diff options
author | lloyd <[email protected]> | 2008-09-29 21:45:25 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-29 21:45:25 +0000 |
commit | 98e89e86beec39c9a789f8dba72dc5746c31943d (patch) | |
tree | b0282892e61fa2930bd20e08d2a940c7adc4d176 /configure.pl | |
parent | 8157ca69909e59682619822d6d54c9c7e90be406 (diff) |
Merge the 3 mlocks (ml_unix, ml_win32, stub mlock.cpp) into a single mlock.cpp
in utils.
Support OS feature macros, eg BOTAN_TARGET_OS_HAS_POSIX_MLOCK (how very autoconf)
Diffstat (limited to 'configure.pl')
-rwxr-xr-x | configure.pl | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/configure.pl b/configure.pl index f9c18c5b6..6c7164be8 100755 --- a/configure.pl +++ b/configure.pl @@ -1043,11 +1043,25 @@ sub load_modules { $$config{'mod-list'} = join("\n", @mod_names); + my $unaligned_ok = 0; + my $gen_defines = sub { my $defines = ''; my $arch = $$config{'arch'}; + my $os = $$config{'os'}; + if($os ne 'generic') { + $defines .= '#define BOTAN_TARGET_OS_IS_' . uc $os . "\n"; + my @features = @{$OPERATING_SYSTEM{$os}{'target_features'}}; + + for my $feature (@features) { + $defines .= '#define BOTAN_TARGET_OS_HAS_' . uc $feature . "\n"; + } + + $defines .= "\n"; + } + if($arch ne 'generic') { my %cpu_info = %{$CPU{$arch}}; my $endian = $cpu_info{'endian'}; @@ -1069,15 +1083,6 @@ sub load_modules { $defines .= "#define BOTAN_TARGET_CPU_IS_$submodel\n"; } - my $os = $$config{'os'}; - if($os ne 'generic') { - $os = uc $os; - $submodel =~ s/-/_/g; - $defines .= "#define BOTAN_TARGET_OS_IS_$os\n"; - } - - my $unaligned_ok = 0; - if(defined($endian)) { $endian = uc $endian; $defines .= "#define BOTAN_TARGET_CPU_IS_${endian}_ENDIAN\n"; @@ -1104,26 +1109,29 @@ sub load_modules { $unaligned_ok = 1; } } - - $defines .= - "#define BOTAN_TARGET_UNALIGNED_LOADSTOR_OK $unaligned_ok\n"; } - my @defarray; + # always set (one or zero) + $defines .= + "#define BOTAN_TARGET_UNALIGNED_LOADSTOR_OK $unaligned_ok\n"; + + my %defines; + foreach my $mod (sort keys %{$$config{'modules'}}) { next unless $$config{'modules'}{$mod} > 0; my $defs = $MODULES{$mod}{'define'}; next unless $defs; - push @defarray, split(/,/, $defs); + push @{$defines{$MODULES{$mod}{'type'}}}, split(/,/, $defs); } - $defines .= "\n" if(@defarray); - - foreach (sort @defarray) { - die unless(defined $_ and $_ ne ''); - $defines .= "#define BOTAN_HAS_$_\n"; + foreach my $type (sort keys %defines) { + $defines .= "\n/* $type */\n"; + for my $macro (@{$defines{$type}}) { + die unless(defined $macro and $macro ne ''); + $defines .= "#define BOTAN_HAS_$macro\n"; + } } chomp($defines); return $defines; @@ -1540,6 +1548,8 @@ sub get_os_info { read_list($_, $reader, 'aliases', list_push(\@{$info{'aliases'}})); + read_list($_, $reader, 'target_features', list_push(\@{$info{'target_features'}})); + read_list($_, $reader, 'supports_shared', list_push(\@{$info{'supports_shared'}})); } |