Witness: WIP
[metze/wireshark/wip.git] / configure.ac
index 67b6123636e09de33a84cf9a270fd05287fb9e13..3843403a4ab00cab85c53201e37668a54010bb5d 100644 (file)
@@ -3,11 +3,13 @@
 
 m4_define([version_major], [1])
 m4_define([version_minor], [11])
-m4_define([version_micro], [0])
+m4_define([version_micro], [3])
 m4_define([version_micro_extra], version_micro)
 m4_append([version_micro_extra], [])
 
 AC_INIT(wireshark, [version_major.version_minor.version_micro_extra], http://bugs.wireshark.org/, , http://www.wireshark.org/)
+CONFIG_ARGS="$*"
+AC_SUBST(CONFIG_ARGS)
 
 # Minimum autoconf version we require.
 AC_PREREQ(2.60)
@@ -51,36 +53,68 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_CPP
+AC_PROG_MKDIR_P
+AC_WIRESHARK_CLANG_CHECK
+
 dnl Work around libtool bug (fixed in the version 1.5a?)
 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
+if test ! -z "$CXX"; then
+       #
+       # OK, we found something AC_LANG_CXX thinks is a C++ compiler,
+       # but is it one?
+       #
+       # Some UN*Xes have, by default, a case-insensitive file
+       # system, and AC_PROG_CXX looks for, among other things,
+       # "CC" as a C++ compiler, and, if you have a case-insensitive
+       # file system and a C compiler named "cc" (both true, by
+       # default, on OS X), AC_PROG_CXX may end up thinking it's
+       # the C++ compiler.
+       #
+       # So we check by feeding the purported C++ compiler a
+       # program using C++ features (iostream).
+       #
+       # We do this after AC_PROG_LIBTOOL; if we did so before, and
+       # cleared CXX if what we had isn't a C++ compiler, that'd
+       # get undone by AC_PROG_LIBTOOL for some reason.
+       #
+       AC_MSG_CHECKING(whether $CXX is a C++ compiler)
+       AC_LANG_PUSH([C++])
+       AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [
+#include <iostream>
+       ],
+       [
+       std::cout << "Hello World! ";
+       return 0;
+       ])],
+               [AC_MSG_RESULT(yes)],
+               [
+                       AC_MSG_RESULT(no)
+                       CXX=""
+               ])
+       AC_LANG_POP([C++])
+fi
 AC_PATH_PROG(PERL, perl)
 
 # Check for Python.
 AC_PATH_PROG(PYTHON, python)
 if test ! -z "$PYTHON"; then
        #
-       # OK, we found Python; is it Python 2.x?
+       # OK, we found Python; is it Python 2.5 or later?
        # Note: we don't use named components for sys.version_info to get
        # the major version number, as named components for version_info
        # were apparently introduced in Python 2.7.
        #
-       AC_MSG_CHECKING([whether $PYTHON is Python 2])
-       python_major_version=`$PYTHON -c 'import sys; print sys.version_info[[0]]'`
-       if test "$python_major_version" = 2; then
-               AC_MSG_RESULT([yes])
+       AC_MSG_CHECKING([whether $PYTHON is Python 2.5 or later])
+       python_major_version=`$PYTHON -c 'import sys; print (sys.version_info[[0]])'`
+       python_minor_version=`$PYTHON -c 'import sys; print (sys.version_info[[1]])'`
+       if test "$python_major_version" -eq 2 -a "$python_minor_version" -lt 5 ; then
+               AC_MSG_RESULT(no)
+               AC_MSG_WARN([Building with Python $python_major_version.$python_minor_version may not work])
        else
-               #
-               # It's not 2.x.
-               #
-               AC_MSG_RESULT([no])
-
-               #
-               # Try looking for python2; if we find it, we assume it's
-               # Python 2
-               #
-               AC_PATH_PROG(PYTHON, python2)
+               AC_MSG_RESULT(yes)
        fi
 fi
 
@@ -223,6 +257,214 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
 #
 PKG_PROG_PKG_CONFIG
 
+AC_ARG_ENABLE(osx-deploy-target,
+  AC_HELP_STRING( [--enable-osx-deploy-target],
+    [choose an OS X deployment target @<:@default=major release on which you're building@:>@]),
+[
+       #
+       # Is this OS X?
+       #
+       case "$host_os" in
+       darwin*)
+               #
+               # Yes.
+               #
+               # Let the user specify an OS X release to use as a
+               # deplayment target; if they specify that we should
+               # have a deployment target but don't specify the
+               # deployment target, then, if we have SDKs available,
+               # pick the OS version on which the build is being done.
+               # This also causes the build to be done against an SDK
+               # rather than against the headers and libraries in
+               # /usr/include and /usr/lib.
+               #
+               # Check for an OS X deployment target early, so that
+               # as many tests using the compiler are done using the
+               # flags that we'll be using when building.
+               #
+               if test $enableval = no
+               then
+                       #
+                       # The user explicitly said
+                       # --disable-osx-deploy-target, so don't build
+                       # against an SDK.
+                       #
+                       deploy_target=
+               elif test $enableval = yes
+               then
+                       #
+                       # The user said --enable-osx-deploy-target, but
+                       # didn't say what version to target; target the
+                       # major version number of the version of OS X on
+                       # which we're running.
+                       #
+                       # (We quote the command so that we can use
+                       # autoconf's M4 quoting characters, [ and ], in
+                       # the sed expression.)
+                       #
+                       [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
+               else
+                       deploy_target="$enableval"
+               fi
+               ;;
+
+       *)
+               #
+               # No.  Fail, because whatever the user intended for us to
+               # do, we can't do it.
+               #
+               AC_MSG_ERROR([--enable-osx-deploy-target specified on an OS other than OS X])
+               ;;
+       esac
+],[
+       #
+       # Is this OS X?
+       #
+       case "$host_os" in
+       darwin*)
+               #
+               # Yes.
+               #
+               # If we have SDKs available, default to targeting the major
+               # version number of the version of OS X on which we're
+               # running.
+               #
+               # (We quote the command so that we can use autoconf's
+               # M4 quoting characters, [ and ], in the sed expression.)
+               #
+               for i in /Developer/SDKs \
+                   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
+                   /Library/Developer/CommandLineTools/SDKs
+               do
+                       if test -d "$i"
+                       then
+                               [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
+                               break
+                       fi
+               done
+               ;;
+
+       *)
+               #
+               # No.  There's nothing to do.
+               #
+               ;;
+       esac
+])
+
+if test ! -z "$deploy_target"
+then
+       AC_MSG_CHECKING([whether we can build for OS X $deploy_target])
+       case $deploy_target in
+
+       10.0|10.1|10.2)
+               #
+               # I'm not sure this would even work.
+               #
+               AC_MSG_RESULT(no)
+               AC_ERROR([We don't support building for OS X $deploy_target])
+               ;;
+
+       10.3)
+               #
+               # XXX - never tested.
+               #
+               AC_MSG_RESULT(yes)
+               SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk"
+               ;;
+
+       *)
+               #
+               # XXX - for 10.4, do we need 10.4u?  We're
+               # not currently doing fat builds (we'd need
+               # fat versions of the support libraries for
+               # that to be useful), but, if we do, we'd
+               # need to use 10.4u.
+               #
+               for i in /Developer/SDKs \
+                   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
+                   /Library/Developer/CommandLineTools/SDKs
+               do
+                       if test -d "$i"/"MacOSX$deploy_target.sdk"
+                       then
+                               SDKPATH="$i"/"MacOSX$deploy_target.sdk"
+                               break
+                       fi
+               done
+               if test -z "$SDKPATH"
+               then
+                       AC_MSG_RESULT(no)
+                       AC_MSG_ERROR([We couldn't find the SDK for OS X $deploy_target])
+               fi
+               AC_MSG_RESULT(yes)
+               ;;
+       esac
+
+       #
+       # Add a -mmacosx-version-min flag to force tests that
+       # use the compiler, as well as the build itself, not to,
+       # for example, use compiler or linker features not supported
+       # by the minimum targeted version of the OS.
+       #
+       # 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"
+
+       #
+       # Add a -sdkroot flag to use with osx-app.sh.
+       #
+       OSX_APP_FLAGS="-sdkroot $SDKPATH"
+
+       #
+       # XXX - do we need this to build the Wireshark wrapper?
+       # XXX - is this still necessary with the -mmacosx-version-min
+       # flag being set?
+       #
+       OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target"
+
+       #
+       # In the installer package XML file, give the deployment target
+       # as the minimum version.
+       #
+       OSX_MIN_VERSION="$deploy_target"
+
+       case $deploy_target in
+
+       10.4|10.5)
+               #
+               # 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.
+               #
+               CFLAGS="-m32 $CFLAGS"
+               CXXFLAGS="-m32 $CXXFLAGS"
+               LDFLAGS="-m32 $LDFLAGS"
+               ;;
+       esac
+else
+       #
+       # Is this OS X?
+       #
+       case "$host_os" in
+       darwin*)
+               #
+               # Yes.
+               #
+               # In the installer package XML file, give the current OS
+               # version, minor version and all, as the minimum version.
+               # We can't guarantee that the resulting binary will work
+               # on older OS versions, not even older minor versions
+               # (original release or earlier software updates).
+               #
+               OSX_MIN_VERSION=`sw_vers -productVersion`
+               ;;
+       esac
+fi
+AC_SUBST(OSX_MIN_VERSION)
+
 #
 # Try to arrange for large file support.
 #
