]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in: remove duplicates from deplibs, handle
authorThomas Tanner <tanner@ffii.org>
Wed, 23 Feb 2000 23:10:05 +0000 (23:10 +0000)
committerThomas Tanner <tanner@gmx.de>
Wed, 23 Feb 2000 23:10:05 +0000 (23:10 +0000)
  interdependent libraries (e.g. -la -lb -la),
  this requires adding deplibs in reverse order

* ltmain.in: link dlpreopened libraries before other libraries
  (reported by Pavel Roskin)
* mdemo/Makefile.am: build and link libsub.la
* mdemo/sub.c: new file used by both dlopened modules
* mdemo/foo*: use sub() defined in libsub
* tests/dryrun.test: build libsub.la

* mdemo/Makefile.am: always link mdemo.static with -static
* mdemo/configure.in: ditto

* ltmain.in: fix dlopen/dlpreopening of objects

* ltmain.in (ILD): fix misplaced `continue' in -R* argument handler

* ltmain.in: merge duplicated code of clean and uninstall mode

* libtool.m4: recognize powerpc*linux* (reported by
  Dirk A. Mueller <dmuell@gmx.net>)

ChangeLog
libtool.m4
ltmain.in
mdemo/Makefile.am
mdemo/configure.in
mdemo/foo.h
mdemo/foo1.c
mdemo/foo2.c
mdemo/sub.c [new file with mode: 0644]
tests/dryrun.test

index 25c499ab46e1325b6623c137fee384514c5662af..bc75d58a797d70cc4b2b93bb79005d017589c346 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2000-02-23  Thomas Tanner  <tanner@ffii.org>
+
+       * ltmain.in: remove duplicates from deplibs, handle
+         interdependent libraries (e.g. -la -lb -la),
+         this requires adding deplibs in reverse order
+         
+       * ltmain.in: link dlpreopened libraries before other libraries
+         (reported by Pavel Roskin)
+       * mdemo/Makefile.am: build and link libsub.la
+       * mdemo/sub.c: new file used by both dlopened modules
+       * mdemo/foo*: use sub() defined in libsub
+       * tests/dryrun.test: build libsub.la
+
+       * mdemo/Makefile.am: always link mdemo.static with -static
+       * mdemo/configure.in: ditto
+
+       * ltmain.in: fix dlopen/dlpreopening of objects
+       
+       * ltmain.in (ILD): fix misplaced `continue' in -R* argument handler
+               
+       * ltmain.in: merge duplicated code of clean and uninstall mode
+
+       * libtool.m4: recognize powerpc*linux* (reported by
+         Dirk A. Mueller <dmuell@gmx.net>)
+
 2000-02-23  Gary V. Vaughan  <gary@oranda.demon.co.uk>
 
        * ltconfig.in (old_MAGIC, old_STRIP, old_reload_flag,
index ab7514f674ec29e0e5e2e8ba0e19d3ae7a589b36..c380eae8517fd90d9b0f2bf1b11b61fd72cacf1c 100644 (file)
@@ -534,7 +534,7 @@ irix5* | irix6*)
 # This must be Linux ELF.
 linux-gnu*)
   case "$host_cpu" in
-  alpha* | i*86 | sparc* )
+  alpha* | i*86 | powerpc* | sparc* )
     lt_cv_deplibs_check_method=pass_all ;;
   *)
     # glibc up to 2.1.1 does not perform some relocations on ARM
index e5ccf7a3a7b1717aa07502958acb4c682c8b6df0..37cfb3e6a043690aadfcd19ae77c9d916cfd92fc 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -841,6 +841,7 @@ compiler."
              dlprefiles="$dlprefiles $arg"
            fi
            prev=
+           continue
            ;;
          esac
          ;;
@@ -1285,7 +1286,16 @@ compiler."
       linkmode=prog ;;
     esac
 
