Add ability to follow UDP stream by index
[metze/wireshark/wip.git] / configure.ac
index bc081a976629ac5462969925496e284cea1b4af1..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?
@@ -119,6 +119,8 @@ if test ! -z "$PYTHON"; then
        else
                AC_MSG_RESULT(yes)
        fi
+else
+       AC_MSG_ERROR(I couldn't find python; make sure it's installed and in your path)
 fi
 
 #
@@ -237,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],
@@ -355,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
@@ -362,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
 
@@ -451,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
 #
@@ -476,10 +551,12 @@ AC_ARG_WITH([gtk3],
 # version 4.2.2, the switched to LGPLv3+ / GPLv2+ in version 6.0.0.
 
 tls_message="no"
+want_gnutls="if_available"
 AC_ARG_WITH([gnutls],
   AC_HELP_STRING( [--with-gnutls=@<:@yes/no@:>@],
-                 [use GnuTLS library @<:@default=yes@:>@]),
-  with_gnutls="$withval", with_gnutls="yes")
+                 [use GnuTLS library @<:@default=yes, if available@:>@]),
+  [ with_gnutls="$withval"; want_gnutls="yes" ], with_gnutls="yes")
+
 if test "x$with_gnutls" = "xyes"; then
   have_license_compatible_gnutls="no"
   PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.1.10 ],
@@ -499,15 +576,22 @@ if test "x$with_gnutls" = "xyes"; then
   else
     echo "GnuTLS with compatible license not found, disabling SSL decryption"
     tls_message="no"
+
+    # Error out if the user explicitly requested gnutls
+    if test "x$want_gnutls" = "xyes"; then
+       AC_MSG_ERROR([GnuTLS crypto library was requested, but is not available])
+    fi
   fi
 fi
 
 # libgrypt
 gcrypt_message="no"
+want_gcrypt="if_available"
 AC_ARG_WITH([gcrypt],
   AC_HELP_STRING( [--with-gcrypt=@<:@yes/no@:>@],
-                 [use gcrypt library @<:@default=yes@:>@]),
-  with_gcrypt="$withval", with_gcrypt="yes")
+                 [use gcrypt library @<:@default=yes, if available@:>@]),
+  [ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes")
+
 if test "x$with_gcrypt" = "xyes"; then
   AM_PATH_LIBGCRYPT(1.1.92,
         [
@@ -522,6 +606,11 @@ if test "x$with_gcrypt" = "xyes"; then
                         echo "libgcrypt not found, disabling ipsec decryption"
                         gcrypt_message="no"
                 fi
+
+               # Error out if the user explicitly requested gcrypt
+               if test "x$want_gcrypt" = "xyes"; then
+                   AC_MSG_ERROR([libgcrypt library was requested, but is not available])
+               fi
         ]
   )
 fi
@@ -637,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)])
        ;;
 
 *)
@@ -733,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.
@@ -757,6 +860,9 @@ AC_ARG_ENABLE(extra-compiler-warnings,
        wireshark_extra_flags=$enableval
        if test $enableval != no
        then
+               #
+               # The following are for C and C++
+               #
                AC_WIRESHARK_COMPILER_FLAGS_CHECK(-pedantic)
                #
                # Various code blocks this one.
@@ -766,10 +872,9 @@ AC_ARG_ENABLE(extra-compiler-warnings,
                #
                # Due to various places where APIs we don't control
                # require us to cast away constness, we can probably
-               # never enable these ones with -Werror.
+               # never enable this one with -Werror.
                #
                AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-qual)
-               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wbad-function-cast, C)
                #
                # Some generated ASN.1 dissectors block this one;
                # multiple function declarations for the same
@@ -800,26 +905,30 @@ AC_ARG_ENABLE(extra-compiler-warnings,
                # (about glib library not using Doxygen)
                #
                AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdocumentation)
+
+               #
+               # The following are C only, not C++
+               #
+               # Due to various places where APIs we don't control
+               # require us to cast away constness, we can probably
+               # never enable this one with -Werror.
+               #
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wbad-function-cast, C)
        fi
 ],)
 
