Hello Stefano, * Stefano Lattarini wrote on Fri, Jan 28, 2011 at 09:55:18PM CET: > But there's a minor mistake in your testsuite addition, and I also > have a couple small unrelated nits/suggestions ...
You're spot-on with your observations, thanks. I've included all elided comments in the patch below. > > +required=cc > > > Here's the mistake: we don't have a meaningful 'cc' requirement yet :-( No, we do. There is a default case in the required loop which isn't lax enough to allow any cc but good enough for any GCC installation to work. ;-) I intend to push this patch and a followup one to remove the warnings about recursive variable expansion (the 'portability-recursive' channel stuff) once there is indication that it will be in the next Posix. Thanks, Ralf Accept dashes in make variable names. * lib/Automake/Variable.pm (Automake::Variable): Accept dashes in Variable names. * tests/varname-dash.test: New test. * tests/Makefile.am: Update. * NEWS: Update. Suggestion from Bruno Haible. diff --git a/NEWS b/NEWS index a5dc93f..08d4955 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ New in 1.11a: - The deprecated options `--output-dir', `--Werror' and `--Wno-error' have been removed. + - Dashes (minus signs) in make variable names are accepted now, since they + are seemingly portable. The Unified naming scheme still flattens them to + underscores as before. + * New targets: - New `cscope' target to build a cscope database for the source tree. diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index 9b2c838..50caee1 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -129,10 +129,10 @@ non-object). =cut -my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@]+'; +my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@-]+'; my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$"; my $_VARIABLE_RECURSIVE_PATTERN = - '^([.A-Za-z0-9_@]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$"; + '^([.A-Za-z0-9_@-]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$"; # The order in which variables should be output. (May contain # duplicates -- only the first occurrence matters.) diff --git a/tests/Makefile.am b/tests/Makefile.am index f53a1f3..1c1e247 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -932,6 +932,7 @@ vala2.test \ vala3.test \ vala4.test \ vala5.test \ +varname-dash.test \ vars.test \ vars3.test \ vartar.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b78e5a5..fc3cc5b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1195,6 +1195,7 @@ vala2.test \ vala3.test \ vala4.test \ vala5.test \ +varname-dash.test \ vars.test \ vars3.test \ vartar.test \ diff --git a/tests/varname-dash.test b/tests/varname-dash.test new file mode 100755 index 0000000..775c118 --- /dev/null +++ b/tests/varname-dash.test @@ -0,0 +1,62 @@ +#!/bin/sh +# Copyright (C) 2011 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/>. + +# Ensure automake allows and understand '-' in variable names. + +required=cc +. ./defs || Exit 1 + +cat >>configure.in <<\END +AC_PROG_CC +AC_OUTPUT +END + +cat >Makefile.am <<\END +var- = 1 +-var = 1 +var2 = $(var-) +var-3 = 3 +var4 = $(var-3) +three = 3 +#var5 = $(var-$(three)) +#var6 = $(-var) +prog-s = foo bar-s +foo-bar = a-b +foo_SOURCES = $(foo-bar:a-b=foo.c) +bar_s_SOURCES = bar.c +bin_PROGRAMS = $(prog-s) + +test: + test x'$(var-)$(var2)$(var-3)$(var4)$(var5)' = x11333 +.PHONY: test +END + +cat >foo.c <<\END +int main (void) { return 0; } +END +cp foo.c bar.c + +$ACLOCAL +$AUTOMAKE +sed 's/^#//' Makefile.am > t +mv -f t Makefile.am +$AUTOMAKE -Wno-portability +$AUTOCONF +./configure +$MAKE test +$MAKE + +: