X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configure;h=b1b847c59d6a0bea5e09832e9590398eb447dd2c;hp=57cdeb3dc40a8ff61818415ec7ce702bbd33b0c7;hb=9e84a42db497e06a38f804b5acd09b6aa4f87db3;hpb=302eba3f6dd588f1269aba4605a007ae86b583db diff --git a/Configure b/Configure index 57cdeb3dc4..b1b847c59d 100755 --- a/Configure +++ b/Configure @@ -117,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" @@ -141,7 +141,6 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED" # -Wunused-macros -- no, too tricky for BN and _XOPEN_SOURCE etc # -Wextended-offsetof -- no, needed in CMS ASN1 code my $clang_devteam_warn = "" - . " -Qunused-arguments" . " -Wswitch-default" . " -Wno-parentheses-equality" . " -Wno-language-extension-token" @@ -149,6 +148,7 @@ my $clang_devteam_warn = "" . " -Wconditional-uninitialized" . " -Wincompatible-pointer-types-discards-qualifiers" . " -Wmissing-variable-declarations" + . " -Wno-unknown-warning-option" ; # This adds backtrace information to the memory leak info. Is only used @@ -514,7 +514,7 @@ my @disable_cascades = ( # no-autoalginit is only useful when building non-shared "autoalginit" => [ "shared", "apps" ], - "stdio" => [ "apps", "capieng" ], + "stdio" => [ "apps", "capieng", "egd" ], "apps" => [ "tests" ], "tests" => [ "external-tests" ], "comp" => [ "zlib" ], @@ -1257,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}; + } + } } @@ -1321,16 +1321,23 @@ if (defined($config{api})) { push @{$config{defines}}, $apiflag; } +if (defined($predefined{__clang__}) && !$disabled{asm}) { + $config{cflags} .= " -Qunused-arguments"; +} + if ($strict_warnings) { my $wopt; - die "ERROR --strict-warnings requires gcc, clang or icc" - unless $ecc eq 'gcc' || $ecc eq 'clang' || $ecc eq 'icc'; + my $gccver = $predefined{__GNUC__} // -1; + + die "ERROR --strict-warnings requires gcc[>=4] or gcc-alike" + unless $gccver >= 4; + $gcc_devteam_warn .= " -Wmisleading-indentation" if $gccver >= 6; 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) {