]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* config/ltmain.m4sh (opt_silent): Whether --silent was given.
authorGary V. Vaughan <gary@gnu.org>
Sun, 24 Oct 2004 15:17:23 +0000 (15:17 +0000)
committerGary V. Vaughan <gary@gnu.org>
Sun, 24 Oct 2004 15:17:23 +0000 (15:17 +0000)
(run, show): Deleted.  All callers converted to opt_dry_run,
opt_silent or calls to func_show_eval.
* tests/mdemo-dryrun.test: Adjust.

ChangeLog
config/ltmain.m4sh
tests/mdemo-dryrun.test

index 3db1a113d5ce52efe735baf0c718fc469843e971..3014447c6900e9fd4ddd390d5a99cb35e30e5b3d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-10-24  Gary V. Vaughan  <gary@gnu.org>
 
+       * config/ltmain.m4sh (opt_silent): Whether --silent was given.
+       (run, show): Deleted.  All callers converted to opt_dry_run,
+       opt_silent or calls to func_show_eval.
+       * tests/mdemo-dryrun.test: Adjust.
+
        * HACKING: Fix a typo in the gpg --verify instructions.
 
        * Makefile.maint (cvs-dist): Generate signatures and directives
index 5f41f04433503f1ac467d1eda40f252bbd1765d5..ebc7d57ad38d1bc3d70ad5c5297ececc90d8b60a 100644 (file)
@@ -111,14 +111,13 @@ magic="%%%MAGIC variable%%%"
 # Global variables.
 mode=$default_mode
 nonopt=
-run=
-show="$ECHO"
 execute_dlfiles=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 
-opt_dry_run=${run-false}  ## inherit $run when mdemo-dryrun.test sets it above
+opt_dry_run=false
 opt_duplicate_deps=false
+opt_silent=false
 
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
@@ -446,10 +445,7 @@ Otherwise, only FILE itself is deleted using RM."
                        shift
                        ;;
 
-      --dry-run | -n)  opt_dry_run=:
-                       run=:
-                       ;;
-
+      --dry-run | -n)  opt_dry_run=:                                   ;;
       --features)       func_features                                  ;;
       --finish)                mode="finish"                                   ;;
 
@@ -480,7 +476,7 @@ Otherwise, only FILE itself is deleted using RM."
                        opt_duplicate_deps=:                            ;;
 
       --quiet|--silent)        preserve_args="$preserve_args $opt"
-                       show=:
+                       opt_silent=:
                        ;;
 
       --tag)           test "$#" -eq 0 && func_missing_arg "$opt" && break
@@ -699,13 +695,12 @@ func_generate_dlsyms () {
        # Discover the nlist of each of the dlfiles.
        nlist="$output_objdir/${my_outputname}.nm"
 
-       $show "$RM $nlist ${nlist}S ${nlist}T"
-       $run $RM "$nlist" "${nlist}S" "${nlist}T"
+       func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 
        # Parse the name list into a source file.
        func_echo "creating $output_objdir/$my_dlsyms"
 
-       test -z "$run" && $ECHO > "$output_objdir/$my_dlsyms" "\
+       $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
 
@@ -719,57 +714,67 @@ extern \"C\" {
        if test "$dlself" = yes; then
          func_echo "generating symbol list for \`$output'"
 
-         test -z "$run" && $ECHO ': @PROGRAM@ ' > "$nlist"
+         $opt_dry_run || $ECHO ': @PROGRAM@ ' > "$nlist"
 
          # Add our own program objects to the symbol list.
          progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
          for progfile in $progfiles; do
            func_echo "extracting global C symbols from \`$progfile'"
-           $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+           $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
          done
 
          if test -n "$exclude_expsyms"; then
-           $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-           $run eval '$MV "$nlist"T "$nlist"'
+           $opt_dry_run || {
+             eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
          fi
 
          if test -n "$export_symbols_regex"; then
-           $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-           $run eval '$MV "$nlist"T "$nlist"'
+           $opt_dry_run || {
+             eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
          fi
 
          # Prepare the list of exported symbols
          if test -z "$export_symbols"; then
            export_symbols="$output_objdir/$output.exp"
-           $run $RM $export_symbols
-           $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-           case $host in
-           *cygwin* | *mingw* )
-              $run eval "${ECHO} EXPORTS "'> "$output_objdir/$output.def"'
-              $run eval 'cat "$export_symbols" >> "$output_objdir/$output.def"'
-             ;;
-           esac
+           $opt_dry_run || {
+             $RM $export_symbols
+             eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             case $host in
+             *cygwin* | *mingw* )
+                eval "${ECHO} EXPORTS "'> "$output_objdir/$output.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$output.def"'
+               ;;
+             esac
+           }
          else
-           $run eval "${SED} -e 's/\([[]][[.*^$]]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
-           case $host in
-           *cygwin | *mingw* )
-             $run eval "${ECHO} EXPORTS "'> "$output_objdir/$output.def"'
-             $run eval 'cat "$output_objdir/$output.exp" >> "$output_objdir/$output.def"'
-             ;;
-           esac
-           $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
-           $run eval '$MV "$nlist"T "$nlist"'
+           $opt_dry_run || {
+             eval "${SED} -e 's/\([[]][[.*^$]]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+             case $host in
+               *cygwin | *mingw* )
+                 eval "${ECHO} EXPORTS "'> "$output_objdir/$output.def"'
+                 eval 'cat "$output_objdir/$output.exp" >> "$output_objdir/$output.def"'
+                 ;;
+             esac
+             eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
          fi
        fi
 
        for dlprefile in $dlprefiles; do
          func_echo "extracting global C symbols from \`$dlprefile'"
          name=`$ECHO "X$dlprefile" | $Xsed -e 's%^.*/%%'`
-         $run eval '$ECHO ": $name " >> "$nlist"'
-         $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'"
+         $opt_dry_run || {
+           eval '$ECHO ": $name " >> "$nlist"'
+           eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'"
+         }
        done
 
-       if test -z "$run"; then
+       $opt_dry_run || {
          # Make sure we have at least an empty file.
          test -f "$nlist" || : > "$nlist"
 
@@ -843,7 +848,7 @@ static const void *lt_preloaded_setup() {
 }
 #endif\
 "
-       fi
+       } # !$opt_dry_run
 
        pic_flag_for_symtable=
        case "$compile_command " in
@@ -869,12 +874,10 @@ static const void *lt_preloaded_setup() {
        esac
 
        # Now compile the dynamic symbol file.
-       $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")"
-       $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $?
+       func_show_eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 
        # Clean up the generated files.
-       $show "$RM $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T"
-       $run $RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
 
        # Transform the symbol file into the correct name.
        symfileobj="$output_objdir/${my_outputname}S.$objext"
@@ -933,7 +936,7 @@ func_extract_archives () {
       *-darwin*)
        func_echo "Extracting $my_xabs"
        # Do not bother doing anything if just a dry run
-       if test -z "$run"; then
+       $opt_dry_run || {
          darwin_orig_dir=`pwd`
          cd $my_xdir || exit $?
          darwin_archive=$my_xabs
@@ -969,14 +972,14 @@ func_extract_archives () {
            cd $darwin_orig_dir
            (cd $my_xdir && $AR x $my_xabs) || exit $?
          fi # $darwin_arches
-       fi # $run
+       } # !$opt_dry_run
       ;;
       *)
        # We will extract separately just the conflicting names and we will
        # no longer touch any unique names. It is faster to leave these
        # extract automatically by $AR in one run.
-       $show "(cd $my_xdir && $AR x $my_xabs)"
-       $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
+       func_show_eval '(cd $my_xdir && $AR x $my_xabs)' 'exit $?'
+
        if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
          :
        else
@@ -994,8 +997,7 @@ func_extract_archives () {
              do
                name_to=`$ECHO "X$name_to" | $Xsed -e "s/\([[^.]]*\)/\1-$i/"`
              done
-             $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $MV '$name' '$name_to')"
-             $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $MV '$name' '$name_to')" || exit $?
+             func_show_eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $MV '$name' '$name_to')" 'exit $?'
              i=`expr $i + 1`
            done
          done
@@ -1183,8 +1185,8 @@ func_mode_compile ()
       removelist="$lobj $libobj ${libobj}T"
     fi
 
-    $run $RM $removelist
-    trap "$run $RM $removelist; exit $EXIT_FAILURE" 1 2 15
+    $opt_dry_run || $RM $removelist
+    trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
     case $host_os in
@@ -1203,7 +1205,7 @@ func_mode_compile ()
       output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[[^.]]*$%%'`.${objext}
       lockfile="$output_obj.lock"
       removelist="$removelist $output_obj $lockfile"
-      trap "$run $RM $removelist; exit $EXIT_FAILURE" 1 2 15
+      trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
     else
       output_obj=
       need_locks=no
@@ -1213,7 +1215,7 @@ func_mode_compile ()
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
        func_echo "Waiting for $lockfile to be removed"
        sleep 2
       done
@@ -1230,7 +1232,7 @@ repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
 
-       $run $RM $removelist
+       $opt_dry_run || $RM $removelist
        exit $EXIT_FAILURE
       fi
       $ECHO $srcfile > "$lockfile"
@@ -1240,11 +1242,11 @@ compiler."
       eval srcfile=\"$fix_srcfile_path\"
     fi
 
