2 # Copyright (C) 2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that automake error out (with an helpful error message) against
18 # old-style usages of AM_INIT_AUTOMAKE (i.e., calls with two or three
23 warn_rx='AM_INIT_AUTOMAKE.* old-style two-.* three-arguments form.*unsupported'
26 mv aclocal.m4 aclocal.sav
28 cat > configure.ac <<'END'
29 AC_INIT([Makefile.am])
30 AM_INIT_AUTOMAKE([twoargs], [1.0])
31 AC_CONFIG_FILES([Makefile])
36 rm -rf autom4te*.cache
37 for cmd in "$ACLOCAL" "$AUTOCONF" "$AUTOMAKE"; do
38 cp aclocal.sav aclocal.m4
39 $cmd -Wnone -Wno-error 2>stderr && { cat stderr; Exit 1; }
41 grep "^configure\.ac:2:.*$warn_rx" stderr
48 sed "/^AM_INIT_AUTOMAKE/s|)$|, [NODEFINE])|" configure.ac > t
49 diff configure.ac t && fatal_ "failed to edit configure.ac"