diff --git a/Makefile.am b/Makefile.am index 55088956df..c6a44a130c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -518,8 +518,7 @@ text2pcap_CFLAGS = $(GENERATED_CFLAGS) # Libraries with which to link text2pcap. text2pcap_LDADD = \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - @ZLIB_LIBS@ + @GLIB_LIBS@ mergecap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -527,8 +526,7 @@ mergecap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) mergecap_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - @ZLIB_LIBS@ + @GLIB_LIBS@ capinfos_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -537,8 +535,7 @@ capinfos_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ @GLIB_LIBS@ \ - @LIBGCRYPT_LIBS@ \ - @ZLIB_LIBS@ + @LIBGCRYPT_LIBS@ captype_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -546,8 +543,7 @@ captype_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) captype_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - @ZLIB_LIBS@ + @GLIB_LIBS@ editcap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -555,8 +551,7 @@ editcap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) editcap_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - @ZLIB_LIBS@ + @GLIB_LIBS@ reordercap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -564,8 +559,7 @@ reordercap_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) reordercap_LDADD = \ wiretap/libwiretap.la \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - @ZLIB_LIBS@ + @GLIB_LIBS@ randpkt_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -579,8 +573,7 @@ randpkt_LDADD = \ @SOCKET_LIBS@ \ @NSL_LIBS@ \ @C_ARES_LIBS@ \ - @ADNS_LIBS@ \ - @ZLIB_LIBS@ + @ADNS_LIBS@ dftest_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) @@ -637,8 +630,7 @@ dumpcap_LDADD = \ @SYSTEMCONFIGURATION_FRAMEWORKS@ \ @COREFOUNDATION_FRAMEWORKS@ \ @LIBCAP_LIBS@ \ - @LIBNL_LIBS@ \ - @ZLIB_LIBS@ + @LIBNL_LIBS@ # # Build the version string diff --git a/acinclude.m4 b/acinclude.m4 index b467ef75bf..b432d4cea2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -593,45 +593,31 @@ AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK], AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK], [ AC_WIRESHARK_PUSH_FLAGS - ac_ws_saved_LIBS="$LIBS" - if test "x$zlib_dir" = "x" + if test "x$zlib_dir" != "x" then - PKG_WIRESHARK_CHECK_SYSTEM_MODULES(ZLIB, [zlib], [zlib_found=yes], [zlib_found=no]) - fi - - if test x"$zlib_found" != xyes; then - if test "x$zlib_dir" != "x"; then - # - # The user specified a directory in which zlib resides, - # so add the "include" subdirectory of that directory to - # the include file search path and the "lib" subdirectory - # of that directory to the library search path. - # - ZLIB_CFLAGS="-I$zlib_dir/include" - AC_WIRESHARK_ADD_DASH_L(ZLIB_LIBS, [$zlib_dir/lib]) - fi - AX_APPEND_FLAG(-lz, ZLIB_LIBS) + # + # The user specified a directory in which zlib resides, + # so add the "include" subdirectory of that directory to + # the include file search path and the "lib" subdirectory + # of that directory to the library search path. + # + # XXX - if there's also a zlib in a directory that's + # already in CPPFLAGS or LDFLAGS, this won't make us find + # the version in the specified directory, as the compiler + # and/or linker will search that other directory before it + # searches the specified directory. + # + CPPFLAGS="$CPPFLAGS -I$zlib_dir/include" + AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $zlib_dir/lib) fi # - # Make sure we have "zlib.h". + # Make sure we have "zlib.h". If we don't, it means we probably + # don't have zlib, so don't use it. # - CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS" - AC_CHECK_HEADERS(zlib.h, + AC_CHECK_HEADER(zlib.h,, [ - # - # We link with zlib to support uncompression of - # gzipped network traffic, e.g. in an HTTP request - # or response body. - # - have_zlib=yes - ], - [ - have_zlib=no - ZLIB_CFLAGS="" - ZLIB_LIBS="" - if test "x$zlib_dir" != "x" then # @@ -655,24 +641,58 @@ AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK], # We couldn't find the header file; don't use the # library, as it's probably not present. # - AC_MSG_NOTICE(zlib.h not found - disabling gzip compression and decompression) + want_zlib=no fi fi ]) - if test "x$have_zlib" != "xno" + if test "x$want_zlib" != "xno" then + # + # Well, we at least have the zlib header file. + # We link with zlib to support uncompression of + # gzipped network traffic, e.g. in an HTTP request + # or response body. + # + if test "x$zlib_dir" != "x" + then + WS_CPPFLAGS="$WS_CPPFLAGS -I$zlib_dir/include" + AC_WIRESHARK_ADD_DASH_L(WS_LDFLAGS, $zlib_dir/lib) + fi + LIBS="$LIBS -lz" + AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library]) # # Check for "inflatePrime()" in zlib, which we need # in order to read compressed capture files. # - LIBS="$ZLIB_LIBS $LIBS" - AC_CHECK_FUNCS(inflatePrime,[], - [AC_MSG_NOTICE(inflatePrime not found - disabling gzipped capture file support)]) + AC_CHECK_FUNCS(inflatePrime) + + if test "x$ac_cv_func_inflatePrime" = "xyes" ; then + # + # Now check for "inflatePrime()" in zlib when + # linking with the linker flags for GTK+ + # applications; people often grab XFree86 source + # and build and install it on their systems, + # and they appear sometimes to misconfigure + # XFree86 so that, even on systems with zlib, + # it assumes there is no zlib, so the XFree86 + # build process builds and installs its + # own zlib in the X11 library directory. + # + # The zlib in at least some versions of XFree86 + # is an older version that may lack "inflatePrime()", + # and that's the zlib with which Wireshark gets + # linked, so the build of Wireshark fails. + # + AC_MSG_CHECKING([for inflatePrime missing when linking with X11]) + AC_TRY_LINK_FUNC(inflatePrime, AC_MSG_RESULT(no), + [ + AC_MSG_RESULT(yes) + AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.) + ]) + fi fi - AC_SUBST(ZLIB_CFLAGS) - AC_SUBST(ZLIB_LIBS) - LIBS="$ac_ws_saved_LIBS" + AC_WIRESHARK_POP_FLAGS ]) diff --git a/configure.ac b/configure.ac index 9e87f9b68e..c917542472 100644 --- a/configure.ac +++ b/configure.ac @@ -2424,11 +2424,8 @@ else AC_WIRESHARK_PCAP_REMOTE_CHECK fi -dnl dnl zlib check -dnl AC_MSG_CHECKING(whether to use zlib for gzip compression and decompression) -have_zlib=no AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib@<:@=DIR@:>@], @@ -2445,11 +2442,24 @@ AC_ARG_WITH(zlib, zlib_dir="$withval" fi ],[ - want_zlib="if available" + # + # Use zlib if it's present, otherwise don't. + # + want_zlib=ifavailable + zlib_dir= ]) -AC_MSG_RESULT([$want_zlib]) -if test "x$want_zlib" != "xno" ; then +if test "x$want_zlib" = "xno" ; then + AC_MSG_RESULT(no) +else + 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 + if test "x$ac_cv_func_inflatePrime" = "xno" ; then + AC_MSG_RESULT(inflatePrime not found in zlib - disabling gzipped capture file support) + fi + fi fi dnl Lua check @@ -3360,7 +3370,7 @@ else dumpcap_group_message="$DUMPCAP_GROUP" fi -if test "x$have_zlib" = "xno" ; then +if test "x$want_zlib" = "xno" ; then zlib_message="no" else zlib_message="yes" diff --git a/epan/Makefile.am b/epan/Makefile.am index 9c79ba5468..2daae9e6e4 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -43,7 +43,7 @@ ACLOCAL_AMFLAGS = `../aclocal-flags` AM_CPPFLAGS = $(INCLUDEDIRS) -I$(builddir)/wslua $(WS_CPPFLAGS) \ $(GLIB_CFLAGS) $(LUA_CFLAGS) $(LIBGNUTLS_CFLAGS) \ $(LIBGCRYPT_CFLAGS) $(LIBSMI_CFLAGS) $(LIBGEOIP_CFLAGS) \ - $(KRB5_CFLAGS) $(ZLIB_CFLAGS) + $(KRB5_CFLAGS) noinst_LTLIBRARIES = libwireshark_generated.la libwireshark_asmopt.la lib_LTLIBRARIES = libwireshark.la @@ -146,7 +146,6 @@ libwireshark_la_LIBADD = \ @LIBSMI_LDFLAGS@ \ @GEOIP_LIBS@ \ @GLIB_LIBS@ \ - $(ZLIB_LIBS) \ -lm libwireshark_la_DEPENDENCIES = \ @@ -168,17 +167,17 @@ EXTRA_PROGRAMS = reassemble_test tvbtest oids_test reassemble_test_LDADD = \ libwireshark.la \ $(GLIB_LIBS) \ - $(ZLIB_LIBS) + -lz tvbtest_LDADD = \ libwireshark.la \ $(GLIB_LIBS) \ - $(ZLIB_LIBS) + -lz oids_test_LDADD = \ libwireshark.la \ $(GLIB_LIBS) \ - $(ZLIB_LIBS) + -lz exntest: exntest.o except.o $(LINK) $^ $(GLIB_LIBS) diff --git a/epan/dissectors/Makefile.am b/epan/dissectors/Makefile.am index 699bdef891..85673f047e 100644 --- a/epan/dissectors/Makefile.am +++ b/epan/dissectors/Makefile.am @@ -22,8 +22,7 @@ include Makefile.common include $(top_srcdir)/Makefile.am.inc AM_CPPFLAGS = $(INCLUDEDIRS) -I$(top_srcdir)/epan $(WS_CPPFLAGS) \ - $(GLIB_CFLAGS) $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS) \ - $(ZLIB_CFLAGS) + $(GLIB_CFLAGS) $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS) noinst_LTLIBRARIES = libdirtydissectors.la libfiledissectors.la libdissectors.la diff --git a/epan/wslua/Makefile.am b/epan/wslua/Makefile.am index 23a267898a..48b20925c1 100644 --- a/epan/wslua/Makefile.am +++ b/epan/wslua/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.am.inc AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(LUA_CFLAGS) \ - $(GLIB_CFLAGS) $(ZLIB_CFLAGS) + $(GLIB_CFLAGS) noinst_LTLIBRARIES = libwslua.la diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am index 3be75a7545..d716817767 100644 --- a/wiretap/Makefile.am +++ b/wiretap/Makefile.am @@ -24,8 +24,7 @@ include $(top_srcdir)/Makefile.am.inc ACLOCAL_AMFLAGS = `../aclocal-flags` -AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DWS_BUILD_DLL $(GLIB_CFLAGS) \ - $(ZLIB_CFLAGS) +AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DWS_BUILD_DLL $(GLIB_CFLAGS) noinst_LTLIBRARIES = libwiretap_generated.la lib_LTLIBRARIES = libwiretap.la @@ -64,11 +63,7 @@ EXTRA_DIST = \ $(GENERATOR_FILES) \ $(GENERATED_FILES) -libwiretap_la_LIBADD = \ - libwiretap_generated.la \ - ${top_builddir}/wsutil/libwsutil.la \ - $(GLIB_LIBS) \ - $(ZLIB_LIBS) +libwiretap_la_LIBADD = libwiretap_generated.la ${top_builddir}/wsutil/libwsutil.la $(GLIB_LIBS) libwiretap_la_DEPENDENCIES = libwiretap_generated.la ${top_builddir}/wsutil/libwsutil.la