X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configure;h=e60130502f11a6da8045cd3bb835e5f3ccabc9d3;hp=e302a58abb71b835727e521c5a28a1dbfe561324;hb=add8d0e9e0bb80728f4b89d15573bf2e70596ceb;hpb=71a5516dcc8a91a9c4fbb724ea7e3658e85f2ad2 diff --git a/Configure b/Configure index e302a58abb..e60130502f 100755 --- a/Configure +++ b/Configure @@ -12,10 +12,12 @@ use 5.10.0; use strict; use Config; +use FindBin; +use lib "$FindBin::Bin/util/perl"; use File::Basename; use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; use File::Path qw/mkpath/; -use if $^O ne "VMS", 'File::Glob' => qw/glob/; +use OpenSSL::Glob; # see INSTALL for instructions. @@ -115,12 +117,12 @@ my $usage="Usage: Configure [no- ...] [enable- ...] [-Dxxx] [-lx # but 'long long' type. my $gcc_devteam_warn = "-DDEBUG_UNUSED" - . " -Wswitch" . " -DPEDANTIC -pedantic -Wno-long-long" . " -Wall" . " -Wextra" . " -Wno-unused-parameter" . " -Wno-missing-field-initializers" + . " -Wswitch" . " -Wsign-compare" . " -Wmissing-prototypes" . " -Wshadow" @@ -406,7 +408,7 @@ my @disablables = ( "tls13downgrade", "ts", "ubsan", - "ui", + "ui-console", "unit-test", "whirlpool", "weak-ssl-ciphers", @@ -416,13 +418,14 @@ my @disablables = ( foreach my $proto ((@tls, @dtls)) { push(@disablables, $proto); - push(@disablables, "$proto-method"); + push(@disablables, "$proto-method") unless $proto eq "tls1_3"; } my %deprecated_disablables = ( "ssl2" => undef, "buf-freelists" => undef, - "ripemd" => "rmd160" + "ripemd" => "rmd160", + "ui" => "ui-console", ); # All of the following is disabled by default (RC5 was enabled before 0.9.8): @@ -513,6 +516,7 @@ my @disable_cascades = ( "stdio" => [ "apps", "capieng" ], "apps" => [ "tests" ], + "tests" => [ "external-tests" ], "comp" => [ "zlib" ], "ec" => [ "tls1_3" ], sub { !$disabled{"unit-test"} } => [ "heartbeats" ], @@ -560,6 +564,9 @@ $config{build_type} = "release"; my %unsupported_options = (); my %deprecated_options = (); +# If you change this, update apps/version.c +my @known_seed_sources = qw(getrandom devrandom os egd none rdcpu librandom); +my @seed_sources = (); while (@argvcopy) { $_ = shift @argvcopy; @@ -728,6 +735,15 @@ while (@argvcopy) { $withargs{fuzzer_include}=$1; } + elsif (/^--with-rand-seed=(.*)$/) + { + foreach my $x (split(m|,|, $1)) + { + die "Unknown --with-rand-seed choice $x\n" + if ! grep { $x eq $_ } @known_seed_sources; + push @seed_sources, $x; + } + } elsif (/^--cross-compile-prefix=(.*)$/) { $config{cross_compile_prefix}=$1; @@ -811,6 +827,17 @@ if ($libs =~ /(^|\s)-Wl,-rpath,/ "***** any of asan, msan or ubsan\n"; } +if (scalar(@seed_sources) == 0) { + print "Using implicit seed configuration\n"; + push @seed_sources, 'os'; +} +die "Cannot seed with none and anything else" + if scalar(grep { $_ eq 'none' } @seed_sources) > 0 + && scalar(@seed_sources) > 1; +push @{$config{openssl_other_defines}}, + map { (my $x = $_) =~ tr|[\-a-z]|[_A-Z]|; "OPENSSL_RAND_SEED_$x" } + @seed_sources; + my @tocheckfor = (keys %disabled); while (@tocheckfor) { my %new_tocheckfor = (); @@ -968,7 +995,7 @@ $target{exe_extension}=".exe" if ($config{target} eq "DJGPP" $target{exe_extension}=".pm" if ($config{target} =~ /vos/); ($target{shared_extension_simple}=$target{shared_extension}) - =~ s|\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)||; + =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||; $target{dso_extension}=$target{shared_extension_simple}; ($target{shared_import_extension}=$target{shared_extension_simple}.".a") if ($config{target} =~ /^(?:Cygwin|mingw)/); @@ -1230,29 +1257,29 @@ unless ($disabled{asm}) { } } -my $ecc = $target{cc}; -if ($^O ne "VMS" && !$disabled{makedepend}) { - # 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}"; - open(PIPE, "$ccpcc --version 2>&1 |"); - my $lines = 2; - while ( ) { - # Find the version number and save the major. - m|(?:.*)\b(\d+)\.\d+\.\d+\b(?:.*)|; - my $compiler_major = $1; - # 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)); - $ecc = "clang" if /clang/; - $ecc = "gcc" if /gcc/; - last if ($config{makedepprog} || !$lines--); +my %predefined; + +if ($^O ne "VMS") { + my $cc = "$config{cross_compile_prefix}$target{cc}"; + + # collect compiler pre-defines from gcc or gcc-alike... + open(PIPE, "$cc -dM -E -x c /dev/null 2>&1 |"); + while () { + m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last; + $predefined{$1} = $2 // ""; } close(PIPE); - $config{makedepprog} = which('makedepend') unless $config{makedepprog}; - $disabled{makedepend} = "unavailable" unless $config{makedepprog}; + if (!$disabled{makedepend}) { + # We know that GNU C version 3 and up as well as all clang + # versions support dependency generation + if ($predefined{__GNUC__} >= 3) { + $config{makedepprog} = $cc; + } else { + $config{makedepprog} = which('makedepend'); + $disabled{makedepend} = "unavailable" unless $config{makedepprog}; + } + } } @@ -1297,13 +1324,13 @@ if (defined($config{api})) { if ($strict_warnings) { my $wopt; - die "ERROR --strict-warnings requires gcc or clang" - unless $ecc eq 'gcc' || $ecc eq 'clang'; + die "ERROR --strict-warnings requires gcc or gcc-alike" + unless defined($predefined{__GNUC__}); foreach $wopt (split /\s+/, $gcc_devteam_warn) { $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(?:^|\s)$wopt(?:\s|$)/) } - if ($ecc eq "clang") + if (defined($predefined{__clang__})) { foreach $wopt (split /\s+/, $clang_devteam_warn) { @@ -1360,7 +1387,6 @@ my %unified_info = (); my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO}); if ($builder eq "unified") { - use lib catdir(dirname(__FILE__),"util"); use with_fallback qw(Text::Template); sub cleandir { @@ -1488,8 +1514,10 @@ if ($builder eq "unified") { my %generate = (); push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f); - my $template = Text::Template->new(TYPE => 'FILE', - SOURCE => catfile($sourced, $f)); + my $template = + Text::Template->new(TYPE => 'FILE', + SOURCE => catfile($sourced, $f), + PREPEND => qq{use lib "$FindBin::Bin/util/perl";}); die "Something went wrong with $sourced/$f: $!\n" unless $template; my @text = split /^/m,