Fixed cond4.test
authorTom Tromey <tromey@redhat.com>
Sat, 18 Jul 1998 06:37:24 +0000 (06:37 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 18 Jul 1998 06:37:24 +0000 (06:37 +0000)
ChangeLog
THANKS
TODO
automake.in
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/cond3.test
tests/cond4.test [new file with mode: 0755]
tests/cond5.test [new file with mode: 0755]

index 60e62fd..d9ca14a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sat Jul 18 00:24:14 1998  Tom Tromey  <tromey@cygnus.com>
+
+       * 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  <tromey@cygnus.com>
 
        * automake.in (am_install_var): Use DESTDIR, not DATADIR.  From
@@ -37,7 +46,7 @@ Tue Jun 23 14:00:27 1998  Ian Lance Taylor  <ian@cygnus.com>
 Tue Jun  2 13:27:34 1998  Tom Tromey  <tromey@cygnus.com>
 
        * 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 9e82d9c..79b5ded 100644 (file)
--- 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 67725eb..ede5c4b 100644 (file)
--- 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
 
index 7bb9023..fc16d7a 100755 (executable)
@@ -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) = ();
index 5c03731..0482b3d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jul 18 00:27:26 1998  Tom Tromey  <tromey@cygnus.com>
+
+       * cond3.test: Changed to match recent fixes.
+
+Fri Jul 17 23:44:49 1998  Tom Tromey  <tromey@cygnus.com>
+
+       * cond4.test, cond5.test: New files.
+
 Tue May 26 01:44:37 1998  Tom Tromey  <tromey@cygnus.com>
 
        * syntax.test: New file.
index b49f05e..f4fe367 100644 (file)
@@ -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)
 
index c77eb9a..eddd23a 100644 (file)
@@ -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
index 2099ca6..44a3760 100755 (executable)
@@ -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 (executable)
index 0000000..42d7251
--- /dev/null
@@ -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 (executable)
index 0000000..ff65743
--- /dev/null
@@ -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