-    $run $RM "$libobj" "${libobj}T"
+    $opt_dry_run || $RM "$libobj" "${libobj}T"
 
     # Create a libtool object file (analogous to a ".la" file),
     # but don't create it if we're doing a dry run.
-    test -z "$run" && cat > ${libobj}T <<EOF
+    $opt_dry_run || cat > ${libobj}T <<EOF
 # $libobj - a libtool object file
 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 #
@@ -1273,14 +1275,10 @@ EOF
        command="$command -o $lobj"
       fi
 
-      $run $RM "$lobj" "$output_obj"
+      $opt_dry_run || $RM "$lobj" "$output_obj"
 
-      $show "$command"
-      if $run eval "$command"; then :
-      else
-       test -n "$output_obj" && $run $RM $removelist
-       exit $EXIT_FAILURE
-      fi
+      func_show_eval "$command"        \
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
 
       if test "$need_locks" = warn &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
@@ -1298,23 +1296,18 @@ repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
 
-       $run $RM $removelist
+       $opt_dry_run || $RM $removelist
        exit $EXIT_FAILURE
       fi
 
       # Just move the object if needed, then go on to compile the next one
       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-       $show "$MV $output_obj $lobj"
-       if $run $MV $output_obj $lobj; then :
-       else
-         error=$?
-         $run $RM $removelist
-         exit $error
-       fi
+       func_show_eval '$MV "$output_obj" "$lobj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
       fi
 
       # Append the name of the PIC object to the libtool object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
+      $opt_dry_run || cat >> ${libobj}T <<EOF
 pic_object='$objdir/$objname'
 
 EOF
@@ -1326,7 +1319,7 @@ EOF
     else
       # No PIC object so indicate it doesn't exist in the libtool
       # object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
+      $opt_dry_run || cat >> ${libobj}T <<EOF
 pic_object=none
 
 EOF
@@ -1346,13 +1339,9 @@ EOF
 
       # Suppress compiler output if we already did a PIC compilation.
       command="$command$suppress_output"
-      $run $RM "$obj" "$output_obj"
-      $show "$command"
-      if $run eval "$command"; then :
-      else
-       $run $RM $removelist
-       exit $EXIT_FAILURE
-      fi
+      $opt_dry_run || $RM "$obj" "$output_obj"
+      func_show_eval "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
       if test "$need_locks" = warn &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
@@ -1370,24 +1359,19 @@ repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
 
-       $run $RM $removelist
+       $opt_dry_run || $RM $removelist
        exit $EXIT_FAILURE
       fi
 
       # Just move the object if needed
       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-       $show "$MV $output_obj $obj"
-       if $run $MV $output_obj $obj; then :
-       else
-         error=$?
-         $run $RM $removelist
-         exit $error
-       fi
+       func_show_eval '$MV "$output_obj" "$obj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
       fi
 
       # Append the name of the non-PIC object the libtool object file.
       # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
+      $opt_dry_run || cat >> ${libobj}T <<EOF
 # Name of the non-PIC object.
 non_pic_object='$objname'
 
@@ -1395,19 +1379,21 @@ EOF
     else
       # Append the name of the non-PIC object the libtool object file.
       # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
+      $opt_dry_run || cat >> ${libobj}T <<EOF
 # Name of the non-PIC object.
 non_pic_object=none
 
 EOF
     fi
 
-    $run $MV "${libobj}T" "${libobj}"
+    $opt_dry_run || {
+      $MV "${libobj}T" "${libobj}"
 
-    # Unlock the critical section if it was locked
-    if test "$need_locks" != no; then
-      $run $RM "$lockfile"
-    fi
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+        $RM "$lockfile"
+      fi
+    }
 
     exit $EXIT_SUCCESS
 }
@@ -1514,7 +1500,7 @@ func_mode_execute ()
       args="$args $func_quote_for_eval_result"
     done
 
-    if test -z "$run"; then
+    if test "X$opt_dry_run" = Xfalse; then
       if test -n "$shlibpath_var"; then
        # Export the shlibpath_var.
        eval "export $shlibpath_var"
@@ -1562,23 +1548,22 @@ func_mode_finish ()
          for cmd in $cmds; do
            IFS="$save_ifs"
            eval cmd=\"$cmd\"
-           $show "$cmd"
-           $run eval "$cmd" || admincmds="$admincmds
-       $cmd"
+           func_show_eval "$cmd" 'admincmds="$admincmds
+'"$cmd"'"'
          done
          IFS="$save_ifs"
        fi
        if test -n "$finish_eval"; then
          # Do the single finish_eval.
          eval cmds=\"$finish_eval\"
-         $run eval "$cmds" || admincmds="$admincmds
+         $opt_dry_run || eval "$cmds" || admincmds="$admincmds
        $cmds"
        fi
       done
     fi
 
     # Exit here if they wanted silent mode.
