summaryrefslogtreecommitdiffstats
path: root/source3/configure.in
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2009-10-20 01:13:56 +0200
committerKarolin Seeger <kseeger@samba.org>2009-11-26 11:39:34 +0100
commit49b768a7f6f0ac0c889417ad1f459229e056f2cb (patch)
tree5a14392cdb8f05904ba9ab4535373a460f36e0c1 /source3/configure.in
parent19a2b0221e57266e2fb658b03494b3d884a5778f (diff)
downloadsamba-49b768a7f6f0ac0c889417ad1f459229e056f2cb.tar.gz
samba-49b768a7f6f0ac0c889417ad1f459229e056f2cb.tar.xz
samba-49b768a7f6f0ac0c889417ad1f459229e056f2cb.zip
s3: make unresolved symbols in libs throw errors
except for the Samba internal plugins unresolved symbol references should not show up in shared libraries. For historical reasons it's the default behaviour of linkers to ignore those in shared libs. We use -z defs (alias --no-undefined) to not ignore them in shared libs. (cherry picked from commit 7aaec4fe68ce23b0b5880badac378f5ca4386389)
Diffstat (limited to 'source3/configure.in')
-rw-r--r--source3/configure.in30
1 files changed, 27 insertions, 3 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 8781cce9945..07fbbb70946 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -377,6 +377,10 @@ esac
DYNEXP=
AC_SUBST(DYNEXP)
+LDSHFLAGS_Z_DEFS=
+AC_SUBST(LDSHFLAGS_Z_DEFS)
+LDSHFLAGS_Z_NODEFS=
+AC_SUBST(LDSHFLAGS_Z_NODEFS)
dnl Add modules that have to be built by default here
dnl These have to be built static:
@@ -1507,10 +1511,9 @@ DSO_EXPORTS=""
AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
esac
BLDSHARED="true"
+ LDSHFLAGS="-shared -Wl,-Bsymbolic"
if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
- LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
- else
- LDSHFLAGS="-shared -Wl,-Bsymbolic"
+ LDSHFLAGS_Z_NODEFS="-Wl,--allow-shlib-undefined"
fi
DYNEXP="-Wl,--export-dynamic"
PICFLAG="-fPIC"
@@ -1722,6 +1725,27 @@ if test x"${ac_cv_prog_gnu_ld}" = x"yes"; then
LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags"
fi
+# for historical reasons almost all linkers don't complain about unresolved
+# symbols in shared libs. Except for the internal samba modules we want to get
+# errors when we produce a shared lib with unresolved symbols. On some
+# platforms unresolved symbols might be intended, so we might have to add
+# platform specific exceptions here.
+
+for flags in "-Wl,-z,defs" "-error_unresolved" "-Wl,-error_unresolved" ; do
+ saved_ldflags="$LDFLAGS"
+ AC_MSG_CHECKING([if $flags works])
+ LDFLAGS="$flags $saved_ldflags"
+ AC_TRY_LINK([],[],
+ [AC_MSG_RESULT([yes])
+ LDSHFLAGS_Z_DEFS=$flags
+ ldshflags_z_defs_found=yes],
+ AC_MSG_RESULT([no]))
+ LDFLAGS=$saved_ldflags
+ test x"$ldshflags_z_defs_found" = xyes && break
+done
+
+AC_MSG_CHECKING([LDSHFLAGS_Z_DEFS])
+AC_MSG_RESULT([$LDSHFLAGS_Z_DEFS])
AC_MSG_CHECKING([LDFLAGS])
AC_MSG_RESULT([$LDFLAGS])
AC_MSG_CHECKING([DYNEXP])