Commit c03926d5 authored by unknown's avatar unknown

A fix for Bug#6273 "building fails on link": we should not use

CLIENT_LIBS in mysql_config as CLIENT_LIBS point to builddir when
we use the bundled zlib.


acinclude.m4:
  Extend MYSQL_CHECK_ZLIB_WITH_COMPRESS m4 macro to substitute ZLIB_DEPS -
  this is a special version of ZLIB_LIBS to use in mysql_config
configure.in:
  Remove NON_THREADED_CLIENT_LIBS which weren't really 
  NON_THREADED_CLIENT_LIBS and use NON_THREADED_LIBS instead.
  AC_SUBST NON_THREADED_LIBS and STATIC_NSS_FLAGS as they're now
  needed inside mysql_config.sh
scripts/Makefile.am:
  Add STATIC_NSS_FLAGS, NON_THREADED_LIBS and ZLIB_DEPS to sed 
  substitution list.
scripts/mysql_config.sh:
  We can't use CLIENT_LIBS as in case when we use the bundled zlib
  it has a reference to $(top_builddir)/zlib.
  libs and libs_r now need to be specified explicitly.
zlib/Makefile.am:
  Install libz.la in case it's used by MySQL: this way we guarantee
  that paths printed by mysql_config are valid in all cases.
parent 32468d3a
...@@ -194,6 +194,8 @@ dnl Define zlib paths to point at bundled zlib ...@@ -194,6 +194,8 @@ dnl Define zlib paths to point at bundled zlib
AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [ AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
ZLIB_INCLUDES="-I\$(top_srcdir)/zlib" ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
ZLIB_LIBS="\$(top_builddir)/zlib/libz.la" ZLIB_LIBS="\$(top_builddir)/zlib/libz.la"
dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps.
ZLIB_DEPS="-lz"
zlib_dir="zlib" zlib_dir="zlib"
AC_SUBST([zlib_dir]) AC_SUBST([zlib_dir])
mysql_cv_compress="yes" mysql_cv_compress="yes"
...@@ -235,8 +237,13 @@ dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the ...@@ -235,8 +237,13 @@ dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
dnl macro bails out with error. dnl macro bails out with error.
dnl dnl
dnl If the library was found, this function #defines HAVE_COMPRESS 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 and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include),
dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz). dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz) and ZLIB_DEPS which is
dnl used in mysql_config and is always the same as ZLIB_LIBS except to
dnl when we use the bundled zlib. In the latter case ZLIB_LIBS points to the
dnl build dir ($top_builddir/zlib), while mysql_config must point to the
dnl installation dir ($pkglibdir), so ZLIB_DEPS is set to point to
dnl $pkglibdir.
AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [ AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
AC_MSG_CHECKING([for zlib compression library]) AC_MSG_CHECKING([for zlib compression library])
...@@ -285,7 +292,11 @@ case $SYSTEM_TYPE in ...@@ -285,7 +292,11 @@ case $SYSTEM_TYPE in
;; ;;
esac esac
if test "$mysql_cv_compress" = "yes"; then if test "$mysql_cv_compress" = "yes"; then
if test "x$ZLIB_DEPS" = "x"; then
ZLIB_DEPS="$ZLIB_LIBS"
fi
AC_SUBST([ZLIB_LIBS]) AC_SUBST([ZLIB_LIBS])
AC_SUBST([ZLIB_DEPS])
AC_SUBST([ZLIB_INCLUDES]) AC_SUBST([ZLIB_INCLUDES])
AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support]) AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
fi fi
...@@ -1039,7 +1050,6 @@ AC_MSG_CHECKING(for OpenSSL) ...@@ -1039,7 +1050,6 @@ AC_MSG_CHECKING(for OpenSSL)
echo "You can't use the --all-static link option when using openssl." echo "You can't use the --all-static link option when using openssl."
exit 1 exit 1
fi fi
NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
if test ! -z "$openssl_includes" if test ! -z "$openssl_includes"
......
...@@ -924,9 +924,11 @@ if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no" ...@@ -924,9 +924,11 @@ if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then then
AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty)) AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
fi fi
# We make a special variable for client library's to avoid including
# thread libs in the client. # We make a special variable for non-threaded version of LIBS to avoid
NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS" # including thread libs into non-threaded version of MySQL client library.
# Later in this script LIBS will be augmented with a threads library.
NON_THREADED_LIBS="$LIBS"
AC_MSG_CHECKING([for int8]) AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in case $SYSTEM_TYPE in
...@@ -1502,7 +1504,7 @@ then ...@@ -1502,7 +1504,7 @@ then
if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4" if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
then then
LIBS="-lxnet $LIBS" LIBS="-lxnet $LIBS"
NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS -lxnet" NON_THREADED_LIBS="-lxnet $NON_THREADED_LIBS"
with_named_thread="-Kthread $LDFLAGS -lxnet" with_named_thread="-Kthread $LDFLAGS -lxnet"
LD_FLAGS="" LD_FLAGS=""
CFLAGS="-Kthread $CFLAGS" CFLAGS="-Kthread $CFLAGS"
...@@ -2826,7 +2828,7 @@ dnl This probably should be cleaned up more - for now the threaded ...@@ -2826,7 +2828,7 @@ dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs. dnl client is just using plain-old libs.
sql_client_dirs="libmysql strings regex client" sql_client_dirs="libmysql strings regex client"
linked_client_targets="linked_libmysql_sources" linked_client_targets="linked_libmysql_sources"
CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS
if test "$THREAD_SAFE_CLIENT" != "no" if test "$THREAD_SAFE_CLIENT" != "no"
then then
sql_client_dirs="libmysql_r $sql_client_dirs" sql_client_dirs="libmysql_r $sql_client_dirs"
...@@ -2834,9 +2836,11 @@ then ...@@ -2834,9 +2836,11 @@ then
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe]) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
fi fi
CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
AC_SUBST(CLIENT_LIBS) AC_SUBST(CLIENT_LIBS)
AC_SUBST(NON_THREADED_LIBS)
AC_SUBST(STATIC_NSS_FLAGS)
AC_SUBST(sql_client_dirs) AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets) AC_SUBST(linked_client_targets)
......
...@@ -140,6 +140,9 @@ SUFFIXES = .sh ...@@ -140,6 +140,9 @@ SUFFIXES = .sh
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \ -e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \ -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \ -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
-e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \
-e 's!@''NON_THREADED_LIBS''@!@NON_THREADED_LIBS@!' \
-e 's!@''ZLIB_DEPS''@!@ZLIB_DEPS@!' \
-e "s!@MAKE@!$(MAKE)!" \ -e "s!@MAKE@!$(MAKE)!" \
$< > $@-t $< > $@-t
@CHMOD@ +x $@-t @CHMOD@ +x $@-t
......
...@@ -82,13 +82,14 @@ version='@VERSION@' ...@@ -82,13 +82,14 @@ version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@' socket='@MYSQL_UNIX_ADDR@'
port='@MYSQL_TCP_PORT@' port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
client_libs='@CLIENT_LIBS@'
# Create options # Create options
libs="$ldflags -L$pkglibdir -lmysqlclient $client_libs" libs="$ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@"
libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @ZLIB_LIBS@ @openssl_libs@"
libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@"
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Process this file with automake to create Makefile.in # Process this file with automake to create Makefile.in
noinst_LTLIBRARIES=libz.la pkglib_LTLIBRARIES=libz.la
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \ 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
......
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