]> The Tcpdump Group git mirrors - libpcap/commitdiff
If we don't have any support for packet capturing, don't bother
authorguy <guy>
Thu, 16 Dec 2004 22:22:20 +0000 (22:22 +0000)
committerguy <guy>
Thu, 16 Dec 2004 22:22:20 +0000 (22:22 +0000)
supplying a non-stub version of "pcap_findalldevs()", as a list of
devices won't do any good for a capture program.

Don't bother checking for "ifaddrs.h" unless we have "getifaddrs()" -
and if we have "getifaddrs()" but don't have a usable "ifaddrs.h",
report an error, rather than leaving the error for the compile stage.

config.h.in
configure
configure.in

index 50c939f5de0159b778e9588a35fb563315c9c1ca..86d7c821cd3252c6995f9baa2fe8640737eb8178 100644 (file)
@@ -10,7 +10,7 @@
 /* Enable optimizer debugging */
 #undef BDEBUG
 
-/* define if you have a DAG API */
+/* define if you have the DAG API */
 #undef HAVE_DAG_API
 
 /* define if you have a /dev/dlpi */
@@ -28,9 +28,6 @@
 /* if ppa_info_t_dl_module_id exists */
 #undef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1
 
-/* Define to 1 if you have the <ifaddrs.h> header file. */
-#undef HAVE_IFADDRS_H
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
index 6a6fc9b6a7e3d539dd52ffadd34741c06c46ffc4..7d163f424df9e0b047f900e5d37b48db7da0a8ab 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.108 .
+# From configure.in Revision: 1.109 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57.
 #
@@ -3333,8 +3333,7 @@ done
 
 
 
-
-for ac_header in sys/ioccom.h sys/sockio.h ifaddrs.h limits.h
+for ac_header in sys/ioccom.h sys/sockio.h limits.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -3848,7 +3847,15 @@ fi
 echo "$as_me:$LINENO: result: $V_PCAP" >&5
 echo "${ECHO_T}$V_PCAP" >&6
 
-echo "$as_me:$LINENO: checking for getifaddrs" >&5
+if test "$V_PCAP" = null
+then
+       #
+       # We can't capture, so we can't open any capture
+       # devices, so we won't return any interfaces.
+       #
+       V_FINDALLDEVS=null
+else
+       echo "$as_me:$LINENO: checking for getifaddrs" >&5
 echo $ECHO_N "checking for getifaddrs... $ECHO_C" >&6
 if test "${ac_cv_func_getifaddrs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3922,30 +3929,187 @@ echo "$as_me:$LINENO: result: $ac_cv_func_getifaddrs" >&5
 echo "${ECHO_T}$ac_cv_func_getifaddrs" >&6
 if test $ac_cv_func_getifaddrs = yes; then
 
-       #
-       # We have "getifaddrs()", so we use that to get the list
-       #
-       V_FINDALLDEVS=getad
+               #
+               # We have "getifaddrs()"; make sure we have <ifaddrs.h>
+               # as well, just in case some platform is really weird.
+               #
+               if test "${ac_cv_header_ifaddrs_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for ifaddrs.h" >&5
+echo $ECHO_N "checking for ifaddrs.h... $ECHO_C" >&6
+if test "${ac_cv_header_ifaddrs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_ifaddrs_h" >&5
+echo "${ECHO_T}$ac_cv_header_ifaddrs_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking ifaddrs.h usability" >&5
+echo $ECHO_N "checking ifaddrs.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <ifaddrs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking ifaddrs.h presence" >&5
+echo $ECHO_N "checking ifaddrs.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ifaddrs.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
 else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-       #
