xref: /freebsd/crypto/openssl/Configure (revision 6a599222bb564010b80b78eef3f2b6ba6c8db14a)
174664626SKris Kennaway:
274664626SKris Kennawayeval 'exec perl -S $0 ${1+"$@"}'
374664626SKris Kennaway    if $running_under_some_shell;
474664626SKris Kennaway##
574664626SKris Kennaway##  Configure -- OpenSSL source tree configuration script
674664626SKris Kennaway##
774664626SKris Kennaway
874664626SKris Kennawayrequire 5.000;
9db522d3aSSimon L. B. Nielseneval 'use strict;';
10db522d3aSSimon L. B. Nielsen
11db522d3aSSimon L. B. Nielsenprint STDERR "Warning: perl module strict not found.\n" if ($@);
1274664626SKris Kennaway
1374664626SKris Kennaway# see INSTALL for instructions.
1474664626SKris Kennaway
15db522d3aSSimon L. B. Nielsenmy $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [enable-montasm] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
1674664626SKris Kennaway
1774664626SKris Kennaway# Options:
1874664626SKris Kennaway#
1974664626SKris Kennaway# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
2074664626SKris Kennaway#               --prefix option is given; /usr/local/ssl otherwise)
2174664626SKris Kennaway# --prefix      prefix for the OpenSSL include, lib and bin directories
2274664626SKris Kennaway#               (Default: the OPENSSLDIR directory)
2374664626SKris Kennaway#
2474664626SKris Kennaway# --install_prefix  Additional prefix for package builders (empty by
2574664626SKris Kennaway#               default).  This needn't be set in advance, you can
2674664626SKris Kennaway#               just as well use "make INSTALL_PREFIX=/whatever install".
2774664626SKris Kennaway#
285c87c606SMark Murray# --with-krb5-dir  Declare where Kerberos 5 lives.  The libraries are expected
295c87c606SMark Murray#		to live in the subdirectory lib/ and the header files in
305c87c606SMark Murray#		include/.  A value is required.
315c87c606SMark Murray# --with-krb5-lib  Declare where the Kerberos 5 libraries live.  A value is
325c87c606SMark Murray#		required.
335c87c606SMark Murray#		(Default: KRB5_DIR/lib)
345c87c606SMark Murray# --with-krb5-include  Declare where the Kerberos 5 header files live.  A
355c87c606SMark Murray#		value is required.
365c87c606SMark Murray#		(Default: KRB5_DIR/include)
375c87c606SMark Murray# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
385c87c606SMark Murray#		supported values are "MIT" and "Heimdal".  A value is required.
395c87c606SMark Murray#
40c1803d78SJacques Vidrine# --test-sanity Make a number of sanity checks on the data in this file.
41c1803d78SJacques Vidrine#               This is a debugging tool for OpenSSL developers.
42c1803d78SJacques Vidrine#
435c87c606SMark Murray# no-hw-xxx     do not compile support for specific crypto hardware.
445c87c606SMark Murray#               Generic OpenSSL-style methods relating to this support
455c87c606SMark Murray#               are always compiled but return NULL if the hardware
465c87c606SMark Murray#               support isn't compiled.
475c87c606SMark Murray# no-hw         do not compile support for any crypto hardware.
4874664626SKris Kennaway# [no-]threads  [don't] try to create a library that is suitable for
4974664626SKris Kennaway#               multithreaded applications (default is "threads" if we
5074664626SKris Kennaway#               know how to do it)
51ddd58736SKris Kennaway# [no-]shared	[don't] try to create shared libraries when supported.
5274664626SKris Kennaway# no-asm        do not use assembler
53ddd58736SKris Kennaway# no-dso        do not compile in any native shared-library methods. This
54ddd58736SKris Kennaway#               will ensure that all methods just return NULL.
555c87c606SMark Murray# no-krb5       do not compile in any KRB5 library or code.
565c87c606SMark Murray# [no-]zlib     [don't] compile support for zlib compression.
575c87c606SMark Murray# zlib-dynamic	Like "zlib", but the zlib library is expected to be a shared
585c87c606SMark Murray#		library and will be loaded in run-time by the OpenSSL library.
59db522d3aSSimon L. B. Nielsen# enable-montasm 0.9.8 branch only: enable Montgomery x86 assembler backport
60db522d3aSSimon L. B. Nielsen#               from 0.9.9
6174664626SKris Kennaway# 386           generate 80386 code
623b4e3dcbSSimon L. B. Nielsen# no-sse2	disables IA-32 SSE2 code, above option implies no-sse2
6374664626SKris Kennaway# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
6474664626SKris Kennaway# -<xxx> +<xxx> compiler options are passed through
6574664626SKris Kennaway#
66ddd58736SKris Kennaway# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
67ddd58736SKris Kennaway#		provided to stack calls. Generates unique stack functions for
68ddd58736SKris Kennaway#		each possible stack type.
6974664626SKris Kennaway# DES_PTR	use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
7074664626SKris Kennaway# DES_RISC1	use different DES_ENCRYPT macro that helps reduce register
7174664626SKris Kennaway#		dependancies but needs to more registers, good for RISC CPU's
7274664626SKris Kennaway# DES_RISC2	A different RISC variant.
7374664626SKris Kennaway# DES_UNROLL	unroll the inner DES loop, sometimes helps, somtimes hinders.
7474664626SKris Kennaway# DES_INT	use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
7574664626SKris Kennaway#		This is used on the DEC Alpha where long is 8 bytes
7674664626SKris Kennaway#		and int is 4
7774664626SKris Kennaway# BN_LLONG	use the type 'long long' in crypto/bn/bn.h
7874664626SKris Kennaway# MD2_CHAR	use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
7974664626SKris Kennaway# MD2_LONG	use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
8074664626SKris Kennaway# IDEA_SHORT	use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8174664626SKris Kennaway# IDEA_LONG	use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8274664626SKris Kennaway# RC2_SHORT	use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8374664626SKris Kennaway# RC2_LONG	use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8474664626SKris Kennaway# RC4_CHAR	use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8574664626SKris Kennaway# RC4_LONG	use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8674664626SKris Kennaway# RC4_INDEX	define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
8774664626SKris Kennaway#		array lookups instead of pointer use.
88f579bf8eSKris Kennaway# RC4_CHUNK	enables code that handles data aligned at long (natural CPU
89f579bf8eSKris Kennaway#		word) boundary.
90f579bf8eSKris Kennaway# RC4_CHUNK_LL	enables code that handles data aligned at long long boundary
91f579bf8eSKris Kennaway#		(intended for 64-bit CPUs running 32-bit OS).
9274664626SKris Kennaway# BF_PTR	use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
9374664626SKris Kennaway# BF_PTR2	intel specific version (generic version is more efficient).
943b4e3dcbSSimon L. B. Nielsen#
953b4e3dcbSSimon L. B. Nielsen# Following are set automatically by this script
963b4e3dcbSSimon L. B. Nielsen#
9774664626SKris Kennaway# MD5_ASM	use some extra md5 assember,
9874664626SKris Kennaway# SHA1_ASM	use some extra sha1 assember, must define L_ENDIAN for x86
9974664626SKris Kennaway# RMD160_ASM	use some extra ripemd160 assember,
1003b4e3dcbSSimon L. B. Nielsen# SHA256_ASM	sha256_block is implemented in assembler
1013b4e3dcbSSimon L. B. Nielsen# SHA512_ASM	sha512_block is implemented in assembler
1023b4e3dcbSSimon L. B. Nielsen# AES_ASM	ASE_[en|de]crypt is implemented in assembler
10374664626SKris Kennaway
104db522d3aSSimon L. B. Nielsen# Minimum warning options... any contributions to OpenSSL should at least get
105db522d3aSSimon L. B. Nielsen# past these.
106db522d3aSSimon L. B. Nielsen
107db522d3aSSimon L. B. Nielsenmy $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
108db522d3aSSimon L. B. Nielsen
1096a599222SSimon L. B. Nielsenmy $strict_warnings = 0;
1106a599222SSimon L. B. Nielsen
11174664626SKris Kennawaymy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
11274664626SKris Kennaway
11374664626SKris Kennaway# MD2_CHAR slags pentium pros
11474664626SKris Kennawaymy $x86_gcc_opts="RC4_INDEX MD2_INT";
11574664626SKris Kennaway
11674664626SKris Kennaway# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
11774664626SKris Kennaway# Don't worry about these normally
11874664626SKris Kennaway
11974664626SKris Kennawaymy $tcc="cc";
12074664626SKris Kennawaymy $tflags="-fast -Xa";
12174664626SKris Kennawaymy $tbn_mul="";
12274664626SKris Kennawaymy $tlib="-lnsl -lsocket";
12374664626SKris Kennaway#$bits1="SIXTEEN_BIT ";
12474664626SKris Kennaway#$bits2="THIRTY_TWO_BIT ";
12574664626SKris Kennawaymy $bits1="THIRTY_TWO_BIT ";
12674664626SKris Kennawaymy $bits2="SIXTY_FOUR_BIT ";
12774664626SKris Kennaway
128db522d3aSSimon L. B. Nielsenmy $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o MAYBE-MO86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o rc4_skey.o:rm86-elf.o:r586-elf.o";
129db522d3aSSimon L. B. Nielsenmy $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o MAYBE-MO86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o rc4_skey.o:rm86-cof.o:r586-cof.o";
130db522d3aSSimon L. B. Nielsenmy $x86_out_asm="x86cpuid-out.o:bn86-out.o co86-out.o MAYBE-MO86-out.o:dx86-out.o yx86-out.o:ax86-out.o:bx86-out.o:mx86-out.o:sx86-out.o s512sse2-out.o:cx86-out.o:rx86-out.o rc4_skey.o:rm86-out.o:r586-out.o";
13174664626SKris Kennaway
132db522d3aSSimon L. B. Nielsenmy $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o::";
133db522d3aSSimon L. B. Nielsenmy $ia64_asm=":bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o:::sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o::";
1345740a5e3SKris Kennaway
1353b4e3dcbSSimon L. B. Nielsenmy $no_asm="::::::::::";
13674664626SKris Kennaway
1373b4e3dcbSSimon L. B. Nielsen# As for $BSDthreads. Idea is to maintain "collective" set of flags,
1383b4e3dcbSSimon L. B. Nielsen# which would cover all BSD flavors. -pthread applies to them all,
1393b4e3dcbSSimon L. B. Nielsen# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
1403b4e3dcbSSimon L. B. Nielsen# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
1413b4e3dcbSSimon L. B. Nielsen# which has to be accompanied by explicit -D_THREAD_SAFE and
1423b4e3dcbSSimon L. B. Nielsen# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
1433b4e3dcbSSimon L. B. Nielsen# seems to be sufficient?
1443b4e3dcbSSimon L. B. Nielsenmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
1453b4e3dcbSSimon L. B. Nielsen
1463b4e3dcbSSimon L. B. Nielsen#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags
147f579bf8eSKris Kennaway
14874664626SKris Kennawaymy %table=(
149ddd58736SKris Kennaway# File 'TABLE' (created by 'make TABLE') contains the data from this list,
150ddd58736SKris Kennaway# formatted for better readability.
151ddd58736SKris Kennaway
152ddd58736SKris Kennaway
153f579bf8eSKris Kennaway#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
154f579bf8eSKris Kennaway#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
155f579bf8eSKris Kennaway#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
156f579bf8eSKris Kennaway#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
15774664626SKris Kennaway
15874664626SKris Kennaway# Our development configs
1595c87c606SMark Murray"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
1605c87c606SMark Murray"debug",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
1613b4e3dcbSSimon L. B. Nielsen"debug-ben",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::bn86-elf.o co86-elf.o",
1625c87c606SMark Murray"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
1635c87c606SMark Murray"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
1646a599222SSimon L. B. Nielsen"debug-ben-debug",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG  -DDEBUG_SAFESTACK -ggdb3 -O2 -pipe::(unknown)::::::",
1656a599222SSimon L. B. Nielsen"debug-ben-debug-noopt",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG  -DDEBUG_SAFESTACK -ggdb3 -pipe::(unknown)::::::",
1665c87c606SMark Murray"debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
1675c87c606SMark Murray"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
168db522d3aSSimon L. B. Nielsen"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
1693b4e3dcbSSimon L. B. Nielsen"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
1706a599222SSimon L. B. Nielsen"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
171db522d3aSSimon L. B. Nielsen"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1726a599222SSimon L. B. Nielsen"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
173db522d3aSSimon L. B. Nielsen"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
1743b4e3dcbSSimon L. B. Nielsen"debug-steve-linux-pseudo64",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
1753b4e3dcbSSimon L. B. Nielsen"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1763b4e3dcbSSimon L. B. Nielsen"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1773b4e3dcbSSimon L. B. Nielsen"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1783b4e3dcbSSimon L. B. Nielsen"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1793b4e3dcbSSimon L. B. Nielsen"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1803b4e3dcbSSimon L. B. Nielsen"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
1813b4e3dcbSSimon L. B. Nielsen"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
1823b4e3dcbSSimon L. B. Nielsen"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1833b4e3dcbSSimon L. B. Nielsen"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1846a599222SSimon L. B. Nielsen"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO  -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1856a599222SSimon L. B. Nielsen"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1866a599222SSimon L. B. Nielsen"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -g -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1875c87c606SMark Murray"dist",		"cc:-O::(unknown)::::::",
18874664626SKris Kennaway
189f579bf8eSKris Kennaway# Basic configs that should work on any (32 and less bit) box
1905c87c606SMark Murray"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
1915c87c606SMark Murray"cc",		"cc:-O::(unknown)::::::",
19274664626SKris Kennaway
1936be8ae07SJacques Vidrine####VOS Configurations
1943b4e3dcbSSimon L. B. Nielsen"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
1953b4e3dcbSSimon L. B. Nielsen"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
1966be8ae07SJacques Vidrine
1975c87c606SMark Murray#### Solaris x86 with GNU C setups
1985c87c606SMark Murray# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
199f579bf8eSKris Kennaway# here because whenever GNU C instantiates an assembler template it
200f579bf8eSKris Kennaway# surrounds it with #APP #NO_APP comment pair which (at least Solaris
201f579bf8eSKris Kennaway# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
202f579bf8eSKris Kennaway# error message.
2033b4e3dcbSSimon L. B. Nielsen"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2043b4e3dcbSSimon L. B. Nielsen# -shared -static-libgcc might appear controversial, but modules taken
2053b4e3dcbSSimon L. B. Nielsen# from static libgcc do not have relocations and linking them into our
2063b4e3dcbSSimon L. B. Nielsen# shared objects doesn't have any negative side-effects. On the contrary,
2073b4e3dcbSSimon L. B. Nielsen# doing so makes it possible to use gcc shared build with Sun C. Given
2083b4e3dcbSSimon L. B. Nielsen# that gcc generates faster code [thanks to inline assembler], I would
2093b4e3dcbSSimon L. B. Nielsen# actually recommend to consider using gcc shared build even with vendor
2103b4e3dcbSSimon L. B. Nielsen# compiler:-)
2113b4e3dcbSSimon L. B. Nielsen#						<appro@fy.chalmers.se>
2126a599222SSimon L. B. Nielsen"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
21374664626SKris Kennaway
21426d191b4SKris Kennaway#### Solaris x86 with Sun C setups
2153b4e3dcbSSimon L. B. Nielsen"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2166a599222SSimon L. B. Nielsen"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
21726d191b4SKris Kennaway
21874664626SKris Kennaway#### SPARC Solaris with GNU C setups
2193b4e3dcbSSimon L. B. Nielsen"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2203b4e3dcbSSimon L. B. Nielsen"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2215c87c606SMark Murray# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
222db522d3aSSimon L. B. Nielsen"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
223db522d3aSSimon L. B. Nielsen"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
22474664626SKris Kennaway####
2253b4e3dcbSSimon L. B. Nielsen"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
226db522d3aSSimon L. B. Nielsen"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
22774664626SKris Kennaway
22874664626SKris Kennaway#### SPARC Solaris with Sun C setups
22974664626SKris Kennaway# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
23074664626SKris Kennaway# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
23174664626SKris Kennaway# SC5.0 note: Compiler common patch 107357-01 or later is required!
2323b4e3dcbSSimon L. B. Nielsen"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2333b4e3dcbSSimon L. B. Nielsen"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
234db522d3aSSimon L. B. Nielsen"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
235db522d3aSSimon L. B. Nielsen"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
236f579bf8eSKris Kennaway####
2373b4e3dcbSSimon L. B. Nielsen"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
238db522d3aSSimon L. B. Nielsen"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
23974664626SKris Kennaway
2403b4e3dcbSSimon L. B. Nielsen#### SunOS configs, assuming sparc for the gcc one.
2413b4e3dcbSSimon L. B. Nielsen#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
2423b4e3dcbSSimon L. B. Nielsen"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
24374664626SKris Kennaway
24474664626SKris Kennaway#### IRIX 5.x configs
24574664626SKris Kennaway# -mips2 flag is added by ./config when appropriate.
2463b4e3dcbSSimon L. B. Nielsen"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2473b4e3dcbSSimon L. B. Nielsen"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
24874664626SKris Kennaway#### IRIX 6.x configs
24974664626SKris Kennaway# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
250ced566fdSJacques Vidrine# './Configure irix-cc -o32' manually.
2513b4e3dcbSSimon L. B. Nielsen"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
252db522d3aSSimon L. B. Nielsen"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
25374664626SKris Kennaway# N64 ABI builds.
2543b4e3dcbSSimon L. B. Nielsen"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
255db522d3aSSimon L. B. Nielsen"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
256f579bf8eSKris Kennaway
257f579bf8eSKris Kennaway#### Unified HP-UX ANSI C configs.
258f579bf8eSKris Kennaway# Special notes:
259f579bf8eSKris Kennaway# - Originally we were optimizing at +O4 level. It should be noted
260f579bf8eSKris Kennaway#   that the only difference between +O3 and +O4 is global inter-
261f579bf8eSKris Kennaway#   procedural analysis. As it has to be performed during the link
262f579bf8eSKris Kennaway#   stage the compiler leaves behind certain pseudo-code in lib*.a
263f579bf8eSKris Kennaway#   which might be release or even patch level specific. Generating
264f579bf8eSKris Kennaway#   the machine code for and analyzing the *whole* program appears
265f579bf8eSKris Kennaway#   to be *extremely* memory demanding while the performance gain is
266f579bf8eSKris Kennaway#   actually questionable. The situation is intensified by the default
267f579bf8eSKris Kennaway#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
268f579bf8eSKris Kennaway#   which is way too low for +O4. In other words, doesn't +O3 make
269f579bf8eSKris Kennaway#   more sense?
270f579bf8eSKris Kennaway# - Keep in mind that the HP compiler by default generates code
271f579bf8eSKris Kennaway#   suitable for execution on the host you're currently compiling at.
272f579bf8eSKris Kennaway#   If the toolkit is ment to be used on various PA-RISC processors
2735c87c606SMark Murray#   consider './config +DAportable'.
2743b4e3dcbSSimon L. B. Nielsen# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
275f579bf8eSKris Kennaway#   compatible with *future* releases.
276f579bf8eSKris Kennaway# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
277f579bf8eSKris Kennaway#   pass -D_REENTRANT on HP-UX 10 and later.
278f579bf8eSKris Kennaway# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
279f579bf8eSKris Kennaway#   32-bit message digests. (For the moment of this writing) HP C
280f579bf8eSKris Kennaway#   doesn't seem to "digest" too many local variables (they make "him"
281f579bf8eSKris Kennaway#   chew forever:-). For more details look-up MD32_XARRAY comment in
282f579bf8eSKris Kennaway#   crypto/sha/sha_lcl.h.
283f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
284f579bf8eSKris Kennaway#
285f579bf8eSKris Kennaway# Since there is mention of this in shlib/hpux10-cc.sh
2863b4e3dcbSSimon L. B. Nielsen"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2873b4e3dcbSSimon L. B. Nielsen"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2883b4e3dcbSSimon L. B. Nielsen"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2893b4e3dcbSSimon L. B. Nielsen"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
290ddd58736SKris Kennaway
291ddd58736SKris Kennaway# More attempts at unified 10.X and 11.X targets for HP C compiler.
292ddd58736SKris Kennaway#
293ddd58736SKris Kennaway# Chris Ruemmler <ruemmler@cup.hp.com>
294ddd58736SKris Kennaway# Kevin Steves <ks@hp.se>
2953b4e3dcbSSimon L. B. Nielsen"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2963b4e3dcbSSimon L. B. Nielsen"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2973b4e3dcbSSimon L. B. Nielsen"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2983b4e3dcbSSimon L. B. Nielsen"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
29974664626SKris Kennaway
3003b4e3dcbSSimon L. B. Nielsen# HP/UX IA-64 targets
3013b4e3dcbSSimon L. B. Nielsen"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3023b4e3dcbSSimon L. B. Nielsen# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
3033b4e3dcbSSimon L. B. Nielsen# with debugging of the following config.
3043b4e3dcbSSimon L. B. Nielsen"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3053b4e3dcbSSimon L. B. Nielsen# GCC builds...
306ed5d4f9aSSimon L. B. Nielsen"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3073b4e3dcbSSimon L. B. Nielsen"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
30874664626SKris Kennaway
3093b4e3dcbSSimon L. B. Nielsen# Legacy HPUX 9.X configs...
3103b4e3dcbSSimon L. B. Nielsen"hpux-cc",	"cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3113b4e3dcbSSimon L. B. Nielsen"hpux-gcc",	"gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
31274664626SKris Kennaway
313ddd58736SKris Kennaway#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
3145c87c606SMark Murray"MPE/iX-gcc",	"gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
315ddd58736SKris Kennaway
3163b4e3dcbSSimon L. B. Nielsen# DEC Alpha OSF/1/Tru64 targets.
317a21b1b38SKris Kennaway#
318a21b1b38SKris Kennaway#	"What's in a name? That which we call a rose
319a21b1b38SKris Kennaway#	 By any other word would smell as sweet."
320a21b1b38SKris Kennaway#
321a21b1b38SKris Kennaway# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
322a21b1b38SKris Kennaway#
32374664626SKris Kennaway# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
324a21b1b38SKris Kennaway#
3253b4e3dcbSSimon L. B. Nielsen"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
3263b4e3dcbSSimon L. B. Nielsen"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
3273b4e3dcbSSimon L. B. Nielsen"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared::-msym:.so",
328f579bf8eSKris Kennaway
3293b4e3dcbSSimon L. B. Nielsen####
3303b4e3dcbSSimon L. B. Nielsen#### Variety of LINUX:-)
3313b4e3dcbSSimon L. B. Nielsen####
3323b4e3dcbSSimon L. B. Nielsen# *-generic* is endian-neutral target, but ./config is free to
3333b4e3dcbSSimon L. B. Nielsen# throw in -D[BL]_ENDIAN, whichever appropriate...
3343b4e3dcbSSimon L. B. Nielsen"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3353b4e3dcbSSimon L. B. Nielsen"linux-ppc",	"gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc32.o::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3363b4e3dcbSSimon L. B. Nielsen#### IA-32 targets...
3373b4e3dcbSSimon L. B. Nielsen"linux-ia32-icc",	"icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3383b4e3dcbSSimon L. B. Nielsen"linux-elf",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3393b4e3dcbSSimon L. B. Nielsen"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
3403b4e3dcbSSimon L. B. Nielsen####
3413b4e3dcbSSimon L. B. Nielsen"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
342db522d3aSSimon L. B. Nielsen"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3433b4e3dcbSSimon L. B. Nielsen"linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3443b4e3dcbSSimon L. B. Nielsen"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3453b4e3dcbSSimon L. B. Nielsen"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3466a599222SSimon L. B. Nielsen"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3473b4e3dcbSSimon L. B. Nielsen#### SPARC Linux setups
3483b4e3dcbSSimon L. B. Nielsen# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
3493b4e3dcbSSimon L. B. Nielsen# assisted with debugging of following two configs.
3503b4e3dcbSSimon L. B. Nielsen"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3513b4e3dcbSSimon L. B. Nielsen# it's a real mess with -mcpu=ultrasparc option under Linux, but
3523b4e3dcbSSimon L. B. Nielsen# -Wa,-Av8plus should do the trick no matter what.
353db522d3aSSimon L. B. Nielsen"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3543b4e3dcbSSimon L. B. Nielsen# GCC 3.1 is a requirement
355db522d3aSSimon L. B. Nielsen"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
356f579bf8eSKris Kennaway#### Alpha Linux with GNU C and Compaq C setups
357f579bf8eSKris Kennaway# Special notes:
358f579bf8eSKris Kennaway# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
359f579bf8eSKris Kennaway#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
360f579bf8eSKris Kennaway#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
361f579bf8eSKris Kennaway#   which is appropriate.
362f579bf8eSKris Kennaway# - If you use ccc keep in mind that -fast implies -arch host and the
363f579bf8eSKris Kennaway#   compiler is free to issue instructions which gonna make elder CPU
364f579bf8eSKris Kennaway#   choke. If you wish to build "blended" toolkit, add -arch generic
365f579bf8eSKris Kennaway#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
366f579bf8eSKris Kennaway#
367f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
368f579bf8eSKris Kennaway#
3693b4e3dcbSSimon L. B. Nielsen"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3703b4e3dcbSSimon L. B. Nielsen"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3713b4e3dcbSSimon L. B. Nielsen"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
3723b4e3dcbSSimon L. B. Nielsen"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
37374664626SKris Kennaway
3743b4e3dcbSSimon L. B. Nielsen#### *BSD [do see comment about ${BSDthreads} above!]
3753b4e3dcbSSimon L. B. Nielsen"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3763b4e3dcbSSimon L. B. Nielsen"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3773b4e3dcbSSimon L. B. Nielsen"BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3783b4e3dcbSSimon L. B. Nielsen"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3793b4e3dcbSSimon L. B. Nielsen"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
38074664626SKris Kennaway
3813b4e3dcbSSimon L. B. Nielsen"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3823b4e3dcbSSimon L. B. Nielsen# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
3833b4e3dcbSSimon L. B. Nielsen# simply *happens* to work around a compiler bug in gcc 3.3.3,
3843b4e3dcbSSimon L. B. Nielsen# triggered by RIPEMD160 code.
385db522d3aSSimon L. B. Nielsen"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3863b4e3dcbSSimon L. B. Nielsen"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3873b4e3dcbSSimon L. B. Nielsen"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3883b4e3dcbSSimon L. B. Nielsen
3893b4e3dcbSSimon L. B. Nielsen"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3903b4e3dcbSSimon L. B. Nielsen
3915c87c606SMark Murray"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
3925c87c606SMark Murray"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
3935c87c606SMark Murray
39474664626SKris Kennaway# NCR MP-RAS UNIX ver 02.03.01
395fceca8a3SJacques Vidrine"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
39674664626SKris Kennaway
3973b4e3dcbSSimon L. B. Nielsen# QNX
3985c87c606SMark Murray"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
3996a599222SSimon L. B. Nielsen"QNX6",       "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4006a599222SSimon L. B. Nielsen"QNX6-i386",  "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
401a21b1b38SKris Kennaway
4023b4e3dcbSSimon L. B. Nielsen#### SCO/Caldera targets.
403fceca8a3SJacques Vidrine#
404fceca8a3SJacques Vidrine# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
405fceca8a3SJacques Vidrine# Now we only have blended unixware-* as it's the only one used by ./config.
406fceca8a3SJacques Vidrine# If you want to optimize for particular microarchitecture, bypass ./config
407fceca8a3SJacques Vidrine# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
408fceca8a3SJacques Vidrine# Note that not all targets include assembler support. Mostly because of
409fceca8a3SJacques Vidrine# lack of motivation to support out-of-date platforms with out-of-date
410fceca8a3SJacques Vidrine# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
411fceca8a3SJacques Vidrine# patiently assisted to debug most of it.
412fceca8a3SJacques Vidrine#
4133b4e3dcbSSimon L. B. Nielsen# UnixWare 2.0x fails destest with -O.
4145c87c606SMark Murray"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
4155c87c606SMark Murray"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
416fceca8a3SJacques Vidrine"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4173b4e3dcbSSimon L. B. Nielsen"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
418fceca8a3SJacques Vidrine# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
419fceca8a3SJacques Vidrine"sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
420fceca8a3SJacques Vidrine"sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
42174664626SKris Kennaway
4223b4e3dcbSSimon L. B. Nielsen#### IBM's AIX.
4233b4e3dcbSSimon L. B. Nielsen"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
424db522d3aSSimon L. B. Nielsen"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
425db522d3aSSimon L. B. Nielsen"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
4263b4e3dcbSSimon L. B. Nielsen# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
4273b4e3dcbSSimon L. B. Nielsen# at build time. $OBJECT_MODE is respected at ./config stage!
428db522d3aSSimon L. B. Nielsen"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
429db522d3aSSimon L. B. Nielsen"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
43074664626SKris Kennaway
43174664626SKris Kennaway#
432c1803d78SJacques Vidrine# Cray T90 and similar (SDSC)
43374664626SKris Kennaway# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
43474664626SKris Kennaway# defined.  The T90 ints and longs are 8 bytes long, and apparently the
43574664626SKris Kennaway# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
43674664626SKris Kennaway# non L_ENDIAN code aligns the bytes in each word correctly.
43774664626SKris Kennaway#
43874664626SKris Kennaway# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
43974664626SKris Kennaway#'Taking the address of a bit field is not allowed. '
44074664626SKris Kennaway#'An expression with bit field exists as the operand of "sizeof" '
44174664626SKris Kennaway# (written by Wayne Schroeder <schroede@SDSC.EDU>)
442c1803d78SJacques Vidrine#
443c1803d78SJacques Vidrine# j90 is considered the base machine type for unicos machines,
444c1803d78SJacques Vidrine# so this configuration is now called "cray-j90" ...
4455c87c606SMark Murray"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
44674664626SKris Kennaway
44774664626SKris Kennaway#
44874664626SKris Kennaway# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
44974664626SKris Kennaway#
45074664626SKris Kennaway# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
45174664626SKris Kennaway# another use.  Basically, the problem is that the T3E uses some bit fields
45274664626SKris Kennaway# for some st_addr stuff, and then sizeof and address-of fails
45374664626SKris Kennaway# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
45474664626SKris Kennaway# did not like it.
4555c87c606SMark Murray"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
45674664626SKris Kennaway
45774664626SKris Kennaway# DGUX, 88100.
4585c87c606SMark Murray"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
4595c87c606SMark Murray"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
4605c87c606SMark Murray"dgux-R4-x86-gcc",	"gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
46174664626SKris Kennaway
46274664626SKris Kennaway# Sinix/ReliantUNIX RM400
46374664626SKris Kennaway# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
4643b4e3dcbSSimon L. B. Nielsen"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:reliantunix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4655c87c606SMark Murray"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
4665c87c606SMark Murray"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
46774664626SKris Kennaway
46874664626SKris Kennaway# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
4695c87c606SMark Murray"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
47074664626SKris Kennaway
471a21b1b38SKris Kennaway# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
472a21b1b38SKris Kennaway# You need to compile using the c89.sh wrapper in the tools directory, because the
473a21b1b38SKris Kennaway# IBM compiler does not like the -L switch after any object modules.
474a21b1b38SKris Kennaway#
4755c87c606SMark Murray"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
476a21b1b38SKris Kennaway
4773b4e3dcbSSimon L. B. Nielsen# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
4783b4e3dcbSSimon L. B. Nielsen"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
4793b4e3dcbSSimon L. B. Nielsen"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
48074664626SKris Kennaway
4813b4e3dcbSSimon L. B. Nielsen# Visual C targets
4823b4e3dcbSSimon L. B. Nielsen"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
4833b4e3dcbSSimon L. B. Nielsen"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
4843b4e3dcbSSimon L. B. Nielsen"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
48574664626SKris Kennaway
48674664626SKris Kennaway# Borland C++ 4.5
4873b4e3dcbSSimon L. B. Nielsen"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
48874664626SKris Kennaway
48950ef0093SJacques Vidrine# MinGW
4903b4e3dcbSSimon L. B. Nielsen"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
491ddd58736SKris Kennaway
4924f20a5a2SJacques Vidrine# UWIN
4933b4e3dcbSSimon L. B. Nielsen"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
4944f20a5a2SJacques Vidrine
495c1803d78SJacques Vidrine# Cygwin
4963b4e3dcbSSimon L. B. Nielsen"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
4973b4e3dcbSSimon L. B. Nielsen"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
4983b4e3dcbSSimon L. B. Nielsen"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
4993b4e3dcbSSimon L. B. Nielsen
500db522d3aSSimon L. B. Nielsen# NetWare from David Ward (dsward@novell.com)
501db522d3aSSimon L. B. Nielsen# requires either MetroWerks NLM development tools, or gcc / nlmconv
502db522d3aSSimon L. B. Nielsen# NetWare defaults socket bio to WinSock sockets. However,
503db522d3aSSimon L. B. Nielsen# the builds can be configured to use BSD sockets instead.
5043b4e3dcbSSimon L. B. Nielsen# netware-clib => legacy CLib c-runtime support
505db522d3aSSimon L. B. Nielsen"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
506db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
507db522d3aSSimon L. B. Nielsen"netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
508db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
5093b4e3dcbSSimon L. B. Nielsen# netware-libc => LibC/NKS support
5103b4e3dcbSSimon L. B. Nielsen"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
5113b4e3dcbSSimon L. B. Nielsen"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
5123b4e3dcbSSimon L. B. Nielsen"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
513db522d3aSSimon L. B. Nielsen"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
5145c87c606SMark Murray
5155c87c606SMark Murray# DJGPP
5163b4e3dcbSSimon L. B. Nielsen"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:",
51774664626SKris Kennaway
51874664626SKris Kennaway# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
5195c87c606SMark Murray"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
5203b4e3dcbSSimon L. B. Nielsen"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
52174664626SKris Kennaway# K&R C is no longer supported; you need gcc on old Ultrix installations
5225c87c606SMark Murray##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
52374664626SKris Kennaway
524a21b1b38SKris Kennaway##### MacOS X (a.k.a. Rhapsody or Darwin) setup
5253b4e3dcbSSimon L. B. Nielsen"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
526db522d3aSSimon L. B. Nielsen"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
527db522d3aSSimon L. B. Nielsen"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc64.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
528db522d3aSSimon L. B. Nielsen"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
529db522d3aSSimon L. B. Nielsen"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
5306a599222SSimon L. B. Nielsen"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
5313b4e3dcbSSimon L. B. Nielsen"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
5325c87c606SMark Murray
5335c87c606SMark Murray##### A/UX
5345c87c606SMark Murray"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
535f579bf8eSKris Kennaway
536ddd58736SKris Kennaway##### Sony NEWS-OS 4.x
5375c87c606SMark Murray"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
5385c87c606SMark Murray
5395c87c606SMark Murray##### GNU Hurd
5403b4e3dcbSSimon L. B. Nielsen"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
5415c87c606SMark Murray
5425c87c606SMark Murray##### OS/2 EMX
5435c87c606SMark Murray"OS2-EMX", "gcc::::::::",
544ddd58736SKris Kennaway
545c1803d78SJacques Vidrine##### VxWorks for various targets
5465c87c606SMark Murray"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
5475c87c606SMark Murray"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
5483b4e3dcbSSimon L. B. Nielsen"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
54950ef0093SJacques Vidrine"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
5503b4e3dcbSSimon L. B. Nielsen"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::${no_asm}::::::ranlibmips:",
5515c87c606SMark Murray
5525c87c606SMark Murray##### Compaq Non-Stop Kernel (Tandem)
5535c87c606SMark Murray"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
554c1803d78SJacques Vidrine
55574664626SKris Kennaway);
55674664626SKris Kennaway
5573b4e3dcbSSimon L. B. Nielsenmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
5583b4e3dcbSSimon L. B. Nielsen		    VC-NT VC-CE VC-WIN32
559db522d3aSSimon L. B. Nielsen		    BC-32 OS2-EMX
560db522d3aSSimon L. B. Nielsen		    netware-clib netware-clib-bsdsock
561db522d3aSSimon L. B. Nielsen		    netware-libc netware-libc-bsdsock);
56274664626SKris Kennaway
563c1803d78SJacques Vidrinemy $idx = 0;
564c1803d78SJacques Vidrinemy $idx_cc = $idx++;
565c1803d78SJacques Vidrinemy $idx_cflags = $idx++;
566c1803d78SJacques Vidrinemy $idx_unistd = $idx++;
567c1803d78SJacques Vidrinemy $idx_thread_cflag = $idx++;
5685c87c606SMark Murraymy $idx_sys_id = $idx++;
569c1803d78SJacques Vidrinemy $idx_lflags = $idx++;
570c1803d78SJacques Vidrinemy $idx_bn_ops = $idx++;
5713b4e3dcbSSimon L. B. Nielsenmy $idx_cpuid_obj = $idx++;
572c1803d78SJacques Vidrinemy $idx_bn_obj = $idx++;
573c1803d78SJacques Vidrinemy $idx_des_obj = $idx++;
5743b4e3dcbSSimon L. B. Nielsenmy $idx_aes_obj = $idx++;
575c1803d78SJacques Vidrinemy $idx_bf_obj = $idx++;
576c1803d78SJacques Vidrinemy $idx_md5_obj = $idx++;
577c1803d78SJacques Vidrinemy $idx_sha1_obj = $idx++;
578c1803d78SJacques Vidrinemy $idx_cast_obj = $idx++;
579c1803d78SJacques Vidrinemy $idx_rc4_obj = $idx++;
580c1803d78SJacques Vidrinemy $idx_rmd160_obj = $idx++;
581c1803d78SJacques Vidrinemy $idx_rc5_obj = $idx++;
582c1803d78SJacques Vidrinemy $idx_dso_scheme = $idx++;
583c1803d78SJacques Vidrinemy $idx_shared_target = $idx++;
584c1803d78SJacques Vidrinemy $idx_shared_cflag = $idx++;
585c1803d78SJacques Vidrinemy $idx_shared_ldflag = $idx++;
586c1803d78SJacques Vidrinemy $idx_shared_extension = $idx++;
587c1803d78SJacques Vidrinemy $idx_ranlib = $idx++;
5885c87c606SMark Murraymy $idx_arflags = $idx++;
589c1803d78SJacques Vidrine
59074664626SKris Kennawaymy $prefix="";
5916a599222SSimon L. B. Nielsenmy $libdir="";
59274664626SKris Kennawaymy $openssldir="";
5935740a5e3SKris Kennawaymy $exe_ext="";
5946a599222SSimon L. B. Nielsenmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
5956a599222SSimon L. B. Nielsenmy $cross_compile_prefix="";
596db522d3aSSimon L. B. Nielsenmy $fipslibdir="/usr/local/ssl/fips-1.0/lib/";
597db522d3aSSimon L. B. Nielsenmy $nofipscanistercheck=0;
598db522d3aSSimon L. B. Nielsenmy $fipsdso=0;
599db522d3aSSimon L. B. Nielsenmy $fipscanisterinternal="n";
600db522d3aSSimon L. B. Nielsenmy $baseaddr="0xFB00000";
60174664626SKris Kennawaymy $no_threads=0;
60274664626SKris Kennawaymy $threads=0;
6033b4e3dcbSSimon L. B. Nielsenmy $no_shared=0; # but "no-shared" is default
6043b4e3dcbSSimon L. B. Nielsenmy $zlib=1;      # but "no-zlib" is default
6053b4e3dcbSSimon L. B. Nielsenmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
6065471f83eSSimon L. B. Nielsenmy $no_rfc3779=1; # but "no-rfc3779" is default
607db522d3aSSimon L. B. Nielsenmy $montasm=1;   # but "no-montasm" is default
60874664626SKris Kennawaymy $no_asm=0;
609ddd58736SKris Kennawaymy $no_dso=0;
6103b4e3dcbSSimon L. B. Nielsenmy $no_gmp=0;
61174664626SKris Kennawaymy @skip=();
6126be8ae07SJacques Vidrinemy $Makefile="Makefile";
61374664626SKris Kennawaymy $des_locl="crypto/des/des_locl.h";
61474664626SKris Kennawaymy $des	="crypto/des/des.h";
61574664626SKris Kennawaymy $bn	="crypto/bn/bn.h";
61674664626SKris Kennawaymy $md2	="crypto/md2/md2.h";
61774664626SKris Kennawaymy $rc4	="crypto/rc4/rc4.h";
61874664626SKris Kennawaymy $rc4_locl="crypto/rc4/rc4_locl.h";
61974664626SKris Kennawaymy $idea	="crypto/idea/idea.h";
62074664626SKris Kennawaymy $rc2	="crypto/rc2/rc2.h";
62174664626SKris Kennawaymy $bf	="crypto/bf/bf_locl.h";
62274664626SKris Kennawaymy $bn_asm	="bn_asm.o";
62374664626SKris Kennawaymy $des_enc="des_enc.o fcrypt_b.o";
624db522d3aSSimon L. B. Nielsenmy $fips_des_enc="fips_des_enc.o";
6253b4e3dcbSSimon L. B. Nielsenmy $aes_enc="aes_core.o aes_cbc.o";
62674664626SKris Kennawaymy $bf_enc	="bf_enc.o";
62774664626SKris Kennawaymy $cast_enc="c_enc.o";
628db522d3aSSimon L. B. Nielsenmy $rc4_enc="rc4_enc.o rc4_skey.o";
62974664626SKris Kennawaymy $rc5_enc="rc5_enc.o";
63074664626SKris Kennawaymy $md5_obj="";
63174664626SKris Kennawaymy $sha1_obj="";
63274664626SKris Kennawaymy $rmd160_obj="";
63374664626SKris Kennawaymy $processor="";
6345740a5e3SKris Kennawaymy $default_ranlib;
63574664626SKris Kennawaymy $perl;
636db522d3aSSimon L. B. Nielsenmy $fips=0;
63774664626SKris Kennaway
6383b4e3dcbSSimon L. B. Nielsen
6393b4e3dcbSSimon L. B. Nielsen# All of the following is disabled by default (RC5 was enabled before 0.9.8):
6403b4e3dcbSSimon L. B. Nielsen
641db522d3aSSimon L. B. Nielsenmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
642ed5d4f9aSSimon L. B. Nielsen                 "camellia"       => "default",
643db522d3aSSimon L. B. Nielsen                 "capieng"        => "default",
644db522d3aSSimon L. B. Nielsen                 "cms"            => "default",
6453b4e3dcbSSimon L. B. Nielsen                 "gmp"            => "default",
646db522d3aSSimon L. B. Nielsen                 "jpake"          => "experimental",
6473b4e3dcbSSimon L. B. Nielsen                 "mdc2"           => "default",
648db522d3aSSimon L. B. Nielsen                 "montasm"        => "default", # explicit option in 0.9.8 only (implicitly enabled in 0.9.9)
6493b4e3dcbSSimon L. B. Nielsen                 "rc5"            => "default",
6505471f83eSSimon L. B. Nielsen                 "rfc3779"        => "default",
651db522d3aSSimon L. B. Nielsen                 "seed"           => "default",
6523b4e3dcbSSimon L. B. Nielsen                 "shared"         => "default",
6533b4e3dcbSSimon L. B. Nielsen                 "zlib"           => "default",
6543b4e3dcbSSimon L. B. Nielsen                 "zlib-dynamic"   => "default"
6553b4e3dcbSSimon L. B. Nielsen               );
656db522d3aSSimon L. B. Nielsenmy @experimental = ();
6573b4e3dcbSSimon L. B. Nielsen
658db522d3aSSimon L. B. Nielsen# This is what $depflags will look like with the above defaults
659db522d3aSSimon L. B. Nielsen# (we need this to see if we should advise the user to run "make depend"):
660db522d3aSSimon L. B. Nielsenmy $default_depflags = " -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED";
6613b4e3dcbSSimon L. B. Nielsen
662db522d3aSSimon L. B. Nielsen
663db522d3aSSimon L. B. Nielsen# Explicit "no-..." options will be collected in %disabled along with the defaults.
664db522d3aSSimon L. B. Nielsen# To remove something from %disabled, use "enable-foo" (unless it's experimental).
665db522d3aSSimon L. B. Nielsen# For symmetry, "disable-foo" is a synonym for "no-foo".
666db522d3aSSimon L. B. Nielsen
667db522d3aSSimon L. B. Nielsen# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
668db522d3aSSimon L. B. Nielsen# We will collect such requests in @experimental.
669db522d3aSSimon L. B. Nielsen# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
6703b4e3dcbSSimon L. B. Nielsen
6713b4e3dcbSSimon L. B. Nielsen
6723b4e3dcbSSimon L. B. Nielsenmy $no_sse2=0;
6735c87c606SMark Murray
67474664626SKris Kennaway&usage if ($#ARGV < 0);
67574664626SKris Kennaway
676ddd58736SKris Kennawaymy $flags;
677ddd58736SKris Kennawaymy $depflags;
678db522d3aSSimon L. B. Nielsenmy $openssl_experimental_defines;
679ddd58736SKris Kennawaymy $openssl_algorithm_defines;
680ddd58736SKris Kennawaymy $openssl_thread_defines;
6815c87c606SMark Murraymy $openssl_sys_defines="";
682ddd58736SKris Kennawaymy $openssl_other_defines;
683ddd58736SKris Kennawaymy $libs;
684fceca8a3SJacques Vidrinemy $libkrb5="";
685ddd58736SKris Kennawaymy $target;
686ddd58736SKris Kennawaymy $options;
687ddd58736SKris Kennawaymy $symlink;
6885c87c606SMark Murraymy $make_depend=0;
6895c87c606SMark Murraymy %withargs=();
690ddd58736SKris Kennaway
691ddd58736SKris Kennawaymy @argvcopy=@ARGV;
692ddd58736SKris Kennawaymy $argvstring="";
693ddd58736SKris Kennawaymy $argv_unprocessed=1;
694ddd58736SKris Kennaway
695ddd58736SKris Kennawaywhile($argv_unprocessed)
696ddd58736SKris Kennaway	{
697ddd58736SKris Kennaway	$flags="";
698ddd58736SKris Kennaway	$depflags="";
699db522d3aSSimon L. B. Nielsen	$openssl_experimental_defines="";
700ddd58736SKris Kennaway	$openssl_algorithm_defines="";
701ddd58736SKris Kennaway	$openssl_thread_defines="";
7025c87c606SMark Murray	$openssl_sys_defines="";
703ddd58736SKris Kennaway	$openssl_other_defines="";
704ddd58736SKris Kennaway	$libs="";
705ddd58736SKris Kennaway	$target="";
706ddd58736SKris Kennaway	$options="";
707ddd58736SKris Kennaway	$symlink=1;
708ddd58736SKris Kennaway
709ddd58736SKris Kennaway	$argv_unprocessed=0;
710ddd58736SKris Kennaway	$argvstring=join(' ',@argvcopy);
711ddd58736SKris Kennaway
712ddd58736SKris KennawayPROCESS_ARGS:
713ddd58736SKris Kennaway	foreach (@argvcopy)
71474664626SKris Kennaway		{
715f579bf8eSKris Kennaway		s /^-no-/no-/; # some people just can't read the instructions
7163b4e3dcbSSimon L. B. Nielsen
7173b4e3dcbSSimon L. B. Nielsen		# rewrite some options in "enable-..." form
7183b4e3dcbSSimon L. B. Nielsen		s /^-?-?shared$/enable-shared/;
7193b4e3dcbSSimon L. B. Nielsen		s /^threads$/enable-threads/;
7203b4e3dcbSSimon L. B. Nielsen		s /^zlib$/enable-zlib/;
7213b4e3dcbSSimon L. B. Nielsen		s /^zlib-dynamic$/enable-zlib-dynamic/;
7223b4e3dcbSSimon L. B. Nielsen
7233b4e3dcbSSimon L. B. Nielsen		if (/^no-(.+)$/ || /^disable-(.+)$/)
7243b4e3dcbSSimon L. B. Nielsen			{
725db522d3aSSimon L. B. Nielsen			if (!($disabled{$1} eq "experimental"))
726db522d3aSSimon L. B. Nielsen				{
7273b4e3dcbSSimon L. B. Nielsen				if ($1 eq "ssl")
7283b4e3dcbSSimon L. B. Nielsen					{
7293b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl2"} = "option(ssl)";
7303b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl3"} = "option(ssl)";
7313b4e3dcbSSimon L. B. Nielsen					}
7323b4e3dcbSSimon L. B. Nielsen				elsif ($1 eq "tls")
7333b4e3dcbSSimon L. B. Nielsen					{
7343b4e3dcbSSimon L. B. Nielsen					$disabled{"tls1"} = "option(tls)"
7353b4e3dcbSSimon L. B. Nielsen					}
7363b4e3dcbSSimon L. B. Nielsen				else
7373b4e3dcbSSimon L. B. Nielsen					{
7383b4e3dcbSSimon L. B. Nielsen					$disabled{$1} = "option";
7393b4e3dcbSSimon L. B. Nielsen					}
7403b4e3dcbSSimon L. B. Nielsen				}
741db522d3aSSimon L. B. Nielsen			}
742db522d3aSSimon L. B. Nielsen		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
7433b4e3dcbSSimon L. B. Nielsen			{
744db522d3aSSimon L. B. Nielsen			my $algo = $1;
745db522d3aSSimon L. B. Nielsen			if ($disabled{$algo} eq "experimental")
746db522d3aSSimon L. B. Nielsen				{
747db522d3aSSimon L. B. Nielsen				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
748db522d3aSSimon L. B. Nielsen					unless (/^experimental-/);
749db522d3aSSimon L. B. Nielsen				push @experimental, $algo;
750db522d3aSSimon L. B. Nielsen				}
751db522d3aSSimon L. B. Nielsen			delete $disabled{$algo};
7523b4e3dcbSSimon L. B. Nielsen
753db522d3aSSimon L. B. Nielsen			$threads = 1 if ($algo eq "threads");
7543b4e3dcbSSimon L. B. Nielsen			}
7553b4e3dcbSSimon L. B. Nielsen		elsif (/^--test-sanity$/)
756c1803d78SJacques Vidrine			{
757c1803d78SJacques Vidrine			exit(&test_sanity());
758c1803d78SJacques Vidrine			}
7596a599222SSimon L. B. Nielsen		elsif (/^--strict-warnings/)
7606a599222SSimon L. B. Nielsen			{
7616a599222SSimon L. B. Nielsen			$strict_warnings = 1;
7626a599222SSimon L. B. Nielsen			}
763ddd58736SKris Kennaway		elsif (/^reconfigure/ || /^reconf/)
764ddd58736SKris Kennaway			{
765ddd58736SKris Kennaway			if (open(IN,"<$Makefile"))
766ddd58736SKris Kennaway				{
767ddd58736SKris Kennaway				while (<IN>)
768ddd58736SKris Kennaway					{
7693b4e3dcbSSimon L. B. Nielsen					chomp;
770ddd58736SKris Kennaway					if (/^CONFIGURE_ARGS=(.*)/)
771ddd58736SKris Kennaway						{
772ddd58736SKris Kennaway						$argvstring=$1;
773ddd58736SKris Kennaway						@argvcopy=split(' ',$argvstring);
774ddd58736SKris Kennaway						die "Incorrect data to reconfigure, please do a normal configuration\n"
775ddd58736SKris Kennaway							if (grep(/^reconf/,@argvcopy));
776ddd58736SKris Kennaway						print "Reconfiguring with: $argvstring\n";
777ddd58736SKris Kennaway						$argv_unprocessed=1;
778ddd58736SKris Kennaway						close(IN);
779ddd58736SKris Kennaway						last PROCESS_ARGS;
780ddd58736SKris Kennaway						}
781ddd58736SKris Kennaway					}
782ddd58736SKris Kennaway				close(IN);
783ddd58736SKris Kennaway				}
784ddd58736SKris Kennaway			die "Insufficient data to reconfigure, please do a normal configuration\n";
785ddd58736SKris Kennaway			}
78674664626SKris Kennaway		elsif (/^386$/)
78774664626SKris Kennaway			{ $processor=386; }
788db522d3aSSimon L. B. Nielsen		elsif (/^fips$/)
789db522d3aSSimon L. B. Nielsen			{
790db522d3aSSimon L. B. Nielsen			$fips=1;
791db522d3aSSimon L. B. Nielsen		        }
79274664626SKris Kennaway		elsif (/^rsaref$/)
79374664626SKris Kennaway			{
7945c87c606SMark Murray			# No RSAref support any more since it's not needed.
7955c87c606SMark Murray			# The check for the option is there so scripts aren't
7965c87c606SMark Murray			# broken
79774664626SKris Kennaway			}
798db522d3aSSimon L. B. Nielsen		elsif (/^nofipscanistercheck$/)
799db522d3aSSimon L. B. Nielsen			{
800db522d3aSSimon L. B. Nielsen			$fips = 1;
801db522d3aSSimon L. B. Nielsen			$nofipscanistercheck = 1;
802db522d3aSSimon L. B. Nielsen			}
803db522d3aSSimon L. B. Nielsen		elsif (/^fipscanisterbuild$/)
804db522d3aSSimon L. B. Nielsen			{
805db522d3aSSimon L. B. Nielsen			$fips = 1;
806db522d3aSSimon L. B. Nielsen			$nofipscanistercheck = 1;
807db522d3aSSimon L. B. Nielsen			$fipslibdir="";
808db522d3aSSimon L. B. Nielsen			$fipscanisterinternal="y";
809db522d3aSSimon L. B. Nielsen			}
810db522d3aSSimon L. B. Nielsen		elsif (/^fipsdso$/)
811db522d3aSSimon L. B. Nielsen			{
812db522d3aSSimon L. B. Nielsen			$fips = 1;
813db522d3aSSimon L. B. Nielsen			$nofipscanistercheck = 1;
814db522d3aSSimon L. B. Nielsen			$fipslibdir="";
815db522d3aSSimon L. B. Nielsen			$fipscanisterinternal="y";
816db522d3aSSimon L. B. Nielsen			$fipsdso = 1;
817db522d3aSSimon L. B. Nielsen			}
81874664626SKris Kennaway		elsif (/^[-+]/)
81974664626SKris Kennaway			{
82074664626SKris Kennaway			if (/^-[lL](.*)$/)
82174664626SKris Kennaway				{
82274664626SKris Kennaway				$libs.=$_." ";
82374664626SKris Kennaway				}
82474664626SKris Kennaway			elsif (/^-[^-]/ or /^\+/)
82574664626SKris Kennaway				{
82674664626SKris Kennaway				$flags.=$_." ";
82774664626SKris Kennaway				}
82874664626SKris Kennaway			elsif (/^--prefix=(.*)$/)
82974664626SKris Kennaway				{
83074664626SKris Kennaway				$prefix=$1;
83174664626SKris Kennaway				}
8326a599222SSimon L. B. Nielsen			elsif (/^--libdir=(.*)$/)
8336a599222SSimon L. B. Nielsen				{
8346a599222SSimon L. B. Nielsen				$libdir=$1;
8356a599222SSimon L. B. Nielsen				}
83674664626SKris Kennaway			elsif (/^--openssldir=(.*)$/)
83774664626SKris Kennaway				{
83874664626SKris Kennaway				$openssldir=$1;
83974664626SKris Kennaway				}
84074664626SKris Kennaway			elsif (/^--install.prefix=(.*)$/)
84174664626SKris Kennaway				{
84274664626SKris Kennaway				$install_prefix=$1;
84374664626SKris Kennaway				}
8445c87c606SMark Murray			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
8455c87c606SMark Murray				{
8465c87c606SMark Murray				$withargs{"krb5-".$1}=$2;
8475c87c606SMark Murray				}
8483b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-lib=(.*)$/)
8493b4e3dcbSSimon L. B. Nielsen				{
8503b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-lib"}=$1;
8513b4e3dcbSSimon L. B. Nielsen				}
8523b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-include=(.*)$/)
8533b4e3dcbSSimon L. B. Nielsen				{
8543b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-include"}="-I$1";
8553b4e3dcbSSimon L. B. Nielsen				}
856db522d3aSSimon L. B. Nielsen			elsif (/^--with-fipslibdir=(.*)$/)
857db522d3aSSimon L. B. Nielsen				{
858db522d3aSSimon L. B. Nielsen				$fipslibdir="$1/";
859db522d3aSSimon L. B. Nielsen				}
860db522d3aSSimon L. B. Nielsen			elsif (/^--with-baseaddr=(.*)$/)
861db522d3aSSimon L. B. Nielsen				{
862db522d3aSSimon L. B. Nielsen				$baseaddr="$1";
863db522d3aSSimon L. B. Nielsen				}
86474664626SKris Kennaway			else
86574664626SKris Kennaway				{
86674664626SKris Kennaway				print STDERR $usage;
86774664626SKris Kennaway				exit(1);
86874664626SKris Kennaway				}
86974664626SKris Kennaway			}
87074664626SKris Kennaway		elsif ($_ =~ /^([^:]+):(.+)$/)
87174664626SKris Kennaway			{
87274664626SKris Kennaway			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
87374664626SKris Kennaway			$target=$1;
87474664626SKris Kennaway			}
87574664626SKris Kennaway		else
87674664626SKris Kennaway			{
8773b4e3dcbSSimon L. B. Nielsen			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
87874664626SKris Kennaway			$target=$_;
87974664626SKris Kennaway			}
88074664626SKris Kennaway
8813b4e3dcbSSimon L. B. Nielsen		unless ($_ eq $target || /^no-/ || /^disable-/)
8825c87c606SMark Murray			{
8833b4e3dcbSSimon L. B. Nielsen			# "no-..." follows later after implied disactivations
8843b4e3dcbSSimon L. B. Nielsen			# have been derived.  (Don't take this too seroiusly,
8853b4e3dcbSSimon L. B. Nielsen			# we really only write OPTIONS to the Makefile out of
8863b4e3dcbSSimon L. B. Nielsen			# nostalgia.)
8873b4e3dcbSSimon L. B. Nielsen
8883b4e3dcbSSimon L. B. Nielsen			if ($options eq "")
8893b4e3dcbSSimon L. B. Nielsen				{ $options = $_; }
8903b4e3dcbSSimon L. B. Nielsen			else
8913b4e3dcbSSimon L. B. Nielsen				{ $options .= " ".$_; }
8923b4e3dcbSSimon L. B. Nielsen			}
8933b4e3dcbSSimon L. B. Nielsen		}
8945c87c606SMark Murray	}
8955c87c606SMark Murray
8963b4e3dcbSSimon L. B. Nielsen
8973b4e3dcbSSimon L. B. Nielsen
8983b4e3dcbSSimon L. B. Nielsenif ($processor eq "386")
8995c87c606SMark Murray	{
9003b4e3dcbSSimon L. B. Nielsen	$disabled{"sse2"} = "forced";
9015c87c606SMark Murray	}
9025c87c606SMark Murray
9033b4e3dcbSSimon L. B. Nielsenif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
9045c87c606SMark Murray	{
9053b4e3dcbSSimon L. B. Nielsen	$disabled{"krb5"} = "krb5-flavor not specified";
9065c87c606SMark Murray	}
9075c87c606SMark Murray
9083b4e3dcbSSimon L. B. Nielsenif (!defined($disabled{"zlib-dynamic"}))
9093b4e3dcbSSimon L. B. Nielsen	{
9103b4e3dcbSSimon L. B. Nielsen	# "zlib-dynamic" was specifically enabled, so enable "zlib"
9113b4e3dcbSSimon L. B. Nielsen	delete $disabled{"zlib"};
9123b4e3dcbSSimon L. B. Nielsen	}
9133b4e3dcbSSimon L. B. Nielsen
9143b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"rijndael"}))
9153b4e3dcbSSimon L. B. Nielsen	{
9163b4e3dcbSSimon L. B. Nielsen	$disabled{"aes"} = "forced";
9173b4e3dcbSSimon L. B. Nielsen	}
9183b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"des"}))
9193b4e3dcbSSimon L. B. Nielsen	{
9203b4e3dcbSSimon L. B. Nielsen	$disabled{"mdc2"} = "forced";
9213b4e3dcbSSimon L. B. Nielsen	}
9223b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"ec"}))
9233b4e3dcbSSimon L. B. Nielsen	{
9243b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdsa"} = "forced";
9253b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdh"} = "forced";
9263b4e3dcbSSimon L. B. Nielsen	}
9273b4e3dcbSSimon L. B. Nielsen
9283b4e3dcbSSimon L. B. Nielsen# SSL 2.0 requires MD5 and RSA
9293b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
9303b4e3dcbSSimon L. B. Nielsen	{
9313b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl2"} = "forced";
9323b4e3dcbSSimon L. B. Nielsen	}
9333b4e3dcbSSimon L. B. Nielsen
9343b4e3dcbSSimon L. B. Nielsen# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
9353b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"sha"})
9363b4e3dcbSSimon L. B. Nielsen    || (defined($disabled{"rsa"})
9373b4e3dcbSSimon L. B. Nielsen        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
9383b4e3dcbSSimon L. B. Nielsen	{
9393b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl3"} = "forced";
9403b4e3dcbSSimon L. B. Nielsen	$disabled{"tls1"} = "forced";
9413b4e3dcbSSimon L. B. Nielsen	}
9423b4e3dcbSSimon L. B. Nielsen
943db522d3aSSimon L. B. Nielsenif (defined($disabled{"tls1"}))
944db522d3aSSimon L. B. Nielsen	{
945db522d3aSSimon L. B. Nielsen	$disabled{"tlsext"} = "forced";
946db522d3aSSimon L. B. Nielsen	}
9473b4e3dcbSSimon L. B. Nielsen
94874664626SKris Kennawayif ($target eq "TABLE") {
94974664626SKris Kennaway	foreach $target (sort keys %table) {
95074664626SKris Kennaway		print_table_entry($target);
95174664626SKris Kennaway	}
95274664626SKris Kennaway	exit 0;
95374664626SKris Kennaway}
95474664626SKris Kennaway
955f579bf8eSKris Kennawayif ($target eq "LIST") {
956f579bf8eSKris Kennaway	foreach (sort keys %table) {
957f579bf8eSKris Kennaway		print;
958f579bf8eSKris Kennaway		print "\n";
959f579bf8eSKris Kennaway	}
960f579bf8eSKris Kennaway	exit 0;
961f579bf8eSKris Kennaway}
962f579bf8eSKris Kennaway
963c1803d78SJacques Vidrineif ($target =~ m/^CygWin32(-.*)$/) {
964c1803d78SJacques Vidrine	$target = "Cygwin".$1;
965c1803d78SJacques Vidrine}
966c1803d78SJacques Vidrine
967ddd58736SKris Kennawayprint "Configuring for $target\n";
968ddd58736SKris Kennaway
96974664626SKris Kennaway&usage if (!defined($table{$target}));
97074664626SKris Kennaway
971db522d3aSSimon L. B. Nielsenmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
972db522d3aSSimon L. B. Nielsenmy $cc = $fields[$idx_cc];
973db522d3aSSimon L. B. Nielsen# Allow environment CC to override compiler...
974db522d3aSSimon L. B. Nielsenif($ENV{CC}) {
975db522d3aSSimon L. B. Nielsen    $cc = $ENV{CC};
976db522d3aSSimon L. B. Nielsen}
977db522d3aSSimon L. B. Nielsenmy $cflags = $fields[$idx_cflags];
978db522d3aSSimon L. B. Nielsenmy $unistd = $fields[$idx_unistd];
979db522d3aSSimon L. B. Nielsenmy $thread_cflag = $fields[$idx_thread_cflag];
980db522d3aSSimon L. B. Nielsenmy $sys_id = $fields[$idx_sys_id];
981db522d3aSSimon L. B. Nielsenmy $lflags = $fields[$idx_lflags];
982db522d3aSSimon L. B. Nielsenmy $bn_ops = $fields[$idx_bn_ops];
983db522d3aSSimon L. B. Nielsenmy $cpuid_obj = $fields[$idx_cpuid_obj];
984db522d3aSSimon L. B. Nielsenmy $bn_obj = $fields[$idx_bn_obj];
985db522d3aSSimon L. B. Nielsenmy $des_obj = $fields[$idx_des_obj];
986db522d3aSSimon L. B. Nielsenmy $aes_obj = $fields[$idx_aes_obj];
987db522d3aSSimon L. B. Nielsenmy $bf_obj = $fields[$idx_bf_obj];
988db522d3aSSimon L. B. Nielsenmy $md5_obj = $fields[$idx_md5_obj];
989db522d3aSSimon L. B. Nielsenmy $sha1_obj = $fields[$idx_sha1_obj];
990db522d3aSSimon L. B. Nielsenmy $cast_obj = $fields[$idx_cast_obj];
991db522d3aSSimon L. B. Nielsenmy $rc4_obj = $fields[$idx_rc4_obj];
992db522d3aSSimon L. B. Nielsenmy $rmd160_obj = $fields[$idx_rmd160_obj];
993db522d3aSSimon L. B. Nielsenmy $rc5_obj = $fields[$idx_rc5_obj];
994db522d3aSSimon L. B. Nielsenmy $dso_scheme = $fields[$idx_dso_scheme];
995db522d3aSSimon L. B. Nielsenmy $shared_target = $fields[$idx_shared_target];
996db522d3aSSimon L. B. Nielsenmy $shared_cflag = $fields[$idx_shared_cflag];
997db522d3aSSimon L. B. Nielsenmy $shared_ldflag = $fields[$idx_shared_ldflag];
998db522d3aSSimon L. B. Nielsenmy $shared_extension = $fields[$idx_shared_extension];
9996a599222SSimon L. B. Nielsenmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
10006a599222SSimon L. B. Nielsenmy $ar = $ENV{'AR'} || "ar";
1001db522d3aSSimon L. B. Nielsenmy $arflags = $fields[$idx_arflags];
1002db522d3aSSimon L. B. Nielsen
1003db522d3aSSimon L. B. Nielsenif ($fips)
1004db522d3aSSimon L. B. Nielsen	{
1005db522d3aSSimon L. B. Nielsen	delete $disabled{"shared"} if ($disabled{"shared"} eq "default");
1006db522d3aSSimon L. B. Nielsen	$disabled{"asm"}="forced"
1007db522d3aSSimon L. B. Nielsen		if ($target !~ "VC\-.*" &&
1008db522d3aSSimon L. B. Nielsen		    "$cpuid_obj:$bn_obj:$aes_obj:$des_obj:$sha1_obj" eq "::::");
1009db522d3aSSimon L. B. Nielsen	}
1010db522d3aSSimon L. B. Nielsen
1011db522d3aSSimon L. B. Nielsenforeach (sort @experimental)
1012db522d3aSSimon L. B. Nielsen	{
1013db522d3aSSimon L. B. Nielsen	my $ALGO;
1014db522d3aSSimon L. B. Nielsen	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
1015db522d3aSSimon L. B. Nielsen
1016db522d3aSSimon L. B. Nielsen	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
1017db522d3aSSimon L. B. Nielsen	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
1018db522d3aSSimon L. B. Nielsen	$cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
1019db522d3aSSimon L. B. Nielsen	}
102074664626SKris Kennaway
10213b4e3dcbSSimon L. B. Nielsenforeach (sort (keys %disabled))
10223b4e3dcbSSimon L. B. Nielsen	{
10233b4e3dcbSSimon L. B. Nielsen	$options .= " no-$_";
10243b4e3dcbSSimon L. B. Nielsen
10253b4e3dcbSSimon L. B. Nielsen	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
10263b4e3dcbSSimon L. B. Nielsen
10273b4e3dcbSSimon L. B. Nielsen	if (/^dso$/)
10283b4e3dcbSSimon L. B. Nielsen		{ $no_dso = 1; }
10293b4e3dcbSSimon L. B. Nielsen	elsif (/^threads$/)
10303b4e3dcbSSimon L. B. Nielsen		{ $no_threads = 1; }
10313b4e3dcbSSimon L. B. Nielsen	elsif (/^shared$/)
10323b4e3dcbSSimon L. B. Nielsen		{ $no_shared = 1; }
10333b4e3dcbSSimon L. B. Nielsen	elsif (/^zlib$/)
10343b4e3dcbSSimon L. B. Nielsen		{ $zlib = 0; }
1035db522d3aSSimon L. B. Nielsen	elsif (/^montasm$/)
1036db522d3aSSimon L. B. Nielsen		{ $montasm = 0; }
10373b4e3dcbSSimon L. B. Nielsen	elsif (/^static-engine$/)
10383b4e3dcbSSimon L. B. Nielsen		{ }
10393b4e3dcbSSimon L. B. Nielsen	elsif (/^zlib-dynamic$/)
10403b4e3dcbSSimon L. B. Nielsen		{ }
10413b4e3dcbSSimon L. B. Nielsen	elsif (/^symlinks$/)
10423b4e3dcbSSimon L. B. Nielsen		{ $symlink = 0; }
10433b4e3dcbSSimon L. B. Nielsen	elsif (/^sse2$/)
10443b4e3dcbSSimon L. B. Nielsen		{ $no_sse2 = 1; }
10453b4e3dcbSSimon L. B. Nielsen	else
10463b4e3dcbSSimon L. B. Nielsen		{
10473b4e3dcbSSimon L. B. Nielsen		my ($ALGO, $algo);
10483b4e3dcbSSimon L. B. Nielsen		($ALGO = $algo = $_) =~ tr/[a-z]/[A-Z]/;
10493b4e3dcbSSimon L. B. Nielsen
10503b4e3dcbSSimon L. B. Nielsen		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
10513b4e3dcbSSimon L. B. Nielsen			{
10523b4e3dcbSSimon L. B. Nielsen			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
10533b4e3dcbSSimon L. B. Nielsen			print " OPENSSL_NO_$ALGO";
10543b4e3dcbSSimon L. B. Nielsen
10553b4e3dcbSSimon L. B. Nielsen			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
10563b4e3dcbSSimon L. B. Nielsen			elsif (/^asm$/)	{ $no_asm = 1; }
10573b4e3dcbSSimon L. B. Nielsen			}
10583b4e3dcbSSimon L. B. Nielsen		else
10593b4e3dcbSSimon L. B. Nielsen			{
10603b4e3dcbSSimon L. B. Nielsen			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
10613b4e3dcbSSimon L. B. Nielsen			print " OPENSSL_NO_$ALGO";
10623b4e3dcbSSimon L. B. Nielsen
10633b4e3dcbSSimon L. B. Nielsen			if (/^krb5$/)
10643b4e3dcbSSimon L. B. Nielsen				{ $no_krb5 = 1; }
10653b4e3dcbSSimon L. B. Nielsen			else
10663b4e3dcbSSimon L. B. Nielsen				{
10673b4e3dcbSSimon L. B. Nielsen				push @skip, $algo;
10683b4e3dcbSSimon L. B. Nielsen				print " (skip dir)";
10693b4e3dcbSSimon L. B. Nielsen
10703b4e3dcbSSimon L. B. Nielsen				$depflags .= " -DOPENSSL_NO_$ALGO";
10713b4e3dcbSSimon L. B. Nielsen				}
10723b4e3dcbSSimon L. B. Nielsen			}
10733b4e3dcbSSimon L. B. Nielsen		}
10743b4e3dcbSSimon L. B. Nielsen
10753b4e3dcbSSimon L. B. Nielsen	print "\n";
10763b4e3dcbSSimon L. B. Nielsen	}
10773b4e3dcbSSimon L. B. Nielsen
10783b4e3dcbSSimon L. B. Nielsenmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
10793b4e3dcbSSimon L. B. Nielsen
1080ed5d4f9aSSimon L. B. Nielsen$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
10813b4e3dcbSSimon L. B. Nielsen
1082db522d3aSSimon L. B. Nielsen$no_shared = 0 if ($fipsdso && !$IsMK1MF);
1083db522d3aSSimon L. B. Nielsen
10843b4e3dcbSSimon L. B. Nielsen$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
1085db522d3aSSimon L. B. Nielsen$exe_ext=".nlm" if ($target =~ /netware/);
10863b4e3dcbSSimon L. B. Nielsen$exe_ext=".pm"  if ($target =~ /vos/);
1087db522d3aSSimon L. B. Nielsenif ($openssldir eq "" and $prefix eq "")
1088db522d3aSSimon L. B. Nielsen	{
1089db522d3aSSimon L. B. Nielsen	if ($fips)
1090db522d3aSSimon L. B. Nielsen		{
1091db522d3aSSimon L. B. Nielsen		$openssldir="/usr/local/ssl/fips";
1092db522d3aSSimon L. B. Nielsen		}
1093db522d3aSSimon L. B. Nielsen	else
1094db522d3aSSimon L. B. Nielsen		{
1095db522d3aSSimon L. B. Nielsen		$openssldir="/usr/local/ssl";
1096db522d3aSSimon L. B. Nielsen		}
1097db522d3aSSimon L. B. Nielsen	}
109874664626SKris Kennaway$prefix=$openssldir if $prefix eq "";
109974664626SKris Kennaway
11006a599222SSimon L. B. Nielsen$libdir="lib" if $libdir eq "";
11016a599222SSimon L. B. Nielsen
11026be8ae07SJacques Vidrine$default_ranlib= &which("ranlib") or $default_ranlib="true";
11036be8ae07SJacques Vidrine$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
11046be8ae07SJacques Vidrine  or $perl="perl";
11056a599222SSimon L. B. Nielsenmy $make = $ENV{'MAKE'} || "make";
11066a599222SSimon L. B. Nielsen
11076a599222SSimon L. B. Nielsen$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
11086be8ae07SJacques Vidrine
110974664626SKris Kennawaychop $openssldir if $openssldir =~ /\/$/;
1110db522d3aSSimon L. B. Nielsenchop $prefix if $prefix =~ /.\/$/;
111174664626SKris Kennaway
111274664626SKris Kennaway$openssldir=$prefix . "/ssl" if $openssldir eq "";
11135c87c606SMark Murray$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
111474664626SKris Kennaway
111574664626SKris Kennaway
11163b4e3dcbSSimon L. B. Nielsenprint "IsMK1MF=$IsMK1MF\n";
111774664626SKris Kennaway
1118db522d3aSSimon L. B. Nielsen# '%' in $lflags is used to split flags to "pre-" and post-flags
1119db522d3aSSimon L. B. Nielsenmy ($prelflags,$postlflags)=split('%',$lflags);
1120db522d3aSSimon L. B. Nielsenif (defined($postlflags))	{ $lflags=$postlflags;  }
1121db522d3aSSimon L. B. Nielsenelse				{ $lflags=$prelflags; undef $prelflags; }
1122c1803d78SJacques Vidrine
1123fceca8a3SJacques Vidrinemy $no_shared_warn=0;
11243b4e3dcbSSimon L. B. Nielsenmy $no_user_cflags=0;
1125fceca8a3SJacques Vidrine
11263b4e3dcbSSimon L. B. Nielsenif ($flags ne "")	{ $cflags="$flags$cflags"; }
11273b4e3dcbSSimon L. B. Nielsenelse			{ $no_user_cflags=1;       }
112874664626SKris Kennaway
11295c87c606SMark Murray# Kerberos settings.  The flavor must be provided from outside, either through
11305c87c606SMark Murray# the script "config" or manually.
11313b4e3dcbSSimon L. B. Nielsenif (!$no_krb5)
11325c87c606SMark Murray	{
11335c87c606SMark Murray	my ($lresolv, $lpath, $lext);
11345c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
11355c87c606SMark Murray		{
11365c87c606SMark Murray		die "Sorry, Heimdal is currently not supported\n";
11375c87c606SMark Murray		}
11385c87c606SMark Murray	##### HACK to force use of Heimdal.
11395c87c606SMark Murray	##### WARNING: Since we don't really have adequate support for Heimdal,
11405c87c606SMark Murray	#####          using this will break the build.  You'll have to make
11415c87c606SMark Murray	#####          changes to the source, and if you do, please send
11425c87c606SMark Murray	#####          patches to openssl-dev@openssl.org
11435c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
11445c87c606SMark Murray		{
11455c87c606SMark Murray		warn "Heimdal isn't really supported.  Your build WILL break\n";
11465c87c606SMark Murray		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
11475c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/heimdal"
11485c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
11495c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
11505c87c606SMark Murray			"/lib -lgssapi -lkrb5 -lcom_err"
11513b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
11525c87c606SMark Murray		$cflags="-DKRB5_HEIMDAL $cflags";
11535c87c606SMark Murray		}
11545c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
11555c87c606SMark Murray		{
11565c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/kerberos"
11575c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
11585c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
11595c87c606SMark Murray			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
11603b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
11615c87c606SMark Murray		$cflags="-DKRB5_MIT $cflags";
11625c87c606SMark Murray		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
11635c87c606SMark Murray		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
11645c87c606SMark Murray			{
11655c87c606SMark Murray			$cflags="-DKRB5_MIT_OLD11 $cflags";
11665c87c606SMark Murray			}
11675c87c606SMark Murray		}
11685c87c606SMark Murray	LRESOLV:
11695c87c606SMark Murray	foreach $lpath ("/lib", "/usr/lib")
11705c87c606SMark Murray		{
11715c87c606SMark Murray		foreach $lext ("a", "so")
11725c87c606SMark Murray			{
11735c87c606SMark Murray			$lresolv = "$lpath/libresolv.$lext";
11745c87c606SMark Murray			last LRESOLV	if (-r "$lresolv");
11755c87c606SMark Murray			$lresolv = "";
11765c87c606SMark Murray			}
11775c87c606SMark Murray		}
11785c87c606SMark Murray	$withargs{"krb5-lib"} .= " -lresolv"
11795c87c606SMark Murray		if ("$lresolv" ne "");
11805c87c606SMark Murray	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
11815c87c606SMark Murray		if $withargs{"krb5-include"} eq "" &&
11825c87c606SMark Murray		   $withargs{"krb5-dir"} ne "";
11835c87c606SMark Murray	}
11845c87c606SMark Murray
1185ddd58736SKris Kennaway# The DSO code currently always implements all functions so that no
1186ddd58736SKris Kennaway# applications will have to worry about that from a compilation point
1187ddd58736SKris Kennaway# of view. However, the "method"s may return zero unless that platform
1188ddd58736SKris Kennaway# has support compiled in for them. Currently each method is enabled
1189ddd58736SKris Kennaway# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1190ddd58736SKris Kennaway# string entry into using the following logic;
1191ddd58736SKris Kennawaymy $dso_cflags;
1192ddd58736SKris Kennawayif (!$no_dso && $dso_scheme ne "")
1193ddd58736SKris Kennaway	{
1194ddd58736SKris Kennaway	$dso_scheme =~ tr/[a-z]/[A-Z]/;
1195ddd58736SKris Kennaway	if ($dso_scheme eq "DLFCN")
1196ddd58736SKris Kennaway		{
1197ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
1198ddd58736SKris Kennaway		}
1199ddd58736SKris Kennaway	elsif ($dso_scheme eq "DLFCN_NO_H")
1200ddd58736SKris Kennaway		{
1201ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN";
1202ddd58736SKris Kennaway		}
1203ddd58736SKris Kennaway	else
1204ddd58736SKris Kennaway		{
1205ddd58736SKris Kennaway		$dso_cflags = "-DDSO_$dso_scheme";
1206ddd58736SKris Kennaway		}
1207ddd58736SKris Kennaway	$cflags = "$dso_cflags $cflags";
1208ddd58736SKris Kennaway	}
1209ddd58736SKris Kennaway
121074664626SKris Kennawaymy $thread_cflags;
1211f579bf8eSKris Kennawaymy $thread_defines;
121274664626SKris Kennawayif ($thread_cflag ne "(unknown)" && !$no_threads)
121374664626SKris Kennaway	{
121474664626SKris Kennaway	# If we know how to do it, support threads by default.
121574664626SKris Kennaway	$threads = 1;
121674664626SKris Kennaway	}
12173b4e3dcbSSimon L. B. Nielsenif ($thread_cflag eq "(unknown)" && $threads)
121874664626SKris Kennaway	{
12193b4e3dcbSSimon L. B. Nielsen	# If the user asked for "threads", [s]he is also expected to
12203b4e3dcbSSimon L. B. Nielsen	# provide any system-dependent compiler options that are
12213b4e3dcbSSimon L. B. Nielsen	# necessary.
12223b4e3dcbSSimon L. B. Nielsen	if ($no_user_cflags)
12233b4e3dcbSSimon L. B. Nielsen		{
12243b4e3dcbSSimon L. B. Nielsen		print "You asked for multi-threading support, but didn't\n";
12253b4e3dcbSSimon L. B. Nielsen		print "provide any system-specific compiler options\n";
12263b4e3dcbSSimon L. B. Nielsen		exit(1);
12273b4e3dcbSSimon L. B. Nielsen		}
12285c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
12295c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
123074664626SKris Kennaway	}
123174664626SKris Kennawayelse
123274664626SKris Kennaway	{
12335c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
12345c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
1235f579bf8eSKris Kennaway#	my $def;
1236f579bf8eSKris Kennaway#	foreach $def (split ' ',$thread_cflag)
1237f579bf8eSKris Kennaway#		{
1238f579bf8eSKris Kennaway#		if ($def =~ s/^-D// && $def !~ /^_/)
1239f579bf8eSKris Kennaway#			{
1240f579bf8eSKris Kennaway#			$thread_defines .= "#define $def\n";
1241f579bf8eSKris Kennaway#			}
1242f579bf8eSKris Kennaway#		}
124374664626SKris Kennaway	}
124474664626SKris Kennaway
124574664626SKris Kennaway$lflags="$libs$lflags" if ($libs ne "");
124674664626SKris Kennaway
124774664626SKris Kennawayif ($no_asm)
124874664626SKris Kennaway	{
12493b4e3dcbSSimon L. B. Nielsen	$cpuid_obj=$bn_obj=$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj="";
125074664626SKris Kennaway	$sha1_obj=$md5_obj=$rmd160_obj="";
1251db522d3aSSimon L. B. Nielsen	$cflags=~s/\-D[BL]_ENDIAN//		if ($fips);
1252db522d3aSSimon L. B. Nielsen	$thread_cflags=~s/\-D[BL]_ENDIAN//	if ($fips);
1253db522d3aSSimon L. B. Nielsen	}
1254db522d3aSSimon L. B. Nielsenif ($montasm)
1255db522d3aSSimon L. B. Nielsen	{
1256db522d3aSSimon L. B. Nielsen	$bn_obj =~ s/MAYBE-MO86-/mo86-/;
1257db522d3aSSimon L. B. Nielsen	}
1258db522d3aSSimon L. B. Nielsenelse
1259db522d3aSSimon L. B. Nielsen	{
1260db522d3aSSimon L. B. Nielsen	$bn_obj =~ s/MAYBE-MO86-[a-z.]*//;
126174664626SKris Kennaway	}
126274664626SKris Kennaway
12635c87c606SMark Murrayif (!$no_shared)
12645c87c606SMark Murray	{
12655c87c606SMark Murray	$cast_obj="";	# CAST assembler is not PIC
12665c87c606SMark Murray	}
12675c87c606SMark Murray
126874664626SKris Kennawayif ($threads)
126974664626SKris Kennaway	{
127074664626SKris Kennaway	$cflags=$thread_cflags;
1271f579bf8eSKris Kennaway	$openssl_thread_defines .= $thread_defines;
127274664626SKris Kennaway	}
127374664626SKris Kennaway
12745c87c606SMark Murrayif ($zlib)
12755c87c606SMark Murray	{
12765c87c606SMark Murray	$cflags = "-DZLIB $cflags";
12773b4e3dcbSSimon L. B. Nielsen	if (defined($disabled{"zlib-dynamic"}))
12783b4e3dcbSSimon L. B. Nielsen		{
12793b4e3dcbSSimon L. B. Nielsen		$lflags = "$lflags -lz";
12803b4e3dcbSSimon L. B. Nielsen		}
12813b4e3dcbSSimon L. B. Nielsen	else
12823b4e3dcbSSimon L. B. Nielsen		{
12833b4e3dcbSSimon L. B. Nielsen		$cflags = "-DZLIB_SHARED $cflags";
12843b4e3dcbSSimon L. B. Nielsen		}
12855c87c606SMark Murray	}
12865c87c606SMark Murray
1287ddd58736SKris Kennaway# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
12885740a5e3SKris Kennawaymy $shared_mark = "";
12895c87c606SMark Murrayif ($shared_target eq "")
12905c87c606SMark Murray	{
1291db522d3aSSimon L. B. Nielsen	$no_shared_warn = 1 if !$no_shared && !$fips;
12925c87c606SMark Murray	$no_shared = 1;
12935c87c606SMark Murray	}
12945c87c606SMark Murrayif (!$no_shared)
12955740a5e3SKris Kennaway	{
1296ddd58736SKris Kennaway	if ($shared_cflag ne "")
1297ddd58736SKris Kennaway		{
12983b4e3dcbSSimon L. B. Nielsen		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
12993b4e3dcbSSimon L. B. Nielsen		}
13003b4e3dcbSSimon L. B. Nielsen	}
13013b4e3dcbSSimon L. B. Nielsen
13023b4e3dcbSSimon L. B. Nielsenif (!$IsMK1MF)
13033b4e3dcbSSimon L. B. Nielsen	{
13043b4e3dcbSSimon L. B. Nielsen	if ($no_shared)
13053b4e3dcbSSimon L. B. Nielsen		{
13063b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
13073b4e3dcbSSimon L. B. Nielsen		}
13083b4e3dcbSSimon L. B. Nielsen	else
13093b4e3dcbSSimon L. B. Nielsen		{
13103b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
13113b4e3dcbSSimon L. B. Nielsen		}
13123b4e3dcbSSimon L. B. Nielsen	}
13133b4e3dcbSSimon L. B. Nielsen
13143b4e3dcbSSimon L. B. Nielsen$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1315db522d3aSSimon L. B. Nielsen
1316db522d3aSSimon L. B. Nielsen#
1317db522d3aSSimon L. B. Nielsen# Platform fix-ups
1318db522d3aSSimon L. B. Nielsen#
1319db522d3aSSimon L. B. Nielsenif ($target =~ /\-icc$/)	# Intel C compiler
13203b4e3dcbSSimon L. B. Nielsen	{
1321db522d3aSSimon L. B. Nielsen	my $iccver=0;
1322db522d3aSSimon L. B. Nielsen	if (open(FD,"$cc -V 2>&1 |"))
1323db522d3aSSimon L. B. Nielsen		{
1324db522d3aSSimon L. B. Nielsen		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1325db522d3aSSimon L. B. Nielsen		close(FD);
1326db522d3aSSimon L. B. Nielsen		}
13273b4e3dcbSSimon L. B. Nielsen	if ($iccver>=8)
13283b4e3dcbSSimon L. B. Nielsen		{
13293b4e3dcbSSimon L. B. Nielsen		# Eliminate unnecessary dependency from libirc.a. This is
13303b4e3dcbSSimon L. B. Nielsen		# essential for shared library support, as otherwise
13313b4e3dcbSSimon L. B. Nielsen		# apps/openssl can end up in endless loop upon startup...
13323b4e3dcbSSimon L. B. Nielsen		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
13335740a5e3SKris Kennaway		}
1334db522d3aSSimon L. B. Nielsen	if ($iccver>=9)
1335db522d3aSSimon L. B. Nielsen		{
1336db522d3aSSimon L. B. Nielsen		$cflags.=" -i-static";
1337db522d3aSSimon L. B. Nielsen		$cflags=~s/\-no_cpprt/-no-cpprt/;
1338db522d3aSSimon L. B. Nielsen		}
1339db522d3aSSimon L. B. Nielsen	if ($iccver>=10)
1340db522d3aSSimon L. B. Nielsen		{
1341db522d3aSSimon L. B. Nielsen		$cflags=~s/\-i\-static/-static-intel/;
1342db522d3aSSimon L. B. Nielsen		}
1343db522d3aSSimon L. B. Nielsen	}
1344db522d3aSSimon L. B. Nielsen
1345db522d3aSSimon L. B. Nielsen# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1346db522d3aSSimon L. B. Nielsen# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1347db522d3aSSimon L. B. Nielsen# .so objects. Apparently application RPATH is not global and does
1348db522d3aSSimon L. B. Nielsen# not apply to .so linked with other .so. Problem manifests itself
1349db522d3aSSimon L. B. Nielsen# when libssl.so fails to load libcrypto.so. One can argue that we
1350db522d3aSSimon L. B. Nielsen# should engrave this into Makefile.shared rules or into BSD-* config
1351db522d3aSSimon L. B. Nielsen# lines above. Meanwhile let's try to be cautious and pass -rpath to
1352db522d3aSSimon L. B. Nielsen# linker only when --prefix is not /usr.
1353db522d3aSSimon L. B. Nielsenif ($target =~ /^BSD\-/)
1354db522d3aSSimon L. B. Nielsen	{
1355db522d3aSSimon L. B. Nielsen	$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1356ddd58736SKris Kennaway	}
13575c87c606SMark Murray
13585c87c606SMark Murrayif ($sys_id ne "")
1359de7cdddaSKris Kennaway	{
13603b4e3dcbSSimon L. B. Nielsen	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
13615c87c606SMark Murray	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
1362de7cdddaSKris Kennaway	}
1363ddd58736SKris Kennaway
13645740a5e3SKris Kennawayif ($ranlib eq "")
13655740a5e3SKris Kennaway	{
13665740a5e3SKris Kennaway	$ranlib = $default_ranlib;
13675740a5e3SKris Kennaway	}
13685740a5e3SKris Kennaway
136974664626SKris Kennaway#my ($bn1)=split(/\s+/,$bn_obj);
137074664626SKris Kennaway#$bn1 = "" unless defined $bn1;
137174664626SKris Kennaway#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
137274664626SKris Kennaway#$bn_obj="$bn1";
137374664626SKris Kennaway
13743b4e3dcbSSimon L. B. Nielsen$cpuid_obj="" if ($processor eq "386");
137574664626SKris Kennaway
13763b4e3dcbSSimon L. B. Nielsen$bn_obj = $bn_asm unless $bn_obj ne "";
13773b4e3dcbSSimon L. B. Nielsen# bn86* is the only one implementing bn_*_part_words
13783b4e3dcbSSimon L. B. Nielsen$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn86/);
13793b4e3dcbSSimon L. B. Nielsen$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /bn86/);
13803b4e3dcbSSimon L. B. Nielsen
1381db522d3aSSimon L. B. Nielsen$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /\-mont|mo86\-/);
1382db522d3aSSimon L. B. Nielsen
1383db522d3aSSimon L. B. Nielsenif ($fips)
1384db522d3aSSimon L. B. Nielsen	{
1385db522d3aSSimon L. B. Nielsen	$openssl_other_defines.="#define OPENSSL_FIPS\n";
1386db522d3aSSimon L. B. Nielsen	}
1387db522d3aSSimon L. B. Nielsen
13883b4e3dcbSSimon L. B. Nielsen$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
138974664626SKris Kennaway$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
139074664626SKris Kennaway$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
139174664626SKris Kennaway$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
139274664626SKris Kennaway$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
13933b4e3dcbSSimon L. B. Nielsenif ($sha1_obj =~ /\.o$/)
139474664626SKris Kennaway	{
139574664626SKris Kennaway#	$sha1_obj=$sha1_enc;
13963b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
13973b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
13983b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1399db522d3aSSimon L. B. Nielsen	if ($sha1_obj =~ /sse2/)
14003b4e3dcbSSimon L. B. Nielsen	    {	if ($no_sse2)
14013b4e3dcbSSimon L. B. Nielsen		{   $sha1_obj =~ s/\S*sse2\S+//;        }
14023b4e3dcbSSimon L. B. Nielsen		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
14033b4e3dcbSSimon L. B. Nielsen		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
14043b4e3dcbSSimon L. B. Nielsen	    }
140574664626SKris Kennaway	}
140674664626SKris Kennawayif ($md5_obj =~ /\.o$/)
140774664626SKris Kennaway	{
140874664626SKris Kennaway#	$md5_obj=$md5_enc;
140974664626SKris Kennaway	$cflags.=" -DMD5_ASM";
141074664626SKris Kennaway	}
141174664626SKris Kennawayif ($rmd160_obj =~ /\.o$/)
141274664626SKris Kennaway	{
141374664626SKris Kennaway#	$rmd160_obj=$rmd160_enc;
141474664626SKris Kennaway	$cflags.=" -DRMD160_ASM";
141574664626SKris Kennaway	}
14163b4e3dcbSSimon L. B. Nielsenif ($aes_obj =~ /\.o$/)
14176be8ae07SJacques Vidrine	{
14183b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DAES_ASM";
14193b4e3dcbSSimon L. B. Nielsen	}
14203b4e3dcbSSimon L. B. Nielsenelse	{
14213b4e3dcbSSimon L. B. Nielsen	$aes_obj=$aes_enc;
14226be8ae07SJacques Vidrine	}
14236be8ae07SJacques Vidrine
14244f20a5a2SJacques Vidrine# "Stringify" the C flags string.  This permits it to be made part of a string
14254f20a5a2SJacques Vidrine# and works as well on command lines.
14264f20a5a2SJacques Vidrine$cflags =~ s/([\\\"])/\\\1/g;
14274f20a5a2SJacques Vidrine
142874664626SKris Kennawaymy $version = "unknown";
14293b4e3dcbSSimon L. B. Nielsenmy $version_num = "unknown";
143074664626SKris Kennawaymy $major = "unknown";
143174664626SKris Kennawaymy $minor = "unknown";
1432ddd58736SKris Kennawaymy $shlib_version_number = "unknown";
1433ddd58736SKris Kennawaymy $shlib_version_history = "unknown";
1434ddd58736SKris Kennawaymy $shlib_major = "unknown";
1435ddd58736SKris Kennawaymy $shlib_minor = "unknown";
143674664626SKris Kennaway
143774664626SKris Kennawayopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
143874664626SKris Kennawaywhile (<IN>)
143974664626SKris Kennaway	{
144074664626SKris Kennaway	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
14413b4e3dcbSSimon L. B. Nielsen	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
1442ddd58736SKris Kennaway	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
1443ddd58736SKris Kennaway	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
144474664626SKris Kennaway	}
144574664626SKris Kennawayclose(IN);
1446ddd58736SKris Kennawayif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
144774664626SKris Kennaway
144874664626SKris Kennawayif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
144974664626SKris Kennaway	{
145074664626SKris Kennaway	$major=$1;
145174664626SKris Kennaway	$minor=$2;
145274664626SKris Kennaway	}
145374664626SKris Kennaway
1454ddd58736SKris Kennawayif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
1455ddd58736SKris Kennaway	{
1456ddd58736SKris Kennaway	$shlib_major=$1;
1457ddd58736SKris Kennaway	$shlib_minor=$2;
1458ddd58736SKris Kennaway	}
1459ddd58736SKris Kennaway
14606a599222SSimon L. B. Nielsenif ($strict_warnings)
14616a599222SSimon L. B. Nielsen	{
14626a599222SSimon L. B. Nielsen	my $wopt;
14636a599222SSimon L. B. Nielsen	die "ERROR --strict-warnings requires gcc" unless ($cc =~ /gcc$/);
14646a599222SSimon L. B. Nielsen	foreach $wopt (split /\s+/, $gcc_devteam_warn)
14656a599222SSimon L. B. Nielsen		{
14666a599222SSimon L. B. Nielsen		$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
14676a599222SSimon L. B. Nielsen		}
14686a599222SSimon L. B. Nielsen	}
14696a599222SSimon L. B. Nielsen
147074664626SKris Kennawayopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
14715c87c606SMark Murrayunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
14725c87c606SMark Murrayopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
1473f579bf8eSKris Kennawayprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
147474664626SKris Kennawaymy $sdirs=0;
147574664626SKris Kennawaywhile (<IN>)
147674664626SKris Kennaway	{
14773b4e3dcbSSimon L. B. Nielsen	chomp;
147874664626SKris Kennaway	$sdirs = 1 if /^SDIRS=/;
147974664626SKris Kennaway	if ($sdirs) {
148074664626SKris Kennaway		my $dir;
148174664626SKris Kennaway		foreach $dir (@skip) {
1482db522d3aSSimon L. B. Nielsen			s/(\s)$dir\s/$1/;
1483db522d3aSSimon L. B. Nielsen			s/\s$dir$//;
148474664626SKris Kennaway			}
148574664626SKris Kennaway		}
148674664626SKris Kennaway	$sdirs = 0 unless /\\$/;
1487db522d3aSSimon L. B. Nielsen        s/fips // if (/^DIRS=/ && !$fips);
1488db522d3aSSimon L. B. Nielsen        s/engines // if (/^DIRS=/ && $disabled{"engine"});
148974664626SKris Kennaway	s/^VERSION=.*/VERSION=$version/;
149074664626SKris Kennaway	s/^MAJOR=.*/MAJOR=$major/;
149174664626SKris Kennaway	s/^MINOR=.*/MINOR=$minor/;
1492ddd58736SKris Kennaway	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
1493ddd58736SKris Kennaway	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
1494ddd58736SKris Kennaway	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
1495ddd58736SKris Kennaway	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
14965740a5e3SKris Kennaway	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
149774664626SKris Kennaway	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
149874664626SKris Kennaway	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
14996a599222SSimon L. B. Nielsen	s/^LIBDIR=.*$/LIBDIR=$libdir/;
150074664626SKris Kennaway	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
150174664626SKris Kennaway	s/^PLATFORM=.*$/PLATFORM=$target/;
150274664626SKris Kennaway	s/^OPTIONS=.*$/OPTIONS=$options/;
1503ddd58736SKris Kennaway	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
15046a599222SSimon L. B. Nielsen	if ($cross_compile_prefix)
15056a599222SSimon L. B. Nielsen		{
15066a599222SSimon L. B. Nielsen		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
15076a599222SSimon L. B. Nielsen		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
15086a599222SSimon L. B. Nielsen		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
15096a599222SSimon L. B. Nielsen		}
15106a599222SSimon L. B. Nielsen	else	{
151174664626SKris Kennaway		s/^CC=.*$/CC= $cc/;
15126a599222SSimon L. B. Nielsen		s/^AR=\s*ar/AR= $ar/;
15136a599222SSimon L. B. Nielsen		s/^RANLIB=.*/RANLIB= $ranlib/;
15146a599222SSimon L. B. Nielsen		}
15155c87c606SMark Murray	s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
151674664626SKris Kennaway	s/^CFLAG=.*$/CFLAG= $cflags/;
151774664626SKris Kennaway	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1518db522d3aSSimon L. B. Nielsen	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
151974664626SKris Kennaway	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
15205740a5e3SKris Kennaway	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
15213b4e3dcbSSimon L. B. Nielsen	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
152274664626SKris Kennaway	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
152374664626SKris Kennaway	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
15243b4e3dcbSSimon L. B. Nielsen	s/^AES_ASM_OBJ=.*$/AES_ASM_OBJ= $aes_obj/;
152574664626SKris Kennaway	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
152674664626SKris Kennaway	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
152774664626SKris Kennaway	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
152874664626SKris Kennaway	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
152974664626SKris Kennaway	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
153074664626SKris Kennaway	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
153174664626SKris Kennaway	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
153274664626SKris Kennaway	s/^PROCESSOR=.*/PROCESSOR= $processor/;
15335c87c606SMark Murray	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
153474664626SKris Kennaway	s/^PERL=.*/PERL= $perl/;
15355c87c606SMark Murray	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1536fceca8a3SJacques Vidrine	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
15373b4e3dcbSSimon L. B. Nielsen	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
15383b4e3dcbSSimon L. B. Nielsen	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
1539db522d3aSSimon L. B. Nielsen	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1540db522d3aSSimon L. B. Nielsen	if ($fipsdso)
1541db522d3aSSimon L. B. Nielsen		{
1542db522d3aSSimon L. B. Nielsen		s/^FIPSCANLIB=.*/FIPSCANLIB=libfips/;
1543db522d3aSSimon L. B. Nielsen		s/^SHARED_FIPS=.*/SHARED_FIPS=libfips\$(SHLIB_EXT)/;
1544db522d3aSSimon L. B. Nielsen		s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl fips/;
1545db522d3aSSimon L. B. Nielsen		}
1546db522d3aSSimon L. B. Nielsen	else
1547db522d3aSSimon L. B. Nielsen		{
1548db522d3aSSimon L. B. Nielsen		s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1549db522d3aSSimon L. B. Nielsen		s/^SHARED_FIPS=.*/SHARED_FIPS=/;
1550db522d3aSSimon L. B. Nielsen		s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl/;
1551db522d3aSSimon L. B. Nielsen		}
1552db522d3aSSimon L. B. Nielsen	s/^FIPSCANISTERINTERNAL=.*/FIPSCANISTERINTERNAL=$fipscanisterinternal/;
1553db522d3aSSimon L. B. Nielsen	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
1554ddd58736SKris Kennaway	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
15555740a5e3SKris Kennaway	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
1556db522d3aSSimon L. B. Nielsen	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
1557a21b1b38SKris Kennaway	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
1558a21b1b38SKris Kennaway		{
1559a21b1b38SKris Kennaway		my $sotmp = $1;
15604f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
15614f20a5a2SJacques Vidrine		}
15624f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
15634f20a5a2SJacques Vidrine		{
15644f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1565a21b1b38SKris Kennaway		}
1566a21b1b38SKris Kennaway	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
1567a21b1b38SKris Kennaway		{
1568a21b1b38SKris Kennaway		my $sotmp = $1;
1569a21b1b38SKris Kennaway		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
1570a21b1b38SKris Kennaway		}
15714f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
15724f20a5a2SJacques Vidrine		{
15734f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
15744f20a5a2SJacques Vidrine		}
1575c1803d78SJacques Vidrine	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
157674664626SKris Kennaway	print OUT $_."\n";
157774664626SKris Kennaway	}
157874664626SKris Kennawayclose(IN);
157974664626SKris Kennawayclose(OUT);
15805c87c606SMark Murrayrename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
15815c87c606SMark Murrayrename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
158274664626SKris Kennaway
158374664626SKris Kennawayprint "CC            =$cc\n";
158474664626SKris Kennawayprint "CFLAG         =$cflags\n";
158574664626SKris Kennawayprint "EX_LIBS       =$lflags\n";
15863b4e3dcbSSimon L. B. Nielsenprint "CPUID_OBJ     =$cpuid_obj\n";
158774664626SKris Kennawayprint "BN_ASM        =$bn_obj\n";
158874664626SKris Kennawayprint "DES_ENC       =$des_obj\n";
15893b4e3dcbSSimon L. B. Nielsenprint "AES_ASM_OBJ   =$aes_obj\n";
159074664626SKris Kennawayprint "BF_ENC        =$bf_obj\n";
159174664626SKris Kennawayprint "CAST_ENC      =$cast_obj\n";
159274664626SKris Kennawayprint "RC4_ENC       =$rc4_obj\n";
159374664626SKris Kennawayprint "RC5_ENC       =$rc5_obj\n";
159474664626SKris Kennawayprint "MD5_OBJ_ASM   =$md5_obj\n";
159574664626SKris Kennawayprint "SHA1_OBJ_ASM  =$sha1_obj\n";
159674664626SKris Kennawayprint "RMD160_OBJ_ASM=$rmd160_obj\n";
159774664626SKris Kennawayprint "PROCESSOR     =$processor\n";
159874664626SKris Kennawayprint "RANLIB        =$ranlib\n";
15995c87c606SMark Murrayprint "ARFLAGS       =$arflags\n";
160074664626SKris Kennawayprint "PERL          =$perl\n";
16015c87c606SMark Murrayprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
16025c87c606SMark Murray	if $withargs{"krb5-include"} ne "";
160374664626SKris Kennaway
160474664626SKris Kennawaymy $des_ptr=0;
160574664626SKris Kennawaymy $des_risc1=0;
160674664626SKris Kennawaymy $des_risc2=0;
160774664626SKris Kennawaymy $des_unroll=0;
160874664626SKris Kennawaymy $bn_ll=0;
160974664626SKris Kennawaymy $def_int=2;
161074664626SKris Kennawaymy $rc4_int=$def_int;
161174664626SKris Kennawaymy $md2_int=$def_int;
161274664626SKris Kennawaymy $idea_int=$def_int;
161374664626SKris Kennawaymy $rc2_int=$def_int;
161474664626SKris Kennawaymy $rc4_idx=0;
1615f579bf8eSKris Kennawaymy $rc4_chunk=0;
161674664626SKris Kennawaymy $bf_ptr=0;
161774664626SKris Kennawaymy @type=("char","short","int","long");
161874664626SKris Kennawaymy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
16195c87c606SMark Murraymy $export_var_as_fn=0;
162074664626SKris Kennaway
162174664626SKris Kennawaymy $des_int;
162274664626SKris Kennaway
162374664626SKris Kennawayforeach (sort split(/\s+/,$bn_ops))
162474664626SKris Kennaway	{
162574664626SKris Kennaway	$des_ptr=1 if /DES_PTR/;
162674664626SKris Kennaway	$des_risc1=1 if /DES_RISC1/;
162774664626SKris Kennaway	$des_risc2=1 if /DES_RISC2/;
162874664626SKris Kennaway	$des_unroll=1 if /DES_UNROLL/;
162974664626SKris Kennaway	$des_int=1 if /DES_INT/;
163074664626SKris Kennaway	$bn_ll=1 if /BN_LLONG/;
163174664626SKris Kennaway	$rc4_int=0 if /RC4_CHAR/;
163274664626SKris Kennaway	$rc4_int=3 if /RC4_LONG/;
163374664626SKris Kennaway	$rc4_idx=1 if /RC4_INDEX/;
1634f579bf8eSKris Kennaway	$rc4_chunk=1 if /RC4_CHUNK/;
1635f579bf8eSKris Kennaway	$rc4_chunk=2 if /RC4_CHUNK_LL/;
163674664626SKris Kennaway	$md2_int=0 if /MD2_CHAR/;
163774664626SKris Kennaway	$md2_int=3 if /MD2_LONG/;
163874664626SKris Kennaway	$idea_int=1 if /IDEA_SHORT/;
163974664626SKris Kennaway	$idea_int=3 if /IDEA_LONG/;
164074664626SKris Kennaway	$rc2_int=1 if /RC2_SHORT/;
164174664626SKris Kennaway	$rc2_int=3 if /RC2_LONG/;
164274664626SKris Kennaway	$bf_ptr=1 if $_ eq "BF_PTR";
164374664626SKris Kennaway	$bf_ptr=2 if $_ eq "BF_PTR2";
164474664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
164574664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
164674664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
164774664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
164874664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
16495c87c606SMark Murray	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
165074664626SKris Kennaway	}
165174664626SKris Kennaway
165274664626SKris Kennawayopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
16535c87c606SMark Murrayunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
16545c87c606SMark Murrayopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
1655f579bf8eSKris Kennawayprint OUT "/* opensslconf.h */\n";
1656f579bf8eSKris Kennawayprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
1657f579bf8eSKris Kennaway
1658f579bf8eSKris Kennawayprint OUT "/* OpenSSL was configured with the following options: */\n";
16595c87c606SMark Murraymy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1660db522d3aSSimon L. B. Nielsen$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n#  define OPENSSL_NO_$1\n# endif\n#endif/mg;
16615c87c606SMark Murray$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1662f579bf8eSKris Kennaway$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1663f579bf8eSKris Kennaway$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1664f579bf8eSKris Kennaway$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
16655c87c606SMark Murray$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1666f579bf8eSKris Kennaway$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
16675c87c606SMark Murrayprint OUT $openssl_sys_defines;
16685c87c606SMark Murrayprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1669db522d3aSSimon L. B. Nielsenprint OUT $openssl_experimental_defines;
1670db522d3aSSimon L. B. Nielsenprint OUT "\n";
16715c87c606SMark Murrayprint OUT $openssl_algorithm_defines;
1672db522d3aSSimon L. B. Nielsenprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
16735c87c606SMark Murrayprint OUT $openssl_thread_defines;
16745c87c606SMark Murrayprint OUT $openssl_other_defines,"\n";
16755c87c606SMark Murray
16765c87c606SMark Murrayprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
16775c87c606SMark Murrayprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
16785c87c606SMark Murrayprint OUT "   who haven't had the time to do the appropriate changes in their\n";
16795c87c606SMark Murrayprint OUT "   applications.  */\n";
16805c87c606SMark Murrayprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
16815c87c606SMark Murrayprint OUT $openssl_algorithm_defines_trans;
16825c87c606SMark Murrayprint OUT "#endif\n\n";
1683f579bf8eSKris Kennaway
16843b4e3dcbSSimon L. B. Nielsenprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj);
16853b4e3dcbSSimon L. B. Nielsen
168674664626SKris Kennawaywhile (<IN>)
168774664626SKris Kennaway	{
168874664626SKris Kennaway	if	(/^#define\s+OPENSSLDIR/)
16896a599222SSimon L. B. Nielsen		{
16906a599222SSimon L. B. Nielsen		my $foo = $openssldir;
16916a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
16926a599222SSimon L. B. Nielsen		print OUT "#define OPENSSLDIR \"$foo\"\n";
16936a599222SSimon L. B. Nielsen		}
16943b4e3dcbSSimon L. B. Nielsen	elsif	(/^#define\s+ENGINESDIR/)
16956a599222SSimon L. B. Nielsen		{
16966a599222SSimon L. B. Nielsen		# $foo is to become "$prefix/lib$multilib/engines";
16976a599222SSimon L. B. Nielsen		# as Makefile.org and engines/Makefile are adapted for
16986a599222SSimon L. B. Nielsen		# $multilib suffix.
16996a599222SSimon L. B. Nielsen		my $foo = "$prefix/lib/engines";
17006a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
17016a599222SSimon L. B. Nielsen		print OUT "#define ENGINESDIR \"$foo\"\n";
17026a599222SSimon L. B. Nielsen		}
17035c87c606SMark Murray	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
17045c87c606SMark Murray		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
17055c87c606SMark Murray			if $export_var_as_fn;
17065c87c606SMark Murray		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
17075c87c606SMark Murray			($export_var_as_fn)?"define":"undef"; }
170874664626SKris Kennaway	elsif	(/^#define\s+OPENSSL_UNISTD/)
170974664626SKris Kennaway		{
171074664626SKris Kennaway		$unistd = "<unistd.h>" if $unistd eq "";
171174664626SKris Kennaway		print OUT "#define OPENSSL_UNISTD $unistd\n";
171274664626SKris Kennaway		}
171374664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
171474664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
171574664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
171674664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
171774664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
171874664626SKris Kennaway		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
171974664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
172074664626SKris Kennaway		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
172174664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
172274664626SKris Kennaway		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
172374664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
172474664626SKris Kennaway		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
172574664626SKris Kennaway	elsif	(/^\#define\s+DES_LONG\s+.*/)
172674664626SKris Kennaway		{ printf OUT "#define DES_LONG unsigned %s\n",
172774664626SKris Kennaway			($des_int)?'int':'long'; }
172874664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_PTR/)
172974664626SKris Kennaway		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
173074664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC1/)
173174664626SKris Kennaway		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
173274664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC2/)
173374664626SKris Kennaway		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
173474664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
173574664626SKris Kennaway		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
173674664626SKris Kennaway	elsif	(/^#define\s+RC4_INT\s/)
173774664626SKris Kennaway		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
1738f579bf8eSKris Kennaway	elsif	(/^#undef\s+RC4_CHUNK/)
1739f579bf8eSKris Kennaway		{
1740f579bf8eSKris Kennaway		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
1741f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
1742f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
1743f579bf8eSKris Kennaway		}
174474664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
174574664626SKris Kennaway		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
174674664626SKris Kennaway	elsif (/^#(define|undef)\s+I386_ONLY/)
17473b4e3dcbSSimon L. B. Nielsen		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
174874664626SKris Kennaway			"define":"undef"; }
174974664626SKris Kennaway	elsif	(/^#define\s+MD2_INT\s/)
175074664626SKris Kennaway		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
175174664626SKris Kennaway	elsif	(/^#define\s+IDEA_INT\s/)
175274664626SKris Kennaway		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
175374664626SKris Kennaway	elsif	(/^#define\s+RC2_INT\s/)
175474664626SKris Kennaway		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
175574664626SKris Kennaway	elsif (/^#(define|undef)\s+BF_PTR/)
175674664626SKris Kennaway		{
175774664626SKris Kennaway		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
175874664626SKris Kennaway		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
175974664626SKris Kennaway		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
176074664626SKris Kennaway	        }
176174664626SKris Kennaway	else
176274664626SKris Kennaway		{ print OUT $_; }
176374664626SKris Kennaway	}
176474664626SKris Kennawayclose(IN);
176574664626SKris Kennawayclose(OUT);
17665c87c606SMark Murrayrename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
17675c87c606SMark Murrayrename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
176874664626SKris Kennaway
176974664626SKris Kennaway
177074664626SKris Kennaway# Fix the date
177174664626SKris Kennaway
177274664626SKris Kennawayprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
177374664626SKris Kennawayprint "SIXTY_FOUR_BIT mode\n" if $b64;
177474664626SKris Kennawayprint "THIRTY_TWO_BIT mode\n" if $b32;
177574664626SKris Kennawayprint "SIXTEEN_BIT mode\n" if $b16;
177674664626SKris Kennawayprint "EIGHT_BIT mode\n" if $b8;
177774664626SKris Kennawayprint "DES_PTR used\n" if $des_ptr;
177874664626SKris Kennawayprint "DES_RISC1 used\n" if $des_risc1;
177974664626SKris Kennawayprint "DES_RISC2 used\n" if $des_risc2;
178074664626SKris Kennawayprint "DES_UNROLL used\n" if $des_unroll;
178174664626SKris Kennawayprint "DES_INT used\n" if $des_int;
178274664626SKris Kennawayprint "BN_LLONG mode\n" if $bn_ll;
178374664626SKris Kennawayprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
178474664626SKris Kennawayprint "RC4_INDEX mode\n" if $rc4_idx;
1785f579bf8eSKris Kennawayprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
1786f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
1787f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
178874664626SKris Kennawayprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
178974664626SKris Kennawayprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
179074664626SKris Kennawayprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
179174664626SKris Kennawayprint "BF_PTR used\n" if $bf_ptr == 1;
179274664626SKris Kennawayprint "BF_PTR2 used\n" if $bf_ptr == 2;
179374664626SKris Kennaway
17943b4e3dcbSSimon L. B. Nielsenif($IsMK1MF) {
179574664626SKris Kennaway	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
179674664626SKris Kennaway	printf OUT <<EOF;
179774664626SKris Kennaway#ifndef MK1MF_BUILD
179874664626SKris Kennaway  /* auto-generated by Configure for crypto/cversion.c:
17993b4e3dcbSSimon L. B. Nielsen   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
180074664626SKris Kennaway   * Windows builds (and other mk1mf builds) compile cversion.c with
180174664626SKris Kennaway   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
180274664626SKris Kennaway  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
180374664626SKris Kennaway#endif
180474664626SKris KennawayEOF
180574664626SKris Kennaway	close(OUT);
180674664626SKris Kennaway} else {
18076a599222SSimon L. B. Nielsen	my $make_command = "$make PERL=\'$perl\'";
18085c87c606SMark Murray	my $make_targets = "";
18095c87c606SMark Murray	$make_targets .= " links" if $symlink;
18103b4e3dcbSSimon L. B. Nielsen	$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
18115c87c606SMark Murray	$make_targets .= " gentests" if $symlink;
18125c87c606SMark Murray	(system $make_command.$make_targets) == 0 or exit $?
18135c87c606SMark Murray		if $make_targets ne "";
181474664626SKris Kennaway	if ( $perl =~ m@^/@) {
1815ddd58736SKris Kennaway	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
1816f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
181774664626SKris Kennaway	} else {
181874664626SKris Kennaway	    # No path for Perl known ...
1819ddd58736SKris Kennaway	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
1820f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
182174664626SKris Kennaway	}
18223b4e3dcbSSimon L. B. Nielsen	if ($depflags ne $default_depflags && !$make_depend) {
18235c87c606SMark Murray		print <<EOF;
18245c87c606SMark Murray
18253b4e3dcbSSimon L. B. NielsenSince you've disabled or enabled at least one algorithm, you need to do
18263b4e3dcbSSimon L. B. Nielsenthe following before building:
18275c87c606SMark Murray
18285c87c606SMark Murray	make depend
18295c87c606SMark MurrayEOF
18305c87c606SMark Murray	}
183174664626SKris Kennaway}
183274664626SKris Kennaway
18333b4e3dcbSSimon L. B. Nielsen# create the ms/version32.rc file if needed
1834db522d3aSSimon L. B. Nielsenif ($IsMK1MF && ($target !~ /^netware/)) {
18353b4e3dcbSSimon L. B. Nielsen	my ($v1, $v2, $v3, $v4);
18363b4e3dcbSSimon L. B. Nielsen	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
18373b4e3dcbSSimon L. B. Nielsen		$v1=hex $1;
18383b4e3dcbSSimon L. B. Nielsen		$v2=hex $2;
18393b4e3dcbSSimon L. B. Nielsen		$v3=hex $3;
18403b4e3dcbSSimon L. B. Nielsen		$v4=hex $4;
18413b4e3dcbSSimon L. B. Nielsen	}
18423b4e3dcbSSimon L. B. Nielsen	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
18433b4e3dcbSSimon L. B. Nielsen	print OUT <<EOF;
18443b4e3dcbSSimon L. B. Nielsen#include <winver.h>
18453b4e3dcbSSimon L. B. Nielsen
18463b4e3dcbSSimon L. B. NielsenLANGUAGE 0x09,0x01
18473b4e3dcbSSimon L. B. Nielsen
18483b4e3dcbSSimon L. B. Nielsen1 VERSIONINFO
18493b4e3dcbSSimon L. B. Nielsen  FILEVERSION $v1,$v2,$v3,$v4
18503b4e3dcbSSimon L. B. Nielsen  PRODUCTVERSION $v1,$v2,$v3,$v4
18513b4e3dcbSSimon L. B. Nielsen  FILEFLAGSMASK 0x3fL
18523b4e3dcbSSimon L. B. Nielsen#ifdef _DEBUG
18533b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x01L
18543b4e3dcbSSimon L. B. Nielsen#else
18553b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x00L
18563b4e3dcbSSimon L. B. Nielsen#endif
18573b4e3dcbSSimon L. B. Nielsen  FILEOS VOS__WINDOWS32
18583b4e3dcbSSimon L. B. Nielsen  FILETYPE VFT_DLL
18593b4e3dcbSSimon L. B. Nielsen  FILESUBTYPE 0x0L
18603b4e3dcbSSimon L. B. NielsenBEGIN
18613b4e3dcbSSimon L. B. Nielsen    BLOCK "StringFileInfo"
18623b4e3dcbSSimon L. B. Nielsen    BEGIN
18633b4e3dcbSSimon L. B. Nielsen	BLOCK "040904b0"
18643b4e3dcbSSimon L. B. Nielsen	BEGIN
1865db522d3aSSimon L. B. Nielsen#if defined(FIPS)
1866db522d3aSSimon L. B. Nielsen	    VALUE "Comments", "WARNING: TEST VERSION ONLY ***NOT*** FIPS 140-2 VALIDATED.\\0"
1867db522d3aSSimon L. B. Nielsen#endif
18683b4e3dcbSSimon L. B. Nielsen	    // Required:
18693b4e3dcbSSimon L. B. Nielsen	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
1870db522d3aSSimon L. B. Nielsen#if defined(FIPS)
1871db522d3aSSimon L. B. Nielsen	    VALUE "FileDescription", "TEST UNVALIDATED FIPS140-2 DLL\\0"
1872db522d3aSSimon L. B. Nielsen#else
18733b4e3dcbSSimon L. B. Nielsen	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
1874db522d3aSSimon L. B. Nielsen#endif
18753b4e3dcbSSimon L. B. Nielsen	    VALUE "FileVersion", "$version\\0"
18763b4e3dcbSSimon L. B. Nielsen#if defined(CRYPTO)
18773b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "libeay32\\0"
18783b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "libeay32.dll\\0"
18793b4e3dcbSSimon L. B. Nielsen#elif defined(SSL)
18803b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "ssleay32\\0"
18813b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "ssleay32.dll\\0"
1882db522d3aSSimon L. B. Nielsen#elif defined(FIPS)
1883db522d3aSSimon L. B. Nielsen	    VALUE "InternalName", "libosslfips\\0"
1884db522d3aSSimon L. B. Nielsen	    VALUE "OriginalFilename", "libosslfips.dll\\0"
18853b4e3dcbSSimon L. B. Nielsen#endif
18863b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
18873b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductVersion", "$version\\0"
18883b4e3dcbSSimon L. B. Nielsen	    // Optional:
18893b4e3dcbSSimon L. B. Nielsen	    //VALUE "Comments", "\\0"
1890db522d3aSSimon L. B. Nielsen	    VALUE "LegalCopyright", "Copyright � 1998-2007 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
18913b4e3dcbSSimon L. B. Nielsen	    //VALUE "LegalTrademarks", "\\0"
18923b4e3dcbSSimon L. B. Nielsen	    //VALUE "PrivateBuild", "\\0"
18933b4e3dcbSSimon L. B. Nielsen	    //VALUE "SpecialBuild", "\\0"
18943b4e3dcbSSimon L. B. Nielsen	END
18953b4e3dcbSSimon L. B. Nielsen    END
18963b4e3dcbSSimon L. B. Nielsen    BLOCK "VarFileInfo"
18973b4e3dcbSSimon L. B. Nielsen    BEGIN
18983b4e3dcbSSimon L. B. Nielsen        VALUE "Translation", 0x409, 0x4b0
18993b4e3dcbSSimon L. B. Nielsen    END
19003b4e3dcbSSimon L. B. NielsenEND
19013b4e3dcbSSimon L. B. NielsenEOF
19023b4e3dcbSSimon L. B. Nielsen	close(OUT);
19033b4e3dcbSSimon L. B. Nielsen  }
19043b4e3dcbSSimon L. B. Nielsen
190574664626SKris Kennawayprint <<EOF;
190674664626SKris Kennaway
1907f579bf8eSKris KennawayConfigured for $target.
190874664626SKris KennawayEOF
190974664626SKris Kennaway
191074664626SKris Kennawayprint <<\EOF if (!$no_threads && !$threads);
191174664626SKris Kennaway
191274664626SKris KennawayThe library could not be configured for supporting multi-threaded
191374664626SKris Kennawayapplications as the compiler options required on this system are not known.
191474664626SKris KennawaySee file INSTALL for details if you need multi-threading.
191574664626SKris KennawayEOF
191674664626SKris Kennaway
1917fceca8a3SJacques Vidrineprint <<\EOF if ($no_shared_warn);
1918fceca8a3SJacques Vidrine
1919fceca8a3SJacques VidrineYou gave the option 'shared'.  Normally, that would give you shared libraries.
1920fceca8a3SJacques VidrineUnfortunately, the OpenSSL configuration doesn't include shared library support
1921fceca8a3SJacques Vidrinefor this platform yet, so it will pretend you gave the option 'no-shared'.  If
1922fceca8a3SJacques Vidrineyou can inform the developpers (openssl-dev\@openssl.org) how to support shared
1923fceca8a3SJacques Vidrinelibraries on this platform, they will at least look at it and try their best
1924fceca8a3SJacques Vidrine(but please first make sure you have tried with a current version of OpenSSL).
1925fceca8a3SJacques VidrineEOF
1926fceca8a3SJacques Vidrine
1927db522d3aSSimon L. B. Nielsenprint <<\EOF if ($fipscanisterinternal eq "y");
1928db522d3aSSimon L. B. Nielsen
1929db522d3aSSimon L. B. NielsenWARNING: OpenSSL has been configured using unsupported option(s) to internally
1930db522d3aSSimon L. B. Nielsengenerate a fipscanister.o object module for TESTING PURPOSES ONLY; that
1931db522d3aSSimon L. B. Nielsencompiled module is NOT FIPS 140-2 validated and CANNOT be used to replace the
1932db522d3aSSimon L. B. NielsenOpenSSL FIPS Object Module as identified by the CMVP
1933db522d3aSSimon L. B. Nielsen(http://csrc.nist.gov/cryptval/) in any application requiring the use of FIPS
1934db522d3aSSimon L. B. Nielsen140-2 validated software.
1935db522d3aSSimon L. B. Nielsen
1936db522d3aSSimon L. B. NielsenThis is an OpenSSL 0.9.8 test version.
1937db522d3aSSimon L. B. Nielsen
1938db522d3aSSimon L. B. NielsenSee the file README.FIPS for details of how to build a test library.
1939db522d3aSSimon L. B. Nielsen
1940db522d3aSSimon L. B. NielsenEOF
1941db522d3aSSimon L. B. Nielsen
194274664626SKris Kennawayexit(0);
194374664626SKris Kennaway
194474664626SKris Kennawaysub usage
194574664626SKris Kennaway	{
194674664626SKris Kennaway	print STDERR $usage;
1947f579bf8eSKris Kennaway	print STDERR "\npick os/compiler from:\n";
194874664626SKris Kennaway	my $j=0;
194974664626SKris Kennaway	my $i;
1950f579bf8eSKris Kennaway        my $k=0;
195174664626SKris Kennaway	foreach $i (sort keys %table)
195274664626SKris Kennaway		{
195374664626SKris Kennaway		next if $i =~ /^debug/;
1954f579bf8eSKris Kennaway		$k += length($i) + 1;
1955f579bf8eSKris Kennaway		if ($k > 78)
1956f579bf8eSKris Kennaway			{
1957f579bf8eSKris Kennaway			print STDERR "\n";
1958f579bf8eSKris Kennaway			$k=length($i);
1959f579bf8eSKris Kennaway			}
1960f579bf8eSKris Kennaway		print STDERR $i . " ";
196174664626SKris Kennaway		}
196274664626SKris Kennaway	foreach $i (sort keys %table)
196374664626SKris Kennaway		{
196474664626SKris Kennaway		next if $i !~ /^debug/;
1965f579bf8eSKris Kennaway		$k += length($i) + 1;
1966f579bf8eSKris Kennaway		if ($k > 78)
1967f579bf8eSKris Kennaway			{
196874664626SKris Kennaway			print STDERR "\n";
1969f579bf8eSKris Kennaway			$k=length($i);
1970f579bf8eSKris Kennaway			}
1971f579bf8eSKris Kennaway		print STDERR $i . " ";
1972f579bf8eSKris Kennaway		}
1973f579bf8eSKris Kennaway	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
197474664626SKris Kennaway	exit(1);
197574664626SKris Kennaway	}
197674664626SKris Kennaway
197774664626SKris Kennawaysub which
197874664626SKris Kennaway	{
197974664626SKris Kennaway	my($name)=@_;
198074664626SKris Kennaway	my $path;
198174664626SKris Kennaway	foreach $path (split /:/, $ENV{PATH})
198274664626SKris Kennaway		{
19836be8ae07SJacques Vidrine		if (-f "$path/$name$exe_ext" and -x _)
198474664626SKris Kennaway			{
19856be8ae07SJacques Vidrine			return "$path/$name$exe_ext" unless ($name eq "perl" and
19866be8ae07SJacques Vidrine			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
198774664626SKris Kennaway			}
198874664626SKris Kennaway		}
198974664626SKris Kennaway	}
199074664626SKris Kennaway
199174664626SKris Kennawaysub dofile
199274664626SKris Kennaway	{
199374664626SKris Kennaway	my $f; my $p; my %m; my @a; my $k; my $ff;
199474664626SKris Kennaway	($f,$p,%m)=@_;
199574664626SKris Kennaway
199674664626SKris Kennaway	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
199774664626SKris Kennaway	@a=<IN>;
199874664626SKris Kennaway	close(IN);
199974664626SKris Kennaway	foreach $k (keys %m)
200074664626SKris Kennaway		{
200174664626SKris Kennaway		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
200274664626SKris Kennaway		}
2003f579bf8eSKris Kennaway	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
200474664626SKris Kennaway	print OUT @a;
200574664626SKris Kennaway	close(OUT);
2006f579bf8eSKris Kennaway	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
2007f579bf8eSKris Kennaway	rename("$f.new",$f) || die "unable to rename $f.new\n";
200874664626SKris Kennaway	}
200974664626SKris Kennaway
201074664626SKris Kennawaysub print_table_entry
201174664626SKris Kennaway	{
201274664626SKris Kennaway	my $target = shift;
201374664626SKris Kennaway
20145c87c606SMark Murray	(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
20153b4e3dcbSSimon L. B. Nielsen	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
2016ddd58736SKris Kennaway	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
20175740a5e3SKris Kennaway	my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
20185c87c606SMark Murray	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=
20195740a5e3SKris Kennaway	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
202074664626SKris Kennaway
202174664626SKris Kennaway	print <<EOF
202274664626SKris Kennaway
202374664626SKris Kennaway*** $target
202474664626SKris Kennaway\$cc           = $cc
202574664626SKris Kennaway\$cflags       = $cflags
202674664626SKris Kennaway\$unistd       = $unistd
202774664626SKris Kennaway\$thread_cflag = $thread_cflag
20285c87c606SMark Murray\$sys_id       = $sys_id
202974664626SKris Kennaway\$lflags       = $lflags
203074664626SKris Kennaway\$bn_ops       = $bn_ops
20313b4e3dcbSSimon L. B. Nielsen\$cpuid_obj    = $cpuid_obj
203274664626SKris Kennaway\$bn_obj       = $bn_obj
203374664626SKris Kennaway\$des_obj      = $des_obj
20343b4e3dcbSSimon L. B. Nielsen\$aes_obj      = $aes_obj
203574664626SKris Kennaway\$bf_obj       = $bf_obj
203674664626SKris Kennaway\$md5_obj      = $md5_obj
203774664626SKris Kennaway\$sha1_obj     = $sha1_obj
203874664626SKris Kennaway\$cast_obj     = $cast_obj
203974664626SKris Kennaway\$rc4_obj      = $rc4_obj
204074664626SKris Kennaway\$rmd160_obj   = $rmd160_obj
204174664626SKris Kennaway\$rc5_obj      = $rc5_obj
2042ddd58736SKris Kennaway\$dso_scheme   = $dso_scheme
2043ddd58736SKris Kennaway\$shared_target= $shared_target
2044ddd58736SKris Kennaway\$shared_cflag = $shared_cflag
2045c1803d78SJacques Vidrine\$shared_ldflag = $shared_ldflag
20465740a5e3SKris Kennaway\$shared_extension = $shared_extension
20475740a5e3SKris Kennaway\$ranlib       = $ranlib
20485c87c606SMark Murray\$arflags      = $arflags
204974664626SKris KennawayEOF
205074664626SKris Kennaway	}
2051c1803d78SJacques Vidrine
2052c1803d78SJacques Vidrinesub test_sanity
2053c1803d78SJacques Vidrine	{
2054c1803d78SJacques Vidrine	my $errorcnt = 0;
2055c1803d78SJacques Vidrine
2056c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2057c1803d78SJacques Vidrine	print STDERR "=== SANITY TESTING!\n";
2058c1803d78SJacques Vidrine	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2059c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2060c1803d78SJacques Vidrine
2061c1803d78SJacques Vidrine	foreach $target (sort keys %table)
2062c1803d78SJacques Vidrine		{
2063c1803d78SJacques Vidrine		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2064c1803d78SJacques Vidrine
2065c1803d78SJacques Vidrine		if ($fields[$idx_dso_scheme-1] =~ /^(dl|dlfcn|win32|vms)$/)
2066c1803d78SJacques Vidrine			{
2067c1803d78SJacques Vidrine			$errorcnt++;
2068c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2069c1803d78SJacques Vidrine			print STDERR "              in the previous field\n";
2070c1803d78SJacques Vidrine			}
2071c1803d78SJacques Vidrine		elsif ($fields[$idx_dso_scheme+1] =~ /^(dl|dlfcn|win32|vms)$/)
2072c1803d78SJacques Vidrine			{
2073c1803d78SJacques Vidrine			$errorcnt++;
2074c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2075c1803d78SJacques Vidrine			print STDERR "              in the following field\n";
2076c1803d78SJacques Vidrine			}
2077c1803d78SJacques Vidrine		elsif ($fields[$idx_dso_scheme] !~ /^(dl|dlfcn|win32|vms|)$/)
2078c1803d78SJacques Vidrine			{
2079c1803d78SJacques Vidrine			$errorcnt++;
2080c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
2081c1803d78SJacques Vidrine			print STDERR "              valid values are 'dl', 'dlfcn', 'win32' and 'vms'\n";
2082c1803d78SJacques Vidrine			}
2083c1803d78SJacques Vidrine		}
2084c1803d78SJacques Vidrine	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2085c1803d78SJacques Vidrine	return $errorcnt;
2086c1803d78SJacques Vidrine	}
2087ed5d4f9aSSimon L. B. Nielsen
2088ed5d4f9aSSimon L. B. Nielsen# Attempt to detect MSYS environment
2089ed5d4f9aSSimon L. B. Nielsen
2090ed5d4f9aSSimon L. B. Nielsensub is_msys
2091ed5d4f9aSSimon L. B. Nielsen	{
2092ed5d4f9aSSimon L. B. Nielsen	return 1 if (exists $ENV{"TERM"} && $ENV{"TERM"} eq "msys");
2093ed5d4f9aSSimon L. B. Nielsen	return 0;
2094ed5d4f9aSSimon L. B. Nielsen	}
2095