+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
# 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.
#include <stdio.h>
#include <string.h>
-void testlib(char *lib, char *alt)
+int testlib(char *lib)
{
lt_dlhandle handle;
int (*pfoo1)() = 0;
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");
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;
}
# 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
$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