diff options
-rwxr-xr-x | configure.pl | 101 | ||||
-rw-r--r-- | src/bigint/info.txt | 4 | ||||
-rw-r--r-- | src/bigint/monty_amd64/info.txt (renamed from src/bigint/monty_amd64/xxxinfo.txt) | 15 | ||||
-rw-r--r-- | src/bigint/monty_generic/info.txt | 7 | ||||
-rw-r--r-- | src/bigint/monty_generic/mp_monty.cpp (renamed from src/bigint/mp_monty.cpp) | 0 | ||||
-rw-r--r-- | src/bigint/mp_generic/info.txt | 2 | ||||
-rw-r--r-- | src/bigint/mulop_amd64/info.txt | 31 | ||||
-rw-r--r-- | src/bigint/mulop_generic/info.txt | 7 | ||||
-rw-r--r-- | src/bigint/mulop_generic/mp_mulop.cpp (renamed from src/bigint/mp_mulop.cpp) | 0 | ||||
-rw-r--r-- | src/bigint/mulop_ia32/info.txt | 31 | ||||
-rw-r--r-- | src/bigint/mulop_ia32/xxxinfo.txt | 43 |
11 files changed, 152 insertions, 89 deletions
diff --git a/configure.pl b/configure.pl index 85d0ebbb2..0477d807c 100755 --- a/configure.pl +++ b/configure.pl @@ -402,6 +402,43 @@ sub choose_target { }); } +sub module_runs_on { + my ($noisy, $modinfo, $mod, $arch, $submodel, $os, $cc) = @_; + + my %modinfo = %{$modinfo}; + + my $realname = $modinfo{'realname'}; + + my @arch_list = @{ $modinfo{'arch'} }; + if(scalar @arch_list > 0 && !in_array($arch, \@arch_list) && + !in_array($submodel, \@arch_list)) + { + autoconfig("$mod ($realname): skipping, " . + "not compatible with " . realname($arch) . + "/" . $submodel) if $noisy; + return 0; + } + + my @os_list = @{ $modinfo{'os'} }; + if(scalar @os_list > 0 && !in_array($os, \@os_list)) + { + autoconfig("$mod ($realname): " . + "skipping, not compatible with " . realname($os)) if $noisy; + return 0; + } + + my @cc_list = @{ $modinfo{'cc'} }; + if(scalar @cc_list > 0 && !in_array($cc, \@cc_list)) { + autoconfig("$mod ($realname): " . + "skipping, not compatible with " . realname($cc)) if $noisy; + return 0; + } + + + return 1; +} + + # Add modules that we think would work (unless autoconfig is off) # to $$config{'modules'} sub autoload_modules { @@ -423,7 +460,7 @@ sub autoload_modules { my $type = $modinfo{'type'}; - #autoconfig("$mod '$realname' is $type"); + autoconfig("$mod '$realname' is $type"); if(defined($$config{'modules'}{$mod})) { my $n = $$config{'modules'}{$mod}; @@ -441,44 +478,42 @@ sub autoload_modules { my @to_enable; - foreach my $req_mod (@{$modinfo{'requires'}}) { - print "Checking if $req_mod required by $mod is ok to use\n"; + foreach my $req_mod_l (@{$modinfo{'requires'}}) { + my @any_of = split(/\|/, $req_mod_l); + + autoconfig("Finding a dep $req_mod_l of $realname"); - 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; + my $mod_to_use = undef; + for my $req_mod (@any_of) { + + # one already enabled or disabled + if(defined($$config{'modules'}{$req_mod})) { + my $n = $$config{'modules'}{$req_mod}; + + next if($n < 0); + + if($n > 0) { + $mod_to_use = $mod; + $loaded{$type}{$mod} = 1; + $$config{'modules'}{$req_mod} = 1; + last; + } + } + elsif(module_runs_on(0, \%modinfo, $realname, $arch, $submodel, $os, $cc)) { + autoconfig("XXX Enabling $req_mod for $mod"); + $mod_to_use = $mod; + $loaded{$type}{$mod} = 1; + $$config{'modules'}{$req_mod} = 1; } - } else { - push @to_enable, $req_mod; } - } - my @arch_list = @{ $modinfo{'arch'} }; - if(scalar @arch_list > 0 && - !in_array($arch, \@arch_list) && - !in_array($submodel, \@arch_list)) { - autoconfig("$mod ($realname): skipping, " . - "not compatible with " . realname($arch) . - "/" . $submodel); - next; - } - - my @os_list = @{ $modinfo{'os'} }; - if(scalar @os_list > 0 && !in_array($os, \@os_list)) { - autoconfig("$mod ($realname): " . - "skipping, not compatible with " . realname($os)); - next; + unless(defined $mod_to_use) { + autoconfig("Disabling module $mod due to missing dep $req_mod_l"); + $$config{'modules'}{$mod} = -1; + } } - my @cc_list = @{ $modinfo{'cc'} }; - if(scalar @cc_list > 0 && !in_array($cc, \@cc_list)) { - autoconfig("$mod ($realname): " . - "skipping, not compatible with " . realname($cc)); - next; - } + next unless module_runs_on(1, \%modinfo, $realname, $arch, $submodel, $os, $cc); if(!$asm_ok and $modinfo{'load_on'} eq 'asm_ok') { autoconfig("$mod ($realname): " . diff --git a/src/bigint/info.txt b/src/bigint/info.txt index b82d1cd72..3e1531754 100644 --- a/src/bigint/info.txt +++ b/src/bigint/info.txt @@ -7,6 +7,8 @@ define BIGINT <requires> hex mp_amd64 +monty_amd64|monty_generic +mulop_generic </requires> <add> @@ -25,7 +27,5 @@ mp_asm.cpp mp_comba.cpp mp_karat.cpp mp_misc.cpp -mp_monty.cpp -mp_mulop.cpp mp_shift.cpp </add> diff --git a/src/bigint/monty_amd64/xxxinfo.txt b/src/bigint/monty_amd64/info.txt index 2a8f9fe5b..32308bf41 100644 --- a/src/bigint/monty_amd64/xxxinfo.txt +++ b/src/bigint/monty_amd64/info.txt @@ -1,20 +1,17 @@ -realname "x86-64 Assembler" +realname "Montgomery Reduction (x86-64)" mp_bits 64 load_on request -<ignore> -#mp_mulop.cpp -#mp_monty.cpp -</ignore> - <add> -asm_macr.h -#mp_mulop_amd64.S -#mp_monty.S +mp_monty.S </add> +<requires> +asm_amd64 +</requires> + <arch> amd64 </arch> diff --git a/src/bigint/monty_generic/info.txt b/src/bigint/monty_generic/info.txt new file mode 100644 index 000000000..9187e9d22 --- /dev/null +++ b/src/bigint/monty_generic/info.txt @@ -0,0 +1,7 @@ +realname "Montgomery Reduction" + +load_on request + +<add> +mp_monty.cpp +</add> diff --git a/src/bigint/mp_monty.cpp b/src/bigint/monty_generic/mp_monty.cpp index c162bfd4f..c162bfd4f 100644 --- a/src/bigint/mp_monty.cpp +++ b/src/bigint/monty_generic/mp_monty.cpp diff --git a/src/bigint/mp_generic/info.txt b/src/bigint/mp_generic/info.txt index 22c2140fb..8b319c58d 100644 --- a/src/bigint/mp_generic/info.txt +++ b/src/bigint/mp_generic/info.txt @@ -1,7 +1,5 @@ realname "MPI Core (C++)" -mp_bits 32 - load_on request <add> diff --git a/src/bigint/mulop_amd64/info.txt b/src/bigint/mulop_amd64/info.txt new file mode 100644 index 000000000..0960ac4d6 --- /dev/null +++ b/src/bigint/mulop_amd64/info.txt @@ -0,0 +1,31 @@ +realname "BigInt Multiply-Add (x86-64)" + +mp_bits 64 + +load_on request + +<add> +mp_mulop_amd64.S +</add> + +<requires> +asm_amd64 +</requires> + +<arch> +amd64 +</arch> + +<cc> +gcc +icc +</cc> + +# ELF systems +<os> +linux +freebsd +netbsd +openbsd +solaris +</os> diff --git a/src/bigint/mulop_generic/info.txt b/src/bigint/mulop_generic/info.txt new file mode 100644 index 000000000..1fe3c2868 --- /dev/null +++ b/src/bigint/mulop_generic/info.txt @@ -0,0 +1,7 @@ +realname "BigInt Multiply-Add" + +load_on request + +<add> +mp_mulop.cpp +</add> diff --git a/src/bigint/mp_mulop.cpp b/src/bigint/mulop_generic/mp_mulop.cpp index 3ab28d306..3ab28d306 100644 --- a/src/bigint/mp_mulop.cpp +++ b/src/bigint/mulop_generic/mp_mulop.cpp diff --git a/src/bigint/mulop_ia32/info.txt b/src/bigint/mulop_ia32/info.txt new file mode 100644 index 000000000..0814bc08a --- /dev/null +++ b/src/bigint/mulop_ia32/info.txt @@ -0,0 +1,31 @@ +realname "BigInt Multiply-Add (IA-32)" + +mp_bits 32 + +load_on request + +<add> +mp_mulop.S +</add> + +<requires> +asm_amd64 +</requires> + +<arch> +ia32 +</arch> + +<cc> +gcc +icc +</cc> + +# ELF systems +<os> +linux +freebsd +netbsd +openbsd +solaris +</os> diff --git a/src/bigint/mulop_ia32/xxxinfo.txt b/src/bigint/mulop_ia32/xxxinfo.txt deleted file mode 100644 index 12c8cd96d..000000000 --- a/src/bigint/mulop_ia32/xxxinfo.txt +++ /dev/null @@ -1,43 +0,0 @@ -realname "x86 Assembler" - -#mp_bits 32 - -load_on asm_ok - -<replace> -md4.cpp -md5.cpp -sha160.cpp -serpent.cpp -</replace> - -<ignore> -#mp_mulop.cpp -</ignore> - -<add> -asm_macr.h -md4core.S -md5core.S -sha1_asm.S -serp_asm.S -#mp_mulop.S -</add> - -<arch> -ia32 -</arch> - -<cc> -gcc -icc -</cc> - -# ELF systems -<os> -linux -freebsd -netbsd -openbsd -solaris -</os> |