Commit 569d3c84 authored by konstantin@mysql.com's avatar konstantin@mysql.com

WL#1518, "make bundled zlib usable for unix builds":

required autotools macro written and deployed in all apropriate Makefile.ams.
Use cases checked:
- linux, standard location of zlib, no ndb
- linux, standard locatoin of zlib, with ndb
- linux, non-standard location of zlib, no ndb
- hpux11, use of bundled zlib, no ndb 
The only non-checked case is non-standard location of zlib (or use of bundled
zlib) + ndb. I wasn't able to check it as ndb/ just won't compile on beasts 
like AIX52 or HPUX11, where such a check is possible. It didn't compile 
there before as these systems dont't have installed zlib, so nothing got broken ;)
parent cd5ed13e
...@@ -19,8 +19,15 @@ ...@@ -19,8 +19,15 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory # These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE README COPYING zlib EXTRA_DIST = INSTALL-SOURCE README COPYING
SUBDIRS = . include @docs_dirs@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
DIST_SUBDIRS = . include @docs_dirs@ zlib \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \ @thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests SSL\ @sql_server_dirs@ scripts man tests SSL\
......
...@@ -167,32 +167,94 @@ then ...@@ -167,32 +167,94 @@ then
fi fi
]) ])
AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [
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;
}
int link_test() dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
{ dnl ------------------------------------------------------------------------
return compress(0, (unsigned long*) 0, "", 0); dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
} dnl
], mysql_cv_compress=yes, mysql_cv_compress=no)]) dnl Provides the following configure options:
if test "$mysql_cv_compress" = "yes" dnl --with-zlib-dir - custom location of compression library.
then dnl MySQL needs both header file (zlib.h) and the library
AC_DEFINE([HAVE_COMPRESS], [1], [ZLIB and compress]) dnl (libz.a). Given location prefix, the macro expects
else 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
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)
;;
*)
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=""])
if test "$mysql_zlib_dir" = "no"; then
mysql_cv_compress="no"
AC_MSG_RESULT([disabled])
else
if test "$mysql_zlib_dir" = ""; then
ZLIB_INCLUDES=""
ZLIB_LIBS="-lz"
else
if test -f "$mysql_zlib_dir/lib/libz.a" -a \
-f "$mysql_zlib_dir/include/zlib.h"; then
true
else
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" LIBS="$save_LIBS"
fi AC_DEFINE([HAVE_COMPRESS], [1], [Define if zlib is present])
AC_SUBST([ZLIB_LIBS])
AC_SUBST([ZLIB_INCLUDES])
fi
;;
esac
]) ])
dnl ------------------------------------------------------------------------
#---START: Used in for client configure #---START: Used in for client configure
AC_DEFUN(MYSQL_CHECK_ULONG, AC_DEFUN(MYSQL_CHECK_ULONG,
[AC_MSG_CHECKING(for type ulong) [AC_MSG_CHECKING(for type ulong)
......
...@@ -664,15 +664,6 @@ AC_ARG_WITH(named-curses-libs, ...@@ -664,15 +664,6 @@ AC_ARG_WITH(named-curses-libs,
[ with_named_curses=no ] [ with_named_curses=no ]
) )
# Force use of a zlib (compress)
AC_ARG_WITH(named-z-libs,
[ --with-named-z-libs=ARG
Use specified zlib libraries instead of
those automatically found by configure.],
[ with_named_zlib=$withval ],
[ with_named_zlib=z ]
)
# Make thread safe client # Make thread safe client
AC_ARG_ENABLE(thread-safe-client, AC_ARG_ENABLE(thread-safe-client,
[ --enable-thread-safe-client [ --enable-thread-safe-client
...@@ -806,16 +797,7 @@ AC_CHECK_FUNC(crypt, AC_DEFINE([HAVE_CRYPT], [1], [crypt])) ...@@ -806,16 +797,7 @@ AC_CHECK_FUNC(crypt, AC_DEFINE([HAVE_CRYPT], [1], [crypt]))
# For sem_xxx functions on Solaris 2.6 # For sem_xxx functions on Solaris 2.6
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init)) AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
MYSQL_CHECK_ZLIB_WITH_COMPRESS
# For compress in zlib
case $SYSTEM_TYPE in
*netware* | *modesto*)
AC_DEFINE(HAVE_COMPRESS, [1])
;;
*)
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
;;
esac
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for TCP wrapper support # Check for TCP wrapper support
...@@ -945,7 +927,7 @@ then ...@@ -945,7 +927,7 @@ then
fi fi
# We make a special variable for client library's to avoid including # We make a special variable for client library's to avoid including
# thread libs in the client. # thread libs in the client.
NON_THREADED_CLIENT_LIBS="$LIBS" NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS"
AC_MSG_CHECKING([for int8]) AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in case $SYSTEM_TYPE in
...@@ -3082,6 +3064,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl ...@@ -3082,6 +3064,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
include/mysql_version.h dnl include/mysql_version.h dnl
cmd-line-utils/Makefile dnl cmd-line-utils/Makefile dnl
cmd-line-utils/libedit/Makefile dnl cmd-line-utils/libedit/Makefile dnl
zlib/Makefile dnl
cmd-line-utils/readline/Makefile) cmd-line-utils/readline/Makefile)
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
AC_OUTPUT AC_OUTPUT
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
target = libmysqlclient.la target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) INCLUDES = -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared include $(srcdir)/Makefile.shared
......
...@@ -21,7 +21,8 @@ target = libmysqlclient_r.la ...@@ -21,7 +21,8 @@ target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @openssl_libs@ LIBS = @LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes) INCLUDES = @MT_INCLUDES@ \
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include ## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared include $(top_srcdir)/libmysql/Makefile.shared
......
...@@ -27,7 +27,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ ...@@ -27,7 +27,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" -DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \ INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql -I$(top_srcdir)/regex \
$(openssl_includes) $(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a pkglib_LIBRARIES = libmysqld.a
......
...@@ -18,8 +18,11 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res ...@@ -18,8 +18,11 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res
pkgdata_DATA = mi_test_all mi_test_all.res pkgdata_DATA = mi_test_all mi_test_all.res
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a ../mysys/libmysys.a \ LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
../dbug/libdbug.a ../strings/libmystrings.a $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
@ZLIB_LIBS@ \
$(top_builddir)/strings/libmystrings.a
pkglib_LIBRARIES = libmyisam.a pkglib_LIBRARIES = libmyisam.a
bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
myisamchk_DEPENDENCIES= $(LIBRARIES) myisamchk_DEPENDENCIES= $(LIBRARIES)
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
MYSQLDATAdir = $(localstatedir) MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir) MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix) MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) INCLUDES = @MT_INCLUDES@ \
@ZLIB_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a ../dbug/libdbug.a \ LDADD = libmysys.a ../dbug/libdbug.a \
../strings/libmystrings.a ../strings/libmystrings.a
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
MYSQLDATAdir = $(localstatedir) MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir) MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix) MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ \ INCLUDES = @MT_INCLUDES@ @ZLIB_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \ @bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
-I$(top_srcdir)/include -I$(top_srcdir)/regex \ -I$(top_srcdir)/include -I$(top_srcdir)/regex \
-I$(srcdir) $(openssl_includes) -I$(srcdir) $(openssl_includes)
...@@ -30,14 +30,15 @@ noinst_PROGRAMS = gen_lex_hash ...@@ -30,14 +30,15 @@ noinst_PROGRAMS = gen_lex_hash
bin_PROGRAMS = mysql_tzinfo_to_sql bin_PROGRAMS = mysql_tzinfo_to_sql
gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@ gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
LDADD = @isam_libs@ \ LDADD = @isam_libs@ \
../myisam/libmyisam.a \ @ZLIB_LIBS@ \
../myisammrg/libmyisammrg.a \ $(top_builddir)/myisam/libmyisam.a \
../heap/libheap.a \ $(top_builddir)/myisammrg/libmyisammrg.a \
../vio/libvio.a \ $(top_builddir)/heap/libheap.a \
../mysys/libmysys.a \ $(top_builddir)/vio/libvio.a \
../dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \
../regex/libregex.a \ $(top_builddir)/dbug/libdbug.a \
../strings/libmystrings.a $(top_builddir)/regex/libregex.a \
$(top_builddir)/strings/libmystrings.a
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \ @bdb_libs@ @innodb_libs@ @pstack_libs@ \
......
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes) # Copyright (C) 2004 MySQL AB
LDADD= @CLIENT_EXTRA_LDFLAGS@ ../libmysql_r/libmysqlclient_r.la @openssl_libs@ #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
INCLUDES=@MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ @ZLIB_LIBS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
bin_PROGRAMS= mysqlmanager bin_PROGRAMS= mysqlmanager
mysqlmanager_SOURCES= mysqlmanager.c mysqlmanager_SOURCES= mysqlmanager.c
mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
......
# Copyright (C) 2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
noinst_LIBRARIES=libz.a
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.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
EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment