On 07/09/2012 09:22 AM, Jim Meyering wrote:
>
> Hi Stefano,
> 
> I see that @mkdir_p@ is used in gettext's Makefile.in.in template:
> 
>   # We use $(mkdir_p).
>   # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
>   # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
>   # @install_sh@ does not start with $(SHELL), so we add it.
>   # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is 
> defined
>   # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these 
> automake
>   # versions, $(mkinstalldirs) and $(install_sh) are unused.
>   mkinstalldirs = $(SHELL) @install_sh@ -d
>   install_sh = $(SHELL) @install_sh@
>   MKDIR_P = @MKDIR_P@
>   mkdir_p = @mkdir_p@
> 
> Since that file is copied into many projects,
> I'd recommend to substitute @mkdir_p@, as well.
>
That is simply enough to do if we content ourselves with a substitution
that makes it usable in Makefiles only:

    AC_SUBST([mkdir_p], ['$(MKDIR_P)'])

See attached patch.  OK?

Regards,
  Stefano
>From bcc3baae5b6e58132d304e41db79cfa5b27d3bcc Mon Sep 17 00:00:00 2001
Message-Id: <bcc3baae5b6e58132d304e41db79cfa5b27d3bcc.1341822836.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Mon, 9 Jul 2012 10:33:49 +0200
Subject: [PATCH] compat: automake should substitute @mkdir_p@, for backward
 compatibility

That has been unwittingly broken by commit v1.12-19-g7a1eb9f of 2012-04-28,
"AM_PROG_MKDIR_P: deprecate, to be removed in Automake 1.13". We thought it
wasn't a big deal, but Jim Meyering reported that @mkdir_p@ is used in
gettext's Makefile.in.in template:
<http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>

* lib/am/header-vars.am (mkdir_p): Don't define.
* m4/init.m4 (AM_INIT_AUTOMAKE): AC_SUBST 'mkdir_p' with $(MKDIR_P).
* t/mkdir_p.sh, t/mkdirp-deprecation.sh: Enhance.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 NEWS                    |    8 ++++----
 lib/am/header-vars.am   |    5 -----
 m4/init.m4              |    5 +++++
 t/mkdir_p.sh            |   12 ++++++++----
 t/mkdirp-deprecation.sh |   12 ++++++++----
 5 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/NEWS b/NEWS
index d38554d..eaab9d1 100644
--- a/NEWS
+++ b/NEWS
@@ -6,10 +6,10 @@ New in 1.12.2:
     long-deprecated 'configure.in' name for the Autoconf input file.
     You are advised to use the recommended name 'configure.ac' instead.
 
-  - The long-obsolete (since automake 1.10) @mkdir_p@ configure-time
-    substitution and AM_PROG_MKDIR m4 macro will be removed in Automake
-    1.13.  The $(mkdir_p) should still remain available for the moment
-    though.
+  - The long-obsolete (since automake 1.10) AM_PROG_MKDIR m4 macro will
+    be removed in Automake 1.13.  The $(mkdir_p) make variable and the
+    @mkdir_p@ substitution should still remain available (as aliases of
+    $(MKDIR_P)) for the moment, for better backward compatibility.
 
   - Autoconf 2.65 or later will be required by the next major Automake
     version (1.13).  Until now, Automake has required Autoconf version
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index c65e08c..ba4aa0b 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -77,11 +77,6 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 
-# For better backward compatibility.  To be removed once Automake 1.9.x
-# dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-mkdir_p = $(MKDIR_P)
-
 ## dejagnu.am uses these variables.  Some users might rely on them too.
 ?BUILD?build_triplet = @build@
 ?HOST?host_triplet = @host@
diff --git a/m4/init.m4 b/m4/init.m4
index 85228ba..cf47e76 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -82,6 +82,11 @@ AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
diff --git a/t/mkdir_p.sh b/t/mkdir_p.sh
index 624365c..2cc68a3 100755
--- a/t/mkdir_p.sh
+++ b/t/mkdir_p.sh
@@ -27,17 +27,21 @@ END
 cat > Makefile.am << 'END'
 SUBDIRS = sub
 all-local:
-	$(mkdir_p) . dir1/dir2
+	$(mkdir_p) . dir1/a
+	@mkdir_p@ . dir2/b
 check-local: all
-	test -d dir1/dir2
-	test -d dir1/dir3
+	test -d dir1/a
+	test -d dir2/b
+	test -d dir3/c
+	test -d dir3/d
 END
 
 mkdir sub
 cat > sub/Makefile.am << 'END'
 # '$(mkdir_p)' should continue to work even in subdir makefiles.
 all-local:
-	$(mkdir_p) .. ../dir1/dir3
+	$(mkdir_p) .. ../dir3/c
+	@mkdir_p@ .. ../dir3/d
 END
 
 $ACLOCAL
diff --git a/t/mkdirp-deprecation.sh b/t/mkdirp-deprecation.sh
index 0257391..68ffa58 100755
--- a/t/mkdirp-deprecation.sh
+++ b/t/mkdirp-deprecation.sh
@@ -29,17 +29,21 @@ END
 cat > Makefile.am << 'END'
 SUBDIRS = sub
 all-local:
-	$(mkdir_p) . dir1/dir2
+	$(mkdir_p) . dir1/a
+	@mkdir_p@ . dir2/b
 check-local: all
-	test -d dir1/dir2
-	test -d dir1/dir3
+	test -d dir1/a
+	test -d dir2/b
+	test -d dir3/c
+	test -d dir3/d
 END
 
 mkdir sub
 cat > sub/Makefile.am << 'END'
 # '$(mkdir_p)' should continue to work even in subdir makefiles.
 all-local:
-	$(mkdir_p) .. ../dir1/dir3
+	$(mkdir_p) .. ../dir3/c
+	@mkdir_p@ .. ../dir3/d
 END
 
 grep_err ()
-- 
1.7.9.5

Reply via email to