summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Configurations/00-base-templates.conf1
-rw-r--r--Configurations/10-main.conf28
-rw-r--r--Configurations/README12
-rwxr-xr-xConfigure123
4 files changed, 108 insertions, 56 deletions
diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf
index 064648f15a..90633c4abf 100644
--- a/Configurations/00-base-templates.conf
+++ b/Configurations/00-base-templates.conf
@@ -20,6 +20,7 @@
poly1305_obj => "",
unistd => "<unistd.h>",
+ build_scheme => "unixmake",
},
x86_asm => {
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 06911acac1..c5ae5940e2 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -125,13 +125,13 @@
},
"solaris-sparcv8-gcc" => {
inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv8_asm") ],
- cflags => sub { join(" ","-mcpu=v8",@_); },
+ cflags => add_before(" ", "-mcpu=v8"),
},
"solaris-sparcv9-gcc" => {
# -m32 should be safe to add as long as driver recognizes
# -mcpu=ultrasparc
inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
- cflags => sub { join(" ","-m32 -mcpu=ultrasparc",@_); },
+ cflags => add_before(" ", "-m32 -mcpu=ultrasparc"),
debug_cflags => "-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DPEDANTIC -O -g -pedantic -ansi -Wshadow -Wno-long-long -D__EXTENSIONS__",
},
"solaris64-sparcv9-gcc" => {
@@ -161,15 +161,15 @@
####
"solaris-sparcv8-cc" => {
inherit_from => [ "solaris-sparcv7-cc", asm("sparcv8_asm") ],
- cflags => sub { join(" ","-xarch=v8",@_); },
+ cflags => add_before(" ", "-xarch=v8"),
},
"solaris-sparcv9-cc" => {
inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
- cflags => sub { join(" ","-xarch=v8plus -xtarget=ultra",@_); },
+ cflags => add_before(" ", "-xarch=v8plus -xtarget=ultra"),
},
"solaris64-sparcv9-cc" => {
inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
- cflags => sub { join(" ","-xarch=v9 -xtarget=ultra",@_); },
+ cflags => add_before(" ", "-xarch=v9 -xtarget=ultra"),
bn_ops => "BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR",
shared_ldflag => "-xarch=v9 -G -dy -z text",
multilib => "/64",
@@ -353,7 +353,7 @@
},
"hpux-parisc1_1-cc" => {
inherit_from => [ "hpux-parisc-cc", asm("parisc11_asm") ],
- cflags => sub { join(" ","+DA1.1",@_); },
+ cflags => add_before(" ", "+DA1.1"),
multilib => "/pa1.1",
},
"hpux64-parisc2-cc" => {
@@ -799,7 +799,7 @@
},
"android-armv7" => {
inherit_from => [ "android-armeabi" ],
- cflags => sub { join (" ","-march=armv7-a",@_); },
+ cflags => add_before(" ", "-march=armv7-a"),
},
"android-mips" => {
inherit_from => [ "android", asm("mips32_asm") ],
@@ -1119,23 +1119,26 @@
cc => "cl",
cflags => "-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE",
dso_scheme => "win32",
+ build_scheme => "mk1mf",
},
"VC-WIN64I" => {
inherit_from => [ "VC-common", asm("ia64_asm") ],
- cflags => sub { join(" ",@_,"-DUNICODE -D_UNICODE"); },
+ cflags => add(" ", "-DUNICODE -D_UNICODE"),
sys_id => "WIN64I",
bn_ops => "SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN",
bn_obj => sub { my $r=join(" ",@_); $r=~s/bn\-//; $r; },
rc4_obj => "",
perlasm_scheme => "ias",
+ build_scheme => [ "mk1mf", "VC-W64" ],
},
"VC-WIN64A" => {
inherit_from => [ "VC-common", asm("x86_64_asm") ],
- cflags => sub { join(" ",@_,"-DUNICODE -D_UNICODE"); },
+ cflags => add(" ", "-DUNICODE -D_UNICODE"),
sys_id => "WIN64A",
bn_ops => "SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN",
bn_obj => sub { my $r=join(" ",@_); $r=~s/x86_64\-gcc/bn_asm/; $r; },
perlasm_scheme => "auto",
+ build_scheme => [ "mk1mf", "VC-W64" ],
},
"VC-WIN32" => {
# x86 Win32 target defaults to ANSI API, if you want UNICODE,
@@ -1144,12 +1147,14 @@
sys_id => "WIN32",
bn_ops => "BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}",
perlasm_scheme => "win32n",
+ build_scheme => [ "mk1mf", "VC-W32" ],
},
"VC-CE" => {
cc => "cl",
sys_id => "WINCE",
bn_ops => "BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}",
dso_scheme => "win32",
+ build_scheme => [ "mk1mf", "VC-WCE" ],
},
#### Borland C++ 4.5
@@ -1158,6 +1163,7 @@
sys_id => "WIN32",
bn_ops => "BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN",
dso_scheme => "win32",
+ build_scheme => [ "mk1mf", "BC" ],
},
#### MinGW
@@ -1277,10 +1283,12 @@
"netware-clib" => {
cc => "mwccnlm",
bn_ops => "${x86_gcc_opts}",
+ build_scheme => [ "mk1mf", "netware" ],
},
"netware-clib-bsdsock" => {
cc => "mwccnlm",
bn_ops => "${x86_gcc_opts}",
+ build_scheme => [ "mk1mf", "netware" ],
},
"netware-clib-gcc" => {
cc => "i586-netware-gcc",
@@ -1296,10 +1304,12 @@
"netware-libc" => {
cc => "mwccnlm",
bn_ops => "BN_LLONG ${x86_gcc_opts}",
+ build_scheme => [ "mk1mf", "netware" ],
},
"netware-libc-bsdsock" => {
cc => "mwccnlm",
bn_ops => "BN_LLONG ${x86_gcc_opts}",
+ build_scheme => [ "mk1mf", "netware" ],
},
"netware-libc-gcc" => {
cc => "i586-netware-gcc",
diff --git a/Configurations/README b/Configurations/README
index e1327e57f9..df55d71549 100644
--- a/Configurations/README
+++ b/Configurations/README
@@ -97,8 +97,16 @@ In each table entry, the following keys are significant:
shared_target => The shared library building method used.
This is a target found in Makefile.shared.
build_scheme => The scheme used to build up a Makefile.
- (NOTE: this is here for future use, it's
- not implemented yet)
+ In its simplest form, the value is a string
+ with the name of the build scheme.
+ The value may also take the form of a list
+ of strings, if the build_scheme is to have
+ some options. In this case, the first
+ string in the list is the name of the build
+ scheme.
+ Currently recognised build schemes are
+ "mk1mf" and "unixmake". Others may appear
+ in the future.
multilib => On systems that support having multiple
implementations of a library (typically a
diff --git a/Configure b/Configure
index be55d8ce83..96f88b253d 100755
--- a/Configure
+++ b/Configure
@@ -172,13 +172,6 @@ foreach (sort glob($pattern) ) {
&read_config($_);
}
-my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
- debug-VC-WIN64I debug-VC-WIN64A
- VC-NT VC-CE VC-WIN32 debug-VC-WIN32
- BC-32
- netware-clib netware-clib-bsdsock
- netware-libc netware-libc-bsdsock);
-
my $prefix="";
my $libdir="";
my $openssldir="";
@@ -763,8 +756,6 @@ my %target = ( %{$table{$base_target}}, resolve_config($target) );
&usage if (!%target || $target{template});
-my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
-
$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
$exe_ext=".nlm" if ($target =~ /netware/);
$exe_ext=".pm" if ($target =~ /vos/);
@@ -782,8 +773,6 @@ $openssldir = catdir($prefix, $openssldir)
unless file_name_is_absolute($openssldir);
-print "IsMK1MF=$IsMK1MF\n";
-
# Allow environment CC to override compiler...
my $cc = $ENV{CC} || $target{cc};
@@ -828,6 +817,9 @@ my $ranlib = $ENV{'RANLIB'} || $target{ranlib};
my $ar = $ENV{'AR'} || "ar";
my $arflags = $target{arflags};
my $multilib = $target{multilib};
+my @build_scheme =
+ ref($target{build_scheme}) eq "ARRAY"
+ ? @{$target{build_scheme}} : ( $target{build_scheme} );
# if $prefix/lib$multilib is not an existing directory, then
# assume that it's not searched by linker automatically, in
@@ -976,7 +968,7 @@ if (!$no_shared)
}
}
-if (!$IsMK1MF)
+if ($build_scheme[0] ne "mk1mf")
{
# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
if ($no_shared)
@@ -1301,6 +1293,7 @@ close(OUT);
rename($Makefile,"$Makefile.orig") || die "unable to rename $Makefile\n" if -e $Makefile;
rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
+print "IsMK1MF =", ($build_scheme[0] eq "mk1mf" ? "yes" : "no"), "\n";
print "CC =$cc\n";
print "CFLAG =$cflags\n";
print "EX_LIBS =$lflags\n";
@@ -1546,17 +1539,25 @@ find(sub {
$File::Find::dir;
}, ".");
-{
- my $perlguess = $perl =~ m@^/@ ? $perl : '/usr/local/bin/perl';
-
- &dofile("tools/c_rehash",$perlguess,
- '^#!/' => '#!%s',
- '^my \$dir;$' => 'my $dir = "' . $openssldir . '";',
- '^my \$prefix;$' => 'my $prefix = "' . $prefix . '";');
- &dofile("apps/CA.pl",$perl,
- '^#!/' => '#!%s');
-}
-if($IsMK1MF) {
+my %builders = (
+ unixmake => sub {
+ my $perlguess = $perl =~ m@^/@ ? $perl : '/usr/local/bin/perl';
+ my $make_command = "$make PERL=\'$perlguess\'";
+ my $make_targets = "";
+ $make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
+ (system $make_command.$make_targets) == 0 or die "make $make_targets failed"
+ if $make_targets ne "";
+ &dofile("tools/c_rehash",$perlguess,
+ '^#!/' => '#!%s',
+ '^my \$dir;$' => 'my $dir = "' . $openssldir . '";',
+ '^my \$prefix;$' => 'my $prefix = "' . $prefix . '";');
+ &dofile("apps/CA.pl",$perlguess,
+ '^#!/' => '#!%s');
+ if ($depflags ne $default_depflags && !$make_depend) {
+ $warn_make_depend++;
+ }
+ },
+ mk1mf => sub {
open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
printf OUT <<"EOF";
#ifndef MK1MF_BUILD
@@ -1568,28 +1569,18 @@ if($IsMK1MF) {
#endif
EOF
close(OUT);
-} else {
- my $make_command = "$make PERL=\'$perl\'";
- my $make_targets = "";
- $make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
- (system $make_command.$make_targets) == 0 or die "make $make_targets failed"
- if $make_targets ne "";
- if ($depflags ne $default_depflags && !$make_depend) {
- $warn_make_depend++;
- }
-}
-# create the ms/version32.rc file if needed
-if ($IsMK1MF && ($target !~ /^netware/)) {
- my ($v1, $v2, $v3, $v4);
- if ($version_num =~ /^0x([0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{1})L$/i) {
+ # create the ms/version32.rc file if needed
+ if (! grep /^netware/, @build_scheme) {
+ my ($v1, $v2, $v3, $v4);
+ if ($version_num =~ /^0x([0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{1})L$/i) {
$v1=hex $1;
$v2=hex $2;
$v3=hex $3;
$v4=hex $4;
- }
- open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
- print OUT <<"EOF";
+ }
+ open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
+ print OUT <<"EOF";
#include <winver.h>
LANGUAGE 0x09,0x01
@@ -1638,8 +1629,13 @@ BEGIN
END
END
EOF
- close(OUT);
- }
+ close(OUT);
+ }
+ },
+ );
+
+my ($builder, @builder_opts) = @build_scheme;
+$builders{$builder}->(@builder_opts);
print <<"EOF";
@@ -1690,6 +1686,43 @@ sub asm {
}
}
+# Helper function to implement adding values to already existing configuration
+# values. It handles elements that are ARRAYs, CODEs and scalars
+sub _add {
+ my $separator = shift;
+
+ # If there's any ARRAY in the collection of values, we will return
+ # an ARRAY of combined values, otherwise a string of joined values
+ # with $separator as the separator.
+ my $found_array = 0;
+
+ my @values =
+ map {
+ if (ref($_) eq "ARRAY") {
+ $found_array = 1;
+ @$_;
+ } else {
+ $_;
+ }
+ } (@_);
+
+ if ($found_array) {
+ [ @values ];
+ } else {
+ join($separator, @values);
+ }
+}
+sub add_before {
+ my $separator = shift;
+ my @x = @_;
+ sub { _add($separator, @x, @_) };
+}
+sub add {
+ my $separator = shift;
+ my @x = @_;
+ sub { _add($separator, @_, @x) };
+}
+
# configuration reader, evaluates the input file as a perl script and expects
# it to fill %targets with target configurations. Those are then added to
# %table.
@@ -1783,7 +1816,7 @@ sub resolve_config {
# value.
# - Otherwise, this target's value is assumed to be a string that
# will simply override the inherited list of values.
- my $default_combiner = sub { join(' ',@_) };
+ my $default_combiner = add(" ");
my %all_keys =
map { $_ => 1 } (keys %combined_inheritance,
@@ -1803,8 +1836,8 @@ sub resolve_config {
# arguments.
$table{$target}->{$_} =
$table{$target}->{$_}->(@{$combined_inheritance{$_}});
- } elsif ($valuetype eq "") {
- # Scalar, just leave it as is.
+ } elsif ($valuetype eq "ARRAY" || $valuetype eq "") {
+ # ARRAY or Scalar, just leave it as is.
} else {
# Some other type of reference that we don't handle.
# Better to abort at this point.