From 2e535eb50aa9c6b73c796f668e1aef8bc17f14c4 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 26 Apr 2021 09:17:05 +0200 Subject: Configuration: rework how dependency making is handled Previously, we had dependency making pretty much hard coded in the build file templates, with a bit of an exception for Unix family platforms, where we had different cases depending on what dependency making program was found. With the Embarcadero C++ builder, a separate scheme appeared, with a different logic. This change merges the two, and introduces two config target attributes: makedepcmd The program to use, where this is relevant. This replaces the earlier configuration attribute 'makedepprog'. makedep_scheme This is a keyword that can be used by build files templates to produce different sorts of commands, but most importantly, to pass as argument to util/add-depend.pl, which uses this keyword as a "producer" for the dependency lines. If the config target doesn't define the 'makedep_scheme' attribute, Configure tries to figure it out by looking for GCC compatible compilers or for the 'makedepend' command. Reviewed-by: Tomas Mraz Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/15006) --- Configure | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'Configure') diff --git a/Configure b/Configure index 6d0ffbf480..b068b60e66 100755 --- a/Configure +++ b/Configure @@ -1533,22 +1533,32 @@ unless ($disabled{asm}) { # Check for makedepend capabilities. if (!$disabled{makedepend}) { - if ($config{target} =~ /^(VC|BC|vms)-/) { - # For VC-, BC- and vms- targets, there's nothing more to do here. The - # functionality is hard coded in the corresponding build files for - # cl/cpp32 (Windows) and CC/DECC (VMS). + # If the attribute makedep_scheme is defined, then we assume that the + # config target and its associated build file are programmed to deal + # with it. + # If makedep_scheme is undefined, we go looking for GCC compatible + # dependency making, and if that's not available, we try to fall back + # on 'makedepend'. + if ($target{makedep_scheme}) { + $config{makedep_scheme} = $target{makedep_scheme}; + # If the makedepcmd attribute is defined, copy it. If not, the + # build files will have to fend for themselves. + $config{makedepcmd} = $target{makedepcmd} if $target{makedepcmd}; } elsif (($predefined_C{__GNUC__} // -1) >= 3 && !($predefined_C{__APPLE_CC__} && !$predefined_C{__clang__})) { # We know that GNU C version 3 and up as well as all clang # versions support dependency generation, but Xcode did not # handle $cc -M before clang support (but claims __GNUC__ = 3) - $config{makedepprog} = "\$(CROSS_COMPILE)$config{CC}"; + $config{makedep_scheme} = 'gcc'; } else { - # In all other cases, we look for 'makedepend', and disable the - # capability if not found. - $config{makedepprog} = which('makedepend'); - disable('unavailable', 'makedepend') unless $config{makedepprog}; + # In all other cases, we look for 'makedepend', and set the + # makedep_scheme value if we found it. + $config{makedepcmd} = which('makedepend'); + $config{makedep_scheme} = 'makedepend' if $config{makedepcmd}; } + + # If no depend scheme is set, we disable makedepend + disable('unavailable', 'makedepend') unless $config{makedep_scheme}; } if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS') { -- cgit v1.2.1