summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-06-26 21:03:01 -0700
committerGuy Harris <guy@alum.mit.edu>2017-06-27 07:48:58 +0000
commite61d2f624348329f8d73af55e6ff3e0e7ee012da (patch)
treea7bd6fc39c26a0f8bb68f32d1918eb5e47dc087b
parentd84da1eb97e3442dc8005b296111a5286ccb10f8 (diff)
downloadwireshark-e61d2f624348329f8d73af55e6ff3e0e7ee012da.tar.gz
On UN*X, make sure we can find inflate() in libz.
For example, on at least some versions of Fedora, if you have a 64-bit machine, have both the 32-bit and 64-bit versions of the run-time zlib package installed, and have only the *32-bit* version of the zlib development package installed, it'll find the header, and think it can use zlib, and will use it in subsequent tests, but it'll try and link 64-bit test programs with the 32-bit library, causing those tests to falsely fail. Hilarity ensues. Change-Id: Ic2536e8a652ef96e2a3923c1faa61f6c8c06bf58 Reviewed-on: https://code.wireshark.org/review/22417 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--acinclude.m422
-rw-r--r--cmake/modules/FindZLIB.cmake16
2 files changed, 37 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index fcbbab8327..4ab5bcbdfb 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -495,18 +495,38 @@ AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK],
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.
#
+ # Check for inflate() in zlib, to make sure the
+ # zlib library is usable. For example, on at
+ # least some versions of Fedora, if you have a
+ # 64-bit machine, have both the 32-bit and 64-bit
+ # versions of the run-time zlib package installed,
+ # and have only the *32-bit* version of the zlib
+ # development package installed, it'll find the
+ # header, and think it can use zlib, and will use
+ # it in subsequent tests, but it'll try and link
+ # 64-bit test programs with the 32-bit library,
+ # causing those tests to falsely fail. Hilarity
+ # ensues.
+ #
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="-lz $LIBS"
AC_DEFINE(HAVE_ZLIB, 1, [Define to use zlib library])
#
+ # Check for "inflate()" in zlib to make sure we can
+ # link with it.
+ #
+ AC_CHECK_LIB(z, inflate,,
+ AC_MSG_ERROR([zlib.h found but linking with -lz failed to find inflate(); do you have the right developer package installed (32-bit vs. 64-bit)?]))
+
+ #
# Check for "inflatePrime()" in zlib, which we need
# in order to read compressed capture files.
#
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake
index ac4259b984..34fb1bb608 100644
--- a/cmake/modules/FindZLIB.cmake
+++ b/cmake/modules/FindZLIB.cmake
@@ -102,6 +102,22 @@ IF(WIN32)
ELSE()
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
+ #
+ # Check for inflate() in zlib, to make sure the zlib library is
+ # usable.
+ #
+ # For example, on at least some versions of Fedora, if you have a
+ # 64-bit machine, have both the 32-bit and 64-bit versions of the
+ # run-time zlib package installed, and have only the *32-bit*
+ # version of the zlib development package installed, it'll find the
+ # header, and think it can use zlib, and will use it in subsequent
+ # tests, but it'll try and link 64-bit test programs with the 32-bit
+ # library, causing those tests to falsely fail. Hilarity ensues.
+ #
+ CHECK_FUNCTION_EXISTS("inflate" HAVE_INFLATE)
+ IF(NOT HAVE_INFLATE)
+ MESSAGE(FATAL_ERROR "zlib.h found but linking with -lz failed to find inflate(); do you have the right developer package installed (32-bit vs. 64-bit)?")
+ ENDIF()
CHECK_FUNCTION_EXISTS("inflatePrime" HAVE_INFLATEPRIME)
# reset
SET(CMAKE_REQUIRED_LIBRARIES "")