Add ability to follow UDP stream by index
[metze/wireshark/wip.git] / configure.ac
index 294f342a7dabcd19a4e4e1ad5ebdd67e8a249851..89a15d44478e32a1fca70b05762adc53bb9d9155 100644 (file)
@@ -7,7 +7,7 @@
 #
 m4_define([version_major], [1])
 m4_define([version_minor], [99])
-m4_define([version_micro], [0])
+m4_define([version_micro], [2])
 m4_define([version_micro_extra], version_micro)
 m4_append([version_micro_extra], [])
 
@@ -102,7 +102,7 @@ fi
 AC_PATH_PROG(PERL, perl)
 
 # Check for Python.
-AC_PATH_PROG(PYTHON, python)
+AC_PATH_PROGS(PYTHON, python, python3)
 if test ! -z "$PYTHON"; then
        #
        # OK, we found Python; is it Python 2.5 or later?
@@ -239,6 +239,9 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
 # the comments in acolocal.m4
 #
 PKG_PROG_PKG_CONFIG
+if test -z "$PKG_CONFIG"; then
+       AC_MSG_ERROR(I couldn't find pkg-config; make sure it's installed and in your path)
+fi
 
 AC_ARG_ENABLE(osx-deploy-target,
   AC_HELP_STRING( [--enable-osx-deploy-target],
@@ -357,6 +360,9 @@ then
                ;;
 
        *)
+               #
+               # Look for the oldest SDK we can find that's
+               # for an OS equal to or later than this one.
                #
                # XXX - for 10.4, do we need 10.4u?  We're
                # not currently doing fat builds (we'd need
@@ -364,22 +370,72 @@ then
                # that to be useful), but, if we do, we'd
                # need to use 10.4u.
                #
-               for i in /Developer/SDKs \
+
+               #
+               # Get the real version - strip off the "10.".
+               # We'll worry about that if, as, and when there's ever
+               # an OS XI.
+               #
+               deploy_real_version=`echo "$deploy_target" | sed -n 's/10\.\(.*\)/\1/p'`
+
+               #
+               # Search each directory that might contain SDKs.
+               #
+               sdkpath=""
+               for sdksdir in /Developer/SDKs \
                    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
                    /Library/Developer/CommandLineTools/SDKs
                do
-                       if test -d "$i"/"MacOSX$deploy_target.sdk"
+                       #
+                       # Get a list of all the SDKs.
+                       #
+                       if ! test -d "$sdksdir"
                        then
-                               SDKPATH="$i"/"MacOSX$deploy_target.sdk"
-                               break
+                               #
+                               # There is no directory with that name.
+                               # Move on to the next one in the list,
+                               # if any.
+                               #
+                               continue
                        fi
+
+                       #
+                       # Get a list of all the SDKs in that directory,
+                       # if any.
+                       #
+                       # We have to use @<:@ for [ and @:>@ for ] to
+                       # avoid m4 removing the square brackets.
+                       #
+                       sdklist=`(cd "$sdksdir"; ls -d MacOSX10.@<:@0-9@:>@*.sdk 2>/dev/null)`
+
+                       for sdk in $sdklist
+                       do
+                               #
+                               # Get the real version for this SDK.
+                               #
+                               sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
+
+                               #
+                               # Is it for the deployment target or
+                               # some later release?
+                               #
+                               if test "$sdk_real_version" -ge "$deploy_real_version"
+                               then
+                                       #
+                                       # Yes, use it.
+                                       #
+                                       sdkpath="$sdksdir/$sdk"
+                                       break 2
+                               fi
+                       done
                done
-               if test -z "$SDKPATH"
+               if test -z "$sdkpath"
                then
                        AC_MSG_RESULT(no)
-                       AC_MSG_ERROR([We couldn't find the SDK for OS X $deploy_target])
+                       AC_MSG_ERROR([We couldn't find an SDK for OS X $deploy_target or later])
                fi
-               AC_MSG_RESULT(yes)
+               SDKPATH="$sdkpath"
+               AC_MSG_RESULT([yes, with the 10.$sdk_real_version SDK])
                ;;
        esac
 
@@ -453,6 +509,23 @@ AC_SUBST(OSX_MIN_VERSION)
 #
 AC_SYS_LARGEFILE
 
+#
+# Look for math functions; use libm if necessary.
+#
+AC_SEARCH_LIBS(floor, m)
+AC_SEARCH_LIBS(ceil, m)
+AC_SEARCH_LIBS(exp, m)
+AC_SEARCH_LIBS(log, m)
+AC_SEARCH_LIBS(log10, m)
+AC_SEARCH_LIBS(floorl, m,
+  [
+    FLOORL_LO=""
+    AC_DEFINE(HAVE_FLOORL, 1, [Define if you have the floorl function.])
+  ],
+  FLOORL_LO="floorl.lo")
+AC_SUBST(FLOORL_LO)
+
+
 #
 # GUI toolkit options
 #
@@ -653,6 +726,12 @@ linux*)
            [enum nl80211_commands x = NL80211_CMD_SET_CHANNEL;],
            [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_CMD_SET_CHANNEL, 1, [SET_CHANNEL is supported])],
            [AC_MSG_RESULT(no)])
+
+       AC_MSG_CHECKING([for NL80211_SPLIT_WIPHY_DUMP])
+         AC_TRY_COMPILE([#include <linux/nl80211.h>],
+           [enum nl80211_protocol_features x = NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP;],
+           [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_SPLIT_WIPHY_DUMP, 1, [SPLIT_WIPHY_DUMP is supported])],
+           [AC_MSG_RESULT(no)])
        ;;
 
 *)
@@ -749,6 +828,14 @@ else
 fi
 AC_SUBST(HAVE_OSX_PACKAGING)
 
+#
+# Use this as a proxy for "is this OS X" (just in case somebody actually
+# built and installed Darwin as an OS, perhaps with some X11-based GUI,
+# don't look for Darwin).
+#
+AC_CHECK_PROG(have_sw_vers, sw_vers, "yes", "no")
+AM_CONDITIONAL(NOT_OS_X, test "x$have_sw_vers" = "xno")
+
 #
 # Some compilers have to be told to fail when passed an unknown -W flag;
 # make sure we do that.
@@ -852,7 +939,7 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-overlength-strings)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wwrite-strings)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-long-long)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
-
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable)
 #
 # The following are C only, not C++
 #
