forked from microsoft/openssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configure
2398 lines (2211 loc) · 72.4 KB
/
Configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
:
eval 'exec perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
##
## Configure -- OpenSSL source tree configuration script
## If editing this file, run this command before committing
## make -f Makefile.org TABLE
##
require 5.000;
use strict;
use File::Basename;
use File::Spec::Functions;
# see INSTALL for instructions.
my $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] [--config=FILE] os/compiler[:flags]\n";
# Options:
#
# --config add the given configuration file, which will be read after
# any "Configurations*" files that are found in the same
# directory as this script.
# --openssldir install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
# --prefix option is given; /usr/local/ssl otherwise)
# --prefix prefix for the OpenSSL include, lib and bin directories
# (Default: the OPENSSLDIR directory)
#
# --install_prefix Additional prefix for package builders (empty by
# default). This needn't be set in advance, you can
# just as well use "make INSTALL_PREFIX=/whatever install".
#
# --with-krb5-dir Declare where Kerberos 5 lives. The libraries are expected
# to live in the subdirectory lib/ and the header files in
# include/. A value is required.
# --with-krb5-lib Declare where the Kerberos 5 libraries live. A value is
# required.
# (Default: KRB5_DIR/lib)
# --with-krb5-include Declare where the Kerberos 5 header files live. A
# value is required.
# (Default: KRB5_DIR/include)
# --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently
# supported values are "MIT" and "Heimdal". A value is required.
#
# --test-sanity Make a number of sanity checks on the data in this file.
# This is a debugging tool for OpenSSL developers.
#
# --cross-compile-prefix Add specified prefix to binutils components.
#
# no-hw-xxx do not compile support for specific crypto hardware.
# Generic OpenSSL-style methods relating to this support
# are always compiled but return NULL if the hardware
# support isn't compiled.
# no-hw do not compile support for any crypto hardware.
# [no-]threads [don't] try to create a library that is suitable for
# multithreaded applications (default is "threads" if we
# know how to do it)
# [no-]shared [don't] try to create shared libraries when supported.
# no-asm do not use assembler
# no-dso do not compile in any native shared-library methods. This
# will ensure that all methods just return NULL.
# no-krb5 do not compile in any KRB5 library or code.
# [no-]zlib [don't] compile support for zlib compression.
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
# library and will be loaded in run-time by the OpenSSL library.
# sctp include SCTP support
# 386 generate 80386 code
# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
# -<xxx> +<xxx> compiler options are passed through
#
# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
# provided to stack calls. Generates unique stack functions for
# each possible stack type.
# DES_PTR use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
# DES_RISC1 use different DES_ENCRYPT macro that helps reduce register
# dependancies but needs to more registers, good for RISC CPU's
# DES_RISC2 A different RISC variant.
# DES_UNROLL unroll the inner DES loop, sometimes helps, somtimes hinders.
# DES_INT use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
# This is used on the DEC Alpha where long is 8 bytes
# and int is 4
# BN_LLONG use the type 'long long' in crypto/bn/bn.h
# MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
# MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
# IDEA_SHORT use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
# IDEA_LONG use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
# RC2_SHORT use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
# RC2_LONG use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
# RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
# RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
# RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on
# array lookups instead of pointer use.
# RC4_CHUNK enables code that handles data aligned at long (natural CPU
# word) boundary.
# RC4_CHUNK_LL enables code that handles data aligned at long long boundary
# (intended for 64-bit CPUs running 32-bit OS).
# BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
# BF_PTR2 intel specific version (generic version is more efficient).
#
# Following are set automatically by this script
#
# MD5_ASM use some extra md5 assember,
# SHA1_ASM use some extra sha1 assember, must define L_ENDIAN for x86
# RMD160_ASM use some extra ripemd160 assember,
# SHA256_ASM sha256_block is implemented in assembler
# SHA512_ASM sha512_block is implemented in assembler
# AES_ASM ASE_[en|de]crypt is implemented in assembler
# Minimum warning options... any contributions to OpenSSL should at least get
# past these.
my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wtype-limits -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DDEBUG_UNUSED";
my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof";
my $strict_warnings = 0;
my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
# MD2_CHAR slags pentium pros
my $x86_gcc_opts="RC4_INDEX MD2_INT";
#$bits1="SIXTEEN_BIT ";
#$bits2="THIRTY_TWO_BIT ";
my $bits1="THIRTY_TWO_BIT ";
my $bits2="SIXTY_FOUR_BIT ";
# As for $BSDthreads. Idea is to maintain "collective" set of flags,
# which would cover all BSD flavors. -pthread applies to them all,
# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
# which has to be accompanied by explicit -D_THREAD_SAFE and
# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
# seems to be sufficient?
my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
# table of known configurations, read in from files
#
# The content of each entry can take one of two forms:
#
# - old style config-string, colon seperated fields with exactly the
# following structure.:
#
# $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 : $perlasm_scheme : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
#
# We use the stringtohash function - defined below - to combine with the
# fields and form a proper hash table from the string.
#
# - direct transfer of old style config string to hash table, using the names
# of the fields as keys:
#
# {
# cc => $cc,
# cflags => $cflags,
# unistd => $unistd,
# thread_cflag => $thread_cflag,
# sys_id => $sys_id,
# lflags => $lflags,
# bn_ops => $bn_ops,
# cpuid_obj => $cpuid_obj,
# bn_obj => $bn_obj,
# ec_obj => $ec_obj,
# des_obj => $des_obj,
# aes_obj => $aes_obj,
# bf_obj => $bf_obj,
# md5_obj => $md5_obj,
# sha1_obj => $sha1_obj,
# cast_obj => $cast_obj,
# rc4_obj => $rc4_obj,
# rmd160_obj => $rmd160_obj,
# rc5_obj => $rc5_obj,
# wp_obj => $wp_obj,
# cmll_obj => $cmll_obj,
# modes_obj => $modes_obj,
# engines_obj => $engines_obj,
# perlasm_scheme => $perlasm_scheme,
# dso_scheme => $dso_scheme,
# shared_target => $shared_target,
# shared_cflag => $shared_cflag,
# shared_ldflag => $shared_ldflag,
# shared_extension => $shared_extension,
# ranlib => $ranlib,
# arflags => $arflags,
# multilib => $multilib
# }
#
# - new style config hash table, which has additional attributes for debug
# and non-debug flags to be added to the common flags, for cflags and lflags:
#
# {
# cc => $cc,
# cflags => $cflags,
# debug_cflags => $debug_cflags,
# release_cflags => $release_cflags,
# unistd => $unistd,
# thread_cflag => $thread_cflag,
# sys_id => $sys_id,
# lflags => $lflags,
# debug_lflags => $debug_lflags,
# release_lflags => $release_lflags,
# bn_ops => $bn_ops,
# cpuid_obj => $cpuid_obj,
# bn_obj => $bn_obj,
# ec_obj => $ec_obj,
# des_obj => $des_obj,
# aes_obj => $aes_obj,
# bf_obj => $bf_obj,
# md5_obj => $md5_obj,
# sha1_obj => $sha1_obj,
# cast_obj => $cast_obj,
# rc4_obj => $rc4_obj,
# rmd160_obj => $rmd160_obj,
# rc5_obj => $rc5_obj,
# wp_obj => $wp_obj,
# cmll_obj => $cmll_obj,
# modes_obj => $modes_obj,
# engines_obj => $engines_obj,
# dso_scheme => $dso_scheme,
# shared_target => $shared_target,
# shared_cflag => $shared_cflag,
# shared_ldflag => $shared_ldflag,
# shared_extension => $shared_extension,
# ranlib => $ranlib,
# arflags => $arflags,
# multilib => $multilib
# }
#
# The configuration reader will do what it can to translate everything into
# new style config hash tables, including merging $target and debug-$target
# if they are similar enough.
#
# The configuration hashes can refer to templates in two different manners:
#
# - as part of the hash, one can have a key called 'inherit_from' that
# indicate what other configuration hashes to inherit data from.
# These are resolved recursively.
#
# Inheritance works as a set of default values that can be overriden
# by corresponding attribute values in the inheriting configuration.
#
# If several configurations are given in the 'inherit_from' array, the
# values of same attribute are concatenated with space separation.
# With this, it's possible to have several smaller templates for
# different configuration aspects that can be combined into a complete
# configuration.
#
# Example:
#
# "foo" => {
# template => 1,
# haha => "haha",
# hoho => "ho"
# },
# "bar" => {
# template => 1,
# hoho => "ho",
# hehe => "hehe"
# },
# "laughter" => {
# inherit_from => [ "foo", "bar" ],
# }
#
# The entry for "foo" will become as follows after processing:
#
# "laughter" => {
# haha => "haha",
# hoho => "ho ho",
# hehe => "hehe"
# }
#
# Note 1: any entry from the table can be used as a template.
# Note 2: pure templates have the attribute 'template => 1' and cannot
# be used as targets.
#
# - instead of a string, one can have a code block of the form
# 'sub { /* your code here */ }', where the arguments are the list of
# inherited values for that key. In fact, the concatenation of strings
# is really done by using 'sub { join(" ",@_) }' on the list of inherited
# values.
#
# Example:
#
# "foo" => {
# template => 1,
# haha => "ha ha",
# hoho => "ho",
# ignored => "This should not appear in the end result",
# },
# "bar" => {
# template => 1,
# haha => "ah",
# hoho => "haho",
# hehe => "hehe"
# },
# "laughter" => {
# inherit_from => [ "foo", "bar" ],
# hehe => sub { join(" ",(@_,"!!!")) },
# ignored => "",
# }
#
# The entry for "foo" will become as follows after processing:
#
# "laughter" => {
# haha => "ha ha ah",
# hoho => "ho haho",
# hehe => "hehe !!!",
# ignored => ""
# }
#
my %table=(
# All these templates are merely a translation of the corresponding
# variables further up.
#
# Note: as long as someone might use old style configuration strings,
# or we bother supporting that, those variables need to stay
x86_asm => {
template => 1,
cpuid_obj => "x86cpuid.o",
bn_obj => "bn-586.o co-586.o x86-mont.o x86-gf2m.o",
ec_obj => "ecp_nistz256.o ecp_nistz256-x86.o",
des_obj => "des-586.o crypt586.o",
aes_obj => "aes-586.o vpaes-x86.o aesni-x86.o",
bf_obj => "bf-586.o",
md5_obj => "md5-586.o",
sha1_obj => "sha1-586.o sha256-586.o sha512-586.o",
rc4_obj => "rc4-586.o",
rmd160_obj => "rmd-586.o",
rc5_obj => "rc5-586.o",
wp_obj => "wp_block.o wp-mmx.o",
cmll_obj => "cmll-x86.o",
modes_obj => "ghash-x86.o",
engines_obj => "e_padlock-x86.o"
},
x86_elf_asm => {
template => 1,
inherit_from => [ "x86_asm" ],
perlasm_scheme => "elf"
},
x86_64_asm => {
template => 1,
cpuid_obj => "x86_64cpuid.o",
bn_obj => "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",
ec_obj => "ecp_nistz256.o ecp_nistz256-x86_64.o",
aes_obj => "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_obj => "md5-x86_64.o",
sha1_obj => "sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o",
rc4_obj => "rc4-x86_64.o rc4-md5-x86_64.o",
wp_obj => "wp-x86_64.o",
cmll_obj => "cmll-x86_64.o cmll_misc.o",
modes_obj => "ghash-x86_64.o aesni-gcm-x86_64.o",
engines_obj => "e_padlock-x86_64.o"
},
ia64_asm => {
template => 1,
cpuid_obj => "ia64cpuid.o",
bn_obj => "bn-ia64.o ia64-mont.o",
aes_obj => "aes_core.o aes_cbc.o aes-ia64.o",
md5_obj => "md5-ia64.o",
sha1_obj => "sha1-ia64.o sha256-ia64.o sha512-ia64.o",
rc4_obj => "rc4-ia64.o rc4_skey.o",
modes_obj => "ghash-ia64.o",
perlasm_scheme => "void"
},
sparcv9_asm => {
template => 1,
cpuid_obj => "sparcv9cap.o sparccpuid.o",
bn_obj => "bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o",
ec_obj => "ecp_nistz256.o ecp_nistz256-sparcv9.o",
des_obj => "des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o",
aes_obj => "aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o",
md5_obj => "md5-sparcv9.o",
sha1_obj => "sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o",
cmll_obj => "camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o",
modes_obj => "ghash-sparcv9.o",
perlasm_scheme => "void"
},
sparcv8_asm => {
template => 1,
cpuid_obj => "",
bn_obj => "sparcv8.o",
des_obj => "des_enc-sparc.o fcrypt_b.o",
perlasm_scheme => "void"
},
alpha_asm => {
template => 1,
cpuid_obj => "alphacpuid.o",
bn_obj => "bn_asm.o alpha-mont.o",
sha1_obj => "sha1-alpha.o",
modes_obj => "ghash-alpha.o",
perlasm_scheme => "void"
},
mips32_asm => {
template => 1,
bn_obj => "bn-mips.o mips-mont.o",
aes_obj => "aes_cbc.o aes-mips.o",
sha1_obj => "sha1-mips.o sha256-mips.o",
},
mips64_asm => {
inherit_from => [ "mips32_asm" ],
template => 1,
sha1_obj => sub { join(" ", @_, "sha512-mips.o") }
},
s390x_asm => {
template => 1,
cpuid_obj => "s390xcap.o s390xcpuid.o",
bn_obj => "bn-s390x.o s390x-mont.o s390x-gf2m.o",
aes_obj => "aes-s390x.o aes-ctr.o aes-xts.o",
sha1_obj => "sha1-s390x.o sha256-s390x.o sha512-s390x.o",
rc4_obj => "rc4-s390x.o",
modes_obj => "ghash-s390x.o",
},
armv4_asm => {
template => 1,
cpuid_obj => "armcap.o armv4cpuid.o",
bn_obj => "bn_asm.o armv4-mont.o armv4-gf2m.o",
ec_obj => "ecp_nistz256.o ecp_nistz256-armv4.o",
aes_obj => "aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o",
sha1_obj => "sha1-armv4-large.o sha256-armv4.o sha512-armv4.o",
modes_obj => "ghash-armv4.o ghashv8-armx.o",
perlasm_scheme => "void"
},
aarch64_asm => {
template => 1,
cpuid_obj => "armcap.o arm64cpuid.o mem_clr.o",
ec_obj => "ecp_nistz256.o ecp_nistz256-armv8.o",
bn_obj => "bn_asm.o armv8-mont.o",
aes_obj => "aes_core.o aes_cbc.o aesv8-armx.o vpaes-armv8.o",
sha1_obj => "sha1-armv8.o sha256-armv8.o sha512-armv8.o",
modes_obj => "ghashv8-armx.o",
},
parisc11_asm => {
template => 1,
cpuid_obj => "pariscid.o",
bn_obj => "bn_asm.o parisc-mont.o",
aes_obj => "aes_core.o aes_cbc.o aes-parisc.o",
sha1_obj => "sha1-parisc.o sha256-parisc.o sha512-parisc.o",
rc4_obj => "rc4-parisc.o",
modes_obj => "ghash-parisc.o",
perlasm_scheme => "32"
},
parisc20_64_asm => {
template => 1,
inherit_from => [ "parisc11_asm" ],
bn_obj => sub { my $r=join(" ",@_); $r=~s/bn_asm/pa-risc2W/; $r; },
perlasm_scheme => "64",
},
ppc64_asm => {
template => 1,
cpuid_obj => "ppccpuid.o ppccap.o",
bn_obj => "bn-ppc.o ppc-mont.o ppc64-mont.o",
aes_obj => "aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o",
sha1_obj => "sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o",
modes_obj => "ghashp8-ppc.o",
},
ppc32_asm => {
inherit_from => [ "ppc64_asm" ],
template => 1
},
);
{ my $no_asm_templates=0;
foreach (@ARGV) { $no_asm_templates=1 if (/^\-?no\-asm$/); }
sub asm { $no_asm_templates?():@_; }
}
sub stringtohash {
my $in = shift @_;
if (ref($in) eq "HASH") {
return $in;
}
my @stringsequence = (
"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",
"perlasm_scheme",
"dso_scheme",
"shared_target",
"shared_cflag",
"shared_ldflag",
"shared_extension",
"ranlib",
"arflags",
"multilib",
);
# return a ref to a hash, that's what the outer braces are for.
return { map { shift @stringsequence => $_ } split /:/, $in };
};
# Read configuration target stanzas from a file, so that people can have
# local files with their own definitions
sub read_config {
my $fname = shift;
open(CONFFILE, "< $fname")
or die "Can't open configuration file '$fname'!\n";
my $x = $/;
undef $/;
my $content = <CONFFILE>;
$/ = $x;
close(CONFFILE);
my %targets = ();
eval $content;
# Make sure we have debug- targets first
my @keys =
sort {
my $a_nd = $a =~ m/^debug-/ ? $' :$a;
my $b_nd = $b =~ m/^debug-/ ? $' :$b;
my $res = 0;
if (($a_nd == $a) == ($b_nd == $b)) {
# they are both debug- or not, compare them as they are
$res = $a cmp $b;
} elsif ($a_nd != $a) {
# $a is debug-, make it lesser
$res = -1;
} else {
# $b is debug-, make $a greater
$res = 1;
}
$res;
} keys %targets;
foreach (@keys) {
if (ref($targets{$_}) ne "HASH") {
# Value is assumed to be a string. Split it up to
# become a hash table of parameters. Also, try to
# merge debug- variants with the non-debug target.
# Start with converting the value from a string to a
# standardised hash of fields. Using $tohash is safe,
# if the input is already a hash ref, it's just returned
# back.
$targets{$_} = stringtohash($targets{$_});
# If the current target is a debug target, there might
# be a corresponding non-debug target that we can merge
# with. If it isn't a debug- target, we've already done
# as much merging as we can and do not need to bother
# with that any more.
if ($_ =~ m/^debug-/) {
my $debugkey = $_;
my $nondebugkey = $';
my $debug = $targets{$debugkey};
my $nondebug;
if ($targets{$nondebugkey}) {
$nondebug = stringtohash($targets{$nondebugkey});
}
if ($nondebug) {
# There's both a debug and non-debug variant of
# this target, so we should try to merge them
# together.
# First, check that the non-debug variant isn't
# already built up with all it should have.
if ($nondebug->{debug_cflags}
|| $nondebug->{release_cflags}
|| $nondebug->{debug_lflags}
|| $nondebug->{release_lflags}) {
warn "there's a debug target $debugkey to be merged with a target $nondebugkey, but the latter seems to already have both nodebug and debug information. This requires human intervention. Skipping $debugkey...";
next;
}
# Now, check similarity.
# For keys they have in common, support that
# cflags and lflags can differ, otherwise they
# must have exactly the same values for them
# to be merged into one.
my $similarenough = 1;
for (keys %{$debug}) {
if ($nondebug->{$_} ne $debug->{$_}
&& $_ !~ m/^[cl]flags$/) {
$similarenough = 0;
last;
}
}
if ($similarenough) {
# Here's where the magic happens, split the
# options in the debug and non-debug variants
# cflags and ldflags into three strings each,
# one with common flags, one with extra debug
# flags and one with extra non-debug flags.
# The result ends up in %h_nondebug, which
# becomes the merged variant when we're done.
# for each of cflags and lflags, they are
# replaced with cflags, debug_cflags,
# release_cflags and similar for lflags.
#
# The purpose is that 'cflags' should be
# used together with 'debug_cflags' or
# 'release_cflags' depending on what the
# user asks for.
foreach (("cflags", "lflags")) {
my @list_d = split /\s+/, $debug->{$_};
my @list_nd = split /\s+/, $nondebug->{$_};
my %presence = (); # bitmap
# 1: present in @list_d
# 2: present in @list_nd
# 3: present in both
map { $presence{$_} += 1; } @list_d;
map { $presence{$_} += 2; } @list_nd;
delete $nondebug->{$_};
# Note: we build from the original lists to
# preserve order, it might be important
$nondebug->{"debug-".$_} =
join(" ",
grep { $presence{$_} == 1 } @list_d);
$nondebug->{"nodebug-".$_} =
join(" ",
grep { $presence{$_} == 2 } @list_nd);
$nondebug->{$_} =
join(" ",
grep { $presence{$_} == 3 } @list_d);
}
$targets{$nondebugkey} = $nondebug;
delete $targets{$debugkey};
}
}
}
}
}
%table = (%table, %targets);
# Local function to resolve inheritance
my $resolve_inheritance;
$resolve_inheritance =
sub {
my $target = shift;
my @breadcrumbs = @_;
if (grep { $_ eq $target } @breadcrumbs) {
die "inherit_from loop! target backtrace:\n "
,$target,"\n ",join("\n ", @breadcrumbs),"\n";
}
# Recurse through all inheritances. They will be resolved on
# the fly, so when this operation is done, they will all just
# be a bunch of attributes with string values.
# What we get here, though, are keys with references to lists
# of the combined values of them all. We will deal with lists
# after this stage is done.
my %combined_inheritance = ();
if ($table{$target}->{inherit_from}) {
foreach (@{$table{$target}->{inherit_from}}) {
my %inherited_config =
$resolve_inheritance->($_, $target, @breadcrumbs);
# 'template' is a marker that's considered private to
# the config that had it.
delete $inherited_config{template};
map {
if (!$combined_inheritance{$_}) {
$combined_inheritance{$_} = [];
}
push @{$combined_inheritance{$_}}, $inherited_config{$_};
} keys %inherited_config;
}
}
# We won't need inherit_from in this target any more, since
# we've resolved all the inheritances that lead to this
delete $table{$target}->{inherit_from};
# Now is the time to deal with those lists. Here's the place
# to decide what shall be done with those lists, all based on
# the values of the target we're currently dealing with.
# - If a value is a coderef, it will be executed with the list
# of inherited values as arguments.
# - If the corresponding key doesn't have a value at all or is
# the emoty string, the inherited value list will be run
# through the default combiner (below), and the result
# becomes this target's value.
# - Otherwise, this target's value is assumed to be a string
# that will simply override the inherited list of values.
my $default_combiner = sub { join(' ',@_) };
my %all_keys =
map { $_ => 1 } (keys %combined_inheritance,
keys %{$table{$target}});
foreach (sort keys %all_keys) {
# Current target doesn't have a value for the current key?
# Assign it the default combiner, the rest of this loop
# body will handle it just like any other coderef.
if (!exists $table{$target}->{$_}) {
$table{$target}->{$_} = $default_combiner;
}
my $valuetype = ref($table{$target}->{$_});
if ($valuetype eq "CODE") {
# CODE reference, execute it with the inherited values
# as arguments.
$table{$target}->{$_} =
$table{$target}->{$_}->(@{$combined_inheritance{$_}});
} elsif ($valuetype eq "") {
# Scalar, just leave it as is.
} else {
# Some other type of reference that we don't handle.
# Better to abort at this point.
die "cannot handle reference type $valuetype,"
," found in target $target -> $_\n";
}
}
# Finally done, return the result.
%{$table{$target}};
};
# Go through all new targets and resolve inheritance and template
# references.
foreach (keys %targets) {
# We're ignoring the returned values here, they are only valuable
# to the inner recursion of this function.
$resolve_inheritance->($_);
}
}
my ($vol, $dir, $dummy) = File::Spec->splitpath($0);
my $pattern = File::Spec->catpath($vol, $dir, "Configurations/*.conf");
foreach (sort glob($pattern) ) {
&read_config($_);
}
my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
debug-VC-WIN64I debug-VC-WIN64A
VC-NT VC-CE VC-WIN32 debug-VC-WIN32
VC-WINSTORE debug-VC-WINSTORE
VC-WINPHONE debug-VC-WINPHONE
VC-WINUNIVERSAL debug-VC-WINUNIVERSAL
BC-32
netware-clib netware-clib-bsdsock
netware-libc netware-libc-bsdsock);
my $prefix="";
my $libdir="";
my $openssldir="";
my $exe_ext="";
my $install_prefix= "$ENV{'INSTALL_PREFIX'}";
my $cross_compile_prefix="";
my $fipslibdir="/usr/local/ssl/fips-2.0/lib/";
my $nofipscanistercheck=0;
my $baseaddr="0xFB00000";
my $no_threads=0;
my $threads=0;
my $no_shared=0; # but "no-shared" is default
my $zlib=1; # but "no-zlib" is default
my $no_krb5=0; # but "no-krb5" is implied unless "--with-krb5-..." is used
my $no_rfc3779=1; # but "no-rfc3779" is default
my $no_asm=0;
my $no_dso=0;
my $no_gmp=0;
my @skip=();
my $Makefile="Makefile";
my $des_locl="crypto/des/des_locl.h";
my $des ="include/openssl/des.h";
my $bn ="include/openssl/bn.h";
my $md2 ="include/openssl/md2.h";
my $rc4 ="include/openssl/rc4.h";
my $rc4_locl="crypto/rc4/rc4_locl.h";
my $idea ="include/openssl/idea.h";
my $rc2 ="include/openssl/rc2.h";
my $bf ="crypto/bf/bf_locl.h";
my $bn_asm ="bn_asm.o";
my $des_enc="des_enc.o fcrypt_b.o";
my $aes_enc="aes_core.o aes_cbc.o";
my $bf_enc ="bf_enc.o";
my $cast_enc="c_enc.o";
my $rc4_enc="rc4_enc.o rc4_skey.o";
my $rc5_enc="rc5_enc.o";
my $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
my $processor="";
my $default_ranlib;
my $perl;
my $fips=0;
# All of the following is disabled by default (RC5 was enabled before 0.9.8):
my %disabled = ( # "what" => "comment" [or special keyword "experimental"]
"deprecated" => "default",
"ec_nistp_64_gcc_128" => "default",
"gmp" => "default",
"jpake" => "experimental",
"md2" => "default",
"rc5" => "default",
"rfc3779" => "default",
"sctp" => "default",
"shared" => "default",
"ssl-trace" => "default",
"store" => "experimental",
"unit-test" => "default",
"zlib" => "default",
"zlib-dynamic" => "default"
);
my @experimental = ();
# This is what $depflags will look like with the above defaults
# (we need this to see if we should advise the user to run "make depend"):
my $default_depflags = " -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST";
# Explicit "no-..." options will be collected in %disabled along with the defaults.
# To remove something from %disabled, use "enable-foo" (unless it's experimental).
# For symmetry, "disable-foo" is a synonym for "no-foo".
# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
# We will collect such requests in @experimental.
# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
my $no_sse2=0;
&usage if ($#ARGV < 0);
my $flags;
my $depflags;
my $openssl_experimental_defines;
my $openssl_algorithm_defines;
my $openssl_thread_defines;
my $openssl_sys_defines="";
my $openssl_other_defines;
my $libs;
my $libkrb5="";
my $target;
my $options;
my $make_depend=0;
my %withargs=();
my $build_prefix = "release_";
my @argvcopy=@ARGV;
my $argvstring="";
my $argv_unprocessed=1;
while($argv_unprocessed)
{
$flags="";
$depflags="";
$openssl_experimental_defines="";
$openssl_algorithm_defines="";
$openssl_thread_defines="";
$openssl_sys_defines="";
$openssl_other_defines="";
$libs="";
$target="";
$options="";
$argv_unprocessed=0;
$argvstring=join(' ',@argvcopy);
PROCESS_ARGS:
foreach (@argvcopy)
{
s /^-no-/no-/; # some people just can't read the instructions
# rewrite some options in "enable-..." form
s /^-?-?shared$/enable-shared/;
s /^sctp$/enable-sctp/;
s /^threads$/enable-threads/;
s /^zlib$/enable-zlib/;
s /^zlib-dynamic$/enable-zlib-dynamic/;
if (/^no-(.+)$/ || /^disable-(.+)$/)
{
if (!($disabled{$1} eq "experimental"))
{
if ($1 eq "ssl")
{
$disabled{"ssl3"} = "option(ssl)";
}
elsif ($1 eq "tls")
{
$disabled{"tls1"} = "option(tls)"
}
elsif ($1 eq "ssl3-method")
{
$disabled{"ssl3-method"} = "option(ssl)";
$disabled{"ssl3"} = "option(ssl)";
}
else
{
$disabled{$1} = "option";
}
}
}
elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
{
my $algo = $1;
if ($disabled{$algo} eq "experimental")
{
die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
unless (/^experimental-/);
push @experimental, $algo;
}
delete $disabled{$algo};
$threads = 1 if ($algo eq "threads");
}
elsif (/^--test-sanity$/)
{
exit(&test_sanity());
}
elsif (/^--strict-warnings$/)
{
$strict_warnings = 1;
}
elsif (/^--debug$/)
{
$build_prefix = "debug_";
}
elsif (/^--release$/)
{
$build_prefix = "release_";
}
elsif (/^reconfigure/ || /^reconf/)
{
if (open(IN,"<$Makefile"))
{
while (<IN>)
{
chomp;
if (/^CONFIGURE_ARGS=(.*)/)
{
$argvstring=$1;
@argvcopy=split(' ',$argvstring);
die "Incorrect data to reconfigure, please do a normal configuration\n"
if (grep(/^reconf/,@argvcopy));
print "Reconfiguring with: $argvstring\n";
$argv_unprocessed=1;
close(IN);
last PROCESS_ARGS;
}
}
close(IN);
}
die "Insufficient data to reconfigure, please do a normal configuration\n";
}
elsif (/^386$/)
{ $processor=386; }
elsif (/^fips$/)
{
$fips=1;
}
elsif (/^rsaref$/)
{
# No RSAref support any more since it's not needed.
# The check for the option is there so scripts aren't
# broken
}
elsif (/^nofipscanistercheck$/)
{
$fips = 1;
$nofipscanistercheck = 1;
}
elsif (/^[-+]/)
{
if (/^--prefix=(.*)$/)
{
$prefix=$1;
}
elsif (/^--libdir=(.*)$/)
{
$libdir=$1;
}
elsif (/^--openssldir=(.*)$/)
{
$openssldir=$1;
}
elsif (/^--install.prefix=(.*)$/)
{