summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/check_ld.m426
-rw-r--r--source4/build/smb_build/makefile.pm9
2 files changed, 31 insertions, 4 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index c3b01551ab..eb1d9a7a1d 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -115,6 +115,8 @@ AC_LD_EXPORT_DYNAMIC
AC_LD_SHLDFLAGS
AC_LD_SHLIBEXT
AC_LD_SONAMEFLAG
+AC_LIBREPLACE_MDLD
+AC_LIBREPLACE_MDLD_FLAGS
#######################################################
# test whether building a shared library actually works
@@ -125,6 +127,11 @@ if test $BLDSHARED = true; then
AC_MSG_CHECKING([SHLD_FLAGS])
AC_MSG_RESULT([$SHLD_FLAGS])
+ AC_MSG_CHECKING([MDLD])
+ AC_MSG_RESULT([$MDLD])
+ AC_MSG_CHECKING([MDLD_FLAGS])
+ AC_MSG_RESULT([$MDLD_FLAGS])
+
AC_MSG_CHECKING([SHLIBEXT])
AC_MSG_RESULT([$SHLIBEXT])
AC_MSG_CHECKING([SONAMEFLAG])
@@ -137,12 +144,22 @@ if test $BLDSHARED = true; then
[ac_cv_shlib_works],[
ac_cv_shlib_works=no
# try building a trivial shared library
+ # TODO: also test SONAMEFLAG
${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/build/tests/shlib.c -o shlib.o &&
${SHLD} ${SHLD_FLAGS} -o shlib.${SHLIBEXT} shlib.o &&
ac_cv_shlib_works=yes
rm -f shlib.${SHLIBEXT} shlib.o
])
- if test $ac_cv_shlib_works = no; then
+ AC_CACHE_CHECK([whether building shared modules actually works],
+ [ac_cv_shmod_works],[
+ ac_cv_shmod_works=no
+ # try building a trivial shared library
+ ${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/build/tests/shlib.c -o shlib.o &&
+ ${MDLD} ${MDLD_FLAGS} -o shlib.${SHLIBEXT} shlib.o &&
+ ac_cv_shmod_works=yes
+ rm -f shlib.${SHLIBEXT} shlib.o
+ ])
+ if test $ac_cv_shlib_works = no -o $ac_cv_shmod_works = no; then
BLDSHARED=false
fi
fi
@@ -150,6 +167,8 @@ fi
if test $BLDSHARED != true; then
SHLD="shared-libraries-disabled"
SHLD_FLAGS="shared-libraries-disabled"
+ MDLD="shared-modules-disabled"
+ MDLD_FLAGS="shared-modules-disabled"
SHLIBEXT="shared_libraries_disabled"
SONAMEFLAG="shared-libraries-disabled"
PICFLAG=""
@@ -158,6 +177,11 @@ if test $BLDSHARED != true; then
AC_MSG_CHECKING([SHLD_FLAGS])
AC_MSG_RESULT([$SHLD_FLAGS])
+ AC_MSG_CHECKING([MDLD])
+ AC_MSG_RESULT([$MDLD])
+ AC_MSG_CHECKING([MDLD_FLAGS])
+ AC_MSG_RESULT([$MDLD_FLAGS])
+
AC_MSG_CHECKING([SHLIBEXT])
AC_MSG_RESULT([$SHLIBEXT])
AC_MSG_CHECKING([SONAMEFLAG])
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 1848ead4cd..887565f8a4 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -204,7 +204,10 @@ STLD_FLAGS=$self->{config}->{STLD_FLAGS}
SHLD=$self->{config}->{SHLD}
SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
-SHLD_UNDEF_FLAGS=$self->{config}->{SHLD_UNDEF_FLAGS}
+
+MDLD=$self->{config}->{MDLD}
+MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
+
SHLIBEXT=$self->{config}->{SHLIBEXT}
XSLTPROC=$self->{config}->{XSLTPROC}
@@ -355,9 +358,9 @@ __EOD__
$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
- \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \@\$(MDLD) \$(MDLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \$(SHLD_UNDEF_FLAGS)
+ \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
__EOD__
);