X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configure;h=03053bc0c31603d158c5f0e86e7e2566cfe7b2f5;hp=6860cfab81493cb6b16578181384812dcd382258;hb=0b76ce99aaa5678b44cb99df464e977975747928;hpb=f5fb6f0543cafd3db6671cfb987bf475a35f30f6;ds=sidebyside diff --git a/Configure b/Configure index 6860cfab81..03053bc0c3 100755 --- a/Configure +++ b/Configure @@ -145,6 +145,8 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED" # -Wlanguage-extension-token -- no, we use asm() # -Wunused-macros -- no, too tricky for BN and _XOPEN_SOURCE etc # -Wextended-offsetof -- no, needed in CMS ASN1 code +# -Wunused-function -- no, it forces header use of safestack et al +# DEFINE macros my $clang_devteam_warn = "" . " -Wswitch-default" . " -Wno-parentheses-equality" @@ -154,6 +156,7 @@ my $clang_devteam_warn = "" . " -Wincompatible-pointer-types-discards-qualifiers" . " -Wmissing-variable-declarations" . " -Wno-unknown-warning-option" + . " -Wno-unused-function" ; # This adds backtrace information to the memory leak info. Is only used @@ -749,7 +752,11 @@ while (@argvcopy) } elsif (/^--strict-warnings$/) { - $strict_warnings = 1; + # Pretend that our strict flags is a C flag, and replace it + # with the proper flags later on + push @{$useradd{CFLAGS}}, '--ossl-strict-warnings'; + push @{$useradd{CXXFLAGS}}, '--ossl-strict-warnings'; + $strict_warnings=1; } elsif (/^--debug$/) { @@ -1500,6 +1507,7 @@ $config{openssl_api_defines} = [ "OPENSSL_MIN_API=".($apitable->{$config{api} // ""} // -1) ]; +my @strict_warnings_collection=(); if ($strict_warnings) { my $wopt; @@ -1507,26 +1515,17 @@ if ($strict_warnings) die "ERROR --strict-warnings requires gcc[>=4] or gcc-alike" unless $gccver >= 4; - foreach $wopt (split /\s+/, $gcc_devteam_warn) - { - push @{$config{cflags}}, $wopt - unless grep { $_ eq $wopt } @{$config{cflags}}; - push @{$config{cxxflags}}, $wopt - if ($config{CXX} - && !grep { $_ eq $wopt } @{$config{cxxflags}}); - } - if (defined($predefined{__clang__})) - { - foreach $wopt (split /\s+/, $clang_devteam_warn) - { - push @{$config{cflags}}, $wopt - unless grep { $_ eq $wopt } @{$config{cflags}}; - push @{$config{cxxflags}}, $wopt - if ($config{CXX} - && !grep { $_ eq $wopt } @{$config{cxxflags}}); - } - } + push @strict_warnings_collection, (split /\s+/, $gcc_devteam_warn); + push @strict_warnings_collection, (split /\s+/, $clang_devteam_warn) + if (defined($predefined{__clang__})); } +foreach (qw(CFLAGS CXXFLAGS)) + { + $useradd{$_} = [ map { $_ eq '--ossl-strict-warnings' + ? @strict_warnings_collection + : ( $_ ) } + @{$useradd{$_}} ]; + } unless ($disabled{"crypto-mdebug-backtrace"}) { @@ -1710,18 +1709,11 @@ if ($builder eq "unified") { my $f = 'build.info'; # The basic things we're trying to build my @programs = (); - my @programs_install = (); my @libraries = (); - my @libraries_install = (); - my @engines = (); - my @engines_install = (); + my @modules = (); my @scripts = (); - my @scripts_install = (); - my @extra = (); - my @overrides = (); - my @intermediates = (); - my @rawlines = (); + my %attributes = (); my %sources = (); my %shared_sources = (); my %includes = (); @@ -1792,48 +1784,82 @@ if ($builder eq "unified") { } } }, - qr/^\s*PROGRAMS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*PROGRAMS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @programs, @x; - push @programs_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @p = tokenize($2); + push @programs, @p; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $p (@p) { + $attributes{$p}->{$ak} = $av; + } + } } }, - qr/^\s*LIBS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*LIBS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @libraries, @x; - push @libraries_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @l = tokenize($2); + push @libraries, @l; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $l (@l) { + $attributes{$l}->{$ak} = $av; + } + } } }, - qr/^\s*ENGINES(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*MODULES(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @engines, @x; - push @engines_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @m = tokenize($2); + push @modules, @m; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $m (@m) { + $attributes{$m}->{$ak} = $av; + } + } } }, - qr/^\s*SCRIPTS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*SCRIPTS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @scripts, @x; - push @scripts_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @s = tokenize($2); + push @scripts, @s; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $s (@s) { + $attributes{$s}->{$ak} = $av; + } + } } }, - qr/^\s*EXTRA\s*=\s*(.*)\s*$/ - => sub { push @extra, tokenize($1) - if !@skip || $skip[$#skip] > 0 }, - qr/^\s*OVERRIDES\s*=\s*(.*)\s*$/ - => sub { push @overrides, tokenize($1) - if !@skip || $skip[$#skip] > 0 }, qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/, => sub { push @{$ordinals{$1}}, tokenize($2) @@ -1856,27 +1882,6 @@ if ($builder eq "unified") { qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/ => sub { push @{$generate{$1}}, $2 if !@skip || $skip[$#skip] > 0 }, - qr/^\s*RENAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/ - => sub { warn "RENAME is no longer supported\n" }, - qr/^\s*SHARED_NAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/ - => sub { warn "SHARED_NAME is no longer supported\n" }, - qr/^\s*BEGINRAW\[((?:\\.|[^\\\]])+)\]\s*$/ - => sub { - my $lineiterator = shift; - my $target_kind = $1; - while (defined $lineiterator->()) { - s|\R$||; - if (/^\s*ENDRAW\[((?:\\.|[^\\\]])+)\]\s*$/) { - die "ENDRAW doesn't match BEGINRAW" - if $1 ne $target_kind; - last; - } - next if @skip && $skip[$#skip] <= 0; - push @rawlines, $_ - if ($target_kind eq $target{build_file} - || $target_kind eq $target{build_file}."(".$builder_platform.")"); - } - }, qr/^\s*(?:#.*)?$/ => sub { }, "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" }, "BEFORE" => sub { @@ -1893,62 +1898,36 @@ if ($builder eq "unified") { ); die "runaway IF?" if (@skip); - foreach (@programs) { - my $program = cleanfile($buildd, $_, $blddir); - $unified_info{programs}->{$program} = 1; - } - - foreach (@programs_install) { - my $program = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{programs}->{$program} = 1; - } - - foreach (@libraries) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{libraries}->{$library} = 1; - } - - foreach (@libraries_install) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{libraries}->{$library} = 1; - } - - die <<"EOF" if scalar @engines and !$config{dynamic_engines}; + if (grep { defined $attributes{$_}->{engine} } keys %attributes + and !$config{dynamic_engines}) { + die <<"EOF" ENGINES can only be used if configured with 'dynamic-engine'. This is usually a fault in a build.info file. EOF - foreach (@engines) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{engines}->{$library} = 1; } - foreach (@engines_install) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{engines}->{$library} = 1; - } - - foreach (@scripts) { - my $script = cleanfile($buildd, $_, $blddir); - $unified_info{scripts}->{$script} = 1; - } - - foreach (@scripts_install) { - my $script = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{scripts}->{$script} = 1; - } - - foreach (@extra) { - my $extra = cleanfile($buildd, $_, $blddir); - $unified_info{extra}->{$extra} = 1; + foreach (keys %attributes) { + my $dest = $_; + my $ddest = cleanfile($buildd, $_, $blddir); + foreach (keys %{$attributes{$dest} // {}}) { + $unified_info{attributes}->{$ddest}->{$_} = + $attributes{$dest}->{$_}; + } } - foreach (@overrides) { - my $override = cleanfile($buildd, $_, $blddir); - $unified_info{overrides}->{$override} = 1; + { + my %infos = ( programs => [ @programs ], + libraries => [ @libraries ], + modules => [ @modules ], + scripts => [ @scripts ] ); + foreach my $k (keys %infos) { + foreach (@{$infos{$k}}) { + my $item = cleanfile($buildd, $_, $blddir); + $unified_info{$k}->{$item} = 1; + } + } } - push @{$unified_info{rawlines}}, @rawlines; - # Check that we haven't defined any library as both shared and # explicitly static. That is forbidden. my @doubles = (); @@ -2165,7 +2144,7 @@ EOF if defined($unified_info{$_}); delete $unified_info{$_}; } - foreach my $prodtype (('programs', 'libraries', 'engines', 'scripts')) { + foreach my $prodtype (('programs', 'libraries', 'modules', 'scripts')) { # $intent serves multi purposes: # - give a prefix for the new object files names # - in the case of libraries, rearrange the object files so static @@ -2181,7 +2160,7 @@ EOF src => [ 'sources', 'shared_sources' ], dst => 'shared_sources' } }, - engines => { dso => { src => [ 'sources', + modules => { dso => { src => [ 'sources', 'shared_sources' ], dst => 'shared_sources' } }, scripts => { script => { src => [ 'sources' ], @@ -2243,11 +2222,11 @@ EOF ### Make unified_info a bit more efficient # One level structures - foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) { + foreach (("programs", "libraries", "modules", "scripts")) { $unified_info{$_} = [ sort keys %{$unified_info{$_}} ]; } # Two level structures - foreach my $l1 (("install", "sources", "shared_sources", "ldadd", "depends")) { + foreach my $l1 (("sources", "shared_sources", "ldadd", "depends")) { foreach my $l2 (sort keys %{$unified_info{$l1}}) { my @items = sort @@ -2291,7 +2270,7 @@ EOF # they end up in where applicable. Then, add build rules for those # directories my %loopinfo = ( "lib" => [ @{$unified_info{libraries}} ], - "dso" => [ @{$unified_info{engines}} ], + "dso" => [ @{$unified_info{modules}} ], "bin" => [ @{$unified_info{programs}} ], "script" => [ @{$unified_info{scripts}} ] ); foreach my $type (keys %loopinfo) { @@ -3508,39 +3487,50 @@ sub collect_information { } # tokenize($line) +# tokenize($line,$separator) # $line is a line of text to split up into tokens -# returns a list of tokens +# $separator [optional] is a regular expression that separates the tokens, +# the default being spaces. Do not use quotes of any kind as separators, +# that will give undefined results. +# Returns a list of tokens. # -# Tokens are divided by spaces. If the tokens include spaces, they -# have to be quoted with single or double quotes. Double quotes -# inside a double quoted token must be escaped. Escaping is done +# Tokens are divided by separator (spaces by default). If the tokens include +# the separators, they have to be quoted with single or double quotes. +# Double quotes inside a double quoted token must be escaped. Escaping is done # with backslash. # Basically, the same quoting rules apply for " and ' as in any # Unix shell. sub tokenize { my $line = my $debug_line = shift; + my $separator = shift // qr|\s+|; my @result = (); - while ($line =~ s|^\s+||, $line ne "") { + if ($ENV{CONFIGURE_DEBUG_TOKENIZE}) { + print STDERR "DEBUG[tokenize]: \$separator = $separator\n"; + } + + while ($line =~ s|^${separator}||, $line ne "") { my $token = ""; - while ($line ne "" && $line !~ m|^\s|) { - if ($line =~ m/^"((?:[^"\\]+|\\.)*)"/) { - $token .= $1; - $line = $'; - } elsif ($line =~ m/^'([^']*)'/) { - $token .= $1; - $line = $'; - } elsif ($line =~ m/^(\S+)/) { - $token .= $1; - $line = $'; - } + again: + $line =~ m/^(.*?)(${separator}|"|'|$)/; + $token .= $1; + $line = $2.$'; + + if ($line =~ m/^"((?:[^"\\]+|\\.)*)"/) { + $token .= $1; + $line = $'; + goto again; + } elsif ($line =~ m/^'([^']*)'/) { + $token .= $1; + $line = $'; + goto again; } push @result, $token; } if ($ENV{CONFIGURE_DEBUG_TOKENIZE}) { - print STDERR "DEBUG[tokenize]: Parsed '$debug_line' into:\n"; - print STDERR "DEBUG[tokenize]: ('", join("', '", @result), "')\n"; + print STDERR "DEBUG[tokenize]: Parsed '$debug_line' into:\n"; + print STDERR "DEBUG[tokenize]: ('", join("', '", @result), "')\n"; } return @result; }