#! /usr/bin/env perl
# -*- mode: perl; -*-
-##
## Configure -- OpenSSL source tree configuration script
-## If editing this file, run this command before committing
-## make -f Makefile.in TABLE
-##
-require 5.000;
+require 5.10.0;
use strict;
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
print "Configuring OpenSSL version $config{version} (0x$config{version_num})\n";
-$config{perl};
$config{prefix}="";
$config{openssldir}="";
$config{processor}="";
# crypto/ subdirectories to build
$config{sdirs} = [
"objects",
- "md2", "md4", "md5", "sha", "mdc2", "hmac", "ripemd", "whrlpool", "poly1305",
+ "md2", "md4", "md5", "sha", "mdc2", "hmac", "ripemd", "whrlpool", "poly1305", "blake2",
"des", "aes", "rc2", "rc4", "rc5", "idea", "bf", "cast", "camellia", "seed", "chacha", "modes",
"bn", "ec", "rsa", "dsa", "dh", "dso", "engine",
"buffer", "bio", "stack", "lhash", "rand", "err",
my @disablables = (
"aes",
+ "afalgeng",
"asm",
"async",
"autoalginit",
"autoerrinit",
"bf",
+ "blake2",
"camellia",
"capieng",
"cast",
"ssl-trace" => "default",
"ssl3" => "default",
"ssl3-method" => "default",
- "static-engine" => "default",
"unit-test" => "default",
"weak-ssl-ciphers" => "default",
"zlib" => "default",
"dso" => [ "dynamic-engine" ],
# Without position independent code, there can be no shared libraries or DSOs
- "pic" => [ "shared", "dynamic-engine" ],
+ "pic" => [ "shared" ],
+ "shared" => [ "dynamic-engine" ],
+ "engine" => [ "afalgeng" ],
);
# Avoid protocol support holes. Also disable all versions below N, if version
my ($test, $descendents) = (shift @cascade_copy, shift @cascade_copy);
if (ref($test) eq "CODE" ? $test->() : defined($disabled{$test})) {
map {
- $new_tocheckfor{$_} => 1; $disabled{$_} = "forced";
+ $new_tocheckfor{$_} = 1; $disabled{$_} = "forced";
} grep { !defined($disabled{$_}) } @$descendents;
}
}
if $srcdir ne $blddir;
$target{build_scheme} = { unix => [ "unixmake" ],
- windows => [ "mk1mf", $target{build_scheme}->[2] ],
+ windows => undef,
VMS => undef } -> {$target{build_scheme}->[1]};
die "Classic mode unavailable on this platform\n"
# Is the compiler gcc or clang? $ecc is used below to see if
# error-checking can be turned on.
my $ccpcc = "$config{cross_compile_prefix}$target{cc}";
- $config{makedepprog} = which('makedepend');
- open(PIPE, "$ccpcc --version 2>&1 | head -2 |");
+ open(PIPE, "$ccpcc --version 2>&1 |");
+ my $lines = 2;
while ( <PIPE> ) {
# Find the version number and save the major.
m|(?:.*)\b(\d+)\.\d+\.\d+\b(?:.*)|;
# We know that GNU C version 3 and up as well as all clang
# versions support dependency generation
$config{makedepprog} = $ccpcc
- if /clang/ || (/gcc/ && $compiler_major > 3);
+ if (/clang/ || (/gcc/ && $compiler_major > 3));
$ecc = "clang" if /clang/;
$ecc = "gcc" if /gcc/;
+ last if ($config{makedepprog} || !$lines--);
}
close(PIPE);
+ $config{makedepprog} = which('makedepend') unless $config{makedepprog};
$disabled{makedepend} = "unavailable" unless $config{makedepprog};
}
# "Stringify" the C flags string. This permits it to be made part of a string
# and works as well on command lines.
-$config{cflags} =~ s/([\\\"])/\\\1/g;
+$config{cflags} =~ s/([\\\"])/\\$1/g;
if (defined($config{api})) {
$config{openssl_api_defines} = [ "OPENSSL_MIN_API=".$apitable->{$config{api}} ];
# ALL MODIFICATIONS TO %config and %target MUST BE DONE FROM HERE ON
-unless ($disabled{engine}) {
- $config{afalg}="";
+unless ($disabled{afalgeng}) {
+ $config{afalgeng}="";
if ($target =~ m/^linux/) {
my $minver = 4*10000 + 1*100 + 0;
if ($config{cross_compile_prefix} eq "") {
($mi2) = $mi2 =~ /(\d+)/;
my $ver = $ma*10000 + $mi1*100 + $mi2;
if ($ver < $minver) {
- $disabled{afalg} = "too-old-kernel";
+ $disabled{afalgeng} = "too-old-kernel";
} else {
push @{$config{engdirs}}, "afalg";
}
+ } else {
+ $disabled{afalgeng} = "cross-compiling";
}
} else {
- $disabled{afalg} = "not-linux";
+ $disabled{afalgeng} = "not-linux";
}
}
-push @{$config{openssl_other_defines}}, "OPENSSL_NO_AFALGENG" if ($disabled{afalg});
+push @{$config{openssl_other_defines}}, "OPENSSL_NO_AFALGENG" if ($disabled{afalgeng});
# If we use the unified build, collect information from build.info files
my %unified_info = ();
+my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO});
if ($builder eq "unified") {
# Store the name of the template file we will build the build file from
# in %config. This may be useful for the build file itself.
}
},
qr/^(?:#.*|\s*)$/ => sub { },
- "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" }
+ "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },
+ "BEFORE" => sub {
+ if ($buildinfo_debug) {
+ print STDERR "DEBUG: Parsing ",join(" ", @_),"\n";
+ print STDERR "DEBUG: ... before parsing, skip stack is ",join(" ", map { int($_) } @skip),"\n";
+ }
+ },
+ "AFTER" => sub {
+ if ($buildinfo_debug) {
+ print STDERR "DEBUG: .... after parsing, skip stack is ",join(" ", map { int($_) } @skip),"\n";
+ }
+ },
);
die "runaway IF?" if (@skip);
print "PADLOCK_OBJ =$target{padlock_obj}\n";
print "CHACHA_ENC =$target{chacha_obj}\n";
print "POLY1305_OBJ =$target{poly1305_obj}\n";
+print "BLAKE2_OBJ =$target{blake2_obj}\n";
print "PROCESSOR =$config{processor}\n";
print "RANLIB =$target{ranlib}\n";
print "ARFLAGS =$target{arflags}\n";
print "SIXTY_FOUR_BIT mode\n" if $config{b64};
print "THIRTY_TWO_BIT mode\n" if $config{b32};
print "BN_LLONG mode\n" if $config{bn_ll};
-print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} != $def_int;
+print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} ne $def_int;
for (@generated_headers) {
mkpath(catdir($blddir, dirname($_)));
exit(1);
}
-sub run_dofile()
+sub run_dofile
{
my $out = shift;
my @templates = @_;
while(defined($_ = $lineiterator->())) {
s|\R$||;
my $found = 0;
+ if ($collectors{"BEFORE"}) {
+ $collectors{"BEFORE"}->($_);
+ }
foreach my $re (keys %collectors) {
- if ($re ne "OTHERWISE" && /$re/) {
+ if ($re !~ /^OTHERWISE|BEFORE|AFTER$/ && /$re/) {
$collectors{$re}->($lineiterator);
$found = 1;
};
$collectors{"OTHERWISE"}->($lineiterator, $_)
unless $found || !defined $collectors{"OTHERWISE"};
}
+ if ($collectors{"AFTER"}) {
+ $collectors{"AFTER"}->($_);
+ }
}
}