summaryrefslogtreecommitdiff
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
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)
-rw-r--r--source4/build/m4/check_ld.m414
-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
4 files changed, 60 insertions, 18 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index de80394b08..15af978dc9 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -19,7 +19,6 @@ AC_SUBST(LD)
AC_SUBST(LDFLAGS)
AC_SUBST(SHLD)
AC_SUBST(SHLD_UNDEF_FLAGS)
-AC_SUBST(SONAMEFLAG)
# Assume non-shared by default and override below
# these are the defaults, good for lots of systems
@@ -28,7 +27,6 @@ STLD_FLAGS="-rcs"
BLDSHARED="false"
LD="${CC}"
SHLD="${CC}"
-SONAMEFLAG=""
PICFLAG=""
# allow for --with-hostld=gcc
@@ -50,13 +48,10 @@ case "$host_os" in
BLDSHARED="true"
SHLD_UNDEF_FLAGS="-Wl,--allow-shlib-undefined"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- SONAMEFLAG="-Wl,-soname="
;;
*solaris*)
BLDSHARED="true"
- SONAMEFLAG="-h "
if test "${GCC}" = "yes"; then
- SONAMEFLAG="-Wl,-soname="
if test "${ac_cv_prog_gnu_ld}" = "yes"; then
LDFLAGS="$LDFLAGS -Wl,-E"
fi
@@ -64,21 +59,17 @@ case "$host_os" in
;;
*sunos*)
BLDSHARED="true"
- SONAMEFLAG="-Wl,-h,"
;;
*netbsd* | *freebsd* | *dragonfly* )
BLDSHARED="true"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- SONAMEFLAG="-Wl,-soname,"
;;
*openbsd*)
BLDSHARED="true"
LDFLAGS="$LDFLAGS -Wl,-Bdynamic"
- SONAMEFLAG="-Wl,-soname,"
;;
*irix*)
BLDSHARED="true"
- SONAMEFLAG="-soname "
SHLD="${PROG_LD}"
;;
*aix*)
@@ -88,8 +79,6 @@ case "$host_os" in
*hpux*)
# Use special PIC flags for the native HP-UX compiler.
if test $ac_cv_prog_cc_Ae = yes; then
- SONAMEFLAG="-Wl,+h "
- elif test "${GCC}" = "yes"; then
fi
BLDSHARED="true" # I hope this is correct
if test "$host_cpu" = "ia64"; then
@@ -100,11 +89,9 @@ case "$host_os" in
;;
*osf*)
BLDSHARED="true"
- SONAMEFLAG="-Wl,-soname,"
;;
*unixware*)
BLDSHARED="true"
- SONAMEFLAG="-Wl,-soname,"
;;
*darwin*)
BLDSHARED="true"
@@ -129,6 +116,7 @@ AC_LD_PICFLAG
AC_LD_EXPORT_DYNAMIC
AC_LD_SHLDFLAGS
AC_LD_SHLIBEXT
+AC_LD_SONAMEFLAG
AC_ARG_ENABLE(shared,
[ --disable-shared Disable testing for building shared libraries],
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
+])