@@ -233,18 +475,18 @@ AC_SYS_LARGEFILE
 #
 AC_ARG_WITH([qt],
   AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
-                  [use Qt @<:@default=no@:>@]),
-  with_qt="$withval", with_qt="no")
+                  [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=yes@:>@]),
-  with_gtk2="$withval", with_gtk2="yes")
+                  [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=no@:>@]),
-  with_gtk3="$withval", with_gtk3="no")
+                  [use GTK+ 3.0 instead of 2.0 @<:@default=yes@:>@]),
+  with_gtk3="$withval", with_gtk3="unspecified")
 
 # GnuTLS
 # Version 3.0 switched from LGPLv2.1+ to LGPLv3+, then switched back to
@@ -508,11 +750,17 @@ fi
 AC_SUBST(HAVE_OSX_PACKAGING)
 
 #
-# Some compilers have to be told to fail on unknown warning errors;
+# Some compilers have to be told to fail when passed an unknown -W flag;
 # make sure we do that.
 #
 AC_WIRESHARK_CHECK_UNKNOWN_WARNING_OPTION_ERROR
 
+#
+# Some C++ compilers have to be told to fail when passed a -W flag that
+# they don't think should apply to C++; make sure we do that.
+#
+AC_WIRESHARK_CHECK_NON_CXX_WARNING_OPTION_ERROR
+
 #
 # Try to add some additional gcc checks to CFLAGS
 #
@@ -523,12 +771,12 @@ AC_ARG_ENABLE(extra-gcc-checks,
        wireshark_extra_gcc_flags=$enableval
        if test $enableval != no
        then
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-pedantic)
                #
                # Various code blocks this one.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Woverflow)
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Woverflow)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
                #
                # Some memset() calls to clear out structures
                # on the stack are getting flagged as "will never
@@ -537,60 +785,65 @@ AC_ARG_ENABLE(extra-gcc-checks,
                # Apple Inc. build 5658) (LLVM build 2336.11.00), for
                # some unknown reason.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunreachable-code)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunreachable-code)
                #
                # Due to various places where APIs we don't control
                # require us to cast away constness, we can probably
                # never enable these ones with -Werror.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast, C)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-qual)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wbad-function-cast, C)
                #
                # Some generated ASN.1 dissectors block this one;
                # multiple function declarations for the same
                # function are being generated.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wredundant-decls)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wredundant-decls)
                #
                # Some loops are safe, but it's hard to convince the
                # compiler of that.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunsafe-loop-optimizations)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunsafe-loop-optimizations)
                #
                # All the registration functions block these for now.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-prototypes)
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-prototypes)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-declarations)
                #
                # A bunch of "that might not work on SPARC" code blocks
                # this one for now.
                #
