summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/check_ld.m4210
-rw-r--r--source4/build/smb_build/makefile.pm13
-rw-r--r--source4/configure.ac7
3 files changed, 107 insertions, 123 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index 137ef8b05d..51dcce6302 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -5,187 +5,174 @@ dnl Copyright (C) Jelmer Vernooij 2006
dnl Released under the GNU GPL
dnl -------------------------------------------------------
dnl
-dnl Check if we use GNU ld
-AC_PATH_PROG(LD, ld)
+
+AC_PATH_PROG(PROG_LD,ld)
AC_PROG_LD_GNU
-AC_PATH_PROG(AR, ar)
+AC_PATH_PROG(PROG_AR, ar)
+AC_SUBST(STLD)
+AC_SUBST(STLD_FLAGS)
+AC_SUBST(BLDSHARED)
+AC_SUBST(LD)
+AC_SUBST(LDFLAGS)
+AC_SUBST(SHLD)
+AC_SUBST(SHLD_FLAGS)
AC_SUBST(SHLIBEXT)
-AC_SUBST(LDSHFLAGS)
AC_SUBST(SONAMEFLAG)
-AC_SUBST(DYNEXP)
AC_SUBST(PICFLAG)
-AC_SUBST(BLDSHARED)
# Assume non-shared by default and override below
-BLDSHARED="false"
-
# these are the defaults, good for lots of systems
-DYNEXP=
-HOST_OS="$host_os"
-LDSHFLAGS="-shared"
+STLD=${PROG_AR}
+STLD_FLAGS="-rcs"
+BLDSHARED="false"
+LD="${CC}"
+LDFLAGS=""
+SHLD="${CC}"
+SHLD_FLAGS="-shared"
+SHLIBEXT="so"
SONAMEFLAG=""
-SHLD="\${CC}"
PICFLAG=""
-SHLIBEXT="so"
AC_MSG_CHECKING([ability to build shared libraries])
# and these are for particular systems
case "$host_os" in
*linux*)
- AC_DEFINE(LINUX,1,[Whether the host os is linux])
BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,--export-dynamic"
- PICFLAG="-fPIC"
+ if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
+ SHLD_FLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
+ else
+ SHLD_FLAGS="-shared -Wl,-Bsymbolic"
+ fi
+ LDFLAGS="-Wl,--export-dynamic"
+ PICFLAGS="-fPIC"
SONAMEFLAG="-Wl,-soname="
;;
*solaris*)
- AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
BLDSHARED="true"
- LDSHFLAGS="-G"
+ SHLD_FLAGS="-G"
+ SONAMEFLAG="-h "
if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
+ PICFLAGS="-fPIC"
+ SONAMEFLAG="-Wl,-soname="
if test "${ac_cv_prog_gnu_ld}" = "yes"; then
- DYNEXP="-Wl,-E"
+ LDFLAGS="-Wl,-E"
fi
else
- PICFLAG="-KPIC"
+ PICFLAGS="-KPIC"
## ${CFLAGS} added for building 64-bit shared
## libs using Sun's Compiler
- LDSHFLAGS="-G \${CFLAGS}"
+ SHLD_FLAGS="-G \${CFLAGS}"
fi
;;
*sunos*)
- AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
BLDSHARED="true"
- LDSHFLAGS="-G"
- PICFLAG="-KPIC" # Is this correct for SunOS
+ SHLD_FLAGS="-G"
+ SONAMEFLAG="-Wl,-h,"
+ PICFLAGS="-KPIC" # Is this correct for SunOS
;;
- *netbsd* | *freebsd*)
+ *netbsd* | *freebsd* | *dragonfly* )
BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,--export-dynamic"
- PICFLAG="-fPIC -DPIC"
+ LDFLAGS="-Wl,--export-dynamic"
+ SONAMEFLAG="-Wl,-soname,"
+ PICFLAGS="-fPIC -DPIC"
;;
*openbsd*)
BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,-Bdynamic"
- PICFLAG="-fPIC"
+ LDFLAGS="-Wl,-Bdynamic"
+ SONAMEFLAG="-Wl,-soname,"
+ PICFLAGS="-fPIC"
;;
*irix*)
- AC_DEFINE(IRIX,1,[Whether the host os is irix])
- ATTEMPT_WRAP32_BUILD=yes
BLDSHARED="true"
- LDSHFLAGS="-set_version sgi1.0 -shared"
+ SHLD_FLAGS="-set_version sgi1.0 -shared"
SONAMEFLAG="-soname "
- SHLD="\${LD}"
+ SHLD="${PROG_LD}"
if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
+ PICFLAGS="-fPIC"
else
- PICFLAG="-KPIC"
+ PICFLAGS="-KPIC"
fi
;;
*aix*)
- AC_DEFINE(AIX,1,[Whether the host os is aix])
BLDSHARED="true"
- LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
- DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
- PICFLAG="-O2"
- if test "${GCC}" != "yes"; then
- ## for funky AIX compiler using strncpy()
- CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
- fi
+ SHLD_FLAGS="-Wl,-G,-bexpall"
+ LDFLAGS="-Wl,-brtl,-bexpall,-bbigtoc"
+ # as AIX code is always position independent...
+ PICFLAGS="-O2"
;;
*hpux*)
- AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
- SHLIBEXT="sl"
# Use special PIC flags for the native HP-UX compiler.
if test $ac_cv_prog_cc_Ae = yes; then
BLDSHARED="true"
- SHLD="/usr/bin/ld"
- LDSHFLAGS="-B symbolic -b -z"
- SONAMEFLAG="+h "
- PICFLAG="+z"
+ SHLD_FLAGS="-b -Wl,-B,symbolic,-b,-z"
+ SONAMEFLAG="-Wl,+h "
+ PICFLAGS="+z"
+ elif test "${GCC}" = "yes"; then
+ BLDSHARED="true" # I hope this is correct
+ PICFLAGS="-fPIC"
+ fi
+ if test "$host_cpu" = "ia64"; then
+ SHLIBEXT="so"
+ LDFLAGS="-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
+ else
+ SHLIBEXT="sl"
+ LDFLAGS="-Wl,-E,+b/usr/local/lib:/usr/lib"
fi
- DYNEXP="-Wl,-E"
- ;;
- *qnx*)
- AC_DEFINE(QNX,1,[Whether the host os is qnx])
;;
*osf*)
- AC_DEFINE(OSF1,1,[Whether the host os is osf1])
BLDSHARED="true"
- LDSHFLAGS="-shared"
SONAMEFLAG="-Wl,-soname,"
- PICFLAG="-fPIC"
- ;;
- *sco*)
- AC_DEFINE(SCO,1,[Whether the host os is sco unix])
+ PICFLAGS="-fPIC"
;;
*unixware*)
- AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
BLDSHARED="true"
- LDSHFLAGS="-shared"
SONAMEFLAG="-Wl,-soname,"
- PICFLAG="-KPIC"
- ;;
- *next2*)
- AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
+ PICFLAGS="-KPIC"
;;
- *dgux*)
- ;;
- *sysv4*)
- AC_DEFINE(SYSV,1,[Whether this is a system V system])
- case "$host" in
- *-univel-*)
- if [ test "$GCC" != yes ]; then
- AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
- fi
- LDSHFLAGS="-G"
- DYNEXP="-Bexport"
- ;;
- *mips-sni-sysv4*)
- AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix])
- ;;
- esac
- ;;
-
- *sysv5*)
- AC_DEFINE(SYSV,1,[Whether this is a system V system])
- if [ test "$GCC" != yes ]; then
- AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
- fi
- LDSHFLAGS="-G"
- ;;
- *-vms)
- BLDSHARED="false"
- LDSHFLAGS=""
- ;;
- *vos*)
- BLDSHARED="false"
- LDSHFLAGS=""
- ;;
- *)
+ *darwin*)
+ BLDSHARED="true"
+ SHLD_FLAGS="-bundle -flat_namespace -undefined suppress"
+ SHLIBEXT="dylib"
;;
esac
+
AC_MSG_RESULT($BLDSHARED)
-AC_MSG_CHECKING([linker flags for shared libraries])
-AC_MSG_RESULT([$LDSHFLAGS])
-AC_MSG_CHECKING([compiler flags for position-independent code])
-AC_MSG_RESULT([$PICFLAG])
+
+AC_MSG_CHECKING([LD])
+AC_MSG_RESULT([$LD])
+AC_MSG_CHECKING([LDFLAGS])
+AC_MSG_RESULT([$LDFLAGS])
+
+AC_MSG_CHECKING([STLD])
+AC_MSG_RESULT([$STLD])
+AC_MSG_CHECKING([STLD_FLAGS])
+AC_MSG_RESULT([$STLD_FLAGS])
#######################################################
# test whether building a shared library actually works
if test $BLDSHARED = true; then
+
+AC_MSG_CHECKING([SHLD])
+AC_MSG_RESULT([$SHLD])
+AC_MSG_CHECKING([SHLD_FLAGS])
+AC_MSG_RESULT([$SHLD_FLAGS])
+
+AC_MSG_CHECKING([SHLIBEXT])
+AC_MSG_RESULT([$SHLIBEXT])
+AC_MSG_CHECKING([SONAMEFLAG])
+AC_MSG_RESULT([$SONAMEFLAG])
+
+AC_MSG_CHECKING([PICFLAG])
+AC_MSG_RESULT([$PICFLAG])
+
AC_CACHE_CHECK([whether building shared libraries actually works],
[ac_cv_shlib_works],[
ac_cv_shlib_works=no
# try building a trivial shared library
${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/build/tests/shlib.c -o shlib.o &&
- ${SHLD} ${LDSHFLAGS} `eval echo ${LDFLAGS}` -o shlib.${SHLIBEXT} shlib.o &&
+ ${SHLD} `eval echo ${SHLD_FLAGS} ` -o shlib.${SHLIBEXT} shlib.o &&
ac_cv_shlib_works=yes
rm -f shlib.${SHLIBEXT} shlib.o
])
@@ -194,4 +181,9 @@ if test $ac_cv_shlib_works = no; then
fi
fi
-
+AC_ARG_ENABLE(dso,
+[ --enable-dso Enable building internal libraries as DSO's (experimental)],
+[ if test x$enable_dso != xyes; then
+ BLDSHARED=false
+ fi],
+[BLDSHARED=false])
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index fae5a4761c..5309adea1d 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -139,13 +139,12 @@ INSTALL_LINK_FLAGS=$devld_install
LD=$self->{config}->{LD}
LDFLAGS=$self->{config}->{LDFLAGS} -L\$(builddir)/bin
-STLD=$self->{config}->{AR}
-STLD_FLAGS=-rc
+STLD=$self->{config}->{STLD}
+STLD_FLAGS=$self->{config}->{STLD_FLAGS}
-SHLD=$self->{config}->{CC}
-SHLD_FLAGS=$self->{config}->{LDSHFLAGS} $self->{config}->{LDFLAGS} -L\$(builddir)/bin
+SHLD=$self->{config}->{SHLD}
+SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin
SHLIBEXT=$self->{config}->{SHLIBEXT}
-DYNEXP=$self->{config}->{DYNEXP}
XSLTPROC=$self->{config}->{XSLTPROC}
@@ -393,7 +392,7 @@ sub Binary($$)
#
bin/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
- \@\$(CC) \$(DYNEXP) \$(LDFLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \$(INSTALL_LINK_FLAGS) \\
+ \@\$(LD) \$(LDFLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \$(INSTALL_LINK_FLAGS) \\
\$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
__EOD__
@@ -403,7 +402,7 @@ __EOD__
$self->output(<< "__EOD__"
$installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
- \@\$(CC) \$(DYNEXP) \$(LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \@\$(LD) \$(LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
\$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
__EOD__
diff --git a/source4/configure.ac b/source4/configure.ac
index 67a56aacd7..9bf9ef8665 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -54,13 +54,6 @@ m4_include(lib/appweb/config.m4)
m4_include(nsswitch/config.m4)
m4_include(libcli/config.m4)
-AC_ARG_ENABLE(dso,
-[ --enable-dso Enable building internal libraries as DSO's (experimental)],
-[ if test x$enable_dso != xyes; then
- BLDSHARED=false
- fi],
-[BLDSHARED=false])
-
#################################################
# add *_CFLAGS only for the real build
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"