Use *, not *.*, as the wildcard pattern on UN*X.
[metze/wireshark/wip.git] / configure.ac
index 857e8980890d0873bc239854f62618462233905d..719ae06cefdfe05bcf9a5515b60bc406630c489f 100644 (file)
@@ -5,9 +5,9 @@
 #
 # Define variables for the components of the Wireshark version number.
 #
-m4_define([version_major], [1])
-m4_define([version_minor], [99])
-m4_define([version_micro], [6])
+m4_define([version_major], [2])
+m4_define([version_minor], [1])
+m4_define([version_micro], [0])
 m4_define([version_micro_extra], version_micro)
 m4_append([version_micro_extra], [])
 
@@ -16,9 +16,9 @@ CONFIG_ARGS="$*"
 AC_SUBST(CONFIG_ARGS)
 
 # Minimum autoconf version we require.
-AC_PREREQ(2.60)
+AC_PREREQ(2.64)
 # Variable expansion doesn't work in AC_PREREQ()
-AC_MIN_VERSION=2.60
+AC_MIN_VERSION=2.64
 AC_SUBST(AC_MIN_VERSION)
 
 dnl Make sure to keep ACLOCAL_AMFLAGS in Makefile.am and AC_CONFIG_MACRO_DIRS
@@ -59,7 +59,11 @@ AM_DISABLE_STATIC
 #
 # Checks for programs used in the main build process.
 #
-AC_PROG_CC
+AC_PROG_CC_STDC
+if test "$ac_cv_prog_cc_stdc" == "no"
+then
+       AC_MSG_ERROR([The C compiler does not support standard C])
+fi
 AM_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_CPP
@@ -108,7 +112,7 @@ fi
 AC_PATH_PROG(PERL, perl)
 
 # Check for Python.
-AC_PATH_PROGS(PYTHON, python, python3)
+AC_PATH_PROGS(PYTHON, python python3)
 if test ! -z "$PYTHON"; then
        #
        # OK, we found Python; is it Python 2.5 or later?
@@ -244,7 +248,11 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
 # "if" statement, it's safer to call PKG_PROG_PKG_CONFIG directly, see
 # the comments in acolocal.m4
 #
-PKG_PROG_PKG_CONFIG
+# We want version 0.7 or better.  (XXX - explain why. Is that just
+# because our Qt tests were originally based on AM_PATH_GTK, and *it*
+# requires 0.7 or better?)
+#
+PKG_PROG_PKG_CONFIG(0.7)
 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
@@ -453,9 +461,9 @@ then
        #
        # Add an -isysroot flag to use the SDK.
        #
-       CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CFLAGS"
-       CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CXXFLAGS"
-       LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS"
+       WS_CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $WS_CFLAGS"
+       WS_CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $WS_CXXFLAGS"
+       WS_LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $WS_LDFLAGS"
 
        #
        # Add a -sdkroot flag to use with osx-app.sh.
@@ -482,11 +490,11 @@ then
                # Only 32-bit builds are supported.  10.5
                # (and 10.4?) had a bug that causes some BPF
                # functions not to work with 64-bit userland
-               # code, so capturing won't work.
+               # code, so capturing won't work.
                #
-               CFLAGS="-m32 $CFLAGS"
-               CXXFLAGS="-m32 $CXXFLAGS"
-               LDFLAGS="-m32 $LDFLAGS"
+               WS_CFLAGS="-m32 $WS_CFLAGS"
+               WS_CXXFLAGS="-m32 $WS_CXXFLAGS"
+               WS_LDFLAGS="-m32 $WS_LDFLAGS"
                ;;
        esac
 else
@@ -530,24 +538,26 @@ AC_SEARCH_LIBS(floorl, m,
   ],
   FLOORL_LO="floorl.lo")
 AC_SUBST(FLOORL_LO)
+AC_SEARCH_LIBS(lrint, m,
+  [AC_DEFINE(HAVE_LRINT, 1, [Define if you have the 'lrint' function.])])
 
 
 #
 # GUI toolkit options
 #
 AC_ARG_WITH([qt],
-  AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
-                  [use Qt @<:@default=yes@:>@]),
+  AC_HELP_STRING( [--with-qt=@<:@yes/no/4/5@:>@],
+                 [use Qt @<:@default=yes@:>@]),
   with_qt="$withval", with_qt="unspecified")
 
 AC_ARG_WITH([gtk2],
   AC_HELP_STRING( [--with-gtk2=@<:@yes/no@:>@],
-                  [use GTK+ 2.0 @<:@default=no@:>@]),
+                 [use GTK+ 2.0 @<:@default=no@:>@]),
   with_gtk2="$withval", with_gtk2="unspecified")
 
 AC_ARG_WITH([gtk3],
   AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@],
-                  [use GTK+ 3.0 instead of 2.0 @<:@default=yes@:>@]),
+                 [use GTK+ 3.0 instead of 2.0 @<:@default=yes@:>@]),
   with_gtk3="$withval", with_gtk3="unspecified")
 
 # GnuTLS
@@ -570,8 +580,8 @@ if test "x$with_gnutls" = "xyes"; then
   )
 
   if test "x$have_license_compatible_gnutls" != "xyes"; then
-    PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0 gnutls < 3],
-      [ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 1.2.0, < 3.0 not found " ]
+    PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0 gnutls < 3],
+      [ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 2.12.0, < 3.0 not found " ]
     )
   fi
 
@@ -599,31 +609,31 @@ AC_ARG_WITH([gcrypt],
   [ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes")
 
 if test "x$with_gcrypt" = "xyes"; then
-  AM_PATH_LIBGCRYPT(1.1.92,
-        [
-                echo "libgcrypt found, enabling ipsec decryption"
-                AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
-                gcrypt_message="yes"
-        ]
-        , [
-                if test x$libgcrypt_config_prefix != x ; then
-                       AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
-                else
-                        echo "libgcrypt not found, disabling ipsec decryption"
-                        gcrypt_message="no"
-                fi
+  AM_PATH_LIBGCRYPT(1.4.2,
+       [
+               echo "libgcrypt found, enabling decryption for ipsec, ssl, etc."
+               AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
+               gcrypt_message="yes"
+       ]
+       , [
+               if test x$libgcrypt_config_prefix != x ; then
+                       AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
+               else
+                       echo "libgcrypt not found, disabling decryption for ipsec, ssl, etc."
+                       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
 
 AC_ARG_WITH(libnl,
   AC_HELP_STRING([--with-libnl@<:@=VERSION@:>@],
-                 [use libnl (force version VERSION, if supplied) @<:@default: yes, if available@:>@]),
+                [use libnl (force version VERSION, if supplied) @<:@default: yes, if available@:>@]),
 [
        if test "x$withval" = "xno"
        then
@@ -672,35 +682,29 @@ linux*)
                # was requested by the user.
                #
                if test x$libnl_version = "xany" -o x$libnl_version = "x3"; then
-                       PKG_CHECK_MODULES(LIBNL3, [libnl-route-3.0 >= 3.0 libnl-genl-3.0] >= 3.0, [have_libnl3=yes], [have_libnl3=no])
+                       PKG_CHECK_EXISTS([libnl-3.0 libnl-route-3.0 libnl-genl-3.0], [have_libnl3=yes], [have_libnl3=no])
                fi
                if test x$libnl_version = "xany" -o x$libnl_version = "x2"; then
-                       PKG_CHECK_MODULES(LIBNL2, libnl-2.0 >= 2.0, [have_libnl2=yes], [have_libnl2=no])
+                       PKG_CHECK_EXISTS([libnl-2.0], [have_libnl2=yes], [have_libnl2=no])
                fi
                if test x$libnl_version = "xany" -o x$libnl_version = "x1"; then
-                       PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0, [have_libnl1=yes], [have_libnl1=no])
+                       PKG_CHECK_EXISTS([libnl-1], [have_libnl1=yes], [have_libnl1=no])
                fi
                if (test "${have_libnl3}" = "yes"); then
-                       CFLAGS="$CFLAGS $LIBNL3_CFLAGS"
-                       LIBS="$LIBS $LIBNL3_LIBS"
+                       PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-3.0 libnl-route-3.0 libnl-genl-3.0])
                        AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
                        AC_DEFINE(HAVE_LIBNL3, 1, [libnl version 3])
                        libnl_message="yes (v3)"
-                       enable_airpcap=no
                elif (test "${have_libnl2}" = "yes"); then
-                       CFLAGS="$CFLAGS $LIBNL2_CFLAGS"
-                       LIBS="$LIBS $LIBNL2_LIBS"
+                       PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-2.0])
                        AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
                        AC_DEFINE(HAVE_LIBNL2, 1, [libnl version 2])
                        libnl_message="yes (v2)"
-                       enable_airpcap=no
                elif (test "${have_libnl1}" = "yes"); then
-                       CFLAGS="$CFLAGS $LIBNL1_CFLAGS"
-                       LIBS="$LIBS $LIBNL1_LIBS"
+                       PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-1])
                        AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
                        AC_DEFINE(HAVE_LIBNL1, 1, [libnl version 1])
                        libnl_message="yes (v1)"
-                       enable_airpcap=no
                else
                        if test x$want_libnl = "xyes"; then
                                case "$libnl_version" in
@@ -818,7 +822,7 @@ AC_SUBST(HAVE_RPM)
 # Debian
 AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
 
-# Mac OS X
+# OS X
 AC_CHECK_PROG(HAVE_XCODEBUILD, xcodebuild, "yes", "no")
 AC_CHECK_PROG(HAVE_HDIUTIL, hdiutil, "yes", "no")
 AC_CHECK_PROG(HAVE_BLESS, bless, "yes", "no")
@@ -839,6 +843,16 @@ AC_SUBST(HAVE_OSX_PACKAGING)
 AC_CHECK_PROG(have_sw_vers, sw_vers, "yes", "no")
 AM_CONDITIONAL(NOT_OS_X, test "x$have_sw_vers" = "xno")
 
