From: Alexandre Duret-Lutz Date: Tue, 7 Sep 2004 06:25:33 +0000 (+0000) Subject: * tests/missing3.test: New file (check for Paolo's change below). X-Git-Tag: Release-1-9b~312 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=533cf320d71dd7319677a4796dfd952d87386b67;p=thirdparty%2Fautomake.git * tests/missing3.test: New file (check for Paolo's change below). * 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. --- diff --git a/ChangeLog b/ChangeLog index fe3e2cbc5..f1e132707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-09-07 Alexandre Duret-Lutz + + * tests/missing3.test: New file (check for Paolo's change below). + * tests/Makefile.am (TESTS): Add missing3.test. + +2004-09-07 Paolo Bonzini + + * 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 * lib/config.guess, lib/texinfo.tex: New upstream versions. diff --git a/lib/missing b/lib/missing index e7ef83a1c..64b5f901d 100755 --- a/lib/missing +++ b/lib/missing @@ -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 , 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 ." + 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 ." 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 diff --git a/tests/Makefile.am b/tests/Makefile.am index aedb8b4a8..3d75dafb9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -332,6 +332,7 @@ mdate3.test \ mdate4.test \ missing.test \ missing2.test \ +missing3.test \ mkinst2.test \ mkinstall.test \ mmodely.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 8616c3587..552b314cf 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..25971657c --- /dev/null +++ b/tests/missing3.test @@ -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