apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r154597 - in apr/apr-util/trunk: INSTALL.MySQL build/dbd.m4 configure.in dbd/apr_dbd.c include/apr_dbd.h include/apu.h.in
Date Mon, 21 Feb 2005 01:16:40 GMT
Author: niq
Date: Sun Feb 20 17:16:38 2005
New Revision: 154597

URL: http://svn.apache.org/viewcvs?view=rev&rev=154597
Log:
Update autofoo to support MySQL build in principle (grotty hack),
and fix apr_dbd.c to work correctly with current autofoo that
builds drivers in statically regardless of DSO.

Added:
    apr/apr-util/trunk/INSTALL.MySQL
Modified:
    apr/apr-util/trunk/build/dbd.m4
    apr/apr-util/trunk/configure.in
    apr/apr-util/trunk/dbd/apr_dbd.c
    apr/apr-util/trunk/include/apr_dbd.h
    apr/apr-util/trunk/include/apu.h.in

Added: apr/apr-util/trunk/INSTALL.MySQL
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/INSTALL.MySQL?view=auto&rev=154597
==============================================================================
--- apr/apr-util/trunk/INSTALL.MySQL (added)
+++ apr/apr-util/trunk/INSTALL.MySQL Sun Feb 20 17:16:38 2005
@@ -0,0 +1,13 @@
+The MySQL driver is not distributed from apache.org due to licensing issues.
+
+If you wish to build the driver, download apr_dbd_mysql.c from
+http://apache.webthing.com/database/
+and copy it into the dbd directory before running configure.
+
+It is distributed under the GPL to conform with MySQL License terms
+This means it cannot be distributed from apache.org, as that would
+violate ASF policy.
+
+Using the driver with APR and Apache is of course allowed,
+and there is no problem with a third party bundling the driver,
+provided you respect both the ASF and GPL licenses.

Modified: apr/apr-util/trunk/build/dbd.m4
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/build/dbd.m4?view=diff&r1=154596&r2=154597
==============================================================================
--- apr/apr-util/trunk/build/dbd.m4 (original)
+++ apr/apr-util/trunk/build/dbd.m4 Sun Feb 20 17:16:38 2005
@@ -3,7 +3,7 @@
 dnl
 
 dnl
-dnl APU_CHECK_DBD: see what kind of DBD backend to use for apr_dbd.
+dnl APU_CHECK_DBD: compile backends for apr_dbd.
 dnl
 AC_DEFUN(APU_CHECK_DBD, [
   apu_have_pgsql=0
@@ -32,7 +32,6 @@
         APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
         APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
       fi
-
       if test "$apu_have_pgsql" != "1"; then
         AC_CHECK_HEADER(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [apu_have_pgsql=1]))
         if test "$apu_have_pgsql" != "0"; then
@@ -45,14 +44,63 @@
     apu_have_pgsql=0
     AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [apu_have_pgsql=1]))
   ])
-
   AC_SUBST(apu_have_pgsql)
-
   dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
   dnl we know the library is there.
   if test "$apu_have_pgsql" = "1"; then
     APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lpq])
     APR_ADDTO(APRUTIL_LIBS,[-lpq])
+  fi
+])
+dnl
+AC_DEFUN(APU_CHECK_DBD_MYSQL, [
+  apu_have_mysql=0
+
+  AC_ARG_WITH([mysql], [
+  --with-mysql=DIR          **** SEE INSTALL.MySQL ****
+  ], [
+    apu_have_mysql=0
+    if test "$withval" = "yes"; then
+      AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+      if test "$apu_have_mysql" == "0"; then
+        AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+        if test "$apu_have_mysql" != "0"; then
+          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/myql])
+        fi
+      fi
+    elif test "$withval" = "no"; then
+      apu_have_mysql=0
+    else
+      CPPFLAGS="-I$withval/include"
+      LIBS="-L$withval/lib "
+
+      AC_MSG_NOTICE(checking for mysql in $withval)
+      AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+      if test "$apu_have_mysql" != "0"; then
+        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+      fi
+
+      if test "$apu_have_mysql" != "1"; then
+        AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+        if test "$apu_have_mysql" != "0"; then
+          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
+          APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+        fi
+      fi
+    fi
+  ], [
+    apu_have_mysql=0
+    AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+  ])
+
+  AC_SUBST(apu_have_mysql)
+
+  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
+  dnl we know the library is there.
+  if test "$apu_have_mysql" = "1"; then
+    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lmysqlclient_r])
+    APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r])
   fi
 ])
 

Modified: apr/apr-util/trunk/configure.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/configure.in?view=diff&r1=154596&r2=154597
==============================================================================
--- apr/apr-util/trunk/configure.in (original)
+++ apr/apr-util/trunk/configure.in Sun Feb 20 17:16:38 2005
@@ -119,6 +119,7 @@
 APU_FIND_LDAP
 APU_CHECK_DBM
 APU_CHECK_DBD
+APU_CHECK_DBD_MYSQL
 APU_FIND_EXPAT
 APU_FIND_ICONV
 