-    libs="$deplibs"
+    specialdeplibs=
+    libs=
+    # Find all interdependent deplibs that
+    # are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      case "$libs " in
+      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+      esac
+      libs="$libs $deplib"
+    done
     deplibs=
     newdependency_libs=
     uninst_path= # paths that contain uninstalled libtool libraries
@@ -1305,6 +1315,8 @@ compiler."
        done
        ;;
     prog)
+       compile_deplibs=
+       finalize_deplibs=
        alldeplibs=no
        newdlfiles=
        newdlprefiles=
@@ -1322,6 +1334,11 @@ compiler."
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
        esac
       fi
+      if test $pass = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
       for deplib in $libs; do
        lib=
        found=no
@@ -1342,11 +1359,11 @@ compiler."
          done
          if test "$found" != yes; then
            if test "$linkmode,$pass" = "prog,link"; then
-             compile_command="$compile_command $deplib"
-             finalize_command="$finalize_command $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
            else
-             deplibs="$deplibs $deplib"
-             test $linkmode = lib && newdependency_libs="$newdependency_libs $deplib"
+             deplibs="$deplib $deplibs"
+             test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
            fi
            continue
          fi
@@ -1354,22 +1371,17 @@ compiler."
        -L*)
          case $linkmode in
          lib)
-           case "$deplibs " in
-           *" $deplib "*) ;;
-           *)
-             deplibs="$deplibs $deplib"
-             newdependency_libs="$newdependency_libs $deplib"
-             new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-             ;;
-           esac
+           deplibs="$deplib $deplibs"
+           newdependency_libs="$deplib $newdependency_libs"
+           new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
            ;;
          prog)
            if test $pass = scan; then
-             deplibs="$deplibs $deplib"
+             deplibs="$deplib $deplibs"
              new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
            else
-             compile_command="$compile_command $deplib"
-             finalize_command="$finalize_command $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
            fi
            ;;
          *)
@@ -1386,8 +1398,8 @@ compiler."
            *" $dir "*) ;;
            *) xrpath="$xrpath $dir" ;;
            esac
-           continue
          fi
+         continue
          ;;
        *.la) lib="$deplib" ;;
        *.$libext)
@@ -1403,22 +1415,35 @@ compiler."
              echo
              echo "*** Warning: Linking the shared library $output against the"
              echo "*** static library $deplib is not portable!"
-             deplibs="$deplibs $deplib"
+             deplibs="$deplib $deplibs"
            fi
            continue
            ;;
          prog)
-           if test $pass = scan; then
-             deplibs="$deplibs $deplib"
+           if test $pass != link; then
+             deplibs="$deplib $deplibs"
            else
-             compile_command="$compile_command $deplib"
-             finalize_command="$finalize_command $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
            fi
            continue
            ;;
          esac
          ;;
-       *.lo | *.$objext) continue ;;
+       *.lo | *.$objext)
+         if test $linkmode = prog; then
+           if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             newdlprefiles="$newdlprefiles $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             newdlfiles="$newdlfiles $deplib"
+           fi
+         fi
+         continue
+         ;;
        %DEPLIBS%)
          alldeplibs=yes
          continue
@@ -1545,24 +1570,31 @@ compiler."
 
        if test $linkmode = prog && test $pass != link; then
          new_lib_search_path="$new_lib_search_path $ladir"
-         deplibs="$deplibs $lib"
+         deplibs="$lib $deplibs"
 
          linkalldeplibs=no
          if test "$link_all_deplibs" != no || test "$fast_install" != no || \
             test "$build_libtool_libs" = no || test -z "$library_names"; then
            linkalldeplibs=yes
-         else
-           # Need to hardcode shared library paths
-           # or/and link against static libraries
-           newdependency_libs="$newdependency_libs $dependeny_libs"
          fi
 
+         tmp_libs=
          for deplib in $dependency_libs; do
            case "$deplib" in
            -L*) new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
            esac
            # Need to link against all dependency_libs?
