Author: jelmer
Date: 2007-11-06 02:16:55 +0000 (Tue, 06 Nov 2007)
New Revision: 25850

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25850

Log:
Add macro for picflag.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/build/m4/check_ld.m4
   branches/SAMBA_4_0/source/lib/ldb/Makefile.in
   branches/SAMBA_4_0/source/lib/ldb/configure.ac
   branches/SAMBA_4_0/source/lib/replace/libreplace_ld.m4


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/build/m4/check_ld.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/check_ld.m4      2007-11-06 01:39:47 UTC 
(rev 25849)
+++ branches/SAMBA_4_0/source/build/m4/check_ld.m4      2007-11-06 02:16:55 UTC 
(rev 25850)
@@ -56,7 +56,6 @@
                SHLD_FLAGS="-shared -Wl,-Bsymbolic"
                SHLD_UNDEF_FLAGS="-Wl,--allow-shlib-undefined"
                LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
-               PICFLAG="-fPIC"
                SONAMEFLAG="-Wl,-soname="
                ;;
        *solaris*)
@@ -64,13 +63,11 @@
                SHLD_FLAGS="-G"
                SONAMEFLAG="-h "
                if test "${GCC}" = "yes"; then
-                       PICFLAG="-fPIC"
                        SONAMEFLAG="-Wl,-soname="
                        if test "${ac_cv_prog_gnu_ld}" = "yes"; then
                                LDFLAGS="$LDFLAGS -Wl,-E"
                        fi
                else
-                       PICFLAG="-KPIC"
                        ## ${CFLAGS} added for building 64-bit shared 
                        ## libs using Sun's Compiler
                        SHLD_FLAGS="-G \${CFLAGS}"
@@ -80,20 +77,17 @@
                BLDSHARED="true"
                SHLD_FLAGS="-G"
                SONAMEFLAG="-Wl,-h,"
-               PICFLAG="-KPIC"   # Is this correct for SunOS
                ;;
        *netbsd* | *freebsd* | *dragonfly* )  
                BLDSHARED="true"
                LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
                SONAMEFLAG="-Wl,-soname,"
-               PICFLAG="-fPIC -DPIC"
                ;;
        *openbsd*)
                # disabled because us4 fails to link libtorture.so
                BLDSHARED="false"
                LDFLAGS="$LDFLAGS -Wl,-Bdynamic"
                SONAMEFLAG="-Wl,-soname,"
-               PICFLAG="-fPIC"
                ;;
        *irix*)
                # disabled because us4 fails to link libtorture.so
@@ -101,19 +95,12 @@
                SHLD_FLAGS="-set_version sgi1.0 -shared"
                SONAMEFLAG="-soname "
                SHLD="${PROG_LD}"
-               if test "${GCC}" = "yes"; then
-                       PICFLAG="-fPIC"
-               else 
-                       PICFLAG="-KPIC"
-               fi
                ;;
        *aix*)
                # disabled because us4 fails to link libtorture.so
                BLDSHARED="false"
                SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
                LDFLAGS="$LDFLAGS -Wl,-brtl,-bexpall,-bbigtoc"
-               # as AIX code is always position independent...
-               PICFLAG="-O2"
                ;;
        *hpux*)
                # Use special PIC flags for the native HP-UX compiler.
@@ -121,14 +108,11 @@
                        BLDSHARED="true"
                        SHLD_FLAGS="-b -Wl,-B,symbolic,-b,-z"
                        SONAMEFLAG="-Wl,+h "
-                       PICFLAG="+z +ESnolit"
                elif test "${GCC}" = "yes"; then
                        BLDSHARED="true" # I hope this is correct
-                       PICFLAG="-fPIC"
                fi
                if test "$host_cpu" = "ia64"; then
                        SHLIBEXT="so"
-                       PICFLAG="+z"
                        LDFLAGS="$LDFLAGS 
-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
                else
                        SHLIBEXT="sl"
@@ -139,12 +123,10 @@
                # disabled because tru64 fails to link libtorture.so
                BLDSHARED="false"
                SONAMEFLAG="-Wl,-soname,"
-               PICFLAG="-fPIC"
                ;;
        *unixware*)
                BLDSHARED="true"
                SONAMEFLAG="-Wl,-soname,"
-               PICFLAG="-KPIC"
                ;;
        *darwin*)
                BLDSHARED="true"
@@ -167,6 +149,8 @@
 AC_MSG_CHECKING([STLD_FLAGS])
 AC_MSG_RESULT([$STLD_FLAGS])
 
