automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {master} compat: restore AM_PROG_MKDIR, again


From: Stefano Lattarini
Subject: [PATCH] {master} compat: restore AM_PROG_MKDIR, again
Date: Mon, 14 Jan 2013 22:50:26 +0100

OK, this is getting ridiculous, but we cannot remove this macro yet
(and, yes, the fault for this mess lies entirely on me; let's not
dwell on that, thank you very much).

Gettext (so far the greatest "offender" in the use of AM_PROG_MKDIR), in
its latest release 0.18.2, has removed all the uses of that macro still
present in its code base.  So I thought we could finally and safely
remove it.  Wrong.  If a package's 'configure.ac' contains a call like:

   AM_GNU_GETTEXT_VERSION([0.18])

then the 'autopoint' script will bring the data files from the Gettext
release *1.18* into the package's tree -- yes, even even if the developer
has installed *and is using* Gettext 1.18.2!  Now, these data files
comprise m4 files (that will be seen by subsequent aclocal and autoconf
calls), and of course, the pre-0.18.2 version of some of these files
still contains occurrences of AM_PROG_MKDIR_P -- so Automake 1.13 errors
out, and we lose.  This has already happened in practice:

  <http://lists.gnu.org/archive/html/bug-grep/2013-01/msg00003.html>

Moreover, while we might see it as not unreasonable to ask a developer
using Automake 1.13 to also update Gettext 1.18.2, that would not
be enough; in order for gettext to use the correct data files, our
developer would have to update his configure.ac to read:

   AM_GNU_GETTEXT_VERSION([0.18.2])

thus requiring *all* of his co-developers to install Gettext 1.18.2,
even if they are still using, say, Automake 1.12.6.  Bad.

So we re-instate this macro as a simple alias for AC_PROG_MKDIR (plus
a non-fatal runtime warning in the 'obsolete' category), and drop any
plan to remove it (see how much good those plans have done us so far).

Note that NEWS is not yet adjusted, since we'll have to adjust it in
maint before (to minimize spurious merge conflicts).

* doc/automake.texi: Update.
* PLANS/obsolete-removed/am-prog-mkdir-p.txt: Likewise.
* t/gettext-macros.sh: Adjust.
* t/am-prog-mkdir-p.sh: New test.
* t/mkdir_p.sh: Remove, folded into the new one.
* t/am-prog-mkdir-p-no-more: Remove as superseded.
* t/list-of-tests.mk: Adjust.
* t/obsolete-err.m4: Re-instate AM_PROG_MKDIR_P as a working
alias for AC_PROG_MKDIR_P (albeit giving runtime warnings, and
calling AC_SUBST on 'mkdir_p' too).
* m4/init.m4 (AM_INIT_AUTOMAKE): No longer call AC_SUBST for
'mkdir_p', as that is once again AM_PROG_MKDIR_P's business.

Signed-off-by: Stefano Lattarini <address@hidden>
---

 I don't think anyone will object to this, but I'll wait some time
 before pushing, in case someone feels like doing a quick review.

 Regards,
   Stefano

 PLANS/obsolete-removed/am-prog-mkdir-p.txt | 72 +++---------------------------
 doc/automake.texi                          | 27 +++++++++--
 m4/init.m4                                 |  5 ---
 m4/obsolete-err.m4                         | 18 ++++----
 t/am-prog-mkdir-p-no-more.sh               | 44 ------------------
 t/{mkdir_p.sh => am-prog-mkdir-p.sh}       | 33 ++++++++++----
 t/gettext-macros.sh                        | 13 +++---
 t/list-of-tests.mk                         |  3 +-
 8 files changed, 72 insertions(+), 143 deletions(-)
 delete mode 100755 t/am-prog-mkdir-p-no-more.sh
 rename t/{mkdir_p.sh => am-prog-mkdir-p.sh} (56%)

diff --git a/PLANS/obsolete-removed/am-prog-mkdir-p.txt 
b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
index b096ece..4143fac 100644
--- a/PLANS/obsolete-removed/am-prog-mkdir-p.txt
+++ b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
@@ -1,67 +1,9 @@
-In Automake 1.13.x
-------------------
+We have dropped any plan to remove the obsolescent macro AM_PROG_MKDIR_P,
+(today just an alias for the Autoconf-provided macro AC_PROG_MKDIR_P), as
+well as the related $(mkdir_p) make variable and the @mkdir_p@ configure
+substitution.
 
