Source
6
6
# This macro #defines HAVE_ZLIB_H if required header files are
7
7
# found, and sets @ZLIB_LDFLAGS@ and @ZLIB_CFLAGS@ to the necessary
8
8
# values.
9
9
#
10
10
# This macro is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
13
14
14
AC_DEFUN([ZLIB_TRY_LINK],
15
15
[
16
+
found_zlib=$1
16
17
AC_TRY_LINK(
17
18
[
18
19
#include <zlib.h>
19
20
],
20
21
[
21
22
z_stream defstream;
22
23
deflateInit(&defstream, Z_BEST_COMPRESSION);
23
24
],
24
25
found_zlib="yes")
25
26
])dnl
26
27
27
28
AC_DEFUN([ZLIB_CHECK_CONFIG],
28
29
[
29
30
AC_ARG_WITH([zlib],[
30
31
If you want to specify zlib installation directories:
31
-
AC_HELP_STRING([--with-zlib=DIR], [use zlib from given base install directory (DIR), default is to search through a number of common places for the zlib files.])],
32
+
AC_HELP_STRING([--with-zlib@<:@=DIR@:>@], [use zlib from given base install directory (DIR), default is to search through a number of common places for the zlib files.])],
32
33
[
33
34
test "x$withval" = "xyes" && withval=/usr
34
35
ZLIB_CFLAGS="-I$withval/include"
35
36
ZLIB_LDFLAGS="-L$withval/lib"
36
37
_zlib_dir_set="yes"
37
38
]
38
39
)
39
40
40
41
AC_ARG_WITH([zlib-include],
41
42
AC_HELP_STRING([--with-zlib-include=DIR],
78
79
79
80
if test "x$found_zlib" = "xyes"; then
80
81
am_save_CFLAGS="$CFLAGS"
81
82
am_save_LDFLAGS="$LDFLAGS"
82
83
am_save_LIBS="$LIBS"
83
84
84
85
CFLAGS="$CFLAGS $ZLIB_CFLAGS"
85
86
LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
86
87
LIBS="$LIBS $ZLIB_LIBS"
87
88
88
-
found_zlib="no"
89
89
ZLIB_TRY_LINK([no])
90
90
91
91
CFLAGS="$am_save_CFLAGS"
92
92
LDFLAGS="$am_save_LDFLAGS"
93
93
LIBS="$am_save_LIBS"
94
94
fi
95
95
96
96
if test "x$found_zlib" = "xyes"; then
97
97
AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the 'zlib' library (-lz)])
98
98
AC_MSG_RESULT(yes)