+#
+# The following are for C and C++
+#
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wextra) # -W is now known as -Wextra
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdeclaration-after-statement, C)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wendif-labels)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpointer-arith)
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-pointer-sign, C)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Warray-bounds)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wformat-security)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fwrapv)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-strict-overflow)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-delete-null-pointer-checks)
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wold-style-definition, C)
-# The Qt headers generate a ton of shortening errors on 64-bit systems
-# so only enable this for C for now.
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wstrict-prototypes, C)
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wvla)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Waddress)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wattributes)
@@ -829,8 +938,13 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpragmas)
 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(-Wc++-compat, C)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable)
+#
+# The following are C only, not C++
+#
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wc++-compat, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdeclaration-after-statement, C)
 
 #
 # XXX - OK for C++?
@@ -856,6 +970,10 @@ foo(int a)
   ],
   [warns about variables in function declarations shadowing other variables])
 
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-pointer-sign, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wold-style-definition, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wstrict-prototypes, C)
+
 # Unfortunately some versions of gcc generate logical-op warnings when strchr()
 # is given a constant string.
 # gcc versions 4.3.2 and 4.4.5 are known to have the problem.
@@ -883,20 +1001,10 @@ bar(void)
   ],
   [generates warnings from strchr()])
 
-
-#
-# On OS X, suppress warnings about deprecated declarations, because
-# they apparently think everything on OS X is Shiny Happy Apple-
-# Framework-Based Apps and are deprecating some perfectly OK
-# multi-platform open-source libraries that we use in our multi-platform
-# open-source application in favor of various frameworks that are
-# OS X-only.
-#
-case "$host_os" in
-darwin*)
-       AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-deprecated-declarations)
-       ;;
-esac
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
+# The Qt headers generate a ton of shortening errors on 64-bit systems
+# so only enable this for C for now.
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
 
 #
 # Use the faster pre gcc 4.5 floating point precision if available.
@@ -1110,6 +1218,9 @@ darwin*)
        #
        LDFLAGS_SHAREDLIB="-Wl,-single_module"
        #
+       # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
+       # code-signing issues is running out of padding space.
+       #
        # Add -Wl,-search_paths_first to make sure that if we search
        # directories A and B, in that order, for a given library, a
        # non-shared version in directory A, rather than a shared
@@ -1125,8 +1236,8 @@ darwin*)
        # libraries in the rpath, rather than having a script tweak
        # DYLD_LIBRARY_PATH.
        #
-       LDFLAGS="-Wl,-search_paths_first -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/lib $LDFLAGS"
-       AC_MSG_RESULT([Apple linker - added -Wl,-single_module and -Wl,-search_paths_first, and rpaths])
+       LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-search_paths_first -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/lib $LDFLAGS"
+       AC_MSG_RESULT([Apple linker - added -Wl,-single_module to shared library linker flags and -Wl,-headerpad_max_install_names -Wl,-search_paths_first and rpaths to all linker flags])
        ;;
 cygwin*)
        #
@@ -1290,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],
@@ -1382,6 +1494,7 @@ AC_SUBST(QT_MIN_VERSION)
 # 5.0.0:  19 Dec 2012
 # 5.1.0:  03 Jul 2013
 # 5.2.0:  12 Dec 2013
+# 5.3.0:  20 May 2014
 
 have_qt=no
 have_gtk=no
@@ -1413,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])])
 
@@ -1497,26 +1608,28 @@ AC_SUBST(GLIB_MIN_VERSION)
 use_glib_cflags="true"
 if test "$have_gtk" = "yes" -a "$have_qt" = "yes" ; then
        # We have both GTK and Qt and thus will be building both wireshark
-       # and wireshark-qt.
+       # and wireshark-gtk.
 
-       wireshark_bin="wireshark\$(EXEEXT) wireshark-qt\$(EXEEXT)"
+       wireshark_bin="wireshark\$(EXEEXT) wireshark-gtk\$(EXEEXT)"
        wireshark_man="wireshark.1"
        wireshark_SUBDIRS="codecs ui/qt ui/gtk"
 fi
 if test "$have_gtk" = "no" -a "$have_qt" = "yes" ; then
        # We don't have GTK+ but we have Qt.
 
-       wireshark_bin="wireshark-qt\$(EXEEXT)"
+       wireshark_bin="wireshark\$(EXEEXT)"
        wireshark_man="wireshark.1"
        wireshark_SUBDIRS="codecs ui/qt"
 fi
 if test "$have_gtk" = "yes" -a "$have_qt" = "no" ; then
        # We have GTK+ but not Qt.
 
