~ubuntu-branches/ubuntu/karmic/e-uae/karmic

« back to all changes in this revision

Viewing changes to m4/check_zlib.m4

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Suerken
  • Date: 2008-07-05 14:02:02 UTC
  • Revision ID: james.westby@ubuntu.com-20080705140202-u5aagnhtg31pmjc3
Tags: upstream-0.8.29-WIP4
ImportĀ upstreamĀ versionĀ 0.8.29-WIP4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Available from the GNU Autoconf Macro Archive at:
 
2
dnl http://www.gnu.org/software/ac-archive/htmldoc/check_zlib.html
 
3
dnl
 
4
AC_DEFUN([CHECK_ZLIB],
 
5
#
 
6
# Handle user hints
 
7
#
 
8
[AC_MSG_CHECKING(if zlib is wanted)
 
9
AC_ARG_WITH(zlib,
 
10
[  --with-zlib=DIR root directory path of zlib installation [defaults to
 
11
                    /usr/local or /usr if not found in /usr/local]
 
12
  --without-zlib to disable zlib usage completely],
 
13
[if test "$withval" != no ; then
 
14
  AC_MSG_RESULT(yes)
 
15
  ZLIB_HOME="$withval"
 
16
else
 
17
  AC_MSG_RESULT(no)
 
18
fi], [
 
19
AC_MSG_RESULT(yes)
 
20
ZLIB_HOME=/usr/local
 
21
if test ! -f "${ZLIB_HOME}/include/zlib.h"
 
22
then
 
23
        ZLIB_HOME=/usr
 
24
fi
 
25
])
 
26
 
 
27
#
 
28
# Locate zlib, if wanted
 
29
#
 
30
if test -n "${ZLIB_HOME}"
 
31
then
 
32
        ZLIB_OLD_LDFLAGS=$LDFLAGS
 
33
        ZLIB_OLD_CPPFLAGS=$LDFLAGS
 
34
        LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
 
35
        CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
 
36
        AC_LANG_SAVE
 
37
        AC_LANG_C
 
38
        AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
 
39
        AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cvs_zlib_h=no])
 
40
        AC_LANG_RESTORE
 
41
        if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
 
42
        then
 
43
                #
 
44
                # If both library and header were found, use them
 
45
                #
 
46
                AC_CHECK_LIB(z, inflateEnd)
 
47
                AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
 
48
                AC_MSG_RESULT(ok)
 
49
        else
 
50
                #
 
51
                # If either header or library was not found, revert and bomb
 
52
                #
 
53
                AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
 
54
                LDFLAGS="$ZLIB_OLD_LDFLAGS"
 
55
                CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
 
56
                AC_MSG_RESULT(failed)
 
57
                AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
 
58
        fi
 
59
fi
 
60
 
 
61
])