build/autoconf/zlib.m4

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 dnl Usage: MOZ_ZLIB_CHECK([version])
michael@0 6
michael@0 7 AC_DEFUN([MOZ_ZLIB_CHECK],
michael@0 8 [
michael@0 9
michael@0 10 MOZZLIB=$1
michael@0 11
michael@0 12 MOZ_ARG_WITH_STRING(system-zlib,
michael@0 13 [ --with-system-zlib[=PFX]
michael@0 14 Use system libz [installed at prefix PFX]],
michael@0 15 ZLIB_DIR=$withval)
michael@0 16
michael@0 17 if test -z "$MOZ_ZLIB_LIBS$MOZ_ZLIB_CFLAGS$SKIP_LIBRARY_CHECKS"; then
michael@0 18 _SAVE_CFLAGS=$CFLAGS
michael@0 19 _SAVE_LDFLAGS=$LDFLAGS
michael@0 20 _SAVE_LIBS=$LIBS
michael@0 21
michael@0 22 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
michael@0 23 MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
michael@0 24 MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib"
michael@0 25 CFLAGS="$MOZ_ZLIB_CFLAGS $CFLAGS"
michael@0 26 LDFLAGS="$MOZ_ZLIB_LIBS $LDFLAGS"
michael@0 27 fi
michael@0 28 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
michael@0 29 MOZ_NATIVE_ZLIB=
michael@0 30 else
michael@0 31 AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"],
michael@0 32 [MOZ_NATIVE_ZLIB=])
michael@0 33 if test "$MOZ_NATIVE_ZLIB" = 1; then
michael@0 34 MOZZLIBNUM=`echo $MOZZLIB | awk -F. changequote(<<, >>)'{printf "0x%x\n", (((<<$>>1 * 16 + <<$>>2) * 16) + <<$>>3) * 16 + <<$>>4}'changequote([, ])`
michael@0 35 AC_TRY_COMPILE([ #include <stdio.h>
michael@0 36 #include <string.h>
michael@0 37 #include <zlib.h> ],
michael@0 38 [ #if ZLIB_VERNUM < $MOZZLIBNUM
michael@0 39 #error "Insufficient zlib version ($MOZZLIBNUM required)."
michael@0 40 #endif ],
michael@0 41 MOZ_NATIVE_ZLIB=1,
michael@0 42 AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)]))
michael@0 43 fi
michael@0 44 fi
michael@0 45 CFLAGS=$_SAVE_CFLAGS
michael@0 46 LDFLAGS=$_SAVE_LDFLAGS
michael@0 47 LIBS=$_SAVE_LIBS
michael@0 48 fi
michael@0 49
michael@0 50 AC_SUBST(MOZ_ZLIB_CFLAGS)
michael@0 51 AC_SUBST(MOZ_ZLIB_LIBS)
michael@0 52 AC_SUBST(MOZ_NATIVE_ZLIB)
michael@0 53
michael@0 54 ])

mercurial