-    test "$show" = : && exit $EXIT_SUCCESS
+    $opt_silent && exit $EXIT_SUCCESS
 
     $ECHO "X----------------------------------------------------------------------" | $Xsed
     $ECHO "Libraries have been installed in:"
@@ -1809,9 +1794,8 @@ func_mode_install ()
          fi
 
          func_warning "relinking \`$file'"
-         $show "$relink_command"
-         $run eval "$relink_command" || \
-           func_fatal_error "error: relink \`$file' with the above command before installing it"
+         func_show_eval "$relink_command" \
+           'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
        fi
 
        # See the names of the shared library.
@@ -1825,21 +1809,18 @@ func_mode_install ()
          test -n "$relink_command" && srcname="$realname"T
 
          # Install the shared library and build the symlinks.
-         $show "$install_prog $dir/$srcname $destdir/$realname"
-         $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+         func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+             'exit $?'
          if test -n "$stripme" && test -n "$striplib"; then
-           $show "$striplib $destdir/$realname"
-           $run eval "$striplib $destdir/$realname" || exit $?
+           func_show_eval "$striplib $destdir/$realname" 'exit $?'
          fi
 
          if test "$#" -gt 0; then
            # Delete the old symlinks, and create new ones.
            for linkname
            do
-             if test "$linkname" != "$realname"; then
-               $show "(cd $destdir && $RM $linkname && $LN_S $realname $linkname)"
-               $run eval "(cd $destdir && $RM $linkname && $LN_S $realname $linkname)"
-             fi
+             test "$linkname" != "$realname" \
+               && func_show_eval "(cd $destdir && $RM $linkname && $LN_S $realname $linkname)"
            done
          fi
 
@@ -1850,8 +1831,7 @@ func_mode_install ()
          for cmd in $cmds; do
            IFS="$save_ifs"
            eval cmd=\"$cmd\"
-           $show "$cmd"
-           $run eval "$cmd" || exit $?
+           func_show_eval "$cmd" 'exit $?'
          done
          IFS="$save_ifs"
        fi
@@ -1859,8 +1839,7 @@ func_mode_install ()
        # Install the pseudo-library for information purposes.
        name=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
        instname="$dir/$name"i
-       $show "$install_prog $instname $destdir/$name"
-       $run eval "$install_prog $instname $destdir/$name" || exit $?
+       func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
        # Maybe install the static library, too.
        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
@@ -1892,18 +1871,14 @@ func_mode_install ()
        esac
 
        # Install the libtool object if requested.
-       if test -n "$destfile"; then
-         $show "$install_prog $file $destfile"
-         $run eval "$install_prog $file $destfile" || exit $?
-       fi
+       test -n "$destfile" && \
+         func_show_eval "$install_prog $file $destfile" 'exit $?'
 
        # Install the old object if enabled.
        if test "$build_old_libs" = yes; then
          # Deduce the name of the old-style object file.
          staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
-
-         $show "$install_prog $staticobj $staticdest"
-         $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+         func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
        fi
        exit $EXIT_SUCCESS
        ;;
@@ -1994,24 +1969,29 @@ func_mode_install ()
 
          outputname=
          if test "$fast_install" = no && test -n "$relink_command"; then
-           if test "$finalize" = yes && test -z "$run"; then
-             tmpdir=`func_mktempdir "${TMPDIR-/tmp}/libtool-XXXXXXXX"`
-             file=`$ECHO "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
-             outputname="$tmpdir/$file"
-             # Replace the output file specification.
-             relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
-             $show "$relink_command"
-             if $run eval "$relink_command"; then :
+           $opt_dry_run || {
+             if test "$finalize" = yes; then
+               tmpdir=`func_mktempdir "${TMPDIR-/tmp}/libtool-XXXXXXXX"`
+               file=`$ECHO "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+               outputname="$tmpdir/$file"
+               # Replace the output file specification.
+               relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+               $opt_silent || {
+                 func_quote_for_expand "$relink_command"
+                 eval "func_echo $func_quote_for_expand_result"
+               }
+               if eval "$relink_command"; then :
+                 else
+                 func_error "error: relink \`$file' with the above command before installing it"
+                 $opt_dry_run || ${RM}r "$tmpdir"
+                 continue
+               fi
+               file="$outputname"
              else
-               func_error "error: relink \`$file' with the above command before installing it"
-               ${RM}r "$tmpdir"
-               continue
+               func_warning "cannot relink \`$file'"
              fi
-             file="$outputname"
-           else
-             func_warning "cannot relink \`$file'"
-           fi
+           }
          else
            # Install the binary that we compiled earlier.
            file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([[^/]]*\)$%$objdir/\1%"`
