Configure 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. :
  2. eval 'exec perl -S $0 ${1+"$@"}'
  3. if $running_under_some_shell;
  4. ##
  5. ## Configure -- OpenSSL source tree configuration script
  6. ##
  7. require 5.000;
  8. use strict;
  9. # see INSTALL for instructions.
  10. my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
  11. # Options:
  12. #
  13. # --openssldir install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
  14. # --prefix option is given; /usr/local/ssl otherwise)
  15. # --prefix prefix for the OpenSSL include, lib and bin directories
  16. # (Default: the OPENSSLDIR directory)
  17. #
  18. # --install_prefix Additional prefix for package builders (empty by
  19. # default). This needn't be set in advance, you can
  20. # just as well use "make INSTALL_PREFIX=/whatever install".
  21. #
  22. # rsaref use RSAref
  23. # [no-]threads [don't] try to create a library that is suitable for
  24. # multithreaded applications (default is "threads" if we
  25. # know how to do it)
  26. # no-asm do not use assembler
  27. # 386 generate 80386 code
  28. # no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
  29. # -<xxx> +<xxx> compiler options are passed through
  30. #
  31. # DES_PTR use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
  32. # DES_RISC1 use different DES_ENCRYPT macro that helps reduce register
  33. # dependancies but needs to more registers, good for RISC CPU's
  34. # DES_RISC2 A different RISC variant.
  35. # DES_UNROLL unroll the inner DES loop, sometimes helps, somtimes hinders.
  36. # DES_INT use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
  37. # This is used on the DEC Alpha where long is 8 bytes
  38. # and int is 4
  39. # BN_LLONG use the type 'long long' in crypto/bn/bn.h
  40. # MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
  41. # MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
  42. # IDEA_SHORT use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
  43. # IDEA_LONG use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
  44. # RC2_SHORT use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
  45. # RC2_LONG use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
  46. # RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
  47. # RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
  48. # RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on
  49. # array lookups instead of pointer use.
  50. # RC4_CHUNK enables code that handles data aligned at long (natural CPU
  51. # word) boundary.
  52. # RC4_CHUNK_LL enables code that handles data aligned at long long boundary
  53. # (intended for 64-bit CPUs running 32-bit OS).
  54. # BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
  55. # BF_PTR2 intel specific version (generic version is more efficient).
  56. # MD5_ASM use some extra md5 assember,
  57. # SHA1_ASM use some extra sha1 assember, must define L_ENDIAN for x86
  58. # RMD160_ASM use some extra ripemd160 assember,
  59. my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
  60. # MD2_CHAR slags pentium pros
  61. my $x86_gcc_opts="RC4_INDEX MD2_INT";
  62. # MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
  63. # Don't worry about these normally
  64. my $tcc="cc";
  65. my $tflags="-fast -Xa";
  66. my $tbn_mul="";
  67. my $tlib="-lnsl -lsocket";
  68. #$bits1="SIXTEEN_BIT ";
  69. #$bits2="THIRTY_TWO_BIT ";
  70. my $bits1="THIRTY_TWO_BIT ";
  71. my $bits2="SIXTY_FOUR_BIT ";
  72. my $x86_sol_asm="asm/bn86-sol.o asm/co86-sol.o:asm/dx86-sol.o asm/yx86-sol.o:asm/bx86-sol.o:asm/mx86-sol.o:asm/sx86-sol.o:asm/cx86-sol.o:asm/rx86-sol.o:asm/rm86-sol.o:asm/r586-sol.o";
  73. my $x86_elf_asm="asm/bn86-elf.o asm/co86-elf.o:asm/dx86-elf.o asm/yx86-elf.o:asm/bx86-elf.o:asm/mx86-elf.o:asm/sx86-elf.o:asm/cx86-elf.o:asm/rx86-elf.o:asm/rm86-elf.o:asm/r586-elf.o";
  74. my $x86_out_asm="asm/bn86-out.o asm/co86-out.o:asm/dx86-out.o asm/yx86-out.o:asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
  75. my $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/bx86bsdi.o:asm/mx86bsdi.o:asm/sx86bsdi.o:asm/cx86bsdi.o:asm/rx86bsdi.o:asm/rm86bsdi.o:asm/r586bsdi.o";
  76. # -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
  77. # So the md5_locl.h file has an undef B_ENDIAN if sun is defined
  78. #config-string $cc : $cflags : $unistd : $thread_cflag : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj
  79. my %table=(
  80. #"b", "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
  81. #"bl-4c-2c", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
  82. #"bl-4c-ri", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
  83. #"b2-is-ri-dp", "${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
  84. # Our development configs
  85. "purify", "purify gcc:-g -DPURIFY -Wall::(unknown):-lsocket -lnsl::::",
  86. "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown):-lefence::::",
  87. "debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
  88. "debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
  89. "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown):::::",
  90. "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  91. "debug-bodo", "gcc:-DBIO_PAIR_DEBUG -DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  92. "debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  93. "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -O2 -m486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  94. "debug-levitte-linux-elf","gcc:-DUSE_ALLOCATING_PRINT -DRL_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DNO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -pipe::-D_REENTRANT:::",
  95. "dist", "cc:-O::(unknown):::::",
  96. # Basic configs that should work on any (32 and less bit) box
  97. "gcc", "gcc:-O3::(unknown)::BN_LLONG:::",
  98. "cc", "cc:-O::(unknown):::::",
  99. #### Solaris x86 setups
  100. # -DNO_INLINE_ASM switches off inline assembler. We have to do it
  101. # here because whenever GNU C instantiates an assembler template it
  102. # surrounds it with #APP #NO_APP comment pair which (at least Solaris
  103. # 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
  104. # error message.
  105. "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DNO_INLINE_ASM::-D_REENTRANT:-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}",
  106. #### SPARC Solaris with GNU C setups
  107. "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
  108. "solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::",
  109. "solaris-sparcv9-gcc","gcc:-mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
  110. # gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
  111. # but keep the assembler modules.
  112. "solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o:",
  113. ####
  114. "debug-solaris-sparcv8-gcc","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::",
  115. "debug-solaris-sparcv9-gcc","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o::",
  116. #### SPARC Solaris with Sun C setups
  117. # DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
  118. "solaris-sparc-sc3","cc:-fast -O -Xa -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:::",
  119. # SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
  120. # SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
  121. # SC5.0 note: Compiler common patch 107357-01 or later is required!
  122. "solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
  123. "solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
  124. "solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
  125. "solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
  126. ####
  127. "debug-solaris-sparcv8-cc","cc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
  128. "debug-solaris-sparcv9-cc","cc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
  129. #### SPARC Linux setups
  130. "linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::",
  131. # Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
  132. # assisted with debugging of following two configs.
  133. "linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::::",
  134. # it's a real mess with -mcpu=ultrasparc option under Linux, but
  135. # -Wa,-Av8plus should do the trick no matter what.
  136. "linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
  137. # !!!Folowing can't be even tested yet!!!
  138. # We have to wait till 64-bit glibc for SPARC is operational!!!
  139. #"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
  140. # Sunos configs, assuming sparc for the gcc one.
  141. ##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown)::DES_UNROLL:::",
  142. "sunos-gcc","gcc:-O3 -mv8::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
  143. #### IRIX 5.x configs
  144. # -mips2 flag is added by ./config when appropriate.
  145. "irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::",
  146. "irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:::",
  147. #### IRIX 6.x configs
  148. # Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
  149. # './Configure irix-[g]cc' manually.
  150. # -mips4 flag is added by ./config when appropriate.
  151. "irix-mips3-gcc","gcc:-mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
  152. "irix-mips3-cc", "cc:-n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
  153. # N64 ABI builds.
  154. "irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
  155. "irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
  156. #### Unified HP-UX ANSI C configs.
  157. # Special notes:
  158. # - Originally we were optimizing at +O4 level. It should be noted
  159. # that the only difference between +O3 and +O4 is global inter-
  160. # procedural analysis. As it has to be performed during the link
  161. # stage the compiler leaves behind certain pseudo-code in lib*.a
  162. # which might be release or even patch level specific. Generating
  163. # the machine code for and analyzing the *whole* program appears
  164. # to be *extremely* memory demanding while the performance gain is
  165. # actually questionable. The situation is intensified by the default
  166. # HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
  167. # which is way too low for +O4. In other words, doesn't +O3 make
  168. # more sense?
  169. # - Keep in mind that the HP compiler by default generates code
  170. # suitable for execution on the host you're currently compiling at.
  171. # If the toolkit is ment to be used on various PA-RISC processors
  172. # consider './config +Dportable'.
  173. # - +DD64 is chosen in favour of +DA2.0W because it's ment to be
  174. # compatible with *future* releases.
  175. # - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
  176. # pass -D_REENTRANT on HP-UX 10 and later.
  177. # - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
  178. # 32-bit message digests. (For the moment of this writing) HP C
  179. # doesn't seem to "digest" too many local variables (they make "him"
  180. # chew forever:-). For more details look-up MD32_XARRAY comment in
  181. # crypto/sha/sha_lcl.h.
  182. # <appro@fy.chalmers.se>
  183. #
  184. "hpux-parisc-cc","cc:-Ae +O3 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  185. "hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  186. "hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:::",
  187. # HPUX 9.X config.
  188. # Don't use the bundled cc. It is broken. Use HP ANSI C if possible, or
  189. # egcs. gcc 2.8.1 is also broken.
  190. "hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::(unknown)::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  191. # If hpux-cc fails (e.g. during "make test"), try the next one; otherwise,
  192. # please report your OS and compiler version to the openssl-bugs@openssl.org
  193. # mailing list.
  194. "hpux-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::(unknown)::DES_PTR DES_UNROLL DES_RISC1:::",
  195. "hpux-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  196. # If hpux-gcc fails, try this one:
  197. "hpux-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::DES_PTR DES_UNROLL DES_RISC1:::",
  198. # HPUX 10.X config. Supports threads.
  199. "hpux10-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  200. # If hpux10-cc fails, try this one (if still fails, try deleting BN_LLONG):
  201. "hpux10-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  202. "hpux10-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
  203. # If hpux10-gcc fails, try this one:
  204. "hpux10-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::DES_PTR DES_UNROLL DES_RISC1:::",
  205. # HPUX 11.X from www.globus.org.
  206. # Only works on PA-RISC 2.0 cpus, and not optimized. Why?
  207. #"hpux11-32bit-cc","cc:+DA2.0 -DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::DES_PTR DES_UNROLL DES_RISC1:::",
  208. #"hpux11-64bit-cc","cc:+DA2.0W -g -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT :::",
  209. # Use unified settings above instead.
  210. # Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
  211. # the new compiler
  212. # For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
  213. "alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o::",
  214. "alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o::",
  215. "alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o::",
  216. "FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
  217. #### Alpha Linux with GNU C and Compaq C setups
  218. # Special notes:
  219. # - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
  220. # ought to run './Configure linux-alpha+bwx-gcc' manually, do
  221. # complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
  222. # which is appropriate.
  223. # - If you use ccc keep in mind that -fast implies -arch host and the
  224. # compiler is free to issue instructions which gonna make elder CPU
  225. # choke. If you wish to build "blended" toolkit, add -arch generic
  226. # *after* -fast and invoke './Configure linux-alpha-ccc' manually.
  227. #
  228. # <appro@fy.chalmers.se>
  229. #
  230. "linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
  231. "linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
  232. "linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
  233. "linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
  234. # assembler versions -- currently defunct:
  235. ##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:asm/alpha.o::",
  236. # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
  237. # bn86-elf.o file file since it is hand tweaked assembler.
  238. "linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  239. "debug-linux-elf","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT:-lefence:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  240. "linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
  241. "linux-mips", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::BN_LLONG:::",
  242. "linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::",
  243. "linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::SIXTY_FOUR_BIT_LONG::",
  244. "NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
  245. "NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
  246. "NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
  247. "FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  248. "FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
  249. "bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown)::RSA_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_bsdi_asm}",
  250. "bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
  251. "nextstep", "cc:-O -Wall:<libc.h>:(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
  252. "nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
  253. # NCR MP-RAS UNIX ver 02.03.01
  254. "ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
  255. # UnixWare 2.0
  256. "unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
  257. "unixware-2.0-pentium","cc:-O -DFILIO_H -Kpentium -Kthread::(unknown):-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
  258. # UnixWare 7
  259. "unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread:-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
  260. # IBM's AIX.
  261. "aix-cc", "cc:-O -DAIX -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR:::",
  262. "aix-gcc", "gcc:-O3 -DAIX -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR:::",
  263. #
  264. # Cray T90 (SDSC)
  265. # It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
  266. # defined. The T90 ints and longs are 8 bytes long, and apparently the
  267. # B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and
  268. # non L_ENDIAN code aligns the bytes in each word correctly.
  269. #
  270. # The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
  271. #'Taking the address of a bit field is not allowed. '
  272. #'An expression with bit field exists as the operand of "sizeof" '
  273. # (written by Wayne Schroeder <schroede@SDSC.EDU>)
  274. "cray-t90-cc", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown)::SIXTY_FOUR_BIT_LONG DES_INT:::",
  275. #
  276. # Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
  277. #
  278. # The BIT_FIELD_LIMITS define was written for the C90 (it seems). I added
  279. # another use. Basically, the problem is that the T3E uses some bit fields
  280. # for some st_addr stuff, and then sizeof and address-of fails
  281. # I could not use the ams/alpha.o option because the Cray assembler, 'cam'
  282. # did not like it.
  283. "cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
  284. # DGUX, 88100.
  285. "dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::RC4_INDEX DES_UNROLL:::",
  286. "dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):-lnsl -lsocket:RC4_INDEX:RC4_INDEX DES_UNROLL:::",
  287. "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}",
  288. # SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the
  289. # SCO cc.
  290. "sco5-cc", "cc:::(unknown):-lsocket:${x86_gcc_des} ${x86_gcc_opts}:::", # des options?
  291. "sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):-lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", # the SCO assembler doesn't seem to like our assembler files ...
  292. # Sinix/ReliantUNIX RM400
  293. # NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */
  294. "ReliantUNIX","cc:-KPIC -g -DSNI -DTERMIOS -DB_ENDIAN::-Kthread:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:::",
  295. "SINIX","cc:-O -DSNI::(unknown):-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
  296. "SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown):-lucb:RC4_INDEX RC4_CHAR:::",
  297. # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
  298. "BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown):-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
  299. # Windows NT, Microsoft Visual C++ 4.0
  300. "VC-NT","cl:::::BN_LLONG RC4_INDEX ${x86_gcc_opts}:::",
  301. "VC-WIN32","cl:::::BN_LLONG RC4_INDEX ${x86_gcc_opts}:::",
  302. "VC-WIN16","cl:::(unknown)::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
  303. "VC-W31-16","cl:::(unknown)::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
  304. "VC-W31-32","cl:::::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
  305. "VC-MSDOS","cl:::(unknown)::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
  306. # Borland C++ 4.5
  307. "BC-32","bcc32:::::BN_LLONG DES_PTR RC4_INDEX:::",
  308. "BC-16","bcc:::(unknown)::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::",
  309. # CygWin32
  310. # (Note: the real CFLAGS for Windows builds are defined by util/mk1mf.pl
  311. # and its library files in util/pl/*)
  312. "CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
  313. "Mingw32", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
  314. # Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
  315. "ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown)::::::",
  316. "ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown)::::::",
  317. # K&R C is no longer supported; you need gcc on old Ultrix installations
  318. ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown)::::::",
  319. # Some OpenBSD from Bob Beck <beck@obtuse.com>
  320. "OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:::",
  321. "OpenBSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
  322. "OpenBSD", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::BN_LLONG RC2_CHAR RC4_INDEX DES_UNROLL:::",
  323. "OpenBSD-mips","gcc:-O2 -DL_ENDIAN::(unknown):BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR::::",
  324. ##### MacOS X (a.k.a. Rhapsody) setup
  325. "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
  326. );
  327. my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
  328. BC-16 CygWin32 Mingw32);
  329. my $prefix="";
  330. my $openssldir="";
  331. my $install_prefix="";
  332. my $no_threads=0;
  333. my $threads=0;
  334. my $no_asm=0;
  335. my @skip=();
  336. my $Makefile="Makefile.ssl";
  337. my $des_locl="crypto/des/des_locl.h";
  338. my $des ="crypto/des/des.h";
  339. my $bn ="crypto/bn/bn.h";
  340. my $md2 ="crypto/md2/md2.h";
  341. my $rc4 ="crypto/rc4/rc4.h";
  342. my $rc4_locl="crypto/rc4/rc4_locl.h";
  343. my $idea ="crypto/idea/idea.h";
  344. my $rc2 ="crypto/rc2/rc2.h";
  345. my $bf ="crypto/bf/bf_locl.h";
  346. my $bn_asm ="bn_asm.o";
  347. my $des_enc="des_enc.o fcrypt_b.o";
  348. my $bf_enc ="bf_enc.o";
  349. my $cast_enc="c_enc.o";
  350. my $rc4_enc="rc4_enc.o";
  351. my $rc5_enc="rc5_enc.o";
  352. my $md5_obj="";
  353. my $sha1_obj="";
  354. my $rmd160_obj="";
  355. my $processor="";
  356. my $ranlib;
  357. my $perl;
  358. $ranlib=&which("ranlib") or $ranlib="true";
  359. $perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
  360. or $perl="perl";
  361. &usage if ($#ARGV < 0);
  362. my $flags="";
  363. my $depflags="";
  364. my $openssl_algorithm_defines="";
  365. my $openssl_thread_defines="";
  366. my $openssl_other_defines="";
  367. my $libs="";
  368. my $target="";
  369. my $options="";
  370. foreach (@ARGV)
  371. {
  372. s /^-no-/no-/; # some people just can't read the instructions
  373. if (/^no-asm$/)
  374. {
  375. $no_asm=1;
  376. $flags .= "-DNO_ASM ";
  377. $openssl_other_defines .= "#define NO_ASM\n";
  378. }
  379. elsif (/^no-threads$/)
  380. { $no_threads=1; }
  381. elsif (/^threads$/)
  382. { $threads=1; }
  383. elsif (/^no-(.+)$/)
  384. {
  385. my $algo=$1;
  386. push @skip,$algo;
  387. $algo =~ tr/[a-z]/[A-Z]/;
  388. $flags .= "-DNO_$algo ";
  389. $depflags .= "-DNO_$algo ";
  390. $openssl_algorithm_defines .= "#define NO_$algo\n";
  391. if ($algo eq "DES")
  392. {
  393. push @skip, "mdc2";
  394. $options .= " no-mdc2";
  395. $flags .= "-DNO_MDC2 ";
  396. $depflags .= "-DNO_MDC2 ";
  397. $openssl_algorithm_defines .= "#define NO_MDC2\n";
  398. }
  399. }
  400. elsif (/^386$/)
  401. { $processor=386; }
  402. elsif (/^rsaref$/)
  403. {
  404. $libs.= "-lRSAglue -lrsaref ";
  405. $flags.= "-DRSAref ";
  406. $openssl_other_defines .= "#define RSAref\n";
  407. }
  408. elsif (/^[-+]/)
  409. {
  410. if (/^-[lL](.*)$/)
  411. {
  412. $libs.=$_." ";
  413. }
  414. elsif (/^-[^-]/ or /^\+/)
  415. {
  416. $flags.=$_." ";
  417. }
  418. elsif (/^--prefix=(.*)$/)
  419. {
  420. $prefix=$1;
  421. }
  422. elsif (/^--openssldir=(.*)$/)
  423. {
  424. $openssldir=$1;
  425. }
  426. elsif (/^--install.prefix=(.*)$/)
  427. {
  428. $install_prefix=$1;
  429. }
  430. else
  431. {
  432. print STDERR $usage;
  433. exit(1);
  434. }
  435. }
  436. elsif ($_ =~ /^([^:]+):(.+)$/)
  437. {
  438. eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
  439. $target=$1;
  440. }
  441. else
  442. {
  443. die "target already defined - $target\n" if ($target ne "");
  444. $target=$_;
  445. }
  446. unless ($_ eq $target) {
  447. if ($options eq "") {
  448. $options = $_;
  449. } else {
  450. $options .= " ".$_;
  451. }
  452. }
  453. }
  454. if ($target eq "TABLE") {
  455. foreach $target (sort keys %table) {
  456. print_table_entry($target);
  457. }
  458. exit 0;
  459. }
  460. if ($target eq "LIST") {
  461. foreach (sort keys %table) {
  462. print;
  463. print "\n";
  464. }
  465. exit 0;
  466. }
  467. &usage if (!defined($table{$target}));
  468. my $IsWindows=scalar grep /^$target$/,@WinTargets;
  469. $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
  470. $prefix=$openssldir if $prefix eq "";
  471. chop $openssldir if $openssldir =~ /\/$/;
  472. chop $prefix if $prefix =~ /\/$/;
  473. $openssldir=$prefix . "/ssl" if $openssldir eq "";
  474. $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /^\//;
  475. print "IsWindows=$IsWindows\n";
  476. (my $cc,my $cflags,my $unistd,my $thread_cflag,my $lflags,my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
  477. $md5_obj,$sha1_obj,my $cast_obj,my $rc4_obj,$rmd160_obj,my $rc5_obj)=
  478. split(/\s*:\s*/,$table{$target} . ":" x 20 , -1);
  479. $cflags="$flags$cflags" if ($flags ne "");
  480. my $thread_cflags;
  481. my $thread_defines;
  482. if ($thread_cflag ne "(unknown)" && !$no_threads)
  483. {
  484. # If we know how to do it, support threads by default.
  485. $threads = 1;
  486. }
  487. if ($thread_cflag eq "(unknown)")
  488. {
  489. # If the user asked for "threads", hopefully they also provided
  490. # any system-dependent compiler options that are necessary.
  491. $thread_cflags="-DTHREADS $cflags" ;
  492. $thread_defines .= "#define THREADS\n";
  493. }
  494. else
  495. {
  496. $thread_cflags="-DTHREADS $thread_cflag $cflags";
  497. $thread_defines .= "#define THREADS\n";
  498. # my $def;
  499. # foreach $def (split ' ',$thread_cflag)
  500. # {
  501. # if ($def =~ s/^-D// && $def !~ /^_/)
  502. # {
  503. # $thread_defines .= "#define $def\n";
  504. # }
  505. # }
  506. }
  507. $lflags="$libs$lflags"if ($libs ne "");
  508. if ($no_asm)
  509. {
  510. $bn_obj=$des_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj="";
  511. $sha1_obj=$md5_obj=$rmd160_obj="";
  512. }
  513. if ($threads)
  514. {
  515. $cflags=$thread_cflags;
  516. $openssl_thread_defines .= $thread_defines;
  517. }
  518. #my ($bn1)=split(/\s+/,$bn_obj);
  519. #$bn1 = "" unless defined $bn1;
  520. #$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
  521. #$bn_obj="$bn1";
  522. $bn_obj = $bn_asm unless $bn_obj ne "";
  523. $des_obj=$des_enc unless ($des_obj =~ /\.o$/);
  524. $bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/);
  525. $cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/);
  526. $rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/);
  527. $rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/);
  528. if ($sha1_obj =~ /\.o$/)
  529. {
  530. # $sha1_obj=$sha1_enc;
  531. $cflags.=" -DSHA1_ASM";
  532. }
  533. if ($md5_obj =~ /\.o$/)
  534. {
  535. # $md5_obj=$md5_enc;
  536. $cflags.=" -DMD5_ASM";
  537. }
  538. if ($rmd160_obj =~ /\.o$/)
  539. {
  540. # $rmd160_obj=$rmd160_enc;
  541. $cflags.=" -DRMD160_ASM";
  542. }
  543. my $version = "unknown";
  544. my $major = "unknown";
  545. my $minor = "unknown";
  546. open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
  547. while (<IN>)
  548. {
  549. $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
  550. }
  551. close(IN);
  552. if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
  553. {
  554. $major=$1;
  555. $minor=$2;
  556. }
  557. open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
  558. open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
  559. print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
  560. my $sdirs=0;
  561. while (<IN>)
  562. {
  563. chop;
  564. $sdirs = 1 if /^SDIRS=/;
  565. if ($sdirs) {
  566. my $dir;
  567. foreach $dir (@skip) {
  568. s/$dir//;
  569. }
  570. }
  571. $sdirs = 0 unless /\\$/;
  572. s/^VERSION=.*/VERSION=$version/;
  573. s/^MAJOR=.*/MAJOR=$major/;
  574. s/^MINOR=.*/MINOR=$minor/;
  575. s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
  576. s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
  577. s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
  578. s/^PLATFORM=.*$/PLATFORM=$target/;
  579. s/^OPTIONS=.*$/OPTIONS=$options/;
  580. s/^CC=.*$/CC= $cc/;
  581. s/^CFLAG=.*$/CFLAG= $cflags/;
  582. s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
  583. s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
  584. s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
  585. s/^DES_ENC=.*$/DES_ENC= $des_obj/;
  586. s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
  587. s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
  588. s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
  589. s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
  590. s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
  591. s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
  592. s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
  593. s/^PROCESSOR=.*/PROCESSOR= $processor/;
  594. s/^RANLIB=.*/RANLIB= $ranlib/;
  595. s/^PERL=.*/PERL= $perl/;
  596. print OUT $_."\n";
  597. }
  598. close(IN);
  599. close(OUT);
  600. print "CC =$cc\n";
  601. print "CFLAG =$cflags\n";
  602. print "EX_LIBS =$lflags\n";
  603. print "BN_ASM =$bn_obj\n";
  604. print "DES_ENC =$des_obj\n";
  605. print "BF_ENC =$bf_obj\n";
  606. print "CAST_ENC =$cast_obj\n";
  607. print "RC4_ENC =$rc4_obj\n";
  608. print "RC5_ENC =$rc5_obj\n";
  609. print "MD5_OBJ_ASM =$md5_obj\n";
  610. print "SHA1_OBJ_ASM =$sha1_obj\n";
  611. print "RMD160_OBJ_ASM=$rmd160_obj\n";
  612. print "PROCESSOR =$processor\n";
  613. print "RANLIB =$ranlib\n";
  614. print "PERL =$perl\n";
  615. my $des_ptr=0;
  616. my $des_risc1=0;
  617. my $des_risc2=0;
  618. my $des_unroll=0;
  619. my $bn_ll=0;
  620. my $def_int=2;
  621. my $rc4_int=$def_int;
  622. my $md2_int=$def_int;
  623. my $idea_int=$def_int;
  624. my $rc2_int=$def_int;
  625. my $rc4_idx=0;
  626. my $rc4_chunk=0;
  627. my $bf_ptr=0;
  628. my @type=("char","short","int","long");
  629. my ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
  630. my $des_int;
  631. foreach (sort split(/\s+/,$bn_ops))
  632. {
  633. $des_ptr=1 if /DES_PTR/;
  634. $des_risc1=1 if /DES_RISC1/;
  635. $des_risc2=1 if /DES_RISC2/;
  636. $des_unroll=1 if /DES_UNROLL/;
  637. $des_int=1 if /DES_INT/;
  638. $bn_ll=1 if /BN_LLONG/;
  639. $rc4_int=0 if /RC4_CHAR/;
  640. $rc4_int=3 if /RC4_LONG/;
  641. $rc4_idx=1 if /RC4_INDEX/;
  642. $rc4_chunk=1 if /RC4_CHUNK/;
  643. $rc4_chunk=2 if /RC4_CHUNK_LL/;
  644. $md2_int=0 if /MD2_CHAR/;
  645. $md2_int=3 if /MD2_LONG/;
  646. $idea_int=1 if /IDEA_SHORT/;
  647. $idea_int=3 if /IDEA_LONG/;
  648. $rc2_int=1 if /RC2_SHORT/;
  649. $rc2_int=3 if /RC2_LONG/;
  650. $bf_ptr=1 if $_ eq "BF_PTR";
  651. $bf_ptr=2 if $_ eq "BF_PTR2";
  652. ($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
  653. ($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
  654. ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
  655. ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
  656. ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
  657. }
  658. open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
  659. open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
  660. print OUT "/* opensslconf.h */\n";
  661. print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
  662. print OUT "/* OpenSSL was configured with the following options: */\n";
  663. $openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
  664. $openssl_algorithm_defines = " /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
  665. $openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
  666. $openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
  667. print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n$openssl_algorithm_defines#endif\n";
  668. print OUT "#ifdef OPENSSL_THREAD_DEFINES\n$openssl_thread_defines#endif\n";
  669. print OUT "#ifdef OPENSSL_OTHER_DEFINES\n$openssl_other_defines#endif\n\n";
  670. while (<IN>)
  671. {
  672. if (/^#define\s+OPENSSLDIR/)
  673. { print OUT "#define OPENSSLDIR \"$openssldir\"\n"; }
  674. elsif (/^#define\s+OPENSSL_UNISTD/)
  675. {
  676. $unistd = "<unistd.h>" if $unistd eq "";
  677. print OUT "#define OPENSSL_UNISTD $unistd\n";
  678. }
  679. elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
  680. { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
  681. elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
  682. { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
  683. elsif (/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
  684. { printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
  685. elsif (/^#((define)|(undef))\s+SIXTEEN_BIT/)
  686. { printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
  687. elsif (/^#((define)|(undef))\s+EIGHT_BIT/)
  688. { printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
  689. elsif (/^#((define)|(undef))\s+BN_LLONG\s*$/)
  690. { printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
  691. elsif (/^\#define\s+DES_LONG\s+.*/)
  692. { printf OUT "#define DES_LONG unsigned %s\n",
  693. ($des_int)?'int':'long'; }
  694. elsif (/^\#(define|undef)\s+DES_PTR/)
  695. { printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
  696. elsif (/^\#(define|undef)\s+DES_RISC1/)
  697. { printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
  698. elsif (/^\#(define|undef)\s+DES_RISC2/)
  699. { printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
  700. elsif (/^\#(define|undef)\s+DES_UNROLL/)
  701. { printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
  702. elsif (/^#define\s+RC4_INT\s/)
  703. { printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
  704. elsif (/^#undef\s+RC4_CHUNK/)
  705. {
  706. printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
  707. printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
  708. printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
  709. }
  710. elsif (/^#((define)|(undef))\s+RC4_INDEX/)
  711. { printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
  712. elsif (/^#(define|undef)\s+I386_ONLY/)
  713. { printf OUT "#%s I386_ONLY\n", ($processor == 386)?
  714. "define":"undef"; }
  715. elsif (/^#define\s+MD2_INT\s/)
  716. { printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
  717. elsif (/^#define\s+IDEA_INT\s/)
  718. {printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
  719. elsif (/^#define\s+RC2_INT\s/)
  720. {printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
  721. elsif (/^#(define|undef)\s+BF_PTR/)
  722. {
  723. printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
  724. printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
  725. printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
  726. }
  727. else
  728. { print OUT $_; }
  729. }
  730. close(IN);
  731. close(OUT);
  732. # Fix the date
  733. print "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
  734. print "SIXTY_FOUR_BIT mode\n" if $b64;
  735. print "THIRTY_TWO_BIT mode\n" if $b32;
  736. print "SIXTEEN_BIT mode\n" if $b16;
  737. print "EIGHT_BIT mode\n" if $b8;
  738. print "DES_PTR used\n" if $des_ptr;
  739. print "DES_RISC1 used\n" if $des_risc1;
  740. print "DES_RISC2 used\n" if $des_risc2;
  741. print "DES_UNROLL used\n" if $des_unroll;
  742. print "DES_INT used\n" if $des_int;
  743. print "BN_LLONG mode\n" if $bn_ll;
  744. print "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
  745. print "RC4_INDEX mode\n" if $rc4_idx;
  746. print "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
  747. print "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
  748. print "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
  749. print "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
  750. print "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
  751. print "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
  752. print "BF_PTR used\n" if $bf_ptr == 1;
  753. print "BF_PTR2 used\n" if $bf_ptr == 2;
  754. if($IsWindows) {
  755. open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
  756. printf OUT <<EOF;
  757. #ifndef MK1MF_BUILD
  758. /* auto-generated by Configure for crypto/cversion.c:
  759. * for Unix builds, crypto/Makefile.ssl generates functional definitions;
  760. * Windows builds (and other mk1mf builds) compile cversion.c with
  761. * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
  762. #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
  763. #endif
  764. EOF
  765. close(OUT);
  766. } else {
  767. (system "make -f Makefile.ssl PERL=\'$perl\' links") == 0 or exit $?;
  768. ### (system 'make depend') == 0 or exit $? if $depflags ne "";
  769. # Run "make depend" manually if you want to be able to delete
  770. # the source code files of ciphers you left out.
  771. &dofile("tools/c_rehash",$openssldir,'^DIR=', 'DIR=%s',);
  772. if ( $perl =~ m@^/@) {
  773. &dofile("apps/der_chop",$perl,'^#!/', '#!%s');
  774. &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
  775. } else {
  776. # No path for Perl known ...
  777. &dofile("apps/der_chop",'/usr/local/bin/perl','^#!/', '#!%s');
  778. &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
  779. }
  780. }
  781. print <<EOF;
  782. Configured for $target.
  783. EOF
  784. print <<\EOF if (!$no_threads && !$threads);
  785. The library could not be configured for supporting multi-threaded
  786. applications as the compiler options required on this system are not known.
  787. See file INSTALL for details if you need multi-threading.
  788. EOF
  789. exit(0);
  790. sub usage
  791. {
  792. print STDERR $usage;
  793. print STDERR "\npick os/compiler from:\n";
  794. my $j=0;
  795. my $i;
  796. my $k=0;
  797. foreach $i (sort keys %table)
  798. {
  799. next if $i =~ /^debug/;
  800. $k += length($i) + 1;
  801. if ($k > 78)
  802. {
  803. print STDERR "\n";
  804. $k=length($i);
  805. }
  806. print STDERR $i . " ";
  807. }
  808. foreach $i (sort keys %table)
  809. {
  810. next if $i !~ /^debug/;
  811. $k += length($i) + 1;
  812. if ($k > 78)
  813. {
  814. print STDERR "\n";
  815. $k=length($i);
  816. }
  817. print STDERR $i . " ";
  818. }
  819. print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
  820. exit(1);
  821. }
  822. sub which
  823. {
  824. my($name)=@_;
  825. my $path;
  826. foreach $path (split /:/, $ENV{PATH})
  827. {
  828. if (-f "$path/$name" and -x _)
  829. {
  830. return "$path/$name" unless ($name eq "perl" and
  831. system("$path/$name -e " . '\'exit($]<5.0);\''));
  832. }
  833. }
  834. }
  835. sub dofile
  836. {
  837. my $f; my $p; my %m; my @a; my $k; my $ff;
  838. ($f,$p,%m)=@_;
  839. open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
  840. @a=<IN>;
  841. close(IN);
  842. foreach $k (keys %m)
  843. {
  844. grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
  845. }
  846. open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
  847. print OUT @a;
  848. close(OUT);
  849. rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
  850. rename("$f.new",$f) || die "unable to rename $f.new\n";
  851. }
  852. sub print_table_entry
  853. {
  854. my $target = shift;
  855. (my $cc,my $cflags,my $unistd,my $thread_cflag,my $lflags,my $bn_ops,
  856. my $bn_obj,my $des_obj,my $bf_obj,
  857. $md5_obj,$sha1_obj,my $cast_obj,my $rc4_obj,$rmd160_obj,my $rc5_obj)=
  858. split(/\s*:\s*/,$table{$target} . ":" x 20 , -1);
  859. print <<EOF
  860. *** $target
  861. \$cc = $cc
  862. \$cflags = $cflags
  863. \$unistd = $unistd
  864. \$thread_cflag = $thread_cflag
  865. \$lflags = $lflags
  866. \$bn_ops = $bn_ops
  867. \$bn_obj = $bn_obj
  868. \$des_obj = $des_obj
  869. \$bf_obj = $bf_obj
  870. \$md5_obj = $md5_obj
  871. \$sha1_obj = $sha1_obj
  872. \$cast_obj = $cast_obj
  873. \$rc4_obj = $rc4_obj
  874. \$rmd160_obj = $rmd160_obj
  875. \$rc5_obj = $rc5_obj
  876. EOF
  877. }