]> sourceware.org Git - automake.git/commitdiff
* doc/automake.texi (Conditionals): Split in two sections, "Usage"
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 4 Aug 2006 10:23:14 +0000 (10:23 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 4 Aug 2006 10:23:14 +0000 (10:23 +0000)
and "Portability", and add a third one, "Limits" to explain how
conditional definitions inside multi-lines definitions can be
handled.
* automake.in (handle_options): Do not assume that
AUTOMAKE_OPTIONS is defined in TRUE, but diagnose conditional
definitions of AUTOMAKE_OPTIONS.
Report from Bas Wijnen.
* tests/amopt.test: New test.
* tests/Makefile.am (TESTS): Add it.

ChangeLog
THANKS
automake.in
doc/automake.texi
doc/stamp-vti
doc/version.texi
tests/Makefile.am
tests/Makefile.in
tests/amopt.test [new file with mode: 0755]

index 922599abf8f78e02f96db94f0b48e948b95c39a5..a876db0e29d1cb998dc479b4899c8f78839f2cc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2006-08-04  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * doc/automake.texi (Conditionals): Split in two sections, "Usage"
+       and "Portability", and add a third one, "Limits" to explain how
+       conditional definitions inside multi-lines definitions can be
+       handled.
+       * automake.in (handle_options): Do not assume that
+       AUTOMAKE_OPTIONS is defined in TRUE, but diagnose conditional
+       definitions of AUTOMAKE_OPTIONS.
+       Report from Bas Wijnen.
+       * tests/amopt.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
        * aclocal.in (install_file): Cannot use /dev/null while diffing
        new files, because Tru64's diff do not handle /dev/null.  So
        create an empty destination file before running diff on a new
diff --git a/THANKS b/THANKS
index ced36a0aed5cbb8eba8855e4e33b8e9d9f8177d9..ce57ebb467469ae325a16ced6fe548e3d06c5b1b 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -23,6 +23,7 @@ Arkadiusz Miskiewicz  misiek@pld.ORG.PL
 Art Haas               ahaas@neosoft.com
 Assar Westerlund       assar@sics.se
 Axel Belinfante                Axel.Belinfante@cs.utwente.nl
+Bas Wijnen             shevek@fmf.nl
 Bernard Giroud         bernard.giroud@creditlyonnais.ch
 Bernard Urban          Bernard.Urban@meteo.fr
 Bernd Jendrissek       berndfoobar@users.sourceforge.net
index d011d9f916d821be7d596ea73fb3d3251799ee54..5e1f967c4d0178351d1f5e2b10316ed126fbaaae 100755 (executable)
@@ -1055,12 +1055,16 @@ sub handle_options
   my $var = var ('AUTOMAKE_OPTIONS');
   if ($var)
     {
-      # FIXME: We should disallow conditional definitions of AUTOMAKE_OPTIONS.
-      if (process_option_list ($var->rdef (TRUE)->location,
-                              $var->value_as_list_recursive (cond_filter =>
-                                                             TRUE)))
+      if ($var->has_conditional_contents)
        {
-         return 1;
+         msg_var ('unsupported', $var,
+                  "`AUTOMAKE_OPTIONS' cannot have conditional contents");
+       }
+      foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
+                                                         location => 1))
+       {
+         my ($loc, $value) = @$locvals;
+         return 1 if (process_option_list ($loc, $value))
        }
     }
 
index 8d68c2580b6b5ef60d679fbb33a071bc14607e2e..dd741cf68526b493df93bd91ac6a15e909287b97 100644 (file)
@@ -7422,6 +7422,8 @@ they are needed to rebuild @file{Makefile.in}.
 
 Automake supports a simple type of conditionals.
 
+@unnumberedsec Usage
+
 @acindex AM_CONDITIONAL
 Before using a conditional, you must define it by using
 @code{AM_CONDITIONAL} in the @file{configure.ac} file (@pxref{Macros}).
