xref: /freebsd/crypto/openssl/Configure (revision 751d29910bd05fdfb3ff3b62e493633e5de76bf9)
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;
1074664626SKris Kennaway
1174664626SKris Kennaway# see INSTALL for instructions.
1274664626SKris Kennaway
131f13597dSJung-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";
1474664626SKris Kennaway
1574664626SKris Kennaway# Options:
1674664626SKris Kennaway#
1774664626SKris Kennaway# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
1874664626SKris Kennaway#               --prefix option is given; /usr/local/ssl otherwise)
1974664626SKris Kennaway# --prefix      prefix for the OpenSSL include, lib and bin directories
2074664626SKris Kennaway#               (Default: the OPENSSLDIR directory)
2174664626SKris Kennaway#
2274664626SKris Kennaway# --install_prefix  Additional prefix for package builders (empty by
2374664626SKris Kennaway#               default).  This needn't be set in advance, you can
2474664626SKris Kennaway#               just as well use "make INSTALL_PREFIX=/whatever install".
2574664626SKris Kennaway#
265c87c606SMark Murray# --with-krb5-dir  Declare where Kerberos 5 lives.  The libraries are expected
275c87c606SMark Murray#		to live in the subdirectory lib/ and the header files in
285c87c606SMark Murray#		include/.  A value is required.
295c87c606SMark Murray# --with-krb5-lib  Declare where the Kerberos 5 libraries live.  A value is
305c87c606SMark Murray#		required.
315c87c606SMark Murray#		(Default: KRB5_DIR/lib)
325c87c606SMark Murray# --with-krb5-include  Declare where the Kerberos 5 header files live.  A
335c87c606SMark Murray#		value is required.
345c87c606SMark Murray#		(Default: KRB5_DIR/include)
355c87c606SMark Murray# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
365c87c606SMark Murray#		supported values are "MIT" and "Heimdal".  A value is required.
375c87c606SMark Murray#
38c1803d78SJacques Vidrine# --test-sanity Make a number of sanity checks on the data in this file.
39c1803d78SJacques Vidrine#               This is a debugging tool for OpenSSL developers.
40c1803d78SJacques Vidrine#
411f13597dSJung-uk Kim# --cross-compile-prefix Add specified prefix to binutils components.
421f13597dSJung-uk Kim#
435c87c606SMark Murray# no-hw-xxx     do not compile support for specific crypto hardware.
445c87c606SMark Murray#               Generic OpenSSL-style methods relating to this support
455c87c606SMark Murray#               are always compiled but return NULL if the hardware
465c87c606SMark Murray#               support isn't compiled.
475c87c606SMark Murray# no-hw         do not compile support for any crypto hardware.
4874664626SKris Kennaway# [no-]threads  [don't] try to create a library that is suitable for
4974664626SKris Kennaway#               multithreaded applications (default is "threads" if we
5074664626SKris Kennaway#               know how to do it)
51ddd58736SKris Kennaway# [no-]shared	[don't] try to create shared libraries when supported.
5274664626SKris Kennaway# no-asm        do not use assembler
53ddd58736SKris Kennaway# no-dso        do not compile in any native shared-library methods. This
54ddd58736SKris Kennaway#               will ensure that all methods just return NULL.
555c87c606SMark Murray# no-krb5       do not compile in any KRB5 library or code.
565c87c606SMark Murray# [no-]zlib     [don't] compile support for zlib compression.
575c87c606SMark Murray# zlib-dynamic	Like "zlib", but the zlib library is expected to be a shared
585c87c606SMark Murray#		library and will be loaded in run-time by the OpenSSL library.
591f13597dSJung-uk Kim# sctp          include SCTP support
6074664626SKris Kennaway# 386           generate 80386 code
613b4e3dcbSSimon L. B. Nielsen# no-sse2	disables IA-32 SSE2 code, above option implies no-sse2
6274664626SKris Kennaway# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
6374664626SKris Kennaway# -<xxx> +<xxx> compiler options are passed through
6474664626SKris Kennaway#
65ddd58736SKris Kennaway# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
66ddd58736SKris Kennaway#		provided to stack calls. Generates unique stack functions for
67ddd58736SKris Kennaway#		each possible stack type.
6874664626SKris Kennaway# DES_PTR	use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
6974664626SKris Kennaway# DES_RISC1	use different DES_ENCRYPT macro that helps reduce register
7074664626SKris Kennaway#		dependancies but needs to more registers, good for RISC CPU's
7174664626SKris Kennaway# DES_RISC2	A different RISC variant.
7274664626SKris Kennaway# DES_UNROLL	unroll the inner DES loop, sometimes helps, somtimes hinders.
7374664626SKris Kennaway# DES_INT	use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
7474664626SKris Kennaway#		This is used on the DEC Alpha where long is 8 bytes
7574664626SKris Kennaway#		and int is 4
7674664626SKris Kennaway# BN_LLONG	use the type 'long long' in crypto/bn/bn.h
7774664626SKris Kennaway# MD2_CHAR	use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
7874664626SKris Kennaway# MD2_LONG	use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
7974664626SKris Kennaway# IDEA_SHORT	use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8074664626SKris Kennaway# IDEA_LONG	use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
8174664626SKris Kennaway# RC2_SHORT	use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8274664626SKris Kennaway# RC2_LONG	use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
8374664626SKris Kennaway# RC4_CHAR	use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8474664626SKris Kennaway# RC4_LONG	use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
8574664626SKris Kennaway# RC4_INDEX	define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
8674664626SKris Kennaway#		array lookups instead of pointer use.
87f579bf8eSKris Kennaway# RC4_CHUNK	enables code that handles data aligned at long (natural CPU
88f579bf8eSKris Kennaway#		word) boundary.
89f579bf8eSKris Kennaway# RC4_CHUNK_LL	enables code that handles data aligned at long long boundary
90f579bf8eSKris Kennaway#		(intended for 64-bit CPUs running 32-bit OS).
9174664626SKris Kennaway# BF_PTR	use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
9274664626SKris Kennaway# BF_PTR2	intel specific version (generic version is more efficient).
933b4e3dcbSSimon L. B. Nielsen#
943b4e3dcbSSimon L. B. Nielsen# Following are set automatically by this script
953b4e3dcbSSimon L. B. Nielsen#
9674664626SKris Kennaway# MD5_ASM	use some extra md5 assember,
9774664626SKris Kennaway# SHA1_ASM	use some extra sha1 assember, must define L_ENDIAN for x86
9874664626SKris Kennaway# RMD160_ASM	use some extra ripemd160 assember,
993b4e3dcbSSimon L. B. Nielsen# SHA256_ASM	sha256_block is implemented in assembler
1003b4e3dcbSSimon L. B. Nielsen# SHA512_ASM	sha512_block is implemented in assembler
1013b4e3dcbSSimon L. B. Nielsen# AES_ASM	ASE_[en|de]crypt is implemented in assembler
10274664626SKris Kennaway
103db522d3aSSimon L. B. Nielsen# Minimum warning options... any contributions to OpenSSL should at least get
104db522d3aSSimon L. B. Nielsen# past these.
105db522d3aSSimon L. B. Nielsen
106db522d3aSSimon L. B. Nielsenmy $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
107db522d3aSSimon L. B. Nielsen
1086a599222SSimon L. B. Nielsenmy $strict_warnings = 0;
1096a599222SSimon L. B. Nielsen
11074664626SKris Kennawaymy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
11174664626SKris Kennaway
11274664626SKris Kennaway# MD2_CHAR slags pentium pros
11374664626SKris Kennawaymy $x86_gcc_opts="RC4_INDEX MD2_INT";
11474664626SKris Kennaway
11574664626SKris Kennaway# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
11674664626SKris Kennaway# Don't worry about these normally
11774664626SKris Kennaway
11874664626SKris Kennawaymy $tcc="cc";
11974664626SKris Kennawaymy $tflags="-fast -Xa";
12074664626SKris Kennawaymy $tbn_mul="";
12174664626SKris Kennawaymy $tlib="-lnsl -lsocket";
12274664626SKris Kennaway#$bits1="SIXTEEN_BIT ";
12374664626SKris Kennaway#$bits2="THIRTY_TWO_BIT ";
12474664626SKris Kennawaymy $bits1="THIRTY_TWO_BIT ";
12574664626SKris Kennawaymy $bits2="SIXTY_FOUR_BIT ";
12674664626SKris Kennaway
1271f13597dSJung-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:";
12874664626SKris Kennaway
1291f13597dSJung-uk Kimmy $x86_elf_asm="$x86_asm:elf";
1305740a5e3SKris Kennaway
1311f13597dSJung-uk Kimmy $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o:";
1321f13597dSJung-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";
1331f13597dSJung-uk Kimmy $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::ghash-sparcv9.o::void";
1341f13597dSJung-uk Kimmy $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::::void";
1351f13597dSJung-uk Kimmy $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o:::::sha1-alpha.o:::::::ghash-alpha.o::void";
1361f13597dSJung-uk Kimmy $mips32_asm=":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o::::::::";
1371f13597dSJung-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::::::::";
1381f13597dSJung-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:";
1391f13597dSJung-uk Kimmy $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o::void";
1401f13597dSJung-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";
1411f13597dSJung-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";
1421f13597dSJung-uk Kimmy $ppc32_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::::";
1431f13597dSJung-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:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::::";
1441f13597dSJung-uk Kimmy $no_asm=":::::::::::::::void";
14574664626SKris Kennaway
1463b4e3dcbSSimon L. B. Nielsen# As for $BSDthreads. Idea is to maintain "collective" set of flags,
1473b4e3dcbSSimon L. B. Nielsen# which would cover all BSD flavors. -pthread applies to them all,
1483b4e3dcbSSimon L. B. Nielsen# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
1493b4e3dcbSSimon L. B. Nielsen# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
1503b4e3dcbSSimon L. B. Nielsen# which has to be accompanied by explicit -D_THREAD_SAFE and
1513b4e3dcbSSimon L. B. Nielsen# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
1523b4e3dcbSSimon L. B. Nielsen# seems to be sufficient?
1533b4e3dcbSSimon L. B. Nielsenmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
1543b4e3dcbSSimon L. B. Nielsen
1551f13597dSJung-uk Kim#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
156f579bf8eSKris Kennaway
15774664626SKris Kennawaymy %table=(
158ddd58736SKris Kennaway# File 'TABLE' (created by 'make TABLE') contains the data from this list,
159ddd58736SKris Kennaway# formatted for better readability.
160ddd58736SKris Kennaway
161ddd58736SKris Kennaway
162f579bf8eSKris Kennaway#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
163f579bf8eSKris Kennaway#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
164f579bf8eSKris Kennaway#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
165f579bf8eSKris Kennaway#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
16674664626SKris Kennaway
16774664626SKris Kennaway# Our development configs
1685c87c606SMark Murray"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
1695c87c606SMark 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::::",
1701f13597dSJung-uk Kim"debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
1715c87c606SMark 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)::::",
1725c87c606SMark 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)::::",
1731f13597dSJung-uk Kim"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
17409286989SJung-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)",
1751f13597dSJung-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::::",
1761f13597dSJung-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)::::::",
17709286989SJung-uk Kim"debug-ben-darwin64","cc:$gcc_devteam_warn -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
1781f13597dSJung-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)::::::",
1795c87c606SMark 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)::::::",
1805c87c606SMark Murray"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
181de78d5d8SJung-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",
1823b4e3dcbSSimon L. B. Nielsen"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
18309286989SJung-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)",
184db522d3aSSimon L. B. Nielsen"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1851f13597dSJung-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)",
18609286989SJung-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)",
18709286989SJung-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)",
18809286989SJung-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 -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
18909286989SJung-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 -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1901f13597dSJung-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)",
1911f13597dSJung-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)",
1921f13597dSJung-uk Kim"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
1931f13597dSJung-uk Kim"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
1941f13597dSJung-uk Kim"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1951f13597dSJung-uk Kim"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1961f13597dSJung-uk Kim"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1976a599222SSimon L. B. Nielsen"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1986a599222SSimon L. B. Nielsen"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1991f13597dSJung-uk Kim"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2005c87c606SMark Murray"dist",		"cc:-O::(unknown)::::::",
20174664626SKris Kennaway
202f579bf8eSKris Kennaway# Basic configs that should work on any (32 and less bit) box
2035c87c606SMark Murray"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
2045c87c606SMark Murray"cc",		"cc:-O::(unknown)::::::",
20574664626SKris Kennaway
2066be8ae07SJacques Vidrine####VOS Configurations
2071f13597dSJung-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:",
2081f13597dSJung-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:",
2096be8ae07SJacques Vidrine
2105c87c606SMark Murray#### Solaris x86 with GNU C setups
2115c87c606SMark Murray# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
212f579bf8eSKris Kennaway# here because whenever GNU C instantiates an assembler template it
213f579bf8eSKris Kennaway# surrounds it with #APP #NO_APP comment pair which (at least Solaris
214f579bf8eSKris Kennaway# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
215f579bf8eSKris Kennaway# error message.
2163b4e3dcbSSimon 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)",
2173b4e3dcbSSimon L. B. Nielsen# -shared -static-libgcc might appear controversial, but modules taken
2183b4e3dcbSSimon L. B. Nielsen# from static libgcc do not have relocations and linking them into our
2193b4e3dcbSSimon L. B. Nielsen# shared objects doesn't have any negative side-effects. On the contrary,
2203b4e3dcbSSimon L. B. Nielsen# doing so makes it possible to use gcc shared build with Sun C. Given
2213b4e3dcbSSimon L. B. Nielsen# that gcc generates faster code [thanks to inline assembler], I would
2223b4e3dcbSSimon L. B. Nielsen# actually recommend to consider using gcc shared build even with vendor
2233b4e3dcbSSimon L. B. Nielsen# compiler:-)
2243b4e3dcbSSimon L. B. Nielsen#						<appro@fy.chalmers.se>
2251f13597dSJung-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",
22674664626SKris Kennaway
22726d191b4SKris Kennaway#### Solaris x86 with Sun C setups
2283b4e3dcbSSimon L. B. Nielsen"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2291f13597dSJung-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",
23026d191b4SKris Kennaway
23174664626SKris Kennaway#### SPARC Solaris with GNU C setups
2323b4e3dcbSSimon 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)",
2331f13597dSJung-uk Kim"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2345c87c606SMark Murray# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
2351f13597dSJung-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)",
2361f13597dSJung-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",
23774664626SKris Kennaway####
2381f13597dSJung-uk Kim"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2391f13597dSJung-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)",
24074664626SKris Kennaway
24174664626SKris Kennaway#### SPARC Solaris with Sun C setups
24274664626SKris Kennaway# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
24374664626SKris Kennaway# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
24474664626SKris Kennaway# SC5.0 note: Compiler common patch 107357-01 or later is required!
2453b4e3dcbSSimon 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)",
2461f13597dSJung-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)",
2471f13597dSJung-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)",
24809286989SJung-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",
249f579bf8eSKris Kennaway####
2501f13597dSJung-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)",
2511f13597dSJung-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)",
25274664626SKris Kennaway
2533b4e3dcbSSimon L. B. Nielsen#### SunOS configs, assuming sparc for the gcc one.
2543b4e3dcbSSimon L. B. Nielsen#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
2553b4e3dcbSSimon L. B. Nielsen"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
25674664626SKris Kennaway
25774664626SKris Kennaway#### IRIX 5.x configs
25874664626SKris Kennaway# -mips2 flag is added by ./config when appropriate.
2591f13597dSJung-uk Kim"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2601f13597dSJung-uk Kim"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
26174664626SKris Kennaway#### IRIX 6.x configs
26274664626SKris Kennaway# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
263ced566fdSJacques Vidrine# './Configure irix-cc -o32' manually.
2641f13597dSJung-uk Kim"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
2651f13597dSJung-uk Kim"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
26674664626SKris Kennaway# N64 ABI builds.
2671f13597dSJung-uk Kim"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2681f13597dSJung-uk Kim"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
269f579bf8eSKris Kennaway
270f579bf8eSKris Kennaway#### Unified HP-UX ANSI C configs.
271f579bf8eSKris Kennaway# Special notes:
272f579bf8eSKris Kennaway# - Originally we were optimizing at +O4 level. It should be noted
273f579bf8eSKris Kennaway#   that the only difference between +O3 and +O4 is global inter-
274f579bf8eSKris Kennaway#   procedural analysis. As it has to be performed during the link
275f579bf8eSKris Kennaway#   stage the compiler leaves behind certain pseudo-code in lib*.a
276f579bf8eSKris Kennaway#   which might be release or even patch level specific. Generating
277f579bf8eSKris Kennaway#   the machine code for and analyzing the *whole* program appears
278f579bf8eSKris Kennaway#   to be *extremely* memory demanding while the performance gain is
279f579bf8eSKris Kennaway#   actually questionable. The situation is intensified by the default
280f579bf8eSKris Kennaway#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
281f579bf8eSKris Kennaway#   which is way too low for +O4. In other words, doesn't +O3 make
282f579bf8eSKris Kennaway#   more sense?
283f579bf8eSKris Kennaway# - Keep in mind that the HP compiler by default generates code
284f579bf8eSKris Kennaway#   suitable for execution on the host you're currently compiling at.
285f579bf8eSKris Kennaway#   If the toolkit is ment to be used on various PA-RISC processors
2865c87c606SMark Murray#   consider './config +DAportable'.
2873b4e3dcbSSimon L. B. Nielsen# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
288f579bf8eSKris Kennaway#   compatible with *future* releases.
289f579bf8eSKris Kennaway# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
290f579bf8eSKris Kennaway#   pass -D_REENTRANT on HP-UX 10 and later.
291f579bf8eSKris Kennaway# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
292f579bf8eSKris Kennaway#   32-bit message digests. (For the moment of this writing) HP C
293f579bf8eSKris Kennaway#   doesn't seem to "digest" too many local variables (they make "him"
294f579bf8eSKris Kennaway#   chew forever:-). For more details look-up MD32_XARRAY comment in
295f579bf8eSKris Kennaway#   crypto/sha/sha_lcl.h.
296f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
297f579bf8eSKris Kennaway#
298f579bf8eSKris Kennaway# Since there is mention of this in shlib/hpux10-cc.sh
2993b4e3dcbSSimon 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)",
3003b4e3dcbSSimon 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)",
3011f13597dSJung-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",
3021f13597dSJung-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",
3031f13597dSJung-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",
304ddd58736SKris Kennaway
305ddd58736SKris Kennaway# More attempts at unified 10.X and 11.X targets for HP C compiler.
306ddd58736SKris Kennaway#
307ddd58736SKris Kennaway# Chris Ruemmler <ruemmler@cup.hp.com>
308ddd58736SKris Kennaway# Kevin Steves <ks@hp.se>
3093b4e3dcbSSimon 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)",
3101f13597dSJung-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",
3111f13597dSJung-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",
3121f13597dSJung-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",
31374664626SKris Kennaway
3143b4e3dcbSSimon L. B. Nielsen# HP/UX IA-64 targets
3151f13597dSJung-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",
3163b4e3dcbSSimon L. B. Nielsen# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
3173b4e3dcbSSimon L. B. Nielsen# with debugging of the following config.
3181f13597dSJung-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",
3193b4e3dcbSSimon L. B. Nielsen# GCC builds...
3201f13597dSJung-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",
3211f13597dSJung-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",
32274664626SKris Kennaway
3233b4e3dcbSSimon L. B. Nielsen# Legacy HPUX 9.X configs...
3243b4e3dcbSSimon 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)",
3253b4e3dcbSSimon 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)",
32674664626SKris Kennaway
327ddd58736SKris Kennaway#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
3285c87c606SMark Murray"MPE/iX-gcc",	"gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
329ddd58736SKris Kennaway
3303b4e3dcbSSimon L. B. Nielsen# DEC Alpha OSF/1/Tru64 targets.
331a21b1b38SKris Kennaway#
332a21b1b38SKris Kennaway#	"What's in a name? That which we call a rose
333a21b1b38SKris Kennaway#	 By any other word would smell as sweet."
334a21b1b38SKris Kennaway#
335a21b1b38SKris Kennaway# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
336a21b1b38SKris Kennaway#
33774664626SKris Kennaway# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
338a21b1b38SKris Kennaway#
3391f13597dSJung-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",
3401f13597dSJung-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",
3411f13597dSJung-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",
342f579bf8eSKris Kennaway
3433b4e3dcbSSimon L. B. Nielsen####
3443b4e3dcbSSimon L. B. Nielsen#### Variety of LINUX:-)
3453b4e3dcbSSimon L. B. Nielsen####
3463b4e3dcbSSimon L. B. Nielsen# *-generic* is endian-neutral target, but ./config is free to
3473b4e3dcbSSimon L. B. Nielsen# throw in -D[BL]_ENDIAN, whichever appropriate...
3483b4e3dcbSSimon L. B. Nielsen"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3491f13597dSJung-uk Kim"linux-ppc",	"gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3501f13597dSJung-uk Kim# It's believed that majority of ARM toolchains predefine appropriate -march.
3511f13597dSJung-uk Kim# If you compiler does not, do complement config command line with one!
3521f13597dSJung-uk Kim"linux-armv4",	"gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3533b4e3dcbSSimon L. B. Nielsen#### IA-32 targets...
3543b4e3dcbSSimon L. B. Nielsen"linux-ia32-icc",	"icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3553b4e3dcbSSimon L. B. Nielsen"linux-elf",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3561f13597dSJung-uk Kim"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
3573b4e3dcbSSimon L. B. Nielsen####
3583b4e3dcbSSimon L. B. Nielsen"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3591f13597dSJung-uk Kim"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
3601f13597dSJung-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)",
3611f13597dSJung-uk Kim"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3621f13597dSJung-uk Kim"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3631f13597dSJung-uk Kim"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
3641f13597dSJung-uk Kim"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
3651f13597dSJung-uk Kim#### So called "highgprs" target for z/Architecture CPUs
3661f13597dSJung-uk Kim# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
3671f13597dSJung-uk Kim# /proc/cpuinfo. The idea is to preserve most significant bits of
3681f13597dSJung-uk Kim# general purpose registers not only upon 32-bit process context
3691f13597dSJung-uk Kim# switch, but even on asynchronous signal delivery to such process.
3701f13597dSJung-uk Kim# This makes it possible to deploy 64-bit instructions even in legacy
3711f13597dSJung-uk Kim# application context and achieve better [or should we say adequate]
3721f13597dSJung-uk Kim# performance. The build is binary compatible with linux-generic32,
3731f13597dSJung-uk Kim# and the idea is to be able to install the resulting libcrypto.so
3741f13597dSJung-uk Kim# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
3751f13597dSJung-uk Kim# ldconfig and run-time linker to autodiscover. Unfortunately it
3761f13597dSJung-uk Kim# doesn't work just yet, because of couple of bugs in glibc
3771f13597dSJung-uk Kim# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
3781f13597dSJung-uk Kim"linux32-s390x",	"gcc:-m31 -Wa,-mzarch -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
3793b4e3dcbSSimon L. B. Nielsen#### SPARC Linux setups
3803b4e3dcbSSimon L. B. Nielsen# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
3813b4e3dcbSSimon L. B. Nielsen# assisted with debugging of following two configs.
3821f13597dSJung-uk Kim"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3833b4e3dcbSSimon L. B. Nielsen# it's a real mess with -mcpu=ultrasparc option under Linux, but
3843b4e3dcbSSimon L. B. Nielsen# -Wa,-Av8plus should do the trick no matter what.
3851f13597dSJung-uk Kim"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3863b4e3dcbSSimon L. B. Nielsen# GCC 3.1 is a requirement
3871f13597dSJung-uk Kim"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
388f579bf8eSKris Kennaway#### Alpha Linux with GNU C and Compaq C setups
389f579bf8eSKris Kennaway# Special notes:
390f579bf8eSKris Kennaway# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
391f579bf8eSKris Kennaway#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
392f579bf8eSKris Kennaway#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
393f579bf8eSKris Kennaway#   which is appropriate.
394f579bf8eSKris Kennaway# - If you use ccc keep in mind that -fast implies -arch host and the
395f579bf8eSKris Kennaway#   compiler is free to issue instructions which gonna make elder CPU
396f579bf8eSKris Kennaway#   choke. If you wish to build "blended" toolkit, add -arch generic
397f579bf8eSKris Kennaway#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
398f579bf8eSKris Kennaway#
399f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
400f579bf8eSKris Kennaway#
4011f13597dSJung-uk Kim"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4021f13597dSJung-uk Kim"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4031f13597dSJung-uk Kim"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
4041f13597dSJung-uk Kim"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
40574664626SKris Kennaway
4061f13597dSJung-uk Kim# Android: linux-* but without -DTERMIO and pointers to headers and libs.
40712de4ed2SJung-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)",
4081f13597dSJung-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)",
4091f13597dSJung-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)",
41012de4ed2SJung-uk Kim
4113b4e3dcbSSimon L. B. Nielsen#### *BSD [do see comment about ${BSDthreads} above!]
4123b4e3dcbSSimon L. B. Nielsen"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4131f13597dSJung-uk Kim"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4143b4e3dcbSSimon L. B. Nielsen"BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4153b4e3dcbSSimon L. B. Nielsen"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4161f13597dSJung-uk Kim"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
41774664626SKris Kennaway
4183b4e3dcbSSimon L. B. Nielsen"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4193b4e3dcbSSimon L. B. Nielsen# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
4203b4e3dcbSSimon L. B. Nielsen# simply *happens* to work around a compiler bug in gcc 3.3.3,
4213b4e3dcbSSimon L. B. Nielsen# triggered by RIPEMD160 code.
4221f13597dSJung-uk Kim"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4231f13597dSJung-uk Kim"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4241f13597dSJung-uk Kim"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4253b4e3dcbSSimon L. B. Nielsen
4263b4e3dcbSSimon 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)",
4273b4e3dcbSSimon L. B. Nielsen
4285c87c606SMark Murray"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4295c87c606SMark Murray"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4305c87c606SMark Murray
43174664626SKris Kennaway# NCR MP-RAS UNIX ver 02.03.01
432fceca8a3SJacques Vidrine"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
43374664626SKris Kennaway
4343b4e3dcbSSimon L. B. Nielsen# QNX
4355c87c606SMark Murray"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
4366a599222SSimon L. B. Nielsen"QNX6",       "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4376a599222SSimon L. B. Nielsen"QNX6-i386",  "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
438a21b1b38SKris Kennaway
4391f13597dSJung-uk Kim# BeOS
4401f13597dSJung-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",
4411f13597dSJung-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",
4421f13597dSJung-uk Kim
4433b4e3dcbSSimon L. B. Nielsen#### SCO/Caldera targets.
444fceca8a3SJacques Vidrine#
445fceca8a3SJacques Vidrine# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
446fceca8a3SJacques Vidrine# Now we only have blended unixware-* as it's the only one used by ./config.
447fceca8a3SJacques Vidrine# If you want to optimize for particular microarchitecture, bypass ./config
448fceca8a3SJacques Vidrine# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
449fceca8a3SJacques Vidrine# Note that not all targets include assembler support. Mostly because of
450fceca8a3SJacques Vidrine# lack of motivation to support out-of-date platforms with out-of-date
451fceca8a3SJacques Vidrine# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
452fceca8a3SJacques Vidrine# patiently assisted to debug most of it.
453fceca8a3SJacques Vidrine#
4543b4e3dcbSSimon L. B. Nielsen# UnixWare 2.0x fails destest with -O.
4555c87c606SMark Murray"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
4565c87c606SMark Murray"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
457fceca8a3SJacques Vidrine"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4583b4e3dcbSSimon L. B. Nielsen"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
459fceca8a3SJacques Vidrine# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
460fceca8a3SJacques Vidrine"sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
461fceca8a3SJacques Vidrine"sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
46274664626SKris Kennaway
4633b4e3dcbSSimon L. B. Nielsen#### IBM's AIX.
4643b4e3dcbSSimon L. B. Nielsen"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
4651f13597dSJung-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",
4661f13597dSJung-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",
4673b4e3dcbSSimon L. B. Nielsen# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
4683b4e3dcbSSimon L. B. Nielsen# at build time. $OBJECT_MODE is respected at ./config stage!
46909286989SJung-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",
47009286989SJung-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",
47174664626SKris Kennaway
47274664626SKris Kennaway#
473c1803d78SJacques Vidrine# Cray T90 and similar (SDSC)
47474664626SKris Kennaway# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
47574664626SKris Kennaway# defined.  The T90 ints and longs are 8 bytes long, and apparently the
47674664626SKris Kennaway# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
47774664626SKris Kennaway# non L_ENDIAN code aligns the bytes in each word correctly.
47874664626SKris Kennaway#
47974664626SKris Kennaway# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
48074664626SKris Kennaway#'Taking the address of a bit field is not allowed. '
48174664626SKris Kennaway#'An expression with bit field exists as the operand of "sizeof" '
48274664626SKris Kennaway# (written by Wayne Schroeder <schroede@SDSC.EDU>)
483c1803d78SJacques Vidrine#
484c1803d78SJacques Vidrine# j90 is considered the base machine type for unicos machines,
485c1803d78SJacques Vidrine# so this configuration is now called "cray-j90" ...
4865c87c606SMark Murray"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
48774664626SKris Kennaway
48874664626SKris Kennaway#
48974664626SKris Kennaway# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
49074664626SKris Kennaway#
49174664626SKris Kennaway# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
49274664626SKris Kennaway# another use.  Basically, the problem is that the T3E uses some bit fields
49374664626SKris Kennaway# for some st_addr stuff, and then sizeof and address-of fails
49474664626SKris Kennaway# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
49574664626SKris Kennaway# did not like it.
4965c87c606SMark Murray"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
49774664626SKris Kennaway
49874664626SKris Kennaway# DGUX, 88100.
4995c87c606SMark Murray"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
5005c87c606SMark Murray"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
5015c87c606SMark 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}",
50274664626SKris Kennaway
50374664626SKris Kennaway# Sinix/ReliantUNIX RM400
50474664626SKris Kennaway# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
5053b4e3dcbSSimon 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)",
5065c87c606SMark Murray"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
5075c87c606SMark Murray"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
50874664626SKris Kennaway
50974664626SKris Kennaway# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
5105c87c606SMark Murray"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
51174664626SKris Kennaway
512a21b1b38SKris Kennaway# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
513a21b1b38SKris Kennaway# You need to compile using the c89.sh wrapper in the tools directory, because the
514a21b1b38SKris Kennaway# IBM compiler does not like the -L switch after any object modules.
515a21b1b38SKris Kennaway#
5165c87c606SMark 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:::",
517a21b1b38SKris Kennaway
5183b4e3dcbSSimon L. B. Nielsen# Visual C targets
5191f13597dSJung-uk Kim#
5201f13597dSJung-uk Kim# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
5211f13597dSJung-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",
5221f13597dSJung-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",
5231f13597dSJung-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",
5241f13597dSJung-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",
5251f13597dSJung-uk Kim# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
5261f13597dSJung-uk Kim# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
5271f13597dSJung-uk Kim"VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
5281f13597dSJung-uk Kim# Unified CE target
529560ede85SJung-uk Kim"debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
5303b4e3dcbSSimon L. B. Nielsen"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
53174664626SKris Kennaway
53274664626SKris Kennaway# Borland C++ 4.5
5333b4e3dcbSSimon L. B. Nielsen"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
53474664626SKris Kennaway
53550ef0093SJacques Vidrine# MinGW
5361f13597dSJung-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",
5371f13597dSJung-uk Kim# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
5381f13597dSJung-uk Kim# compiled with one compiler with application compiled with another
5391f13597dSJung-uk Kim# compiler. It's possible to engage Applink support in mingw64 build,
5401f13597dSJung-uk Kim# but it's not done, because till mingw64 supports structured exception
5411f13597dSJung-uk Kim# handling, one can't seriously consider its binaries for using with
5421f13597dSJung-uk Kim# non-mingw64 run-time environment. And as mingw64 is always consistent
5431f13597dSJung-uk Kim# with itself, Applink is never engaged and can as well be omitted.
5441f13597dSJung-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",
545ddd58736SKris Kennaway
5464f20a5a2SJacques Vidrine# UWIN
5473b4e3dcbSSimon L. B. Nielsen"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
5484f20a5a2SJacques Vidrine
549c1803d78SJacques Vidrine# Cygwin
5503b4e3dcbSSimon L. B. Nielsen"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
5511f13597dSJung-uk Kim"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
5521f13597dSJung-uk Kim"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
5533b4e3dcbSSimon L. B. Nielsen
554db522d3aSSimon L. B. Nielsen# NetWare from David Ward (dsward@novell.com)
555db522d3aSSimon L. B. Nielsen# requires either MetroWerks NLM development tools, or gcc / nlmconv
556db522d3aSSimon L. B. Nielsen# NetWare defaults socket bio to WinSock sockets. However,
557db522d3aSSimon L. B. Nielsen# the builds can be configured to use BSD sockets instead.
5583b4e3dcbSSimon L. B. Nielsen# netware-clib => legacy CLib c-runtime support
559db522d3aSSimon L. B. Nielsen"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
560db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
561db522d3aSSimon 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}::",
562db522d3aSSimon 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}::",
5633b4e3dcbSSimon L. B. Nielsen# netware-libc => LibC/NKS support
5643b4e3dcbSSimon L. B. Nielsen"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
5653b4e3dcbSSimon L. B. Nielsen"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
5663b4e3dcbSSimon 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}::",
567db522d3aSSimon 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}::",
5685c87c606SMark Murray
5695c87c606SMark Murray# DJGPP
5701f13597dSJung-uk Kim"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
57174664626SKris Kennaway
57274664626SKris Kennaway# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
5735c87c606SMark Murray"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
5743b4e3dcbSSimon L. B. Nielsen"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
57574664626SKris Kennaway# K&R C is no longer supported; you need gcc on old Ultrix installations
5765c87c606SMark Murray##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
57774664626SKris Kennaway
578a21b1b38SKris Kennaway##### MacOS X (a.k.a. Rhapsody or Darwin) setup
5793b4e3dcbSSimon 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}::",
5801f13597dSJung-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",
5811f13597dSJung-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",
5821f13597dSJung-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",
5831f13597dSJung-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",
5841f13597dSJung-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_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",
5851f13597dSJung-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",
5861f13597dSJung-uk Kim# iPhoneOS/iOS
5871f13597dSJung-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",
5885c87c606SMark Murray
5895c87c606SMark Murray##### A/UX
5905c87c606SMark Murray"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
591f579bf8eSKris Kennaway
592ddd58736SKris Kennaway##### Sony NEWS-OS 4.x
5935c87c606SMark 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::::",
5945c87c606SMark Murray
5955c87c606SMark Murray##### GNU Hurd
5963b4e3dcbSSimon L. B. Nielsen"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
5975c87c606SMark Murray
5985c87c606SMark Murray##### OS/2 EMX
5995c87c606SMark Murray"OS2-EMX", "gcc::::::::",
600ddd58736SKris Kennaway
601c1803d78SJacques Vidrine##### VxWorks for various targets
6021f13597dSJung-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:::::",
6031f13597dSJung-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:::::",
6045c87c606SMark Murray"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6055c87c606SMark 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:::::",
6061f13597dSJung-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:::::",
60750ef0093SJacques Vidrine"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6081f13597dSJung-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:",
6091f13597dSJung-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:",
6105c87c606SMark Murray
6115c87c606SMark Murray##### Compaq Non-Stop Kernel (Tandem)
6125c87c606SMark Murray"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
613c1803d78SJacques Vidrine
6141f13597dSJung-uk Kim# uClinux
6151f13597dSJung-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'}::",
6161f13597dSJung-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'}::",
6171f13597dSJung-uk Kim
61874664626SKris Kennaway);
61974664626SKris Kennaway
6203b4e3dcbSSimon L. B. Nielsenmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
6211f13597dSJung-uk Kim		    debug-VC-WIN64I debug-VC-WIN64A
6221f13597dSJung-uk Kim		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
6231f13597dSJung-uk Kim		    BC-32
624db522d3aSSimon L. B. Nielsen		    netware-clib netware-clib-bsdsock
625db522d3aSSimon L. B. Nielsen		    netware-libc netware-libc-bsdsock);
62674664626SKris Kennaway
627c1803d78SJacques Vidrinemy $idx = 0;
628c1803d78SJacques Vidrinemy $idx_cc = $idx++;
629c1803d78SJacques Vidrinemy $idx_cflags = $idx++;
630c1803d78SJacques Vidrinemy $idx_unistd = $idx++;
631c1803d78SJacques Vidrinemy $idx_thread_cflag = $idx++;
6325c87c606SMark Murraymy $idx_sys_id = $idx++;
633c1803d78SJacques Vidrinemy $idx_lflags = $idx++;
634c1803d78SJacques Vidrinemy $idx_bn_ops = $idx++;
6353b4e3dcbSSimon L. B. Nielsenmy $idx_cpuid_obj = $idx++;
636c1803d78SJacques Vidrinemy $idx_bn_obj = $idx++;
637c1803d78SJacques Vidrinemy $idx_des_obj = $idx++;
6383b4e3dcbSSimon L. B. Nielsenmy $idx_aes_obj = $idx++;
639c1803d78SJacques Vidrinemy $idx_bf_obj = $idx++;
640c1803d78SJacques Vidrinemy $idx_md5_obj = $idx++;
641c1803d78SJacques Vidrinemy $idx_sha1_obj = $idx++;
642c1803d78SJacques Vidrinemy $idx_cast_obj = $idx++;
643c1803d78SJacques Vidrinemy $idx_rc4_obj = $idx++;
644c1803d78SJacques Vidrinemy $idx_rmd160_obj = $idx++;
645c1803d78SJacques Vidrinemy $idx_rc5_obj = $idx++;
6461f13597dSJung-uk Kimmy $idx_wp_obj = $idx++;
6471f13597dSJung-uk Kimmy $idx_cmll_obj = $idx++;
6481f13597dSJung-uk Kimmy $idx_modes_obj = $idx++;
6491f13597dSJung-uk Kimmy $idx_engines_obj = $idx++;
6501f13597dSJung-uk Kimmy $idx_perlasm_scheme = $idx++;
651c1803d78SJacques Vidrinemy $idx_dso_scheme = $idx++;
652c1803d78SJacques Vidrinemy $idx_shared_target = $idx++;
653c1803d78SJacques Vidrinemy $idx_shared_cflag = $idx++;
654c1803d78SJacques Vidrinemy $idx_shared_ldflag = $idx++;
655c1803d78SJacques Vidrinemy $idx_shared_extension = $idx++;
656c1803d78SJacques Vidrinemy $idx_ranlib = $idx++;
6575c87c606SMark Murraymy $idx_arflags = $idx++;
6581f13597dSJung-uk Kimmy $idx_multilib = $idx++;
659c1803d78SJacques Vidrine
66074664626SKris Kennawaymy $prefix="";
6616a599222SSimon L. B. Nielsenmy $libdir="";
66274664626SKris Kennawaymy $openssldir="";
6635740a5e3SKris Kennawaymy $exe_ext="";
6646a599222SSimon L. B. Nielsenmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
6656a599222SSimon L. B. Nielsenmy $cross_compile_prefix="";
6661f13597dSJung-uk Kimmy $fipsdir="/usr/local/ssl/fips-2.0";
6671f13597dSJung-uk Kimmy $fipslibdir="";
668db522d3aSSimon L. B. Nielsenmy $baseaddr="0xFB00000";
66974664626SKris Kennawaymy $no_threads=0;
67074664626SKris Kennawaymy $threads=0;
6713b4e3dcbSSimon L. B. Nielsenmy $no_shared=0; # but "no-shared" is default
6723b4e3dcbSSimon L. B. Nielsenmy $zlib=1;      # but "no-zlib" is default
6733b4e3dcbSSimon L. B. Nielsenmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
6745471f83eSSimon L. B. Nielsenmy $no_rfc3779=1; # but "no-rfc3779" is default
67574664626SKris Kennawaymy $no_asm=0;
676ddd58736SKris Kennawaymy $no_dso=0;
6773b4e3dcbSSimon L. B. Nielsenmy $no_gmp=0;
67874664626SKris Kennawaymy @skip=();
6796be8ae07SJacques Vidrinemy $Makefile="Makefile";
68074664626SKris Kennawaymy $des_locl="crypto/des/des_locl.h";
68174664626SKris Kennawaymy $des	="crypto/des/des.h";
68274664626SKris Kennawaymy $bn	="crypto/bn/bn.h";
68374664626SKris Kennawaymy $md2	="crypto/md2/md2.h";
68474664626SKris Kennawaymy $rc4	="crypto/rc4/rc4.h";
68574664626SKris Kennawaymy $rc4_locl="crypto/rc4/rc4_locl.h";
68674664626SKris Kennawaymy $idea	="crypto/idea/idea.h";
68774664626SKris Kennawaymy $rc2	="crypto/rc2/rc2.h";
68874664626SKris Kennawaymy $bf	="crypto/bf/bf_locl.h";
68974664626SKris Kennawaymy $bn_asm	="bn_asm.o";
69074664626SKris Kennawaymy $des_enc="des_enc.o fcrypt_b.o";
6913b4e3dcbSSimon L. B. Nielsenmy $aes_enc="aes_core.o aes_cbc.o";
69274664626SKris Kennawaymy $bf_enc	="bf_enc.o";
69374664626SKris Kennawaymy $cast_enc="c_enc.o";
694db522d3aSSimon L. B. Nielsenmy $rc4_enc="rc4_enc.o rc4_skey.o";
69574664626SKris Kennawaymy $rc5_enc="rc5_enc.o";
69674664626SKris Kennawaymy $md5_obj="";
69774664626SKris Kennawaymy $sha1_obj="";
69874664626SKris Kennawaymy $rmd160_obj="";
6991f13597dSJung-uk Kimmy $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
70074664626SKris Kennawaymy $processor="";
7015740a5e3SKris Kennawaymy $default_ranlib;
70274664626SKris Kennawaymy $perl;
703db522d3aSSimon L. B. Nielsenmy $fips=0;
70474664626SKris Kennaway
7051f13597dSJung-uk Kimif (exists $ENV{FIPSDIR})
7061f13597dSJung-uk Kim	{
7071f13597dSJung-uk Kim	$fipsdir = $ENV{FIPSDIR};
7081f13597dSJung-uk Kim	$fipsdir =~ s/\/$//;
7091f13597dSJung-uk Kim	}
7103b4e3dcbSSimon L. B. Nielsen
7113b4e3dcbSSimon L. B. Nielsen# All of the following is disabled by default (RC5 was enabled before 0.9.8):
7123b4e3dcbSSimon L. B. Nielsen
713db522d3aSSimon L. B. Nielsenmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
7141f13597dSJung-uk Kim		 "ec_nistp_64_gcc_128" => "default",
7153b4e3dcbSSimon L. B. Nielsen		 "gmp"		  => "default",
716db522d3aSSimon L. B. Nielsen		 "jpake"          => "experimental",
7171f13597dSJung-uk Kim		 "md2"            => "default",
7183b4e3dcbSSimon L. B. Nielsen		 "rc5"            => "default",
7195471f83eSSimon L. B. Nielsen		 "rfc3779"	  => "default",
7201f13597dSJung-uk Kim		 "sctp"       => "default",
7213b4e3dcbSSimon L. B. Nielsen		 "shared"         => "default",
7221f13597dSJung-uk Kim		 "store"	  => "experimental",
723a93cbc2bSJung-uk Kim		 "unit-test"	  => "default",
7243b4e3dcbSSimon L. B. Nielsen		 "zlib"           => "default",
7253b4e3dcbSSimon L. B. Nielsen		 "zlib-dynamic"   => "default"
7263b4e3dcbSSimon L. B. Nielsen	       );
727db522d3aSSimon L. B. Nielsenmy @experimental = ();
7283b4e3dcbSSimon L. B. Nielsen
729db522d3aSSimon L. B. Nielsen# This is what $depflags will look like with the above defaults
730db522d3aSSimon L. B. Nielsen# (we need this to see if we should advise the user to run "make depend"):
731a93cbc2bSJung-uk Kimmy $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST";
732db522d3aSSimon L. B. Nielsen
733db522d3aSSimon L. B. Nielsen# Explicit "no-..." options will be collected in %disabled along with the defaults.
734db522d3aSSimon L. B. Nielsen# To remove something from %disabled, use "enable-foo" (unless it's experimental).
735db522d3aSSimon L. B. Nielsen# For symmetry, "disable-foo" is a synonym for "no-foo".
736db522d3aSSimon L. B. Nielsen
737db522d3aSSimon L. B. Nielsen# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
738db522d3aSSimon L. B. Nielsen# We will collect such requests in @experimental.
739db522d3aSSimon L. B. Nielsen# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
7403b4e3dcbSSimon L. B. Nielsen
7413b4e3dcbSSimon L. B. Nielsen
7423b4e3dcbSSimon L. B. Nielsenmy $no_sse2=0;
7435c87c606SMark Murray
74474664626SKris Kennaway&usage if ($#ARGV < 0);
74574664626SKris Kennaway
746ddd58736SKris Kennawaymy $flags;
747ddd58736SKris Kennawaymy $depflags;
748db522d3aSSimon L. B. Nielsenmy $openssl_experimental_defines;
749ddd58736SKris Kennawaymy $openssl_algorithm_defines;
750ddd58736SKris Kennawaymy $openssl_thread_defines;
7515c87c606SMark Murraymy $openssl_sys_defines="";
752ddd58736SKris Kennawaymy $openssl_other_defines;
753ddd58736SKris Kennawaymy $libs;
754fceca8a3SJacques Vidrinemy $libkrb5="";
755ddd58736SKris Kennawaymy $target;
756ddd58736SKris Kennawaymy $options;
757ddd58736SKris Kennawaymy $symlink;
7585c87c606SMark Murraymy $make_depend=0;
7595c87c606SMark Murraymy %withargs=();
760ddd58736SKris Kennaway
761ddd58736SKris Kennawaymy @argvcopy=@ARGV;
762ddd58736SKris Kennawaymy $argvstring="";
763ddd58736SKris Kennawaymy $argv_unprocessed=1;
764ddd58736SKris Kennaway
765ddd58736SKris Kennawaywhile($argv_unprocessed)
766ddd58736SKris Kennaway	{
767ddd58736SKris Kennaway	$flags="";
768ddd58736SKris Kennaway	$depflags="";
769db522d3aSSimon L. B. Nielsen	$openssl_experimental_defines="";
770ddd58736SKris Kennaway	$openssl_algorithm_defines="";
771ddd58736SKris Kennaway	$openssl_thread_defines="";
7725c87c606SMark Murray	$openssl_sys_defines="";
773ddd58736SKris Kennaway	$openssl_other_defines="";
774ddd58736SKris Kennaway	$libs="";
775ddd58736SKris Kennaway	$target="";
776ddd58736SKris Kennaway	$options="";
777ddd58736SKris Kennaway	$symlink=1;
778ddd58736SKris Kennaway
779ddd58736SKris Kennaway	$argv_unprocessed=0;
780ddd58736SKris Kennaway	$argvstring=join(' ',@argvcopy);
781ddd58736SKris Kennaway
782ddd58736SKris KennawayPROCESS_ARGS:
783ddd58736SKris Kennaway	foreach (@argvcopy)
78474664626SKris Kennaway		{
785f579bf8eSKris Kennaway		s /^-no-/no-/; # some people just can't read the instructions
7863b4e3dcbSSimon L. B. Nielsen
7873b4e3dcbSSimon L. B. Nielsen		# rewrite some options in "enable-..." form
7883b4e3dcbSSimon L. B. Nielsen		s /^-?-?shared$/enable-shared/;
7891f13597dSJung-uk Kim		s /^sctp$/enable-sctp/;
7903b4e3dcbSSimon L. B. Nielsen		s /^threads$/enable-threads/;
7913b4e3dcbSSimon L. B. Nielsen		s /^zlib$/enable-zlib/;
7923b4e3dcbSSimon L. B. Nielsen		s /^zlib-dynamic$/enable-zlib-dynamic/;
7933b4e3dcbSSimon L. B. Nielsen
7943b4e3dcbSSimon L. B. Nielsen		if (/^no-(.+)$/ || /^disable-(.+)$/)
7953b4e3dcbSSimon L. B. Nielsen			{
796db522d3aSSimon L. B. Nielsen			if (!($disabled{$1} eq "experimental"))
797db522d3aSSimon L. B. Nielsen				{
7983b4e3dcbSSimon L. B. Nielsen				if ($1 eq "ssl")
7993b4e3dcbSSimon L. B. Nielsen					{
8003b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl2"} = "option(ssl)";
8013b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl3"} = "option(ssl)";
8023b4e3dcbSSimon L. B. Nielsen					}
8033b4e3dcbSSimon L. B. Nielsen				elsif ($1 eq "tls")
8043b4e3dcbSSimon L. B. Nielsen					{
8053b4e3dcbSSimon L. B. Nielsen					$disabled{"tls1"} = "option(tls)"
8063b4e3dcbSSimon L. B. Nielsen					}
807*751d2991SJung-uk Kim				elsif ($1 eq "ssl3-method")
808*751d2991SJung-uk Kim					{
809*751d2991SJung-uk Kim					$disabled{"ssl3-method"} = "option(ssl)";
810*751d2991SJung-uk Kim					$disabled{"ssl3"} = "option(ssl)";
811*751d2991SJung-uk Kim					}
8123b4e3dcbSSimon L. B. Nielsen				else
8133b4e3dcbSSimon L. B. Nielsen					{
8143b4e3dcbSSimon L. B. Nielsen					$disabled{$1} = "option";
8153b4e3dcbSSimon L. B. Nielsen					}
8163b4e3dcbSSimon L. B. Nielsen				}
817db522d3aSSimon L. B. Nielsen			}
818db522d3aSSimon L. B. Nielsen		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
8193b4e3dcbSSimon L. B. Nielsen			{
820db522d3aSSimon L. B. Nielsen			my $algo = $1;
821db522d3aSSimon L. B. Nielsen			if ($disabled{$algo} eq "experimental")
822db522d3aSSimon L. B. Nielsen				{
823db522d3aSSimon L. B. Nielsen				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
824db522d3aSSimon L. B. Nielsen					unless (/^experimental-/);
825db522d3aSSimon L. B. Nielsen				push @experimental, $algo;
826db522d3aSSimon L. B. Nielsen				}
827db522d3aSSimon L. B. Nielsen			delete $disabled{$algo};
8283b4e3dcbSSimon L. B. Nielsen
829db522d3aSSimon L. B. Nielsen			$threads = 1 if ($algo eq "threads");
8303b4e3dcbSSimon L. B. Nielsen			}
8313b4e3dcbSSimon L. B. Nielsen		elsif (/^--test-sanity$/)
832c1803d78SJacques Vidrine			{
833c1803d78SJacques Vidrine			exit(&test_sanity());
834c1803d78SJacques Vidrine			}
8356a599222SSimon L. B. Nielsen		elsif (/^--strict-warnings/)
8366a599222SSimon L. B. Nielsen			{
8376a599222SSimon L. B. Nielsen			$strict_warnings = 1;
8386a599222SSimon L. B. Nielsen			}
839ddd58736SKris Kennaway		elsif (/^reconfigure/ || /^reconf/)
840ddd58736SKris Kennaway			{
841ddd58736SKris Kennaway			if (open(IN,"<$Makefile"))
842ddd58736SKris Kennaway				{
843ddd58736SKris Kennaway				while (<IN>)
844ddd58736SKris Kennaway					{
8453b4e3dcbSSimon L. B. Nielsen					chomp;
846ddd58736SKris Kennaway					if (/^CONFIGURE_ARGS=(.*)/)
847ddd58736SKris Kennaway						{
848ddd58736SKris Kennaway						$argvstring=$1;
849ddd58736SKris Kennaway						@argvcopy=split(' ',$argvstring);
850ddd58736SKris Kennaway						die "Incorrect data to reconfigure, please do a normal configuration\n"
851ddd58736SKris Kennaway							if (grep(/^reconf/,@argvcopy));
852ddd58736SKris Kennaway						print "Reconfiguring with: $argvstring\n";
853ddd58736SKris Kennaway						$argv_unprocessed=1;
854ddd58736SKris Kennaway						close(IN);
855ddd58736SKris Kennaway						last PROCESS_ARGS;
856ddd58736SKris Kennaway						}
857ddd58736SKris Kennaway					}
858ddd58736SKris Kennaway				close(IN);
859ddd58736SKris Kennaway				}
860ddd58736SKris Kennaway			die "Insufficient data to reconfigure, please do a normal configuration\n";
861ddd58736SKris Kennaway			}
86274664626SKris Kennaway		elsif (/^386$/)
86374664626SKris Kennaway			{ $processor=386; }
864db522d3aSSimon L. B. Nielsen		elsif (/^fips$/)
865db522d3aSSimon L. B. Nielsen			{
866db522d3aSSimon L. B. Nielsen			$fips=1;
867db522d3aSSimon L. B. Nielsen			}
86874664626SKris Kennaway		elsif (/^rsaref$/)
86974664626SKris Kennaway			{
8705c87c606SMark Murray			# No RSAref support any more since it's not needed.
8715c87c606SMark Murray			# The check for the option is there so scripts aren't
8725c87c606SMark Murray			# broken
87374664626SKris Kennaway			}
87474664626SKris Kennaway		elsif (/^[-+]/)
87574664626SKris Kennaway			{
8761f13597dSJung-uk Kim			if (/^-[lL](.*)$/ or /^-Wl,/)
87774664626SKris Kennaway				{
87874664626SKris Kennaway				$libs.=$_." ";
87974664626SKris Kennaway				}
88074664626SKris Kennaway			elsif (/^-[^-]/ or /^\+/)
88174664626SKris Kennaway				{
8821f13597dSJung-uk Kim				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
88374664626SKris Kennaway				$flags.=$_." ";
88474664626SKris Kennaway				}
88574664626SKris Kennaway			elsif (/^--prefix=(.*)$/)
88674664626SKris Kennaway				{
88774664626SKris Kennaway				$prefix=$1;
88874664626SKris Kennaway				}
8896a599222SSimon L. B. Nielsen			elsif (/^--libdir=(.*)$/)
8906a599222SSimon L. B. Nielsen				{
8916a599222SSimon L. B. Nielsen				$libdir=$1;
8926a599222SSimon L. B. Nielsen				}
89374664626SKris Kennaway			elsif (/^--openssldir=(.*)$/)
89474664626SKris Kennaway				{
89574664626SKris Kennaway				$openssldir=$1;
89674664626SKris Kennaway				}
89774664626SKris Kennaway			elsif (/^--install.prefix=(.*)$/)
89874664626SKris Kennaway				{
89974664626SKris Kennaway				$install_prefix=$1;
90074664626SKris Kennaway				}
9015c87c606SMark Murray			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
9025c87c606SMark Murray				{
9035c87c606SMark Murray				$withargs{"krb5-".$1}=$2;
9045c87c606SMark Murray				}
9053b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-lib=(.*)$/)
9063b4e3dcbSSimon L. B. Nielsen				{
9073b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-lib"}=$1;
9083b4e3dcbSSimon L. B. Nielsen				}
9093b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-include=(.*)$/)
9103b4e3dcbSSimon L. B. Nielsen				{
9113b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-include"}="-I$1";
9123b4e3dcbSSimon L. B. Nielsen				}
9131f13597dSJung-uk Kim			elsif (/^--with-fipsdir=(.*)$/)
9141f13597dSJung-uk Kim				{
9151f13597dSJung-uk Kim				$fipsdir="$1";
9161f13597dSJung-uk Kim				}
917db522d3aSSimon L. B. Nielsen			elsif (/^--with-fipslibdir=(.*)$/)
918db522d3aSSimon L. B. Nielsen				{
9191f13597dSJung-uk Kim				$fipslibdir="$1";
920db522d3aSSimon L. B. Nielsen				}
921db522d3aSSimon L. B. Nielsen			elsif (/^--with-baseaddr=(.*)$/)
922db522d3aSSimon L. B. Nielsen				{
923db522d3aSSimon L. B. Nielsen				$baseaddr="$1";
924db522d3aSSimon L. B. Nielsen				}
9251f13597dSJung-uk Kim			elsif (/^--cross-compile-prefix=(.*)$/)
9261f13597dSJung-uk Kim				{
9271f13597dSJung-uk Kim				$cross_compile_prefix=$1;
9281f13597dSJung-uk Kim				}
92974664626SKris Kennaway			else
93074664626SKris Kennaway				{
93174664626SKris Kennaway				print STDERR $usage;
93274664626SKris Kennaway				exit(1);
93374664626SKris Kennaway				}
93474664626SKris Kennaway			}
93574664626SKris Kennaway		elsif ($_ =~ /^([^:]+):(.+)$/)
93674664626SKris Kennaway			{
93774664626SKris Kennaway			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
93874664626SKris Kennaway			$target=$1;
93974664626SKris Kennaway			}
94074664626SKris Kennaway		else
94174664626SKris Kennaway			{
9423b4e3dcbSSimon L. B. Nielsen			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
94374664626SKris Kennaway			$target=$_;
94474664626SKris Kennaway			}
94574664626SKris Kennaway
9463b4e3dcbSSimon L. B. Nielsen		unless ($_ eq $target || /^no-/ || /^disable-/)
9475c87c606SMark Murray			{
9483b4e3dcbSSimon L. B. Nielsen			# "no-..." follows later after implied disactivations
9493b4e3dcbSSimon L. B. Nielsen			# have been derived.  (Don't take this too seroiusly,
9503b4e3dcbSSimon L. B. Nielsen			# we really only write OPTIONS to the Makefile out of
9513b4e3dcbSSimon L. B. Nielsen			# nostalgia.)
9523b4e3dcbSSimon L. B. Nielsen
9533b4e3dcbSSimon L. B. Nielsen			if ($options eq "")
9543b4e3dcbSSimon L. B. Nielsen				{ $options = $_; }
9553b4e3dcbSSimon L. B. Nielsen			else
9563b4e3dcbSSimon L. B. Nielsen				{ $options .= " ".$_; }
9573b4e3dcbSSimon L. B. Nielsen			}
9583b4e3dcbSSimon L. B. Nielsen		}
9595c87c606SMark Murray	}
9605c87c606SMark Murray
9613b4e3dcbSSimon L. B. Nielsen
9623b4e3dcbSSimon L. B. Nielsen
9633b4e3dcbSSimon L. B. Nielsenif ($processor eq "386")
9645c87c606SMark Murray	{
9653b4e3dcbSSimon L. B. Nielsen	$disabled{"sse2"} = "forced";
9665c87c606SMark Murray	}
9675c87c606SMark Murray
9683b4e3dcbSSimon L. B. Nielsenif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
9695c87c606SMark Murray	{
9703b4e3dcbSSimon L. B. Nielsen	$disabled{"krb5"} = "krb5-flavor not specified";
9715c87c606SMark Murray	}
9725c87c606SMark Murray
9733b4e3dcbSSimon L. B. Nielsenif (!defined($disabled{"zlib-dynamic"}))
9743b4e3dcbSSimon L. B. Nielsen	{
9753b4e3dcbSSimon L. B. Nielsen	# "zlib-dynamic" was specifically enabled, so enable "zlib"
9763b4e3dcbSSimon L. B. Nielsen	delete $disabled{"zlib"};
9773b4e3dcbSSimon L. B. Nielsen	}
9783b4e3dcbSSimon L. B. Nielsen
9793b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"rijndael"}))
9803b4e3dcbSSimon L. B. Nielsen	{
9813b4e3dcbSSimon L. B. Nielsen	$disabled{"aes"} = "forced";
9823b4e3dcbSSimon L. B. Nielsen	}
9833b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"des"}))
9843b4e3dcbSSimon L. B. Nielsen	{
9853b4e3dcbSSimon L. B. Nielsen	$disabled{"mdc2"} = "forced";
9863b4e3dcbSSimon L. B. Nielsen	}
9873b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"ec"}))
9883b4e3dcbSSimon L. B. Nielsen	{
9893b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdsa"} = "forced";
9903b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdh"} = "forced";
9913b4e3dcbSSimon L. B. Nielsen	}
9923b4e3dcbSSimon L. B. Nielsen
9933b4e3dcbSSimon L. B. Nielsen# SSL 2.0 requires MD5 and RSA
9943b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
9953b4e3dcbSSimon L. B. Nielsen	{
9963b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl2"} = "forced";
9973b4e3dcbSSimon L. B. Nielsen	}
9983b4e3dcbSSimon L. B. Nielsen
9991f13597dSJung-uk Kimif ($fips && $fipslibdir eq "")
10001f13597dSJung-uk Kim	{
10011f13597dSJung-uk Kim	$fipslibdir = $fipsdir . "/lib/";
10021f13597dSJung-uk Kim	}
10031f13597dSJung-uk Kim
10041f13597dSJung-uk Kim# RSAX ENGINE sets default non-FIPS RSA method.
10051f13597dSJung-uk Kimif ($fips)
10061f13597dSJung-uk Kim	{
10071f13597dSJung-uk Kim	$disabled{"rsax"} = "forced";
10081f13597dSJung-uk Kim	}
10091f13597dSJung-uk Kim
10103b4e3dcbSSimon L. B. Nielsen# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
10113b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"sha"})
10123b4e3dcbSSimon L. B. Nielsen    || (defined($disabled{"rsa"})
10133b4e3dcbSSimon L. B. Nielsen        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
10143b4e3dcbSSimon L. B. Nielsen	{
10153b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl3"} = "forced";
10163b4e3dcbSSimon L. B. Nielsen	$disabled{"tls1"} = "forced";
10173b4e3dcbSSimon L. B. Nielsen	}
10183b4e3dcbSSimon L. B. Nielsen
1019db522d3aSSimon L. B. Nielsenif (defined($disabled{"tls1"}))
1020db522d3aSSimon L. B. Nielsen	{
1021db522d3aSSimon L. B. Nielsen	$disabled{"tlsext"} = "forced";
1022db522d3aSSimon L. B. Nielsen	}
10233b4e3dcbSSimon L. B. Nielsen
10241f13597dSJung-uk Kimif (defined($disabled{"ec"}) || defined($disabled{"dsa"})
10251f13597dSJung-uk Kim    || defined($disabled{"dh"}))
10261f13597dSJung-uk Kim	{
10271f13597dSJung-uk Kim	$disabled{"gost"} = "forced";
10281f13597dSJung-uk Kim	}
10291f13597dSJung-uk Kim
10301f13597dSJung-uk Kim# SRP and HEARTBEATS require TLSEXT
10311f13597dSJung-uk Kimif (defined($disabled{"tlsext"}))
10321f13597dSJung-uk Kim	{
10331f13597dSJung-uk Kim	$disabled{"srp"} = "forced";
10341f13597dSJung-uk Kim	$disabled{"heartbeats"} = "forced";
10351f13597dSJung-uk Kim	}
10361f13597dSJung-uk Kim
103774664626SKris Kennawayif ($target eq "TABLE") {
103874664626SKris Kennaway	foreach $target (sort keys %table) {
103974664626SKris Kennaway		print_table_entry($target);
104074664626SKris Kennaway	}
104174664626SKris Kennaway	exit 0;
104274664626SKris Kennaway}
104374664626SKris Kennaway
1044f579bf8eSKris Kennawayif ($target eq "LIST") {
1045f579bf8eSKris Kennaway	foreach (sort keys %table) {
1046f579bf8eSKris Kennaway		print;
1047f579bf8eSKris Kennaway		print "\n";
1048f579bf8eSKris Kennaway	}
1049f579bf8eSKris Kennaway	exit 0;
1050f579bf8eSKris Kennaway}
1051f579bf8eSKris Kennaway
1052c1803d78SJacques Vidrineif ($target =~ m/^CygWin32(-.*)$/) {
1053c1803d78SJacques Vidrine	$target = "Cygwin".$1;
1054c1803d78SJacques Vidrine}
1055c1803d78SJacques Vidrine
1056ddd58736SKris Kennawayprint "Configuring for $target\n";
1057ddd58736SKris Kennaway
105874664626SKris Kennaway&usage if (!defined($table{$target}));
105974664626SKris Kennaway
10601f13597dSJung-uk Kim
10611f13597dSJung-uk Kimforeach (sort (keys %disabled))
10621f13597dSJung-uk Kim	{
10631f13597dSJung-uk Kim	$options .= " no-$_";
10641f13597dSJung-uk Kim
10651f13597dSJung-uk Kim	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
10661f13597dSJung-uk Kim
10671f13597dSJung-uk Kim	if (/^dso$/)
10681f13597dSJung-uk Kim		{ $no_dso = 1; }
10691f13597dSJung-uk Kim	elsif (/^threads$/)
10701f13597dSJung-uk Kim		{ $no_threads = 1; }
10711f13597dSJung-uk Kim	elsif (/^shared$/)
10721f13597dSJung-uk Kim		{ $no_shared = 1; }
10731f13597dSJung-uk Kim	elsif (/^zlib$/)
10741f13597dSJung-uk Kim		{ $zlib = 0; }
10751f13597dSJung-uk Kim	elsif (/^static-engine$/)
10761f13597dSJung-uk Kim		{ }
10771f13597dSJung-uk Kim	elsif (/^zlib-dynamic$/)
10781f13597dSJung-uk Kim		{ }
10791f13597dSJung-uk Kim	elsif (/^symlinks$/)
10801f13597dSJung-uk Kim		{ $symlink = 0; }
10811f13597dSJung-uk Kim	elsif (/^sse2$/)
10821f13597dSJung-uk Kim		{ $no_sse2 = 1; }
10831f13597dSJung-uk Kim	else
10841f13597dSJung-uk Kim		{
10851f13597dSJung-uk Kim		my ($ALGO, $algo);
10861f13597dSJung-uk Kim		($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
10871f13597dSJung-uk Kim
10881f13597dSJung-uk Kim		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
10891f13597dSJung-uk Kim			{
10901f13597dSJung-uk Kim			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
10911f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
10921f13597dSJung-uk Kim
10931f13597dSJung-uk Kim			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
10941f13597dSJung-uk Kim			elsif (/^asm$/)	{ $no_asm = 1; }
10951f13597dSJung-uk Kim			}
10961f13597dSJung-uk Kim		else
10971f13597dSJung-uk Kim			{
10981f13597dSJung-uk Kim			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
10991f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
11001f13597dSJung-uk Kim
11011f13597dSJung-uk Kim			if (/^krb5$/)
11021f13597dSJung-uk Kim				{ $no_krb5 = 1; }
11031f13597dSJung-uk Kim			else
11041f13597dSJung-uk Kim				{
11051f13597dSJung-uk Kim				push @skip, $algo;
11061f13597dSJung-uk Kim				# fix-up crypto/directory name(s)
11071f13597dSJung-uk Kim				@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
11081f13597dSJung-uk Kim				print " (skip dir)";
11091f13597dSJung-uk Kim
11101f13597dSJung-uk Kim				$depflags .= " -DOPENSSL_NO_$ALGO";
11111f13597dSJung-uk Kim				}
11121f13597dSJung-uk Kim			}
11131f13597dSJung-uk Kim		}
11141f13597dSJung-uk Kim
11151f13597dSJung-uk Kim	print "\n";
11161f13597dSJung-uk Kim	}
11171f13597dSJung-uk Kim
11181f13597dSJung-uk Kimmy $exp_cflags = "";
11191f13597dSJung-uk Kimforeach (sort @experimental)
11201f13597dSJung-uk Kim	{
11211f13597dSJung-uk Kim	my $ALGO;
11221f13597dSJung-uk Kim	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
11231f13597dSJung-uk Kim
11241f13597dSJung-uk Kim	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
11251f13597dSJung-uk Kim	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
11261f13597dSJung-uk Kim	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
11271f13597dSJung-uk Kim	}
11281f13597dSJung-uk Kim
11291f13597dSJung-uk Kimmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
11301f13597dSJung-uk Kim
11311f13597dSJung-uk Kim$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
11321f13597dSJung-uk Kim$exe_ext=".nlm" if ($target =~ /netware/);
11331f13597dSJung-uk Kim$exe_ext=".pm"  if ($target =~ /vos/);
11341f13597dSJung-uk Kim$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
11351f13597dSJung-uk Kim$prefix=$openssldir if $prefix eq "";
11361f13597dSJung-uk Kim
11371f13597dSJung-uk Kim$default_ranlib= &which("ranlib") or $default_ranlib="true";
11381f13597dSJung-uk Kim$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
11391f13597dSJung-uk Kim  or $perl="perl";
11401f13597dSJung-uk Kimmy $make = $ENV{'MAKE'} || "make";
11411f13597dSJung-uk Kim
11421f13597dSJung-uk Kim$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
11431f13597dSJung-uk Kim
11441f13597dSJung-uk Kimchop $openssldir if $openssldir =~ /\/$/;
11451f13597dSJung-uk Kimchop $prefix if $prefix =~ /.\/$/;
11461f13597dSJung-uk Kim
11471f13597dSJung-uk Kim$openssldir=$prefix . "/ssl" if $openssldir eq "";
11481f13597dSJung-uk Kim$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
11491f13597dSJung-uk Kim
11501f13597dSJung-uk Kim
11511f13597dSJung-uk Kimprint "IsMK1MF=$IsMK1MF\n";
11521f13597dSJung-uk Kim
1153db522d3aSSimon L. B. Nielsenmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1154db522d3aSSimon L. B. Nielsenmy $cc = $fields[$idx_cc];
1155db522d3aSSimon L. B. Nielsen# Allow environment CC to override compiler...
1156db522d3aSSimon L. B. Nielsenif($ENV{CC}) {
1157db522d3aSSimon L. B. Nielsen    $cc = $ENV{CC};
1158db522d3aSSimon L. B. Nielsen}
1159db522d3aSSimon L. B. Nielsenmy $cflags = $fields[$idx_cflags];
1160db522d3aSSimon L. B. Nielsenmy $unistd = $fields[$idx_unistd];
1161db522d3aSSimon L. B. Nielsenmy $thread_cflag = $fields[$idx_thread_cflag];
1162db522d3aSSimon L. B. Nielsenmy $sys_id = $fields[$idx_sys_id];
1163db522d3aSSimon L. B. Nielsenmy $lflags = $fields[$idx_lflags];
1164db522d3aSSimon L. B. Nielsenmy $bn_ops = $fields[$idx_bn_ops];
1165db522d3aSSimon L. B. Nielsenmy $cpuid_obj = $fields[$idx_cpuid_obj];
1166db522d3aSSimon L. B. Nielsenmy $bn_obj = $fields[$idx_bn_obj];
1167db522d3aSSimon L. B. Nielsenmy $des_obj = $fields[$idx_des_obj];
1168db522d3aSSimon L. B. Nielsenmy $aes_obj = $fields[$idx_aes_obj];
1169db522d3aSSimon L. B. Nielsenmy $bf_obj = $fields[$idx_bf_obj];
1170db522d3aSSimon L. B. Nielsenmy $md5_obj = $fields[$idx_md5_obj];
1171db522d3aSSimon L. B. Nielsenmy $sha1_obj = $fields[$idx_sha1_obj];
1172db522d3aSSimon L. B. Nielsenmy $cast_obj = $fields[$idx_cast_obj];
1173db522d3aSSimon L. B. Nielsenmy $rc4_obj = $fields[$idx_rc4_obj];
1174db522d3aSSimon L. B. Nielsenmy $rmd160_obj = $fields[$idx_rmd160_obj];
1175db522d3aSSimon L. B. Nielsenmy $rc5_obj = $fields[$idx_rc5_obj];
11761f13597dSJung-uk Kimmy $wp_obj = $fields[$idx_wp_obj];
11771f13597dSJung-uk Kimmy $cmll_obj = $fields[$idx_cmll_obj];
11781f13597dSJung-uk Kimmy $modes_obj = $fields[$idx_modes_obj];
11791f13597dSJung-uk Kimmy $engines_obj = $fields[$idx_engines_obj];
11801f13597dSJung-uk Kimmy $perlasm_scheme = $fields[$idx_perlasm_scheme];
1181db522d3aSSimon L. B. Nielsenmy $dso_scheme = $fields[$idx_dso_scheme];
1182db522d3aSSimon L. B. Nielsenmy $shared_target = $fields[$idx_shared_target];
1183db522d3aSSimon L. B. Nielsenmy $shared_cflag = $fields[$idx_shared_cflag];
1184db522d3aSSimon L. B. Nielsenmy $shared_ldflag = $fields[$idx_shared_ldflag];
1185db522d3aSSimon L. B. Nielsenmy $shared_extension = $fields[$idx_shared_extension];
11866a599222SSimon L. B. Nielsenmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
11876a599222SSimon L. B. Nielsenmy $ar = $ENV{'AR'} || "ar";
1188db522d3aSSimon L. B. Nielsenmy $arflags = $fields[$idx_arflags];
11891f13597dSJung-uk Kimmy $multilib = $fields[$idx_multilib];
1190db522d3aSSimon L. B. Nielsen
11911f13597dSJung-uk Kim# if $prefix/lib$multilib is not an existing directory, then
11921f13597dSJung-uk Kim# assume that it's not searched by linker automatically, in
11931f13597dSJung-uk Kim# which case adding $multilib suffix causes more grief than
11941f13597dSJung-uk Kim# we're ready to tolerate, so don't...
11951f13597dSJung-uk Kim$multilib="" if !-d "$prefix/lib$multilib";
1196db522d3aSSimon L. B. Nielsen
11971f13597dSJung-uk Kim$libdir="lib$multilib" if $libdir eq "";
1198db522d3aSSimon L. B. Nielsen
11991f13597dSJung-uk Kim$cflags = "$cflags$exp_cflags";
120074664626SKris Kennaway
1201db522d3aSSimon L. B. Nielsen# '%' in $lflags is used to split flags to "pre-" and post-flags
1202db522d3aSSimon L. B. Nielsenmy ($prelflags,$postlflags)=split('%',$lflags);
1203db522d3aSSimon L. B. Nielsenif (defined($postlflags))	{ $lflags=$postlflags;	}
1204db522d3aSSimon L. B. Nielsenelse				{ $lflags=$prelflags; undef $prelflags;	}
1205c1803d78SJacques Vidrine
12061f13597dSJung-uk Kimif ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
12071f13597dSJung-uk Kim	{
12081f13597dSJung-uk Kim	$cflags =~ s/\-mno\-cygwin\s*//;
12091f13597dSJung-uk Kim	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
12101f13597dSJung-uk Kim	}
12111f13597dSJung-uk Kim
1212fceca8a3SJacques Vidrinemy $no_shared_warn=0;
12133b4e3dcbSSimon L. B. Nielsenmy $no_user_cflags=0;
1214fceca8a3SJacques Vidrine
12153b4e3dcbSSimon L. B. Nielsenif ($flags ne "")	{ $cflags="$flags$cflags"; }
12163b4e3dcbSSimon L. B. Nielsenelse			{ $no_user_cflags=1;       }
121774664626SKris Kennaway
12185c87c606SMark Murray# Kerberos settings.  The flavor must be provided from outside, either through
12195c87c606SMark Murray# the script "config" or manually.
12203b4e3dcbSSimon L. B. Nielsenif (!$no_krb5)
12215c87c606SMark Murray	{
12225c87c606SMark Murray	my ($lresolv, $lpath, $lext);
12235c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
12245c87c606SMark Murray		{
12255c87c606SMark Murray		die "Sorry, Heimdal is currently not supported\n";
12265c87c606SMark Murray		}
12275c87c606SMark Murray	##### HACK to force use of Heimdal.
12285c87c606SMark Murray	##### WARNING: Since we don't really have adequate support for Heimdal,
12295c87c606SMark Murray	#####          using this will break the build.  You'll have to make
12305c87c606SMark Murray	#####          changes to the source, and if you do, please send
12315c87c606SMark Murray	#####          patches to openssl-dev@openssl.org
12325c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
12335c87c606SMark Murray		{
12345c87c606SMark Murray		warn "Heimdal isn't really supported.  Your build WILL break\n";
12355c87c606SMark Murray		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
12365c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/heimdal"
12375c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
12385c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
12395c87c606SMark Murray			"/lib -lgssapi -lkrb5 -lcom_err"
12403b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
12415c87c606SMark Murray		$cflags="-DKRB5_HEIMDAL $cflags";
12425c87c606SMark Murray		}
12435c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
12445c87c606SMark Murray		{
12455c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/kerberos"
12465c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
12475c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
12485c87c606SMark Murray			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
12493b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
12505c87c606SMark Murray		$cflags="-DKRB5_MIT $cflags";
12515c87c606SMark Murray		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
12525c87c606SMark Murray		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
12535c87c606SMark Murray			{
12545c87c606SMark Murray			$cflags="-DKRB5_MIT_OLD11 $cflags";
12555c87c606SMark Murray			}
12565c87c606SMark Murray		}
12575c87c606SMark Murray	LRESOLV:
12585c87c606SMark Murray	foreach $lpath ("/lib", "/usr/lib")
12595c87c606SMark Murray		{
12605c87c606SMark Murray		foreach $lext ("a", "so")
12615c87c606SMark Murray			{
12625c87c606SMark Murray			$lresolv = "$lpath/libresolv.$lext";
12635c87c606SMark Murray			last LRESOLV	if (-r "$lresolv");
12645c87c606SMark Murray			$lresolv = "";
12655c87c606SMark Murray			}
12665c87c606SMark Murray		}
12675c87c606SMark Murray	$withargs{"krb5-lib"} .= " -lresolv"
12685c87c606SMark Murray		if ("$lresolv" ne "");
12695c87c606SMark Murray	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
12705c87c606SMark Murray		if $withargs{"krb5-include"} eq "" &&
12715c87c606SMark Murray		   $withargs{"krb5-dir"} ne "";
12725c87c606SMark Murray	}
12735c87c606SMark Murray
1274ddd58736SKris Kennaway# The DSO code currently always implements all functions so that no
1275ddd58736SKris Kennaway# applications will have to worry about that from a compilation point
1276ddd58736SKris Kennaway# of view. However, the "method"s may return zero unless that platform
1277ddd58736SKris Kennaway# has support compiled in for them. Currently each method is enabled
1278ddd58736SKris Kennaway# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1279ddd58736SKris Kennaway# string entry into using the following logic;
1280ddd58736SKris Kennawaymy $dso_cflags;
1281ddd58736SKris Kennawayif (!$no_dso && $dso_scheme ne "")
1282ddd58736SKris Kennaway	{
1283ddd58736SKris Kennaway	$dso_scheme =~ tr/[a-z]/[A-Z]/;
1284ddd58736SKris Kennaway	if ($dso_scheme eq "DLFCN")
1285ddd58736SKris Kennaway		{
1286ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
1287ddd58736SKris Kennaway		}
1288ddd58736SKris Kennaway	elsif ($dso_scheme eq "DLFCN_NO_H")
1289ddd58736SKris Kennaway		{
1290ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN";
1291ddd58736SKris Kennaway		}
1292ddd58736SKris Kennaway	else
1293ddd58736SKris Kennaway		{
1294ddd58736SKris Kennaway		$dso_cflags = "-DDSO_$dso_scheme";
1295ddd58736SKris Kennaway		}
1296ddd58736SKris Kennaway	$cflags = "$dso_cflags $cflags";
1297ddd58736SKris Kennaway	}
1298ddd58736SKris Kennaway
129974664626SKris Kennawaymy $thread_cflags;
1300f579bf8eSKris Kennawaymy $thread_defines;
130174664626SKris Kennawayif ($thread_cflag ne "(unknown)" && !$no_threads)
130274664626SKris Kennaway	{
130374664626SKris Kennaway	# If we know how to do it, support threads by default.
130474664626SKris Kennaway	$threads = 1;
130574664626SKris Kennaway	}
13063b4e3dcbSSimon L. B. Nielsenif ($thread_cflag eq "(unknown)" && $threads)
130774664626SKris Kennaway	{
13083b4e3dcbSSimon L. B. Nielsen	# If the user asked for "threads", [s]he is also expected to
13093b4e3dcbSSimon L. B. Nielsen	# provide any system-dependent compiler options that are
13103b4e3dcbSSimon L. B. Nielsen	# necessary.
13113b4e3dcbSSimon L. B. Nielsen	if ($no_user_cflags)
13123b4e3dcbSSimon L. B. Nielsen		{
13133b4e3dcbSSimon L. B. Nielsen		print "You asked for multi-threading support, but didn't\n";
13143b4e3dcbSSimon L. B. Nielsen		print "provide any system-specific compiler options\n";
13153b4e3dcbSSimon L. B. Nielsen		exit(1);
13163b4e3dcbSSimon L. B. Nielsen		}
13175c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
13185c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
131974664626SKris Kennaway	}
132074664626SKris Kennawayelse
132174664626SKris Kennaway	{
13225c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
13235c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
1324f579bf8eSKris Kennaway#	my $def;
1325f579bf8eSKris Kennaway#	foreach $def (split ' ',$thread_cflag)
1326f579bf8eSKris Kennaway#		{
1327f579bf8eSKris Kennaway#		if ($def =~ s/^-D// && $def !~ /^_/)
1328f579bf8eSKris Kennaway#			{
1329f579bf8eSKris Kennaway#			$thread_defines .= "#define $def\n";
1330f579bf8eSKris Kennaway#			}
1331f579bf8eSKris Kennaway#		}
133274664626SKris Kennaway	}
133374664626SKris Kennaway
133474664626SKris Kennaway$lflags="$libs$lflags" if ($libs ne "");
133574664626SKris Kennaway
133674664626SKris Kennawayif ($no_asm)
133774664626SKris Kennaway	{
13381f13597dSJung-uk Kim	$cpuid_obj=$bn_obj=
13391f13597dSJung-uk Kim	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
13401f13597dSJung-uk Kim	$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
134174664626SKris Kennaway	}
134274664626SKris Kennaway
13435c87c606SMark Murrayif (!$no_shared)
13445c87c606SMark Murray	{
13455c87c606SMark Murray	$cast_obj="";	# CAST assembler is not PIC
13465c87c606SMark Murray	}
13475c87c606SMark Murray
134874664626SKris Kennawayif ($threads)
134974664626SKris Kennaway	{
135074664626SKris Kennaway	$cflags=$thread_cflags;
1351f579bf8eSKris Kennaway	$openssl_thread_defines .= $thread_defines;
135274664626SKris Kennaway	}
135374664626SKris Kennaway
13545c87c606SMark Murrayif ($zlib)
13555c87c606SMark Murray	{
13565c87c606SMark Murray	$cflags = "-DZLIB $cflags";
13573b4e3dcbSSimon L. B. Nielsen	if (defined($disabled{"zlib-dynamic"}))
13583b4e3dcbSSimon L. B. Nielsen		{
13591f13597dSJung-uk Kim		if (defined($withargs{"zlib-lib"}))
13601f13597dSJung-uk Kim			{
13611f13597dSJung-uk Kim			$lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
13621f13597dSJung-uk Kim			}
13631f13597dSJung-uk Kim		else
13641f13597dSJung-uk Kim			{
13653b4e3dcbSSimon L. B. Nielsen			$lflags = "$lflags -lz";
13663b4e3dcbSSimon L. B. Nielsen			}
13671f13597dSJung-uk Kim		}
13683b4e3dcbSSimon L. B. Nielsen	else
13693b4e3dcbSSimon L. B. Nielsen		{
13703b4e3dcbSSimon L. B. Nielsen		$cflags = "-DZLIB_SHARED $cflags";
13713b4e3dcbSSimon L. B. Nielsen		}
13725c87c606SMark Murray	}
13735c87c606SMark Murray
1374ddd58736SKris Kennaway# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
13755740a5e3SKris Kennawaymy $shared_mark = "";
13765c87c606SMark Murrayif ($shared_target eq "")
13775c87c606SMark Murray	{
13781f13597dSJung-uk Kim	$no_shared_warn = 1 if !$no_shared;
13795c87c606SMark Murray	$no_shared = 1;
13805c87c606SMark Murray	}
13815c87c606SMark Murrayif (!$no_shared)
13825740a5e3SKris Kennaway	{
1383ddd58736SKris Kennaway	if ($shared_cflag ne "")
1384ddd58736SKris Kennaway		{
13853b4e3dcbSSimon L. B. Nielsen		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
13863b4e3dcbSSimon L. B. Nielsen		}
13873b4e3dcbSSimon L. B. Nielsen	}
13883b4e3dcbSSimon L. B. Nielsen
13893b4e3dcbSSimon L. B. Nielsenif (!$IsMK1MF)
13903b4e3dcbSSimon L. B. Nielsen	{
13911f13597dSJung-uk Kim	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
13923b4e3dcbSSimon L. B. Nielsen	if ($no_shared)
13933b4e3dcbSSimon L. B. Nielsen		{
13943b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
13951f13597dSJung-uk Kim		$options.=" static-engine";
13963b4e3dcbSSimon L. B. Nielsen		}
13973b4e3dcbSSimon L. B. Nielsen	else
13983b4e3dcbSSimon L. B. Nielsen		{
13993b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
14001f13597dSJung-uk Kim		$options.=" no-static-engine";
14013b4e3dcbSSimon L. B. Nielsen		}
14023b4e3dcbSSimon L. B. Nielsen	}
14033b4e3dcbSSimon L. B. Nielsen
14041f13597dSJung-uk Kim$cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1405db522d3aSSimon L. B. Nielsen
1406db522d3aSSimon L. B. Nielsen#
1407db522d3aSSimon L. B. Nielsen# Platform fix-ups
1408db522d3aSSimon L. B. Nielsen#
1409db522d3aSSimon L. B. Nielsenif ($target =~ /\-icc$/)	# Intel C compiler
14103b4e3dcbSSimon L. B. Nielsen	{
1411db522d3aSSimon L. B. Nielsen	my $iccver=0;
1412db522d3aSSimon L. B. Nielsen	if (open(FD,"$cc -V 2>&1 |"))
1413db522d3aSSimon L. B. Nielsen		{
1414db522d3aSSimon L. B. Nielsen		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1415db522d3aSSimon L. B. Nielsen		close(FD);
1416db522d3aSSimon L. B. Nielsen		}
14173b4e3dcbSSimon L. B. Nielsen	if ($iccver>=8)
14183b4e3dcbSSimon L. B. Nielsen		{
14193b4e3dcbSSimon L. B. Nielsen		# Eliminate unnecessary dependency from libirc.a. This is
14203b4e3dcbSSimon L. B. Nielsen		# essential for shared library support, as otherwise
14213b4e3dcbSSimon L. B. Nielsen		# apps/openssl can end up in endless loop upon startup...
14223b4e3dcbSSimon L. B. Nielsen		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
14235740a5e3SKris Kennaway		}
1424db522d3aSSimon L. B. Nielsen	if ($iccver>=9)
1425db522d3aSSimon L. B. Nielsen		{
1426db522d3aSSimon L. B. Nielsen		$cflags.=" -i-static";
1427db522d3aSSimon L. B. Nielsen		$cflags=~s/\-no_cpprt/-no-cpprt/;
1428db522d3aSSimon L. B. Nielsen		}
1429db522d3aSSimon L. B. Nielsen	if ($iccver>=10)
1430db522d3aSSimon L. B. Nielsen		{
1431db522d3aSSimon L. B. Nielsen		$cflags=~s/\-i\-static/-static-intel/;
1432db522d3aSSimon L. B. Nielsen		}
1433db522d3aSSimon L. B. Nielsen	}
1434db522d3aSSimon L. B. Nielsen
1435db522d3aSSimon L. B. Nielsen# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1436db522d3aSSimon L. B. Nielsen# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1437db522d3aSSimon L. B. Nielsen# .so objects. Apparently application RPATH is not global and does
1438db522d3aSSimon L. B. Nielsen# not apply to .so linked with other .so. Problem manifests itself
1439db522d3aSSimon L. B. Nielsen# when libssl.so fails to load libcrypto.so. One can argue that we
1440db522d3aSSimon L. B. Nielsen# should engrave this into Makefile.shared rules or into BSD-* config
1441db522d3aSSimon L. B. Nielsen# lines above. Meanwhile let's try to be cautious and pass -rpath to
1442db522d3aSSimon L. B. Nielsen# linker only when --prefix is not /usr.
1443db522d3aSSimon L. B. Nielsenif ($target =~ /^BSD\-/)
1444db522d3aSSimon L. B. Nielsen	{
1445db522d3aSSimon L. B. Nielsen	$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1446ddd58736SKris Kennaway	}
14475c87c606SMark Murray
14485c87c606SMark Murrayif ($sys_id ne "")
1449de7cdddaSKris Kennaway	{
14503b4e3dcbSSimon L. B. Nielsen	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
14515c87c606SMark Murray	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
1452de7cdddaSKris Kennaway	}
1453ddd58736SKris Kennaway
14545740a5e3SKris Kennawayif ($ranlib eq "")
14555740a5e3SKris Kennaway	{
14565740a5e3SKris Kennaway	$ranlib = $default_ranlib;
14575740a5e3SKris Kennaway	}
14585740a5e3SKris Kennaway
145974664626SKris Kennaway#my ($bn1)=split(/\s+/,$bn_obj);
146074664626SKris Kennaway#$bn1 = "" unless defined $bn1;
146174664626SKris Kennaway#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
146274664626SKris Kennaway#$bn_obj="$bn1";
146374664626SKris Kennaway
14643b4e3dcbSSimon L. B. Nielsen$cpuid_obj="" if ($processor eq "386");
146574664626SKris Kennaway
14663b4e3dcbSSimon L. B. Nielsen$bn_obj = $bn_asm unless $bn_obj ne "";
14671f13597dSJung-uk Kim# bn-586 is the only one implementing bn_*_part_words
14681f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
14691f13597dSJung-uk Kim$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
14703b4e3dcbSSimon L. B. Nielsen
14711f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
14721f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
14731f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
1474db522d3aSSimon L. B. Nielsen
1475db522d3aSSimon L. B. Nielsenif ($fips)
1476db522d3aSSimon L. B. Nielsen	{
1477db522d3aSSimon L. B. Nielsen	$openssl_other_defines.="#define OPENSSL_FIPS\n";
14781f13597dSJung-uk Kim	$cflags .= " -I\$(FIPSDIR)/include";
1479db522d3aSSimon L. B. Nielsen	}
1480db522d3aSSimon L. B. Nielsen
14811f13597dSJung-uk Kim$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
14823b4e3dcbSSimon L. B. Nielsen$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
148374664626SKris Kennaway$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
148474664626SKris Kennaway$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
148574664626SKris Kennaway$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
148674664626SKris Kennaway$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
14873b4e3dcbSSimon L. B. Nielsenif ($sha1_obj =~ /\.o$/)
148874664626SKris Kennaway	{
148974664626SKris Kennaway#	$sha1_obj=$sha1_enc;
14903b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
14913b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
14923b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1493db522d3aSSimon L. B. Nielsen	if ($sha1_obj =~ /sse2/)
14943b4e3dcbSSimon L. B. Nielsen	    {	if ($no_sse2)
14953b4e3dcbSSimon L. B. Nielsen		{   $sha1_obj =~ s/\S*sse2\S+//;        }
14963b4e3dcbSSimon L. B. Nielsen		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
14973b4e3dcbSSimon L. B. Nielsen		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
14983b4e3dcbSSimon L. B. Nielsen	    }
149974664626SKris Kennaway	}
150074664626SKris Kennawayif ($md5_obj =~ /\.o$/)
150174664626SKris Kennaway	{
150274664626SKris Kennaway#	$md5_obj=$md5_enc;
150374664626SKris Kennaway	$cflags.=" -DMD5_ASM";
150474664626SKris Kennaway	}
150574664626SKris Kennawayif ($rmd160_obj =~ /\.o$/)
150674664626SKris Kennaway	{
150774664626SKris Kennaway#	$rmd160_obj=$rmd160_enc;
150874664626SKris Kennaway	$cflags.=" -DRMD160_ASM";
150974664626SKris Kennaway	}
15103b4e3dcbSSimon L. B. Nielsenif ($aes_obj =~ /\.o$/)
15116be8ae07SJacques Vidrine	{
15123b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DAES_ASM";
15131f13597dSJung-uk Kim	# aes-ctr.o is not a real file, only indication that assembler
15141f13597dSJung-uk Kim	# module implements AES_ctr32_encrypt...
15151f13597dSJung-uk Kim	$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
15161f13597dSJung-uk Kim	# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
15171f13597dSJung-uk Kim	$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
15181f13597dSJung-uk Kim	$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
15191f13597dSJung-uk Kim	$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
15201f13597dSJung-uk Kim	$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
15213b4e3dcbSSimon L. B. Nielsen	}
15223b4e3dcbSSimon L. B. Nielsenelse	{
15233b4e3dcbSSimon L. B. Nielsen	$aes_obj=$aes_enc;
15246be8ae07SJacques Vidrine	}
15251f13597dSJung-uk Kim$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
15261f13597dSJung-uk Kimif ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
15271f13597dSJung-uk Kim	{
15281f13597dSJung-uk Kim	$cflags.=" -DWHIRLPOOL_ASM";
15291f13597dSJung-uk Kim	}
15301f13597dSJung-uk Kimelse	{
15311f13597dSJung-uk Kim	$wp_obj="wp_block.o";
15321f13597dSJung-uk Kim	}
15331f13597dSJung-uk Kim$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
15341f13597dSJung-uk Kimif ($modes_obj =~ /ghash/)
15351f13597dSJung-uk Kim	{
15361f13597dSJung-uk Kim	$cflags.=" -DGHASH_ASM";
15371f13597dSJung-uk Kim	}
15386be8ae07SJacques Vidrine
15394f20a5a2SJacques Vidrine# "Stringify" the C flags string.  This permits it to be made part of a string
15404f20a5a2SJacques Vidrine# and works as well on command lines.
15414f20a5a2SJacques Vidrine$cflags =~ s/([\\\"])/\\\1/g;
15424f20a5a2SJacques Vidrine
154374664626SKris Kennawaymy $version = "unknown";
15443b4e3dcbSSimon L. B. Nielsenmy $version_num = "unknown";
154574664626SKris Kennawaymy $major = "unknown";
154674664626SKris Kennawaymy $minor = "unknown";
1547ddd58736SKris Kennawaymy $shlib_version_number = "unknown";
1548ddd58736SKris Kennawaymy $shlib_version_history = "unknown";
1549ddd58736SKris Kennawaymy $shlib_major = "unknown";
1550ddd58736SKris Kennawaymy $shlib_minor = "unknown";
155174664626SKris Kennaway
155274664626SKris Kennawayopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
155374664626SKris Kennawaywhile (<IN>)
155474664626SKris Kennaway	{
155574664626SKris Kennaway	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
15563b4e3dcbSSimon L. B. Nielsen	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
1557ddd58736SKris Kennaway	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
1558ddd58736SKris Kennaway	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
155974664626SKris Kennaway	}
156074664626SKris Kennawayclose(IN);
1561ddd58736SKris Kennawayif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
156274664626SKris Kennaway
156374664626SKris Kennawayif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
156474664626SKris Kennaway	{
156574664626SKris Kennaway	$major=$1;
156674664626SKris Kennaway	$minor=$2;
156774664626SKris Kennaway	}
156874664626SKris Kennaway
1569ddd58736SKris Kennawayif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
1570ddd58736SKris Kennaway	{
1571ddd58736SKris Kennaway	$shlib_major=$1;
1572ddd58736SKris Kennaway	$shlib_minor=$2;
1573ddd58736SKris Kennaway	}
1574ddd58736SKris Kennaway
15756a599222SSimon L. B. Nielsenif ($strict_warnings)
15766a599222SSimon L. B. Nielsen	{
15776a599222SSimon L. B. Nielsen	my $wopt;
15786a599222SSimon L. B. Nielsen	die "ERROR --strict-warnings requires gcc" unless ($cc =~ /gcc$/);
15796a599222SSimon L. B. Nielsen	foreach $wopt (split /\s+/, $gcc_devteam_warn)
15806a599222SSimon L. B. Nielsen		{
15816a599222SSimon L. B. Nielsen		$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
15826a599222SSimon L. B. Nielsen		}
15836a599222SSimon L. B. Nielsen	}
15846a599222SSimon L. B. Nielsen
158574664626SKris Kennawayopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
15865c87c606SMark Murrayunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
15875c87c606SMark Murrayopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
1588f579bf8eSKris Kennawayprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
158974664626SKris Kennawaymy $sdirs=0;
159074664626SKris Kennawaywhile (<IN>)
159174664626SKris Kennaway	{
15923b4e3dcbSSimon L. B. Nielsen	chomp;
159374664626SKris Kennaway	$sdirs = 1 if /^SDIRS=/;
159474664626SKris Kennaway	if ($sdirs) {
159574664626SKris Kennaway		my $dir;
159674664626SKris Kennaway		foreach $dir (@skip) {
15971f13597dSJung-uk Kim			s/(\s)$dir /$1/;
1598db522d3aSSimon L. B. Nielsen			s/\s$dir$//;
159974664626SKris Kennaway			}
160074664626SKris Kennaway		}
160174664626SKris Kennaway	$sdirs = 0 unless /\\$/;
1602db522d3aSSimon L. B. Nielsen        s/engines // if (/^DIRS=/ && $disabled{"engine"});
16031f13597dSJung-uk Kim	s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"});
160474664626SKris Kennaway	s/^VERSION=.*/VERSION=$version/;
160574664626SKris Kennaway	s/^MAJOR=.*/MAJOR=$major/;
160674664626SKris Kennaway	s/^MINOR=.*/MINOR=$minor/;
1607ddd58736SKris Kennaway	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
1608ddd58736SKris Kennaway	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
1609ddd58736SKris Kennaway	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
1610ddd58736SKris Kennaway	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
16115740a5e3SKris Kennaway	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
161274664626SKris Kennaway	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
16131f13597dSJung-uk Kim	s/^MULTILIB=.*$/MULTILIB=$multilib/;
161474664626SKris Kennaway	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
16156a599222SSimon L. B. Nielsen	s/^LIBDIR=.*$/LIBDIR=$libdir/;
161674664626SKris Kennaway	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
161774664626SKris Kennaway	s/^PLATFORM=.*$/PLATFORM=$target/;
161874664626SKris Kennaway	s/^OPTIONS=.*$/OPTIONS=$options/;
1619ddd58736SKris Kennaway	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
16206a599222SSimon L. B. Nielsen	if ($cross_compile_prefix)
16216a599222SSimon L. B. Nielsen		{
16226a599222SSimon L. B. Nielsen		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
16236a599222SSimon L. B. Nielsen		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
16241f13597dSJung-uk Kim		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
16256a599222SSimon L. B. Nielsen		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
16261f13597dSJung-uk Kim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc";
16276a599222SSimon L. B. Nielsen		}
16286a599222SSimon L. B. Nielsen	else	{
162974664626SKris Kennaway		s/^CC=.*$/CC= $cc/;
16306a599222SSimon L. B. Nielsen		s/^AR=\s*ar/AR= $ar/;
16316a599222SSimon L. B. Nielsen		s/^RANLIB=.*/RANLIB= $ranlib/;
16325c87c606SMark Murray		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
16331f13597dSJung-uk Kim		}
163474664626SKris Kennaway	s/^CFLAG=.*$/CFLAG= $cflags/;
163574664626SKris Kennaway	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1636db522d3aSSimon L. B. Nielsen	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
163774664626SKris Kennaway	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
16385740a5e3SKris Kennaway	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
16393b4e3dcbSSimon L. B. Nielsen	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
164074664626SKris Kennaway	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
164174664626SKris Kennaway	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
16421f13597dSJung-uk Kim	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
164374664626SKris Kennaway	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
164474664626SKris Kennaway	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
164574664626SKris Kennaway	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
164674664626SKris Kennaway	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
164774664626SKris Kennaway	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
164874664626SKris Kennaway	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
164974664626SKris Kennaway	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
16501f13597dSJung-uk Kim	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
16511f13597dSJung-uk Kim	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
16521f13597dSJung-uk Kim	s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
16531f13597dSJung-uk Kim	s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
16541f13597dSJung-uk Kim	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
165574664626SKris Kennaway	s/^PROCESSOR=.*/PROCESSOR= $processor/;
16565c87c606SMark Murray	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
165774664626SKris Kennaway	s/^PERL=.*/PERL= $perl/;
16585c87c606SMark Murray	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1659fceca8a3SJacques Vidrine	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
16603b4e3dcbSSimon L. B. Nielsen	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
16613b4e3dcbSSimon L. B. Nielsen	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
16621f13597dSJung-uk Kim
16631f13597dSJung-uk Kim	s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
1664db522d3aSSimon L. B. Nielsen	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1665db522d3aSSimon L. B. Nielsen	s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1666db522d3aSSimon L. B. Nielsen	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
16671f13597dSJung-uk Kim
1668ddd58736SKris Kennaway	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
16695740a5e3SKris Kennaway	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
16701f13597dSJung-uk Kim	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
1671a21b1b38SKris Kennaway	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
1672a21b1b38SKris Kennaway		{
1673a21b1b38SKris Kennaway		my $sotmp = $1;
16744f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
16754f20a5a2SJacques Vidrine		}
16764f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
16774f20a5a2SJacques Vidrine		{
16784f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1679a21b1b38SKris Kennaway		}
1680a21b1b38SKris Kennaway	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
1681a21b1b38SKris Kennaway		{
1682a21b1b38SKris Kennaway		my $sotmp = $1;
1683a21b1b38SKris Kennaway		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
1684a21b1b38SKris Kennaway		}
16854f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
16864f20a5a2SJacques Vidrine		{
16874f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
16884f20a5a2SJacques Vidrine		}
1689c1803d78SJacques Vidrine	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
169074664626SKris Kennaway	print OUT $_."\n";
169174664626SKris Kennaway	}
169274664626SKris Kennawayclose(IN);
169374664626SKris Kennawayclose(OUT);
16945c87c606SMark Murrayrename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
16955c87c606SMark Murrayrename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
169674664626SKris Kennaway
169774664626SKris Kennawayprint "CC            =$cc\n";
169874664626SKris Kennawayprint "CFLAG         =$cflags\n";
169974664626SKris Kennawayprint "EX_LIBS       =$lflags\n";
17003b4e3dcbSSimon L. B. Nielsenprint "CPUID_OBJ     =$cpuid_obj\n";
170174664626SKris Kennawayprint "BN_ASM        =$bn_obj\n";
170274664626SKris Kennawayprint "DES_ENC       =$des_obj\n";
17031f13597dSJung-uk Kimprint "AES_ENC       =$aes_obj\n";
170474664626SKris Kennawayprint "BF_ENC        =$bf_obj\n";
170574664626SKris Kennawayprint "CAST_ENC      =$cast_obj\n";
170674664626SKris Kennawayprint "RC4_ENC       =$rc4_obj\n";
170774664626SKris Kennawayprint "RC5_ENC       =$rc5_obj\n";
170874664626SKris Kennawayprint "MD5_OBJ_ASM   =$md5_obj\n";
170974664626SKris Kennawayprint "SHA1_OBJ_ASM  =$sha1_obj\n";
171074664626SKris Kennawayprint "RMD160_OBJ_ASM=$rmd160_obj\n";
17111f13597dSJung-uk Kimprint "CMLL_ENC      =$cmll_obj\n";
17121f13597dSJung-uk Kimprint "MODES_OBJ     =$modes_obj\n";
17131f13597dSJung-uk Kimprint "ENGINES_OBJ   =$engines_obj\n";
171474664626SKris Kennawayprint "PROCESSOR     =$processor\n";
171574664626SKris Kennawayprint "RANLIB        =$ranlib\n";
17165c87c606SMark Murrayprint "ARFLAGS       =$arflags\n";
171774664626SKris Kennawayprint "PERL          =$perl\n";
17185c87c606SMark Murrayprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
17195c87c606SMark Murray	if $withargs{"krb5-include"} ne "";
172074664626SKris Kennaway
172174664626SKris Kennawaymy $des_ptr=0;
172274664626SKris Kennawaymy $des_risc1=0;
172374664626SKris Kennawaymy $des_risc2=0;
172474664626SKris Kennawaymy $des_unroll=0;
172574664626SKris Kennawaymy $bn_ll=0;
172674664626SKris Kennawaymy $def_int=2;
172774664626SKris Kennawaymy $rc4_int=$def_int;
172874664626SKris Kennawaymy $md2_int=$def_int;
172974664626SKris Kennawaymy $idea_int=$def_int;
173074664626SKris Kennawaymy $rc2_int=$def_int;
173174664626SKris Kennawaymy $rc4_idx=0;
1732f579bf8eSKris Kennawaymy $rc4_chunk=0;
173374664626SKris Kennawaymy $bf_ptr=0;
173474664626SKris Kennawaymy @type=("char","short","int","long");
173574664626SKris Kennawaymy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
17365c87c606SMark Murraymy $export_var_as_fn=0;
173774664626SKris Kennaway
173874664626SKris Kennawaymy $des_int;
173974664626SKris Kennaway
174074664626SKris Kennawayforeach (sort split(/\s+/,$bn_ops))
174174664626SKris Kennaway	{
174274664626SKris Kennaway	$des_ptr=1 if /DES_PTR/;
174374664626SKris Kennaway	$des_risc1=1 if /DES_RISC1/;
174474664626SKris Kennaway	$des_risc2=1 if /DES_RISC2/;
174574664626SKris Kennaway	$des_unroll=1 if /DES_UNROLL/;
174674664626SKris Kennaway	$des_int=1 if /DES_INT/;
174774664626SKris Kennaway	$bn_ll=1 if /BN_LLONG/;
174874664626SKris Kennaway	$rc4_int=0 if /RC4_CHAR/;
174974664626SKris Kennaway	$rc4_int=3 if /RC4_LONG/;
175074664626SKris Kennaway	$rc4_idx=1 if /RC4_INDEX/;
1751f579bf8eSKris Kennaway	$rc4_chunk=1 if /RC4_CHUNK/;
1752f579bf8eSKris Kennaway	$rc4_chunk=2 if /RC4_CHUNK_LL/;
175374664626SKris Kennaway	$md2_int=0 if /MD2_CHAR/;
175474664626SKris Kennaway	$md2_int=3 if /MD2_LONG/;
175574664626SKris Kennaway	$idea_int=1 if /IDEA_SHORT/;
175674664626SKris Kennaway	$idea_int=3 if /IDEA_LONG/;
175774664626SKris Kennaway	$rc2_int=1 if /RC2_SHORT/;
175874664626SKris Kennaway	$rc2_int=3 if /RC2_LONG/;
175974664626SKris Kennaway	$bf_ptr=1 if $_ eq "BF_PTR";
176074664626SKris Kennaway	$bf_ptr=2 if $_ eq "BF_PTR2";
176174664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
176274664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
176374664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
176474664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
176574664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
17665c87c606SMark Murray	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
176774664626SKris Kennaway	}
176874664626SKris Kennaway
176974664626SKris Kennawayopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
17705c87c606SMark Murrayunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
17715c87c606SMark Murrayopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
1772f579bf8eSKris Kennawayprint OUT "/* opensslconf.h */\n";
1773f579bf8eSKris Kennawayprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
1774f579bf8eSKris Kennaway
1775fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
1776fa5fddf1SJung-uk Kimprint OUT "extern \"C\" {\n";
1777fa5fddf1SJung-uk Kimprint OUT "#endif\n";
1778f579bf8eSKris Kennawayprint OUT "/* OpenSSL was configured with the following options: */\n";
17795c87c606SMark Murraymy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1780db522d3aSSimon 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;
17815c87c606SMark Murray$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1782f579bf8eSKris Kennaway$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1783f579bf8eSKris Kennaway$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1784f579bf8eSKris Kennaway$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
17855c87c606SMark Murray$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1786f579bf8eSKris Kennaway$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
17875c87c606SMark Murrayprint OUT $openssl_sys_defines;
17885c87c606SMark Murrayprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1789db522d3aSSimon L. B. Nielsenprint OUT $openssl_experimental_defines;
1790db522d3aSSimon L. B. Nielsenprint OUT "\n";
17915c87c606SMark Murrayprint OUT $openssl_algorithm_defines;
1792db522d3aSSimon L. B. Nielsenprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
17935c87c606SMark Murrayprint OUT $openssl_thread_defines;
17945c87c606SMark Murrayprint OUT $openssl_other_defines,"\n";
17955c87c606SMark Murray
17965c87c606SMark Murrayprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
17975c87c606SMark Murrayprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
17985c87c606SMark Murrayprint OUT "   who haven't had the time to do the appropriate changes in their\n";
17995c87c606SMark Murrayprint OUT "   applications.  */\n";
18005c87c606SMark Murrayprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
18015c87c606SMark Murrayprint OUT $openssl_algorithm_defines_trans;
18025c87c606SMark Murrayprint OUT "#endif\n\n";
1803f579bf8eSKris Kennaway
18041f13597dSJung-uk Kimprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
18053b4e3dcbSSimon L. B. Nielsen
180674664626SKris Kennawaywhile (<IN>)
180774664626SKris Kennaway	{
180874664626SKris Kennaway	if	(/^#define\s+OPENSSLDIR/)
18096a599222SSimon L. B. Nielsen		{
18106a599222SSimon L. B. Nielsen		my $foo = $openssldir;
18116a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
18126a599222SSimon L. B. Nielsen		print OUT "#define OPENSSLDIR \"$foo\"\n";
18136a599222SSimon L. B. Nielsen		}
18143b4e3dcbSSimon L. B. Nielsen	elsif	(/^#define\s+ENGINESDIR/)
18156a599222SSimon L. B. Nielsen		{
18161f13597dSJung-uk Kim		my $foo = "$prefix/$libdir/engines";
18176a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
18186a599222SSimon L. B. Nielsen		print OUT "#define ENGINESDIR \"$foo\"\n";
18196a599222SSimon L. B. Nielsen		}
18205c87c606SMark Murray	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
18215c87c606SMark Murray		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
18225c87c606SMark Murray			if $export_var_as_fn;
18235c87c606SMark Murray		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
18245c87c606SMark Murray			($export_var_as_fn)?"define":"undef"; }
182574664626SKris Kennaway	elsif	(/^#define\s+OPENSSL_UNISTD/)
182674664626SKris Kennaway		{
182774664626SKris Kennaway		$unistd = "<unistd.h>" if $unistd eq "";
182874664626SKris Kennaway		print OUT "#define OPENSSL_UNISTD $unistd\n";
182974664626SKris Kennaway		}
183074664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
183174664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
183274664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
183374664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
183474664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
183574664626SKris Kennaway		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
183674664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
183774664626SKris Kennaway		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
183874664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
183974664626SKris Kennaway		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
184074664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
184174664626SKris Kennaway		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
184274664626SKris Kennaway	elsif	(/^\#define\s+DES_LONG\s+.*/)
184374664626SKris Kennaway		{ printf OUT "#define DES_LONG unsigned %s\n",
184474664626SKris Kennaway			($des_int)?'int':'long'; }
184574664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_PTR/)
184674664626SKris Kennaway		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
184774664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC1/)
184874664626SKris Kennaway		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
184974664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC2/)
185074664626SKris Kennaway		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
185174664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
185274664626SKris Kennaway		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
185374664626SKris Kennaway	elsif	(/^#define\s+RC4_INT\s/)
185474664626SKris Kennaway		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
1855f579bf8eSKris Kennaway	elsif	(/^#undef\s+RC4_CHUNK/)
1856f579bf8eSKris Kennaway		{
1857f579bf8eSKris Kennaway		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
1858f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
1859f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
1860f579bf8eSKris Kennaway		}
186174664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
186274664626SKris Kennaway		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
186374664626SKris Kennaway	elsif (/^#(define|undef)\s+I386_ONLY/)
18643b4e3dcbSSimon L. B. Nielsen		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
186574664626SKris Kennaway			"define":"undef"; }
186674664626SKris Kennaway	elsif	(/^#define\s+MD2_INT\s/)
186774664626SKris Kennaway		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
186874664626SKris Kennaway	elsif	(/^#define\s+IDEA_INT\s/)
186974664626SKris Kennaway		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
187074664626SKris Kennaway	elsif	(/^#define\s+RC2_INT\s/)
187174664626SKris Kennaway		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
187274664626SKris Kennaway	elsif (/^#(define|undef)\s+BF_PTR/)
187374664626SKris Kennaway		{
187474664626SKris Kennaway		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
187574664626SKris Kennaway		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
187674664626SKris Kennaway		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
187774664626SKris Kennaway	        }
187874664626SKris Kennaway	else
187974664626SKris Kennaway		{ print OUT $_; }
188074664626SKris Kennaway	}
188174664626SKris Kennawayclose(IN);
1882fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
1883fa5fddf1SJung-uk Kimprint OUT "}\n";
1884fa5fddf1SJung-uk Kimprint OUT "#endif\n";
188574664626SKris Kennawayclose(OUT);
18865c87c606SMark Murrayrename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
18875c87c606SMark Murrayrename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
188874664626SKris Kennaway
188974664626SKris Kennaway
189074664626SKris Kennaway# Fix the date
189174664626SKris Kennaway
189274664626SKris Kennawayprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
189374664626SKris Kennawayprint "SIXTY_FOUR_BIT mode\n" if $b64;
189474664626SKris Kennawayprint "THIRTY_TWO_BIT mode\n" if $b32;
189574664626SKris Kennawayprint "SIXTEEN_BIT mode\n" if $b16;
189674664626SKris Kennawayprint "EIGHT_BIT mode\n" if $b8;
189774664626SKris Kennawayprint "DES_PTR used\n" if $des_ptr;
189874664626SKris Kennawayprint "DES_RISC1 used\n" if $des_risc1;
189974664626SKris Kennawayprint "DES_RISC2 used\n" if $des_risc2;
190074664626SKris Kennawayprint "DES_UNROLL used\n" if $des_unroll;
190174664626SKris Kennawayprint "DES_INT used\n" if $des_int;
190274664626SKris Kennawayprint "BN_LLONG mode\n" if $bn_ll;
190374664626SKris Kennawayprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
190474664626SKris Kennawayprint "RC4_INDEX mode\n" if $rc4_idx;
1905f579bf8eSKris Kennawayprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
1906f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
1907f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
190874664626SKris Kennawayprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
190974664626SKris Kennawayprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
191074664626SKris Kennawayprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
191174664626SKris Kennawayprint "BF_PTR used\n" if $bf_ptr == 1;
191274664626SKris Kennawayprint "BF_PTR2 used\n" if $bf_ptr == 2;
191374664626SKris Kennaway
19143b4e3dcbSSimon L. B. Nielsenif($IsMK1MF) {
191574664626SKris Kennaway	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
191674664626SKris Kennaway	printf OUT <<EOF;
191774664626SKris Kennaway#ifndef MK1MF_BUILD
191874664626SKris Kennaway  /* auto-generated by Configure for crypto/cversion.c:
19193b4e3dcbSSimon L. B. Nielsen   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
192074664626SKris Kennaway   * Windows builds (and other mk1mf builds) compile cversion.c with
192174664626SKris Kennaway   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
192274664626SKris Kennaway  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
192374664626SKris Kennaway#endif
192474664626SKris KennawayEOF
192574664626SKris Kennaway	close(OUT);
192674664626SKris Kennaway} else {
19276a599222SSimon L. B. Nielsen	my $make_command = "$make PERL=\'$perl\'";
19285c87c606SMark Murray	my $make_targets = "";
19295c87c606SMark Murray	$make_targets .= " links" if $symlink;
19303b4e3dcbSSimon L. B. Nielsen	$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
19315c87c606SMark Murray	$make_targets .= " gentests" if $symlink;
19325c87c606SMark Murray	(system $make_command.$make_targets) == 0 or exit $?
19335c87c606SMark Murray		if $make_targets ne "";
193474664626SKris Kennaway	if ( $perl =~ m@^/@) {
1935a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
1936f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
193774664626SKris Kennaway	} else {
193874664626SKris Kennaway	    # No path for Perl known ...
1939a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
1940f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
194174664626SKris Kennaway	}
19423b4e3dcbSSimon L. B. Nielsen	if ($depflags ne $default_depflags && !$make_depend) {
19435c87c606SMark Murray		print <<EOF;
19445c87c606SMark Murray
19453b4e3dcbSSimon L. B. NielsenSince you've disabled or enabled at least one algorithm, you need to do
19463b4e3dcbSSimon L. B. Nielsenthe following before building:
19475c87c606SMark Murray
19485c87c606SMark Murray	make depend
19495c87c606SMark MurrayEOF
19505c87c606SMark Murray	}
195174664626SKris Kennaway}
195274664626SKris Kennaway
19533b4e3dcbSSimon L. B. Nielsen# create the ms/version32.rc file if needed
1954db522d3aSSimon L. B. Nielsenif ($IsMK1MF && ($target !~ /^netware/)) {
19553b4e3dcbSSimon L. B. Nielsen	my ($v1, $v2, $v3, $v4);
19563b4e3dcbSSimon L. B. Nielsen	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
19573b4e3dcbSSimon L. B. Nielsen		$v1=hex $1;
19583b4e3dcbSSimon L. B. Nielsen		$v2=hex $2;
19593b4e3dcbSSimon L. B. Nielsen		$v3=hex $3;
19603b4e3dcbSSimon L. B. Nielsen		$v4=hex $4;
19613b4e3dcbSSimon L. B. Nielsen	}
19623b4e3dcbSSimon L. B. Nielsen	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
19633b4e3dcbSSimon L. B. Nielsen	print OUT <<EOF;
19643b4e3dcbSSimon L. B. Nielsen#include <winver.h>
19653b4e3dcbSSimon L. B. Nielsen
19663b4e3dcbSSimon L. B. NielsenLANGUAGE 0x09,0x01
19673b4e3dcbSSimon L. B. Nielsen
19683b4e3dcbSSimon L. B. Nielsen1 VERSIONINFO
19693b4e3dcbSSimon L. B. Nielsen  FILEVERSION $v1,$v2,$v3,$v4
19703b4e3dcbSSimon L. B. Nielsen  PRODUCTVERSION $v1,$v2,$v3,$v4
19713b4e3dcbSSimon L. B. Nielsen  FILEFLAGSMASK 0x3fL
19723b4e3dcbSSimon L. B. Nielsen#ifdef _DEBUG
19733b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x01L
19743b4e3dcbSSimon L. B. Nielsen#else
19753b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x00L
19763b4e3dcbSSimon L. B. Nielsen#endif
19773b4e3dcbSSimon L. B. Nielsen  FILEOS VOS__WINDOWS32
19783b4e3dcbSSimon L. B. Nielsen  FILETYPE VFT_DLL
19793b4e3dcbSSimon L. B. Nielsen  FILESUBTYPE 0x0L
19803b4e3dcbSSimon L. B. NielsenBEGIN
19813b4e3dcbSSimon L. B. Nielsen    BLOCK "StringFileInfo"
19823b4e3dcbSSimon L. B. Nielsen    BEGIN
19833b4e3dcbSSimon L. B. Nielsen	BLOCK "040904b0"
19843b4e3dcbSSimon L. B. Nielsen	BEGIN
19853b4e3dcbSSimon L. B. Nielsen	    // Required:
19863b4e3dcbSSimon L. B. Nielsen	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
19873b4e3dcbSSimon L. B. Nielsen	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
19883b4e3dcbSSimon L. B. Nielsen	    VALUE "FileVersion", "$version\\0"
19893b4e3dcbSSimon L. B. Nielsen#if defined(CRYPTO)
19903b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "libeay32\\0"
19913b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "libeay32.dll\\0"
19923b4e3dcbSSimon L. B. Nielsen#elif defined(SSL)
19933b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "ssleay32\\0"
19943b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "ssleay32.dll\\0"
19953b4e3dcbSSimon L. B. Nielsen#endif
19963b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
19973b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductVersion", "$version\\0"
19983b4e3dcbSSimon L. B. Nielsen	    // Optional:
19993b4e3dcbSSimon L. B. Nielsen	    //VALUE "Comments", "\\0"
20001f13597dSJung-uk Kim	    VALUE "LegalCopyright", "Copyright � 1998-2005 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
20013b4e3dcbSSimon L. B. Nielsen	    //VALUE "LegalTrademarks", "\\0"
20023b4e3dcbSSimon L. B. Nielsen	    //VALUE "PrivateBuild", "\\0"
20033b4e3dcbSSimon L. B. Nielsen	    //VALUE "SpecialBuild", "\\0"
20043b4e3dcbSSimon L. B. Nielsen	END
20053b4e3dcbSSimon L. B. Nielsen    END
20063b4e3dcbSSimon L. B. Nielsen    BLOCK "VarFileInfo"
20073b4e3dcbSSimon L. B. Nielsen    BEGIN
20083b4e3dcbSSimon L. B. Nielsen        VALUE "Translation", 0x409, 0x4b0
20093b4e3dcbSSimon L. B. Nielsen    END
20103b4e3dcbSSimon L. B. NielsenEND
20113b4e3dcbSSimon L. B. NielsenEOF
20123b4e3dcbSSimon L. B. Nielsen	close(OUT);
20133b4e3dcbSSimon L. B. Nielsen  }
20143b4e3dcbSSimon L. B. Nielsen
201574664626SKris Kennawayprint <<EOF;
201674664626SKris Kennaway
2017f579bf8eSKris KennawayConfigured for $target.
201874664626SKris KennawayEOF
201974664626SKris Kennaway
202074664626SKris Kennawayprint <<\EOF if (!$no_threads && !$threads);
202174664626SKris Kennaway
202274664626SKris KennawayThe library could not be configured for supporting multi-threaded
202374664626SKris Kennawayapplications as the compiler options required on this system are not known.
202474664626SKris KennawaySee file INSTALL for details if you need multi-threading.
202574664626SKris KennawayEOF
202674664626SKris Kennaway
2027fceca8a3SJacques Vidrineprint <<\EOF if ($no_shared_warn);
2028fceca8a3SJacques Vidrine
2029fceca8a3SJacques VidrineYou gave the option 'shared'.  Normally, that would give you shared libraries.
2030fceca8a3SJacques VidrineUnfortunately, the OpenSSL configuration doesn't include shared library support
2031fceca8a3SJacques Vidrinefor this platform yet, so it will pretend you gave the option 'no-shared'.  If
2032fceca8a3SJacques Vidrineyou can inform the developpers (openssl-dev\@openssl.org) how to support shared
2033fceca8a3SJacques Vidrinelibraries on this platform, they will at least look at it and try their best
2034fceca8a3SJacques Vidrine(but please first make sure you have tried with a current version of OpenSSL).
2035fceca8a3SJacques VidrineEOF
2036fceca8a3SJacques Vidrine
203774664626SKris Kennawayexit(0);
203874664626SKris Kennaway
203974664626SKris Kennawaysub usage
204074664626SKris Kennaway	{
204174664626SKris Kennaway	print STDERR $usage;
2042f579bf8eSKris Kennaway	print STDERR "\npick os/compiler from:\n";
204374664626SKris Kennaway	my $j=0;
204474664626SKris Kennaway	my $i;
2045f579bf8eSKris Kennaway        my $k=0;
204674664626SKris Kennaway	foreach $i (sort keys %table)
204774664626SKris Kennaway		{
204874664626SKris Kennaway		next if $i =~ /^debug/;
2049f579bf8eSKris Kennaway		$k += length($i) + 1;
2050f579bf8eSKris Kennaway		if ($k > 78)
2051f579bf8eSKris Kennaway			{
2052f579bf8eSKris Kennaway			print STDERR "\n";
2053f579bf8eSKris Kennaway			$k=length($i);
2054f579bf8eSKris Kennaway			}
2055f579bf8eSKris Kennaway		print STDERR $i . " ";
205674664626SKris Kennaway		}
205774664626SKris Kennaway	foreach $i (sort keys %table)
205874664626SKris Kennaway		{
205974664626SKris Kennaway		next if $i !~ /^debug/;
2060f579bf8eSKris Kennaway		$k += length($i) + 1;
2061f579bf8eSKris Kennaway		if ($k > 78)
2062f579bf8eSKris Kennaway			{
206374664626SKris Kennaway			print STDERR "\n";
2064f579bf8eSKris Kennaway			$k=length($i);
2065f579bf8eSKris Kennaway			}
2066f579bf8eSKris Kennaway		print STDERR $i . " ";
2067f579bf8eSKris Kennaway		}
2068f579bf8eSKris Kennaway	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
206974664626SKris Kennaway	exit(1);
207074664626SKris Kennaway	}
207174664626SKris Kennaway
207274664626SKris Kennawaysub which
207374664626SKris Kennaway	{
207474664626SKris Kennaway	my($name)=@_;
207574664626SKris Kennaway	my $path;
207674664626SKris Kennaway	foreach $path (split /:/, $ENV{PATH})
207774664626SKris Kennaway		{
20786be8ae07SJacques Vidrine		if (-f "$path/$name$exe_ext" and -x _)
207974664626SKris Kennaway			{
20806be8ae07SJacques Vidrine			return "$path/$name$exe_ext" unless ($name eq "perl" and
20816be8ae07SJacques Vidrine			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
208274664626SKris Kennaway			}
208374664626SKris Kennaway		}
208474664626SKris Kennaway	}
208574664626SKris Kennaway
208674664626SKris Kennawaysub dofile
208774664626SKris Kennaway	{
208874664626SKris Kennaway	my $f; my $p; my %m; my @a; my $k; my $ff;
208974664626SKris Kennaway	($f,$p,%m)=@_;
209074664626SKris Kennaway
209174664626SKris Kennaway	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
209274664626SKris Kennaway	@a=<IN>;
209374664626SKris Kennaway	close(IN);
209474664626SKris Kennaway	foreach $k (keys %m)
209574664626SKris Kennaway		{
209674664626SKris Kennaway		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
209774664626SKris Kennaway		}
2098f579bf8eSKris Kennaway	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
209974664626SKris Kennaway	print OUT @a;
210074664626SKris Kennaway	close(OUT);
2101f579bf8eSKris Kennaway	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
2102f579bf8eSKris Kennaway	rename("$f.new",$f) || die "unable to rename $f.new\n";
210374664626SKris Kennaway	}
210474664626SKris Kennaway
210574664626SKris Kennawaysub print_table_entry
210674664626SKris Kennaway	{
210774664626SKris Kennaway	my $target = shift;
210874664626SKris Kennaway
21095c87c606SMark Murray	(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
21103b4e3dcbSSimon L. B. Nielsen	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
2111ddd58736SKris Kennaway	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
21121f13597dSJung-uk Kim	my $rc5_obj,my $wp_obj,my $cmll_obj,my $modes_obj, my $engines_obj,
21131f13597dSJung-uk Kim	my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag,
21141f13597dSJung-uk Kim	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multilib)=
21155740a5e3SKris Kennaway	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
211674664626SKris Kennaway
211774664626SKris Kennaway	print <<EOF
211874664626SKris Kennaway
211974664626SKris Kennaway*** $target
212074664626SKris Kennaway\$cc           = $cc
212174664626SKris Kennaway\$cflags       = $cflags
212274664626SKris Kennaway\$unistd       = $unistd
212374664626SKris Kennaway\$thread_cflag = $thread_cflag
21245c87c606SMark Murray\$sys_id       = $sys_id
212574664626SKris Kennaway\$lflags       = $lflags
212674664626SKris Kennaway\$bn_ops       = $bn_ops
21273b4e3dcbSSimon L. B. Nielsen\$cpuid_obj    = $cpuid_obj
212874664626SKris Kennaway\$bn_obj       = $bn_obj
212974664626SKris Kennaway\$des_obj      = $des_obj
21303b4e3dcbSSimon L. B. Nielsen\$aes_obj      = $aes_obj
213174664626SKris Kennaway\$bf_obj       = $bf_obj
213274664626SKris Kennaway\$md5_obj      = $md5_obj
213374664626SKris Kennaway\$sha1_obj     = $sha1_obj
213474664626SKris Kennaway\$cast_obj     = $cast_obj
213574664626SKris Kennaway\$rc4_obj      = $rc4_obj
213674664626SKris Kennaway\$rmd160_obj   = $rmd160_obj
213774664626SKris Kennaway\$rc5_obj      = $rc5_obj
21381f13597dSJung-uk Kim\$wp_obj       = $wp_obj
21391f13597dSJung-uk Kim\$cmll_obj     = $cmll_obj
21401f13597dSJung-uk Kim\$modes_obj    = $modes_obj
21411f13597dSJung-uk Kim\$engines_obj  = $engines_obj
21421f13597dSJung-uk Kim\$perlasm_scheme = $perlasm_scheme
2143ddd58736SKris Kennaway\$dso_scheme   = $dso_scheme
2144ddd58736SKris Kennaway\$shared_target= $shared_target
2145ddd58736SKris Kennaway\$shared_cflag = $shared_cflag
2146c1803d78SJacques Vidrine\$shared_ldflag = $shared_ldflag
21475740a5e3SKris Kennaway\$shared_extension = $shared_extension
21485740a5e3SKris Kennaway\$ranlib       = $ranlib
21495c87c606SMark Murray\$arflags      = $arflags
21501f13597dSJung-uk Kim\$multilib     = $multilib
215174664626SKris KennawayEOF
215274664626SKris Kennaway	}
2153c1803d78SJacques Vidrine
2154c1803d78SJacques Vidrinesub test_sanity
2155c1803d78SJacques Vidrine	{
2156c1803d78SJacques Vidrine	my $errorcnt = 0;
2157c1803d78SJacques Vidrine
2158c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2159c1803d78SJacques Vidrine	print STDERR "=== SANITY TESTING!\n";
2160c1803d78SJacques Vidrine	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2161c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2162c1803d78SJacques Vidrine
2163c1803d78SJacques Vidrine	foreach $target (sort keys %table)
2164c1803d78SJacques Vidrine		{
2165c1803d78SJacques Vidrine		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2166c1803d78SJacques Vidrine
21671f13597dSJung-uk Kim		if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2168c1803d78SJacques Vidrine			{
2169c1803d78SJacques Vidrine			$errorcnt++;
2170c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2171c1803d78SJacques Vidrine			print STDERR "              in the previous field\n";
2172c1803d78SJacques Vidrine			}
21731f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2174c1803d78SJacques Vidrine			{
2175c1803d78SJacques Vidrine			$errorcnt++;
2176c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2177c1803d78SJacques Vidrine			print STDERR "              in the following field\n";
2178c1803d78SJacques Vidrine			}
21791f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
2180c1803d78SJacques Vidrine			{
2181c1803d78SJacques Vidrine			$errorcnt++;
2182c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
21831f13597dSJung-uk Kim			print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
2184c1803d78SJacques Vidrine			}
2185c1803d78SJacques Vidrine		}
2186c1803d78SJacques Vidrine	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2187c1803d78SJacques Vidrine	return $errorcnt;
2188c1803d78SJacques Vidrine	}
2189