-       wireshark_bin="wireshark\$(EXEEXT)"
+       wireshark_bin="wireshark-gtk\$(EXEEXT)"
        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.
@@ -1631,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)
@@ -1786,7 +1925,7 @@ AC_SUBST(OSX_DMG_FLAGS)
 # Enable/disable tshark
 AC_ARG_ENABLE(tshark,
   AC_HELP_STRING( [--enable-tshark],
-                  [build TShark @<:@default=yes@:>@]),
+                  [build tshark @<:@default=yes@:>@]),
     tshark=$enableval,enable_tshark=yes)
 
 if test "x$enable_tshark" = "xyes" ; then
@@ -1800,23 +1939,6 @@ fi
 AC_SUBST(tshark_bin)
 AC_SUBST(tshark_man)
 
-# Enable/disable tfshark
-AC_ARG_ENABLE(tfshark,
-  AC_HELP_STRING( [--enable-tfshark],
-                  [build TFShark @<:@default=no@:>@]),
-    tfshark=$enableval,enable_tfshark=no)
-
-if test "x$enable_tfshark" = "xyes" ; then
-       tfshark_bin="tfshark\$(EXEEXT)"
-       tfshark_man="tfshark.1"
-       wiresharkfilter_man="wireshark-filter.4"
-else
-       tfshark_bin=""
-       tfshark_man=""
-fi
-AC_SUBST(tfshark_bin)
-AC_SUBST(tfshark_man)
-
 # Enable/disable editcap
 
 AC_ARG_ENABLE(editcap,
@@ -1834,26 +1956,6 @@ fi
 AC_SUBST(editcap_bin)
 AC_SUBST(editcap_man)
 
-# Enable/disable echld
-
-AC_ARG_ENABLE(echld,
-  AC_HELP_STRING( [--enable-echld],
-                  [support echld]),
-    have_echld=$enableval,have_echld=no)
-
-AM_CONDITIONAL(HAVE_ECHLD, test "x$have_echld" = "xyes")
-if test "x$have_echld" = "xyes"
-then
-  AC_DEFINE(HAVE_ECHLD, 1, [Define if echld is enabled])
-  echld_test_bin="echld_test\$(EXEEXT)"
-  echld_dir="echld"
-else
-  have_echld="no"
-  echld_test_bin=""
-  echld_dir=""
-fi
-AC_SUBST(echld_test_bin)
-AC_SUBST(echld_dir)
 
 # Enabling/disabling of dumpcap is done later (after we know if we have PCAP
 # or not)
@@ -2096,6 +2198,45 @@ fi
 AC_SUBST(rawshark_bin)
 AC_SUBST(rawshark_man)
 
+
+# Enable/disable echld
+AC_ARG_ENABLE(echld,
+  AC_HELP_STRING( [--enable-echld],
+                  [support echld (Experimental) @<:@default=no@:>@]),
+    have_echld=$enableval,have_echld=no)
+
+AM_CONDITIONAL(HAVE_ECHLD, test "x$have_echld" = "xyes")
+if test "x$have_echld" = "xyes"
+then
+  AC_DEFINE(HAVE_ECHLD, 1, [Define if echld is enabled])
+  echld_test_bin="echld_test\$(EXEEXT)"
+  echld_dir="echld"
+else
+  have_echld="no"
+  echld_test_bin=""
+  echld_dir=""
+fi
+AC_SUBST(echld_test_bin)
+AC_SUBST(echld_dir)
+
+# Enable/disable tfshark
+AC_ARG_ENABLE(tfshark,
+  AC_HELP_STRING( [--enable-tfshark],
+                  [build tfshark (Experimental) @<:@default=no@:>@]),
+    tfshark=$enableval,enable_tfshark=no)
+
+if test "x$enable_tfshark" = "xyes" ; then
+       tfshark_bin="tfshark\$(EXEEXT)"
+       tfshark_man="tfshark.1"
+       wiresharkfilter_man="wireshark-filter.4"
+else
+       tfshark_bin=""
+       tfshark_man=""
+fi
+AC_SUBST(tfshark_bin)
+AC_SUBST(tfshark_man)
+
+
 dnl Use pcap-ng by default
 AC_ARG_ENABLE(pcap-ng-default,
   AC_HELP_STRING( [--enable-pcap-ng-default],
@@ -2527,38 +2668,41 @@ AC_C_BIGENDIAN
 # XXX - do we need this?
 AC_PROG_GCC_TRADITIONAL
 
-GETOPT_LO=""
-AC_CHECK_FUNC(getopt,
-  [GETOPT_LO=""
-   AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
+AC_CHECK_FUNC(getopt_long,
+  [
+    GETOPT_LO=""
+    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"
-)
-if test "$ac_cv_func_getopt" = no ; then
-  GETOPT_LO="wsgetopt.lo"
-fi
-AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno")
+  GETOPT_LO="wsgetopt.lo")
 AC_SUBST(GETOPT_LO)
 
-AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="",
-  STRNCASECMP_LO="strncasecmp.lo")
-if test "$ac_cv_func_strncasecmp" = no ; then
-  STRNCASECMP_LO="strncasecmp.lo"
-fi
-AM_CONDITIONAL(NEED_STRNCASECMP_LO, test "x$ac_cv_func_strncasecmp" = "xno")
-AC_SUBST(STRNCASECMP_LO)
-
 AC_CHECK_FUNCS(mkstemp mkdtemp)
 
-AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes,
-    have_inet_aton=no)
-if test "$have_inet_aton" = no; then
-  INET_ATON_LO="inet_aton.lo"
-  AC_DEFINE(HAVE_INET_ATON_H, 0, [Define unless inet/aton.h needs to be included])
-else
-  INET_ATON_LO=""
-fi
-AM_CONDITIONAL(NEED_INET_ATON_LO, test "x$have_inet_aton" = "xno")
+AC_SEARCH_LIBS(inet_aton, [socket nsl],
+  [
+    INET_ATON_LO=""
+    AC_DEFINE(HAVE_INET_ATON, 0, [Define to 1 if you have the inet_aton function.])
+  ],
+  INET_ATON_LO="inet_aton.lo")
 AC_SUBST(INET_ATON_LO)
 
 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
@@ -2620,17 +2764,22 @@ extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
 AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
 AC_SUBST(INET_NTOP_LO)
 
-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_LO="strptime.lo"
-fi
-AC_SUBST(STRPTIME_C)
-AM_CONDITIONAL(NEED_STRPTIME_LO, test "x$ac_cv_func_strptime" = "no")
+AC_CHECK_FUNC(strptime,
+  [
+    STRPTIME_LO=""
+    AC_DEFINE(HAVE_STRPTIME, 1, [Define if you have the strptime function.])
+  ],
+  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)
@@ -2679,6 +2828,32 @@ CPPFLAGS="$CPPFLAGS '-DPLUGIN_INSTALL_DIR=\"\$(plugindir)\"'"
 PLUGIN_LIBS=""
 AC_SUBST(PLUGIN_LIBS)
 
+
+dnl Use extcap by default
+extcapdir='${datadir}/wireshark/extcap/'
+AC_ARG_WITH(extcap,
+  AC_HELP_STRING( [--with-extcap@<:@=DIR@:>@],
+                  [use extcap for external capture sources (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
+[
+  if test "x$withval" = "xno"; then
+      have_extcap=no
+  elif test "x$withval" = "xyes"; then
+      have_extcap=yes
+  elif test "x$withval" != "xyes"; then
+      have_extcap=yes
+      extcapdir ="$withval"
+  fi
+],[
+    have_extcap=yes
+])
+AM_CONDITIONAL(HAVE_EXTCAP, test "x$have_extcap" = "xyes")
+if test "x$have_extcap" = "xyes"
+then
+  AC_DEFINE(HAVE_EXTCAP, 1, [Define if external capture sources should be enabled])
+  AC_DEFINE_UNQUOTED(EXTCAP_DIR,"$extcapdir", [Directory for extcap plugins])
+fi
+AC_SUBST(extcapdir)
+
 #
 # Check if (emem) memory allocations must be 8-byte aligned.
 # I haven't been able to write C code that reliably makes that determination
@@ -2701,43 +2876,6 @@ case $host_cpu in
                ;;
 esac
 
-# Gather only the "--with*" arguments and also a list of --with arguments for rpmbuild
-for f in $CONFIG_ARGS
-do
-       case $f in
-       --with-gtk2*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with gtk2"
-               ;;
-       --without-gtk2*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without gtk2"
-               ;;
-       --with-gtk3*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with gtk3"
-               ;;
-       --without-gtk3*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without gtk3"
-               ;;
-       --with-qt*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
-               ;;
-       --without-qt*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt"
-               ;;
-       --with*)
-               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
-               ;;
-       esac
-
-done
-AC_SUBST(CONFIG_WITH_ARGS)
-AC_SUBST(RPMBUILD_WITH_ARGS)
-
 dnl libtool defs
 #
 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
@@ -2757,6 +2895,23 @@ then
 fi
 AC_SUBST(ENABLE_STATIC)
 
+# Gather which GUI we're building for rpmbuild
+if test "x$have_gtk" = "xyes"; then
+       if test "x$with_gtk3" = "xyes"; then
+               RPMBUILD_WITH_ARGS="--with gtk3 --without gtk2"
+       else
+               RPMBUILD_WITH_ARGS="--without gtk3 --with gtk2"
+       fi
+else
+       RPMBUILD_WITH_ARGS="--without gtk2 --without gtk3"
+fi
+if test "x$have_qt" = "xyes" ; then
+       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
+else
+       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt"
+fi
+AC_SUBST(RPMBUILD_WITH_ARGS)
+
 dnl Save the cacheable configure results to config.cache before recursing
 AC_CACHE_SAVE
 
@@ -2877,9 +3032,12 @@ AC_OUTPUT(
   asn1/x721/Makefile
   capchild/Makefile
   capchild/doxygen.cfg
+  caputils/Makefile
+  caputils/doxygen.cfg
   doc/Makefile
   docbook/Makefile
   epan/Makefile
+  epan/compress/Makefile
   epan/crypt/Makefile
   epan/doxygen.cfg
   epan/dfilter/Makefile
@@ -2887,9 +3045,9 @@ AC_OUTPUT(
   epan/dissectors/dcerpc/Makefile
   epan/dissectors/pidl/Makefile
   epan/ftypes/Makefile
+  epan/nghttp2/Makefile
   epan/wmem/Makefile
   epan/wslua/Makefile
-  filetap/Makefile
   codecs/Makefile
   ui/Makefile
   ui/doxygen.cfg
@@ -2913,6 +3071,7 @@ AC_OUTPUT(
   packaging/svr4/pkginfo
   plugins/Makefile
   plugins/docsis/Makefile
+  plugins/easy_codec/Makefile
   plugins/ethercat/Makefile
   plugins/gryphon/Makefile
   plugins/irda/Makefile
@@ -2929,7 +3088,6 @@ AC_OUTPUT(
   tools/lemon/Makefile
   wiretap/Makefile
   wsutil/Makefile
-  wsutil/nghttp2/Makefile
   echld/Makefile
   _CUSTOM_AC_OUTPUT_
   ,)
@@ -2952,9 +3110,9 @@ if test "x$have_gtk" = "xyes"; then
 fi
 
 if test "x$have_qt" = "xyes" ; then
-       enable_qtshark="yes"
+       enable_wireshark_qt="yes"
 else
-       enable_qtshark="no"
+       enable_wireshark_qt="no"
 fi
 
 if test "x$enable_setcap_install" = "xyes" ; then
@@ -3035,8 +3193,8 @@ fi
 
 echo ""
 echo "The Wireshark package has been configured with the following options."
-echo "             Build wireshark (Gtk+) : $have_gtk""$gtk_lib_message"
-echo "                 Build wireshark-qt : $enable_qtshark"
+echo "                    Build wireshark : $enable_wireshark_qt"
+echo "                Build wireshark-gtk : $have_gtk""$gtk_lib_message"
 echo "                       Build tshark : $enable_tshark"
 echo "                      Build tfshark : $enable_tfshark"
 echo "                     Build capinfos : $enable_capinfos"
@@ -3056,6 +3214,7 @@ 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 external capture sources : $have_extcap"
 echo "                    Use Lua library : $lua_message"
 echo "                   Build rtp_player : $portaudio_message"
 echo "             Build profile binaries : $enable_profile_build"