*** empty log message ***
diff --git a/ChangeLog b/ChangeLog
index 373f482..afcf774 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+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
+	`-dlopen' usage.
+
+	* demo/dlmain.c: New file to demonstrate preloaded modules.
+
+	* ltmain.sh.in (link): Add `-dlopen' flag to preload dynamic
+ 	modules, even on static platforms.  Use `$NM' and
+	`$global_symbol_cmd' to extract symbols from required files.
+	(dlname): Delete dlname mode entirely.  It is rendered obsolete
+	because the `.la' file format is now a public interface.
+
+	* ltconfig.in (NM): New variable for BSD-compatible nm program.
+	(global_symbol_cmd): Pipeline to extract global symbols from the
+	nm output.
+
+	* ltmain.sh.in: The .la file header should depend on `ltmain.sh',
+ 	not `$PROGRAM'.
+	(link): Make sure $export_dynamic_flag is eval'ed before it is
+ 	used.
+
 Fri Jul 11 19:33:02 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
 	* libtool.spec: New Red Hat Package Manager specification file in
diff --git a/Makefile.am b/Makefile.am
index 90af84a..8164189 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@
 libtool: ltconfig
 	@echo 'WARNING: Warnings from ltconfig can be ignored. :-)'
 	CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
-	LD="$(LD)" LN_S="$(LN_S)" RANLIB="$(RANLIB)" \
+	LD="$(LD)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
 	$(srcdir)/ltconfig --srcdir=$(srcdir) $(pkgdatadir)/ltmain.sh
 
 libtoolize: libtoolize.in $(top_builddir)/config.status
diff --git a/NEWS b/NEWS
index 7754f7a..151c1c2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,14 @@
 NEWS - list of user-visible changes between releases of GNU libtool.
 
+New in 1.0a:
+* Bug fixes.
+* Full support for dynamically loaded modules, even on static-only
+  platforms, via a new `-dlopen' link flag.
+* New tests for a BSD-compatible `nm' program, required for dlopened
+  modules.
+* FIXME: Deleted `dlname' mode, now that the internal structure of `.la'
+  files is a public interface.
+
 New in 1.0:
 * Bug fixes.
 * Better configuration test to find the system linker.  The old test
diff --git a/TODO b/TODO
index 4c433c8..2239f42 100644
--- a/TODO
+++ b/TODO
@@ -17,6 +17,22 @@
 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.
+
 * Implement full multi-language support.  Currently, this is only for
 C++, but there are beginnings of this in the manual (Other Languages).
 This includes writing libtool not to be so dependent on the compiler
diff --git a/configure.in b/configure.in
index 52f41c8..d6ab960 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to create configure.
 AC_INIT(ltmain.sh.in)
-AM_INIT_AUTOMAKE(libtool,1.0)
+AM_INIT_AUTOMAKE(libtool,1.0a)
 
 pkgdatadir='${datadir}/libtool'
 AC_SUBST(pkgdatadir)
@@ -11,6 +11,7 @@
 AC_PROG_CC
 AC_PROG_RANLIB
 AM_PROG_LD
+AM_PROG_NM
 AC_PROG_LN_S
 
 AC_OUTPUT([Makefile doc/Makefile tests/Makefile])
diff --git a/demo/Makefile.am b/demo/Makefile.am
index c7d7a9e..d673842 100644
--- a/demo/Makefile.am
+++ b/demo/Makefile.am
@@ -13,7 +13,7 @@
 
 include_HEADERS = foo.h
 
-bin_PROGRAMS = hell hell.static
+bin_PROGRAMS = hell hell.static helldl
 
 # Build hell from main.c and libhello.la
 hell_SOURCES = main.c
@@ -24,6 +24,10 @@
 hell_static_LDADD = libhello.la
 hell_static_LDFLAGS = -static
 
+# Create a version of hell that does its own dlopening.
+helldl_SOURCES = dlmain.c
+helldl_LDFLAGS = -dlopen libhello.la
+
 TESTS = run.test
 
 # The following rules are only for the libtool demo and tests.
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 149b905..b26a076 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -2425,6 +2425,10 @@
 The name of the system library archiver.
 @end defvar
 
+@defvar CC
+The name of the C compiler used to configure libtool.
+@end defvar
+
 @defvar LD
 The name of the linker that libtool should use internally for reloadable
 linking and possibly shared libraries.
@@ -2436,6 +2440,17 @@
 @code{libtool}, and how that information is used in @code{ltmain.sh}.
 @end defvar
 
