mirror of https://github.com/openssl/openssl
Configure: base compiler-specific decisions on pre-defines.
The commit subject is a bit misleading in sense that decisions affect only gcc and gcc-alikes, like clang, recent icc... Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/4281)
This commit is contained in:
parent
e295d046dc
commit
54cf3b981a
48
Configure
48
Configure
|
@ -117,12 +117,12 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||||
# but 'long long' type.
|
# but 'long long' type.
|
||||||
|
|
||||||
my $gcc_devteam_warn = "-DDEBUG_UNUSED"
|
my $gcc_devteam_warn = "-DDEBUG_UNUSED"
|
||||||
. " -Wswitch"
|
|
||||||
. " -DPEDANTIC -pedantic -Wno-long-long"
|
. " -DPEDANTIC -pedantic -Wno-long-long"
|
||||||
. " -Wall"
|
. " -Wall"
|
||||||
. " -Wextra"
|
. " -Wextra"
|
||||||
. " -Wno-unused-parameter"
|
. " -Wno-unused-parameter"
|
||||||
. " -Wno-missing-field-initializers"
|
. " -Wno-missing-field-initializers"
|
||||||
|
. " -Wswitch"
|
||||||
. " -Wsign-compare"
|
. " -Wsign-compare"
|
||||||
. " -Wmissing-prototypes"
|
. " -Wmissing-prototypes"
|
||||||
. " -Wshadow"
|
. " -Wshadow"
|
||||||
|
@ -1257,29 +1257,29 @@ unless ($disabled{asm}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $ecc = $target{cc};
|
my %predefined;
|
||||||
if ($^O ne "VMS" && !$disabled{makedepend}) {
|
|
||||||
# Is the compiler gcc or clang? $ecc is used below to see if
|
if ($^O ne "VMS") {
|
||||||
# error-checking can be turned on.
|
my $cc = "$config{cross_compile_prefix}$target{cc}";
|
||||||
my $ccpcc = "$config{cross_compile_prefix}$target{cc}";
|
|
||||||
open(PIPE, "$ccpcc --version 2>&1 |");
|
# collect compiler pre-defines from gcc or gcc-alike...
|
||||||
my $lines = 2;
|
open(PIPE, "$cc -dM -E -x c /dev/null 2>&1 |");
|
||||||
while ( <PIPE> ) {
|
while (<PIPE>) {
|
||||||
# Find the version number and save the major.
|
m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last;
|
||||||
m|(?:.*)\b(\d+)\.\d+\.\d+\b(?:.*)|;
|
$predefined{$1} = $2 // "";
|
||||||
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--);
|
|
||||||
}
|
}
|
||||||
close(PIPE);
|
close(PIPE);
|
||||||
|
|
||||||
$config{makedepprog} = which('makedepend') unless $config{makedepprog};
|
if (!$disabled{makedepend}) {
|
||||||
$disabled{makedepend} = "unavailable" unless $config{makedepprog};
|
# 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};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1324,13 +1324,13 @@ if (defined($config{api})) {
|
||||||
if ($strict_warnings)
|
if ($strict_warnings)
|
||||||
{
|
{
|
||||||
my $wopt;
|
my $wopt;
|
||||||
die "ERROR --strict-warnings requires gcc or clang"
|
die "ERROR --strict-warnings requires gcc or gcc-alike"
|
||||||
unless $ecc eq 'gcc' || $ecc eq 'clang';
|
unless defined($predefined{__GNUC__});
|
||||||
foreach $wopt (split /\s+/, $gcc_devteam_warn)
|
foreach $wopt (split /\s+/, $gcc_devteam_warn)
|
||||||
{
|
{
|
||||||
$config{cflags} .= " $wopt" unless ($config{cflags} =~ /(?:^|\s)$wopt(?:\s|$)/)
|
$config{cflags} .= " $wopt" unless ($config{cflags} =~ /(?:^|\s)$wopt(?:\s|$)/)
|
||||||
}
|
}
|
||||||
if ($ecc eq "clang")
|
if (defined($predefined{__clang__}))
|
||||||
{
|
{
|
||||||
foreach $wopt (split /\s+/, $clang_devteam_warn)
|
foreach $wopt (split /\s+/, $clang_devteam_warn)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue