From 26b77f660137fd3a4a23d53706065d640b85f162 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 18 Jul 1998 06:37:14 +0000 Subject: [PATCH] Fixed cond4.test --- ChangeLog | 11 ++++++++++- THANKS | 1 + TODO | 3 +++ automake.in | 33 ++++++++++++++++++--------------- tests/ChangeLog | 8 ++++++++ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/cond3.test | 2 +- tests/cond4.test | 31 +++++++++++++++++++++++++++++++ tests/cond5.test | 39 +++++++++++++++++++++++++++++++++++++++ 10 files changed, 113 insertions(+), 19 deletions(-) create mode 100755 tests/cond4.test create mode 100755 tests/cond5.test diff --git a/ChangeLog b/ChangeLog index 60e62fd8..d9ca14a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Jul 18 00:24:14 1998 Tom Tromey + + * automake.in (variable_conditions_sub): If var is not + conditional, but does have conditional subvariables, then return + value should be all permutations of subvariable conditions. Test + cond4.test. + (handle_source_transform): Define _OBJECTS variable with each + condition; no need to define multiple new variables. + Fri Jul 17 12:56:14 1998 Tom Tromey * automake.in (am_install_var): Use DESTDIR, not DATADIR. From @@ -37,7 +46,7 @@ Tue Jun 23 14:00:27 1998 Ian Lance Taylor Tue Jun 2 13:27:34 1998 Tom Tromey * automake.in (scan_one_configure_file): Make CONFIGURE file - handle local. + handle local. From Kevin Street. * automake.in (read_am_file): Error if blank line or comment follows trailing backslash. Test syntax.test. diff --git a/THANKS b/THANKS index 9e82d9cb..79b5ded2 100644 --- a/THANKS +++ b/THANKS @@ -44,6 +44,7 @@ Juergen A. Erhard jae@laden.ilk.de Karl Berry kb@cs.umb.edu Karl Heuer kwzh@gnu.org Kevin Dalley kevin@aimnet.com +Kevin Street street@iname.com L. Peter Deutsch ghost@aladdin.com Maciej W. Rozycki macro@ds2.pg.gda.pl Marius Vollmer mvo@zagadka.ping.de diff --git a/TODO b/TODO index 67725ebe..ede5c4b0 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ +* There are probably more bugs in variable_conditions_sub along + the lines of the one that caused cond4.test to fail. + * give user more control over -I flags in particular document a way to override the defaults diff --git a/automake.in b/automake.in index 7bb90235..fc16d7a1 100755 --- a/automake.in +++ b/automake.in @@ -1329,9 +1329,7 @@ sub handle_source_transform } else { - local ($cond, $cond_var_name); - local ($count) = 0; - local (@namelist) = (); + local ($cond); foreach $cond (@conds) { @files = &variable_value_as_list ($var, $cond); @@ -1339,20 +1337,12 @@ sub handle_source_transform @files); $linker = $temp if $linker eq ''; - # We have to have a new name for each such - # variable. Then we define the _OBJECTS variable - # as the union of all such variables. Hopefully - # this is the Right Thing. - $cond_var_name = 'cond' . $count . $one_file . '_OBJECTS'; - &define_pretty_variable ($cond_var_name, $cond, @result) + # Define _OBJECTS conditionally. + &define_pretty_variable ($one_file . '_OBJECTS', $cond, + @result) unless $prefix eq 'EXTRA_'; - push (@namelist, '$(' . $cond_var_name . ')'); - ++$count; } - &define_pretty_variable ($one_file . '_OBJECTS', '', - @namelist); - next; } } @@ -4748,7 +4738,20 @@ sub variable_conditions_sub } } - return &variable_conditions_reduce (@new_conds); + # Now we want to return all permutations of the subvariable + # conditions. + local (%allconds, $item); + foreach $item (@new_conds) + { + foreach (split ('@', $item)) + { + next if ! $_; + s/_(TRUE|FALSE)$//; + $allconds{$_ . '_TRUE'} = 1; + } + } + + return &variable_conditions_permutations (keys %allconds); } local (@this_conds) = (); diff --git a/tests/ChangeLog b/tests/ChangeLog index 5c03731a..0482b3d1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +Sat Jul 18 00:27:26 1998 Tom Tromey + + * cond3.test: Changed to match recent fixes. + +Fri Jul 17 23:44:49 1998 Tom Tromey + + * cond4.test, cond5.test: New files. + Tue May 26 01:44:37 1998 Tom Tromey * syntax.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index b49f05e4..f4fe367a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -31,7 +31,7 @@ aclocal.test alpha.test whoami.test unused.test condman.test \ texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test \ java.test sinclude.test javaprim.test javasubst.test aclocalii.test \ lex2.test libobj8.test version3.test instdata.test exdir2.test \ -colon5.test library.test syntax.test +colon5.test library.test syntax.test cond4.test cond5.test EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index c77eb9a8..eddd23a6 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -94,7 +94,7 @@ aclocal.test alpha.test whoami.test unused.test condman.test \ texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test \ java.test sinclude.test javaprim.test javasubst.test aclocalii.test \ lex2.test libobj8.test version3.test instdata.test exdir2.test \ -colon5.test library.test syntax.test +colon5.test library.test syntax.test cond4.test cond5.test EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/tests/cond3.test b/tests/cond3.test index 2099ca6d..44a37605 100755 --- a/tests/cond3.test +++ b/tests/cond3.test @@ -40,4 +40,4 @@ END $AUTOMAKE || exit 1 -test "`grep '^targ_OBJECTS' Makefile.in | wc -l`" -eq 1 +test "`grep 'targ_OBJECTS =' Makefile.in | wc -l`" -eq 8 diff --git a/tests/cond4.test b/tests/cond4.test new file mode 100755 index 00000000..42d72511 --- /dev/null +++ b/tests/cond4.test @@ -0,0 +1,31 @@ +#! /bin/sh + +# Another sources-in-conditional test. Report from Tim Goodwin. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AC_PROG_CC +AM_CONDITIONAL(ONE, true) +AM_CONDITIONAL(TWO, false) +AC_OUTPUT(Makefile) +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = targ + +if ONE +OPT1 = one.c +endif + +if TWO +OPT2 = two.c +endif + +targ_SOURCES = main.c $(OPT1) $(OPT2) +END + +$AUTOMAKE || exit 1 + +test "`grep TWO_FALSE Makefile.in | wc -l`" -eq 2 diff --git a/tests/cond5.test b/tests/cond5.test new file mode 100755 index 00000000..ff657431 --- /dev/null +++ b/tests/cond5.test @@ -0,0 +1,39 @@ +#! /bin/sh + +# Yet another sources-in-conditional test. Report from Tim Goodwin. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AC_PROG_CC +AM_CONDITIONAL(ONE, true) +AM_CONDITIONAL(TWO, false) +AC_OUTPUT(Makefile) +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = targ + +if ONE +OPT_SRC = one.c +endif + +if TWO +OPT_SRC = $(OPT_SRC) two.c +endif + +targ_SOURCES = main.c $(OPT_SRC) +END + +# The bug is that automake hangs. So we give it a few seconds and +# then kill it. +$AUTOMAKE & +pid=$! + +sleep 5 +kill -0 $pid && { + kill $pid + exit 1 +} +exit 0 -- 2.43.5