From: Paul Eggert Date: Mon, 24 Apr 2006 19:58:01 +0000 (+0000) Subject: * lib/install.sh: Handle --, and diagnose unknown options. X-Git-Tag: Release-1-9b~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65b495783036f9d4707375cc18c490463591b615;p=thirdparty%2Fautomake.git * lib/install.sh: Handle --, and diagnose unknown options. * m4/mkdirp.m4 (AM_PROG_MKDIR_P): In the normal case, set mkdir_p='mkdir -p', not to 'mkdir -p --', for consistency with the other ways that mkdir_p might be set. --- diff --git a/ChangeLog b/ChangeLog index f5ec487cd..35bbdcc4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-24 Paul Eggert + + * lib/install.sh: Handle --, and diagnose unknown options. + * m4/mkdirp.m4 (AM_PROG_MKDIR_P): In the normal case, set + mkdir_p='mkdir -p', not to 'mkdir -p --', for consistency with + the other ways that mkdir_p might be set. + 2006-04-21 Alexandre Duret-Lutz * m4/amversion.in (_AM_AUTOCONF_VERSION): New macro. diff --git a/lib/install-sh b/lib/install-sh index fd2e75a02..36df0da0c 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -109,7 +109,7 @@ Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " -while test -n "$1"; do +while test $# -ne 0; do case $1 in -c) shift continue;; @@ -150,25 +150,33 @@ while test -n "$1"; do --version) echo "$0 $scriptversion"; exit $?;; - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done + --) shift break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; esac done -if test -z "$1"; then +if test $# -ne 0 && test -z "$dir_arg$dstarg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done +fi + +if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 diff --git a/m4/mkdirp.m4 b/m4/mkdirp.m4 index 30ee9db68..02d7e5f9b 100644 --- a/m4/mkdirp.m4 +++ b/m4/mkdirp.m4 @@ -1,5 +1,5 @@ ## -*- Autoconf -*- -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -29,7 +29,7 @@ # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to define $(mkdir_p) as `mkdir -p -- .', in order to + # We used to define $(mkdir_p) as `mkdir -p .', in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However we don't do @@ -48,7 +48,7 @@ AC_DEFUN([AM_PROG_MKDIR_P], # 3. $(mkdir_p) is named after `mkdir -p' and we don't expect this # to accept no argument. # 4. having something like `mkdir .' in the output is unsightly. - mkdir_p='mkdir -p --' + mkdir_p='mkdir -p' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as