Bug 747300 - SQL backend missing from most recent DMG?

Fix configure.ac so that ${prefix}/lib/dbd is searched for modules.
Use gnc_path_get_libdir() to check for modules in the event that
$GNC_DBD_DIR is either empty or wrong and the path compiled into libdbi
itself is invalid. This applies mostly to Mac as other OSes tend to
leave their binaries where configure installs them.
This commit is contained in:
John Ralls 2015-04-03 13:57:27 -07:00
parent f717e09146
commit 1d6fd55767
2 changed files with 24 additions and 8 deletions

View File

@ -617,7 +617,7 @@ then
if test $? -eq 0; then
EXTRA_SEARCH_LIBS="$(pkg-config --variable=libdir dbi)/dbd"
else
EXTRA_SEARCH_LIBS="/usr/lib/dbd:/usr/lib64/dbd:${libdir}/dbd:$(prefix)/lib/dbd"
EXTRA_SEARCH_LIBS="/usr/lib/dbd:/usr/lib64/dbd:${libdir}/dbd:${prefix}/lib/dbd"
fi]]
)
case $host_os in
@ -633,12 +633,14 @@ then
export LIBS="$lt_cv_dlopen_libs $LIBS"
;;
esac
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$EXTRA_SEARCH_LIBS"
AC_MSG_CHECKING([Looking for at least one supported DBD module])
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
old_ld_library_path="$LD_LIBRARY_PATH"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$EXTRA_SEARCH_LIBS"
AC_MSG_NOTICE([Search Path $(LD_LIBRARY_PATH)])
AC_MSG_CHECKING([Looking for at least one supported DBD module])
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
[[if (!$lt_cv_dlopen("libdbdsqlite3.$LDEXT"$LDFUNCARGS)) return -1;
]])],AC_MSG_RESULT([SQLite3]),
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
[[if (!$lt_cv_dlopen("libdbdmysql.$LDEXT"$LDFUNCARGS)) return -1;
]])],AC_MSG_RESULT([MySql]),
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
@ -661,6 +663,7 @@ to the configure argument list and run it again.
LIBDBI_LIBS=-ldbi
_COMPONENTS="$_COMPONENTS dbi"
LIBS=$saved_libs
LD_LIBRARY_PATH="$old_ld_library_path"
else
AC_MSG_ERROR([

View File

@ -48,6 +48,7 @@
#include "gnc-uri-utils.h"
#include "gnc-filepath-utils.h"
#include <gnc-path.h>
#include "gnc-locale-utils.h"
#include "gnc-backend-dbi.h"
@ -1883,13 +1884,25 @@ gnc_module_init_backend_dbi(void)
}
/* dbi_initialize returns -1 in case of errors */
#if HAVE_LIBDBI_R
#if HAVE_LIBDBI_R
if (dbi_instance)
return;
num_drivers = dbi_initialize_r( driver_dir, &dbi_instance );
#else
#else
num_drivers = dbi_initialize( driver_dir );
#endif
#endif
if ( num_drivers <= 0 )
{
gchar *dir = g_build_filename(gnc_path_get_libdir(), "dbd", NULL);
#if HAVE_LIBDBI_R
if (dbi_instance)
return;
num_drivers = dbi_initialize_r( dir, &dbi_instance );
#else
num_drivers = dbi_initialize( dir );
#endif
g_free (dir);
}
if ( num_drivers <= 0 )
{
PWARN( "No DBD drivers found\n" );