summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-03-31 16:39:32 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-05-06 11:30:16 +0200
commit27136dfe02926ac596c853fced7c17825ef3cf68 (patch)
treedb64caeb4199554fcf71a262dba4c7be2e1f32c0
parent37267407001d025b48648c4fbcf5b3f16072fcc1 (diff)
downloadautomake-27136dfe02926ac596c853fced7c17825ef3cf68.tar.gz
init: warn against obsolete usage of AM_INIT_AUTOMAKE
Support for the two- and three-arguments invocation forms of the AM_INIT_AUTOMAKE macro, as in: AM_INIT_AUTOMAKE($PACKAGE, $VERSION) or: AM_INIT_AUTOMAKE($PACKAGE, $VERSION, NODEFINE) will be removed in the next major Automake release (1.13). Such usages have already been deprecated in the documentation starting from commit v1.11-2015-ge99690a of 23-02-2012 "docs, news: document planned removal of obsolete macros and features". We now start giving runtime warnings as well (in the 'obsolete' category). * NEWS: Update. * m4/init.m4 (AM_INIT_AUTOMAKE): Report the two- and three-arguments form invocation. * automake.in (scan_autoconf_traces): Likewise. * doc/automake.texi: Minor adjustments. Add an @anchor to the location where it's described how to modernize outdated invocation of AM_INIT_AUTOMAKE, so that it can be referenced from automake warning/error messages. * t/aminit-moreargs-deprecation.sh: New test. * tests/list-of-tests.mk: Add it. * tests/ac-output-old.tap: Adjust by calling automake with the warnings in the 'obsolete' category disabled. * t/backcompat.test: Likewise. * t/backcompat3.test: Likewise. * t/backcompat5.test: Likewise. * t/backcompat6.test: Likewise. * t/version.test: Likewise. * t/version2.test: Likewise. * t/pr2.test: Modernize style of AC_INIT and AM_INIT_AUTOMAKE invocations, and use proper m4 quoting. * t/pr87.test: Likewise. * t/confsub.test: Likewise. * t/install2.test: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--NEWS5
-rw-r--r--automake.in4
-rw-r--r--doc/automake.texi3
-rw-r--r--m4/init.m45
-rwxr-xr-xt/ac-output-old.tap2
-rwxr-xr-xt/aminit-moreargs-deprecation.sh51
-rwxr-xr-xt/backcompat.sh2
-rwxr-xr-xt/backcompat3.sh2
-rwxr-xr-xt/backcompat5.sh4
-rwxr-xr-xt/backcompat6.sh2
-rwxr-xr-xt/confsub.sh9
-rwxr-xr-xt/install2.sh12
-rw-r--r--t/list-of-tests.mk1
-rwxr-xr-xt/pr2.sh9
-rwxr-xr-xt/pr87.sh14
-rwxr-xr-xt/version.sh2
-rwxr-xr-xt/version2.sh2
17 files changed, 100 insertions, 29 deletions
diff --git a/NEWS b/NEWS
index dcfd8c1c4..57af90117 100644
--- a/NEWS
+++ b/NEWS
@@ -56,6 +56,11 @@ New in 1.12.1:
* Deprecated obsolescent features:
+ - Use of the long-deprecated two- and three-arguments invocation forms
+ of the AM_INIT_AUTOMAKE macro now elicits a warning in the 'obsolete'
+ category. Starting from the next major Automake release (1.13), such
+ usages won't be allowed anymore.
+
- Support for the "Cygnus-style" trees (enabled by the 'cygnus' option) is
now deprecated (its use triggers a warning in the 'obsolete' category).
It will be removed in the next major Automake release (1.13).
diff --git a/automake.in b/automake.in
index 16f44b705..5cf5a2c16 100644
--- a/automake.in
+++ b/automake.in
@@ -5409,6 +5409,10 @@ EOF
$seen_init_automake = $where;
if (defined $args[2])
{
+ msg 'obsolete', $where, <<'EOF';
+AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation
+EOF
$package_version = $args[2];
$package_version_location = $where;
}
diff --git a/doc/automake.texi b/doc/automake.texi
index 5e2b9c22b..2f2ebb087 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -3946,13 +3946,14 @@ each option were listed in @code{AUTOMAKE_OPTIONS} (@pxref{Options}).
@acindex AC_INIT
This macro can also be called in @emph{another, deprecated form} (support
-for which will be @emph{removed in the next major Automake release}):
+for which will be @emph{removed in the next major Automake release (1.13)}):
@code{AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])}. In this form,
there are two required arguments: the package and the version number.
This form is obsolete because the @var{package} and @var{version} can
be obtained from Autoconf's @code{AC_INIT} macro (which itself has an
old and a new form).
+@anchor{Modernize AM_INIT_AUTOMAKE invocation}
If your @file{configure.ac} has:
@example
diff --git a/m4/init.m4 b/m4/init.m4
index 206034c54..85228ba8c 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -52,7 +52,10 @@ AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+[$0: two- and three-arguments forms are deprecated. For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
diff --git a/t/ac-output-old.tap b/t/ac-output-old.tap
index 5c906a2f0..5ba3d3e3a 100755
--- a/t/ac-output-old.tap
+++ b/t/ac-output-old.tap
@@ -24,6 +24,8 @@ plan_ 22
rm -f configure.ac depcomp # Not required.
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
# -----------------------------------------------------------------------
# Test for bug reported by François Pinard.
diff --git a/t/aminit-moreargs-deprecation.sh b/t/aminit-moreargs-deprecation.sh
new file mode 100755
index 000000000..ac91d1d1b
--- /dev/null
+++ b/t/aminit-moreargs-deprecation.sh
@@ -0,0 +1,51 @@
+#! /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 automake warns against old-style usages of AM_INIT_AUTOMAKE
+# (i.e., calls with two or three arguments).
+
+. ./defs || Exit 1
+
+warn_rx='AM_INIT_AUTOMAKE.* two-.* three-arguments form.*deprecated'
+
+cat > configure.ac <<'END'
+AC_INIT([Makefile.am])
+AM_INIT_AUTOMAKE([twoargs], [1.0])
+AC_CONFIG_FILES([Makefile])
+END
+
+$ACLOCAL
+
+do_check()
+{
+ rm -rf autom4te*.cache
+ for cmd in "$AUTOCONF" "$AUTOMAKE"; do
+ $cmd -Werror -Wnone -Wobsolete 2>stderr && { cat stderr; Exit 1; }
+ cat stderr >&2
+ grep "^configure\.ac:2:.*$warn_rx" stderr
+ $cmd -Werror -Wall -Wno-obsolete || Exit 1
+ done
+}
+
+: > Makefile.am
+do_check
+
+sed "/^AM_INIT_AUTOMAKE/s|)$|, [NODEFINE])|" configure.ac > t
+diff configure.ac t && fatal_ "failed to edit configure.ac"
+mv -f t configure.ac
+do_check
+
+:
diff --git a/t/backcompat.sh b/t/backcompat.sh
index ec8292c12..8a93141a9 100755
--- a/t/backcompat.sh
+++ b/t/backcompat.sh
@@ -55,7 +55,7 @@ END
cat configure.in # For debugging.
$ACLOCAL
$AUTOCONF
- $AUTOMAKE
+ $AUTOMAKE -Wno-obsolete
./configure
$MAKE test
done
diff --git a/t/backcompat3.sh b/t/backcompat3.sh
index 2377e8876..5dc78f672 100755
--- a/t/backcompat3.sh
+++ b/t/backcompat3.sh
@@ -22,6 +22,8 @@ am_create_testdir=empty
empty=''
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
cat > Makefile.am <<'END'
## Leading ':;' here required to work around bugs of (at least) bash 3.2
got: Makefile
diff --git a/t/backcompat5.sh b/t/backcompat5.sh
index 3aa90679e..6bfb1c21e 100755
--- a/t/backcompat5.sh
+++ b/t/backcompat5.sh
@@ -94,10 +94,10 @@ END
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -a -Wno-obsolete
test -f install-sh
for f in $makefiles; do mv -f $f.in $f.sav; done
-$AUTOMAKE
+$AUTOMAKE -Wno-obsolete
for f in $makefiles; do diff $f.sav $f.in; done
./configure
diff --git a/t/backcompat6.sh b/t/backcompat6.sh
index fde118b1c..4523a6567 100755
--- a/t/backcompat6.sh
+++ b/t/backcompat6.sh
@@ -78,7 +78,7 @@ int main (void)
END
$ACLOCAL
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-obsolete --add-missing
$AUTOCONF
./configure
diff --git a/t/confsub.sh b/t/confsub.sh
index 188704678..b13f26a3b 100755
--- a/t/confsub.sh
+++ b/t/confsub.sh
@@ -19,11 +19,10 @@
. ./defs || Exit 1
-cat > configure.ac << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AM_CONFIG_HEADER(subdir/config.h:subdir/config.hin)
-AC_OUTPUT(Makefile subdir/Makefile)
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+AM_CONFIG_HEADER([subdir/config.h:subdir/config.hin])
+AC_OUTPUT
END
cat > Makefile.am << 'END'
diff --git a/t/install2.sh b/t/install2.sh
index f1992e8b1..bd400f427 100755
--- a/t/install2.sh
+++ b/t/install2.sh
@@ -17,14 +17,16 @@
# Test for bug in 'make dist'
# From Pavel Roskin.
+am_create_testdir=empty
. ./defs || Exit 1
-cat > configure.ac << 'END'
-AC_INIT
+cat > configure.ac << END
+AC_INIT([$me], [1.0])
dnl Prevent automake from looking in .. and ../..
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE(foo, 0.1)
-AC_OUTPUT(Makefile)
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
END
cat > Makefile.am << 'END'
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 708e9722a..e9f8d238f 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -117,6 +117,7 @@ t/alpha2.sh \
t/amhello-cflags.sh \
t/amhello-cross-compile.sh \
t/amhello-binpkg.sh \
+t/aminit-moreargs-deprecation.sh \
t/amassign.sh \
t/ammissing.sh \
t/amopt.sh \
diff --git a/t/pr2.sh b/t/pr2.sh
index ffe4a81d7..9aa7bc536 100755
--- a/t/pr2.sh
+++ b/t/pr2.sh
@@ -29,11 +29,8 @@
. ./defs || Exit 1
-# Please keep this underquoted and old-style.
-cat > configure.ac << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(README.foo:templ/README.foo.in Makefile)
+cat >> configure.ac << 'END'
+AC_OUTPUT([README.foo:templ/README.foo.in])
END
: > Makefile.am
@@ -46,6 +43,6 @@ $AUTOCONF
$AUTOMAKE
./configure
$MAKE distdir
-test -f nonesuch-nonesuch/templ/README.foo.in
+test -f $distdir/templ/README.foo.in
:
diff --git a/t/pr87.sh b/t/pr87.sh
index d98b66152..121328d63 100755
--- a/t/pr87.sh
+++ b/t/pr87.sh
@@ -37,12 +37,16 @@ EOF
done
echo "SUBDIRS = $subdirs" > Makefile.am
-cat >configure.ac <<EOF
-AC_INIT(`echo $subdirs | sed 's|\([a-z][a-z]*\).*|\1/\1.c|'`)
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE($me, 1.0)
+
+cat > configure.ac <<EOF
+AC_INIT([$me], [1.0])
+AC_CONFIG_SRCDIR([foo/foo.c])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
AC_PROG_CC
-AC_OUTPUT(Makefile `echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`)
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([`echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`])
+AC_OUTPUT
EOF
mkdir build
diff --git a/t/version.sh b/t/version.sh
index 98664e28c..431eb0dae 100755
--- a/t/version.sh
+++ b/t/version.sh
@@ -38,4 +38,4 @@ END
: > THANKS
$ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete
diff --git a/t/version2.sh b/t/version2.sh
index 71749f64b..273bd3670 100755
--- a/t/version2.sh
+++ b/t/version2.sh
@@ -38,4 +38,4 @@ END
: > THANKS
$ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete