In current automake, if a variable is defined in terms of N conditionally defined variables, an array of possible combinations of conditional values is generated. This array is, of course, of size 2^N, which implies that only small numbers of conditionals can effectively be used together. The gstreamer project, however, has a Makefile.am with conditionals for each of a set of conditions dictating which SUBDIRS are to be built. The file currently has 16 separate conditionally defined variables (and will have more soon), used only in the SUBDIRS variable. The attached patch avoids computing the list of conditionals for the SUBDIRS variable, where it is not actually needed, if the DIST_SUBDIRS variable is defined. This enables automake to generate the Makefile.in for gstreamer within a memory footprint of about 4Mb. Without the patch, automake grows to around 160Mb, (and causes my home computer to run out of space and crash). A better solution may be to make variable_conditionally_defined() not call variable_conditions(), determining whether a variable is conditionally defined in a more efficient way. However, this patch helps a great deal. It may also be worth giving a warning if more than, say, 8 conditionals are used together, to avoid this situation occurring unexpectedly. -- Richard
Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1046 diff -u -r1.1046 automake.in --- automake.in 2001/04/24 18:00:14 1.1046 +++ automake.in 2001/04/24 19:35:56 @@ -3071,8 +3071,8 @@ # to all possible directories, and use it. If DIST_SUBDIRS is # defined, just use it. my $dist_subdir_name; - if (variable_conditionally_defined ('SUBDIRS') - || &variable_defined ('DIST_SUBDIRS')) + if (&variable_defined ('DIST_SUBDIRS') + || variable_conditionally_defined ('SUBDIRS')) { $dist_subdir_name = 'DIST_SUBDIRS'; if (! &variable_defined ('DIST_SUBDIRS'))