+#
+# Check compiler vendor. For GCC this will be 'gnu' and for Clang 'clang'.
+#
+AX_COMPILER_VENDOR
+if test "x$CXX" != "x" ; then
+       AC_LANG_PUSH(C++)
+       AX_COMPILER_VENDOR
+       AC_LANG_POP
+fi
+
 #
 # Some compilers have to be told to fail when passed an unknown -W flag;
 # make sure we do that.
@@ -868,6 +882,11 @@ AC_ARG_ENABLE(extra-compiler-warnings,
                #
                AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpedantic)
                #
+               # As we use variadic macros, we don't want warnings
+               # about them, even with -Wpedantic.
+               #
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-variadic-macros)
+               #
                # Various code blocks this one.
                #
                AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Woverflow)
@@ -925,14 +944,15 @@ AC_ARG_ENABLE(extra-compiler-warnings,
 #
 AC_ARG_ENABLE(asan,
   AC_HELP_STRING( [--enable-asan],
-                  [Enable AddressSanitizer (ASAN) for debugging (May be slow down)@<:@default=no@:>@]),
+                 [Enable AddressSanitizer (ASAN) for debugging (May be slow down)@<:@default=no@:>@]),
 [
-        #
-        # With Clang >= 3.5 Leak detection is enable by default
-        # and no yet all leak is fixed...
-        # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
-        #
-        AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fsanitize=address)
+       #
+       # With Clang >= 3.5 Leak detection is enable by default
+       # and no yet all leak is fixed...
+       # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
+       #
+       # XXX shouldn't this also be added to LDFLAGS?
+       AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fsanitize=address)
 
 ],)
 
@@ -957,7 +977,6 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdiv-by-zero)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wignored-qualifiers)
 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(-Wheader-guard)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable)
@@ -1027,6 +1046,16 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
 # so only enable this for C for now.
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
 
+# Clang only. Avoid "argument unused during compilation" warnings
+# (for example, when getting the -gsplit-dwarf option or
+# when combining -fwrapv with -fno-strict-overflow)
+if test x"$ax_cv_c_compiler_vendor" = xclang; then
+       AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Qunused-arguments, C)
+fi
+if test x"$ax_cv_cxx_compiler_vendor" = xclang; then
+       AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Qunused-arguments, CXX)
+fi
+
 #
 # Use the faster pre gcc 4.5 floating point precision if available.
 #
@@ -1039,18 +1068,16 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fexcess-precision=fast)
 # failures to export symbols, rather than having that fail only on
 # Windows.
 #
-CFLAGS_before_fvhidden="$CFLAGS"
-#
 # GCC and GCC-compatible compilers
 #
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fvisibility=hidden)
-if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
+if test "x$can_add_to_cflags" = "xno"
 then
        #
        # Sun^WOracle C.
        #
        AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xldscope=hidden)
-       if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
+       if test "x$can_add_to_cflags" = "xno"
        then
                # TODO add other ways of hiding symbols
                AC_MSG_WARN(Compiler will export all symbols from shared libraries)
@@ -1070,60 +1097,52 @@ AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
 # privileges, and using PIE means the OS can run it at random locations
 # in the address space to make attacks more difficult.
 #
-CFLAGS_before_pie="$CFLAGS"
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE)
-if test "x$CFLAGS" != "x$CFLAGS_before_pie"
-then
-       # Restore CFLAGS
-       CFLAGS="$CFLAGS_before_pie"
 
-       LDFLAGS_before_pie="$LDFLAGS"
+WS_CFLAGS_saved="$WS_CFLAGS"
+WS_LDFLAGS_saved="$WS_LDFLAGS"
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE, C)
+if test "x$can_add_to_cflags" = "xyes"
+then
        AC_WIRESHARK_LDFLAGS_CHECK([-fPIE -pie])
-       if test "x$LDFLAGS" != "x$LDFLAGS_before_pie"
+       if test "x$can_add_to_ldflags" = "xyes"
        then
                # We can use PIE
                PIE_CFLAGS="-fPIE"
                PIE_LDFLAGS="-pie"
-
-               # Restore LDFLAGS
-               LDFLAGS="$LDFLAGS_before_pie"
        fi
-
 fi
+WS_CFLAGS="$WS_CFLAGS_saved"
+WS_LDFLAGS="$WS_LDFLAGS_saved"
 AC_SUBST(PIE_CFLAGS)
 AC_SUBST(PIE_LDFLAGS)
 
-CFLAGS_before_simd="$CFLAGS"
+WS_CFLAGS_saved="$WS_CFLAGS"
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
-if test "x$CFLAGS" != "x$CFLAGS_before_simd"
+if test "x$can_add_to_cflags" = "xyes"
 then
        #
        # The compiler supports -msse4.2; use that to enable SSE 4.2.
        #
-       # Restore CFLAGS.  We only want to apply -msse4.2 to
+       # We only want to apply -msse4.2 to
        # wsutil/ws_mempbrk_sse42.c, as the SSE4.2 code there
        # is run only if the hardware supports it, but other
        # code would do no such checks.
        #
-       CFLAGS="$CFLAGS_before_simd"
        ac_sse4_2_flag=-msse4.2
 else
        #
        # Try -xarch=sse4_2; that's the flag for Sun's compiler.
        #
        AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xarch=sse4_2, C)
-       if test "x$CFLAGS" != "x$CFLAGS_before_simd"
+       if test "x$can_add_to_cflags" = "xyes"
        then
                #
                # The compiler supports -xarch=sse4_2; use that to
                # enable SSE 4.2.
-               #
-               # Restore CFLAGS; see above.
-               #
-               CFLAGS="$CFLAGS_before_simd"
                ac_sse4_2_flag=-xarch=sse4_2
        fi
 fi
+WS_CFLAGS="$WS_CFLAGS_saved"
 
 if test "x$ac_sse4_2_flag" != x; then
        #
@@ -1140,12 +1159,12 @@ if test "x$ac_sse4_2_flag" != x; then
                [#include <emmintrin.h>],
                [return 0;],
                [
-                       emmintrin_h_works=yes
-                       AC_MSG_RESULT([yes])
+                       emmintrin_h_works=yes
+                       AC_MSG_RESULT([yes])
                ],
                [
                        emmintrin_h_works=no
-                       AC_MSG_RESULT([no])
+                       AC_MSG_RESULT([no])
                ]
        )
 
@@ -1166,7 +1185,7 @@ if test "x$ac_sse4_2_flag" != x; then
                #
                AC_MSG_CHECKING([whether there is nmmintrin.h header and we can use it])
                saved_CFLAGS="$CFLAGS"
-               CFLAGS="$ac_sse4_2_flag $CFLAGS"
+               CFLAGS="$ac_sse4_2_flag $WS_CFLAGS $CFLAGS"
                AC_TRY_COMPILE(
                        [#include <nmmintrin.h>],
                        [return 0;],
@@ -1259,9 +1278,9 @@ if test "x$GCC" = "xyes" ; then
        solaris*)
                # the X11 headers don't automatically include prototype info
                # and a lot don't include the return type
-               CPPFLAGS="$CPPFLAGS -DFUNCPROTO=15"
-               CFLAGS="$CFLAGS -Wno-return-type"
-               CXXFLAGS="$CXXFLAGS -Wno-return-type"
+               WS_CPPFLAGS="$WS_CPPFLAGS -DFUNCPROTO=15"
+               WS_CFLAGS="$WS_CFLAGS -Wno-return-type"
+               WS_CXXFLAGS="$WS_CXXFLAGS -Wno-return-type"
                AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
                ;;
        *)
@@ -1275,18 +1294,34 @@ else
        case "$host_os" in
        hpux*)
                #
-               # HP's ANSI C compiler; flags suggested by Jost Martin.
-               # "-Ae" for ANSI C plus extensions such as "long long".
-               # "+O2", for optimization.  XXX - works with "-g"?
+               # AC_PROG_CC_STDC should already have added whatever
+               # flags are necessary for ISO C - C99 if available,
+               # otherwise C89 - with extensions.
+               #
+               # Add +O2, for optimization, as suggested by Jost Martin.
+               # XXX - works with "-g"?
+               #
+               # +O2 is supported both by the C and C++ compiler.
+               #
+               WS_CFLAGS="+O2 $WS_CFLAGS"
+               if test "$CC" = "$CC_FOR_BUILD"; then
+                       #
+                       # We're building the build tools with the same
+                       # compiler as the one with which we're building
+                       # Wireshark, so add the flags to the flags for
+                       # that compiler as well.
+                       #
+                       CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
+               fi
+               WS_CXXFLAGS="+O2 $WS_CXXFLAGS"
+               AC_MSG_RESULT(HP C/C++ compiler - added +O2)
+               ;;
+       solaris*)
                #
-               # HP's ANSI C++ compiler doesn't support "-Ae", but
-               # does support "+O2", at least according to the
-               # documentation I can find online.
+               # Crank up the warning level.
                #
-               CFLAGS="-Ae +O2 $CFLAGS"
-               CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
-               CXXFLAGS="+O2 $CFLAGS"
-               AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
+               WS_CFLAGS="$WS_CFLAGS -v"
+               WS_CXXFLAGS="$WS_CXXFLAGS +w2"
                ;;
        *)
                AC_MSG_RESULT(none needed)
@@ -1319,22 +1354,15 @@ darwin*)
        # with a static version installed in /usr/local/lib rather than
        # the system version in /usr/lib).
        #
-       # Also add -Wl,-rpath,@executable_path/../lib and
-       # -Wl,-rpath,/usr/local/lib, so that, if we build an app
-       # bundle, we can tweak all the executable images, shared
-       # libraries, and plugins in the bundle to look for non-system
-       # libraries in the rpath, rather than having a script tweak
-       # DYLD_LIBRARY_PATH.
-       #
-       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])
+       WS_LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-search_paths_first $WS_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 -Wl,-headerpad_max_install_names to all linker flags])
        ;;
 cygwin*)
        #
        # Shared libraries in cygwin/Win32 must never contain
        # undefined symbols.
        #
