Using a CVS automake I recently had a directory where I wanted to run
some tests only if a certain configuration option is selected.
if SOME_OPTION
check_PROGRAMS = foo bar
TESTS = $(check_PROGRAMS)
endif
This has the desired effect, except when using bash (2.04) for /bin/sh.
The check-TESTS rule has
for tst in $(TESTS) ; do
...
done
But bash objects to an empty for-loop list ("syntax error near
unexpected token `;'"). A dummy variable (empty or unset) will make
it happy,
for tst in $(TESTS) $$dummy_to_make_bash_happy ; do
...
I was also thinking it'd be good to print nothing at all if there's no
tests, not "All 0 tests passed", ie. wrap the whole check-TESTS in
if test -n "$(TESTS)"; then
...
fi
But wrapped like that bash still needs the dummy variable.
--
[Please CC followups.]