build: handle libsmbsharemodes by SMB_LIBRARY() and correctly create SONAME file.
authorMichael Adam <obnox@samba.org>
Sun, 6 Jul 2008 22:41:23 +0000 (00:41 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 18 Aug 2008 12:58:46 +0000 (14:58 +0200)
Create libsmbsharemodes.so as a symlink.

Michael
(cherry picked from commit 1157048146084e9ab34d7c2e77e8d00b22df53a4)
(cherry picked from commit 8335245d9164f0bd19b2d018bb3138fde9e05fa7)

source/Makefile.in
source/configure.in

index fb726760ef5b7c5c2954bbb4d952cc491a7c221d..293d18182f11778d571f506694bb7e5b1ae4d3e2 100644 (file)
@@ -1501,7 +1501,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)
 
@@ -1881,16 +1881,28 @@ uninstallclientlib:: uninstalllibsmbclient
 
 LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o @LIBTDB_STATIC@
 
+LIBSMBSHAREMODES_SHARED_TARGET=@LIBSMBSHAREMODES_SHARED_TARGET@
+LIBSMBSHAREMODES_SOVER=$(shell grep \^$(LIBSMBSHAREMODES_SHARED_TARGET) $(builddir)/library-versions | cut -d: -f2)
+LIBSMBSHAREMODES_SHARED_TARGET_SONAME=$(LIBSMBSHAREMODES_SHARED_TARGET).$(LIBSMBSHAREMODES_SOVER)
+LIBSMBSHAREMODES_STATIC_TARGET=@LIBSMBSHAREMODES_STATIC_TARGET@
+LIBSMBSHAREMODES=$(LIBSMBSHAREMODES_STATIC_TARGET) @LIBSMBSHAREMODES_SHARED@
+#LIBSMBSHAREMODES_SYMS=$(srcdir)/exports/libsmbsharemodes.@SYMSEXT@
+LIBSMBSHAREMODES_HEADERS=$(srcdir)/include/smb_share_modes.h
+
 LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@
 
-bin/libsmbsharemodes.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
+$(LIBSMBSHAREMODES_SHARED_TARGET_SONAME): $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
        @echo Linking shared library $@
        @$(SHLD_DSO) $(LIBSMBSHAREMODES_OBJ) \
                $(LIBS) @LIBTALLOC_LIBS@ @LIBTDB_LIBS@ \
                $(KRB5LIBS) $(LDAP_LIBS) \
-               @SONAMEFLAG@`basename $@`.$(SONAME_VER)
+               @SONAMEFLAG@`basename $@`
 
-bin/libsmbsharemodes.a: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
+$(LIBSMBSHAREMODES_SHARED_TARGET): $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME)
+       @rm -f $@
+       @ln -s -f `basename $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME)` $@
+
+$(LIBSMBSHAREMODES_STATIC_TARGET): $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
        @echo Linking non-shared library $@
        @-$(AR) -rc $@ $(LIBSMBSHAREMODES_OBJ)
 
@@ -1898,13 +1910,21 @@ libsmbsharemodes: $(LIBSMBSHAREMODES)
 
 installlibsmbsharemodes:: installdirs libsmbsharemodes
        @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
-       -$(INSTALLLIBCMD_SH) bin/libsmbsharemodes.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
-       -$(INSTALLLIBCMD_A) bin/libsmbsharemodes.a $(DESTDIR)$(LIBDIR)
-       -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/include/smb_share_modes.h $(DESTDIR)${prefix}/include
+       -$(INSTALLLIBCMD_SH) $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME) $(DESTDIR)$(LIBDIR)
+       @rm -f $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBSHAREMODES_SHARED_TARGET)`
+       -if test -e $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME) ; then \
+               ln -s -f `basename $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME)` \
+                       $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBSHAREMODES_SHARED_TARGET)` ; \
+       fi
+       -$(INSTALLLIBCMD_A) $(LIBSMBSHAREMODES_STATIC_TARGET) $(DESTDIR)$(LIBDIR)
+       @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) ${prefix}/include
+       -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(LIBSMBSHAREMODES_HEADERS) $(DESTDIR)${prefix}/include
 
 uninstalllibsmbsharemodes::
-       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libsmbsharemodes.@SHLIBEXT@
-       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libsmbsharemodes.a
+       -rm -f $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBSHAREMODES_SHARED_TARGET)`
+       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBSHAREMODES_SHARED_TARGET_SONAME)`
+       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBSHAREMODES_STATIC_TARGET)`
+       -rm -f $(DESTDIR)${prefix}/include/smb_share_modes.h
 
 
 #-------------------------------------------------------------------
index b080cb1e27099161d3f05dc8d0fb7186730dca8b..9f0c794847ef786b1c12438e2f6fc0f992d4885e 100644 (file)
@@ -95,11 +95,6 @@ AC_SUBST(WINBIND_LIBS)
 
 AC_SUBST(LIBSAMBAUTIL_SHARED)
 
-AC_SUBST(INSTALL_LIBSMBSHAREMODES)
-AC_SUBST(UNINSTALL_LIBSMBSHAREMODES)
-AC_SUBST(LIBSMBSHAREMODES_SHARED)
-AC_SUBST(LIBSMBSHAREMODES)
-
 AC_SUBST(PRINT_LIBS)
 AC_SUBST(AUTH_LIBS)
 AC_SUBST(ACL_LIBS)
@@ -4673,6 +4668,7 @@ SMB_LIBRARY(talloc)
 SMB_LIBRARY(tdb)
 SMB_LIBRARY(netapi)
 SMB_LIBRARY(smbclient)
+SMB_LIBRARY(smbsharemodes)
 
 
 #################################################
@@ -4708,48 +4704,6 @@ AC_ARG_WITH(libaddns,
 )
 
 
-INSTALL_LIBSMBSHAREMODES=
-LIBSMBSHAREMODES_SHARED=
-LIBSMBSHAREMODES=
-AC_MSG_CHECKING(whether to build the libsmbsharemodes shared library)
-AC_ARG_WITH(libsmbsharemodes,
-[AS_HELP_STRING([--with-libsmbsharemodes], [Build the libsmbsharemodes shared library (default=yes if shared libs supported)])],
-[ case "$withval" in
-  no)
-     AC_MSG_RESULT(no)
-     ;;
-  *)
-     if test $BLDSHARED = true; then
-        LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT
-        LIBSMBSHAREMODES=libsmbsharemodes
-        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
-        LIBSMBSHAREMODES=libsmbsharemodes
-     fi
-     INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes
-     UNINSTALL_LIBSMBSHAREMODES=uninstalllibsmbsharemodes
-     ;;
-  esac ],
-[
-# if unspecified, default is to build it if possible.
-  if test $BLDSHARED = true; then
-     LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT
-     LIBSMBSHAREMODES=libsmbsharemodes
-     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
-     LIBSMBSHAREMODES=libsmbsharemodes
-  fi]
-  INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes
-)
-
 
 #################################################
 # these tests are taken from the GNU fileutils package