@@ -393,57 +393,20 @@ AC_DEFUN(AC_LBL_LIBPCAP,
393393 if test $using_local_libpcap = no ; then
394394 #
395395 # We didn't find a local libpcap.
396- # Look for an installed pkg-config.
396+ # First, try finding it with pkg-config.
397397 #
398- if test -n "$PKG_CONFIG" ; then
398+ PKG_CHECK_MODULE(LIBPCAP, libpcap,
399+ [
399400 #
400- # We have it. Are there .pc files for libpcap?
401+ # We found it; use the results as configuration information
402+ # for libpcap.
401403 #
402- # --exists was introduced in pkg-config 0.4.0; that
403- # dates back to late 2000, so we won't worry about
404- # earlier releases that lack it.
404+ $2 ="$LIBPCAP_CFLAGS $$2 "
405+ libpcap="$LIBPCAP_LIBS"
406+ ] ,
407+ [
405408 #
406- AC_MSG_CHECKING ( whether there are .pc files for libpcap )
407- if "$PKG_CONFIG" libpcap --exists ; then
408- #
409- # Yes, so we can use pkg-config to get configuration
410- # information for libpcap.
411- #
412- AC_MSG_RESULT ( yes )
413- pkg_config_usable=yes
414- else
415- #
416- # No, so we can't use pkg-config to get configuration
417- # information for libpcap.
418- #
419- AC_MSG_RESULT ( no )
420- pkg_config_usable=no
421- fi
422- else
423- #
424- # We don't have it, so we obviously can't use it.
425- #
426- pkg_config_usable=no
427- fi
428- if test "$pkg_config_usable" = "yes" ; then
429- #
430- # Found both - use pkg-config to get the include flags for
431- # libpcap and the flags to link with libpcap.
432- #
433- # Please read section 11.6 "Shell Substitutions"
434- # in the autoconf manual before doing anything
435- # to this that involves quoting. Especially note
436- # the statement "There is just no portable way to use
437- # double-quoted strings inside double-quoted back-quoted
438- # expressions (pfew!)."
439- #
440- cflags=`"$PKG_CONFIG" libpcap --cflags`
441- $2 ="$cflags $$2 "
442- libpcap=`"$PKG_CONFIG" libpcap --libs`
443- else
444- #
445- # No pkg-config
446- # Look for an installed pcap-config.
409+ # We didn't find it; look for an installed pcap-config.
447410 #
448411 AC_PATH_TOOL ( PCAP_CONFIG , pcap-config )
449412 if test -n "$PCAP_CONFIG" ; then
@@ -639,7 +602,7 @@ AC_DEFUN(AC_LBL_LIBPCAP,
639602 AC_MSG_RESULT ( found -- - I$d added )
640603 fi
641604 fi
642- fi
605+ ] )
643606 else
644607 #
645608 # We found a local libpcap. Add it to the dependencies for
@@ -965,10 +928,13 @@ fi[]dnl
965928
966929dnl PKG_CHECK_EXISTS(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
967930dnl -------------------------------------------------------------------
968- dnl Since: 0.18
969- dnl
970931dnl Check to see whether a particular module exists. Similar to
971932dnl PKG_CHECK_MODULE(), but does not set variables or print errors.
933+ dnl
934+ dnl --exists was introduced in pkg-config 0.4.0; that dates back to late
935+ dnl 2000, and we require 0.17.0 or later anyway, so we won't worry about
936+ dnl earlier releases that lack it.
937+ dnl
972938AC_DEFUN ( [ PKG_CHECK_EXISTS] ,
973939[
974940if test -n "$PKG_CONFIG" && \
@@ -1038,7 +1004,11 @@ fi[]dnl
10381004dnl PKG_CHECK_MODULE(VARIABLE-PREFIX, MODULE, [ACTION-IF-FOUND],
10391005dnl [ACTION-IF-NOT-FOUND])
10401006dnl --------------------------------------------------------------
1041- dnl Since: 0.4.0
1007+ dnl Check to see whether a particular module exists and, if it
1008+ dnl does, set <MODULE>_CFLAGS, <MODULE>_LIBS, and <MODULE>_LIBS_STATIC
1009+ dnl to the results of --cflags, --libs, and --libs --static,
1010+ dnl respectively.
1011+ dnl
10421012AC_DEFUN ( [ PKG_CHECK_MODULE] ,
10431013[
10441014if test -n "$PKG_CONFIG"; then
0 commit comments