Merge in the sanity checker from 0.9.7-dev.
This commit is contained in:
		
							
								
								
									
										96
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										96
									
								
								Configure
									
									
									
									
									
								
							@@ -10,7 +10,7 @@ use strict;
 | 
			
		||||
 | 
			
		||||
# see INSTALL for instructions.
 | 
			
		||||
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [no-dso] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [no-dso] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--test-sanity] os/compiler[:flags]\n";
 | 
			
		||||
 | 
			
		||||
# Options:
 | 
			
		||||
#
 | 
			
		||||
@@ -23,6 +23,9 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
 | 
			
		||||
#               default).  This needn't be set in advance, you can
 | 
			
		||||
#               just as well use "make INSTALL_PREFIX=/whatever install".
 | 
			
		||||
#
 | 
			
		||||
# --test-sanity Make a number of sanity checks on the data in this file.
 | 
			
		||||
#               This is a debugging tool for OpenSSL developers.
 | 
			
		||||
#
 | 
			
		||||
# rsaref        use RSAref
 | 
			
		||||
# [no-]threads  [don't] try to create a library that is suitable for
 | 
			
		||||
#               multithreaded applications (default is "threads" if we
 | 
			
		||||
@@ -491,6 +494,29 @@ my %table=(
 | 
			
		||||
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
 | 
			
		||||
	BC-16 Mingw32);
 | 
			
		||||
 | 
			
		||||
my $idx = 0;
 | 
			
		||||
my $idx_cc = $idx++;
 | 
			
		||||
my $idx_cflags = $idx++;
 | 
			
		||||
my $idx_unistd = $idx++;
 | 
			
		||||
my $idx_thread_cflag = $idx++;
 | 
			
		||||
my $idx_lflags = $idx++;
 | 
			
		||||
my $idx_bn_ops = $idx++;
 | 
			
		||||
my $idx_bn_obj = $idx++;
 | 
			
		||||
my $idx_des_obj = $idx++;
 | 
			
		||||
my $idx_bf_obj = $idx++;
 | 
			
		||||
my $idx_md5_obj = $idx++;
 | 
			
		||||
my $idx_sha1_obj = $idx++;
 | 
			
		||||
my $idx_cast_obj = $idx++;
 | 
			
		||||
my $idx_rc4_obj = $idx++;
 | 
			
		||||
my $idx_rmd160_obj = $idx++;
 | 
			
		||||
my $idx_rc5_obj = $idx++;
 | 
			
		||||
my $idx_dso_scheme = $idx++;
 | 
			
		||||
my $idx_shared_target = $idx++;
 | 
			
		||||
my $idx_shared_cflag = $idx++;
 | 
			
		||||
my $idx_shared_ldflag = $idx++;
 | 
			
		||||
my $idx_shared_extension = $idx++;
 | 
			
		||||
my $idx_ranlib = $idx++;
 | 
			
		||||
 | 
			
		||||
my $prefix="";
 | 
			
		||||
my $openssldir="";
 | 
			
		||||
my $exe_ext="";
 | 
			
		||||