-We had already scheduled the removal of the long-deprecated AM_PROG_MKDR_P
-macro (superseded by the autoconf-provided one AC_PROG_MKDIR_P) for
-Automake 1.13 -- see commit 'v1.12-20-g8a1c64f'.
+That planned removal has already proven source of countless headaches and
+backward-compatibility issues, which vastly outweigh any "clean-up benefit"
+we would get from the removal of that obsolescent but unobtrusive cruft.
 
-Alas, it turned out the latest Gettext version at the time (0.18.1.1) was
-still using that macro:
-
-  <http://lists.gnu.org/archive/html/automake/2012-09/msg00010.html>
-
-And since the maintenance of Gettext was stalled, we couldn't get a fix
-committed and released in time for the appearance of automake 1.13:
-
-  <http://lists.gnu.org/archive/html/bug-gettext/2012-04/msg00018.html>
-  <http://lists.gnu.org/archive/html/bug-gettext/2012-06/msg00012.html>
-  <http://lists.gnu.org/archive/html/bug-gettext/2012-10/msg00001.html>
-
-So, on a strong advice by Jim Meyering, in commit 'v1.12.4-158-gdf23daf'
-we re-introduced AM_PROG_MKDIR_P in Automake.  That has been an
-unfortunate necessity (thanks to Jim for having convinced me of that in
-time!)
-
-
-For Automake 1.14
------------------
-
-Finally, AM_PROG_MKDR_P we'll be fully obsolete in in Automake 1.14 (see
-commit 'v1.12.4-174-g5a28948', merged in master by 'v1.13-5-gb373ad9'),
-while still offering a clear error message for the moment (see follow-up
-commit 'v1.13-30-gd01834b').
-
-We can finally do so because Gettext has got a maintainer in the meantime,
-and a new release has been made that no longer uses AM_PROG_MKDIR_P:
-
-  <http://lists.gnu.org/archive/html/bug-gettext/2012-12/msg00064.html>
-
-We still keep the obsolete '@mkdir_p@' substitution and '$(mkdir_p)'
-variable around though, since they are still used by 'Makefile.in.in'
-template from gettext:
-
-  $ cd ~/src/gettext
-  $ git checkout master
-  $ git describe
-  v0.18.2-4-g3188bbf
-  $ grep mkdir_p gettext-runtime/po/Makefile.in.in | grep -v '^#'
-  mkdir_p = @mkdir_p@
-       $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
-       $(mkdir_p) $(DESTDIR)$$dir; \
-       $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
-       $(mkdir_p) $(DESTDIR)$$dir; \
-
-(see also Automake commit v1.12.1-112-g2551021).
-
-More to the point, it's almost impossible to diagnose usages of those
-macro and substitution using the existing Automake parsing and warning
-infrastructure; it's much easier to just keep them around for a while.
-
-
-The future
-----------
-
-We want to finally remove '@mkdir_p@' and '$(mkdir_p)' as well some
-day.  It would be nice if we could do so with some kind of deprecation,
-but that is not worth too much work.  Anyway, no hurry an no high
-priority for this removal.
diff --git a/doc/automake.texi b/doc/automake.texi
index 6ec14b0..5eaa277 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -4050,10 +4050,10 @@ define @code{WITH_DMALLOC} and add @option{-ldmalloc} 
to @code{LIBS}.
 @cindex obsolete macros
 
 Although using some of the following macros was required in past
-releases, you should not use any of them in new code.  Also, all
-these macros will be @emph{removed in some future Automake version},
-so you should consider updating your @file{configure.ac} to avoid
-problems in the future.
+releases, you should not use any of them in new code.  Also, most
+of these macros will probably be @emph{removed in some future Automake
+version}, so you should consider updating your @file{configure.ac}
+to avoid problems in the future.
 
 @table @code
 
@@ -4064,6 +4064,25 @@ This is an @emph{obsolete wrapper} around 
@code{AC_PROG_CC_C_O}.  New
 code needs not to use this macro.  It will be deprecated, and then
 removed, in future Automake versions.
 
