From 2bf0fed4a3897eede998f2ae4b6760c4ec546c4f Mon Sep 17 00:00:00 2001 From: RobGowin Date: Sat, 23 Jan 2016 16:45:34 -0600 Subject: [PATCH] Change test to use LIBDIR to find dynamic libraries --- src/gnc-module/test/test-dynload.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gnc-module/test/test-dynload.c b/src/gnc-module/test/test-dynload.c index 3b83242f17..def77bf96e 100644 --- a/src/gnc-module/test/test-dynload.c +++ b/src/gnc-module/test/test-dynload.c @@ -40,10 +40,16 @@ guile_main(void *closure, int argc, char ** argv) gchar *logdomain = "gnc.module"; gchar *modpath; guint loglevel = G_LOG_LEVEL_WARNING; + const char *libdir = g_getenv("LIBDIR"); TestErrorStruct check = { loglevel, logdomain, msg }; g_log_set_handler (logdomain, loglevel, (GLogFunc)test_checked_handler, &check); + if (libdir == NULL) + { + libdir = "../.libs"; + } + g_test_message(" test-dynload.c: testing dynamic linking of libgnc-module ..."); #ifdef G_OS_WIN32 /* MinGW builds libgnc-module-0.dll */ @@ -53,9 +59,16 @@ guile_main(void *closure, int argc, char ** argv) * that means that g_module_build_path (), which uses ".so", doesn't * build the right path name. */ - modpath = g_build_filename ("..", ".libs", "libgnc-module.dylib", NULL); + if (libdir == NULL) + { + modpath = g_build_filename ("..", ".libs", "libgnc-module.dylib", NULL); + } + else + { + modpath = g_build_filename (libdir, "libgnc-module.dylib", NULL); + } #else /* Regular Unix */ - modpath = g_module_build_path ("../.libs", "gnc-module"); + modpath = g_module_build_path (libdir, "gnc-module"); #endif gmodule = g_module_open(modpath, 0);