Use *, not *.*, as the wildcard pattern on UN*X.
[metze/wireshark/wip.git] / configure.ac
index 18dfb8665b174101afe66ef86582e199b21dd105..719ae06cefdfe05bcf9a5515b60bc406630c489f 100644 (file)
@@ -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
@@ -461,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.
@@ -492,9 +492,9 @@ then
                # functions not to work with 64-bit userland
                # 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
@@ -538,6 +538,8 @@ 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.])])
 
 
 #
@@ -680,29 +682,26 @@ linux*)
                # was requested by the user.
                #
                if test x$libnl_version = "xany" -o x$libnl_version = "x3"; then
-                       PKG_WIRESHARK_CHECK_SYSTEM_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_WIRESHARK_CHECK_SYSTEM_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_WIRESHARK_CHECK_SYSTEM_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)"
                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)"
                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)"
@@ -844,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.
@@ -1037,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.
 #
@@ -1078,42 +1097,37 @@ 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.
 #
-WS_CHECKED_CFLAGS_before_pie="$WS_CHECKED_CFLAGS"
+
+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
-       # Restore CFLAGS
-       WS_CHECKED_CFLAGS="$WS_CHECKED_CFLAGS_before_pie"
-
-       LDFLAGS_before_pie="$LDFLAGS"
        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)
 
-WS_CHECKED_CFLAGS_before_simd="$WS_CHECKED_CFLAGS"
+WS_CFLAGS_saved="$WS_CFLAGS"
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
 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.
        #
-       WS_CHECKED_CFLAGS="$WS_CHECKED_CFLAGS_before_simd"
        ac_sse4_2_flag=-msse4.2
 else
        #
@@ -1125,20 +1139,10 @@ else
                #
                # The compiler supports -xarch=sse4_2; use that to
                # enable SSE 4.2.
-               #
-               # Restore CFLAGS; see above.
-               #
-               WS_CHECKED_CFLAGS="$WS_CHECKED_CFLAGS_before_simd"
                ac_sse4_2_flag=-xarch=sse4_2
        fi
 fi
-
-#
-# All AC_WIRESHARK_COMPILER_FLAGS_CHECK are done, do not call it again!
-# Prepend them to the user-specified CFLAGS/CXXFLAGS.
-#
-CFLAGS="$WS_CHECKED_CFLAGS $CFLAGS"
-CXXFLAGS="$WS_CHECKED_CXXFLAGS $CXXFLAGS"
+WS_CFLAGS="$WS_CFLAGS_saved"
 
 if test "x$ac_sse4_2_flag" != x; then
        #
@@ -1181,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;],
@@ -1274,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)
                ;;
        *)
@@ -1299,7 +1303,7 @@ else
                #
                # +O2 is supported both by the C and C++ compiler.
                #
-               CFLAGS="+O2 $CFLAGS"
+               WS_CFLAGS="+O2 $WS_CFLAGS"
                if test "$CC" = "$CC_FOR_BUILD"; then
                        #
                        # We're building the build tools with the same
@@ -1309,15 +1313,15 @@ else
                        #
                        CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
                fi
-               CXXFLAGS="+O2 $CXXFLAGS"
+               WS_CXXFLAGS="+O2 $WS_CXXFLAGS"
                AC_MSG_RESULT(HP C/C++ compiler - added +O2)
                ;;
        solaris*)
                #
                # Crank up the warning level.
                #
-               CFLAGS="$CFLAGS -v"
-               CXXFLAGS="$CXXFLAGS +w2"
+               WS_CFLAGS="$WS_CFLAGS -v"
+               WS_CXXFLAGS="$WS_CXXFLAGS +w2"
                ;;
        *)
                AC_MSG_RESULT(none needed)
@@ -1350,7 +1354,7 @@ darwin*)
        # with a static version installed in /usr/local/lib rather than
        # the system version in /usr/lib).
        #
-       LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-search_paths_first $LDFLAGS"
+       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*)
@@ -1358,7 +1362,7 @@ 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)
        ;;
 *)
