xref: /freebsd/crypto/openssl/Configure (revision 7bded2db17780f5b59bc532689d8a9541f06901e)
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
108*7bded2dbSJung-uk Kim# TODO(openssl-team): fix problems and investigate if (at least) the following
109*7bded2dbSJung-uk Kim# warnings can also be enabled:
110*7bded2dbSJung-uk Kim# -Wconditional-uninitialized, -Wswitch-enum, -Wunused-macros,
111*7bded2dbSJung-uk Kim# -Wmissing-field-initializers, -Wmissing-variable-declarations,
112*7bded2dbSJung-uk Kim# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
113*7bded2dbSJung-uk Kim# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
114*7bded2dbSJung-uk Kim# -Wextended-offsetof
115*7bded2dbSJung-uk Kimmy $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token  -Wno-extended-offsetof";
116*7bded2dbSJung-uk Kim
117*7bded2dbSJung-uk Kim# These are used in addition to $gcc_devteam_warn when the compiler is clang.
118*7bded2dbSJung-uk Kim# TODO(openssl-team): fix problems and investigate if (at least) the
119*7bded2dbSJung-uk Kim# following warnings can also be enabled: -Wconditional-uninitialized,
120*7bded2dbSJung-uk Kim# -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers,
121*7bded2dbSJung-uk Kim# -Wmissing-variable-declarations,
122*7bded2dbSJung-uk Kim# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
123*7bded2dbSJung-uk Kim# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
124*7bded2dbSJung-uk Kim# -Wextended-offsetof
125*7bded2dbSJung-uk Kimmy $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
126*7bded2dbSJung-uk Kim
1276a599222SSimon L. B. Nielsenmy $strict_warnings = 0;
1286a599222SSimon L. B. Nielsen
12974664626SKris Kennawaymy $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
13074664626SKris Kennaway
13174664626SKris Kennaway# MD2_CHAR slags pentium pros
13274664626SKris Kennawaymy $x86_gcc_opts="RC4_INDEX MD2_INT";
13374664626SKris Kennaway
13474664626SKris Kennaway# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
13574664626SKris Kennaway# Don't worry about these normally
13674664626SKris Kennaway
13774664626SKris Kennawaymy $tcc="cc";
13874664626SKris Kennawaymy $tflags="-fast -Xa";
13974664626SKris Kennawaymy $tbn_mul="";
14074664626SKris Kennawaymy $tlib="-lnsl -lsocket";
14174664626SKris Kennaway#$bits1="SIXTEEN_BIT ";
14274664626SKris Kennaway#$bits2="THIRTY_TWO_BIT ";
14374664626SKris Kennawaymy $bits1="THIRTY_TWO_BIT ";
14474664626SKris Kennawaymy $bits2="SIXTY_FOUR_BIT ";
14574664626SKris Kennaway
146*7bded2dbSJung-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:";
14774664626SKris Kennaway
1481f13597dSJung-uk Kimmy $x86_elf_asm="$x86_asm:elf";
1495740a5e3SKris Kennaway
150*7bded2dbSJung-uk Kimmy $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o aesni-gcm-x86_64.o:";
151*7bded2dbSJung-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";
152*7bded2dbSJung-uk Kimmy $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o::void";
153*7bded2dbSJung-uk Kimmy $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o:::::::::::::void";
154*7bded2dbSJung-uk Kimmy $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o::void";
155*7bded2dbSJung-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::::::::";
156*7bded2dbSJung-uk Kimmy $mips32_asm=$mips64_asm; $mips32_asm =~ s/\s*sha512\-mips\.o//;
157*7bded2dbSJung-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:";
158*7bded2dbSJung-uk Kimmy $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o::void";
159*7bded2dbSJung-uk Kimmy $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:";
160*7bded2dbSJung-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";
161*7bded2dbSJung-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";
162*7bded2dbSJung-uk Kimmy $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o:";
163*7bded2dbSJung-uk Kimmy $ppc32_asm=$ppc64_asm;
164*7bded2dbSJung-uk Kimmy $no_asm="::::::::::::::::void";
16574664626SKris Kennaway
1663b4e3dcbSSimon L. B. Nielsen# As for $BSDthreads. Idea is to maintain "collective" set of flags,
1673b4e3dcbSSimon L. B. Nielsen# which would cover all BSD flavors. -pthread applies to them all,
1683b4e3dcbSSimon L. B. Nielsen# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
1693b4e3dcbSSimon L. B. Nielsen# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
1703b4e3dcbSSimon L. B. Nielsen# which has to be accompanied by explicit -D_THREAD_SAFE and
1713b4e3dcbSSimon L. B. Nielsen# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
1723b4e3dcbSSimon L. B. Nielsen# seems to be sufficient?
1733b4e3dcbSSimon L. B. Nielsenmy $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
1743b4e3dcbSSimon L. B. Nielsen
175*7bded2dbSJung-uk Kim#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $ec_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
176f579bf8eSKris Kennaway
17774664626SKris Kennawaymy %table=(
178ddd58736SKris Kennaway# File 'TABLE' (created by 'make TABLE') contains the data from this list,
179ddd58736SKris Kennaway# formatted for better readability.
180ddd58736SKris Kennaway
181ddd58736SKris Kennaway
182f579bf8eSKris Kennaway#"b",		"${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
183f579bf8eSKris Kennaway#"bl-4c-2c",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
184f579bf8eSKris Kennaway#"bl-4c-ri",	"${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
185f579bf8eSKris Kennaway#"b2-is-ri-dp",	"${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
18674664626SKris Kennaway
18774664626SKris Kennaway# Our development configs
1885c87c606SMark Murray"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
1895c87c606SMark 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::::",
1901f13597dSJung-uk Kim"debug-ben",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
1915c87c606SMark 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)::::",
1925c87c606SMark 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)::::",
1931f13597dSJung-uk Kim"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
19409286989SJung-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)",
1951f13597dSJung-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::::",
1961f13597dSJung-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)::::::",
197*7bded2dbSJung-uk Kim"debug-ben-darwin64","cc:$gcc_devteam_warn -g -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
198*7bded2dbSJung-uk Kim"debug-ben-debug-64-clang",	"clang:$gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Qunused-arguments -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
1991f13597dSJung-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)::::::",
2005c87c606SMark 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)::::::",
2015c87c606SMark Murray"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
202de78d5d8SJung-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",
20309286989SJung-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)",
204*7bded2dbSJung-uk Kim"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2051f13597dSJung-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)",
20609286989SJung-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)",
20709286989SJung-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)",
2086f9291ceSJung-uk Kim"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2096f9291ceSJung-uk Kim"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2101f13597dSJung-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)",
2111f13597dSJung-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)",
2126f9291ceSJung-uk Kim"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
2136f9291ceSJung-uk Kim"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
2146f9291ceSJung-uk Kim"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2156f9291ceSJung-uk Kim"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
216*7bded2dbSJung-uk Kim"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o::des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2176f9291ceSJung-uk Kim"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
218*7bded2dbSJung-uk Kim"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2196f9291ceSJung-uk Kim"debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2205c87c606SMark Murray"dist",		"cc:-O::(unknown)::::::",
22174664626SKris Kennaway
222f579bf8eSKris Kennaway# Basic configs that should work on any (32 and less bit) box
2235c87c606SMark Murray"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
2245c87c606SMark Murray"cc",		"cc:-O::(unknown)::::::",
22574664626SKris Kennaway
2266be8ae07SJacques Vidrine####VOS Configurations
2271f13597dSJung-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:",
2281f13597dSJung-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:",
2296be8ae07SJacques Vidrine
2305c87c606SMark Murray#### Solaris x86 with GNU C setups
2315c87c606SMark Murray# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
232f579bf8eSKris Kennaway# here because whenever GNU C instantiates an assembler template it
233f579bf8eSKris Kennaway# surrounds it with #APP #NO_APP comment pair which (at least Solaris
234f579bf8eSKris Kennaway# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
235f579bf8eSKris Kennaway# error message.
2363b4e3dcbSSimon 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)",
2373b4e3dcbSSimon L. B. Nielsen# -shared -static-libgcc might appear controversial, but modules taken
2383b4e3dcbSSimon L. B. Nielsen# from static libgcc do not have relocations and linking them into our
2393b4e3dcbSSimon L. B. Nielsen# shared objects doesn't have any negative side-effects. On the contrary,
2403b4e3dcbSSimon L. B. Nielsen# doing so makes it possible to use gcc shared build with Sun C. Given
2413b4e3dcbSSimon L. B. Nielsen# that gcc generates faster code [thanks to inline assembler], I would
2423b4e3dcbSSimon L. B. Nielsen# actually recommend to consider using gcc shared build even with vendor
2433b4e3dcbSSimon L. B. Nielsen# compiler:-)
2443b4e3dcbSSimon L. B. Nielsen#						<appro@fy.chalmers.se>
2451f13597dSJung-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",
24674664626SKris Kennaway
24726d191b4SKris Kennaway#### Solaris x86 with Sun C setups
248*7bded2dbSJung-uk Kim"solaris-x86-cc","cc:-fast -xarch=generic -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2491f13597dSJung-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",
25026d191b4SKris Kennaway
25174664626SKris Kennaway#### SPARC Solaris with GNU C setups
2523b4e3dcbSSimon 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)",
253ed6b93beSJung-uk Kim"solaris-sparcv8-gcc","gcc:-mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2545c87c606SMark Murray# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
2551f13597dSJung-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)",
2561f13597dSJung-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",
25774664626SKris Kennaway####
258ed6b93beSJung-uk Kim"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2591f13597dSJung-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)",
26074664626SKris Kennaway
26174664626SKris Kennaway#### SPARC Solaris with Sun C setups
26274664626SKris Kennaway# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
26374664626SKris Kennaway# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
26474664626SKris Kennaway# SC5.0 note: Compiler common patch 107357-01 or later is required!
2653b4e3dcbSSimon 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)",
2661f13597dSJung-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)",
2671f13597dSJung-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)",
26809286989SJung-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",
269f579bf8eSKris Kennaway####
2701f13597dSJung-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)",
2711f13597dSJung-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)",
27274664626SKris Kennaway
2733b4e3dcbSSimon L. B. Nielsen#### SunOS configs, assuming sparc for the gcc one.
2743b4e3dcbSSimon L. B. Nielsen#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
275ed6b93beSJung-uk Kim"sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
27674664626SKris Kennaway
27774664626SKris Kennaway#### IRIX 5.x configs
27874664626SKris Kennaway# -mips2 flag is added by ./config when appropriate.
2796f9291ceSJung-uk Kim"irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
2806f9291ceSJung-uk Kim"irix-cc", "cc:-O2 -use_readonly_const -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
28174664626SKris Kennaway#### IRIX 6.x configs
28274664626SKris Kennaway# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
283ced566fdSJacques Vidrine# './Configure irix-cc -o32' manually.
2846f9291ceSJung-uk Kim"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
2856f9291ceSJung-uk Kim"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
28674664626SKris Kennaway# N64 ABI builds.
2876f9291ceSJung-uk Kim"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
2886f9291ceSJung-uk Kim"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
289f579bf8eSKris Kennaway
290f579bf8eSKris Kennaway#### Unified HP-UX ANSI C configs.
291f579bf8eSKris Kennaway# Special notes:
292f579bf8eSKris Kennaway# - Originally we were optimizing at +O4 level. It should be noted
293f579bf8eSKris Kennaway#   that the only difference between +O3 and +O4 is global inter-
294f579bf8eSKris Kennaway#   procedural analysis. As it has to be performed during the link
295f579bf8eSKris Kennaway#   stage the compiler leaves behind certain pseudo-code in lib*.a
296f579bf8eSKris Kennaway#   which might be release or even patch level specific. Generating
297f579bf8eSKris Kennaway#   the machine code for and analyzing the *whole* program appears
298f579bf8eSKris Kennaway#   to be *extremely* memory demanding while the performance gain is
299f579bf8eSKris Kennaway#   actually questionable. The situation is intensified by the default
300f579bf8eSKris Kennaway#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
301f579bf8eSKris Kennaway#   which is way too low for +O4. In other words, doesn't +O3 make
302f579bf8eSKris Kennaway#   more sense?
303f579bf8eSKris Kennaway# - Keep in mind that the HP compiler by default generates code
304f579bf8eSKris Kennaway#   suitable for execution on the host you're currently compiling at.
305f579bf8eSKris Kennaway#   If the toolkit is ment to be used on various PA-RISC processors
3065c87c606SMark Murray#   consider './config +DAportable'.
3073b4e3dcbSSimon L. B. Nielsen# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
308f579bf8eSKris Kennaway#   compatible with *future* releases.
309f579bf8eSKris Kennaway# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
310f579bf8eSKris Kennaway#   pass -D_REENTRANT on HP-UX 10 and later.
311f579bf8eSKris Kennaway# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
312f579bf8eSKris Kennaway#   32-bit message digests. (For the moment of this writing) HP C
313f579bf8eSKris Kennaway#   doesn't seem to "digest" too many local variables (they make "him"
314f579bf8eSKris Kennaway#   chew forever:-). For more details look-up MD32_XARRAY comment in
315f579bf8eSKris Kennaway#   crypto/sha/sha_lcl.h.
316f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
317f579bf8eSKris Kennaway#
318f579bf8eSKris Kennaway# Since there is mention of this in shlib/hpux10-cc.sh
3193b4e3dcbSSimon 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)",
3203b4e3dcbSSimon 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)",
3211f13597dSJung-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",
3221f13597dSJung-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",
323*7bded2dbSJung-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",
324ddd58736SKris Kennaway
325ddd58736SKris Kennaway# More attempts at unified 10.X and 11.X targets for HP C compiler.
326ddd58736SKris Kennaway#
327ddd58736SKris Kennaway# Chris Ruemmler <ruemmler@cup.hp.com>
328ddd58736SKris Kennaway# Kevin Steves <ks@hp.se>
3293b4e3dcbSSimon 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)",
3301f13597dSJung-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",
3311f13597dSJung-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",
3321f13597dSJung-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",
33374664626SKris Kennaway
3343b4e3dcbSSimon L. B. Nielsen# HP/UX IA-64 targets
3351f13597dSJung-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",
3363b4e3dcbSSimon L. B. Nielsen# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
3373b4e3dcbSSimon L. B. Nielsen# with debugging of the following config.
3381f13597dSJung-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",
3393b4e3dcbSSimon L. B. Nielsen# GCC builds...
3401f13597dSJung-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",
3411f13597dSJung-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",
34274664626SKris Kennaway
3433b4e3dcbSSimon L. B. Nielsen# Legacy HPUX 9.X configs...
3443b4e3dcbSSimon 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)",
3453b4e3dcbSSimon 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)",
34674664626SKris Kennaway
347ddd58736SKris Kennaway#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
3485c87c606SMark 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:::",
349ddd58736SKris Kennaway
3503b4e3dcbSSimon L. B. Nielsen# DEC Alpha OSF/1/Tru64 targets.
351a21b1b38SKris Kennaway#
352a21b1b38SKris Kennaway#	"What's in a name? That which we call a rose
353a21b1b38SKris Kennaway#	 By any other word would smell as sweet."
354a21b1b38SKris Kennaway#
355a21b1b38SKris Kennaway# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
356a21b1b38SKris Kennaway#
35774664626SKris Kennaway# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
358a21b1b38SKris Kennaway#
3591f13597dSJung-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",
3601f13597dSJung-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",
3611f13597dSJung-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",
362f579bf8eSKris Kennaway
3633b4e3dcbSSimon L. B. Nielsen####
3643b4e3dcbSSimon L. B. Nielsen#### Variety of LINUX:-)
3653b4e3dcbSSimon L. B. Nielsen####
3663b4e3dcbSSimon L. B. Nielsen# *-generic* is endian-neutral target, but ./config is free to
3673b4e3dcbSSimon L. B. Nielsen# throw in -D[BL]_ENDIAN, whichever appropriate...
3686f9291ceSJung-uk Kim"linux-generic32","gcc:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
3696f9291ceSJung-uk Kim"linux-ppc",	"gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
370*7bded2dbSJung-uk Kim
371*7bded2dbSJung-uk Kim#######################################################################
372*7bded2dbSJung-uk Kim# Note that -march is not among compiler options in below linux-armv4
373*7bded2dbSJung-uk Kim# target line. Not specifying one is intentional to give you choice to:
374*7bded2dbSJung-uk Kim#
375*7bded2dbSJung-uk Kim# a) rely on your compiler default by not specifying one;
376*7bded2dbSJung-uk Kim# b) specify your target platform explicitly for optimal performance,
377*7bded2dbSJung-uk Kim#    e.g. -march=armv6 or -march=armv7-a;
378*7bded2dbSJung-uk Kim# c) build "universal" binary that targets *range* of platforms by
379*7bded2dbSJung-uk Kim#    specifying minimum and maximum supported architecture;
380*7bded2dbSJung-uk Kim#
381*7bded2dbSJung-uk Kim# As for c) option. It actually makes no sense to specify maximum to be
382*7bded2dbSJung-uk Kim# less than ARMv7, because it's the least requirement for run-time
383*7bded2dbSJung-uk Kim# switch between platform-specific code paths. And without run-time
384*7bded2dbSJung-uk Kim# switch performance would be equivalent to one for minimum. Secondly,
385*7bded2dbSJung-uk Kim# there are some natural limitations that you'd have to accept and
386*7bded2dbSJung-uk Kim# respect. Most notably you can *not* build "universal" binary for
387*7bded2dbSJung-uk Kim# big-endian platform. This is because ARMv7 processor always picks
388*7bded2dbSJung-uk Kim# instructions in little-endian order. Another similar limitation is
389*7bded2dbSJung-uk Kim# that -mthumb can't "cross" -march=armv6t2 boundary, because that's
390*7bded2dbSJung-uk Kim# where it became Thumb-2. Well, this limitation is a bit artificial,
391*7bded2dbSJung-uk Kim# because it's not really impossible, but it's deemed too tricky to
392*7bded2dbSJung-uk Kim# support. And of course you have to be sure that your binutils are
393*7bded2dbSJung-uk Kim# actually up to the task of handling maximum target platform. With all
394*7bded2dbSJung-uk Kim# this in mind here is an example of how to configure "universal" build:
395*7bded2dbSJung-uk Kim#
396*7bded2dbSJung-uk Kim#       ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
397*7bded2dbSJung-uk Kim#
3986f9291ceSJung-uk Kim"linux-armv4",	"gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
399*7bded2dbSJung-uk Kim"linux-aarch64","gcc: -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
400*7bded2dbSJung-uk Kim# Configure script adds minimally required -march for assembly support,
401*7bded2dbSJung-uk Kim# if no -march was specified at command line. mips32 and mips64 below
402*7bded2dbSJung-uk Kim# refer to contemporary MIPS Architecture specifications, MIPS32 and
403*7bded2dbSJung-uk Kim# MIPS64, rather than to kernel bitness.
404*7bded2dbSJung-uk Kim"linux-mips32",	"gcc:-mabi=32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
405*7bded2dbSJung-uk Kim"linux-mips64",   "gcc:-mabi=n32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:n32:dlfcn:linux-shared:-fPIC:-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
406*7bded2dbSJung-uk Kim"linux64-mips64",   "gcc:-mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:64:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4073b4e3dcbSSimon L. B. Nielsen#### IA-32 targets...
408*7bded2dbSJung-uk Kim"linux-ia32-icc",	"icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4096f9291ceSJung-uk Kim"linux-elf",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4106f9291ceSJung-uk Kim"linux-aout",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
4113b4e3dcbSSimon L. B. Nielsen####
4126f9291ceSJung-uk Kim"linux-generic64","gcc:-O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4136f9291ceSJung-uk Kim"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
414*7bded2dbSJung-uk Kim"linux-ppc64le","gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:$ppc64_asm:linux64le:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::",
415*7bded2dbSJung-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)",
416*7bded2dbSJung-uk Kim"linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4176f9291ceSJung-uk Kim"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
418*7bded2dbSJung-uk Kim"linux-x86_64-clang",	"clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
419*7bded2dbSJung-uk Kim"linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
420*7bded2dbSJung-uk Kim"linux-x32",	"gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
4216f9291ceSJung-uk Kim"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
4221f13597dSJung-uk Kim#### So called "highgprs" target for z/Architecture CPUs
4231f13597dSJung-uk Kim# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
4241f13597dSJung-uk Kim# /proc/cpuinfo. The idea is to preserve most significant bits of
4251f13597dSJung-uk Kim# general purpose registers not only upon 32-bit process context
4261f13597dSJung-uk Kim# switch, but even on asynchronous signal delivery to such process.
4271f13597dSJung-uk Kim# This makes it possible to deploy 64-bit instructions even in legacy
4281f13597dSJung-uk Kim# application context and achieve better [or should we say adequate]
4291f13597dSJung-uk Kim# performance. The build is binary compatible with linux-generic32,
4301f13597dSJung-uk Kim# and the idea is to be able to install the resulting libcrypto.so
4311f13597dSJung-uk Kim# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
4321f13597dSJung-uk Kim# ldconfig and run-time linker to autodiscover. Unfortunately it
4331f13597dSJung-uk Kim# doesn't work just yet, because of couple of bugs in glibc
4341f13597dSJung-uk Kim# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
4356f9291ceSJung-uk Kim"linux32-s390x",	"gcc:-m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
4363b4e3dcbSSimon L. B. Nielsen#### SPARC Linux setups
4373b4e3dcbSSimon L. B. Nielsen# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
4383b4e3dcbSSimon L. B. Nielsen# assisted with debugging of following two configs.
439ed6b93beSJung-uk Kim"linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4403b4e3dcbSSimon L. B. Nielsen# it's a real mess with -mcpu=ultrasparc option under Linux, but
4413b4e3dcbSSimon L. B. Nielsen# -Wa,-Av8plus should do the trick no matter what.
4426f9291ceSJung-uk Kim"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4433b4e3dcbSSimon L. B. Nielsen# GCC 3.1 is a requirement
4446f9291ceSJung-uk Kim"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
445f579bf8eSKris Kennaway#### Alpha Linux with GNU C and Compaq C setups
446f579bf8eSKris Kennaway# Special notes:
447f579bf8eSKris Kennaway# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
448f579bf8eSKris Kennaway#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
449f579bf8eSKris Kennaway#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
450f579bf8eSKris Kennaway#   which is appropriate.
451f579bf8eSKris Kennaway# - If you use ccc keep in mind that -fast implies -arch host and the
452f579bf8eSKris Kennaway#   compiler is free to issue instructions which gonna make elder CPU
453f579bf8eSKris Kennaway#   choke. If you wish to build "blended" toolkit, add -arch generic
454f579bf8eSKris Kennaway#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
455f579bf8eSKris Kennaway#
456f579bf8eSKris Kennaway#					<appro@fy.chalmers.se>
457f579bf8eSKris Kennaway#
4586f9291ceSJung-uk Kim"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4596f9291ceSJung-uk Kim"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4606f9291ceSJung-uk Kim"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
4616f9291ceSJung-uk Kim"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
46274664626SKris Kennaway
4636f9291ceSJung-uk Kim# Android: linux-* but without pointers to headers and libs.
46412de4ed2SJung-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)",
4651f13597dSJung-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)",
4661f13597dSJung-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)",
467*7bded2dbSJung-uk Kim"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
46812de4ed2SJung-uk Kim
4693b4e3dcbSSimon L. B. Nielsen#### *BSD [do see comment about ${BSDthreads} above!]
4706f9291ceSJung-uk Kim"BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4716f9291ceSJung-uk Kim"BSD-x86",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4726f9291ceSJung-uk Kim"BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4736f9291ceSJung-uk Kim"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
474ed6b93beSJung-uk Kim"BSD-sparcv8",	"gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
47574664626SKris Kennaway
4766f9291ceSJung-uk Kim"BSD-generic64","gcc:-O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4773b4e3dcbSSimon L. B. Nielsen# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
4783b4e3dcbSSimon L. B. Nielsen# simply *happens* to work around a compiler bug in gcc 3.3.3,
4793b4e3dcbSSimon L. B. Nielsen# triggered by RIPEMD160 code.
4806f9291ceSJung-uk Kim"BSD-sparc64",	"gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4816f9291ceSJung-uk Kim"BSD-ia64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
482*7bded2dbSJung-uk Kim"BSD-x86_64",	"cc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4833b4e3dcbSSimon L. B. Nielsen
4843b4e3dcbSSimon 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)",
4853b4e3dcbSSimon L. B. Nielsen
4865c87c606SMark Murray"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4875c87c606SMark Murray"nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
4885c87c606SMark Murray
48974664626SKris Kennaway# NCR MP-RAS UNIX ver 02.03.01
490fceca8a3SJacques Vidrine"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
49174664626SKris Kennaway
4923b4e3dcbSSimon L. B. Nielsen# QNX
4935c87c606SMark Murray"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
4946f9291ceSJung-uk Kim"QNX6",       "gcc:::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
4956f9291ceSJung-uk Kim"QNX6-i386",  "gcc:-DL_ENDIAN -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
496a21b1b38SKris Kennaway
4971f13597dSJung-uk Kim# BeOS
4981f13597dSJung-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",
4991f13597dSJung-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",
5001f13597dSJung-uk Kim
5013b4e3dcbSSimon L. B. Nielsen#### SCO/Caldera targets.
502fceca8a3SJacques Vidrine#
503fceca8a3SJacques Vidrine# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
504fceca8a3SJacques Vidrine# Now we only have blended unixware-* as it's the only one used by ./config.
505fceca8a3SJacques Vidrine# If you want to optimize for particular microarchitecture, bypass ./config
506fceca8a3SJacques Vidrine# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
507fceca8a3SJacques Vidrine# Note that not all targets include assembler support. Mostly because of
508fceca8a3SJacques Vidrine# lack of motivation to support out-of-date platforms with out-of-date
509fceca8a3SJacques Vidrine# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
510fceca8a3SJacques Vidrine# patiently assisted to debug most of it.
511fceca8a3SJacques Vidrine#
5123b4e3dcbSSimon L. B. Nielsen# UnixWare 2.0x fails destest with -O.
5135c87c606SMark Murray"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
5145c87c606SMark Murray"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
515*7bded2dbSJung-uk Kim"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}-1:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
516*7bded2dbSJung-uk Kim"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
517fceca8a3SJacques Vidrine# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
518*7bded2dbSJung-uk Kim"sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
519*7bded2dbSJung-uk Kim"sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
52074664626SKris Kennaway
5213b4e3dcbSSimon L. B. Nielsen#### IBM's AIX.
5223b4e3dcbSSimon L. B. Nielsen"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
5231f13597dSJung-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",
5241f13597dSJung-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",
5253b4e3dcbSSimon L. B. Nielsen# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
5263b4e3dcbSSimon L. B. Nielsen# at build time. $OBJECT_MODE is respected at ./config stage!
52709286989SJung-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",
52809286989SJung-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",
52974664626SKris Kennaway
53074664626SKris Kennaway#
531c1803d78SJacques Vidrine# Cray T90 and similar (SDSC)
53274664626SKris Kennaway# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
53374664626SKris Kennaway# defined.  The T90 ints and longs are 8 bytes long, and apparently the
53474664626SKris Kennaway# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
53574664626SKris Kennaway# non L_ENDIAN code aligns the bytes in each word correctly.
53674664626SKris Kennaway#
53774664626SKris Kennaway# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
53874664626SKris Kennaway#'Taking the address of a bit field is not allowed. '
53974664626SKris Kennaway#'An expression with bit field exists as the operand of "sizeof" '
54074664626SKris Kennaway# (written by Wayne Schroeder <schroede@SDSC.EDU>)
541c1803d78SJacques Vidrine#
542c1803d78SJacques Vidrine# j90 is considered the base machine type for unicos machines,
543c1803d78SJacques Vidrine# so this configuration is now called "cray-j90" ...
5445c87c606SMark Murray"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
54574664626SKris Kennaway
54674664626SKris Kennaway#
54774664626SKris Kennaway# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
54874664626SKris Kennaway#
54974664626SKris Kennaway# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
55074664626SKris Kennaway# another use.  Basically, the problem is that the T3E uses some bit fields
55174664626SKris Kennaway# for some st_addr stuff, and then sizeof and address-of fails
55274664626SKris Kennaway# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
55374664626SKris Kennaway# did not like it.
5545c87c606SMark Murray"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
55574664626SKris Kennaway
55674664626SKris Kennaway# DGUX, 88100.
5575c87c606SMark Murray"dgux-R3-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
5585c87c606SMark Murray"dgux-R4-gcc",	"gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
5595c87c606SMark 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}",
56074664626SKris Kennaway
56174664626SKris Kennaway# Sinix/ReliantUNIX RM400
56274664626SKris Kennaway# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
5633b4e3dcbSSimon 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)",
5645c87c606SMark Murray"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
5655c87c606SMark Murray"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
56674664626SKris Kennaway
56774664626SKris Kennaway# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
5686f9291ceSJung-uk Kim"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
56974664626SKris Kennaway
570a21b1b38SKris Kennaway# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
571a21b1b38SKris Kennaway# You need to compile using the c89.sh wrapper in the tools directory, because the
572a21b1b38SKris Kennaway# IBM compiler does not like the -L switch after any object modules.
573a21b1b38SKris Kennaway#
5745c87c606SMark 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:::",
575a21b1b38SKris Kennaway
5763b4e3dcbSSimon L. B. Nielsen# Visual C targets
5771f13597dSJung-uk Kim#
5781f13597dSJung-uk Kim# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
579*7bded2dbSJung-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",
5801f13597dSJung-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",
581*7bded2dbSJung-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",
5821f13597dSJung-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",
5831f13597dSJung-uk Kim# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
5841f13597dSJung-uk Kim# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
5851f13597dSJung-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",
5861f13597dSJung-uk Kim# Unified CE target
587560ede85SJung-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",
5883b4e3dcbSSimon L. B. Nielsen"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
58974664626SKris Kennaway
59074664626SKris Kennaway# Borland C++ 4.5
5913b4e3dcbSSimon L. B. Nielsen"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
59274664626SKris Kennaway
59350ef0093SJacques Vidrine# MinGW
5941f13597dSJung-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",
5951f13597dSJung-uk Kim# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
5961f13597dSJung-uk Kim# compiled with one compiler with application compiled with another
5971f13597dSJung-uk Kim# compiler. It's possible to engage Applink support in mingw64 build,
5981f13597dSJung-uk Kim# but it's not done, because till mingw64 supports structured exception
5991f13597dSJung-uk Kim# handling, one can't seriously consider its binaries for using with
6001f13597dSJung-uk Kim# non-mingw64 run-time environment. And as mingw64 is always consistent
6011f13597dSJung-uk Kim# with itself, Applink is never engaged and can as well be omitted.
6021f13597dSJung-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",
603ddd58736SKris Kennaway
6044f20a5a2SJacques Vidrine# UWIN
6053b4e3dcbSSimon L. B. Nielsen"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
6064f20a5a2SJacques Vidrine
607c1803d78SJacques Vidrine# Cygwin
608*7bded2dbSJung-uk Kim"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
609*7bded2dbSJung-uk Kim"Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
6103b4e3dcbSSimon L. B. Nielsen
611db522d3aSSimon L. B. Nielsen# NetWare from David Ward (dsward@novell.com)
612db522d3aSSimon L. B. Nielsen# requires either MetroWerks NLM development tools, or gcc / nlmconv
613db522d3aSSimon L. B. Nielsen# NetWare defaults socket bio to WinSock sockets. However,
614db522d3aSSimon L. B. Nielsen# the builds can be configured to use BSD sockets instead.
6153b4e3dcbSSimon L. B. Nielsen# netware-clib => legacy CLib c-runtime support
616db522d3aSSimon L. B. Nielsen"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
617db522d3aSSimon L. B. Nielsen"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
618db522d3aSSimon 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}::",
619db522d3aSSimon 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}::",
6203b4e3dcbSSimon L. B. Nielsen# netware-libc => LibC/NKS support
6213b4e3dcbSSimon L. B. Nielsen"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
6223b4e3dcbSSimon L. B. Nielsen"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
6233b4e3dcbSSimon 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}::",
624db522d3aSSimon 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}::",
6255c87c606SMark Murray
6265c87c606SMark Murray# DJGPP
6276f9291ceSJung-uk Kim"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
62874664626SKris Kennaway
62974664626SKris Kennaway# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
6305c87c606SMark Murray"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
6313b4e3dcbSSimon L. B. Nielsen"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
63274664626SKris Kennaway# K&R C is no longer supported; you need gcc on old Ultrix installations
6335c87c606SMark Murray##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
63474664626SKris Kennaway
635a21b1b38SKris Kennaway##### MacOS X (a.k.a. Rhapsody or Darwin) setup
6363b4e3dcbSSimon 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}::",
6371f13597dSJung-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",
6381f13597dSJung-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",
6391f13597dSJung-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",
6401f13597dSJung-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",
641*7bded2dbSJung-uk Kim"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
642*7bded2dbSJung-uk Kim"debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
6431f13597dSJung-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",
6441f13597dSJung-uk Kim# iPhoneOS/iOS
6451f13597dSJung-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",
6465c87c606SMark Murray
6475c87c606SMark Murray##### A/UX
6485c87c606SMark Murray"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
649f579bf8eSKris Kennaway
650ddd58736SKris Kennaway##### Sony NEWS-OS 4.x
6515c87c606SMark 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::::",
6525c87c606SMark Murray
6535c87c606SMark Murray##### GNU Hurd
6546f9291ceSJung-uk Kim"hurd-x86",  "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
6555c87c606SMark Murray
6565c87c606SMark Murray##### OS/2 EMX
6575c87c606SMark Murray"OS2-EMX", "gcc::::::::",
658ddd58736SKris Kennaway
659c1803d78SJacques Vidrine##### VxWorks for various targets
6601f13597dSJung-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:::::",
6611f13597dSJung-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:::::",
6625c87c606SMark Murray"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6635c87c606SMark 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:::::",
6641f13597dSJung-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:::::",
66550ef0093SJacques Vidrine"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
6661f13597dSJung-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:",
6671f13597dSJung-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:",
6685c87c606SMark Murray
6695c87c606SMark Murray##### Compaq Non-Stop Kernel (Tandem)
6705c87c606SMark Murray"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
671c1803d78SJacques Vidrine
6721f13597dSJung-uk Kim# uClinux
6731f13597dSJung-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'}::",
6741f13597dSJung-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'}::",
6751f13597dSJung-uk Kim
67674664626SKris Kennaway);
67774664626SKris Kennaway
6783b4e3dcbSSimon L. B. Nielsenmy @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
6791f13597dSJung-uk Kim		    debug-VC-WIN64I debug-VC-WIN64A
6801f13597dSJung-uk Kim		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
6811f13597dSJung-uk Kim		    BC-32
682db522d3aSSimon L. B. Nielsen		    netware-clib netware-clib-bsdsock
683db522d3aSSimon L. B. Nielsen		    netware-libc netware-libc-bsdsock);
68474664626SKris Kennaway
685c1803d78SJacques Vidrinemy $idx = 0;
686c1803d78SJacques Vidrinemy $idx_cc = $idx++;
687c1803d78SJacques Vidrinemy $idx_cflags = $idx++;
688c1803d78SJacques Vidrinemy $idx_unistd = $idx++;
689c1803d78SJacques Vidrinemy $idx_thread_cflag = $idx++;
6905c87c606SMark Murraymy $idx_sys_id = $idx++;
691c1803d78SJacques Vidrinemy $idx_lflags = $idx++;
692c1803d78SJacques Vidrinemy $idx_bn_ops = $idx++;
6933b4e3dcbSSimon L. B. Nielsenmy $idx_cpuid_obj = $idx++;
694c1803d78SJacques Vidrinemy $idx_bn_obj = $idx++;
695*7bded2dbSJung-uk Kimmy $idx_ec_obj = $idx++;
696c1803d78SJacques Vidrinemy $idx_des_obj = $idx++;
6973b4e3dcbSSimon L. B. Nielsenmy $idx_aes_obj = $idx++;
698c1803d78SJacques Vidrinemy $idx_bf_obj = $idx++;
699c1803d78SJacques Vidrinemy $idx_md5_obj = $idx++;
700c1803d78SJacques Vidrinemy $idx_sha1_obj = $idx++;
701c1803d78SJacques Vidrinemy $idx_cast_obj = $idx++;
702c1803d78SJacques Vidrinemy $idx_rc4_obj = $idx++;
703c1803d78SJacques Vidrinemy $idx_rmd160_obj = $idx++;
704c1803d78SJacques Vidrinemy $idx_rc5_obj = $idx++;
7051f13597dSJung-uk Kimmy $idx_wp_obj = $idx++;
7061f13597dSJung-uk Kimmy $idx_cmll_obj = $idx++;
7071f13597dSJung-uk Kimmy $idx_modes_obj = $idx++;
7081f13597dSJung-uk Kimmy $idx_engines_obj = $idx++;
7091f13597dSJung-uk Kimmy $idx_perlasm_scheme = $idx++;
710c1803d78SJacques Vidrinemy $idx_dso_scheme = $idx++;
711c1803d78SJacques Vidrinemy $idx_shared_target = $idx++;
712c1803d78SJacques Vidrinemy $idx_shared_cflag = $idx++;
713c1803d78SJacques Vidrinemy $idx_shared_ldflag = $idx++;
714c1803d78SJacques Vidrinemy $idx_shared_extension = $idx++;
715c1803d78SJacques Vidrinemy $idx_ranlib = $idx++;
7165c87c606SMark Murraymy $idx_arflags = $idx++;
7171f13597dSJung-uk Kimmy $idx_multilib = $idx++;
718c1803d78SJacques Vidrine
71974664626SKris Kennawaymy $prefix="";
7206a599222SSimon L. B. Nielsenmy $libdir="";
72174664626SKris Kennawaymy $openssldir="";
7225740a5e3SKris Kennawaymy $exe_ext="";
7236a599222SSimon L. B. Nielsenmy $install_prefix= "$ENV{'INSTALL_PREFIX'}";
7246a599222SSimon L. B. Nielsenmy $cross_compile_prefix="";
7251f13597dSJung-uk Kimmy $fipsdir="/usr/local/ssl/fips-2.0";
7261f13597dSJung-uk Kimmy $fipslibdir="";
727db522d3aSSimon L. B. Nielsenmy $baseaddr="0xFB00000";
72874664626SKris Kennawaymy $no_threads=0;
72974664626SKris Kennawaymy $threads=0;
7303b4e3dcbSSimon L. B. Nielsenmy $no_shared=0; # but "no-shared" is default
7313b4e3dcbSSimon L. B. Nielsenmy $zlib=1;      # but "no-zlib" is default
7323b4e3dcbSSimon L. B. Nielsenmy $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
7335471f83eSSimon L. B. Nielsenmy $no_rfc3779=1; # but "no-rfc3779" is default
73474664626SKris Kennawaymy $no_asm=0;
735ddd58736SKris Kennawaymy $no_dso=0;
7363b4e3dcbSSimon L. B. Nielsenmy $no_gmp=0;
73774664626SKris Kennawaymy @skip=();
7386be8ae07SJacques Vidrinemy $Makefile="Makefile";
73974664626SKris Kennawaymy $des_locl="crypto/des/des_locl.h";
74074664626SKris Kennawaymy $des	="crypto/des/des.h";
74174664626SKris Kennawaymy $bn	="crypto/bn/bn.h";
74274664626SKris Kennawaymy $md2	="crypto/md2/md2.h";
74374664626SKris Kennawaymy $rc4	="crypto/rc4/rc4.h";
74474664626SKris Kennawaymy $rc4_locl="crypto/rc4/rc4_locl.h";
74574664626SKris Kennawaymy $idea	="crypto/idea/idea.h";
74674664626SKris Kennawaymy $rc2	="crypto/rc2/rc2.h";
74774664626SKris Kennawaymy $bf	="crypto/bf/bf_locl.h";
74874664626SKris Kennawaymy $bn_asm	="bn_asm.o";
74974664626SKris Kennawaymy $des_enc="des_enc.o fcrypt_b.o";
7503b4e3dcbSSimon L. B. Nielsenmy $aes_enc="aes_core.o aes_cbc.o";
75174664626SKris Kennawaymy $bf_enc	="bf_enc.o";
75274664626SKris Kennawaymy $cast_enc="c_enc.o";
753db522d3aSSimon L. B. Nielsenmy $rc4_enc="rc4_enc.o rc4_skey.o";
75474664626SKris Kennawaymy $rc5_enc="rc5_enc.o";
75574664626SKris Kennawaymy $md5_obj="";
75674664626SKris Kennawaymy $sha1_obj="";
75774664626SKris Kennawaymy $rmd160_obj="";
7581f13597dSJung-uk Kimmy $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
75974664626SKris Kennawaymy $processor="";
7605740a5e3SKris Kennawaymy $default_ranlib;
76174664626SKris Kennawaymy $perl;
762db522d3aSSimon L. B. Nielsenmy $fips=0;
76374664626SKris Kennaway
7641f13597dSJung-uk Kimif (exists $ENV{FIPSDIR})
7651f13597dSJung-uk Kim	{
7661f13597dSJung-uk Kim	$fipsdir = $ENV{FIPSDIR};
7671f13597dSJung-uk Kim	$fipsdir =~ s/\/$//;
7681f13597dSJung-uk Kim	}
7693b4e3dcbSSimon L. B. Nielsen
7703b4e3dcbSSimon L. B. Nielsen# All of the following is disabled by default (RC5 was enabled before 0.9.8):
7713b4e3dcbSSimon L. B. Nielsen
772db522d3aSSimon L. B. Nielsenmy %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
7731f13597dSJung-uk Kim		 "ec_nistp_64_gcc_128" => "default",
7743b4e3dcbSSimon L. B. Nielsen		 "gmp"		  => "default",
775db522d3aSSimon L. B. Nielsen		 "jpake"          => "experimental",
776*7bded2dbSJung-uk Kim		 "libunbound"     => "experimental",
7771f13597dSJung-uk Kim		 "md2"            => "default",
7783b4e3dcbSSimon L. B. Nielsen		 "rc5"            => "default",
7795471f83eSSimon L. B. Nielsen		 "rfc3779"	  => "default",
7801f13597dSJung-uk Kim		 "sctp"       => "default",
7813b4e3dcbSSimon L. B. Nielsen		 "shared"         => "default",
782*7bded2dbSJung-uk Kim		 "ssl-trace"	  => "default",
7831f13597dSJung-uk Kim		 "store"	  => "experimental",
784a93cbc2bSJung-uk Kim		 "unit-test"	  => "default",
7853b4e3dcbSSimon L. B. Nielsen		 "zlib"           => "default",
7863b4e3dcbSSimon L. B. Nielsen		 "zlib-dynamic"   => "default"
7873b4e3dcbSSimon L. B. Nielsen	       );
788db522d3aSSimon L. B. Nielsenmy @experimental = ();
7893b4e3dcbSSimon L. B. Nielsen
790db522d3aSSimon L. B. Nielsen# This is what $depflags will look like with the above defaults
791db522d3aSSimon L. B. Nielsen# (we need this to see if we should advise the user to run "make depend"):
792*7bded2dbSJung-uk Kimmy $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST";
793db522d3aSSimon L. B. Nielsen
794db522d3aSSimon L. B. Nielsen# Explicit "no-..." options will be collected in %disabled along with the defaults.
795db522d3aSSimon L. B. Nielsen# To remove something from %disabled, use "enable-foo" (unless it's experimental).
796db522d3aSSimon L. B. Nielsen# For symmetry, "disable-foo" is a synonym for "no-foo".
797db522d3aSSimon L. B. Nielsen
798db522d3aSSimon L. B. Nielsen# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
799db522d3aSSimon L. B. Nielsen# We will collect such requests in @experimental.
800db522d3aSSimon L. B. Nielsen# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
8013b4e3dcbSSimon L. B. Nielsen
8023b4e3dcbSSimon L. B. Nielsen
8033b4e3dcbSSimon L. B. Nielsenmy $no_sse2=0;
8045c87c606SMark Murray
80574664626SKris Kennaway&usage if ($#ARGV < 0);
80674664626SKris Kennaway
807ddd58736SKris Kennawaymy $flags;
808ddd58736SKris Kennawaymy $depflags;
809db522d3aSSimon L. B. Nielsenmy $openssl_experimental_defines;
810ddd58736SKris Kennawaymy $openssl_algorithm_defines;
811ddd58736SKris Kennawaymy $openssl_thread_defines;
8125c87c606SMark Murraymy $openssl_sys_defines="";
813ddd58736SKris Kennawaymy $openssl_other_defines;
814ddd58736SKris Kennawaymy $libs;
815fceca8a3SJacques Vidrinemy $libkrb5="";
816ddd58736SKris Kennawaymy $target;
817ddd58736SKris Kennawaymy $options;
818ddd58736SKris Kennawaymy $symlink;
8195c87c606SMark Murraymy $make_depend=0;
8205c87c606SMark Murraymy %withargs=();
821ddd58736SKris Kennaway
822ddd58736SKris Kennawaymy @argvcopy=@ARGV;
823ddd58736SKris Kennawaymy $argvstring="";
824ddd58736SKris Kennawaymy $argv_unprocessed=1;
825ddd58736SKris Kennaway
826ddd58736SKris Kennawaywhile($argv_unprocessed)
827ddd58736SKris Kennaway	{
828ddd58736SKris Kennaway	$flags="";
829ddd58736SKris Kennaway	$depflags="";
830db522d3aSSimon L. B. Nielsen	$openssl_experimental_defines="";
831ddd58736SKris Kennaway	$openssl_algorithm_defines="";
832ddd58736SKris Kennaway	$openssl_thread_defines="";
8335c87c606SMark Murray	$openssl_sys_defines="";
834ddd58736SKris Kennaway	$openssl_other_defines="";
835ddd58736SKris Kennaway	$libs="";
836ddd58736SKris Kennaway	$target="";
837ddd58736SKris Kennaway	$options="";
838ddd58736SKris Kennaway	$symlink=1;
839ddd58736SKris Kennaway
840ddd58736SKris Kennaway	$argv_unprocessed=0;
841ddd58736SKris Kennaway	$argvstring=join(' ',@argvcopy);
842ddd58736SKris Kennaway
843ddd58736SKris KennawayPROCESS_ARGS:
844ddd58736SKris Kennaway	foreach (@argvcopy)
84574664626SKris Kennaway		{
846f579bf8eSKris Kennaway		s /^-no-/no-/; # some people just can't read the instructions
8473b4e3dcbSSimon L. B. Nielsen
8483b4e3dcbSSimon L. B. Nielsen		# rewrite some options in "enable-..." form
8493b4e3dcbSSimon L. B. Nielsen		s /^-?-?shared$/enable-shared/;
8501f13597dSJung-uk Kim		s /^sctp$/enable-sctp/;
8513b4e3dcbSSimon L. B. Nielsen		s /^threads$/enable-threads/;
8523b4e3dcbSSimon L. B. Nielsen		s /^zlib$/enable-zlib/;
8533b4e3dcbSSimon L. B. Nielsen		s /^zlib-dynamic$/enable-zlib-dynamic/;
8543b4e3dcbSSimon L. B. Nielsen
8553b4e3dcbSSimon L. B. Nielsen		if (/^no-(.+)$/ || /^disable-(.+)$/)
8563b4e3dcbSSimon L. B. Nielsen			{
857db522d3aSSimon L. B. Nielsen			if (!($disabled{$1} eq "experimental"))
858db522d3aSSimon L. B. Nielsen				{
8593b4e3dcbSSimon L. B. Nielsen				if ($1 eq "ssl")
8603b4e3dcbSSimon L. B. Nielsen					{
8613b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl2"} = "option(ssl)";
8623b4e3dcbSSimon L. B. Nielsen					$disabled{"ssl3"} = "option(ssl)";
8633b4e3dcbSSimon L. B. Nielsen					}
8643b4e3dcbSSimon L. B. Nielsen				elsif ($1 eq "tls")
8653b4e3dcbSSimon L. B. Nielsen					{
8663b4e3dcbSSimon L. B. Nielsen					$disabled{"tls1"} = "option(tls)"
8673b4e3dcbSSimon L. B. Nielsen					}
868751d2991SJung-uk Kim				elsif ($1 eq "ssl3-method")
869751d2991SJung-uk Kim					{
870751d2991SJung-uk Kim					$disabled{"ssl3-method"} = "option(ssl)";
871751d2991SJung-uk Kim					$disabled{"ssl3"} = "option(ssl)";
872751d2991SJung-uk Kim					}
8733b4e3dcbSSimon L. B. Nielsen				else
8743b4e3dcbSSimon L. B. Nielsen					{
8753b4e3dcbSSimon L. B. Nielsen					$disabled{$1} = "option";
8763b4e3dcbSSimon L. B. Nielsen					}
8773b4e3dcbSSimon L. B. Nielsen				}
878db522d3aSSimon L. B. Nielsen			}
879db522d3aSSimon L. B. Nielsen		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
8803b4e3dcbSSimon L. B. Nielsen			{
881db522d3aSSimon L. B. Nielsen			my $algo = $1;
882db522d3aSSimon L. B. Nielsen			if ($disabled{$algo} eq "experimental")
883db522d3aSSimon L. B. Nielsen				{
884db522d3aSSimon L. B. Nielsen				die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
885db522d3aSSimon L. B. Nielsen					unless (/^experimental-/);
886db522d3aSSimon L. B. Nielsen				push @experimental, $algo;
887db522d3aSSimon L. B. Nielsen				}
888db522d3aSSimon L. B. Nielsen			delete $disabled{$algo};
8893b4e3dcbSSimon L. B. Nielsen
890db522d3aSSimon L. B. Nielsen			$threads = 1 if ($algo eq "threads");
8913b4e3dcbSSimon L. B. Nielsen			}
8923b4e3dcbSSimon L. B. Nielsen		elsif (/^--test-sanity$/)
893c1803d78SJacques Vidrine			{
894c1803d78SJacques Vidrine			exit(&test_sanity());
895c1803d78SJacques Vidrine			}
8966a599222SSimon L. B. Nielsen		elsif (/^--strict-warnings/)
8976a599222SSimon L. B. Nielsen			{
8986a599222SSimon L. B. Nielsen			$strict_warnings = 1;
8996a599222SSimon L. B. Nielsen			}
900ddd58736SKris Kennaway		elsif (/^reconfigure/ || /^reconf/)
901ddd58736SKris Kennaway			{
902ddd58736SKris Kennaway			if (open(IN,"<$Makefile"))
903ddd58736SKris Kennaway				{
904ddd58736SKris Kennaway				while (<IN>)
905ddd58736SKris Kennaway					{
9063b4e3dcbSSimon L. B. Nielsen					chomp;
907ddd58736SKris Kennaway					if (/^CONFIGURE_ARGS=(.*)/)
908ddd58736SKris Kennaway						{
909ddd58736SKris Kennaway						$argvstring=$1;
910ddd58736SKris Kennaway						@argvcopy=split(' ',$argvstring);
911ddd58736SKris Kennaway						die "Incorrect data to reconfigure, please do a normal configuration\n"
912ddd58736SKris Kennaway							if (grep(/^reconf/,@argvcopy));
913ddd58736SKris Kennaway						print "Reconfiguring with: $argvstring\n";
914ddd58736SKris Kennaway						$argv_unprocessed=1;
915ddd58736SKris Kennaway						close(IN);
916ddd58736SKris Kennaway						last PROCESS_ARGS;
917ddd58736SKris Kennaway						}
918ddd58736SKris Kennaway					}
919ddd58736SKris Kennaway				close(IN);
920ddd58736SKris Kennaway				}
921ddd58736SKris Kennaway			die "Insufficient data to reconfigure, please do a normal configuration\n";
922ddd58736SKris Kennaway			}
92374664626SKris Kennaway		elsif (/^386$/)
92474664626SKris Kennaway			{ $processor=386; }
925db522d3aSSimon L. B. Nielsen		elsif (/^fips$/)
926db522d3aSSimon L. B. Nielsen			{
927db522d3aSSimon L. B. Nielsen			$fips=1;
928db522d3aSSimon L. B. Nielsen			}
92974664626SKris Kennaway		elsif (/^rsaref$/)
93074664626SKris Kennaway			{
9315c87c606SMark Murray			# No RSAref support any more since it's not needed.
9325c87c606SMark Murray			# The check for the option is there so scripts aren't
9335c87c606SMark Murray			# broken
93474664626SKris Kennaway			}
93574664626SKris Kennaway		elsif (/^[-+]/)
93674664626SKris Kennaway			{
937*7bded2dbSJung-uk Kim			if (/^--prefix=(.*)$/)
93874664626SKris Kennaway				{
93974664626SKris Kennaway				$prefix=$1;
94074664626SKris Kennaway				}
9416a599222SSimon L. B. Nielsen			elsif (/^--libdir=(.*)$/)
9426a599222SSimon L. B. Nielsen				{
9436a599222SSimon L. B. Nielsen				$libdir=$1;
9446a599222SSimon L. B. Nielsen				}
94574664626SKris Kennaway			elsif (/^--openssldir=(.*)$/)
94674664626SKris Kennaway				{
94774664626SKris Kennaway				$openssldir=$1;
94874664626SKris Kennaway				}
94974664626SKris Kennaway			elsif (/^--install.prefix=(.*)$/)
95074664626SKris Kennaway				{
95174664626SKris Kennaway				$install_prefix=$1;
95274664626SKris Kennaway				}
9535c87c606SMark Murray			elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
9545c87c606SMark Murray				{
9555c87c606SMark Murray				$withargs{"krb5-".$1}=$2;
9565c87c606SMark Murray				}
9573b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-lib=(.*)$/)
9583b4e3dcbSSimon L. B. Nielsen				{
9593b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-lib"}=$1;
9603b4e3dcbSSimon L. B. Nielsen				}
9613b4e3dcbSSimon L. B. Nielsen			elsif (/^--with-zlib-include=(.*)$/)
9623b4e3dcbSSimon L. B. Nielsen				{
9633b4e3dcbSSimon L. B. Nielsen				$withargs{"zlib-include"}="-I$1";
9643b4e3dcbSSimon L. B. Nielsen				}
9651f13597dSJung-uk Kim			elsif (/^--with-fipsdir=(.*)$/)
9661f13597dSJung-uk Kim				{
9671f13597dSJung-uk Kim				$fipsdir="$1";
9681f13597dSJung-uk Kim				}
969db522d3aSSimon L. B. Nielsen			elsif (/^--with-fipslibdir=(.*)$/)
970db522d3aSSimon L. B. Nielsen				{
9711f13597dSJung-uk Kim				$fipslibdir="$1";
972db522d3aSSimon L. B. Nielsen				}
973db522d3aSSimon L. B. Nielsen			elsif (/^--with-baseaddr=(.*)$/)
974db522d3aSSimon L. B. Nielsen				{
975db522d3aSSimon L. B. Nielsen				$baseaddr="$1";
976db522d3aSSimon L. B. Nielsen				}
9771f13597dSJung-uk Kim			elsif (/^--cross-compile-prefix=(.*)$/)
9781f13597dSJung-uk Kim				{
9791f13597dSJung-uk Kim				$cross_compile_prefix=$1;
9801f13597dSJung-uk Kim				}
981*7bded2dbSJung-uk Kim			elsif (/^-[lL](.*)$/ or /^-Wl,/)
98274664626SKris Kennaway				{
983*7bded2dbSJung-uk Kim				$libs.=$_." ";
984*7bded2dbSJung-uk Kim				}
985*7bded2dbSJung-uk Kim			else	# common if (/^[-+]/), just pass down...
986*7bded2dbSJung-uk Kim				{
987*7bded2dbSJung-uk Kim				$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
988*7bded2dbSJung-uk Kim				$flags.=$_." ";
98974664626SKris Kennaway				}
99074664626SKris Kennaway			}
99174664626SKris Kennaway		elsif ($_ =~ /^([^:]+):(.+)$/)
99274664626SKris Kennaway			{
99374664626SKris Kennaway			eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
99474664626SKris Kennaway			$target=$1;
99574664626SKris Kennaway			}
99674664626SKris Kennaway		else
99774664626SKris Kennaway			{
9983b4e3dcbSSimon L. B. Nielsen			die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
99974664626SKris Kennaway			$target=$_;
100074664626SKris Kennaway			}
100174664626SKris Kennaway
10023b4e3dcbSSimon L. B. Nielsen		unless ($_ eq $target || /^no-/ || /^disable-/)
10035c87c606SMark Murray			{
10043b4e3dcbSSimon L. B. Nielsen			# "no-..." follows later after implied disactivations
10053b4e3dcbSSimon L. B. Nielsen			# have been derived.  (Don't take this too seroiusly,
10063b4e3dcbSSimon L. B. Nielsen			# we really only write OPTIONS to the Makefile out of
10073b4e3dcbSSimon L. B. Nielsen			# nostalgia.)
10083b4e3dcbSSimon L. B. Nielsen
10093b4e3dcbSSimon L. B. Nielsen			if ($options eq "")
10103b4e3dcbSSimon L. B. Nielsen				{ $options = $_; }
10113b4e3dcbSSimon L. B. Nielsen			else
10123b4e3dcbSSimon L. B. Nielsen				{ $options .= " ".$_; }
10133b4e3dcbSSimon L. B. Nielsen			}
10143b4e3dcbSSimon L. B. Nielsen		}
10155c87c606SMark Murray	}
10165c87c606SMark Murray
10173b4e3dcbSSimon L. B. Nielsen
10183b4e3dcbSSimon L. B. Nielsen
10193b4e3dcbSSimon L. B. Nielsenif ($processor eq "386")
10205c87c606SMark Murray	{
10213b4e3dcbSSimon L. B. Nielsen	$disabled{"sse2"} = "forced";
10225c87c606SMark Murray	}
10235c87c606SMark Murray
10243b4e3dcbSSimon L. B. Nielsenif (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
10255c87c606SMark Murray	{
10263b4e3dcbSSimon L. B. Nielsen	$disabled{"krb5"} = "krb5-flavor not specified";
10275c87c606SMark Murray	}
10285c87c606SMark Murray
10293b4e3dcbSSimon L. B. Nielsenif (!defined($disabled{"zlib-dynamic"}))
10303b4e3dcbSSimon L. B. Nielsen	{
10313b4e3dcbSSimon L. B. Nielsen	# "zlib-dynamic" was specifically enabled, so enable "zlib"
10323b4e3dcbSSimon L. B. Nielsen	delete $disabled{"zlib"};
10333b4e3dcbSSimon L. B. Nielsen	}
10343b4e3dcbSSimon L. B. Nielsen
10353b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"rijndael"}))
10363b4e3dcbSSimon L. B. Nielsen	{
10373b4e3dcbSSimon L. B. Nielsen	$disabled{"aes"} = "forced";
10383b4e3dcbSSimon L. B. Nielsen	}
10393b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"des"}))
10403b4e3dcbSSimon L. B. Nielsen	{
10413b4e3dcbSSimon L. B. Nielsen	$disabled{"mdc2"} = "forced";
10423b4e3dcbSSimon L. B. Nielsen	}
10433b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"ec"}))
10443b4e3dcbSSimon L. B. Nielsen	{
10453b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdsa"} = "forced";
10463b4e3dcbSSimon L. B. Nielsen	$disabled{"ecdh"} = "forced";
10473b4e3dcbSSimon L. B. Nielsen	}
10483b4e3dcbSSimon L. B. Nielsen
10493b4e3dcbSSimon L. B. Nielsen# SSL 2.0 requires MD5 and RSA
10503b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
10513b4e3dcbSSimon L. B. Nielsen	{
10523b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl2"} = "forced";
10533b4e3dcbSSimon L. B. Nielsen	}
10543b4e3dcbSSimon L. B. Nielsen
10551f13597dSJung-uk Kimif ($fips && $fipslibdir eq "")
10561f13597dSJung-uk Kim	{
10571f13597dSJung-uk Kim	$fipslibdir = $fipsdir . "/lib/";
10581f13597dSJung-uk Kim	}
10591f13597dSJung-uk Kim
10601f13597dSJung-uk Kim# RSAX ENGINE sets default non-FIPS RSA method.
10611f13597dSJung-uk Kimif ($fips)
10621f13597dSJung-uk Kim	{
10631f13597dSJung-uk Kim	$disabled{"rsax"} = "forced";
10641f13597dSJung-uk Kim	}
10651f13597dSJung-uk Kim
10663b4e3dcbSSimon L. B. Nielsen# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
10673b4e3dcbSSimon L. B. Nielsenif (defined($disabled{"md5"}) || defined($disabled{"sha"})
10683b4e3dcbSSimon L. B. Nielsen    || (defined($disabled{"rsa"})
10693b4e3dcbSSimon L. B. Nielsen        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
10703b4e3dcbSSimon L. B. Nielsen	{
10713b4e3dcbSSimon L. B. Nielsen	$disabled{"ssl3"} = "forced";
10723b4e3dcbSSimon L. B. Nielsen	$disabled{"tls1"} = "forced";
10733b4e3dcbSSimon L. B. Nielsen	}
10743b4e3dcbSSimon L. B. Nielsen
1075db522d3aSSimon L. B. Nielsenif (defined($disabled{"tls1"}))
1076db522d3aSSimon L. B. Nielsen	{
1077db522d3aSSimon L. B. Nielsen	$disabled{"tlsext"} = "forced";
1078db522d3aSSimon L. B. Nielsen	}
10793b4e3dcbSSimon L. B. Nielsen
10801f13597dSJung-uk Kimif (defined($disabled{"ec"}) || defined($disabled{"dsa"})
10811f13597dSJung-uk Kim    || defined($disabled{"dh"}))
10821f13597dSJung-uk Kim	{
10831f13597dSJung-uk Kim	$disabled{"gost"} = "forced";
10841f13597dSJung-uk Kim	}
10851f13597dSJung-uk Kim
10861f13597dSJung-uk Kim# SRP and HEARTBEATS require TLSEXT
10871f13597dSJung-uk Kimif (defined($disabled{"tlsext"}))
10881f13597dSJung-uk Kim	{
10891f13597dSJung-uk Kim	$disabled{"srp"} = "forced";
10901f13597dSJung-uk Kim	$disabled{"heartbeats"} = "forced";
10911f13597dSJung-uk Kim	}
10921f13597dSJung-uk Kim
109374664626SKris Kennawayif ($target eq "TABLE") {
109474664626SKris Kennaway	foreach $target (sort keys %table) {
109574664626SKris Kennaway		print_table_entry($target);
109674664626SKris Kennaway	}
109774664626SKris Kennaway	exit 0;
109874664626SKris Kennaway}
109974664626SKris Kennaway
1100f579bf8eSKris Kennawayif ($target eq "LIST") {
1101f579bf8eSKris Kennaway	foreach (sort keys %table) {
1102f579bf8eSKris Kennaway		print;
1103f579bf8eSKris Kennaway		print "\n";
1104f579bf8eSKris Kennaway	}
1105f579bf8eSKris Kennaway	exit 0;
1106f579bf8eSKris Kennaway}
1107f579bf8eSKris Kennaway
1108c1803d78SJacques Vidrineif ($target =~ m/^CygWin32(-.*)$/) {
1109c1803d78SJacques Vidrine	$target = "Cygwin".$1;
1110c1803d78SJacques Vidrine}
1111c1803d78SJacques Vidrine
1112ddd58736SKris Kennawayprint "Configuring for $target\n";
1113ddd58736SKris Kennaway
111474664626SKris Kennaway&usage if (!defined($table{$target}));
111574664626SKris Kennaway
11161f13597dSJung-uk Kim
11171f13597dSJung-uk Kimforeach (sort (keys %disabled))
11181f13597dSJung-uk Kim	{
11191f13597dSJung-uk Kim	$options .= " no-$_";
11201f13597dSJung-uk Kim
11211f13597dSJung-uk Kim	printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
11221f13597dSJung-uk Kim
11231f13597dSJung-uk Kim	if (/^dso$/)
11241f13597dSJung-uk Kim		{ $no_dso = 1; }
11251f13597dSJung-uk Kim	elsif (/^threads$/)
11261f13597dSJung-uk Kim		{ $no_threads = 1; }
11271f13597dSJung-uk Kim	elsif (/^shared$/)
11281f13597dSJung-uk Kim		{ $no_shared = 1; }
11291f13597dSJung-uk Kim	elsif (/^zlib$/)
11301f13597dSJung-uk Kim		{ $zlib = 0; }
11311f13597dSJung-uk Kim	elsif (/^static-engine$/)
11321f13597dSJung-uk Kim		{ }
11331f13597dSJung-uk Kim	elsif (/^zlib-dynamic$/)
11341f13597dSJung-uk Kim		{ }
11351f13597dSJung-uk Kim	elsif (/^symlinks$/)
11361f13597dSJung-uk Kim		{ $symlink = 0; }
11371f13597dSJung-uk Kim	elsif (/^sse2$/)
11381f13597dSJung-uk Kim		{ $no_sse2 = 1; }
11391f13597dSJung-uk Kim	else
11401f13597dSJung-uk Kim		{
11411f13597dSJung-uk Kim		my ($ALGO, $algo);
11421f13597dSJung-uk Kim		($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
11431f13597dSJung-uk Kim
11441f13597dSJung-uk Kim		if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
11451f13597dSJung-uk Kim			{
11461f13597dSJung-uk Kim			$openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
11471f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
11481f13597dSJung-uk Kim
11491f13597dSJung-uk Kim			if (/^err$/)	{ $flags .= "-DOPENSSL_NO_ERR "; }
11501f13597dSJung-uk Kim			elsif (/^asm$/)	{ $no_asm = 1; }
11511f13597dSJung-uk Kim			}
11521f13597dSJung-uk Kim		else
11531f13597dSJung-uk Kim			{
11541f13597dSJung-uk Kim			$openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
11551f13597dSJung-uk Kim			print " OPENSSL_NO_$ALGO";
11561f13597dSJung-uk Kim
11571f13597dSJung-uk Kim			if (/^krb5$/)
11581f13597dSJung-uk Kim				{ $no_krb5 = 1; }
11591f13597dSJung-uk Kim			else
11601f13597dSJung-uk Kim				{
11611f13597dSJung-uk Kim				push @skip, $algo;
11621f13597dSJung-uk Kim				# fix-up crypto/directory name(s)
11631f13597dSJung-uk Kim				@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
11641f13597dSJung-uk Kim				print " (skip dir)";
11651f13597dSJung-uk Kim
11661f13597dSJung-uk Kim				$depflags .= " -DOPENSSL_NO_$ALGO";
11671f13597dSJung-uk Kim				}
11681f13597dSJung-uk Kim			}
11691f13597dSJung-uk Kim		}
11701f13597dSJung-uk Kim
11711f13597dSJung-uk Kim	print "\n";
11721f13597dSJung-uk Kim	}
11731f13597dSJung-uk Kim
11741f13597dSJung-uk Kimmy $exp_cflags = "";
11751f13597dSJung-uk Kimforeach (sort @experimental)
11761f13597dSJung-uk Kim	{
11771f13597dSJung-uk Kim	my $ALGO;
11781f13597dSJung-uk Kim	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
11791f13597dSJung-uk Kim
11801f13597dSJung-uk Kim	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
11811f13597dSJung-uk Kim	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
11821f13597dSJung-uk Kim	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
11831f13597dSJung-uk Kim	}
11841f13597dSJung-uk Kim
11851f13597dSJung-uk Kimmy $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
11861f13597dSJung-uk Kim
11871f13597dSJung-uk Kim$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
11881f13597dSJung-uk Kim$exe_ext=".nlm" if ($target =~ /netware/);
11891f13597dSJung-uk Kim$exe_ext=".pm"  if ($target =~ /vos/);
11901f13597dSJung-uk Kim$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
11911f13597dSJung-uk Kim$prefix=$openssldir if $prefix eq "";
11921f13597dSJung-uk Kim
11931f13597dSJung-uk Kim$default_ranlib= &which("ranlib") or $default_ranlib="true";
11941f13597dSJung-uk Kim$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
11951f13597dSJung-uk Kim  or $perl="perl";
11961f13597dSJung-uk Kimmy $make = $ENV{'MAKE'} || "make";
11971f13597dSJung-uk Kim
11981f13597dSJung-uk Kim$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
11991f13597dSJung-uk Kim
12001f13597dSJung-uk Kimchop $openssldir if $openssldir =~ /\/$/;
12011f13597dSJung-uk Kimchop $prefix if $prefix =~ /.\/$/;
12021f13597dSJung-uk Kim
12031f13597dSJung-uk Kim$openssldir=$prefix . "/ssl" if $openssldir eq "";
12041f13597dSJung-uk Kim$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
12051f13597dSJung-uk Kim
12061f13597dSJung-uk Kim
12071f13597dSJung-uk Kimprint "IsMK1MF=$IsMK1MF\n";
12081f13597dSJung-uk Kim
1209db522d3aSSimon L. B. Nielsenmy @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1210db522d3aSSimon L. B. Nielsenmy $cc = $fields[$idx_cc];
1211db522d3aSSimon L. B. Nielsen# Allow environment CC to override compiler...
1212db522d3aSSimon L. B. Nielsenif($ENV{CC}) {
1213db522d3aSSimon L. B. Nielsen    $cc = $ENV{CC};
1214db522d3aSSimon L. B. Nielsen}
1215*7bded2dbSJung-uk Kim
1216db522d3aSSimon L. B. Nielsenmy $cflags = $fields[$idx_cflags];
1217db522d3aSSimon L. B. Nielsenmy $unistd = $fields[$idx_unistd];
1218db522d3aSSimon L. B. Nielsenmy $thread_cflag = $fields[$idx_thread_cflag];
1219db522d3aSSimon L. B. Nielsenmy $sys_id = $fields[$idx_sys_id];
1220db522d3aSSimon L. B. Nielsenmy $lflags = $fields[$idx_lflags];
1221db522d3aSSimon L. B. Nielsenmy $bn_ops = $fields[$idx_bn_ops];
1222db522d3aSSimon L. B. Nielsenmy $cpuid_obj = $fields[$idx_cpuid_obj];
1223db522d3aSSimon L. B. Nielsenmy $bn_obj = $fields[$idx_bn_obj];
1224*7bded2dbSJung-uk Kimmy $ec_obj = $fields[$idx_ec_obj];
1225db522d3aSSimon L. B. Nielsenmy $des_obj = $fields[$idx_des_obj];
1226db522d3aSSimon L. B. Nielsenmy $aes_obj = $fields[$idx_aes_obj];
1227db522d3aSSimon L. B. Nielsenmy $bf_obj = $fields[$idx_bf_obj];
1228db522d3aSSimon L. B. Nielsenmy $md5_obj = $fields[$idx_md5_obj];
1229db522d3aSSimon L. B. Nielsenmy $sha1_obj = $fields[$idx_sha1_obj];
1230db522d3aSSimon L. B. Nielsenmy $cast_obj = $fields[$idx_cast_obj];
1231db522d3aSSimon L. B. Nielsenmy $rc4_obj = $fields[$idx_rc4_obj];
1232db522d3aSSimon L. B. Nielsenmy $rmd160_obj = $fields[$idx_rmd160_obj];
1233db522d3aSSimon L. B. Nielsenmy $rc5_obj = $fields[$idx_rc5_obj];
12341f13597dSJung-uk Kimmy $wp_obj = $fields[$idx_wp_obj];
12351f13597dSJung-uk Kimmy $cmll_obj = $fields[$idx_cmll_obj];
12361f13597dSJung-uk Kimmy $modes_obj = $fields[$idx_modes_obj];
12371f13597dSJung-uk Kimmy $engines_obj = $fields[$idx_engines_obj];
12381f13597dSJung-uk Kimmy $perlasm_scheme = $fields[$idx_perlasm_scheme];
1239db522d3aSSimon L. B. Nielsenmy $dso_scheme = $fields[$idx_dso_scheme];
1240db522d3aSSimon L. B. Nielsenmy $shared_target = $fields[$idx_shared_target];
1241db522d3aSSimon L. B. Nielsenmy $shared_cflag = $fields[$idx_shared_cflag];
1242db522d3aSSimon L. B. Nielsenmy $shared_ldflag = $fields[$idx_shared_ldflag];
1243db522d3aSSimon L. B. Nielsenmy $shared_extension = $fields[$idx_shared_extension];
12446a599222SSimon L. B. Nielsenmy $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
12456a599222SSimon L. B. Nielsenmy $ar = $ENV{'AR'} || "ar";
1246db522d3aSSimon L. B. Nielsenmy $arflags = $fields[$idx_arflags];
12471f13597dSJung-uk Kimmy $multilib = $fields[$idx_multilib];
1248db522d3aSSimon L. B. Nielsen
12491f13597dSJung-uk Kim# if $prefix/lib$multilib is not an existing directory, then
12501f13597dSJung-uk Kim# assume that it's not searched by linker automatically, in
12511f13597dSJung-uk Kim# which case adding $multilib suffix causes more grief than
12521f13597dSJung-uk Kim# we're ready to tolerate, so don't...
12531f13597dSJung-uk Kim$multilib="" if !-d "$prefix/lib$multilib";
1254db522d3aSSimon L. B. Nielsen
12551f13597dSJung-uk Kim$libdir="lib$multilib" if $libdir eq "";
1256db522d3aSSimon L. B. Nielsen
12571f13597dSJung-uk Kim$cflags = "$cflags$exp_cflags";
125874664626SKris Kennaway
1259db522d3aSSimon L. B. Nielsen# '%' in $lflags is used to split flags to "pre-" and post-flags
1260db522d3aSSimon L. B. Nielsenmy ($prelflags,$postlflags)=split('%',$lflags);
1261db522d3aSSimon L. B. Nielsenif (defined($postlflags))	{ $lflags=$postlflags;	}
1262db522d3aSSimon L. B. Nielsenelse				{ $lflags=$prelflags; undef $prelflags;	}
1263c1803d78SJacques Vidrine
12641f13597dSJung-uk Kimif ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
12651f13597dSJung-uk Kim	{
12661f13597dSJung-uk Kim	$cflags =~ s/\-mno\-cygwin\s*//;
12671f13597dSJung-uk Kim	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
12681f13597dSJung-uk Kim	}
12691f13597dSJung-uk Kim
1270*7bded2dbSJung-uk Kimif ($target =~ /linux.*\-mips/ && !$no_asm && $flags !~ /\-m(ips|arch=)/) {
1271*7bded2dbSJung-uk Kim	# minimally required architecture flags for assembly modules
1272*7bded2dbSJung-uk Kim	$cflags="-mips2 $cflags" if ($target =~ /mips32/);
1273*7bded2dbSJung-uk Kim	$cflags="-mips3 $cflags" if ($target =~ /mips64/);
1274*7bded2dbSJung-uk Kim}
1275*7bded2dbSJung-uk Kim
1276fceca8a3SJacques Vidrinemy $no_shared_warn=0;
12773b4e3dcbSSimon L. B. Nielsenmy $no_user_cflags=0;
1278fceca8a3SJacques Vidrine
12793b4e3dcbSSimon L. B. Nielsenif ($flags ne "")	{ $cflags="$flags$cflags"; }
12803b4e3dcbSSimon L. B. Nielsenelse			{ $no_user_cflags=1;       }
128174664626SKris Kennaway
12825c87c606SMark Murray# Kerberos settings.  The flavor must be provided from outside, either through
12835c87c606SMark Murray# the script "config" or manually.
12843b4e3dcbSSimon L. B. Nielsenif (!$no_krb5)
12855c87c606SMark Murray	{
12865c87c606SMark Murray	my ($lresolv, $lpath, $lext);
12875c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
12885c87c606SMark Murray		{
12895c87c606SMark Murray		die "Sorry, Heimdal is currently not supported\n";
12905c87c606SMark Murray		}
12915c87c606SMark Murray	##### HACK to force use of Heimdal.
12925c87c606SMark Murray	##### WARNING: Since we don't really have adequate support for Heimdal,
12935c87c606SMark Murray	#####          using this will break the build.  You'll have to make
12945c87c606SMark Murray	#####          changes to the source, and if you do, please send
12955c87c606SMark Murray	#####          patches to openssl-dev@openssl.org
12965c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
12975c87c606SMark Murray		{
12985c87c606SMark Murray		warn "Heimdal isn't really supported.  Your build WILL break\n";
12995c87c606SMark Murray		warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
13005c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/heimdal"
13015c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
13025c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
13035c87c606SMark Murray			"/lib -lgssapi -lkrb5 -lcom_err"
13043b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
13055c87c606SMark Murray		$cflags="-DKRB5_HEIMDAL $cflags";
13065c87c606SMark Murray		}
13075c87c606SMark Murray	if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
13085c87c606SMark Murray		{
13095c87c606SMark Murray		$withargs{"krb5-dir"} = "/usr/kerberos"
13105c87c606SMark Murray			if $withargs{"krb5-dir"} eq "";
13115c87c606SMark Murray		$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
13125c87c606SMark Murray			"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
13133b4e3dcbSSimon L. B. Nielsen			if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
13145c87c606SMark Murray		$cflags="-DKRB5_MIT $cflags";
13155c87c606SMark Murray		$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
13165c87c606SMark Murray		if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
13175c87c606SMark Murray			{
13185c87c606SMark Murray			$cflags="-DKRB5_MIT_OLD11 $cflags";
13195c87c606SMark Murray			}
13205c87c606SMark Murray		}
13215c87c606SMark Murray	LRESOLV:
13225c87c606SMark Murray	foreach $lpath ("/lib", "/usr/lib")
13235c87c606SMark Murray		{
13245c87c606SMark Murray		foreach $lext ("a", "so")
13255c87c606SMark Murray			{
13265c87c606SMark Murray			$lresolv = "$lpath/libresolv.$lext";
13275c87c606SMark Murray			last LRESOLV	if (-r "$lresolv");
13285c87c606SMark Murray			$lresolv = "";
13295c87c606SMark Murray			}
13305c87c606SMark Murray		}
13315c87c606SMark Murray	$withargs{"krb5-lib"} .= " -lresolv"
13325c87c606SMark Murray		if ("$lresolv" ne "");
13335c87c606SMark Murray	$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
13345c87c606SMark Murray		if $withargs{"krb5-include"} eq "" &&
13355c87c606SMark Murray		   $withargs{"krb5-dir"} ne "";
13365c87c606SMark Murray	}
13375c87c606SMark Murray
1338ddd58736SKris Kennaway# The DSO code currently always implements all functions so that no
1339ddd58736SKris Kennaway# applications will have to worry about that from a compilation point
1340ddd58736SKris Kennaway# of view. However, the "method"s may return zero unless that platform
1341ddd58736SKris Kennaway# has support compiled in for them. Currently each method is enabled
1342ddd58736SKris Kennaway# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1343ddd58736SKris Kennaway# string entry into using the following logic;
1344ddd58736SKris Kennawaymy $dso_cflags;
1345ddd58736SKris Kennawayif (!$no_dso && $dso_scheme ne "")
1346ddd58736SKris Kennaway	{
1347ddd58736SKris Kennaway	$dso_scheme =~ tr/[a-z]/[A-Z]/;
1348ddd58736SKris Kennaway	if ($dso_scheme eq "DLFCN")
1349ddd58736SKris Kennaway		{
1350ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
1351ddd58736SKris Kennaway		}
1352ddd58736SKris Kennaway	elsif ($dso_scheme eq "DLFCN_NO_H")
1353ddd58736SKris Kennaway		{
1354ddd58736SKris Kennaway		$dso_cflags = "-DDSO_DLFCN";
1355ddd58736SKris Kennaway		}
1356ddd58736SKris Kennaway	else
1357ddd58736SKris Kennaway		{
1358ddd58736SKris Kennaway		$dso_cflags = "-DDSO_$dso_scheme";
1359ddd58736SKris Kennaway		}
1360ddd58736SKris Kennaway	$cflags = "$dso_cflags $cflags";
1361ddd58736SKris Kennaway	}
1362ddd58736SKris Kennaway
136374664626SKris Kennawaymy $thread_cflags;
1364f579bf8eSKris Kennawaymy $thread_defines;
136574664626SKris Kennawayif ($thread_cflag ne "(unknown)" && !$no_threads)
136674664626SKris Kennaway	{
136774664626SKris Kennaway	# If we know how to do it, support threads by default.
136874664626SKris Kennaway	$threads = 1;
136974664626SKris Kennaway	}
13703b4e3dcbSSimon L. B. Nielsenif ($thread_cflag eq "(unknown)" && $threads)
137174664626SKris Kennaway	{
13723b4e3dcbSSimon L. B. Nielsen	# If the user asked for "threads", [s]he is also expected to
13733b4e3dcbSSimon L. B. Nielsen	# provide any system-dependent compiler options that are
13743b4e3dcbSSimon L. B. Nielsen	# necessary.
13753b4e3dcbSSimon L. B. Nielsen	if ($no_user_cflags)
13763b4e3dcbSSimon L. B. Nielsen		{
13773b4e3dcbSSimon L. B. Nielsen		print "You asked for multi-threading support, but didn't\n";
13783b4e3dcbSSimon L. B. Nielsen		print "provide any system-specific compiler options\n";
13793b4e3dcbSSimon L. B. Nielsen		exit(1);
13803b4e3dcbSSimon L. B. Nielsen		}
13815c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $cflags" ;
13825c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
138374664626SKris Kennaway	}
138474664626SKris Kennawayelse
138574664626SKris Kennaway	{
13865c87c606SMark Murray	$thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
13875c87c606SMark Murray	$thread_defines .= "#define OPENSSL_THREADS\n";
1388f579bf8eSKris Kennaway#	my $def;
1389f579bf8eSKris Kennaway#	foreach $def (split ' ',$thread_cflag)
1390f579bf8eSKris Kennaway#		{
1391f579bf8eSKris Kennaway#		if ($def =~ s/^-D// && $def !~ /^_/)
1392f579bf8eSKris Kennaway#			{
1393f579bf8eSKris Kennaway#			$thread_defines .= "#define $def\n";
1394f579bf8eSKris Kennaway#			}
1395f579bf8eSKris Kennaway#		}
139674664626SKris Kennaway	}
139774664626SKris Kennaway
139874664626SKris Kennaway$lflags="$libs$lflags" if ($libs ne "");
139974664626SKris Kennaway
140074664626SKris Kennawayif ($no_asm)
140174664626SKris Kennaway	{
1402*7bded2dbSJung-uk Kim	$cpuid_obj=$bn_obj=$ec_obj=
14031f13597dSJung-uk Kim	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
14041f13597dSJung-uk Kim	$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
140574664626SKris Kennaway	}
140674664626SKris Kennaway
14075c87c606SMark Murrayif (!$no_shared)
14085c87c606SMark Murray	{
14095c87c606SMark Murray	$cast_obj="";	# CAST assembler is not PIC
14105c87c606SMark Murray	}
14115c87c606SMark Murray
141274664626SKris Kennawayif ($threads)
141374664626SKris Kennaway	{
141474664626SKris Kennaway	$cflags=$thread_cflags;
1415f579bf8eSKris Kennaway	$openssl_thread_defines .= $thread_defines;
141674664626SKris Kennaway	}
141774664626SKris Kennaway
14185c87c606SMark Murrayif ($zlib)
14195c87c606SMark Murray	{
14205c87c606SMark Murray	$cflags = "-DZLIB $cflags";
14213b4e3dcbSSimon L. B. Nielsen	if (defined($disabled{"zlib-dynamic"}))
14223b4e3dcbSSimon L. B. Nielsen		{
14231f13597dSJung-uk Kim		if (defined($withargs{"zlib-lib"}))
14241f13597dSJung-uk Kim			{
14251f13597dSJung-uk Kim			$lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
14261f13597dSJung-uk Kim			}
14271f13597dSJung-uk Kim		else
14281f13597dSJung-uk Kim			{
14293b4e3dcbSSimon L. B. Nielsen			$lflags = "$lflags -lz";
14303b4e3dcbSSimon L. B. Nielsen			}
14311f13597dSJung-uk Kim		}
14323b4e3dcbSSimon L. B. Nielsen	else
14333b4e3dcbSSimon L. B. Nielsen		{
14343b4e3dcbSSimon L. B. Nielsen		$cflags = "-DZLIB_SHARED $cflags";
14353b4e3dcbSSimon L. B. Nielsen		}
14365c87c606SMark Murray	}
14375c87c606SMark Murray
1438ddd58736SKris Kennaway# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
14395740a5e3SKris Kennawaymy $shared_mark = "";
14405c87c606SMark Murrayif ($shared_target eq "")
14415c87c606SMark Murray	{
14421f13597dSJung-uk Kim	$no_shared_warn = 1 if !$no_shared;
14435c87c606SMark Murray	$no_shared = 1;
14445c87c606SMark Murray	}
14455c87c606SMark Murrayif (!$no_shared)
14465740a5e3SKris Kennaway	{
1447ddd58736SKris Kennaway	if ($shared_cflag ne "")
1448ddd58736SKris Kennaway		{
14493b4e3dcbSSimon L. B. Nielsen		$cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
14503b4e3dcbSSimon L. B. Nielsen		}
14513b4e3dcbSSimon L. B. Nielsen	}
14523b4e3dcbSSimon L. B. Nielsen
14533b4e3dcbSSimon L. B. Nielsenif (!$IsMK1MF)
14543b4e3dcbSSimon L. B. Nielsen	{
14551f13597dSJung-uk Kim	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
14563b4e3dcbSSimon L. B. Nielsen	if ($no_shared)
14573b4e3dcbSSimon L. B. Nielsen		{
14583b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
14591f13597dSJung-uk Kim		$options.=" static-engine";
14603b4e3dcbSSimon L. B. Nielsen		}
14613b4e3dcbSSimon L. B. Nielsen	else
14623b4e3dcbSSimon L. B. Nielsen		{
14633b4e3dcbSSimon L. B. Nielsen		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
14641f13597dSJung-uk Kim		$options.=" no-static-engine";
14653b4e3dcbSSimon L. B. Nielsen		}
14663b4e3dcbSSimon L. B. Nielsen	}
14673b4e3dcbSSimon L. B. Nielsen
14681f13597dSJung-uk Kim$cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1469db522d3aSSimon L. B. Nielsen
1470db522d3aSSimon L. B. Nielsen#
1471db522d3aSSimon L. B. Nielsen# Platform fix-ups
1472db522d3aSSimon L. B. Nielsen#
1473db522d3aSSimon L. B. Nielsenif ($target =~ /\-icc$/)	# Intel C compiler
14743b4e3dcbSSimon L. B. Nielsen	{
1475db522d3aSSimon L. B. Nielsen	my $iccver=0;
1476db522d3aSSimon L. B. Nielsen	if (open(FD,"$cc -V 2>&1 |"))
1477db522d3aSSimon L. B. Nielsen		{
1478db522d3aSSimon L. B. Nielsen		while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1479db522d3aSSimon L. B. Nielsen		close(FD);
1480db522d3aSSimon L. B. Nielsen		}
14813b4e3dcbSSimon L. B. Nielsen	if ($iccver>=8)
14823b4e3dcbSSimon L. B. Nielsen		{
1483*7bded2dbSJung-uk Kim		$cflags=~s/\-KPIC/-fPIC/;
14843b4e3dcbSSimon L. B. Nielsen		# Eliminate unnecessary dependency from libirc.a. This is
14853b4e3dcbSSimon L. B. Nielsen		# essential for shared library support, as otherwise
14863b4e3dcbSSimon L. B. Nielsen		# apps/openssl can end up in endless loop upon startup...
14873b4e3dcbSSimon L. B. Nielsen		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
14885740a5e3SKris Kennaway		}
1489db522d3aSSimon L. B. Nielsen	if ($iccver>=9)
1490db522d3aSSimon L. B. Nielsen		{
1491*7bded2dbSJung-uk Kim		$lflags.=" -i-static";
1492*7bded2dbSJung-uk Kim		$lflags=~s/\-no_cpprt/-no-cpprt/;
1493db522d3aSSimon L. B. Nielsen		}
1494db522d3aSSimon L. B. Nielsen	if ($iccver>=10)
1495db522d3aSSimon L. B. Nielsen		{
1496*7bded2dbSJung-uk Kim		$lflags=~s/\-i\-static/-static-intel/;
1497*7bded2dbSJung-uk Kim		}
1498*7bded2dbSJung-uk Kim	if ($iccver>=11)
1499*7bded2dbSJung-uk Kim		{
1500*7bded2dbSJung-uk Kim		$cflags.=" -no-intel-extensions";	# disable Cilk
1501*7bded2dbSJung-uk Kim		$lflags=~s/\-no\-cpprt/-no-cxxlib/;
1502db522d3aSSimon L. B. Nielsen		}
1503db522d3aSSimon L. B. Nielsen	}
1504db522d3aSSimon L. B. Nielsen
1505db522d3aSSimon L. B. Nielsen# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1506db522d3aSSimon L. B. Nielsen# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1507db522d3aSSimon L. B. Nielsen# .so objects. Apparently application RPATH is not global and does
1508db522d3aSSimon L. B. Nielsen# not apply to .so linked with other .so. Problem manifests itself
1509db522d3aSSimon L. B. Nielsen# when libssl.so fails to load libcrypto.so. One can argue that we
1510db522d3aSSimon L. B. Nielsen# should engrave this into Makefile.shared rules or into BSD-* config
1511db522d3aSSimon L. B. Nielsen# lines above. Meanwhile let's try to be cautious and pass -rpath to
1512db522d3aSSimon L. B. Nielsen# linker only when --prefix is not /usr.
1513db522d3aSSimon L. B. Nielsenif ($target =~ /^BSD\-/)
1514db522d3aSSimon L. B. Nielsen	{
1515db522d3aSSimon L. B. Nielsen	$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1516ddd58736SKris Kennaway	}
15175c87c606SMark Murray
15185c87c606SMark Murrayif ($sys_id ne "")
1519de7cdddaSKris Kennaway	{
15203b4e3dcbSSimon L. B. Nielsen	#$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
15215c87c606SMark Murray	$openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
1522de7cdddaSKris Kennaway	}
1523ddd58736SKris Kennaway
15245740a5e3SKris Kennawayif ($ranlib eq "")
15255740a5e3SKris Kennaway	{
15265740a5e3SKris Kennaway	$ranlib = $default_ranlib;
15275740a5e3SKris Kennaway	}
15285740a5e3SKris Kennaway
152974664626SKris Kennaway#my ($bn1)=split(/\s+/,$bn_obj);
153074664626SKris Kennaway#$bn1 = "" unless defined $bn1;
153174664626SKris Kennaway#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
153274664626SKris Kennaway#$bn_obj="$bn1";
153374664626SKris Kennaway
15343b4e3dcbSSimon L. B. Nielsen$cpuid_obj="" if ($processor eq "386");
153574664626SKris Kennaway
15363b4e3dcbSSimon L. B. Nielsen$bn_obj = $bn_asm unless $bn_obj ne "";
15371f13597dSJung-uk Kim# bn-586 is the only one implementing bn_*_part_words
15381f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
15391f13597dSJung-uk Kim$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
15403b4e3dcbSSimon L. B. Nielsen
15411f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
15421f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
15431f13597dSJung-uk Kim$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
1544db522d3aSSimon L. B. Nielsen
1545db522d3aSSimon L. B. Nielsenif ($fips)
1546db522d3aSSimon L. B. Nielsen	{
1547db522d3aSSimon L. B. Nielsen	$openssl_other_defines.="#define OPENSSL_FIPS\n";
15481f13597dSJung-uk Kim	$cflags .= " -I\$(FIPSDIR)/include";
1549db522d3aSSimon L. B. Nielsen	}
1550db522d3aSSimon L. B. Nielsen
15511f13597dSJung-uk Kim$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
15523b4e3dcbSSimon L. B. Nielsen$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
155374664626SKris Kennaway$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
155474664626SKris Kennaway$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
155574664626SKris Kennaway$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
155674664626SKris Kennaway$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
15573b4e3dcbSSimon L. B. Nielsenif ($sha1_obj =~ /\.o$/)
155874664626SKris Kennaway	{
155974664626SKris Kennaway#	$sha1_obj=$sha1_enc;
15603b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
15613b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
15623b4e3dcbSSimon L. B. Nielsen	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1563db522d3aSSimon L. B. Nielsen	if ($sha1_obj =~ /sse2/)
15643b4e3dcbSSimon L. B. Nielsen	    {	if ($no_sse2)
15653b4e3dcbSSimon L. B. Nielsen		{   $sha1_obj =~ s/\S*sse2\S+//;        }
15663b4e3dcbSSimon L. B. Nielsen		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
15673b4e3dcbSSimon L. B. Nielsen		{   $cflags.=" -DOPENSSL_IA32_SSE2";    }
15683b4e3dcbSSimon L. B. Nielsen	    }
156974664626SKris Kennaway	}
157074664626SKris Kennawayif ($md5_obj =~ /\.o$/)
157174664626SKris Kennaway	{
157274664626SKris Kennaway#	$md5_obj=$md5_enc;
157374664626SKris Kennaway	$cflags.=" -DMD5_ASM";
157474664626SKris Kennaway	}
157574664626SKris Kennawayif ($rmd160_obj =~ /\.o$/)
157674664626SKris Kennaway	{
157774664626SKris Kennaway#	$rmd160_obj=$rmd160_enc;
157874664626SKris Kennaway	$cflags.=" -DRMD160_ASM";
157974664626SKris Kennaway	}
15803b4e3dcbSSimon L. B. Nielsenif ($aes_obj =~ /\.o$/)
15816be8ae07SJacques Vidrine	{
1582*7bded2dbSJung-uk Kim	$cflags.=" -DAES_ASM" if ($aes_obj =~ m/\baes\-/);;
15831f13597dSJung-uk Kim	# aes-ctr.o is not a real file, only indication that assembler
15841f13597dSJung-uk Kim	# module implements AES_ctr32_encrypt...
15851f13597dSJung-uk Kim	$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
15861f13597dSJung-uk Kim	# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
15871f13597dSJung-uk Kim	$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
15881f13597dSJung-uk Kim	$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
15891f13597dSJung-uk Kim	$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
15901f13597dSJung-uk Kim	$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
15913b4e3dcbSSimon L. B. Nielsen	}
15923b4e3dcbSSimon L. B. Nielsenelse	{
15933b4e3dcbSSimon L. B. Nielsen	$aes_obj=$aes_enc;
15946be8ae07SJacques Vidrine	}
15951f13597dSJung-uk Kim$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
15961f13597dSJung-uk Kimif ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
15971f13597dSJung-uk Kim	{
15981f13597dSJung-uk Kim	$cflags.=" -DWHIRLPOOL_ASM";
15991f13597dSJung-uk Kim	}
16001f13597dSJung-uk Kimelse	{
16011f13597dSJung-uk Kim	$wp_obj="wp_block.o";
16021f13597dSJung-uk Kim	}
16031f13597dSJung-uk Kim$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
1604*7bded2dbSJung-uk Kimif ($modes_obj =~ /ghash\-/)
16051f13597dSJung-uk Kim	{
16061f13597dSJung-uk Kim	$cflags.=" -DGHASH_ASM";
16071f13597dSJung-uk Kim	}
1608*7bded2dbSJung-uk Kimif ($ec_obj =~ /ecp_nistz256/)
1609*7bded2dbSJung-uk Kim	{
1610*7bded2dbSJung-uk Kim	$cflags.=" -DECP_NISTZ256_ASM";
1611*7bded2dbSJung-uk Kim	}
16126be8ae07SJacques Vidrine
16134f20a5a2SJacques Vidrine# "Stringify" the C flags string.  This permits it to be made part of a string
16144f20a5a2SJacques Vidrine# and works as well on command lines.
16154f20a5a2SJacques Vidrine$cflags =~ s/([\\\"])/\\\1/g;
16164f20a5a2SJacques Vidrine
161774664626SKris Kennawaymy $version = "unknown";
16183b4e3dcbSSimon L. B. Nielsenmy $version_num = "unknown";
161974664626SKris Kennawaymy $major = "unknown";
162074664626SKris Kennawaymy $minor = "unknown";
1621ddd58736SKris Kennawaymy $shlib_version_number = "unknown";
1622ddd58736SKris Kennawaymy $shlib_version_history = "unknown";
1623ddd58736SKris Kennawaymy $shlib_major = "unknown";
1624ddd58736SKris Kennawaymy $shlib_minor = "unknown";
162574664626SKris Kennaway
162674664626SKris Kennawayopen(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
162774664626SKris Kennawaywhile (<IN>)
162874664626SKris Kennaway	{
162974664626SKris Kennaway	$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
16303b4e3dcbSSimon L. B. Nielsen	$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
1631ddd58736SKris Kennaway	$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
1632ddd58736SKris Kennaway	$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
163374664626SKris Kennaway	}
163474664626SKris Kennawayclose(IN);
1635ddd58736SKris Kennawayif ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
163674664626SKris Kennaway
163774664626SKris Kennawayif ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
163874664626SKris Kennaway	{
163974664626SKris Kennaway	$major=$1;
164074664626SKris Kennaway	$minor=$2;
164174664626SKris Kennaway	}
164274664626SKris Kennaway
1643ddd58736SKris Kennawayif ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
1644ddd58736SKris Kennaway	{
1645ddd58736SKris Kennaway	$shlib_major=$1;
1646ddd58736SKris Kennaway	$shlib_minor=$2;
1647ddd58736SKris Kennaway	}
1648ddd58736SKris Kennaway
16496a599222SSimon L. B. Nielsenif ($strict_warnings)
16506a599222SSimon L. B. Nielsen	{
1651*7bded2dbSJung-uk Kim	my $ecc = $cc;
1652*7bded2dbSJung-uk Kim	$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
16536a599222SSimon L. B. Nielsen	my $wopt;
1654*7bded2dbSJung-uk Kim	die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/);
16556a599222SSimon L. B. Nielsen	foreach $wopt (split /\s+/, $gcc_devteam_warn)
16566a599222SSimon L. B. Nielsen		{
16576a599222SSimon L. B. Nielsen		$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
16586a599222SSimon L. B. Nielsen		}
1659*7bded2dbSJung-uk Kim	if ($ecc eq "clang")
1660*7bded2dbSJung-uk Kim		{
1661*7bded2dbSJung-uk Kim		foreach $wopt (split /\s+/, $clang_devteam_warn)
1662*7bded2dbSJung-uk Kim			{
1663*7bded2dbSJung-uk Kim			$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
1664*7bded2dbSJung-uk Kim			}
1665*7bded2dbSJung-uk Kim		}
16666a599222SSimon L. B. Nielsen	}
16676a599222SSimon L. B. Nielsen
166874664626SKris Kennawayopen(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
16695c87c606SMark Murrayunlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
16705c87c606SMark Murrayopen(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
1671f579bf8eSKris Kennawayprint OUT "### Generated automatically from Makefile.org by Configure.\n\n";
167274664626SKris Kennawaymy $sdirs=0;
167374664626SKris Kennawaywhile (<IN>)
167474664626SKris Kennaway	{
16753b4e3dcbSSimon L. B. Nielsen	chomp;
167674664626SKris Kennaway	$sdirs = 1 if /^SDIRS=/;
167774664626SKris Kennaway	if ($sdirs) {
167874664626SKris Kennaway		my $dir;
167974664626SKris Kennaway		foreach $dir (@skip) {
16801f13597dSJung-uk Kim			s/(\s)$dir /$1/;
1681db522d3aSSimon L. B. Nielsen			s/\s$dir$//;
168274664626SKris Kennaway			}
168374664626SKris Kennaway		}
168474664626SKris Kennaway	$sdirs = 0 unless /\\$/;
1685db522d3aSSimon L. B. Nielsen        s/engines // if (/^DIRS=/ && $disabled{"engine"});
16861f13597dSJung-uk Kim	s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"});
168774664626SKris Kennaway	s/^VERSION=.*/VERSION=$version/;
168874664626SKris Kennaway	s/^MAJOR=.*/MAJOR=$major/;
168974664626SKris Kennaway	s/^MINOR=.*/MINOR=$minor/;
1690ddd58736SKris Kennaway	s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
1691ddd58736SKris Kennaway	s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
1692ddd58736SKris Kennaway	s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
1693ddd58736SKris Kennaway	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
16945740a5e3SKris Kennaway	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
169574664626SKris Kennaway	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
16961f13597dSJung-uk Kim	s/^MULTILIB=.*$/MULTILIB=$multilib/;
169774664626SKris Kennaway	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
16986a599222SSimon L. B. Nielsen	s/^LIBDIR=.*$/LIBDIR=$libdir/;
169974664626SKris Kennaway	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
170074664626SKris Kennaway	s/^PLATFORM=.*$/PLATFORM=$target/;
170174664626SKris Kennaway	s/^OPTIONS=.*$/OPTIONS=$options/;
1702ddd58736SKris Kennaway	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
17036a599222SSimon L. B. Nielsen	if ($cross_compile_prefix)
17046a599222SSimon L. B. Nielsen		{
17056a599222SSimon L. B. Nielsen		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
17066a599222SSimon L. B. Nielsen		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
17071f13597dSJung-uk Kim		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
17086a599222SSimon L. B. Nielsen		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
17091f13597dSJung-uk Kim		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc";
17106a599222SSimon L. B. Nielsen		}
17116a599222SSimon L. B. Nielsen	else	{
171274664626SKris Kennaway		s/^CC=.*$/CC= $cc/;
17136a599222SSimon L. B. Nielsen		s/^AR=\s*ar/AR= $ar/;
17146a599222SSimon L. B. Nielsen		s/^RANLIB=.*/RANLIB= $ranlib/;
17155c87c606SMark Murray		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
17161f13597dSJung-uk Kim		}
171774664626SKris Kennaway	s/^CFLAG=.*$/CFLAG= $cflags/;
171874664626SKris Kennaway	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1719db522d3aSSimon L. B. Nielsen	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
172074664626SKris Kennaway	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
17215740a5e3SKris Kennaway	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
17223b4e3dcbSSimon L. B. Nielsen	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
172374664626SKris Kennaway	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
1724*7bded2dbSJung-uk Kim	s/^EC_ASM=.*$/EC_ASM= $ec_obj/;
172574664626SKris Kennaway	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
17261f13597dSJung-uk Kim	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
172774664626SKris Kennaway	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
172874664626SKris Kennaway	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
172974664626SKris Kennaway	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
173074664626SKris Kennaway	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
173174664626SKris Kennaway	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
173274664626SKris Kennaway	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
173374664626SKris Kennaway	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
17341f13597dSJung-uk Kim	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
17351f13597dSJung-uk Kim	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
17361f13597dSJung-uk Kim	s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
17371f13597dSJung-uk Kim	s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
17381f13597dSJung-uk Kim	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
173974664626SKris Kennaway	s/^PROCESSOR=.*/PROCESSOR= $processor/;
17405c87c606SMark Murray	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
174174664626SKris Kennaway	s/^PERL=.*/PERL= $perl/;
17425c87c606SMark Murray	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1743fceca8a3SJacques Vidrine	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
17443b4e3dcbSSimon L. B. Nielsen	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
17453b4e3dcbSSimon L. B. Nielsen	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
17461f13597dSJung-uk Kim
17471f13597dSJung-uk Kim	s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
1748db522d3aSSimon L. B. Nielsen	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1749db522d3aSSimon L. B. Nielsen	s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1750db522d3aSSimon L. B. Nielsen	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
17511f13597dSJung-uk Kim
1752ddd58736SKris Kennaway	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
17535740a5e3SKris Kennaway	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
17541f13597dSJung-uk Kim	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
1755a21b1b38SKris Kennaway	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
1756a21b1b38SKris Kennaway		{
1757a21b1b38SKris Kennaway		my $sotmp = $1;
17584f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
17594f20a5a2SJacques Vidrine		}
17604f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
17614f20a5a2SJacques Vidrine		{
17624f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1763a21b1b38SKris Kennaway		}
1764a21b1b38SKris Kennaway	elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
1765a21b1b38SKris Kennaway		{
1766a21b1b38SKris Kennaway		my $sotmp = $1;
1767a21b1b38SKris Kennaway		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
1768a21b1b38SKris Kennaway		}
17694f20a5a2SJacques Vidrine	elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
17704f20a5a2SJacques Vidrine		{
17714f20a5a2SJacques Vidrine		s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
17724f20a5a2SJacques Vidrine		}
1773c1803d78SJacques Vidrine	s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
177474664626SKris Kennaway	print OUT $_."\n";
177574664626SKris Kennaway	}
177674664626SKris Kennawayclose(IN);
177774664626SKris Kennawayclose(OUT);
17785c87c606SMark Murrayrename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
17795c87c606SMark Murrayrename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
178074664626SKris Kennaway
178174664626SKris Kennawayprint "CC            =$cc\n";
178274664626SKris Kennawayprint "CFLAG         =$cflags\n";
178374664626SKris Kennawayprint "EX_LIBS       =$lflags\n";
17843b4e3dcbSSimon L. B. Nielsenprint "CPUID_OBJ     =$cpuid_obj\n";
178574664626SKris Kennawayprint "BN_ASM        =$bn_obj\n";
1786*7bded2dbSJung-uk Kimprint "EC_ASM        =$ec_obj\n";
178774664626SKris Kennawayprint "DES_ENC       =$des_obj\n";
17881f13597dSJung-uk Kimprint "AES_ENC       =$aes_obj\n";
178974664626SKris Kennawayprint "BF_ENC        =$bf_obj\n";
179074664626SKris Kennawayprint "CAST_ENC      =$cast_obj\n";
179174664626SKris Kennawayprint "RC4_ENC       =$rc4_obj\n";
179274664626SKris Kennawayprint "RC5_ENC       =$rc5_obj\n";
179374664626SKris Kennawayprint "MD5_OBJ_ASM   =$md5_obj\n";
179474664626SKris Kennawayprint "SHA1_OBJ_ASM  =$sha1_obj\n";
179574664626SKris Kennawayprint "RMD160_OBJ_ASM=$rmd160_obj\n";
17961f13597dSJung-uk Kimprint "CMLL_ENC      =$cmll_obj\n";
17971f13597dSJung-uk Kimprint "MODES_OBJ     =$modes_obj\n";
17981f13597dSJung-uk Kimprint "ENGINES_OBJ   =$engines_obj\n";
179974664626SKris Kennawayprint "PROCESSOR     =$processor\n";
180074664626SKris Kennawayprint "RANLIB        =$ranlib\n";
18015c87c606SMark Murrayprint "ARFLAGS       =$arflags\n";
180274664626SKris Kennawayprint "PERL          =$perl\n";
18035c87c606SMark Murrayprint "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
18045c87c606SMark Murray	if $withargs{"krb5-include"} ne "";
180574664626SKris Kennaway
180674664626SKris Kennawaymy $des_ptr=0;
180774664626SKris Kennawaymy $des_risc1=0;
180874664626SKris Kennawaymy $des_risc2=0;
180974664626SKris Kennawaymy $des_unroll=0;
181074664626SKris Kennawaymy $bn_ll=0;
181174664626SKris Kennawaymy $def_int=2;
181274664626SKris Kennawaymy $rc4_int=$def_int;
181374664626SKris Kennawaymy $md2_int=$def_int;
181474664626SKris Kennawaymy $idea_int=$def_int;
181574664626SKris Kennawaymy $rc2_int=$def_int;
181674664626SKris Kennawaymy $rc4_idx=0;
1817f579bf8eSKris Kennawaymy $rc4_chunk=0;
181874664626SKris Kennawaymy $bf_ptr=0;
181974664626SKris Kennawaymy @type=("char","short","int","long");
182074664626SKris Kennawaymy ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
18215c87c606SMark Murraymy $export_var_as_fn=0;
182274664626SKris Kennaway
182374664626SKris Kennawaymy $des_int;
182474664626SKris Kennaway
182574664626SKris Kennawayforeach (sort split(/\s+/,$bn_ops))
182674664626SKris Kennaway	{
182774664626SKris Kennaway	$des_ptr=1 if /DES_PTR/;
182874664626SKris Kennaway	$des_risc1=1 if /DES_RISC1/;
182974664626SKris Kennaway	$des_risc2=1 if /DES_RISC2/;
183074664626SKris Kennaway	$des_unroll=1 if /DES_UNROLL/;
183174664626SKris Kennaway	$des_int=1 if /DES_INT/;
183274664626SKris Kennaway	$bn_ll=1 if /BN_LLONG/;
183374664626SKris Kennaway	$rc4_int=0 if /RC4_CHAR/;
183474664626SKris Kennaway	$rc4_int=3 if /RC4_LONG/;
183574664626SKris Kennaway	$rc4_idx=1 if /RC4_INDEX/;
1836f579bf8eSKris Kennaway	$rc4_chunk=1 if /RC4_CHUNK/;
1837f579bf8eSKris Kennaway	$rc4_chunk=2 if /RC4_CHUNK_LL/;
183874664626SKris Kennaway	$md2_int=0 if /MD2_CHAR/;
183974664626SKris Kennaway	$md2_int=3 if /MD2_LONG/;
184074664626SKris Kennaway	$idea_int=1 if /IDEA_SHORT/;
184174664626SKris Kennaway	$idea_int=3 if /IDEA_LONG/;
184274664626SKris Kennaway	$rc2_int=1 if /RC2_SHORT/;
184374664626SKris Kennaway	$rc2_int=3 if /RC2_LONG/;
184474664626SKris Kennaway	$bf_ptr=1 if $_ eq "BF_PTR";
184574664626SKris Kennaway	$bf_ptr=2 if $_ eq "BF_PTR2";
184674664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
184774664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
184874664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
184974664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
185074664626SKris Kennaway	($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
18515c87c606SMark Murray	$export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
185274664626SKris Kennaway	}
185374664626SKris Kennaway
185474664626SKris Kennawayopen(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
18555c87c606SMark Murrayunlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
18565c87c606SMark Murrayopen(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
1857f579bf8eSKris Kennawayprint OUT "/* opensslconf.h */\n";
1858f579bf8eSKris Kennawayprint OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
1859f579bf8eSKris Kennaway
1860fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
1861fa5fddf1SJung-uk Kimprint OUT "extern \"C\" {\n";
1862fa5fddf1SJung-uk Kimprint OUT "#endif\n";
1863f579bf8eSKris Kennawayprint OUT "/* OpenSSL was configured with the following options: */\n";
18645c87c606SMark Murraymy $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1865db522d3aSSimon 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;
18665c87c606SMark Murray$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1867f579bf8eSKris Kennaway$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1868f579bf8eSKris Kennaway$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1869f579bf8eSKris Kennaway$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
18705c87c606SMark Murray$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1871f579bf8eSKris Kennaway$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
18725c87c606SMark Murrayprint OUT $openssl_sys_defines;
18735c87c606SMark Murrayprint OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1874db522d3aSSimon L. B. Nielsenprint OUT $openssl_experimental_defines;
1875db522d3aSSimon L. B. Nielsenprint OUT "\n";
18765c87c606SMark Murrayprint OUT $openssl_algorithm_defines;
1877db522d3aSSimon L. B. Nielsenprint OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
18785c87c606SMark Murrayprint OUT $openssl_thread_defines;
18795c87c606SMark Murrayprint OUT $openssl_other_defines,"\n";
18805c87c606SMark Murray
18815c87c606SMark Murrayprint OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
18825c87c606SMark Murrayprint OUT "   asks for it.  This is a transient feature that is provided for those\n";
18835c87c606SMark Murrayprint OUT "   who haven't had the time to do the appropriate changes in their\n";
18845c87c606SMark Murrayprint OUT "   applications.  */\n";
18855c87c606SMark Murrayprint OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
18865c87c606SMark Murrayprint OUT $openssl_algorithm_defines_trans;
18875c87c606SMark Murrayprint OUT "#endif\n\n";
1888f579bf8eSKris Kennaway
18891f13597dSJung-uk Kimprint OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
18903b4e3dcbSSimon L. B. Nielsen
189174664626SKris Kennawaywhile (<IN>)
189274664626SKris Kennaway	{
189374664626SKris Kennaway	if	(/^#define\s+OPENSSLDIR/)
18946a599222SSimon L. B. Nielsen		{
18956a599222SSimon L. B. Nielsen		my $foo = $openssldir;
18966a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
18976a599222SSimon L. B. Nielsen		print OUT "#define OPENSSLDIR \"$foo\"\n";
18986a599222SSimon L. B. Nielsen		}
18993b4e3dcbSSimon L. B. Nielsen	elsif	(/^#define\s+ENGINESDIR/)
19006a599222SSimon L. B. Nielsen		{
19011f13597dSJung-uk Kim		my $foo = "$prefix/$libdir/engines";
19026a599222SSimon L. B. Nielsen		$foo =~ s/\\/\\\\/g;
19036a599222SSimon L. B. Nielsen		print OUT "#define ENGINESDIR \"$foo\"\n";
19046a599222SSimon L. B. Nielsen		}
19055c87c606SMark Murray	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
19065c87c606SMark Murray		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
19075c87c606SMark Murray			if $export_var_as_fn;
19085c87c606SMark Murray		  printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
19095c87c606SMark Murray			($export_var_as_fn)?"define":"undef"; }
191074664626SKris Kennaway	elsif	(/^#define\s+OPENSSL_UNISTD/)
191174664626SKris Kennaway		{
191274664626SKris Kennaway		$unistd = "<unistd.h>" if $unistd eq "";
191374664626SKris Kennaway		print OUT "#define OPENSSL_UNISTD $unistd\n";
191474664626SKris Kennaway		}
191574664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
191674664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
191774664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
191874664626SKris Kennaway		{ printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
191974664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
192074664626SKris Kennaway		{ printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
192174664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+SIXTEEN_BIT/)
192274664626SKris Kennaway		{ printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
192374664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+EIGHT_BIT/)
192474664626SKris Kennaway		{ printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
192574664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+BN_LLONG\s*$/)
192674664626SKris Kennaway		{ printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
192774664626SKris Kennaway	elsif	(/^\#define\s+DES_LONG\s+.*/)
192874664626SKris Kennaway		{ printf OUT "#define DES_LONG unsigned %s\n",
192974664626SKris Kennaway			($des_int)?'int':'long'; }
193074664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_PTR/)
193174664626SKris Kennaway		{ printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
193274664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC1/)
193374664626SKris Kennaway		{ printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
193474664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_RISC2/)
193574664626SKris Kennaway		{ printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
193674664626SKris Kennaway	elsif	(/^\#(define|undef)\s+DES_UNROLL/)
193774664626SKris Kennaway		{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
193874664626SKris Kennaway	elsif	(/^#define\s+RC4_INT\s/)
193974664626SKris Kennaway		{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
1940f579bf8eSKris Kennaway	elsif	(/^#undef\s+RC4_CHUNK/)
1941f579bf8eSKris Kennaway		{
1942f579bf8eSKris Kennaway		printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
1943f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
1944f579bf8eSKris Kennaway		printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
1945f579bf8eSKris Kennaway		}
194674664626SKris Kennaway	elsif	(/^#((define)|(undef))\s+RC4_INDEX/)
194774664626SKris Kennaway		{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
194874664626SKris Kennaway	elsif (/^#(define|undef)\s+I386_ONLY/)
19493b4e3dcbSSimon L. B. Nielsen		{ printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
195074664626SKris Kennaway			"define":"undef"; }
195174664626SKris Kennaway	elsif	(/^#define\s+MD2_INT\s/)
195274664626SKris Kennaway		{ printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
195374664626SKris Kennaway	elsif	(/^#define\s+IDEA_INT\s/)
195474664626SKris Kennaway		{printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
195574664626SKris Kennaway	elsif	(/^#define\s+RC2_INT\s/)
195674664626SKris Kennaway		{printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
195774664626SKris Kennaway	elsif (/^#(define|undef)\s+BF_PTR/)
195874664626SKris Kennaway		{
195974664626SKris Kennaway		printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
196074664626SKris Kennaway		printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
196174664626SKris Kennaway		printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
196274664626SKris Kennaway	        }
196374664626SKris Kennaway	else
196474664626SKris Kennaway		{ print OUT $_; }
196574664626SKris Kennaway	}
196674664626SKris Kennawayclose(IN);
1967fa5fddf1SJung-uk Kimprint OUT "#ifdef  __cplusplus\n";
1968fa5fddf1SJung-uk Kimprint OUT "}\n";
1969fa5fddf1SJung-uk Kimprint OUT "#endif\n";
197074664626SKris Kennawayclose(OUT);
19715c87c606SMark Murrayrename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
19725c87c606SMark Murrayrename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
197374664626SKris Kennaway
197474664626SKris Kennaway
197574664626SKris Kennaway# Fix the date
197674664626SKris Kennaway
197774664626SKris Kennawayprint "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
197874664626SKris Kennawayprint "SIXTY_FOUR_BIT mode\n" if $b64;
197974664626SKris Kennawayprint "THIRTY_TWO_BIT mode\n" if $b32;
198074664626SKris Kennawayprint "SIXTEEN_BIT mode\n" if $b16;
198174664626SKris Kennawayprint "EIGHT_BIT mode\n" if $b8;
198274664626SKris Kennawayprint "DES_PTR used\n" if $des_ptr;
198374664626SKris Kennawayprint "DES_RISC1 used\n" if $des_risc1;
198474664626SKris Kennawayprint "DES_RISC2 used\n" if $des_risc2;
198574664626SKris Kennawayprint "DES_UNROLL used\n" if $des_unroll;
198674664626SKris Kennawayprint "DES_INT used\n" if $des_int;
198774664626SKris Kennawayprint "BN_LLONG mode\n" if $bn_ll;
198874664626SKris Kennawayprint "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
198974664626SKris Kennawayprint "RC4_INDEX mode\n" if $rc4_idx;
1990f579bf8eSKris Kennawayprint "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
1991f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
1992f579bf8eSKris Kennawayprint "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
199374664626SKris Kennawayprint "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
199474664626SKris Kennawayprint "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
199574664626SKris Kennawayprint "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
199674664626SKris Kennawayprint "BF_PTR used\n" if $bf_ptr == 1;
199774664626SKris Kennawayprint "BF_PTR2 used\n" if $bf_ptr == 2;
199874664626SKris Kennaway
19993b4e3dcbSSimon L. B. Nielsenif($IsMK1MF) {
200074664626SKris Kennaway	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
200174664626SKris Kennaway	printf OUT <<EOF;
200274664626SKris Kennaway#ifndef MK1MF_BUILD
200374664626SKris Kennaway  /* auto-generated by Configure for crypto/cversion.c:
20043b4e3dcbSSimon L. B. Nielsen   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
200574664626SKris Kennaway   * Windows builds (and other mk1mf builds) compile cversion.c with
200674664626SKris Kennaway   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
200774664626SKris Kennaway  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
200874664626SKris Kennaway#endif
200974664626SKris KennawayEOF
201074664626SKris Kennaway	close(OUT);
201174664626SKris Kennaway} else {
20126a599222SSimon L. B. Nielsen	my $make_command = "$make PERL=\'$perl\'";
20135c87c606SMark Murray	my $make_targets = "";
20145c87c606SMark Murray	$make_targets .= " links" if $symlink;
20153b4e3dcbSSimon L. B. Nielsen	$make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
20165c87c606SMark Murray	$make_targets .= " gentests" if $symlink;
20175c87c606SMark Murray	(system $make_command.$make_targets) == 0 or exit $?
20185c87c606SMark Murray		if $make_targets ne "";
201974664626SKris Kennaway	if ( $perl =~ m@^/@) {
2020a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
2021f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
202274664626SKris Kennaway	} else {
202374664626SKris Kennaway	    # No path for Perl known ...
2024a3ddd25aSSimon L. B. Nielsen	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
2025f579bf8eSKris Kennaway	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
202674664626SKris Kennaway	}
20273b4e3dcbSSimon L. B. Nielsen	if ($depflags ne $default_depflags && !$make_depend) {
20285c87c606SMark Murray		print <<EOF;
20295c87c606SMark Murray
20303b4e3dcbSSimon L. B. NielsenSince you've disabled or enabled at least one algorithm, you need to do
20313b4e3dcbSSimon L. B. Nielsenthe following before building:
20325c87c606SMark Murray
20335c87c606SMark Murray	make depend
20345c87c606SMark MurrayEOF
20355c87c606SMark Murray	}
203674664626SKris Kennaway}
203774664626SKris Kennaway
20383b4e3dcbSSimon L. B. Nielsen# create the ms/version32.rc file if needed
2039db522d3aSSimon L. B. Nielsenif ($IsMK1MF && ($target !~ /^netware/)) {
20403b4e3dcbSSimon L. B. Nielsen	my ($v1, $v2, $v3, $v4);
20413b4e3dcbSSimon L. B. Nielsen	if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
20423b4e3dcbSSimon L. B. Nielsen		$v1=hex $1;
20433b4e3dcbSSimon L. B. Nielsen		$v2=hex $2;
20443b4e3dcbSSimon L. B. Nielsen		$v3=hex $3;
20453b4e3dcbSSimon L. B. Nielsen		$v4=hex $4;
20463b4e3dcbSSimon L. B. Nielsen	}
20473b4e3dcbSSimon L. B. Nielsen	open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
20483b4e3dcbSSimon L. B. Nielsen	print OUT <<EOF;
20493b4e3dcbSSimon L. B. Nielsen#include <winver.h>
20503b4e3dcbSSimon L. B. Nielsen
20513b4e3dcbSSimon L. B. NielsenLANGUAGE 0x09,0x01
20523b4e3dcbSSimon L. B. Nielsen
20533b4e3dcbSSimon L. B. Nielsen1 VERSIONINFO
20543b4e3dcbSSimon L. B. Nielsen  FILEVERSION $v1,$v2,$v3,$v4
20553b4e3dcbSSimon L. B. Nielsen  PRODUCTVERSION $v1,$v2,$v3,$v4
20563b4e3dcbSSimon L. B. Nielsen  FILEFLAGSMASK 0x3fL
20573b4e3dcbSSimon L. B. Nielsen#ifdef _DEBUG
20583b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x01L
20593b4e3dcbSSimon L. B. Nielsen#else
20603b4e3dcbSSimon L. B. Nielsen  FILEFLAGS 0x00L
20613b4e3dcbSSimon L. B. Nielsen#endif
20623b4e3dcbSSimon L. B. Nielsen  FILEOS VOS__WINDOWS32
20633b4e3dcbSSimon L. B. Nielsen  FILETYPE VFT_DLL
20643b4e3dcbSSimon L. B. Nielsen  FILESUBTYPE 0x0L
20653b4e3dcbSSimon L. B. NielsenBEGIN
20663b4e3dcbSSimon L. B. Nielsen    BLOCK "StringFileInfo"
20673b4e3dcbSSimon L. B. Nielsen    BEGIN
20683b4e3dcbSSimon L. B. Nielsen	BLOCK "040904b0"
20693b4e3dcbSSimon L. B. Nielsen	BEGIN
20703b4e3dcbSSimon L. B. Nielsen	    // Required:
20713b4e3dcbSSimon L. B. Nielsen	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
20723b4e3dcbSSimon L. B. Nielsen	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
20733b4e3dcbSSimon L. B. Nielsen	    VALUE "FileVersion", "$version\\0"
20743b4e3dcbSSimon L. B. Nielsen#if defined(CRYPTO)
20753b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "libeay32\\0"
20763b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "libeay32.dll\\0"
20773b4e3dcbSSimon L. B. Nielsen#elif defined(SSL)
20783b4e3dcbSSimon L. B. Nielsen	    VALUE "InternalName", "ssleay32\\0"
20793b4e3dcbSSimon L. B. Nielsen	    VALUE "OriginalFilename", "ssleay32.dll\\0"
20803b4e3dcbSSimon L. B. Nielsen#endif
20813b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
20823b4e3dcbSSimon L. B. Nielsen	    VALUE "ProductVersion", "$version\\0"
20833b4e3dcbSSimon L. B. Nielsen	    // Optional:
20843b4e3dcbSSimon L. B. Nielsen	    //VALUE "Comments", "\\0"
20851f13597dSJung-uk Kim	    VALUE "LegalCopyright", "Copyright  � 1998-2005 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
20863b4e3dcbSSimon L. B. Nielsen	    //VALUE "LegalTrademarks", "\\0"
20873b4e3dcbSSimon L. B. Nielsen	    //VALUE "PrivateBuild", "\\0"
20883b4e3dcbSSimon L. B. Nielsen	    //VALUE "SpecialBuild", "\\0"
20893b4e3dcbSSimon L. B. Nielsen	END
20903b4e3dcbSSimon L. B. Nielsen    END
20913b4e3dcbSSimon L. B. Nielsen    BLOCK "VarFileInfo"
20923b4e3dcbSSimon L. B. Nielsen    BEGIN
20933b4e3dcbSSimon L. B. Nielsen        VALUE "Translation", 0x409, 0x4b0
20943b4e3dcbSSimon L. B. Nielsen    END
20953b4e3dcbSSimon L. B. NielsenEND
20963b4e3dcbSSimon L. B. NielsenEOF
20973b4e3dcbSSimon L. B. Nielsen	close(OUT);
20983b4e3dcbSSimon L. B. Nielsen  }
20993b4e3dcbSSimon L. B. Nielsen
210074664626SKris Kennawayprint <<EOF;
210174664626SKris Kennaway
2102f579bf8eSKris KennawayConfigured for $target.
210374664626SKris KennawayEOF
210474664626SKris Kennaway
210574664626SKris Kennawayprint <<\EOF if (!$no_threads && !$threads);
210674664626SKris Kennaway
210774664626SKris KennawayThe library could not be configured for supporting multi-threaded
210874664626SKris Kennawayapplications as the compiler options required on this system are not known.
210974664626SKris KennawaySee file INSTALL for details if you need multi-threading.
211074664626SKris KennawayEOF
211174664626SKris Kennaway
2112fceca8a3SJacques Vidrineprint <<\EOF if ($no_shared_warn);
2113fceca8a3SJacques Vidrine
2114fceca8a3SJacques VidrineYou gave the option 'shared'.  Normally, that would give you shared libraries.
2115fceca8a3SJacques VidrineUnfortunately, the OpenSSL configuration doesn't include shared library support
2116fceca8a3SJacques Vidrinefor this platform yet, so it will pretend you gave the option 'no-shared'.  If
2117fceca8a3SJacques Vidrineyou can inform the developpers (openssl-dev\@openssl.org) how to support shared
2118fceca8a3SJacques Vidrinelibraries on this platform, they will at least look at it and try their best
2119fceca8a3SJacques Vidrine(but please first make sure you have tried with a current version of OpenSSL).
2120fceca8a3SJacques VidrineEOF
2121fceca8a3SJacques Vidrine
212274664626SKris Kennawayexit(0);
212374664626SKris Kennaway
212474664626SKris Kennawaysub usage
212574664626SKris Kennaway	{
212674664626SKris Kennaway	print STDERR $usage;
2127f579bf8eSKris Kennaway	print STDERR "\npick os/compiler from:\n";
212874664626SKris Kennaway	my $j=0;
212974664626SKris Kennaway	my $i;
2130f579bf8eSKris Kennaway        my $k=0;
213174664626SKris Kennaway	foreach $i (sort keys %table)
213274664626SKris Kennaway		{
213374664626SKris Kennaway		next if $i =~ /^debug/;
2134f579bf8eSKris Kennaway		$k += length($i) + 1;
2135f579bf8eSKris Kennaway		if ($k > 78)
2136f579bf8eSKris Kennaway			{
2137f579bf8eSKris Kennaway			print STDERR "\n";
2138f579bf8eSKris Kennaway			$k=length($i);
2139f579bf8eSKris Kennaway			}
2140f579bf8eSKris Kennaway		print STDERR $i . " ";
214174664626SKris Kennaway		}
214274664626SKris Kennaway	foreach $i (sort keys %table)
214374664626SKris Kennaway		{
214474664626SKris Kennaway		next if $i !~ /^debug/;
2145f579bf8eSKris Kennaway		$k += length($i) + 1;
2146f579bf8eSKris Kennaway		if ($k > 78)
2147f579bf8eSKris Kennaway			{
214874664626SKris Kennaway			print STDERR "\n";
2149f579bf8eSKris Kennaway			$k=length($i);
2150f579bf8eSKris Kennaway			}
2151f579bf8eSKris Kennaway		print STDERR $i . " ";
2152f579bf8eSKris Kennaway		}
2153f579bf8eSKris Kennaway	print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
215474664626SKris Kennaway	exit(1);
215574664626SKris Kennaway	}
215674664626SKris Kennaway
215774664626SKris Kennawaysub which
215874664626SKris Kennaway	{
215974664626SKris Kennaway	my($name)=@_;
216074664626SKris Kennaway	my $path;
216174664626SKris Kennaway	foreach $path (split /:/, $ENV{PATH})
216274664626SKris Kennaway		{
21636be8ae07SJacques Vidrine		if (-f "$path/$name$exe_ext" and -x _)
216474664626SKris Kennaway			{
21656be8ae07SJacques Vidrine			return "$path/$name$exe_ext" unless ($name eq "perl" and
21666be8ae07SJacques Vidrine			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
216774664626SKris Kennaway			}
216874664626SKris Kennaway		}
216974664626SKris Kennaway	}
217074664626SKris Kennaway
217174664626SKris Kennawaysub dofile
217274664626SKris Kennaway	{
217374664626SKris Kennaway	my $f; my $p; my %m; my @a; my $k; my $ff;
217474664626SKris Kennaway	($f,$p,%m)=@_;
217574664626SKris Kennaway
217674664626SKris Kennaway	open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
217774664626SKris Kennaway	@a=<IN>;
217874664626SKris Kennaway	close(IN);
217974664626SKris Kennaway	foreach $k (keys %m)
218074664626SKris Kennaway		{
218174664626SKris Kennaway		grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
218274664626SKris Kennaway		}
2183f579bf8eSKris Kennaway	open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
218474664626SKris Kennaway	print OUT @a;
218574664626SKris Kennaway	close(OUT);
2186f579bf8eSKris Kennaway	rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
2187f579bf8eSKris Kennaway	rename("$f.new",$f) || die "unable to rename $f.new\n";
218874664626SKris Kennaway	}
218974664626SKris Kennaway
219074664626SKris Kennawaysub print_table_entry
219174664626SKris Kennaway	{
219274664626SKris Kennaway	my $target = shift;
219374664626SKris Kennaway
2194*7bded2dbSJung-uk Kim	my ($cc, $cflags, $unistd, $thread_cflag, $sys_id, $lflags,
2195*7bded2dbSJung-uk Kim	    $bn_ops, $cpuid_obj, $bn_obj, $ec_obj, $des_obj, $aes_obj, $bf_obj,
2196*7bded2dbSJung-uk Kim	    $md5_obj, $sha1_obj, $cast_obj, $rc4_obj, $rmd160_obj,
2197*7bded2dbSJung-uk Kim	    $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj,
2198*7bded2dbSJung-uk Kim	    $perlasm_scheme, $dso_scheme, $shared_target, $shared_cflag,
2199*7bded2dbSJung-uk Kim	    $shared_ldflag, $shared_extension, $ranlib, $arflags, $multilib)=
22005740a5e3SKris Kennaway	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
220174664626SKris Kennaway
220274664626SKris Kennaway	print <<EOF
220374664626SKris Kennaway
220474664626SKris Kennaway*** $target
220574664626SKris Kennaway\$cc           = $cc
220674664626SKris Kennaway\$cflags       = $cflags
220774664626SKris Kennaway\$unistd       = $unistd
220874664626SKris Kennaway\$thread_cflag = $thread_cflag
22095c87c606SMark Murray\$sys_id       = $sys_id
221074664626SKris Kennaway\$lflags       = $lflags
221174664626SKris Kennaway\$bn_ops       = $bn_ops
22123b4e3dcbSSimon L. B. Nielsen\$cpuid_obj    = $cpuid_obj
221374664626SKris Kennaway\$bn_obj       = $bn_obj
2214*7bded2dbSJung-uk Kim\$ec_obj       = $ec_obj
221574664626SKris Kennaway\$des_obj      = $des_obj
22163b4e3dcbSSimon L. B. Nielsen\$aes_obj      = $aes_obj
221774664626SKris Kennaway\$bf_obj       = $bf_obj
221874664626SKris Kennaway\$md5_obj      = $md5_obj
221974664626SKris Kennaway\$sha1_obj     = $sha1_obj
222074664626SKris Kennaway\$cast_obj     = $cast_obj
222174664626SKris Kennaway\$rc4_obj      = $rc4_obj
222274664626SKris Kennaway\$rmd160_obj   = $rmd160_obj
222374664626SKris Kennaway\$rc5_obj      = $rc5_obj
22241f13597dSJung-uk Kim\$wp_obj       = $wp_obj
22251f13597dSJung-uk Kim\$cmll_obj     = $cmll_obj
22261f13597dSJung-uk Kim\$modes_obj    = $modes_obj
22271f13597dSJung-uk Kim\$engines_obj  = $engines_obj
22281f13597dSJung-uk Kim\$perlasm_scheme = $perlasm_scheme
2229ddd58736SKris Kennaway\$dso_scheme   = $dso_scheme
2230ddd58736SKris Kennaway\$shared_target= $shared_target
2231ddd58736SKris Kennaway\$shared_cflag = $shared_cflag
2232c1803d78SJacques Vidrine\$shared_ldflag = $shared_ldflag
22335740a5e3SKris Kennaway\$shared_extension = $shared_extension
22345740a5e3SKris Kennaway\$ranlib       = $ranlib
22355c87c606SMark Murray\$arflags      = $arflags
22361f13597dSJung-uk Kim\$multilib     = $multilib
223774664626SKris KennawayEOF
223874664626SKris Kennaway	}
2239c1803d78SJacques Vidrine
2240c1803d78SJacques Vidrinesub test_sanity
2241c1803d78SJacques Vidrine	{
2242c1803d78SJacques Vidrine	my $errorcnt = 0;
2243c1803d78SJacques Vidrine
2244c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2245c1803d78SJacques Vidrine	print STDERR "=== SANITY TESTING!\n";
2246c1803d78SJacques Vidrine	print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2247c1803d78SJacques Vidrine	print STDERR "=" x 70, "\n";
2248c1803d78SJacques Vidrine
2249c1803d78SJacques Vidrine	foreach $target (sort keys %table)
2250c1803d78SJacques Vidrine		{
2251c1803d78SJacques Vidrine		@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2252c1803d78SJacques Vidrine
22531f13597dSJung-uk Kim		if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2254c1803d78SJacques Vidrine			{
2255c1803d78SJacques Vidrine			$errorcnt++;
2256c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2257c1803d78SJacques Vidrine			print STDERR "              in the previous field\n";
2258c1803d78SJacques Vidrine			}
22591f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
2260c1803d78SJacques Vidrine			{
2261c1803d78SJacques Vidrine			$errorcnt++;
2262c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2263c1803d78SJacques Vidrine			print STDERR "              in the following field\n";
2264c1803d78SJacques Vidrine			}
22651f13597dSJung-uk Kim		elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
2266c1803d78SJacques Vidrine			{
2267c1803d78SJacques Vidrine			$errorcnt++;
2268c1803d78SJacques Vidrine			print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
22691f13597dSJung-uk Kim			print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
2270c1803d78SJacques Vidrine			}
2271c1803d78SJacques Vidrine		}
2272c1803d78SJacques Vidrine	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2273c1803d78SJacques Vidrine	return $errorcnt;
2274c1803d78SJacques Vidrine	}
2275