Move all autogenerated header file parts to crypto/opensslconf.h.
diff --git a/Configure b/Configure
index 04ad6f7..b4e8925 100755
--- a/Configure
+++ b/Configure
@@ -91,17 +91,16 @@
 "debug-ben",	"gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -O2 -Wall -Wshadow -Werror -pipe:::::",
 "debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe:::::",
 "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
-"debug-solaris-sparc-gcc","gcc:-O3 -g -mv8 -Wall -DB_ENDIAN:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
 "dist",		"cc:-O:::::",
 
 # Basic configs that should work on any box
 "gcc",		"gcc:-O3::BN_LLONG:::",
 "cc",		"cc:-O:::::",
 
-
 # Solaris setups
 "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN:-lsocket -lnsl:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_sol_asm",
 "solaris-sparc-gcc","gcc:-O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8.o::",
+"debug-solaris-sparc-gcc","gcc:-O3 -g -mv8 -Wall -DB_ENDIAN:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
 
 # DO NOT use /xO[34] on sparc with SC3.0. 
 # It is broken, and will not pass the tests
@@ -223,11 +222,11 @@
 "VC-WIN32","cl:::BN_LLONG RC4_INDEX ${x86_gcc_opts}:::",
 "VC-WIN16","cl:::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
 "VC-W31-16","cl:::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
-"VC-W31-32","cl:::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
+"VC-W31-32","cl:::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
 "VC-MSDOS","cl:::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
 
 # Borland C++ 4.5
-"BC-32","bcc32:::DES_PTR RC4_INDEX:::",
+"BC-32","bcc32:::BN_LLONG DES_PTR RC4_INDEX:::",
 "BC-16","bcc:::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::",
 
 # CygWin32
@@ -246,25 +245,10 @@
 
 );
 
-# Miscellaneous hacks: this is designed to allow environments where the "one
-# makefile" option does not auto build all files.
-## # The first six fields are the hard coded versions of the stuff generated by
-## # ctx_size for pem.h: that is EVP_ENCODE_CTX_SIZE, EVP_MD_SIZE EVP_MD_CTX_SIZE,
-## # EVP_CIPHER_SIZE, EVP_CIPHER_CTX_SIZE and EVP_MAX_MD_SIZE respectively.
-# If the seventh field is 1 then auto generate
-# crypto/date.h
-# Need to add Win16 and others here.
-
-my %misc_table = (
-"VC-WIN32", 	"96:60:152:40:4212:20:1",
-"VC-NT", 	"96:60:152:40:4212:20:1"
-);
-
 my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
 	BC-16 CygWin32);
 
 my $no_asm=0;
-my $postfix="org";
 my $Makefile="Makefile.ssl";
 my $des_locl="crypto/des/des_locl.h";
 my $des	="crypto/des/des.h";
@@ -481,10 +465,8 @@
 	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
 	}
 
