From 3790e88b96c5bf565dd984e9ee184590f3bd7d0e Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Tue, 22 May 2007 12:07:06 +0000 Subject: [PATCH] * tests/lt_dladvise.at: Use the lib prefix throughout for better portability - testing whether modules build and load without that prefix is not the domain of this test. Also, only run the test of the global hint with the depend module on hosts that can compile a module without passing -no-undefined in link mode. --- ChangeLog | 9 +++++++ tests/lt_dladvise.at | 59 ++++++++++++++++++++++++++++++++------------ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ed15040f..96e7b7020 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-22 Gary V. Vaughan + + * tests/lt_dladvise.at: Use the lib prefix throughout for + better portability - testing whether modules build and load + without that prefix is not the domain of this test. + Also, only run the test of the global hint with the depend + module on hosts that can compile a module without passing + -no-undefined in link mode. + 2007-05-10 Noah Misch * tests/duplicate_deps.at: Make the XFAIL unconditional, but diff --git a/tests/lt_dladvise.at b/tests/lt_dladvise.at index 7ee612730..5945c7408 100644 --- a/tests/lt_dladvise.at +++ b/tests/lt_dladvise.at @@ -93,7 +93,7 @@ hint_ext (void) if (lt_dladvise_init (&advise) || lt_dladvise_ext (&advise)) complain ("error setting advise ext"); - handle = moduleopen ("moddepend", advise); + handle = moduleopen ("libdepend", advise); if (handle) printf ("depend: %d\n", moduletest (handle, "g", "j")); @@ -111,7 +111,7 @@ hint_resident (void) if (lt_dladvise_init (&advise) || lt_dladvise_resident (&advise)) complain ("error setting advise resident"); - handle = moduleopen ("modresident.la", advise); + handle = moduleopen ("libresident.la", advise); if (handle) { @@ -139,7 +139,7 @@ hint_local (void) if (lt_dladvise_init (&advise) || lt_dladvise_local (&advise)) complain ("error setting advise local"); - handle = moduleopen ("modlocal.la", advise); + handle = moduleopen ("liblocal.la", advise); if (handle) { @@ -165,7 +165,7 @@ hint_global (void) if (lt_dladvise_init (&advise) || lt_dladvise_global (&advise)) complain ("error setting advise global"); - handle = moduleopen ("modglobal.la", advise); + handle = moduleopen ("libglobal.la", advise); if (handle) { @@ -268,25 +268,52 @@ depend: 5 : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"} CPPFLAGS="$CPPFLAGS $LTDLINCL" -LDFLAGS="$LDFLAGS" + +dlopenable='resident local global' + +# ------------------------------------------------------------------------- # +# The depend test makes no sense unless compiled without -no-undefined. By # +# not building the depend module in that case, when this test passes we can # +# be sure that hint_global() above, is being correctly informed those hosts # +# are reporting not able to accept the global hint to lt_dlopenadvise(). # +# ------------------------------------------------------------------------- # + +case $host_os in +cygwin*) + # These hosts do not support linking without -no-undefined + ;; +*) + dlopenable="$dlopen depend" + $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c moddepend.c + AT_CHECK([$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o libdepend.la \ + moddepend.lo -rpath /foo -avoid-version], [], [ignore], [ignore]) + ;; +esac + +# ------------------------------------------------------------------------- # +# Other modules can be tested correctly even when built with -no-undefined. # +# ------------------------------------------------------------------------- # + +LDFLAGS="$LDFLAGS -no-undefined" $CC $CPPFLAGS $CFLAGS -c main.c -for file in modresident modlocal modglobal moddepend; do - $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c - AT_CHECK([$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o $file.la \ - $file.lo -rpath /foo -avoid-version], [], [ignore], [ignore]) +for name in resident local global; do + $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c mod$name.c + AT_CHECK([$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o lib$name.la \ + mod$name.lo -rpath /foo -avoid-version], [], [ignore], [ignore]) done # TODO: test -dlpreopen for dlopen in -dlopen; do + + modules= + for module in $dlopenable; do + modules="${modules+$modules }$dlopen lib$module.la" + done + AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT \ - $dlopen modresident.la $dlopen modlocal.la $dlopen modglobal.la \ - $dlopen moddepend.la $LIBLTDL], - [], [ignore], [ignore]) - LT_AT_NOINST_EXEC_CHECK([./main], - [$dlopen modresident.la $dlopen modlocal.la $dlopen modglobal.la \ - $dlopen moddepend.la], - [], [expout], []) + $modules $LIBLTDL], [], [ignore], [ignore]) + LT_AT_NOINST_EXEC_CHECK([./main], [$modules], [], [expout], []) done AT_CLEANUP -- 2.47.3