automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some warnings of type `unsupported' don't cause "automake -Werror" t


From: Ralf Wildenhues
Subject: Re: Some warnings of type `unsupported' don't cause "automake -Werror" to fail
Date: Tue, 20 Apr 2010 07:49:06 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

* Stefano Lattarini wrote on Sun, Apr 18, 2010 at 06:17:29PM CEST:
> Recently, I stumbled upon a weird behaviour of automake: apparently,
> even when given the `-Werror' flag, it doesn't fail on warnings of type 
> `unsupported' which concern the copresence of `configure.ac' and 
> `configure.in'.

Thanks for the bug report.  This happens because find_configure_ac is
called at the time the Variable.pm module is initialized, which is
before the command line options have been parsed and acted upon.

I'm applying this fix.

Thanks,
Ralf

    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.

diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 250dee9..fa30585 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -195,7 +195,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 =
@@ -1134,6 +1134,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)
     {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7dc1088..815740f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -218,6 +218,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
index 0000000..57a5fab
--- /dev/null
+++ b/tests/configure.test
@@ -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
+
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]