X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configure;h=0cf893ee7a99392cd246a07a0e182fc59d2d5b2f;hp=61d28a71416320b8e644e663cb53932fb7926b53;hb=d6b55faca3bc085ed487c1a69aa976f81cf1c7fa;hpb=242ffb05a2e4aa3fc7ffc131037e077b7e242189 diff --git a/Configure b/Configure index 61d28a7141..0cf893ee7a 100755 --- a/Configure +++ b/Configure @@ -32,10 +32,6 @@ my $usage="Usage: Configure [no- ...] [enable- ...] [experimenta # This becomes the value of OPENSSLDIR in Makefile and in C. # (Default: PREFIX/ssl) # -# --install_prefix Additional prefix for package builders (empty by -# default). This needn't be set in advance, you can -# just as well use "make INSTALL_PREFIX=/whatever install". -# # --cross-compile-prefix Add specified prefix to binutils components. # # --api One of 0.9.8, 1.0.0 or 1.1.0. Do not compile support for @@ -80,23 +76,42 @@ my $usage="Usage: Configure [no- ...] [enable- ...] [experimenta # Minimum warning options... any contributions to OpenSSL should at least get # past these. -my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wtype-limits -Werror -DREF_CHECK -DDEBUG_UNUSED"; +my $gcc_devteam_warn = "-DPEDANTIC -DREF_DEBUG -DDEBUG_UNUSED" + . " -pedantic" + . " -Wall" + . " -Wno-long-long" + . " -Wsign-compare" + . " -Wmissing-prototypes" + . " -Wshadow" + . " -Wformat" + . " -Wtype-limits" + . " -Werror" + ; # These are used in addition to $gcc_devteam_warn when the compiler is clang. # TODO(openssl-team): fix problems and investigate if (at least) the # following warnings can also be enabled: -# -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers, -# -Wcast-align, -# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token -# -Wextended-offsetof -my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Qunused-arguments -Wincompatible-pointer-types-discards-qualifiers -Wmissing-variable-declarations"; - -# Warn that "make depend" should be run? -my $warn_make_depend = 0; - -# These are used in addition to $gcc_devteam_warn unless this is a mingw build. -# This adds backtrace information to the memory leak info. -my $memleak_devteam_backtrace = "-rdynamic -DCRYPTO_MDEBUG_BACKTRACE"; +# -Wswitch-enum +# -Wunused-macros +# -Wcast-align +# -Wunreachable-code +# -Wlanguage-extension-token +# -Wextended-offsetof +my $clang_devteam_warn = "" + . " -Qunused-arguments" + . " -Wextra" + . " -Wno-unused-parameter" + . " -Wno-missing-field-initializers" + . " -Wno-language-extension-token" + . " -Wno-extended-offsetof" + . " -Wconditional-uninitialized" + . " -Wincompatible-pointer-types-discards-qualifiers" + . " -Wmissing-variable-declarations" + ; + +# This adds backtrace information to the memory leak info. Is only used +# when crypto-mdebug-backtrace is enabled. +my $memleak_devteam_backtrace = "-rdynamic"; my $strict_warnings = 0; @@ -187,7 +202,6 @@ $config{prefix}=""; $config{openssldir}=""; $config{processor}=""; $config{libdir}=""; -$config{install_prefix}= "$ENV{'INSTALL_PREFIX'}"; $config{cross_compile_prefix}=""; $config{fipslibdir}="/usr/local/ssl/fips-2.0/lib/"; my $nofipscanistercheck=0; @@ -238,6 +252,7 @@ my @disablables = ( "cms", "comp", "crypto-mdebug", + "crypto-mdebug-backtrace", "ct", "deprecated", "des", @@ -321,6 +336,7 @@ my %disabled = ( # "what" => "comment" [or special keyword "experimental "unit-test" => "default", "zlib" => "default", "crypto-mdebug" => "default", + "heartbeats" => "default", ); my @experimental = (); @@ -362,6 +378,8 @@ my @disable_cascades = ( # SRP and HEARTBEATS require TLSEXT "tlsext" => [ "srp", "heartbeats" ], + + "crypto-mdebug" => [ "crypto-mdebug-backtrace" ], ); # Avoid protocol support holes. Also disable all versions below N, if version @@ -398,6 +416,15 @@ my @default_depdefines = # We will collect such requests in @experimental. # To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO. +my @generated_headers = ( + "include/openssl/opensslconf.h", + "crypto/include/internal/bn_conf.h" + ); + +my @generated_by_make_headers = ( + "crypto/buildinf.h" + ); + my $no_sse2=0; @@ -416,7 +443,6 @@ $config{openssl_other_defines}=[]; my $libs=""; my $target=""; $config{options}=""; -my $make_depend=0; my %withargs=(); my $build_prefix = "release_"; @@ -450,7 +476,7 @@ if (grep /^reconf(igure)?$/, @argvcopy) { # centered information gathering the reading configdata.pm # while () { - chomp; + s|\R$||; if (/^CONFIGURE_ARGS=\s*(.*)\s*/) { # Older form, we split the string and hope for the best @argvcopy = split /\s+/, $_; @@ -475,6 +501,13 @@ $config{perlargv} = [ @argvcopy ]; my %unsupported_options = (); foreach (@argvcopy) { + # VMS is a case insensitive environment, and depending on settings + # out of our control, we may receive options uppercased. Let's + # downcase at least the part before any equal sign. + if ($^O eq "VMS") + { + s/^([^=]*)/lc($1)/e; + } s /^-no-/no-/; # some people just can't read the instructions # rewrite some options in "enable-..." form @@ -598,10 +631,6 @@ foreach (@argvcopy) { $config{openssldir}=$1; } - elsif (/^--install.prefix=(.*)$/) - { - $config{install_prefix}=$1; - } elsif (/^--with-zlib-lib=(.*)$/) { $withargs{zlib_lib}=$1; @@ -637,7 +666,7 @@ foreach (@argvcopy) else # common if (/^[-+]/), just pass down... { $_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei; - $user_cflags.=$_." "; + $user_cflags.=" ".$_; } } elsif ($_ =~ /^([^:]+):(.+)$/) @@ -865,10 +894,10 @@ push @{$config{defines}}, map { (my $x = $_) =~ s/^OPENSSL_NO_/OPENSSL_EXPERIMENTAL_/; $x } @{$config{openssl_experimental_defines}}; -if ($target =~ /^mingw/ && `$target{cc} --target-help 2>&1` !~ m/-mno-cygwin/m) +if ($target =~ /^mingw/ && `$target{cc} --target-help 2>&1` =~ m/-mno-cygwin/m) { - $config{cflags} =~ s/-mno-cygwin\s*//; - $target{shared_ldflag} =~ s/-mno-cygwin\s*//; + $config{cflags} .= " -mno-cygwin"; + $target{shared_ldflag} .= " -mno-cygwin"; } if ($target =~ /linux.*-mips/ && !$no_asm && $user_cflags !~ /-m(ips|arch=)/) { @@ -881,11 +910,6 @@ my $no_shared_warn=0; my $no_user_cflags=0; my $no_user_defines=0; -if ($user_cflags ne "") { $config{cflags}="$user_cflags$config{cflags}"; } -else { $no_user_cflags=1; } -if (@user_defines) { $config{defines}=[ @user_defines, @{$config{defines}} ]; } -else { $no_user_defines=1; } - # The DSO code currently always implements all functions so that no # applications will have to worry about that from a compilation point # of view. However, the "method"s may return zero unless that platform @@ -1021,7 +1045,9 @@ if ($target{ranlib} eq "") if (!$no_asm) { $target{cpuid_asm_src}=$table{BASE}->{cpuid_asm_src} if ($config{processor} eq "386"); - $target{cpuid_asm_src}.=" uplink.c uplink-x86.s" if (grep { $_ eq "OPENSSL_USE_APPLINK"} @{$config{defines}}); + $target{cpuid_asm_src}.=" uplink.c uplink-x86.s" + if (grep { $_ eq "OPENSSL_USE_APPLINK"} @{$config{defines}} + || grep /(^|\s)-DOPENSSL_USE_APPLINK(\s|$)/, ${$config{cflags}}); $target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m})); @@ -1078,18 +1104,20 @@ if (!$no_asm) { } } -# Is the compiler gcc or clang? $ecc is used below to see if error-checking -# can be turned on. my $ecc = $target{cc}; -my $ccpcc = "$config{cross_compile_prefix}$target{cc}"; -$config{makedepprog} = 'makedepend'; -open(PIPE, "$ccpcc --version 2>&1 | head -2 |"); -while ( ) { - $config{makedepprog} = $ccpcc if /clang|gcc/; - $ecc = "clang" if /clang/; - $ecc = "gcc" if /gcc/; +if ($^O ne "VMS") { + # 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}"; + $config{makedepprog} = 'makedepend'; + open(PIPE, "$ccpcc --version 2>&1 | head -2 |"); + while ( ) { + $config{makedepprog} = $ccpcc if /clang|gcc/; + $ecc = "clang" if /clang/; + $ecc = "gcc" if /gcc/; + } + close(PIPE); } -close(PIPE); $config{depflags} =~ s/^\s*//; @@ -1148,19 +1176,27 @@ if ($strict_warnings) $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/) } } - if ($target !~ /^mingw/) + } + +unless ($disabled{"crypto-mdebug-backtrace"}) + { + foreach my $wopt (split /\s+/, $memleak_devteam_backtrace) { - foreach $wopt (split /\s+/, $memleak_devteam_backtrace) - { - $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/) - } - if ($target =~ /^BSD-/) - { - $config{ex_libs} .= " -lexecinfo"; - } + $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/) + } + if ($target =~ /^BSD-/) + { + $config{ex_libs} .= " -lexecinfo"; } } +if ($user_cflags ne "") { $config{cflags}="$config{cflags}$user_cflags"; } +else { $no_user_cflags=1; } +if (@user_defines) { $config{defines}=[ @{$config{defines}}, @user_defines ]; } +else { $no_user_defines=1; } + +# ALL MODIFICATIONS TO %config and %target MUST BE DONE FROM HERE ON + # If we use the unified build, collect information from build.info files my %unified_info = (); @@ -1327,7 +1363,7 @@ if ($builder eq "unified") { my $lineiterator = shift; my $target_kind = $1; while (defined $lineiterator->()) { - chomp; + s|\R$||; if (/^\s*ENDRAW\[((?:\\.|[^\\\]])+)\]\s*$/) { die "ENDRAW doesn't match BEGINRAW" if $1 ne $target_kind; @@ -1485,9 +1521,15 @@ EOF foreach (@{$depends{$dest}}) { my $d = cleanfile($sourced, $_, $blddir); - # If it isn't found in the source, let's assume it's generated - # and that the Makefile template has the lines - if (! -f $d) { + # If we know it's generated, or assume it is because we can't + # find it in the source tree, we set file we depend on to be + # 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 + || !(grep { $d eq $_ } + map { cleanfile($srcdir, $_, $blddir) } + (@generated_headers, @generated_by_make_headers))) { $d = cleanfile($buildd, $_, $blddir); } # Take note if the file to depend on is being renamed @@ -1701,14 +1743,10 @@ print "THIRTY_TWO_BIT mode\n" if $config{b32}; print "BN_LLONG mode\n" if $config{bn_ll}; print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} != $def_int; -mkpath(catdir($blddir, "include/openssl")); -run_dofile(catfile($blddir, "include/openssl/opensslconf.h"), - catfile($srcdir, "include/openssl/opensslconf.h.in")); - -mkpath(catdir($blddir, "crypto/include/internal")); -foreach my $alg ( 'bn' ) { - run_dofile(catfile($blddir, "crypto/include/internal/${alg}_conf.h"), - catfile($srcdir, "crypto/include/internal/${alg}_conf.h.in")); +for (@generated_headers) { + mkpath(catdir($blddir, dirname($_))); + run_dofile(catfile($blddir, $_), + catfile($srcdir, $_.".in")); } ### @@ -1751,60 +1789,18 @@ my %builders = ( run_dofile(catfile($blddir, $target{build_file}), $config{build_file_template}, catfile($srcdir, "Configurations", "common.tmpl")); - - my $make_command = "$make PERL=\'$config{perl}\'"; - my $make_targets = ""; - my $need_make_depend = - join(" ", @{$config{depdefines}}) ne join(" ", @default_depdefines); - $make_targets .= " depend" - if $need_make_depend && $make_depend; - - (system $make_command.$make_targets) == 0 - or die "make $make_targets failed" - if $make_targets ne ""; - - if ($need_make_depend && !$make_depend) { - $warn_make_depend++; - } }, unixmake => sub { build_Makefile(); run_dofile("util/domd", "util/domd.in"); chmod 0755, "util/domd"; - - my $make_command = "$make PERL=\'$config{perl}\'"; - my $make_targets = ""; - my $need_make_depend = - join(" ", @{$config{depdefines}}) ne join(" ", @default_depdefines); - $make_targets .= " depend" - if $need_make_depend && $make_depend; - - (system $make_command.$make_targets) == 0 - or die "make $make_targets failed" - if $make_targets ne ""; - - if ($need_make_depend && !$make_depend) { - $warn_make_depend++; - } }, mk1mf => sub { my $platform = shift; # The only reason we do this is to have something to build MINFO from build_Makefile(); - open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; - printf OUT <<"EOF"; -#ifndef MK1MF_BUILD - /* auto-generated by Configure for crypto/cversion.c: - * for Unix builds, crypto/Makefile.ssl generates functional definitions; - * Windows builds (and other mk1mf builds) compile cversion.c with - * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */ - #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles" -#endif -EOF - close(OUT); - # create the ms/version32.rc file if needed if ($platform ne "netware") { my ($v1, $v2, $v3, $v4); @@ -1891,14 +1887,6 @@ shared libraries, please let us know (but please first make sure you have tried with a current version of OpenSSL). EOF -print <<"EOF" if ($warn_make_depend); - -*** Because of configuration changes, you MUST do the following before -*** building: - - make depend -EOF - ###### TO BE REMOVED BEFORE FINAL RELEASE ###### ###### If the user hasn't chosen --unified, try to nudge them. @@ -2223,6 +2211,7 @@ sub print_table_entry "shared_target", "shared_cflag", "shared_ldflag", + "shared_rcflag", "shared_extension", "obj_extension", "exe_extension", @@ -2333,7 +2322,7 @@ sub collect_from_file { my $saved_line = ""; $_ = ""; while (<$fh>) { - chomp; + s|\R$||; if (defined $line_concat) { $_ = $line_concat->($saved_line, $_); $saved_line = ""; @@ -2364,7 +2353,7 @@ sub collect_from_array { my $saved_line = ""; $_ = ""; while (defined($_ = shift @array)) { - chomp; + s|\R$||; if (defined $line_concat) { $_ = $line_concat->($saved_line, $_); $saved_line = ""; @@ -2389,7 +2378,7 @@ sub collect_information { my %collectors = @_; while(defined($_ = $lineiterator->())) { - chomp; + s|\R$||; my $found = 0; foreach my $re (keys %collectors) { if ($re ne "OTHERWISE" && /$re/) {