X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configure;h=2da2a1a8c3af8cb2ed972763a20207b84af493c8;hp=445f928663ae7955f835b60d8f66f92e59f88d5e;hb=83bd048e9dbe5f376b2feaa7f0a6db6d98ef3a47;hpb=141d7325e7e513102fb8c123dab62dbbd61e846d diff --git a/Configure b/Configure index 445f928663..2da2a1a8c3 100755 --- a/Configure +++ b/Configure @@ -114,6 +114,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED" # it grew impossible to resolve this without sizeable additional # code, so we just tell compiler to be pedantic about everything # but 'long long' type. + . " -Wswitch" . " -DPEDANTIC -pedantic -Wno-long-long" . " -Wall" . " -Wsign-compare" @@ -127,7 +128,6 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED" # 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 # -Wcast-align # -Wunreachable-code # -Wlanguage-extension-token -- no, we use asm() @@ -136,6 +136,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED" my $clang_devteam_warn = "" . " -Qunused-arguments" . " -Wextra" + . " -Wswitch -Wswitch-default" . " -Wno-unused-parameter" . " -Wno-missing-field-initializers" . " -Wno-language-extension-token" @@ -221,6 +222,8 @@ if (grep /^reconf(igure)?$/, @argvcopy) { if defined($configdata::config{cross_compile_prefix}); $ENV{CC} = $configdata::config{cc} if defined($configdata::config{cc}); + $ENV{CXX} = $configdata::config{cxx} + if defined($configdata::config{cxx}); $ENV{BUILDFILE} = $configdata::config{build_file} if defined($configdata::config{build_file}); $ENV{$local_config_envname} = $configdata::config{local_config_dir} @@ -230,6 +233,7 @@ if (grep /^reconf(igure)?$/, @argvcopy) { print " CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n" if $ENV{CROSS_COMPILE}; print " CC = ",$ENV{CC},"\n" if $ENV{CC}; + print " CXX = ",$ENV{CXX},"\n" if $ENV{CXX}; print " BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE}; print " $local_config_envname = ",$ENV{$local_config_envname},"\n" if $ENV{$local_config_envname}; @@ -286,7 +290,7 @@ if (defined $ENV{$local_config_envname}) { } -print "Configuring OpenSSL version $config{version} (0x$config{version_num})\n"; +print "Configuring OpenSSL version $config{version} ($config{version_num})\n"; $config{prefix}=""; $config{openssldir}=""; @@ -541,8 +545,9 @@ $config{build_type} = "release"; my %unsupported_options = (); my %deprecated_options = (); -foreach (@argvcopy) +while (@argvcopy) { + $_ = shift @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. @@ -729,6 +734,14 @@ foreach (@argvcopy) { $libs.=$_." "; } + elsif (/^-rpath$/ or /^-R$/) + # -rpath is the OSF1 rpath flag + # -R is the old Solaris rpath flag + { + my $rpath = shift(@argvcopy) || ""; + $rpath .= " " if $rpath ne ""; + $libs.=$_." ".$rpath; + } elsif (/^-static$/) { $libs.=$_." "; @@ -886,7 +899,8 @@ foreach (sort (keys %disabled)) $what = "ripemd" if $what eq "rmd160"; $what = "whrlpool" if $what eq "whirlpool"; - if (grep { $_ eq $what } @{$config{sdirs}}) + if ($what ne "async" && $what ne "err" + && grep { $_ eq $what } @{$config{sdirs}}) { push @{$config{openssl_algorithm_defines}}, "OPENSSL_NO_$WHAT"; @{$config{sdirs}} = grep { $_ ne $what} @{$config{sdirs}}; @@ -921,8 +935,11 @@ my %target = resolve_config($target); &usage if (!%target || $target{template}); +my %conf_files = map { $_ => 1 } (@{$target{_conf_fname_int}}); +$config{conf_files} = [ sort keys %conf_files ]; %target = ( %{$table{DEFAULTS}}, %target ); +$target{cxxflags}=$target{cflags} unless defined $target{cxxflags}; $target{exe_extension}=""; $target{exe_extension}=".exe" if ($config{target} eq "DJGPP" || $config{target} =~ /^(?:Cygwin|mingw)/); @@ -941,10 +958,11 @@ $config{cross_compile_prefix} = $ENV{'CROSS_COMPILE'} # Allow overriding the names of some tools. USE WITH CARE # Note: only Unix cares about HASHBANGPERL... that explains # the default string. -$config{perl} = $ENV{'PERL'} || ($^O ne "VMS" ? $^X : "perl"); +$config{perl} = ($^O ne "VMS" ? $^X : "perl"); $config{hashbangperl} = $ENV{'HASHBANGPERL'} || $ENV{'PERL'} || "/usr/bin/env perl"; $target{cc} = $ENV{'CC'} || $target{cc} || "cc"; +$target{cxx} = $ENV{'CXX'} || $target{cxx} || "c++"; $target{ranlib} = $ENV{'RANLIB'} || $target{ranlib} || (which("$config{cross_compile_prefix}ranlib") ? "\$(CROSS_COMPILE)ranlib" : "true"); @@ -958,6 +976,7 @@ $target{build_file} = $ENV{BUILDFILE} || $target{build_file} || "Makefile"; # Cache information necessary for reconfiguration $config{cc} = $target{cc}; +$config{cxx} = $target{cxx}; $config{build_file} = $target{build_file}; # For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_ @@ -965,6 +984,7 @@ $config{build_file} = $target{build_file}; # Do it in such a way that no spurious space is appended (hence the grep). $config{defines} = []; $config{cflags} = ""; +$config{cxxflags} = ""; $config{ex_libs} = ""; $config{shared_ldflag} = ""; @@ -1198,7 +1218,7 @@ if ($^O ne "VMS" && !$disabled{makedepend}) { # 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)); + if (/clang/ || (/gcc/ && $compiler_major >= 3)); $ecc = "clang" if /clang/; $ecc = "gcc" if /gcc/; last if ($config{makedepprog} || !$lines--); @@ -1314,44 +1334,6 @@ my %unified_info = (); my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO}); if ($builder eq "unified") { - # Store the name of the template file we will build the build file from - # in %config. This may be useful for the build file itself. - my @build_file_template_names = - ( $builder_platform."-".$target{build_file}.".tmpl", - $target{build_file}.".tmpl" ); - my @build_file_templates = (); - - # First, look in the user provided directory, if given - if (defined $ENV{$local_config_envname}) { - @build_file_templates = - map { - if ($^O eq 'VMS') { - # VMS environment variables are logical names, - # which can be used as is - $local_config_envname . ':' . $_; - } else { - catfile($ENV{$local_config_envname}, $_); - } - } - @build_file_template_names; - } - # Then, look in our standard directory - push @build_file_templates, - ( map { catfile($srcdir, "Configurations", $_) } - @build_file_template_names ); - - my $build_file_template; - for $_ (@build_file_templates) { - $build_file_template = $_; - last if -f $build_file_template; - - $build_file_template = undef; - } - if (!defined $build_file_template) { - die "*** Couldn't find any of:\n", join("\n", @build_file_templates), "\n"; - } - $config{build_file_template} = $build_file_template; - use lib catdir(dirname(__FILE__),"util"); use with_fallback qw(Text::Template); @@ -1388,6 +1370,47 @@ if ($builder eq "unified") { return $res; } + # Store the name of the template file we will build the build file from + # in %config. This may be useful for the build file itself. + my @build_file_template_names = + ( $builder_platform."-".$target{build_file}.".tmpl", + $target{build_file}.".tmpl" ); + my @build_file_templates = (); + + # First, look in the user provided directory, if given + if (defined $ENV{$local_config_envname}) { + @build_file_templates = + map { + if ($^O eq 'VMS') { + # VMS environment variables are logical names, + # which can be used as is + $local_config_envname . ':' . $_; + } else { + catfile($ENV{$local_config_envname}, $_); + } + } + @build_file_template_names; + } + # Then, look in our standard directory + push @build_file_templates, + ( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir) } + @build_file_template_names ); + + my $build_file_template; + for $_ (@build_file_templates) { + $build_file_template = $_; + last if -f $build_file_template; + + $build_file_template = undef; + } + if (!defined $build_file_template) { + die "*** Couldn't find any of:\n", join("\n", @build_file_templates), "\n"; + } + $config{build_file_templates} + = [ $build_file_template, + cleanfile($srcdir, catfile("Configurations", "common.tmpl"), + $blddir) ]; + my @build_infos = ( [ ".", "build.info" ] ); foreach (@{$config{dirs}}) { push @build_infos, [ $_, "build.info" ] @@ -1740,9 +1763,11 @@ EOF if (! -f $s) { $s = cleanfile($buildd, $_, $blddir); } - # We recognise C and asm files - if ($s =~ /\.[csS]\b$/) { - (my $o = $_) =~ s/\.[csS]\b$/.o/; + # We recognise C++, C and asm files + if ($s =~ /\.(cc|cpp|c|s|S)$/) { + my $o = $_; + $o =~ s/\.[csS]$/.o/; # C and assembler + $o =~ s/\.(cc|cpp)$/_cc.o/; # C++ $o = cleanfile($buildd, $o, $blddir); $unified_info{sources}->{$ddest}->{$o} = 1; $unified_info{sources}->{$o}->{$s} = 1; @@ -1766,9 +1791,11 @@ EOF if (! -f $s) { $s = cleanfile($buildd, $_, $blddir); } - # We recognise C and asm files - if ($s =~ /\.[csS]\b$/) { - (my $o = $_) =~ s/\.[csS]\b$/.o/; + # We recognise C++, C and asm files + if ($s =~ /\.(cc|cpp|c|s|S)$/) { + my $o = $_; + $o =~ s/\.[csS]$/.o/; # C and assembler + $o =~ s/\.(cc|cpp)$/_cc.o/; # C++ $o = cleanfile($buildd, $o, $blddir); $unified_info{shared_sources}->{$ddest}->{$o} = 1; $unified_info{sources}->{$o}->{$s} = 1; @@ -1891,7 +1918,9 @@ EOF foreach (grep /_(asm|aux)_src$/, keys %target) { my $src = $_; (my $obj = $_) =~ s/_(asm|aux)_src$/_obj/; - ($target{$obj} = $target{$src}) =~ s/\.[csS]\b/.o/g; + $target{$obj} = $target{$src}; + $target{$obj} =~ s/\.[csS]\b/.o/g; # C and assembler + $target{$obj} =~ s/\.(cc|cpp)\b/_cc.o/g; # C++ } # Write down our configuration where it fits ######################### @@ -2019,14 +2048,17 @@ EOF print OUT "1;\n"; close(OUT); -my $perlvers = &get_perl_version(); print "\n"; print "PROCESSOR =$config{processor}\n" if $config{processor}; print "PERL =$config{perl}\n"; -print "PERLVERSION =$perlvers\n"; +print "PERLVERSION =$Config{version} for $Config{archname}\n"; print "HASHBANGPERL =$config{hashbangperl}\n"; print "CC =$config{cross_compile_prefix}$target{cc}\n"; print "CFLAG =$target{cflags} $config{cflags}\n"; +print "CXX =$config{cross_compile_prefix}$target{cxx}\n" + if defined $target{cxx}; +print "CXXFLAG =$target{cxxflags} $config{cxxflags}\n" + if defined $target{cxx}; print "DEFINES =",join(" ", @{$target{defines}}, @{$config{defines}}),"\n"; #print "RANLIB =", $target{ranlib} eq '$(CROSS_COMPILE)ranlib' ? # "$config{cross_compile_prefix}ranlib" : @@ -2036,8 +2068,7 @@ print "EX_LIBS =$target{ex_libs} $config{ex_libs}\n"; my %builders = ( unified => sub { run_dofile(catfile($blddir, $target{build_file}), - $config{build_file_template}, - catfile($srcdir, "Configurations", "common.tmpl")); + @{$config{build_file_templates}}); }, ); @@ -2210,7 +2241,8 @@ sub read_config { close(CONFFILE); my %targets = (); { - local %table = %::table; # Protect %table from tampering + # Protect certain tables from tampering + local %table = %::table; eval $content; warn $@ if $@; @@ -2225,7 +2257,9 @@ sub read_config { warn "Misconfigured target configuration for $_ (should be a hash table), ignoring...\n"; } delete $targets{$_}; - } + } else { + $targets{$_}->{_conf_fname_int} = add([ $fname ]); + } } %table = (%table, %targets); @@ -2384,21 +2418,6 @@ sub usage exit(1); } -# Return the perl version. -sub get_perl_version -{ - return "$Config{version} for $Config{archname}" if $config{perl} eq $^X; - my $l; - open my $FH, "$config{perl} -v|" || return "??unknown??"; - while ( <$FH> ) { - chop; - $l .= $_; - } - close $FH; - $l =~ s/This is (.{1,70}).*/$1/; - return $l; -} - sub run_dofile { my $out = shift;