Author: wyoung
Date: Tue Jul 22 20:11:35 2008
New Revision: 2314

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2314&view=rev
Log:
MySQL C API library detection routine now also checks whether zlib is
really needed to make the link succeed.  Before, we always used -lz on
autoconf systems, even refusing to build if it wasn't present.  Now we
only check for zlib when direct linking to the C API library fails, as a
prerequisite for trying the two together.

Modified:
    trunk/Wishlist
    trunk/config/mysql_loc.m4
    trunk/configure.ac
    trunk/mysql++.bkl

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=2314&r1=2313&r2=2314&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Tue Jul 22 20:11:35 2008
@@ -26,12 +26,6 @@
       in the script, which will detect what's built before it goes
       and tries to install it.  It might even pop up a simple GUI to
       ask for the user's installation preferences.
-
-    o Add autoconf test to check if -lz is needed to link to
-      -lmysqlclient.  Reportedly, MySQL Enterprise includes zlib
-      in its mysqlclient, so linking to it gives mulitple-defined
-      symbols.  MySQL says they won't change this, so we have to
-      be able to leave this out.
 
 
 v3.1 Tentative Plan

Modified: trunk/config/mysql_loc.m4
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/config/mysql_loc.m4?rev=2314&r1=2313&r2=2314&view=diff
==============================================================================
--- trunk/config/mysql_loc.m4 (original)
+++ trunk/config/mysql_loc.m4 Tue Jul 22 20:11:35 2008
@@ -102,10 +102,29 @@
 
        CPPFLAGS="$CPPFLAGS -I${MYSQL_incdir}"
 
+    AC_MSG_CHECKING([if we can link to MySQL C API library directly])
        save_LIBS=$LIBS
-       LIBS="$LIBS $MYSQLPP_EXTRA_LIBS"
-       AC_CHECK_LIB($MYSQL_C_LIB, mysql_store_result, [], [
-                       AC_MSG_ERROR([Could not find working MySQL client 
library!]) ])
+       LIBS="$LIBS -l$MYSQL_C_LIB $MYSQLPP_EXTRA_LIBS"
+       AC_TRY_LINK(
+        [ #include <mysql.h> ],
+        [ mysql_store_result(0); ],
+        AC_MSG_RESULT([yes]),
+        [ AC_MSG_RESULT([no])  
+          LIBS="$save_LIBS"
+          AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread, [],
+              [ AC_MSG_ERROR([zlib not found]) ]))
+          AC_MSG_CHECKING([whether adding -lz will let MySQL C API link 
succeed])
+          MYSQLPP_EXTRA_LIBS="-lz $MYSQLPP_EXTRA_LIBS"
+          LIBS="$save_LIBS -l$MYSQL_C_LIB $MYSQLPP_EXTRA_LIBS"
+          AC_TRY_LINK(
+              [ #include <mysql.h> ],
+              [ mysql_store_result(0); ],
+              AC_MSG_RESULT([yes]),
+              [ AC_MSG_RESULT([no])
+                AC_MSG_ERROR([Unable to link to MySQL client library!])
+              ]
+          )
+        ])
        AC_SUBST(MYSQL_C_LIB)
        LIBS=$save_LIBS
 ]) dnl MYSQL_API_LOCATION

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/configure.ac?rev=2314&r1=2313&r2=2314&view=diff
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Jul 22 20:11:35 2008
@@ -53,8 +53,6 @@
 
 
 # Checks for libraries and local system features
-AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread, [],
-               [ AC_MSG_ERROR([zlib is required]) ]))
 LIB_MATH
 LIB_SOCKET_NSL
 MYSQL_API_LOCATION

Modified: trunk/mysql++.bkl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/mysql%2B%2B.bkl?rev=2314&r1=2313&r2=2314&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Tue Jul 22 20:11:35 2008
@@ -6,7 +6,6 @@
 
     <set var="DDD">$(DOLLAR)$(DOLLAR)d</set>
     <set var="DDF">$(DOLLAR)$(DOLLAR)f</set>
-    <set var="ZLIB">yes</set>
 
     <set var="PLATFORM_WINDOWS_NATIVE">no</set>
     <set var="THREAD_TYPE">single</set>
@@ -123,10 +122,6 @@
                 <ldflags>@PTHREAD_LIBS@ @MYSQLPP_EXTRA_LIBS@</ldflags>
                 <sys-lib>@MYSQL_C_LIB@</sys-lib>
 
-                <if cond="ZLIB=='yes'">
-                    <sys-lib>z</sys-lib>
-                </if>
-
                 <modify-target target="uninstall">
                     <command>
                         rm -f 
$(DESTDIR)$(libdir)/$(DLLPREFIX)mysqlpp.$(SO_SUFFIX)
@@ -175,9 +170,6 @@
             <sys-lib>@MYSQL_C_LIB@</sys-lib>
             <warnings>max</warnings>
             <sys-lib>mysqlpp</sys-lib>
-            <if cond="ZLIB=='yes'">
-                <sys-lib>z</sys-lib>
-            </if>
         </if>
 
         <if cond="FORMAT=='mingw'">


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to