# # Include the TEA standard macro set # builtin(include,tclconfig/tcl.m4) # # Add here whatever m4 macros you want to define for your package # # AC_DEFUN([LIB_ZLIB], [ZLIB_CFLAGS= ZLIB_LDFLAGS= ZLIB_LIBS= AC_ARG_WITH([zlib], [AC_HELP_STRING([--with-zlib@<:@=PATH@:>@], [Set the path of zlib])], ZLIB_DIR=$with_zlib,ZLIB_DIR=yes) AC_MSG_CHECKING([for zlib location]) if test x"$ZLIB_DIR" = xyes ; then if test -f "./zlib-1.2.2/deflate.o" ; then ZLIB_DIR=./zlib-1.2.2 fi fi if test x"$ZLIB_DIR" = xyes ; then for dir in $prefix /usr/local /usr ; do if test -f "$dir/include/zlib.h" ; then ZLIB_DIR=$dir break fi done fi if test x"$ZLIB_DIR" = xyes ; then # This is probably heresy during configure... # Try to copy & build the supplied zlib if test -f "./libz" ; then rm ./libz/* rmdir ./libz fi mkdir ./libz cp ${srcdir}/zlib-1.2.2/* ./libz cd libz ./configure --shared make cd .. ZLIB_DIR=./libz fi if test x"$ZLIB_DIR" = xyes ; then AC_MSG_ERROR([cannot find libz]) else AC_MSG_RESULT([$ZLIB_DIR]) if test -f "$ZLIB_DIR/deflate.o" ; then ZLIB_CFLAGS="-I$ZLIB_DIR" ZLIB_LDFLAGS="$ZLIB_DIR/adler32.o $ZLIB_DIR/crc32.o \ $ZLIB_DIR/infback.o $ZLIB_DIR/inflate.o $ZLIB_DIR/uncompr.o \ $ZLIB_DIR/compress.o $ZLIB_DIR/deflate.o $ZLIB_DIR/gzio.o \ $ZLIB_DIR/inffast.o $ZLIB_DIR/inftrees.o $ZLIB_DIR/trees.o \ $ZLIB_DIR/zutil.o" else if test x"$ZLIB_DIR" != x/usr ; then ZLIB_CFLAGS="-I$ZLIB_DIR/include" ZLIB_LDFLAGS="-L$ZLIB_DIR/lib -lz" else ZLIB_LDFLAGS="-lz" fi zlib_save_LDFLAGS=$LDFLAGS LDFLAGS="$ZLIB_LDFLAGS $LDFLAGS" AC_CHECK_LIB([z], [deflateBound], [ZLIB_LIBS=-lz], [ZLIB_LIBS=no]) LDFLAGS=$zlib_save_LDFLAGS if test x"$ZLIB_LIBS" = xno ; then # Try to copy & build the supplied zlib if test -f "./libz" ; then rm ./libz/* rmdir ./libz fi mkdir ./libz cp ${srcdir}/zlib-1.2.2/* ./libz cd libz ./configure --shared make cd .. ZLIB_DIR=./libz ZLIB_LIBS="" ZLIB_CFLAGS="-I$ZLIB_DIR" ZLIB_LDFLAGS="$ZLIB_DIR/adler32.o $ZLIB_DIR/crc32.o \ $ZLIB_DIR/infback.o $ZLIB_DIR/inflate.o $ZLIB_DIR/uncompr.o \ $ZLIB_DIR/compress.o $ZLIB_DIR/deflate.o $ZLIB_DIR/gzio.o \ $ZLIB_DIR/inffast.o $ZLIB_DIR/inftrees.o $ZLIB_DIR/trees.o \ $ZLIB_DIR/zutil.o" fi fi AC_DEFINE([HAVE_ZLIB], 1, [Define if zlib is available.]) fi AC_SUBST([ZLIB_CFLAGS]) AC_SUBST([ZLIB_LDFLAGS]) AC_SUBST([ZLIB_LIBS])])