]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* tests/missing3.test: New file (check for Paolo's change below).
authorAlexandre Duret-Lutz <adl@gnu.org>
Tue, 7 Sep 2004 06:25:33 +0000 (06:25 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Tue, 7 Sep 2004 06:25:33 +0000 (06:25 +0000)
* tests/Makefile.am (TESTS): Add missing3.test.

* missing: Handle all command line options together.  Add a
separate case statement to detect failed runs, and fail
silently there if --help or --version is passed to the program.

ChangeLog
lib/missing
tests/Makefile.am
tests/Makefile.in
tests/missing3.test [new file with mode: 0755]

index fe3e2cbc5dde5006ebd5b0e5e686b5d5447902a0..f1e132707500c61bb5933b5aa5e85c35b66b3c63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-09-07  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * tests/missing3.test: New file (check for Paolo's change below).
+       * tests/Makefile.am (TESTS): Add missing3.test.
+
+2004-09-07  Paolo Bonzini  <bonzini@gnu.org>
+
+       * missing: Handle all command line options together.  Add a
+       separate case statement to detect failed runs, and fail
+       silently there if --help or --version is passed to the program.
+
 2004-08-11  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * lib/config.guess, lib/texinfo.tex: New upstream versions.
index e7ef83a1c2512ce091a7c622ece4ade5bf4acf98..64b5f901dd558f301c33a0fb99466b48eb58a27f 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2003-09-02.23
+scriptversion=2004-09-07.08
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
 #   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
@@ -60,11 +60,6 @@ case "$1" in
     msg="probably too old"
   fi
   ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
 
   -h|--h|--he|--hel|--help)
     echo "\
@@ -92,10 +87,12 @@ Supported PROGRAM values:
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Send bug reports to <bug-automake@gnu.org>."
+    exit 0
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
     echo "missing $scriptversion (GNU Automake)"
+    exit 0
     ;;
 
   -*)
@@ -104,12 +101,42 @@ Send bug reports to <bug-automake@gnu.org>."
     exit 1
     ;;
 
-  aclocal*)
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
        exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
     fi
+    ;;
+esac
 
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
@@ -119,11 +146,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -133,11 +155,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -157,11 +174,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -173,11 +185,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -254,11 +261,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
         you modified a dependency of a manual page.  You may need the
@@ -279,11 +281,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -301,10 +298,6 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   tar)
     shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
 
     # We have already tried tar in the generic part.
     # Look for gnutar/gtar before invocation to avoid ugly error
index aedb8b4a8d1833559ad4ffe46f065133f880f3a6..3d75dafb9603231adb60d6835fdc1c7954da08c0 100644 (file)
@@ -332,6 +332,7 @@ mdate3.test \
 mdate4.test \
 missing.test \
 missing2.test \
+missing3.test \
 mkinst2.test \
 mkinstall.test \
 mmodely.test \
index 8616c3587e3fd0394735ad0c9bc05a64127ce5bb..552b314cf3673f5f9456f6c294a80000097ca411 100644 (file)
@@ -450,6 +450,7 @@ mdate3.test \
 mdate4.test \
 missing.test \
 missing2.test \
+missing3.test \
 mkinst2.test \
 mkinstall.test \
 mmodely.test \
diff --git a/tests/missing3.test b/tests/missing3.test
new file mode 100755 (executable)
index 0000000..2597165
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2004  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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, or (at your option)
+# any later version.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test missing when running a tool's --version.
+
+. ./defs || exit 1
+
+set -e
+
+# b7cb8259 assumed not to exist.
+
+./missing b7cb8259 --version 2>stderr && exit 1
+grep . stderr && exit 1
+./missing b7cb8259 --grep 2>stderr && exit 1
+grep WARNING stderr
+
+./missing --run b7cb8259 --version && exit 1
+./missing --run b7cb8259 --grep 2>stderr && exit 1
+grep WARNING stderr
+
+# missing itself it known to exist :)
+
+./missing ./missing --version 2>stderr && exit 1
+grep . stderr && exit 1
+./missing ./missing --grep 2>stderr && exit 1
+grep WARNING stderr
+
+./missing --run ./missing --version 2>stderr
+grep . stderr && exit 1
+./missing --run ./missing --grep 2>stderr && exit 1
+grep WARNING stderr && exit 1
+grep Unknown stderr