@@ -393,57 +393,20 @@ AC_DEFUN(AC_LBL_LIBPCAP,
393
393
if test $using_local_libpcap = no ; then
394
394
#
395
395
# We didn't find a local libpcap.
396
- # Look for an installed pkg-config.
396
+ # First, try finding it with pkg-config.
397
397
#
398
- if test -n "$PKG_CONFIG" ; then
398
+ PKG_CHECK_MODULE(LIBPCAP, libpcap,
399
+ [
399
400
#
400
- # We have it. Are there .pc files for libpcap?
401
+ # We found it; use the results as configuration information
402
+ # for libpcap.
401
403
#
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
+ [
405
408
#
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.
447
410
#
448
411
AC_PATH_TOOL ( PCAP_CONFIG , pcap-config )
449
412
if test -n "$PCAP_CONFIG" ; then
@@ -639,7 +602,7 @@ AC_DEFUN(AC_LBL_LIBPCAP,
639
602
AC_MSG_RESULT ( found -- - I$d added )
640
603
fi
641
604
fi
642
- fi
605
+ ] )
643
606
else
644
607
#
645
608
# We found a local libpcap. Add it to the dependencies for
@@ -965,10 +928,13 @@ fi[]dnl
965
928
966
929
dnl PKG_CHECK_EXISTS(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
967
930
dnl -------------------------------------------------------------------
968
- dnl Since: 0.18
969
- dnl
970
931
dnl Check to see whether a particular module exists. Similar to
971
932
dnl 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
972
938
AC_DEFUN ( [ PKG_CHECK_EXISTS] ,
973
939
[
974
940
if test -n "$PKG_CONFIG" && \
@@ -1038,7 +1004,11 @@ fi[]dnl
1038
1004
dnl PKG_CHECK_MODULE(VARIABLE-PREFIX, MODULE, [ACTION-IF-FOUND],
1039
1005
dnl [ACTION-IF-NOT-FOUND])
1040
1006
dnl --------------------------------------------------------------
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
1042
1012
AC_DEFUN ( [ PKG_CHECK_MODULE] ,
1043
1013
[
1044
1014
if test -n "$PKG_CONFIG"; then
0 commit comments