From: Richard Levitte Date: Thu, 8 Mar 2018 11:01:28 +0000 (+0100) Subject: Configure: catch the build tree configdata.pm X-Git-Tag: OpenSSL_1_1_0h~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d8bb766bdcd77ac43bb43424af698ae1050abb30;p=oweals%2Fopenssl.git Configure: catch the build tree configdata.pm There are things depending on configdata.pm. However, it's perfectly possible that there is one in the source directory from a previous build, and that might disrupt an out of source build. To avoid this conflict, make sure never to use the source tree configdata.pm in that case, i.e. make the hard assumption that it's a generated file in the build tree, which it is. Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/5546) (cherry picked from commit 846e4c4d650da50f049ee74901e840ffe409fa69) --- diff --git a/Configure b/Configure index 0585db9257..c317b70e09 100755 --- a/Configure +++ b/Configure @@ -1452,6 +1452,10 @@ if ($builder eq "unified") { my %sharednames = (); my %generate = (); + # 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); + push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f); my $template = Text::Template->new(TYPE => 'FILE', @@ -1757,7 +1761,7 @@ EOF # If it isn't in the source tree, we assume it's generated # in the build tree - if (! -f $s || $generate{$_}) { + if ($s eq $src_configdata || ! -f $s || $generate{$_}) { $s = cleanfile($buildd, $_, $blddir); } # We recognise C and asm files @@ -1783,7 +1787,7 @@ EOF # If it isn't in the source tree, we assume it's generated # in the build tree - if (! -f $s || $generate{$_}) { + if ($s eq $src_configdata || ! -f $s || $generate{$_}) { $s = cleanfile($buildd, $_, $blddir); } # We recognise C and asm files @@ -1818,7 +1822,7 @@ EOF # If the destination doesn't exist in source, it can only be # a generated file in the build tree. - if ($ddest ne "" && ! -f $ddest) { + if ($ddest ne "" && ($ddest eq $src_configdata || ! -f $ddest)) { $ddest = cleanfile($buildd, $_, $blddir); if ($unified_info{rename}->{$ddest}) { $ddest = $unified_info{rename}->{$ddest}; @@ -1832,7 +1836,8 @@ EOF # in the build tree rather than the source tree, and assume # and that there are lines to build it in a BEGINRAW..ENDRAW # section or in the Makefile template. - if (! -f $d + if ($d eq $src_configdata + || ! -f $d || (grep { $d eq $_ } map { cleanfile($srcdir, $_, $blddir) } grep { /\.h$/ } keys %{$unified_info{generate}})) { @@ -1852,7 +1857,7 @@ EOF # If the destination doesn't exist in source, it can only be # a generated file in the build tree. - if (! -f $ddest) { + if ($ddest eq $src_configdata || ! -f $ddest) { $ddest = cleanfile($buildd, $_, $blddir); if ($unified_info{rename}->{$ddest}) { $ddest = $unified_info{rename}->{$ddest}; @@ -2141,14 +2146,6 @@ or position independent code, please let us know (but please first make sure you have tried with a current version of OpenSSL). EOF -print <<"EOF" if (-f catfile($srcdir, "configdata.pm") && $srcdir ne $blddir); - -WARNING: there are indications that another build was made in the source -directory. This build may have picked up artifacts from that build, the -safest course of action is to clean the source directory and redo this -configuration. -EOF - exit(0); ######################################################################