+@defvar NM
+The name of a BSD-compatible @code{nm} program, which produces listings
+of global symbols in one the following formats:
+
+@example
+@var{address} C @var{global-variable-name}
+@var{address} D @var{global-variable-name}
+@var{address} T @var{global-function-name}
+@end example
+@end defvar
+
 @defvar RANLIB
 Set to the name of the ranlib program, if any.
 @end defvar
@@ -2473,6 +2488,20 @@
 specific directory.
 @end defvar
 
+@defvar global_symbol_cmd
+A pipeline that takes the output of @var{NM}, and produces a listing of
+raw symbols followed by their C names.  For example:
+
+@example
+$ @kbd{$NM | $global_symbol_cmd}
+@var{symbol1} @var{C-symbol1}
+@var{symbol2} @var{C-symbol2}
+@var{symbol3} @var{C-symbol3}
+@dots{}
+$
+@end example
+@end defvar
+
 @defvar hardcode_action
 Either @samp{immediate} or @samp{relink}, depending on whether shared
 library paths can be hardcoded into executables before they are installed,
diff --git a/doc/platforms.texi b/doc/platforms.texi
index 9505907..bdae826 100644
--- a/doc/platforms.texi
+++ b/doc/platforms.texi
@@ -15,7 +15,7 @@
 i386-unknown-gnu0.0          gcc       0.5       ok
 i386-unknown-netbsd1.2       gcc       0.9g      ok
 i586-pc-linux-gnu1.3.20      gcc       1.0       ok
-i586-pc-linux-gnu2.0.16      gcc       1.0       ok
+i586-pc-linux-gnu2.0.16      gcc       1.0a      ok
 mips-sgi-irix5.3             cc        0.8       ok
 mips-sgi-irix5.3             gcc       0.8       ok
 mips-sgi-irix6.2             cc -32    0.9       ok
diff --git a/libtool.m4 b/libtool.m4
index f7d1d9b..e449e9a 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -24,9 +24,10 @@
 # serial 9 AM_PROG_LIBTOOL
 AC_DEFUN(AM_PROG_LIBTOOL,
 [AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_CC])
 AC_REQUIRE([AC_PROG_RANLIB])
+AC_REQUIRE([AC_PROG_CC])
 AC_REQUIRE([AM_PROG_LD])
+AC_REQUIRE([AM_PROG_NM])
 AC_REQUIRE([AC_PROG_LN_S])
 
 # Always use our own libtool.
@@ -69,7 +70,7 @@
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" RANLIB="$RANLIB" LN_S="$LN_S" \
+LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || AC_MSG_ERROR([libtool configure failed])
@@ -129,3 +130,36 @@
   ac_cv_prog_gnu_ld=no
 fi])
 ])
+
+# AM_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AM_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[case "$NM" in
+/*)
+  ac_cv_path_NM="$NM" # Let the user override the test with a path.
+  ;;
+*)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in /usr/ucb:$PATH:/bin; do
+    test -z "$ac_dir" && dir=.
+    if test -f $ac_dir/nm; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+        ac_cv_path_NM="$ac_dir/nm -B"
+      elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+        ac_cv_path_NM="$ac_dir/nm -p"
+      else
+        ac_cv_path_NM="$ac_dir/nm"
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+  ;;
+esac])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
+])
diff --git a/libtool.spec b/libtool.spec
index 4ca7628..ab5e1c7 100644
--- a/libtool.spec
+++ b/libtool.spec
@@ -1,6 +1,6 @@
 Summary: GNU libtool - shared library support for source packages
 Name: libtool
-Version: 1.0
+Version: 1.1
 Release: 1
 Copyright: GPL
 Group: Development/Build
diff --git a/ltconfig.in b/ltconfig.in
index 37b367d..19b5ba3 100755
--- a/ltconfig.in
+++ b/ltconfig.in
@@ -61,6 +61,7 @@
 old_CPPFLAGS="$CPPFLAGS"
 old_LD="$LD"
 old_LN_S="$LN_S"
+old_NM="$NM"
 old_RANLIB="$RANLIB"
 
 test -z "$AR" && AR=ar
@@ -607,7 +608,7 @@
   case "$host_os" in
   aix3*)
     allow_undefined_flag=unsupported
-    archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
+    archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
     # Note: this linker hardcodes the directories in LIBPATH if there
     # are no directories specified by -L.
     hardcode_minus_L=yes
@@ -615,7 +616,7 @@
 
   aix4*)
     allow_undefined_flag=unsupported
-    archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | 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
     ;;
@@ -708,6 +709,57 @@
 fi
 echo $ac_t "$ld_shlibs" 1>&6
 
+if test -z "$NM"; then
+  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+  case "$NM" in
+  /*) ;; # Let the user override the test with a path.
+  *)
+    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+    for ac_dir in /usr/ucb:$PATH:/bin; do
+      test -z "$ac_dir" && dir=.
+      if test -f $ac_dir/nm; then
+        # Check to see if the nm accepts a BSD-compat flag.
+        if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -B"
+        elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -p"
+	else
+          NM="$ac_dir/nm"
+	fi
+        break
+      fi
+    done
+    IFS="$ac_save_ifs"
+    test -z "$NM" && NM=nm
+    ;;
+  esac
+  echo "$ac_t$NM" 1>&6
+fi
+
+# 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*) ;;
+
+linux*)
+  global_symbol_pipe="sed '/^.* [BCDT] /!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
+  ;;
+esac
+
+if test -z "$global_symbol_pipe"; then
+  echo "$ac_t"no
+else
+  echo "$ac_t"yes
+fi
+
 # Check hardcoding attributes.
 echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
 hardcode_action=
@@ -925,7 +977,7 @@
 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 #
 # CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
-# LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
+# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
 #   $0$ltconfig_args
 #
 # Compiler and other test output produced by $progname, useful for
@@ -947,12 +999,18 @@
 # The archiver.
 AR='$AR'
 
+# The default C compiler.
+CC='$CC'
+
 # The linker used to build libraries.
 LD='$LD'
 
 # Whether we need hard or soft links.
 LN_S='$LN_S'
 
+# A BSD-compatible nm program.
+NM='$NM'
+
 # How to create reloadable object files.
 reload_flag='$reload_flag'
 reload_cmds='$reload_cmds'
@@ -997,6 +1055,9 @@
 # Commands used to finish a libtool library installation in a directory.
 finish_cmds='$finish_cmds'
 
+# Take the output of nm and produce a listing of raw symbols and C names
+global_symbol_pipe="$global_symbol_pipe"
+
 # How to strip a library file.
 striplib='$striplib'
 old_striplib='$old_striplib'
diff --git a/ltmain.sh.in b/ltmain.sh.in
index e438204..27b2433 100644
--- a/ltmain.sh.in
+++ b/ltmain.sh.in
@@ -158,9 +158,6 @@
     *rm)
       mode=uninstall
       ;;
-    *.la)
-      mode=dlname
-      ;;
     *)
       # Just use the default operation mode.
       if test -z "$mode"; then
@@ -295,6 +292,7 @@
     compile_shlibpath=
     finalize_shlibpath=
     deplibs=
+    dlfiles=
     export_dynamic=no
     hardcode_libdirs=
     install_libdir=
@@ -333,10 +331,22 @@
 	  ;;
 	esac
 
-	eval "$prev=\$arg"
-	prev=
-
-	continue
+	case "$prev" in
+        dlopen)
+	  if test -z "$dlfiles"; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$compile_command @SYMFILE@"
+	  fi
+	  dlfiles="$dlfiles $arg"
+          prev=
+          ;;
+        *)
+	  eval "$prev=\$arg"
+	  prev=
+	  continue
+          ;;
+        esac
       fi
 
       args="$args $arg"
@@ -345,10 +355,15 @@
       case "$arg" in
       -allow-undefined) allow_undefined=yes ;;
 
+      -dlopen)
+	prev=dlopen
+	continue
+	;;
+
       -export-dynamic)
 	export_dynamic=yes
-	compile_command="$compile_command $export_dynamic_flag"
-	finalize_command="$finalize_command $export_dynamic_flag"
+	compile_command="$compile_command "`eval echo "$export_dynamic_flag"`
+	finalize_command="$finalize_command "`eval echo "$export_dynamic_flag"`
 	continue
 	;;
 
@@ -421,7 +436,7 @@
 	old_library=
 
 	# Check to see that this really is a libtool archive.
-	if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
+	if egrep "^# Generated by ltmain.sh" $arg >/dev/null 2>&1; then :
 	else
 	  echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
 	  exit 1
@@ -621,6 +636,13 @@
 	exit 1
       fi
 
+      if test -n "$dlfiles"; then
+	echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
+	# Nullify the symbol file.
+	compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%%"`
+	finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%%"`
+      fi
+
       if test -z "$install_libdir"; then
 	echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
 	exit 1
@@ -794,6 +816,13 @@
 	echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
       fi
 
+      if test -n "$dlfiles"; then
+	echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2
+	# Nullify the symbol file.
+	compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%%"`
+	finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%%"`
+      fi
+
       if test -n "$install_libdir"; then
         echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
       fi
@@ -878,6 +907,116 @@
 	# Transform all the library objects into standard objects.
 	compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
 	finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
+	dlfiles=`echo "$dlfiles " | sed 's/\.lo /.o /g; s/ $//'`
+      fi
+
+      if test -n "$dlfiles"; then
+	if test -z "$global_symbol_pipe" || test -z "$NM"; then
+	  echo "$progname: not configured to extract global symbols from \`-dlopen' files" 1>&2
+	  exit 1
+	fi
+
+        # Discover the nlist of each of the dlfiles.
+	dlsyms="$objdir/${output}S.c"
+	nlist="$objdir/${output}.syms"
+
+	$run rm -f $nlist
+	for arg in $dlfiles; do
+	  pre_dlname=
+	  case "$arg" in
+	  *.a | *.o) pre_dlname="$arg" ;;
+	  *.la)
+	    # We already checked for libtool archive validity above.
+
+	    # Find the directory that the archive lives in.
+	    ltlib=`echo "$arg" | sed 's%^.*/%%'`
+	    dir=`echo "$arg" | sed 's%/[^/]*$%%'`
+	    test "X$dir" = "X$arg" && dir=.
+
+	    # Read the libtool archive.
+	    old_library=
+	    library_names=
+	    . $dir/$ltlib
+
+	    # Prefer the new library to the old one.
+	    if test -n "$library_names"; then
+	      set dummy $library_names
+	      pre_dlname="$2"
+	    else
+	      pre_dlname="$old_library"
+	    fi
+
+	    if test -f "$dir/$objdir/$pre_dlname"; then
+	      pre_dlname="$dir/$objdir/$pre_dlname"
+	    elif test -f "$dir/$pre_dlname"; then
+	      pre_dlname="$dir/$pre_dlname"
+	    else
+	      echo "$progname: cannot find \`$pre_dlname' in \`$dir/$objdir' or \`$dir'" 1>&2
+	      pre_dlname=
+	    fi
+	    ;;
+	  esac
+
+	  if test -z "$pre_dlname"; then
+	    echo "$progname: \`$arg' is not a dlopenable file" 1>&2
+	    exit 1
+	  fi
+
+	  echo "extracting global symbols from \`$pre_dlname'"
+	  $run eval "$NM $pre_dlname | $global_symbol_pipe >> $nlist"
+	done
+
+	# Parse the name list into a C file.
+	echo "creating $dlsyms"
+	if test -z "$run"; then
+          cat <<EOF > $dlsyms
+/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
+
+/* External symbol declarations for the compiler. */
+EOF
+	  if test -f "$nlist"; then
+	    # Prevent the only kind of circular reference mistake we can make.
+	    sed '/ dld_preloaded_symbols$/d; s/^.* \(.*\)$/extern char \1;/' < $nlist >> $dlsyms
+	  else
+	    echo "/* NONE */" >> $dlsyms
+	  fi
+
+	  cat <<\EOF >> $dlsyms
+
+#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
+
+	  if test -f "$nlist"; then
+	    sed 's/^\(.*\) \(.*\)$/  {"\1", \&\1},/' < $nlist >> $dlsyms
+	  fi
+
+          cat <<\EOF >> $dlsyms
+  {0},
+};
+EOF
+	fi
+	$run rm -f "$nlist"
+
+	# Now compile the dynamic symbol file.
+	$show "(cd $objdir && $CC -c ${output}S.c)"
+	$run eval "(cd $objdir && $CC -c ${output}S.c)" || exit $?
+
+	# Transform the symbol file into the correct name.
+	compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
+	finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
       fi
 
       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
