* Stefano Lattarini wrote on Thu, Nov 25, 2010 at 02:37:28PM CET:
The attached patch is based off of maint, and intended for master.
OK to apply?
With nits addressed.
Thanks,
Ralf
Improve and extend tests on `:=' variable assignments.
* tests/colneq.test: Avoid useless use of wildcards and extra
variable assignments in Makefile.am. Use command-line automake
options instead of editing AUTOMAKE_OPTIONS in Makefile.am.
Make grepping of the generated Makefile.in slightly stricter.
Add a trailing `:' command.
* tests/colneq.test: Avoid useless use of EXTRA_DIST special
variable in Makefile.am. Do not create dummy files which are
not needed anymore. Also run autoconf, ./configure and make.
Add a trailing `:' command.
* tests/colneq3.test: New test, similar to colneq.test, but
running ./configure and make.
* tests/Makefile.am (TESTS): Update.
--- a/tests/colneq.test
+++ b/tests/colneq.test
@@ -21,14 +22,14 @@
set -e
cat Makefile.am 'END'
-ICONS := $(wildcard *.xbm)
Please leave the wildcard line in. Removing it makes assumptions about
the parser.
-data_DATA = $(ICONS)
+FOOBAR := zardoz
END
$ACLOCAL
AUTOMAKE_fails
grep ':=.*not portable' stderr
-echo 'AUTOMAKE_OPTIONS = -Wno-portability' Makefile.am
-$AUTOMAKE
-grep 'ICONS :=' Makefile.in
+$AUTOMAKE -Wno-portability
+grep '^FOOBAR *:= *zardoz *$' Makefile.in
+
+:
--- a/tests/colneq2.test
+++ b/tests/colneq2.test
@@ -20,14 +20,23 @@
set -e
+cat configure.in 'END'
+AC_OUTPUT
+END
+
cat Makefile.am 'END'
t = a b c
-EXTRA_DIST = $(t:=.test)
Please leave the EXTRA_DIST line in. It is something different if
automake skips a normal variable containing this, and a variable that is
special to automake.
+FOO = $(t:=.test)
+.PHONY: test
+test:
+ test x'$(FOO)' = x'a.test b.test c.test'
END
-: a.test
-: b.test
-: c.test
-
$ACLOCAL
+$AUTOCONF
$AUTOMAKE
+
+./configure
+$MAKE test
+
+:
--- /dev/null
+++ b/tests/colneq3.test
@@ -0,0 +1,46 @@
+# Test that := definitions work as expected at make time.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+cat configure.in 'END'
+AC_OUTPUT
+END
+
+cat Makefile.am 'END'
+BAR := $(FOO)
+BAZ = $(FOO)
+FOO := foo
Uh, oh. Thin ice. This is OK, but we gotta remember that it won't
work reliably if some of these variables are actually automake-set
before they are overridden. automake generally orders all of its
variable settings before all of the user ones (so the user ones are
preferred). When I override, e.g., libdir here, however, it doesn't
get reordered to the user part. I wonder whether that is a bug in
automake.
+.PHONY: test
+test:
+ test x'$(FOO)' = x'foo'
+ test x'$(BAZ)' = x'foo'
+ test x'$(BAR)' = x
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-portability
Trailing white space.
+
+./configure
+$MAKE test
+
+: