summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-05 23:09:25 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-05 23:09:25 +0100
commit3ba8fbef29aabfcd78e1170fcbfcf7bc943af6f9 (patch)
treeaee434da1f67917b89118a9cbdd4afb857d3e315 /source3/lib
parent4c364e3078795ff38d55503c4351b2bf3bc9e6bc (diff)
downloadsamba-3ba8fbef29aabfcd78e1170fcbfcf7bc943af6f9.tar.gz
samba-3ba8fbef29aabfcd78e1170fcbfcf7bc943af6f9.tar.bz2
samba-3ba8fbef29aabfcd78e1170fcbfcf7bc943af6f9.zip
selftest: Use platform-specific equivalents of LD_LIBRARY_PATH for Samba4's smbtorture.
(This used to be commit 64ff1dad8664f14030c7d78c252d946216798a88)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/replace/libreplace_ld.m4167
1 files changed, 154 insertions, 13 deletions
diff --git a/source3/lib/replace/libreplace_ld.m4 b/source3/lib/replace/libreplace_ld.m4
index fd85ef9fc4..cb8e21434e 100644
--- a/source3/lib/replace/libreplace_ld.m4
+++ b/source3/lib/replace/libreplace_ld.m4
@@ -1,3 +1,23 @@
+#
+# This offers a nice overview how to build shared libraries on all platforms
+# http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
+#
+
+AC_DEFUN([AC_LIBREPLACE_STLD],
+[
+ AC_PATH_PROG(PROG_AR, ar)
+
+ STLD=${PROG_AR}
+
+ AC_SUBST(STLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_STLD_FLAGS],
+[
+ STLD_FLAGS="-rcs"
+ AC_SUBST(STLD_FLAGS)
+])
+
AC_DEFUN([AC_LD_EXPORT_DYNAMIC],
[
saved_LDFLAGS="$LDFLAGS"
@@ -67,48 +87,102 @@ case "$host_os" in
PICFLAG="-KPIC"
;;
*darwin*)
+ PICFLAG="-fno-common"
;;
esac
AC_SUBST(PICFLAG)
])
-AC_DEFUN([AC_LD_SHLDFLAGS],
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_LINKER],
+[
+ LD_SHLIB_LINKER="${CC}"
+
+ case "$host_os" in
+ *irix*)
+ LD_SHLIB_LINKER="${PROG_LD}"
+ ;;
+ esac
+
+ AC_SUBST(LD_SHLIB_LINKER)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_FLAGS],
[
- SHLD_FLAGS="-shared"
+ LD_SHLIB_FLAGS="-shared"
case "$host_os" in
*linux*)
- SHLD_FLAGS="-shared -Wl,-Bsymbolic"
+ LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic"
;;
*solaris*)
- SHLD_FLAGS="-G"
+ LD_SHLIB_FLAGS="-G"
if test "${GCC}" = "no"; then
## ${CFLAGS} added for building 64-bit shared
## libs using Sun's Compiler
- SHLD_FLAGS="-G \${CFLAGS}"
+ LD_SHLIB_FLAGS="-G \${CFLAGS}"
fi
;;
*sunos*)
- SHLD_FLAGS="-G"
+ LD_SHLIB_FLAGS="-G"
;;
*irix*)
- SHLD_FLAGS="-shared"
+ LD_SHLIB_FLAGS="-shared"
;;
*aix*)
- SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
+ LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
;;
*hpux*)
if test "${GCC}" = "yes"; then
- SHLD_FLAGS="-shared"
+ LD_SHLIB_FLAGS="-shared"
else
- SHLD_FLAGS="-b"
+ LD_SHLIB_FLAGS="-b"
fi
;;
+ *osf*)
+ LD_SHLIB_FLAGS="-shared"
+ ;;
*darwin*)
- SHLD_FLAGS="-dynamiclib"
+ LD_SHLIB_FLAGS="-dynamiclib -Wl,-search_paths_first"
;;
esac
+ AC_SUBST(LD_SHLIB_FLAGS)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG],
+[
+ LD_SHLIB_DISALLOW_UNDEF_FLAG=""
+
+ #
+ # TODO: enforce error not only warnings
+ #
+ # NOTE: -Wl,--no-allow-shlib-undefined isn't what we want...
+ # as it bails out on broken system libraries
+ #
+ case "$host_os" in
+ *osf*)
+ LD_SHLIB_DISALLOW_UNDEF_FLAG="-warning_unresolved"
+ ;;
+ *darwin*)
+ LD_SHLIB_DISALLOW_UNDEF_FLAG="-undefined error"
+ ;;
+ esac
+
+ AC_SUBST(LD_SHLIB_DISALLOW_UNDEF_FLAG)
+])
+
+AC_DEFUN([AC_LIBREPLACE_SHLD],
+[
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
+ SHLD="$LD_SHLIB_LINKER"
+ AC_SUBST(SHLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_SHLD_FLAGS],
+[
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG])
+ SHLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_DISALLOW_UNDEF_FLAG"
AC_SUBST(SHLD_FLAGS)
])
@@ -157,7 +231,7 @@ AC_DEFUN([AC_LD_SONAMEFLAG],
SONAMEFLAG="-Wl,-soname,"
;;
*hpux*)
- SONAMEFLAG="-Wl,+h "
+ SONAMEFLAG="-Wl,+h,"
;;
*osf*)
SONAMEFLAG="-Wl,-soname,"
@@ -166,7 +240,74 @@ AC_DEFUN([AC_LD_SONAMEFLAG],
SONAMEFLAG="-Wl,-soname,"
;;
*darwin*)
- SONAMEFLAG="-install_name "
+ SONAMEFLAG="#"
+ ;;
+ *aix*)
+ # Not supported
+ SONAMEFLAG="#"
;;
esac
])
+
+AC_DEFUN([AC_LIBREPLACE_MDLD],
+[
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
+ MDLD="$LD_SHLIB_LINKER"
+ AC_SUBST(MDLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG],
+[
+ LD_ALLOW_SHLIB_UNDEF_FLAG=""
+
+ case "$host_os" in
+ *linux*)
+ LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined"
+ ;;
+ *osf*)
+ LD_SHLIB_ALLOW_UNDEF_FLAG="-expect_unresolved '*'"
+ ;;
+ *darwin*)
+ LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup"
+ ;;
+ esac
+
+ AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG)
+])
+
+AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS],
+[
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
+ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG])
+ MDLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_ALLOW_UNDEF_FLAG"
+ AC_SUBST(MDLD_FLAGS)
+])
+
+AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR],
+[
+ case "$host_os" in
+ *linux*)
+ LIB_PATH_VAR=LD_LIBRARY_PATH
+ ;;
+ *solaris*)
+ LIB_PATH_VAR=LD_LIBRARY_PATH
+ ;;
+ *hpux*)
+ LIB_PATH_VAR=SHLIB_PATH
+ ;;
+ *osf*)
+ LIB_PATH_VAR=LD_LIBRARY_PATH
+ ;;
+ *aix*)
+ LIB_PATH_VAR=LIB_PATH
+ ;;
+ *irix*)
+ LIB_PATH_VAR=LD_LIBRARY_PATH
+ ;;
+ *darwin*)
+ LIB_PATH_VAR=DYLD_LIBRARY_PATH
+ ;;
+ esac
+
+ AC_SUBST(LIB_PATH_VAR)
+])