-               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
+               AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-align)
        fi
 ],)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wextra) # -W is now known as -Wextra
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdeclaration-after-statement, C)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wendif-labels)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign, C)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wold-style-definition, C)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes, C)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wjump-misses-init, C)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wvla)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Waddress)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wattributes)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdiv-by-zero)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wignored-qualifiers)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpragmas)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-overlength-strings)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wc++-compat, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wextra) # -W is now known as -Wextra
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdeclaration-after-statement, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wendif-labels)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpointer-arith)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-pointer-sign, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Warray-bounds)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wformat-security)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fwrapv)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-strict-overflow)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-delete-null-pointer-checks)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wold-style-definition, C)
+# The Qt headers generate a ton of shortening errors on 64-bit systems
+# so only enable this for C for now.
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wstrict-prototypes, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wvla)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Waddress)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wattributes)
+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(-Wc++-compat, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
 
 #
 # XXX - OK for C++?
@@ -601,7 +854,7 @@ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wc++-compat, C)
 # some Xcode versions that came with Mac OS X 10.5) complain about
 # that.
 #
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshadow, C,
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshadow, C,
   [
 extern int bar(int a);
 extern int foo(int);
@@ -619,7 +872,7 @@ foo(int a)
 # Unfortunately some versions of gcc generate logical-op warnings when strchr()
 # is given a constant string.
 # gcc versions 4.3.2 and 4.4.5 are known to have the problem.
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op, C,
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wlogical-op, C,
   [
 #include <string.h>
 
@@ -654,18 +907,18 @@ bar(void)
 #
 case "$host_os" in
 darwin*)
-       AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-deprecated-declarations)
+       AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-deprecated-declarations)
        ;;
 esac
 
 #
 # Use the faster pre gcc 4.5 floating point precision if available.
 #
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-fexcess-precision=fast)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fexcess-precision=fast)
 
-CFLAGS_before_fvhidden=$CFLAGS
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-fvisibility=hidden)
-if test "x$CLFAGS" = "x$CFLAGS_before_fvhidden"
+CFLAGS_before_fvhidden="$CFLAGS"
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fvisibility=hidden)
+if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
 then
        # TODO add other ways of hiding symbols
        AC_MSG_WARN(Compiler will export all symbols from shared libraries)
@@ -684,14 +937,14 @@ 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_GCC_CFLAGS_CHECK(-fPIE, C)
-if test "x$CLFAGS" != "x$CFLAGS_before_pie"
+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
+       CFLAGS="$CFLAGS_before_pie"
 
-       LDFLAGS_before_pie=$LDFLAGS
+       LDFLAGS_before_pie="$LDFLAGS"
        AC_WIRESHARK_LDFLAGS_CHECK([-fPIE -pie])
        if test "x$LDFLAGS" != "x$LDFLAGS_before_pie"
        then
@@ -700,7 +953,7 @@ then
                PIE_LDFLAGS="-pie"
 
                # Restore LDFLAGS
-               LDFLAGS=$LDFLAGS_before_pie
+               LDFLAGS="$LDFLAGS_before_pie"
        fi
 
 fi
@@ -831,8 +1084,15 @@ darwin*)
        # with a static version installed in /usr/local/lib rather than
        # the system version in /usr/lib).
        #
-       LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
-       AC_MSG_RESULT([Apple linker - added -Wl,-single_module and -Wl,-search_paths_first])
+       # 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,-search_paths_first -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/lib $LDFLAGS"
+       AC_MSG_RESULT([Apple linker - added -Wl,-single_module and -Wl,-search_paths_first, and rpaths])
        ;;
 cygwin*)
        #
@@ -894,6 +1154,15 @@ AC_SUBST(APPLICATIONSERVICES_FRAMEWORKS)
 AC_SUBST(SYSTEMCONFIGURATION_FRAMEWORKS)
 AC_SUBST(COREFOUNDATION_FRAMEWORKS)
 
+#
+# On Solaris, check whether we have getexecname().
+#
+case "$host_os" in
+solaris*)
+       AC_CHECK_FUNC(getexecname)
+       ;;
+esac
+
 dnl Look in /usr/local for header files and libraries ?
 dnl XXX FIXME don't include /usr/local if it is already in the system
 dnl search path as this causes gcc 3.2 on Linux to complain about a change
@@ -954,6 +1223,11 @@ esac
 #
 # Add any checks here that are necessary for other OSes.
 #
+AC_PATH_PROG(SED, sed)
+if test "x$SED" = x
+then
+       AC_MSG_ERROR(I couldn't find sed; make sure it's installed and in your path)
+fi
 AC_WIRESHARK_GNU_SED_CHECK
 if test "$HAVE_GNU_SED" = no ; then
        case "$host_os" in
