diff options
author | lloyd <[email protected]> | 2008-09-29 17:43:36 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-29 17:43:36 +0000 |
commit | 26abd45c61294aacdd59fa4763ff1cd78aefbc7c (patch) | |
tree | 3ef4a44cd659d0b5442d2c6d8b3e9539fc23bb05 /configure.pl | |
parent | ba722ad52627163f945fd9fa97ff98f0df8452d1 (diff) |
Make asm implementations distinctly named objects, for instance MD5_IA32,
rather than silently replacing the C++ versions. Instead they are silently
replaced (currently, at least) at the lookup level: we switch off the set
of feature macros set to choose the best implementation in the current
build configuration. So you can have (and benchmark) MD5 and MD5_IA32
directly against each other in the same program with no hassles, but if
you ask for "MD5", you'll get maybe an MD5 or maybe MD5_IA32.
Also make the canonical asm names (which aren't guarded by C++ namespaces)
of the form botan_<algo>_<arch>_<func> as in botan_sha160_ia32_compress,
to avoid namespace collisions.
This change has another bonus that it should in many cases be possible to
derive the asm specializations directly from the original implementation,
saving some code (and of course logically SHA_160_IA32 is a SHA_160, just
one with a faster implementation of the compression function, so this seems
reasonable anyway).
Diffstat (limited to 'configure.pl')
-rwxr-xr-x | configure.pl | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/configure.pl b/configure.pl index 87ec7f90b..1fddc6121 100755 --- a/configure.pl +++ b/configure.pl @@ -411,13 +411,17 @@ sub autoload_modules { my $asm_ok = $$config{'asm_ok'}; - my @autoloaded; + my %loaded; # type -> { mod1 => 1, mod2 => 1 } MOD: foreach my $mod (sort keys %MODULES) { my %modinfo = %{ $MODULES{$mod} }; my $realname = $modinfo{'realname'}; + my $type = $modinfo{'type'}; + + #autoconfig("$mod '$realname' is $type"); + if(defined($$config{'modules'}{$mod})) { my $n = $$config{'modules'}{$mod}; @@ -426,28 +430,12 @@ sub autoload_modules { next; } else { - autoconfig("$mod ($realname): loading by user request"); + #$loaded{$type}{$mod} = 1; + #autoconfig("$mod ($realname): loading by user request"); next; } } - foreach my $req_mod (@{$modinfo{'requires'}}) { - if(defined($$config{'modules'}{$req_mod})) { - if($$config{'modules'}{$req_mod} < 0) { - autoconfig("Disabling $mod since required module " . - "$req_mod is disabled"); - - $$config{'modules'}{$mod} = -1; - next MOD; - } - - } else { - autoconfig("Enabling module $req_mod - required by $mod"); - $$config{'modules'}{$req_mod} = 1; - load_module($config, $req_mod); - } - } - my @arch_list = @{ $modinfo{'arch'} }; if(scalar @arch_list > 0 && !in_array($arch, \@arch_list) && @@ -478,17 +466,37 @@ sub autoload_modules { next; } + foreach my $req_mod (@{$modinfo{'requires'}}) { + if(defined($$config{'modules'}{$req_mod})) { + if($$config{'modules'}{$req_mod} < 0) { + autoconfig("Disabling $mod since required module " . + "$req_mod is disabled"); + $$config{'modules'}{$mod} = -1; + next MOD; + } + + } else { + autoconfig("Enabling module $req_mod - required by $mod"); + $$config{'modules'}{$req_mod} = 1; + $loaded{$type}{$mod} = 1; + load_module($config, $req_mod); + } + } + if($modinfo{'load_on'} eq 'request') { autoconfig("$mod ($realname): skipping, loaded by request only"); next; } - push @autoloaded, $mod; - trace("$mod ($realname): loading"); + autoconfig("$mod ($realname): loading"); + $loaded{$type}{$mod} = 1; $$config{'modules'}{$mod} = 1; } - autoconfig("Loaded " . join(' ', @autoloaded)); + for my $type (sort keys %loaded) { + my %mods = %{$loaded{$type}}; + autoconfig("*** Loading $type: " . join(' ', sort keys %mods)); + } } sub get_options { @@ -1111,6 +1119,8 @@ sub load_module { trace("load_module($modname)"); + croak("Unknown module $modname") unless defined($MODULES{$modname}); + my %module = %{$MODULES{$modname}}; my $works_on = sub { @@ -1412,8 +1422,12 @@ sub get_module_info { $info{'load_on'} = 'request'; # default unless specified $info{'libs'} = {}; + my @dir_arr = File::Spec->splitdir($dirs); + $info{'type'} = $dir_arr[$#dir_arr-2]; # cipher, hash, ... + if($info{'type'} eq 'src') { $info{'type'} = $dir_arr[$#dir_arr-1]; } + while($_ = &$reader()) { - match_any_of($_, \%info, 'quoted', 'realname', 'note'); + match_any_of($_, \%info, 'quoted', 'realname', 'note', 'type'); match_any_of($_, \%info, 'unquoted', 'define', 'mp_bits', 'modset', 'load_on'); read_list($_, $reader, 'arch', list_push(\@{$info{'arch'}})); |