address@hidden AM_PROG_MKDIR_P
address@hidden AM_PROG_MKDIR_P
address@hidden @code{mkdir -p}, macro check
address@hidden MKDIR_P
address@hidden mkdir_p
+
+From Automake 1.8 to 1.9.6 this macro used to define the output
+variable @code{mkdir_p} to one of @code{mkdir -p}, @code{install-sh
+-d}, or @code{mkinstalldirs}.
+
+Nowadays Autoconf provides a similar functionality with
address@hidden (@pxref{Particular Programs, , Particular
+Program Checks, autoconf, The Autoconf Manual}), however this defines
+the output variable @code{MKDIR_P} instead.  In case you are still
+using the @code{AM_PROG_MKDIR_P} macro in your @file{configure.ac},
+or its provided variable @code{$(mkdir_p)} in your @file{Makefile.am},
+you are advised to switch ASAP to the more modern Autoconf-provided
+interface instead.
+
 @end table
 
 @node Private Macros
diff --git a/m4/init.m4 b/m4/init.m4
index 6857c44..d7d4013 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -79,11 +79,6 @@ 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/m4/obsolete-err.m4 b/m4/obsolete-err.m4
index a94a651..1ba6df3 100644
--- a/m4/obsolete-err.m4
+++ b/m4/obsolete-err.m4
@@ -1,6 +1,5 @@
 #  -*- Autoconf -*-
-# Obsolete and "removed" macros, that must however still report explicit
-# error messages when used, to smooth transition.
+# Deprecated, obsolescent or and obsolete macros.
 #
 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
@@ -8,6 +7,14 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])dnl
+AC_DIAGNOSE([obsolete],
+[macro '$0' is deprecated.
+You should use the Autoconf-provided 'AC][_PROG_MKDIR_P' macro instead,
+and use '$(MKDIR_P)' instead of '$(mkdir_p)' in your Makefile.am files.])])
+
 dnl TODO: Remove in Automake 1.15.
 AC_DEFUN([AM_CONFIG_HEADER],
 [AC_FATAL(['$0': this macro is obsolete.
@@ -20,13 +27,6 @@ AC_DEFUN([AM_PROG_CC_STDC],
     Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
     but upon 'ac_cv_prog_cc_stdc'.])])
 
-dnl TODO: Remove in Automake 1.16.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_FATAL(['$0': this macro is obsolete.
-    You should simply use the 'AC][_PROG_MKDIR_P' macro instead, and
-    use '$(MKDIR_P)' instead of '$(mkdir_p)' in your Makefile.am
-    files.])])
-
 dnl TODO: Remove in Automake 1.14.
 AC_DEFUN([AM_C_PROTOTYPES],
          [AC_FATAL([automatic de-ANSI-fication support has been removed])])
diff --git a/t/am-prog-mkdir-p-no-more.sh b/t/am-prog-mkdir-p-no-more.sh
deleted file mode 100755
index 78a3ef9..0000000
--- a/t/am-prog-mkdir-p-no-more.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2012-2013 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Check that any attempt to use the obsolete macro AM_PROG_MKDIR_P
-# elicits clear and explicit fatal errors.
-
-. test-init.sh
-
-geterr ()
-{
-    "$@" -Wnone 2>stderr && { cat stderr >&2; exit 1; }
-    cat stderr >&2
-    grep "^configure\.ac:4:.*'AM_PROG_MKDIR_P'.*obsolete" stderr
-    grep "'AC_PROG_MKDIR_P'.* instead" stderr
-    grep " use '\$(MKDIR_P)' instead of '\$(mkdir_p)'.*Makefile" stderr
-}
-
-$ACLOCAL
-mv aclocal.m4 aclocal.sav
-
-echo AM_PROG_MKDIR_P >> configure.ac
-
-geterr $ACLOCAL
-test ! -f aclocal.m4
-
-cat aclocal.sav "$am_automake_acdir"/obsolete-err.m4 > aclocal.m4
-
-geterr $AUTOCONF
-geterr $AUTOMAKE
-
-:
diff --git a/t/mkdir_p.sh b/t/am-prog-mkdir-p.sh
similarity index 56%
rename from t/mkdir_p.sh
rename to t/am-prog-mkdir-p.sh
index 2e83423..ad5a810 100755
--- a/t/mkdir_p.sh
+++ b/t/am-prog-mkdir-p.sh
@@ -14,38 +14,53 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# AM_INIT_AUTOMAKE should still define $(mkdir_p), for backward
+# Check that the AM_PROG_MKDIR_P macro is deprecated, but still works.
+# We should should also still define $(mkdir_p), for backward
 # compatibility.
 
 . test-init.sh
 