@@ -2035,9 +2015,10 @@ func_mode_install ()
          esac
          ;;
        esac
-       $show "$install_prog$stripme $file $destfile"
-       $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
-       test -n "$outputname" && ${RM}r "$tmpdir"
+       func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+       $opt_dry_run || if test -n "$outputname"; then
+         ${RM}r "$tmpdir"
+       fi
        ;;
       esac
     done
@@ -2048,12 +2029,10 @@ func_mode_install ()
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
 
-      $show "$install_prog $file $oldlib"
-      $run eval "$install_prog \$file \$oldlib" || exit $?
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-       $show "$old_striplib $oldlib"
-       $run eval "$old_striplib $oldlib" || exit $?
+       func_show_eval "$old_striplib $oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -2062,8 +2041,7 @@ func_mode_install ()
       for cmd in $cmds; do
        IFS="$save_ifs"
        eval cmd=\"$cmd\"
-       $show "$cmd"
-       $run eval "$cmd" || exit $?
+       func_show_eval "$cmd" 'exit $?'
       done
       IFS="$save_ifs"
     done
@@ -2073,7 +2051,7 @@ func_mode_install ()
 
     if test -n "$current_libdirs"; then
       # Maybe just do a dry run.
-      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
       exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
     else
       exit $EXIT_SUCCESS
@@ -2360,11 +2338,7 @@ func_mode_link ()
                fi
              else
                # Only an error if not doing a dry-run.
-               if test -z "$run"; then
-                 func_fatal_error "\`$arg' is not a valid libtool object"
-               else
-                 # Dry-run case.
-
+               if $opt_dry_run; then
                  # Extract subdirectory from the argument.
                  xdir=`$ECHO "X$arg" | $Xsed -e 's%/[[^/]]*$%%'`
                  if test "X$xdir" = "X$arg"; then
@@ -2377,6 +2351,8 @@ func_mode_link ()
                  non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
                  libobjs="$libobjs $pic_object"
                  non_pic_objects="$non_pic_objects $non_pic_object"
+               else
+                 func_fatal_error "\`$arg' is not a valid libtool object"
                fi
              fi
            done
@@ -2855,11 +2831,7 @@ func_mode_link ()
          fi
        else
          # Only an error if not doing a dry-run.
-         if test -z "$run"; then
-           func_fatal_error "\`$arg' is not a valid libtool object"
-         else
-           # Dry-run case.
-
+         if $opt_dry_run; then
            # Extract subdirectory from the argument.
            xdir=`$ECHO "X$arg" | $Xsed -e 's%/[[^/]]*$%%'`
            if test "X$xdir" = "X$arg"; then
@@ -2872,6 +2844,8 @@ func_mode_link ()
            non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
            libobjs="$libobjs $pic_object"
            non_pic_objects="$non_pic_objects $non_pic_object"
+         else
+           func_fatal_error "\`$arg' is not a valid libtool object"
          fi
        fi
        ;;
@@ -3642,8 +3616,7 @@ func_mode_link ()
              for cmd in $cmds; do
                IFS="$save_ifs"
                eval cmd=\"$cmd\"
-               $show "$cmd"
-               $run eval "$cmd" || exit $?
+               func_show_eval "$cmd" 'exit $?'
              done
              IFS="$save_ifs"
            fi
@@ -3656,8 +3629,7 @@ func_mode_link ()
              for cmd in $cmds; do
                IFS="$save_ifs"
                eval cmd=\"$cmd\"
-               $show "$cmd"
-               $run eval "$cmd" || exit $?
+               func_show_eval "$cmd" 'exit $?'
              done
              IFS="$save_ifs"
            fi
@@ -4385,10 +4357,8 @@ func_mode_link ()
            *) ;;
          esac
        done
-       if test -n "$removelist"; then
-         $show "${RM}r $removelist"
-         $run ${RM}r $removelist
-       fi
+       test -n "$removelist" && \
+         func_show_eval "${RM}r \$removelist"
       fi
 
       # Now set the variables for building old libraries.
@@ -4495,11 +4465,11 @@ func_mode_link ()
          # limits. Maybe even breaks it.  We compile a program, linking it
          # against the deplibs as a proxy for the library.  Then we can check
          # whether they linked in statically or dynamically with ldd.
-         $RM conftest.c
+         $opt_dry_run || $RM conftest.c
          cat > conftest.c <<EOF
          int main() { return 0; }
 EOF
-         $RM conftest
+         $opt_dry_run || $RM conftest
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
          if test "$?" -eq 0 ; then
            ldd_output=`ldd conftest`
@@ -4544,7 +4514,7 @@ EOF
              name="`expr $i : '-l\(.*\)'`"
              # If $name is empty we are operating on a -L argument.
              if test "$name" != "" && test "$name" != "0"; then