@@ -1314,6 +1401,7 @@ AC_ARG_ENABLE(wireshark,
   AC_HELP_STRING( [--enable-wireshark],
                   [build the Wireshark GUI (with Gtk+, Qt, or both) @<:@default=yes@:>@]),
     enable_wireshark=$enableval,enable_wireshark=yes)
+AM_CONDITIONAL(BUILDING_WIRESHARK, test x$enable_wireshark = xyes)
 
 AC_ARG_ENABLE(packet-editor,
   AC_HELP_STRING( [--enable-packet-editor],
@@ -1438,8 +1526,6 @@ if test "x$enable_wireshark" = "xyes"; then
                        CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
                        have_qt=yes
                        GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-qt"
-                       OSX_APP_FLAGS="$OSX_APP_FLAGS -qt"
-                       OSX_DMG_FLAGS="-qt"
                ],
                [AC_MSG_ERROR([Qt is not available])])
 
@@ -1542,6 +1628,8 @@ if test "$have_gtk" = "yes" -a "$have_qt" = "no" ; then
        wireshark_man="wireshark.1"
        wireshark_SUBDIRS="codecs ui/gtk"
        use_glib_cflags="false"
+       OSX_APP_FLAGS="$OSX_APP_FLAGS -gtk"
+       OSX_DMG_FLAGS="-gtk"
 fi
 if test "$have_gtk" = "no" -a "$have_qt" = "no" ; then
        # We have neither GTK+ nor Qt.