@@ -1443,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
@@ -1536,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."
@@ -1546,28 +1550,46 @@ 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)
@@ -1652,17 +1674,11 @@ if test "x$enable_wireshark" = "xyes"; then
                #
                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"
 
-                       #
-                       # XXX - greasy hack to make ui/gtk/recent.c
-                       # compile.
-                       #
-                       CPPFLAGS="-DQT_GUI_LIB"
-
                        #
                        # We're building with Qt, so we need the Qt build
                        # tools in order to build the Wireshark GUI.
@@ -1698,6 +1714,21 @@ if test "x$enable_wireshark" = "xyes"; then
                                ;;
                        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)
                ],
                [
                        case "$with_qt" in
@@ -1737,66 +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
-# 2.42.0: 22 Sep 2014
-# 2.44.0: 23 Mar 2014
-# 2.46.0: 25 Sep 2015
+# 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.
@@ -1842,53 +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_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
-
-# Check for GResource support
-PKG_CHECK_EXISTS([gio-2.0 >= 2.32 gdk-pixbuf-2.0 >= 2.26], [have_gresource=yes], [have_gresource=no])
-AM_CONDITIONAL(HAVE_GRESOURCE, test "x$have_gresource" = "xyes")
-if test "x$have_gresource" = "xyes"; then
-       AC_DEFINE(HAVE_GRESOURCE, 1, [Defined if GLib GResource is supported])
-fi
-
-# 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.
@@ -1896,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>
@@ -1940,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
@@ -1967,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>
@@ -2344,23 +2338,6 @@ else
        AC_MSG_RESULT(no)
 fi
 
-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)
-
 if test "x$enable_randpktdump" = "xyes" ; then
        randpktdump_bin="randpktdump\$(EXEEXT)"
        randpktdump_man=""
@@ -2634,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
@@ -2690,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
@@ -2755,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
@@ -2780,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
@@ -2830,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
@@ -2855,7 +2832,7 @@ elif test "x$withval" = "xyes"; then
        want_libssh=yes
 elif test -d "$withval"; then
        want_libssh=yes
-       AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
+       AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, ${withval}/lib)
 fi
 ])
 if test "x$want_libssh" = "xno"; then
@@ -2932,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)
@@ -2961,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")
@@ -2990,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)
 
@@ -3037,13 +3014,14 @@ 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@:>@]),
@@ -3062,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/
@@ -3070,9 +3047,12 @@ 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@:>@]),
@@ -3092,7 +3072,6 @@ 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)
 
@@ -3158,6 +3137,11 @@ else
 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
 
@@ -3172,6 +3156,7 @@ AC_OUTPUT(
   Makefile
   doxygen.cfg
   asn1/Makefile
+  wireshark.pc
   _CUSTOM_ASN1_AC_OUTPUT_
   asn1/acp133/Makefile
   asn1/acse/Makefile
@@ -3294,6 +3279,7 @@ AC_OUTPUT(
   epan/nghttp2/Makefile
   epan/wmem/Makefile
   epan/wslua/Makefile
+  extcap/Makefile
   codecs/Makefile
   ui/Makefile
   ui/doxygen.cfg
@@ -3330,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
@@ -3343,11 +3331,7 @@ 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 OS X integration)"
        else
@@ -3357,7 +3341,7 @@ fi
 
 if test "x$have_qt" = "xyes" ; then
        enable_wireshark_qt="yes"
-       qt_lib_message=" (with Qt $qt_version)"
+       qt_lib_message=" (with Qt$qt_version v$QT_VERSION)"
 else
        enable_wireshark_qt="no"
 fi
@@ -3419,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
@@ -3428,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
 
@@ -3456,6 +3446,17 @@ 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$qt_lib_message"
@@ -3502,4 +3503,4 @@ 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 GResource : $have_gresource"
+#echo "       Use GDK-Pixbuf with GResource: $have_gresource_pixbuf"