-       # Well, we don't have "getifaddrs()", so we have to use some
-       # other mechanism; determine what that mechanism is.
-       #
-       # The first thing we use is the type of capture mechanism,
-       # which is somewhat of a proxy for the OS we're using.
-       #
-       case "$V_PCAP" in
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: ifaddrs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ifaddrs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ifaddrs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ifaddrs.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to [email protected]. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: ifaddrs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ifaddrs.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ifaddrs.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ifaddrs.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ifaddrs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ifaddrs.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to [email protected]. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for ifaddrs.h" >&5
+echo $ECHO_N "checking for ifaddrs.h... $ECHO_C" >&6
+if test "${ac_cv_header_ifaddrs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_ifaddrs_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_ifaddrs_h" >&5
+echo "${ECHO_T}$ac_cv_header_ifaddrs_h" >&6
+
+fi
+if test $ac_cv_header_ifaddrs_h = yes; then
+
+                   #
+                   # We have the header, so we use "getifaddrs()" to
+                   # get the list of interfaces.
+                   #
+                   V_FINDALLDEVS=getad
+
+else
+
+                   #
+                   # We don't have the header - give up.
+                   # XXX - we could also fall back on some other
+                   # mechanism, but, for now, this'll catch this
+                   # problem so that we can at least try to figure
+                   # out something to do on systems with "getifaddrs()"
+                   # but without "ifaddrs.h", if there is something
+                   # we can do on those systems.
+                   #
+                   { { echo "$as_me:$LINENO: error: Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>." >&5
+echo "$as_me: error: Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>." >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+
+
+else
 
-       dlpi)
                #
-               # This might be Solaris 8 or later, with SIOCGLIFCONF,
-               # or it might be some other OS, with just SIOCGIFCONF.
+               # Well, we don't have "getifaddrs()", so we have to use
+               # some other mechanism; determine what that mechanism is.
                #
-               echo "$as_me:$LINENO: checking whether we have SIOCGLIFCONF" >&5
+               # The first thing we use is the type of capture mechanism,
+               # which is somewhat of a proxy for the OS we're using.
+               #
+               case "$V_PCAP" in
+
+               dlpi)
+                       #
+                       # This might be Solaris 8 or later, with
+                       # SIOCGLIFCONF, or it might be some other OS
+                       # or some older version of Solaris, with
+                       # just SIOCGIFCONF.
+                       #
+                       echo "$as_me:$LINENO: checking whether we have SIOCGLIFCONF" >&5
 echo $ECHO_N "checking whether we have SIOCGLIFCONF... $ECHO_C" >&6
-               if test "${ac_cv_lbl_have_siocglifconf+set}" = set; then
+                       if test "${ac_cv_lbl_have_siocglifconf+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -3956,10 +4120,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/param.h>
-                       #include <sys/file.h>
-                       #include <sys/ioctl.h>
-                       #include <sys/socket.h>
-                       #include <sys/sockio.h>
+                               #include <sys/file.h>
+                               #include <sys/ioctl.h>
+                               #include <sys/socket.h>
+                               #include <sys/sockio.h>
 int
 main ()
 {
@@ -3990,35 +4154,28 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-               echo "$as_me:$LINENO: result: $ac_cv_lbl_have_siocglifconf" >&5
+                       echo "$as_me:$LINENO: result: $ac_cv_lbl_have_siocglifconf" >&5
 echo "${ECHO_T}$ac_cv_lbl_have_siocglifconf" >&6
-               if test $ac_cv_lbl_have_siocglifconf = yes ; then
-                       V_FINDALLDEVS=glifc
-               else
+                       if test $ac_cv_lbl_have_siocglifconf = yes ; then
+                               V_FINDALLDEVS=glifc
+                       else
+                               V_FINDALLDEVS=gifc
+                       fi
+                       ;;
+
+               *)
+                       #
+                       # Assume we just have SIOCGIFCONF.
+                       # (XXX - on at least later Linux kernels, there's
+                       # another mechanism, and we should be using that
+                       # instead.)
+                       #
                        V_FINDALLDEVS=gifc
-               fi
-               ;;
-
-       null)
-               #
-               # We can't capture, so we can't open any capture
-               # devices, so we won't return any interfaces.
-               #
-               V_FINDALLDEVS=null
-               ;;
-
-       *)
-               #
-               # Assume we just have SIOCGIFCONF.
-               # (XXX - on at least later Linux kernels, there's
-               # another mechanism, and we should be using that
-               # instead.)
-               #
-               V_FINDALLDEVS=gifc
-               ;;
-       esac
+                       ;;
+               esac
 fi
 
+fi
 
 echo "$as_me:$LINENO: checking if --enable-ipv6 option is specified" >&5
 echo $ECHO_N "checking if --enable-ipv6 option is specified... $ECHO_C" >&6
index 999eb0e365c2b2a8a0b4d423c7384ba4c2d89c3f..b65d4b9dfc17a00e53b35acf2a65ad77e61371e5 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.108 2004-11-09 18:32:22 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.109 2004-12-16 22:22:20 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.108 $)
+AC_REVISION($Revision: 1.109 $)
 AC_PREREQ(2.50)
 AC_INIT(pcap.c)
 
@@ -26,7 +26,7 @@ dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
 dnl
-AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h)
+AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h)
 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
 #include <sys/socket.h>])
 
@@ -105,65 +105,88 @@ fi
 AC_MSG_RESULT($V_PCAP)
 
 dnl
