re: could you also address the M4 stuff in your patch?
Done. This patch removes the no-longer-needed reference to APU_DSO_BUILD
from dbd.m4.
There was no need to change the build in any way.
--with-dbname and --enable-dbd-dso work just as they did before to build
static or dynamic dbd drivers.
This patch removes the restriction that prohibits using dso drivers at runtime if any static drivers
are linked into APR. It always allows dso drivers (unless, of course, the platform doesn't support
dso - are there really any OSs left which don't support dynamic libraries?)
Seems like nitpicking - but unlike dbm, there are potentially *lots* of useful dbd drivers, and
using several different ones (possibly supplied by 3rd parties) in the the same process seems
reasonable.
I tested by simultaneously using a static and a dso driver (mysql and pgsql) in
the same process.
This worked for me on both Windows and Linux.
-tom-
Bojan Smojver wrote:
On Tue, 2007-02-27 at 21:12 -0500, Tom Donovan wrote:
I'm puzzled by the implicit rule in apr_dbd.c that if one or more static dbd drivers are configured,
dso drivers aren't allowed. Also by the fact that dso dbd drivers need to be explicitly enabled.
I would venture a guess that it's probably unintentional, but maybe Joe
wanted to make sure that people that want to build the old way can still
do so. Not sure...
This patch to 1.3 works for me on Windows. I haven't tried it on Unix yet.
It dispenses with the whole --enable-dbd-dso/APU_DSO_BUILD thing and just enables dso dbd drivers if
dso is enabled - regardless of whether there are any static dbd drivers or not.
Once you start playing with the Unix side of things, could you also
address the M4 stuff in your patch?
Index: dbd/apr_dbd.c
===================================================================
--- dbd/apr_dbd.c (revision 512602)
+++ dbd/apr_dbd.c (working copy)
@@ -53,7 +53,6 @@
}
#endif
-#ifndef APU_DSO_BUILD
#define DRIVER_LOAD(name,driver,pool) \
{ \
extern const apr_dbd_driver_t driver; \
@@ -62,7 +61,6 @@
driver.init(pool); \
} \
}
-#endif
static apr_status_t apr_dbd_term(void *ptr)
{
@@ -92,7 +90,6 @@
/* This already registers a pool cleanup */
#endif
-#ifndef APU_DSO_BUILD
/* Load statically-linked drivers: */
#if APU_HAVE_MYSQL
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
@@ -112,12 +109,11 @@
#if APU_HAVE_SOME_OTHER_BACKEND
DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
#endif
-#endif /* APU_DSO_BUILD */
return ret;
}
-#if defined(APU_DSO_BUILD) && APR_HAS_THREADS
+#if defined(APR_HAS_DSO) && APR_HAS_THREADS
#define dbd_drivers_lock(m) apr_thread_mutex_lock(m)
#define dbd_drivers_unlock(m) apr_thread_mutex_unlock(m)
#else
@@ -128,7 +124,7 @@
APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char
*name,
const apr_dbd_driver_t **driver)
{
-#ifdef APU_DSO_BUILD
+#ifdef APR_HAS_DSO
char path[80];
apr_dso_handle_t *dlhandle = NULL;
apr_dso_handle_sym_t symbol;
@@ -146,7 +142,7 @@
return APR_SUCCESS;
}
-#ifdef APU_DSO_BUILD
+#ifdef APR_HAS_DSO
#ifdef WIN32
sprintf(path, "apr_dbd_%s.dll", name);
Index: build/dbd.m4
===================================================================
--- build/dbd.m4 (revision 512602)
+++ build/dbd.m4 (working copy)
@@ -371,7 +371,6 @@
APR_HELP_STRING([--enable-dbd-dso], [build DBD drivers as DSOs]))
if test "$enable_dbd_dso" = "yes"; then
- AC_DEFINE([APU_DSO_BUILD], 1, [Define if DBD drivers are built as DSOs])
dsos=
test $apu_have_oracle = 1 && dsos="$dsos dbd/apr_dbd_oracle.la"