* lib/install.sh: Handle --, and diagnose unknown options.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2006 19:58:01 +0000 (19:58 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2006 19:58:01 +0000 (19:58 +0000)
* 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.

ChangeLog
lib/install-sh
m4/mkdirp.m4

index f5ec487..35bbdcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * 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  <adl@gnu.org>
 
        * m4/amversion.in (_AM_AUTOCONF_VERSION): New macro.
index fd2e75a..36df0da 100755 (executable)
@@ -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
index 30ee9db..02d7e5f 100644 (file)
@@ -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