Modified: apr/apr-util/trunk/dbd/apr_dbd.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd.c?view=diff&r1=154596&r2=154597
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd.c Sun Feb 20 17:16:38 2005
@@ -27,17 +27,21 @@
 static apr_hash_t *drivers = NULL;
 
 
-#if APR_HAS_DSO
+/* Once the autofoo supports building it for dynamic load, we can use
+ * #define APR_DSO_BUILD APR_HAS_DSO
+ */
+
+#if APR_DSO_BUILD
 #if APR_HAS_THREADS
 static apr_thread_mutex_t* mutex = NULL;
 #endif
 #else
 #define DRIVER_LOAD(name,driver,pool) \
     {   \
-        extern apr_dbd_driver_t *driver; \
-        apr_hash_set(drivers,name,APR_HASH_KEY_STRING,driver); \
-        if (driver->init) {     \
-            driver->init(pool); \
+        extern apr_dbd_driver_t driver; \
+        apr_hash_set(drivers,name,APR_HASH_KEY_STRING,&driver); \
+        if (driver.init) {     \
+            driver.init(pool); \
         }  \
     }
 #endif
@@ -47,7 +51,7 @@
     apr_status_t ret;
     drivers = apr_hash_make(pool);
 
-#if APR_HAS_DSO
+#if APR_DSO_BUILD
 
 #if APR_HAS_THREADS
     ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
@@ -62,23 +66,8 @@
 #if APU_HAVE_PGSQL
     DRIVER_LOAD("pgsql", apr_dbd_pgsql_driver, pool);
 #endif
-#if APU_HAVE_FIREBIRD
-    DRIVER_LOAD("firebird", apr_dbd_firebird_driver, pool);
-#endif
-#if APU_HAVE_MSQL
-    DRIVER_LOAD("msql", apr_dbd_msql_driver, pool);
-#endif
-#if APU_HAVE_DB2
-    DRIVER_LOAD("db2", apr_dbd_db2_driver, pool);
-#endif
-#if APU_HAVE_ODBC
-    DRIVER_LOAD("odbc", apr_dbd_odbc_driver, pool);
-#endif
-#if APU_HAVE_ORACLE
-    DRIVER_LOAD("oracle", apr_dbd_oracle_driver, pool);
-#endif
-#if APU_HAVE_MSSQL
-    DRIVER_LOAD("mssql", apr_dbd_mssql_driver, pool);
+#if APU_HAVE_SOME_OTHER_BACKEND
+    DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
 #endif
 #endif
     return ret;
@@ -86,7 +75,7 @@
 APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
                                              apr_dbd_driver_t **driver)
 {
-#if APR_HAS_DSO
+#if APR_DSO_BUILD
     char path[80];
     apr_dso_handle_t *dlhandle = NULL;
 #endif
@@ -97,7 +86,7 @@
         return APR_SUCCESS;
     }
 
-#if APR_HAS_DSO
+#if APR_DSO_BUILD
 
 #if APR_HAS_THREADS
     rv = apr_thread_mutex_lock(mutex);
@@ -131,7 +120,7 @@
     apr_thread_mutex_unlock(mutex);
 #endif
 
-#else	/* APR_HAS_DSO - so if it wasn't already loaded, it's NOTIMPL */
+#else	/* APR_DSO_BUILD - so if it wasn't already loaded, it's NOTIMPL */
     rv = APR_ENOTIMPL;
 #endif
 

Modified: apr/apr-util/trunk/include/apr_dbd.h
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/apr_dbd.h?view=diff&r1=154596&r2=154597
==============================================================================
--- apr/apr-util/trunk/include/apr_dbd.h (original)
+++ apr/apr-util/trunk/include/apr_dbd.h Sun Feb 20 17:16:38 2005
@@ -25,15 +25,6 @@
 extern "C" {
 #endif
 
-/** Patch required to build against APR/0.9 and HTTPD/2.0
- *  Invalidate a resource in the pool - e.g. a database connection
- *  that returns a "lost connection" error and can't be restored.
- *  Use this instead of apr_reslist_release if the resource is bad.
- */
-#if APR_HAS_THREADS
-#include "apr_reslist.h"
-#endif
-
 /* These are opaque structs.  Instantiation is up to each backend */
 #ifndef APR_DBD_INTERNAL
 typedef struct apr_dbd_t apr_dbd_t;

Modified: apr/apr-util/trunk/include/apu.h.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/apu.h.in?view=diff&r1=154596&r2=154597
==============================================================================
--- apr/apr-util/trunk/include/apu.h.in (original)
+++ apr/apr-util/trunk/include/apu.h.in Sun Feb 20 17:16:38 2005
@@ -78,6 +78,7 @@
 #endif /* APU_HAVE_DB */
 
 #define APU_HAVE_PGSQL         @apu_have_pgsql@
+#define APU_HAVE_MYSQL         @apu_have_mysql@
 
 #define APU_HAVE_APR_ICONV     @have_apr_iconv@
 #define APU_HAVE_ICONV         @have_iconv@



Mime
View raw message