]> The Tcpdump Group git mirrors - tcpdump/commitdiff
autoconf: replace --with-system-libpcap with --disable-local-libpcap.
authorGuy Harris <[email protected]>
Mon, 20 Jul 2020 03:12:32 +0000 (20:12 -0700)
committerGuy Harris <[email protected]>
Mon, 20 Jul 2020 03:12:32 +0000 (20:12 -0700)
--with-system-libpcap didn't work - it didn't prevent searching for a
local libpcap - and had a misleading name.  Replace it with
--disable-local-libpcap.

This should address GitHub issue #823.

aclocal.m4
configure

index b95e64c68a58b3a29b3c2b37784473a05ae87033..9c95b8b89625bc62c417e6742fdfd0da844f14de 100644 (file)
@@ -472,52 +472,61 @@ AC_DEFUN(AC_LBL_LIBPCAP,
         fi
     fi
     libpcap=FAIL
-    AC_ARG_WITH([system-libpcap],
-        [AS_HELP_STRING([--with-system-libpcap], [don't use local pcap library])],
-        [
+    AC_MSG_CHECKING([whether to look for a local libpcap])
+    AC_ARG_ENABLE(local-libpcap,
+        AS_HELP_STRING([--disable-local-libpcap],
+                       [don't look for a local libpcap @<:@default=check for a local libpcap@:>@]),,
+        enableval=yes)
+    case "$enableval" in
+
+    no)
+        AC_MSG_RESULT(no)
+        #
+        # Don't look for a local libpcap.
+        #
+        using_local_libpcap=no
+        ;;
+       
+    *)
+        AC_MSG_RESULT(yes)
+        #
+        # Look for a local pcap library.
+        #
+        AC_MSG_CHECKING(for local pcap library)
+        lastdir=FAIL
+        places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
+            egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
+        places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+            egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
+        for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+            basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \
+                sed -e 's/-PRE-GIT$//' `
+            if test $lastdir = $basedir ; then
+                dnl skip alphas when an actual release is present
+                continue;
+            fi
+            lastdir=$dir
+            if test -r $dir/libpcap.a ; then
+                libpcap=$dir/libpcap.a
+                local_pcap_dir=$dir
+                dnl continue and select the last one that exists
+            fi
+        done
+        if test $libpcap = FAIL ; then
             #
-            # Don't look for a local libpcap.
+            # We didn't find a local libpcap.
             #
-            using_local_libpcap=no
-        ],
-        [
+            AC_MSG_RESULT(not found)
+            using_local_libpcap=no;
+        else
             #
-            # Look for a local pcap library.
+            # We found a local libpcap.
             #
-            AC_MSG_CHECKING(for local pcap library)
-            lastdir=FAIL
-            places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
-                egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
-            places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
-                egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
-            for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
-                basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \
-                    sed -e 's/-PRE-GIT$//' `
-                if test $lastdir = $basedir ; then
-                    dnl skip alphas when an actual release is present
-                    continue;
-                fi
-                lastdir=$dir
-                if test -r $dir/libpcap.a ; then
-                    libpcap=$dir/libpcap.a
-                    local_pcap_dir=$dir
-                    dnl continue and select the last one that exists
-                fi
-            done
-            if test $libpcap = FAIL ; then
-                #
-                # We didn't find a local libpcap.
-                #
-                AC_MSG_RESULT(not found)
-                using_local_libpcap=no;
-            else
-                #
-                # We found a local libpcap.
-                #
-                AC_MSG_RESULT($libpcap)
-                using_local_libpcap=yes
-            fi
-        ])
+            AC_MSG_RESULT($libpcap)
+            using_local_libpcap=yes
+        fi
+        ;;
+    esac
 
     if test $using_local_libpcap = no ; then
         #
index 721352dca1d3c384267205901609b57d9c7a7a9f..c9b545eb662c4838b4bcb4ef4cce843c10076778 100755 (executable)
--- a/configure
+++ b/configure
@@ -676,7 +676,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -706,7 +705,7 @@ enable_smb
 with_user
 with_chroot
 with_sandbox_capsicum
-with_system_libpcap
+enable_local_libpcap
 with_crypto
 with_cap_ng
 '
@@ -757,7 +756,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1010,15 +1008,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1156,7 +1145,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1309,7 +1298,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1346,6 +1334,8 @@ Optional Features:
   --disable-universal     don't build universal on macOS
   --enable-smb            enable possibly-buggy SMB printer default=yes
   --disable-smb           disable possibly-buggy SMB printer
+  --disable-local-libpcap don't look for a local libpcap [default=check for a
+                          local libpcap]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1357,7 +1347,6 @@ Optional Packages:
   --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY
   --with-sandbox-capsicum use Capsicum security functions [default=yes, if
                           available]
-  --with-system-libpcap   don't use local pcap library
   --with-crypto[=DIR]     use OpenSSL/libressl libcrypto (located in directory
                           DIR, if specified) [default=yes, if available]
   --with-cap-ng           use libcap-ng [default=yes, if available]
@@ -5130,57 +5119,68 @@ $as_echo "Using $pfopen" >&6; }
         fi
     fi
     libpcap=FAIL
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to look for a local libpcap" >&5
+$as_echo_n "checking whether to look for a local libpcap... " >&6; }
+    # Check whether --enable-local-libpcap was given.
+if test "${enable_local_libpcap+set}" = set; then :
+  enableval=$enable_local_libpcap;
+else
+  enableval=yes
+fi
 
-# Check whether --with-system-libpcap was given.
-if test "${with_system_libpcap+set}" = set; then :
-  withval=$with_system_libpcap;
-            #
-            # Don't look for a local libpcap.
-            #
-            using_local_libpcap=no
+    case "$enableval" in
 
-else
+    no)
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        #
+        # Don't look for a local libpcap.
+        #
+        using_local_libpcap=no
+        ;;
 
+    *)
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        #
+        # Look for a local pcap library.
+        #
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5
+$as_echo_n "checking for local pcap library... " >&6; }
+        lastdir=FAIL
+        places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
+            egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
+        places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+            egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
+        for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+            basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \
+                sed -e 's/-PRE-GIT$//' `
+            if test $lastdir = $basedir ; then
+                                continue;
+            fi
+            lastdir=$dir
+            if test -r $dir/libpcap.a ; then
+                libpcap=$dir/libpcap.a
+                local_pcap_dir=$dir
+                            fi
+        done
+        if test $libpcap = FAIL ; then
             #
-            # Look for a local pcap library.
+            # We didn't find a local libpcap.
             #
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5
-$as_echo_n "checking for local pcap library... " >&6; }
-            lastdir=FAIL
-            places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
-                egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
-            places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
-                egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
-            for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
-                basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \
-                    sed -e 's/-PRE-GIT$//' `
-                if test $lastdir = $basedir ; then
-                                        continue;
-                fi
-                lastdir=$dir
-                if test -r $dir/libpcap.a ; then
-                    libpcap=$dir/libpcap.a
-                    local_pcap_dir=$dir
-                                    fi
-            done
-            if test $libpcap = FAIL ; then
-                #
-                # We didn't find a local libpcap.
-                #
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-                using_local_libpcap=no;
-            else
-                #
-                # We found a local libpcap.
-                #
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5
+            using_local_libpcap=no;
+        else
+            #
+            # We found a local libpcap.
+            #
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5
 $as_echo "$libpcap" >&6; }
-                using_local_libpcap=yes
-            fi
-
-fi
-
+            using_local_libpcap=yes
+        fi
+        ;;
+    esac
 
     if test $using_local_libpcap = no ; then
         #