r19191 - gnucash/trunk - Fix libdbi hardcoded driver directory usage

Geert Janssens gjanssens at code.gnucash.org
Thu May 20 16:16:47 EDT 2010


Author: gjanssens
Date: 2010-05-20 16:16:47 -0400 (Thu, 20 May 2010)
New Revision: 19191
Trac: http://svn.gnucash.org/trac/changeset/19191

Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
   gnucash/trunk/src/backend/dbi/test/Makefile.am
   gnucash/trunk/src/bin/Makefile.am
   gnucash/trunk/src/bin/environment-osx.in
   gnucash/trunk/src/bin/environment-win32.in
   gnucash/trunk/src/bin/environment.in
   gnucash/trunk/src/bin/gnucash-setup-env-osx.in
   gnucash/trunk/src/business/business-core/sql/test/Makefile.am
Log:
Fix libdbi hardcoded driver directory usage
Patch by Bill Nottingham, with modifications to only set GNC_DBD_DIR if --with-dbi-dbd-path is explicitly set.

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/configure.ac	2010-05-20 20:16:47 UTC (rev 19191)
@@ -583,9 +583,9 @@
   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="")
 
     LIBDBI_LIBS=-ldbi
     DBI_DIR=dbi
@@ -596,6 +596,7 @@
 AC_SUBST(LIBDBI_LIBS)
 AC_SUBST(DBI_DIR)
 AC_SUBST(GNC_DBD_DIR)
+AM_CONDITIONAL(CUSTOM_GNC_DBD_DIR, [test x"$GNC_DBD_DIR" != "x"])
 
 ### --------------------------------------------------------------------------
 ### Variables

Modified: gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c	2010-05-20 20:16:47 UTC (rev 19191)
@@ -1007,7 +1007,6 @@
 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 @@
     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;
+        PINFO( "GNC_DBD_DIR not set: using libdbi built-in default\n");
     }
 
     num_drivers = dbi_initialize( driver_dir );

Modified: gnucash/trunk/src/backend/dbi/test/Makefile.am
===================================================================
--- gnucash/trunk/src/backend/dbi/test/Makefile.am	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/backend/dbi/test/Makefile.am	2010-05-20 20:16:47 UTC (rev 19191)
@@ -25,10 +25,14 @@
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine
 
+if CUSTOM_GNC_DBD_DIR
+gnc_dbd_dir_override = "GNC_DBD_DIR=@GNC_DBD_DIR@"
+endif
+
 TESTS_ENVIRONMENT = \
   GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
   SRCDIR=${srcdir} \