-dnl Now figure out how we get a list of interfaces and addresses.
+dnl Now figure out how we get a list of interfaces and addresses,
+dnl if we support capturing.  Don't bother if we don't support
+dnl capturing.
 dnl
-AC_CHECK_FUNC(getifaddrs,[
+if test "$V_PCAP" = null
+then
        #
-       # We have "getifaddrs()", so we use that to get the list
+       # We can't capture, so we can't open any capture
+       # devices, so we won't return any interfaces.
        #
-       V_FINDALLDEVS=getad
-],[
-       #
-       # Well, we don't have "getifaddrs()", so we have to use some
-       # other mechanism; determine what that mechanism is.
-       #
-       # The first thing we use is the type of capture mechanism,
-       # which is somewhat of a proxy for the OS we're using.
-       #
-       case "$V_PCAP" in
-
-       dlpi)
-               #
-               # This might be Solaris 8 or later, with SIOCGLIFCONF,
-               # or it might be some other OS, with just SIOCGIFCONF.
+       V_FINDALLDEVS=null
+else
+       AC_CHECK_FUNC(getifaddrs,[
                #
-               AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
-               AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
-                   AC_TRY_COMPILE(
-                       [#include <sys/param.h>
-                       #include <sys/file.h>
-                       #include <sys/ioctl.h>
-                       #include <sys/socket.h>
-                       #include <sys/sockio.h>],
-                       [ioctl(0, SIOCGLIFCONF, (char *)0);],
-                       ac_cv_lbl_have_siocglifconf=yes,
-                       ac_cv_lbl_have_siocglifconf=no))
-               AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
-               if test $ac_cv_lbl_have_siocglifconf = yes ; then
-                       V_FINDALLDEVS=glifc
-               else
-                       V_FINDALLDEVS=gifc
-               fi
-               ;;
-
-       null)
+               # We have "getifaddrs()"; make sure we have <ifaddrs.h>
+               # as well, just in case some platform is really weird.
                #
-               # We can't capture, so we can't open any capture
-               # devices, so we won't return any interfaces.
+               AC_CHECK_HEADER(ifaddrs.h,[
+                   #
+                   # We have the header, so we use "getifaddrs()" to
+                   # get the list of interfaces.
+                   #
+                   V_FINDALLDEVS=getad
+               ],[
+                   #
+                   # We don't have the header - give up.
+                   # XXX - we could also fall back on some other
+                   # mechanism, but, for now, this'll catch this
+                   # problem so that we can at least try to figure
+                   # out something to do on systems with "getifaddrs()"
+                   # but without "ifaddrs.h", if there is something
+                   # we can do on those systems.
+                   #
+                   AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
+               ])
+       ],[
                #
-               V_FINDALLDEVS=null
-               ;;
-
-       *)
+               # Well, we don't have "getifaddrs()", so we have to use
+               # some other mechanism; determine what that mechanism is.
                #
-               # Assume we just have SIOCGIFCONF.
-               # (XXX - on at least later Linux kernels, there's
-               # another mechanism, and we should be using that
-               # instead.)
+               # The first thing we use is the type of capture mechanism,
+               # which is somewhat of a proxy for the OS we're using.
                #
-               V_FINDALLDEVS=gifc
-               ;;
-       esac])
+               case "$V_PCAP" in
+
+               dlpi)
+                       #
+                       # This might be Solaris 8 or later, with
+                       # SIOCGLIFCONF, or it might be some other OS
+                       # or some older version of Solaris, with
+                       # just SIOCGIFCONF.
+                       #
+                       AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
+                       AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
+                           AC_TRY_COMPILE(
+                               [#include <sys/param.h>
+                               #include <sys/file.h>
+                               #include <sys/ioctl.h>
+                               #include <sys/socket.h>
+                               #include <sys/sockio.h>],
+                               [ioctl(0, SIOCGLIFCONF, (char *)0);],
+                               ac_cv_lbl_have_siocglifconf=yes,
+                               ac_cv_lbl_have_siocglifconf=no))
+                       AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
+                       if test $ac_cv_lbl_have_siocglifconf = yes ; then
+                               V_FINDALLDEVS=glifc
+                       else
+                               V_FINDALLDEVS=gifc
+                       fi
+                       ;;
+
+               *)
+                       #
+                       # Assume we just have SIOCGIFCONF.
+                       # (XXX - on at least later Linux kernels, there's
+                       # another mechanism, and we should be using that
+                       # instead.)
+                       #
+                       V_FINDALLDEVS=gifc
+                       ;;
+               esac])
+fi
 
 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
 AC_ARG_ENABLE(ipv6, [  --enable-ipv6           build IPv6-capable version])