@{$configdata::config{perlargv}} : ();
die "Incorrect data to reconfigure, please do a normal configuration\n"
if (grep(/^reconf/,@argvcopy));
- $ENV{CROSS_COMPILE} = $configdata::config{cross_compile_prefix}
- if defined($configdata::config{cross_compile_prefix});
- $ENV{CC} = $configdata::config{cc}
- if defined($configdata::config{cc});
- $ENV{CXX} = $configdata::config{cxx}
- if defined($configdata::config{cxx});
- $ENV{BUILDFILE} = $configdata::config{build_file}
- if defined($configdata::config{build_file});
- $ENV{$local_config_envname} = $configdata::config{local_config_dir}
- if defined($configdata::config{local_config_dir});
+ $config{perlenv} = $configdata::config{perlenv} // {};
print "Reconfiguring with: ", join(" ",@argvcopy), "\n";
- print " CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
- if $ENV{CROSS_COMPILE};
- print " CC = ",$ENV{CC},"\n" if $ENV{CC};
- print " CXX = ",$ENV{CXX},"\n" if $ENV{CXX};
- print " BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE};
- print " $local_config_envname = ",$ENV{$local_config_envname},"\n"
- if $ENV{$local_config_envname};
+ foreach (sort keys %{$config{perlenv}}) {
+ print " $_ = $config{perlenv}->{$_}\n";
+ }
} else {
die "Insufficient data to reconfigure, please do a normal configuration\n";
}
&read_config($_);
}
-if (defined $ENV{$local_config_envname}) {
+if (defined env($local_config_envname)) {
if ($^O eq 'VMS') {
# VMS environment variables are logical names,
# which can be used as is
$pattern = $local_config_envname . ':' . '*.conf';
} else {
- $pattern = catfile($ENV{$local_config_envname}, '*.conf');
+ $pattern = catfile(env($local_config_envname), '*.conf');
}
foreach (sort glob($pattern)) {
# crypto/ subdirectories to build
$config{sdirs} = [
"objects",
- "md2", "md4", "md5", "sha", "mdc2", "hmac", "ripemd", "whrlpool", "poly1305", "blake2", "siphash",
- "des", "aes", "rc2", "rc4", "rc5", "idea", "aria", "bf", "cast", "camellia", "seed", "chacha", "modes",
+ "md2", "md4", "md5", "sha", "mdc2", "hmac", "ripemd", "whrlpool", "poly1305", "blake2", "siphash", "sm3",
+ "des", "aes", "rc2", "rc4", "rc5", "idea", "aria", "bf", "cast", "camellia", "seed", "sm4", "chacha", "modes",
"bn", "ec", "rsa", "dsa", "dh", "dso", "engine",
"buffer", "bio", "stack", "lhash", "rand", "err",
"evp", "asn1", "pem", "x509", "x509v3", "conf", "txt_db", "pkcs7", "pkcs12", "comp", "ocsp", "ui",
"seed",
"shared",
"siphash",
+ "sm3",
+ "sm4",
"sock",
"srp",
"srtp",
sub { 0 == scalar grep { !$disabled{$_} } @dtls }
=> [ "dtls" ],
- # SSL 3.0, (D)TLS 1.0 and TLS 1.1 require MD5 and SHA
- "md5" => [ "ssl", "tls1", "tls1_1", "dtls1" ],
- "sha" => [ "ssl", "tls1", "tls1_1", "dtls1" ],
-
- # Additionally, SSL 3.0 requires either RSA or DSA+DH
- sub { $disabled{rsa}
- && ($disabled{dsa} || $disabled{dh}); }
- => [ "ssl" ],
-
- # (D)TLS 1.0 and TLS 1.1 also require either RSA or DSA+DH
- # or ECDSA + ECDH. (D)TLS 1.2 has this requirement as well.
- # (XXX: We don't support PSK-only builds).
- sub { $disabled{rsa}
- && ($disabled{dsa} || $disabled{dh})
- && ($disabled{ecdsa} || $disabled{ecdh}); }
- => [ "tls1", "tls1_1", "tls1_2", "tls1_3",
- "dtls1", "dtls1_2" ],
-
"tls" => [ @tls ],
sub { 0 == scalar grep { !$disabled{$_} } @tls }
=> [ "tls" ],
- # SRP and HEARTBEATS require TLSEXT
- "tlsext" => [ "srp", "heartbeats" ],
-
"crypto-mdebug" => [ "crypto-mdebug-backtrace" ],
# Without DSO, we can't load dynamic engines, so don't build them dynamic
while (@argvcopy)
{
$_ = shift @argvcopy;
+
+ # Support env variable assignments among the options
+ if (m|^(\w+)=(.+)?$|)
+ {
+ $config{perlenv}->{$1} = $2;
+ next;
+ }
+
# VMS is a case insensitive environment, and depending on settings
# out of our control, we may receive options uppercased. Let's
# downcase at least the part before any equal sign.
}
unless ($_ eq $target || /^no-/ || /^disable-/)
{
- # "no-..." follows later after implied disactivations
+ # "no-..." follows later after implied deactivations
# have been derived. (Don't take this too seriously,
# we really only write OPTIONS to the Makefile out of
# nostalgia.)
if ($config{target} =~ /^(?:Cygwin|mingw)/);
-$config{cross_compile_prefix} = $ENV{'CROSS_COMPILE'}
+$config{cross_compile_prefix} = env('CROSS_COMPILE')
if $config{cross_compile_prefix} eq "";
# Allow overriding the names of some tools. USE WITH CARE
# the default string.
$config{perl} = ($^O ne "VMS" ? $^X : "perl");
$config{hashbangperl} =
- $ENV{'HASHBANGPERL'} || $ENV{'PERL'} || "/usr/bin/env perl";
-$target{cc} = $ENV{'CC'} || $target{cc} || "cc";
-$target{cxx} = $ENV{'CXX'} || $target{cxx} || "c++";
-$target{ranlib} = $ENV{'RANLIB'} || $target{ranlib} ||
+ env('HASHBANGPERL') || env('PERL') || "/usr/bin/env perl";
+$target{cc} = env('CC') || $target{cc} || "cc";
+$target{cxx} = env('CXX') || $target{cxx} || "c++";
+$target{ranlib} = env('RANLIB') || $target{ranlib} ||
(which("$config{cross_compile_prefix}ranlib") ?
"\$(CROSS_COMPILE)ranlib" : "true");
-$target{ar} = $ENV{'AR'} || $target{ar} || "ar";
-$target{nm} = $ENV{'NM'} || $target{nm} || "nm";
+$target{ar} = env('AR') || $target{ar} || "ar";
+$target{nm} = env('NM') || $target{nm} || "nm";
$target{rc} =
- $ENV{'RC'} || $ENV{'WINDRES'} || $target{rc} || "windres";
+ env('RC') || env('WINDRES') || $target{rc} || "windres";
# Allow overriding the build file name
-$target{build_file} = $ENV{BUILDFILE} || $target{build_file} || "Makefile";
+$target{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
# Cache information necessary for reconfiguration
$config{cc} = $target{cc};
my @build_file_templates = ();
# First, look in the user provided directory, if given
- if (defined $ENV{$local_config_envname}) {
+ if (defined env($local_config_envname)) {
@build_file_templates =
map {
if ($^O eq 'VMS') {
# which can be used as is
$local_config_envname . ':' . $_;
} else {
- catfile($ENV{$local_config_envname}, $_);
+ catfile(env($local_config_envname), $_);
}
}
@build_file_template_names;
# Additionally, we set up sharednames for libraries that don't
# have any, as themselves. Only for libraries that aren't
- # explicitely static.
+ # explicitly static.
foreach (grep !/\.a$/, keys %{$unified_info{libraries}}) {
if (!defined $unified_info{sharednames}->{$_}) {
$unified_info{sharednames}->{$_} = $_
}
# Check that we haven't defined any library as both shared and
- # explicitely static. That is forbidden.
+ # explicitly static. That is forbidden.
my @doubles = ();
foreach (grep /\.a$/, keys %{$unified_info{libraries}}) {
(my $l = $_) =~ s/\.a$//;
push @doubles, $l if defined $unified_info{sharednames}->{$l};
}
- die "these libraries are both explicitely static and shared:\n ",
+ die "these libraries are both explicitly static and shared:\n ",
join(" ", @doubles), "\n"
if @doubles;
}
print OUT " ", $_, " => [ ", join(", ",
map { quotify("perl", $_) }
@{$config{$_}}), " ],\n";
+ } elsif (ref($config{$_}) eq "HASH") {
+ print OUT " ", $_, " => {";
+ if (scalar keys %{$config{$_}} > 0) {
+ print OUT "\n";
+ foreach my $key (sort keys %{$config{$_}}) {
+ print OUT " ",
+ join(" => ",
+ quotify("perl", $key),
+ defined $config{$_}->{$key}
+ ? quotify("perl", $config{$_}->{$key})
+ : "undef");
+ print OUT ",\n";
+ }
+ print OUT " ";
+ }
+ print OUT "},\n";
} else {
print OUT " ", $_, " => ", quotify("perl", $config{$_}), ",\n"
}
}
}
+sub env
+{
+ my $name = shift;
+
+ # Note that if $ENV{$name} doesn't exist or is undefined,
+ # $config{perlenv}->{$name} will be created with the value
+ # undef. This is intentional.
+
+ $config{perlenv}->{$name} = $ENV{$name}
+ if ! exists $config{perlenv}->{$name};
+ return $config{perlenv}->{$name};
+}
+
# Configuration printer ##############################################
sub print_table_entry