]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
*** empty log message ***
authorGordon Matzigkeit <gord@gnu.ai.mit.edu>
Sun, 20 Jul 1997 05:03:16 +0000 (05:03 +0000)
committerGordon Matzigkeit <gord@gnu.org>
Sun, 20 Jul 1997 05:03:16 +0000 (05:03 +0000)
ChangeLog
Makefile.am
TODO
demo/Makefile.am
demo/dlmain.c
libtool.m4
ltconfig.in
ltmain.sh.in
tests/demo-exec.test
tests/demo-inst.test

index afcf774fc6818c2f2cd91158a0b2b323c0357624..6649b031ff2330186e8d35d13c2b9006a5bf1df7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+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
index 81641895fffedc43f015e904d20127314b235f6a..92f99ea1900f8f6fb0fbee3ccc83fb6f5b929f60 100644 (file)
@@ -18,7 +18,7 @@ MAINTAINERCLEANFILES = ltconfig ltmain.sh
 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
diff --git a/TODO b/TODO
index 2239f42c34496ea62b4bb3aea68d48ebef535c55..759067fe90e90e953ee12a6ce7a104bbfd42265d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -13,25 +13,8 @@ fixed in GCC.
 * 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).
index d673842039eb26c1e41d829f5b0a915e9af905bd..d7b8c00f478ba89b0299aebea32830cfe013a3ab 100644 (file)
@@ -1,4 +1,8 @@
 # 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
@@ -36,10 +40,26 @@ $(srcdir)/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 \
@@ -49,9 +69,11 @@ hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES)
          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 > $@"; \
index d61ffb976ba17eaa6f67f299b5c888a59fcc4755..3077962498b1229861a3efa744965ec91fd4204d 100644 (file)
@@ -37,7 +37,7 @@ main (int argc, char **argv)
   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)
@@ -67,15 +67,21 @@ main (int argc, char **argv)
        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;
 }
index e449e9a7f02ea00fa30c5cfde7ae5a8e5e4239bf..54b0225cb1163675c482c13d12b20a32538ce96a 100644 (file)
@@ -100,7 +100,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
       # 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
@@ -124,7 +124,7 @@ AM_PROG_LD_GNU
 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
index 19b5ba3d8ddf64c4453ce72cf37eb58276508d6f..d5e53614c4a4a446c458cc5c251f909d93df5551 100755 (executable)
@@ -1,7 +1,7 @@
 #! /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
@@ -35,6 +35,7 @@ PROGRAM=ltconfig
 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."
@@ -211,6 +212,7 @@ if test -z "$srcdir"; then
   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=
@@ -368,14 +370,13 @@ if test "$with_gcc" != yes || test -z "$CC"; then
   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
@@ -533,7 +534,7 @@ if test "$with_gnu_ld" != yes || test -z "$LD"; then
        # 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
@@ -599,7 +600,7 @@ if test "$with_gnu_ld" = yes; then
   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
@@ -616,7 +617,7 @@ else
 
   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
     ;;
@@ -738,27 +739,94 @@ 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*) ;;
+# 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
index 27b2433367fce7b10679545c3f3ad29e0dd4962e..eaac8d540965cc655189e232e1e78fa978a2022d 100644 (file)
@@ -284,11 +284,11 @@ if test -z "$show_help"; then
   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=
@@ -406,7 +406,7 @@ if test -z "$show_help"; then
        continue
        ;;
 
-      -*) cc="$cc $arg" ;; # Some other compiler flag.
+      -*) CC="$CC $arg" ;; # Some other compiler flag.
 
       *.o)
        # A standard object.
@@ -1000,7 +1000,7 @@ dld_preloaded_symbols[] =
 EOF
 
          if test -f "$nlist"; then
-           sed 's/^\(.*\) \(.*\)$/  {"\1", \&\1},/' < $nlist >> $dlsyms
+           sed 's/^\(.*\) \(.*\)$/  {"\1", \&\2},/' < $nlist >> $dlsyms
          fi
 
           cat <<\EOF >> $dlsyms
@@ -1133,7 +1133,6 @@ else
   # Try to get the absolute directory name.
   absdir=\`cd "\$thisdir" && pwd\`
   test -n "\$absdir" && thisdir="\$absdir"
-
   progdir="\$thisdir/$objdir"
   program="$output"
 
index 286e8c5c4bbbf96d33d84a890dfdb458998ad6ff..0babad1c97ac9dd4c3fc8c3300719a7d820479b5 100755 (executable)
@@ -31,7 +31,7 @@ else
   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
index 57e05517d37fde964def06e79bc3b6088373a296..281939f4e03d812008f84d43f050a4eca12212e7 100755 (executable)
@@ -43,7 +43,7 @@ else
   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