Hello,

On Wed, Apr 19, 2006 at 01:02:30AM -0700, Paul Eggert wrote:
> [...], but now that
> $(mkdir_p) is intended to mean 'mkdir -p' I think it's more consistent
> for the expansion to not include the '--'.

I think it is more practical to have $(mkdir_p) set to 'mkdir -p --'.

And you can often write
        $(mkdir_p) $(directory_list)
without knowing exactly the names of the directories.  It's natural to
forget that the directory name might start with a dash.

And $(mkdir_p) cannot be used with an option anyway.

So I propose the following variation of your patch.
(The install-sh part remains unchanged.)

Have a nice day,
        Stepan
2006-04-19  Paul Eggert  <[EMAIL PROTECTED]>
        and Stepan Kasal  <[EMAIL PROTECTED]> 

        * lib/install.sh: Handle --, and diagnose unknown options.
        * m4/mkdirp.m4 (AM_PROG_MKDIR_P): Use '$(install_sh) -d --' as
        the fallback, for consistency with 'mkdir -p --'.

Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.29
diff -u -r1.29 install-sh
--- lib/install-sh      12 Jan 2006 21:11:14 -0000      1.29
+++ lib/install-sh      19 Apr 2006 11:04:28 -0000
@@ -109,7 +109,7 @@
   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 @@
 
     --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 
[EMAIL PROTECTED]
-       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 [EMAIL 
PROTECTED]
+  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: m4/mkdirp.m4
===================================================================
RCS file: /cvs/automake/automake/m4/mkdirp.m4,v
retrieving revision 1.8
diff -u -r1.8 mkdirp.m4
--- m4/mkdirp.m4        7 Aug 2005 08:10:06 -0000       1.8
+++ m4/mkdirp.m4        19 Apr 2006 11:04:30 -0000
@@ -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,
@@ -57,11 +57,6 @@
   do
     test -d $d && rmdir $d
   done
-  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
-  if test -f "$ac_aux_dir/mkinstalldirs"; then
-    mkdir_p='$(mkinstalldirs)'
-  else
-    mkdir_p='$(install_sh) -d'
-  fi
+  mkdir_p='$(install_sh) -d --'
 fi
 AC_SUBST([mkdir_p])])

Reply via email to