-  GNC_DBD_DIR=@GNC_DBD_DIR@ \
+  ${gnc_dbd_dir_override} \
   $(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
 
 check_PROGRAMS = \

Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/bin/Makefile.am	2010-05-20 20:16:47 UTC (rev 19191)
@@ -55,7 +55,13 @@
 if PLATFORM_OSX_QUARTZ
 PRE_RUN = . ${bindir}/gnucash-setup-env
 PLATFORM_FILES = gnucash-setup-env
+if CUSTOM_GNC_DBD_DIR
+gnc_dbd_dir_override = export GNC_DBD_DIR="@GNC_DBD_DIR@"
 else
+gnc_dbd_dir_override =
+endif
+
+else
 PRE_RUN =
 PLATFORM_FILES =
 endif
@@ -93,7 +99,7 @@
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
 	    -e 's#@-BIN_DIR-@#${bindir}#g' \
-	    -e 's#@-GNC_DBD_DIR-@#${GNC_DBD_DIR}#g' \
+	    -e 's#@-gnc_dbd_dir_override-@#${gnc_dbd_dir_override}#g' \
 	    -e 's#@-GNC_STANDARD_REPORTS_DIR-@#${GNC_SHAREDIR}/guile-modules/gnucash/report/standard-reports#g' \
 	    -e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
 	    -e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
@@ -110,7 +116,6 @@
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
 	    -e 's#@-BIN_DIR-@#${bindir}#g' \
-	    -e 's#@-GNC_DBD_DIR-@#${GNC_DBD_DIR}#g' \
 	    -e 's#@-GNC_STANDARD_REPORTS_DIR-@#${GNC_SHAREDIR}/guile-modules/gnucash/report/standard-reports#g' \
 	    -e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
 	    -e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
@@ -118,6 +123,9 @@
 	    -e 's#@-GNC_PKGLIB_INSTALLDIR-@#${pkglibdir}#g' \
 	    -e "s#@-TOP_SRC_DIR-@#`pwd`/${top_srcdir}#g" \
 	    -e 's#@-PREFIX-@#${prefix}#g'
+if CUSTOM_GNC_DBD_DIR
+	echo 'GNC_DBD_DIR="@GNC_DBD_DIR@"' >> $@.tmp
+endif
 	mv $@.tmp $@
 	chmod u+x $@
 

Modified: gnucash/trunk/src/bin/environment-osx.in
===================================================================
--- gnucash/trunk/src/bin/environment-osx.in	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/bin/environment-osx.in	2010-05-20 20:16:47 UTC (rev 19191)
@@ -29,6 +29,5 @@
 #LD_LIBRARY_PATH={EXTRA_LIBS};${LD_LIBRARY_PATH}
 #DYLD_LIBRARY_PATH={EXTRA_LIBS};${DYLD_LIBRARY_PATH}
 
-#GNC_DBD_DIR=@-GNC_DBD_DIR-@
 #GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@
-#GNC_DOT_DIR={HOME}/Library/Application Support/Gnucash
\ No newline at end of file
+#GNC_DOT_DIR={HOME}/Library/Application Support/Gnucash

Modified: gnucash/trunk/src/bin/environment-win32.in
===================================================================
--- gnucash/trunk/src/bin/environment-win32.in	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/bin/environment-win32.in	2010-05-20 20:16:47 UTC (rev 19191)
@@ -25,5 +25,4 @@
 LD_LIBRARY_PATH={EXTRA_LIBS};{LD_LIBRARY_PATH}
 DYLD_LIBRARY_PATH={EXTRA_LIBS};{DYLD_LIBRARY_PATH}
 
-GNC_DBD_DIR=@-GNC_DBD_DIR-@
-GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@
\ No newline at end of file
+GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@

Modified: gnucash/trunk/src/bin/environment.in
===================================================================
--- gnucash/trunk/src/bin/environment.in	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/bin/environment.in	2010-05-20 20:16:47 UTC (rev 19191)
@@ -23,5 +23,4 @@
 LD_LIBRARY_PATH={EXTRA_LIBS};{LD_LIBRARY_PATH}
 DYLD_LIBRARY_PATH={EXTRA_LIBS};{DYLD_LIBRARY_PATH}
 
-GNC_DBD_DIR=@-GNC_DBD_DIR-@
-GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@
\ No newline at end of file
+GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@

Modified: gnucash/trunk/src/bin/gnucash-setup-env-osx.in
===================================================================
--- gnucash/trunk/src/bin/gnucash-setup-env-osx.in	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/bin/gnucash-setup-env-osx.in	2010-05-20 20:16:47 UTC (rev 19191)
@@ -25,8 +25,8 @@
 
 LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
 DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"
-GNC_DBD_DIR="@-GNC_DBD_DIR-@"
 GNC_STANDARD_REPORTS_DIR="@-GNC_STANDARD_REPORTS_DIR-@"
+ at -CUSTOM_GNC_DBD_DIR-@"
 
 export GNC_MODULE_PATH
 export GUILE_LOAD_PATH

Modified: gnucash/trunk/src/business/business-core/sql/test/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-core/sql/test/Makefile.am	2010-05-20 20:02:35 UTC (rev 19190)
+++ gnucash/trunk/src/business/business-core/sql/test/Makefile.am	2010-05-20 20:16:47 UTC (rev 19191)
@@ -16,10 +16,14 @@
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/backend/sql
 
+if CUSTOM_GNC_DBD_DIR
+gnc_dbd_dir_override="GNC_DBD_DIR=@GNC_DBD_DIR@"
+endif
+
 TESTS_ENVIRONMENT = \
   GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
   SRCDIR=${srcdir} \
-  GNC_DBD_DIR=@GNC_DBD_DIR@ \
+  ${gnc_dbd_dir_override} \
   $(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
 
 check_PROGRAMS = \



More information about the gnucash-changes mailing list