From: Thomas Tanner Date: Sat, 7 Nov 1998 04:33:47 +0000 (+0000) Subject: * mdemo/main.c: removed hardcoded library names; link against -lm X-Git-Tag: start~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=316ebb4d2d509e7988c51bd5292ca56368d3db51;p=thirdparty%2Flibtool.git * mdemo/main.c: removed hardcoded library names; link against -lm * tests/mdemo-exec, tests/mdemo-inst: pass the library names to the program --- diff --git a/ChangeLog b/ChangeLog index e335f35f3..d9a06a86e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1998-11-07 Thomas Tanner + + * mdemo/main.c: removed hardcoded library names; link against -lm + * tests/mdemo-exec, tests/mdemo-inst: pass the library names + to the program + 1998-11-07 Marc J. Fraioli * README: Added DG/UX diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index 52df8d8ec..0272e5b58 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -20,7 +20,7 @@ bin_PROGRAMS = hell hell.debug # Create a version of hell that does dlopen. hell_SOURCES = main.c ltdl.c -hell_LDFLAGS = $(LIBADD_DL) +hell_LDFLAGS = $(LIBADD_DL) -lm hell_DEPENDENCIES = libfoo1.la libfoo2.la # Create an easier-to-debug version of hell. diff --git a/mdemo/main.c b/mdemo/main.c index f9b0c748b..bf142f318 100644 --- a/mdemo/main.c +++ b/mdemo/main.c @@ -22,7 +22,7 @@ USA. */ #include #include -void testlib(char *lib, char *alt) +int testlib(char *lib) { lt_dlhandle handle; int (*pfoo1)() = 0; @@ -31,11 +31,9 @@ void testlib(char *lib, char *alt) int *pnothing = 0; handle = lt_dlopen(lib); - if (!handle) - handle = lt_dlopen(alt); if (!handle) { fprintf (stderr, "can't open library %s!\n", lib); - return; + return 1; } phello = lt_dlsym(handle, "hello"); pfoo1 = lt_dlsym(handle, "foo1"); @@ -74,19 +72,22 @@ void testlib(char *lib, char *alt) fprintf (stderr, "did not find the `foo' function\n"); lt_dlclose(handle); + return 0; } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { + int i; printf ("Welcome to *modular* GNU Hell!\n"); - testlib(".libs/libfoo1.so", ".libs/libfoo1.a"); - - testlib(".libs/libfoo2.so", ".libs/libfoo2.a"); + if (argc < 2) { + fprintf (stderr, "usage: %s libname [libname...]\n", argv[0]); + } + for (i = 1; i < argc; i++) + if (testlib(argv[i])) + return 1; return 0; } diff --git a/tests/mdemo-exec.test b/tests/mdemo-exec.test index a37da01c0..3a231a51a 100755 --- a/tests/mdemo-exec.test +++ b/tests/mdemo-exec.test @@ -19,14 +19,19 @@ fi # Check to see if the programs really run. echo "Executing uninstalled programs in ../mdemo" +old_library1=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/libfoo1.la` +old_library2=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/libfoo2.la` +dlname1=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/libfoo1.la` +dlname2=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/libfoo2.la` + status=0 -if ../mdemo/hell.debug| grep 'GNU Hell'; then : +if ../mdemo/hell.debug .libs/$old_library1 .libs/$old_library2; then : else echo "$0: cannot execute ../mdemo/hell.debug" 1>&2 status=1 fi -if ../mdemo/hell | grep 'GNU Hell'; then : +if ../mdemo/hell ../mdemo/.libs/$dlname1 ../mdemo/.libs/$dlname2; then : else echo "$0: cannot execute ../mdemo/hell" 1>&2 status=1 diff --git a/tests/mdemo-inst.test b/tests/mdemo-inst.test index e56fdd017..eb867141c 100755 --- a/tests/mdemo-inst.test +++ b/tests/mdemo-inst.test @@ -24,14 +24,20 @@ echo "= Running $make install in ../mdemo" $make install || exit 1 echo "= Executing installed programs" + +old_library1=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/libfoo1.la` +old_library2=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/libfoo2.la` +dlname1=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/libfoo1.la` +dlname2=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/libfoo2.la` + status=0 -if $prefix/bin/hell.debug | grep 'Welcome to GNU Hell'; then : +if $prefix/bin/hell.debug .libs/$old_library1 .libs/$old_library2; then : else echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2 status=1 fi -if $prefix/bin/hell | grep 'Welcome to GNU Hell'; then : +if $prefix/bin/hell $prefix/lib/$dlname1 $prefix/lib/$dlname2; then : else echo "$0: cannot execute $prefix/bin/hell" 1>&2