-       LDFLAGS="$LDFLAGS -no-undefined"
+       WS_LDFLAGS="$WS_LDFLAGS -no-undefined"
        AC_MSG_RESULT(CygWin GNU ld - added -no-undefined)
        ;;
 *)
@@ -1362,9 +1390,10 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
 # get version information from plists and thus need Core Foundation
 # to process those plists.
 #
+have_os_x_frameworks=no
 case "$host_os" in
-
 darwin*)
+       have_os_x_frameworks=yes
        AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
        APPLICATIONSERVICES_FRAMEWORKS="-framework ApplicationServices"
        SYSTEMCONFIGURATION_FRAMEWORKS="-framework SystemConfiguration"
@@ -1388,6 +1417,7 @@ esac
 AC_SUBST(APPLICATIONSERVICES_FRAMEWORKS)
 AC_SUBST(SYSTEMCONFIGURATION_FRAMEWORKS)
 AC_SUBST(COREFOUNDATION_FRAMEWORKS)
+AM_CONDITIONAL(HAVE_OS_X_FRAMEWORKS, [test "x$have_os_x_frameworks" = "xyes"])
 
 #
 # On Solaris, check whether we have getexecname().
@@ -1404,7 +1434,7 @@ dnl search path as this causes gcc 3.2 on Linux to complain about a change
 dnl of the system search order for includes
 AC_ARG_ENABLE(usr-local,
   AC_HELP_STRING( [--enable-usr-local],
-                  [look for headers and libs in /usr/local tree @<:@default=yes@:>@]),
+                 [look for headers and libs in /usr/local tree @<:@default=yes@:>@]),
     ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
 
 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
@@ -1417,12 +1447,12 @@ if test "x$ac_cv_enable_usr_local" = "xyes" ; then
                # as various packages we use ("libpcap", "zlib", "adns")
                # may have been installed under "/usr/local/include".
                #
-               CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+               AX_APPEND_FLAG([-I/usr/local/include], [WS_CPPFLAGS])
 
                #
                # Arrange that we search for libraries in "/usr/local/lib".
                #
-               AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
+               AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, /usr/local/lib)
        else
                AC_MSG_RESULT(no)
        fi
@@ -1489,13 +1519,13 @@ fi
 # Enable/disable wireshark
 AC_ARG_ENABLE(wireshark,
   AC_HELP_STRING( [--enable-wireshark],
-                  [build the Wireshark GUI (with Gtk+, Qt, or both) @<:@default=yes@:>@]),
+                 [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],
-                  [add support for packet editor in Wireshark @<:@default=yes@:>@]),
+                 [add support for packet editor in Wireshark @<:@default=yes@:>@]),
     enable_packet_editor=$enableval,enable_packet_editor=yes)
 if test x$enable_packet_editor = xyes; then
        AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor])
@@ -1510,8 +1540,8 @@ AC_MSG_CHECKING(if profile builds must be generated)
 if test "x$enable_profile_build" = "xyes" ; then
        if test "x$GCC" = "xyes" -o "x$CLANG" = "xyes" ; then
                AC_MSG_RESULT(yes)
-               CFLAGS=" -pg $CFLAGS"
-               CXXFLAGS=" -pg $CXXFLAGS"
+               WS_CFLAGS="-pg $WS_CFLAGS"
+               WS_CXXFLAGS="-pg $WS_CXXFLAGS"
        else
                AC_MSG_RESULT(no)
                echo "Building profile binaries currently only supported for GCC and clang."
@@ -1520,34 +1550,52 @@ else
        AC_MSG_RESULT(no)
 fi
 