-cat >> configure.ac << 'END'
+cat >> configure.ac <<'END'
 AC_CONFIG_FILES([sub/Makefile])
+AM_PROG_MKDIR_P
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
 all-local:
-       $(mkdir_p) . dir1/a
-       @mkdir_p@ . dir2/b
+       $(MKDIR_P) . dir1/a
+       $(mkdir_p) . dir2/b
+       @MKDIR_P@ . dir3/c
+       @mkdir_p@ . dir4/d
 check-local: all
        test -d dir1/a
        test -d dir2/b
        test -d dir3/c
-       test -d dir3/d
+       test -d dir4/d
+       test -d dir5/e
+       test -d dir5/f
+       test -d dir5/g
 END
 
 mkdir sub
 cat > sub/Makefile.am << 'END'
-# '$(mkdir_p)' should continue to work even in subdir makefiles.
+# Even '$(mkdir_p)' should continue to work also in subdir makefiles.
 all-local:
-       $(mkdir_p) .. ../dir3/c
-       @mkdir_p@ .. ../dir3/d
+       $(MKDIR_P) .. ../dir5/d
+       $(mkdir_p) .. ../dir5/e
+       @MKDIR_P@ .. ../dir5/f
+       @mkdir_p@ .. ../dir5/g
 END
 
 $ACLOCAL
-$AUTOCONF -Werror -Wall
+$AUTOCONF -Wnone -Wobsolete -Werror 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep "^configure\\.ac:5:.*'AM_PROG_MKDIR_P'.*deprecated" stderr
+grep "[Aa]utoconf-provided 'AC_PROG_MKDIR_P'.* instead" stderr
+grep "'\$(MKDIR_P)' instead of '\$(mkdir_p)'" stderr
+
+$AUTOCONF -Wno-obsolete
 $AUTOMAKE
 
 ./configure
diff --git a/t/gettext-macros.sh b/t/gettext-macros.sh
index 67839b4..5a93240 100755
--- a/t/gettext-macros.sh
+++ b/t/gettext-macros.sh
@@ -62,7 +62,10 @@ AM_GNU_GETTEXT
 AM_GNU_GETTEXT_VERSION([$autopoint_version])
 END
 
-if ! ($am_gettextize_command --force && test -f m4/gettext.m4); then
+if $am_gettextize_command --force && test -f m4/gettext.m4; then
+  echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
+  echo "export ACLOCAL_PATH" >> get.sh
+else
   # Older versions of gettext might not have a gettextize program
   # available, but this doesn't mean the user hasn't made the gettext
   # macros available, e.g., by properly setting ACLOCAL_PATH.
@@ -76,12 +79,12 @@ if ! ($am_gettextize_command --force && test -f 
m4/gettext.m4); then
   fi
 fi
 
-echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
-echo "export ACLOCAL_PATH" >> get.sh
-
+cat >> get.sh <<'END'
 # Even recent versions of gettext used the now-obsolete 'AM_PROG_MKDIR_P'
 # m4 macro.  So we need the following to avoid spurious errors.
-echo 'AC_DEFUN([AM_PROG_MKDIR_P], [AC_PROG_MKDIR_P(address@hidden)])' >> 
m4/mk-dirp.m4
+ACLOCAL="$ACLOCAL -Wno-obsolete"
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+END
 
 . ./get.sh
 
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index d2b6876..1996de6 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -133,7 +133,7 @@ t/amassign.sh \
 t/am-config-header-no-more.sh \
 t/am-prog-cc-c-o.sh \
 t/am-prog-cc-stdc-no-more.sh \
-t/am-prog-mkdir-p-no-more.sh \
+t/am-prog-mkdir-p.sh \
 t/am-macro-not-found.sh \
 t/amopt.sh \
 t/amopts-location.sh \
@@ -686,7 +686,6 @@ t/missing-version-mismatch.sh \
 t/missing3.sh \
 t/am-missing-prog.sh \
 t/missing-auxfile-stops-makefiles-creation.sh \
-t/mkdir_p.sh \
 t/mkinstall.sh \
 t/mkinst2.sh \
 t/mkinst3.sh \
-- 
1.8.1.rc3.192.g2d0029e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]