From 8b59ef86cb293fd7debf242d51544e8fa71aba0c Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Wed, 10 May 2006 20:47:36 +0000 Subject: [PATCH] * lib/missing: Remove superfluous quotes. Replace all uses of `[' by `test', for consistency, and for.. * tests/missing5.test: ..this new test. * tests/Makefile.am: Update. --- ChangeLog | 5 ++++ lib/missing | 34 +++++++++++++-------------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/missing5.test | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 17 deletions(-) create mode 100755 tests/missing5.test diff --git a/ChangeLog b/ChangeLog index 5900fc6f9..a74c1823b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-05-10 Ralf Wildenhues + * lib/missing: Remove superfluous quotes. Replace all uses of + `[' by `test', for consistency, and for.. + * tests/missing5.test: ..this new test. + * tests/Makefile.am: Update. + * lib/missing (sed_minuso, sed_output): New variables. (autom4te, help2man, makeinfo): Use them. Unifies detection of `-o FILE', `--output FILE', `--output=FILE', stricter regex. diff --git a/lib/missing b/lib/missing index fb4f10c49..1c8ff7049 100755 --- a/lib/missing +++ b/lib/missing @@ -1,7 +1,7 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2006-05-10.22 +scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. @@ -46,7 +46,7 @@ fi msg="missing on your system" -case "$1" in +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= @@ -109,7 +109,7 @@ 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 +case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; @@ -138,7 +138,7 @@ esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case "$1" in +case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -167,7 +167,7 @@ WARNING: \`$1' is $msg. You should only need it if test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -217,25 +217,25 @@ WARNING: \`$1' $msg. You should only need it if in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; @@ -247,18 +247,18 @@ WARNING: \`$1' is $msg. You should only need it if in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; @@ -324,13 +324,13 @@ WARNING: \`$1' is $msg. You should only need it if fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1210b5ba7..bbe570a0c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -358,6 +358,7 @@ missing.test \ missing2.test \ missing3.test \ missing4.test \ +missing5.test \ mkinstall.test \ mkinst2.test \ mkinst3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index c1d4da042..c4f80cde8 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -488,6 +488,7 @@ missing.test \ missing2.test \ missing3.test \ missing4.test \ +missing5.test \ mkinstall.test \ mkinst2.test \ mkinst3.test \ diff --git a/tests/missing5.test b/tests/missing5.test new file mode 100755 index 000000000..aac834b21 --- /dev/null +++ b/tests/missing5.test @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# test how well `missing' finds output file names of various tools. +# PR automake/483. + +. ./defs || exit 1 + +set -e + +# these programs may be invoked by `missing' +needed_tools='chmod find sed test touch' +needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'` + +cat >configure.in <$tool.in < output-file +cp output-file my--output--file-o + +save_PATH=$PATH +PATH=. +export PATH +missing --help +missing --version +for tool in autom4te help2man makeinfo; do + missing --run $tool -o my--output--file-o input + missing --run $tool --output my--output--file-o input +done +PATH=$save_PATH +export PATH +diff output-file my--output--file-o +test ! -f ./--file-o +test ! -f input -- 2.11.4.GIT