@@ -985,8 +1259,8 @@ AC_ARG_ENABLE(wireshark,
 
 AC_ARG_ENABLE(packet-editor,
   AC_HELP_STRING( [--enable-packet-editor],
-                  [add support for packet editor in Wireshark @<:@default=no@:>@]),
-    enable_packet_editor=$enableval,enable_packet_editor=no)
+                  [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])
 fi
@@ -1066,44 +1340,37 @@ AC_SUBST(QT_MIN_VERSION)
 have_qt=no
 have_gtk=no
 if test "x$enable_wireshark" = "xyes"; then
+       if test "x$with_gtk2" = "xunspecified" -a \
+               "x$with_gtk3" = "xunspecified" -a \
+               "x$with_qt" = "xunspecified"; then
+               #
+               # No GUI toolkit was explicitly specified; pick Qt and GTK+ 3.
+               #
+               with_qt=yes
+               with_gtk3=yes
+       fi
        if test "x$with_qt" = "xyes"; then
                #
-               # Make sure we have a C++ compiler.
+               # Qt was specified; Make sure we have a C++ compiler.
                #
-               # Some UN*Xes have, by default, a case-insensitive file
-               # system, and AC_PROG_CXX looks for, among other things,
-               # "CC" as a C++ compiler, and, if you have a case-insensitive
-               # file system and a C compiler named "cc" (both true, by
-               # default, on OS X), AC_PROG_CXX may end up thinking it's
-               # the C++ compiler.
+               if test -z "$CXX"; then
+                       AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt)
+               fi
+
                #
-               # So we check by feeding the purported C++ compiler a
-               # program using C++ features (iostream).
+               # Now make sure we have Qt and, if so, add the flags
+               # for it to CFLAGS and CXXFLAGS.
                #
-               AC_MSG_CHECKING(whether we have a working C++ compiler)
-               AC_LANG_PUSH([C++])
-               AC_LINK_IFELSE([AC_LANG_PROGRAM(
-               [
-#include <iostream>
-               ],
-               [
-       std::cout << "Hello World! ";
-       return 0;
-               ])],
-                       [AC_MSG_RESULT(yes)],
-                       [
-                               AC_MSG_RESULT(no)
-                                AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt)
-                       ])
-               AC_LANG_POP([C++])
-
-               AM_PATH_QT($QT_MIN_VERSION,
+               AC_WIRESHARK_QT_CHECK($QT_MIN_VERSION,
                [
                        CFLAGS="$CFLAGS $Qt_CFLAGS"
                        CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
                        have_qt=yes
-               ]
-               , [AC_MSG_ERROR([Qt is not available])])
+                       GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-qt"
+                       OSX_APP_FLAGS="$OSX_APP_FLAGS -qt"
+                       OSX_DMG_FLAGS="-qt"
+               ],
+               [AC_MSG_ERROR([Qt is not available])])
 
                #
                # XXX - greasy hack to make ui/gtk/recent.c
@@ -1112,29 +1379,43 @@ if test "x$enable_wireshark" = "xyes"; then
                CPPFLAGS="-DQT_GUI_LIB"
        fi
 
-       if test "x$with_gtk3" = "xyes" -a "x$with_gtk2" = "xyes" ; then
-               # If the user gave us --with-gtk3, use gtk3 rather than gtk2
-               with_gtk2="no"
-       fi
-
        if test "x$with_gtk3" = "xyes"; then
+               #
+               # GTK+ 3 was specified; make sure they didn't also
+               # specify GTK+ 2, as we don't support building both
+               # GTK+ 2 and GTK+ 3 versions at the same time.
+               #
+               if test "x$with_gtk2" = "xyes"; then
+                       AC_MSG_ERROR([Both GTK+ 2 and GTK+ 3 were specified; choose one but not both])
+               fi
+
+               #
+               # 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
-               ], have_gtk=no)
-       fi
-
-       if test "x$with_gtk2" = "xyes"; then
+                       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
-               ], have_gtk=no)
+                       GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk2"
+               ],
+               [AC_MSG_ERROR([GTK+ 2 is not available])])
        fi
 fi
