summaryrefslogtreecommitdiff
path: root/source3
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
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')
-rw-r--r--source3/Makefile.in7
-rw-r--r--source3/configure.in2
-rw-r--r--source3/lib/replace/libreplace_ld.m4167
3 files changed, 161 insertions, 15 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 53f7bf3dc4..ec28b3bb22 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -21,6 +21,7 @@ smbtorture4_path=@smbtorture4_path@
LIBS=@LIBS@
CC=@CC@
SHLD=@SHLD@
+LIB_PATH_VAR=@LIB_PATH_VAR@
## Dynamic shared libraries build settings
DSO_EXPORTS_CMD=-Wl,--version-script,$(srcdir)/exports/`basename $@ | sed 's/@SHLIBEXT@$$/syms/'`
@@ -2145,16 +2146,18 @@ test_pam_modules: pam_modules
|| exit 1; \
done
+
##
## Targets for 'make test'
##
test: all torture timelimit
@echo Running Test suite
- @PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}"
+ @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}"
valgrindtest: all torture timelimit
@echo Running Test suite with valgrind
- @NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \
+ @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared \
+ NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \
WINBINDD_VALGRIND="xterm -n winbindd -e valgrind -q --db-attach=yes --num-callers=30" \
SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/st/valgrind.log" \
diff --git a/source3/configure.in b/source3/configure.in
index 1906d74505..0036133230 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -2037,6 +2037,8 @@ AC_MSG_RESULT([$PICFLAG])
AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension])
+AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
+
################
AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
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)
+])