LP1990018: Fix libdbi build
authorJason Stephenson <jason@sigio.com>
Sun, 18 Sep 2022 13:38:40 +0000 (09:38 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 30 Sep 2022 18:41:06 +0000 (14:41 -0400)
Resolve issues with finding libdbi and libdbdpgsql on ARM64 by using better
autoconf hygiene:

 * Use PKG_CHECK_MODULES to find and set the dbi library flags.
 * Remove the "backup" code to find a manually installed libdbi.
   (This has not been needed for some time.)
 * Update Makefile.ams to use the dbi LDFLAGS properly.
 * Remove -ldbdpgsql from compile commands.
   (It is loaded dynamically.)

I tested it on a x86_64 VM with Ubuntu 22.04.  Most tests passed.  Only the
remot auth and cover uploader tests failed.  The latter have not passed for
some time, and I believe the former may have been affected by a recent
change unrelated to this commit.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>

Open-ILS/src/c-apps/Makefile.am
Open-ILS/src/c-apps/tests/Makefile.am
configure.ac

index 2daa997..2bf76b8 100644 (file)
@@ -7,7 +7,7 @@
 SUBDIRS = . tests
 
 AM_CFLAGS = $(DEF_CFLAGS) -DOSRF_LOG_PARAMS -I@top_srcdir@/include/
-AM_LDFLAGS = $(DEF_LDFLAGS) -L$(DBI_LIBS) -lopensrf
+AM_LDFLAGS = $(DEF_LDFLAGS) $(DBI_LIBS) -lopensrf
 
 bin_PROGRAMS = oils_dataloader dump_idl idlval test_json_query test_qstore
 oils_dataloader_SOURCES = oils_dataloader.c
@@ -42,19 +42,19 @@ liboils_utils_la_SOURCES = oils_utils.c oils_event.c
 liboils_utils_la_LDFLAGS = -loils_idl -version-info 2:0:0
 
 liboils_cstore_la_SOURCES = oils_cstore.c oils_sql.c
-liboils_cstore_la_LDFLAGS = $(AM_LDFLAGS) -ldbi -ldbdpgsql -loils_utils -module -version-info 2:0:0
+liboils_cstore_la_LDFLAGS = $(AM_LDFLAGS) -loils_utils -module -version-info 2:0:0
 liboils_cstore_la_DEPENDENCIES = liboils_utils.la
 
 liboils_qstore_la_SOURCES = oils_qstore.c oils_sql.c oils_storedq.c oils_buildq.c buildSQL.c oils_execsql.c
-liboils_qstore_la_LDFLAGS = $(AM_LDFLAGS) -ldbi -ldbdpgsql -loils_utils -module -version-info 2:0:0
+liboils_qstore_la_LDFLAGS = $(AM_LDFLAGS) -loils_utils -module -version-info 2:0:0
 liboils_qstore_la_DEPENDENCIES = liboils_utils.la
 
 liboils_rstore_la_SOURCES = oils_rstore.c oils_sql.c
-liboils_rstore_la_LDFLAGS = $(AM_LDFLAGS) -ldbi -ldbdpgsql -loils_utils -module -version-info 2:0:0
+liboils_rstore_la_LDFLAGS = $(AM_LDFLAGS) -loils_utils -module -version-info 2:0:0
 liboils_rstore_la_DEPENDENCIES = liboils_utils.la
 
 liboils_pcrud_la_SOURCES = oils_pcrud.c oils_sql.c
-liboils_pcrud_la_LDFLAGS = $(AM_LDFLAGS) -ldbi -ldbdpgsql -loils_utils -module -version-info 2:0:0
+liboils_pcrud_la_LDFLAGS = $(AM_LDFLAGS) -loils_utils -module -version-info 2:0:0
 liboils_pcrud_la_DEPENDENCIES = liboils_utils.la
 
 liboils_auth_la_SOURCES = oils_auth.c
index a782624..682b21c 100644 (file)
@@ -4,7 +4,7 @@ export DEF_LDLIBS = -lopensrf
 
 COMMON = testsuite.c
 AM_CFLAGS = $(DEF_CFLAGS) -DOSRF_LOG_PARAMS
-AM_LDFLAGS = $(DEF_LDFLAGS) $(DEF_LDLIBS) -L$(DBI_LIBS)
+AM_LDFLAGS = $(DEF_LDFLAGS) $(DEF_LDLIBS) $(DBI_LIBS)
 
 TESTS = check_util check_idl
 check_PROGRAMS = check_util check_idl
index 8ce2087..67596da 100644 (file)
@@ -187,10 +187,7 @@ AC_ARG_WITH([libxml2],
 [LIBXML2_HEADERS=/usr/include/libxml2/])
 AC_SUBST([LIBXML2_HEADERS])
 
-AC_ARG_WITH([dbi],
-[  --with-dbi=path             location of the libdbi driver libraries (default is /usr/lib/x86_64-linux-gnu/dbd/)],
-[DBI_LIBS=${withval}],
-[DBI_LIBS=/usr/lib/x86_64-linux-gnu/dbd/])
+PKG_CHECK_MODULES([DBI], [dbi])
 
 AC_ARG_WITH([perlbase],
 [  --with-perlbase=path        base location to install Perl modules (default based on Config.pm)],
@@ -198,18 +195,6 @@ AC_ARG_WITH([perlbase],
 [PERL_BASE=x])
 AC_SUBST([PERL_BASE])
 
-# If the passed in value doesn't work, fall back to reasonable defaults
-# Distributions are starting to package a good version of libdbi / libdbd
-if ! test -d "$DBI_LIBS"; then
-    for i in /usr/lib/dbd/ /usr/lib64/dbd /usr/local/lib/dbd/ ; do
-        if test -d "$i"; then
-            DBI_LIBS="$i"
-            break
-        fi
-    done
-fi
-AC_SUBST([DBI_LIBS])
-
 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
 
 if test "x$openils_core" = "xtrue"; then