+AC_SUBST(GUI_CONFIGURE_FLAGS)
 
 GLIB_MIN_VERSION=2.16.0
 AC_SUBST(GLIB_MIN_VERSION)
@@ -1214,7 +1495,13 @@ if test "$have_gtk" = "yes" ; then
 
        CPPFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CPPFLAGS"
        CPPFLAGS="-DGDK_DISABLE_DEPRECATED $CPPFLAGS"
-       CPPFLAGS="-DGTK_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
@@ -1244,10 +1531,10 @@ fi
 # 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-qt4)
+AC_PATH_PROG(UIC, uic)
 if test "x$UIC" = x
 then
-       AC_PATH_PROG(UIC, uic)
+       AC_PATH_PROG(UIC, uic-qt4)
        if test "x$UIC" = x
        then
                if test "x$with_qt" = "xyes"; then
@@ -1270,10 +1557,10 @@ then
        fi
 fi
 AC_SUBST(UIC)
-AC_PATH_PROG(MOC, moc-qt4)
+AC_PATH_PROG(MOC, moc)
 if test "x$MOC" = x
 then
-       AC_PATH_PROG(MOC, moc)
+       AC_PATH_PROG(MOC, moc-qt4)
        if test "x$MOC" = x
        then
                if test "x$with_qt" = "xyes"; then
@@ -1342,40 +1629,34 @@ else
 fi
 
 #
-# If we have <dlfcn.h>, check whether we can use dladdr to find a
-# filename (hopefully, a full pathname, but no guarantees) for
-# the executable.
+# If we have <dlfcn.h>, check whether we have dladdr.
 #
 if test "$ac_cv_header_dlfcn_h" = "yes"
 then
-       AC_MSG_CHECKING(whether dladdr can be used to find the pathname of an executable)
+       #
+       # Use GLib compiler flags and linker flags; GLib's gmodule
+       # stuff uses the dl APIs if available, so it might know
+       # what flags are needed.
+       #
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LIBS="$LIBS"
        CFLAGS="$CFLAGS $GLIB_CFLAGS"
        LIBS="$GLIB_LIBS $LIBS"
-       AC_TRY_RUN([
-#define _GNU_SOURCE    /* required on Linux, sigh */
-#include <dlfcn.h>
-
-int
-main(void)
-{
-       Dl_info info;
-
-       if (!dladdr((void *)main, &info))
-               return 1;       /* failure */
-       return 0;               /* assume success */
-}
-], ac_cv_dladdr_finds_executable_path=yes, ac_cv_dladdr_finds_executable_path=no,
-   [echo $ac_n "cross compiling; assumed OK... $ac_c"
-    ac_cv_dladdr_finds_executable_path=yes])
-       CFLAGS="$ac_save_CFLAGS"
-       LIBS="$ac_save_LIBS"
-       if test x$ac_cv_dladdr_finds_executable_path = xyes
+       AC_CHECK_FUNCS(dladdr)
+       if test x$ac_cv_func_dladdr = xno
        then
-               AC_DEFINE(DLADDR_FINDS_EXECUTABLE_PATH, 1, [Define if dladdr can be used to find the path of the executable])
+               #
+               # OK, try it with -ldl, in case you need that to get
+               # dladdr().  For some reason, on Linux, that's not
+               # part of the GLib flags; perhaps GLib itself is
+               # linked with libdl, so that you can link with
+               # Glib and it'll pull libdl in itself.
+               #
+               LIBS="$LIBS -ldl"
+               AC_CHECK_FUNCS(dladdr)
        fi
-       AC_MSG_RESULT($ac_cv_dladdr_finds_executable_path)
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
 fi
 
 #
@@ -1448,10 +1729,10 @@ AC_SUBST(wireshark_bin)
 AC_SUBST(wireshark_man)
 AM_CONDITIONAL(HAVE_Qt, test "$have_qt" = "yes")
 AM_CONDITIONAL(HAVE_GTK, test "$have_gtk" = "yes")
-
+AC_SUBST(OSX_APP_FLAGS)
+AC_SUBST(OSX_DMG_FLAGS)
 
 # Enable/disable tshark