-# Create DATAFILE_DIR #define for config.h
-datafiledir=$datadir/wireshark
-datafiledir=`(
-    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 DATAFILE_DIR had a value starting with
-    # "${prefix}/" instead of e.g. "/usr/local/"
-    eval eval echo "$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])
+GLIB_MIN_VERSION=2.16.0
+AC_SUBST(GLIB_MIN_VERSION)
+# GLib checks; we require GLib $GLIB_MIN_VERSION or later, and require gmodule
+# support, as we need that for dynamically loading plugins.
+#
+# Release dates for GLib versions:
+# 2.14.0: 03 Aug 2007
+# 2.16.0: 10 Mar 2008
+# 2.18.0: 02 Sep 2008
+# 2.20.0: 13 Mar 2009
+# 2.22.0: 22 Sep 2009
+# 2.24.0: 28 Mar 2010
+# 2.26.0: 27 Sep 2010
+# 2.28.0: 08 Feb 2011
+# 2.30.0: 27 Sep 2011
+# 2.32.0: 24 Mar 2012
+# 2.34.0: 24 Sep 2012
+# 2.36.0: 25 Mar 2013
+# 2.38.0: 23 Sep 2013
+# 2.40.0: 24 Mar 2014
+# 2.42.0: 22 Sep 2014
+# 2.44.0: 23 Mar 2014
+# 2.46.0: 25 Sep 2015
+
+PKG_WIRESHARK_CHECK_SYSTEM_MODULES([GLIB],
+       [glib-2.0 >= $GLIB_MIN_VERSION gthread-2.0 >= $GLIB_MIN_VERSION gmodule-2.0 >= $GLIB_MIN_VERSION],
+       [],
+       [AC_MSG_ERROR([GLib $GLIB_MIN_VERSION or later not found.])])
+
+# 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)
+#  is used.
+AX_APPEND_FLAG([-DG_DISABLE_SINGLE_INCLUDES], [GLIB_CONFIG])
+
+# Error out on the usage of deprecated glib functions
+AX_APPEND_FLAG([-DG_DISABLE_DEPRECATED], [GLIB_CONFIG])
+
+GLIB_CFLAGS="$GLIB_CONFIG $GLIB_CFLAGS"
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
 
 GTK2_MIN_VERSION=2.12.0
 AC_SUBST(GTK2_MIN_VERSION)
 GTK3_MIN_VERSION=3.0.0
 AC_SUBST(GTK3_MIN_VERSION)
-QT_MIN_VERSION=4.6.0
+QT_MIN_VERSION=4.7.0
 AC_SUBST(QT_MIN_VERSION)
 # GTK+ and Qt checks; we require GTK+ $GTK2_MIN_VERSION or later or
 # GTK3_MIN_VERSION or later or Qt $QT_MIN_VERSION or later.
@@ -1560,7 +1608,7 @@ AC_SUBST(QT_MIN_VERSION)
 # force all programs to be built with GTK+ or Qt.
 #
 # Release dates for GTK+ versions:
-# http://en.wikipedia.org/wiki/GTK+#Releases
+# https://en.wikipedia.org/wiki/GTK+#Releases
 # 2.12.0: 14 Sep 2007
 # 2.14.0: 04 Sep 2008
 # 2.16.0: 13 Mar 2009
@@ -1575,9 +1623,12 @@ AC_SUBST(QT_MIN_VERSION)
 # 3.8.0:  25 Mar 2013
 # 3.10.0: 23 Sep 2013
 # 3.12.0: 25 Mar 2014
+# 3.14.0: 30 Sep 2014
+# 3.16.0: 22 Mar 2015
+# 3.18.0  22 Sep 2015
 #
 # Release dates for Qt versions:
-# http://en.wikipedia.org/wiki/List_of_Qt_releases
+# https://en.wikipedia.org/wiki/List_of_Qt_releases
 # 4.6.0:  01 Dec 2009
 # 4.7.0:  21 Sep 2010
 # 4.8.0:  15 Dec 2011
@@ -1585,6 +1636,8 @@ AC_SUBST(QT_MIN_VERSION)
 # 5.1.0:  03 Jul 2013
 # 5.2.0:  12 Dec 2013
 # 5.3.0:  20 May 2014
+# 5.4.0:  10 Dec 2015
+# 5.5.0:  01 Jul 2015
 
 have_qt=no
 have_gtk=no
@@ -1593,14 +1646,23 @@ if test "x$enable_wireshark" = "xyes"; then
                "x$with_gtk3" = "xunspecified" -a \
                "x$with_qt" = "xunspecified"; then
                #
-               # No GUI toolkit was explicitly specified; pick Qt and GTK+ 3.
+               # No GUI toolkits were explicitly specified; pick Qt
+               # and GTK+ 3.
                #
                with_qt=yes
                with_gtk3=yes
+       elif test "x$with_gtk2" = "xunspecified" -a \
+                 "x$with_gtk3" = "xunspecified" -a \
+                 "x$with_qt" = "xno"; then
+               #
+               # Qt was explicitly disabled, and neither GTK+ 2 nor
+               # GTK+ 3 were explicitly specified; pick GTK+ 3.
+               #
+               with_gtk3=yes
        fi
-       if test "x$with_qt" = "xyes"; then
+       if test "x$with_qt" != "xno"; then
                #
-               # Qt was specified; Make sure we have a C++ compiler.
+               # Qt was specified; make sure we have a C++ compiler.
                #
                if test -z "$CXX"; then
                        AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt)
@@ -1610,20 +1672,87 @@ if test "x$enable_wireshark" = "xyes"; then
                # Now make sure we have Qt and, if so, add the flags
                # for it to CFLAGS and CXXFLAGS.
                #
-               AC_WIRESHARK_QT_CHECK($QT_MIN_VERSION,
+               AC_WIRESHARK_QT_CHECK($QT_MIN_VERSION, "$with_qt",
                [
-                       CFLAGS="$CFLAGS $Qt_CFLAGS"
-                       CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
+                       AC_SUBST(Qt_CFLAGS)
+                       AC_SUBST(Qt_LIBS)
                        have_qt=yes
                        GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-qt"
+
+                       #
+                       # We're building with Qt, so we need the Qt build
+                       # tools in order to build the Wireshark GUI.
+                       # We've found a particular major version of Qt,
+                       # and we want that version's build tools; for
+                       # example, the Qt 4 version of uic produces files
+                       # that include Qt headers with paths that work
+                       # with Qt 4 but not Qt 5, so we can't use the
+                       # Qt 4 version of uic if we're building with Qt 5.
+                       AC_WIRESHARK_QT_TOOL_CHECK(UIC, uic, "$qt_version")
+                       AC_SUBST(UIC)
+                       AC_WIRESHARK_QT_TOOL_CHECK(MOC, moc, "$qt_version")
+                       AC_SUBST(MOC)
+                       AC_WIRESHARK_QT_TOOL_CHECK(RCC, rcc, "$qt_version")
+                       AC_SUBST(RCC)
+
+                       #
+                       # On Darwin, find where the Qt frameworks are
+                       # located, and add that to the rpath, just in
+                       # case this is Qt 5.5 or later and the frameworks
+                       # have an install name that begins with @rpath
+                       # and aren't installed in a frameworks directory
+                       # that's searched by default.
+                       #
+                       case "$host_os" in
+                       darwin*)
+                               if test $qt_version -le 4
+                               then
+                                       Qt_LDFLAGS="-Wl,-rpath,"`$PKG_CONFIG --libs QtCore | sed -e 's/-F//' -e 's/ -framework.*//'`
+                               else
+                                       Qt_LDFLAGS="-Wl,-rpath,"`$PKG_CONFIG --libs Qt${qt_version}Core | sed -e 's/-F//' -e 's/ -framework.*//'`
+                               fi
+                               ;;
+                       esac
+                       AC_SUBST(Qt_LDFLAGS)
+                       if test -z "$MOC_OPTIONS"
+                       then
+                               if test $qt_version -eq 5
+                               then
+                                       MOC_OPTIONS="--no-notes"
+                               elif test $qt_version -eq 4
+                               then
+                                       qt_minor_version=`echo "$QT_VERSION" | cut -f2 -d.`
+                                       if test $qt_minor_version -ge 8
+                                       then
+                                               MOC_OPTIONS="-nn"
+                                       fi
+                               fi
+                       fi
+                       AC_SUBST(MOC_OPTIONS)
                ],
-               [AC_MSG_ERROR([Qt is not available])])
+               [
+                       case "$with_qt" in
 
-               #
-               # XXX - greasy hack to make ui/gtk/recent.c
-               # compile.
-               #
-               CPPFLAGS="-DQT_GUI_LIB"
+                       unspecified)
+                               #
+                               # They didn't explicitly ask for Qt,
+                               # so just don't build with it.
+                               #
+                               ;;
+
+                       yes)
+                               AC_MSG_ERROR([Qt is not available])
+                               ;;
+
+                       4)
+                               AC_MSG_ERROR([Qt 4 is not available])
+                               ;;
+
+                       5)
+                               AC_MSG_ERROR([Qt 5 is not available])
+                               ;;
+                       esac
+               ])
        fi
 
        if test "x$with_gtk3" = "xyes"; then
@@ -1639,63 +1768,76 @@ if test "x$enable_wireshark" = "xyes"; then
                #
                # Make sure we have GTK+ 3.
                #
-               AM_PATH_GTK_3_0(3.0.0,
-               [
-                       CFLAGS="$CFLAGS $GTK_CFLAGS"
-                       CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
-                       have_gtk=yes
-                       GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk3"
-               ],
-               [AC_MSG_ERROR([GTK+ 3 is not available])])
+               PKG_WIRESHARK_CHECK_SYSTEM_MODULES([GTK],
+                       [gtk+-3.0 >= $GTK3_MIN_VERSION glib-2.0 >= $GLIB_MIN_VERSION gthread-2.0 >= $GLIB_MIN_VERSION gmodule-2.0 >= $GLIB_MIN_VERSION],
+                       [
+                               have_gtk=yes
+                               GTK_VERSION=`$PKG_CONFIG --modversion gtk+-3.0`
+                               GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk3"
+                       ],
+                       [AC_MSG_ERROR([GTK+ 3 is not available])])
        elif test "x$with_gtk2" = "xyes"; then
                #
                # GTK+ 3 wasn't specified, and GTK+ 2 was specified;
                # make sure we have GTK+ 2.
                #
-               AM_PATH_GTK_2_0($GTK2_MIN_VERSION,
-               [
-                       CFLAGS="$CFLAGS $GTK_CFLAGS"
-                       CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
-                       have_gtk=yes
-                       GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk2"
-               ],
-               [AC_MSG_ERROR([GTK+ 2 is not available])])
+               PKG_WIRESHARK_CHECK_SYSTEM_MODULES([GTK],
+                       [gtk+-2.0 >= $GTK2_MIN_VERSION glib-2.0 >= $GLIB_MIN_VERSION gthread-2.0 >= $GLIB_MIN_VERSION gmodule-2.0 >= $GLIB_MIN_VERSION],
+                       [
+                               have_gtk=yes
+                               GTK_VERSION=`$PKG_CONFIG --modversion gtk+-2.0`
+                               GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk2"
+                       ],
+                       [AC_MSG_ERROR([GTK+ 2 is not available])])
+       fi
+
+       if test "$have_gtk" = "yes" ; then
+               # If we have GTK then add flags for it.
+               #
+               # GLib flags first
+               #
+               GTK_CONFIG="$GLIB_CONFIG"
+
+               gtk_config_major_version=`echo $GTK_VERSION | cut -d. -f1`
+               gtk_config_minor_version=`echo $GTK_VERSION | cut -d. -f2`
+
+               AX_APPEND_FLAG([-DGDK_DISABLE_DEPRECATED], [GTK_CONFIG])
+               if test \( $gtk_config_major_version -eq 3 -a $gtk_config_minor_version -ge 10 \) ; then
+                       ## Allow use of deprecated & disable deprecated warnings if Gtk >= 3.10;
+                       ##  The deprecations in Gtk 3.10 will not be fixed ...
+                       AX_APPEND_FLAG([-DGDK_DISABLE_DEPRECATION_WARNINGS], [GTK_CONFIG])
+               else
+                       AX_APPEND_FLAG([-DGTK_DISABLE_DEPRECATED], [GTK_CONFIG])
+               fi
+               AX_APPEND_FLAG([-DGTK_DISABLE_SINGLE_INCLUDES], [GTK_CONFIG])
+               if test ! \( $gtk_config_major_version -eq 2 -a $gtk_config_minor_version -lt 20 \) ; then
+                       # Enable GSEAL when building with GTK > 2.20
+                       # (Versions prior to 2.22 lacked some necessary accessors.)
+                       AX_APPEND_FLAG([-DGSEAL_ENABLE], [GTK_CONFIG])
+               fi
+
+               GTK_CFLAGS="$GTK_CONFIG $GTK_CFLAGS"
        fi
 fi
+
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
 AC_SUBST(GUI_CONFIGURE_FLAGS)
 
-GLIB_MIN_VERSION=2.16.0
-AC_SUBST(GLIB_MIN_VERSION)
-# GLib checks; we require GLib $GLIB_MIN_VERSION or later, and require gmodule
-# support, as we need that for dynamically loading plugins.
-# If we found GTK+, this doesn't add GLIB_CFLAGS to CFLAGS, because
-# AM_PATH_GTK will add GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a
-# superset of GLIB_CFLAGS.  If we didn't find GTK+, it does add
-# GLIB_CFLAGS to CFLAGS.
-# However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
-# set when generating the Makefile, so we can make programs that require
-# only GLib link with @GLIB_LIBS@ and make programs that require GTK+
-# link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
-# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
-# programs to be built with GLib.
-#
-# Release dates for GLib versions:
-# 2.14.0: 03 Aug 2007
-# 2.16.0: 10 Mar 2008
-# 2.18.0: 02 Sep 2008
-# 2.20.0: 13 Mar 2009
-# 2.22.0: 22 Sep 2009
-# 2.24.0: 28 Mar 2010
-# 2.26.0: 27 Sep 2010
-# 2.28.0: 08 Feb 2011
-# 2.30.0: 27 Sep 2011
-# 2.32.0: 24 Mar 2012
-# 2.34.0: 24 Sep 2012
-# 2.36.0: 25 Mar 2013
-# 2.38.0: 23 Sep 2013
-# 2.40.0: 24 Mar 2014
+# Check for GTK GUI support for GResource pixbufs
+have_gresource_pixbuf=no
+if test "x$have_gtk" = "xyes"; then
+       AC_MSG_CHECKING(whether GDK-Pixbuf can load data using GResource)
+       PKG_CHECK_EXISTS([gio-2.0 >= 2.32 gdk-pixbuf-2.0 >= 2.26],
+         [
+          AC_MSG_RESULT(yes)
+          AC_DEFINE(HAVE_GDK_GRESOURCE, 1, [Defined if GResource is supported])
+          have_gresource_pixbuf=yes
+         ],
+         [AC_MSG_RESULT(no)])
+fi
+AM_CONDITIONAL(HAVE_GRESOURCE_PIXBUF, test "x$have_gresource_pixbuf" = "xyes")
 
-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-gtk.
@@ -1741,146 +1883,6 @@ if test "$have_gtk" = "no" -a "$have_qt" = "no" ; then
        wireshark_man=""
 fi
 
-if test "$have_gtk" = "yes" ; then
-       # If we have GTK then add flags for it.
-
-       CPPFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CPPFLAGS"
-       CPPFLAGS="-DGDK_DISABLE_DEPRECATED $CPPFLAGS"
-       if test \( $gtk_config_major_version -eq 3 -a $gtk_config_minor_version -ge 10 \) ; then
-               ## Allow use of deprecated & disable deprecated warnings if Gtk >= 3.10;
-               ##  The deprecations in Gtk 3.10 will not be fixed ...
-               CPPFLAGS="-DGDK_DISABLE_DEPRECATION_WARNINGS $CPPFLAGS"
-       else
-               CPPFLAGS="-DGTK_DISABLE_DEPRECATED $CPPFLAGS"
-       fi
-       CPPFLAGS="-DGTK_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
-       if test ! \( $gtk_config_major_version -eq 2 -a $gtk_config_minor_version -lt 20 \) ; then
-               # Enable GSEAL when building with GTK > 2.20
-               # (Versions prior to 2.22 lacked some necessary accessors.)
-               CPPFLAGS="-DGSEAL_ENABLE $CPPFLAGS"
-       fi
-fi
-
-# XXX - Is this really necessary?  When we build with both Gtk+ and Qt it works...
-if test "$use_glib_cflags" = "true"; then
-       # Use GLIB_CFLAGS
-       AM_PATH_GLIB_2_0($GLIB_MIN_VERSION,
-       [
-               CFLAGS="$CFLAGS $GLIB_CFLAGS"
-               CXXFLAGS="$CXXFLAGS $GLIB_CFLAGS"
-       ], AC_MSG_ERROR(GLib $GLIB_MIN_VERSION or later distribution not found.), gthread gmodule)
-else
-       # Don't use GLIB_CFLAGS
-       AM_PATH_GLIB_2_0($GLIB_MIN_VERSION, , AC_MSG_ERROR(GLib $GLIB_MIN_VERSION or later distribution not found.), gthread gmodule)
-fi
-
-#
-# "make dist" requires that we have the Qt build tools.
-#
-# Annoyingly, at least on Fedora 16, uic and moc are named XXX-qt4
-# rather than just XXX, perhaps to allow Qt 3 and Qt 4 tools to be
-# installed; if they're still doing that in current Fedora releases,
-# perhaps there will also be XXX-qt5 when they pick up Qt 5.
-#
-AC_PATH_PROG(UIC, uic)
-if test "x$UIC" = x
-then
-       AC_PATH_PROG(UIC, uic-qt5)
-       if test "x$UIC" = x
-       then
-               AC_PATH_PROG(UIC, uic-qt4)
-               if test "x$UIC" = x
-               then
-                       if test "x$with_qt" = "xyes"; then
-                               #
-                               # If you want to build with Qt, you'd better
-                               # have uic.
-                               #
-                               AC_MSG_ERROR(I couldn't find uic or uic-qt5 or uic-qt4; 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.
-                               #
-                               UIC=uic
-                       fi
-               fi
-       fi
-fi
-AC_SUBST(UIC)
-AC_PATH_PROG(MOC, moc)
-if test "x$MOC" = x
-then
-       AC_PATH_PROG(MOC, moc-qt5)
-       if test "x$MOC" = x
-       then
-               AC_PATH_PROG(MOC, moc-qt4)
-               if test "x$MOC" = 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 moc or moc-qt5 or moc-qt4; 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.
-                               #
-                               MIC=moc
-                       fi
-               fi
-       fi
-fi
-AC_SUBST(MOC)
-AC_PATH_PROG(RCC, rcc)
-if test "x$RCC" = x
-then
-       AC_PATH_PROG(RCC, rcc-qt5)
-       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 or rcc-qt5; 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
-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)
-#  is used.
-CPPFLAGS="-DG_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
-
-# Error out on the usage of deprecated glib functions
-CPPFLAGS="-DG_DISABLE_DEPRECATED $CPPFLAGS"
-
 #
 # Check whether GLib modules are supported, to determine whether we
 # can support plugins.
@@ -1888,8 +1890,8 @@ CPPFLAGS="-DG_DISABLE_DEPRECATED $CPPFLAGS"
 AC_MSG_CHECKING(whether GLib supports loadable modules)
 ac_save_CFLAGS="$CFLAGS"
 ac_save_LIBS="$LIBS"
-CFLAGS="$CFLAGS $GLIB_CFLAGS"
-LIBS="$GLIB_LIBS $LIBS"
+CFLAGS="$WS_CFLAGS $GLIB_CFLAGS $CFLAGS"
+LIBS="$LIBS $GLIB_LIBS"
 AC_TRY_RUN([
 #include <glib.h>
 #include <gmodule.h>
@@ -1932,8 +1934,8 @@ then
        #
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LIBS="$LIBS"
-       CFLAGS="$CFLAGS $GLIB_CFLAGS"
-       LIBS="$GLIB_LIBS $LIBS"
+       CFLAGS="$WS_CFLAGS $GLIB_CFLAGS $CFLAGS"
+       LIBS="$LIBS $GLIB_LIBS"
        AC_CHECK_FUNCS(dladdr)
        if test x$ac_cv_func_dladdr = xno
        then
@@ -1959,8 +1961,8 @@ fi
 AC_MSG_CHECKING(whether GLib supports POSIX/XSI thousands grouping)
 ac_save_CFLAGS="$CFLAGS"
 ac_save_LIBS="$LIBS"
-CFLAGS="$CFLAGS $GLIB_CFLAGS"
-LIBS="$GLIB_LIBS $LIBS"
+CFLAGS="$WS_CFLAGS $GLIB_CFLAGS $CFLAGS"
+LIBS="$LIBS $GLIB_LIBS"
 AC_TRY_RUN([
 #include <glib.h>
 #include <locale.h>
@@ -1998,22 +2000,22 @@ then
 
     AC_ARG_WITH(osx-integration,
       AC_HELP_STRING( [--with-osx-integration],
-                      [use OS X integration functions @<:@default=yes, if available@:>@]),
+                     [use OS X integration functions @<:@default=yes, if available@:>@]),
     [
-        if test $withval = no
-        then
-            want_osx_integration=no
-        else
-            want_osx_integration=yes
-        fi
+       if test $withval = no
+       then
+           want_osx_integration=no
+       else
+           want_osx_integration=yes
+       fi
     ],[
-        want_osx_integration=yes
+       want_osx_integration=yes
     ])
     if test "x$want_osx_integration" = "xno"; then
-        AC_MSG_RESULT(no)
+       AC_MSG_RESULT(no)
     else
-        AC_MSG_RESULT(yes)
-        AC_WIRESHARK_OSX_INTEGRATION_CHECK
+       AC_MSG_RESULT(yes)
+       AC_WIRESHARK_OSX_INTEGRATION_CHECK
     fi
 fi
 
@@ -2027,7 +2029,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
@@ -2045,7 +2047,7 @@ AC_SUBST(tshark_man)
 
 AC_ARG_ENABLE(editcap,
   AC_HELP_STRING( [--enable-editcap],
-                  [build editcap @<:@default=yes@:>@]),
+                 [build editcap @<:@default=yes@:>@]),
     enable_editcap=$enableval,enable_editcap=yes)
 
 if test "x$enable_editcap" = "xyes" ; then
@@ -2066,7 +2068,7 @@ AC_SUBST(editcap_man)
 
 AC_ARG_ENABLE(capinfos,
   AC_HELP_STRING( [--enable-capinfos],
-                  [build capinfos @<:@default=yes@:>@]),
+                 [build capinfos @<:@default=yes@:>@]),
     enable_capinfos=$enableval,enable_capinfos=yes)
 
 if test "x$enable_capinfos" = "xyes" ; then
@@ -2083,7 +2085,7 @@ AC_SUBST(capinfos_man)
 
 AC_ARG_ENABLE(captype,
   AC_HELP_STRING( [--enable-captype],
-                  [build captype @<:@default=yes@:>@]),
+                 [build captype @<:@default=yes@:>@]),
     enable_captype=$enableval,enable_captype=yes)
 
 if test "x$enable_captype" = "xyes" ; then
@@ -2100,7 +2102,7 @@ AC_SUBST(captype_man)
 
 AC_ARG_ENABLE(mergecap,
   AC_HELP_STRING( [--enable-mergecap],
-                  [build mergecap @<:@default=yes@:>@]),
+                 [build mergecap @<:@default=yes@:>@]),
     enable_mergecap=$enableval,enable_mergecap=yes)
 
 if test "x$enable_mergecap" = "xyes" ; then
@@ -2117,7 +2119,7 @@ AC_SUBST(mergecap_man)
 
 AC_ARG_ENABLE(reordercap,
   AC_HELP_STRING( [--enable-reordercap],
-                  [build reordercap @<:@default=yes@:>@]),
+                 [build reordercap @<:@default=yes@:>@]),
     enable_reordercap=$enableval,enable_reordercap=yes)
 
 if test "x$enable_reordercap" = "xyes" ; then
@@ -2134,7 +2136,7 @@ AC_SUBST(reordercap_man)
 
 AC_ARG_ENABLE(text2pcap,
   AC_HELP_STRING( [--enable-text2pcap],
-                  [build text2pcap @<:@default=yes@:>@]),
+                 [build text2pcap @<:@default=yes@:>@]),
     text2pcap=$enableval,enable_text2pcap=yes)
 
 if test "x$enable_text2pcap" = "xyes" ; then
@@ -2151,7 +2153,7 @@ AC_SUBST(text2pcap_man)
 
 AC_ARG_ENABLE(dftest,
   AC_HELP_STRING( [--enable-dftest],
-                  [build dftest @<:@default=yes@:>@]),
+                 [build dftest @<:@default=yes@:>@]),
     enable_dftest=$enableval,enable_dftest=yes)
 
 if test "x$enable_dftest" = "xyes" ; then
@@ -2168,7 +2170,7 @@ AC_SUBST(dftest_man)
 
 AC_ARG_ENABLE(randpkt,
   AC_HELP_STRING( [--enable-randpkt],
-                  [build randpkt @<:@default=yes@:>@]),
+                 [build randpkt @<:@default=yes@:>@]),
     enable_randpkt=$enableval,enable_randpkt=yes)
 
 if test "x$enable_randpkt" = "xyes" ; then
@@ -2192,7 +2194,7 @@ AC_MSG_CHECKING(whether to use libpcap for packet capture)
 
 AC_ARG_WITH(pcap,
   AC_HELP_STRING( [--with-pcap@<:@=DIR@:>@],
-                  [use libpcap for packet capturing @<:@default=yes@:>@]),
+                 [use libpcap for packet capturing @<:@default=yes@:>@]),
 [
        if test $withval = no
        then
@@ -2215,33 +2217,12 @@ else
        AC_WIRESHARK_PCAP_CHECK
 fi
 
-
-dnl Check for airpcap
-AC_MSG_CHECKING(whether to include airpcap support)
-AC_ARG_ENABLE(airpcap,
-  AC_HELP_STRING( [--enable-airpcap],
-                  [use AirPcap in Wireshark @<:@default=yes@:>@]),
-  enable_airpcap=$enableval, enable_airpcap=yes)
-
-if test x$enable_airpcap = xyes; then
-       if test "x$want_pcap" = "xno" ; then
-               enable_airpcap=no
-               AC_MSG_RESULT(pcap not available - disabling airpcap)
-       else
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_AIRPCAP, 1, [Enable AirPcap])
-       fi
-else
-       AC_MSG_RESULT(no)
-fi
-
-
 dnl dumpcap check
 AC_MSG_CHECKING(whether to build dumpcap)
 
 AC_ARG_ENABLE(dumpcap,
   AC_HELP_STRING( [--enable-dumpcap],
-                  [build dumpcap @<:@default=yes@:>@]),
+                 [build dumpcap @<:@default=yes@:>@]),
     enable_dumpcap=$enableval,enable_dumpcap=yes)
 
 if test "x$enable_dumpcap" = "xyes" ; then
@@ -2272,7 +2253,7 @@ AC_MSG_CHECKING(whether to build rawshark)
 
 AC_ARG_ENABLE(rawshark,
   AC_HELP_STRING( [--enable-rawshark],
-                  [build rawshark @<:@default=yes@:>@]),
+                 [build rawshark @<:@default=yes@:>@]),
     rawshark=$enableval,enable_rawshark=yes)
 
 if test "x$enable_rawshark" = "xyes" ; then
@@ -2296,11 +2277,81 @@ fi
 AC_SUBST(rawshark_bin)
 AC_SUBST(rawshark_man)
 
+dnl androiddump check
+AC_MSG_CHECKING(whether to build androiddump)
+
+AC_ARG_ENABLE(androiddump,
+  AC_HELP_STRING( [--enable-androiddump],
+                 [build androiddump @<:@default=yes@:>@]),
+    androiddump=$enableval,enable_androiddump=yes)
+
+if test "x$enable_androiddump" = "xyes" ; then
+       AC_MSG_RESULT(yes)
+else
+       AC_MSG_RESULT(no)
+fi
+
+AC_ARG_ENABLE(androiddump_use_libpcap,
+  AC_HELP_STRING( [--enable-androiddump-use-libpcap],
+                 [build androiddump using libpcap @<:@default=no@:>@]),
+    androiddump_use_libpcap=$enableval,enable_androiddump_use_libpcap=no)
+
+if test "x$enable_androiddump_use_libpcap" = "xyes" ; then
+       AC_DEFINE(ANDROIDDUMP_USE_LIBPCAP, 1, [Androiddump will use Libpcap])
+fi
+
+if test "x$enable_androiddump" = "xyes" ; then
+       androiddump_bin="androiddump\$(EXEEXT)"
+       androiddump_man=""
+else
+       androiddump_bin=""
+       androiddump_man=""
+fi
+AC_SUBST(androiddump_bin)
+AC_SUBST(androiddump_man)
+
+dnl sshdump check
+AC_MSG_CHECKING(whether to build sshdump)
+
+AC_ARG_ENABLE(sshdump,
+  AC_HELP_STRING( [--enable-sshdump],
+                 [build sshdump @<:@default=yes@:>@]),
+    sshdump=$enableval,enable_sshdump=yes)
+
+if test "x$enable_sshdump" = "xyes" ; then
+       AC_MSG_RESULT(yes)
+else
+       AC_MSG_RESULT(no)
+fi
+
+dnl randpktdump check
+AC_MSG_CHECKING(whether to build randpktdump)
+
+AC_ARG_ENABLE(randpktdump,
+  AC_HELP_STRING( [--enable-randpktdump],
+                 [build androiddump @<:@default=yes@:>@]),
+    randpktdump=$enableval,enable_randpktdump=yes)
+
+if test "x$enable_randpktdump" = "xyes" ; then
+       AC_MSG_RESULT(yes)
+else
+       AC_MSG_RESULT(no)
+fi
+
+if test "x$enable_randpktdump" = "xyes" ; then
+       randpktdump_bin="randpktdump\$(EXEEXT)"
+       randpktdump_man=""
+else
+       randpktdump_bin=""
+       randpktdump_man=""
+fi
+AC_SUBST(randpktdump_bin)
+AC_SUBST(randpktdump_man)
 
 # Enable/disable echld
 AC_ARG_ENABLE(echld,
   AC_HELP_STRING( [--enable-echld],
-                  [support echld (Experimental) @<:@default=no@:>@]),
+                 [support echld (Experimental) @<:@default=no@:>@]),
     have_echld=$enableval,have_echld=no)
 
 AM_CONDITIONAL(HAVE_ECHLD, test "x$have_echld" = "xyes")
@@ -2320,7 +2371,7 @@ AC_SUBST(echld_dir)
 # Enable/disable tfshark
 AC_ARG_ENABLE(tfshark,
   AC_HELP_STRING( [--enable-tfshark],
-                  [build tfshark (Experimental) @<:@default=no@:>@]),
+                 [build tfshark (Experimental) @<:@default=no@:>@]),
     tfshark=$enableval,enable_tfshark=no)
 
 if test "x$enable_tfshark" = "xyes" ; then
@@ -2338,7 +2389,7 @@ AC_SUBST(tfshark_man)
 dnl Use pcap-ng by default
 AC_ARG_ENABLE(pcap-ng-default,
   AC_HELP_STRING( [--enable-pcap-ng-default],
-                  [use the pcap-ng file format by default instead of pcap @<:@default=yes@:>@]),
+                 [use the pcap-ng file format by default instead of pcap @<:@default=yes@:>@]),
     enable_pcap_ng_default=$enableval,enable_pcap_ng_default=yes)
 if test x$enable_pcap_ng_default = xyes; then
        AC_DEFINE(PCAP_NG_DEFAULT, 1, [Support for pcap-ng])
@@ -2349,13 +2400,13 @@ AC_MSG_CHECKING(whether to use libpcap remote capturing feature)
 
 AC_ARG_WITH(pcap-remote,
     AC_HELP_STRING([--with-pcap-remote],
-                   [use libpcap remote capturing (requires libpcap)]),
+                  [use libpcap remote capturing (requires libpcap)]),
 [
     if test $withval = no
     then
-        want_pcap_remote=no
+       want_pcap_remote=no
     else
-        want_pcap_remote=yes
+       want_pcap_remote=yes
     fi
 ],[
     want_pcap_remote=no
@@ -2372,7 +2423,7 @@ AC_MSG_CHECKING(whether to use zlib for gzip compression and decompression)
 
 AC_ARG_WITH(zlib,
   AC_HELP_STRING([--with-zlib@<:@=DIR@:>@],
-                 [use zlib (located in directory DIR, if supplied) for gzip compression and decompression @<:@default=yes, if available@:>@]),
+                [use zlib (located in directory DIR, if supplied) for gzip compression and decompression @<:@default=yes, if available@:>@]),
 [
        if test "x$withval" = "xno"
        then
@@ -2392,10 +2443,10 @@ AC_ARG_WITH(zlib,
        zlib_dir=
 ])
 if test "x$want_zlib" = "xno" ; then
-        AC_MSG_RESULT(no)
+       AC_MSG_RESULT(no)
 else
-        AC_MSG_RESULT(yes)
-        AC_WIRESHARK_ZLIB_CHECK
+       AC_MSG_RESULT(yes)
+       AC_WIRESHARK_ZLIB_CHECK
        if test "x$want_zlib" = "xno" ; then
                AC_MSG_RESULT(zlib not found - disabling gzip compression and decompression)
        else
@@ -2408,7 +2459,7 @@ fi
 dnl Lua check
 AC_ARG_WITH(lua,
   AC_HELP_STRING( [--with-lua@<:@=DIR@:>@],
-                  [use liblua (located in directory DIR, if supplied) for the Lua scripting plugin @<:@default=yes, if available@:>@]),
+                 [use liblua (located in directory DIR, if supplied) for the Lua scripting plugin @<:@default=yes, if available@:>@]),
 [
        if test $withval = no
        then
@@ -2430,7 +2481,7 @@ if test "x$want_lua" != "xno" ; then
 
        if test "x$want_lua" = "xyes" -a "x$have_lua" = "xno"
        then
-                AC_MSG_ERROR([Lua support was requested, but is not available])
+               AC_MSG_ERROR([Lua support was requested, but is not available])
        fi
 fi
 if test "x$have_lua" = "xyes"
@@ -2443,11 +2494,11 @@ AC_SUBST(LUA_CFLAGS)
 
 
 dnl portaudio check
-AC_MSG_CHECKING(whether to use libportaudio for the rtp_player)
+AC_MSG_CHECKING(whether to use libportaudio for the GTK+ RTP player)
 
 AC_ARG_WITH(portaudio,
   AC_HELP_STRING( [--with-portaudio@<:@=DIR@:>@],
-                  [use libportaudio (located in directory DIR, if supplied) for the rtp_player @<:@default=yes, if available@:>@]),
+                 [use libportaudio (located in directory DIR, if supplied) for the GTK+ RTP player @<:@default=yes, if available@:>@]),
 [
        if test $withval = no
        then
@@ -2472,32 +2523,17 @@ else
        AC_MSG_RESULT(yes)
        AC_WIRESHARK_LIBPORTAUDIO_CHECK
        if test "x$want_portaudio" = "xno" ; then
-               AC_MSG_RESULT(libportaudio not found - disabling support for the rtp_player)
+               AC_MSG_RESULT(libportaudio not found - disabling support for the GTK+ RTP player)
        fi
 fi
 AM_CONDITIONAL(HAVE_LIBPORTAUDIO, test x$want_portaudio = xyes)
 
 
-dnl ipv6 check
-AC_ARG_ENABLE(ipv6,
-  AC_HELP_STRING( [--enable-ipv6],
-                  [use IPv6 name resolution, if available @<:@default=yes@:>@]),
-    enable_ipv6=$enableval,enable_ipv6=yes)
-
-AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
-if test "x$enable_ipv6" = "xno" ; then
-       AC_MSG_RESULT(no)
-else
-       AC_MSG_RESULT(yes)
-       AC_WIRESHARK_IPV6_STACK
-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@:>@]),
+                 [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)
@@ -2520,7 +2556,7 @@ 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],
-                  [install dumpcap as setuid @<:@default=no@:>@]),
+                 [install dumpcap as setuid @<:@default=no@:>@]),
     enable_setuid_install=$enableval,enable_setuid_install=no)
 
 AC_MSG_CHECKING(whether to install dumpcap setuid)
@@ -2546,13 +2582,13 @@ 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]),
+                 [restrict dumpcap to GROUP]),
 [
   if test "x$withval" = "xyes"; then
       AC_MSG_ERROR([No dumpcap group specified.])
   elif test "x$withval" != "xno"; then
       if test "x$enable_dumpcap" = "xno" ; then
-          AC_MSG_ERROR(dumpcap group install works only with dumpcap but dumpcap is disabled)
+         AC_MSG_ERROR(dumpcap group install works only with dumpcap but dumpcap is disabled)
       fi
       AC_MSG_RESULT($withval)
       DUMPCAP_GROUP="$withval"
@@ -2567,7 +2603,7 @@ AC_MSG_CHECKING(whether to use the libcap capabilities library)
 
 AC_ARG_WITH(libcap,
   AC_HELP_STRING( [--with-libcap@<:@=DIR@:>@],
-                  [use libcap (located in directory DIR, if supplied) for POSIX.1e capabilities management @<:@default=yes, if present@:>@]),
+                 [use libcap (located in directory DIR, if supplied) for POSIX.1e capabilities management @<:@default=yes, if present@:>@]),
 [
 if   test "x$withval" = "xno";  then
        want_libcap=no
@@ -2575,7 +2611,7 @@ elif test "x$withval" = "xyes"; then
        want_libcap=yes
 elif test -d "$withval"; then
        want_libcap=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ])
 if test "x$with_libcap" = "xno" ; then
@@ -2591,28 +2627,39 @@ dnl Some of these may not be needed: http://hacks.owlfolio.org/header-survey/
 dnl Note, however, that, whilst this script is generally run only on UN*Xes:
 dnl
 dnl     1) we also support building on and for Windows and not all of those
-dnl        headers are present on Windows, so the code has to check a
-dnl        #define *anyway* to determine whether to include the header
-dnl        file
+dnl       headers are present on Windows, so the code has to check a
+dnl       #define *anyway* to determine whether to include the header
+dnl       file
 dnl
 dnl and
 dnl
 dnl     2) this might also be run on Windows with a sufficiently UNIXy
-dnl        environment such as Cygwin (although Wireshark should be built
-dnl        natively rather than using Cygwin).
+dnl       environment such as Cygwin (although Wireshark should be built
+dnl       natively rather than using Cygwin).
 dnl
 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h unistd.h)
 AC_CHECK_HEADERS(sys/ioctl.h sys/param.h sys/socket.h sys/sockio.h sys/stat.h sys/time.h sys/types.h sys/utsname.h sys/wait.h)
 AC_CHECK_HEADERS(netinet/in.h)
 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
 
+#
+# On Linux, check for some additional headers, which we need as a
+# workaround for a bonding driver bug and for libpcap's current lack
+# of its own workaround for that bug.
+#
+case "$host_os" in
+linux*)
+       AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,[#include <sys/socket.h>])
+       ;;
+esac
+
 dnl SSL Check
 SSL_LIBS=''
 AC_MSG_CHECKING(whether to use SSL library)
 
 AC_ARG_WITH(ssl,
   AC_HELP_STRING( [--with-ssl@<:@=DIR@:>@],
-                  [use SSL crypto library (located in directory DIR, if supplied) @<:@default=no@:>@]),
+                 [use SSL crypto library (located in directory DIR, if supplied) @<:@default=no@:>@]),
 [
 if test "x$withval" = "xno";  then
        want_ssl=no
@@ -2620,7 +2667,7 @@ elif test "x$withval" = "xyes"; then
        want_ssl=yes
 elif test -d "$withval"; then
        want_ssl=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ],[
        want_ssl=no
@@ -2632,7 +2679,7 @@ if test "x$want_ssl" = "xyes"; then
                SSL_LIBS=-lcrypto
            ],
            [
-                AC_MSG_ERROR([SSL crypto library was requested, but is not available])
+               AC_MSG_ERROR([SSL crypto library was requested, but is not available])
            ])
 else
        AC_MSG_RESULT(no)
@@ -2644,7 +2691,7 @@ AC_MSG_CHECKING(whether to use Kerberos library)
 
 AC_ARG_WITH(krb5,
   AC_HELP_STRING( [--with-krb5@<:@=DIR@:>@],
-                  [use Kerberos library (located in directory DIR, if supplied) to use in Kerberos dissection @<:@default=yes@:>@]),
+                 [use Kerberos library (located in directory DIR, if supplied) to use in Kerberos dissection @<:@default=yes@:>@]),
 [
        if test $withval = no
        then
@@ -2685,7 +2732,7 @@ elif test "x$withval" = "xyes"; then
        want_c_ares=yes
 elif test -d "$withval"; then
        want_c_ares=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ])
 if test "x$want_c_ares" = "xno" ; then
@@ -2710,7 +2757,7 @@ elif test "x$withval" = "xyes"; then
        want_adns=yes
 elif test -d "$withval"; then
        want_adns=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ])
 if test "x$want_adns" = "xno" -o "x$have_good_c_ares" = "xyes" ; then
@@ -2752,7 +2799,7 @@ AC_MSG_CHECKING(whether to use the GeoIP IP address mapping library if available
 
 AC_ARG_WITH(geoip,
   AC_HELP_STRING( [--with-geoip@<:@=DIR@:>@],
-                  [use GeoIP (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
+                 [use GeoIP (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
 [
 if   test "x$withval" = "xno";  then
        want_geoip=no
@@ -2760,7 +2807,7 @@ elif test "x$withval" = "xyes"; then
        want_geoip=yes
 elif test -d "$withval"; then
        want_geoip=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ])
 if test "x$want_geoip" = "xno"; then
@@ -2771,6 +2818,31 @@ else
 fi
 AC_SUBST(GEOIP_LIBS)
 
+dnl LIBSSH Check
+LIBSSH=''
+AC_MSG_CHECKING(whether to use the libssh library if available)
+
+AC_ARG_WITH(ssh,
+  AC_HELP_STRING( [--with-libssh@<:@=DIR@:>@],
+                 [use libssh (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
+[
+if   test "x$withval" = "xno";  then
+       want_libssh=no
+elif test "x$withval" = "xyes"; then
+       want_libssh=yes
+elif test -d "$withval"; then
+       want_libssh=yes
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
+fi
+])
+if test "x$want_libssh" = "xno"; then
+       AC_MSG_RESULT(no)
+else
+       AC_MSG_RESULT(yes)
+       AC_WIRESHARK_LIBSSH_CHECK
+fi
+AC_SUBST(LIBSSH_LIBS)
+
 #
 # Define WS_MSVC_NORETURN appropriately for declarations of routines that
 # never return (just like Charlie on the MTA).
@@ -2816,9 +2888,9 @@ AC_CHECK_FUNC(getopt_long,
     AC_MSG_CHECKING(whether optreset is defined)
     AC_TRY_LINK([],
       [
-        extern int optreset;
+       extern int optreset;
 
-        return optreset;
+       return optreset;
       ],
       ac_cv_pcap_debug_defined=yes,
       ac_cv_pcap_debug_defined=no)
@@ -2837,7 +2909,7 @@ AC_CHECK_FUNCS(mkstemp mkdtemp)
 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.])
+    AC_DEFINE(HAVE_INET_ATON, 1, [Define to 1 if you have the inet_aton function.])
   ],
   INET_ATON_LO="inet_aton.lo")
 AC_SUBST(INET_ATON_LO)
@@ -2866,6 +2938,8 @@ have_inet_pton=no)
 if test "$have_inet_pton" = no; then
   INET_PTON_LO="inet_pton.lo"
 else
+  AC_DEFINE(HAVE_INET_PTON, 1,
+    [Define to 1 if you have the `inet_pton' function.])
   INET_PTON_LO=""
 fi
 AM_CONDITIONAL(NEED_INET_PTON_LO, test "x$have_inet_pton" = "xno")
