[
if test $withval != no
then
- ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wmissing-declarations -Wwrite-strings"
+ wireshark_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wmissing-declarations -Wwrite-strings"
fi
],)
-AC_MSG_CHECKING(to see if we can add '-Wall -W -Wcast-qual $ethereal_extra_gcc_flags' to CFLAGS)
+AC_MSG_CHECKING(to see if we can add '-Wall -W -Wcast-qual -Werror $wireshark_extra_gcc_flags' to CFLAGS)
if test x$GCC != x ; then
- CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W $ethereal_extra_gcc_flags $CFLAGS"
+ CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W $wireshark_extra_gcc_flags $CFLAGS"
AC_MSG_RESULT(yes)
else
CFLAGS="-D_U_=\"\" $CFLAGS"
AC_MSG_RESULT(no)
fi
+AC_ARG_WITH(warnings-as-errors,
+[ --with-warnings-as-errors Treat warnings as errors (if using gcc). [default=no]],
+[
+ if test "x$GCC" != "x"; then
+ if test "x$withval" != "xno"; then
+ with_warnings_as_errors="yes"
+ fi
+ else
+ with_warnings_as_errors="no"
+ fi
+],)
+AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes")
+
#
# Add any platform-specific compiler flags needed.
#
CFLAGS="-no-cpp-precomp $CFLAGS"
AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
;;
- cygwin*)
- #
- # Shared libraries in cygwin/Win32 must never contain
- # undefined symbols.
- #
- LDFLAGS="$LDFLAGS -no-undefined"
- AC_MSG_RESULT(CygWin GCC - added -no-undefined to LDFLAGS)
- ;;
*)
AC_MSG_RESULT(none needed)
;;
esac
fi
+
+#
+# Add any platform-specific linker flags needed.
+#
+AC_MSG_CHECKING(for platform-specific linker flags)
+case "$host_os" in
+darwin*)
+ #
+ # Add -Wl,-single_module to the LDFLAGS used with shared
+ # libraries, to fix some error that show up in some cases;
+ # some Apple documentation recommends it for most shared
+ # libraries.
+ #
+ LDFLAGS_SHAREDLIB="-Wl,-single_module"
+ #
+ # Add -Wl,-search_paths_first to make sure that if we search
+ # directories A and B, in that order, for a given library, a
+ # non-shared version in directory A, rather than a shared
+ # version in directory B, is chosen (so we can use
+ # --with-pcap=/usr/local to force all programs to be linked
+ # 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)
+ ;;
+cygwin*)
+ #
+ # Shared libraries in cygwin/Win32 must never contain
+ # undefined symbols.
+ #
+ LDFLAGS="$LDFLAGS -no-undefined"
+ AC_MSG_RESULT(CygWin GNU ld - added -no-undefined)
+ ;;
+*)
+ AC_MSG_RESULT(none needed)
+ ;;
+esac
+AC_SUBST(LDFLAGS_SHAREDLIB)
+
AC_ARG_ENABLE(profile-build,
[ --enable-profile-build build profile-ready binaries. [default=no]],enable_profile_build=$enableval,enable_profile_build=no)
AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
fi
AC_ARG_ENABLE(gtk2,
-[ --disable-gtk2 build Glib1/Gtk1+-based (t)ethereal. [default=no]],enable_gtk2=$enableval,enable_gtk2=yes)
+[ --disable-gtk2 build Glib1/Gtk1+-based wireshark/tshark. [default=no]],enable_gtk2=$enableval,enable_gtk2=yes)
if test "x$enable_gtk2" = "xyes" ; then
AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS", , gmodule)
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h netinet/in.h unistd.h fcntl.h sys/stat.h sys/types.h)
+#
+# Define WS_VAR_IMPORT appropriately for declarations of external
+# variables exported from dynamically-linked libraries.
+#
+AC_DEFINE(WS_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
+
# We must know our byte order
AC_C_BIGENDIAN
+#
+# Does GLib define G_GINT64_MODIFIER?
+#
+AC_MSG_CHECKING([[whether glib.h defines the G_GINT64_MODIFIER macro]])
+AC_COMPILE_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+ #include <glib.h>
+ #if GTK_MAJOR_VERSION >= 2
+ #include <glib/gprintf.h>
+ #endif
+ #include <stdio.h>
+
+ main()
+ {
+ char strbuf[16+1];
+ g_snprintf(strbuf, sizeof strbuf, "%" G_GINT64_MODIFIER "x\n", (gint64)1);
+ }
+ ]])
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_WIRETAP_CHECK_64BIT_FORMAT(ll,
+ [
+ AC_WIRETAP_CHECK_64BIT_FORMAT(L,
+ [
+ AC_WIRETAP_CHECK_64BIT_FORMAT(q,
+ [
+ AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
+ ])
+ ])
+ ])
+ ])
+
#
# Look for libpcap, so we can include <pcap.h> in libpcap.c if it's
# found.
#
# "--with-pcap" is merely done to allow the user to specify a directory
# in which to look for <pcap.h> (and so that specifying it to the
-# top-level Ethereal configure script specifies it to the Wiretap
+# top-level Wireshark configure script specifies it to the Wiretap
# configure script as well); we search for it regardless of whether
# "--without-pcap" was specified, as Wiretap isn't linked with it and
# there's no benefit to not looking for the header.