+AC_LD_PICFLAG
+
 AC_ARG_ENABLE(shared,
 [  --disable-shared        Disable testing for building shared libraries],
 [],[enable_shared=yes])

Modified: branches/SAMBA_4_0/source/lib/ldb/Makefile.in
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/Makefile.in       2007-11-06 01:39:47 UTC 
(rev 25849)
+++ branches/SAMBA_4_0/source/lib/ldb/Makefile.in       2007-11-06 02:16:55 UTC 
(rev 25850)
@@ -36,6 +36,7 @@
 
 LD_EXPORT_DYNAMIC = @LD_EXPORT_DYNAMIC@
 
+PICFLAG = @PICFLAG@
 CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \
        $(POPT_CFLAGS) $(TALLOC_CFLAGS) $(TDB_CFLAGS) \
        -DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"$(SHLIBEXT)\" -DUSE_MMAP=1 @CFLAGS@
@@ -98,6 +99,11 @@
        @mkdir -p `dirname [EMAIL PROTECTED]
        @$(CC) $(CFLAGS) -c $< -o $@
 
+.c.po:
+       @echo Compiling $*.c
+       @mkdir -p `dirname [EMAIL PROTECTED]
+       @$(CC) $(CFLAGS) $(PICFLAG) -c $< -o $@
+
 dirs:
        @mkdir -p $(DIRS)
 
@@ -108,8 +114,8 @@
 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)
 
-sample_module.$(SHLIBEXT): tests/sample_module.o 
-       $(CC) -shared -o $@ tests/sample_module.o 
+sample_module.$(SHLIBEXT): tests/sample_module.po 
+       $(CC) -shared -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)
@@ -141,7 +147,7 @@
 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 .po
 
 manpages:
        @$(srcdir)/docs/builddocs.sh "$(XSLTPROC)" "$(srcdir)"

Modified: branches/SAMBA_4_0/source/lib/ldb/configure.ac
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/configure.ac      2007-11-06 01:39:47 UTC 
(rev 25849)
+++ branches/SAMBA_4_0/source/lib/ldb/configure.ac      2007-11-06 02:16:55 UTC 
(rev 25850)
@@ -72,6 +72,7 @@
 AC_SUBST(EXTRA_OBJ)
 
 AC_LD_EXPORT_DYNAMIC
+AC_LD_PICFLAG
 
 m4_include(libldb.m4)
 AC_OUTPUT(Makefile ldb.pc)

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_ld.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/libreplace_ld.m4      2007-11-06 
01:39:47 UTC (rev 25849)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_ld.m4      2007-11-06 
02:16:55 UTC (rev 25850)
@@ -8,3 +8,58 @@
 AC_SUBST(LD_EXPORT_DYNAMIC)
 LDFLAGS="$saved_LDFLAGS"
 ])
+
+AC_DEFUN([AC_LD_PICFLAG],
+[
+case "$host_os" in
+       *linux*) 
+               PICFLAG="-fPIC" 
+               ;;
+       *solaris*)
+               if test "${GCC}" = "yes"; then
+                       PICFLAG="-fPIC"
+               else
+                       PICFLAG="-KPIC"
+               fi
+               ;;
+       *sunos*)
+               PICFLAG="-KPIC"   # Is this correct for SunOS
+               ;;
+       *netbsd* | *freebsd* | *dragonfly* )  
+               PICFLAG="-fPIC -DPIC"
+               ;;
+       *openbsd*)
+               PICFLAG="-fPIC"
+               ;;
+       *irix*)
+               if test "${GCC}" = "yes"; then
+                       PICFLAG="-fPIC"
+               else 
+                       PICFLAG="-KPIC"
+               fi
+               ;;
+       *aix*)
+               # as AIX code is always position independent...
+               PICFLAG="-O2"
+               ;;
+       *hpux*)
+               if test $ac_cv_prog_cc_Ae = yes; then
+                       PICFLAG="+z +ESnolit"
+               elif test "${GCC}" = "yes"; then
+                       PICFLAG="-fPIC"
+               fi
+               if test "$host_cpu" = "ia64"; then
+                       PICFLAG="+z"
+               fi
+               ;;
+       *osf*)
+               PICFLAG="-fPIC"
+               ;;
+       *unixware*)
+               PICFLAG="-KPIC"
+               ;;
+       *darwin*)
+               ;;
+esac
+AC_SUBST(PICFLAG)
+])

Reply via email to