-           test $linkalldeplibs = yes && deplibs="$deplibs $deplib"
+           if test $linkalldeplibs = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           case "$tmp_libs " in
+           *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+           esac
+           tmp_libs="$tmp_libs $deplib"
          done
          continue
        fi
@@ -1572,11 +1604,18 @@ compiler."
          convenience="$convenience $dir/$old_library"
          old_convenience="$old_convenience $dir/$old_library"
          if test $linkmode = lib; then
-           deplibs="$deplibs $dir/$old_library"
-           newdependency_libs="$newdependency_libs $dependency_libs"
+           deplibs="$dir/$old_library $deplibs"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             newdependency_libs="$deplib $newdependency_libs"
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+             tmp_libs="$tmp_libs $deplib"
+           done
          elif test "$linkmode,$pass" = "prog,link"; then
-           compile_command="$compile_command $dir/$old_library"
-           finalize_command="$finalize_command $dir/$old_library"
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
          fi
          continue
        fi
@@ -1754,28 +1793,18 @@ compiler."
              esac
            fi
            if test $linkmode = prog; then
-             if test -n "$add_dir"; then
-               case "$compile_command " in
-               *" $add_dir "*) ;;
-               *) compile_command="$compile_command $add_dir" ;;
-               esac
-             fi
-             test -n "$add" && compile_command="$compile_command $add"
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
            else
-             if test -n "$add_dir"; then
-               case "$deplibs " in
-               *" $add_dir "*) ;;
-               *) deplibs="$deplibs $add_dir" ;;
-               esac
-             fi
-             test -n "$add" && deplibs="$deplibs $add"
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
              if test "$hardcode_direct" != yes && \
                 test "$hardcode_minus_L" != yes && \
                 test "$hardcode_shlibpath_var" = yes; then
-                 case ":$finalize_shlibpath:" in
-                 *":$libdir:"*) ;;
-                 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-                 esac
+               case ":$finalize_shlibpath:" in
+               *":$libdir:"*) ;;
+               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+               esac
              fi
            fi
          fi
@@ -1803,21 +1832,11 @@ compiler."
            fi
 
            if test $linkmode = prog; then
-             if test -n "$add_dir"; then
-               case "$finalize_command " in
-               *" $add_dir "*) ;;
-               *) finalize_command="$finalize_command $add_dir" ;;
-               esac
-             fi
-             test -n "$add" && finalize_command="$finalize_command $add"
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
            else
-             if test -n "$add_dir"; then
-               case "$deplibs " in
-               *" $add_dir "*) ;;
-               *) deplibs="$deplibs $add_dir" ;;
-               esac
-             fi
-             test -n "$add" && deplibs="$deplibs $add"
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add deplibs"
            fi
          fi
        elif test $linkmode = prog; then
@@ -1826,19 +1845,11 @@ compiler."
          # shared platforms.
          if test "$hardcode_direct" != unsupported; then
            test -n "$old_library" && linklib="$old_library"
-           compile_command="$compile_command $dir/$linklib"
-           finalize_command="$finalize_command $dir/$linklib"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
          else
-           case "$compile_command " in
-           *" -L$dir "*) ;;
-           *) compile_command="$compile_command -L$dir";;
-           esac
-           compile_command="$compile_command -l$name"
-           case "$finalize_command " in
-           *" -L$dir "*) ;;
-           *) finalize_command="$finalize_command -L$dir";;
-           esac
-           finalize_command="$finalize_command -l$name"
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
          fi
        elif test "$build_libtool_libs" = yes; then
          # Not a shared library
@@ -1855,7 +1866,7 @@ compiler."
          else
            convenience="$convenience $dir/$old_library"
            old_convenience="$old_convenience $dir/$old_library"
-           deplibs="$deplibs $dir/$old_library"
+           deplibs="$dir/$old_library $deplibs"
            link_static=yes
          fi
        fi
@@ -1881,9 +1892,16 @@ compiler."
 
          new_lib_search_path="$new_lib_search_path $absdir"
          # Link against this library
-         test "$link_static" = no && newdependency_libs="$newdependency_libs $abs_ladir/$laname"
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
          # ... and its dependency_libs
-         newdependency_libs="$newdependency_libs $dependency_libs"
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           case "$tmp_libs " in
+           *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+           esac
+           tmp_libs="$tmp_libs $deplib"
+         done
 
          if test $link_all_deplibs != no; then
            # Add the search paths of all dependency libraries
@@ -1920,24 +1938,70 @@ compiler."
                ;;
              *) continue ;;
              esac
-             case "$deplibs " in
+             case " $deplibs " in
              *" $path "*) ;;
-             *) deplibs="$path $deplibs" ;;
+             *) deplibs="$deplibs $path" ;;
              esac
            done
          fi
        fi
       done
       dependency_libs="$newdependency_libs"
-      # Make sure lib_search_path contains only unique directories.
-      lib_search_path=
-      for dir in $new_lib_search_path; do
-       case "$lib_search_path " in
-       *" $dir "*) ;;
-       *) lib_search_path="$lib_search_path $dir" ;;
-       esac
-      done
-      lib_search_path="$lib_search_path $sys_lib_search_path"
+      if test $pass = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       deplibs="$deplibs $save_deplibs"
+      elif test $pass != dlopen; then
+       # Make sure lib_search_path contains only unique directories.
+       lib_search_path=
+       for dir in $new_lib_search_path; do
+         case "$lib_search_path " in
+         *" $dir "*) ;;
+         *) lib_search_path="$lib_search_path $dir" ;;
+         esac
+       done
+       lib_search_path="$lib_search_path $sys_lib_search_path"
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Make sure that $var contains only unique libraries
+         # and add them in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           case "$deplib" in
+           -L*) new_libs="$deplib $new_libs" ;;
+           *)
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case "$deplib" in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) tmp_libs="$tmp_libs $deplib" ;;
+             esac
+             ;;
+           *) tmp_libs="$tmp_libs $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done
+      fi
     done
     if test $linkmode = prog; then
       dlfiles="$newdlfiles"
@@ -2862,6 +2926,9 @@ EOF
        fi
       fi
 
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
       if test -n "$rpath$xrpath"; then
        # If the user specified any rpath flags, then add them.
        for libdir in $rpath $xrpath; do
@@ -4170,83 +4237,6 @@ relink_command=\"$relink_command\""
     exit 0
     ;;
 
-  # libtool clean mode
-  clean)
-    modename="$modename: clean"
-    rm="$nonopt"
-    files=
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case "$arg" in
-      -*) rm="$rm $arg" ;;
-      *) files="$files $arg" ;;
-      esac
-    done
-
-    if test -z "$rm"; then
-      $echo "$modename: you must specify an RM program" 1>&2
-      $echo "$help" 1>&2
-      exit 1
-    fi
-
-    for file in $files; do
-      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-      if test "X$dir" = "X$file"; then
-       dir=.
-       objdir="$objdir"
-      else
-       objdir="$dir/$objdir"
-      fi
-      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
-      rmfiles="$file"
-
-      case "$file" in
-      *.la)
-       # Possibly a libtool archive, so verify it.
-       if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-         . ./$file
-
-         # Delete the libtool libraries and symlinks.
-         for n in $library_names; do
-           rmfiles="$rmfiles $objdir/$n"
-         done
-         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-         rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-       fi
-       ;;
-
-      *.lo)
-       if test "$build_old_libs" = yes; then
-         oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
-         rmfiles="$rmfiles $dir/$oldobj"
-       fi
-       ;;
-
-      *)
-       # Do a test to see if this is a libtool program.
-       if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-         relink_command=
-         . $dir/$file
-
-         rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
-         if test "$fast_install" = yes && test -n "$relink_command"; then
-           rmfiles="$rmfiles $objdir/lt-$name"
-         fi
-       fi
-       ;;
-      esac
-      $show "$rm $rmfiles"
-      $run $rm $rmfiles
-    done
-    exit 0
-    ;;
-
   # libtool execute mode
   execute)
     modename="$modename: execute"
