From 85e3fedddc73c939bbd1e74850dfbb222aa0b823 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Fri, 8 Jul 2011 15:44:15 +0200 Subject: [PATCH] Use a helper script to link the correct database backend. On some platforms the extension of shared libs is not .so (OSX seems to use .dylib and some other platform even other exotic names). We now extract the extension from libtool which knows best as it also creates our shared libs. --- bacula/autoconf/configure.in | 1 + bacula/src/cats/Makefile.in | 3 +- bacula/src/cats/install-default-backend.in | 33 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 bacula/src/cats/install-default-backend.in diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 213e71e9da..6d566cc120 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -3304,6 +3304,7 @@ AC_OUTPUT([autoconf/Make.common \ src/cats/make_bacula_tables \ src/cats/drop_bacula_tables \ src/cats/drop_bacula_database \ + src/cats/install-default-backend \ src/findlib/Makefile \ src/tools/Makefile \ src/plugins/fd/Makefile \ diff --git a/bacula/src/cats/Makefile.in b/bacula/src/cats/Makefile.in index a4138eab70..2df93d7778 100644 --- a/bacula/src/cats/Makefile.in +++ b/bacula/src/cats/Makefile.in @@ -230,8 +230,7 @@ libtool-install: all for db_type in @DB_BACKENDS@; do \ $(LIBTOOL_INSTALL_FINISH) $(INSTALL_LIB) libbaccats-$${db_type}.la $(DESTDIR)$(libdir); \ done - $(CP) $(DESTDIR)$(libdir)/libbaccats-@DEFAULT_DB_TYPE@-$(LIBBACCATS_LT_RELEASE).so \ - $(DESTDIR)$(libdir)/libbaccats-$(LIBBACCATS_LT_RELEASE).so + ./install-default-backend @DEFAULT_DB_TYPE@ $(LIBBACCATS_LT_RELEASE) $(DESTDIR)$(libdir) libtool-uninstall: $(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbacsql.la diff --git a/bacula/src/cats/install-default-backend.in b/bacula/src/cats/install-default-backend.in new file mode 100755 index 0000000000..b456eb2a0a --- /dev/null +++ b/bacula/src/cats/install-default-backend.in @@ -0,0 +1,33 @@ +#!/bin/sh + +LIBTOOL=@LIBTOOL@ + +if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 +fi + +default_backend=$1 +library_version=$2 +install_dir=$3 + +# +# Find out what the shared lib extension is for this platform. +# +shrext_cmds="`${LIBTOOL} --config | grep shrext_cmds`" +eval $shrext_cmds +if [ -z "${shrext_cmds}" ]; then + echo "Failed to determine default shared library extension" + exit 1 +fi + +if [ -f ${install_dir}/libbaccats-${default_backend}-${library_version}${shrext_cmds} ]; then + # + # Create a default catalog library pointing to one of the shared libs. + # + rm -f ${install_dir}/libbaccats-${library_version}${shrext_cmds} + ln -s ${install_dir}/libbaccats-${default_backend}-${library_version}${shrext_cmds} \ + ${install_dir}/libbaccats-${library_version}${shrext_cmds} +fi + +exit 0 -- 2.39.5