diff options
author | lloyd <[email protected]> | 2009-07-17 19:25:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-17 19:25:39 +0000 |
commit | 9f9517d0067e67732a4226061b952f092ecd47ac (patch) | |
tree | b35b6bdec3e4e769924503ab09708d119599f441 | |
parent | bd4c44afe05f571a5647715afdec088d442dd03c (diff) |
Fix dependency resolution in configure.pl (same algorithm as configure.py)
Fix --enable-asm (had same effect as --disable-asm)
Fix mp_bits calculation; took into account both modules which were enabled
and ones that were explicitly disabled, for instance
./configure.pl --disable-modules=mp_amd64 -> mp_bits == 64
-rwxr-xr-x | configure.pl | 93 |
1 files changed, 32 insertions, 61 deletions
diff --git a/configure.pl b/configure.pl index 539256acb..06c5d5df7 100755 --- a/configure.pl +++ b/configure.pl @@ -158,7 +158,7 @@ sub main { 'build_include_botan' => File::Spec->catdir($$config{'build_dir'}, 'include', 'botan'), - 'mp_bits' => find_mp_bits(sort keys %{$$config{'modules'}}), + 'mp_bits' => find_mp_bits($config), 'mod_libs' => [ using_libs($os, sort keys %{$$config{'modules'}}) ], @@ -494,82 +494,51 @@ sub module_runs_on { } - return 1; -} - -sub can_enable_module { - my ($config, $mod, $for_dep) = @_; - - my %modinfo = %{ $MODULES{$mod} }; - - my $is_enabled = 0; - - # If it was enabled by the user with --enable-modules, trust them - if(defined($$config{'modules'}{$mod})) { - return '' if($$config{'modules'}{$mod} < 0); - $is_enabled = 1; - } - - unless($is_enabled) { - return '' if $modinfo{'load_on'} eq 'dep' and $for_dep == 0; - return '' if $modinfo{'load_on'} eq 'request'; - return '' if $modinfo{'load_on'} eq 'never'; - } - - # Doesn't run here, don't bother - return '' unless module_runs_on($config, \%modinfo, $mod, 0); - if($modinfo{'uses_tr1'} eq 'yes') { - return '' unless defined($$config{'tr1'}); + return 0 unless defined($$config{'tr1'}); my $tr1 = $$config{'tr1'}; - return '' unless($tr1 eq 'system' or $tr1 eq 'boost'); + return 0 unless($tr1 eq 'system' or $tr1 eq 'boost'); } - # @deps is the full list of modules that must be loaded (this loop - # every time is a really dumb way to do this, but it works since - # there are only about 150 info.txt files total, and most don't - # have complicated deps) + return 1; +} - my @deps; - push @deps, $mod; +sub scan_modules { + my ($config) = @_; - LINE: foreach (@{$modinfo{'requires'}}) { + my %dep_mods = (); - for my $req_mod (split(/\|/, $_)) { - next unless defined $MODULES{$req_mod}; + foreach my $mod (sort keys %MODULES) { + my %modinfo = %{ $MODULES{$mod} }; - if(can_enable_module($config, $req_mod, 1)) { - push @deps, $req_mod; - next LINE; - } - } + next if(defined($$config{'modules'}{$mod}) && $$config{'modules'}{$mod} < 0); - #autoconfig("Could not get a dep match for $_ for mod $mod"); - # Could not find a match - return ''; - } + next unless(module_runs_on($config, \%modinfo, $mod, 0)); - return join(' ', @deps); -} + if($modinfo{'load_on'} eq 'auto' or + ($modinfo{'load_on'} eq 'asm_ok' and $$config{'asm_ok'})) { -sub scan_modules { - my ($config) = @_; + $$config{'modules'}{$mod} = 1; - MOD: foreach my $mod (sort keys %MODULES) { - my %modinfo = %{ $MODULES{$mod} }; + LINE: foreach (@{$modinfo{'requires'}}) { + for my $req_mod (split(/\|/, $_)) { + next unless defined $MODULES{$req_mod}; + + next if(defined($$config{'modules'}{$req_mod}) && $$config{'modules'}{$req_mod} < 0); + next unless(module_runs_on($config, $MODULES{$req_mod}, $req_mod, 0)); - my @mods = split(/ /, can_enable_module($config, $mod, 0)); + $dep_mods{$req_mod} = 1; + next LINE; + } + } - if($#mods < 0) { - trace("Will not enable $mod"); next; } + } - foreach my $req_mod (@mods) { - #autoconfig("Enabling module $req_mod"); - $$config{'modules'}{$req_mod} = 1; - } + foreach my $mod (sort keys %dep_mods) { + $$config{'modules'}{$mod} = 1; } } @@ -767,7 +736,7 @@ sub get_options { 'quiet' => sub { $$config{'verbose'} = 0; }, 'trace' => sub { $TRACING = 1; }, - 'enable-asm' => sub { $$config{'asm_ok'} = 0; }, + 'enable-asm' => sub { $$config{'asm_ok'} = 1; }, 'disable-asm' => sub { $$config{'asm_ok'} = 0; }, 'enable-autoconfig' => sub { $$config{'autoconfig'} = 1; }, @@ -1146,9 +1115,11 @@ sub find_mp_bits { my $seen_mp_module = undef; - foreach my $modname (@modules_list) { + foreach my $modname (sort keys %{$$config{'modules'}}) { croak("Unknown module $modname") unless defined $MODULES{$modname}; + next if $$config{'modules'}{$modname} < 0; + my %modinfo = %{ $MODULES{$modname} }; if($modinfo{'mp_bits'}) { if(defined($seen_mp_module) and $modinfo{'mp_bits'} != $mp_bits) { |