-# The configuration hashes can refer to templates in two different manners:
-#
-# - as part of the hash, one can have a key called 'inherit_from' that
-# indicate what other configuration hashes to inherit data from.
-# These are resolved recursively.
-#
-# Inheritance works as a set of default values that can be overriden
-# by corresponding attribute values in the inheriting configuration.
-#
-# If several configurations are given in the 'inherit_from' array, the
-# values of same attribute are concatenated with space separation.
-# With this, it's possible to have several smaller templates for
-# different configuration aspects that can be combined into a complete
-# configuration.
-#
-# Example:
-#
-# "foo" => {
-# template => 1,
-# haha => "haha",
-# hoho => "ho"
-# },
-# "bar" => {
-# template => 1,
-# hoho => "ho",
-# hehe => "hehe"
-# },
-# "laughter" => {
-# inherit_from => [ "foo", "bar" ],
-# }
-#
-# The entry for "foo" will become as follows after processing:
-#
-# "laughter" => {
-# haha => "haha",
-# hoho => "ho ho",
-# hehe => "hehe"
-# }
-#
-# Note 1: any entry from the table can be used as a template.
-# Note 2: pure templates have the attribute 'template => 1' and cannot
-# be used as targets.
-#
-# - instead of a string, one can have a code block of the form
-# 'sub { /* your code here */ }', where the arguments are the list of
-# inherited values for that key. In fact, the concatenation of strings
-# is really done by using 'sub { join(" ",@_) }' on the list of inherited
-# values.
-#
-# Example:
-#
-# "foo" => {
-# template => 1,
-# haha => "ha ha",
-# hoho => "ho",
-# ignored => "This should not appear in the end result",
-# },
-# "bar" => {
-# template => 1,
-# haha => "ah",
-# hoho => "haho",
-# hehe => "hehe"
-# },
-# "laughter" => {
-# inherit_from => [ "foo", "bar" ],
-# hehe => sub { join(" ",(@_,"!!!")) },
-# ignored => "",
-# }
-#
-# The entry for "foo" will become as follows after processing:
-#
-# "laughter" => {
-# haha => "ha ha ah",
-# hoho => "ho haho",
-# hehe => "hehe !!!",
-# ignored => ""
-# }
-#
-
-my %table=(
-
- # All these templates are merely a translation of the corresponding
- # variables further up.
- #
- # Note: as long as someone might use old style configuration strings,
- # or we bother supporting that, those variables need to stay
-
- x86_asm => {
- template => 1,
- cpuid_obj => "x86cpuid.o",
- bn_obj => "bn-586.o co-586.o x86-mont.o x86-gf2m.o",
- ec_obj => "ecp_nistz256.o ecp_nistz256-x86.o",
- des_obj => "des-586.o crypt586.o",
- aes_obj => "aes-586.o vpaes-x86.o aesni-x86.o",
- bf_obj => "bf-586.o",
- md5_obj => "md5-586.o",
- sha1_obj => "sha1-586.o sha256-586.o sha512-586.o",
- rc4_obj => "rc4-586.o",
- rmd160_obj => "rmd-586.o",
- rc5_obj => "rc5-586.o",
- wp_obj => "wp_block.o wp-mmx.o",
- cmll_obj => "cmll-x86.o",
- modes_obj => "ghash-x86.o",
- engines_obj => "e_padlock-x86.o"
- },
- x86_elf_asm => {
- template => 1,
- inherit_from => [ "x86_asm" ],
- perlasm_scheme => "elf"
- },
- x86_64_asm => {
- template => 1,
- cpuid_obj => "x86_64cpuid.o",
- bn_obj => "x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",
- ec_obj => "ecp_nistz256.o ecp_nistz256-x86_64.o",
- aes_obj => "aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o",
- md5_obj => "md5-x86_64.o",
- sha1_obj => "sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o",
- rc4_obj => "rc4-x86_64.o rc4-md5-x86_64.o",
- wp_obj => "wp-x86_64.o",
- cmll_obj => "cmll-x86_64.o cmll_misc.o",
- modes_obj => "ghash-x86_64.o aesni-gcm-x86_64.o",
- engines_obj => "e_padlock-x86_64.o"
- },
- ia64_asm => {
- template => 1,
- cpuid_obj => "ia64cpuid.o",
- bn_obj => "bn-ia64.o ia64-mont.o",
- aes_obj => "aes_core.o aes_cbc.o aes-ia64.o",
- md5_obj => "md5-ia64.o",
- sha1_obj => "sha1-ia64.o sha256-ia64.o sha512-ia64.o",
- rc4_obj => "rc4-ia64.o rc4_skey.o",
- modes_obj => "ghash-ia64.o",
- perlasm_scheme => "void"
- },
- sparcv9_asm => {
- template => 1,
- cpuid_obj => "sparcv9cap.o sparccpuid.o",
- bn_obj => "bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o",
- ec_obj => "ecp_nistz256.o ecp_nistz256-sparcv9.o",
- des_obj => "des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o",
- aes_obj => "aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o",
- md5_obj => "md5-sparcv9.o",
- sha1_obj => "sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o",
- cmll_obj => "camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o",
- modes_obj => "ghash-sparcv9.o",
- perlasm_scheme => "void"
- },
- sparcv8_asm => {
- template => 1,
- cpuid_obj => "",
- bn_obj => "sparcv8.o",
- des_obj => "des_enc-sparc.o fcrypt_b.o",
- perlasm_scheme => "void"
- },
- alpha_asm => {
- template => 1,
- cpuid_obj => "alphacpuid.o",
- bn_obj => "bn_asm.o alpha-mont.o",
- sha1_obj => "sha1-alpha.o",
- modes_obj => "ghash-alpha.o",
- perlasm_scheme => "void"
- },
- mips32_asm => {
- template => 1,
- bn_obj => "bn-mips.o mips-mont.o",
- aes_obj => "aes_cbc.o aes-mips.o",
- sha1_obj => "sha1-mips.o sha256-mips.o",
- },
- mips64_asm => {
- inherit_from => [ "mips32_asm" ],
- template => 1,
- sha1_obj => sub { join(" ", @_, "sha512-mips.o") }
- },
- s390x_asm => {
- template => 1,
- cpuid_obj => "s390xcap.o s390xcpuid.o",
- bn_obj => "bn-s390x.o s390x-mont.o s390x-gf2m.o",
- aes_obj => "aes-s390x.o aes-ctr.o aes-xts.o",
- sha1_obj => "sha1-s390x.o sha256-s390x.o sha512-s390x.o",
- rc4_obj => "rc4-s390x.o",
- modes_obj => "ghash-s390x.o",
- },
- armv4_asm => {
- template => 1,
- cpuid_obj => "armcap.o armv4cpuid.o",
- bn_obj => "bn_asm.o armv4-mont.o armv4-gf2m.o",
- ec_obj => "ecp_nistz256.o ecp_nistz256-armv4.o",
- aes_obj => "aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o",
- sha1_obj => "sha1-armv4-large.o sha256-armv4.o sha512-armv4.o",
- modes_obj => "ghash-armv4.o ghashv8-armx.o",
- perlasm_scheme => "void"
- },
- aarch64_asm => {
- template => 1,
- cpuid_obj => "armcap.o arm64cpuid.o mem_clr.o",
- ec_obj => "ecp_nistz256.o ecp_nistz256-armv8.o",
- bn_obj => "bn_asm.o armv8-mont.o",
- aes_obj => "aes_core.o aes_cbc.o aesv8-armx.o vpaes-armv8.o",
- sha1_obj => "sha1-armv8.o sha256-armv8.o sha512-armv8.o",
- modes_obj => "ghashv8-armx.o",
- },
- parisc11_asm => {
- template => 1,
- cpuid_obj => "pariscid.o",
- bn_obj => "bn_asm.o parisc-mont.o",
- aes_obj => "aes_core.o aes_cbc.o aes-parisc.o",
- sha1_obj => "sha1-parisc.o sha256-parisc.o sha512-parisc.o",
- rc4_obj => "rc4-parisc.o",
- modes_obj => "ghash-parisc.o",
- perlasm_scheme => "32"
- },
- parisc20_64_asm => {
- template => 1,
- inherit_from => [ "parisc11_asm" ],
- bn_obj => sub { my $r=join(" ",@_); $r=~s/bn_asm/pa-risc2W/; $r; },
- perlasm_scheme => "64",
- },
- ppc64_asm => {
- template => 1,
- cpuid_obj => "ppccpuid.o ppccap.o",
- bn_obj => "bn-ppc.o ppc-mont.o ppc64-mont.o",
- aes_obj => "aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o",
- sha1_obj => "sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o",
- modes_obj => "ghashp8-ppc.o",
- },
- ppc32_asm => {
- inherit_from => [ "ppc64_asm" ],
- template => 1
- },
-);
-
-{ my $no_asm_templates=0;
- foreach (@ARGV) { $no_asm_templates=1 if (/^\-?no\-asm$/); }
- sub asm { $no_asm_templates?():@_; }
-}
-
-
-sub stringtohash {
- my $in = shift @_;
- if (ref($in) eq "HASH") {
- return $in;
- }
- my @stringsequence = (
- "cc",
- "cflags",
- "unistd",
- "thread_cflag",
- "sys_id",
- "lflags",
- "bn_ops",
- "cpuid_obj",
- "bn_obj",
- "ec_obj",
- "des_obj",
- "aes_obj",
- "bf_obj",
- "md5_obj",
- "sha1_obj",
- "cast_obj",
- "rc4_obj",
- "rmd160_obj",
- "rc5_obj",
- "wp_obj",
- "cmll_obj",
- "modes_obj",
- "engines_obj",
- "perlasm_scheme",
- "dso_scheme",
- "shared_target",
- "shared_cflag",
- "shared_ldflag",
- "shared_extension",
- "ranlib",
- "arflags",
- "multilib",
- );
-
- # return a ref to a hash, that's what the outer braces are for.
- return { map { shift @stringsequence => $_ } split /:/, $in };