>>> "BW" == Bas Wijnen <[EMAIL PROTECTED]> writes:
BW> Hi, BW> automake just crashed on me, and it told me to send a mail BW> here, so I do. :-) Hi Bas, thanks for doing so. BW> This is what it says: BW> Makefile.am:184: unterminated conditionals: DEBUGGING_TRUE DEPRECATION_TRUE This means Automake's parser is completely lost. Automake is not smart enough to handle conditionals inside multi-lines definitions. You shouldn't use : BW> console_cflags = \ BW> if WARNINGS BW> @EXTRA_WARNING_FLAGS@ \ BW> -Wall \ BW> -W \ BW> -Wpointer-arith \ BW> -Wcast-qual \ BW> -Wwrite-strings \ BW> -Wno-sign-compare \ BW> -Waggregate-return \ BW> -Wstrict-prototypes \ BW> -Wmissing-prototypes \ BW> -Wmissing-declarations \ BW> -Wredundant-decls \ BW> -Wnested-externs \ BW> -O \ BW> endif BW> if DEBUGGING BW> -ggdb3 \ BW> endif BW> if DEPRECATION BW> -DG_DISABLE_DEPRECATED \ BW> endif BW> -I$(top_srcdir)/common \ BW> -I$(top_builddir)/common \ BW> -I$(includedir) \ BW> $(GLIB2_CFLAGS) but rather something like | if WARNINGS | warnings_console_cflags = @EXTRA_WARNING_FLAGS@ \ | -Wall \ | -W \ | -Wpointer-arith \ | -Wcast-qual \ | -Wwrite-strings \ | -Wno-sign-compare \ | -Waggregate-return \ | -Wstrict-prototypes \ | -Wmissing-prototypes \ | -Wmissing-declarations \ | -Wredundant-decls \ | -Wnested-externs \ | -O | endif | if DEBUGGING | debugging_console_cflags = -ggdb3 | endif | if DEPRECATION | deprecation_console_cflags = -DG_DISABLE_DEPRECATED | endif | | console_cflags = $(warnings_console_cflags) $(debugging_console_cflags) \ | $(deprecation_console_cflags) \ | -I$(top_srcdir)/common \ | -I$(top_builddir)/common \ | -I$(includedir) \ | $(aGLIB2_CFLAGS) or you can build console_cflags bits after bits : | console_cflags = | if WARNINGS | console_cflags += @EXTRA_WARNING_FLAGS@ \ | -Wall \ | -W \ | -Wpointer-arith \ | -Wcast-qual \ | -Wwrite-strings \ | -Wno-sign-compare \ | -Waggregate-return \ | -Wstrict-prototypes \ | -Wmissing-prototypes \ | -Wmissing-declarations \ | -Wredundant-decls \ | -Wnested-externs \ | -O | endif | if DEBUGGING | console_cflags += -ggdb3 | endif | if DEPRECATION | console_cflags += -DG_DISABLE_DEPRECATED | endif | console_cflags += -I$(top_srcdir)/common \ | -I$(top_builddir)/common \ | -I$(includedir) \ | $(aGLIB2_CFLAGS) Fixing Automake to diagnose this situation would be difficult. I'll just mention it in the manual. BW> automake-1.9: #################### BW> automake-1.9: ## Internal Error ## BW> automake-1.9: #################### BW> automake-1.9: undefined condition `TRUE' for `AUTOMAKE_OPTIONS' Automake is so lost it thinks AUTOMAKE_OPTIONS is conditionally defined. This error message at least is easily improved. BW> # Pioneers - Implementation of the excellent Settlers of Catan board game. BW> # Go buy a copy. I own one already. Great game ! I'm checking the following patch in. 2006-08-04 Alexandre Duret-Lutz <[EMAIL PROTECTED]> * 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. Index: THANKS =================================================================== RCS file: /cvs/automake/automake/THANKS,v retrieving revision 1.286 diff -u -r1.286 THANKS --- THANKS 24 Jun 2006 05:35:43 -0000 1.286 +++ THANKS 4 Aug 2006 10:21:46 -0000 @@ -23,6 +23,7 @@ Art Haas [EMAIL PROTECTED] Assar Westerlund [EMAIL PROTECTED] Axel Belinfante [EMAIL PROTECTED] +Bas Wijnen [EMAIL PROTECTED] Bernard Giroud [EMAIL PROTECTED] Bernard Urban [EMAIL PROTECTED] Bernd Jendrissek [EMAIL PROTECTED] Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1624 diff -u -r1.1624 automake.in --- automake.in 4 Aug 2006 06:08:58 -0000 1.1624 +++ automake.in 4 Aug 2006 10:21:46 -0000 @@ -1055,12 +1055,16 @@ 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: doc/automake.texi =================================================================== RCS file: /cvs/automake/automake/doc/automake.texi,v retrieving revision 1.137 diff -u -r1.137 automake.texi --- doc/automake.texi 26 May 2006 16:47:05 -0000 1.137 +++ doc/automake.texi 4 Aug 2006 10:21:48 -0000 @@ -7422,6 +7422,8 @@ Automake supports a simple type of conditionals. [EMAIL PROTECTED] 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 @@ @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. + [EMAIL PROTECTED] 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 @@ Automake conditionals will work with any make program. [EMAIL PROTECTED] 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: + [EMAIL PROTECTED] +# This syntax is not understood by Automake +AM_CPPFLAGS = \ + -DFEATURE_A \ +if WANT_DEBUG + -DDEBUG \ +endif + -DFEATURE_B [EMAIL PROTECTED] example + +However the intended definition of @code{AM_CPPFLAGS} can be achieved +with + [EMAIL PROTECTED] +if WANT_DEBUG + DEBUGFLAGS = -DDEBUG +endif +AM_CPPFLAGS = -DFEATURE_A $(DEBUGFLAGS) -DFEATURE_B [EMAIL PROTECTED] example + [EMAIL PROTECTED] or + [EMAIL PROTECTED] +AM_CPPFLAGS = -DFEATURE_A +if WANT_DEBUG +AM_CPPFLAGS += -DDEBUG +endif +AM_CPPFLAGS += -DFEATURE_B [EMAIL PROTECTED] example @node Gnits @chapter The effect of @option{--gnu} and @option{--gnits} Index: doc/stamp-vti =================================================================== RCS file: /cvs/automake/automake/doc/stamp-vti,v retrieving revision 1.124 diff -u -r1.124 stamp-vti --- doc/stamp-vti 4 Aug 2006 06:08:58 -0000 1.124 +++ doc/stamp-vti 4 Aug 2006 10:21:48 -0000 @@ -1,4 +1,4 @@ [EMAIL PROTECTED] UPDATED 6 June 2006 [EMAIL PROTECTED] UPDATED-MONTH June 2006 [EMAIL PROTECTED] UPDATED 4 August 2006 [EMAIL PROTECTED] UPDATED-MONTH August 2006 @set EDITION 1.9a @set VERSION 1.9a Index: doc/version.texi =================================================================== RCS file: /cvs/automake/automake/doc/version.texi,v retrieving revision 1.124 diff -u -r1.124 version.texi --- doc/version.texi 4 Aug 2006 06:08:58 -0000 1.124 +++ doc/version.texi 4 Aug 2006 10:21:48 -0000 @@ -1,4 +1,4 @@ [EMAIL PROTECTED] UPDATED 6 June 2006 [EMAIL PROTECTED] UPDATED-MONTH June 2006 [EMAIL PROTECTED] UPDATED 4 August 2006 [EMAIL PROTECTED] UPDATED-MONTH August 2006 @set EDITION 1.9a @set VERSION 1.9a Index: tests/Makefile.am =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.am,v retrieving revision 1.605 diff -u -r1.605 Makefile.am --- tests/Makefile.am 24 Jun 2006 05:31:55 -0000 1.605 +++ tests/Makefile.am 4 Aug 2006 10:21:48 -0000 @@ -39,6 +39,7 @@ alpha2.test \ amassign.test \ ammissing.test \ +amopt.test \ amsubst.test \ ansi.test \ ansi2.test \ Index: tests/Makefile.in =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.in,v retrieving revision 1.785 diff -u -r1.785 Makefile.in --- tests/Makefile.in 24 Jun 2006 05:35:44 -0000 1.785 +++ tests/Makefile.in 4 Aug 2006 10:21:48 -0000 @@ -170,6 +170,7 @@ alpha2.test \ amassign.test \ ammissing.test \ +amopt.test \ amsubst.test \ ansi.test \ ansi2.test \ Index: tests/amopt.test =================================================================== RCS file: tests/amopt.test diff -N tests/amopt.test --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/amopt.test 4 Aug 2006 10:21:48 -0000 @@ -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 -- Alexandre Duret-Lutz Shared books are happy books. http://www.bookcrossing.com/friend/gadl