summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-07-27 10:05:56 -0700
committerunknown <konstantin@mysql.com>2004-07-27 10:05:56 -0700
commit5217955d1a5268fb8cf9e0c4293460725572733d (patch)
tree33f68cd1e472a560f82f0f039e0f061b62f0f371 /acinclude.m4
parent906ad26dc5466bfc98513d2529256f4f95214893 (diff)
parent6a371e242b7ee7549089233662d0b2c369e51d64 (diff)
downloadmariadb-git-5217955d1a5268fb8cf9e0c4293460725572733d.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/kostja/mysql/mysql-4.1-zlib configure.in: Auto merged
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4128
1 files changed, 106 insertions, 22 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 0e6dab052ab..0df0eed85d7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -167,32 +167,116 @@ then
fi
])
-AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [
+
+dnl Define zlib paths to point at bundled zlib
+
+AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
+ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
+ZLIB_LIBS="\$(top_builddir)/zlib/libz.la"
+zlib_dir="zlib"
+AC_SUBST([zlib_dir])
+mysql_cv_compress="yes"
+])
+
+dnl Auxilary macro to check for zlib at given path
+
+AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
+save_INCLUDES="$INCLUDES"
save_LIBS="$LIBS"
-LIBS="-l$1 $LIBS"
-AC_CACHE_CHECK([if libz with compress], mysql_cv_compress,
-[AC_TRY_RUN([#include <zlib.h>
-#ifdef __cplusplus
-extern "C"
-#endif
-int main(int argv, char **argc)
-{
- return 0;
-}
+INCLUDES="$ZLIB_INCLUDES"
+LIBS="$ZLIB_LIBS"
+AC_CACHE_VAL([mysql_cv_compress],
+ [AC_TRY_LINK([#include <zlib.h>],
+ [int link_test() { return compress(0, (unsigned long*) 0, "", 0); }],
+ [mysql_cv_compress="yes"
+ AC_MSG_RESULT([ok])],
+ [mysql_cv_compress="no"])
+ ])
+INCLUDES="$save_INCLUDES"
+LIBS="$save_LIBS"
+])
-int link_test()
-{
- return compress(0, (unsigned long*) 0, "", 0);
-}
-], mysql_cv_compress=yes, mysql_cv_compress=no)])
-if test "$mysql_cv_compress" = "yes"
-then
- AC_DEFINE([HAVE_COMPRESS], [1], [ZLIB and compress])
-else
- LIBS="$save_LIBS"
-fi
+dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
+dnl ------------------------------------------------------------------------
+dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
+dnl
+dnl Provides the following configure options:
+dnl --with-zlib-dir=DIR
+dnl Possible DIR values are:
+dnl - "no" - the macro will disable use of compression functions
+dnl - "bundled" - means use zlib bundled along with MySQL sources
+dnl - empty, or not specified - the macro will try default system
+dnl library (if present), and in case of error will fall back to
+dnl bundled zlib
+dnl - zlib location prefix - given location prefix, the macro expects
+dnl to find the library headers in $prefix/include, and binaries in
+dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
+dnl macro bails out with error.
+dnl
+dnl If the library was found, this function #defines HAVE_COMPRESS
+dnl and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include) and
+dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz).
+
+AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
+AC_MSG_CHECKING([for zlib compression library])
+case $SYSTEM_TYPE in
+dnl This is a quick fix for Netware if AC_TRY_LINK for some reason
+dnl won't work there. Uncomment in case of failure and on Netware
+dnl we'll always assume that zlib is present
+dnl *netware* | *modesto*)
+dnl AC_MSG_RESULT(ok)
+dnl AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
+dnl ;;
+ *)
+ AC_ARG_WITH([zlib-dir],
+ AC_HELP_STRING([--with-zlib-dir=DIR],
+ [Provide MySQL with a custom location of
+ compression library. Given DIR, zlib binary is
+ assumed to be in $DIR/lib and header files
+ in $DIR/include.]),
+ [mysql_zlib_dir=${withval}],
+ [mysql_zlib_dir=""])
+ case "$mysql_zlib_dir" in
+ "no")
+ mysql_cv_compress="no"
+ AC_MSG_RESULT([disabled])
+ ;;
+ "bundled")
+ MYSQL_USE_BUNDLED_ZLIB
+ AC_MSG_RESULT([using bundled zlib])
+ ;;
+ "")
+ ZLIB_INCLUDES=""
+ ZLIB_LIBS="-lz"
+ MYSQL_CHECK_ZLIB_DIR
+ if test "$mysql_cv_compress" = "no"; then
+ MYSQL_USE_BUNDLED_ZLIB
+ AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
+ fi
+ ;;
+ *)
+ if test -f "$mysql_zlib_dir/lib/libz.a" -a \
+ -f "$mysql_zlib_dir/include/zlib.h"; then
+ ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
+ ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
+ MYSQL_CHECK_ZLIB_DIR
+ fi
+ if test "x$mysql_cv_compress" != "xyes"; then
+ AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,lib}])
+ fi
+ ;;
+ esac
+ if test "$mysql_cv_compress" = "yes"; then
+ AC_SUBST([ZLIB_LIBS])
+ AC_SUBST([ZLIB_INCLUDES])
+ AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
+ fi
+ ;;
+esac
])
+dnl ------------------------------------------------------------------------
+
#---START: Used in for client configure
AC_DEFUN(MYSQL_CHECK_ULONG,
[AC_MSG_CHECKING(for type ulong)