From dd66e34d416a95c1a1d36b032c72f781b14a13b7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 6 Nov 2007 02:17:05 +0100 Subject: r25851: Move system-specific ldflags checks to libreplace so they can be used by ldb. (This used to be commit d28c8b822e7b571f24542409376bba8701eeef79) --- source4/lib/ldb/Makefile.in | 5 +++-- source4/lib/ldb/configure.ac | 1 + source4/lib/replace/libreplace_ld.m4 | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index eb10311ccc..fd0caa4a5c 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -35,6 +35,7 @@ LDAP_LIBS = @LDAP_LIBS@ SHLIBEXT = @SHLIBEXT@ LD_EXPORT_DYNAMIC = @LD_EXPORT_DYNAMIC@ +SHLD_FLAGS = @SHLD_FLAGS@ PICFLAG = @PICFLAG@ CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \ @@ -112,10 +113,10 @@ lib/libldb.a: $(OBJS) @-ranlib $@ lib/libnss_ldb.so.2: $(NSS_OBJ) $(LIBS) bin/libldb.a - $(CC) -shared -Wl,-soname,libnss_ldb.so.2 -o lib/libnss_ldb.so.2 $(NSS_OBJ) $(OBJS) $(LIB_FLAGS) + $(CC) $(SHLD_FLAGS) -Wl,-soname,libnss_ldb.so.2 -o lib/libnss_ldb.so.2 $(NSS_OBJ) $(OBJS) $(LIB_FLAGS) sample_module.$(SHLIBEXT): tests/sample_module.po - $(CC) -shared -o $@ tests/sample_module.po + $(CC) $(SHLD_FLAGS) -o $@ tests/sample_module.po bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS) $(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC) diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac index b4b8788253..ffa3f4f750 100644 --- a/source4/lib/ldb/configure.ac +++ b/source4/lib/ldb/configure.ac @@ -73,6 +73,7 @@ AC_SUBST(EXTRA_OBJ) AC_LD_EXPORT_DYNAMIC AC_LD_PICFLAG +AC_LD_SHLDFLAGS 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 d3d3f9464f..07dd2db231 100644 --- a/source4/lib/replace/libreplace_ld.m4 +++ b/source4/lib/replace/libreplace_ld.m4 @@ -63,3 +63,41 @@ case "$host_os" in esac AC_SUBST(PICFLAG) ]) + +AC_DEFUN([AC_LD_SHLDFLAGS], +[ + SHLD_FLAGS="-shared" + + case "$host_os" in + *linux*) + SHLD_FLAGS="-shared -Wl,-Bsymbolic" + ;; + *solaris*) + SHLD_FLAGS="-G" + if test "${GCC}" = "no"; then + ## ${CFLAGS} added for building 64-bit shared + ## libs using Sun's Compiler + SHLD_FLAGS="-G \${CFLAGS}" + fi + ;; + *sunos*) + SHLD_FLAGS="-G" + ;; + *irix*) + SHLD_FLAGS="-set_version sgi1.0 -shared" + ;; + *aix*) + SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc" + ;; + *hpux*) + if test $ac_cv_prog_cc_Ae = yes; then + SHLD_FLAGS="-b -Wl,-B,symbolic,-b,-z" + fi + ;; + *darwin*) + SHLD_FLAGS="-bundle -flat_namespace -undefined suppress" + ;; + esac + + AC_SUBST(SHLD_FLAGS) +]) -- cgit