@@ -2895,9 +2969,7 @@ extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
       [Define if inet_ntop() prototype exists])], [
       AC_MSG_RESULT(no)])])
   INET_NTOP_LO=""], [
-  INET_NTOP_LO="inet_ntop.lo"
-  AC_DEFINE(NEED_INET_V6DEFS_H, 1,
-  [Define if inet/v6defs.h needs to be included])])
+  INET_NTOP_LO="inet_ntop.lo"])
 AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
 AC_SUBST(INET_NTOP_LO)
 
@@ -2928,13 +3000,13 @@ AC_SUBST(wireshark_SUBDIRS)
 # git://git.kernel.org/pub/scm/bluetooth/sbc.git
 AC_ARG_WITH([sbc],
   AC_HELP_STRING( [--with-sbc=@<:@yes/no@:>@],
-                  [use SBC codec to play Bluetooth A2DP stream @<:@default=yes, if available@:>@]),
+                 [use SBC codec to play Bluetooth A2DP stream @<:@default=yes, if available@:>@]),
   with_sbc="$withval"; want_sbc="yes", with_sbc="yes")
 
 PKG_CHECK_MODULES(SBC, sbc >= 1.0, [have_sbc=yes], [have_sbc=no])
 if test "x$with_sbc" != "xno"; then
     if (test "${have_sbc}" = "yes"); then
