+Sat Jul 19 21:54:33 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+
+ * ltconfig.in (pipe_works): Check to make sure our guessed
+ global_symbol_pipe actually works.
+
+ * ltmain.sh.in (link): Revert change from Kenneth Albanowski. The
+ wrapper scripts are more reliable when they just use the argv[0]
+ value. Generally, when the argv[0] method doesn't work, the user
+ is trying to do something weird with an uninstalled binary, and
+ should try a different approach.
+
+ * ltconfig.in, ltmain.sh.in (CC): Always use `$CC' instead of
+ `$cc'. This fixes a FreeBSD bug. Reported by Chuck Robey, and
+ others.
+
+Mon Jul 14 22:26:15 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+
+ * ltmain.sh.in (link): In wrapper scripts, hardcode the current
+ directory to prevent phony argv[0] values from screwing up our
+ program. From Kenneth Albanowski.
+
+Sun Jul 13 19:14:32 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+
+ * Makefile.am (demo_distfiles): Add demo/dlmain.c to the
+ distribution.
+
Sat Jul 12 10:07:28 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* demo/Makefile.am: Add helldl, made from dlmain.c, to demostrate
demo_distfiles = demo/Makefile.in demo/Makefile.am demo/README \
demo/acinclude.m4 demo/aclocal.m4 \
demo/configure demo/configure.in demo/foo.c demo/foo.h \
- demo/hello.c demo/main.c demo/run.test
+ demo/dlmain.c demo/hello.c demo/main.c demo/run.test
# These are required by libtoolize.
pkgdata_SCRIPTS = config.guess config.sub ltconfig
* We could use libtool object convenience libraries that resolve
symbols to be included in a libtool archive.
-* Delete dlname mode, and integrate DLD support. We need a way for
-different major versions of the same .la to coexist. This also
-involves writing a better uninstall mode, so that nothing breaks.
-
-Semantics:
-
-# Just link a library normally.
-./libtool gcc -o testld testld.o libhello.la -lm
-
-# Again, link normally.
-./libtool gcc -o testld -export-dynamic testld.o libhello.la -lm
-
-# This time, preload the symbols from the specified library (or
-# object), as well as normal linking.
-./libtool gcc -o testld -export-dynamic testld.o -dlopen libhello.la -lm
-dlfiles="$dlfiles libhello.la"
-
-This defines an array called `dld_preloaded_symbols', that can be used
-to lookup symbols already present in the running executable.
+* Add a flag to make sure at least a null dld_preloaded_symbols is
+generated.
* Implement full multi-language support. Currently, this is only for
C++, but there are beginnings of this in the manual (Other Languages).
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
+#
+# NOTE: Don't forget that in the libtool distribution, files in this
+# directory are distributed by the demo_distfiles variable in the top
+# level Makefile.
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = $(TESTS) acinclude.m4
rm -f $(srcdir)/acinclude.m4
ln -s ../libtool.m4 $(srcdir)/acinclude.m4
+# Don't build helldl on unsupported platforms.
+helldl: $(helldl_OBJECTS) $(helldl_DEPENDENCIES)
+ @rm -f helldl helldlT
+ @eval "`egrep '^global_symbol_pipe=' libtool`"; \
+ if test -z "$$global_symbol_pipe"; then \
+ echo 'creating helldl (-dlopen is unsupported)'; \
+ echo "#! /bin/sh" > helldlT; \
+ echo "echo '-dlopen is unsupported'" >> helldlT; \
+ chmod +x helldlT; \
+ mv -f helldlT helldl; \
+ else \
+ echo '$(LINK) $(helldl_LDFLAGS) $(helldl_OBJECTS) $(helldl_LDADD) $(LIBS)'; \
+ $(LINK) $(helldl_LDFLAGS) $(helldl_OBJECTS) $(helldl_LDADD) $(LIBS); \
+ fi
+
# Test programs to see what gets hardcoded.
.PHONY: hardcode
hardcode: $(hardcode_tests)
hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+ @rm -f hc-direct
@shlib=./.libs/libhello.a; \
eval "`egrep '^library_names' libhello.la`"; \
for lib in $$library_names; do \
eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS)"
hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+ @rm -f hc-minusL
$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./.libs -lhello $(LIBS)
hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+ @rm -f hc-libpath
@echo "You may ignore any linking errors from the following command:"
@eval `egrep -e '^shlibpath_var=' ./libtool`; \
echo "$$shlibpath_var=./.libs $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) || echo unsupported > $@"; \
int (*phello)() = 0;
int *pnothing = 0;
- printf ("Welcome to dynamic GNU Hell!\n");
+ printf ("Welcome to GNU Hell **dynamically**!\n");
s = dld_preloaded_symbols;
while (s->name)
return 1;
}
else
- fprintf (stderr, "did not find the `foo' function\n");
+ {
+ fprintf (stderr, "did not find the `foo' function\n");
+ return 2;
+ }
if (phello)
{
if ((*phello) () != HELLO_RET)
- return 2;
+ return 3;
}
else
- fprintf (stderr, "did not find the `hello' function\n");
+ {
+ fprintf (stderr, "did not find the `hello' function\n");
+ return 4;
+ }
return 0;
}
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" = yes && break
else
test "$with_gnu_ld" != yes && break
AC_DEFUN(AM_PROG_LD_GNU,
[AC_CACHE_CHECK([whether we are using GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' > /dev/null; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
#! /bin/sh
# ltconfig - Create a system-specific libtool.
-# When updating this script, search for LINENUM and fix line number refs.
+# When updating this script, search for LINENO and fix line number refs.
# @configure_input@
# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
PACKAGE=@PACKAGE@
VERSION=@VERSION@
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
rm="rm -f"
help="Try \`$progname --help' for more information."
test "$srcdir" = "$ltmain" && srcdir=.
fi
+trap "$rm conftest*; exit 1" 1 2 15
if test "$verify_host" = yes; then
# Check for config.guess and config.sub.
ac_aux_dir=
with_gcc=no
echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
- trap "$rm conftest.c; exit 1" 1 2 15
$rm conftest.c
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
- # LINENUM
+ # LINENO
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
with_gcc=yes
fi
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
- if "$LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
+ if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" = yes && break
else
test "$with_gnu_ld" != yes && break
esac
if test "$ld_shlibs" = yes; then
- archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
+ archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
export_dynamic_flag='${wl}-export-dynamic'
fi
aix4*)
allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
+ archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
hardcode_direct=yes
hardcode_minus_L=yes
;;
# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-global_symbol_pipe=
-# WARNING: these filters need to be compatible with GNU nm, so they should
-# accept at least [BDT].
-case "$host_os" in
-aix*)
- global_symbol_pipe="sed '/^.* [BCDT] [^.]/!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
- ;;
-# These platforms may need to strip leading underscores from C symbols.
-linux-gnuoldld*) ;;
+# This is a sane default that works on at least a few old systems.
+# [It comes from Ultrix. What could be older than Ultrix?!! ;)]
+global_symbol_pipe="sed '/^.* [BCDEGRST] /!d; s/^.* [BCDEGRST] \(.*\)$/\1 \1/'"
-linux*)
- global_symbol_pipe="sed '/^.* [BCDT] /!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
- ;;
-esac
+# Take a first stab at what the pipe should be.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ # We're using GNU nm.
+ global_symbol_pipe="sed '/^.* [BCDGIST] /!d; s/^.* [BCDGIST] \(.*\)$/\1 \1/'"
+else
+ # It's the system nm.
+ case "$host_os" in
+ aix*)
+ # Delete symbols that begin with a dot.
+ global_symbol_pipe="sed '/^.* [BCDT] [^.]/!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
+ ;;
+ solaris2*)
+ global_symbol_pipe="sed '/^.* [BDT] /!d; s/^.* [BDT] \(.*\)$/\1 \1/'"
+ ;;
+ esac
+fi
-if test -z "$global_symbol_pipe"; then
- echo "$ac_t"no
+# Check to see that the pipe works correctly.
+pipe_works=no
+rm -f conftest*
+cat > conftest.c <<EOF
+char nm_test_var;
+void nm_test_func(){}
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+# LINENO
+if { (eval echo $progname:751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
+ # Now try to grab the symbols.
+ if { echo "$progname:752: eval \"$NM conftest.o | $global_symbol_pipe > conftest.nm\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > conftest.nm 2>&5"; } && test -s conftest.nm; then
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' conftest.nm >/dev/null; then
+ if egrep ' nm_test_func$' conftest.nm >/dev/null; then
+ # Now generate the symbol file.
+ sed 's/^.* \(.*\)$/extern char \1;/' < conftest.nm > conftest.c
+ cat <<\EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define __ptr_t void *
+#else
+# define __ptr_t char *
+#endif
+
+/* The mapping between symbol names and symbols. */
+struct {
+ char *name;
+ __ptr_t address;
+}
+dld_preloaded_symbols[] =
+{
+EOF
+ sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < conftest.nm >> conftest.c
+ cat <<\EOF >> conftest.c
+ {0},
+};
+EOF
+ # Now try linking the two files.
+ mv conftest.o conftestm.o
+ save_LIBS="$LIBS"
+ LIBS='conftestm.o'
+ if { (eval echo configure:807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ LIBS="$save_LIBS"
+ fi
+ else
+ echo "cannot find nm_test_func in conftest.nm" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in conftest.nm" >&5
+ fi
else
- echo "$ac_t"yes
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
fi
+rm -f conftest*
+
+# Don't use the global_symbol_pipe unless it works.
+echo "$ac_t$pipe_works" 1>&6
+test "$pipe_works" = yes || global_symbol_pipe=
# Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
link)
progname="$progname: link"
# Go through the arguments, transforming them on the way.
- cc="$nonopt"
- args="$cc"
+ CC="$nonopt"
+ args="$CC"
allow_undefined=no
- compile_command="$cc"
- finalize_command="$cc"
+ compile_command="$CC"
+ finalize_command="$CC"
compile_shlibpath=
finalize_shlibpath=
deplibs=
continue
;;
- -*) cc="$cc $arg" ;; # Some other compiler flag.
+ -*) CC="$CC $arg" ;; # Some other compiler flag.
*.o)
# A standard object.
EOF
if test -f "$nlist"; then
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\1},/' < $nlist >> $dlsyms
+ sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < $nlist >> $dlsyms
fi
cat <<\EOF >> $dlsyms
# Try to get the absolute directory name.
absdir=\`cd "\$thisdir" && pwd\`
test -n "\$absdir" && thisdir="\$absdir"
-
progdir="\$thisdir/$objdir"
program="$output"
exit 1
fi
-if ../demo/helldl | grep 'Welcome to GNU Hell'; then :
+if ../demo/helldl | egrep -e '(Welcome to GNU Hell|unsupported)'; then :
else
echo "$0: cannot execute ../demo/helldl" 1>&2
exit 1
status=1
fi
-if $prefix/bin/helldl | grep 'Welcome to GNU Hell'; then :
+if $prefix/bin/helldl | egrep -e '(Welcome to GNU Hell|unsupported)'; then :
else
echo "$0: cannot execute $prefix/bin/helldl" 1>&2