]>
Commit | Line | Data |
---|---|---|
99eada54 SS |
1 | --- exiv2-0.17.1/acinclude.m4.orig 1970-01-01 01:00:00.000000000 +0100 |
2 | +++ exiv2-0.17.1/acinclude.m4 2008-07-21 13:52:55.923794430 +0200 | |
3 | @@ -0,0 +1,90 @@ | |
4 | +dnl @synopsis CHECK_ZLIB() | |
5 | +dnl | |
6 | +dnl This macro searches for an installed zlib library. If nothing | |
7 | +dnl was specified when calling configure, it searches first in /usr/local | |
8 | +dnl and then in /usr. If the --with-zlib=DIR is specified, it will try | |
9 | +dnl to find it in DIR/include/zlib.h and DIR/lib/libz.a. If --without-zlib | |
10 | +dnl is specified, the library is not searched at all. | |
11 | +dnl | |
12 | +dnl If either the header file (zlib.h) or the library (libz) is not | |
13 | +dnl found, the configuration exits on error, asking for a valid | |
14 | +dnl zlib installation directory or --without-zlib. | |
15 | +dnl | |
16 | +dnl The macro defines the symbol HAVE_LIBZ if the library is found. You should | |
17 | +dnl use autoheader to include a definition for this symbol in a config.h | |
18 | +dnl file. Sample usage in a C/C++ source is as follows: | |
19 | +dnl | |
20 | +dnl #ifdef HAVE_LIBZ | |
21 | +dnl #include <zlib.h> | |
22 | +dnl #endif /* HAVE_LIBZ */ | |
23 | +dnl | |
24 | +dnl @version $Id$ | |
25 | +dnl @author Loic Dachary <loic@senga.org> | |
26 | +dnl with modifications by Andreas Huggel <ahuggel@gmx.net> | |
27 | +dnl | |
28 | +AC_DEFUN([CHECK_ZLIB], | |
29 | +# | |
30 | +# Handle user hints | |
31 | +# | |
32 | +[AC_MSG_CHECKING(if zlib is wanted) | |
33 | +AC_ARG_WITH(zlib, | |
34 | +[ --with-zlib=DIR root directory path of zlib installation [defaults to | |
35 | + /usr/local or /usr if not found in /usr/local] | |
36 | + --without-zlib to disable zlib usage completely], | |
37 | +[if test "$withval" != no ; then | |
38 | + AC_MSG_RESULT(yes) | |
39 | + ZLIB_HOME="$withval" | |
40 | +else | |
41 | + AC_MSG_RESULT(no) | |
42 | +fi], [ | |
43 | +AC_MSG_RESULT(yes) | |
44 | +ZLIB_HOME=/usr/local | |
45 | +if test ! -f "${ZLIB_HOME}/include/zlib.h" | |
46 | +then | |
47 | + ZLIB_HOME=/usr | |
48 | +fi | |
49 | +]) | |
50 | +# | |
51 | +# Locate zlib, if wanted | |
52 | +# | |
53 | +if test -n "${ZLIB_HOME}" | |
54 | +then | |
55 | + ZLIB_OLD_LDFLAGS=$LDFLAGS | |
56 | + ZLIB_OLD_CPPFLAGS=$CPPFLAGS | |
57 | + # | |
58 | + # Adding /usr/lib or /usr/include to the flags/libs may | |
59 | + # hurt if using a compiler not installed in the standard | |
60 | + # place. | |
61 | + # | |
62 | + if test "${ZLIB_HOME}" != "/usr" | |
63 | + then | |
64 | + LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" | |
65 | + CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" | |
66 | + fi | |
67 | + AC_LANG_SAVE | |
68 | + AC_LANG_C | |
69 | + AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no]) | |
70 | + AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no]) | |
71 | + AC_LANG_RESTORE | |
72 | + if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes" | |
73 | + then | |
74 | + # | |
75 | + # If both library and header were found, use them | |
76 | + # | |
77 | + AC_CHECK_LIB(z, inflateEnd) | |
78 | + AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) | |
79 | + AC_MSG_RESULT(ok) | |
80 | + HAVE_LIBZ=1 | |
81 | + else | |
82 | + # | |
83 | + # If either header or library was not found, revert and bomb | |
84 | + # | |
85 | + AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) | |
86 | + LDFLAGS="$ZLIB_OLD_LDFLAGS" | |
87 | + CPPFLAGS="$ZLIB_OLD_CPPFLAGS" | |
88 | + AC_MSG_RESULT(failed) | |
89 | + AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib) | |
90 | + fi | |
91 | +fi | |
92 | + | |
93 | +]) |