-
 AC_ARG_ENABLE(tshark,
   AC_HELP_STRING( [--enable-tshark],
                   [build TShark @<:@default=yes@:>@]),
@@ -1467,9 +1748,23 @@ else
 fi
 AC_SUBST(tshark_bin)
 AC_SUBST(tshark_man)
-AC_SUBST(wiresharkfilter_man)
 
+# Enable/disable tfshark
+AC_ARG_ENABLE(tfshark,
+  AC_HELP_STRING( [--enable-tfshark],
+                  [build TFShark @<:@default=no@:>@]),
+    tfshark=$enableval,enable_tfshark=no)
 
+if test "x$enable_tfshark" = "xyes" ; then
+       tfshark_bin="tfshark\$(EXEEXT)"
+       tfshark_man="tfshark.1"
+       wiresharkfilter_man="wireshark-filter.4"
+else
+       tfshark_bin=""
+       tfshark_man=""
+fi
+AC_SUBST(tfshark_bin)
+AC_SUBST(tfshark_man)
 
 # Enable/disable editcap
 
@@ -1488,8 +1783,6 @@ fi
 AC_SUBST(editcap_bin)
 AC_SUBST(editcap_man)
 
-
-
 # Enable/disable echld
 
 AC_ARG_ENABLE(echld,
@@ -1511,7 +1804,6 @@ fi
 AC_SUBST(echld_test_bin)
 AC_SUBST(echld_dir)
 
-
 # Enabling/disabling of dumpcap is done later (after we know if we have PCAP
 # or not)
 
@@ -1532,6 +1824,22 @@ fi
 AC_SUBST(capinfos_bin)
 AC_SUBST(capinfos_man)
 
+# Enable/disable captype
+
+AC_ARG_ENABLE(captype,
+  AC_HELP_STRING( [--enable-captype],
+                  [build captype @<:@default=yes@:>@]),
+    enable_captype=$enableval,enable_captype=yes)
+
+if test "x$enable_captype" = "xyes" ; then
+       captype_bin="captype\$(EXEEXT)"
+       captype_man="captype.1"
+else
+       captype_bin=""
+       captype_man=""
+fi
+AC_SUBST(captype_bin)
+AC_SUBST(captype_man)
 
 # Enable/disable mergecap
 
@@ -1550,7 +1858,6 @@ fi
 AC_SUBST(mergecap_bin)
 AC_SUBST(mergecap_man)
 
-
 # Enable/disable reordercap
 
 AC_ARG_ENABLE(reordercap,
@@ -1568,7 +1875,6 @@ fi
 AC_SUBST(reordercap_bin)
 AC_SUBST(reordercap_man)
 
-
 # Enable/disable text2pcap
 
 AC_ARG_ENABLE(text2pcap,
@@ -1586,7 +1892,6 @@ fi
 AC_SUBST(text2pcap_bin)
 AC_SUBST(text2pcap_man)
 
-
 # Enable/disable dftest
 
 AC_ARG_ENABLE(dftest,
@@ -1604,7 +1909,6 @@ fi
 AC_SUBST(dftest_bin)
 AC_SUBST(dftest_man)
 
-
 # Enable/disable randpkt
 
 AC_ARG_ENABLE(randpkt,
@@ -1622,7 +1926,7 @@ fi
 AC_SUBST(randpkt_bin)
 AC_SUBST(randpkt_man)
 
-
+AC_SUBST(wiresharkfilter_man)
 
 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
 dnl "gethostbyname()".
@@ -1989,7 +2293,7 @@ AC_SUBST(LIBCAP_LIBS)
 
 dnl Checks for header files.
 dnl Some of these may not be needed: http://hacks.owlfolio.org/header-survey/
-AC_CHECK_HEADERS(direct.h dirent.h fcntl.h grp.h inttypes.h netdb.h pwd.h stdarg.h stddef.h unistd.h)
+AC_CHECK_HEADERS(direct.h dirent.h fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h stdarg.h stddef.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)
@@ -2235,7 +2539,7 @@ AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes,
     have_inet_aton=no)
 if test "$have_inet_aton" = no; then
   INET_ATON_LO="inet_aton.lo"
-  AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
+  AC_DEFINE(HAVE_INET_ATON_H, 0, [Define unless inet/aton.h needs to be included])
 else
   INET_ATON_LO=""
 fi
@@ -2315,7 +2619,6 @@ AC_SUBST(STRPTIME_LO)
 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
 AC_CHECK_FUNCS(issetugid)
 AC_CHECK_FUNCS(mmap mprotect sysconf)
-AC_CHECK_FUNCS(strtoll)
 
 dnl blank for now, but will be used in future
 AC_SUBST(wireshark_SUBDIRS)
@@ -2374,6 +2677,43 @@ case $host_cpu in
                ;;
 esac
 
+# Gather only the "--with*" arguments and also a list of --with arguments for rpmbuild
+for f in $CONFIG_ARGS
+do
+       case $f in
+       --with-gtk2*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with gtk2"
+               ;;
+       --without-gtk2*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without gtk2"
+               ;;
+       --with-gtk3*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with gtk3"
+               ;;
+       --without-gtk3*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without gtk3"
+               ;;
+       --with-qt*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
+               ;;
+       --without-qt*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt"
+               ;;
+       --with*)
+               CONFIG_WITH_ARGS="$CONFIG_WITH_ARGS $f"
+               ;;
+       esac
+
+done
+AC_SUBST(CONFIG_WITH_ARGS)
+AC_SUBST(RPMBUILD_WITH_ARGS)
+
 dnl libtool defs
 #
 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
@@ -2412,6 +2752,9 @@ AC_OUTPUT(
   asn1/acse/Makefile
   asn1/ansi_map/Makefile
   asn1/ansi_tcap/Makefile
+  asn1/atn-cm/Makefile
+  asn1/atn-cpdlc/Makefile
+  asn1/atn-ulcs/Makefile
   asn1/c1222/Makefile
   asn1/camel/Makefile
   asn1/cdt/Makefile
@@ -2427,7 +2770,6 @@ AC_OUTPUT(
   asn1/dsp/Makefile
   asn1/ess/Makefile
   asn1/ftam/Makefile
-  asn1/gnm/Makefile
   asn1/goose/Makefile
   asn1/gprscdr/Makefile
   asn1/gsm_map/Makefile
@@ -2445,6 +2787,7 @@ AC_OUTPUT(
   asn1/HI2Operations/Makefile
   asn1/hnbap/Makefile
   asn1/idmp/Makefile
+  asn1/ilp/Makefile
   asn1/inap/Makefile
   asn1/isdn-sup/Makefile
   asn1/kerberos/Makefile
@@ -2461,6 +2804,7 @@ AC_OUTPUT(
   asn1/mpeg-pes/Makefile
   asn1/nbap/Makefile
   asn1/ns_cert_exts/Makefile
+  asn1/novell_pkis/Makefile
   asn1/ocsp/Makefile
   asn1/p1/Makefile
   asn1/p22/Makefile
@@ -2520,6 +2864,7 @@ AC_OUTPUT(
   epan/wmem/Makefile
   epan/wslua/Makefile
   epan/wspython/Makefile
+  filetap/Makefile
   codecs/Makefile
   ui/Makefile
   ui/doxygen.cfg
@@ -2533,6 +2878,7 @@ AC_OUTPUT(
   packaging/macosx/Info.plist
   packaging/macosx/Makefile
   packaging/macosx/osx-dmg.sh
+  packaging/macosx/Wireshark_package.pmdoc/index.xml
   packaging/nsis/Makefile
   packaging/rpm/Makefile
   packaging/rpm/SPECS/Makefile
@@ -2541,7 +2887,6 @@ AC_OUTPUT(
   packaging/svr4/checkinstall
   packaging/svr4/pkginfo
   plugins/Makefile
-  plugins/asn1/Makefile
   plugins/docsis/Makefile
   plugins/ethercat/Makefile
   plugins/gryphon/Makefile
@@ -2673,7 +3018,9 @@ echo "The Wireshark package has been configured with the following options."
 echo "             Build wireshark (Gtk+) : $have_gtk""$gtk_lib_message"
 echo "                 Build wireshark-qt : $enable_qtshark"
 echo "                       Build tshark : $enable_tshark"
+echo "                      Build tfshark : $enable_tfshark"
 echo "                     Build capinfos : $enable_capinfos"
+echo "                      Build captype : $enable_captype"
 echo "                      Build editcap : $enable_editcap"
 echo "                      Build dumpcap : $enable_dumpcap"
 echo "                     Build mergecap : $enable_mergecap"