* mdemo/main.c: removed hardcoded library names; link against -lm

* tests/mdemo-exec, tests/mdemo-inst: pass the library names
	to the program
This commit is contained in:
Thomas Tanner 1998-11-07 04:33:47 +00:00 committed by Alexandre Oliva
parent 986ef4cd72
commit 316ebb4d2d
5 changed files with 33 additions and 15 deletions

View File

@ -1,3 +1,9 @@
1998-11-07 Thomas Tanner <tanner@gmx.de>
* 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 <fraioli@dg-rtp.dg.com>
* README: Added DG/UX

View File

@ -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.

View File

@ -22,7 +22,7 @@ USA. */
#include <stdio.h>
#include <string.h>
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;
}

View File

@ -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

View File

@ -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