From 6da2538ced020ca4bc4d38e60bfef104984a7d63 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 17 Apr 2004 18:46:05 +0000 Subject: [PATCH] Fix PR automake/49: * automake.in (scan_autoconf_traces) : Diagnose calls to AC_CONFIG_AUX_DIR followings calls to AM_INIT_AUTOMAKE. * tests/auxdir.test, tests/auxdir2.test, tests/lex5.test, tests/mdate3.test, tests/multlib.test, tests/reqd2.test, tests/symlink.test, tests/txinfo8.test, tests/txinfo22.test, tests/yacc6.test, tests/yacc8.test: Fix to call AC_CONFIG_AUX_DIR before AM_INIT_AUTOMAKE. * tests/auxdir3.test: New file (exercise this diagnostic). * tests/Makefile.am (TESTS): Add auxdir3.test. --- ChangeLog | 13 +++++++++++++ NEWS | 2 ++ automake.in | 8 +++++++- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/auxdir.test | 7 +++++-- tests/auxdir2.test | 7 +++++-- tests/auxdir3.test | 35 +++++++++++++++++++++++++++++++++++ tests/lex5.test | 5 ++++- tests/mdate3.test | 9 ++++++--- tests/multlib.test | 7 +++++-- tests/reqd2.test | 5 ++++- tests/subobj3.test | 5 +++-- tests/symlink.test | 7 +++++-- tests/txinfo22.test | 7 +++++-- tests/txinfo8.test | 5 +++-- tests/yacc6.test | 7 +++++-- tests/yacc8.test | 7 +++++-- 18 files changed, 114 insertions(+), 24 deletions(-) create mode 100755 tests/auxdir3.test diff --git a/ChangeLog b/ChangeLog index 9122883b..bb1e15b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-04-17 Alexandre Duret-Lutz + + Fix PR automake/49: + * automake.in (scan_autoconf_traces) : Diagnose + calls to AC_CONFIG_AUX_DIR followings calls to AM_INIT_AUTOMAKE. + * tests/auxdir.test, tests/auxdir2.test, tests/lex5.test, + tests/mdate3.test, tests/multlib.test, tests/reqd2.test, + tests/symlink.test, tests/txinfo8.test, tests/txinfo22.test, + tests/yacc6.test, tests/yacc8.test: Fix to call AC_CONFIG_AUX_DIR + before AM_INIT_AUTOMAKE. + * tests/auxdir3.test: New file (exercise this diagnostic). + * tests/Makefile.am (TESTS): Add auxdir3.test. + 2004-04-15 Alexandre Duret-Lutz * aclocal.in (%map_traced_defs): New variable. diff --git a/NEWS b/NEWS index 44221972..58da9927 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,8 @@ New in 1.8a: (Calls to AC_PROG_EGREP causing libtool.m4 to be included is the most famous instance of this bug.) +* Diagnose AC_CONFIG_AUX_DIR calls following AM_INIT_AUTOMAKE. (PR/49) + New in 1.8: diff --git a/automake.in b/automake.in index 00be104d..afdb051b 100755 --- a/automake.in +++ b/automake.in @@ -4596,7 +4596,7 @@ sub scan_autoconf_traces ($) while ($_ = $tracefh->getline) { chomp; - my ($here, @args) = split /::/; + my ($here, @args) = split (/::/); my $where = new Automake::Location $here; my $macro = $args[0]; @@ -4626,6 +4626,12 @@ sub scan_autoconf_traces ($) } elsif ($macro eq 'AC_CONFIG_AUX_DIR') { + if ($seen_init_automake) + { + error ($where, "AC_CONFIG_AUX_DIR must be called before " + . "AM_INIT_AUTOMAKE...", partial => 1); + error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here"); + } $config_aux_dir = $args[1]; $config_aux_dir_set_in_configure_ac = 1; } diff --git a/tests/Makefile.am b/tests/Makefile.am index cebf448a..817dff18 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -53,6 +53,7 @@ autohdr3.test \ autohdr4.test \ auxdir.test \ auxdir2.test \ +auxdir3.test \ backsl.test \ backsl2.test \ backsl3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f457c2b7..8583b241 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -168,6 +168,7 @@ autohdr3.test \ autohdr4.test \ auxdir.test \ auxdir2.test \ +auxdir3.test \ backsl.test \ backsl2.test \ backsl3.test \ diff --git a/tests/auxdir.test b/tests/auxdir.test index 2046d03c..8feaea8b 100755 --- a/tests/auxdir.test +++ b/tests/auxdir.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -23,8 +23,11 @@ . ./defs || exit 1 # The "./." is here so we don't have to mess with subdirs. -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([auxdir], [1.0]) AC_CONFIG_AUX_DIR(./.) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) END cat > Makefile.am << 'END' diff --git a/tests/auxdir2.test b/tests/auxdir2.test index 4313825d..5e1d766d 100755 --- a/tests/auxdir2.test +++ b/tests/auxdir2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -24,8 +24,11 @@ . ./defs || exit 1 # The "./." is here so we don't have to mess with subdirs. -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([auxdir2], [1.0]) AC_CONFIG_AUX_DIR($foo) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) END : > Makefile.am diff --git a/tests/auxdir3.test b/tests/auxdir3.test new file mode 100755 index 00000000..f04ec36c --- /dev/null +++ b/tests/auxdir3.test @@ -0,0 +1,35 @@ +#! /bin/sh +# Copyright (C) 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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. +# +# GNU Automake 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 Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Test to make sure we diagnose misplaced AC_CONFIG_AUX_DIR. + +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_AUX_DIR(.) +END + +: > Makefile.am + +$ACLOCAL +AUTOMAKE_fails +grep 'AC_CONFIG_AUX_DIR.*AM_INIT_AUTOMAKE' stderr diff --git a/tests/lex5.test b/tests/lex5.test index 60e36a2c..71554cdd 100755 --- a/tests/lex5.test +++ b/tests/lex5.test @@ -25,8 +25,11 @@ required='gcc GNUmake gzip flex' set -e -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([lex5], [1.0]) AC_CONFIG_AUX_DIR([.]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_PROG_CC AM_PROG_CC_C_O AM_PROG_LEX diff --git a/tests/mdate3.test b/tests/mdate3.test index 177519f4..900ef5f2 100755 --- a/tests/mdate3.test +++ b/tests/mdate3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -22,8 +22,11 @@ . ./defs || exit 1 -cat >> configure.in << 'END' -AC_CONFIG_AUX_DIR(foo) +cat > configure.in << 'END' +AC_INIT([mdate3], [1.0]) +AC_CONFIG_AUX_DIR([foo]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) END cat > Makefile.am << 'END' diff --git a/tests/multlib.test b/tests/multlib.test index 61c4f0a4..c64bce0f 100755 --- a/tests/multlib.test +++ b/tests/multlib.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -26,9 +26,12 @@ required='gcc GNUmake' set -e -cat >>configure.in <<'END' +cat >configure.in <<'END' +AC_INIT([multlib], [1.0]) AC_CONFIG_SRCDIR(libfoo/foo.c) AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_CONFIG_SUBDIRS(libfoo) AC_CONFIG_SUBDIRS(libbar) AC_OUTPUT diff --git a/tests/reqd2.test b/tests/reqd2.test index 12cf1f45..cce80231 100755 --- a/tests/reqd2.test +++ b/tests/reqd2.test @@ -27,8 +27,11 @@ required='libtoolize' set -e -cat >>configure.in <<'END' +cat > configure.in << 'END' +AC_INIT([req2], [1.0]) AC_CONFIG_AUX_DIR([autoconf]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_PROG_CC AM_PROG_LIBTOOL AC_CONFIG_FILES([autoconf/Makefile main/Makefile]) diff --git a/tests/subobj3.test b/tests/subobj3.test index 92576952..7255392a 100755 --- a/tests/subobj3.test +++ b/tests/subobj3.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software +# Foundation, Inc. # # This file is part of GNU Automake. # @@ -25,9 +26,9 @@ required=gcc cat > configure.in << 'END' AC_INIT(sub/hello.c) -AM_INIT_AUTOMAKE(hello,0.23) dnl Prevent automake from looking in .. and ../.. AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE(hello,0.23) AC_PROG_CC AM_PROG_CC_C_O AM_C_PROTOTYPES diff --git a/tests/symlink.test b/tests/symlink.test index 597336d9..974edb6f 100755 --- a/tests/symlink.test +++ b/tests/symlink.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -30,8 +30,11 @@ rm -f mkinstalldirs : > Makefile.am -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([symlink], [1.0]) AC_CONFIG_AUX_DIR(sub) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) END $ACLOCAL diff --git a/tests/txinfo22.test b/tests/txinfo22.test index a2cf051d..8607431e 100755 --- a/tests/txinfo22.test +++ b/tests/txinfo22.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -28,8 +28,11 @@ required='makeinfo tex' set -e -cat >>configure.in < configure.in << 'END' +AC_INIT([txinfo22], [1.0]) AC_CONFIG_AUX_DIR(aux) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_OUTPUT END diff --git a/tests/txinfo8.test b/tests/txinfo8.test index edc9b117..a4299856 100755 --- a/tests/txinfo8.test +++ b/tests/txinfo8.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software +# Foundation, Inc. # # This file is part of GNU Automake. # @@ -26,9 +27,9 @@ cat > configure.in << 'END' AC_INIT +AC_CONFIG_AUX_DIR(sub) AM_INIT_AUTOMAKE(nonesuch, nonesuch) AC_OUTPUT(Makefile sub/Makefile) -AC_CONFIG_AUX_DIR(sub) END cat > Makefile.am << 'END' diff --git a/tests/yacc6.test b/tests/yacc6.test index 108bc20b..c25a2e5a 100755 --- a/tests/yacc6.test +++ b/tests/yacc6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -28,8 +28,11 @@ required='gcc bison' set -e -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([yacc6], [1.0]) AC_CONFIG_AUX_DIR([aux]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES([sub/Makefile]) diff --git a/tests/yacc8.test b/tests/yacc8.test index 40009b86..5f1eaea6 100755 --- a/tests/yacc8.test +++ b/tests/yacc8.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -26,8 +26,11 @@ required="gcc bison" set -e -cat >> configure.in << 'END' +cat > configure.in << 'END' +AC_INIT([yacc8], [1.0]) AC_CONFIG_AUX_DIR([.]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) AC_PROG_CC AM_PROG_CC_C_O AC_PROG_YACC -- 2.43.5