@@ -4389,12 +4379,16 @@ relink_command=\"$relink_command\""
     fi
     ;;
 
-  # libtool uninstall mode
-  uninstall)
-    modename="$modename: uninstall"
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
     rm="$nonopt"
     files=
 
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
     for arg
     do
       case "$arg" in
@@ -4411,8 +4405,14 @@ relink_command=\"$relink_command\""
 
     for file in $files; do
       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-      test "X$dir" = "X$file" && dir=.
+      if test "X$dir" = "X$file"; then
+       dir=.
+       objdir="$objdir"
+      else
+       objdir="$dir/$objdir"
+      fi
       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test $mode = uninstall && objdir="$dir"
 
       rmfiles="$file"
 
@@ -4424,38 +4424,37 @@ relink_command=\"$relink_command\""
 
          # Delete the libtool libraries and symlinks.
          for n in $library_names; do
-           rmfiles="$rmfiles $dir/$n"
+           rmfiles="$rmfiles $objdir/$n"
          done
-         test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
-
-         $show "$rm $rmfiles"
-         $run $rm $rmfiles
+         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+         test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
-         if test -n "$library_names"; then
-           # Do each command in the postuninstall commands.
-           eval cmds=\"$postuninstall_cmds\"
-           IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
-           for cmd in $cmds; do
+         if test $mode = uninstall; then
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             eval cmds=\"$postuninstall_cmds\"
+             IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               $show "$cmd"
+               $run eval "$cmd"
+             done
              IFS="$save_ifs"
-             $show "$cmd"
-             $run eval "$cmd"
-           done
-           IFS="$save_ifs"
-         fi
+           fi
 
-         if test -n "$old_library"; then
-           # Do each command in the old_postuninstall commands.
-           eval cmds=\"$old_postuninstall_cmds\"
-           IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
-           for cmd in $cmds; do
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             eval cmds=\"$old_postuninstall_cmds\"
+             IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               $show "$cmd"
+               $run eval "$cmd"
+             done
              IFS="$save_ifs"
-             $show "$cmd"
-             $run eval "$cmd"
-           done
-           IFS="$save_ifs"
+           fi
+           # FIXME: should reinstall the best remaining shared library.
          fi
-
-         # FIXME: should reinstall the best remaining shared library.
        fi
        ;;
 
@@ -4464,15 +4463,24 @@ relink_command=\"$relink_command\""
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
          rmfiles="$rmfiles $dir/$oldobj"
        fi
-       $show "$rm $rmfiles"
-       $run $rm $rmfiles
        ;;
 
       *)
