[PATCH] fix libdbi hardcoded driver directory usage

Bill Nottingham notting at redhat.com
Tue May 18 13:35:26 EDT 2010


1) libdbi, in its default configuration, puts the driver directory
in $libdir/dbd, not a hardcoded /usr/lib/dbd. Fix gnucash's configury
to use the same.

2) If GNC_DBD_DIR is not set, fall back to the libdbi compiled-in default
(whatever it may be) rather than a hardcoded value, as it's more likely
to be correct.

Bill
-------------- next part --------------
diff -up gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c.foo gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c
--- gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c.foo	2010-05-18 12:36:31.929812252 -0400
+++ gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c	2010-05-18 12:38:29.962687968 -0400
@@ -1007,7 +1007,6 @@ void
 gnc_module_init_backend_dbi(void)
 {
     QofBackendProvider *prov;
-#define DEFAULT_DBD_DIR "/usr/lib/dbd"
     const gchar* driver_dir;
     int num_drivers;
     gboolean have_sqlite3_driver = FALSE;
@@ -1019,8 +1018,7 @@ gnc_module_init_backend_dbi(void)
     driver_dir = g_getenv( "GNC_DBD_DIR" );
     if ( driver_dir == NULL )
     {
-        PWARN( "GNC_DBD_DIR not set: using %s\n", DEFAULT_DBD_DIR );
-        driver_dir = DEFAULT_DBD_DIR;
+        PWARN( "GNC_DBD_DIR not set: using libdi built-in default\n");
     }
 
     num_drivers = dbi_initialize( driver_dir );
diff -up gnucash-2.3.12/configure.in.foo gnucash-2.3.12/configure.in
--- gnucash-2.3.12/configure.in.foo	2010-05-18 12:51:28.688812527 -0400
+++ gnucash-2.3.12/configure.in	2010-05-18 12:52:28.985062367 -0400
@@ -582,9 +582,9 @@ then
   AC_CHECK_HEADERS(dbi/dbi.h)
   if test "x$ac_cv_header_dbi_dbi_h" != xno; then
     AC_ARG_WITH( dbi-dbd-dir,
-      [AS_HELP_STRING([--with-dbi-dbd-dir=PATH],[specify location of libdbi drivers @<:@default=/usr/lib/dbd@:>@])],
+      [AS_HELP_STRING([--with-dbi-dbd-dir=PATH],[specify location of libdbi drivers @<:@default=${libdir}/dbd@:>@])],
       GNC_DBD_DIR="$with_dbi_dbd_dir",
-      GNC_DBD_DIR="/usr/lib/dbd")
+      GNC_DBD_DIR="${libdir}/dbd")
 
     LIBDBI_LIBS=-ldbi
     DBI_DIR=dbi


More information about the gnucash-devel mailing list