summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-11-06 16:23:18 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:44:36 +0100
commit414e5eca2e1495916f4a52789a6bee63d2f1ab6d (patch)
treebc04e8823933a0b799ef2e8d8fac4e345582acd2 /source4/lib
parenta73cfa950afe7ccf5625e044070815846f5612ae (diff)
downloadsamba-414e5eca2e1495916f4a52789a6bee63d2f1ab6d.tar.gz
samba-414e5eca2e1495916f4a52789a6bee63d2f1ab6d.tar.bz2
samba-414e5eca2e1495916f4a52789a6bee63d2f1ab6d.zip
r25877: Add libreplace macro for soname flags.
(This used to be commit 25aa875119622679881cd0e1b3b9dff8d2cf03ee)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/Makefile.in22
-rw-r--r--source4/lib/ldb/configure.ac1
-rw-r--r--source4/lib/replace/libreplace_ld.m441
3 files changed, 59 insertions, 5 deletions
diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in
index a1f89fe626..5deb9b3b90 100644
--- a/source4/lib/ldb/Makefile.in
+++ b/source4/lib/ldb/Makefile.in
@@ -35,6 +35,7 @@ LDAP_LIBS = @LDAP_LIBS@
LIBDL = @LIBDL@
SHLIBEXT = @SHLIBEXT@
+SONAMEFLAG = @SONAMEFLAG@
LD_EXPORT_DYNAMIC = @LD_EXPORT_DYNAMIC@
SHLD_FLAGS = @SHLD_FLAGS@
@@ -47,7 +48,7 @@ CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \
$(POPT_CFLAGS) $(TALLOC_CFLAGS) $(TDB_CFLAGS) \
-DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"$(SHLIBEXT)\" -DUSE_MMAP=1 @CFLAGS@
-LIB_FLAGS=$(LDFLAGS) -Llib -lldb $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
+LIB_FLAGS=$(LDFLAGS) -Llib $(SOLIB) $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
$(TDB_LIBS) $(LDAP_LIBS) $(LIBDL)
LDB_TDB_DIR=ldb_tdb
@@ -80,7 +81,7 @@ LDB_LIB = lib/libldb.a
BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest bin/oLschema2ldif
-LIBS = $(LDB_LIB)
+LIBS = $(SOLIB)
EXAMPLES = examples/ldbreader examples/ldifreader
@@ -93,7 +94,13 @@ nss: nssdir all $(NSS_LIB)
nssdir:
@mkdir -p $(NSSDIR)
-all: showflags dirs $(OBJS) $(LDB_LIB) $(BINS) $(EXAMPLES) manpages
+SONAME = libldb.so.0
+SOLIB = lib/libldb.so.0.9.0
+
+$(SOLIB): $(OBJS)
+ $(CC) $(SHLD_FLAGS) $(SONAMEFLAG)$(SONAME) -o $@ $^ @LDFLAGS@ @LIBS@ $(TALLOC_LIBS) $(TDB_LIBS)
+
+all: showflags dirs $(OBJS) $(LDB_LIB) $(SOLIB) $(BINS) $(EXAMPLES) manpages
showflags:
@echo 'ldb will be compiled with flags:'
@@ -105,6 +112,11 @@ showflags:
@mkdir -p `dirname $@`
@$(CC) $(CFLAGS) $(PICFLAG) -c $< -o $@
+.c.po:
+ @echo Compiling $*.c
+ @mkdir -p `dirname $@`
+ @$(CC) -fPIC $(CFLAGS) -c $< -o $@
+
dirs:
@mkdir -p $(DIRS)
@@ -148,7 +160,7 @@ examples/ldbreader: examples/ldbreader.o $(LIBS)
examples/ldifreader: examples/ldifreader.o $(LIBS)
$(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
-.SUFFIXES: .1 .1.xml .3 .3.xml .xml .html
+.SUFFIXES: .1 .1.xml .3 .3.xml .xml .html .c .o
manpages:
@$(srcdir)/docs/builddocs.sh "$(XSLTPROC)" "$(srcdir)"
@@ -190,7 +202,7 @@ installcheck: install test
install: all
mkdir -p $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig $(DESTDIR)$(libdir) $(bindir)
cp $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(DESTDIR)$(includedir)
- cp $(LDB_LIB) $(DESTDIR)$(libdir)
+ cp $(LDB_LIB) $(SOLIB) $(DESTDIR)$(libdir)
cp $(BINS) $(DESTDIR)$(bindir)
cp ldb.pc $(DESTDIR)$(libdir)/pkgconfig
$(srcdir)/docs/installdocs.sh $(DESTDIR)$(mandir)
diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac
index ff100bb2e0..bf7b5b05a9 100644
--- a/source4/lib/ldb/configure.ac
+++ b/source4/lib/ldb/configure.ac
@@ -71,6 +71,7 @@ AC_LD_EXPORT_DYNAMIC
AC_LD_PICFLAG
AC_LD_SHLDFLAGS
AC_LD_SHLIBEXT
+AC_LD_SONAMEFLAG
m4_include(libldb.m4)
AC_OUTPUT(Makefile ldb.pc)
diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4
index 183c302aae..c276a7a864 100644
--- a/source4/lib/replace/libreplace_ld.m4
+++ b/source4/lib/replace/libreplace_ld.m4
@@ -125,3 +125,44 @@ AC_DEFUN([AC_LD_SHLIBEXT],
esac
AC_SUBST(SHLIBEXT)
])
+
+AC_DEFUN([AC_LD_SONAMEFLAG],
+[
+ AC_SUBST(SONAMEFLAG)
+ SONAMEFLAG=""
+ case "$host_os" in
+ *linux*)
+ SONAMEFLAG="-Wl,-soname="
+ ;;
+ *solaris*)
+ SONAMEFLAG="-h "
+ if test "${GCC}" = "yes"; then
+ SONAMEFLAG="-Wl,-soname="
+ fi
+ ;;
+ *sunos*)
+ SONAMEFLAG="-Wl,-h,"
+ ;;
+ *netbsd* | *freebsd* | *dragonfly* )
+ SONAMEFLAG="-Wl,-soname,"
+ ;;
+ *openbsd*)
+ SONAMEFLAG="-Wl,-soname,"
+ ;;
+ *irix*)
+ SONAMEFLAG="-soname "
+ ;;
+ *hpux*)
+ SONAMEFLAG="-Wl,+h "
+ ;;
+ *osf*)
+ SONAMEFLAG="-Wl,-soname,"
+ ;;
+ *unixware*)
+ SONAMEFLAG="-Wl,-soname,"
+ ;;
+ *darwin*)
+ SONAMEFLAG="-Wl,-soname,"
+ ;;
+ esac
+])