#!/usr/local/bin/perl
# A bit of an evil hack but it post processes the file ../MINFO which
# is generated by `make files` in the top directory.
# This script outputs one mega makefile that has no shell stuff or any
# funny stuff
#
$INSTALLTOP="/usr/local/ssl";
$OPTIONS="";
$ssl_version="";
$banner="\t\@echo Building OpenSSL";
open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n";
while(<IN>) {
$ssl_version=$1 if (/^VERSION=(.*)$/);
$OPTIONS=$1 if (/^OPTIONS=(.*)$/);
$INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/);
}
close(IN);
die "Makefile.ssl is not the toplevel Makefile!\n" if $ssl_version eq "";
$infile="MINFO";
%ops=(
"VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
"VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
"VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
"VC-WIN16", "Alias for VC-W31-32",
"VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+",
"VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS",
"Mingw32", "GNU C++ - Windows NT or 9x",
"Mingw32-files", "Create files with DOS copy ...",
"BC-NT", "Borland C++ 4.5 - Windows NT",
"BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING",
"BC-MSDOS","Borland C++ 4.5 - MSDOS",
"linux-elf","Linux elf",
"ultrix-mips","DEC mips ultrix",
"FreeBSD","FreeBSD distribution",
"OS2-EMX", "EMX GCC OS/2",
"default","cc under unix",
);
$platform="";
foreach (@ARGV)
{
if (!&read_options && !defined($ops{$_}))
{
print STDERR "unknown option - $_\n";
print STDERR "usage: perl mk1mf.pl [options] [system]\n";
print STDERR "\nwhere [system] can be one of the following\n";
foreach $i (sort keys %ops)
{ printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
print STDERR <<"EOF";
and [options] can be one of
no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
no-ripemd
no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
no-bf no-cast no-aes
no-rsa no-dsa no-dh - Skip this public key cipher
no-ssl2 no-ssl3 - Skip this version of SSL
just-ssl - remove all non-ssl keys/digest
no-asm - No x86 asm
no-krb5 - No KRB5
no-ec - No EC
no-ecdsa - No ECDSA
nasm - Use NASM for x86 asm
gaswin - Use GNU as with Mingw32
no-socks - No socket code
no-err - No error strings
dll/shlib - Build shared libraries (MS)
debug - Debug build
profile - Profiling build
gcc - Use Gcc (unix)
Values that can be set
TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
-L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
-<ex_cc_flags> - extra 'cc' flags,
added (MS), or replace (unix)
EOF
exit(1);
}
$platform=$_;
}
foreach (grep(!/^$/, split(/ /, $OPTIONS)))
{
print STDERR "unknown option - $_\n" if !&read_options;
}
$no_mdc2=1 if ($no_des);
$no_ssl3=1 if ($no_md5 || $no_sha);
$no_ssl3=1 if ($no_rsa && $no_dh);
$no_ssl2=1 if ($no_md5);
$no_ssl2=1 if ($no_rsa);
$out_def="out";
$inc_def="outinc";
$tmp_def="tmp";
$mkdir="-mkdir";
($ssl,$crypto)=("ssl","crypto");
$ranlib="echo ranlib";
$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
# $bin_dir.=$o causes a core dump on my sparc :-(
$NT=0;
push(@INC,"util/pl","pl");
if ($platform eq "VC-MSDOS")
{
$asmbits=16;
$msdos=1;
require 'VC-16.pl';
}
elsif ($platform eq "VC-W31-16")
{
$asmbits=16;
$msdos=1; $win16=1;
require 'VC-16.pl';
}
elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16"))
{
$asmbits=32;
$msdos=1; $win16=1;
require 'VC-16.pl';
}
elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
{
$NT = 1 if $platform eq "VC-NT";
require 'VC-32.pl';
}
elsif ($platform eq "Mingw32")
{
require 'Mingw32.pl';
}
elsif ($platform eq "Mingw32-files")
{
require 'Mingw32f.pl';
}
elsif ($platform eq "BC-NT")
{
$bc=1;
require 'BC-32.pl';
}
elsif ($platform eq "BC-W31")
{
$bc=1;
$msdos=1; $w16=1;
require 'BC-16.pl';
}
elsif ($platform eq "BC-Q16")
{
$msdos=1; $w16=1; $shlib=0; $qw=1;
require 'BC-16.pl';
}
elsif ($platform eq "BC-MSDOS")
{
$asmbits=16;
$msdos=1;
require 'BC-16.pl';
}
elsif