@@ -1656,6 +1744,32 @@ then
        fi
 fi
 AC_SUBST(MOC)
+AC_PATH_PROG(RCC, rcc)
+if test "x$RCC" = x
+then
+       AC_PATH_PROG(RCC, rcc)
+       if test "x$RCC" = x
+       then
+               if test "x$with_qt" = "xyes"; then
+                       #
+                       # If you want to build with Qt, you'd better
+                       # have moc.
+                       #
+                       AC_MSG_ERROR(I couldn't find rcc; make sure it's installed and in your path)
+               else
+                       #
+                       # We shouldn't fail here, as the user's not
+                       # building with Qt, and we shouldn't force them
+                       # to have Qt installed if they're not doing so.
+                       # "make dist" will fail if they do that, but
+                       # we don't know whether they'll be doing that,
+                       # so this is the best we can do.
+                       #
+                       RCC=rcc
+               fi
+       fi
+fi
+AC_SUBST(RCC)
 
 # Error out if a glib header other than a "top level" header
 #  (glib.h, glib-object.h, gio.h) or certain other headers( e.g.,gmodule.h)
@@ -2554,27 +2668,33 @@ AC_C_BIGENDIAN
 # XXX - do we need this?
 AC_PROG_GCC_TRADITIONAL
 
-AC_CHECK_FUNC(getopt,
+AC_CHECK_FUNC(getopt_long,
   [
     GETOPT_LO=""
-    AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
+    AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
+
+    #
+    # Do we have optreset?
+    #
+    AC_MSG_CHECKING(whether optreset is defined)
+    AC_TRY_LINK([],
+      [
+        extern int optreset;
+
+        return optreset;
+      ],
+      ac_cv_pcap_debug_defined=yes,
+      ac_cv_pcap_debug_defined=no)
+    if test "$ac_cv_pcap_debug_defined" = yes ; then
+      AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if you have the optreset variable])
+    else
+      AC_MSG_RESULT(no)
+    fi
   ],
   GETOPT_LO="wsgetopt.lo")
 AC_SUBST(GETOPT_LO)
 
-AC_CHECK_FUNC(strncasecmp,
-  [
-    STRNCASECMP_INCLUDES=""
-    STRNCASECMP_LO=""
-    AC_DEFINE(HAVE_STRNCASECMP, 1, [Define to 1 if you have the strncasecmp function.])
-  ],
-  [
-    STRNCASECMP_INCLUDES="strncasecmp.h"
-    STRNCASECMP_LO="strncasecmp.lo"
-  ])
-AC_SUBST(STRNCASECMP_INCLUDES)
-AC_SUBST(STRNCASECMP_LO)
-
 AC_CHECK_FUNCS(mkstemp mkdtemp)
 
 AC_SEARCH_LIBS(inet_aton, [socket nsl],
@@ -2652,6 +2772,14 @@ AC_CHECK_FUNC(strptime,
   STRPTIME_LO="strptime.lo")
 AC_SUBST(STRPTIME_LO)
 
+AC_CHECK_FUNC(popcount,
+  [
+    POPCOUNT_LO=""
+    AC_DEFINE(HAVE_POPCOUNT, 1, [Define if you have the popcount function.])
+  ],
+  POPCOUNT_LO="popcount.lo")
+AC_SUBST(POPCOUNT_LO)
+
 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
 AC_CHECK_FUNCS(issetugid)
 AC_CHECK_FUNCS(mmap mprotect sysconf)
@@ -2909,6 +3037,7 @@ AC_OUTPUT(
   doc/Makefile
   docbook/Makefile
   epan/Makefile
+  epan/compress/Makefile
   epan/crypt/Makefile
   epan/doxygen.cfg
   epan/dfilter/Makefile