X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configure;h=dfad3fe7a5aac3361c1629c4a7d5a2deba409778;hp=648fc0694efd94c994c061804d9a4760457d72eb;hb=HEAD;hpb=764cf5b26306a8712e8b3d41599c44dc5ed07a25 diff --git a/Configure b/Configure index 648fc0694e..75f3f720f9 100755 --- a/Configure +++ b/Configure @@ -1,6 +1,6 @@ #! /usr/bin/env perl # -*- mode: perl; -*- -# Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -17,7 +17,6 @@ use lib "$FindBin::Bin/util/perl"; use File::Basename; use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs splitdir/; use File::Path qw/mkpath/; -use File::Compare qw(compare_text); use OpenSSL::fallback "$FindBin::Bin/external/perl/MODULES.txt"; use OpenSSL::Glob; use OpenSSL::Template; @@ -28,7 +27,7 @@ use OpenSSL::config; my $orig_death_handler = $SIG{__DIE__}; $SIG{__DIE__} = \&death_handler; -my $usage="Usage: Configure [no- ...] [enable- ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n"; +my $usage="Usage: Configure [no- ...] [enable- ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]thread-pool] [[no-]default-thread-pool] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n"; my $banner = <<"EOF"; @@ -78,10 +77,18 @@ EOF # Generic OpenSSL-style methods relating to this support # are always compiled but return NULL if the hardware # support isn't compiled. +# +# enable-demos Enable the building of the example code in the demos directory +# enable-h3demo Enable the http3 demo, which currently only links to the +# external nghttp3 library on unix platforms # no-hw do not compile support for any crypto hardware. # [no-]threads [don't] try to create a library that is suitable for # multithreaded applications (default is "threads" if we # know how to do it) +# [no-]thread-pool +# [don't] allow thread pool functionality +# [no-]default-thread-pool +# [don't] allow default thread pool functionality # [no-]shared [don't] try to create shared libraries when supported. # [no-]pic [don't] try to build position independent code when supported. # If disabled, it also disables shared and dynamic-engine. @@ -89,8 +96,9 @@ EOF # no-egd do not compile support for the entropy-gathering daemon APIs # [no-]zlib [don't] compile support for zlib compression. # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared -# library and will be loaded in run-time by the OpenSSL library. +# library and will be loaded at run-time by the OpenSSL library. # sctp include SCTP support +# no-quic disable QUIC support # no-uplink Don't build support for UPLINK interface. # enable-weak-ssl-ciphers # Enable weak ciphers that are disabled by default. @@ -162,7 +170,8 @@ my @gcc_devteam_warn = qw( -Wsign-compare -Wshadow -Wformat - -Wtype-limits + -Wno-type-limits + -Wno-tautological-constant-out-of-range-compare -Wundef -Werror -Wmissing-prototypes @@ -183,6 +192,7 @@ my @clang_devteam_warn = qw( -Wno-parentheses-equality -Wno-language-extension-token -Wno-extended-offsetof + -Wno-missing-braces -Wconditional-uninitialized -Wincompatible-pointer-types-discards-qualifiers -Wmissing-variable-declarations @@ -379,6 +389,12 @@ if (defined env($local_config_envname)) { } } +# Fail if no configuration is apparent +if (!%table) { + print "Failed to find any os/compiler configurations. Please make sure the Configurations directory is included.\n"; + &usage; +} + # Save away perl command information $config{perl_cmd} = $^X; $config{perl_version} = $Config{version}; @@ -402,20 +418,26 @@ my @dtls = qw(dtls1 dtls1_2); my @disablables = ( "acvp-tests", "afalgeng", + "apps", + "argon2", "aria", "asan", "asm", "async", + "atexit", "autoalginit", "autoerrinit", "autoload-config", "bf", "blake2", + "brotli", + "brotli-dynamic", "buildtest-c++", "bulk", "cached-fetch", "camellia", "capieng", + "winstore", "cast", "chacha", "cmac", @@ -424,11 +446,15 @@ my @disablables = ( "comp", "crypto-mdebug", "ct", + "default-thread-pool", + "demos", + "h3demo", "deprecated", "des", "devcryptoeng", "dgram", "dh", + "docs", "dsa", "dso", "dtls", @@ -438,6 +464,7 @@ my @disablables = ( "ec_nistp_64_gcc_128", "ecdh", "ecdsa", + "ecx", "egd", "engine", "err", @@ -448,6 +475,7 @@ my @disablables = ( "fuzz-afl", "fuzz-libfuzzer", "gost", + "http", "idea", "ktls", "legacy", @@ -464,10 +492,13 @@ my @disablables = ( "ocsp", "padlockeng", "pic", + "pie", "pinshared", "poly1305", "posix-io", "psk", + "quic", + "unstable-qlog", "rc2", "rc4", "rc5", @@ -482,6 +513,7 @@ my @disablables = ( "siphash", "siv", "sm2", + "sm2-precomp", "sm3", "sm4", "sock", @@ -494,8 +526,10 @@ my @disablables = ( "stdio", "tests", "tfo", + "thread-pool", "threads", "tls", + "integrity-only-ciphers", "trace", "ts", "ubsan", @@ -506,6 +540,8 @@ my @disablables = ( "whirlpool", "zlib", "zlib-dynamic", + "zstd", + "zstd-dynamic", ); foreach my $proto ((@tls, @dtls)) { @@ -537,15 +573,20 @@ my %deprecated_disablables = ( our %disabled = ( # "what" => "comment" "fips" => "default", "asan" => "default", + "brotli" => "default", + "brotli-dynamic" => "default", "buildtest-c++" => "default", "crypto-mdebug" => "default", "crypto-mdebug-backtrace" => "default", + "demos" => "default", + "h3demo" => "default", "devcryptoeng" => "default", "ec_nistp_64_gcc_128" => "default", "egd" => "default", "external-tests" => "default", "fuzz-afl" => "default", "fuzz-libfuzzer" => "default", + "pie" => "default", "ktls" => "default", "md2" => "default", "msan" => "default", @@ -560,13 +601,15 @@ our %disabled = ( # "what" => "comment" "weak-ssl-ciphers" => "default", "zlib" => "default", "zlib-dynamic" => "default", + "zstd" => "default", + "zstd-dynamic" => "default", ); # Note: => pair form used for aesthetics, not to truly make a hash table my @disable_cascades = ( # "what" => [ "cascade", ... ] "bulk" => [ "shared", "dso", - "aria", "async", "autoload-config", + "aria", "async", "atexit", "autoload-config", "blake2", "bf", "camellia", "cast", "chacha", "cmac", "cms", "cmp", "comp", "ct", "des", "dgram", "dh", "dsa", @@ -587,9 +630,11 @@ my @disable_cascades = ( "ssl" => [ "ssl3" ], "ssl3-method" => [ "ssl3" ], "zlib" => [ "zlib-dynamic" ], + "brotli" => [ "brotli-dynamic" ], + "zstd" => [ "zstd-dynamic" ], "des" => [ "mdc2" ], - "ec" => [ "ec2m", "ecdsa", "ecdh", "sm2", "gost" ], - "dgram" => [ "dtls", "sctp" ], + "ec" => [ "ec2m", "ecdsa", "ecdh", "sm2", "gost", "ecx" ], + "dgram" => [ "dtls", "quic", "sctp" ], "sock" => [ "dgram", "tfo" ], "dtls" => [ @dtls ], sub { 0 == scalar grep { !$disabled{$_} } @dtls } @@ -598,11 +643,12 @@ my @disable_cascades = ( "tls" => [ @tls ], sub { 0 == scalar grep { !$disabled{$_} } @tls } => [ "tls" ], + "tls1_3" => [ "quic" ], + "quic" => [ "unstable-qlog" ], "crypto-mdebug" => [ "crypto-mdebug-backtrace" ], - # If no modules, then no dynamic engines either - "module" => [ "dynamic-engine" ], + "module" => [ "dynamic-engine", "fips" ], # Without shared libraries, dynamic engines aren't possible. # This is due to them having to link with libcrypto and register features @@ -620,8 +666,6 @@ my @disable_cascades = ( # or modules. "pic" => [ "shared", "module" ], - "module" => [ "fips", "dso" ], - "engine" => [ "dynamic-engine", grep(/eng$/, @disablables) ], "dynamic-engine" => [ "loadereng" ], "hw" => [ "padlockeng" ], @@ -632,7 +676,7 @@ my @disable_cascades = ( "stdio" => [ "apps", "capieng", "egd" ], "apps" => [ "tests" ], "tests" => [ "external-tests" ], - "comp" => [ "zlib" ], + "comp" => [ "zlib", "brotli", "zstd" ], "sm3" => [ "sm2" ], sub { !$disabled{"unit-test"} } => [ "heartbeats" ], @@ -645,7 +689,14 @@ my @disable_cascades = ( "fips" => [ "fips-securitychecks", "acvp-tests" ], - "deprecated-3.0" => [ "engine", "srp" ] + "threads" => [ "thread-pool" ], + "thread-pool" => [ "default-thread-pool" ], + + "blake2" => [ "argon2" ], + + "deprecated-3.0" => [ "engine", "srp" ], + + "http" => [ "ocsp" ] ); # Avoid protocol support holes. Also disable all versions below N, if version @@ -714,6 +765,7 @@ my @user_crossable = qw ( AR AS CC CXX CPP LD MT RANLIB RC ); # input, as opposed to the VAR=string option that override the corresponding # config target attributes my %useradd = ( + ASFLAGS => [], CPPDEFINES => [], CPPINCLUDES => [], CPPFLAGS => [], @@ -890,6 +942,18 @@ while (@argvcopy) { delete $disabled{"zlib"}; } + elsif ($1 eq "brotli-dynamic") + { + delete $disabled{"brotli"}; + } + elsif ($1 eq "pie") + { + delete $disabled{"pie"}; + } + elsif ($1 eq "zstd-dynamic") + { + delete $disabled{"zstd"}; + } my $algo = $1; delete $disabled{$algo}; @@ -940,8 +1004,6 @@ while (@argvcopy) if (/^--prefix=(.*)$/) { $config{prefix}=$1; - die "Directory given with --prefix MUST be absolute\n" - unless file_name_is_absolute($config{prefix}); } elsif (/^--api=(.*)$/) { @@ -966,6 +1028,22 @@ while (@argvcopy) { $withargs{zlib_include}=$1; } + elsif (/^--with-brotli-lib=(.*)$/) + { + $withargs{brotli_lib}=$1; + } + elsif (/^--with-brotli-include=(.*)$/) + { + $withargs{brotli_include}=$1; + } + elsif (/^--with-zstd-lib=(.*)$/) + { + $withargs{zstd_lib}=$1; + } + elsif (/^--with-zstd-include=(.*)$/) + { + $withargs{zstd_include}=$1; + } elsif (/^--with-fuzzer-lib=(.*)$/) { $withargs{fuzzer_lib}=$1; @@ -1384,6 +1462,11 @@ foreach (keys %useradd) { # At this point, we can forget everything about %user and %useradd, # because it's now all been merged into the corresponding $config entry +if ($config{prefix} && !$config{CROSS_COMPILE}) { + die "Directory given with --prefix MUST be absolute\n" + unless file_name_is_absolute($config{prefix}); +} + if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) { disable('static', 'pic', 'threads'); } @@ -1398,7 +1481,7 @@ $target{build_scheme} = [ $target{build_scheme} ] my ($builder, $builder_platform, @builder_opts) = @{$target{build_scheme}}; -foreach my $checker (($builder_platform."-".$target{build_file}."-checker.pm", +foreach my $checker (($builder_platform."-".$config{build_file}."-checker.pm", $builder_platform."-checker.pm")) { my $checker_path = catfile($srcdir, "Configurations", $checker); if (-f $checker_path) { @@ -1427,7 +1510,7 @@ if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m) } if ($target =~ /linux.*-mips/ && !$disabled{asm} - && !grep { $_ !~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) { + && !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) { # minimally required architecture flags for assembly modules my $value; $value = '-mips2' if ($target =~ /mips32/); @@ -1487,6 +1570,10 @@ unless($disabled{threads}) { push @{$config{openssl_feature_defines}}, "OPENSSL_THREADS"; } +if ($disabled{"unstable-qlog"}) { + $disabled{"qlog"} = 1; +} + my $no_shared_warn=0; if (($target{shared_target} // '') eq "") { @@ -1506,9 +1593,7 @@ unless ($disabled{asan} || defined $detected_sanitizers{asan}) { } unless ($disabled{ubsan} || defined $detected_sanitizers{ubsan}) { - # -DPEDANTIC or -fnosanitize=alignment may also be required on some - # platforms. - push @{$config{cflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all"; + push @{$config{cflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all", "-DPEDANTIC"; } unless ($disabled{msan} || defined $detected_sanitizers{msan}) { @@ -1707,20 +1792,13 @@ unless ($disabled{devcryptoeng}) { unless ($disabled{ktls}) { $config{ktls}=""; + my $cc = $config{CROSS_COMPILE}.$config{CC}; if ($target =~ m/^linux/) { - my $usr = "/usr/$config{cross_compile_prefix}"; - chop($usr); - if ($config{cross_compile_prefix} eq "") { - $usr = "/usr"; - } - my $minver = (4 << 16) + (13 << 8) + 0; - my @verstr = split(" ",`cat $usr/include/linux/version.h | grep LINUX_VERSION_CODE`); - - if ($verstr[2] < $minver) { + system("printf '#include \n#include ' | $cc -E - >/dev/null 2>&1"); + if ($? != 0) { disable('too-old-kernel', 'ktls'); } } elsif ($target =~ m/^BSD/) { - my $cc = $config{CROSS_COMPILE}.$config{CC}; system("printf '#include \n#include ' | $cc -E - >/dev/null 2>&1"); if ($? != 0) { disable('too-old-freebsd', 'ktls'); @@ -1730,6 +1808,12 @@ unless ($disabled{ktls}) { } } +unless ($disabled{winstore}) { + unless ($target =~ /^(?:Cygwin|mingw|VC-|BC-)/) { + disable('not-windows', 'winstore'); + } +} + push @{$config{openssl_other_defines}}, "OPENSSL_NO_KTLS" if ($disabled{ktls}); # Get the extra flags used when building shared libraries and modules. We @@ -1801,7 +1885,7 @@ foreach my $what (sort keys %disabled) { if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared', 'module', 'pic', 'dynamic-engine', 'makedepend', - 'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) { + 'sse2', 'legacy' )) { (my $WHAT = uc $what) =~ s|-|_|g; my $skipdir = $what; @@ -1835,11 +1919,12 @@ if ($builder eq "unified") { my $base = shift; my $dir = shift; my $relativeto = shift || "."; + my $no_mkpath = shift // 0; $dir = catdir($base,$dir) unless isabsolute($dir); # Make sure the directories we're building in exists - mkpath($dir); + mkpath($dir) unless $no_mkpath; my $res = abs2rel(absolutedir($dir), rel2abs($relativeto)); #print STDERR "DEBUG[cleandir]: $dir , $base => $res\n"; @@ -1850,6 +1935,7 @@ if ($builder eq "unified") { my $base = shift; my $file = shift; my $relativeto = shift || "."; + my $no_mkpath = shift // 0; $file = catfile($base,$file) unless isabsolute($file); @@ -1857,7 +1943,7 @@ if ($builder eq "unified") { my $f = basename($file); # Make sure the directories we're building in exists - mkpath($d); + mkpath($d) unless $no_mkpath; my $res = abs2rel(catfile(absolutedir($d), $f), rel2abs($relativeto)); #print STDERR "DEBUG[cleanfile]: $d , $f => $res\n"; @@ -1867,8 +1953,8 @@ 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. my @build_file_template_names = - ( $builder_platform."-".$target{build_file}.".tmpl", - $target{build_file}.".tmpl" ); + ( $builder_platform."-".$config{build_file}.".tmpl", + $config{build_file}.".tmpl" ); my @build_file_templates = (); # First, look in the user provided directory, if given @@ -1887,7 +1973,7 @@ if ($builder eq "unified") { } # Then, look in our standard directory push @build_file_templates, - ( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir) } + ( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir, 1) } @build_file_template_names ); my $build_file_template; @@ -1902,7 +1988,7 @@ if ($builder eq "unified") { } $config{build_file_templates} = [ cleanfile($srcdir, catfile("Configurations", "common0.tmpl"), - $blddir), + $blddir, 1), $build_file_template ]; my @build_dirs = ( [ ] ); # current directory @@ -1911,7 +1997,7 @@ if ($builder eq "unified") { # We want to detect configdata.pm in the source tree, so we # don't use it if the build tree is different. - my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir); + my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir, 1); # Any source file that we recognise is placed in this hash table, with # the list of its intended destinations as value. When everything has @@ -2202,9 +2288,10 @@ if ($builder eq "unified") { \$attributes{depends}, $+{ATTRIBS}, tokenize($expand_variables->($+{VALUE}))) if !@skip || $skip[$#skip] > 0; }, - qr/^\s* GENERATE ${index_re} \s* = \s* ${value_re} \s* $/x + qr/^\s* GENERATE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x => sub { $push_to->(\%generate, $expand_variables->($+{INDEX}), - undef, undef, $expand_variables->($+{VALUE})) + \$attributes{generate}, $+{ATTRIBS}, + $expand_variables->($+{VALUE})) if !@skip || $skip[$#skip] > 0; }, qr/^\s* (?:\#.*)? $/x => sub { }, "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" }, @@ -2263,7 +2350,7 @@ EOF my $dest = $_; my $ddest = cleanfile($buildd, $_, $blddir); foreach (@{$sources{$dest}}) { - my $s = cleanfile($sourced, $_, $blddir); + my $s = cleanfile($sourced, $_, $blddir, 1); # If it's generated or we simply don't find it in the source # tree, we assume it's in the build tree. @@ -2308,7 +2395,7 @@ EOF my $dest = $_; my $ddest = cleanfile($buildd, $_, $blddir); foreach (@{$shared_sources{$dest}}) { - my $s = cleanfile($sourced, $_, $blddir); + my $s = cleanfile($sourced, $_, $blddir, 1); # If it's generated or we simply don't find it in the source # tree, we assume it's in the build tree. @@ -2363,7 +2450,7 @@ EOF if scalar @{$generate{$_}} > 1; my @generator = split /\s+/, $generate{$dest}->[0]; my $gen = $generator[0]; - $generator[0] = cleanfile($sourced, $gen, $blddir); + $generator[0] = cleanfile($sourced, $gen, $blddir, 1); # If the generator is itself generated, it's in the build tree if ($generate{$gen} || ! -f $generator[0]) { @@ -2372,6 +2459,10 @@ EOF $check_generate{$ddest}->{$generator[0]}++; $unified_info{generate}->{$ddest} = [ @generator ]; + # Fix up associated attributes + $unified_info{attributes}->{generate}->{$ddest} = + $attributes{generate}->{$dest}->{$gen} + if defined $attributes{generate}->{$dest}->{$gen}; } foreach (keys %depends) { @@ -2385,17 +2476,40 @@ EOF } elsif ($dest eq '') { $ddest = ''; } else { - $ddest = cleanfile($sourced, $_, $blddir); + $ddest = cleanfile($sourced, $dest, $blddir, 1); # If the destination doesn't exist in source, it can only be # a generated file in the build tree. if ($ddest eq $src_configdata || ! -f $ddest) { - $ddest = cleanfile($buildd, $_, $blddir); + $ddest = cleanfile($buildd, $dest, $blddir); } } - foreach (@{$depends{$dest}}) { - my $d = cleanfile($sourced, $_, $blddir); - my $d2 = cleanfile($buildd, $_, $blddir); + foreach my $f (@{$depends{$dest}}) { + # If the dependency destination is generated, dependencies + # may have an extra syntax to separate the intended inclusion + # directory from the module to be loaded: a | instead of a + # / as directory separator. + # Do note that this has to be handled in the build file + # template as well. + # $i = inclusion path in source directory + # $i2 = inclusion path in build directory + # $m = module path (within the inclusion path) + # $i = full module path in source directory + # $i2 = full module path in build directory + my $i; my $i2; my $m; my $d; my $d2; + if ($unified_info{generate}->{$ddest} + && $f =~ m/^(.*?)\|(.*)$/) { + $i = $1; + $m = $2; + # We must be very careful to modify $i last + $d = cleanfile($sourced, "$i/$m", $blddir, 1); + $d2 = cleanfile($buildd, "$i/$m", $blddir); + $i2 = cleandir($buildd, $i, $blddir); + $i = cleandir($sourced, $i, $blddir, 1); + } else { + $d = cleanfile($sourced, $f, $blddir, 1); + $d2 = cleanfile($buildd, $f, $blddir); + } # If we know it's generated, or assume it is because we can't # find it in the source tree, we set file we depend on to be @@ -2405,19 +2519,26 @@ EOF keys %{$unified_info{generate}}) || ! -f $d) { $d = $d2; + $i = $i2; + } + if ($i) { + # Put together the computed inclusion dir with the + # original module name. Do note that we conserve the + # Unixly path syntax for the module path. + $d = "$i|$m"; } $unified_info{depends}->{$ddest}->{$d} = 1; # Fix up associated attributes $unified_info{attributes}->{depends}->{$ddest}->{$d} = - $attributes{depends}->{$dest}->{$_} - if defined $attributes{depends}->{$dest}->{$_}; + $attributes{depends}->{$dest}->{$f} + if defined $attributes{depends}->{$dest}->{$f}; } } foreach (keys %includes) { my $dest = $_; - my $ddest = cleanfile($sourced, $_, $blddir); + my $ddest = cleanfile($sourced, $_, $blddir, 1); # If the destination doesn't exist in source, it can only be # a generated file in the build tree. @@ -2425,7 +2546,7 @@ EOF $ddest = cleanfile($buildd, $_, $blddir); } foreach (@{$includes{$dest}}) { - my $is = cleandir($sourced, $_, $blddir); + my $is = cleandir($sourced, $_, $blddir, 1); my $ib = cleandir($buildd, $_, $blddir); push @{$unified_info{includes}->{$ddest}->{source}}, $is unless grep { $_ eq $is } @{$unified_info{includes}->{$ddest}->{source}}; @@ -2438,7 +2559,7 @@ EOF my $ddest; if ($dest ne "") { - $ddest = cleanfile($sourced, $dest, $blddir); + $ddest = cleanfile($sourced, $dest, $blddir, 1); # If the destination doesn't exist in source, it can only # be a generated file in the build tree. @@ -2581,7 +2702,9 @@ EOF next if $dest eq ""; foreach my $d (keys %{$unified_info{depends}->{$dest}}) { next unless $d =~ /\.(h|pm)$/; - my $i = dirname($d); + # Take into account when a dependency uses the inclusion|module + # syntax + my $i = $d =~ m/\|/ ? $` : dirname($d); my $spot = $d eq "configdata.pm" || defined($unified_info{generate}->{$d}) ? 'build' : 'source'; @@ -2820,7 +2943,7 @@ my %template_vars = ( my $configdata_outname = 'configdata.pm'; open CONFIGDATA, ">$configdata_outname.new" or die "Trying to create $configdata_outname.new: $!"; -my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir); +my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir, 1); my $configdata_tmpl = OpenSSL::Template->new(TYPE => 'FILE', SOURCE => $configdata_tmplname); $configdata_tmpl->fill_in( @@ -2834,56 +2957,20 @@ $configdata_tmpl->fill_in( ) or die $Text::Template::ERROR; close CONFIGDATA; -# When using stat() on Windows, we can get it to perform better by avoid some -# data. This doesn't affect the mtime field, so we're not losing anything... -${^WIN32_SLOPPY_STAT} = 1; - -my $update_configdata = 0; -my $run_configdata = 0; -if (-f $configdata_outname) { - my $Configure_mtime = (stat($0))[9]; - my $configdata_mtime = (stat($configdata_outname))[9]; - - # If this script was updated after the last configdata.pm, or if - # configdata.pm.new differs from configdata.pm, we update configdata.pm - if ($configdata_mtime < $Configure_mtime - || compare_text("$configdata_outname.new", $configdata_outname) != 0) { - $update_configdata = 1; - } else { - # If nothing has changed, let's just drop the new one and pretend - # like nothing happened - unlink "$configdata_outname.new"; - - # We still run configdata.pm if the build file (Makefile) is missing - $run_configdata = !( -f $target{build_file} ); - } -} else { - $update_configdata = 1; +rename "$configdata_outname.new", $configdata_outname; +if ($builder_platform eq 'unix') { + my $mode = (0755 & ~umask); + chmod $mode, 'configdata.pm' + or warn sprintf("WARNING: Couldn't change mode for 'configdata.pm' to 0%03o: %s\n",$mode,$!); } +print "Created $configdata_outname\n"; -if ($update_configdata) { - # If something did change, or there was no previous configdata.pm, we - # rename the new one, set permissions as needed, and run it. - rename "$configdata_outname.new", $configdata_outname; - if ($builder_platform eq 'unix') { - my $mode = (0755 & ~umask); - chmod $mode, 'configdata.pm' - or warn sprintf("WARNING: Couldn't change mode for 'configdata.pm' to 0%03o: %s\n",$mode,$!); - } - $run_configdata = 1; - print "Created $configdata_outname\n"; -} - -if ($run_configdata) { - print "Running $configdata_outname\n"; - my $perlcmd = (quotify("maybeshell", $config{PERL}))[0]; - my $cmd = "$perlcmd $configdata_outname"; - #print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n"; - system($cmd); - exit 1 if $? != 0; -} else { - print "No changes in $configdata_outname, no need to run it\n"; -} +print "Running $configdata_outname\n"; +my $perlcmd = (quotify("maybeshell", $config{PERL}))[0]; +my $cmd = "$perlcmd $configdata_outname"; +#print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n"; +system($cmd); +exit 1 if $? != 0; $SIG{__DIE__} = $orig_death_handler; @@ -2916,7 +3003,7 @@ exit(0); # sub death_handler { die @_ if $^S; # To prevent the added message in eval blocks - my $build_file = $target{build_file} // "build file"; + my $build_file = $config{build_file} // "build file"; my @message = ( <<"_____", @_ ); Failure! $build_file wasn't produced.