Configure revision 276861
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
61160814Ssimon# no-sse2	disables IA-32 SSE2 code, above option implies no-sse2
6255714Skris# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
6355714Skris# -<xxx> +<xxx> compiler options are passed through 
6468651Skris#
6568651Skris# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
6668651Skris#		provided to stack calls. Generates unique stack functions for
6768651Skris#		each possible stack type.
6855714Skris# DES_PTR	use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
6955714Skris# DES_RISC1	use different DES_ENCRYPT macro that helps reduce register
7055714Skris#		dependancies but needs to more registers, good for RISC CPU's
7155714Skris# DES_RISC2	A different RISC variant.
7255714Skris# DES_UNROLL	unroll the inner DES loop, sometimes helps, somtimes hinders.
7355714Skris# DES_INT	use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
7455714Skris#		This is used on the DEC Alpha where long is 8 bytes
7555714Skris#		and int is 4
7655714Skris# BN_LLONG	use the type 'long long' in crypto/bn/bn.h
7755714Skris# MD2_CHAR	use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
7855714Skris# MD2_LONG	use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
7955714Skris# IDEA_SHORT	use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8055714Skris# IDEA_LONG	use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8155714Skris# RC2_SHORT	use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8255714Skris# RC2_LONG	use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8355714Skris# RC4_CHAR	use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8455714Skris# RC4_LONG	use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8555714Skris# RC4_INDEX	define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
8655714Skris#		array lookups instead of pointer use.
8759191Skris# RC4_CHUNK	enables code that handles data aligned at long (natural CPU
8859191Skris#		word) boundary.
8959191Skris# RC4_CHUNK_LL	enables code that handles data aligned at long long boundary
9059191Skris#		(intended for 64-bit CPUs running 32-bit OS).
9155714Skris# BF_PTR	use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
9255714Skris# BF_PTR2	intel specific version (generic version is more efficient).
93160814Ssimon#
94160814Ssimon# Following are set automatically by this script
95160814Ssimon#
9655714Skris# MD5_ASM	use some extra md5 assember,
9755714Skris# SHA1_ASM	use some extra sha1 assember, must define L_ENDIAN for x86
9855714Skris# RMD160_ASM	use some extra ripemd160 assember,
99160814Ssimon# SHA256_ASM	sha256_block is implemented in assembler
100160814Ssimon# SHA512_ASM	sha512_block is implemented in assembler
101160814Ssimon# AES_ASM	ASE_[en|de]crypt is implemented in assembler
10255714Skris
103194206Ssimon# Minimum warning options... any contributions to OpenSSL should at least get
104194206Ssimon# past these. 
105194206Ssimon
106194206Ssimonmy $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";
107194206Ssimon
108205128Ssimonmy $strict_warnings = 0;
109205128Ssimon
11055714Skrismy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
11155714Skris
11255714Skris# MD2_CHAR slags pentium pros
11355714Skrismy $x86_gcc_opts="RC4_INDEX MD2_INT";
11455714Skris
11555714Skris# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
11655714Skris# Don't worry about these normally
11755714Skris
11855714Skrismy $tcc="cc";
11955714Skrismy $tflags="-fast -Xa";
12055714Skrismy $tbn_mul="";
12155714Skrismy $tlib="-lnsl -lsocket";
12255714Skris#$bits1="SIXTEEN_BIT ";
12355714Skris#$bits2="THIRTY_TWO_BIT ";
12455714Skrismy $bits1="THIRTY_TWO_BIT ";
12555714Skrismy $bits2="SIXTY_FOUR_BIT ";
12655714Skris
127238405Sjkimmy $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:";
12855714Skris
129238405Sjkimmy $x86_elf_asm="$x86_asm:elf";
13076866Skris
131238405Sjkimmy $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:";
132238405Sjkimmy $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";
133238405Sjkimmy $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";
134238405Sjkimmy $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::::void";
135238405Sjkimmy $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o:::::sha1-alpha.o:::::::ghash-alpha.o::void";
136238405Sjkimmy $mips32_asm=":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o::::::::";
137238405Sjkimmy $mips64_asm=":bn-mips.o mips-mont.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::";
138238405Sjkimmy $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:";
139238405Sjkimmy $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";
140238405Sjkimmy $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";
141238405Sjkimmy $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";
142238405Sjkimmy $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::::::::";
143238405Sjkimmy $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::::::::";
144238405Sjkimmy $no_asm=":::::::::::::::void";
14555714Skris
146160814Ssimon# As for $BSDthreads. Idea is to maintain "collective" set of flags,
147160814Ssimon# which would cover all BSD flavors. -pthread applies to them all, 
148160814Ssimon# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
149160814Ssimon# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
150160814Ssimon# which has to be accompanied by explicit -D_THREAD_SAFE and
151160814Ssimon# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
152160814Ssimon# seems to be sufficient?
153160814Ssimonmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
15459191Skris
155238405Sjkim#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
156160814Ssimon
15755714Skrismy %table=(
15868651Skris# File 'TABLE' (created by 'make TABLE') contains the data from this list,
15968651Skris# formatted for better readability.
16068651Skris
16168651Skris
16259191Skris#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
16359191Skris#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
16459191Skris#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
16559191Skris#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
16655714Skris
16755714Skris# Our development configs
168109998Smarkm"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
169109998Smarkm"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::::",
170238405Sjkim"debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
171109998Smarkm"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)::::",
172109998Smarkm"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)::::",
173238405Sjkim"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
174246772Sjkim"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)",
175238405Sjkim"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::::",
176238405Sjkim"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)::::::",
177246772Sjkim"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",
178238405Sjkim"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
179109998Smarkm"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)::::::",
180109998Smarkm"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
181261037Sjkim"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",
182160814Ssimon"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",
183246772Sjkim"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)",
184194206Ssimon"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)",
185238405Sjkim"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)",
186246772Sjkim"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)",
187246772Sjkim"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)",
188246772Sjkim"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -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)",
189246772Sjkim"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -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)",
190238405Sjkim"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)",
191238405Sjkim"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)",
192238405Sjkim"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
193238405Sjkim"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
194238405Sjkim"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
195238405Sjkim"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
196238405Sjkim"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -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)",
197238405Sjkim"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
198205128Ssimon"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
199238405Sjkim"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -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",
200109998Smarkm"dist",		"cc:-O::(unknown)::::::",
20155714Skris
20259191Skris# Basic configs that should work on any (32 and less bit) box
203109998Smarkm"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
204109998Smarkm"cc",		"cc:-O::(unknown)::::::",
20555714Skris
206142425Snectar####VOS Configurations
207238405Sjkim"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:",
208238405Sjkim"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:",
209142425Snectar
210109998Smarkm#### Solaris x86 with GNU C setups
211109998Smarkm# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
21259191Skris# here because whenever GNU C instantiates an assembler template it
21359191Skris# surrounds it with #APP #NO_APP comment pair which (at least Solaris
21459191Skris# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
21559191Skris# error message.
216160814Ssimon"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)",
217160814Ssimon# -shared -static-libgcc might appear controversial, but modules taken
218160814Ssimon# from static libgcc do not have relocations and linking them into our
219160814Ssimon# shared objects doesn't have any negative side-effects. On the contrary,
220160814Ssimon# doing so makes it possible to use gcc shared build with Sun C. Given
221160814Ssimon# that gcc generates faster code [thanks to inline assembler], I would
222160814Ssimon# actually recommend to consider using gcc shared build even with vendor
223160814Ssimon# compiler:-)
224160814Ssimon#						<appro@fy.chalmers.se>
225238405Sjkim"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",
226160814Ssimon 
22779998Skris#### Solaris x86 with Sun C setups
228160814Ssimon"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)",
229238405Sjkim"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",
23079998Skris
23155714Skris#### SPARC Solaris with GNU C setups
232160814Ssimon"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)",
233238405Sjkim"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
234109998Smarkm# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
235238405Sjkim"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)",
236238405Sjkim"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",
23755714Skris####
238238405Sjkim"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
239238405Sjkim"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)",
24055714Skris
24155714Skris#### SPARC Solaris with Sun C setups
24255714Skris# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
24355714Skris# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
24455714Skris# SC5.0 note: Compiler common patch 107357-01 or later is required!
245160814Ssimon"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)",
246238405Sjkim"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)",
247238405Sjkim"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)",
248246772Sjkim"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",
24959191Skris####
250238405Sjkim"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)",
251238405Sjkim"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)", 
25255714Skris
253160814Ssimon#### SunOS configs, assuming sparc for the gcc one.
254160814Ssimon#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
255160814Ssimon"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
25655714Skris
25755714Skris#### IRIX 5.x configs
25855714Skris# -mips2 flag is added by ./config when appropriate.
259238405Sjkim"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
260238405Sjkim"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
26155714Skris#### IRIX 6.x configs
26255714Skris# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
263127128Snectar# './Configure irix-cc -o32' manually.
264238405Sjkim"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
265238405Sjkim"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
26655714Skris# N64 ABI builds.
267238405Sjkim"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
268238405Sjkim"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
26955714Skris
27059191Skris#### Unified HP-UX ANSI C configs.
27159191Skris# Special notes:
27259191Skris# - Originally we were optimizing at +O4 level. It should be noted
27359191Skris#   that the only difference between +O3 and +O4 is global inter-
27459191Skris#   procedural analysis. As it has to be performed during the link
27559191Skris#   stage the compiler leaves behind certain pseudo-code in lib*.a
27659191Skris#   which might be release or even patch level specific. Generating
27759191Skris#   the machine code for and analyzing the *whole* program appears
27859191Skris#   to be *extremely* memory demanding while the performance gain is
27959191Skris#   actually questionable. The situation is intensified by the default
28059191Skris#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
28159191Skris#   which is way too low for +O4. In other words, doesn't +O3 make
28259191Skris#   more sense?
28359191Skris# - Keep in mind that the HP compiler by default generates code
28459191Skris#   suitable for execution on the host you're currently compiling at.
28559191Skris#   If the toolkit is ment to be used on various PA-RISC processors
286109998Smarkm#   consider './config +DAportable'.
287160814Ssimon# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
28859191Skris#   compatible with *future* releases.
28959191Skris# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
29059191Skris#   pass -D_REENTRANT on HP-UX 10 and later.
29159191Skris# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
29259191Skris#   32-bit message digests. (For the moment of this writing) HP C
29359191Skris#   doesn't seem to "digest" too many local variables (they make "him"
29459191Skris#   chew forever:-). For more details look-up MD32_XARRAY comment in
29559191Skris#   crypto/sha/sha_lcl.h.
29659191Skris#					<appro@fy.chalmers.se>
29759191Skris#
29859191Skris# Since there is mention of this in shlib/hpux10-cc.sh
299160814Ssimon"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)",
300160814Ssimon"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)",
301238405Sjkim"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",
302238405Sjkim"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",
303238405Sjkim"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",
30459191Skris
30568651Skris# More attempts at unified 10.X and 11.X targets for HP C compiler.
30668651Skris#
30768651Skris# Chris Ruemmler <ruemmler@cup.hp.com>
30868651Skris# Kevin Steves <ks@hp.se>
309160814Ssimon"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)",
310238405Sjkim"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",
311238405Sjkim"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",
312238405Sjkim"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",
31368651Skris
314160814Ssimon# HP/UX IA-64 targets
315238405Sjkim"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",
316160814Ssimon# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
317160814Ssimon# with debugging of the following config.
318238405Sjkim"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",
319160814Ssimon# GCC builds...
320238405Sjkim"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",
321238405Sjkim"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", 
32255714Skris
323160814Ssimon# Legacy HPUX 9.X configs...
324160814Ssimon"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)",
325160814Ssimon"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)",
32655714Skris
32768651Skris#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
328160814Ssimon"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:::",
32968651Skris
330160814Ssimon# DEC Alpha OSF/1/Tru64 targets.
33189837Skris#
33289837Skris#	"What's in a name? That which we call a rose
33389837Skris#	 By any other word would smell as sweet."
33489837Skris#
33589837Skris# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
33689837Skris#
33755714Skris# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
33889837Skris#
339238405Sjkim"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
340238405Sjkim"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
341238405Sjkim"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",
34255714Skris
343160814Ssimon####
344160814Ssimon#### Variety of LINUX:-)
345160814Ssimon####
346160814Ssimon# *-generic* is endian-neutral target, but ./config is free to
347160814Ssimon# throw in -D[BL]_ENDIAN, whichever appropriate...
348160814Ssimon"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
349238405Sjkim"linux-ppc",	"gcc:-DB_ENDIAN -DTERMIO -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)",
350238405Sjkim# It's believed that majority of ARM toolchains predefine appropriate -march.
351238405Sjkim# If you compiler does not, do complement config command line with one!
352238405Sjkim"linux-armv4",	"gcc:-DTERMIO -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)",
353160814Ssimon#### IA-32 targets...
354160814Ssimon"linux-ia32-icc",	"icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
355160814Ssimon"linux-elf",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
356238405Sjkim"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
357160814Ssimon####
358160814Ssimon"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
359238405Sjkim"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -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",
360238405Sjkim"linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -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)",
361238405Sjkim"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -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)",
362238405Sjkim"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -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)",
363238405Sjkim"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -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",
364238405Sjkim"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -DTERMIO -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",
365238405Sjkim#### So called "highgprs" target for z/Architecture CPUs
366238405Sjkim# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
367238405Sjkim# /proc/cpuinfo. The idea is to preserve most significant bits of
368238405Sjkim# general purpose registers not only upon 32-bit process context
369238405Sjkim# switch, but even on asynchronous signal delivery to such process.
370238405Sjkim# This makes it possible to deploy 64-bit instructions even in legacy
371238405Sjkim# application context and achieve better [or should we say adequate]
372238405Sjkim# performance. The build is binary compatible with linux-generic32,
373238405Sjkim# and the idea is to be able to install the resulting libcrypto.so
374238405Sjkim# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
375238405Sjkim# ldconfig and run-time linker to autodiscover. Unfortunately it
376238405Sjkim# doesn't work just yet, because of couple of bugs in glibc
377238405Sjkim# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
378238405Sjkim"linux32-s390x",	"gcc:-m31 -Wa,-mzarch -DB_ENDIAN -DTERMIO -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",
379160814Ssimon#### SPARC Linux setups
380160814Ssimon# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
381160814Ssimon# assisted with debugging of following two configs.
382238405Sjkim"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
383160814Ssimon# it's a real mess with -mcpu=ultrasparc option under Linux, but
384160814Ssimon# -Wa,-Av8plus should do the trick no matter what.
385238405Sjkim"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
386160814Ssimon# GCC 3.1 is a requirement
387238405Sjkim"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -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",
38859191Skris#### Alpha Linux with GNU C and Compaq C setups
38959191Skris# Special notes:
39059191Skris# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
39159191Skris#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
39259191Skris#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
39359191Skris#   which is appropriate.
39459191Skris# - If you use ccc keep in mind that -fast implies -arch host and the
39559191Skris#   compiler is free to issue instructions which gonna make elder CPU
39659191Skris#   choke. If you wish to build "blended" toolkit, add -arch generic
39759191Skris#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
39859191Skris#
39959191Skris#					<appro@fy.chalmers.se>
40059191Skris#
401238405Sjkim"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
402238405Sjkim"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-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)",
403238405Sjkim"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
404238405Sjkim"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
40559191Skris
406238405Sjkim# Android: linux-* but without -DTERMIO and pointers to headers and libs.
407237657Sjkim"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)",
408238405Sjkim"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)",
409238405Sjkim"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)",
410237657Sjkim
411160814Ssimon#### *BSD [do see comment about ${BSDthreads} above!]
412160814Ssimon"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
413238405Sjkim"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -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)",
414160814Ssimon"BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
415160814Ssimon"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
416238405Sjkim"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
41755714Skris
418160814Ssimon"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
419160814Ssimon# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
420160814Ssimon# simply *happens* to work around a compiler bug in gcc 3.3.3,
421160814Ssimon# triggered by RIPEMD160 code.
422238405Sjkim"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -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)",
423238405Sjkim"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -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)",
424238405Sjkim"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -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)",
425160814Ssimon
426160814Ssimon"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)",
427160814Ssimon
428109998Smarkm"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
429109998Smarkm"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
430109998Smarkm
43155714Skris# NCR MP-RAS UNIX ver 02.03.01
432111147Snectar"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
43355714Skris
434160814Ssimon# QNX
435109998Smarkm"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
436205128Ssimon"QNX6",       "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
437205128Ssimon"QNX6-i386",  "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
43889837Skris
439238405Sjkim# BeOS
440238405Sjkim"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",
441238405Sjkim"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",
442238405Sjkim
443160814Ssimon#### SCO/Caldera targets.
444111147Snectar#
445111147Snectar# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
446111147Snectar# Now we only have blended unixware-* as it's the only one used by ./config.
447111147Snectar# If you want to optimize for particular microarchitecture, bypass ./config
448111147Snectar# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
449111147Snectar# Note that not all targets include assembler support. Mostly because of
450111147Snectar# lack of motivation to support out-of-date platforms with out-of-date
451111147Snectar# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
452111147Snectar# patiently assisted to debug most of it.
453111147Snectar#
454160814Ssimon# UnixWare 2.0x fails destest with -O.
455109998Smarkm"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
456109998Smarkm"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
457111147Snectar"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)",
458160814Ssimon"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)",
459111147Snectar# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
460111147Snectar"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)",
461111147Snectar"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)",
46276866Skris
463160814Ssimon#### IBM's AIX.
464160814Ssimon"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
465238405Sjkim"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",
466238405Sjkim"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",
467160814Ssimon# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
468160814Ssimon# at build time. $OBJECT_MODE is respected at ./config stage!
469246772Sjkim"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",
470246772Sjkim"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",
47159191Skris
47255714Skris#
473100928Snectar# Cray T90 and similar (SDSC)
47455714Skris# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
47555714Skris# defined.  The T90 ints and longs are 8 bytes long, and apparently the
47655714Skris# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
47755714Skris# non L_ENDIAN code aligns the bytes in each word correctly.
47855714Skris#
47955714Skris# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
48055714Skris#'Taking the address of a bit field is not allowed. '
48155714Skris#'An expression with bit field exists as the operand of "sizeof" '
48255714Skris# (written by Wayne Schroeder <schroede@SDSC.EDU>)
483100928Snectar#
484100928Snectar# j90 is considered the base machine type for unicos machines,
485100928Snectar# so this configuration is now called "cray-j90" ...
486109998Smarkm"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
48755714Skris
48855714Skris#
48955714Skris# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
49055714Skris#
49155714Skris# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
49255714Skris# another use.  Basically, the problem is that the T3E uses some bit fields
49355714Skris# for some st_addr stuff, and then sizeof and address-of fails
49455714Skris# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
49555714Skris# did not like it.
496109998Smarkm"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
49755714Skris
49855714Skris# DGUX, 88100.
499109998Smarkm"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
500109998Smarkm"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
501109998Smarkm"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}",
50255714Skris
50355714Skris# Sinix/ReliantUNIX RM400
50455714Skris# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
505160814Ssimon"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)",
506109998Smarkm"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
507109998Smarkm"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
50855714Skris
50955714Skris# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
510109998Smarkm"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
51155714Skris
51289837Skris# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
51389837Skris# You need to compile using the c89.sh wrapper in the tools directory, because the
51489837Skris# IBM compiler does not like the -L switch after any object modules.
51589837Skris#
516109998Smarkm"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:::",
51789837Skris
518238405Sjkim# Visual C targets
519238405Sjkim#
520160814Ssimon# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
521238405Sjkim"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",
522238405Sjkim"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",
523238405Sjkim"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",
524238405Sjkim"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",
525238405Sjkim# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
526238405Sjkim# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
527238405Sjkim"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",
528238405Sjkim# Unified CE target
529264278Sjkim"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",
530160814Ssimon"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
53155714Skris
53255714Skris# Borland C++ 4.5
533160814Ssimon"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
53455714Skris
535120631Snectar# MinGW
536238405Sjkim"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",
537238405Sjkim# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
538238405Sjkim# compiled with one compiler with application compiled with another
539238405Sjkim# compiler. It's possible to engage Applink support in mingw64 build,
540238405Sjkim# but it's not done, because till mingw64 supports structured exception
541238405Sjkim# handling, one can't seriously consider its binaries for using with
542238405Sjkim# non-mingw64 run-time environment. And as mingw64 is always consistent
543238405Sjkim# with itself, Applink is never engaged and can as well be omitted.
544238405Sjkim"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",
54555714Skris
546100936Snectar# UWIN 
547160814Ssimon"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
548100936Snectar
549100928Snectar# Cygwin
550160814Ssimon"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",
551238405Sjkim"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",
552238405Sjkim"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",
55368651Skris
554194206Ssimon# NetWare from David Ward (dsward@novell.com)
555194206Ssimon# requires either MetroWerks NLM development tools, or gcc / nlmconv
556194206Ssimon# NetWare defaults socket bio to WinSock sockets. However,
557194206Ssimon# the builds can be configured to use BSD sockets instead.
558160814Ssimon# netware-clib => legacy CLib c-runtime support
559194206Ssimon"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
560194206Ssimon"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
561194206Ssimon"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}::",
562194206Ssimon"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}::",
563160814Ssimon# netware-libc => LibC/NKS support
564160814Ssimon"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
565160814Ssimon"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
566160814Ssimon"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}::",
567194206Ssimon"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}::",
568160814Ssimon
569109998Smarkm# DJGPP
570238405Sjkim"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
571109998Smarkm
57255714Skris# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
573109998Smarkm"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
574160814Ssimon"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
57555714Skris# K&R C is no longer supported; you need gcc on old Ultrix installations
576109998Smarkm##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
57755714Skris
57889837Skris##### MacOS X (a.k.a. Rhapsody or Darwin) setup
579160814Ssimon"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
580238405Sjkim"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",
581238405Sjkim"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",
582238405Sjkim"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",
583238405Sjkim"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",
584238405Sjkim"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",
585238405Sjkim"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",
586238405Sjkim# iPhoneOS/iOS
587238405Sjkim"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",
58859191Skris
589109998Smarkm##### A/UX
590109998Smarkm"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
591109998Smarkm
59268651Skris##### Sony NEWS-OS 4.x
593109998Smarkm"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
59468651Skris
595109998Smarkm##### GNU Hurd
596160814Ssimon"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
597109998Smarkm
598109998Smarkm##### OS/2 EMX
599109998Smarkm"OS2-EMX", "gcc::::::::",
600109998Smarkm
601100928Snectar##### VxWorks for various targets
602238405Sjkim"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:::::",
603238405Sjkim"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:::::",
604109998Smarkm"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
605109998Smarkm"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:::::",
606238405Sjkim"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:::::",
607120631Snectar"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
608238405Sjkim"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:",
609238405Sjkim"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:",
610100928Snectar
611109998Smarkm##### Compaq Non-Stop Kernel (Tandem)
612109998Smarkm"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
613109998Smarkm
614238405Sjkim# uClinux
615238405Sjkim"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'}::",
616238405Sjkim"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'}::",
617238405Sjkim
61855714Skris);
61955714Skris
620160814Ssimonmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
621238405Sjkim		    debug-VC-WIN64I debug-VC-WIN64A
622238405Sjkim		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
623238405Sjkim		    BC-32 
624194206Ssimon		    netware-clib netware-clib-bsdsock
625194206Ssimon		    netware-libc netware-libc-bsdsock);
62655714Skris
627100928Snectarmy $idx = 0;
628100928Snectarmy $idx_cc = $idx++;
629100928Snectarmy $idx_cflags = $idx++;
630100928Snectarmy $idx_unistd = $idx++;
631100928Snectarmy $idx_thread_cflag = $idx++;
632109998Smarkmmy $idx_sys_id = $idx++;
633100928Snectarmy $idx_lflags = $idx++;
634100928Snectarmy $idx_bn_ops = $idx++;
635160814Ssimonmy $idx_cpuid_obj = $idx++;
636100928Snectarmy $idx_bn_obj = $idx++;
637100928Snectarmy $idx_des_obj = $idx++;
638160814Ssimonmy $idx_aes_obj = $idx++;
639100928Snectarmy $idx_bf_obj = $idx++;
640100928Snectarmy $idx_md5_obj = $idx++;
641100928Snectarmy $idx_sha1_obj = $idx++;
642100928Snectarmy $idx_cast_obj = $idx++;
643100928Snectarmy $idx_rc4_obj = $idx++;
644100928Snectarmy $idx_rmd160_obj = $idx++;
645100928Snectarmy $idx_rc5_obj = $idx++;
646238405Sjkimmy $idx_wp_obj = $idx++;
647238405Sjkimmy $idx_cmll_obj = $idx++;
648238405Sjkimmy $idx_modes_obj = $idx++;
649238405Sjkimmy $idx_engines_obj = $idx++;
650238405Sjkimmy $idx_perlasm_scheme = $idx++;
651100928Snectarmy $idx_dso_scheme = $idx++;
652100928Snectarmy $idx_shared_target = $idx++;
653100928Snectarmy $idx_shared_cflag = $idx++;
654100928Snectarmy $idx_shared_ldflag = $idx++;
655100928Snectarmy $idx_shared_extension = $idx++;
656100928Snectarmy $idx_ranlib = $idx++;
657109998Smarkmmy $idx_arflags = $idx++;
658238405Sjkimmy $idx_multilib = $idx++;
659100928Snectar
66055714Skrismy $prefix="";
661205128Ssimonmy $libdir="";
66255714Skrismy $openssldir="";
66376866Skrismy $exe_ext="";
664205128Ssimonmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
665205128Ssimonmy $cross_compile_prefix="";
666238405Sjkimmy $fipsdir="/usr/local/ssl/fips-2.0";
667238405Sjkimmy $fipslibdir="";
668194206Ssimonmy $baseaddr="0xFB00000";
66955714Skrismy $no_threads=0;
67055714Skrismy $threads=0;
671160814Ssimonmy $no_shared=0; # but "no-shared" is default
672160814Ssimonmy $zlib=1;      # but "no-zlib" is default
673160814Ssimonmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
674167612Ssimonmy $no_rfc3779=1; # but "no-rfc3779" is default
67555714Skrismy $no_asm=0;
67668651Skrismy $no_dso=0;
677160814Ssimonmy $no_gmp=0;
67855714Skrismy @skip=();
679142425Snectarmy $Makefile="Makefile";
68055714Skrismy $des_locl="crypto/des/des_locl.h";
68155714Skrismy $des	="crypto/des/des.h";
68255714Skrismy $bn	="crypto/bn/bn.h";
68355714Skrismy $md2	="crypto/md2/md2.h";
68455714Skrismy $rc4	="crypto/rc4/rc4.h";
68555714Skrismy $rc4_locl="crypto/rc4/rc4_locl.h";
68655714Skrismy $idea	="crypto/idea/idea.h";
68755714Skrismy $rc2	="crypto/rc2/rc2.h";
68855714Skrismy $bf	="crypto/bf/bf_locl.h";
68955714Skrismy $bn_asm	="bn_asm.o";
69055714Skrismy $des_enc="des_enc.o fcrypt_b.o";
691160814Ssimonmy $aes_enc="aes_core.o aes_cbc.o";
69255714Skrismy $bf_enc	="bf_enc.o";
69355714Skrismy $cast_enc="c_enc.o";
694194206Ssimonmy $rc4_enc="rc4_enc.o rc4_skey.o";
69555714Skrismy $rc5_enc="rc5_enc.o";
69655714Skrismy $md5_obj="";
69755714Skrismy $sha1_obj="";
69855714Skrismy $rmd160_obj="";
699238405Sjkimmy $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
70055714Skrismy $processor="";
70176866Skrismy $default_ranlib;
70255714Skrismy $perl;
703194206Ssimonmy $fips=0;
70455714Skris
705238405Sjkimif (exists $ENV{FIPSDIR})
706238405Sjkim	{
707238405Sjkim	$fipsdir = $ENV{FIPSDIR};
708238405Sjkim	$fipsdir =~ s/\/$//;
709238405Sjkim	}
710109998Smarkm
711160814Ssimon# All of the following is disabled by default (RC5 was enabled before 0.9.8):
712160814Ssimon
713194206Ssimonmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
714238405Sjkim		 "ec_nistp_64_gcc_128" => "default",
715238405Sjkim		 "gmp"		  => "default",
716238405Sjkim		 "jpake"          => "experimental",
717238405Sjkim		 "md2"            => "default",
718238405Sjkim		 "rc5"            => "default",
719238405Sjkim		 "rfc3779"	  => "default",
720238405Sjkim		 "sctp"       => "default",
721238405Sjkim		 "shared"         => "default",
722238405Sjkim		 "store"	  => "experimental",
723269682Sjkim		 "unit-test"	  => "default",
724238405Sjkim		 "zlib"           => "default",
725238405Sjkim		 "zlib-dynamic"   => "default"
726238405Sjkim	       );
727194206Ssimonmy @experimental = ();
728160814Ssimon
729194206Ssimon# This is what $depflags will look like with the above defaults
730194206Ssimon# (we need this to see if we should advise the user to run "make depend"):
731269682Sjkimmy $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_STORE -DOPENSSL_NO_UNIT_TEST";
732160814Ssimon
733194206Ssimon# Explicit "no-..." options will be collected in %disabled along with the defaults.
734194206Ssimon# To remove something from %disabled, use "enable-foo" (unless it's experimental).
735194206Ssimon# For symmetry, "disable-foo" is a synonym for "no-foo".
736160814Ssimon
737194206Ssimon# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
738194206Ssimon# We will collect such requests in @experimental.
739194206Ssimon# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
740194206Ssimon
741194206Ssimon
742160814Ssimonmy $no_sse2=0;
743160814Ssimon
74455714Skris&usage if ($#ARGV < 0);
74555714Skris
74668651Skrismy $flags;
74768651Skrismy $depflags;
748194206Ssimonmy $openssl_experimental_defines;
74968651Skrismy $openssl_algorithm_defines;
75068651Skrismy $openssl_thread_defines;
751109998Smarkmmy $openssl_sys_defines="";
75268651Skrismy $openssl_other_defines;
75368651Skrismy $libs;
754111147Snectarmy $libkrb5="";
75568651Skrismy $target;
75668651Skrismy $options;
75768651Skrismy $symlink;
758109998Smarkmmy $make_depend=0;
759109998Smarkmmy %withargs=();
76068651Skris
76168651Skrismy @argvcopy=@ARGV;
76268651Skrismy $argvstring="";
76368651Skrismy $argv_unprocessed=1;
76468651Skris
76568651Skriswhile($argv_unprocessed)
76655714Skris	{
76768651Skris	$flags="";
76868651Skris	$depflags="";
769194206Ssimon	$openssl_experimental_defines="";
77068651Skris	$openssl_algorithm_defines="";
77168651Skris	$openssl_thread_defines="";
772109998Smarkm	$openssl_sys_defines="";
77368651Skris	$openssl_other_defines="";
77468651Skris	$libs="";
77568651Skris	$target="";
77668651Skris	$options="";
77768651Skris	$symlink=1;
77868651Skris
77968651Skris	$argv_unprocessed=0;
78068651Skris	$argvstring=join(' ',@argvcopy);
78168651Skris
78268651SkrisPROCESS_ARGS:
78368651Skris	foreach (@argvcopy)
78455714Skris		{
78568651Skris		s /^-no-/no-/; # some people just can't read the instructions
786160814Ssimon
787160814Ssimon		# rewrite some options in "enable-..." form
788160814Ssimon		s /^-?-?shared$/enable-shared/;
789238405Sjkim		s /^sctp$/enable-sctp/;
790160814Ssimon		s /^threads$/enable-threads/;
791160814Ssimon		s /^zlib$/enable-zlib/;
792160814Ssimon		s /^zlib-dynamic$/enable-zlib-dynamic/;
793160814Ssimon
794160814Ssimon		if (/^no-(.+)$/ || /^disable-(.+)$/)
795100928Snectar			{
796194206Ssimon			if (!($disabled{$1} eq "experimental"))
797109998Smarkm				{
798194206Ssimon				if ($1 eq "ssl")
799194206Ssimon					{
800194206Ssimon					$disabled{"ssl2"} = "option(ssl)";
801194206Ssimon					$disabled{"ssl3"} = "option(ssl)";
802194206Ssimon					}
803194206Ssimon				elsif ($1 eq "tls")
804194206Ssimon					{
805194206Ssimon					$disabled{"tls1"} = "option(tls)"
806194206Ssimon					}
807276861Sjkim				elsif ($1 eq "ssl3-method")
808276861Sjkim					{
809276861Sjkim					$disabled{"ssl3-method"} = "option(ssl)";
810276861Sjkim					$disabled{"ssl3"} = "option(ssl)";
811276861Sjkim					}
812194206Ssimon				else
813194206Ssimon					{
814194206Ssimon					$disabled{$1} = "option";
815194206Ssimon					}
816238405Sjkim				}			
817238405Sjkim			}
818194206Ssimon		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
819194206Ssimon			{
820194206Ssimon			my $algo = $1;
821194206Ssimon			if ($disabled{$algo} eq "experimental")
82268651Skris				{
823194206Ssimon				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
824194206Ssimon					unless (/^experimental-/);
825194206Ssimon				push @experimental, $algo;
82668651Skris				}
827194206Ssimon			delete $disabled{$algo};
828160814Ssimon
829194206Ssimon			$threads = 1 if ($algo eq "threads");
83055714Skris			}
831160814Ssimon		elsif (/^--test-sanity$/)
832160814Ssimon			{
833160814Ssimon			exit(&test_sanity());
834160814Ssimon			}
835205128Ssimon		elsif (/^--strict-warnings/)
836205128Ssimon			{
837205128Ssimon			$strict_warnings = 1;
838205128Ssimon			}
83968651Skris		elsif (/^reconfigure/ || /^reconf/)
84055714Skris			{
84168651Skris			if (open(IN,"<$Makefile"))
84268651Skris				{
84368651Skris				while (<IN>)
84468651Skris					{
845160814Ssimon					chomp;
84668651Skris					if (/^CONFIGURE_ARGS=(.*)/)
84768651Skris						{
84868651Skris						$argvstring=$1;
84968651Skris						@argvcopy=split(' ',$argvstring);
85068651Skris						die "Incorrect data to reconfigure, please do a normal configuration\n"
85168651Skris							if (grep(/^reconf/,@argvcopy));
85268651Skris						print "Reconfiguring with: $argvstring\n";
85368651Skris						$argv_unprocessed=1;
85468651Skris						close(IN);
85568651Skris						last PROCESS_ARGS;
85668651Skris						}
85768651Skris					}
85868651Skris				close(IN);
85968651Skris				}
86068651Skris			die "Insufficient data to reconfigure, please do a normal configuration\n";
86155714Skris			}
86268651Skris		elsif (/^386$/)
86368651Skris			{ $processor=386; }
864194206Ssimon		elsif (/^fips$/)
865194206Ssimon			{
866194206Ssimon			$fips=1;
867238405Sjkim			}
86868651Skris		elsif (/^rsaref$/)
86955714Skris			{
870109998Smarkm			# No RSAref support any more since it's not needed.
871109998Smarkm			# The check for the option is there so scripts aren't
872109998Smarkm			# broken
87355714Skris			}
87468651Skris		elsif (/^[-+]/)
87555714Skris			{
876238405Sjkim			if (/^-[lL](.*)$/ or /^-Wl,/)
87768651Skris				{
87868651Skris				$libs.=$_." ";
87968651Skris				}
88068651Skris			elsif (/^-[^-]/ or /^\+/)
88168651Skris				{
882238405Sjkim				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
88368651Skris				$flags.=$_." ";
88468651Skris				}
88568651Skris			elsif (/^--prefix=(.*)$/)
88668651Skris				{
88768651Skris				$prefix=$1;
88868651Skris				}
889205128Ssimon			elsif (/^--libdir=(.*)$/)
890205128Ssimon				{
891205128Ssimon				$libdir=$1;
892205128Ssimon				}
89368651Skris			elsif (/^--openssldir=(.*)$/)
89468651Skris				{
89568651Skris				$openssldir=$1;
89668651Skris				}
89768651Skris			elsif (/^--install.prefix=(.*)$/)
89868651Skris				{
89968651Skris				$install_prefix=$1;
90068651Skris				}
901109998Smarkm			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
902109998Smarkm				{
903109998Smarkm				$withargs{"krb5-".$1}=$2;
904109998Smarkm				}
905160814Ssimon			elsif (/^--with-zlib-lib=(.*)$/)
906160814Ssimon				{
907160814Ssimon				$withargs{"zlib-lib"}=$1;
908160814Ssimon				}
909160814Ssimon			elsif (/^--with-zlib-include=(.*)$/)
910160814Ssimon				{
911160814Ssimon				$withargs{"zlib-include"}="-I$1";
912160814Ssimon				}
913238405Sjkim			elsif (/^--with-fipsdir=(.*)$/)
914238405Sjkim				{
915238405Sjkim				$fipsdir="$1";
916238405Sjkim				}
917194206Ssimon			elsif (/^--with-fipslibdir=(.*)$/)
918194206Ssimon				{
919238405Sjkim				$fipslibdir="$1";
920194206Ssimon				}
921194206Ssimon			elsif (/^--with-baseaddr=(.*)$/)
922194206Ssimon				{
923194206Ssimon				$baseaddr="$1";
924194206Ssimon				}
925238405Sjkim			elsif (/^--cross-compile-prefix=(.*)$/)
926238405Sjkim				{
927238405Sjkim				$cross_compile_prefix=$1;
928238405Sjkim				}
92968651Skris			else
93068651Skris				{
93168651Skris				print STDERR $usage;
93268651Skris				exit(1);
93368651Skris				}
93455714Skris			}
93568651Skris		elsif ($_ =~ /^([^:]+):(.+)$/)
93655714Skris			{
93768651Skris			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
93868651Skris			$target=$1;
93955714Skris			}
94055714Skris		else
94155714Skris			{
942160814Ssimon			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
94368651Skris			$target=$_;
94455714Skris			}
945160814Ssimon
946160814Ssimon		unless ($_ eq $target || /^no-/ || /^disable-/)
947160814Ssimon			{
948160814Ssimon			# "no-..." follows later after implied disactivations
949160814Ssimon			# have been derived.  (Don't take this too seroiusly,
950160814Ssimon			# we really only write OPTIONS to the Makefile out of
951160814Ssimon			# nostalgia.)
952160814Ssimon
953160814Ssimon			if ($options eq "")
954160814Ssimon				{ $options = $_; }
955160814Ssimon			else
956160814Ssimon				{ $options .= " ".$_; }
95768651Skris			}
95855714Skris		}
95955714Skris	}
96055714Skris
961109998Smarkm
962109998Smarkm
963160814Ssimonif ($processor eq "386")
964160814Ssimon	{
965160814Ssimon	$disabled{"sse2"} = "forced";
966160814Ssimon	}
967109998Smarkm
968160814Ssimonif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
969109998Smarkm	{
970160814Ssimon	$disabled{"krb5"} = "krb5-flavor not specified";
971109998Smarkm	}
972109998Smarkm
973160814Ssimonif (!defined($disabled{"zlib-dynamic"}))
974109998Smarkm	{
975160814Ssimon	# "zlib-dynamic" was specifically enabled, so enable "zlib"
976160814Ssimon	delete $disabled{"zlib"};
977109998Smarkm	}
978109998Smarkm
979160814Ssimonif (defined($disabled{"rijndael"}))
980109998Smarkm	{
981160814Ssimon	$disabled{"aes"} = "forced";
982109998Smarkm	}
983160814Ssimonif (defined($disabled{"des"}))
984160814Ssimon	{
985160814Ssimon	$disabled{"mdc2"} = "forced";
986160814Ssimon	}
987160814Ssimonif (defined($disabled{"ec"}))
988160814Ssimon	{
989160814Ssimon	$disabled{"ecdsa"} = "forced";
990160814Ssimon	$disabled{"ecdh"} = "forced";
991160814Ssimon	}
992109998Smarkm
993160814Ssimon# SSL 2.0 requires MD5 and RSA
994160814Ssimonif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
995160814Ssimon	{
996160814Ssimon	$disabled{"ssl2"} = "forced";
997160814Ssimon	}
998160814Ssimon
999238405Sjkimif ($fips && $fipslibdir eq "")
1000238405Sjkim	{
1001238405Sjkim	$fipslibdir = $fipsdir . "/lib/";
1002238405Sjkim	}
1003238405Sjkim
1004238405Sjkim# RSAX ENGINE sets default non-FIPS RSA method.
1005238405Sjkimif ($fips)
1006238405Sjkim	{
1007238405Sjkim	$disabled{"rsax"} = "forced";
1008238405Sjkim	}
1009238405Sjkim
1010160814Ssimon# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
1011160814Ssimonif (defined($disabled{"md5"}) || defined($disabled{"sha"})
1012160814Ssimon    || (defined($disabled{"rsa"})
1013160814Ssimon        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
1014160814Ssimon	{
1015160814Ssimon	$disabled{"ssl3"} = "forced";
1016160814Ssimon	$disabled{"tls1"} = "forced";
1017160814Ssimon	}
1018160814Ssimon
1019194206Ssimonif (defined($disabled{"tls1"}))
1020194206Ssimon	{
1021194206Ssimon	$disabled{"tlsext"} = "forced";
1022194206Ssimon	}
1023160814Ssimon
1024238405Sjkimif (defined($disabled{"ec"}) || defined($disabled{"dsa"})
1025238405Sjkim    || defined($disabled{"dh"}))
1026238405Sjkim	{
1027238405Sjkim	$disabled{"gost"} = "forced";
1028238405Sjkim	}
1029238405Sjkim
1030238405Sjkim# SRP and HEARTBEATS require TLSEXT
1031238405Sjkimif (defined($disabled{"tlsext"}))
1032238405Sjkim	{
1033238405Sjkim	$disabled{"srp"} = "forced";
1034238405Sjkim	$disabled{"heartbeats"} = "forced";
1035238405Sjkim	}
1036238405Sjkim
103755714Skrisif ($target eq "TABLE") {
103855714Skris	foreach $target (sort keys %table) {
103955714Skris		print_table_entry($target);
104055714Skris	}
104155714Skris	exit 0;
104255714Skris}
104355714Skris
104459191Skrisif ($target eq "LIST") {
104559191Skris	foreach (sort keys %table) {
104659191Skris		print;
104759191Skris		print "\n";
104859191Skris	}
104959191Skris	exit 0;
105059191Skris}
105159191Skris
1052100928Snectarif ($target =~ m/^CygWin32(-.*)$/) {
1053100928Snectar	$target = "Cygwin".$1;
1054100928Snectar}
1055100928Snectar
105668651Skrisprint "Configuring for $target\n";
105768651Skris
105855714Skris&usage if (!defined($table{$target}));
105955714Skris
106055714Skris
1061160814Ssimonforeach (sort (keys %disabled))
1062160814Ssimon	{
1063160814Ssimon	$options .= " no-$_";
1064160814Ssimon
1065160814Ssimon	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
1066160814Ssimon
1067160814Ssimon	if (/^dso$/)
1068160814Ssimon		{ $no_dso = 1; }
1069160814Ssimon	elsif (/^threads$/)
1070160814Ssimon		{ $no_threads = 1; }
1071160814Ssimon	elsif (/^shared$/)
1072160814Ssimon		{ $no_shared = 1; }
1073160814Ssimon	elsif (/^zlib$/)
1074160814Ssimon		{ $zlib = 0; }
1075160814Ssimon	elsif (/^static-engine$/)
1076160814Ssimon		{ }
1077160814Ssimon	elsif (/^zlib-dynamic$/)
1078160814Ssimon		{ }
1079160814Ssimon	elsif (/^symlinks$/)
1080160814Ssimon		{ $symlink = 0; }
1081160814Ssimon	elsif (/^sse2$/)
1082160814Ssimon		{ $no_sse2 = 1; }
1083160814Ssimon	else
1084160814Ssimon		{
1085160814Ssimon		my ($ALGO, $algo);
1086238405Sjkim		($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
1087160814Ssimon
1088160814Ssimon		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
1089160814Ssimon			{
1090160814Ssimon			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
1091160814Ssimon			print " OPENSSL_NO_$ALGO";
1092160814Ssimon		
1093160814Ssimon			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
1094160814Ssimon			elsif (/^asm$/)	{ $no_asm = 1; }
1095160814Ssimon			}
1096160814Ssimon		else
1097160814Ssimon			{
1098160814Ssimon			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
1099160814Ssimon			print " OPENSSL_NO_$ALGO";
1100160814Ssimon
1101160814Ssimon			if (/^krb5$/)
1102160814Ssimon				{ $no_krb5 = 1; }
1103160814Ssimon			else
1104160814Ssimon				{
1105160814Ssimon				push @skip, $algo;
1106238405Sjkim				# fix-up crypto/directory name(s)
1107238405Sjkim				@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
1108160814Ssimon				print " (skip dir)";
1109160814Ssimon
1110194206Ssimon				$depflags .= " -DOPENSSL_NO_$ALGO";
1111160814Ssimon				}
1112160814Ssimon			}
1113160814Ssimon		}
1114160814Ssimon
1115160814Ssimon	print "\n";
1116160814Ssimon	}
1117160814Ssimon
1118238405Sjkimmy $exp_cflags = "";
1119238405Sjkimforeach (sort @experimental)
1120238405Sjkim	{
1121238405Sjkim	my $ALGO;
1122238405Sjkim	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
1123160814Ssimon
1124238405Sjkim	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
1125238405Sjkim	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
1126238405Sjkim	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
1127238405Sjkim	}
1128160814Ssimon
1129238405Sjkimmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
1130194206Ssimon
1131238405Sjkim$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
1132194206Ssimon$exe_ext=".nlm" if ($target =~ /netware/);
1133160814Ssimon$exe_ext=".pm"  if ($target =~ /vos/);
1134238405Sjkim$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
113555714Skris$prefix=$openssldir if $prefix eq "";
113655714Skris
1137142425Snectar$default_ranlib= &which("ranlib") or $default_ranlib="true";
1138142425Snectar$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
1139142425Snectar  or $perl="perl";
1140205128Ssimonmy $make = $ENV{'MAKE'} || "make";
1141142425Snectar
1142205128Ssimon$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
1143205128Ssimon
114455714Skrischop $openssldir if $openssldir =~ /\/$/;
1145194206Ssimonchop $prefix if $prefix =~ /.\/$/;
114655714Skris
114755714Skris$openssldir=$prefix . "/ssl" if $openssldir eq "";
1148109998Smarkm$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
114955714Skris
115055714Skris
1151160814Ssimonprint "IsMK1MF=$IsMK1MF\n";
115255714Skris
1153238405Sjkimmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1154238405Sjkimmy $cc = $fields[$idx_cc];
1155238405Sjkim# Allow environment CC to override compiler...
1156238405Sjkimif($ENV{CC}) {
1157238405Sjkim    $cc = $ENV{CC};
1158238405Sjkim}
1159238405Sjkimmy $cflags = $fields[$idx_cflags];
1160238405Sjkimmy $unistd = $fields[$idx_unistd];
1161238405Sjkimmy $thread_cflag = $fields[$idx_thread_cflag];
1162238405Sjkimmy $sys_id = $fields[$idx_sys_id];
1163238405Sjkimmy $lflags = $fields[$idx_lflags];
1164238405Sjkimmy $bn_ops = $fields[$idx_bn_ops];
1165238405Sjkimmy $cpuid_obj = $fields[$idx_cpuid_obj];
1166238405Sjkimmy $bn_obj = $fields[$idx_bn_obj];
1167238405Sjkimmy $des_obj = $fields[$idx_des_obj];
1168238405Sjkimmy $aes_obj = $fields[$idx_aes_obj];
1169238405Sjkimmy $bf_obj = $fields[$idx_bf_obj];
1170238405Sjkimmy $md5_obj = $fields[$idx_md5_obj];
1171238405Sjkimmy $sha1_obj = $fields[$idx_sha1_obj];
1172238405Sjkimmy $cast_obj = $fields[$idx_cast_obj];
1173238405Sjkimmy $rc4_obj = $fields[$idx_rc4_obj];
1174238405Sjkimmy $rmd160_obj = $fields[$idx_rmd160_obj];
1175238405Sjkimmy $rc5_obj = $fields[$idx_rc5_obj];
1176238405Sjkimmy $wp_obj = $fields[$idx_wp_obj];
1177238405Sjkimmy $cmll_obj = $fields[$idx_cmll_obj];
1178238405Sjkimmy $modes_obj = $fields[$idx_modes_obj];
1179238405Sjkimmy $engines_obj = $fields[$idx_engines_obj];
1180238405Sjkimmy $perlasm_scheme = $fields[$idx_perlasm_scheme];
1181238405Sjkimmy $dso_scheme = $fields[$idx_dso_scheme];
1182238405Sjkimmy $shared_target = $fields[$idx_shared_target];
1183238405Sjkimmy $shared_cflag = $fields[$idx_shared_cflag];
1184238405Sjkimmy $shared_ldflag = $fields[$idx_shared_ldflag];
1185238405Sjkimmy $shared_extension = $fields[$idx_shared_extension];
1186238405Sjkimmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
1187238405Sjkimmy $ar = $ENV{'AR'} || "ar";
1188238405Sjkimmy $arflags = $fields[$idx_arflags];
1189238405Sjkimmy $multilib = $fields[$idx_multilib];
1190238405Sjkim
1191238405Sjkim# if $prefix/lib$multilib is not an existing directory, then
1192238405Sjkim# assume that it's not searched by linker automatically, in
1193238405Sjkim# which case adding $multilib suffix causes more grief than
1194238405Sjkim# we're ready to tolerate, so don't...
1195238405Sjkim$multilib="" if !-d "$prefix/lib$multilib";
1196238405Sjkim
1197238405Sjkim$libdir="lib$multilib" if $libdir eq "";
1198238405Sjkim
1199238405Sjkim$cflags = "$cflags$exp_cflags";
1200238405Sjkim
1201194206Ssimon# '%' in $lflags is used to split flags to "pre-" and post-flags
1202194206Ssimonmy ($prelflags,$postlflags)=split('%',$lflags);
1203238405Sjkimif (defined($postlflags))	{ $lflags=$postlflags;	}
1204238405Sjkimelse				{ $lflags=$prelflags; undef $prelflags;	}
1205100928Snectar
1206238405Sjkimif ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
1207238405Sjkim	{
1208238405Sjkim	$cflags =~ s/\-mno\-cygwin\s*//;
1209238405Sjkim	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
1210238405Sjkim	}
1211238405Sjkim
1212111147Snectarmy $no_shared_warn=0;
1213160814Ssimonmy $no_user_cflags=0;
1214111147Snectar
1215160814Ssimonif ($flags ne "")	{ $cflags="$flags$cflags"; }
1216160814Ssimonelse			{ $no_user_cflags=1;       }
121755714Skris
1218109998Smarkm# Kerberos settings.  The flavor must be provided from outside, either through
1219109998Smarkm# the script "config" or manually.
1220160814Ssimonif (!$no_krb5)
1221109998Smarkm	{
1222109998Smarkm	my ($lresolv, $lpath, $lext);
1223109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
1224109998Smarkm		{
1225109998Smarkm		die "Sorry, Heimdal is currently not supported\n";
1226109998Smarkm		}
1227109998Smarkm	##### HACK to force use of Heimdal.
1228109998Smarkm	##### WARNING: Since we don't really have adequate support for Heimdal,
1229109998Smarkm	#####          using this will break the build.  You'll have to make
1230109998Smarkm	#####          changes to the source, and if you do, please send
1231109998Smarkm	#####          patches to openssl-dev@openssl.org
1232109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
1233109998Smarkm		{
1234109998Smarkm		warn "Heimdal isn't really supported.  Your build WILL break\n";
1235109998Smarkm		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
1236109998Smarkm		$withargs{"krb5-dir"} = "/usr/heimdal"
1237109998Smarkm			if $withargs{"krb5-dir"} eq "";
1238109998Smarkm		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1239109998Smarkm			"/lib -lgssapi -lkrb5 -lcom_err"
1240160814Ssimon			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1241109998Smarkm		$cflags="-DKRB5_HEIMDAL $cflags";
1242109998Smarkm		}
1243109998Smarkm	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
1244109998Smarkm		{
1245109998Smarkm		$withargs{"krb5-dir"} = "/usr/kerberos"
1246109998Smarkm			if $withargs{"krb5-dir"} eq "";
1247109998Smarkm		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1248109998Smarkm			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
1249160814Ssimon			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1250109998Smarkm		$cflags="-DKRB5_MIT $cflags";
1251109998Smarkm		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
1252109998Smarkm		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
1253109998Smarkm			{
1254109998Smarkm			$cflags="-DKRB5_MIT_OLD11 $cflags";
1255109998Smarkm			}
1256109998Smarkm		}
1257109998Smarkm	LRESOLV:
1258109998Smarkm	foreach $lpath ("/lib", "/usr/lib")
1259109998Smarkm		{
1260109998Smarkm		foreach $lext ("a", "so")
1261109998Smarkm			{
1262109998Smarkm			$lresolv = "$lpath/libresolv.$lext";
1263109998Smarkm			last LRESOLV	if (-r "$lresolv");
1264109998Smarkm			$lresolv = "";
1265109998Smarkm			}
1266109998Smarkm		}
1267109998Smarkm	$withargs{"krb5-lib"} .= " -lresolv"
1268109998Smarkm		if ("$lresolv" ne "");
1269109998Smarkm	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
1270109998Smarkm		if $withargs{"krb5-include"} eq "" &&
1271109998Smarkm		   $withargs{"krb5-dir"} ne "";
1272109998Smarkm	}
1273109998Smarkm
127468651Skris# The DSO code currently always implements all functions so that no
127568651Skris# applications will have to worry about that from a compilation point
127668651Skris# of view. However, the "method"s may return zero unless that platform
127768651Skris# has support compiled in for them. Currently each method is enabled
127868651Skris# by a define "DSO_<name>" ... we translate the "dso_scheme" config
127968651Skris# string entry into using the following logic;
128068651Skrismy $dso_cflags;
128168651Skrisif (!$no_dso && $dso_scheme ne "")
128268651Skris	{
128368651Skris	$dso_scheme =~ tr/[a-z]/[A-Z]/;
128468651Skris	if ($dso_scheme eq "DLFCN")
128568651Skris		{
128668651Skris		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
128768651Skris		}
128868651Skris	elsif ($dso_scheme eq "DLFCN_NO_H")
128968651Skris		{
129068651Skris		$dso_cflags = "-DDSO_DLFCN";
129168651Skris		}
129268651Skris	else
129368651Skris		{
129468651Skris		$dso_cflags = "-DDSO_$dso_scheme";
129568651Skris		}
129668651Skris	$cflags = "$dso_cflags $cflags";
129768651Skris	}
129868651Skris
129955714Skrismy $thread_cflags;
130059191Skrismy $thread_defines;
130155714Skrisif ($thread_cflag ne "(unknown)" && !$no_threads)
130255714Skris	{
130355714Skris	# If we know how to do it, support threads by default.
130455714Skris	$threads = 1;
130555714Skris	}
1306160814Ssimonif ($thread_cflag eq "(unknown)" && $threads)
130755714Skris	{
1308160814Ssimon	# If the user asked for "threads", [s]he is also expected to
1309160814Ssimon	# provide any system-dependent compiler options that are
1310160814Ssimon	# necessary.
1311160814Ssimon	if ($no_user_cflags)
1312160814Ssimon		{
1313160814Ssimon		print "You asked for multi-threading support, but didn't\n";
1314160814Ssimon		print "provide any system-specific compiler options\n";
1315160814Ssimon		exit(1);
1316160814Ssimon		}
1317109998Smarkm	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
1318109998Smarkm	$thread_defines .= "#define OPENSSL_THREADS\n";
131955714Skris	}
132055714Skriselse
132155714Skris	{
1322109998Smarkm	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
1323109998Smarkm	$thread_defines .= "#define OPENSSL_THREADS\n";
132459191Skris#	my $def;
132559191Skris#	foreach $def (split ' ',$thread_cflag)
132659191Skris#		{
132759191Skris#		if ($def =~ s/^-D// && $def !~ /^_/)
132859191Skris#			{
132959191Skris#			$thread_defines .= "#define $def\n";
133059191Skris#			}
133159191Skris#		}
133255714Skris	}	
133355714Skris
1334109998Smarkm$lflags="$libs$lflags" if ($libs ne "");
133555714Skris
133655714Skrisif ($no_asm)
133755714Skris	{
1338238405Sjkim	$cpuid_obj=$bn_obj=
1339238405Sjkim	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
1340238405Sjkim	$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
134155714Skris	}
134255714Skris
1343109998Smarkmif (!$no_shared)
1344109998Smarkm	{
1345109998Smarkm	$cast_obj="";	# CAST assembler is not PIC
1346109998Smarkm	}
1347109998Smarkm
134855714Skrisif ($threads)
134955714Skris	{
1350109998Smarkm	$cflags=$thread_cflags;
1351109998Smarkm	$openssl_thread_defines .= $thread_defines;
135255714Skris	}
135355714Skris
1354109998Smarkmif ($zlib)
1355109998Smarkm	{
1356109998Smarkm	$cflags = "-DZLIB $cflags";
1357160814Ssimon	if (defined($disabled{"zlib-dynamic"}))
1358160814Ssimon		{
1359238405Sjkim		if (defined($withargs{"zlib-lib"}))
1360238405Sjkim			{
1361238405Sjkim			$lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
1362238405Sjkim			}
1363238405Sjkim		else
1364238405Sjkim			{
1365238405Sjkim			$lflags = "$lflags -lz";
1366238405Sjkim			}
1367160814Ssimon		}
1368160814Ssimon	else
1369160814Ssimon		{
1370160814Ssimon		$cflags = "-DZLIB_SHARED $cflags";
1371160814Ssimon		}
1372109998Smarkm	}
1373109998Smarkm
137468651Skris# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
137576866Skrismy $shared_mark = "";
1376109998Smarkmif ($shared_target eq "")
137768651Skris	{
1378238405Sjkim	$no_shared_warn = 1 if !$no_shared;
1379109998Smarkm	$no_shared = 1;
1380109998Smarkm	}
1381109998Smarkmif (!$no_shared)
1382109998Smarkm	{
138376866Skris	if ($shared_cflag ne "")
138476866Skris		{
1385160814Ssimon		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
138676866Skris		}
138768651Skris	}
1388109998Smarkm
1389160814Ssimonif (!$IsMK1MF)
1390160814Ssimon	{
1391238405Sjkim	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
1392160814Ssimon	if ($no_shared)
1393160814Ssimon		{
1394160814Ssimon		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
1395238405Sjkim		$options.=" static-engine";
1396160814Ssimon		}
1397160814Ssimon	else
1398160814Ssimon		{
1399160814Ssimon		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
1400238405Sjkim		$options.=" no-static-engine";
1401160814Ssimon		}
1402160814Ssimon	}
1403160814Ssimon
1404238405Sjkim$cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1405194206Ssimon
1406194206Ssimon#
1407194206Ssimon# Platform fix-ups
1408194206Ssimon#
1409194206Ssimonif ($target =~ /\-icc$/)	# Intel C compiler
1410160814Ssimon	{
1411194206Ssimon	my $iccver=0;
1412194206Ssimon	if (open(FD,"$cc -V 2>&1 |"))
1413194206Ssimon		{
1414194206Ssimon		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1415194206Ssimon		close(FD);
1416194206Ssimon		}
1417160814Ssimon	if ($iccver>=8)
1418160814Ssimon		{
1419160814Ssimon		# Eliminate unnecessary dependency from libirc.a. This is
1420160814Ssimon		# essential for shared library support, as otherwise
1421160814Ssimon		# apps/openssl can end up in endless loop upon startup...
1422160814Ssimon		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
1423160814Ssimon		}
1424194206Ssimon	if ($iccver>=9)
1425194206Ssimon		{
1426194206Ssimon		$cflags.=" -i-static";
1427194206Ssimon		$cflags=~s/\-no_cpprt/-no-cpprt/;
1428194206Ssimon		}
1429194206Ssimon	if ($iccver>=10)
1430194206Ssimon		{
1431194206Ssimon		$cflags=~s/\-i\-static/-static-intel/;
1432194206Ssimon		}
1433160814Ssimon	}
1434160814Ssimon
1435194206Ssimon# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1436194206Ssimon# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1437194206Ssimon# .so objects. Apparently application RPATH is not global and does
1438194206Ssimon# not apply to .so linked with other .so. Problem manifests itself
1439194206Ssimon# when libssl.so fails to load libcrypto.so. One can argue that we
1440194206Ssimon# should engrave this into Makefile.shared rules or into BSD-* config
1441194206Ssimon# lines above. Meanwhile let's try to be cautious and pass -rpath to
1442194206Ssimon# linker only when --prefix is not /usr.
1443194206Ssimonif ($target =~ /^BSD\-/)
1444194206Ssimon	{
1445194206Ssimon	$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1446194206Ssimon	}
1447194206Ssimon
1448109998Smarkmif ($sys_id ne "")
144972613Skris	{
1450160814Ssimon	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
1451109998Smarkm	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
145272613Skris	}
145368651Skris
145476866Skrisif ($ranlib eq "")
145576866Skris	{
145676866Skris	$ranlib = $default_ranlib;
145776866Skris	}
145876866Skris
145955714Skris#my ($bn1)=split(/\s+/,$bn_obj);
146055714Skris#$bn1 = "" unless defined $bn1;
146155714Skris#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
146255714Skris#$bn_obj="$bn1";
146355714Skris
1464160814Ssimon$cpuid_obj="" if ($processor eq "386");
1465160814Ssimon
146655714Skris$bn_obj = $bn_asm unless $bn_obj ne "";
1467238405Sjkim# bn-586 is the only one implementing bn_*_part_words
1468238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
1469238405Sjkim$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
147055714Skris
1471238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
1472238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
1473238405Sjkim$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
1474194206Ssimon
1475194206Ssimonif ($fips)
1476194206Ssimon	{
1477194206Ssimon	$openssl_other_defines.="#define OPENSSL_FIPS\n";
1478238405Sjkim	$cflags .= " -I\$(FIPSDIR)/include";
1479194206Ssimon	}
1480194206Ssimon
1481238405Sjkim$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
1482160814Ssimon$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
148355714Skris$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
148455714Skris$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
148555714Skris$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
148655714Skris$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
1487160814Ssimonif ($sha1_obj =~ /\.o$/)
148855714Skris	{
148955714Skris#	$sha1_obj=$sha1_enc;
1490160814Ssimon	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
1491160814Ssimon	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
1492160814Ssimon	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1493194206Ssimon	if ($sha1_obj =~ /sse2/)
1494160814Ssimon	    {	if ($no_sse2)
1495160814Ssimon		{   $sha1_obj =~ s/\S*sse2\S+//;        }
1496160814Ssimon		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
1497160814Ssimon		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
1498160814Ssimon	    }
149955714Skris	}
150055714Skrisif ($md5_obj =~ /\.o$/)
150155714Skris	{
150255714Skris#	$md5_obj=$md5_enc;
150355714Skris	$cflags.=" -DMD5_ASM";
150455714Skris	}
150555714Skrisif ($rmd160_obj =~ /\.o$/)
150655714Skris	{
150755714Skris#	$rmd160_obj=$rmd160_enc;
150855714Skris	$cflags.=" -DRMD160_ASM";
150955714Skris	}
1510160814Ssimonif ($aes_obj =~ /\.o$/)
1511142425Snectar	{
1512160814Ssimon	$cflags.=" -DAES_ASM";
1513238405Sjkim	# aes-ctr.o is not a real file, only indication that assembler
1514238405Sjkim	# module implements AES_ctr32_encrypt...
1515238405Sjkim	$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
1516238405Sjkim	# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
1517238405Sjkim	$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
1518238405Sjkim	$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
1519238405Sjkim	$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
1520238405Sjkim	$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
1521142425Snectar	}
1522160814Ssimonelse	{
1523160814Ssimon	$aes_obj=$aes_enc;
1524160814Ssimon	}
1525238405Sjkim$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
1526238405Sjkimif ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
1527238405Sjkim	{
1528238405Sjkim	$cflags.=" -DWHIRLPOOL_ASM";
1529238405Sjkim	}
1530238405Sjkimelse	{
1531238405Sjkim	$wp_obj="wp_block.o";
1532238405Sjkim	}
1533238405Sjkim$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
1534238405Sjkimif ($modes_obj =~ /ghash/)
1535238405Sjkim	{
1536238405Sjkim	$cflags.=" -DGHASH_ASM";
1537238405Sjkim	}
1538142425Snectar
1539100936Snectar# "Stringify" the C flags string.  This permits it to be made part of a string
1540100936Snectar# and works as well on command lines.
1541100936Snectar$cflags =~ s/([\\\"])/\\\1/g;
1542100936Snectar
154355714Skrismy $version = "unknown";
1544160814Ssimonmy $version_num = "unknown";
154555714Skrismy $major = "unknown";
154655714Skrismy $minor = "unknown";
154768651Skrismy $shlib_version_number = "unknown";
154868651Skrismy $shlib_version_history = "unknown";
154968651Skrismy $shlib_major = "unknown";
155068651Skrismy $shlib_minor = "unknown";
155155714Skris
155255714Skrisopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
155355714Skriswhile (<IN>)
155455714Skris	{
155555714Skris	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
1556160814Ssimon	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
155768651Skris	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
155868651Skris	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
155955714Skris	}
156055714Skrisclose(IN);
156168651Skrisif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
156255714Skris
156355714Skrisif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
156455714Skris	{
156555714Skris	$major=$1;
156655714Skris	$minor=$2;
156755714Skris	}
156855714Skris
156968651Skrisif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
157068651Skris	{
157168651Skris	$shlib_major=$1;
157268651Skris	$shlib_minor=$2;
157368651Skris	}
157468651Skris
1575205128Ssimonif ($strict_warnings)
1576205128Ssimon	{
1577205128Ssimon	my $wopt;
1578205128Ssimon	die "ERROR --strict-warnings requires gcc" unless ($cc =~ /gcc$/);
1579205128Ssimon	foreach $wopt (split /\s+/, $gcc_devteam_warn)
1580205128Ssimon		{
1581205128Ssimon		$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
1582205128Ssimon		}
1583205128Ssimon	}
1584205128Ssimon
158555714Skrisopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
1586109998Smarkmunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
1587109998Smarkmopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
158859191Skrisprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
158955714Skrismy $sdirs=0;
159055714Skriswhile (<IN>)
159155714Skris	{
1592160814Ssimon	chomp;
159355714Skris	$sdirs = 1 if /^SDIRS=/;
159455714Skris	if ($sdirs) {
159555714Skris		my $dir;
159655714Skris		foreach $dir (@skip) {
1597238405Sjkim			s/(\s)$dir /$1/;
1598194206Ssimon			s/\s$dir$//;
159955714Skris			}
160055714Skris		}
160155714Skris	$sdirs = 0 unless /\\$/;
1602194206Ssimon        s/engines // if (/^DIRS=/ && $disabled{"engine"});
1603238405Sjkim	s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"});
160455714Skris	s/^VERSION=.*/VERSION=$version/;
160555714Skris	s/^MAJOR=.*/MAJOR=$major/;
160655714Skris	s/^MINOR=.*/MINOR=$minor/;
160768651Skris	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
160868651Skris	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
160968651Skris	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
161068651Skris	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
161176866Skris	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
161255714Skris	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
1613238405Sjkim	s/^MULTILIB=.*$/MULTILIB=$multilib/;
161455714Skris	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
1615205128Ssimon	s/^LIBDIR=.*$/LIBDIR=$libdir/;
161655714Skris	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
161755714Skris	s/^PLATFORM=.*$/PLATFORM=$target/;
161855714Skris	s/^OPTIONS=.*$/OPTIONS=$options/;
161968651Skris	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
1620205128Ssimon	if ($cross_compile_prefix)
1621205128Ssimon		{
1622205128Ssimon		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
1623205128Ssimon		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
1624238405Sjkim		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
1625205128Ssimon		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
1626238405Sjkim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc";
1627205128Ssimon		}
1628205128Ssimon	else	{
1629205128Ssimon		s/^CC=.*$/CC= $cc/;
1630205128Ssimon		s/^AR=\s*ar/AR= $ar/;
1631205128Ssimon		s/^RANLIB=.*/RANLIB= $ranlib/;
1632238405Sjkim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
1633205128Ssimon		}
163455714Skris	s/^CFLAG=.*$/CFLAG= $cflags/;
1635194206Ssimon	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1636194206Ssimon	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
163755714Skris	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
163876866Skris	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
1639160814Ssimon	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
164055714Skris	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
164155714Skris	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
1642238405Sjkim	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
164355714Skris	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
164455714Skris	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
164555714Skris	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
164655714Skris	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
164755714Skris	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
164855714Skris	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
164955714Skris	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
1650238405Sjkim	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
1651238405Sjkim	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
1652238405Sjkim	s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
1653238405Sjkim	s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
1654238405Sjkim	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
165555714Skris	s/^PROCESSOR=.*/PROCESSOR= $processor/;
1656109998Smarkm	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
165755714Skris	s/^PERL=.*/PERL= $perl/;
1658109998Smarkm	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1659111147Snectar	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
1660160814Ssimon	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
1661160814Ssimon	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
1662238405Sjkim
1663238405Sjkim	s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
1664194206Ssimon	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1665238405Sjkim	s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1666194206Ssimon	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
1667238405Sjkim
166868651Skris	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
166976866Skris	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
1670238405Sjkim	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
167189837Skris	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
167289837Skris		{
167389837Skris		my $sotmp = $1;
1674100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
167589837Skris		}
1676100936Snectar	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
1677100936Snectar		{
1678100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1679100936Snectar		}
168089837Skris	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
168189837Skris		{
168289837Skris		my $sotmp = $1;
168389837Skris		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
168489837Skris		}
1685100936Snectar	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
1686100936Snectar		{
1687100936Snectar		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
1688100936Snectar		}
1689100928Snectar	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
169055714Skris	print OUT $_."\n";
169155714Skris	}
169255714Skrisclose(IN);
169355714Skrisclose(OUT);
1694109998Smarkmrename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
1695109998Smarkmrename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
169655714Skris
169755714Skrisprint "CC            =$cc\n";
169855714Skrisprint "CFLAG         =$cflags\n";
169955714Skrisprint "EX_LIBS       =$lflags\n";
1700160814Ssimonprint "CPUID_OBJ     =$cpuid_obj\n";
170155714Skrisprint "BN_ASM        =$bn_obj\n";
170255714Skrisprint "DES_ENC       =$des_obj\n";
1703238405Sjkimprint "AES_ENC       =$aes_obj\n";
170455714Skrisprint "BF_ENC        =$bf_obj\n";
170555714Skrisprint "CAST_ENC      =$cast_obj\n";
170655714Skrisprint "RC4_ENC       =$rc4_obj\n";
170755714Skrisprint "RC5_ENC       =$rc5_obj\n";
170855714Skrisprint "MD5_OBJ_ASM   =$md5_obj\n";
170955714Skrisprint "SHA1_OBJ_ASM  =$sha1_obj\n";
171055714Skrisprint "RMD160_OBJ_ASM=$rmd160_obj\n";
1711238405Sjkimprint "CMLL_ENC      =$cmll_obj\n";
1712238405Sjkimprint "MODES_OBJ     =$modes_obj\n";
1713238405Sjkimprint "ENGINES_OBJ   =$engines_obj\n";
171455714Skrisprint "PROCESSOR     =$processor\n";
171555714Skrisprint "RANLIB        =$ranlib\n";
1716109998Smarkmprint "ARFLAGS       =$arflags\n";
171755714Skrisprint "PERL          =$perl\n";
1718109998Smarkmprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
1719109998Smarkm	if $withargs{"krb5-include"} ne "";
172055714Skris
172155714Skrismy $des_ptr=0;
172255714Skrismy $des_risc1=0;
172355714Skrismy $des_risc2=0;
172455714Skrismy $des_unroll=0;
172555714Skrismy $bn_ll=0;
172655714Skrismy $def_int=2;
172755714Skrismy $rc4_int=$def_int;
172855714Skrismy $md2_int=$def_int;
172955714Skrismy $idea_int=$def_int;
173055714Skrismy $rc2_int=$def_int;
173155714Skrismy $rc4_idx=0;
173259191Skrismy $rc4_chunk=0;
173355714Skrismy $bf_ptr=0;
173455714Skrismy @type=("char","short","int","long");
173555714Skrismy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
1736109998Smarkmmy $export_var_as_fn=0;
173755714Skris
173855714Skrismy $des_int;
173955714Skris
174055714Skrisforeach (sort split(/\s+/,$bn_ops))
174155714Skris	{
174255714Skris	$des_ptr=1 if /DES_PTR/;
174355714Skris	$des_risc1=1 if /DES_RISC1/;
174455714Skris	$des_risc2=1 if /DES_RISC2/;
174555714Skris	$des_unroll=1 if /DES_UNROLL/;
174655714Skris	$des_int=1 if /DES_INT/;
174755714Skris	$bn_ll=1 if /BN_LLONG/;
174855714Skris	$rc4_int=0 if /RC4_CHAR/;
174955714Skris	$rc4_int=3 if /RC4_LONG/;
175055714Skris	$rc4_idx=1 if /RC4_INDEX/;
175159191Skris	$rc4_chunk=1 if /RC4_CHUNK/;
175259191Skris	$rc4_chunk=2 if /RC4_CHUNK_LL/;
175355714Skris	$md2_int=0 if /MD2_CHAR/;
175455714Skris	$md2_int=3 if /MD2_LONG/;
175555714Skris	$idea_int=1 if /IDEA_SHORT/;
175655714Skris	$idea_int=3 if /IDEA_LONG/;
175755714Skris	$rc2_int=1 if /RC2_SHORT/;
175855714Skris	$rc2_int=3 if /RC2_LONG/;
175955714Skris	$bf_ptr=1 if $_ eq "BF_PTR";
176055714Skris	$bf_ptr=2 if $_ eq "BF_PTR2";
176155714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
176255714Skris	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
176355714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
176455714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
176555714Skris	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
1766109998Smarkm	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
176755714Skris	}
176855714Skris
176955714Skrisopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
1770109998Smarkmunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
1771109998Smarkmopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
177259191Skrisprint OUT "/* opensslconf.h */\n";
177359191Skrisprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
177459191Skris
1775273144Sjkimprint OUT "#ifdef  __cplusplus\n";
1776273144Sjkimprint OUT "extern \"C\" {\n";
1777273144Sjkimprint OUT "#endif\n";
177859191Skrisprint OUT "/* OpenSSL was configured with the following options: */\n";
1779109998Smarkmmy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1780194206Ssimon$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;
1781109998Smarkm$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1782109998Smarkm$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
178359191Skris$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1784109998Smarkm$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1785109998Smarkm$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1786109998Smarkm$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1787109998Smarkmprint OUT $openssl_sys_defines;
1788109998Smarkmprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1789194206Ssimonprint OUT $openssl_experimental_defines;
1790194206Ssimonprint OUT "\n";
1791109998Smarkmprint OUT $openssl_algorithm_defines;
1792194206Ssimonprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
1793109998Smarkmprint OUT $openssl_thread_defines;
1794109998Smarkmprint OUT $openssl_other_defines,"\n";
179559191Skris
1796109998Smarkmprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
1797109998Smarkmprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
1798109998Smarkmprint OUT "   who haven't had the time to do the appropriate changes in their\n";
1799109998Smarkmprint OUT "   applications.  */\n";
1800109998Smarkmprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
1801109998Smarkmprint OUT $openssl_algorithm_defines_trans;
1802109998Smarkmprint OUT "#endif\n\n";
1803109998Smarkm
1804238405Sjkimprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
1805160814Ssimon
180655714Skriswhile (<IN>)
180755714Skris	{
180855714Skris	if	(/^#define\s+OPENSSLDIR/)
1809205128Ssimon		{
1810205128Ssimon		my $foo = $openssldir;
1811205128Ssimon		$foo =~ s/\\/\\\\/g;
1812205128Ssimon		print OUT "#define OPENSSLDIR \"$foo\"\n";
1813205128Ssimon		}
1814160814Ssimon	elsif	(/^#define\s+ENGINESDIR/)
1815205128Ssimon		{
1816238405Sjkim		my $foo = "$prefix/$libdir/engines";
1817205128Ssimon		$foo =~ s/\\/\\\\/g;
1818205128Ssimon		print OUT "#define ENGINESDIR \"$foo\"\n";
1819205128Ssimon		}
1820109998Smarkm	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
1821109998Smarkm		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
1822109998Smarkm			if $export_var_as_fn;
1823109998Smarkm		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
1824109998Smarkm			($export_var_as_fn)?"define":"undef"; }
182555714Skris	elsif	(/^#define\s+OPENSSL_UNISTD/)
182655714Skris		{
182755714Skris		$unistd = "<unistd.h>" if $unistd eq "";
182855714Skris		print OUT "#define OPENSSL_UNISTD $unistd\n";
182955714Skris		}
183055714Skris	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
183155714Skris		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
183255714Skris	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
183355714Skris		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
183455714Skris	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
183555714Skris		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
183655714Skris	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
183755714Skris		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
183855714Skris	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
183955714Skris		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
184055714Skris	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
184155714Skris		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
184255714Skris	elsif	(/^\#define\s+DES_LONG\s+.*/)
184355714Skris		{ printf OUT "#define DES_LONG unsigned %s\n",
184455714Skris			($des_int)?'int':'long'; }
184555714Skris	elsif	(/^\#(define|undef)\s+DES_PTR/)
184655714Skris		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
184755714Skris	elsif	(/^\#(define|undef)\s+DES_RISC1/)
184855714Skris		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
184955714Skris	elsif	(/^\#(define|undef)\s+DES_RISC2/)
185055714Skris		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
185155714Skris	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
185255714Skris		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
185355714Skris	elsif	(/^#define\s+RC4_INT\s/)
185455714Skris		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
185559191Skris	elsif	(/^#undef\s+RC4_CHUNK/)
185659191Skris		{
185759191Skris		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
185859191Skris		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
185959191Skris		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
186059191Skris		}
186155714Skris	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
186255714Skris		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
186355714Skris	elsif (/^#(define|undef)\s+I386_ONLY/)
1864160814Ssimon		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
186555714Skris			"define":"undef"; }
186655714Skris	elsif	(/^#define\s+MD2_INT\s/)
186755714Skris		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
186855714Skris	elsif	(/^#define\s+IDEA_INT\s/)
186955714Skris		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
187055714Skris	elsif	(/^#define\s+RC2_INT\s/)
187155714Skris		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
187255714Skris	elsif (/^#(define|undef)\s+BF_PTR/)
187355714Skris		{
187455714Skris		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
187555714Skris		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
187655714Skris		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
187755714Skris	        }
187855714Skris	else
187955714Skris		{ print OUT $_; }
188055714Skris	}
188155714Skrisclose(IN);
1882273144Sjkimprint OUT "#ifdef  __cplusplus\n";
1883273144Sjkimprint OUT "}\n";
1884273144Sjkimprint OUT "#endif\n";
188555714Skrisclose(OUT);
1886109998Smarkmrename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
1887109998Smarkmrename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
188855714Skris
188955714Skris
189055714Skris# Fix the date
189155714Skris
189255714Skrisprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
189355714Skrisprint "SIXTY_FOUR_BIT mode\n" if $b64;
189455714Skrisprint "THIRTY_TWO_BIT mode\n" if $b32;
189555714Skrisprint "SIXTEEN_BIT mode\n" if $b16;
189655714Skrisprint "EIGHT_BIT mode\n" if $b8;
189755714Skrisprint "DES_PTR used\n" if $des_ptr;
189855714Skrisprint "DES_RISC1 used\n" if $des_risc1;
189955714Skrisprint "DES_RISC2 used\n" if $des_risc2;
190055714Skrisprint "DES_UNROLL used\n" if $des_unroll;
190155714Skrisprint "DES_INT used\n" if $des_int;
190255714Skrisprint "BN_LLONG mode\n" if $bn_ll;
190355714Skrisprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
190455714Skrisprint "RC4_INDEX mode\n" if $rc4_idx;
190559191Skrisprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
190659191Skrisprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
190759191Skrisprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
190855714Skrisprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
190955714Skrisprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
191055714Skrisprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
191155714Skrisprint "BF_PTR used\n" if $bf_ptr == 1; 
191255714Skrisprint "BF_PTR2 used\n" if $bf_ptr == 2; 
191355714Skris
1914160814Ssimonif($IsMK1MF) {
191555714Skris	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
191655714Skris	printf OUT <<EOF;
191755714Skris#ifndef MK1MF_BUILD
191855714Skris  /* auto-generated by Configure for crypto/cversion.c:
1919160814Ssimon   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
192055714Skris   * Windows builds (and other mk1mf builds) compile cversion.c with
192155714Skris   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
192255714Skris  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
192355714Skris#endif
192455714SkrisEOF
192555714Skris	close(OUT);
192655714Skris} else {
1927205128Ssimon	my $make_command = "$make PERL=\'$perl\'";
1928109998Smarkm	my $make_targets = "";
1929109998Smarkm	$make_targets .= " links" if $symlink;
1930160814Ssimon	$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
1931109998Smarkm	$make_targets .= " gentests" if $symlink;
1932109998Smarkm	(system $make_command.$make_targets) == 0 or exit $?
1933109998Smarkm		if $make_targets ne "";
193455714Skris	if ( $perl =~ m@^/@) {
1935215697Ssimon	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
193659191Skris	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
193755714Skris	} else {
193855714Skris	    # No path for Perl known ...
1939215697Ssimon	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
194059191Skris	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
1941109998Smarkm	}
1942160814Ssimon	if ($depflags ne $default_depflags && !$make_depend) {
1943109998Smarkm		print <<EOF;
1944109998Smarkm
1945160814SsimonSince you've disabled or enabled at least one algorithm, you need to do
1946160814Ssimonthe following before building:
1947109998Smarkm
1948109998Smarkm	make depend
1949109998SmarkmEOF
1950109998Smarkm	}
195155714Skris}
195255714Skris
1953160814Ssimon# create the ms/version32.rc file if needed
1954194206Ssimonif ($IsMK1MF && ($target !~ /^netware/)) {
1955160814Ssimon	my ($v1, $v2, $v3, $v4);
1956160814Ssimon	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
1957160814Ssimon		$v1=hex $1;
1958160814Ssimon		$v2=hex $2;
1959160814Ssimon		$v3=hex $3;
1960160814Ssimon		$v4=hex $4;
1961160814Ssimon	}
1962160814Ssimon	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
1963160814Ssimon	print OUT <<EOF;
1964160814Ssimon#include <winver.h>
1965160814Ssimon
1966160814SsimonLANGUAGE 0x09,0x01
1967160814Ssimon
1968160814Ssimon1 VERSIONINFO
1969160814Ssimon  FILEVERSION $v1,$v2,$v3,$v4
1970160814Ssimon  PRODUCTVERSION $v1,$v2,$v3,$v4
1971160814Ssimon  FILEFLAGSMASK 0x3fL
1972160814Ssimon#ifdef _DEBUG
1973160814Ssimon  FILEFLAGS 0x01L
1974160814Ssimon#else
1975160814Ssimon  FILEFLAGS 0x00L
1976160814Ssimon#endif
1977160814Ssimon  FILEOS VOS__WINDOWS32
1978160814Ssimon  FILETYPE VFT_DLL
1979160814Ssimon  FILESUBTYPE 0x0L
1980160814SsimonBEGIN
1981160814Ssimon    BLOCK "StringFileInfo"
1982160814Ssimon    BEGIN
1983160814Ssimon	BLOCK "040904b0"
1984160814Ssimon	BEGIN
1985160814Ssimon	    // Required:	    
1986160814Ssimon	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
1987160814Ssimon	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
1988160814Ssimon	    VALUE "FileVersion", "$version\\0"
1989160814Ssimon#if defined(CRYPTO)
1990160814Ssimon	    VALUE "InternalName", "libeay32\\0"
1991160814Ssimon	    VALUE "OriginalFilename", "libeay32.dll\\0"
1992160814Ssimon#elif defined(SSL)
1993160814Ssimon	    VALUE "InternalName", "ssleay32\\0"
1994160814Ssimon	    VALUE "OriginalFilename", "ssleay32.dll\\0"
1995160814Ssimon#endif
1996160814Ssimon	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
1997160814Ssimon	    VALUE "ProductVersion", "$version\\0"
1998160814Ssimon	    // Optional:
1999160814Ssimon	    //VALUE "Comments", "\\0"
2000238405Sjkim	    VALUE "LegalCopyright", "Copyright � 1998-2005 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
2001160814Ssimon	    //VALUE "LegalTrademarks", "\\0"
2002160814Ssimon	    //VALUE "PrivateBuild", "\\0"
2003160814Ssimon	    //VALUE "SpecialBuild", "\\0"
2004160814Ssimon	END
2005160814Ssimon    END
2006160814Ssimon    BLOCK "VarFileInfo"
2007160814Ssimon    BEGIN
2008160814Ssimon        VALUE "Translation", 0x409, 0x4b0
2009160814Ssimon    END
2010160814SsimonEND
2011160814SsimonEOF
2012160814Ssimon	close(OUT);
2013160814Ssimon  }
2014160814Ssimon  
201555714Skrisprint <<EOF;
201655714Skris
201759191SkrisConfigured for $target.
201855714SkrisEOF
201955714Skris
202055714Skrisprint <<\EOF if (!$no_threads && !$threads);
202155714Skris
202255714SkrisThe library could not be configured for supporting multi-threaded
202355714Skrisapplications as the compiler options required on this system are not known.
202455714SkrisSee file INSTALL for details if you need multi-threading.
202555714SkrisEOF
202655714Skris
2027111147Snectarprint <<\EOF if ($no_shared_warn);
2028111147Snectar
2029111147SnectarYou gave the option 'shared'.  Normally, that would give you shared libraries.
2030111147SnectarUnfortunately, the OpenSSL configuration doesn't include shared library support
2031111147Snectarfor this platform yet, so it will pretend you gave the option 'no-shared'.  If
2032111147Snectaryou can inform the developpers (openssl-dev\@openssl.org) how to support shared
2033111147Snectarlibraries on this platform, they will at least look at it and try their best
2034111147Snectar(but please first make sure you have tried with a current version of OpenSSL).
2035111147SnectarEOF
2036111147Snectar
203755714Skrisexit(0);
203855714Skris
203955714Skrissub usage
204055714Skris	{
204155714Skris	print STDERR $usage;
204259191Skris	print STDERR "\npick os/compiler from:\n";
204355714Skris	my $j=0;
204455714Skris	my $i;
204559191Skris        my $k=0;
204655714Skris	foreach $i (sort keys %table)
204755714Skris		{
204855714Skris		next if $i =~ /^debug/;
204959191Skris		$k += length($i) + 1;
205059191Skris		if ($k > 78)
205159191Skris			{
205259191Skris			print STDERR "\n";
205359191Skris			$k=length($i);
205459191Skris			}
205559191Skris		print STDERR $i . " ";
205655714Skris		}
205755714Skris	foreach $i (sort keys %table)
205855714Skris		{
205955714Skris		next if $i !~ /^debug/;
206059191Skris		$k += length($i) + 1;
206159191Skris		if ($k > 78)
206259191Skris			{
206359191Skris			print STDERR "\n";
206459191Skris			$k=length($i);
206559191Skris			}
206659191Skris		print STDERR $i . " ";
206755714Skris		}
206859191Skris	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
206955714Skris	exit(1);
207055714Skris	}
207155714Skris
207255714Skrissub which
207355714Skris	{
207455714Skris	my($name)=@_;
207555714Skris	my $path;
207655714Skris	foreach $path (split /:/, $ENV{PATH})
207755714Skris		{
2078142425Snectar		if (-f "$path/$name$exe_ext" and -x _)
207955714Skris			{
2080142425Snectar			return "$path/$name$exe_ext" unless ($name eq "perl" and
2081142425Snectar			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
208255714Skris			}
208355714Skris		}
208455714Skris	}
208555714Skris
208655714Skrissub dofile
208755714Skris	{
208855714Skris	my $f; my $p; my %m; my @a; my $k; my $ff;
208955714Skris	($f,$p,%m)=@_;
209055714Skris
209155714Skris	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
209255714Skris	@a=<IN>;
209355714Skris	close(IN);
209455714Skris	foreach $k (keys %m)
209555714Skris		{
209655714Skris		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
209755714Skris		}
209859191Skris	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
209955714Skris	print OUT @a;
210055714Skris	close(OUT);
210159191Skris	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
210259191Skris	rename("$f.new",$f) || die "unable to rename $f.new\n";
210355714Skris	}
210455714Skris
210555714Skrissub print_table_entry
210655714Skris	{
210755714Skris	my $target = shift;
210855714Skris
2109109998Smarkm	(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
2110160814Ssimon	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
211168651Skris	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
2112238405Sjkim	my $rc5_obj,my $wp_obj,my $cmll_obj,my $modes_obj, my $engines_obj,
2113238405Sjkim	my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag,
2114238405Sjkim	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multilib)=
211576866Skris	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
211655714Skris			
211755714Skris	print <<EOF
211855714Skris
211955714Skris*** $target
212055714Skris\$cc           = $cc
212155714Skris\$cflags       = $cflags
212255714Skris\$unistd       = $unistd
212355714Skris\$thread_cflag = $thread_cflag
2124109998Smarkm\$sys_id       = $sys_id
212555714Skris\$lflags       = $lflags
212655714Skris\$bn_ops       = $bn_ops
2127160814Ssimon\$cpuid_obj    = $cpuid_obj
212855714Skris\$bn_obj       = $bn_obj
212955714Skris\$des_obj      = $des_obj
2130160814Ssimon\$aes_obj      = $aes_obj
213155714Skris\$bf_obj       = $bf_obj
213255714Skris\$md5_obj      = $md5_obj
213355714Skris\$sha1_obj     = $sha1_obj
213455714Skris\$cast_obj     = $cast_obj
213555714Skris\$rc4_obj      = $rc4_obj
213655714Skris\$rmd160_obj   = $rmd160_obj
213755714Skris\$rc5_obj      = $rc5_obj
2138238405Sjkim\$wp_obj       = $wp_obj
2139238405Sjkim\$cmll_obj     = $cmll_obj
2140238405Sjkim\$modes_obj    = $modes_obj
2141238405Sjkim\$engines_obj  = $engines_obj
2142238405Sjkim\$perlasm_scheme = $perlasm_scheme
214368651Skris\$dso_scheme   = $dso_scheme
214468651Skris\$shared_target= $shared_target
214568651Skris\$shared_cflag = $shared_cflag
2146100928Snectar\$shared_ldflag = $shared_ldflag
214776866Skris\$shared_extension = $shared_extension
214876866Skris\$ranlib       = $ranlib
2149109998Smarkm\$arflags      = $arflags
2150238405Sjkim\$multilib     = $multilib
215155714SkrisEOF
215255714Skris	}
2153100928Snectar
2154100928Snectarsub test_sanity
2155100928Snectar	{
2156100928Snectar	my $errorcnt = 0;
2157100928Snectar
2158100928Snectar	print STDERR "=" x 70, "\n";
2159100928Snectar	print STDERR "=== SANITY TESTING!\n";
2160100928Snectar	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2161100928Snectar	print STDERR "=" x 70, "\n";
2162100928Snectar
2163100928Snectar	foreach $target (sort keys %table)
2164100928Snectar		{
2165100928Snectar		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2166100928Snectar
2167238405Sjkim		if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2168100928Snectar			{
2169100928Snectar			$errorcnt++;
2170100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2171100928Snectar			print STDERR "              in the previous field\n";
2172100928Snectar			}
2173238405Sjkim		elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2174100928Snectar			{
2175100928Snectar			$errorcnt++;
2176100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2177100928Snectar			print STDERR "              in the following field\n";
2178100928Snectar			}
2179238405Sjkim		elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
2180100928Snectar			{
2181100928Snectar			$errorcnt++;
2182100928Snectar			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
2183238405Sjkim			print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
2184100928Snectar			}
2185100928Snectar		}
2186100928Snectar	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2187100928Snectar	return $errorcnt;
2188100928Snectar	}
2189