Fix -Werror handling for presence of configure.in and configure.ac.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 20 Apr 2010 05:43:59 +0000 (07:43 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 20 Apr 2010 05:44:29 +0000 (07:44 +0200)
* lib/Automake/Variable.pm (Automake::Variable): Do not initialize
$configure_ac at the global level, before command-line arguments
have been parsed.
(require_variables): Initialize it here.
* tests/configure.test: New test.
* tests/Makefile.am: Update.
Report by Stefano Lattarini.

ChangeLog
lib/Automake/Variable.pm
tests/Makefile.am
tests/Makefile.in
tests/configure.test [new file with mode: 0755]

index 08e3c73..97e03ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-04-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix -Werror handling for presence of configure.in and configure.ac.
+       * lib/Automake/Variable.pm (Automake::Variable): Do not initialize
+       $configure_ac at the global level, before command-line arguments
+       have been parsed.
+       (require_variables): Initialize it here.
+       * tests/configure.test: New test.
+       * tests/Makefile.am: Update.
+       Report by Stefano Lattarini.
+
 2010-04-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Avoid possible false negatives in confh5.test.
index 8a5b568..3261360 100644 (file)
@@ -193,7 +193,7 @@ my %_ac_macro_for_var =
    );
 
 # The name of the configure.ac file.
-my $configure_ac = find_configure_ac;
+my $configure_ac;
 
 # Variables that can be overridden without complaint from -Woverride
 my %_silent_variable_override =
@@ -1132,6 +1132,9 @@ sub require_variables ($$$@)
   my $res = 0;
   $reason .= ' but ' unless $reason eq '';
 
+  $configure_ac = find_configure_ac
+    unless defined $configure_ac;
+
  VARIABLE:
   foreach my $var (@vars)
     {
index f09e843..ea81c85 100644 (file)
@@ -211,6 +211,7 @@ condinc2.test \
 condlib.test \
 condman.test \
 condman2.test \
+configure.test \
 conf2.test \
 confdeps.test \
 conff.test \
index 0c557d4..539e94d 100644 (file)
@@ -449,6 +449,7 @@ condinc2.test \
 condlib.test \
 condman.test \
 condman2.test \
+configure.test \
 conf2.test \
 confdeps.test \
 conff.test \
diff --git a/tests/configure.test b/tests/configure.test
new file mode 100755 (executable)
index 0000000..4b0f28d
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Diagnose if both configure.in and configure.ac are present, prefer
+# configure.ac.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >configure.ac <<\EOF
+AC_INIT
+AM_INIT_AUTOMAKE([configure], [1.0])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+: >Makefile.am
+
+$ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'configure.ac.*configure.in.*both present' stderr
+
+$ACLOCAL -Wno-error 2>stderr
+cat stderr >&2
+grep 'configure.ac.*configure.in.*both present' stderr
+grep 'proceeding.*configure.ac' stderr
+
+# Ensure we really proceed with configure.ac.
+AUTOMAKE_fails -Werror
+grep 'configure.ac.*configure.in.*both present' stderr
+grep 'proceeding.*configure.ac' stderr
+
+AUTOMAKE_run 0 -Wno-error
+grep 'configure.ac.*configure.in.*both present' stderr
+grep 'proceeding.*configure.ac' stderr
+
+: