diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-06-26 21:03:01 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-06-27 07:49:10 +0000 |
commit | 89431bce5373fec79aea03bef9fa25908d92f7f4 (patch) | |
tree | 8ce1c666c2195803c646cab4a884c1e607db74e5 | |
parent | fc9a7df426589b1311df1fc2912ab39f9efd5ac9 (diff) | |
download | wireshark-89431bce5373fec79aea03bef9fa25908d92f7f4.tar.gz wireshark-89431bce5373fec79aea03bef9fa25908d92f7f4.tar.bz2 wireshark-89431bce5373fec79aea03bef9fa25908d92f7f4.zip |
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>
(cherry picked from commit e61d2f624348329f8d73af55e6ff3e0e7ee012da)
Reviewed-on: https://code.wireshark.org/review/22418
-rw-r--r-- | acinclude.m4 | 22 | ||||
-rw-r--r-- | cmake/modules/FindZLIB.cmake | 16 |
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 "") |