@@ -563,7 +589,11 @@ PROCESS_ARGS:
 | 
			
		||||
	foreach (@argvcopy)
 | 
			
		||||
		{
 | 
			
		||||
		s /^-no-/no-/; # some people just can't read the instructions
 | 
			
		||||
		if (/^no-asm$/)
 | 
			
		||||
		if (/^--test-sanity$/)
 | 
			
		||||
			{
 | 
			
		||||
			exit(&test_sanity());
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^no-asm$/)
 | 
			
		||||
		 	{
 | 
			
		||||
			$no_asm=1;
 | 
			
		||||
			$flags .= "-DNO_ASM ";
 | 
			
		||||
@@ -711,9 +741,29 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /^\//;
 | 
			
		||||
 | 
			
		||||
print "IsWindows=$IsWindows\n";
 | 
			
		||||
 | 
			
		||||
(my $cc,my $cflags,my $unistd,my $thread_cflag,my $lflags,my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
 | 
			
		||||
 $md5_obj,$sha1_obj,my $cast_obj,my $rc4_obj,$rmd160_obj,my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,my $shared_ldflag,my $shared_extension,my $ranlib)=
 | 
			
		||||
	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
my $cc = $fields[$idx_cc];
 | 
			
		||||
my $cflags = $fields[$idx_cflags];
 | 
			
		||||
my $unistd = $fields[$idx_unistd];
 | 
			
		||||
my $thread_cflag = $fields[$idx_thread_cflag];
 | 
			
		||||
my $lflags = $fields[$idx_lflags];
 | 
			
		||||
my $bn_ops = $fields[$idx_bn_ops];
 | 
			
		||||
my $bn_obj = $fields[$idx_bn_obj];
 | 
			
		||||
my $des_obj = $fields[$idx_des_obj];
 | 
			
		||||
my $bf_obj = $fields[$idx_bf_obj];
 | 
			
		||||
my $md5_obj = $fields[$idx_md5_obj];
 | 
			
		||||
my $sha1_obj = $fields[$idx_sha1_obj];
 | 
			
		||||
my $cast_obj = $fields[$idx_cast_obj];
 | 
			
		||||
my $rc4_obj = $fields[$idx_rc4_obj];
 | 
			
		||||
my $rmd160_obj = $fields[$idx_rmd160_obj];
 | 
			
		||||
my $rc5_obj = $fields[$idx_rc5_obj];
 | 
			
		||||
my $dso_scheme = $fields[$idx_dso_scheme];
 | 
			
		||||
my $shared_target = $fields[$idx_shared_target];
 | 
			
		||||
my $shared_cflag = $fields[$idx_shared_cflag];
 | 
			
		||||
my $shared_ldflag = $fields[$idx_shared_ldflag];
 | 
			
		||||
my $shared_extension = $fields[$idx_shared_extension];
 | 
			
		||||
my $ranlib = $fields[$idx_ranlib];
 | 
			
		||||
 | 
			
		||||
$cflags="$flags$cflags" if ($flags ne "");
 | 
			
		||||
 | 
			
		||||
# The DSO code currently always implements all functions so that no
 | 
			
		||||
@@ -1244,3 +1294,39 @@ sub print_table_entry
 | 
			
		||||
\$ranlib       = $ranlib
 | 
			
		||||
EOF
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
sub test_sanity
 | 
			
		||||
	{
 | 
			
		||||
	my $errorcnt = 0;
 | 
			
		||||
 | 
			
		||||
	print STDERR "=" x 70, "\n";
 | 
			
		||||
	print STDERR "=== SANITY TESTING!\n";
 | 
			
		||||
	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
 | 
			
		||||
	print STDERR "=" x 70, "\n";
 | 
			
		||||
 | 
			
		||||
	foreach $target (sort keys %table)
 | 
			
		||||
		{
 | 
			
		||||
		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
 | 
			
		||||
		if ($fields[$idx_dso_scheme-1] =~ /^(dl|dlfcn|win32|vms)$/)
 | 
			
		||||
			{
 | 
			
		||||
			$errorcnt++;
 | 
			
		||||
			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
 | 
			
		||||
			print STDERR "              in the previous field\n";
 | 
			
		||||
			}
 | 
			
		||||
		elsif ($fields[$idx_dso_scheme+1] =~ /^(dl|dlfcn|win32|vms)$/)
 | 
			
		||||
			{
 | 
			
		||||
			$errorcnt++;
 | 
			
		||||
			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
 | 
			
		||||
			print STDERR "              in the following field\n";
 | 
			
		||||
			}
 | 
			
		||||
		elsif ($fields[$idx_dso_scheme] !~ /^(dl|dlfcn|win32|vms|)$/)
 | 
			
		||||
			{
 | 
			
		||||
			$errorcnt++;
 | 
			
		||||
			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
 | 
			
		||||
			print STDERR "              valid values are 'dl', 'dlfcn', 'win32' and 'vms'\n";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
 | 
			
		||||
	return $errorcnt;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user