@@ -7496,6 +7498,12 @@ endif !DEBUG
 @noindent
 Unbalanced conditions are errors.
 
+The @code{else} branch of the above two examples could be omitted,
+since assigning the empty string to an otherwise undefined variable
+makes no difference.
+
+@unnumberedsec Portability
+
 Note that conditionals in Automake are not the same as conditionals in
 GNU Make.  Automake conditionals are checked at configure time by the
 @file{configure} script, and affect the translation from
@@ -7507,6 +7515,42 @@ in the @file{Makefile}.
 
 Automake conditionals will work with any make program.
 
+@unnumberedsec Limits
+
+Conditionals should enclose complete statements like variables or
+rules definitions.  Automake cannot deal with conditionals used inside
+a variable definition, for instance, and is not even able to diagnose
+this situation.  The following example would not work:
+
+@example
+# This syntax is not understood by Automake
+AM_CPPFLAGS = \
+  -DFEATURE_A \
+if WANT_DEBUG
+  -DDEBUG \
+endif
+  -DFEATURE_B
+@end example
+
+However the intended definition of @code{AM_CPPFLAGS} can be achieved
+with
+
+@example
+if WANT_DEBUG
+  DEBUGFLAGS = -DDEBUG
+endif
+AM_CPPFLAGS = -DFEATURE_A $(DEBUGFLAGS) -DFEATURE_B
+@end example
+
+@noindent or
+
+@example
+AM_CPPFLAGS = -DFEATURE_A
+if WANT_DEBUG
+AM_CPPFLAGS += -DDEBUG
+endif
+AM_CPPFLAGS += -DFEATURE_B
+@end example
 
 @node Gnits
 @chapter The effect of @option{--gnu} and @option{--gnits}
index fbc1f742e74adb30686ba518a5b41da4b238e435..7e049f890dbeb8673ce31215aa7b97a6b3f63644 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 6 June 2006
-@set UPDATED-MONTH June 2006
+@set UPDATED 4 August 2006
+@set UPDATED-MONTH August 2006
 @set EDITION 1.9a
 @set VERSION 1.9a
index fbc1f742e74adb30686ba518a5b41da4b238e435..7e049f890dbeb8673ce31215aa7b97a6b3f63644 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 6 June 2006
-@set UPDATED-MONTH June 2006
+@set UPDATED 4 August 2006
+@set UPDATED-MONTH August 2006
 @set EDITION 1.9a
 @set VERSION 1.9a
index 586e237983a4add54ff4d149d0aeb06a978845bc..92591380a1270abecac4128e14651c11eb948511 100644 (file)
@@ -39,6 +39,7 @@ alpha.test \
 alpha2.test \
 amassign.test \
 ammissing.test \
+amopt.test \
 amsubst.test \
 ansi.test \
 ansi2.test \
index 24de387d9bfe58b6e154d452b95a29880cb2ec81..bd43b5fdbdc3a4f66b81591de044edfbf6d809ff 100644 (file)
@@ -170,6 +170,7 @@ alpha.test \
 alpha2.test \
 amassign.test \
 ammissing.test \
+amopt.test \
 amsubst.test \
 ansi.test \
 ansi2.test \
diff --git a/tests/amopt.test b/tests/amopt.test
new file mode 100755 (executable)
index 0000000..f7ffb12
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2006  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., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Make Automake diagnose a conditional AUTOMAKE_OPTIONS.
+# Report from Bas Wijnen.
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_CONDITIONAL([COND], [true])
+END
+
+mkdir sub
+
+# These two Makefile contain the same errors, but have different
+# warnings disabled.
+
+cat >Makefile.am <<END
+if COND
+AUTOMAKE_OPTIONS = -Wall
+endif
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'Makefile.am:2.*AUTOMAKE_OPTIONS.*conditional' stderr
This page took 0.050889 seconds and 5 git commands to generate.