xref: /freebsd/crypto/openssl/Configure (revision dee36b4f92f269b95977ae9c4a37046fb7cc351c)
174664626SKris Kennaway:
274664626SKris Kennawayeval 'exec perl -S $0 ${1+"$@"}'
374664626SKris Kennaway    if $running_under_some_shell;
474664626SKris Kennaway##
574664626SKris Kennaway##  Configure -- OpenSSL source tree configuration script
674664626SKris Kennaway##
774664626SKris Kennaway
874664626SKris Kennawayrequire 5.000;
91f13597dSJung-uk Kimuse strict;
106cf8931aSJung-uk Kimuse File::Compare;
1174664626SKris Kennaway
1274664626SKris Kennaway# see INSTALL for instructions.
1374664626SKris Kennaway
141f13597dSJung-uk Kimmy $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";
1574664626SKris Kennaway
1674664626SKris Kennaway# Options:
1774664626SKris Kennaway#
1874664626SKris Kennaway# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
1974664626SKris Kennaway#               --prefix option is given; /usr/local/ssl otherwise)
2074664626SKris Kennaway# --prefix      prefix for the OpenSSL include, lib and bin directories
2174664626SKris Kennaway#               (Default: the OPENSSLDIR directory)
2274664626SKris Kennaway#
2374664626SKris Kennaway# --install_prefix  Additional prefix for package builders (empty by
2474664626SKris Kennaway#               default).  This needn't be set in advance, you can
2574664626SKris Kennaway#               just as well use "make INSTALL_PREFIX=/whatever install".
2674664626SKris Kennaway#
275c87c606SMark Murray# --with-krb5-dir  Declare where Kerberos 5 lives.  The libraries are expected
285c87c606SMark Murray#		to live in the subdirectory lib/ and the header files in
295c87c606SMark Murray#		include/.  A value is required.
305c87c606SMark Murray# --with-krb5-lib  Declare where the Kerberos 5 libraries live.  A value is
315c87c606SMark Murray#		required.
325c87c606SMark Murray#		(Default: KRB5_DIR/lib)
335c87c606SMark Murray# --with-krb5-include  Declare where the Kerberos 5 header files live.  A
345c87c606SMark Murray#		value is required.
355c87c606SMark Murray#		(Default: KRB5_DIR/include)
365c87c606SMark Murray# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
375c87c606SMark Murray#		supported values are "MIT" and "Heimdal".  A value is required.
385c87c606SMark Murray#
39c1803d78SJacques Vidrine# --test-sanity Make a number of sanity checks on the data in this file.
40c1803d78SJacques Vidrine#               This is a debugging tool for OpenSSL developers.
41c1803d78SJacques Vidrine#
421f13597dSJung-uk Kim# --cross-compile-prefix Add specified prefix to binutils components.
431f13597dSJung-uk Kim#
445c87c606SMark Murray# no-hw-xxx     do not compile support for specific crypto hardware.
455c87c606SMark Murray#               Generic OpenSSL-style methods relating to this support
465c87c606SMark Murray#               are always compiled but return NULL if the hardware
475c87c606SMark Murray#               support isn't compiled.
485c87c606SMark Murray# no-hw         do not compile support for any crypto hardware.
4974664626SKris Kennaway# [no-]threads  [don't] try to create a library that is suitable for
5074664626SKris Kennaway#               multithreaded applications (default is "threads" if we
5174664626SKris Kennaway#               know how to do it)
52ddd58736SKris Kennaway# [no-]shared	[don't] try to create shared libraries when supported.
5374664626SKris Kennaway# no-asm        do not use assembler
54ddd58736SKris Kennaway# no-dso        do not compile in any native shared-library methods. This
55ddd58736SKris Kennaway#               will ensure that all methods just return NULL.
565c87c606SMark Murray# no-krb5       do not compile in any KRB5 library or code.
575c87c606SMark Murray# [no-]zlib     [don't] compile support for zlib compression.
585c87c606SMark Murray# zlib-dynamic	Like "zlib", but the zlib library is expected to be a shared
595c87c606SMark Murray#		library and will be loaded in run-time by the OpenSSL library.
601f13597dSJung-uk Kim# sctp          include SCTP support
614c6a0400SJung-uk Kim# enable-weak-ssl-ciphers
624c6a0400SJung-uk Kim#		Enable EXPORT and LOW SSLv3 ciphers that are disabled by
634c6a0400SJung-uk Kim#		default.  Note, weak SSLv2 ciphers are unconditionally
644c6a0400SJung-uk Kim#		disabled.
656cf8931aSJung-uk Kim# 386		generate 80386 code in assembly modules
666cf8931aSJung-uk Kim# no-sse2	disables IA-32 SSE2 code in assembly modules, the above
676cf8931aSJung-uk Kim#		mentioned '386' option implies this one
6874664626SKris Kennaway# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
6974664626SKris Kennaway# -<xxx> +<xxx> compiler options are passed through
7074664626SKris Kennaway#
71ddd58736SKris Kennaway# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
72ddd58736SKris Kennaway#		provided to stack calls. Generates unique stack functions for
73ddd58736SKris Kennaway#		each possible stack type.
7474664626SKris Kennaway# DES_PTR	use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
7574664626SKris Kennaway# DES_RISC1	use different DES_ENCRYPT macro that helps reduce register
7674664626SKris Kennaway#		dependancies but needs to more registers, good for RISC CPU's
7774664626SKris Kennaway# DES_RISC2	A different RISC variant.
7874664626SKris Kennaway# DES_UNROLL	unroll the inner DES loop, sometimes helps, somtimes hinders.
7974664626SKris Kennaway# DES_INT	use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
8074664626SKris Kennaway#		This is used on the DEC Alpha where long is 8 bytes
8174664626SKris Kennaway#		and int is 4
8274664626SKris Kennaway# BN_LLONG	use the type 'long long' in crypto/bn/bn.h
8374664626SKris Kennaway# MD2_CHAR	use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
8474664626SKris Kennaway# MD2_LONG	use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
8574664626SKris Kennaway# IDEA_SHORT	use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8674664626SKris Kennaway# IDEA_LONG	use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8774664626SKris Kennaway# RC2_SHORT	use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8874664626SKris Kennaway# RC2_LONG	use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8974664626SKris Kennaway# RC4_CHAR	use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
9074664626SKris Kennaway# RC4_LONG	use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
9174664626SKris Kennaway# RC4_INDEX	define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
9274664626SKris Kennaway#		array lookups instead of pointer use.
93f579bf8eSKris Kennaway# RC4_CHUNK	enables code that handles data aligned at long (natural CPU
94f579bf8eSKris Kennaway#		word) boundary.
95f579bf8eSKris Kennaway# RC4_CHUNK_LL	enables code that handles data aligned at long long boundary
96f579bf8eSKris Kennaway#		(intended for 64-bit CPUs running 32-bit OS).
9774664626SKris Kennaway# BF_PTR	use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
9874664626SKris Kennaway# BF_PTR2	intel specific version (generic version is more efficient).
993b4e3dcbSSimon L. B. Nielsen#
1003b4e3dcbSSimon L. B. Nielsen# Following are set automatically by this script
1013b4e3dcbSSimon L. B. Nielsen#
10274664626SKris Kennaway# MD5_ASM	use some extra md5 assember,
10374664626SKris Kennaway# SHA1_ASM	use some extra sha1 assember, must define L_ENDIAN for x86
10474664626SKris Kennaway# RMD160_ASM	use some extra ripemd160 assember,
1053b4e3dcbSSimon L. B. Nielsen# SHA256_ASM	sha256_block is implemented in assembler
1063b4e3dcbSSimon L. B. Nielsen# SHA512_ASM	sha512_block is implemented in assembler
1073b4e3dcbSSimon L. B. Nielsen# AES_ASM	ASE_[en|de]crypt is implemented in assembler
10874664626SKris Kennaway
109db522d3aSSimon L. B. Nielsen# Minimum warning options... any contributions to OpenSSL should at least get
110db522d3aSSimon L. B. Nielsen# past these.
111db522d3aSSimon L. B. Nielsen
112ed7112f0SJung-uk Kimmy $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wundef -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
113db522d3aSSimon L. B. Nielsen
1147bded2dbSJung-uk Kim# TODO(openssl-team): fix problems and investigate if (at least) the following
1157bded2dbSJung-uk Kim# warnings can also be enabled:
1167bded2dbSJung-uk Kim# -Wconditional-uninitialized, -Wswitch-enum, -Wunused-macros,
1177bded2dbSJung-uk Kim# -Wmissing-field-initializers, -Wmissing-variable-declarations,
1187bded2dbSJung-uk Kim# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
1197bded2dbSJung-uk Kim# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
1207bded2dbSJung-uk Kim# -Wextended-offsetof
1217bded2dbSJung-uk Kimmy $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token  -Wno-extended-offsetof";
1227bded2dbSJung-uk Kim
1237bded2dbSJung-uk Kim# These are used in addition to $gcc_devteam_warn when the compiler is clang.
1247bded2dbSJung-uk Kim# TODO(openssl-team): fix problems and investigate if (at least) the
1257bded2dbSJung-uk Kim# following warnings can also be enabled: -Wconditional-uninitialized,
1267bded2dbSJung-uk Kim# -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers,
1277bded2dbSJung-uk Kim# -Wmissing-variable-declarations,
1287bded2dbSJung-uk Kim# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
1297bded2dbSJung-uk Kim# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
1307bded2dbSJung-uk Kim# -Wextended-offsetof
1317bded2dbSJung-uk Kimmy $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
1327bded2dbSJung-uk Kim
1338180e704SJung-uk Kim# Warn that "make depend" should be run?
1348180e704SJung-uk Kimmy $warn_make_depend = 0;
1358180e704SJung-uk Kim
1366a599222SSimon L. B. Nielsenmy $strict_warnings = 0;
1376a599222SSimon L. B. Nielsen
13874664626SKris Kennawaymy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
13974664626SKris Kennaway
14074664626SKris Kennaway# MD2_CHAR slags pentium pros
14174664626SKris Kennawaymy $x86_gcc_opts="RC4_INDEX MD2_INT";
14274664626SKris Kennaway
14374664626SKris Kennaway# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
14474664626SKris Kennaway# Don't worry about these normally
14574664626SKris Kennaway
14674664626SKris Kennawaymy $tcc="cc";
14774664626SKris Kennawaymy $tflags="-fast -Xa";
14874664626SKris Kennawaymy $tbn_mul="";
14974664626SKris Kennawaymy $tlib="-lnsl -lsocket";
15074664626SKris Kennaway#$bits1="SIXTEEN_BIT ";
15174664626SKris Kennaway#$bits2="THIRTY_TWO_BIT ";
15274664626SKris Kennawaymy $bits1="THIRTY_TWO_BIT ";
15374664626SKris Kennawaymy $bits2="SIXTY_FOUR_BIT ";
15474664626SKris Kennaway
1557bded2dbSJung-uk Kimmy $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:";
15674664626SKris Kennaway
1571f13597dSJung-uk Kimmy $x86_elf_asm="$x86_asm:elf";
1585740a5e3SKris Kennaway
1597bded2dbSJung-uk Kimmy $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-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 aesni-gcm-x86_64.o:";
1607bded2dbSJung-uk Kimmy $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";
1617bded2dbSJung-uk Kimmy $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o::void";
1627bded2dbSJung-uk Kimmy $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o:::::::::::::void";
1637bded2dbSJung-uk Kimmy $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o::void";
1647bded2dbSJung-uk Kimmy $mips64_asm=":bn-mips.o mips-mont.o:::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::";
1657bded2dbSJung-uk Kimmy $mips32_asm=$mips64_asm; $mips32_asm =~ s/\s*sha512\-mips\.o//;
1667bded2dbSJung-uk Kimmy $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:";
1677bded2dbSJung-uk Kimmy $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o::void";
1687bded2dbSJung-uk Kimmy $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:";
1697bded2dbSJung-uk Kimmy $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";
1707bded2dbSJung-uk Kimmy $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";
1717bded2dbSJung-uk Kimmy $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o:";
1727bded2dbSJung-uk Kimmy $ppc32_asm=$ppc64_asm;
1737bded2dbSJung-uk Kimmy $no_asm="::::::::::::::::void";
17474664626SKris Kennaway
1753b4e3dcbSSimon L. B. Nielsen# As for $BSDthreads. Idea is to maintain "collective" set of flags,
1763b4e3dcbSSimon L. B. Nielsen# which would cover all BSD flavors. -pthread applies to them all,
1773b4e3dcbSSimon L. B. Nielsen# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
1783b4e3dcbSSimon L. B. Nielsen# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
1793b4e3dcbSSimon L. B. Nielsen# which has to be accompanied by explicit -D_THREAD_SAFE and
1803b4e3dcbSSimon L. B. Nielsen# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
1813b4e3dcbSSimon L. B. Nielsen# seems to be sufficient?
1823b4e3dcbSSimon L. B. Nielsenmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
1833b4e3dcbSSimon L. B. Nielsen
1847bded2dbSJung-uk Kim#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $ec_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
185f579bf8eSKris Kennaway
18674664626SKris Kennawaymy %table=(
187ddd58736SKris Kennaway# File 'TABLE' (created by 'make TABLE') contains the data from this list,
188ddd58736SKris Kennaway# formatted for better readability.
189ddd58736SKris Kennaway
190ddd58736SKris Kennaway
191f579bf8eSKris Kennaway#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
192f579bf8eSKris Kennaway#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
193f579bf8eSKris Kennaway#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
194f579bf8eSKris Kennaway#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
19574664626SKris Kennaway
19674664626SKris Kennaway# Our development configs
1975c87c606SMark Murray"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
1985c87c606SMark Murray"debug",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
1991f13597dSJung-uk Kim"debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
2005c87c606SMark Murray"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
2015c87c606SMark Murray"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
2021f13597dSJung-uk Kim"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
20309286989SJung-uk Kim"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)",
2041f13597dSJung-uk Kim"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::::",
2051f13597dSJung-uk Kim"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)::::::",
2067bded2dbSJung-uk Kim"debug-ben-darwin64","cc:$gcc_devteam_warn -g -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",
2077bded2dbSJung-uk Kim"debug-ben-debug-64-clang",	"clang:$gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Qunused-arguments -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)",
2081f13597dSJung-uk Kim"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
2095c87c606SMark Murray"debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
2105c87c606SMark Murray"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
211de78d5d8SJung-uk Kim"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",
21209286989SJung-uk Kim"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)",
2137bded2dbSJung-uk Kim"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -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)",
2141f13597dSJung-uk Kim"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)",
21509286989SJung-uk Kim"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)",
21609286989SJung-uk Kim"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)",
2176f9291ceSJung-uk Kim"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2186f9291ceSJung-uk Kim"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2191f13597dSJung-uk Kim"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)",
2201f13597dSJung-uk Kim"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)",
2216f9291ceSJung-uk Kim"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
2226f9291ceSJung-uk Kim"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
2236f9291ceSJung-uk Kim"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2246f9291ceSJung-uk Kim"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2257bded2dbSJung-uk Kim"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o::des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2266f9291ceSJung-uk Kim"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2277bded2dbSJung-uk Kim"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)",
2286f9291ceSJung-uk Kim"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2295c87c606SMark Murray"dist",		"cc:-O::(unknown)::::::",
23074664626SKris Kennaway
231f579bf8eSKris Kennaway# Basic configs that should work on any (32 and less bit) box
2325c87c606SMark Murray"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
2335c87c606SMark Murray"cc",		"cc:-O::(unknown)::::::",
23474664626SKris Kennaway
2356be8ae07SJacques Vidrine####VOS Configurations
2361f13597dSJung-uk Kim"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:",
2371f13597dSJung-uk Kim"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:",
2386be8ae07SJacques Vidrine
2395c87c606SMark Murray#### Solaris x86 with GNU C setups
2405c87c606SMark Murray# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
241f579bf8eSKris Kennaway# here because whenever GNU C instantiates an assembler template it
242f579bf8eSKris Kennaway# surrounds it with #APP #NO_APP comment pair which (at least Solaris
243f579bf8eSKris Kennaway# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
244f579bf8eSKris Kennaway# error message.
2453b4e3dcbSSimon L. B. Nielsen"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2463b4e3dcbSSimon L. B. Nielsen# -shared -static-libgcc might appear controversial, but modules taken
2473b4e3dcbSSimon L. B. Nielsen# from static libgcc do not have relocations and linking them into our
2483b4e3dcbSSimon L. B. Nielsen# shared objects doesn't have any negative side-effects. On the contrary,
2493b4e3dcbSSimon L. B. Nielsen# doing so makes it possible to use gcc shared build with Sun C. Given
2503b4e3dcbSSimon L. B. Nielsen# that gcc generates faster code [thanks to inline assembler], I would
2513b4e3dcbSSimon L. B. Nielsen# actually recommend to consider using gcc shared build even with vendor
2523b4e3dcbSSimon L. B. Nielsen# compiler:-)
2533b4e3dcbSSimon L. B. Nielsen#						<appro@fy.chalmers.se>
2541f13597dSJung-uk Kim"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",
25574664626SKris Kennaway
25626d191b4SKris Kennaway#### Solaris x86 with Sun C setups
2577bded2dbSJung-uk Kim"solaris-x86-cc","cc:-fast -xarch=generic -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)",
2581f13597dSJung-uk Kim"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",
25926d191b4SKris Kennaway
26074664626SKris Kennaway#### SPARC Solaris with GNU C setups
2613b4e3dcbSSimon L. B. Nielsen"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
262ed6b93beSJung-uk Kim"solaris-sparcv8-gcc","gcc:-mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2635c87c606SMark Murray# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
2641f13597dSJung-uk Kim"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)",
2651f13597dSJung-uk Kim"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",
26674664626SKris Kennaway####
267ed6b93beSJung-uk Kim"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2681f13597dSJung-uk Kim"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)",
26974664626SKris Kennaway
27074664626SKris Kennaway#### SPARC Solaris with Sun C setups
27174664626SKris Kennaway# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
27274664626SKris Kennaway# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
27374664626SKris Kennaway# SC5.0 note: Compiler common patch 107357-01 or later is required!
2743b4e3dcbSSimon L. B. Nielsen"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2751f13597dSJung-uk Kim"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)",
2761f13597dSJung-uk Kim"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)",
27709286989SJung-uk Kim"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",
278f579bf8eSKris Kennaway####
2791f13597dSJung-uk Kim"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)",
2801f13597dSJung-uk Kim"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)",
28174664626SKris Kennaway
2823b4e3dcbSSimon L. B. Nielsen#### SunOS configs, assuming sparc for the gcc one.
2833b4e3dcbSSimon L. B. Nielsen#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
284ed6b93beSJung-uk Kim"sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
28574664626SKris Kennaway
28674664626SKris Kennaway#### IRIX 5.x configs
28774664626SKris Kennaway# -mips2 flag is added by ./config when appropriate.
2886f9291ceSJung-uk Kim"irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2896f9291ceSJung-uk Kim"irix-cc", "cc:-O2 -use_readonly_const -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
29074664626SKris Kennaway#### IRIX 6.x configs
29174664626SKris Kennaway# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
292ced566fdSJacques Vidrine# './Configure irix-cc -o32' manually.
2936f9291ceSJung-uk Kim"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
2946f9291ceSJung-uk Kim"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
29574664626SKris Kennaway# N64 ABI builds.
2966f9291ceSJung-uk Kim"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2976f9291ceSJung-uk Kim"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
298f579bf8eSKris Kennaway
299f579bf8eSKris Kennaway#### Unified HP-UX ANSI C configs.
300f579bf8eSKris Kennaway# Special notes:
301f579bf8eSKris Kennaway# - Originally we were optimizing at +O4 level. It should be noted
302f579bf8eSKris Kennaway#   that the only difference between +O3 and +O4 is global inter-
303f579bf8eSKris Kennaway#   procedural analysis. As it has to be performed during the link
304f579bf8eSKris Kennaway#   stage the compiler leaves behind certain pseudo-code in lib*.a
305f579bf8eSKris Kennaway#   which might be release or even patch level specific. Generating
306f579bf8eSKris Kennaway#   the machine code for and analyzing the *whole* program appears
307f579bf8eSKris Kennaway#   to be *extremely* memory demanding while the performance gain is
308f579bf8eSKris Kennaway#   actually questionable. The situation is intensified by the default
309f579bf8eSKris Kennaway#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
310f579bf8eSKris Kennaway#   which is way too low for +O4. In other words, doesn't +O3 make
311f579bf8eSKris Kennaway#   more sense?
312f579bf8eSKris Kennaway# - Keep in mind that the HP compiler by default generates code
313f579bf8eSKris Kennaway#   suitable for execution on the host you're currently compiling at.
314f579bf8eSKris Kennaway#   If the toolkit is ment to be used on various PA-RISC processors
3155c87c606SMark Murray#   consider './config +DAportable'.
3163b4e3dcbSSimon L. B. Nielsen# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
317f579bf8eSKris Kennaway#   compatible with *future* releases.
318f579bf8eSKris Kennaway# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
319f579bf8eSKris Kennaway#   pass -D_REENTRANT on HP-UX 10 and later.
320f579bf8eSKris Kennaway# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
321f579bf8eSKris Kennaway#   32-bit message digests. (For the moment of this writing) HP C
322f579bf8eSKris Kennaway#   doesn't seem to "digest" too many local variables (they make "him"
323f579bf8eSKris Kennaway#   chew forever:-). For more details look-up MD32_XARRAY comment in
324f579bf8eSKris Kennaway#   crypto/sha/sha_lcl.h.
325f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
326f579bf8eSKris Kennaway#
327f579bf8eSKris Kennaway# Since there is mention of this in shlib/hpux10-cc.sh
3283b4e3dcbSSimon L. B. Nielsen"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3293b4e3dcbSSimon L. B. Nielsen"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3301f13597dSJung-uk Kim"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",
3311f13597dSJung-uk Kim"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",
3327bded2dbSJung-uk Kim"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",
333ddd58736SKris Kennaway
334ddd58736SKris Kennaway# More attempts at unified 10.X and 11.X targets for HP C compiler.
335ddd58736SKris Kennaway#
336ddd58736SKris Kennaway# Chris Ruemmler <ruemmler@cup.hp.com>
337ddd58736SKris Kennaway# Kevin Steves <ks@hp.se>
3383b4e3dcbSSimon L. B. Nielsen"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3391f13597dSJung-uk Kim"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",
3401f13597dSJung-uk Kim"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",
3411f13597dSJung-uk Kim"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",
34274664626SKris Kennaway
3433b4e3dcbSSimon L. B. Nielsen# HP/UX IA-64 targets
3441f13597dSJung-uk Kim"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",
3453b4e3dcbSSimon L. B. Nielsen# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
3463b4e3dcbSSimon L. B. Nielsen# with debugging of the following config.
3471f13597dSJung-uk Kim"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",
3483b4e3dcbSSimon L. B. Nielsen# GCC builds...
3491f13597dSJung-uk Kim"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",
3501f13597dSJung-uk Kim"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",
35174664626SKris Kennaway
3523b4e3dcbSSimon L. B. Nielsen# Legacy HPUX 9.X configs...
3533b4e3dcbSSimon L. B. Nielsen"hpux-cc",	"cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3543b4e3dcbSSimon L. B. Nielsen"hpux-gcc",	"gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
35574664626SKris Kennaway
356ddd58736SKris Kennaway#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
357*dee36b4fSJung-uk Kim"MPE/iX-gcc",	"gcc:-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:::",
358ddd58736SKris Kennaway
3593b4e3dcbSSimon L. B. Nielsen# DEC Alpha OSF/1/Tru64 targets.
360a21b1b38SKris Kennaway#
361a21b1b38SKris Kennaway#	"What's in a name? That which we call a rose
362a21b1b38SKris Kennaway#	 By any other word would smell as sweet."
363a21b1b38SKris Kennaway#
364a21b1b38SKris Kennaway# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
365a21b1b38SKris Kennaway#
36674664626SKris Kennaway# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
367a21b1b38SKris Kennaway#
3681f13597dSJung-uk Kim"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
3691f13597dSJung-uk Kim"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
3701f13597dSJung-uk Kim"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",
371f579bf8eSKris Kennaway
3723b4e3dcbSSimon L. B. Nielsen####
3733b4e3dcbSSimon L. B. Nielsen#### Variety of LINUX:-)
3743b4e3dcbSSimon L. B. Nielsen####
3753b4e3dcbSSimon L. B. Nielsen# *-generic* is endian-neutral target, but ./config is free to
3763b4e3dcbSSimon L. B. Nielsen# throw in -D[BL]_ENDIAN, whichever appropriate...
3776f9291ceSJung-uk Kim"linux-generic32","gcc:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3786f9291ceSJung-uk Kim"linux-ppc",	"gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3797bded2dbSJung-uk Kim
3807bded2dbSJung-uk Kim#######################################################################
3817bded2dbSJung-uk Kim# Note that -march is not among compiler options in below linux-armv4
3827bded2dbSJung-uk Kim# target line. Not specifying one is intentional to give you choice to:
3837bded2dbSJung-uk Kim#
3847bded2dbSJung-uk Kim# a) rely on your compiler default by not specifying one;
3857bded2dbSJung-uk Kim# b) specify your target platform explicitly for optimal performance,
3867bded2dbSJung-uk Kim#    e.g. -march=armv6 or -march=armv7-a;
3877bded2dbSJung-uk Kim# c) build "universal" binary that targets *range* of platforms by
3887bded2dbSJung-uk Kim#    specifying minimum and maximum supported architecture;
3897bded2dbSJung-uk Kim#
3907bded2dbSJung-uk Kim# As for c) option. It actually makes no sense to specify maximum to be
3917bded2dbSJung-uk Kim# less than ARMv7, because it's the least requirement for run-time
3927bded2dbSJung-uk Kim# switch between platform-specific code paths. And without run-time
3937bded2dbSJung-uk Kim# switch performance would be equivalent to one for minimum. Secondly,
3947bded2dbSJung-uk Kim# there are some natural limitations that you'd have to accept and
3957bded2dbSJung-uk Kim# respect. Most notably you can *not* build "universal" binary for
3967bded2dbSJung-uk Kim# big-endian platform. This is because ARMv7 processor always picks
3977bded2dbSJung-uk Kim# instructions in little-endian order. Another similar limitation is
3987bded2dbSJung-uk Kim# that -mthumb can't "cross" -march=armv6t2 boundary, because that's
3997bded2dbSJung-uk Kim# where it became Thumb-2. Well, this limitation is a bit artificial,
4007bded2dbSJung-uk Kim# because it's not really impossible, but it's deemed too tricky to
4017bded2dbSJung-uk Kim# support. And of course you have to be sure that your binutils are
4027bded2dbSJung-uk Kim# actually up to the task of handling maximum target platform. With all
4037bded2dbSJung-uk Kim# this in mind here is an example of how to configure "universal" build:
4047bded2dbSJung-uk Kim#
4057bded2dbSJung-uk Kim#       ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
4067bded2dbSJung-uk Kim#
4076f9291ceSJung-uk Kim"linux-armv4",	"gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4087bded2dbSJung-uk Kim"linux-aarch64","gcc: -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4097bded2dbSJung-uk Kim# Configure script adds minimally required -march for assembly support,
4107bded2dbSJung-uk Kim# if no -march was specified at command line. mips32 and mips64 below
4117bded2dbSJung-uk Kim# refer to contemporary MIPS Architecture specifications, MIPS32 and
4127bded2dbSJung-uk Kim# MIPS64, rather than to kernel bitness.
4137bded2dbSJung-uk Kim"linux-mips32",	"gcc:-mabi=32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4147bded2dbSJung-uk Kim"linux-mips64",   "gcc:-mabi=n32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:n32:dlfcn:linux-shared:-fPIC:-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
4157bded2dbSJung-uk Kim"linux64-mips64",   "gcc:-mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:64:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4163b4e3dcbSSimon L. B. Nielsen#### IA-32 targets...
4177bded2dbSJung-uk Kim"linux-ia32-icc",	"icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4186f9291ceSJung-uk Kim"linux-elf",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4196f9291ceSJung-uk Kim"linux-aout",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
4203b4e3dcbSSimon L. B. Nielsen####
4216f9291ceSJung-uk Kim"linux-generic64","gcc:-O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4226f9291ceSJung-uk Kim"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4237bded2dbSJung-uk Kim"linux-ppc64le","gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:$ppc64_asm:linux64le:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::",
4247bded2dbSJung-uk Kim"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)",
4257bded2dbSJung-uk Kim"linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4266f9291ceSJung-uk Kim"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4277bded2dbSJung-uk Kim"linux-x86_64-clang",	"clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
42880815a77SJung-uk Kim"debug-linux-x86_64-clang",	"clang: -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4297bded2dbSJung-uk Kim"linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4307bded2dbSJung-uk Kim"linux-x32",	"gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
4316f9291ceSJung-uk Kim"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4321f13597dSJung-uk Kim#### So called "highgprs" target for z/Architecture CPUs
4331f13597dSJung-uk Kim# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
4341f13597dSJung-uk Kim# /proc/cpuinfo. The idea is to preserve most significant bits of
4351f13597dSJung-uk Kim# general purpose registers not only upon 32-bit process context
4361f13597dSJung-uk Kim# switch, but even on asynchronous signal delivery to such process.
4371f13597dSJung-uk Kim# This makes it possible to deploy 64-bit instructions even in legacy
4381f13597dSJung-uk Kim# application context and achieve better [or should we say adequate]
4391f13597dSJung-uk Kim# performance. The build is binary compatible with linux-generic32,
4401f13597dSJung-uk Kim# and the idea is to be able to install the resulting libcrypto.so
4411f13597dSJung-uk Kim# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
4421f13597dSJung-uk Kim# ldconfig and run-time linker to autodiscover. Unfortunately it
4431f13597dSJung-uk Kim# doesn't work just yet, because of couple of bugs in glibc
4441f13597dSJung-uk Kim# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
4456f9291ceSJung-uk Kim"linux32-s390x",	"gcc:-m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
4463b4e3dcbSSimon L. B. Nielsen#### SPARC Linux setups
4473b4e3dcbSSimon L. B. Nielsen# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
4483b4e3dcbSSimon L. B. Nielsen# assisted with debugging of following two configs.
449ed6b93beSJung-uk Kim"linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4503b4e3dcbSSimon L. B. Nielsen# it's a real mess with -mcpu=ultrasparc option under Linux, but
4513b4e3dcbSSimon L. B. Nielsen# -Wa,-Av8plus should do the trick no matter what.
4526f9291ceSJung-uk Kim"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4533b4e3dcbSSimon L. B. Nielsen# GCC 3.1 is a requirement
4546f9291ceSJung-uk Kim"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
455f579bf8eSKris Kennaway#### Alpha Linux with GNU C and Compaq C setups
456f579bf8eSKris Kennaway# Special notes:
457f579bf8eSKris Kennaway# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
458f579bf8eSKris Kennaway#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
459f579bf8eSKris Kennaway#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
460f579bf8eSKris Kennaway#   which is appropriate.
461f579bf8eSKris Kennaway# - If you use ccc keep in mind that -fast implies -arch host and the
462f579bf8eSKris Kennaway#   compiler is free to issue instructions which gonna make elder CPU
463f579bf8eSKris Kennaway#   choke. If you wish to build "blended" toolkit, add -arch generic
464f579bf8eSKris Kennaway#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
465f579bf8eSKris Kennaway#
466f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
467f579bf8eSKris Kennaway#
4686f9291ceSJung-uk Kim"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4696f9291ceSJung-uk Kim"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4706f9291ceSJung-uk Kim"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
4716f9291ceSJung-uk Kim"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
47274664626SKris Kennaway
4736f9291ceSJung-uk Kim# Android: linux-* but without pointers to headers and libs.
47412de4ed2SJung-uk Kim"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)",
4751f13597dSJung-uk Kim"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)",
4761f13597dSJung-uk Kim"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)",
4777bded2dbSJung-uk Kim"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
47812de4ed2SJung-uk Kim
4793b4e3dcbSSimon L. B. Nielsen#### *BSD [do see comment about ${BSDthreads} above!]
4806f9291ceSJung-uk Kim"BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4816f9291ceSJung-uk Kim"BSD-x86",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4826f9291ceSJung-uk Kim"BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4836f9291ceSJung-uk Kim"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
484ed6b93beSJung-uk Kim"BSD-sparcv8",	"gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
48574664626SKris Kennaway
4866f9291ceSJung-uk Kim"BSD-generic64","gcc:-O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4873b4e3dcbSSimon L. B. Nielsen# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
4883b4e3dcbSSimon L. B. Nielsen# simply *happens* to work around a compiler bug in gcc 3.3.3,
4893b4e3dcbSSimon L. B. Nielsen# triggered by RIPEMD160 code.
4906f9291ceSJung-uk Kim"BSD-sparc64",	"gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4916f9291ceSJung-uk Kim"BSD-ia64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4927bded2dbSJung-uk Kim"BSD-x86_64",	"cc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4933b4e3dcbSSimon L. B. Nielsen
4943b4e3dcbSSimon L. B. Nielsen"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4953b4e3dcbSSimon L. B. Nielsen
4965c87c606SMark Murray"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4975c87c606SMark Murray"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4985c87c606SMark Murray
49974664626SKris Kennaway# NCR MP-RAS UNIX ver 02.03.01
500fceca8a3SJacques Vidrine"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
50174664626SKris Kennaway
5023b4e3dcbSSimon L. B. Nielsen# QNX
5035c87c606SMark Murray"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
5046f9291ceSJung-uk Kim"QNX6",       "gcc:::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
5056f9291ceSJung-uk Kim"QNX6-i386",  "gcc:-DL_ENDIAN -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
506a21b1b38SKris Kennaway
5071f13597dSJung-uk Kim# BeOS
5081f13597dSJung-uk Kim"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",
5091f13597dSJung-uk Kim"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",
5101f13597dSJung-uk Kim
5113b4e3dcbSSimon L. B. Nielsen#### SCO/Caldera targets.
512fceca8a3SJacques Vidrine#
513fceca8a3SJacques Vidrine# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
514fceca8a3SJacques Vidrine# Now we only have blended unixware-* as it's the only one used by ./config.
515fceca8a3SJacques Vidrine# If you want to optimize for particular microarchitecture, bypass ./config
516fceca8a3SJacques Vidrine# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
517fceca8a3SJacques Vidrine# Note that not all targets include assembler support. Mostly because of
518fceca8a3SJacques Vidrine# lack of motivation to support out-of-date platforms with out-of-date
519fceca8a3SJacques Vidrine# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
520fceca8a3SJacques Vidrine# patiently assisted to debug most of it.
521fceca8a3SJacques Vidrine#
5223b4e3dcbSSimon L. B. Nielsen# UnixWare 2.0x fails destest with -O.
5235c87c606SMark Murray"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
5245c87c606SMark Murray"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
5257bded2dbSJung-uk Kim"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}-1:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
5267bded2dbSJung-uk Kim"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}-1:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
527fceca8a3SJacques Vidrine# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
5287bded2dbSJung-uk Kim"sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
5297bded2dbSJung-uk Kim"sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
53074664626SKris Kennaway
5313b4e3dcbSSimon L. B. Nielsen#### IBM's AIX.
5323b4e3dcbSSimon L. B. Nielsen"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
5331f13597dSJung-uk Kim"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",
5341f13597dSJung-uk Kim"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",
5353b4e3dcbSSimon L. B. Nielsen# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
5363b4e3dcbSSimon L. B. Nielsen# at build time. $OBJECT_MODE is respected at ./config stage!
53709286989SJung-uk Kim"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",
53809286989SJung-uk Kim"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",
53974664626SKris Kennaway
54074664626SKris Kennaway#
541c1803d78SJacques Vidrine# Cray T90 and similar (SDSC)
54274664626SKris Kennaway# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
54374664626SKris Kennaway# defined.  The T90 ints and longs are 8 bytes long, and apparently the
54474664626SKris Kennaway# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
54574664626SKris Kennaway# non L_ENDIAN code aligns the bytes in each word correctly.
54674664626SKris Kennaway#
54774664626SKris Kennaway# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
54874664626SKris Kennaway#'Taking the address of a bit field is not allowed. '
54974664626SKris Kennaway#'An expression with bit field exists as the operand of "sizeof" '
55074664626SKris Kennaway# (written by Wayne Schroeder <schroede@SDSC.EDU>)
551c1803d78SJacques Vidrine#
552c1803d78SJacques Vidrine# j90 is considered the base machine type for unicos machines,
553c1803d78SJacques Vidrine# so this configuration is now called "cray-j90" ...
5545c87c606SMark Murray"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
55574664626SKris Kennaway
55674664626SKris Kennaway#
55774664626SKris Kennaway# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
55874664626SKris Kennaway#
55974664626SKris Kennaway# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
56074664626SKris Kennaway# another use.  Basically, the problem is that the T3E uses some bit fields
56174664626SKris Kennaway# for some st_addr stuff, and then sizeof and address-of fails
56274664626SKris Kennaway# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
56374664626SKris Kennaway# did not like it.
5645c87c606SMark Murray"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
56574664626SKris Kennaway
56674664626SKris Kennaway# DGUX, 88100.
5675c87c606SMark Murray"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
5685c87c606SMark Murray"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
5695c87c606SMark Murray"dgux-R4-x86-gcc",	"gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
57074664626SKris Kennaway
57174664626SKris Kennaway# Sinix/ReliantUNIX RM400
57274664626SKris Kennaway# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
5733b4e3dcbSSimon L. B. Nielsen"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:reliantunix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
5745c87c606SMark Murray"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
5755c87c606SMark Murray"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
57674664626SKris Kennaway
57774664626SKris Kennaway# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
5786f9291ceSJung-uk Kim"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
57974664626SKris Kennaway
580a21b1b38SKris Kennaway# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
581a21b1b38SKris Kennaway# You need to compile using the c89.sh wrapper in the tools directory, because the
582a21b1b38SKris Kennaway# IBM compiler does not like the -L switch after any object modules.
583a21b1b38SKris Kennaway#
5845c87c606SMark Murray"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
585a21b1b38SKris Kennaway
5863b4e3dcbSSimon L. B. Nielsen# Visual C targets
5871f13597dSJung-uk Kim#
5881f13597dSJung-uk Kim# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
5897bded2dbSJung-uk Kim"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",
5901f13597dSJung-uk Kim"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",
5917bded2dbSJung-uk Kim"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",
5921f13597dSJung-uk Kim"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",
5931f13597dSJung-uk Kim# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
5941f13597dSJung-uk Kim# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
595c4ad4dffSJung-uk Kim"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
5961f13597dSJung-uk Kim# Unified CE target
597c4ad4dffSJung-uk Kim"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
5983b4e3dcbSSimon L. B. Nielsen"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
59974664626SKris Kennaway
60074664626SKris Kennaway# Borland C++ 4.5
6013b4e3dcbSSimon L. B. Nielsen"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
60274664626SKris Kennaway
60350ef0093SJacques Vidrine# MinGW
6041f13597dSJung-uk Kim"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",
6051f13597dSJung-uk Kim# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
6061f13597dSJung-uk Kim# compiled with one compiler with application compiled with another
6071f13597dSJung-uk Kim# compiler. It's possible to engage Applink support in mingw64 build,
6081f13597dSJung-uk Kim# but it's not done, because till mingw64 supports structured exception
6091f13597dSJung-uk Kim# handling, one can't seriously consider its binaries for using with
6101f13597dSJung-uk Kim# non-mingw64 run-time environment. And as mingw64 is always consistent
6111f13597dSJung-uk Kim# with itself, Applink is never engaged and can as well be omitted.
6121f13597dSJung-uk Kim"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",
613ddd58736SKris Kennaway
6144f20a5a2SJacques Vidrine# UWIN
6153b4e3dcbSSimon L. B. Nielsen"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
6164f20a5a2SJacques Vidrine
617c1803d78SJacques Vidrine# Cygwin
6187bded2dbSJung-uk Kim"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
6197bded2dbSJung-uk Kim"Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
6203b4e3dcbSSimon L. B. Nielsen
621db522d3aSSimon L. B. Nielsen# NetWare from David Ward (dsward@novell.com)
622db522d3aSSimon L. B. Nielsen# requires either MetroWerks NLM development tools, or gcc / nlmconv
623db522d3aSSimon L. B. Nielsen# NetWare defaults socket bio to WinSock sockets. However,
624db522d3aSSimon L. B. Nielsen# the builds can be configured to use BSD sockets instead.
6253b4e3dcbSSimon L. B. Nielsen# netware-clib => legacy CLib c-runtime support
626db522d3aSSimon L. B. Nielsen"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
627db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
628db522d3aSSimon L. B. Nielsen"netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
629db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
6303b4e3dcbSSimon L. B. Nielsen# netware-libc => LibC/NKS support
6313b4e3dcbSSimon L. B. Nielsen"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
6323b4e3dcbSSimon L. B. Nielsen"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
6333b4e3dcbSSimon L. B. Nielsen"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
634db522d3aSSimon L. B. Nielsen"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
6355c87c606SMark Murray
6365c87c606SMark Murray# DJGPP
6376f9291ceSJung-uk Kim"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
63874664626SKris Kennaway
63974664626SKris Kennaway# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
6405c87c606SMark Murray"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
6413b4e3dcbSSimon L. B. Nielsen"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
64274664626SKris Kennaway# K&R C is no longer supported; you need gcc on old Ultrix installations
6435c87c606SMark Murray##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
64474664626SKris Kennaway
645a21b1b38SKris Kennaway##### MacOS X (a.k.a. Rhapsody or Darwin) setup
6463b4e3dcbSSimon L. B. Nielsen"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
6471f13597dSJung-uk Kim"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",
6481f13597dSJung-uk Kim"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",
6491f13597dSJung-uk Kim"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",
6501f13597dSJung-uk Kim"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",
6517bded2dbSJung-uk Kim"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG 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",
6527bded2dbSJung-uk Kim"debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG 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",
6531f13597dSJung-uk Kim"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",
6541f13597dSJung-uk Kim# iPhoneOS/iOS
6551f13597dSJung-uk Kim"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",
6565c87c606SMark Murray
6575c87c606SMark Murray##### A/UX
6585c87c606SMark Murray"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
659f579bf8eSKris Kennaway
660ddd58736SKris Kennaway##### Sony NEWS-OS 4.x
6615c87c606SMark Murray"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
6625c87c606SMark Murray
6635c87c606SMark Murray##### GNU Hurd
6646f9291ceSJung-uk Kim"hurd-x86",  "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
6655c87c606SMark Murray
6665c87c606SMark Murray##### OS/2 EMX
6675c87c606SMark Murray"OS2-EMX", "gcc::::::::",
668ddd58736SKris Kennaway
669c1803d78SJacques Vidrine##### VxWorks for various targets
6701f13597dSJung-uk Kim"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:::::",
6711f13597dSJung-uk Kim"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:::::",
6725c87c606SMark Murray"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6735c87c606SMark Murray"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
6741f13597dSJung-uk Kim"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:::::",
67550ef0093SJacques Vidrine"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6761f13597dSJung-uk Kim"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:",
6771f13597dSJung-uk Kim"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:",
6785c87c606SMark Murray
6795c87c606SMark Murray##### Compaq Non-Stop Kernel (Tandem)
6805c87c606SMark Murray"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
681c1803d78SJacques Vidrine
6821f13597dSJung-uk Kim# uClinux
6831f13597dSJung-uk Kim"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'}::",
6841f13597dSJung-uk Kim"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'}::",
6851f13597dSJung-uk Kim
68674664626SKris Kennaway);
68774664626SKris Kennaway
6883b4e3dcbSSimon L. B. Nielsenmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
6891f13597dSJung-uk Kim		    debug-VC-WIN64I debug-VC-WIN64A
6901f13597dSJung-uk Kim		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
6911f13597dSJung-uk Kim		    BC-32
692db522d3aSSimon L. B. Nielsen		    netware-clib netware-clib-bsdsock
693db522d3aSSimon L. B. Nielsen		    netware-libc netware-libc-bsdsock);
69474664626SKris Kennaway
695c1803d78SJacques Vidrinemy $idx = 0;
696c1803d78SJacques Vidrinemy $idx_cc = $idx++;
697c1803d78SJacques Vidrinemy $idx_cflags = $idx++;
698c1803d78SJacques Vidrinemy $idx_unistd = $idx++;
699c1803d78SJacques Vidrinemy $idx_thread_cflag = $idx++;
7005c87c606SMark Murraymy $idx_sys_id = $idx++;
701c1803d78SJacques Vidrinemy $idx_lflags = $idx++;
702c1803d78SJacques Vidrinemy $idx_bn_ops = $idx++;
7033b4e3dcbSSimon L. B. Nielsenmy $idx_cpuid_obj = $idx++;
704c1803d78SJacques Vidrinemy $idx_bn_obj = $idx++;
7057bded2dbSJung-uk Kimmy $idx_ec_obj = $idx++;
706c1803d78SJacques Vidrinemy $idx_des_obj = $idx++;
7073b4e3dcbSSimon L. B. Nielsenmy $idx_aes_obj = $idx++;
708c1803d78SJacques Vidrinemy $idx_bf_obj = $idx++;
709c1803d78SJacques Vidrinemy $idx_md5_obj = $idx++;
710c1803d78SJacques Vidrinemy $idx_sha1_obj = $idx++;
711c1803d78SJacques Vidrinemy $idx_cast_obj = $idx++;
712c1803d78SJacques Vidrinemy $idx_rc4_obj = $idx++;
713c1803d78SJacques Vidrinemy $idx_rmd160_obj = $idx++;
714c1803d78SJacques Vidrinemy $idx_rc5_obj = $idx++;
7151f13597dSJung-uk Kimmy $idx_wp_obj = $idx++;
7161f13597dSJung-uk Kimmy $idx_cmll_obj = $idx++;
7171f13597dSJung-uk Kimmy $idx_modes_obj = $idx++;
7181f13597dSJung-uk Kimmy $idx_engines_obj = $idx++;
7191f13597dSJung-uk Kimmy $idx_perlasm_scheme = $idx++;
720c1803d78SJacques Vidrinemy $idx_dso_scheme = $idx++;
721c1803d78SJacques Vidrinemy $idx_shared_target = $idx++;
722c1803d78SJacques Vidrinemy $idx_shared_cflag = $idx++;
723c1803d78SJacques Vidrinemy $idx_shared_ldflag = $idx++;
724c1803d78SJacques Vidrinemy $idx_shared_extension = $idx++;
725c1803d78SJacques Vidrinemy $idx_ranlib = $idx++;
7265c87c606SMark Murraymy $idx_arflags = $idx++;
7271f13597dSJung-uk Kimmy $idx_multilib = $idx++;
728c1803d78SJacques Vidrine
72974664626SKris Kennawaymy $prefix="";
7306a599222SSimon L. B. Nielsenmy $libdir="";
73174664626SKris Kennawaymy $openssldir="";
7325740a5e3SKris Kennawaymy $exe_ext="";
7336a599222SSimon L. B. Nielsenmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
7346a599222SSimon L. B. Nielsenmy $cross_compile_prefix="";
7351f13597dSJung-uk Kimmy $fipsdir="/usr/local/ssl/fips-2.0";
7361f13597dSJung-uk Kimmy $fipslibdir="";
737db522d3aSSimon L. B. Nielsenmy $baseaddr="0xFB00000";
73874664626SKris Kennawaymy $no_threads=0;
73974664626SKris Kennawaymy $threads=0;
7403b4e3dcbSSimon L. B. Nielsenmy $no_shared=0; # but "no-shared" is default
7413b4e3dcbSSimon L. B. Nielsenmy $zlib=1;      # but "no-zlib" is default
7423b4e3dcbSSimon L. B. Nielsenmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
7435471f83eSSimon L. B. Nielsenmy $no_rfc3779=1; # but "no-rfc3779" is default
74474664626SKris Kennawaymy $no_asm=0;
745ddd58736SKris Kennawaymy $no_dso=0;
7463b4e3dcbSSimon L. B. Nielsenmy $no_gmp=0;
74774664626SKris Kennawaymy @skip=();
7486be8ae07SJacques Vidrinemy $Makefile="Makefile";
74974664626SKris Kennawaymy $des_locl="crypto/des/des_locl.h";
75074664626SKris Kennawaymy $des	="crypto/des/des.h";
75174664626SKris Kennawaymy $bn	="crypto/bn/bn.h";
75274664626SKris Kennawaymy $md2	="crypto/md2/md2.h";
75374664626SKris Kennawaymy $rc4	="crypto/rc4/rc4.h";
75474664626SKris Kennawaymy $rc4_locl="crypto/rc4/rc4_locl.h";
75574664626SKris Kennawaymy $idea	="crypto/idea/idea.h";
75674664626SKris Kennawaymy $rc2	="crypto/rc2/rc2.h";
75774664626SKris Kennawaymy $bf	="crypto/bf/bf_locl.h";
75874664626SKris Kennawaymy $bn_asm	="bn_asm.o";
75974664626SKris Kennawaymy $des_enc="des_enc.o fcrypt_b.o";
7603b4e3dcbSSimon L. B. Nielsenmy $aes_enc="aes_core.o aes_cbc.o";
76174664626SKris Kennawaymy $bf_enc	="bf_enc.o";
76274664626SKris Kennawaymy $cast_enc="c_enc.o";
763db522d3aSSimon L. B. Nielsenmy $rc4_enc="rc4_enc.o rc4_skey.o";
76474664626SKris Kennawaymy $rc5_enc="rc5_enc.o";
76574664626SKris Kennawaymy $md5_obj="";
76674664626SKris Kennawaymy $sha1_obj="";
76774664626SKris Kennawaymy $rmd160_obj="";
7681f13597dSJung-uk Kimmy $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
76974664626SKris Kennawaymy $processor="";
7705740a5e3SKris Kennawaymy $default_ranlib;
77174664626SKris Kennawaymy $perl;
772db522d3aSSimon L. B. Nielsenmy $fips=0;
77374664626SKris Kennaway
7741f13597dSJung-uk Kimif (exists $ENV{FIPSDIR})
7751f13597dSJung-uk Kim	{
7761f13597dSJung-uk Kim	$fipsdir = $ENV{FIPSDIR};
7771f13597dSJung-uk Kim	$fipsdir =~ s/\/$//;
7781f13597dSJung-uk Kim	}
7793b4e3dcbSSimon L. B. Nielsen
7803b4e3dcbSSimon L. B. Nielsen# All of the following is disabled by default (RC5 was enabled before 0.9.8):
7813b4e3dcbSSimon L. B. Nielsen
782db522d3aSSimon L. B. Nielsenmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
7831f13597dSJung-uk Kim		 "ec_nistp_64_gcc_128" => "default",
7843b4e3dcbSSimon L. B. Nielsen		 "gmp"		  => "default",
785db522d3aSSimon L. B. Nielsen		 "jpake"          => "experimental",
7867bded2dbSJung-uk Kim		 "libunbound"     => "experimental",
7871f13597dSJung-uk Kim		 "md2"            => "default",
7883b4e3dcbSSimon L. B. Nielsen		 "rc5"            => "default",
7895471f83eSSimon L. B. Nielsen		 "rfc3779"	  => "default",
7901f13597dSJung-uk Kim		 "sctp"           => "default",
7913b4e3dcbSSimon L. B. Nielsen		 "shared"         => "default",
7927bded2dbSJung-uk Kim		 "ssl-trace"	  => "default",
7934c6a0400SJung-uk Kim		 "ssl2"           => "default",
7941f13597dSJung-uk Kim		 "store"	  => "experimental",
795a93cbc2bSJung-uk Kim		 "unit-test"	  => "default",
7964c6a0400SJung-uk Kim		 "weak-ssl-ciphers" => "default",
7973b4e3dcbSSimon L. B. Nielsen		 "zlib"           => "default",
7983b4e3dcbSSimon L. B. Nielsen		 "zlib-dynamic"   => "default"
7993b4e3dcbSSimon L. B. Nielsen	       );
800db522d3aSSimon L. B. Nielsenmy @experimental = ();
8013b4e3dcbSSimon L. B. Nielsen
802db522d3aSSimon L. B. Nielsen# This is what $depflags will look like with the above defaults
803db522d3aSSimon L. B. Nielsen# (we need this to see if we should advise the user to run "make depend"):
804aeb5019cSJung-uk Kimmy $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS";
805db522d3aSSimon L. B. Nielsen
806db522d3aSSimon L. B. Nielsen# Explicit "no-..." options will be collected in %disabled along with the defaults.
807db522d3aSSimon L. B. Nielsen# To remove something from %disabled, use "enable-foo" (unless it's experimental).
808db522d3aSSimon L. B. Nielsen# For symmetry, "disable-foo" is a synonym for "no-foo".
809db522d3aSSimon L. B. Nielsen
810db522d3aSSimon L. B. Nielsen# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
811db522d3aSSimon L. B. Nielsen# We will collect such requests in @experimental.
812db522d3aSSimon L. B. Nielsen# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
8133b4e3dcbSSimon L. B. Nielsen
8143b4e3dcbSSimon L. B. Nielsen
8153b4e3dcbSSimon L. B. Nielsenmy $no_sse2=0;
8165c87c606SMark Murray
81774664626SKris Kennaway&usage if ($#ARGV < 0);
81874664626SKris Kennaway
819ddd58736SKris Kennawaymy $flags;
820ddd58736SKris Kennawaymy $depflags;
821db522d3aSSimon L. B. Nielsenmy $openssl_experimental_defines;
822ddd58736SKris Kennawaymy $openssl_algorithm_defines;
823ddd58736SKris Kennawaymy $openssl_thread_defines;
8245c87c606SMark Murraymy $openssl_sys_defines="";
825ddd58736SKris Kennawaymy $openssl_other_defines;
826ddd58736SKris Kennawaymy $libs;
827fceca8a3SJacques Vidrinemy $libkrb5="";
828ddd58736SKris Kennawaymy $target;
829ddd58736SKris Kennawaymy $options;
830ddd58736SKris Kennawaymy $symlink;
8315c87c606SMark Murraymy $make_depend=0;
8325c87c606SMark Murraymy %withargs=();
833ddd58736SKris Kennaway
834ddd58736SKris Kennawaymy @argvcopy=@ARGV;
835ddd58736SKris Kennawaymy $argvstring="";
836ddd58736SKris Kennawaymy $argv_unprocessed=1;
837ddd58736SKris Kennaway
838ddd58736SKris Kennawaywhile($argv_unprocessed)
839ddd58736SKris Kennaway	{
840ddd58736SKris Kennaway	$flags="";
841ddd58736SKris Kennaway	$depflags="";
842db522d3aSSimon L. B. Nielsen	$openssl_experimental_defines="";
843ddd58736SKris Kennaway	$openssl_algorithm_defines="";
844ddd58736SKris Kennaway	$openssl_thread_defines="";
8455c87c606SMark Murray	$openssl_sys_defines="";
846ddd58736SKris Kennaway	$openssl_other_defines="";
847ddd58736SKris Kennaway	$libs="";
848ddd58736SKris Kennaway	$target="";
849ddd58736SKris Kennaway	$options="";
850ddd58736SKris Kennaway	$symlink=1;
851ddd58736SKris Kennaway
852ddd58736SKris Kennaway	$argv_unprocessed=0;
853ddd58736SKris Kennaway	$argvstring=join(' ',@argvcopy);
854ddd58736SKris Kennaway
855ddd58736SKris KennawayPROCESS_ARGS:
856ddd58736SKris Kennaway	foreach (@argvcopy)
85774664626SKris Kennaway		{
858f579bf8eSKris Kennaway		s /^-no-/no-/; # some people just can't read the instructions
8593b4e3dcbSSimon L. B. Nielsen
8603b4e3dcbSSimon L. B. Nielsen		# rewrite some options in "enable-..." form
8613b4e3dcbSSimon L. B. Nielsen		s /^-?-?shared$/enable-shared/;
8621f13597dSJung-uk Kim		s /^sctp$/enable-sctp/;
8633b4e3dcbSSimon L. B. Nielsen		s /^threads$/enable-threads/;
8643b4e3dcbSSimon L. B. Nielsen		s /^zlib$/enable-zlib/;
8653b4e3dcbSSimon L. B. Nielsen		s /^zlib-dynamic$/enable-zlib-dynamic/;
8663b4e3dcbSSimon L. B. Nielsen
8673b4e3dcbSSimon L. B. Nielsen		if (/^no-(.+)$/ || /^disable-(.+)$/)
8683b4e3dcbSSimon L. B. Nielsen			{
869db522d3aSSimon L. B. Nielsen			if (!($disabled{$1} eq "experimental"))
870db522d3aSSimon L. B. Nielsen				{
8713b4e3dcbSSimon L. B. Nielsen				if ($1 eq "ssl")
8723b4e3dcbSSimon L. B. Nielsen					{
8733b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl2"} = "option(ssl)";
8743b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl3"} = "option(ssl)";
8753b4e3dcbSSimon L. B. Nielsen					}
8763b4e3dcbSSimon L. B. Nielsen				elsif ($1 eq "tls")
8773b4e3dcbSSimon L. B. Nielsen					{
8783b4e3dcbSSimon L. B. Nielsen					$disabled{"tls1"} = "option(tls)"
8793b4e3dcbSSimon L. B. Nielsen					}
880751d2991SJung-uk Kim				elsif ($1 eq "ssl3-method")
881751d2991SJung-uk Kim					{
882751d2991SJung-uk Kim					$disabled{"ssl3-method"} = "option(ssl)";
883751d2991SJung-uk Kim					$disabled{"ssl3"} = "option(ssl)";
884751d2991SJung-uk Kim					}
8853b4e3dcbSSimon L. B. Nielsen				else
8863b4e3dcbSSimon L. B. Nielsen					{
8873b4e3dcbSSimon L. B. Nielsen					$disabled{$1} = "option";
8883b4e3dcbSSimon L. B. Nielsen					}
8893b4e3dcbSSimon L. B. Nielsen				}
890db522d3aSSimon L. B. Nielsen			}
891db522d3aSSimon L. B. Nielsen		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
8923b4e3dcbSSimon L. B. Nielsen			{
893db522d3aSSimon L. B. Nielsen			my $algo = $1;
894db522d3aSSimon L. B. Nielsen			if ($disabled{$algo} eq "experimental")
895db522d3aSSimon L. B. Nielsen				{
896db522d3aSSimon L. B. Nielsen				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
897db522d3aSSimon L. B. Nielsen					unless (/^experimental-/);
898db522d3aSSimon L. B. Nielsen				push @experimental, $algo;
899db522d3aSSimon L. B. Nielsen				}
900db522d3aSSimon L. B. Nielsen			delete $disabled{$algo};
9013b4e3dcbSSimon L. B. Nielsen
902db522d3aSSimon L. B. Nielsen			$threads = 1 if ($algo eq "threads");
9033b4e3dcbSSimon L. B. Nielsen			}
9043b4e3dcbSSimon L. B. Nielsen		elsif (/^--test-sanity$/)
905c1803d78SJacques Vidrine			{
906c1803d78SJacques Vidrine			exit(&test_sanity());
907c1803d78SJacques Vidrine			}
9086a599222SSimon L. B. Nielsen		elsif (/^--strict-warnings/)
9096a599222SSimon L. B. Nielsen			{
9106a599222SSimon L. B. Nielsen			$strict_warnings = 1;
9116a599222SSimon L. B. Nielsen			}
912ddd58736SKris Kennaway		elsif (/^reconfigure/ || /^reconf/)
913ddd58736SKris Kennaway			{
914ddd58736SKris Kennaway			if (open(IN,"<$Makefile"))
915ddd58736SKris Kennaway				{
916ddd58736SKris Kennaway				while (<IN>)
917ddd58736SKris Kennaway					{
9183b4e3dcbSSimon L. B. Nielsen					chomp;
919ddd58736SKris Kennaway					if (/^CONFIGURE_ARGS=(.*)/)
920ddd58736SKris Kennaway						{
921ddd58736SKris Kennaway						$argvstring=$1;
922ddd58736SKris Kennaway						@argvcopy=split(' ',$argvstring);
923ddd58736SKris Kennaway						die "Incorrect data to reconfigure, please do a normal configuration\n"
924ddd58736SKris Kennaway							if (grep(/^reconf/,@argvcopy));
925ddd58736SKris Kennaway						print "Reconfiguring with: $argvstring\n";
926ddd58736SKris Kennaway						$argv_unprocessed=1;
927ddd58736SKris Kennaway						close(IN);
928ddd58736SKris Kennaway						last PROCESS_ARGS;
929ddd58736SKris Kennaway						}
930ddd58736SKris Kennaway					}
931ddd58736SKris Kennaway				close(IN);
932ddd58736SKris Kennaway				}
933ddd58736SKris Kennaway			die "Insufficient data to reconfigure, please do a normal configuration\n";
934ddd58736SKris Kennaway			}
93574664626SKris Kennaway		elsif (/^386$/)
93674664626SKris Kennaway			{ $processor=386; }
937db522d3aSSimon L. B. Nielsen		elsif (/^fips$/)
938db522d3aSSimon L. B. Nielsen			{
939db522d3aSSimon L. B. Nielsen			$fips=1;
940db522d3aSSimon L. B. Nielsen			}
94174664626SKris Kennaway		elsif (/^rsaref$/)
94274664626SKris Kennaway			{
9435c87c606SMark Murray			# No RSAref support any more since it's not needed.
9445c87c606SMark Murray			# The check for the option is there so scripts aren't
9455c87c606SMark Murray			# broken
94674664626SKris Kennaway			}
94774664626SKris Kennaway		elsif (/^[-+]/)
94874664626SKris Kennaway			{
9497bded2dbSJung-uk Kim			if (/^--prefix=(.*)$/)
95074664626SKris Kennaway				{
95174664626SKris Kennaway				$prefix=$1;
95274664626SKris Kennaway				}
9536a599222SSimon L. B. Nielsen			elsif (/^--libdir=(.*)$/)
9546a599222SSimon L. B. Nielsen				{
9556a599222SSimon L. B. Nielsen				$libdir=$1;
9566a599222SSimon L. B. Nielsen				}
95774664626SKris Kennaway			elsif (/^--openssldir=(.*)$/)
95874664626SKris Kennaway				{
95974664626SKris Kennaway				$openssldir=$1;
96074664626SKris Kennaway				}
96174664626SKris Kennaway			elsif (/^--install.prefix=(.*)$/)
96274664626SKris Kennaway				{
96374664626SKris Kennaway				$install_prefix=$1;
96474664626SKris Kennaway				}
9655c87c606SMark Murray			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
9665c87c606SMark Murray				{
9675c87c606SMark Murray				$withargs{"krb5-".$1}=$2;
9685c87c606SMark Murray				}
9693b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-lib=(.*)$/)
9703b4e3dcbSSimon L. B. Nielsen				{
9713b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-lib"}=$1;
9723b4e3dcbSSimon L. B. Nielsen				}
9733b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-include=(.*)$/)
9743b4e3dcbSSimon L. B. Nielsen				{
9753b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-include"}="-I$1";
9763b4e3dcbSSimon L. B. Nielsen				}
9771f13597dSJung-uk Kim			elsif (/^--with-fipsdir=(.*)$/)
9781f13597dSJung-uk Kim				{
9791f13597dSJung-uk Kim				$fipsdir="$1";
9801f13597dSJung-uk Kim				}
981db522d3aSSimon L. B. Nielsen			elsif (/^--with-fipslibdir=(.*)$/)
982db522d3aSSimon L. B. Nielsen				{
9831f13597dSJung-uk Kim				$fipslibdir="$1";
984db522d3aSSimon L. B. Nielsen				}
985db522d3aSSimon L. B. Nielsen			elsif (/^--with-baseaddr=(.*)$/)
986db522d3aSSimon L. B. Nielsen				{
987db522d3aSSimon L. B. Nielsen				$baseaddr="$1";
988db522d3aSSimon L. B. Nielsen				}
9891f13597dSJung-uk Kim			elsif (/^--cross-compile-prefix=(.*)$/)
9901f13597dSJung-uk Kim				{
9911f13597dSJung-uk Kim				$cross_compile_prefix=$1;
9921f13597dSJung-uk Kim				}
9937bded2dbSJung-uk Kim			elsif (/^-[lL](.*)$/ or /^-Wl,/)
99474664626SKris Kennaway				{
9957bded2dbSJung-uk Kim				$libs.=$_." ";
9967bded2dbSJung-uk Kim				}
9977bded2dbSJung-uk Kim			else	# common if (/^[-+]/), just pass down...
9987bded2dbSJung-uk Kim				{
9997bded2dbSJung-uk Kim				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
10007bded2dbSJung-uk Kim				$flags.=$_." ";
100174664626SKris Kennaway				}
100274664626SKris Kennaway			}
100374664626SKris Kennaway		elsif ($_ =~ /^([^:]+):(.+)$/)
100474664626SKris Kennaway			{
100574664626SKris Kennaway			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
100674664626SKris Kennaway			$target=$1;
100774664626SKris Kennaway			}
100874664626SKris Kennaway		else
100974664626SKris Kennaway			{
10103b4e3dcbSSimon L. B. Nielsen			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
101174664626SKris Kennaway			$target=$_;
101274664626SKris Kennaway			}
101374664626SKris Kennaway
10143b4e3dcbSSimon L. B. Nielsen		unless ($_ eq $target || /^no-/ || /^disable-/)
10155c87c606SMark Murray			{
10163b4e3dcbSSimon L. B. Nielsen			# "no-..." follows later after implied disactivations
10173b4e3dcbSSimon L. B. Nielsen			# have been derived.  (Don't take this too seroiusly,
10183b4e3dcbSSimon L. B. Nielsen			# we really only write OPTIONS to the Makefile out of
10193b4e3dcbSSimon L. B. Nielsen			# nostalgia.)
10203b4e3dcbSSimon L. B. Nielsen
10213b4e3dcbSSimon L. B. Nielsen			if ($options eq "")
10223b4e3dcbSSimon L. B. Nielsen				{ $options = $_; }
10233b4e3dcbSSimon L. B. Nielsen			else
10243b4e3dcbSSimon L. B. Nielsen				{ $options .= " ".$_; }
10253b4e3dcbSSimon L. B. Nielsen			}
10263b4e3dcbSSimon L. B. Nielsen		}
10275c87c606SMark Murray	}
10285c87c606SMark Murray
10293b4e3dcbSSimon L. B. Nielsen
10303b4e3dcbSSimon L. B. Nielsen
10313b4e3dcbSSimon L. B. Nielsenif ($processor eq "386")
10325c87c606SMark Murray	{
10333b4e3dcbSSimon L. B. Nielsen	$disabled{"sse2"} = "forced";
10345c87c606SMark Murray	}
10355c87c606SMark Murray
10363b4e3dcbSSimon L. B. Nielsenif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
10375c87c606SMark Murray	{
10383b4e3dcbSSimon L. B. Nielsen	$disabled{"krb5"} = "krb5-flavor not specified";
10395c87c606SMark Murray	}
10405c87c606SMark Murray
10413b4e3dcbSSimon L. B. Nielsenif (!defined($disabled{"zlib-dynamic"}))
10423b4e3dcbSSimon L. B. Nielsen	{
10433b4e3dcbSSimon L. B. Nielsen	# "zlib-dynamic" was specifically enabled, so enable "zlib"
10443b4e3dcbSSimon L. B. Nielsen	delete $disabled{"zlib"};
10453b4e3dcbSSimon L. B. Nielsen	}
10463b4e3dcbSSimon L. B. Nielsen
10473b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"rijndael"}))
10483b4e3dcbSSimon L. B. Nielsen	{
10493b4e3dcbSSimon L. B. Nielsen	$disabled{"aes"} = "forced";
10503b4e3dcbSSimon L. B. Nielsen	}
10513b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"des"}))
10523b4e3dcbSSimon L. B. Nielsen	{
10533b4e3dcbSSimon L. B. Nielsen	$disabled{"mdc2"} = "forced";
10543b4e3dcbSSimon L. B. Nielsen	}
10553b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"ec"}))
10563b4e3dcbSSimon L. B. Nielsen	{
10573b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdsa"} = "forced";
10583b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdh"} = "forced";
10593b4e3dcbSSimon L. B. Nielsen	}
10603b4e3dcbSSimon L. B. Nielsen
10613b4e3dcbSSimon L. B. Nielsen# SSL 2.0 requires MD5 and RSA
10623b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
10633b4e3dcbSSimon L. B. Nielsen	{
10643b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl2"} = "forced";
10653b4e3dcbSSimon L. B. Nielsen	}
10663b4e3dcbSSimon L. B. Nielsen
10671f13597dSJung-uk Kimif ($fips && $fipslibdir eq "")
10681f13597dSJung-uk Kim	{
10691f13597dSJung-uk Kim	$fipslibdir = $fipsdir . "/lib/";
10701f13597dSJung-uk Kim	}
10711f13597dSJung-uk Kim
10721f13597dSJung-uk Kim# RSAX ENGINE sets default non-FIPS RSA method.
10731f13597dSJung-uk Kimif ($fips)
10741f13597dSJung-uk Kim	{
10751f13597dSJung-uk Kim	$disabled{"rsax"} = "forced";
10761f13597dSJung-uk Kim	}
10771f13597dSJung-uk Kim
10783b4e3dcbSSimon L. B. Nielsen# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
10793b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"sha"})
10803b4e3dcbSSimon L. B. Nielsen    || (defined($disabled{"rsa"})
10813b4e3dcbSSimon L. B. Nielsen        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
10823b4e3dcbSSimon L. B. Nielsen	{
10833b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl3"} = "forced";
10843b4e3dcbSSimon L. B. Nielsen	$disabled{"tls1"} = "forced";
10853b4e3dcbSSimon L. B. Nielsen	}
10863b4e3dcbSSimon L. B. Nielsen
10871f13597dSJung-uk Kimif (defined($disabled{"ec"}) || defined($disabled{"dsa"})
10881f13597dSJung-uk Kim    || defined($disabled{"dh"}))
10891f13597dSJung-uk Kim	{
10901f13597dSJung-uk Kim	$disabled{"gost"} = "forced";
10911f13597dSJung-uk Kim	}
10921f13597dSJung-uk Kim
10931f13597dSJung-uk Kim# SRP and HEARTBEATS require TLSEXT
10941f13597dSJung-uk Kimif (defined($disabled{"tlsext"}))
10951f13597dSJung-uk Kim	{
10961f13597dSJung-uk Kim	$disabled{"srp"} = "forced";
10971f13597dSJung-uk Kim	$disabled{"heartbeats"} = "forced";
10981f13597dSJung-uk Kim	}
10991f13597dSJung-uk Kim
110074664626SKris Kennawayif ($target eq "TABLE") {
110174664626SKris Kennaway	foreach $target (sort keys %table) {
110274664626SKris Kennaway		print_table_entry($target);
110374664626SKris Kennaway	}
110474664626SKris Kennaway	exit 0;
110574664626SKris Kennaway}
110674664626SKris Kennaway
1107f579bf8eSKris Kennawayif ($target eq "LIST") {
1108f579bf8eSKris Kennaway	foreach (sort keys %table) {
1109f579bf8eSKris Kennaway		print;
1110f579bf8eSKris Kennaway		print "\n";
1111f579bf8eSKris Kennaway	}
1112f579bf8eSKris Kennaway	exit 0;
1113f579bf8eSKris Kennaway}
1114f579bf8eSKris Kennaway
1115c1803d78SJacques Vidrineif ($target =~ m/^CygWin32(-.*)$/) {
1116c1803d78SJacques Vidrine	$target = "Cygwin".$1;
1117c1803d78SJacques Vidrine}
1118c1803d78SJacques Vidrine
1119ddd58736SKris Kennawayprint "Configuring for $target\n";
1120ddd58736SKris Kennaway
112174664626SKris Kennaway&usage if (!defined($table{$target}));
112274664626SKris Kennaway
11231f13597dSJung-uk Kim
11241f13597dSJung-uk Kimforeach (sort (keys %disabled))
11251f13597dSJung-uk Kim	{
11261f13597dSJung-uk Kim	$options .= " no-$_";
11271f13597dSJung-uk Kim
11281f13597dSJung-uk Kim	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
11291f13597dSJung-uk Kim
11301f13597dSJung-uk Kim	if (/^dso$/)
11311f13597dSJung-uk Kim		{ $no_dso = 1; }
11321f13597dSJung-uk Kim	elsif (/^threads$/)
11331f13597dSJung-uk Kim		{ $no_threads = 1; }
11341f13597dSJung-uk Kim	elsif (/^shared$/)
11351f13597dSJung-uk Kim		{ $no_shared = 1; }
11361f13597dSJung-uk Kim	elsif (/^zlib$/)
11371f13597dSJung-uk Kim		{ $zlib = 0; }
11381f13597dSJung-uk Kim	elsif (/^static-engine$/)
11391f13597dSJung-uk Kim		{ }
11401f13597dSJung-uk Kim	elsif (/^zlib-dynamic$/)
11411f13597dSJung-uk Kim		{ }
11421f13597dSJung-uk Kim	elsif (/^symlinks$/)
11431f13597dSJung-uk Kim		{ $symlink = 0; }
11441f13597dSJung-uk Kim	elsif (/^sse2$/)
11451f13597dSJung-uk Kim		{ $no_sse2 = 1; }
11461f13597dSJung-uk Kim	else
11471f13597dSJung-uk Kim		{
11481f13597dSJung-uk Kim		my ($ALGO, $algo);
11491f13597dSJung-uk Kim		($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
11501f13597dSJung-uk Kim
11511f13597dSJung-uk Kim		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
11521f13597dSJung-uk Kim			{
11531f13597dSJung-uk Kim			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
11541f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
11551f13597dSJung-uk Kim
11561f13597dSJung-uk Kim			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
11571f13597dSJung-uk Kim			elsif (/^asm$/)	{ $no_asm = 1; }
11581f13597dSJung-uk Kim			}
11591f13597dSJung-uk Kim		else
11601f13597dSJung-uk Kim			{
11611f13597dSJung-uk Kim			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
11621f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
11631f13597dSJung-uk Kim
11641f13597dSJung-uk Kim			if (/^krb5$/)
11651f13597dSJung-uk Kim				{ $no_krb5 = 1; }
11661f13597dSJung-uk Kim			else
11671f13597dSJung-uk Kim				{
11681f13597dSJung-uk Kim				push @skip, $algo;
11691f13597dSJung-uk Kim				# fix-up crypto/directory name(s)
11701f13597dSJung-uk Kim				@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
11711f13597dSJung-uk Kim				print " (skip dir)";
11721f13597dSJung-uk Kim
11731f13597dSJung-uk Kim				$depflags .= " -DOPENSSL_NO_$ALGO";
11741f13597dSJung-uk Kim				}
11751f13597dSJung-uk Kim			}
11761f13597dSJung-uk Kim		}
11771f13597dSJung-uk Kim
11781f13597dSJung-uk Kim	print "\n";
11791f13597dSJung-uk Kim	}
11801f13597dSJung-uk Kim
11811f13597dSJung-uk Kimmy $exp_cflags = "";
11821f13597dSJung-uk Kimforeach (sort @experimental)
11831f13597dSJung-uk Kim	{
11841f13597dSJung-uk Kim	my $ALGO;
11851f13597dSJung-uk Kim	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
11861f13597dSJung-uk Kim
11871f13597dSJung-uk Kim	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
11881f13597dSJung-uk Kim	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
11891f13597dSJung-uk Kim	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
11901f13597dSJung-uk Kim	}
11911f13597dSJung-uk Kim
11921f13597dSJung-uk Kimmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
11931f13597dSJung-uk Kim
11941f13597dSJung-uk Kim$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
11951f13597dSJung-uk Kim$exe_ext=".nlm" if ($target =~ /netware/);
11961f13597dSJung-uk Kim$exe_ext=".pm"  if ($target =~ /vos/);
11971f13597dSJung-uk Kim$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
11981f13597dSJung-uk Kim$prefix=$openssldir if $prefix eq "";
11991f13597dSJung-uk Kim
12001f13597dSJung-uk Kim$default_ranlib= &which("ranlib") or $default_ranlib="true";
12011f13597dSJung-uk Kim$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
12021f13597dSJung-uk Kim  or $perl="perl";
12031f13597dSJung-uk Kimmy $make = $ENV{'MAKE'} || "make";
12041f13597dSJung-uk Kim
12051f13597dSJung-uk Kim$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
12061f13597dSJung-uk Kim
12071f13597dSJung-uk Kimchop $openssldir if $openssldir =~ /\/$/;
12081f13597dSJung-uk Kimchop $prefix if $prefix =~ /.\/$/;
12091f13597dSJung-uk Kim
12101f13597dSJung-uk Kim$openssldir=$prefix . "/ssl" if $openssldir eq "";
12111f13597dSJung-uk Kim$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
12121f13597dSJung-uk Kim
12131f13597dSJung-uk Kim
12141f13597dSJung-uk Kimprint "IsMK1MF=$IsMK1MF\n";
12151f13597dSJung-uk Kim
1216db522d3aSSimon L. B. Nielsenmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1217db522d3aSSimon L. B. Nielsenmy $cc = $fields[$idx_cc];
1218db522d3aSSimon L. B. Nielsen# Allow environment CC to override compiler...
1219db522d3aSSimon L. B. Nielsenif($ENV{CC}) {
1220db522d3aSSimon L. B. Nielsen    $cc = $ENV{CC};
1221db522d3aSSimon L. B. Nielsen}
12227bded2dbSJung-uk Kim
1223db522d3aSSimon L. B. Nielsenmy $cflags = $fields[$idx_cflags];
1224db522d3aSSimon L. B. Nielsenmy $unistd = $fields[$idx_unistd];
1225db522d3aSSimon L. B. Nielsenmy $thread_cflag = $fields[$idx_thread_cflag];
1226db522d3aSSimon L. B. Nielsenmy $sys_id = $fields[$idx_sys_id];
1227db522d3aSSimon L. B. Nielsenmy $lflags = $fields[$idx_lflags];
1228db522d3aSSimon L. B. Nielsenmy $bn_ops = $fields[$idx_bn_ops];
1229db522d3aSSimon L. B. Nielsenmy $cpuid_obj = $fields[$idx_cpuid_obj];
1230db522d3aSSimon L. B. Nielsenmy $bn_obj = $fields[$idx_bn_obj];
12317bded2dbSJung-uk Kimmy $ec_obj = $fields[$idx_ec_obj];
1232db522d3aSSimon L. B. Nielsenmy $des_obj = $fields[$idx_des_obj];
1233db522d3aSSimon L. B. Nielsenmy $aes_obj = $fields[$idx_aes_obj];
1234db522d3aSSimon L. B. Nielsenmy $bf_obj = $fields[$idx_bf_obj];
1235db522d3aSSimon L. B. Nielsenmy $md5_obj = $fields[$idx_md5_obj];
1236db522d3aSSimon L. B. Nielsenmy $sha1_obj = $fields[$idx_sha1_obj];
1237db522d3aSSimon L. B. Nielsenmy $cast_obj = $fields[$idx_cast_obj];
1238db522d3aSSimon L. B. Nielsenmy $rc4_obj = $fields[$idx_rc4_obj];
1239db522d3aSSimon L. B. Nielsenmy $rmd160_obj = $fields[$idx_rmd160_obj];
1240db522d3aSSimon L. B. Nielsenmy $rc5_obj = $fields[$idx_rc5_obj];
12411f13597dSJung-uk Kimmy $wp_obj = $fields[$idx_wp_obj];
12421f13597dSJung-uk Kimmy $cmll_obj = $fields[$idx_cmll_obj];
12431f13597dSJung-uk Kimmy $modes_obj = $fields[$idx_modes_obj];
12441f13597dSJung-uk Kimmy $engines_obj = $fields[$idx_engines_obj];
12451f13597dSJung-uk Kimmy $perlasm_scheme = $fields[$idx_perlasm_scheme];
1246db522d3aSSimon L. B. Nielsenmy $dso_scheme = $fields[$idx_dso_scheme];
1247db522d3aSSimon L. B. Nielsenmy $shared_target = $fields[$idx_shared_target];
1248db522d3aSSimon L. B. Nielsenmy $shared_cflag = $fields[$idx_shared_cflag];
1249db522d3aSSimon L. B. Nielsenmy $shared_ldflag = $fields[$idx_shared_ldflag];
1250db522d3aSSimon L. B. Nielsenmy $shared_extension = $fields[$idx_shared_extension];
12516a599222SSimon L. B. Nielsenmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
12526a599222SSimon L. B. Nielsenmy $ar = $ENV{'AR'} || "ar";
1253db522d3aSSimon L. B. Nielsenmy $arflags = $fields[$idx_arflags];
1254aeb5019cSJung-uk Kimmy $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres";
12551f13597dSJung-uk Kimmy $multilib = $fields[$idx_multilib];
1256db522d3aSSimon L. B. Nielsen
12571f13597dSJung-uk Kim# if $prefix/lib$multilib is not an existing directory, then
12581f13597dSJung-uk Kim# assume that it's not searched by linker automatically, in
12591f13597dSJung-uk Kim# which case adding $multilib suffix causes more grief than
12601f13597dSJung-uk Kim# we're ready to tolerate, so don't...
12611f13597dSJung-uk Kim$multilib="" if !-d "$prefix/lib$multilib";
1262db522d3aSSimon L. B. Nielsen
12631f13597dSJung-uk Kim$libdir="lib$multilib" if $libdir eq "";
1264db522d3aSSimon L. B. Nielsen
12651f13597dSJung-uk Kim$cflags = "$cflags$exp_cflags";
126674664626SKris Kennaway
1267db522d3aSSimon L. B. Nielsen# '%' in $lflags is used to split flags to "pre-" and post-flags
1268db522d3aSSimon L. B. Nielsenmy ($prelflags,$postlflags)=split('%',$lflags);
1269db522d3aSSimon L. B. Nielsenif (defined($postlflags))	{ $lflags=$postlflags;	}
1270db522d3aSSimon L. B. Nielsenelse				{ $lflags=$prelflags; undef $prelflags;	}
1271c1803d78SJacques Vidrine
1272*dee36b4fSJung-uk Kimif ($target =~ /^mingw/ && `$cross_compile_prefix$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
12731f13597dSJung-uk Kim	{
12741f13597dSJung-uk Kim	$cflags =~ s/\-mno\-cygwin\s*//;
12751f13597dSJung-uk Kim	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
12761f13597dSJung-uk Kim	}
12771f13597dSJung-uk Kim
12787bded2dbSJung-uk Kimif ($target =~ /linux.*\-mips/ && !$no_asm && $flags !~ /\-m(ips|arch=)/) {
12797bded2dbSJung-uk Kim	# minimally required architecture flags for assembly modules
12807bded2dbSJung-uk Kim	$cflags="-mips2 $cflags" if ($target =~ /mips32/);
12817bded2dbSJung-uk Kim	$cflags="-mips3 $cflags" if ($target =~ /mips64/);
12827bded2dbSJung-uk Kim}
12837bded2dbSJung-uk Kim
1284fceca8a3SJacques Vidrinemy $no_shared_warn=0;
12853b4e3dcbSSimon L. B. Nielsenmy $no_user_cflags=0;
1286fceca8a3SJacques Vidrine
12873b4e3dcbSSimon L. B. Nielsenif ($flags ne "")	{ $cflags="$flags$cflags"; }
12883b4e3dcbSSimon L. B. Nielsenelse			{ $no_user_cflags=1;       }
128974664626SKris Kennaway
12905c87c606SMark Murray# Kerberos settings.  The flavor must be provided from outside, either through
12915c87c606SMark Murray# the script "config" or manually.
12923b4e3dcbSSimon L. B. Nielsenif (!$no_krb5)
12935c87c606SMark Murray	{
12945c87c606SMark Murray	my ($lresolv, $lpath, $lext);
12955c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
12965c87c606SMark Murray		{
12975c87c606SMark Murray		die "Sorry, Heimdal is currently not supported\n";
12985c87c606SMark Murray		}
12995c87c606SMark Murray	##### HACK to force use of Heimdal.
13005c87c606SMark Murray	##### WARNING: Since we don't really have adequate support for Heimdal,
13015c87c606SMark Murray	#####          using this will break the build.  You'll have to make
13025c87c606SMark Murray	#####          changes to the source, and if you do, please send
13035c87c606SMark Murray	#####          patches to openssl-dev@openssl.org
13045c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
13055c87c606SMark Murray		{
13065c87c606SMark Murray		warn "Heimdal isn't really supported.  Your build WILL break\n";
13075c87c606SMark Murray		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
13085c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/heimdal"
13095c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
13105c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
13115c87c606SMark Murray			"/lib -lgssapi -lkrb5 -lcom_err"
13123b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
13135c87c606SMark Murray		$cflags="-DKRB5_HEIMDAL $cflags";
13145c87c606SMark Murray		}
13155c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
13165c87c606SMark Murray		{
13175c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/kerberos"
13185c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
13195c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
13205c87c606SMark Murray			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
13213b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
13225c87c606SMark Murray		$cflags="-DKRB5_MIT $cflags";
13235c87c606SMark Murray		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
13245c87c606SMark Murray		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
13255c87c606SMark Murray			{
13265c87c606SMark Murray			$cflags="-DKRB5_MIT_OLD11 $cflags";
13275c87c606SMark Murray			}
13285c87c606SMark Murray		}
13295c87c606SMark Murray	LRESOLV:
13305c87c606SMark Murray	foreach $lpath ("/lib", "/usr/lib")
13315c87c606SMark Murray		{
13325c87c606SMark Murray		foreach $lext ("a", "so")
13335c87c606SMark Murray			{
13345c87c606SMark Murray			$lresolv = "$lpath/libresolv.$lext";
13355c87c606SMark Murray			last LRESOLV	if (-r "$lresolv");
13365c87c606SMark Murray			$lresolv = "";
13375c87c606SMark Murray			}
13385c87c606SMark Murray		}
13395c87c606SMark Murray	$withargs{"krb5-lib"} .= " -lresolv"
13405c87c606SMark Murray		if ("$lresolv" ne "");
13415c87c606SMark Murray	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
13425c87c606SMark Murray		if $withargs{"krb5-include"} eq "" &&
13435c87c606SMark Murray		   $withargs{"krb5-dir"} ne "";
13445c87c606SMark Murray	}
13455c87c606SMark Murray
1346ddd58736SKris Kennaway# The DSO code currently always implements all functions so that no
1347ddd58736SKris Kennaway# applications will have to worry about that from a compilation point
1348ddd58736SKris Kennaway# of view. However, the "method"s may return zero unless that platform
1349ddd58736SKris Kennaway# has support compiled in for them. Currently each method is enabled
1350ddd58736SKris Kennaway# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1351ddd58736SKris Kennaway# string entry into using the following logic;
1352ddd58736SKris Kennawaymy $dso_cflags;
1353ddd58736SKris Kennawayif (!$no_dso && $dso_scheme ne "")
1354ddd58736SKris Kennaway	{
1355ddd58736SKris Kennaway	$dso_scheme =~ tr/[a-z]/[A-Z]/;
1356ddd58736SKris Kennaway	if ($dso_scheme eq "DLFCN")
1357ddd58736SKris Kennaway		{
1358ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
1359ddd58736SKris Kennaway		}
1360ddd58736SKris Kennaway	elsif ($dso_scheme eq "DLFCN_NO_H")
1361ddd58736SKris Kennaway		{
1362ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN";
1363ddd58736SKris Kennaway		}
1364ddd58736SKris Kennaway	else
1365ddd58736SKris Kennaway		{
1366ddd58736SKris Kennaway		$dso_cflags = "-DDSO_$dso_scheme";
1367ddd58736SKris Kennaway		}
1368ddd58736SKris Kennaway	$cflags = "$dso_cflags $cflags";
1369ddd58736SKris Kennaway	}
1370ddd58736SKris Kennaway
137174664626SKris Kennawaymy $thread_cflags;
1372f579bf8eSKris Kennawaymy $thread_defines;
137374664626SKris Kennawayif ($thread_cflag ne "(unknown)" && !$no_threads)
137474664626SKris Kennaway	{
137574664626SKris Kennaway	# If we know how to do it, support threads by default.
137674664626SKris Kennaway	$threads = 1;
137774664626SKris Kennaway	}
13783b4e3dcbSSimon L. B. Nielsenif ($thread_cflag eq "(unknown)" && $threads)
137974664626SKris Kennaway	{
13803b4e3dcbSSimon L. B. Nielsen	# If the user asked for "threads", [s]he is also expected to
13813b4e3dcbSSimon L. B. Nielsen	# provide any system-dependent compiler options that are
13823b4e3dcbSSimon L. B. Nielsen	# necessary.
13833b4e3dcbSSimon L. B. Nielsen	if ($no_user_cflags)
13843b4e3dcbSSimon L. B. Nielsen		{
13853b4e3dcbSSimon L. B. Nielsen		print "You asked for multi-threading support, but didn't\n";
13863b4e3dcbSSimon L. B. Nielsen		print "provide any system-specific compiler options\n";
13873b4e3dcbSSimon L. B. Nielsen		exit(1);
13883b4e3dcbSSimon L. B. Nielsen		}
13895c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
13905c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
139174664626SKris Kennaway	}
139274664626SKris Kennawayelse
139374664626SKris Kennaway	{
13945c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
13955c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
1396f579bf8eSKris Kennaway#	my $def;
1397f579bf8eSKris Kennaway#	foreach $def (split ' ',$thread_cflag)
1398f579bf8eSKris Kennaway#		{
1399f579bf8eSKris Kennaway#		if ($def =~ s/^-D// && $def !~ /^_/)
1400f579bf8eSKris Kennaway#			{
1401f579bf8eSKris Kennaway#			$thread_defines .= "#define $def\n";
1402f579bf8eSKris Kennaway#			}
1403f579bf8eSKris Kennaway#		}
140474664626SKris Kennaway	}
140574664626SKris Kennaway
140674664626SKris Kennaway$lflags="$libs$lflags" if ($libs ne "");
140774664626SKris Kennaway
140874664626SKris Kennawayif ($no_asm)
140974664626SKris Kennaway	{
14107bded2dbSJung-uk Kim	$cpuid_obj=$bn_obj=$ec_obj=
14111f13597dSJung-uk Kim	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
14121f13597dSJung-uk Kim	$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
141374664626SKris Kennaway	}
141474664626SKris Kennaway
14155c87c606SMark Murrayif (!$no_shared)
14165c87c606SMark Murray	{
14175c87c606SMark Murray	$cast_obj="";	# CAST assembler is not PIC
14185c87c606SMark Murray	}
14195c87c606SMark Murray
142074664626SKris Kennawayif ($threads)
142174664626SKris Kennaway	{
142274664626SKris Kennaway	$cflags=$thread_cflags;
1423f579bf8eSKris Kennaway	$openssl_thread_defines .= $thread_defines;
142474664626SKris Kennaway	}
142574664626SKris Kennaway
14265c87c606SMark Murrayif ($zlib)
14275c87c606SMark Murray	{
14285c87c606SMark Murray	$cflags = "-DZLIB $cflags";
14293b4e3dcbSSimon L. B. Nielsen	if (defined($disabled{"zlib-dynamic"}))
14303b4e3dcbSSimon L. B. Nielsen		{
14311f13597dSJung-uk Kim		if (defined($withargs{"zlib-lib"}))
14321f13597dSJung-uk Kim			{
14331f13597dSJung-uk Kim			$lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
14341f13597dSJung-uk Kim			}
14351f13597dSJung-uk Kim		else
14361f13597dSJung-uk Kim			{
14373b4e3dcbSSimon L. B. Nielsen			$lflags = "$lflags -lz";
14383b4e3dcbSSimon L. B. Nielsen			}
14391f13597dSJung-uk Kim		}
14403b4e3dcbSSimon L. B. Nielsen	else
14413b4e3dcbSSimon L. B. Nielsen		{
14423b4e3dcbSSimon L. B. Nielsen		$cflags = "-DZLIB_SHARED $cflags";
14433b4e3dcbSSimon L. B. Nielsen		}
14445c87c606SMark Murray	}
14455c87c606SMark Murray
1446ddd58736SKris Kennaway# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
14475740a5e3SKris Kennawaymy $shared_mark = "";
14485c87c606SMark Murrayif ($shared_target eq "")
14495c87c606SMark Murray	{
14501f13597dSJung-uk Kim	$no_shared_warn = 1 if !$no_shared;
14515c87c606SMark Murray	$no_shared = 1;
14525c87c606SMark Murray	}
14535c87c606SMark Murrayif (!$no_shared)
14545740a5e3SKris Kennaway	{
1455ddd58736SKris Kennaway	if ($shared_cflag ne "")
1456ddd58736SKris Kennaway		{
14573b4e3dcbSSimon L. B. Nielsen		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
14583b4e3dcbSSimon L. B. Nielsen		}
14593b4e3dcbSSimon L. B. Nielsen	}
14603b4e3dcbSSimon L. B. Nielsen
14613b4e3dcbSSimon L. B. Nielsenif (!$IsMK1MF)
14623b4e3dcbSSimon L. B. Nielsen	{
14631f13597dSJung-uk Kim	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
14643b4e3dcbSSimon L. B. Nielsen	if ($no_shared)
14653b4e3dcbSSimon L. B. Nielsen		{
14663b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
14671f13597dSJung-uk Kim		$options.=" static-engine";
14683b4e3dcbSSimon L. B. Nielsen		}
14693b4e3dcbSSimon L. B. Nielsen	else
14703b4e3dcbSSimon L. B. Nielsen		{
14713b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
14721f13597dSJung-uk Kim		$options.=" no-static-engine";
14733b4e3dcbSSimon L. B. Nielsen		}
14743b4e3dcbSSimon L. B. Nielsen	}
14753b4e3dcbSSimon L. B. Nielsen
14761f13597dSJung-uk Kim$cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1477db522d3aSSimon L. B. Nielsen
1478db522d3aSSimon L. B. Nielsen#
1479db522d3aSSimon L. B. Nielsen# Platform fix-ups
1480db522d3aSSimon L. B. Nielsen#
1481db522d3aSSimon L. B. Nielsenif ($target =~ /\-icc$/)	# Intel C compiler
14823b4e3dcbSSimon L. B. Nielsen	{
1483db522d3aSSimon L. B. Nielsen	my $iccver=0;
1484db522d3aSSimon L. B. Nielsen	if (open(FD,"$cc -V 2>&1 |"))
1485db522d3aSSimon L. B. Nielsen		{
1486db522d3aSSimon L. B. Nielsen		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1487db522d3aSSimon L. B. Nielsen		close(FD);
1488db522d3aSSimon L. B. Nielsen		}
14893b4e3dcbSSimon L. B. Nielsen	if ($iccver>=8)
14903b4e3dcbSSimon L. B. Nielsen		{
14917bded2dbSJung-uk Kim		$cflags=~s/\-KPIC/-fPIC/;
14923b4e3dcbSSimon L. B. Nielsen		# Eliminate unnecessary dependency from libirc.a. This is
14933b4e3dcbSSimon L. B. Nielsen		# essential for shared library support, as otherwise
14943b4e3dcbSSimon L. B. Nielsen		# apps/openssl can end up in endless loop upon startup...
14953b4e3dcbSSimon L. B. Nielsen		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
14965740a5e3SKris Kennaway		}
1497db522d3aSSimon L. B. Nielsen	if ($iccver>=9)
1498db522d3aSSimon L. B. Nielsen		{
14997bded2dbSJung-uk Kim		$lflags.=" -i-static";
15007bded2dbSJung-uk Kim		$lflags=~s/\-no_cpprt/-no-cpprt/;
1501db522d3aSSimon L. B. Nielsen		}
1502db522d3aSSimon L. B. Nielsen	if ($iccver>=10)
1503db522d3aSSimon L. B. Nielsen		{
15047bded2dbSJung-uk Kim		$lflags=~s/\-i\-static/-static-intel/;
15057bded2dbSJung-uk Kim		}
15067bded2dbSJung-uk Kim	if ($iccver>=11)
15077bded2dbSJung-uk Kim		{
15087bded2dbSJung-uk Kim		$cflags.=" -no-intel-extensions";	# disable Cilk
15097bded2dbSJung-uk Kim		$lflags=~s/\-no\-cpprt/-no-cxxlib/;
1510db522d3aSSimon L. B. Nielsen		}
1511db522d3aSSimon L. B. Nielsen	}
1512db522d3aSSimon L. B. Nielsen
1513db522d3aSSimon L. B. Nielsen# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1514db522d3aSSimon L. B. Nielsen# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1515db522d3aSSimon L. B. Nielsen# .so objects. Apparently application RPATH is not global and does
1516db522d3aSSimon L. B. Nielsen# not apply to .so linked with other .so. Problem manifests itself
1517db522d3aSSimon L. B. Nielsen# when libssl.so fails to load libcrypto.so. One can argue that we
1518db522d3aSSimon L. B. Nielsen# should engrave this into Makefile.shared rules or into BSD-* config
1519db522d3aSSimon L. B. Nielsen# lines above. Meanwhile let's try to be cautious and pass -rpath to
1520db522d3aSSimon L. B. Nielsen# linker only when --prefix is not /usr.
1521db522d3aSSimon L. B. Nielsenif ($target =~ /^BSD\-/)
1522db522d3aSSimon L. B. Nielsen	{
15238180e704SJung-uk Kim	$shared_ldflag.=" -Wl,-rpath,\$\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1524ddd58736SKris Kennaway	}
15255c87c606SMark Murray
15265c87c606SMark Murrayif ($sys_id ne "")
1527de7cdddaSKris Kennaway	{
15283b4e3dcbSSimon L. B. Nielsen	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
15295c87c606SMark Murray	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
1530de7cdddaSKris Kennaway	}
1531ddd58736SKris Kennaway
15325740a5e3SKris Kennawayif ($ranlib eq "")
15335740a5e3SKris Kennaway	{
15345740a5e3SKris Kennaway	$ranlib = $default_ranlib;
15355740a5e3SKris Kennaway	}
15365740a5e3SKris Kennaway
153774664626SKris Kennaway#my ($bn1)=split(/\s+/,$bn_obj);
153874664626SKris Kennaway#$bn1 = "" unless defined $bn1;
153974664626SKris Kennaway#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
154074664626SKris Kennaway#$bn_obj="$bn1";
154174664626SKris Kennaway
15423b4e3dcbSSimon L. B. Nielsen$cpuid_obj="" if ($processor eq "386");
154374664626SKris Kennaway
15443b4e3dcbSSimon L. B. Nielsen$bn_obj = $bn_asm unless $bn_obj ne "";
15451f13597dSJung-uk Kim# bn-586 is the only one implementing bn_*_part_words
15461f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
15471f13597dSJung-uk Kim$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
15483b4e3dcbSSimon L. B. Nielsen
15491f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
15501f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
15511f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
1552db522d3aSSimon L. B. Nielsen
1553db522d3aSSimon L. B. Nielsenif ($fips)
1554db522d3aSSimon L. B. Nielsen	{
1555db522d3aSSimon L. B. Nielsen	$openssl_other_defines.="#define OPENSSL_FIPS\n";
15561f13597dSJung-uk Kim	$cflags .= " -I\$(FIPSDIR)/include";
1557db522d3aSSimon L. B. Nielsen	}
1558db522d3aSSimon L. B. Nielsen
15591f13597dSJung-uk Kim$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
15603b4e3dcbSSimon L. B. Nielsen$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
156174664626SKris Kennaway$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
156274664626SKris Kennaway$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
156374664626SKris Kennaway$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
1564aeb5019cSJung-uk Kimif ($rc4_obj =~ /\.o$/)
1565aeb5019cSJung-uk Kim	{
1566aeb5019cSJung-uk Kim	$cflags.=" -DRC4_ASM";
1567aeb5019cSJung-uk Kim	}
1568aeb5019cSJung-uk Kimelse
1569aeb5019cSJung-uk Kim	{
1570aeb5019cSJung-uk Kim	$rc4_obj=$rc4_enc;
1571aeb5019cSJung-uk Kim	}
15723b4e3dcbSSimon L. B. Nielsenif ($sha1_obj =~ /\.o$/)
157374664626SKris Kennaway	{
157474664626SKris Kennaway#	$sha1_obj=$sha1_enc;
15753b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
15763b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
15773b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1578db522d3aSSimon L. B. Nielsen	if ($sha1_obj =~ /sse2/)
15793b4e3dcbSSimon L. B. Nielsen	    {	if ($no_sse2)
15803b4e3dcbSSimon L. B. Nielsen		{   $sha1_obj =~ s/\S*sse2\S+//;        }
15813b4e3dcbSSimon L. B. Nielsen		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
15823b4e3dcbSSimon L. B. Nielsen		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
15833b4e3dcbSSimon L. B. Nielsen	    }
158474664626SKris Kennaway	}
158574664626SKris Kennawayif ($md5_obj =~ /\.o$/)
158674664626SKris Kennaway	{
158774664626SKris Kennaway#	$md5_obj=$md5_enc;
158874664626SKris Kennaway	$cflags.=" -DMD5_ASM";
158974664626SKris Kennaway	}
159074664626SKris Kennawayif ($rmd160_obj =~ /\.o$/)
159174664626SKris Kennaway	{
159274664626SKris Kennaway#	$rmd160_obj=$rmd160_enc;
159374664626SKris Kennaway	$cflags.=" -DRMD160_ASM";
159474664626SKris Kennaway	}
15953b4e3dcbSSimon L. B. Nielsenif ($aes_obj =~ /\.o$/)
15966be8ae07SJacques Vidrine	{
15977bded2dbSJung-uk Kim	$cflags.=" -DAES_ASM" if ($aes_obj =~ m/\baes\-/);;
15981f13597dSJung-uk Kim	# aes-ctr.o is not a real file, only indication that assembler
15991f13597dSJung-uk Kim	# module implements AES_ctr32_encrypt...
16001f13597dSJung-uk Kim	$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
16011f13597dSJung-uk Kim	# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
16021f13597dSJung-uk Kim	$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
16031f13597dSJung-uk Kim	$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
16041f13597dSJung-uk Kim	$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
16051f13597dSJung-uk Kim	$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
16063b4e3dcbSSimon L. B. Nielsen	}
16073b4e3dcbSSimon L. B. Nielsenelse	{
16083b4e3dcbSSimon L. B. Nielsen	$aes_obj=$aes_enc;
16096be8ae07SJacques Vidrine	}
16101f13597dSJung-uk Kim$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
16111f13597dSJung-uk Kimif ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
16121f13597dSJung-uk Kim	{
16131f13597dSJung-uk Kim	$cflags.=" -DWHIRLPOOL_ASM";
16141f13597dSJung-uk Kim	}
16151f13597dSJung-uk Kimelse	{
16161f13597dSJung-uk Kim	$wp_obj="wp_block.o";
16171f13597dSJung-uk Kim	}
16181f13597dSJung-uk Kim$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
16197bded2dbSJung-uk Kimif ($modes_obj =~ /ghash\-/)
16201f13597dSJung-uk Kim	{
16211f13597dSJung-uk Kim	$cflags.=" -DGHASH_ASM";
16221f13597dSJung-uk Kim	}
16237bded2dbSJung-uk Kimif ($ec_obj =~ /ecp_nistz256/)
16247bded2dbSJung-uk Kim	{
16257bded2dbSJung-uk Kim	$cflags.=" -DECP_NISTZ256_ASM";
16267bded2dbSJung-uk Kim	}
16276be8ae07SJacques Vidrine
16284f20a5a2SJacques Vidrine# "Stringify" the C flags string.  This permits it to be made part of a string
16294f20a5a2SJacques Vidrine# and works as well on command lines.
16304f20a5a2SJacques Vidrine$cflags =~ s/([\\\"])/\\\1/g;
16314f20a5a2SJacques Vidrine
163274664626SKris Kennawaymy $version = "unknown";
16333b4e3dcbSSimon L. B. Nielsenmy $version_num = "unknown";
163474664626SKris Kennawaymy $major = "unknown";
163574664626SKris Kennawaymy $minor = "unknown";
1636ddd58736SKris Kennawaymy $shlib_version_number = "unknown";
1637ddd58736SKris Kennawaymy $shlib_version_history = "unknown";
1638ddd58736SKris Kennawaymy $shlib_major = "unknown";
1639ddd58736SKris Kennawaymy $shlib_minor = "unknown";
164074664626SKris Kennaway
164174664626SKris Kennawayopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
164274664626SKris Kennawaywhile (<IN>)
164374664626SKris Kennaway	{
164474664626SKris Kennaway	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
16453b4e3dcbSSimon L. B. Nielsen	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
1646ddd58736SKris Kennaway	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
1647ddd58736SKris Kennaway	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
164874664626SKris Kennaway	}
164974664626SKris Kennawayclose(IN);
1650ddd58736SKris Kennawayif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
165174664626SKris Kennaway
165274664626SKris Kennawayif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
165374664626SKris Kennaway	{
165474664626SKris Kennaway	$major=$1;
165574664626SKris Kennaway	$minor=$2;
165674664626SKris Kennaway	}
165774664626SKris Kennaway
1658ddd58736SKris Kennawayif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
1659ddd58736SKris Kennaway	{
1660ddd58736SKris Kennaway	$shlib_major=$1;
1661ddd58736SKris Kennaway	$shlib_minor=$2;
1662ddd58736SKris Kennaway	}
1663ddd58736SKris Kennaway
1664*dee36b4fSJung-uk Kimmy %predefined;
1665*dee36b4fSJung-uk Kim
1666*dee36b4fSJung-uk Kim# collect compiler pre-defines from gcc or gcc-alike...
1667*dee36b4fSJung-uk Kimopen(PIPE, "$cross_compile_prefix$cc -dM -E -x c /dev/null 2>&1 |");
1668*dee36b4fSJung-uk Kimwhile (<PIPE>) {
1669*dee36b4fSJung-uk Kim  m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last;
1670*dee36b4fSJung-uk Kim  $predefined{$1} = defined($2) ? $2 : "";
1671*dee36b4fSJung-uk Kim}
1672*dee36b4fSJung-uk Kimclose(PIPE);
167380815a77SJung-uk Kim
167480815a77SJung-uk Kimif ($strict_warnings)
167580815a77SJung-uk Kim	{
16766a599222SSimon L. B. Nielsen	my $wopt;
1677*dee36b4fSJung-uk Kim	die "ERROR --strict-warnings requires gcc or clang" unless defined($predefined{__GNUC__});
16786a599222SSimon L. B. Nielsen	foreach $wopt (split /\s+/, $gcc_devteam_warn)
16796a599222SSimon L. B. Nielsen		{
168080815a77SJung-uk Kim		$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
16816a599222SSimon L. B. Nielsen		}
1682*dee36b4fSJung-uk Kim	if (defined($predefined{__clang__}))
16837bded2dbSJung-uk Kim		{
16847bded2dbSJung-uk Kim		foreach $wopt (split /\s+/, $clang_devteam_warn)
16857bded2dbSJung-uk Kim			{
168680815a77SJung-uk Kim			$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
16877bded2dbSJung-uk Kim			}
16887bded2dbSJung-uk Kim		}
16896a599222SSimon L. B. Nielsen	}
16906a599222SSimon L. B. Nielsen
169174664626SKris Kennawayopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
16925c87c606SMark Murrayunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
16935c87c606SMark Murrayopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
1694f579bf8eSKris Kennawayprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
169574664626SKris Kennawaymy $sdirs=0;
169674664626SKris Kennawaywhile (<IN>)
169774664626SKris Kennaway	{
16983b4e3dcbSSimon L. B. Nielsen	chomp;
169974664626SKris Kennaway	$sdirs = 1 if /^SDIRS=/;
170074664626SKris Kennaway	if ($sdirs) {
170174664626SKris Kennaway		my $dir;
170274664626SKris Kennaway		foreach $dir (@skip) {
17031f13597dSJung-uk Kim			s/(\s)$dir /$1/;
1704db522d3aSSimon L. B. Nielsen			s/\s$dir$//;
170574664626SKris Kennaway			}
170674664626SKris Kennaway		}
170774664626SKris Kennaway	$sdirs = 0 unless /\\$/;
1708db522d3aSSimon L. B. Nielsen        s/engines // if (/^DIRS=/ && $disabled{"engine"});
17091f13597dSJung-uk Kim	s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"});
171074664626SKris Kennaway	s/^VERSION=.*/VERSION=$version/;
171174664626SKris Kennaway	s/^MAJOR=.*/MAJOR=$major/;
171274664626SKris Kennaway	s/^MINOR=.*/MINOR=$minor/;
1713ddd58736SKris Kennaway	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
1714ddd58736SKris Kennaway	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
1715ddd58736SKris Kennaway	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
1716ddd58736SKris Kennaway	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
17175740a5e3SKris Kennaway	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
171874664626SKris Kennaway	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
17191f13597dSJung-uk Kim	s/^MULTILIB=.*$/MULTILIB=$multilib/;
172074664626SKris Kennaway	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
17216a599222SSimon L. B. Nielsen	s/^LIBDIR=.*$/LIBDIR=$libdir/;
172274664626SKris Kennaway	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
172374664626SKris Kennaway	s/^PLATFORM=.*$/PLATFORM=$target/;
172474664626SKris Kennaway	s/^OPTIONS=.*$/OPTIONS=$options/;
1725ddd58736SKris Kennaway	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
17266a599222SSimon L. B. Nielsen	if ($cross_compile_prefix)
17276a599222SSimon L. B. Nielsen		{
17286a599222SSimon L. B. Nielsen		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
17296a599222SSimon L. B. Nielsen		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
17301f13597dSJung-uk Kim		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
17316a599222SSimon L. B. Nielsen		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
1732aeb5019cSJung-uk Kim		s/^RC=\s*/RC= \$\(CROSS_COMPILE\)/;
1733*dee36b4fSJung-uk Kim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $predefined{__GNUC__} >= 3;
17346a599222SSimon L. B. Nielsen		}
17356a599222SSimon L. B. Nielsen	else	{
173674664626SKris Kennaway		s/^CC=.*$/CC= $cc/;
17376a599222SSimon L. B. Nielsen		s/^AR=\s*ar/AR= $ar/;
17386a599222SSimon L. B. Nielsen		s/^RANLIB=.*/RANLIB= $ranlib/;
1739aeb5019cSJung-uk Kim		s/^RC=.*/RC= $windres/;
1740*dee36b4fSJung-uk Kim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $predefined{__GNUC__} >= 3;
17411f13597dSJung-uk Kim		}
174274664626SKris Kennaway	s/^CFLAG=.*$/CFLAG= $cflags/;
174374664626SKris Kennaway	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1744db522d3aSSimon L. B. Nielsen	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
174574664626SKris Kennaway	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
17465740a5e3SKris Kennaway	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
17473b4e3dcbSSimon L. B. Nielsen	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
174874664626SKris Kennaway	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
17497bded2dbSJung-uk Kim	s/^EC_ASM=.*$/EC_ASM= $ec_obj/;
175074664626SKris Kennaway	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
17511f13597dSJung-uk Kim	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
175274664626SKris Kennaway	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
175374664626SKris Kennaway	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
175474664626SKris Kennaway	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
175574664626SKris Kennaway	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
175674664626SKris Kennaway	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
175774664626SKris Kennaway	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
175874664626SKris Kennaway	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
17591f13597dSJung-uk Kim	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
17601f13597dSJung-uk Kim	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
17611f13597dSJung-uk Kim	s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
17621f13597dSJung-uk Kim	s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
17631f13597dSJung-uk Kim	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
176474664626SKris Kennaway	s/^PROCESSOR=.*/PROCESSOR= $processor/;
17655c87c606SMark Murray	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
176674664626SKris Kennaway	s/^PERL=.*/PERL= $perl/;
17675c87c606SMark Murray	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1768fceca8a3SJacques Vidrine	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
17693b4e3dcbSSimon L. B. Nielsen	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
17703b4e3dcbSSimon L. B. Nielsen	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
17711f13597dSJung-uk Kim
17721f13597dSJung-uk Kim	s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
1773db522d3aSSimon L. B. Nielsen	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1774db522d3aSSimon L. B. Nielsen	s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1775db522d3aSSimon L. B. Nielsen	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
17761f13597dSJung-uk Kim
1777ddd58736SKris Kennaway	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
17785740a5e3SKris Kennaway	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
17791f13597dSJung-uk Kim	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
1780a21b1b38SKris Kennaway	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
1781a21b1b38SKris Kennaway		{
1782a21b1b38SKris Kennaway		my $sotmp = $1;
17834f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
17844f20a5a2SJacques Vidrine		}
17854f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
17864f20a5a2SJacques Vidrine		{
17874f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1788a21b1b38SKris Kennaway		}
1789a21b1b38SKris Kennaway	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
1790a21b1b38SKris Kennaway		{
1791a21b1b38SKris Kennaway		my $sotmp = $1;
1792a21b1b38SKris Kennaway		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
1793a21b1b38SKris Kennaway		}
17944f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
17954f20a5a2SJacques Vidrine		{
17964f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
17974f20a5a2SJacques Vidrine		}
1798c1803d78SJacques Vidrine	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
179974664626SKris Kennaway	print OUT $_."\n";
180074664626SKris Kennaway	}
180174664626SKris Kennawayclose(IN);
180274664626SKris Kennawayclose(OUT);
18036cf8931aSJung-uk Kimif ((compare($Makefile, "$Makefile.new"))
18046cf8931aSJung-uk Kim	or file_newer('Configure', $Makefile)
18056cf8931aSJung-uk Kim	or file_newer('config', $Makefile)
18066cf8931aSJung-uk Kim	or file_newer('Makefile.org', $Makefile))
18076cf8931aSJung-uk Kim	{
18085c87c606SMark Murray	rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
18095c87c606SMark Murray	rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
18106cf8931aSJung-uk Kim	}
18116cf8931aSJung-uk Kimelse
18126cf8931aSJung-uk Kim	{ unlink("$Makefile.new"); }
181374664626SKris Kennaway
181474664626SKris Kennawayprint "CC            =$cc\n";
181574664626SKris Kennawayprint "CFLAG         =$cflags\n";
181674664626SKris Kennawayprint "EX_LIBS       =$lflags\n";
18173b4e3dcbSSimon L. B. Nielsenprint "CPUID_OBJ     =$cpuid_obj\n";
181874664626SKris Kennawayprint "BN_ASM        =$bn_obj\n";
18197bded2dbSJung-uk Kimprint "EC_ASM        =$ec_obj\n";
182074664626SKris Kennawayprint "DES_ENC       =$des_obj\n";
18211f13597dSJung-uk Kimprint "AES_ENC       =$aes_obj\n";
182274664626SKris Kennawayprint "BF_ENC        =$bf_obj\n";
182374664626SKris Kennawayprint "CAST_ENC      =$cast_obj\n";
182474664626SKris Kennawayprint "RC4_ENC       =$rc4_obj\n";
182574664626SKris Kennawayprint "RC5_ENC       =$rc5_obj\n";
182674664626SKris Kennawayprint "MD5_OBJ_ASM   =$md5_obj\n";
182774664626SKris Kennawayprint "SHA1_OBJ_ASM  =$sha1_obj\n";
182874664626SKris Kennawayprint "RMD160_OBJ_ASM=$rmd160_obj\n";
18291f13597dSJung-uk Kimprint "CMLL_ENC      =$cmll_obj\n";
18301f13597dSJung-uk Kimprint "MODES_OBJ     =$modes_obj\n";
18311f13597dSJung-uk Kimprint "ENGINES_OBJ   =$engines_obj\n";
183274664626SKris Kennawayprint "PROCESSOR     =$processor\n";
183374664626SKris Kennawayprint "RANLIB        =$ranlib\n";
18345c87c606SMark Murrayprint "ARFLAGS       =$arflags\n";
183574664626SKris Kennawayprint "PERL          =$perl\n";
18365c87c606SMark Murrayprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
18375c87c606SMark Murray	if $withargs{"krb5-include"} ne "";
183874664626SKris Kennaway
183974664626SKris Kennawaymy $des_ptr=0;
184074664626SKris Kennawaymy $des_risc1=0;
184174664626SKris Kennawaymy $des_risc2=0;
184274664626SKris Kennawaymy $des_unroll=0;
184374664626SKris Kennawaymy $bn_ll=0;
184474664626SKris Kennawaymy $def_int=2;
184574664626SKris Kennawaymy $rc4_int=$def_int;
184674664626SKris Kennawaymy $md2_int=$def_int;
184774664626SKris Kennawaymy $idea_int=$def_int;
184874664626SKris Kennawaymy $rc2_int=$def_int;
184974664626SKris Kennawaymy $rc4_idx=0;
1850f579bf8eSKris Kennawaymy $rc4_chunk=0;
185174664626SKris Kennawaymy $bf_ptr=0;
185274664626SKris Kennawaymy @type=("char","short","int","long");
185374664626SKris Kennawaymy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
18545c87c606SMark Murraymy $export_var_as_fn=0;
185574664626SKris Kennaway
185674664626SKris Kennawaymy $des_int;
185774664626SKris Kennaway
185874664626SKris Kennawayforeach (sort split(/\s+/,$bn_ops))
185974664626SKris Kennaway	{
186074664626SKris Kennaway	$des_ptr=1 if /DES_PTR/;
186174664626SKris Kennaway	$des_risc1=1 if /DES_RISC1/;
186274664626SKris Kennaway	$des_risc2=1 if /DES_RISC2/;
186374664626SKris Kennaway	$des_unroll=1 if /DES_UNROLL/;
186474664626SKris Kennaway	$des_int=1 if /DES_INT/;
186574664626SKris Kennaway	$bn_ll=1 if /BN_LLONG/;
186674664626SKris Kennaway	$rc4_int=0 if /RC4_CHAR/;
186774664626SKris Kennaway	$rc4_int=3 if /RC4_LONG/;
186874664626SKris Kennaway	$rc4_idx=1 if /RC4_INDEX/;
1869f579bf8eSKris Kennaway	$rc4_chunk=1 if /RC4_CHUNK/;
1870f579bf8eSKris Kennaway	$rc4_chunk=2 if /RC4_CHUNK_LL/;
187174664626SKris Kennaway	$md2_int=0 if /MD2_CHAR/;
187274664626SKris Kennaway	$md2_int=3 if /MD2_LONG/;
187374664626SKris Kennaway	$idea_int=1 if /IDEA_SHORT/;
187474664626SKris Kennaway	$idea_int=3 if /IDEA_LONG/;
187574664626SKris Kennaway	$rc2_int=1 if /RC2_SHORT/;
187674664626SKris Kennaway	$rc2_int=3 if /RC2_LONG/;
187774664626SKris Kennaway	$bf_ptr=1 if $_ eq "BF_PTR";
187874664626SKris Kennaway	$bf_ptr=2 if $_ eq "BF_PTR2";
187974664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
188074664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
188174664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
188274664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
188374664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
18845c87c606SMark Murray	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
188574664626SKris Kennaway	}
188674664626SKris Kennaway
188774664626SKris Kennawayopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
18885c87c606SMark Murrayunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
18895c87c606SMark Murrayopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
1890f579bf8eSKris Kennawayprint OUT "/* opensslconf.h */\n";
1891f579bf8eSKris Kennawayprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
1892f579bf8eSKris Kennaway
1893fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
1894fa5fddf1SJung-uk Kimprint OUT "extern \"C\" {\n";
1895fa5fddf1SJung-uk Kimprint OUT "#endif\n";
1896f579bf8eSKris Kennawayprint OUT "/* OpenSSL was configured with the following options: */\n";
18975c87c606SMark Murraymy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1898db522d3aSSimon L. B. Nielsen$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n#  define OPENSSL_NO_$1\n# endif\n#endif/mg;
18995c87c606SMark Murray$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1900f579bf8eSKris Kennaway$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1901f579bf8eSKris Kennaway$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1902f579bf8eSKris Kennaway$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
19035c87c606SMark Murray$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1904f579bf8eSKris Kennaway$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
19055c87c606SMark Murrayprint OUT $openssl_sys_defines;
19065c87c606SMark Murrayprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1907db522d3aSSimon L. B. Nielsenprint OUT $openssl_experimental_defines;
1908db522d3aSSimon L. B. Nielsenprint OUT "\n";
19095c87c606SMark Murrayprint OUT $openssl_algorithm_defines;
1910db522d3aSSimon L. B. Nielsenprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
19115c87c606SMark Murrayprint OUT $openssl_thread_defines;
19125c87c606SMark Murrayprint OUT $openssl_other_defines,"\n";
19135c87c606SMark Murray
19145c87c606SMark Murrayprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
19155c87c606SMark Murrayprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
19165c87c606SMark Murrayprint OUT "   who haven't had the time to do the appropriate changes in their\n";
19175c87c606SMark Murrayprint OUT "   applications.  */\n";
19185c87c606SMark Murrayprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
19195c87c606SMark Murrayprint OUT $openssl_algorithm_defines_trans;
19205c87c606SMark Murrayprint OUT "#endif\n\n";
1921f579bf8eSKris Kennaway
19221f13597dSJung-uk Kimprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
19233b4e3dcbSSimon L. B. Nielsen
192474664626SKris Kennawaywhile (<IN>)
192574664626SKris Kennaway	{
192674664626SKris Kennaway	if	(/^#define\s+OPENSSLDIR/)
19276a599222SSimon L. B. Nielsen		{
19286a599222SSimon L. B. Nielsen		my $foo = $openssldir;
19296a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
19306a599222SSimon L. B. Nielsen		print OUT "#define OPENSSLDIR \"$foo\"\n";
19316a599222SSimon L. B. Nielsen		}
19323b4e3dcbSSimon L. B. Nielsen	elsif	(/^#define\s+ENGINESDIR/)
19336a599222SSimon L. B. Nielsen		{
19341f13597dSJung-uk Kim		my $foo = "$prefix/$libdir/engines";
19356a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
19366a599222SSimon L. B. Nielsen		print OUT "#define ENGINESDIR \"$foo\"\n";
19376a599222SSimon L. B. Nielsen		}
19385c87c606SMark Murray	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
19395c87c606SMark Murray		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
19405c87c606SMark Murray			if $export_var_as_fn;
19415c87c606SMark Murray		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
19425c87c606SMark Murray			($export_var_as_fn)?"define":"undef"; }
194374664626SKris Kennaway	elsif	(/^#define\s+OPENSSL_UNISTD/)
194474664626SKris Kennaway		{
194574664626SKris Kennaway		$unistd = "<unistd.h>" if $unistd eq "";
194674664626SKris Kennaway		print OUT "#define OPENSSL_UNISTD $unistd\n";
194774664626SKris Kennaway		}
194874664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
194974664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
195074664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
195174664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
195274664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
195374664626SKris Kennaway		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
195474664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
195574664626SKris Kennaway		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
195674664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
195774664626SKris Kennaway		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
195874664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
195974664626SKris Kennaway		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
196074664626SKris Kennaway	elsif	(/^\#define\s+DES_LONG\s+.*/)
196174664626SKris Kennaway		{ printf OUT "#define DES_LONG unsigned %s\n",
196274664626SKris Kennaway			($des_int)?'int':'long'; }
196374664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_PTR/)
196474664626SKris Kennaway		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
196574664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC1/)
196674664626SKris Kennaway		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
196774664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC2/)
196874664626SKris Kennaway		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
196974664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
197074664626SKris Kennaway		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
197174664626SKris Kennaway	elsif	(/^#define\s+RC4_INT\s/)
197274664626SKris Kennaway		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
1973f579bf8eSKris Kennaway	elsif	(/^#undef\s+RC4_CHUNK/)
1974f579bf8eSKris Kennaway		{
1975f579bf8eSKris Kennaway		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
1976f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
1977f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
1978f579bf8eSKris Kennaway		}
197974664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
198074664626SKris Kennaway		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
198174664626SKris Kennaway	elsif (/^#(define|undef)\s+I386_ONLY/)
19823b4e3dcbSSimon L. B. Nielsen		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
198374664626SKris Kennaway			"define":"undef"; }
198474664626SKris Kennaway	elsif	(/^#define\s+MD2_INT\s/)
198574664626SKris Kennaway		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
198674664626SKris Kennaway	elsif	(/^#define\s+IDEA_INT\s/)
198774664626SKris Kennaway		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
198874664626SKris Kennaway	elsif	(/^#define\s+RC2_INT\s/)
198974664626SKris Kennaway		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
199074664626SKris Kennaway	elsif (/^#(define|undef)\s+BF_PTR/)
199174664626SKris Kennaway		{
199274664626SKris Kennaway		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
199374664626SKris Kennaway		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
199474664626SKris Kennaway		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
199574664626SKris Kennaway	        }
199674664626SKris Kennaway	else
199774664626SKris Kennaway		{ print OUT $_; }
199874664626SKris Kennaway	}
199974664626SKris Kennawayclose(IN);
2000fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
2001fa5fddf1SJung-uk Kimprint OUT "}\n";
2002fa5fddf1SJung-uk Kimprint OUT "#endif\n";
200374664626SKris Kennawayclose(OUT);
20046cf8931aSJung-uk Kimif (compare("crypto/opensslconf.h.new","crypto/opensslconf.h"))
20056cf8931aSJung-uk Kim	{
20065c87c606SMark Murray	rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
20075c87c606SMark Murray	rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
20086cf8931aSJung-uk Kim	}
20096cf8931aSJung-uk Kimelse
20106cf8931aSJung-uk Kim	{ unlink("crypto/opensslconf.h.new"); }
201174664626SKris Kennaway
201274664626SKris Kennaway# Fix the date
201374664626SKris Kennaway
201474664626SKris Kennawayprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
201574664626SKris Kennawayprint "SIXTY_FOUR_BIT mode\n" if $b64;
201674664626SKris Kennawayprint "THIRTY_TWO_BIT mode\n" if $b32;
201774664626SKris Kennawayprint "SIXTEEN_BIT mode\n" if $b16;
201874664626SKris Kennawayprint "EIGHT_BIT mode\n" if $b8;
201974664626SKris Kennawayprint "DES_PTR used\n" if $des_ptr;
202074664626SKris Kennawayprint "DES_RISC1 used\n" if $des_risc1;
202174664626SKris Kennawayprint "DES_RISC2 used\n" if $des_risc2;
202274664626SKris Kennawayprint "DES_UNROLL used\n" if $des_unroll;
202374664626SKris Kennawayprint "DES_INT used\n" if $des_int;
202474664626SKris Kennawayprint "BN_LLONG mode\n" if $bn_ll;
202574664626SKris Kennawayprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
202674664626SKris Kennawayprint "RC4_INDEX mode\n" if $rc4_idx;
2027f579bf8eSKris Kennawayprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
2028f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
2029f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
203074664626SKris Kennawayprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
203174664626SKris Kennawayprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
203274664626SKris Kennawayprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
203374664626SKris Kennawayprint "BF_PTR used\n" if $bf_ptr == 1;
203474664626SKris Kennawayprint "BF_PTR2 used\n" if $bf_ptr == 2;
203574664626SKris Kennaway
20363b4e3dcbSSimon L. B. Nielsenif($IsMK1MF) {
203774664626SKris Kennaway	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
203874664626SKris Kennaway	printf OUT <<EOF;
203974664626SKris Kennaway#ifndef MK1MF_BUILD
204074664626SKris Kennaway  /* auto-generated by Configure for crypto/cversion.c:
20413b4e3dcbSSimon L. B. Nielsen   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
204274664626SKris Kennaway   * Windows builds (and other mk1mf builds) compile cversion.c with
204374664626SKris Kennaway   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
204474664626SKris Kennaway  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
204574664626SKris Kennaway#endif
204674664626SKris KennawayEOF
204774664626SKris Kennaway	close(OUT);
204874664626SKris Kennaway} else {
20496a599222SSimon L. B. Nielsen	my $make_command = "$make PERL=\'$perl\'";
2050ed7112f0SJung-uk Kim	my @make_targets = ();
2051ed7112f0SJung-uk Kim	push @make_targets, "links" if $symlink;
2052ed7112f0SJung-uk Kim	push @make_targets, "depend" if $depflags ne $default_depflags && $make_depend;
2053ed7112f0SJung-uk Kim	push @make_targets, "gentests" if $symlink;
2054ed7112f0SJung-uk Kim	foreach my $make_target (@make_targets) {
2055ed7112f0SJung-uk Kim	    (system "$make_command $make_target") == 0 or exit $?;
2056ed7112f0SJung-uk Kim	}
205774664626SKris Kennaway	if ( $perl =~ m@^/@) {
2058a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
2059f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
206074664626SKris Kennaway	} else {
206174664626SKris Kennaway	    # No path for Perl known ...
2062a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
2063f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
206474664626SKris Kennaway	}
20653b4e3dcbSSimon L. B. Nielsen	if ($depflags ne $default_depflags && !$make_depend) {
20668180e704SJung-uk Kim	    $warn_make_depend++;
20675c87c606SMark Murray	}
206874664626SKris Kennaway}
206974664626SKris Kennaway
20703b4e3dcbSSimon L. B. Nielsen# create the ms/version32.rc file if needed
2071db522d3aSSimon L. B. Nielsenif ($IsMK1MF && ($target !~ /^netware/)) {
20723b4e3dcbSSimon L. B. Nielsen	my ($v1, $v2, $v3, $v4);
20733b4e3dcbSSimon L. B. Nielsen	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
20743b4e3dcbSSimon L. B. Nielsen		$v1=hex $1;
20753b4e3dcbSSimon L. B. Nielsen		$v2=hex $2;
20763b4e3dcbSSimon L. B. Nielsen		$v3=hex $3;
20773b4e3dcbSSimon L. B. Nielsen		$v4=hex $4;
20783b4e3dcbSSimon L. B. Nielsen	}
20793b4e3dcbSSimon L. B. Nielsen	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
20803b4e3dcbSSimon L. B. Nielsen	print OUT <<EOF;
20813b4e3dcbSSimon L. B. Nielsen#include <winver.h>
20823b4e3dcbSSimon L. B. Nielsen
20833b4e3dcbSSimon L. B. NielsenLANGUAGE 0x09,0x01
20843b4e3dcbSSimon L. B. Nielsen
20853b4e3dcbSSimon L. B. Nielsen1 VERSIONINFO
20863b4e3dcbSSimon L. B. Nielsen  FILEVERSION $v1,$v2,$v3,$v4
20873b4e3dcbSSimon L. B. Nielsen  PRODUCTVERSION $v1,$v2,$v3,$v4
20883b4e3dcbSSimon L. B. Nielsen  FILEFLAGSMASK 0x3fL
20893b4e3dcbSSimon L. B. Nielsen#ifdef _DEBUG
20903b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x01L
20913b4e3dcbSSimon L. B. Nielsen#else
20923b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x00L
20933b4e3dcbSSimon L. B. Nielsen#endif
20943b4e3dcbSSimon L. B. Nielsen  FILEOS VOS__WINDOWS32
20953b4e3dcbSSimon L. B. Nielsen  FILETYPE VFT_DLL
20963b4e3dcbSSimon L. B. Nielsen  FILESUBTYPE 0x0L
20973b4e3dcbSSimon L. B. NielsenBEGIN
20983b4e3dcbSSimon L. B. Nielsen    BLOCK "StringFileInfo"
20993b4e3dcbSSimon L. B. Nielsen    BEGIN
21003b4e3dcbSSimon L. B. Nielsen	BLOCK "040904b0"
21013b4e3dcbSSimon L. B. Nielsen	BEGIN
21023b4e3dcbSSimon L. B. Nielsen	    // Required:
21033b4e3dcbSSimon L. B. Nielsen	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
21043b4e3dcbSSimon L. B. Nielsen	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
21053b4e3dcbSSimon L. B. Nielsen	    VALUE "FileVersion", "$version\\0"
21063b4e3dcbSSimon L. B. Nielsen#if defined(CRYPTO)
21073b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "libeay32\\0"
21083b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "libeay32.dll\\0"
21093b4e3dcbSSimon L. B. Nielsen#elif defined(SSL)
21103b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "ssleay32\\0"
21113b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "ssleay32.dll\\0"
21123b4e3dcbSSimon L. B. Nielsen#endif
21133b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
21143b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductVersion", "$version\\0"
21153b4e3dcbSSimon L. B. Nielsen	    // Optional:
21163b4e3dcbSSimon L. B. Nielsen	    //VALUE "Comments", "\\0"
21171f13597dSJung-uk Kim	    VALUE "LegalCopyright", "Copyright  � 1998-2005 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
21183b4e3dcbSSimon L. B. Nielsen	    //VALUE "LegalTrademarks", "\\0"
21193b4e3dcbSSimon L. B. Nielsen	    //VALUE "PrivateBuild", "\\0"
21203b4e3dcbSSimon L. B. Nielsen	    //VALUE "SpecialBuild", "\\0"
21213b4e3dcbSSimon L. B. Nielsen	END
21223b4e3dcbSSimon L. B. Nielsen    END
21233b4e3dcbSSimon L. B. Nielsen    BLOCK "VarFileInfo"
21243b4e3dcbSSimon L. B. Nielsen    BEGIN
21253b4e3dcbSSimon L. B. Nielsen        VALUE "Translation", 0x409, 0x4b0
21263b4e3dcbSSimon L. B. Nielsen    END
21273b4e3dcbSSimon L. B. NielsenEND
21283b4e3dcbSSimon L. B. NielsenEOF
21293b4e3dcbSSimon L. B. Nielsen	close(OUT);
21303b4e3dcbSSimon L. B. Nielsen  }
21313b4e3dcbSSimon L. B. Nielsen
213274664626SKris Kennawayprint <<EOF;
213374664626SKris Kennaway
2134f579bf8eSKris KennawayConfigured for $target.
213574664626SKris KennawayEOF
213674664626SKris Kennaway
213774664626SKris Kennawayprint <<\EOF if (!$no_threads && !$threads);
213874664626SKris Kennaway
213974664626SKris KennawayThe library could not be configured for supporting multi-threaded
214074664626SKris Kennawayapplications as the compiler options required on this system are not known.
214174664626SKris KennawaySee file INSTALL for details if you need multi-threading.
214274664626SKris KennawayEOF
214374664626SKris Kennaway
2144fceca8a3SJacques Vidrineprint <<\EOF if ($no_shared_warn);
2145fceca8a3SJacques Vidrine
21468180e704SJung-uk KimYou gave the option 'shared', which is not supported on this platform, so
21478180e704SJung-uk Kimwe will pretend you gave the option 'no-shared'.  If you know how to implement
21488180e704SJung-uk Kimshared libraries, please let us know (but please first make sure you have
21498180e704SJung-uk Kimtried with a current version of OpenSSL).
21508180e704SJung-uk KimEOF
21518180e704SJung-uk Kim
21528180e704SJung-uk Kimprint <<EOF if ($warn_make_depend);
21538180e704SJung-uk Kim
21548180e704SJung-uk Kim*** Because of configuration changes, you MUST do the following before
21558180e704SJung-uk Kim*** building:
21568180e704SJung-uk Kim
21578180e704SJung-uk Kim	make depend
2158fceca8a3SJacques VidrineEOF
2159fceca8a3SJacques Vidrine
216074664626SKris Kennawayexit(0);
216174664626SKris Kennaway
216274664626SKris Kennawaysub usage
216374664626SKris Kennaway	{
216474664626SKris Kennaway	print STDERR $usage;
2165f579bf8eSKris Kennaway	print STDERR "\npick os/compiler from:\n";
216674664626SKris Kennaway	my $j=0;
216774664626SKris Kennaway	my $i;
2168f579bf8eSKris Kennaway        my $k=0;
216974664626SKris Kennaway	foreach $i (sort keys %table)
217074664626SKris Kennaway		{
217174664626SKris Kennaway		next if $i =~ /^debug/;
2172f579bf8eSKris Kennaway		$k += length($i) + 1;
2173f579bf8eSKris Kennaway		if ($k > 78)
2174f579bf8eSKris Kennaway			{
2175f579bf8eSKris Kennaway			print STDERR "\n";
2176f579bf8eSKris Kennaway			$k=length($i);
2177f579bf8eSKris Kennaway			}
2178f579bf8eSKris Kennaway		print STDERR $i . " ";
217974664626SKris Kennaway		}
218074664626SKris Kennaway	foreach $i (sort keys %table)
218174664626SKris Kennaway		{
218274664626SKris Kennaway		next if $i !~ /^debug/;
2183f579bf8eSKris Kennaway		$k += length($i) + 1;
2184f579bf8eSKris Kennaway		if ($k > 78)
2185f579bf8eSKris Kennaway			{
218674664626SKris Kennaway			print STDERR "\n";
2187f579bf8eSKris Kennaway			$k=length($i);
2188f579bf8eSKris Kennaway			}
2189f579bf8eSKris Kennaway		print STDERR $i . " ";
2190f579bf8eSKris Kennaway		}
2191f579bf8eSKris Kennaway	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
219274664626SKris Kennaway	exit(1);
219374664626SKris Kennaway	}
219474664626SKris Kennaway
219574664626SKris Kennawaysub which
219674664626SKris Kennaway	{
219774664626SKris Kennaway	my($name)=@_;
219874664626SKris Kennaway	my $path;
219974664626SKris Kennaway	foreach $path (split /:/, $ENV{PATH})
220074664626SKris Kennaway		{
22016be8ae07SJacques Vidrine		if (-f "$path/$name$exe_ext" and -x _)
220274664626SKris Kennaway			{
22036be8ae07SJacques Vidrine			return "$path/$name$exe_ext" unless ($name eq "perl" and
22046be8ae07SJacques Vidrine			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
220574664626SKris Kennaway			}
220674664626SKris Kennaway		}
220774664626SKris Kennaway	}
220874664626SKris Kennaway
220974664626SKris Kennawaysub dofile
221074664626SKris Kennaway	{
221174664626SKris Kennaway	my $f; my $p; my %m; my @a; my $k; my $ff;
221274664626SKris Kennaway	($f,$p,%m)=@_;
221374664626SKris Kennaway
221474664626SKris Kennaway	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
221574664626SKris Kennaway	@a=<IN>;
221674664626SKris Kennaway	close(IN);
221774664626SKris Kennaway	foreach $k (keys %m)
221874664626SKris Kennaway		{
221974664626SKris Kennaway		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
222074664626SKris Kennaway		}
2221f579bf8eSKris Kennaway	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
222274664626SKris Kennaway	print OUT @a;
222374664626SKris Kennaway	close(OUT);
2224f579bf8eSKris Kennaway	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
2225f579bf8eSKris Kennaway	rename("$f.new",$f) || die "unable to rename $f.new\n";
222674664626SKris Kennaway	}
222774664626SKris Kennaway
222874664626SKris Kennawaysub print_table_entry
222974664626SKris Kennaway	{
223074664626SKris Kennaway	my $target = shift;
223174664626SKris Kennaway
22327bded2dbSJung-uk Kim	my ($cc, $cflags, $unistd, $thread_cflag, $sys_id, $lflags,
22337bded2dbSJung-uk Kim	    $bn_ops, $cpuid_obj, $bn_obj, $ec_obj, $des_obj, $aes_obj, $bf_obj,
22347bded2dbSJung-uk Kim	    $md5_obj, $sha1_obj, $cast_obj, $rc4_obj, $rmd160_obj,
22357bded2dbSJung-uk Kim	    $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj,
22367bded2dbSJung-uk Kim	    $perlasm_scheme, $dso_scheme, $shared_target, $shared_cflag,
22377bded2dbSJung-uk Kim	    $shared_ldflag, $shared_extension, $ranlib, $arflags, $multilib)=
22385740a5e3SKris Kennaway	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
223974664626SKris Kennaway
224074664626SKris Kennaway	print <<EOF
224174664626SKris Kennaway
224274664626SKris Kennaway*** $target
224374664626SKris Kennaway\$cc           = $cc
224474664626SKris Kennaway\$cflags       = $cflags
224574664626SKris Kennaway\$unistd       = $unistd
224674664626SKris Kennaway\$thread_cflag = $thread_cflag
22475c87c606SMark Murray\$sys_id       = $sys_id
224874664626SKris Kennaway\$lflags       = $lflags
224974664626SKris Kennaway\$bn_ops       = $bn_ops
22503b4e3dcbSSimon L. B. Nielsen\$cpuid_obj    = $cpuid_obj
225174664626SKris Kennaway\$bn_obj       = $bn_obj
22527bded2dbSJung-uk Kim\$ec_obj       = $ec_obj
225374664626SKris Kennaway\$des_obj      = $des_obj
22543b4e3dcbSSimon L. B. Nielsen\$aes_obj      = $aes_obj
225574664626SKris Kennaway\$bf_obj       = $bf_obj
225674664626SKris Kennaway\$md5_obj      = $md5_obj
225774664626SKris Kennaway\$sha1_obj     = $sha1_obj
225874664626SKris Kennaway\$cast_obj     = $cast_obj
225974664626SKris Kennaway\$rc4_obj      = $rc4_obj
226074664626SKris Kennaway\$rmd160_obj   = $rmd160_obj
226174664626SKris Kennaway\$rc5_obj      = $rc5_obj
22621f13597dSJung-uk Kim\$wp_obj       = $wp_obj
22631f13597dSJung-uk Kim\$cmll_obj     = $cmll_obj
22641f13597dSJung-uk Kim\$modes_obj    = $modes_obj
22651f13597dSJung-uk Kim\$engines_obj  = $engines_obj
22661f13597dSJung-uk Kim\$perlasm_scheme = $perlasm_scheme
2267ddd58736SKris Kennaway\$dso_scheme   = $dso_scheme
2268ddd58736SKris Kennaway\$shared_target= $shared_target
2269ddd58736SKris Kennaway\$shared_cflag = $shared_cflag
2270c1803d78SJacques Vidrine\$shared_ldflag = $shared_ldflag
22715740a5e3SKris Kennaway\$shared_extension = $shared_extension
22725740a5e3SKris Kennaway\$ranlib       = $ranlib
22735c87c606SMark Murray\$arflags      = $arflags
22741f13597dSJung-uk Kim\$multilib     = $multilib
227574664626SKris KennawayEOF
227674664626SKris Kennaway	}
2277c1803d78SJacques Vidrine
2278c1803d78SJacques Vidrinesub test_sanity
2279c1803d78SJacques Vidrine	{
2280c1803d78SJacques Vidrine	my $errorcnt = 0;
2281c1803d78SJacques Vidrine
2282c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2283c1803d78SJacques Vidrine	print STDERR "=== SANITY TESTING!\n";
2284c1803d78SJacques Vidrine	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2285c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2286c1803d78SJacques Vidrine
2287c1803d78SJacques Vidrine	foreach $target (sort keys %table)
2288c1803d78SJacques Vidrine		{
2289c1803d78SJacques Vidrine		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2290c1803d78SJacques Vidrine
22911f13597dSJung-uk Kim		if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2292c1803d78SJacques Vidrine			{
2293c1803d78SJacques Vidrine			$errorcnt++;
2294c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2295c1803d78SJacques Vidrine			print STDERR "              in the previous field\n";
2296c1803d78SJacques Vidrine			}
22971f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2298c1803d78SJacques Vidrine			{
2299c1803d78SJacques Vidrine			$errorcnt++;
2300c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2301c1803d78SJacques Vidrine			print STDERR "              in the following field\n";
2302c1803d78SJacques Vidrine			}
23031f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
2304c1803d78SJacques Vidrine			{
2305c1803d78SJacques Vidrine			$errorcnt++;
2306c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
23071f13597dSJung-uk Kim			print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
2308c1803d78SJacques Vidrine			}
2309c1803d78SJacques Vidrine		}
2310c1803d78SJacques Vidrine	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2311c1803d78SJacques Vidrine	return $errorcnt;
2312c1803d78SJacques Vidrine	}
23136cf8931aSJung-uk Kim
23146cf8931aSJung-uk Kimsub file_newer
23156cf8931aSJung-uk Kim	{
23166cf8931aSJung-uk Kim	my ($file1, $file2) = @_;
23176cf8931aSJung-uk Kim	return (stat($file1))[9] > (stat($file2))[9]
23186cf8931aSJung-uk Kim	}
2319