From 806e21149915e8a0c110069bbd9d8bf516d580a6 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 7 Aug 2005 08:10:06 +0000 Subject: [PATCH] * m4/mkdirp.m4: Update misleading comment about `mkdir -p .'. Prompted by Stepan Kasal. --- ChangeLog | 5 +++++ m4/mkdirp.m4 | 34 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8801539..f2e10c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-07 Alexandre Duret-Lutz + + * m4/mkdirp.m4: Update misleading comment about `mkdir -p .'. + Prompted by Stepan Kasal. + 2005-08-07 Stepan Kasal * lib/am/texinfos.am (uninstall-info-am): Call install-info only if diff --git a/m4/mkdirp.m4 b/m4/mkdirp.m4 index d49b608..30ee9db 100644 --- a/m4/mkdirp.m4 +++ b/m4/mkdirp.m4 @@ -25,30 +25,34 @@ # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures +# restrict ourselves to GNU mkdir (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, 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 this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. + # where $(somedir) is conditionally defined. However we don't do + # that anymore. + # 1. before we restricted the check to GNU mkdir, `mkdir -p .' was + # reported to fail in read-only directories. The system where this + # happened has been forgotten. + # 2. in practice we call $(mkdir_p) on directories such as + # $(mkdir_p) "$(DESTDIR)$(somedir)" + # and we don't want to create $(DESTDIR) if $(somedir) is empty. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) "$(DESTDIR)$(somedir)" + # so $(mkdir_p) always has an argument. + # We will have better chances of detecting a missing test if + # $(mkdir_p) complains about missing arguments. + # 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 --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. + # directories to create. for d in ./-p ./--version; do test -d $d && rmdir $d -- 2.7.4