155714Skris:
255714Skriseval 'exec perl -S $0 ${1+"$@"}'
355714Skris    if $running_under_some_shell;
455714Skris##
555714Skris##  Configure -- OpenSSL source tree configuration script
655714Skris##
755714Skris
855714Skrisrequire 5.000;
9238405Sjkimuse strict;
1055714Skris
1155714Skris# see INSTALL for instructions.
1255714Skris
13238405Sjkimmy $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] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
1455714Skris
1555714Skris# Options:
1655714Skris#
1755714Skris# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
1855714Skris#               --prefix option is given; /usr/local/ssl otherwise)
1955714Skris# --prefix      prefix for the OpenSSL include, lib and bin directories
2055714Skris#               (Default: the OPENSSLDIR directory)
2155714Skris#
2255714Skris# --install_prefix  Additional prefix for package builders (empty by
2355714Skris#               default).  This needn't be set in advance, you can
2455714Skris#               just as well use "make INSTALL_PREFIX=/whatever install".
2555714Skris#
26109998Smarkm# --with-krb5-dir  Declare where Kerberos 5 lives.  The libraries are expected
27109998Smarkm#		to live in the subdirectory lib/ and the header files in
28109998Smarkm#		include/.  A value is required.
29109998Smarkm# --with-krb5-lib  Declare where the Kerberos 5 libraries live.  A value is
30109998Smarkm#		required.
31109998Smarkm#		(Default: KRB5_DIR/lib)
32109998Smarkm# --with-krb5-include  Declare where the Kerberos 5 header files live.  A
33109998Smarkm#		value is required.
34109998Smarkm#		(Default: KRB5_DIR/include)
35109998Smarkm# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
36109998Smarkm#		supported values are "MIT" and "Heimdal".  A value is required.
37109998Smarkm#
38100928Snectar# --test-sanity Make a number of sanity checks on the data in this file.
39100928Snectar#               This is a debugging tool for OpenSSL developers.
40100928Snectar#
41238405Sjkim# --cross-compile-prefix Add specified prefix to binutils components.
42238405Sjkim#
43109998Smarkm# no-hw-xxx     do not compile support for specific crypto hardware.
44109998Smarkm#               Generic OpenSSL-style methods relating to this support
45109998Smarkm#               are always compiled but return NULL if the hardware
46109998Smarkm#               support isn't compiled.
47109998Smarkm# no-hw         do not compile support for any crypto hardware.
4855714Skris# [no-]threads  [don't] try to create a library that is suitable for
4955714Skris#               multithreaded applications (default is "threads" if we
5055714Skris#               know how to do it)
5168651Skris# [no-]shared	[don't] try to create shared libraries when supported.
5255714Skris# no-asm        do not use assembler
5368651Skris# no-dso        do not compile in any native shared-library methods. This
5468651Skris#               will ensure that all methods just return NULL.
55109998Smarkm# no-krb5       do not compile in any KRB5 library or code.
56109998Smarkm# [no-]zlib     [don't] compile support for zlib compression.
57109998Smarkm# zlib-dynamic	Like "zlib", but the zlib library is expected to be a shared
58109998Smarkm#		library and will be loaded in run-time by the OpenSSL library.
59238405Sjkim# sctp          include SCTP support
6055714Skris# 386           generate 80386 code
61296317Sdelphij# enable-weak-ssl-ciphers
62296317Sdelphij#		Enable EXPORT and LOW SSLv3 ciphers that are disabled by
63296317Sdelphij#		default.  Note, weak SSLv2 ciphers are unconditionally
64296317Sdelphij#		disabled.
65160814Ssimon# no-sse2	disables IA-32 SSE2 code, above option implies no-sse2
6655714Skris# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
6755714Skris# -<xxx> +<xxx> compiler options are passed through 
6868651Skris#
6968651Skris# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
7068651Skris#		provided to stack calls. Generates unique stack functions for
7168651Skris#		each possible stack type.
7255714Skris# DES_PTR	use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
7355714Skris# DES_RISC1	use different DES_ENCRYPT macro that helps reduce register
7455714Skris#		dependancies but needs to more registers, good for RISC CPU's
7555714Skris# DES_RISC2	A different RISC variant.
7655714Skris# DES_UNROLL	unroll the inner DES loop, sometimes helps, somtimes hinders.
7755714Skris# DES_INT	use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
7855714Skris#		This is used on the DEC Alpha where long is 8 bytes
7955714Skris#		and int is 4
8055714Skris# BN_LLONG	use the type 'long long' in crypto/bn/bn.h
8155714Skris# MD2_CHAR	use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
8255714Skris# MD2_LONG	use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
8355714Skris# IDEA_SHORT	use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8455714Skris# IDEA_LONG	use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8555714Skris# RC2_SHORT	use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8655714Skris# RC2_LONG	use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8755714Skris# RC4_CHAR	use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8855714Skris# RC4_LONG	use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8955714Skris# RC4_INDEX	define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
9055714Skris#		array lookups instead of pointer use.
9159191Skris# RC4_CHUNK	enables code that handles data aligned at long (natural CPU
9259191Skris#		word) boundary.
9359191Skris# RC4_CHUNK_LL	enables code that handles data aligned at long long boundary
9459191Skris#		(intended for 64-bit CPUs running 32-bit OS).
9555714Skris# BF_PTR	use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
9655714Skris# BF_PTR2	intel specific version (generic version is more efficient).
97160814Ssimon#
98160814Ssimon# Following are set automatically by this script
99160814Ssimon#
10055714Skris# MD5_ASM	use some extra md5 assember,
10155714Skris# SHA1_ASM	use some extra sha1 assember, must define L_ENDIAN for x86
10255714Skris# RMD160_ASM	use some extra ripemd160 assember,
103160814Ssimon# SHA256_ASM	sha256_block is implemented in assembler
104160814Ssimon# SHA512_ASM	sha512_block is implemented in assembler
105160814Ssimon# AES_ASM	ASE_[en|de]crypt is implemented in assembler
10655714Skris
107194206Ssimon# Minimum warning options... any contributions to OpenSSL should at least get
108194206Ssimon# past these. 
109194206Ssimon
110194206Ssimonmy $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";
111194206Ssimon
112295016Sjkim# Warn that "make depend" should be run?
113295016Sjkimmy $warn_make_depend = 0;
114295016Sjkim
115291721Sjkimmy $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
116291721Sjkim
117205128Ssimonmy $strict_warnings = 0;
118205128Ssimon
11955714Skrismy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
12055714Skris
12155714Skris# MD2_CHAR slags pentium pros
12255714Skrismy $x86_gcc_opts="RC4_INDEX MD2_INT";
12355714Skris
12455714Skris# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
12555714Skris# Don't worry about these normally
12655714Skris
12755714Skrismy $tcc="cc";
12855714Skrismy $tflags="-fast -Xa";
12955714Skrismy $tbn_mul="";
13055714Skrismy $tlib="-lnsl -lsocket";
13155714Skris#$bits1="SIXTEEN_BIT ";
13255714Skris#$bits2="THIRTY_TWO_BIT ";
13355714Skrismy $bits1="THIRTY_TWO_BIT ";
13455714Skrismy $bits2="SIXTY_FOUR_BIT ";
13555714Skris
136238405Sjkimmy $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o:des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o:";
13755714Skris
138238405Sjkimmy $x86_elf_asm="$x86_asm:elf";
13976866Skris
140238405Sjkimmy $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o:";
141238405Sjkimmy $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::ghash-ia64.o::void";
142238405Sjkimmy $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::ghash-sparcv9.o::void";
143238405Sjkimmy $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::::void";
144238405Sjkimmy $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o:::::sha1-alpha.o:::::::ghash-alpha.o::void";
145238405Sjkimmy $mips32_asm=":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o::::::::";
146238405Sjkimmy $mips64_asm=":bn-mips.o mips-mont.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::";
147238405Sjkimmy $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o:";
148238405Sjkimmy $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o::void";
149238405Sjkimmy $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::32";
150238405Sjkimmy $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::64";
151238405Sjkimmy $ppc32_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::::";
152238405Sjkimmy $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::::";
153238405Sjkimmy $no_asm=":::::::::::::::void";
15455714Skris
155160814Ssimon# As for $BSDthreads. Idea is to maintain "collective" set of flags,
156160814Ssimon# which would cover all BSD flavors. -pthread applies to them all, 
157160814Ssimon# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
158160814Ssimon# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
159160814Ssimon# which has to be accompanied by explicit -D_THREAD_SAFE and
160160814Ssimon# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
161160814Ssimon# seems to be sufficient?
162160814Ssimonmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
16359191Skris
164238405Sjkim#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 : $wp_obj : $cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
165160814Ssimon
16655714Skrismy %table=(
16768651Skris# File 'TABLE' (created by 'make TABLE') contains the data from this list,
16868651Skris# formatted for better readability.
16968651Skris
17068651Skris
17159191Skris#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
17259191Skris#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
17359191Skris#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
17459191Skris#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
17555714Skris
17655714Skris# Our development configs
177109998Smarkm"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
178109998Smarkm"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::::",
179238405Sjkim"debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
180109998Smarkm"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)::::",
181109998Smarkm"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)::::",
182238405Sjkim"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
183246772Sjkim"debug-ben-debug-64",	"gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
184238405Sjkim"debug-ben-macos",	"cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::",
185238405Sjkim"debug-ben-macos-gcc46",	"gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::",
186246772Sjkim"debug-ben-darwin64","cc:$gcc_devteam_warn -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
187238405Sjkim"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
188109998Smarkm"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)::::::",
189109998Smarkm"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
190264331Sjkim"debug-bodo",	"gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
191160814Ssimon"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",
192246772Sjkim"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
193194206Ssimon"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)",
194238405Sjkim"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
195246772Sjkim"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
196246772Sjkim"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
197280304Sjkim"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -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)",
198280304Sjkim"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 -DPEDANTIC -ggdb -g3 -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)",
199238405Sjkim"debug-geoff32","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:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
200238405Sjkim"debug-geoff64","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: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)",
201280304Sjkim"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
202280304Sjkim"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
203280304Sjkim"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -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)",
204280304Sjkim"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -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)",
205280304Sjkim"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
206280304Sjkim"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -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)",
207280304Sjkim"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -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)",
208280304Sjkim"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
209291721Sjkim"debug-linux-x86_64-clang","clang: -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
210109998Smarkm"dist",		"cc:-O::(unknown)::::::",
21155714Skris
21259191Skris# Basic configs that should work on any (32 and less bit) box
213109998Smarkm"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
214109998Smarkm"cc",		"cc:-O::(unknown)::::::",
21555714Skris
216142425Snectar####VOS Configurations
217238405Sjkim"vos-gcc","gcc:-O3 -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
218238405Sjkim"debug-vos-gcc","gcc:-O0 -g -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
219142425Snectar
220109998Smarkm#### Solaris x86 with GNU C setups
221109998Smarkm# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
22259191Skris# here because whenever GNU C instantiates an assembler template it
22359191Skris# surrounds it with #APP #NO_APP comment pair which (at least Solaris
22459191Skris# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
22559191Skris# error message.
226160814Ssimon"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)",
227160814Ssimon# -shared -static-libgcc might appear controversial, but modules taken
228160814Ssimon# from static libgcc do not have relocations and linking them into our
229160814Ssimon# shared objects doesn't have any negative side-effects. On the contrary,
230160814Ssimon# doing so makes it possible to use gcc shared build with Sun C. Given
231160814Ssimon# that gcc generates faster code [thanks to inline assembler], I would
232160814Ssimon# actually recommend to consider using gcc shared build even with vendor
233160814Ssimon# compiler:-)
234160814Ssimon#						<appro@fy.chalmers.se>
235238405Sjkim"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
236160814Ssimon 
23779998Skris#### Solaris x86 with Sun C setups
238160814Ssimon"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)",
239238405Sjkim"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}:elf:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
24079998Skris
24155714Skris#### SPARC Solaris with GNU C setups
242160814Ssimon"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)",
243284285Sjkim"solaris-sparcv8-gcc","gcc:-mcpu=v8 -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_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
244109998Smarkm# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
245238405Sjkim"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:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
246238405Sjkim"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
24755714Skris####
248284285Sjkim"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
249238405Sjkim"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
25055714Skris
25155714Skris#### SPARC Solaris with Sun C setups
25255714Skris# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
25355714Skris# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
25455714Skris# SC5.0 note: Compiler common patch 107357-01 or later is required!
255160814Ssimon"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)",
256238405Sjkim"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_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
257238405Sjkim"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:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
258246772Sjkim"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
25959191Skris####
260238405Sjkim"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
261238405Sjkim"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
26255714Skris
263160814Ssimon#### SunOS configs, assuming sparc for the gcc one.
264160814Ssimon#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
265284285Sjkim"sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
26655714Skris
26755714Skris#### IRIX 5.x configs
26855714Skris# -mips2 flag is added by ./config when appropriate.
269280304Sjkim"irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
270280304Sjkim"irix-cc", "cc:-O2 -use_readonly_const -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
27155714Skris#### IRIX 6.x configs
27255714Skris# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
273127128Snectar# './Configure irix-cc -o32' manually.
274280304Sjkim"irix-mips3-gcc","gcc:-mabi=n32 -O3 -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:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
275280304Sjkim"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
27655714Skris# N64 ABI builds.
277280304Sjkim"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
278280304Sjkim"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
27955714Skris
28059191Skris#### Unified HP-UX ANSI C configs.
28159191Skris# Special notes:
28259191Skris# - Originally we were optimizing at +O4 level. It should be noted
28359191Skris#   that the only difference between +O3 and +O4 is global inter-
28459191Skris#   procedural analysis. As it has to be performed during the link
28559191Skris#   stage the compiler leaves behind certain pseudo-code in lib*.a
28659191Skris#   which might be release or even patch level specific. Generating
28759191Skris#   the machine code for and analyzing the *whole* program appears
28859191Skris#   to be *extremely* memory demanding while the performance gain is
28959191Skris#   actually questionable. The situation is intensified by the default
29059191Skris#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
29159191Skris#   which is way too low for +O4. In other words, doesn't +O3 make
29259191Skris#   more sense?
29359191Skris# - Keep in mind that the HP compiler by default generates code
29459191Skris#   suitable for execution on the host you're currently compiling at.
29559191Skris#   If the toolkit is ment to be used on various PA-RISC processors
296109998Smarkm#   consider './config +DAportable'.
297160814Ssimon# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
29859191Skris#   compatible with *future* releases.
29959191Skris# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
30059191Skris#   pass -D_REENTRANT on HP-UX 10 and later.
30159191Skris# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
30259191Skris#   32-bit message digests. (For the moment of this writing) HP C
30359191Skris#   doesn't seem to "digest" too many local variables (they make "him"
30459191Skris#   chew forever:-). For more details look-up MD32_XARRAY comment in
30559191Skris#   crypto/sha/sha_lcl.h.
30659191Skris#					<appro@fy.chalmers.se>
30759191Skris#
30859191Skris# Since there is mention of this in shlib/hpux10-cc.sh
309160814Ssimon"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)",
310160814Ssimon"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)",
311238405Sjkim"hpux-parisc1_1-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${parisc11_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
312238405Sjkim"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:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
313238405Sjkim"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::::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
31459191Skris
31568651Skris# More attempts at unified 10.X and 11.X targets for HP C compiler.
31668651Skris#
31768651Skris# Chris Ruemmler <ruemmler@cup.hp.com>
31868651Skris# Kevin Steves <ks@hp.se>
319160814Ssimon"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)",
320238405Sjkim"hpux-parisc1_1-cc","cc:+DA1.1 +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:${parisc11_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
321238405Sjkim"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:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
322238405Sjkim"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:${parisc20_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
32368651Skris
324160814Ssimon# HP/UX IA-64 targets
325238405Sjkim"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):::/hpux32",
326160814Ssimon# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
327160814Ssimon# with debugging of the following config.
328238405Sjkim"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):::/hpux64",
329160814Ssimon# GCC builds...
330238405Sjkim"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):::/hpux32",
331238405Sjkim"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):::/hpux64", 
33255714Skris
333160814Ssimon# Legacy HPUX 9.X configs...
334160814Ssimon"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)",
335160814Ssimon"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)",
33655714Skris
33768651Skris#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
338160814Ssimon"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:::",
33968651Skris
340160814Ssimon# DEC Alpha OSF/1/Tru64 targets.
34189837Skris#
34289837Skris#	"What's in a name? That which we call a rose
34389837Skris#	 By any other word would smell as sweet."
34489837Skris#
34589837Skris# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
34689837Skris#
34755714Skris# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
34889837Skris#
349238405Sjkim"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
350238405Sjkim"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
351238405Sjkim"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared::-msym:.so",
35255714Skris
353160814Ssimon####
354160814Ssimon#### Variety of LINUX:-)
355160814Ssimon####
356160814Ssimon# *-generic* is endian-neutral target, but ./config is free to
357160814Ssimon# throw in -D[BL]_ENDIAN, whichever appropriate...
358280304Sjkim"linux-generic32","gcc:-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)",
359280304Sjkim"linux-ppc",	"gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
360238405Sjkim# It's believed that majority of ARM toolchains predefine appropriate -march.
361238405Sjkim# If you compiler does not, do complement config command line with one!
362280304Sjkim"linux-armv4",	"gcc:-O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
363160814Ssimon#### IA-32 targets...
364280304Sjkim"linux-ia32-icc",	"icc:-DL_ENDIAN -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)",
365280304Sjkim"linux-elf",	"gcc:-DL_ENDIAN -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)",
366280304Sjkim"linux-aout",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
367160814Ssimon####
368280304Sjkim"linux-generic64","gcc:-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)",
369280304Sjkim"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
370280304Sjkim"linux-ia64",	"gcc:-DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
371280304Sjkim"linux-ia64-ecc","ecc:-DL_ENDIAN -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
372280304Sjkim"linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
373280304Sjkim"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
374291721Sjkim"linux-x86_64-clang","clang: -m64 -DL_ENDIAN -O3 -Wall -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
375280304Sjkim"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
376238405Sjkim#### So called "highgprs" target for z/Architecture CPUs
377238405Sjkim# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
378238405Sjkim# /proc/cpuinfo. The idea is to preserve most significant bits of
379238405Sjkim# general purpose registers not only upon 32-bit process context
380238405Sjkim# switch, but even on asynchronous signal delivery to such process.
381238405Sjkim# This makes it possible to deploy 64-bit instructions even in legacy
382238405Sjkim# application context and achieve better [or should we say adequate]
383238405Sjkim# performance. The build is binary compatible with linux-generic32,
384238405Sjkim# and the idea is to be able to install the resulting libcrypto.so
385238405Sjkim# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
386238405Sjkim# ldconfig and run-time linker to autodiscover. Unfortunately it
387238405Sjkim# doesn't work just yet, because of couple of bugs in glibc
388238405Sjkim# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
389280304Sjkim"linux32-s390x",	"gcc:-m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
390160814Ssimon#### SPARC Linux setups
391160814Ssimon# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
392160814Ssimon# assisted with debugging of following two configs.
393284285Sjkim"linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
394160814Ssimon# it's a real mess with -mcpu=ultrasparc option under Linux, but
395160814Ssimon# -Wa,-Av8plus should do the trick no matter what.
396280304Sjkim"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
397160814Ssimon# GCC 3.1 is a requirement
398280304Sjkim"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
39959191Skris#### Alpha Linux with GNU C and Compaq C setups
40059191Skris# Special notes:
40159191Skris# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
40259191Skris#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
40359191Skris#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
40459191Skris#   which is appropriate.
40559191Skris# - If you use ccc keep in mind that -fast implies -arch host and the
40659191Skris#   compiler is free to issue instructions which gonna make elder CPU
40759191Skris#   choke. If you wish to build "blended" toolkit, add -arch generic
40859191Skris#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
40959191Skris#
41059191Skris#					<appro@fy.chalmers.se>
41159191Skris#
412280304Sjkim"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
413280304Sjkim"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
414280304Sjkim"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
415280304Sjkim"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
41659191Skris
417280304Sjkim# Android: linux-* but without pointers to headers and libs.
418237657Sjkim"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -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)",
419238405Sjkim"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
420238405Sjkim"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
421237657Sjkim
422160814Ssimon#### *BSD [do see comment about ${BSDthreads} above!]
423280304Sjkim"BSD-generic32","gcc:-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)",
424280304Sjkim"BSD-x86",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
425280304Sjkim"BSD-x86-elf",	"gcc:-DL_ENDIAN -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)",
426280304Sjkim"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
427284285Sjkim"BSD-sparcv8",	"gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
42855714Skris
429280304Sjkim"BSD-generic64","gcc:-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)",
430160814Ssimon# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
431160814Ssimon# simply *happens* to work around a compiler bug in gcc 3.3.3,
432160814Ssimon# triggered by RIPEMD160 code.
433280304Sjkim"BSD-sparc64",	"gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
434280304Sjkim"BSD-ia64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
435280304Sjkim"BSD-x86_64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
436160814Ssimon
437160814Ssimon"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)",
438160814Ssimon
439109998Smarkm"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
440109998Smarkm"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
441109998Smarkm
44255714Skris# NCR MP-RAS UNIX ver 02.03.01
443111147Snectar"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
44455714Skris
445160814Ssimon# QNX
446109998Smarkm"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
447280304Sjkim"QNX6",       "gcc:::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
448280304Sjkim"QNX6-i386",  "gcc:-DL_ENDIAN -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
44989837Skris
450238405Sjkim# BeOS
451238405Sjkim"beos-x86-r5",   "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
452238405Sjkim"beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
453238405Sjkim
454160814Ssimon#### SCO/Caldera targets.
455111147Snectar#
456111147Snectar# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
457111147Snectar# Now we only have blended unixware-* as it's the only one used by ./config.
458111147Snectar# If you want to optimize for particular microarchitecture, bypass ./config
459111147Snectar# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
460111147Snectar# Note that not all targets include assembler support. Mostly because of
461111147Snectar# lack of motivation to support out-of-date platforms with out-of-date
462111147Snectar# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
463111147Snectar# patiently assisted to debug most of it.
464111147Snectar#
465160814Ssimon# UnixWare 2.0x fails destest with -O.
466109998Smarkm"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
467109998Smarkm"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
468111147Snectar"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)",
469160814Ssimon"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)",
470111147Snectar# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
471111147Snectar"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)",
472111147Snectar"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)",
47376866Skris
474160814Ssimon#### IBM's AIX.
475160814Ssimon"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
476238405Sjkim"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X32",
477238405Sjkim"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
478160814Ssimon# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
479160814Ssimon# at build time. $OBJECT_MODE is respected at ./config stage!
480246772Sjkim"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
481246772Sjkim"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
48259191Skris
48355714Skris#
484100928Snectar# Cray T90 and similar (SDSC)
48555714Skris# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
48655714Skris# defined.  The T90 ints and longs are 8 bytes long, and apparently the
48755714Skris# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
48855714Skris# non L_ENDIAN code aligns the bytes in each word correctly.
48955714Skris#
49055714Skris# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
49155714Skris#'Taking the address of a bit field is not allowed. '
49255714Skris#'An expression with bit field exists as the operand of "sizeof" '
49355714Skris# (written by Wayne Schroeder <schroede@SDSC.EDU>)
494100928Snectar#
495100928Snectar# j90 is considered the base machine type for unicos machines,
496100928Snectar# so this configuration is now called "cray-j90" ...
497109998Smarkm"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
49855714Skris
49955714Skris#
50055714Skris# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
50155714Skris#
50255714Skris# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
50355714Skris# another use.  Basically, the problem is that the T3E uses some bit fields
50455714Skris# for some st_addr stuff, and then sizeof and address-of fails
50555714Skris# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
50655714Skris# did not like it.
507109998Smarkm"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
50855714Skris
50955714Skris# DGUX, 88100.
510109998Smarkm"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
511109998Smarkm"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
512109998Smarkm"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}",
51355714Skris
51455714Skris# Sinix/ReliantUNIX RM400
51555714Skris# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
516160814Ssimon"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)",
517109998Smarkm"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
518109998Smarkm"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
51955714Skris
52055714Skris# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
521280304Sjkim"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
52255714Skris
52389837Skris# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
52489837Skris# You need to compile using the c89.sh wrapper in the tools directory, because the
52589837Skris# IBM compiler does not like the -L switch after any object modules.
52689837Skris#
527109998Smarkm"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:::",
52889837Skris
529238405Sjkim# Visual C targets
530238405Sjkim#
531160814Ssimon# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
532238405Sjkim"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o ia64-mont.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
533238405Sjkim"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
534238405Sjkim"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
535238405Sjkim"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
536238405Sjkim# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
537238405Sjkim# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
538238405Sjkim"VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
539238405Sjkim# Unified CE target
540264331Sjkim"debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
541160814Ssimon"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
54255714Skris
54355714Skris# Borland C++ 4.5
544160814Ssimon"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
54555714Skris
546120631Snectar# MinGW
547238405Sjkim"mingw", "gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall::-D_MT:MINGW32:-lws2_32 -lgdi32 -lcrypt32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
548238405Sjkim# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
549238405Sjkim# compiled with one compiler with application compiled with another
550238405Sjkim# compiler. It's possible to engage Applink support in mingw64 build,
551238405Sjkim# but it's not done, because till mingw64 supports structured exception
552238405Sjkim# handling, one can't seriously consider its binaries for using with
553238405Sjkim# non-mingw64 run-time environment. And as mingw64 is always consistent
554238405Sjkim# with itself, Applink is never engaged and can as well be omitted.
555238405Sjkim"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE::-D_MT:MINGW64:-lws2_32 -lgdi32 -lcrypt32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
55655714Skris
557100936Snectar# UWIN 
558160814Ssimon"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
559100936Snectar
560100928Snectar# Cygwin
561160814Ssimon"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",
562238405Sjkim"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
563238405Sjkim"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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",
56468651Skris
565194206Ssimon# NetWare from David Ward (dsward@novell.com)
566194206Ssimon# requires either MetroWerks NLM development tools, or gcc / nlmconv
567194206Ssimon# NetWare defaults socket bio to WinSock sockets. However,
568194206Ssimon# the builds can be configured to use BSD sockets instead.
569160814Ssimon# netware-clib => legacy CLib c-runtime support
570194206Ssimon"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
571194206Ssimon"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
572194206Ssimon"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}::",
573194206Ssimon"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}::",
574160814Ssimon# netware-libc => LibC/NKS support
575160814Ssimon"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
576160814Ssimon"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
577160814Ssimon"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}::",
578194206Ssimon"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}::",
579160814Ssimon
580109998Smarkm# DJGPP
581280304Sjkim"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
582109998Smarkm
58355714Skris# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
584109998Smarkm"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
585160814Ssimon"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
58655714Skris# K&R C is no longer supported; you need gcc on old Ultrix installations
587109998Smarkm##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
58855714Skris
58989837Skris##### MacOS X (a.k.a. Rhapsody or Darwin) setup
590160814Ssimon"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
591238405Sjkim"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
592238405Sjkim"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:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
593238405Sjkim"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
594238405Sjkim"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
595238405Sjkim"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
596238405Sjkim"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:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
597238405Sjkim# iPhoneOS/iOS
598238405Sjkim"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
59959191Skris
600109998Smarkm##### A/UX
601109998Smarkm"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
602109998Smarkm
60368651Skris##### Sony NEWS-OS 4.x
604109998Smarkm"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
60568651Skris
606109998Smarkm##### GNU Hurd
607280304Sjkim"hurd-x86",  "gcc:-DL_ENDIAN -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",
608109998Smarkm
609109998Smarkm##### OS/2 EMX
610109998Smarkm"OS2-EMX", "gcc::::::::",
611109998Smarkm
612100928Snectar##### VxWorks for various targets
613238405Sjkim"vxworks-ppc60x","ccppc:-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common:::::",
614238405Sjkim"vxworks-ppcgen","ccppc:-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon:::::",
615109998Smarkm"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
616109998Smarkm"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:::::",
617238405Sjkim"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 -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
618120631Snectar"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
619238405Sjkim"vxworks-simlinux","ccpentium:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DL_ENDIAN -DCPU=SIMLINUX -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK:::VXWORKS:-r::${no_asm}::::::ranlibpentium:",
620238405Sjkim"vxworks-mips","ccmips:-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DCPU=MIPS32 -msoft-float -mno-branch-likely -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip::-D_REENTRANT:VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon::${mips32_asm}:o32::::::ranlibmips:",
621100928Snectar
622109998Smarkm##### Compaq Non-Stop Kernel (Tandem)
623109998Smarkm"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
624109998Smarkm
625238405Sjkim# uClinux
626238405Sjkim"uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
627238405Sjkim"uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):SIXTY_FOUR_BIT_LONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
628238405Sjkim
62955714Skris);
63055714Skris
631160814Ssimonmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
632238405Sjkim		    debug-VC-WIN64I debug-VC-WIN64A
633238405Sjkim		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
634238405Sjkim		    BC-32 
635194206Ssimon		    netware-clib netware-clib-bsdsock
636194206Ssimon		    netware-libc netware-libc-bsdsock);
63755714Skris
638100928Snectarmy $idx = 0;
639100928Snectarmy $idx_cc = $idx++;
640100928Snectarmy $idx_cflags = $idx++;
641100928Snectarmy $idx_unistd = $idx++;
642100928Snectarmy $idx_thread_cflag = $idx++;
643109998Smarkmmy $idx_sys_id = $idx++;
644100928Snectarmy $idx_lflags = $idx++;
645100928Snectarmy $idx_bn_ops = $idx++;
646160814Ssimonmy $idx_cpuid_obj = $idx++;
647100928Snectarmy $idx_bn_obj = $idx++;
648100928Snectarmy $idx_des_obj = $idx++;
649160814Ssimonmy $idx_aes_obj = $idx++;
650100928Snectarmy $idx_bf_obj = $idx++;
651100928Snectarmy $idx_md5_obj = $idx++;
652100928Snectarmy $idx_sha1_obj = $idx++;
653100928Snectarmy $idx_cast_obj = $idx++;
654100928Snectarmy $idx_rc4_obj = $idx++;
655100928Snectarmy $idx_rmd160_obj = $idx++;
656100928Snectarmy $idx_rc5_obj = $idx++;
657238405Sjkimmy $idx_wp_obj = $idx++;
658238405Sjkimmy $idx_cmll_obj = $idx++;
659238405Sjkimmy $idx_modes_obj = $idx++;
660238405Sjkimmy $idx_engines_obj = $idx++;
661238405Sjkimmy $idx_perlasm_scheme = $idx++;
662100928Snectarmy $idx_dso_scheme = $idx++;
663100928Snectarmy $idx_shared_target = $idx++;
664100928Snectarmy $idx_shared_cflag = $idx++;
665100928Snectarmy $idx_shared_ldflag = $idx++;
666100928Snectarmy $idx_shared_extension = $idx++;
667100928Snectarmy $idx_ranlib = $idx++;
668109998Smarkmmy $idx_arflags = $idx++;
669238405Sjkimmy $idx_multilib = $idx++;
670100928Snectar
67155714Skrismy $prefix="";
672205128Ssimonmy $libdir="";
67355714Skrismy $openssldir="";
67476866Skrismy $exe_ext="";
675205128Ssimonmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
676205128Ssimonmy $cross_compile_prefix="";
677238405Sjkimmy $fipsdir="/usr/local/ssl/fips-2.0";
678238405Sjkimmy $fipslibdir="";
679194206Ssimonmy $baseaddr="0xFB00000";
68055714Skrismy $no_threads=0;
68155714Skrismy $threads=0;
682160814Ssimonmy $no_shared=0; # but "no-shared" is default
683160814Ssimonmy $zlib=1;      # but "no-zlib" is default
684160814Ssimonmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
685167612Ssimonmy $no_rfc3779=1; # but "no-rfc3779" is default
68655714Skrismy $no_asm=0;
68768651Skrismy $no_dso=0;
688160814Ssimonmy $no_gmp=0;
68955714Skrismy @skip=();
690142425Snectarmy $Makefile="Makefile";
69155714Skrismy $des_locl="crypto/des/des_locl.h";
69255714Skrismy $des	="crypto/des/des.h";
69355714Skrismy $bn	="crypto/bn/bn.h";
69455714Skrismy $md2	="crypto/md2/md2.h";
69555714Skrismy $rc4	="crypto/rc4/rc4.h";
69655714Skrismy $rc4_locl="crypto/rc4/rc4_locl.h";
69755714Skrismy $idea	="crypto/idea/idea.h";
69855714Skrismy $rc2	="crypto/rc2/rc2.h";
69955714Skrismy $bf	="crypto/bf/bf_locl.h";
70055714Skrismy $bn_asm	="bn_asm.o";
70155714Skrismy $des_enc="des_enc.o fcrypt_b.o";
702160814Ssimonmy $aes_enc="aes_core.o aes_cbc.o";
70355714Skrismy $bf_enc	="bf_enc.o";
70455714Skrismy $cast_enc="c_enc.o";
705194206Ssimonmy $rc4_enc="rc4_enc.o rc4_skey.o";
70655714Skrismy $rc5_enc="rc5_enc.o";
70755714Skrismy $md5_obj="";
70855714Skrismy $sha1_obj="";
70955714Skrismy $rmd160_obj="";
710238405Sjkimmy $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
71155714Skrismy $processor="";
71276866Skrismy $default_ranlib;
71355714Skrismy $perl;
714194206Ssimonmy $fips=0;
71555714Skris
716238405Sjkimif (exists $ENV{FIPSDIR})
717238405Sjkim	{
718238405Sjkim	$fipsdir = $ENV{FIPSDIR};
719238405Sjkim	$fipsdir =~ s/\/$//;
720238405Sjkim	}
721109998Smarkm
722160814Ssimon# All of the following is disabled by default (RC5 was enabled before 0.9.8):
723160814Ssimon
724194206Ssimonmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
725238405Sjkim		 "ec_nistp_64_gcc_128" => "default",
726238405Sjkim		 "gmp"		  => "default",
727238405Sjkim		 "jpake"          => "experimental",
728238405Sjkim		 "md2"            => "default",
729238405Sjkim		 "rc5"            => "default",
730238405Sjkim		 "rfc3779"	  => "default",
731296317Sdelphij		 "sctp"           => "default",
732238405Sjkim		 "shared"         => "default",
733296317Sdelphij		 "ssl2"           => "default",
734238405Sjkim		 "store"	  => "experimental",
735269686Sjkim		 "unit-test"	  => "default",
736296317Sdelphij		 "weak-ssl-ciphers" => "default",
737238405Sjkim		 "zlib"           => "default",
738238405Sjkim		 "zlib-dynamic"   => "default"
739238405Sjkim	       );
740194206Ssimonmy @experimental = ();
741160814Ssimon
742194206Ssimon# This is what $depflags will look like with the above defaults
743194206Ssimon# (we need this to see if we should advise the user to run "make depend"):
744306196Sjkimmy $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS";
745160814Ssimon
746194206Ssimon# Explicit "no-..." options will be collected in %disabled along with the defaults.
747194206Ssimon# To remove something from %disabled, use "enable-foo" (unless it's experimental).
748194206Ssimon# For symmetry, "disable-foo" is a synonym for "no-foo".
749160814Ssimon
750194206Ssimon# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
751194206Ssimon# We will collect such requests in @experimental.
752194206Ssimon# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
753194206Ssimon
754194206Ssimon
755160814Ssimonmy $no_sse2=0;
756160814Ssimon
75755714Skris&usage if ($#ARGV < 0);
75855714Skris
75968651Skrismy $flags;
76068651Skrismy $depflags;
761194206Ssimonmy $openssl_experimental_defines;
76268651Skrismy $openssl_algorithm_defines;
76368651Skrismy $openssl_thread_defines;
764109998Smarkmmy $openssl_sys_defines="";
76568651Skrismy $openssl_other_defines;
76668651Skrismy $libs;
767111147Snectarmy $libkrb5="";
76868651Skrismy $target;
76968651Skrismy $options;
77068651Skrismy $symlink;
771109998Smarkmmy $make_depend=0;
772109998Smarkmmy %withargs=();
77368651Skris
77468651Skrismy @argvcopy=@ARGV;
77568651Skrismy $argvstring="";
77668651Skrismy $argv_unprocessed=1;
77768651Skris
77868651Skriswhile($argv_unprocessed)
77955714Skris	{
78068651Skris	$flags="";
78168651Skris	$depflags="";
782194206Ssimon	$openssl_experimental_defines="";
78368651Skris	$openssl_algorithm_defines="";
78468651Skris	$openssl_thread_defines="";
785109998Smarkm	$openssl_sys_defines="";
78668651Skris	$openssl_other_defines="";
78768651Skris	$libs="";
78868651Skris	$target="";
78968651Skris	$options="";
79068651Skris	$symlink=1;
79168651Skris
79268651Skris	$argv_unprocessed=0;
79368651Skris	$argvstring=join(' ',@argvcopy);
79468651Skris
79568651SkrisPROCESS_ARGS:
79668651Skris	foreach (@argvcopy)
79755714Skris		{
79868651Skris		s /^-no-/no-/; # some people just can't read the instructions
799160814Ssimon
800160814Ssimon		# rewrite some options in "enable-..." form
801160814Ssimon		s /^-?-?shared$/enable-shared/;
802238405Sjkim		s /^sctp$/enable-sctp/;
803160814Ssimon		s /^threads$/enable-threads/;
804160814Ssimon		s /^zlib$/enable-zlib/;
805160814Ssimon		s /^zlib-dynamic$/enable-zlib-dynamic/;
806160814Ssimon
807160814Ssimon		if (/^no-(.+)$/ || /^disable-(.+)$/)
808100928Snectar			{
809194206Ssimon			if (!($disabled{$1} eq "experimental"))
810109998Smarkm				{
811194206Ssimon				if ($1 eq "ssl")
812194206Ssimon					{
813194206Ssimon					$disabled{"ssl2"} = "option(ssl)";
814194206Ssimon					$disabled{"ssl3"} = "option(ssl)";
815194206Ssimon					}
816194206Ssimon				elsif ($1 eq "tls")
817194206Ssimon					{
818194206Ssimon					$disabled{"tls1"} = "option(tls)"
819194206Ssimon					}
820276864Sjkim				elsif ($1 eq "ssl3-method")
821276864Sjkim					{
822276864Sjkim					$disabled{"ssl3-method"} = "option(ssl)";
823276864Sjkim					$disabled{"ssl3"} = "option(ssl)";
824276864Sjkim					}
825194206Ssimon				else
826194206Ssimon					{
827194206Ssimon					$disabled{$1} = "option";
828194206Ssimon					}
829238405Sjkim				}			
830238405Sjkim			}
831194206Ssimon		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
832194206Ssimon			{
833194206Ssimon			my $algo = $1;
834194206Ssimon			if ($disabled{$algo} eq "experimental")
83568651Skris				{
836194206Ssimon				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
837194206Ssimon					unless (/^experimental-/);
838194206Ssimon				push @experimental, $algo;
83968651Skris				}
840194206Ssimon			delete $disabled{$algo};
841160814Ssimon
842194206Ssimon			$threads = 1 if ($algo eq "threads");
84355714Skris			}
844160814Ssimon		elsif (/^--test-sanity$/)
845160814Ssimon			{
846160814Ssimon			exit(&test_sanity());
847160814Ssimon			}
848205128Ssimon		elsif (/^--strict-warnings/)
849205128Ssimon			{
850205128Ssimon			$strict_warnings = 1;
851205128Ssimon			}
85268651Skris		elsif (/^reconfigure/ || /^reconf/)
85355714Skris			{
85468651Skris			if (open(IN,"<$Makefile"))
85568651Skris				{
85668651Skris				while (<IN>)
85768651Skris					{
858160814Ssimon					chomp;
85968651Skris					if (/^CONFIGURE_ARGS=(.*)/)
86068651Skris						{
86168651Skris						$argvstring=$1;
86268651Skris						@argvcopy=split(' ',$argvstring);
86368651Skris						die "Incorrect data to reconfigure, please do a normal configuration\n"
86468651Skris							if (grep(/^reconf/,@argvcopy));
86568651Skris						print "Reconfiguring with: $argvstring\n";
86668651Skris						$argv_unprocessed=1;
86768651Skris						close(IN);
86868651Skris						last PROCESS_ARGS;
86968651Skris						}
87068651Skris					}
87168651Skris				close(IN);
87268651Skris				}
87368651Skris			die "Insufficient data to reconfigure, please do a normal configuration\n";
87455714Skris			}
87568651Skris		elsif (/^386$/)
87668651Skris			{ $processor=386; }
877194206Ssimon		elsif (/^fips$/)
878194206Ssimon			{
879194206Ssimon			$fips=1;
880238405Sjkim			}
88168651Skris		elsif (/^rsaref$/)
88255714Skris			{
883109998Smarkm			# No RSAref support any more since it's not needed.
884109998Smarkm			# The check for the option is there so scripts aren't
885109998Smarkm			# broken
88655714Skris			}
88768651Skris		elsif (/^[-+]/)
88855714Skris			{
889238405Sjkim			if (/^-[lL](.*)$/ or /^-Wl,/)
89068651Skris				{
89168651Skris				$libs.=$_." ";
89268651Skris				}
89368651Skris			elsif (/^-[^-]/ or /^\+/)
89468651Skris				{
895238405Sjkim				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
89668651Skris				$flags.=$_." ";
89768651Skris				}
89868651Skris			elsif (/^--prefix=(.*)$/)
89968651Skris				{
90068651Skris				$prefix=$1;
90168651Skris				}
902205128Ssimon			elsif (/^--libdir=(.*)$/)
903205128Ssimon				{
904205128Ssimon				$libdir=$1;
905205128Ssimon				}
90668651Skris			elsif (/^--openssldir=(.*)$/)
90768651Skris				{
90868651Skris				$openssldir=$1;
90968651Skris				}
91068651Skris			elsif (/^--install.prefix=(.*)$/)
91168651Skris				{
91268651Skris				$install_prefix=$1;
91368651Skris				}
914109998Smarkm			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
915109998Smarkm				{
916109998Smarkm				$withargs{"krb5-".$1}=$2;
917109998Smarkm				}
918160814Ssimon			elsif (/^--with-zlib-lib=(.*)$/)
919160814Ssimon				{
920160814Ssimon				$withargs{"zlib-lib"}=$1;
921160814Ssimon				}
922160814Ssimon			elsif (/^--with-zlib-include=(.*)$/)
923160814Ssimon				{
924160814Ssimon				$withargs{"zlib-include"}="-I$1";
925160814Ssimon				}
926238405Sjkim			elsif (/^--with-fipsdir=(.*)$/)
927238405Sjkim				{
928238405Sjkim				$fipsdir="$1";
929238405Sjkim				}
930194206Ssimon			elsif (/^--with-fipslibdir=(.*)$/)
931194206Ssimon				{
932238405Sjkim				$fipslibdir="$1";
933194206Ssimon				}
934194206Ssimon			elsif (/^--with-baseaddr=(.*)$/)
935194206Ssimon				{
936194206Ssimon				$baseaddr="$1";
937194206Ssimon				}
938238405Sjkim			elsif (/^--cross-compile-prefix=(.*)$/)
939238405Sjkim				{
940238405Sjkim				$cross_compile_prefix=$1;
941238405Sjkim				}
94268651Skris			else
94368651Skris				{
94468651Skris				print STDERR $usage;
94568651Skris				exit(1);
94668651Skris				}
94755714Skris			}
94868651Skris		elsif ($_ =~ /^([^:]+):(.+)$/)
94955714Skris			{
95068651Skris			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
95168651Skris			$target=$1;
95255714Skris			}
95355714Skris		else
95455714Skris			{
955160814Ssimon			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
95668651Skris			$target=$_;
95755714Skris			}
958160814Ssimon
959160814Ssimon		unless ($_ eq $target || /^no-/ || /^disable-/)
960160814Ssimon			{
961160814Ssimon			# "no-..." follows later after implied disactivations
962160814Ssimon			# have been derived.  (Don't take this too seroiusly,
963160814Ssimon			# we really only write OPTIONS to the Makefile out of
964160814Ssimon			# nostalgia.)
965160814Ssimon
966160814Ssimon			if ($options eq "")
967160814Ssimon				{ $options = $_; }
968160814Ssimon			else
969160814Ssimon				{ $options .= " ".$_; }
97068651Skris			}
97155714Skris		}
97255714Skris	}
97355714Skris
974109998Smarkm
975109998Smarkm
976160814Ssimonif ($processor eq "386")
977160814Ssimon	{
978160814Ssimon	$disabled{"sse2"} = "forced";
979160814Ssimon	}
980109998Smarkm
981160814Ssimonif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
982109998Smarkm	{
983160814Ssimon	$disabled{"krb5"} = "krb5-flavor not specified";
984109998Smarkm	}
985109998Smarkm
986160814Ssimonif (!defined($disabled{"zlib-dynamic"}))
987109998Smarkm	{
988160814Ssimon	# "zlib-dynamic" was specifically enabled, so enable "zlib"
989160814Ssimon	delete $disabled{"zlib"};
990109998Smarkm	}
991109998Smarkm
992160814Ssimonif (defined($disabled{"rijndael"}))
993109998Smarkm	{
994160814Ssimon	$disabled{"aes"} = "forced";
995109998Smarkm	}
996160814Ssimonif (defined($disabled{"des"}))
997160814Ssimon	{
998160814Ssimon	$disabled{"mdc2"} = "forced";
999160814Ssimon	}
1000160814Ssimonif (defined($disabled{"ec"}))
1001160814Ssimon	{
1002160814Ssimon	$disabled{"ecdsa"} = "forced";
1003160814Ssimon	$disabled{"ecdh"} = "forced";
1004160814Ssimon	}
1005109998Smarkm
1006160814Ssimon# SSL 2.0 requires MD5 and RSA
1007160814Ssimonif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
1008160814Ssimon	{
1009160814Ssimon	$disabled{"ssl2"} = "forced";
1010160814Ssimon	}
1011160814Ssimon
1012238405Sjkimif ($fips && $fipslibdir eq "")
1013238405Sjkim	{
1014238405Sjkim	$fipslibdir = $fipsdir . "/lib/";
1015238405Sjkim	}
1016238405Sjkim
1017238405Sjkim# RSAX ENGINE sets default non-FIPS RSA method.
1018238405Sjkimif ($fips)
1019238405Sjkim	{
1020238405Sjkim	$disabled{"rsax"} = "forced";
1021238405Sjkim	}
1022238405Sjkim
1023160814Ssimon# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
1024160814Ssimonif (defined($disabled{"md5"}) || defined($disabled{"sha"})
1025160814Ssimon    || (defined($disabled{"rsa"})
1026160814Ssimon        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
1027160814Ssimon	{
1028160814Ssimon	$disabled{"ssl3"} = "forced";
1029160814Ssimon	$disabled{"tls1"} = "forced";
1030160814Ssimon	}
1031160814Ssimon
1032194206Ssimonif (defined($disabled{"tls1"}))
1033194206Ssimon	{
1034194206Ssimon	$disabled{"tlsext"} = "forced";
1035194206Ssimon	}
1036160814Ssimon
1037238405Sjkimif (defined($disabled{"ec"}) || defined($disabled{"dsa"})
1038238405Sjkim    || defined($disabled{"dh"}))
1039238405Sjkim	{
1040238405Sjkim	$disabled{"gost"} = "forced";
1041238405Sjkim	}
1042238405Sjkim
1043238405Sjkim# SRP and HEARTBEATS require TLSEXT
1044238405Sjkimif (defined($disabled{"tlsext"}))
1045238405Sjkim	{
1046238405Sjkim	$disabled{"srp"} = "forced";
1047238405Sjkim	$disabled{"heartbeats"} = "forced";
1048238405Sjkim	}
1049238405Sjkim
105055714Skrisif ($target eq "TABLE") {
105155714Skris	foreach $target (sort keys %table) {
105255714Skris		print_table_entry($target);
105355714Skris	}
105455714Skris	exit 0;
105555714Skris}
105655714Skris
105759191Skrisif ($target eq "LIST") {
105859191Skris	foreach (sort keys %table) {
105959191Skris		print;
106059191Skris		print "\n";
106159191Skris	}
106259191Skris	exit 0;
106359191Skris}
106459191Skris
1065100928Snectarif ($target =~ m/^CygWin32(-.*)$/) {
1066100928Snectar	$target = "Cygwin".$1;
1067100928Snectar}
1068100928Snectar
106968651Skrisprint "Configuring for $target\n";
107068651Skris
107155714Skris&usage if (!defined($table{$target}));
107255714Skris
107355714Skris
1074160814Ssimonforeach (sort (keys %disabled))
1075160814Ssimon	{
1076160814Ssimon	$options .= " no-$_";
1077160814Ssimon
1078160814Ssimon	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
1079160814Ssimon
1080160814Ssimon	if (/^dso$/)
1081160814Ssimon		{ $no_dso = 1; }
1082160814Ssimon	elsif (/^threads$/)
1083160814Ssimon		{ $no_threads = 1; }
1084160814Ssimon	elsif (/^shared$/)
1085160814Ssimon		{ $no_shared = 1; }
1086160814Ssimon	elsif (/^zlib$/)
1087160814Ssimon		{ $zlib = 0; }
1088160814Ssimon	elsif (/^static-engine$/)
1089160814Ssimon		{ }
1090160814Ssimon	elsif (/^zlib-dynamic$/)
1091160814Ssimon		{ }
1092160814Ssimon	elsif (/^symlinks$/)
1093160814Ssimon		{ $symlink = 0; }
1094160814Ssimon	elsif (/^sse2$/)
1095160814Ssimon		{ $no_sse2 = 1; }
1096160814Ssimon	else
1097160814Ssimon		{
1098160814Ssimon		my ($ALGO, $algo);
1099238405Sjkim		($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
1100160814Ssimon
1101160814Ssimon		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
1102160814Ssimon			{
1103160814Ssimon			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
1104160814Ssimon			print " OPENSSL_NO_$ALGO";
1105160814Ssimon		
1106160814Ssimon			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
1107160814Ssimon			elsif (/^asm$/)	{ $no_asm = 1; }
1108160814Ssimon			}
1109160814Ssimon		else
1110160814Ssimon			{
1111160814Ssimon			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
1112160814Ssimon			print " OPENSSL_NO_$ALGO";
1113160814Ssimon
1114160814Ssimon			if (/^krb5$/)
1115160814Ssimon				{ $no_krb5 = 1; }
1116160814Ssimon			else
1117160814Ssimon				{
1118160814Ssimon				push @skip, $algo;
1119238405Sjkim				# fix-up crypto/directory name(s)
1120238405Sjkim				@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
1121160814Ssimon				print " (skip dir)";
1122160814Ssimon
1123194206Ssimon				$depflags .= " -DOPENSSL_NO_$ALGO";
1124160814Ssimon				}
1125160814Ssimon			}
1126160814Ssimon		}
1127160814Ssimon
1128160814Ssimon	print "\n";
1129160814Ssimon	}
1130160814Ssimon
1131238405Sjkimmy $exp_cflags = "";
1132238405Sjkimforeach (sort @experimental)
1133238405Sjkim	{
1134238405Sjkim	my $ALGO;
1135238405Sjkim	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
1136160814Ssimon
1137238405Sjkim	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
1138238405Sjkim	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
1139238405Sjkim	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
1140238405Sjkim	}
1141160814Ssimon
1142238405Sjkimmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
1143194206Ssimon
1144238405Sjkim$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
1145194206Ssimon$exe_ext=".nlm" if ($target =~ /netware/);
1146160814Ssimon$exe_ext=".pm"  if ($target =~ /vos/);
1147238405Sjkim$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
114855714Skris$prefix=$openssldir if $prefix eq "";
114955714Skris
1150142425Snectar$default_ranlib= &which("ranlib") or $default_ranlib="true";
1151142425Snectar$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
1152142425Snectar  or $perl="perl";
1153205128Ssimonmy $make = $ENV{'MAKE'} || "make";
1154142425Snectar
1155205128Ssimon$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
1156205128Ssimon
115755714Skrischop $openssldir if $openssldir =~ /\/$/;
1158194206Ssimonchop $prefix if $prefix =~ /.\/$/;
115955714Skris
116055714Skris$openssldir=$prefix . "/ssl" if $openssldir eq "";
1161109998Smarkm$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
116255714Skris
116355714Skris
1164160814Ssimonprint "IsMK1MF=$IsMK1MF\n";
116555714Skris
1166238405Sjkimmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1167238405Sjkimmy $cc = $fields[$idx_cc];
1168238405Sjkim# Allow environment CC to override compiler...
1169238405Sjkimif($ENV{CC}) {
1170238405Sjkim    $cc = $ENV{CC};
1171238405Sjkim}
1172238405Sjkimmy $cflags = $fields[$idx_cflags];
1173238405Sjkimmy $unistd = $fields[$idx_unistd];
1174238405Sjkimmy $thread_cflag = $fields[$idx_thread_cflag];
1175238405Sjkimmy $sys_id = $fields[$idx_sys_id];
1176238405Sjkimmy $lflags = $fields[$idx_lflags];
1177238405Sjkimmy $bn_ops = $fields[$idx_bn_ops];
1178238405Sjkimmy $cpuid_obj = $fields[$idx_cpuid_obj];
1179238405Sjkimmy $bn_obj = $fields[$idx_bn_obj];
1180238405Sjkimmy $des_obj = $fields[$idx_des_obj];
1181238405Sjkimmy $aes_obj = $fields[$idx_aes_obj];
1182238405Sjkimmy $bf_obj = $fields[$idx_bf_obj];
1183238405Sjkimmy $md5_obj = $fields[$idx_md5_obj];
1184238405Sjkimmy $sha1_obj = $fields[$idx_sha1_obj];
1185238405Sjkimmy $cast_obj = $fields[$idx_cast_obj];
1186238405Sjkimmy $rc4_obj = $fields[$idx_rc4_obj];
1187238405Sjkimmy $rmd160_obj = $fields[$idx_rmd160_obj];
1188238405Sjkimmy $rc5_obj = $fields[$idx_rc5_obj];
1189238405Sjkimmy $wp_obj = $fields[$idx_wp_obj];
1190238405Sjkimmy $cmll_obj = $fields[$idx_cmll_obj];
1191238405Sjkimmy $modes_obj = $fields[$idx_modes_obj];
1192238405Sjkimmy $engines_obj = $fields[$idx_engines_obj];
1193238405Sjkimmy $perlasm_scheme = $fields[$idx_perlasm_scheme];
1194238405Sjkimmy $dso_scheme = $fields[$idx_dso_scheme];
1195238405Sjkimmy $shared_target = $fields[$idx_shared_target];
1196238405Sjkimmy $shared_cflag = $fields[$idx_shared_cflag];
1197238405Sjkimmy $shared_ldflag = $fields[$idx_shared_ldflag];
1198238405Sjkimmy $shared_extension = $fields[$idx_shared_extension];
1199238405Sjkimmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
1200238405Sjkimmy $ar = $ENV{'AR'} || "ar";
1201238405Sjkimmy $arflags = $fields[$idx_arflags];
1202238405Sjkimmy $multilib = $fields[$idx_multilib];
1203238405Sjkim
1204238405Sjkim# if $prefix/lib$multilib is not an existing directory, then
1205238405Sjkim# assume that it's not searched by linker automatically, in
1206238405Sjkim# which case adding $multilib suffix causes more grief than
1207238405Sjkim# we're ready to tolerate, so don't...
1208238405Sjkim$multilib="" if !-d "$prefix/lib$multilib";
1209238405Sjkim
1210238405Sjkim$libdir="lib$multilib" if $libdir eq "";
1211238405Sjkim
1212238405Sjkim$cflags = "$cflags$exp_cflags";
1213238405Sjkim
1214194206Ssimon# '%' in $lflags is used to split flags to "pre-" and post-flags
1215194206Ssimonmy ($prelflags,$postlflags)=split('%',$lflags);
1216238405Sjkimif (defined($postlflags))	{ $lflags=$postlflags;	}
1217238405Sjkimelse				{ $lflags=$prelflags; undef $prelflags;	}
1218100928Snectar
1219238405Sjkimif ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
1220238405Sjkim	{
1221238405Sjkim	$cflags =~ s/\-mno\-cygwin\s*//;
1222238405Sjkim	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
1223238405Sjkim	}
1224238405Sjkim
1225111147Snectarmy $no_shared_warn=0;
1226160814Ssimonmy $no_user_cflags=0;
1227111147Snectar
1228160814Ssimonif ($flags ne "")	{ $cflags="$flags$cflags"; }
1229160814Ssimonelse			{ $no_user_cflags=1;       }
123055714Skris
1231109998Smarkm# Kerberos settings.  The flavor must be provided from outside, either through
1232109998Smarkm# the script "config" or manually.
1233160814Ssimonif (!$no_krb5)
1234109998Smarkm	{
1235109998Smarkm	my ($lresolv, $lpath, $lext);
1236109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
1237109998Smarkm		{
1238109998Smarkm		die "Sorry, Heimdal is currently not supported\n";
1239109998Smarkm		}
1240109998Smarkm	##### HACK to force use of Heimdal.
1241109998Smarkm	##### WARNING: Since we don't really have adequate support for Heimdal,
1242109998Smarkm	#####          using this will break the build.  You'll have to make
1243109998Smarkm	#####          changes to the source, and if you do, please send
1244109998Smarkm	#####          patches to openssl-dev@openssl.org
1245109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
1246109998Smarkm		{
1247109998Smarkm		warn "Heimdal isn't really supported.  Your build WILL break\n";
1248109998Smarkm		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
1249109998Smarkm		$withargs{"krb5-dir"} = "/usr/heimdal"
1250109998Smarkm			if $withargs{"krb5-dir"} eq "";
1251109998Smarkm		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1252109998Smarkm			"/lib -lgssapi -lkrb5 -lcom_err"
1253160814Ssimon			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1254109998Smarkm		$cflags="-DKRB5_HEIMDAL $cflags";
1255109998Smarkm		}
1256109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
1257109998Smarkm		{
1258109998Smarkm		$withargs{"krb5-dir"} = "/usr/kerberos"
1259109998Smarkm			if $withargs{"krb5-dir"} eq "";
1260109998Smarkm		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1261109998Smarkm			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
1262160814Ssimon			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1263109998Smarkm		$cflags="-DKRB5_MIT $cflags";
1264109998Smarkm		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
1265109998Smarkm		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
1266109998Smarkm			{
1267109998Smarkm			$cflags="-DKRB5_MIT_OLD11 $cflags";
1268109998Smarkm			}
1269109998Smarkm		}
1270109998Smarkm	LRESOLV:
1271109998Smarkm	foreach $lpath ("/lib", "/usr/lib")
1272109998Smarkm		{
1273109998Smarkm		foreach $lext ("a", "so")
1274109998Smarkm			{
1275109998Smarkm			$lresolv = "$lpath/libresolv.$lext";
1276109998Smarkm			last LRESOLV	if (-r "$lresolv");
1277109998Smarkm			$lresolv = "";
1278109998Smarkm			}
1279109998Smarkm		}
1280109998Smarkm	$withargs{"krb5-lib"} .= " -lresolv"
1281109998Smarkm		if ("$lresolv" ne "");
1282109998Smarkm	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
1283109998Smarkm		if $withargs{"krb5-include"} eq "" &&
1284109998Smarkm		   $withargs{"krb5-dir"} ne "";
1285109998Smarkm	}
1286109998Smarkm
128768651Skris# The DSO code currently always implements all functions so that no
128868651Skris# applications will have to worry about that from a compilation point
128968651Skris# of view. However, the "method"s may return zero unless that platform
129068651Skris# has support compiled in for them. Currently each method is enabled
129168651Skris# by a define "DSO_<name>" ... we translate the "dso_scheme" config
129268651Skris# string entry into using the following logic;
129368651Skrismy $dso_cflags;
129468651Skrisif (!$no_dso && $dso_scheme ne "")
129568651Skris	{
129668651Skris	$dso_scheme =~ tr/[a-z]/[A-Z]/;
129768651Skris	if ($dso_scheme eq "DLFCN")
129868651Skris		{
129968651Skris		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
130068651Skris		}
130168651Skris	elsif ($dso_scheme eq "DLFCN_NO_H")
130268651Skris		{
130368651Skris		$dso_cflags = "-DDSO_DLFCN";
130468651Skris		}
130568651Skris	else
130668651Skris		{
130768651Skris		$dso_cflags = "-DDSO_$dso_scheme";
130868651Skris		}
130968651Skris	$cflags = "$dso_cflags $cflags";
131068651Skris	}
131168651Skris
131255714Skrismy $thread_cflags;
131359191Skrismy $thread_defines;
131455714Skrisif ($thread_cflag ne "(unknown)" && !$no_threads)
131555714Skris	{
131655714Skris	# If we know how to do it, support threads by default.
131755714Skris	$threads = 1;
131855714Skris	}
1319160814Ssimonif ($thread_cflag eq "(unknown)" && $threads)
132055714Skris	{
1321160814Ssimon	# If the user asked for "threads", [s]he is also expected to
1322160814Ssimon	# provide any system-dependent compiler options that are
1323160814Ssimon	# necessary.
1324160814Ssimon	if ($no_user_cflags)
1325160814Ssimon		{
1326160814Ssimon		print "You asked for multi-threading support, but didn't\n";
1327160814Ssimon		print "provide any system-specific compiler options\n";
1328160814Ssimon		exit(1);
1329160814Ssimon		}
1330109998Smarkm	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
1331109998Smarkm	$thread_defines .= "#define OPENSSL_THREADS\n";
133255714Skris	}
133355714Skriselse
133455714Skris	{
1335109998Smarkm	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
1336109998Smarkm	$thread_defines .= "#define OPENSSL_THREADS\n";
133759191Skris#	my $def;
133859191Skris#	foreach $def (split ' ',$thread_cflag)
133959191Skris#		{
134059191Skris#		if ($def =~ s/^-D// && $def !~ /^_/)
134159191Skris#			{
134259191Skris#			$thread_defines .= "#define $def\n";
134359191Skris#			}
134459191Skris#		}
134555714Skris	}	
134655714Skris
1347109998Smarkm$lflags="$libs$lflags" if ($libs ne "");
134855714Skris
134955714Skrisif ($no_asm)
135055714Skris	{
1351238405Sjkim	$cpuid_obj=$bn_obj=
1352238405Sjkim	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
1353238405Sjkim	$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
135455714Skris	}
135555714Skris
1356109998Smarkmif (!$no_shared)
1357109998Smarkm	{
1358109998Smarkm	$cast_obj="";	# CAST assembler is not PIC
1359109998Smarkm	}
1360109998Smarkm
136155714Skrisif ($threads)
136255714Skris	{
1363109998Smarkm	$cflags=$thread_cflags;
1364109998Smarkm	$openssl_thread_defines .= $thread_defines;
136555714Skris	}
136655714Skris
1367109998Smarkmif ($zlib)
1368109998Smarkm	{
1369109998Smarkm	$cflags = "-DZLIB $cflags";
1370160814Ssimon	if (defined($disabled{"zlib-dynamic"}))
1371160814Ssimon		{
1372238405Sjkim		if (defined($withargs{"zlib-lib"}))
1373238405Sjkim			{
1374238405Sjkim			$lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
1375238405Sjkim			}
1376238405Sjkim		else
1377238405Sjkim			{
1378238405Sjkim			$lflags = "$lflags -lz";
1379238405Sjkim			}
1380160814Ssimon		}
1381160814Ssimon	else
1382160814Ssimon		{
1383160814Ssimon		$cflags = "-DZLIB_SHARED $cflags";
1384160814Ssimon		}
1385109998Smarkm	}
1386109998Smarkm
138768651Skris# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
138876866Skrismy $shared_mark = "";
1389109998Smarkmif ($shared_target eq "")
139068651Skris	{
1391238405Sjkim	$no_shared_warn = 1 if !$no_shared;
1392109998Smarkm	$no_shared = 1;
1393109998Smarkm	}
1394109998Smarkmif (!$no_shared)
1395109998Smarkm	{
139676866Skris	if ($shared_cflag ne "")
139776866Skris		{
1398160814Ssimon		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
139976866Skris		}
140068651Skris	}
1401109998Smarkm
1402160814Ssimonif (!$IsMK1MF)
1403160814Ssimon	{
1404238405Sjkim	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
1405160814Ssimon	if ($no_shared)
1406160814Ssimon		{
1407160814Ssimon		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
1408238405Sjkim		$options.=" static-engine";
1409160814Ssimon		}
1410160814Ssimon	else
1411160814Ssimon		{
1412160814Ssimon		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
1413238405Sjkim		$options.=" no-static-engine";
1414160814Ssimon		}
1415160814Ssimon	}
1416160814Ssimon
1417238405Sjkim$cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1418194206Ssimon
1419194206Ssimon#
1420194206Ssimon# Platform fix-ups
1421194206Ssimon#
1422194206Ssimonif ($target =~ /\-icc$/)	# Intel C compiler
1423160814Ssimon	{
1424194206Ssimon	my $iccver=0;
1425194206Ssimon	if (open(FD,"$cc -V 2>&1 |"))
1426194206Ssimon		{
1427194206Ssimon		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1428194206Ssimon		close(FD);
1429194206Ssimon		}
1430160814Ssimon	if ($iccver>=8)
1431160814Ssimon		{
1432160814Ssimon		# Eliminate unnecessary dependency from libirc.a. This is
1433160814Ssimon		# essential for shared library support, as otherwise
1434160814Ssimon		# apps/openssl can end up in endless loop upon startup...
1435160814Ssimon		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
1436160814Ssimon		}
1437194206Ssimon	if ($iccver>=9)
1438194206Ssimon		{
1439194206Ssimon		$cflags.=" -i-static";
1440194206Ssimon		$cflags=~s/\-no_cpprt/-no-cpprt/;
1441194206Ssimon		}
1442194206Ssimon	if ($iccver>=10)
1443194206Ssimon		{
1444194206Ssimon		$cflags=~s/\-i\-static/-static-intel/;
1445194206Ssimon		}
1446160814Ssimon	}
1447160814Ssimon
1448194206Ssimon# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1449194206Ssimon# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1450194206Ssimon# .so objects. Apparently application RPATH is not global and does
1451194206Ssimon# not apply to .so linked with other .so. Problem manifests itself
1452194206Ssimon# when libssl.so fails to load libcrypto.so. One can argue that we
1453194206Ssimon# should engrave this into Makefile.shared rules or into BSD-* config
1454194206Ssimon# lines above. Meanwhile let's try to be cautious and pass -rpath to
1455194206Ssimon# linker only when --prefix is not /usr.
1456194206Ssimonif ($target =~ /^BSD\-/)
1457194206Ssimon	{
1458295016Sjkim	$shared_ldflag.=" -Wl,-rpath,\$\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1459194206Ssimon	}
1460194206Ssimon
1461109998Smarkmif ($sys_id ne "")
146272613Skris	{
1463160814Ssimon	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
1464109998Smarkm	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
146572613Skris	}
146668651Skris
146776866Skrisif ($ranlib eq "")
146876866Skris	{
146976866Skris	$ranlib = $default_ranlib;
147076866Skris	}
147176866Skris
147255714Skris#my ($bn1)=split(/\s+/,$bn_obj);
147355714Skris#$bn1 = "" unless defined $bn1;
147455714Skris#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
147555714Skris#$bn_obj="$bn1";
147655714Skris
1477160814Ssimon$cpuid_obj="" if ($processor eq "386");
1478160814Ssimon
147955714Skris$bn_obj = $bn_asm unless $bn_obj ne "";
1480238405Sjkim# bn-586 is the only one implementing bn_*_part_words
1481238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
1482238405Sjkim$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
148355714Skris
1484238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
1485238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
1486238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
1487194206Ssimon
1488194206Ssimonif ($fips)
1489194206Ssimon	{
1490194206Ssimon	$openssl_other_defines.="#define OPENSSL_FIPS\n";
1491238405Sjkim	$cflags .= " -I\$(FIPSDIR)/include";
1492194206Ssimon	}
1493194206Ssimon
1494238405Sjkim$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
1495160814Ssimon$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
149655714Skris$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
149755714Skris$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
149855714Skris$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
149955714Skris$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
1500160814Ssimonif ($sha1_obj =~ /\.o$/)
150155714Skris	{
150255714Skris#	$sha1_obj=$sha1_enc;
1503160814Ssimon	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
1504160814Ssimon	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
1505160814Ssimon	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1506194206Ssimon	if ($sha1_obj =~ /sse2/)
1507160814Ssimon	    {	if ($no_sse2)
1508160814Ssimon		{   $sha1_obj =~ s/\S*sse2\S+//;        }
1509160814Ssimon		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
1510160814Ssimon		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
1511160814Ssimon	    }
151255714Skris	}
151355714Skrisif ($md5_obj =~ /\.o$/)
151455714Skris	{
151555714Skris#	$md5_obj=$md5_enc;
151655714Skris	$cflags.=" -DMD5_ASM";
151755714Skris	}
151855714Skrisif ($rmd160_obj =~ /\.o$/)
151955714Skris	{
152055714Skris#	$rmd160_obj=$rmd160_enc;
152155714Skris	$cflags.=" -DRMD160_ASM";
152255714Skris	}
1523160814Ssimonif ($aes_obj =~ /\.o$/)
1524142425Snectar	{
1525160814Ssimon	$cflags.=" -DAES_ASM";
1526238405Sjkim	# aes-ctr.o is not a real file, only indication that assembler
1527238405Sjkim	# module implements AES_ctr32_encrypt...
1528238405Sjkim	$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
1529238405Sjkim	# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
1530238405Sjkim	$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
1531238405Sjkim	$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
1532238405Sjkim	$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
1533238405Sjkim	$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
1534142425Snectar	}
1535160814Ssimonelse	{
1536160814Ssimon	$aes_obj=$aes_enc;
1537160814Ssimon	}
1538238405Sjkim$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
1539238405Sjkimif ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
1540238405Sjkim	{
1541238405Sjkim	$cflags.=" -DWHIRLPOOL_ASM";
1542238405Sjkim	}
1543238405Sjkimelse	{
1544238405Sjkim	$wp_obj="wp_block.o";
1545238405Sjkim	}
1546238405Sjkim$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
1547238405Sjkimif ($modes_obj =~ /ghash/)
1548238405Sjkim	{
1549238405Sjkim	$cflags.=" -DGHASH_ASM";
1550238405Sjkim	}
1551142425Snectar
1552100936Snectar# "Stringify" the C flags string.  This permits it to be made part of a string
1553100936Snectar# and works as well on command lines.
1554100936Snectar$cflags =~ s/([\\\"])/\\\1/g;
1555100936Snectar
155655714Skrismy $version = "unknown";
1557160814Ssimonmy $version_num = "unknown";
155855714Skrismy $major = "unknown";
155955714Skrismy $minor = "unknown";
156068651Skrismy $shlib_version_number = "unknown";
156168651Skrismy $shlib_version_history = "unknown";
156268651Skrismy $shlib_major = "unknown";
156368651Skrismy $shlib_minor = "unknown";
156455714Skris
156555714Skrisopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
156655714Skriswhile (<IN>)
156755714Skris	{
156855714Skris	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
1569160814Ssimon	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
157068651Skris	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
157168651Skris	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
157255714Skris	}
157355714Skrisclose(IN);
157468651Skrisif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
157555714Skris
157655714Skrisif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
157755714Skris	{
157855714Skris	$major=$1;
157955714Skris	$minor=$2;
158055714Skris	}
158155714Skris
158268651Skrisif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
158368651Skris	{
158468651Skris	$shlib_major=$1;
158568651Skris	$shlib_minor=$2;
158668651Skris	}
158768651Skris
1588205128Ssimonif ($strict_warnings)
1589205128Ssimon	{
1590291721Sjkim	my $ecc = $cc;
1591291721Sjkim	$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
1592205128Ssimon	my $wopt;
1593291721Sjkim	die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/);
1594205128Ssimon	foreach $wopt (split /\s+/, $gcc_devteam_warn)
1595205128Ssimon		{
1596291721Sjkim		$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
1597205128Ssimon		}
1598291721Sjkim	if ($ecc eq "clang")
1599291721Sjkim		{
1600291721Sjkim		foreach $wopt (split /\s+/, $clang_devteam_warn)
1601291721Sjkim			{
1602291721Sjkim			$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
1603291721Sjkim			}
1604291721Sjkim		}
1605205128Ssimon	}
1606205128Ssimon
160755714Skrisopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
1608109998Smarkmunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
1609109998Smarkmopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
161059191Skrisprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
161155714Skrismy $sdirs=0;
161255714Skriswhile (<IN>)
161355714Skris	{
1614160814Ssimon	chomp;
161555714Skris	$sdirs = 1 if /^SDIRS=/;
161655714Skris	if ($sdirs) {
161755714Skris		my $dir;
161855714Skris		foreach $dir (@skip) {
1619238405Sjkim			s/(\s)$dir /$1/;
1620194206Ssimon			s/\s$dir$//;
162155714Skris			}
162255714Skris		}
162355714Skris	$sdirs = 0 unless /\\$/;
1624194206Ssimon        s/engines // if (/^DIRS=/ && $disabled{"engine"});
1625238405Sjkim	s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"});
162655714Skris	s/^VERSION=.*/VERSION=$version/;
162755714Skris	s/^MAJOR=.*/MAJOR=$major/;
162855714Skris	s/^MINOR=.*/MINOR=$minor/;
162968651Skris	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
163068651Skris	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
163168651Skris	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
163268651Skris	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
163376866Skris	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
163455714Skris	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
1635238405Sjkim	s/^MULTILIB=.*$/MULTILIB=$multilib/;
163655714Skris	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
1637205128Ssimon	s/^LIBDIR=.*$/LIBDIR=$libdir/;
163855714Skris	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
163955714Skris	s/^PLATFORM=.*$/PLATFORM=$target/;
164055714Skris	s/^OPTIONS=.*$/OPTIONS=$options/;
164168651Skris	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
1642205128Ssimon	if ($cross_compile_prefix)
1643205128Ssimon		{
1644205128Ssimon		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
1645205128Ssimon		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
1646238405Sjkim		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
1647205128Ssimon		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
1648238405Sjkim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc";
1649205128Ssimon		}
1650205128Ssimon	else	{
1651205128Ssimon		s/^CC=.*$/CC= $cc/;
1652205128Ssimon		s/^AR=\s*ar/AR= $ar/;
1653205128Ssimon		s/^RANLIB=.*/RANLIB= $ranlib/;
1654238405Sjkim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
1655205128Ssimon		}
165655714Skris	s/^CFLAG=.*$/CFLAG= $cflags/;
1657194206Ssimon	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1658194206Ssimon	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
165955714Skris	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
166076866Skris	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
1661160814Ssimon	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
166255714Skris	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
166355714Skris	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
1664238405Sjkim	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
166555714Skris	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
166655714Skris	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
166755714Skris	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
166855714Skris	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
166955714Skris	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
167055714Skris	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
167155714Skris	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
1672238405Sjkim	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
1673238405Sjkim	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
1674238405Sjkim	s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
1675238405Sjkim	s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
1676238405Sjkim	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
167755714Skris	s/^PROCESSOR=.*/PROCESSOR= $processor/;
1678109998Smarkm	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
167955714Skris	s/^PERL=.*/PERL= $perl/;
1680109998Smarkm	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1681111147Snectar	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
1682160814Ssimon	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
1683160814Ssimon	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
1684238405Sjkim
1685238405Sjkim	s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
1686194206Ssimon	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1687238405Sjkim	s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1688194206Ssimon	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
1689238405Sjkim
169068651Skris	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
169176866Skris	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
1692238405Sjkim	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
169389837Skris	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
169489837Skris		{
169589837Skris		my $sotmp = $1;
1696100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
169789837Skris		}
1698100936Snectar	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
1699100936Snectar		{
1700100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1701100936Snectar		}
170289837Skris	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
170389837Skris		{
170489837Skris		my $sotmp = $1;
170589837Skris		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
170689837Skris		}
1707100936Snectar	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
1708100936Snectar		{
1709100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
1710100936Snectar		}
1711100928Snectar	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
171255714Skris	print OUT $_."\n";
171355714Skris	}
171455714Skrisclose(IN);
171555714Skrisclose(OUT);
1716109998Smarkmrename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
1717109998Smarkmrename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
171855714Skris
171955714Skrisprint "CC            =$cc\n";
172055714Skrisprint "CFLAG         =$cflags\n";
172155714Skrisprint "EX_LIBS       =$lflags\n";
1722160814Ssimonprint "CPUID_OBJ     =$cpuid_obj\n";
172355714Skrisprint "BN_ASM        =$bn_obj\n";
172455714Skrisprint "DES_ENC       =$des_obj\n";
1725238405Sjkimprint "AES_ENC       =$aes_obj\n";
172655714Skrisprint "BF_ENC        =$bf_obj\n";
172755714Skrisprint "CAST_ENC      =$cast_obj\n";
172855714Skrisprint "RC4_ENC       =$rc4_obj\n";
172955714Skrisprint "RC5_ENC       =$rc5_obj\n";
173055714Skrisprint "MD5_OBJ_ASM   =$md5_obj\n";
173155714Skrisprint "SHA1_OBJ_ASM  =$sha1_obj\n";
173255714Skrisprint "RMD160_OBJ_ASM=$rmd160_obj\n";
1733238405Sjkimprint "CMLL_ENC      =$cmll_obj\n";
1734238405Sjkimprint "MODES_OBJ     =$modes_obj\n";
1735238405Sjkimprint "ENGINES_OBJ   =$engines_obj\n";
173655714Skrisprint "PROCESSOR     =$processor\n";
173755714Skrisprint "RANLIB        =$ranlib\n";
1738109998Smarkmprint "ARFLAGS       =$arflags\n";
173955714Skrisprint "PERL          =$perl\n";
1740109998Smarkmprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
1741109998Smarkm	if $withargs{"krb5-include"} ne "";
174255714Skris
174355714Skrismy $des_ptr=0;
174455714Skrismy $des_risc1=0;
174555714Skrismy $des_risc2=0;
174655714Skrismy $des_unroll=0;
174755714Skrismy $bn_ll=0;
174855714Skrismy $def_int=2;
174955714Skrismy $rc4_int=$def_int;
175055714Skrismy $md2_int=$def_int;
175155714Skrismy $idea_int=$def_int;
175255714Skrismy $rc2_int=$def_int;
175355714Skrismy $rc4_idx=0;
175459191Skrismy $rc4_chunk=0;
175555714Skrismy $bf_ptr=0;
175655714Skrismy @type=("char","short","int","long");
175755714Skrismy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
1758109998Smarkmmy $export_var_as_fn=0;
175955714Skris
176055714Skrismy $des_int;
176155714Skris
176255714Skrisforeach (sort split(/\s+/,$bn_ops))
176355714Skris	{
176455714Skris	$des_ptr=1 if /DES_PTR/;
176555714Skris	$des_risc1=1 if /DES_RISC1/;
176655714Skris	$des_risc2=1 if /DES_RISC2/;
176755714Skris	$des_unroll=1 if /DES_UNROLL/;
176855714Skris	$des_int=1 if /DES_INT/;
176955714Skris	$bn_ll=1 if /BN_LLONG/;
177055714Skris	$rc4_int=0 if /RC4_CHAR/;
177155714Skris	$rc4_int=3 if /RC4_LONG/;
177255714Skris	$rc4_idx=1 if /RC4_INDEX/;
177359191Skris	$rc4_chunk=1 if /RC4_CHUNK/;
177459191Skris	$rc4_chunk=2 if /RC4_CHUNK_LL/;
177555714Skris	$md2_int=0 if /MD2_CHAR/;
177655714Skris	$md2_int=3 if /MD2_LONG/;
177755714Skris	$idea_int=1 if /IDEA_SHORT/;
177855714Skris	$idea_int=3 if /IDEA_LONG/;
177955714Skris	$rc2_int=1 if /RC2_SHORT/;
178055714Skris	$rc2_int=3 if /RC2_LONG/;
178155714Skris	$bf_ptr=1 if $_ eq "BF_PTR";
178255714Skris	$bf_ptr=2 if $_ eq "BF_PTR2";
178355714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
178455714Skris	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
178555714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
178655714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
178755714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
1788109998Smarkm	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
178955714Skris	}
179055714Skris
179155714Skrisopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
1792109998Smarkmunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
1793109998Smarkmopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
179459191Skrisprint OUT "/* opensslconf.h */\n";
179559191Skrisprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
179659191Skris
1797273149Sjkimprint OUT "#ifdef  __cplusplus\n";
1798273149Sjkimprint OUT "extern \"C\" {\n";
1799273149Sjkimprint OUT "#endif\n";
180059191Skrisprint OUT "/* OpenSSL was configured with the following options: */\n";
1801109998Smarkmmy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1802194206Ssimon$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;
1803109998Smarkm$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1804109998Smarkm$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
180559191Skris$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1806109998Smarkm$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1807109998Smarkm$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1808109998Smarkm$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1809109998Smarkmprint OUT $openssl_sys_defines;
1810109998Smarkmprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1811194206Ssimonprint OUT $openssl_experimental_defines;
1812194206Ssimonprint OUT "\n";
1813109998Smarkmprint OUT $openssl_algorithm_defines;
1814194206Ssimonprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
1815109998Smarkmprint OUT $openssl_thread_defines;
1816109998Smarkmprint OUT $openssl_other_defines,"\n";
181759191Skris
1818109998Smarkmprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
1819109998Smarkmprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
1820109998Smarkmprint OUT "   who haven't had the time to do the appropriate changes in their\n";
1821109998Smarkmprint OUT "   applications.  */\n";
1822109998Smarkmprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
1823109998Smarkmprint OUT $openssl_algorithm_defines_trans;
1824109998Smarkmprint OUT "#endif\n\n";
1825109998Smarkm
1826238405Sjkimprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
1827160814Ssimon
182855714Skriswhile (<IN>)
182955714Skris	{
183055714Skris	if	(/^#define\s+OPENSSLDIR/)
1831205128Ssimon		{
1832205128Ssimon		my $foo = $openssldir;
1833205128Ssimon		$foo =~ s/\\/\\\\/g;
1834205128Ssimon		print OUT "#define OPENSSLDIR \"$foo\"\n";
1835205128Ssimon		}
1836160814Ssimon	elsif	(/^#define\s+ENGINESDIR/)
1837205128Ssimon		{
1838238405Sjkim		my $foo = "$prefix/$libdir/engines";
1839205128Ssimon		$foo =~ s/\\/\\\\/g;
1840205128Ssimon		print OUT "#define ENGINESDIR \"$foo\"\n";
1841205128Ssimon		}
1842109998Smarkm	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
1843109998Smarkm		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
1844109998Smarkm			if $export_var_as_fn;
1845109998Smarkm		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
1846109998Smarkm			($export_var_as_fn)?"define":"undef"; }
184755714Skris	elsif	(/^#define\s+OPENSSL_UNISTD/)
184855714Skris		{
184955714Skris		$unistd = "<unistd.h>" if $unistd eq "";
185055714Skris		print OUT "#define OPENSSL_UNISTD $unistd\n";
185155714Skris		}
185255714Skris	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
185355714Skris		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
185455714Skris	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
185555714Skris		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
185655714Skris	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
185755714Skris		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
185855714Skris	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
185955714Skris		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
186055714Skris	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
186155714Skris		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
186255714Skris	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
186355714Skris		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
186455714Skris	elsif	(/^\#define\s+DES_LONG\s+.*/)
186555714Skris		{ printf OUT "#define DES_LONG unsigned %s\n",
186655714Skris			($des_int)?'int':'long'; }
186755714Skris	elsif	(/^\#(define|undef)\s+DES_PTR/)
186855714Skris		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
186955714Skris	elsif	(/^\#(define|undef)\s+DES_RISC1/)
187055714Skris		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
187155714Skris	elsif	(/^\#(define|undef)\s+DES_RISC2/)
187255714Skris		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
187355714Skris	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
187455714Skris		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
187555714Skris	elsif	(/^#define\s+RC4_INT\s/)
187655714Skris		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
187759191Skris	elsif	(/^#undef\s+RC4_CHUNK/)
187859191Skris		{
187959191Skris		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
188059191Skris		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
188159191Skris		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
188259191Skris		}
188355714Skris	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
188455714Skris		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
188555714Skris	elsif (/^#(define|undef)\s+I386_ONLY/)
1886160814Ssimon		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
188755714Skris			"define":"undef"; }
188855714Skris	elsif	(/^#define\s+MD2_INT\s/)
188955714Skris		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
189055714Skris	elsif	(/^#define\s+IDEA_INT\s/)
189155714Skris		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
189255714Skris	elsif	(/^#define\s+RC2_INT\s/)
189355714Skris		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
189455714Skris	elsif (/^#(define|undef)\s+BF_PTR/)
189555714Skris		{
189655714Skris		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
189755714Skris		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
189855714Skris		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
189955714Skris	        }
190055714Skris	else
190155714Skris		{ print OUT $_; }
190255714Skris	}
190355714Skrisclose(IN);
1904273149Sjkimprint OUT "#ifdef  __cplusplus\n";
1905273149Sjkimprint OUT "}\n";
1906273149Sjkimprint OUT "#endif\n";
190755714Skrisclose(OUT);
1908109998Smarkmrename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
1909109998Smarkmrename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
191055714Skris
191155714Skris
191255714Skris# Fix the date
191355714Skris
191455714Skrisprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
191555714Skrisprint "SIXTY_FOUR_BIT mode\n" if $b64;
191655714Skrisprint "THIRTY_TWO_BIT mode\n" if $b32;
191755714Skrisprint "SIXTEEN_BIT mode\n" if $b16;
191855714Skrisprint "EIGHT_BIT mode\n" if $b8;
191955714Skrisprint "DES_PTR used\n" if $des_ptr;
192055714Skrisprint "DES_RISC1 used\n" if $des_risc1;
192155714Skrisprint "DES_RISC2 used\n" if $des_risc2;
192255714Skrisprint "DES_UNROLL used\n" if $des_unroll;
192355714Skrisprint "DES_INT used\n" if $des_int;
192455714Skrisprint "BN_LLONG mode\n" if $bn_ll;
192555714Skrisprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
192655714Skrisprint "RC4_INDEX mode\n" if $rc4_idx;
192759191Skrisprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
192859191Skrisprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
192959191Skrisprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
193055714Skrisprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
193155714Skrisprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
193255714Skrisprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
193355714Skrisprint "BF_PTR used\n" if $bf_ptr == 1; 
193455714Skrisprint "BF_PTR2 used\n" if $bf_ptr == 2; 
193555714Skris
1936160814Ssimonif($IsMK1MF) {
193755714Skris	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
193855714Skris	printf OUT <<EOF;
193955714Skris#ifndef MK1MF_BUILD
194055714Skris  /* auto-generated by Configure for crypto/cversion.c:
1941160814Ssimon   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
194255714Skris   * Windows builds (and other mk1mf builds) compile cversion.c with
194355714Skris   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
194455714Skris  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
194555714Skris#endif
194655714SkrisEOF
194755714Skris	close(OUT);
194855714Skris} else {
1949205128Ssimon	my $make_command = "$make PERL=\'$perl\'";
1950109998Smarkm	my $make_targets = "";
1951109998Smarkm	$make_targets .= " links" if $symlink;
1952160814Ssimon	$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
1953109998Smarkm	$make_targets .= " gentests" if $symlink;
1954109998Smarkm	(system $make_command.$make_targets) == 0 or exit $?
1955109998Smarkm		if $make_targets ne "";
195655714Skris	if ( $perl =~ m@^/@) {
1957215697Ssimon	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
195859191Skris	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
195955714Skris	} else {
196055714Skris	    # No path for Perl known ...
1961215697Ssimon	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
196259191Skris	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
1963109998Smarkm	}
1964160814Ssimon	if ($depflags ne $default_depflags && !$make_depend) {
1965295016Sjkim            $warn_make_depend++;
1966295016Sjkim        }
196755714Skris}
196855714Skris
1969160814Ssimon# create the ms/version32.rc file if needed
1970194206Ssimonif ($IsMK1MF && ($target !~ /^netware/)) {
1971160814Ssimon	my ($v1, $v2, $v3, $v4);
1972160814Ssimon	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
1973160814Ssimon		$v1=hex $1;
1974160814Ssimon		$v2=hex $2;
1975160814Ssimon		$v3=hex $3;
1976160814Ssimon		$v4=hex $4;
1977160814Ssimon	}
1978160814Ssimon	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
1979160814Ssimon	print OUT <<EOF;
1980160814Ssimon#include <winver.h>
1981160814Ssimon
1982160814SsimonLANGUAGE 0x09,0x01
1983160814Ssimon
1984160814Ssimon1 VERSIONINFO
1985160814Ssimon  FILEVERSION $v1,$v2,$v3,$v4
1986160814Ssimon  PRODUCTVERSION $v1,$v2,$v3,$v4
1987160814Ssimon  FILEFLAGSMASK 0x3fL
1988160814Ssimon#ifdef _DEBUG
1989160814Ssimon  FILEFLAGS 0x01L
1990160814Ssimon#else
1991160814Ssimon  FILEFLAGS 0x00L
1992160814Ssimon#endif
1993160814Ssimon  FILEOS VOS__WINDOWS32
1994160814Ssimon  FILETYPE VFT_DLL
1995160814Ssimon  FILESUBTYPE 0x0L
1996160814SsimonBEGIN
1997160814Ssimon    BLOCK "StringFileInfo"
1998160814Ssimon    BEGIN
1999160814Ssimon	BLOCK "040904b0"
2000160814Ssimon	BEGIN
2001160814Ssimon	    // Required:	    
2002160814Ssimon	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
2003160814Ssimon	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
2004160814Ssimon	    VALUE "FileVersion", "$version\\0"
2005160814Ssimon#if defined(CRYPTO)
2006160814Ssimon	    VALUE "InternalName", "libeay32\\0"
2007160814Ssimon	    VALUE "OriginalFilename", "libeay32.dll\\0"
2008160814Ssimon#elif defined(SSL)
2009160814Ssimon	    VALUE "InternalName", "ssleay32\\0"
2010160814Ssimon	    VALUE "OriginalFilename", "ssleay32.dll\\0"
2011160814Ssimon#endif
2012160814Ssimon	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
2013160814Ssimon	    VALUE "ProductVersion", "$version\\0"
2014160814Ssimon	    // Optional:
2015160814Ssimon	    //VALUE "Comments", "\\0"
2016238405Sjkim	    VALUE "LegalCopyright", "Copyright � 1998-2005 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
2017160814Ssimon	    //VALUE "LegalTrademarks", "\\0"
2018160814Ssimon	    //VALUE "PrivateBuild", "\\0"
2019160814Ssimon	    //VALUE "SpecialBuild", "\\0"
2020160814Ssimon	END
2021160814Ssimon    END
2022160814Ssimon    BLOCK "VarFileInfo"
2023160814Ssimon    BEGIN
2024160814Ssimon        VALUE "Translation", 0x409, 0x4b0
2025160814Ssimon    END
2026160814SsimonEND
2027160814SsimonEOF
2028160814Ssimon	close(OUT);
2029160814Ssimon  }
2030160814Ssimon  
203155714Skrisprint <<EOF;
203255714Skris
203359191SkrisConfigured for $target.
203455714SkrisEOF
203555714Skris
203655714Skrisprint <<\EOF if (!$no_threads && !$threads);
203755714Skris
203855714SkrisThe library could not be configured for supporting multi-threaded
203955714Skrisapplications as the compiler options required on this system are not known.
204055714SkrisSee file INSTALL for details if you need multi-threading.
204155714SkrisEOF
204255714Skris
2043111147Snectarprint <<\EOF if ($no_shared_warn);
2044111147Snectar
2045295016SjkimYou gave the option 'shared', which is not supported on this platform, so
2046295016Sjkimwe will pretend you gave the option 'no-shared'.  If you know how to implement
2047295016Sjkimshared libraries, please let us know (but please first make sure you have
2048295016Sjkimtried with a current version of OpenSSL).
2049111147SnectarEOF
2050111147Snectar
2051295016Sjkimprint <<EOF if ($warn_make_depend);
2052295016Sjkim
2053295016Sjkim*** Because of configuration changes, you MUST do the following before
2054295016Sjkim*** building:
2055295016Sjkim
2056295016Sjkim	make depend
2057295016SjkimEOF
2058295016Sjkim
205955714Skrisexit(0);
206055714Skris
206155714Skrissub usage
206255714Skris	{
206355714Skris	print STDERR $usage;
206459191Skris	print STDERR "\npick os/compiler from:\n";
206555714Skris	my $j=0;
206655714Skris	my $i;
206759191Skris        my $k=0;
206855714Skris	foreach $i (sort keys %table)
206955714Skris		{
207055714Skris		next if $i =~ /^debug/;
207159191Skris		$k += length($i) + 1;
207259191Skris		if ($k > 78)
207359191Skris			{
207459191Skris			print STDERR "\n";
207559191Skris			$k=length($i);
207659191Skris			}
207759191Skris		print STDERR $i . " ";
207855714Skris		}
207955714Skris	foreach $i (sort keys %table)
208055714Skris		{
208155714Skris		next if $i !~ /^debug/;
208259191Skris		$k += length($i) + 1;
208359191Skris		if ($k > 78)
208459191Skris			{
208559191Skris			print STDERR "\n";
208659191Skris			$k=length($i);
208759191Skris			}
208859191Skris		print STDERR $i . " ";
208955714Skris		}
209059191Skris	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
209155714Skris	exit(1);
209255714Skris	}
209355714Skris
209455714Skrissub which
209555714Skris	{
209655714Skris	my($name)=@_;
209755714Skris	my $path;
209855714Skris	foreach $path (split /:/, $ENV{PATH})
209955714Skris		{
2100142425Snectar		if (-f "$path/$name$exe_ext" and -x _)
210155714Skris			{
2102142425Snectar			return "$path/$name$exe_ext" unless ($name eq "perl" and
2103142425Snectar			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
210455714Skris			}
210555714Skris		}
210655714Skris	}
210755714Skris
210855714Skrissub dofile
210955714Skris	{
211055714Skris	my $f; my $p; my %m; my @a; my $k; my $ff;
211155714Skris	($f,$p,%m)=@_;
211255714Skris
211355714Skris	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
211455714Skris	@a=<IN>;
211555714Skris	close(IN);
211655714Skris	foreach $k (keys %m)
211755714Skris		{
211855714Skris		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
211955714Skris		}
212059191Skris	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
212155714Skris	print OUT @a;
212255714Skris	close(OUT);
212359191Skris	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
212459191Skris	rename("$f.new",$f) || die "unable to rename $f.new\n";
212555714Skris	}
212655714Skris
212755714Skrissub print_table_entry
212855714Skris	{
212955714Skris	my $target = shift;
213055714Skris
2131109998Smarkm	(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
2132160814Ssimon	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
213368651Skris	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
2134238405Sjkim	my $rc5_obj,my $wp_obj,my $cmll_obj,my $modes_obj, my $engines_obj,
2135238405Sjkim	my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag,
2136238405Sjkim	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multilib)=
213776866Skris	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
213855714Skris			
213955714Skris	print <<EOF
214055714Skris
214155714Skris*** $target
214255714Skris\$cc           = $cc
214355714Skris\$cflags       = $cflags
214455714Skris\$unistd       = $unistd
214555714Skris\$thread_cflag = $thread_cflag
2146109998Smarkm\$sys_id       = $sys_id
214755714Skris\$lflags       = $lflags
214855714Skris\$bn_ops       = $bn_ops
2149160814Ssimon\$cpuid_obj    = $cpuid_obj
215055714Skris\$bn_obj       = $bn_obj
215155714Skris\$des_obj      = $des_obj
2152160814Ssimon\$aes_obj      = $aes_obj
215355714Skris\$bf_obj       = $bf_obj
215455714Skris\$md5_obj      = $md5_obj
215555714Skris\$sha1_obj     = $sha1_obj
215655714Skris\$cast_obj     = $cast_obj
215755714Skris\$rc4_obj      = $rc4_obj
215855714Skris\$rmd160_obj   = $rmd160_obj
215955714Skris\$rc5_obj      = $rc5_obj
2160238405Sjkim\$wp_obj       = $wp_obj
2161238405Sjkim\$cmll_obj     = $cmll_obj
2162238405Sjkim\$modes_obj    = $modes_obj
2163238405Sjkim\$engines_obj  = $engines_obj
2164238405Sjkim\$perlasm_scheme = $perlasm_scheme
216568651Skris\$dso_scheme   = $dso_scheme
216668651Skris\$shared_target= $shared_target
216768651Skris\$shared_cflag = $shared_cflag
2168100928Snectar\$shared_ldflag = $shared_ldflag
216976866Skris\$shared_extension = $shared_extension
217076866Skris\$ranlib       = $ranlib
2171109998Smarkm\$arflags      = $arflags
2172238405Sjkim\$multilib     = $multilib
217355714SkrisEOF
217455714Skris	}
2175100928Snectar
2176100928Snectarsub test_sanity
2177100928Snectar	{
2178100928Snectar	my $errorcnt = 0;
2179100928Snectar
2180100928Snectar	print STDERR "=" x 70, "\n";
2181100928Snectar	print STDERR "=== SANITY TESTING!\n";
2182100928Snectar	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2183100928Snectar	print STDERR "=" x 70, "\n";
2184100928Snectar
2185100928Snectar	foreach $target (sort keys %table)
2186100928Snectar		{
2187100928Snectar		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2188100928Snectar
2189238405Sjkim		if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2190100928Snectar			{
2191100928Snectar			$errorcnt++;
2192100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2193100928Snectar			print STDERR "              in the previous field\n";
2194100928Snectar			}
2195238405Sjkim		elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2196100928Snectar			{
2197100928Snectar			$errorcnt++;
2198100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2199100928Snectar			print STDERR "              in the following field\n";
2200100928Snectar			}
2201238405Sjkim		elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
2202100928Snectar			{
2203100928Snectar			$errorcnt++;
2204100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
2205238405Sjkim			print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
2206100928Snectar			}
2207100928Snectar		}
2208100928Snectar	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2209100928Snectar	return $errorcnt;
2210100928Snectar	}
2211