automake-patches
[Top][All Lists]
Advanced

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

[FYI] {master} obsolete: better error message if AM_PROG_MKDIR_P is used


From: Stefano Lattarini
Subject: [FYI] {master} obsolete: better error message if AM_PROG_MKDIR_P is used
Date: Sun, 30 Dec 2012 11:57:32 +0100

In Automake 1.14, the long-deprecated macro AM_PROG_MKDIR_P will be
removed.  Instead of simply dropping the macro definition, which would
cause unclear error messages in aclocal and autoconf:

    configure.ac:4: warning: macro 'AM_PROG_MKDIR_P' not found in library
    configure.ac:4: error: possibly undefined macro: AM_PROG_MKDIR_P
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

we re-add an AM_PROG_MKDIR_P definition that simply raises a *clear* error
message when the macro is used.

See also recent similar commits 'v1.13-5-g9c07d89' and 'v1.13-4-g8e921bf'

* t/am-prog-mkdir-p-no-more.sh: New test.
* t/list-of-tests.mk: Add it.
* m4/obsolete-err.m4: Add the new "error-raising" definition for
AM_PROG_MKDIR_P.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 m4/obsolete-err.m4           |  6 ++++++
 t/am-prog-mkdir-p-no-more.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk           |  1 +
 3 files changed, 51 insertions(+)
 create mode 100755 t/am-prog-mkdir-p-no-more.sh

diff --git a/m4/obsolete-err.m4 b/m4/obsolete-err.m4
index 2d7c518..39262f6 100644
--- a/m4/obsolete-err.m4
+++ b/m4/obsolete-err.m4
@@ -18,6 +18,12 @@ AU_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'.])])
 
+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.])])
+
 AC_DEFUN([AM_C_PROTOTYPES],
          [AC_FATAL([automatic de-ANSI-fication support has been removed])])
 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
diff --git a/t/am-prog-mkdir-p-no-more.sh b/t/am-prog-mkdir-p-no-more.sh
new file mode 100755
index 0000000..4a2e615
--- /dev/null
+++ b/t/am-prog-mkdir-p-no-more.sh
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2012 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/list-of-tests.mk b/t/list-of-tests.mk
index 7e62e6a..cd41e6a 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -133,6 +133,7 @@ t/aminit-moreargs-deprecation.sh \
 t/amassign.sh \
 t/am-config-header-no-more.sh \
 t/am-prog-cc-stdc-no-more.sh \
+t/am-prog-mkdir-p-no-more.sh \
 t/am-macro-not-found.sh \
 t/amopt.sh \
 t/amopts-location.sh \
-- 
1.8.1.rc3.27.g3b73c7d




reply via email to

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