diff options
Diffstat (limited to 'configure.in')
-rwxr-xr-x | configure.in | 266 |
1 files changed, 229 insertions, 37 deletions
diff --git a/configure.in b/configure.in index b3a10abc488f..4530aed3a7d0 100755 --- a/configure.in +++ b/configure.in @@ -1,4 +1,3 @@ -dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL) dnl dnl Copyright (c) 1994, 1995, 1996, 1997 dnl The Regents of the University of California. All rights reserved. @@ -15,8 +14,7 @@ dnl # config.sub. # -AC_REVISION($Revision: 1.168 $) -AC_PREREQ(2.50) +AC_PREREQ(2.61) AC_INIT(pcap.c) AC_CANONICAL_SYSTEM @@ -27,6 +25,10 @@ AC_LBL_C_INIT(V_CCOPT, V_INCLS) AC_LBL_SHLIBS_INIT AC_LBL_C_INLINE AC_C___ATTRIBUTE__ +if test "$ac_cv___attribute__" = "yes"; then + AC_C___ATTRIBUTE___UNUSED + AC_C___ATTRIBUTE___FORMAT +fi AC_CHECK_HEADERS(sys/bitypes.h) @@ -346,6 +348,16 @@ AC_MSG_RESULT($V_PCAP) case "$V_PCAP" in dlpi) # + # Needed for common functions used by pcap-[dlpi,libdlpi].c + # + SSRC="dlpisubs.c" + + # + # Checks for some header files. + # + AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) + + # # Checks to see if Solaris has the public libdlpi(3LIB) library. # Note: The existence of /usr/include/libdlpi.h does not mean it is the # public libdlpi(3LIB) version. Before libdlpi was made public, a @@ -359,9 +371,11 @@ dlpi) saved_ldflags=$LDFLAGS LDFLAGS="$LIBS -L/lib" AC_CHECK_LIB(dlpi, dlpi_walk, - LIBS="-ldlpi $LIBS" - V_PCAP=libdlpi - AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]), + [ + LIBS="-ldlpi $LIBS" + V_PCAP=libdlpi + AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]) + ], V_PCAP=dlpi) LDFLAGS=$saved_ldflags @@ -600,7 +614,6 @@ else case "$V_PCAP" in dlpi|libdlpi) - AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) # # This might be Solaris 8 or later, with # SIOCGLIFCONF, or it might be some other OS @@ -624,10 +637,6 @@ else else V_FINDALLDEVS=gifc fi - # - # Needed for common functions used by pcap-[dlpi,libdlpi].c - # - SSRC="dlpisubs.c" ;; *) @@ -1103,6 +1112,45 @@ darwin*) if test "$enable_universal" != "no"; then case "$host_os" in + darwin[0-7].*) + # + # Pre-Tiger. Build only for 32-bit PowerPC; no + # need for any special compiler or linker flags. + # + ;; + + darwin8.[0123]*) + # + # Tiger, prior to Intel support. Build for 32-bit + # PowerPC and 64-bit PowerPC, with 32-bit PowerPC + # first. (I'm guessing that's what Apple does.) + # + V_CCOPT="$V_CCOPT -arch ppc -arch ppc64" + LDFLAGS="$LDFLAGS -arch ppc -arch ppc64" + ;; + + darwin8.[456]*) + # + # Tiger, subsequent to Intel support but prior to + # x86-64 support. Build for 32-bit PowerPC, 64-bit + # PowerPC, and x86, with 32-bit PowerPC first. + # (I'm guessing that's what Apple does.) + # + V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386" + LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386" + ;; + + darwin8.*) + # + # All other Tiger, so subsequent to x86-64 + # support. Build for 32-bit PowerPC, 64-bit + # PowerPC, x86, and x86-64, and with 32-bit PowerPC + # first. (I'm guessing that's what Apple does.) + # + V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" + LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" + ;; + darwin9.*) # # Leopard. Build for 32-bit PowerPC, 64-bit @@ -1127,11 +1175,13 @@ darwin*) LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc" ;; - darwin11.*) + darwin*) # - # Lion. Build for x86-64 and x86, with x86-64 - # first. (That's probably what Apple does, - # given that Rosetta is gone.) + # Post-Snow Leopard. Build for x86-64 and + # x86, with x86-64 first. (That's probably what + # Apple does, given that Rosetta is gone.) + # XXX - update if and when Apple drops support + # for 32-bit x86 code. # V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" @@ -1258,6 +1308,9 @@ test "x$enable_shared" = "xno" && DYEXT="none" AC_PROG_RANLIB AC_CHECK_TOOL([AR], [ar]) +AC_PROG_LN_S +AC_SUBST(LN_S) + AC_LBL_DEVEL(V_CCOPT) AC_LBL_SOCKADDR_SA_LEN @@ -1402,7 +1455,7 @@ AC_SUBST(NETFILTER_SRC) AC_ARG_ENABLE([bluetooth], [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])], [], - [enable_bluetooth=yes]) + [enable_bluetooth=ifsupportavailable]) if test "x$enable_bluetooth" != "xno" ; then dnl check for Bluetooth sniffing support @@ -1432,23 +1485,56 @@ if test "x$enable_bluetooth" != "xno" ; then if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,, [if struct sockaddr_hci has hci_channel member]) + + # + # OK, is HCI_CHANNEL_MONITOR defined? + # + AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined) + AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined, + AC_TRY_COMPILE( +[ +#include <bluetooth/bluetooth.h> +#include <bluetooth/hci.h> +], + [u_int i = HCI_CHANNEL_MONITOR], + ac_cv_lbl_hci_channel_monitor_is_defined=yes, + ac_cv_lbl_hci_channel_monitor_is_defined=no)) + AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined) + if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then + AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,, + [target host supports Bluetooth Monitor]) + BT_MONITOR_SRC=pcap-bt-monitor-linux.c + fi fi + ac_lbl_bluetooth_available=yes ], - AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) + ac_lbl_bluetooth_available=no ) + if test "x$ac_lbl_bluetooth_available" == "xno" ; then + if test "x$enable_bluetooth" = "xyes" ; then + AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) + else + AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) + fi + fi ;; *) - AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) + if test "x$enable_bluetooth" = "xyes" ; then + AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os) + else + AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) + fi ;; esac AC_SUBST(PCAP_SUPPORT_BT) AC_SUBST(BT_SRC) + AC_SUBST(BT_MONITOR_SRC) fi AC_ARG_ENABLE([canusb], [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])], [], - [enable_canusb=yes]) + [enable_canusb=ifsupportavailable]) if test "x$enable_canusb" != "xno" ; then dnl check for canusb support @@ -1456,16 +1542,34 @@ if test "x$enable_canusb" != "xno" ; then linux*) AC_CHECK_HEADER(libusb-1.0/libusb.h, [ - AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb]) - CANUSB_SRC=pcap-canusb-linux.c - LIBS="-lusb-1.0 -lpthread $LIBS" - AC_MSG_NOTICE(canusb sniffing is supported) + AC_CHECK_LIB(usb-1.0, libusb_init, + [ + AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb]) + CANUSB_SRC=pcap-canusb-linux.c + LIBS="-lusb-1.0 -lpthread $LIBS" + ac_lbl_has_libusb=yes + ], + ac_lbl_has_libusb=no + ) ], - AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it) + ac_lbl_has_libusb=no ) + if test "x$ac_lbl_has_libusb" = "xyes" ; then + AC_MSG_NOTICE(canusb sniffing is supported) + else + if test "x$enable_canusb" = "xyes" ; then + AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it) + else + AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it) + fi + fi ;; *) - AC_MSG_NOTICE(no canusb support implemented for $host_os) + if test "x$enable_canusb" = "xyes" ; then + AC_MSG_ERROR(no canusb support implemented for $host_os) + else + AC_MSG_NOTICE(no canusb support implemented for $host_os) + fi ;; esac AC_SUBST(PCAP_SUPPORT_CANUSB) @@ -1475,28 +1579,114 @@ fi AC_ARG_ENABLE([can], [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])], [], - [enable_can=yes]) + [enable_can=ifsupportavailable]) if test "x$enable_can" != "xno" ; then dnl check for CAN sniffing support case "$host_os" in linux*) AC_CHECK_HEADER(linux/can.h, - [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing]) - CAN_SRC=pcap-can-linux.c - AC_MSG_NOTICE(CAN sniffing is supported)], - AC_MSG_NOTICE(CAN sniffing is not supported), + [ + AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing]) + CAN_SRC=pcap-can-linux.c + AC_MSG_NOTICE(CAN sniffing is supported) + ], + [ + if test "x$enable_can" = "xyes" ; then + AC_MSG_ERROR(CAN sniffing is not supported) + else + AC_MSG_NOTICE(CAN sniffing is not supported) + fi + ], [#include <sys/socket.h>] ) ;; *) - AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os) + if test "x$enable_can" = "xyes" ; then + AC_MSG_ERROR(no CAN sniffing support implemented for $host_os) + else + AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os) + fi ;; esac AC_SUBST(PCAP_SUPPORT_CAN) AC_SUBST(CAN_SRC) fi +AC_ARG_ENABLE([dbus], +[AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])], + [], + [enable_dbus=ifavailable]) + +if test "x$enable_dbus" != "xno"; then + if test "x$enable_dbus" = "xyes"; then + case "$host_os" in + + darwin*) + # + # https://bugs.freedesktop.org/show_bug.cgi?id=74029 + # + AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X]) + ;; + esac + else + case "$host_os" in + + darwin*) + # + # https://bugs.freedesktop.org/show_bug.cgi?id=74029 + # + ;; + + *) + AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) + if test "x$PKGCONFIG" != "xno"; then + AC_MSG_CHECKING([for D-Bus]) + if "$PKGCONFIG" dbus-1; then + AC_MSG_RESULT([yes]) + DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1` + DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1` + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + CFLAGS="$CFLAGS $DBUS_CFLAGS" + LIBS="$LIBS $DBUS_LIBS" + AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write) + AC_TRY_LINK( + [#include <string.h> + + #include <time.h> + #include <sys/time.h> + + #include <dbus/dbus.h>], + [return dbus_connection_read_write(NULL, 0);], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing]) + DBUS_SRC=pcap-dbus.c + V_INCLS="$V_INCLS $DBUS_CFLAGS" + ], + [ + AC_MSG_RESULT([no]) + if test "x$enable_dbus" = "xyes"; then + AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()]) + fi + LIBS="$save_LIBS" + ]) + CFLAGS="$save_CFLAGS" + else + AC_MSG_RESULT([no]) + if test "x$enable_dbus" = "xyes"; then + AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed]) + fi + fi + fi + ;; + esac + fi + AC_SUBST(PCAP_SUPPORT_DBUS) + AC_SUBST(DBUS_SRC) +fi + dnl check for hardware timestamp support case "$host_os" in linux*) @@ -1511,14 +1701,16 @@ AC_PROG_INSTALL AC_CONFIG_HEADER(config.h) +AC_OUTPUT_COMMANDS([if test -f .devel; then + echo timestamp > stamp-h + cat Makefile-devel-adds >> Makefile + make depend +fi]) AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap - pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap - pcap_open_dead.3pcap pcap_open_offline.3pcap + pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap + pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap + pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap) - -if test -f .devel ; then - make depend -fi exit 0 |