zlib: let lib dir configurable

The zlib were found in $mysql_zlib_dir/lib, and the
search will fail if zlib in $mysql_zlib_dir/lib64.

Let lib dir configurable rather than hardcode.

Upstream-Status: Pending
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 config/ac-macros/zlib.m4 | 12 ++++++------
 configure.in             |  8 ++++++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4
--- a/config/ac-macros/zlib.m4
+++ b/config/ac-macros/zlib.m4
@@ -106,17 +106,17 @@ case $SYSTEM_TYPE in
         ;;
       *)
         # Test for libz using all known library file endings
-        if test \( -f "$mysql_zlib_dir/lib/libz.a"  -o \
-                   -f "$mysql_zlib_dir/lib/libz.so" -o \
-                   -f "$mysql_zlib_dir/lib/libz.sl" -o \
-                   -f "$mysql_zlib_dir/lib/libz.dylib" \) \
+        if test \( -f "$mysql_zlib_dir/$base_libdir/libz.a"  -o \
+                   -f "$mysql_zlib_dir/$base_libdir/libz.so" -o \
+                   -f "$mysql_zlib_dir/$base_libdir/libz.sl" -o \
+                   -f "$mysql_zlib_dir/$base_libdir/libz.dylib" \) \
                 -a -f "$mysql_zlib_dir/include/zlib.h"; then
           ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
-          ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
+          ZLIB_LIBS="-L$mysql_zlib_dir/$base_libdir -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}])
+          AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,$base_libdir}])
         fi
         ;;
     esac
diff --git a/configure.in b/configure.in
index 2c6c08e..193b59a 100644
--- a/configure.in
+++ b/configure.in
@@ -104,6 +104,14 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 AC_SUBST(SHARED_LIB_VERSION)
 AC_SUBST(AVAILABLE_LANGUAGES)
 
+AC_ARG_WITH([baselib-dir],
+            AC_HELP_STRING([--baselib-dir=DIR],
+                           [Provide MySQL with a custom location of
+                           baselib dir. Given DIR, such as zlib binary is
+                           assumed to be in $zlib-dir/$DIR.]),
+            [base_libdir=${withval}],
+            [base_libdir="lib"])
+
 # Check whether a debug mode should be enabled.
 AC_ARG_WITH([debug],
     AS_HELP_STRING([--with-debug@<:@=full@:>@],
-- 
1.8.1.2