-               $RM conftest
+               $opt_dry_run || $RM conftest
                $LTCC $LTCFLAGS -o conftest conftest.c $i
                # Did it work?
                if test "$?" -eq 0 ; then
@@ -4895,7 +4865,7 @@ EOF
          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
            func_echo "generating symbol list for \`$libname.la'"
            export_symbols="$output_objdir/$libname.exp"
-           $run $RM $export_symbols
+           $opt_dry_run || $RM $export_symbols
            cmds=$export_symbols_cmds
            save_ifs="$IFS"; IFS='~'
            for cmd in $cmds; do
@@ -4903,8 +4873,7 @@ EOF
              eval cmd=\"$cmd\"
              if len=`expr "X$cmd" : ".*"` &&
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-               $show "$cmd"
-               $run eval "$cmd" || exit $?
+               func_show_eval "$cmd" 'exit $?'
                skipped_export=false
              else
                # The command line is too long to execute in one step.
@@ -4914,16 +4883,14 @@ EOF
            done
            IFS="$save_ifs"
            if test -n "$export_symbols_regex"; then
-             $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
-             $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-             $show "$MV \"${export_symbols}T\" \"$export_symbols\""
-             $run eval '$MV "${export_symbols}T" "$export_symbols"'
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
            fi
          fi
        fi
 
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
-         $run eval '$ECHO "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+         $opt_dry_run || eval '$ECHO "X$include_expsyms" | $SP2NL >> "$export_symbols"'
        fi
 
        tmp_deplibs=
@@ -4957,7 +4924,7 @@ EOF
 
        # Make a backup of the uninstalled library when relinking
        if test "$mode" = relink; then
-         $run eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
        fi
 
        # Do each of the archive commands.
@@ -5058,7 +5025,7 @@ EOF
            if ${skipped_export-false}; then
              func_echo "generating symbol list for \`$libname.la'"
              export_symbols="$output_objdir/$libname.exp"
-             $run $RM $export_symbols
+             $opt_dry_run || $RM $export_symbols
              libobjs=$output
              # Append the command to create the export file.
              eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
@@ -5079,13 +5046,18 @@ EOF
            save_ifs="$IFS"; IFS='~'
            for cmd in $concat_cmds; do
              IFS="$save_ifs"
