Add #ifndef __PRIVILEGES_H__ / #define / #endif logic to prevent multiple
[obnox/wireshark/wip.git] / configure.in
index 57f7aa541266338e62bee372e749a9e2352e1a4a..27de1d7ab4f543dbdcb677e732a296394f2d3322 100644 (file)
@@ -2,7 +2,7 @@
 #
 AC_PREREQ(2.60)
 
-AC_INIT(wireshark, 1.3.5)
+AC_INIT(wireshark, 1.5.0)
 
 dnl Check for CPU / vendor / OS
 dnl The user is encouraged to use either `AC_CANONICAL_BUILD', or
@@ -302,6 +302,8 @@ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security)
+# Use the faster pre gcc 4.5 floating point precision
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-fexcess-precision=fast)
 
 AC_WIRESHARK_GCC_LDFLAGS_CHECK([-Wl,--as-needed])
 # AC_WIRESHARK_GCC_LDFLAGS_CHECK([-flto])
@@ -461,8 +463,9 @@ case "$host_os" in
 darwin*)
        AC_MSG_CHECKING([whether we can build with Core Foundation, Launch Services, and Core Services])
        ac_save_LIBS="$LIBS"
-       ac_frameworks="-framework ApplicationServices -framework CoreFoundation -framework CoreServices"
-       LIBS="$LIBS $ac_frameworks"
+       ac_coreservices_frameworks="-framework CoreServices"
+       ac_launchservices_frameworks="-framework ApplicationServices -framework CoreFoundation $ac_coreservices_frameworks"
+       LIBS="$LIBS $ac_launchservices_frameworks $ac_coreservices_frameworks"
        AC_TRY_LINK(
           [
 #       include <CoreFoundation/CFBase.h>
@@ -488,7 +491,8 @@ darwin*)
           [echo $ac_n "cross compiling; assumed OK... $ac_c"])
        if test "$ac_cv_can_use_osx_frameworks" = yes ; then
                AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
-               FRAMEWORKS="$ac_frameworks"
+               CORESERVICES_FRAMEWORKS="$ac_coreservices_frameworks"
+               LAUNCHSERVICES_FRAMEWORKS="$ac_launchservices_frameworks"
                AC_MSG_RESULT(yes)
        else
                AC_MSG_RESULT(no)
@@ -496,7 +500,8 @@ darwin*)
        LIBS="$ac_save_LIBS"
        ;;
 esac
-AC_SUBST(FRAMEWORKS)
+AC_SUBST(CORESERVICES_FRAMEWORKS)
+AC_SUBST(LAUNCHSERVICES_FRAMEWORKS)
 
 #
 # If using $prefix we add "$prefix/include" to the include search path
@@ -533,20 +538,24 @@ AC_ARG_ENABLE(usr-local,
 
 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
-       AC_MSG_RESULT(yes)
-       #
-       # Arrange that we search for header files in the source directory
-       # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
-       # as various packages we use ("libpcap", "zlib", "adns", "pcre")
-       # may have been installed under "/usr/local/include".
-       #
-       CFLAGS="$CFLAGS -I/usr/local/include"
-       CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+       if test -d "/usr/local"; then
+               AC_MSG_RESULT(yes)
+               #
+               # Arrange that we search for header files in the source directory
+               # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
+               # as various packages we use ("libpcap", "zlib", "adns", "pcre")
+               # may have been installed under "/usr/local/include".
+               #
+               CFLAGS="$CFLAGS -I/usr/local/include"
+               CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 
-       #
-       # Arrange that we search for libraries in "/usr/local/lib".
-       #
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
+               #
+               # Arrange that we search for libraries in "/usr/local/lib".
+               #
+               AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
+       else
+               AC_MSG_RESULT(no)
+       fi
 else
        AC_MSG_RESULT(no)
 fi
@@ -645,6 +654,17 @@ datafiledir=`(
 )`
 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
 
+# Create DOC_DIR #define for config.h
+docdir=`(
+    test "x$prefix" = xNONE && prefix=$ac_default_prefix
+    test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
+    # Ugly hack, but I don't see how this problem can be solved
+    # properly that DOC_DIR had a value starting with
+    # "${prefix}/" instead of e.g. "/usr/local/"
+    eval eval echo "$docdir"
+)`
+AC_DEFINE_UNQUOTED(DOC_DIR, "$docdir", [Directory for docs])
+
 # GTK checks; we require GTK+ 2.4 or later.
 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
 # programs to be built with GTK+.
@@ -654,6 +674,7 @@ if test "x$enable_wireshark" = "xyes"; then
        [
                CFLAGS="$CFLAGS $GTK_CFLAGS"
                CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
+               AC_DEFINE(HAVE_GTK, 1, [Define to 1 if compiling with GTK])
        ], GTK_OK=no, gthread)
 else
        GTK_OK=no
@@ -798,30 +819,36 @@ main(void)
        AC_MSG_RESULT($ac_cv_dladdr_finds_executable_path)
 fi
 
-dnl IGE Mac integration check
-AC_MSG_CHECKING(whether to use IGE Mac integration functions)
-
-AC_ARG_WITH(ige-mac-integration,
-  AC_HELP_STRING( [--with-ige-mac-integration],
-                  [use IGE Mac integration. (@<:@default=yes, if available@:>@]),
-[
-    if test $withval = no
-    then
-        want_ige_mac_integration=no
+if test "x$no_gtk" != "xyes"
+then
+    #
+    # We have GTK+; do we want the OS X integration functions and,
+    # if so, do we have them and, if so, which versions do we have,
+    # the old Carbon-based ones or the new Cocoa-based ones?
+    #
+    AC_MSG_CHECKING(whether to use OS X integration functions)
+
+    AC_ARG_WITH(osx-integration,
+      AC_HELP_STRING( [--with-osx-integration],
+                      [use OS X integration functions (@<:@default=yes, if available@:>@]),
+    [
+        if test $withval = no
+        then
+            want_osx_integration=no
+        else
+            want_osx_integration=yes
+        fi
+    ],[
+        want_osx_integration=yes
+    ])
+    if test "x$want_osx_integration" = "xno"; then
+        AC_MSG_RESULT(no)
     else
-        want_ige_mac_integration=yes
+        AC_MSG_RESULT(yes)
+        AC_WIRESHARK_OSX_INTEGRATION_CHECK
     fi
-],[
-    want_ige_mac_integration=yes
-])
-if test "x$want_ige_mac_integration" = "xno" -o "x$no_gtk" = "xyes" ; then
-    AC_MSG_RESULT(no)
-else
-    AC_MSG_RESULT(yes)
-    AC_WIRESHARK_IGE_MAC_INTEGRATION_CHECK
 fi
 
-
 AC_SUBST(wireshark_bin)
 AC_SUBST(wireshark_man)
 
@@ -947,10 +974,13 @@ AC_ARG_ENABLE(dftest,
 
 if test "x$enable_dftest" = "xyes" ; then
        dftest_bin="dftest\$(EXEEXT)"
+       dftest_man="dftest.1"
 else
        dftest_bin=""
+       dftest_man=""
 fi
 AC_SUBST(dftest_bin)
+AC_SUBST(dftest_man)
 
 
 # Enable/disable randpkt
@@ -962,10 +992,13 @@ AC_ARG_ENABLE(randpkt,
 
 if test "x$enable_randpkt" = "xyes" ; then
        randpkt_bin="randpkt\$(EXEEXT)"
+       randpkt_man="randpkt.1"
 else
        randpkt_bin=""
+       randpkt_man=""
 fi
 AC_SUBST(randpkt_bin)
+AC_SUBST(randpkt_man)
 
 
 
@@ -1072,7 +1105,8 @@ dnl pcap remote check
 AC_MSG_CHECKING(whether to use libpcap remote capturing feature)
 
 AC_ARG_WITH(pcap-remote,
-[  --with-pcap-remote        use libpcap remote capturing (requires libpcap)],
+    AC_HELP_STRING([--with-pcap-remote],
+                   [use libpcap remote capturing (requires libpcap)]),
 [
     if test $withval = no
     then
@@ -1094,8 +1128,8 @@ dnl zlib check
 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
 
 AC_ARG_WITH(zlib,
-  AC_HELP_STRING( [--with-zlib@<:@=DIR@:>@],
-                  [use zlib (located in directory DIR, if supplied) to read compressed data.  @<:@default=yes, if available@:>@]),
+  AC_HELP_STRING([--with-zlib@<:@=DIR@:>@],
+                 [use zlib (located in directory DIR, if supplied) to read compressed data.  @<:@default=yes, if available@:>@]),
 [
        if test $withval = no
        then
@@ -1124,6 +1158,12 @@ else
        fi
 fi
 
+if test "x$want_zlib" != "xno" ; then
+       AC_CHECK_LIB(z, gzclearerr,
+       [
+               AC_DEFINE(HAVE_GZCLEARERR, 1, [Define if we have gzclearerr])
+       ])
+fi
 
 dnl pcre check
 AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters)
@@ -1251,6 +1291,28 @@ else
 fi
 
 
+dnl Check if dumpcap should be installed with filesystem capabilities
+AC_PATH_PROG(SETCAP, setcap)
+AC_ARG_ENABLE(setcap-install,
+  AC_HELP_STRING( [--enable-setcap-install],
+                  [install dumpcap with cap_net_admin and cap_net_raw @<:@default=no@:>@]),
+    enable_setcap_install=$enableval,enable_setcap_install=no)
+
+AC_MSG_CHECKING(whether to install dumpcap with cap_net_admin and cap_net_raw capabilities)
+if test "x$enable_setcap_install" = "xno" ; then
+       AC_MSG_RESULT(no)
+else
+       if test "x$SETCAP" = "x" ; then
+               AC_MSG_RESULT(no. Setcap not found)
+       elif test "x$enable_dumpcap" = "xno" ; then
+               AC_MSG_ERROR(Setcap install works only with dumpcap but dumpcap is disabled)
+       else
+               AC_MSG_RESULT(yes)
+       fi
+fi
+
+AM_CONDITIONAL(SETCAP_INSTALL, test x$enable_setcap_install = xyes)
+
 dnl Check if dumpcap should be installed setuid
 AC_ARG_ENABLE(setuid-install,
   AC_HELP_STRING( [--enable-setuid-install],
@@ -1261,7 +1323,10 @@ AC_MSG_CHECKING(whether to install dumpcap setuid)
 if test "x$enable_setuid_install" = "xno" ; then
        AC_MSG_RESULT(no)
 else
-       if test "x$enable_dumpcap" = "xno" ; then
+       if test "x$enable_setcap_install" = "xyes" ; then
+               enable_setuid_install=no
+               AC_MSG_RESULT(no; using setcap instead)
+       elif test "x$enable_dumpcap" = "xno" ; then
                AC_MSG_ERROR(Setuid install works only with dumpcap but dumpcap is disabled)
        else
                AC_MSG_RESULT(yes)
@@ -1271,6 +1336,22 @@ fi
 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
 AC_CHECK_FUNCS(setresuid setresgid)
 
+dnl ...but our Network Operations group is named "no"!
+DUMPCAP_GROUP=''
+AC_ARG_WITH(dumpcap-group,
+  AC_HELP_STRING( [--with-dumpcap-group=GROUP],
+                  [restrict dumpcap to GROUP]),
+[
+  if test "x$withval" = "xyes"; then
+      AC_MSG_ERROR([No dumpcap group specified.])
+  elif test "x$withval" != "xno"; then
+      AC_MSG_RESULT($withval)
+      DUMPCAP_GROUP="$withval"
+  fi
+])
+AC_SUBST(DUMPCAP_GROUP)
+AM_CONDITIONAL(HAVE_DUMPCAP_GROUP, test x$DUMPCAP_GROUP != x)
+
 dnl libcap (not libpcap) check
 LIBCAP_LIBS=''
 AC_MSG_CHECKING(whether to use the libcap capabilities library)
@@ -1445,7 +1526,7 @@ AC_SUBST(GEOIP_LIBS)
 dnl Python devel Check
 AC_ARG_WITH(python,
     AC_HELP_STRING( [--with-python@<:@=DIR@:>@],
-                    [use python interpretor (installed in DIR, if supplied). @<:@default=no@:>@ (EXPERIMENTAL)]),
+                    [use python interpreter (installed in DIR, if supplied). @<:@default=yes@:>@ (EXPERIMENTAL)]),
 [
 pythondir='${libdir}/wireshark/python/${VERSION}'
 if test "x$withval" = "xno"; then
@@ -1470,7 +1551,7 @@ AC_DEFINE(WS_VAR_IMPORT, extern, [Define as the string to precede external varia
 
 AC_ARG_ENABLE(airpcap,
   AC_HELP_STRING( [--enable-airpcap],
-                  [use airpcap in wireshark.  @<:@default=no@:>@]),
+                  [use airpcap in wireshark.  @<:@default=yes@:>@]),
   enable_airpcap=$enableval
   if test x$enable_airpcap != xno; then
        AC_DEFINE(HAVE_AIRPCAP, 1, [Enable AirPcap])
@@ -1500,63 +1581,44 @@ AC_C_BIGENDIAN
 # XXX - do we need this?
 AC_PROG_GCC_TRADITIONAL
 
-GETOPT_C=""
-GETOPT_O=""
+GETOPT_LO=""
 AC_CHECK_FUNC(getopt,
-  [GETOPT_O=""
+  [GETOPT_LO=""
    AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the <getopt.h> header file.])
   ],
-  GETOPT_O="wsgetopt.o"
+  GETOPT_LO="wsgetopt.lo"
 )
 if test "$ac_cv_func_getopt" = no ; then
-  GETOPT_C="wsgetopt.c"
-  GETOPT_O="wsgetopt.o"
+  GETOPT_LO="wsgetopt.lo"
 fi
-AC_SUBST(GETOPT_C)
-AC_SUBST(GETOPT_O)
+AC_SUBST(GETOPT_LO)
 
-AC_CHECK_FUNC(strerror, STRERROR_O="",
-  [STRERROR_O="strerror.o"
+AC_CHECK_FUNC(strerror, STRERROR_LO="",
+  [STRERROR_LO="strerror.lo"
    AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
 ])
 if test "$ac_cv_func_strerror" = no ; then
-  STRERROR_C="strerror.c"
-  STRERROR_O="strerror.o"
+  STRERROR_LO="strerror.lo"
 fi
-AC_SUBST(STRERROR_C)
-AC_SUBST(STRERROR_O)
+AC_SUBST(STRERROR_LO)
 
-AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
-  STRNCASECMP_O="strncasecmp.o")
+AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="",
+  STRNCASECMP_LO="strncasecmp.lo")
 if test "$ac_cv_func_strncasecmp" = no ; then
-  STRNCASECMP_C="strncasecmp.c"
-  STRNCASECMP_O="strncasecmp.o"
+  STRNCASECMP_LO="strncasecmp.lo"
 fi
-AC_SUBST(STRNCASECMP_C)
-AC_SUBST(STRNCASECMP_O)
+AC_SUBST(STRNCASECMP_LO)
 
 AC_CHECK_FUNCS(mkstemp mkdtemp)
 
-#
-# XXX - if inet_aton isn't found, the build fails, with a complaint from
-# libtool about inet_aton.lo not being a valid libtool object.  We
-# probably have to handle it - and all the other replacement functions that
-# get built into libwireshark - differently.
-#
 AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes,
     have_inet_aton=no)
 if test "$have_inet_aton" = no; then
-  INET_ATON_C="inet_aton.c"
-  INET_ATON_O="inet_aton.o"
   INET_ATON_LO="inet_aton.lo"
   AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
 else
-  INET_ATON_C=""
-  INET_ATON_O=""
   INET_ATON_LO=""
 fi
-AC_SUBST(INET_ATON_C)
-AC_SUBST(INET_ATON_O)
 AC_SUBST(INET_ATON_LO)
 
 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
@@ -1581,16 +1643,10 @@ have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
 have_inet_pton=no])],
 have_inet_pton=no)
 if test "$have_inet_pton" = no; then
-  INET_PTON_C="inet_pton.c"
-  INET_PTON_O="inet_pton.o"
   INET_PTON_LO="inet_pton.lo"
 else
-  INET_PTON_C=""
-  INET_PTON_O=""
   INET_PTON_LO=""
 fi
-AC_SUBST(INET_PTON_C)
-AC_SUBST(INET_PTON_O)
 AC_SUBST(INET_PTON_LO)
 
 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
@@ -1616,31 +1672,26 @@ extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
       [Define if inet_ntop() prototype exists])], [
       AC_MSG_RESULT(no)])])
-  INET_NTOP_O=""
   INET_NTOP_LO=""], [
-  INET_NTOP_C="inet_ntop.c"
-  INET_NTOP_O="inet_ntop.o"
   INET_NTOP_LO="inet_ntop.lo"
   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
   [Define if inet/v6defs.h needs to be included])])
-AC_SUBST(INET_NTOP_C)
-AC_SUBST(INET_NTOP_O)
 AC_SUBST(INET_NTOP_LO)
 
-AC_CHECK_FUNC(strptime, STRPTIME_O="",
-  [STRPTIME_O="strptime.o"
+AC_CHECK_FUNC(strptime, STRPTIME_LO="",
+  [STRPTIME_LO="strptime.lo"
    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
 ])
 if test "$ac_cv_func_strptime" = no ; then
-  STRPTIME_C="strptime.c"
-  STRPTIME_O="strptime.o"
+  STRPTIME_LO="strptime.lo"
 fi
 AC_SUBST(STRPTIME_C)
-AC_SUBST(STRPTIME_O)
+AC_SUBST(STRPTIME_LO)
 
 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
 AC_CHECK_FUNCS(issetugid)
 AC_CHECK_FUNCS(mmap mprotect sysconf)
+AC_CHECK_FUNCS(strtoll)
 
 dnl blank for now, but will be used in future
 AC_SUBST(wireshark_SUBDIRS)
@@ -1703,7 +1754,8 @@ AC_ARG_ENABLE(new-packet-list,
 AC_MSG_CHECKING(if new packet list is used);
 if test "x$new_packet_list" = "xyes" ; then
        AC_MSG_RESULT(yes)
-       CFLAGS=" -DNEW_PACKET_LIST $CFLAGS"
+       AC_DEFINE(NEW_PACKET_LIST, 1,
+           [Use the new packet list code])
 else
        AC_MSG_RESULT(no)
 fi
@@ -1752,6 +1804,7 @@ AC_OUTPUT(
   asn1/h501/Makefile
   asn1/HI2Operations/Makefile
   asn1/hnbap/Makefile
+  asn1/idmp/Makefile
   asn1/inap/Makefile
   asn1/kerberos/Makefile
   asn1/ldap/Makefile
@@ -1768,6 +1821,7 @@ AC_OUTPUT(
   asn1/pkcs1/Makefile
   asn1/pkcs12/Makefile
   asn1/pkinit/Makefile
+  asn1/pkixac/Makefile
   asn1/pkix1explicit/Makefile
   asn1/pkix1implicit/Makefile
   asn1/pkixproxy/Makefile
@@ -1790,6 +1844,7 @@ AC_OUTPUT(
   asn1/smrse/Makefile
   asn1/snmp/Makefile
   asn1/spnego/Makefile
+  asn1/sv/Makefile
   asn1/t125/Makefile
   asn1/t38/Makefile
   asn1/tcap/Makefile
@@ -1811,6 +1866,8 @@ AC_OUTPUT(
   epan/doxygen.cfg
   epan/dfilter/Makefile
   epan/dissectors/Makefile
+  epan/dissectors/dcerpc/Makefile
+  epan/dissectors/pidl/Makefile
   epan/ftypes/Makefile
   epan/wslua/Makefile
   epan/wspython/Makefile
@@ -1857,12 +1914,25 @@ dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
 
 # Pretty messages
 
+if test "x$enable_setcap_install" = "xyes" ; then
+       setcap_message="yes"
+else
+       setcap_message="no"
+fi
+
+
 if test "x$enable_setuid_install" = "xyes" ; then
        setuid_message="yes"
 else
        setuid_message="no"
 fi
 
+if test "x$DUMPCAP_GROUP" = "x" ; then
+       dumpcap_group_message="(none)"
+else
+       dumpcap_group_message="$DUMPCAP_GROUP"
+fi
+
 if test "x$want_zlib" = "xno" ; then
        zlib_message="no"
 else
@@ -1948,7 +2018,9 @@ echo "                      Build randpkt : $enable_randpkt"
 echo "                       Build dftest : $enable_dftest"
 echo "                     Build rawshark : $enable_rawshark"
 echo ""
+echo "  Install dumpcap with capabilities : $setcap_message"
 echo "             Install dumpcap setuid : $setuid_message"
+echo "                  Use dumpcap group : $dumpcap_group_message"
 echo "                        Use plugins : $have_plugins"
 echo "                    Use lua library : $lua_message"
 echo "                 Use python binding : $python_message"