-        AC_DEFINE(HAVE_SBC, 1, [Define to support playing SBC by standalone BlueZ SBC library])
+       AC_DEFINE(HAVE_SBC, 1, [Define to support playing SBC by standalone BlueZ SBC library])
     elif test "x$want_sbc" = "xyes"; then
        # Error out if the user explicitly requested the sbc library
        AC_MSG_ERROR([SBC codec library was requested, but is not available])
@@ -2942,16 +3014,17 @@ if test "x$with_sbc" != "xno"; then
 else
     have_sbc=no
 fi
+AM_CONDITIONAL(HAVE_SBC, test "x$have_sbc" = "xyes")
 
 dnl
 dnl check whether plugins should be enabled and, if they should be,
 dnl check for plugins directory - stolen from Amanda's configure.ac
 dnl
 dnl we don't wish to expand ${libdir} yet
-plugindir='${libdir}/wireshark/plugins/${VERSION}'
+plugindir="\${libdir}/wireshark/plugins/${VERSION}"
 AC_ARG_WITH(plugins,
   AC_HELP_STRING( [--with-plugins@<:@=DIR@:>@],
-                  [support plugins (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
+                 [support plugins (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
 [
   if test "x$withval" = "xno"; then
     have_plugins=no
@@ -2967,7 +3040,6 @@ then
   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
 fi
 AC_SUBST(plugindir)
-CPPFLAGS="$CPPFLAGS '-DPLUGIN_INSTALL_DIR=\"\$(plugindir)\"'"
 
 #
 # The plugin dissectors reside in ./plugins/PROTO/
@@ -2975,12 +3047,15 @@ CPPFLAGS="$CPPFLAGS '-DPLUGIN_INSTALL_DIR=\"\$(plugindir)\"'"
 PLUGIN_LIBS=""
 AC_SUBST(PLUGIN_LIBS)
 
-
-dnl Use extcap by default
-extcapdir='${datadir}/wireshark/extcap/'
+dnl
+dnl check whether extcap programs should be enabled and, if they should be,
+dnl check for extcap directory - stolen from Amanda's configure.ac
+dnl
+dnl we don't wish to expand ${libdir} yet
+extcapdir="\${libdir}/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@:>@]),
+                 [use extcap for external capture sources (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
 [
   if test "x$withval" = "xno"; then
       have_extcap=no
@@ -2997,10 +3072,26 @@ 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)
 
+if test "x$enable_sshdump" = "xyes" ; then
+       if  test "x$have_good_libssh" = "xyes" ; then
+               sshdump_bin="sshdump\$(EXEEXT)"
+               sshdump_man="sshdump.1"
+       else
+               echo "Can't find libssh. Disabling sshdump."
+               enable_sshdump=no
+               sshdump_bin=""
+               sshdump_man=""
+       fi
+else
+       sshdump_bin=""
+       sshdump_man=""
+fi
+AC_SUBST(sshdump_bin)
+AC_SUBST(sshdump_man)
+
 dnl libtool defs
 #
 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
@@ -3031,12 +3122,26 @@ else
        RPMBUILD_WITH_ARGS="--without gtk2 --without gtk3"
 fi
 if test "x$have_qt" = "xyes" ; then
-       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
+       if test "$qt_version" -eq "5"; then
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt5"
+       else
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
+       fi
 else
-       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt"
+       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt --without qt5"
+fi
+if test "x$have_lua" = "xyes" ; then
+       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with lua"
+else
+       RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without lua"
 fi
 AC_SUBST(RPMBUILD_WITH_ARGS)
 
+AC_SUBST(WS_CPPFLAGS)
+AC_SUBST(WS_CFLAGS)
+AC_SUBST(WS_CXXFLAGS)
+AC_SUBST(WS_LDFLAGS)
+
 dnl Save the cacheable configure results to config.cache before recursing
 AC_CACHE_SAVE
 
@@ -3051,6 +3156,7 @@ AC_OUTPUT(
   Makefile
   doxygen.cfg
   asn1/Makefile
+  wireshark.pc
   _CUSTOM_ASN1_AC_OUTPUT_
   asn1/acp133/Makefile
   asn1/acse/Makefile
@@ -3173,6 +3279,7 @@ AC_OUTPUT(
   epan/nghttp2/Makefile
   epan/wmem/Makefile
   epan/wslua/Makefile
+  extcap/Makefile
   codecs/Makefile
   ui/Makefile
   ui/doxygen.cfg
@@ -3209,6 +3316,8 @@ AC_OUTPUT(
   plugins/wimax/Makefile
   plugins/wimaxasncp/Makefile
   plugins/wimaxmacphy/Makefile
+  randpkt_core/doxygen.cfg
+  randpkt_core/Makefile
   tools/Makefile
   tools/lemon/Makefile
   wiretap/Makefile
@@ -3222,13 +3331,9 @@ dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
 # Pretty messages
 
 if test "x$have_gtk" = "xyes"; then
-       if test "x$with_gtk3" = "xyes"; then
-               gtk_lib_message=" (with GTK+ 3"
-       else
-               gtk_lib_message=" (with GTK+ 2"
-       fi
+       gtk_lib_message=" (with GTK+ v$GTK_VERSION"
        if test "x$have_ige_mac" = "xyes"; then
-               gtk_lib_message="$gtk_lib_message and Mac OS X integration)"
+               gtk_lib_message="$gtk_lib_message and OS X integration)"
        else
                gtk_lib_message="$gtk_lib_message)"
        fi
@@ -3236,6 +3341,7 @@ fi
 
 if test "x$have_qt" = "xyes" ; then
        enable_wireshark_qt="yes"
+       qt_lib_message=" (with Qt$qt_version v$QT_VERSION)"
 else
        enable_wireshark_qt="no"
 fi
@@ -3270,6 +3376,12 @@ else
        lua_message="no"
 fi
 
+if test "x$have_qt_multimedia_lib" = "xyes" ; then
+       qt_multimedia_message="yes"
+else
+       qt_multimedia_message="no"
+fi
+
 if test "x$want_portaudio" = "xyes" ; then
        portaudio_message="yes"
 else
@@ -3291,7 +3403,12 @@ fi
 if test "x$have_good_c_ares" = "xyes" ; then
        c_ares_message="yes"
 else
-       c_ares_message="no"
+       if test "x$have_good_adns" = "xyes" ; then
+               c_ares_message="no"
+       else
+               # We should make this an error at some point.
+               c_ares_message="no. This can cause serious performance issues."
+       fi
 fi
 
 if test "x$have_good_adns" = "xyes" ; then
@@ -3300,7 +3417,8 @@ else
        if test "x$have_good_c_ares" = "xyes" ; then
                adns_message="no (using c-ares instead)"
        else
-               adns_message="no"
+               # We should make this an error at some point.
+               adns_message="no. This can cause serious performance issues."
        fi
 fi
 
@@ -3316,9 +3434,32 @@ else
        geoip_message="no"
 fi
 
+if test "x$have_good_libssh" = "xyes" ; then
+       libssh_message="yes"
+else
+       libssh_message="no"
+fi
+
+if test "x$have_ssh_userauth_agent" = "xyes" ; then
+       ssh_userauth_agent_message="yes"
+else
+       ssh_userauth_agent_message="no"
+fi
+
+echo ""
+echo "  CPPFLAGS: $WS_CPPFLAGS $CPPFLAGS"
+echo ""
+echo "  CFLAGS: $WS_CFLAGS $CFLAGS"
+echo ""
+echo "  CXXFLAGS: $WS_CXXFLAGS $CXXFLAGS"
+echo ""
+echo "  LDFLAGS: $WS_LDFLAGS $LDFLAGS"
+echo ""
+echo "  LIBS: $LIBS"
+
 echo ""
 echo "The Wireshark package has been configured with the following options."
-echo "                    Build wireshark : $enable_wireshark_qt"
+echo "                    Build wireshark : $enable_wireshark_qt$qt_lib_message"
 echo "                Build wireshark-gtk : $have_gtk""$gtk_lib_message"
 echo "                       Build tshark : $enable_tshark"
 echo "                      Build tfshark : $enable_tfshark"
@@ -3332,6 +3473,9 @@ echo "                    Build text2pcap : $enable_text2pcap"
 echo "                      Build randpkt : $enable_randpkt"
 echo "                       Build dftest : $enable_dftest"
 echo "                     Build rawshark : $enable_rawshark"
+echo "                  Build androiddump : $enable_androiddump"
+echo "                      Build sshdump : $enable_sshdump"
+echo "                  Build randpktdump : $enable_randpktdump"
 echo "                        Build echld : $have_echld"
 echo ""
 echo "   Save files as pcap-ng by default : $enable_pcap_ng_default"
@@ -3341,7 +3485,8 @@ 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 Qt RTP player : $qt_multimedia_message"
+echo "              Build GTK+ RTP player : $portaudio_message"
 echo "             Build profile binaries : $enable_profile_build"
 echo "                   Use pcap library : $want_pcap"
 echo "                   Use zlib library : $zlib_message"
@@ -3351,9 +3496,11 @@ echo "               Use GNU ADNS library : $adns_message"
 echo "                Use SMI MIB library : $libsmi_message"
 echo "             Use GNU crypto library : $gcrypt_message"
 echo "             Use SSL crypto library : $ssl_message"
-echo "           Use IPv6 name resolution : $enable_ipv6"
 echo "                 Use gnutls library : $tls_message"
 echo "     Use POSIX capabilities library : $libcap_message"
 echo "                  Use GeoIP library : $geoip_message"
+echo "                 Use libssh library : $libssh_message"
+echo "            Have ssh_userauth_agent : $ssh_userauth_agent_message"
 echo "                     Use nl library : $libnl_message"
 echo "              Use SBC codec library : $have_sbc"
+#echo "       Use GDK-Pixbuf with GResource: $have_gresource_pixbuf"