-             $show "$cmd"
-             $run eval "$cmd" || {
+             $opt_silent || {
+                 func_quote_for_expand "$cmd"
+                 eval "func_echo $func_quote_for_expand_result"
+             }
+             $opt_dry_run || eval "$cmd" || {
                lt_exit=$?
 
                # Restore the uninstalled library and exit
                if test "$mode" = relink; then
-                 $run eval '(cd $output_objdir && $RM ${realname}T && $MV ${realname}U $realname)'
+                 ( cd "$output_objdir" && \
+                   $RM "${realname}T" && \
+                   $MV "${realname}U" "$realname" )
                fi
 
                exit $lt_exit
@@ -5137,14 +5109,18 @@ EOF
        for cmd in $cmds; do
          IFS="$save_ifs"
          eval cmd=\"$cmd\"
-         func_quote_for_expand "$cmd"
-         eval \$show "$func_quote_for_expand_result"
-         $run eval "$cmd" || {
+         $opt_silent || {
+           func_quote_for_expand "$cmd"
+           eval "func_echo $func_quote_for_expand_result"
+         }
+         $opt_dry_run || eval "$cmd" || {
            lt_exit=$?
 
            # Restore the uninstalled library and exit
            if test "$mode" = relink; then
-             $run eval '(cd $output_objdir && $RM ${realname}T && $MV ${realname}U $realname)'
+             ( cd "$output_objdir" && \
+               $RM "${realname}T" && \
+               $MV "${realname}U" "$realname" )
            fi
 
            exit $lt_exit
@@ -5154,12 +5130,11 @@ EOF
 
        # Restore the uninstalled library and exit
        if test "$mode" = relink; then
-         $run eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
          if test -n "$convenience"; then
            if test -z "$whole_archive_flag_spec"; then
-             $show "${RM}r $gentop"
-             $run ${RM}r "$gentop"
+             func_show_eval '${RM}r "$gentop"'
            fi
          fi
 
@@ -5169,8 +5144,7 @@ EOF
        # Create links to the real library.
        for linkname in $linknames; do
          if test "$realname" != "$linkname"; then
-           $show "(cd $output_objdir && $RM $linkname && $LN_S $realname $linkname)"
-           $run eval '(cd $output_objdir && $RM $linkname && $LN_S $realname $linkname)' || exit $?
+           func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
          fi
        done
 
@@ -5217,7 +5191,7 @@ EOF
       esac
 
       # Delete the old objects.
-      $run $RM $obj $libobj
+      $opt_dry_run || $RM $obj $libobj
 
       # Objects from convenience libraries.  This assumes
       # single-version convenience libraries.  Whenever we create
@@ -5250,16 +5224,14 @@ EOF
       for cmd in $cmds; do
        IFS="$save_ifs"
        eval cmd=\"$cmd\"
-       $show "$cmd"
-       $run eval "$cmd" || exit $?
+       func_show_eval "$cmd" 'exit $?'
       done
       IFS="$save_ifs"
 
       # Exit if we aren't doing a library object file.
       if test -z "$libobj"; then
        if test -n "$gentop"; then
-         $show "${RM}r $gentop"
-         $run ${RM}r $gentop
+         func_show_eval '${RM}r "$gentop"'
        fi
 
        exit $EXIT_SUCCESS
@@ -5267,14 +5239,13 @@ EOF
 
       if test "$build_libtool_libs" != yes; then
        if test -n "$gentop"; then
-         $show "${RM}r $gentop"
-         $run ${RM}r $gentop
+         func_show_eval '${RM}r "$gentop"'
        fi
 
        # Create an invalid libtool object if no PIC, so that we don't
        # accidentally link it into a program.
        # $show "$ECHO timestamp > $libobj"
-       # $run eval "$ECHO timestamp > $libobj" || exit $?
+       # $opt_dry_run || eval "$ECHO timestamp > $libobj" || exit $?
        exit $EXIT_SUCCESS
       fi
 
@@ -5287,15 +5258,13 @@ EOF
        for cmd in $cmds; do
          IFS="$save_ifs"
          eval cmd=\"$cmd\"
-         $show "$cmd"
-         $run eval "$cmd" || exit $?
+         func_show_eval "$cmd" 'exit $?'
        done
        IFS="$save_ifs"
       fi
 
       if test -n "$gentop"; then
-       $show "${RM}r $gentop"
-       $run ${RM}r $gentop
+       func_show_eval '${RM}r "$gentop"'
       fi
 
       exit $EXIT_SUCCESS
@@ -5471,14 +5440,12 @@ EOF
        link_command="$compile_command$compile_rpath"
 
        # We have no uninstalled library dependencies, so finalize right now.
-       $show "$link_command"
-       $run eval "$link_command"
+       func_show_eval "$link_command"
        status=$?
 
        # Delete the generated files.
        if test -f "$output_objdir/${outputname}S.${objext}"; then
-         $show "$RM $output_objdir/${outputname}S.${objext}"
-         $run $RM "$output_objdir/${outputname}S.${objext}"
+         func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
        fi
 
        exit $status
@@ -5546,10 +5513,9 @@ EOF
        # Replace the output file specification.
        link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
        # Delete the old output file.
-       $run $RM $output
+       $opt_dry_run || $RM $output
        # Link the executable and exit
-       $show "$link_command"
-       $run eval "$link_command" || exit $?
+       func_show_eval "$link_command" 'exit $?'
        exit $EXIT_SUCCESS
       fi
 
@@ -5579,10 +5545,9 @@ EOF
       link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
-      $run $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
-      $show "$link_command"
-      $run eval "$link_command" || exit $?
+      func_show_eval "$link_command" 'exit $?'
 
       # Now create the wrapper script.
       func_echo "creating $output"
@@ -5615,8 +5580,8 @@ EOF
        qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
       fi
 
-      # Only actually do things if our run command is non-null.
-      if test -z "$run"; then
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
        # win32 will think the script is a binary if it has
        # a .exe suffix, so we strip it off here.
        case $output in
@@ -5972,7 +5937,7 @@ EOF
          # are only useful if you want to execute the "real" binary.
          # Since the "real" binary is built for $host, then this
          # wrapper might as well be built for $host, too.
-         $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+         $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
          ;;
        esac
        $RM $output
@@ -6150,7 +6115,7 @@ else
 fi\
 "
        chmod +x $output
-      fi
+      }
       exit $EXIT_SUCCESS
       ;;
     esac
@@ -6261,16 +6226,13 @@ fi\
       for cmd in $cmds; do
        eval cmd=\"$cmd\"
        IFS="$save_ifs"
-       $show "$cmd"
-       $run eval "$cmd" || exit $?
+       func_show_eval "$cmd" 'exit $?'
       done
       IFS="$save_ifs"
     done
 
-    if test -n "$generated"; then
-      $show "${RM}r$generated"
-      $run ${RM}r$generated
-    fi
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
 
     # Now create the libtool archive.
     case $output in
@@ -6298,7 +6260,7 @@ fi\
       fi
 
       # Only create the output if not a dry run.
-      if test -z "$run"; then
+      $opt_dry_run || {
        for installed in no yes; do
          if test "$installed" = yes; then
            if test -z "$install_libdir"; then
@@ -6425,12 +6387,11 @@ libdir='$install_libdir'"
 relink_command=\"$relink_command\""
          fi
        done
-      fi
+      }
 
       # Do a symbolic link so that the libtool archive can be found in
       # LD_LIBRARY_PATH before the program is installed.
-      $show "(cd $output_objdir && $RM $outputname && $LN_S ../$outputname $outputname)"
-      $run eval '(cd $output_objdir && $RM $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
       ;;
     esac
     exit $EXIT_SUCCESS
@@ -6518,8 +6479,7 @@ func_mode_uninstall ()
              for cmd in $cmds; do
                IFS="$save_ifs"
                eval cmd=\"$cmd\"
-               $show "$cmd"
-               $run eval "$cmd"
+               func_show_eval "$cmd"
                if test "$?" -ne 0 && test "$rmforce" != yes; then
                  exit_status=1
                fi
@@ -6534,8 +6494,7 @@ func_mode_uninstall ()
              for cmd in $cmds; do
                IFS="$save_ifs"
                eval cmd=\"$cmd\"
-               $show "$cmd"
-               $run eval "$cmd"
+               func_show_eval "$cmd"
                if test "$?" -ne 0 && test "$rmforce" != yes; then
                  exit_status=1
                fi
@@ -6598,16 +6557,14 @@ func_mode_uninstall ()
        fi
        ;;
       esac
-      $show "$RM $rmfiles"
-      $run $RM $rmfiles || exit_status=1
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
     objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
       if test -d "$dir"; then
-       $show "rmdir $dir"
-       $run rmdir $dir >/dev/null 2>&1
+       func_show_eval "rmdir $dir >/dev/null 2>&1"
       fi
     done
 
index 32112a0771f4f9a2325ec6d9c925c2a938bf2cd8..d8e8b166802b8594a5ea4772594bf55a887681a6 100755 (executable)
@@ -39,7 +39,7 @@ after=$objdir/temp/temp/after
 # Create a new libtool script that will enter dry run if the environment
 # variable force_dry_run is set
 rm -f $objdir/libtool.new
-sed 's/^run=$/run=${force_dry_run+:}/' < libtool > $objdir/libtool.new
+sed 's/^opt_dry_run=.*$/opt_dry_run=${force_dry_run-false}/' < libtool > $objdir/libtool.new
 chmod +x $objdir/libtool.new
 mv libtool $objdir/libtool
 mv $objdir/libtool.new libtool
@@ -51,7 +51,7 @@ func_make main.$objext
 
 func_msg "Making object files in mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
-force_dry_run=yes $MAKE foo1.lo foo2.lo sub.lo || exit $?
+force_dry_run=: $MAKE foo1.lo foo2.lo sub.lo || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
@@ -59,7 +59,7 @@ func_make foo1.lo foo2.lo libsub.la
 
 func_msg "Making libraries in mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
-force_dry_run=yes $MAKE foo1.la libfoo2.la || exit $?
+force_dry_run=: $MAKE foo1.la libfoo2.la || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
@@ -67,7 +67,7 @@ func_make foo1.la libfoo2.la
 
 func_msg "Making programs in ../mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
-force_dry_run=yes $MAKE mdemo$EXEEXT mdemo_static$EXEEXT 1>&2 || exit $?
+force_dry_run=: $MAKE mdemo$EXEEXT mdemo_static$EXEEXT 1>&2 || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
@@ -79,7 +79,7 @@ func_mkdir_p "$prefix/bin"
 func_mkdir_p "$prefix/lib"
 ls -l . $objdir | grep -v total > $before
 ls -lR $prefix | grep -v total >> $before
-force_dry_run=yes $MAKE install 1>&2 || exit 1
+force_dry_run=: $MAKE install 1>&2 || exit 1
 ls -l . $objdir | grep -v total > $after
 ls -lR $prefix | grep -v total >> $after
 cmp $before $after > /dev/null || exit 1
@@ -91,7 +91,7 @@ func_msg "Running $MAKE uninstall in ../mdemo (dry run)"
 rm -f "$prefix/bin/mdemo$EXEEXT" "$prefix/bin/mdemo_static$EXEEXT"
 ls -l . $objdir | grep -v total > $before
 ls -lR $prefix | grep -v total >> $before
-force_dry_run=yes $MAKE uninstall 1>&2 || exit $?
+force_dry_run=: $MAKE uninstall 1>&2 || exit $?
 ls -l . $objdir | grep -v total > $after
 ls -lR $prefix | grep -v total >> $after
 cmp $before $after > /dev/null || exit 1