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>
* 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).
$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;
}
@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
# 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
rm -f configure.ac depcomp # Not required.
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
# -----------------------------------------------------------------------
# Test for bug reported by François Pinard.
--- /dev/null
+#! /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
+
+:
cat configure.in # For debugging.
$ACLOCAL
$AUTOCONF
- $AUTOMAKE
+ $AUTOMAKE -Wno-obsolete
./configure
$MAKE test
done
empty=''
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
cat > Makefile.am <<'END'
## Leading ':;' here required to work around bugs of (at least) bash 3.2
got: Makefile
$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
END
$ACLOCAL
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-obsolete --add-missing
$AUTOCONF
./configure
. ./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'
# 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'
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 \
. ./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
$AUTOMAKE
./configure
$MAKE distdir
-test -f nonesuch-nonesuch/templ/README.foo.in
+test -f $distdir/templ/README.foo.in
:
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
: > THANKS
$ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete
: > THANKS
$ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete