| 1 |
dnl |
| 2 |
dnl Configure ext/zlib |
| 3 |
dnl This file is included by the toplevel configure.ac |
| 4 |
dnl |
| 5 |
|
| 6 |
dnl |
| 7 |
dnl process with-zlib |
| 8 |
dnl |
| 9 |
|
| 10 |
dnl Use zlib unless explicitly specified otherwise |
| 11 |
ac_cv_use_zlib=yes |
| 12 |
ZLIB_CPPFLAGS= |
| 13 |
ZLIB_LDFLAGS= |
| 14 |
|
| 15 |
AC_ARG_WITH(zlib, |
| 16 |
AS_HELP_STRING([--with-zlib=PATH], |
| 17 |
[Use zlib library installed under PATH. |
| 18 |
The rfc.zlib module uses zlib if it is avilable. If your system has zlib |
| 19 |
library in non-trivial location, specify this option. |
| 20 |
The include file is looked for in PATH/include, |
| 21 |
and the library file is looked for in PATH/lib. |
| 22 |
If you don't want to use zlib for some reason, say --without-zlib. ]), |
| 23 |
[ |
| 24 |
AS_CASE([$with_zlib], |
| 25 |
[no], [ac_cv_use_zlib=no], |
| 26 |
[yes], [], |
| 27 |
[ZLIB_CPPFLAGS="-I$with_zlib/include" |
| 28 |
ZLIB_LDFLAGS="-L$with_zlib/lib"]) |
| 29 |
]) |
| 30 |
|
| 31 |
dnl |
| 32 |
dnl Check zlib.h |
| 33 |
dnl |
| 34 |
|
| 35 |
AS_IF([test "$ac_cv_use_zlib" != no], [ |
| 36 |
save_cppflags=$CPPFLAGS |
| 37 |
CPPFLAGS="$CPPFLAGS $ZLIB_CPPFLAGS" |
| 38 |
AC_CHECK_HEADER(zlib.h, |
| 39 |
AC_DEFINE(HAVE_ZLIB_H,1,[Define if you have zlib.h and want to use it]), |
| 40 |
[AC_MSG_WARN("Can't find zlib.h so I turned off using zlib; you may want to use --with-zlib=PATH.") |
| 41 |
ac_cv_use_zlib=no]) |
| 42 |
CPPFLAGS=$save_cppflags |
| 43 |
]) |
| 44 |
|
| 45 |
dnl |
| 46 |
dnl Check libz. |
| 47 |
dnl |
| 48 |
|
| 49 |
AS_IF([test "$ac_cv_use_zlib" = yes], [ |
| 50 |
save_cflags="$CFLAGS" |
| 51 |
save_ldflags="$LDFLAGS" |
| 52 |
save_libs="$LIBS" |
| 53 |
CFLAGS="$CFLAGS $ZLIB_CPPFLAGS" |
| 54 |
LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS" |
| 55 |
LIBS="$LIBS -lz" |
| 56 |
AC_LINK_IFELSE( |
| 57 |
[AC_LANG_PROGRAM([@%:@include <zlib.h>], |
| 58 |
[[const char *r = zlibVersion();]])], |
| 59 |
[ZLIB_LIB="-lz"], |
| 60 |
[AC_MSG_WARN("Can't find libz so I turned off using zlib; you may want to use --with-zlib=PATH") |
| 61 |
ac_cv_use_zlib=no]) |
| 62 |
CFLAGS="$save_cflags" |
| 63 |
LDFLAGS="$save_ldflags" |
| 64 |
LIBS="$save_libs" |
| 65 |
]) |
| 66 |
|
| 67 |
AS_IF([test "$ac_cv_use_zlib" = yes], [ |
| 68 |
dnl Force static linking on MinGW |
| 69 |
AS_CASE(["$target"], |
| 70 |
[*mingw*], [ZLIB_LIB="-Wl,-dn,$ZLIB_LIB,-dy"]) |
| 71 |
|
| 72 |
AC_DEFINE(USE_ZLIB, [], [Define if uses zlib]) |
| 73 |
ZLIB_ARCHFILES=rfc--zlib.$SHLIB_SO_SUFFIX |
| 74 |
AC_SUBST(ZLIB_ARCHFILES) |
| 75 |
ZLIB_SCMFILES=zlib.sci |
| 76 |
AC_SUBST(ZLIB_SCMFILES) |
| 77 |
ZLIB_OBJECTS="gauche-zlib.$OBJEXT rfc--zlib.$OBJEXT" |
| 78 |
AC_SUBST(ZLIB_OBJECTS) |
| 79 |
EXT_LIBS="$EXT_LIBS $ZLIB_LIB" |
| 80 |
]) |
| 81 |
AC_SUBST(ZLIB_CPPFLAGS) |
| 82 |
AC_SUBST(ZLIB_LDFLAGS) |
| 83 |
AC_SUBST(ZLIB_LIB) |
| 84 |
|
| 85 |
dnl Local variables: |
| 86 |
dnl mode: autoconf |
| 87 |
dnl end: |