summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2004-07-27 10:05:55 -0700
committerkonstantin@mysql.com <>2004-07-27 10:05:55 -0700
commitd68ed3f0f7bc0730c97f4b40fdc9d42d1b5c60ad (patch)
tree68c9750f9fa1635feca481ec2035c897fda55320
parent569d3c848884b09f30ec0e8ef8bafb73aa167e3e (diff)
downloadmariadb-git-d68ed3f0f7bc0730c97f4b40fdc9d42d1b5c60ad.tar.gz
WL#1518 "make bundled zlib usable for unix builds", post review fixes:
- comment for AC_DEFINE(HAVE_COMPRESS) fixed - build convenience library from zlib: we need to compile it into both libmysqlclient.a and libmysqlclient.so - --with-zlib-dir=bundled configure option
-rw-r--r--acinclude.m4122
-rw-r--r--tools/Makefile.am2
-rw-r--r--zlib/Makefile.am10
3 files changed, 78 insertions, 56 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index bcfa7b55e9b..0df0eed85d7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -168,36 +168,65 @@ fi
])
+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"
+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"
+])
+
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 - custom location of compression library.
-dnl MySQL needs both header file (zlib.h) and the library
-dnl (libz.a). Given location prefix, the macro expects
-dnl to find the library headers in $prefix/include,
-dnl and binaries in $prefix/lib. If DIR is "no",
-dnl compression and all dependent functions will be
-dnl disabled.
-dnl The call checks presense of 'zlib' compression library in default or
-dnl given location. If there is no default library, the macro falls
-dnl back to use zlib bundled along with MySQL sources. But if configure is
-dnl called with custom name/path, and there is no library at given place,
-dnl the macro bails out with error.
+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).
-dnl
-dnl Exception is Novell Netware, where we assume zlib is always present.
AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
AC_MSG_CHECKING([for zlib compression library])
case $SYSTEM_TYPE in
- *netware* | *modesto*)
- AC_MSG_RESULT(ok)
- ;;
+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],
@@ -207,47 +236,40 @@ case $SYSTEM_TYPE in
in $DIR/include.]),
[mysql_zlib_dir=${withval}],
[mysql_zlib_dir=""])
- if test "$mysql_zlib_dir" = "no"; then
- mysql_cv_compress="no"
- AC_MSG_RESULT([disabled])
- else
- if test "$mysql_zlib_dir" = ""; then
+ 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"
- else
+ 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
- true
- else
+ 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
- ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
- ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
- fi
- save_INCLUDES="$INCLUDES"
- save_LIBS="$LIBS"
- 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)],
- [if test "$mysql_zlib_dir" = ""; then
- AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
- ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
- ZLIB_LIBS="-L\$(top_builddir)/zlib -lz"
- zlib_dir="zlib"
- AC_SUBST([zlib_dir])
- mysql_cv_compress="yes"
- else
- AC_MSG_ERROR([not found in $mysql_zlib_dir])
- fi])])
- INCLUDES="$save_INCLUDES"
- LIBS="$save_LIBS"
- AC_DEFINE([HAVE_COMPRESS], [1], [Define if zlib is present])
+ ;;
+ 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
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 50d1c8af56a..0dc90a0d107 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -17,7 +17,7 @@
INCLUDES=@MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ @ZLIB_LIBS@ \
- $(top_builddir)/libmysql_r/libmysqlclient_r.la \
+ $(top_builddir)/libmysql_r/libmysqlclient_r.la
bin_PROGRAMS= mysqlmanager
mysqlmanager_SOURCES= mysqlmanager.c
mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
diff --git a/zlib/Makefile.am b/zlib/Makefile.am
index 81d0f26082d..58d3811cd7c 100644
--- a/zlib/Makefile.am
+++ b/zlib/Makefile.am
@@ -16,14 +16,14 @@
# Process this file with automake to create Makefile.in
-noinst_LIBRARIES=libz.a
+noinst_LTLIBRARIES=libz.la
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \
- inftrees.h trees.h zconf.h zlib.h zutil.h
+ inftrees.h trees.h zconf.h zlib.h zutil.h
-libz_a_SOURCES= adler32.c compress.c crc32.c deflate.c gzio.c \
- infback.c inffast.c inflate.c inftrees.c trees.c \
- uncompr.c zutil.c
+libz_la_SOURCES= adler32.c compress.c crc32.c deflate.c gzio.c \
+ infback.c inffast.c inflate.c inftrees.c trees.c \
+ uncompr.c zutil.c
EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3