-((my $in=$bn) =~ s/\.([^.]+)/.$postfix/);
-my $n=&file_new($bn);
-open(IN,"<".$in) || die "unable to read $bn:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
+open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
+open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
 while (<IN>)
 	{
 	if	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
@@ -499,38 +481,10 @@
 		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
 	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
 		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($bn,&file_old($bn));
-&Rename($n,$bn);
-
-(($in=$des) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($des);
-open(IN,"<".$in) || die "unable to read $des:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^\#define\s+DES_LONG\s+.*/)
+	elsif	(/^\#define\s+DES_LONG\s+.*/)
 		{ printf OUT "#define DES_LONG unsigned %s\n",
 			($des_int)?'int':'long'; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($des,&file_old($des));
-&Rename($n,$des);
-
-(($in=$des_locl) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($des_locl);
-open(IN,"<".$in) || die "unable to read $des_locl:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^\#(define|undef)\s+DES_PTR/)
+	elsif	(/^\#(define|undef)\s+DES_PTR/)
 		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
 	elsif	(/^\#(define|undef)\s+DES_RISC1/)
 		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
@@ -538,158 +492,28 @@
 		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
 	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
 		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($des_locl,&file_old($des_locl));
-&Rename($n,$des_locl);
-
-(($in=$rc4) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($rc4);
-open(IN,"<".$in) || die "unable to read $rc4:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^#define\s+RC4_INT\s/)
+	elsif	(/^#define\s+RC4_INT\s/)
 		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($rc4,&file_old($rc4));
-&Rename($n,$rc4);
-
-(($in=$rc4_locl) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($rc4_locl);
-open(IN,"<".$in) || die "unable to read $rc4_locl:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^#((define)|(undef))\s+RC4_INDEX/)
+	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
 		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($rc4_locl,&file_old($rc4_locl));
-&Rename($n,$rc4_locl);
-
-(($in=$md2) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($md2);
-open(IN,"<".$in) || die "unable to read $bn:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^#define\s+MD2_INT\s/)
+	elsif	(/^#define\s+MD2_INT\s/)
 		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($md2,&file_old($md2));
-&Rename($n,$md2);
-
-(($in=$idea) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($idea);
-open(IN,"<".$in) || die "unable to read $idea:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^#define\s+IDEA_INT\s/)
+	elsif	(/^#define\s+IDEA_INT\s/)
 		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($idea,&file_old($idea));
-&Rename($n,$idea);
-
-(($in=$rc2) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($rc2);
-open(IN,"<".$in) || die "unable to read $rc2:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if	(/^#define\s+RC2_INT\s/)
+	elsif	(/^#define\s+RC2_INT\s/)
 		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
-	else
-		{ print OUT $_; }
-	}
-close(IN);
-close(OUT);
-&Rename($rc2,&file_old($rc2));
-&Rename($n,$rc2);
-
-(($in=$bf) =~ s/\.([^.]+)/.$postfix/);
-$n=&file_new($bf);
-open(IN,"<".$in) || die "unable to read $bf:$!\n";
-open(OUT,">$n") || die "unable to read $n:$!\n";
-while (<IN>)
-	{
-	if (/^#(define|undef)\s+BF_PTR/)
+	elsif (/^#(define|undef)\s+BF_PTR/)
 		{
 		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
 		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
 		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
-		}
+	        }
 	else
 		{ print OUT $_; }
 	}
-close(IN);
-close(OUT);
-&Rename($bf,&file_old($bf));
-&Rename($n,$bf);
-
-# Now the miscellaneous fixups
-
-if(defined $misc_table{$target}) {
-	my ($enc_ctx, $md_size, $md_ctx_size, $cipher_size, $cipher_ctx_size,
-		$max_md_size, $date_fix) = 
-		split(/\s*:\s*/,$misc_table{$target} . ":", -1);
-
-## #print "EVP_ENCODE_CTX_SIZE $enc_ctx\n";
-## #print "EVP_MD_SIZE $md_size\n";
-## #print "EVP_MD_CTX_SIZE $md_ctx_size\n";
-## #print "EVP_CIPHER_SIZE $cipher_size\n";
-## #print "EVP_CIPHER_CTX_SIZE $cipher_ctx_size\n";
-## #print "EVP_MAX_MD_SIZE $max_md_size\n";
-#printf "Date fix: %s\n", $date_fix ? "Yes" : "No";
 
 # Fix the date
 
-if($date_fix) {
-	open (OUT,">crypto/date.h") || die "Can't open date.h";
-	printf OUT "#define DATE \"%s\"\n", scalar gmtime();
-	close(OUT);
-}
-
-## open (IN, "crypto/pem/pem.org") || die "Can't open crypto/pem/pem.org";
-## open (OUT, ">crypto/pem/pem.h") || die "Can't create crypto/pem/pem.h";
-## 
-## # Now fix up pem.h
-## while(<IN>) {
-## 	chop;
-## 	s/^(#define EVP_ENCODE_CTX_SIZE).*$/$1 $enc_ctx/;
-## 	s/^(#define EVP_MD_SIZE).*$/$1 $md_size/;
-## 	s/^(#define EVP_MD_CTX_SIZE).*$/$1 $md_ctx_size/;
-## 	s/^(#define EVP_CIPHER_SIZE).*$/$1 $cipher_size/;
-## 	s/^(#define EVP_CIPHER_CTX_SIZE).*$/$1 $cipher_ctx_size/;
-## 	s/^(#define EVP_MAX_MD_SIZE).*$/$1 $max_md_size/;
-## 	print OUT "$_\n";
-## }
-## 
-## close (IN);
-## close (OUT);
-
-
-}
-
 print "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
 print "SIXTY_FOUR_BIT mode\n" if $b64;
 print "THIRTY_TWO_BIT mode\n" if $b32;
@@ -709,6 +533,12 @@
 print "BF_PTR used\n" if $bf_ptr == 1; 
 print "BF_PTR2 used\n" if $bf_ptr == 2; 
 
+if($IsWindows) {
+	open (OUT,">crypto/date.h") || die "Can't open date.h";
+	printf OUT "#define DATE \"%s\"\n", scalar gmtime();
+	close(OUT);
+}
+
 system 'make -f Makefile.ssl links' if !$IsWindows;
 
 exit(0);
@@ -727,19 +557,6 @@
 	print STDERR "\n";
 	}
 
-sub Rename
-	{
-	my($from,$to)=@_;
-	unlink($to);
-	if(!rename($from,$to))
-	    {
-	     -e $from && die "unable to rename $from to $to:$!\n";
-	    }
-	}
-
-sub file_new { my($a)=@_; $a =~ s/(\.[^.]+$|$)/.new/; $a; }
-sub file_old { my($a)=@_; $a =~ s/(\.[^.]+$|$)/.old/; $a; }
-
 sub which
 	{
 	my($name)=@_;