@@ -973,7 +1112,7 @@
 #! /bin/sh
 
 # $output - temporary wrapper script for $objdir/$output
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
+# Generated by ltmain.sh - GNU $PACKAGE $VERSION
 #
 # The $output program cannot be directly executed until all the libtool
 # libraries that it depends on are installed.
@@ -1087,7 +1226,7 @@
       if test -z "$run"; then
 	cat > $output <<EOF
 # $output - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
+# Generated by ltmain.sh - GNU $PACKAGE $VERSION
 
 # The name that we can dlopen(3).
 dlname='$dlname'
@@ -1238,7 +1377,7 @@
 
       *.la)
 	# Check to see that this really is a libtool archive.
-	if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then :
+	if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then :
 	else
 	  echo "$progname: \`$file' is not a valid libtool archive" 1>&2
 	  echo "$help" 1>&2
@@ -1385,7 +1524,7 @@
 
       *)
 	# Do a test to see if this is really a libtool program.
-	if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
+	if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then
 	  # This variable tells wrapper scripts just to set variables rather
 	  # than running their programs.
 	  libtool_install_magic="$magic"
@@ -1499,58 +1638,6 @@
     exit 0
     ;;
 
-  # libtool dlname mode
-  dlname)
-    progname="$progname: dlname"
-    ltlibs="$nonopt"
-    for lib
-    do
-      ltlibs="$ltlibs $lib"
-    done
-
-    if test -z "$ltlibs"; then
-      echo "$progname: you must specify at least one LTLIBRARY" 1>&2
-      echo "$help" 1>&2
-      exit 1
-    fi
-
-    # Now check to make sure each one is a valid libtool library.
-    status=0
-    for lib in $ltlibs; do
-      dlname=
-      libdir=
-      library_names=
-
-      # Check to see that this really is a libtool archive.
-      if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
-      else
-        echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
-	status=1
-	continue
-      fi
-
-      # If there is no directory component, then add one.
-      case "$arg" in
-      */*) . $arg ;;
-      *) . ./$arg ;;
-      esac
-
-      if test -z "$libdir"; then
-        echo "$progname: \`$arg' contains no -rpath information" 1>&2
-        status=1
-      elif test -n "$dlname"; then
-	echo "$libdir/$dlname"
-      elif test -z "$library_names"; then
-        echo "$progname: \`$arg' is not a shared library" 1>&2
-        status=1
-      else
-        echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
-        status=1
-      fi
-    done
-    exit $status
-    ;;
-
   # libtool finish mode
   finish)
     progname="$progname: finish"
@@ -1613,7 +1700,7 @@
       case "$name" in
       *.la)
 	# Possibly a libtool archive, so verify it.
-	if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
+	if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then
 	  . $dir/$name
 
 	  # Delete the libtool libraries and symlinks.
@@ -1671,7 +1758,6 @@
 MODE must be one of the following:
 
       compile         compile a source file into a libtool object
-      dlname          print filenames to use to \`dlopen' libtool libraries
       finish          complete the installation of libtool libraries
       install         install libraries or executables
       link            create a library or an executable
@@ -1697,19 +1783,6 @@
 EOF
   ;;
 
-dlname)
-  cat <<EOF
-Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
-
-Print filenames to use to \`dlopen' libtool libraries.
-
-Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
-was linked using the \`-export-dynamic' option).
-
-The names to use are printed to standard output, one per line.
-EOF
-  ;;
-
 finish)
   cat <<EOF
 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
@@ -1750,6 +1823,7 @@
 The following components of LINK-COMMAND are treated specially:
 
   -allow-undefined  allow a libtool library to reference undefined symbols
+  -dlopen FILE      link in FILE and add its symbols to dld_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9a78ca5..92c9e2c 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 12 15:38:25 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
+
+	* demo-exec.test, demo-inst.test: Check the new helldl program,
+	too.
+
 Fri Jul 11 19:31:43 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
 	* nomode.test: New test to make sure there is correct behaviour
diff --git a/tests/demo-exec.test b/tests/demo-exec.test
index 841e149..286e8c5 100755
--- a/tests/demo-exec.test
+++ b/tests/demo-exec.test
@@ -21,13 +21,19 @@
 
 if ../demo/hell.static | grep 'Welcome to GNU Hell'; then :
 else
-  echo "$0: cannot execute ./hell.static" 1>&2
+  echo "$0: cannot execute ../demo/hell.static" 1>&2
   exit 1
 fi
 
 if ../demo/hell | grep 'Welcome to GNU Hell'; then :
 else
-  echo "$0: cannot execute ./hell" 1>&2
+  echo "$0: cannot execute ../demo/hell" 1>&2
+  exit 1
+fi
+
+if ../demo/helldl | grep 'Welcome to GNU Hell'; then :
+else
+  echo "$0: cannot execute ../demo/helldl" 1>&2
   exit 1
 fi
 
diff --git a/tests/demo-inst.test b/tests/demo-inst.test
index ac2309d..57e0551 100755
--- a/tests/demo-inst.test
+++ b/tests/demo-inst.test
@@ -42,4 +42,17 @@
   fi
   status=1
 fi
+
+if $prefix/bin/helldl | grep 'Welcome to GNU Hell'; then :
+else
+  echo "$0: cannot execute $prefix/bin/helldl" 1>&2
+
+  # Simple check to see if they are superuser.
+  if test -w /; then :
+  else
+    echo "You may need to run $0 as the superuser."
+  fi
+  status=1
+fi
+
 exit $status