build: handle libaddns by SMB_LIBRARY() and correctly create SONAME file.
authorMichael Adam <obnox@samba.org>
Mon, 7 Jul 2008 11:57:34 +0000 (13:57 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 18 Aug 2008 12:59:23 +0000 (14:59 +0200)
Create .so file as a symlink.

Michael
(cherry picked from commit bbf665ad5790e89ff01867e2762fe2b94db7277d)
(cherry picked from commit f0ee69d25da86647a4a75e6994e72a62ad889064)

source/Makefile.in
source/configure.in

index 98f253f54320681664cca689e0c5f04dc408c5bf..b31ed7b1706b67a9da58bf88afeca2d67fe69c35 100644 (file)
@@ -1498,7 +1498,7 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIB
 
 MKSYMS_SH = $(srcdir)/script/mksyms.sh
 
-SHLIBS = libtalloc libtdb @LIBWBCLIENT@ libsmbclient libsmbsharemodes @LIBADDNS@ libnetapi
+SHLIBS = libtalloc libtdb @LIBWBCLIENT@ libsmbclient libsmbsharemodes libaddns libnetapi
 
 shlibs: $(SHLIBS)
 
@@ -1701,15 +1701,25 @@ uninstalllibwbclient::
 
 LIBADDNS_OBJ = $(LIBADDNS_OBJ0) @LIBTALLOC_STATIC@
 
-LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@
+LIBADDNS_SHARED_TARGET=@LIBADDNS_SHARED_TARGET@
+LIBADDNS_SOVER=$(shell grep \^$(LIBADDNS_SHARED_TARGET) $(builddir)/library-versions | cut -d: -f2)
+LIBADDNS_SHARED_TARGET_SONAME=$(LIBADDNS_SHARED_TARGET).$(LIBADDNS_SOVER)
+LIBADDNS_STATIC_TARGET=@LIBADDNS_STATIC_TARGET@
+LIBADDNS=$(LIBADDNS_STATIC_TARGET) @LIBADDNS_SHARED@
+#LIBADDNS_SYMS=$(srcdir)/exports/libaddns.@SYMSEXT@
+LIBADDNS_HEADERS=$(srcdir)/libaddns/addns.h
 
-bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ) @LIBTALLOC_SHARED@
+$(LIBADDNS_SHARED_TARGET_SONAME): $(BINARY_PREREQS) $(LIBADDNS_OBJ) @LIBTALLOC_SHARED@
        @echo Linking shared library $@
        @$(SHLD_DSO) $(LIBADDNS_OBJ) $(LIBS) \
                $(KRB5LIBS) $(UUID_LIBS) @LIBTALLOC_LIBS@ \
-               @SONAMEFLAG@`basename $@`.$(SONAME_VER)
+               @SONAMEFLAG@`basename $@`
+
+$(LIBADDNS_SHARED_TARGET): $(LIBADDNS_SHARED_TARGET_SONAME)
+       @rm -f $@
+       @ln -s -f `basename $(LIBADDNS_SHARED_TARGET_SONAME)` $@
 
-bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
+$(LIBADDNS_STATIC_TARGET): $(BINARY_PREREQS) $(LIBADDNS_OBJ)
        @echo Linking non-shared library $@
        @-$(AR) -rc $@ $(LIBADDNS_OBJ)
 
@@ -1717,12 +1727,18 @@ libaddns: $(LIBADDNS)
 
 installlibaddns:: installdirs libaddns
        @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
-       -$(INSTALLLIBCMD_SH) bin/libaddns.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
-       -$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR)
+       -$(INSTALLLIBCMD_SH) $(LIBADDNS_SHARED_TARGET_SONAME) $(DESTDIR)$(LIBDIR)
+       @rm -f $(DESTDIR)$(LIBDIR)/`basename $(LIBADDNS_SHARED_TARGET)`
+       -if test -e $(LIBADDNS_SHARED_TARGET_SONAME) ; then \
+               ln -s -f `basename $(LIBADDNS_SHARED_TARGET_SONAME)` \
+                       $(DESTDIR)$(LIBDIR)/`basename $(LIBADDNS_SHARED_TARGET)` ; \
+       fi
+       -$(INSTALLLIBCMD_A) $(LIBADDNS_STATIC_TARGET) $(DESTDIR)$(LIBDIR)
 
 uninstalllibaddns::
-       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libaddns.@SHLIBEXT@
-       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libaddns.a
+       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/`basename $(LIBADDNS_SHARED_TARGET_SONAME)`
+       -rm -f $(DESTDIR)$(LIBDIR)/`basename $(LIBADDNS_SHARED_TARGET)`
+       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/`basename $(LIBADDNS_STATIC_TARGET)`
 
 
 #-------------------------------------------------------------------
index 9f0c794847ef786b1c12438e2f6fc0f992d4885e..fe3f51f0cd92994f1917a0ed7efcf19c063f5109 100644 (file)
@@ -79,10 +79,6 @@ AC_SUBST(INSTALLLIBCMD_SH)
 AC_SUBST(INSTALLLIBCMD_A)
 AC_SUBST(UNINSTALLLIBCMD_SH)
 AC_SUBST(UNINSTALLLIBCMD_A)
-AC_SUBST(INSTALL_LIBADDNS)
-AC_SUBST(UNINSTALL_LIBADDNS)
-AC_SUBST(LIBADDNS_SHARED)
-AC_SUBST(LIBADDNS)
 
 AC_SUBST(INSTALL_LIBWBCLIENT)
 AC_SUBST(UNINSTALL_LIBWBCLIENT)
@@ -4669,39 +4665,7 @@ SMB_LIBRARY(tdb)
 SMB_LIBRARY(netapi)
 SMB_LIBRARY(smbclient)
 SMB_LIBRARY(smbsharemodes)
-
-
-#################################################
-# should we build libaddns?
-INSTALL_LIBADDNS=
-UNINSTALL_LIBADDNS=
-LIBADDNS_SHARED=
-LIBADDNS=
-AC_MSG_CHECKING(whether to build the libaddns shared library)
-AC_ARG_WITH(libaddns,
-[AS_HELP_STRING([--with-libaddns], [Build the libaddns shared library (default=no undefined API)])],
-[ case "$withval" in
-  *)
-     AC_MSG_RESULT(no)
-     ;;
-  yes)
-     if test $BLDSHARED = true; then
-        LIBADDNS_SHARED=bin/libaddns.$SHLIBEXT
-        LIBADDNS=libaddns
-        AC_MSG_RESULT(yes)
-     else
-       enable_static=yes
-        AC_MSG_RESULT(no shared library support -- will supply static library)
-     fi
-     if test $enable_static = yes; then
-        LIBADDNS=libaddns
-     fi
-     INSTALL_LIBADDNS=installlibaddns
-     UNINSTALL_LIBADDNS=uninstalllibaddns
-     ;;
-  esac ],
-[AC_MSG_RESULT(no)]
-)
+SMB_LIBRARY(addns, no, [undefined API])