-       $show "$rm $rmfiles"
-       $run $rm $rmfiles
+       # Do a test to see if this is a libtool program.
+       if test $mode = clean &&
+          (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         relink_command=
+         . $dir/$file
+
+         rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+         if test "$fast_install" = yes && test -n "$relink_command"; then
+           rmfiles="$rmfiles $objdir/lt-$name"
+         fi
+       fi
        ;;
       esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles
     done
     exit 0
     ;;
index bd23885e3f24049b57f5b3f05d1ec1ca78d62db1..4ca188f2704d3d186642433b8cdbeecc9a6845e1 100644 (file)
@@ -6,7 +6,7 @@ INCLUDES = $(INCLTDL)
 
 EXTRA_DIST = acinclude.m4
 
-lib_LTLIBRARIES = foo1.la libfoo2.la
+lib_LTLIBRARIES = foo1.la libfoo2.la libsub.la
 
 foo1_la_SOURCES = foo1.c
 foo1_la_LIBADD = $(LIBM)
@@ -16,6 +16,9 @@ libfoo2_la_SOURCES = foo2.c
 libfoo2_la_LIBADD = $(LIBM)
 libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"
 
+libsub_la_SOURCES = sub.c
+libsub_la_LDFLAGS = -no-undefined
+
 noinst_HEADERS = foo.h
 
 bin_PROGRAMS = mdemo mdemo.static
@@ -33,13 +36,13 @@ bin_PROGRAMS = mdemo mdemo.static
 mdemo_SOURCES = main.c
 mdemo_LDFLAGS = -export-dynamic
 ## The quotes around -dlopen below fool automake into accepting it
-mdemo_LDADD = @LIBLTDL@ "-dlopen" self \
+mdemo_LDADD = @LIBLTDL@ libsub.la "-dlopen" self \
                "-dlopen" foo1.la "-dlopen" libfoo2.la
-mdemo_DEPENDENCIES = @LIBLTDL@ foo1.la libfoo2.la
+mdemo_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la
 
 # Create a statically linked version of mdemo.
 mdemo_static_SOURCES = $(mdemo_SOURCES)
-mdemo_static_LDFLAGS = $(STATIC) $(mdemo_LDFLAGS)
+mdemo_static_LDFLAGS = $(mdemo_LDFLAGS) -static
 mdemo_static_LDADD = $(mdemo_LDADD)
 mdemo_static_DEPENDENCIES = $(mdemo_DEPENDENCIES)
 
index 7faa720e8c26b7f2c956cb9fb1fc2c3e9ee9cd80..fe1a6762275c819c83ffbc43518ce35daa43cd70 100644 (file)
@@ -20,13 +20,6 @@ AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_SUBST(LIBTOOL_DEPS)
 
-if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
-  STATIC=-static
-else
-  STATIC=
-fi
-AC_SUBST(STATIC)
-
 AC_CHECK_HEADERS(math.h)
 
 AC_CHECK_LIBM
index 48dc9127ed52940c517e13d6d48c6ce4f6a83546..be28c770b5816d7459656ec4c2cb6c54db325234 100644 (file)
@@ -26,4 +26,6 @@ USA. */
 #define HELLO_RET 0xe110
 #define FOO_RET 0xf00
 
+extern void sub();
+
 #endif /* !_FOO_H_ */
index a6a28dd2c012f155d405090c47b581335c9e3df1..e09c5f8dace1c608b027a118b653757e9da478f0 100644 (file)
@@ -36,6 +36,7 @@ int nothing;
 int
 _foo1_helper()
 {
+  sub();
   return FOO_RET;
 }
 
index a747d4c69f5d0eedd5a2dae2f16223ddb28d4622..443994d6d93ac6b775b75de475e0bbb9f74eb5e5 100644 (file)
@@ -36,6 +36,7 @@ int nothing;
 int
 _foo2_helper()
 {
+  sub();
   return FOO_RET;
 }
 
diff --git a/mdemo/sub.c b/mdemo/sub.c
new file mode 100644 (file)
index 0000000..75dc497
--- /dev/null
@@ -0,0 +1,27 @@
+/* sub.c -- trivial test library
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include <stdio.h>
+
+void
+sub()
+{
+  printf ("sub() called\n");
+}
index 0fd60d95ee1387d3f3134b99ac51a4ceb529937f..c4259fa3a6690221c0c10a4c21677964e1a09fc4 100755 (executable)
@@ -56,12 +56,12 @@ $make foo1.lo foo2.lo || exit 1
 
 echo "= Making libraries in ../mdemo (dry run)"
 ls -l . $objdir > $before
-force_dry_run=yes $make foo1.la libfoo2.la || exit $?
+force_dry_run=yes $make foo1.la libfoo2.la libsub.la || exit $?
 ls -l . $objdir > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
 echo "= Making libraries in ../mdemo"
-$make foo1.la libfoo2.la || exit 1
+$make foo1.la libfoo2.la libsub.la || exit 1
 
 echo "= Making programs in ../mdemo (dry run)"
 ls -l . $objdir > $before