K2.6 patches and update.
[tomato.git] / release / src / router / openssl / util / mk1mf.pl
blob72fa089f6b92793bf12af19c102a3f5e8a30d736
1 #!/usr/local/bin/perl
2 # A bit of an evil hack but it post processes the file ../MINFO which
3 # is generated by `make files` in the top directory.
4 # This script outputs one mega makefile that has no shell stuff or any
5 # funny stuff
8 $INSTALLTOP="/usr/local/ssl";
9 $OPENSSLDIR="/usr/local/ssl";
10 $OPTIONS="";
11 $ssl_version="";
12 $banner="\t\@echo Building OpenSSL";
14 my $no_static_engine = 1;
15 my $engines = "";
16 my $otherlibs = "";
17 local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
18 local $zlib_lib = "";
19 local $perl_asm = 0; # 1 to autobuild asm files from perl scripts
21 my $ex_l_libs = "";
23 # Options to import from top level Makefile
25 my %mf_import = (
26 VERSION => \$ssl_version,
27 OPTIONS => \$OPTIONS,
28 INSTALLTOP => \$INSTALLTOP,
29 OPENSSLDIR => \$OPENSSLDIR,
30 PLATFORM => \$mf_platform,
31 CFLAG => \$mf_cflag,
32 DEPFLAG => \$mf_depflag,
33 CPUID_OBJ => \$mf_cpuid_asm,
34 BN_ASM => \$mf_bn_asm,
35 DES_ENC => \$mf_des_asm,
36 AES_ENC => \$mf_aes_asm,
37 BF_ENC => \$mf_bf_asm,
38 CAST_ENC => \$mf_cast_asm,
39 RC4_ENC => \$mf_rc4_asm,
40 RC5_ENC => \$mf_rc5_asm,
41 MD5_ASM_OBJ => \$mf_md5_asm,
42 SHA1_ASM_OBJ => \$mf_sha_asm,
43 RMD160_ASM_OBJ => \$mf_rmd_asm,
44 WP_ASM_OBJ => \$mf_wp_asm,
45 CMLL_ENC => \$mf_cm_asm,
46 BASEADDR => \$baseaddr,
47 FIPSDIR => \$fipsdir,
51 open(IN,"<Makefile") || die "unable to open Makefile!\n";
52 while(<IN>) {
53 my ($mf_opt, $mf_ref);
54 while (($mf_opt, $mf_ref) = each %mf_import) {
55 if (/^$mf_opt\s*=\s*(.*)$/) {
56 $$mf_ref = $1;
60 close(IN);
62 $debug = 1 if $mf_platform =~ /^debug-/;
64 die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
66 $infile="MINFO";
68 %ops=(
69 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
70 "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64",
71 "VC-WIN64A", "Microsoft C/C++ - Win64/x64",
72 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
73 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
74 "Mingw32", "GNU C++ - Windows NT or 9x",
75 "Mingw32-files", "Create files with DOS copy ...",
76 "BC-NT", "Borland C++ 4.5 - Windows NT",
77 "linux-elf","Linux elf",
78 "ultrix-mips","DEC mips ultrix",
79 "FreeBSD","FreeBSD distribution",
80 "OS2-EMX", "EMX GCC OS/2",
81 "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets",
82 "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets",
83 "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
84 "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
85 "default","cc under unix",
86 "auto", "auto detect from top level Makefile"
89 $platform="";
90 my $xcflags="";
91 foreach (@ARGV)
93 if (!&read_options && !defined($ops{$_}))
95 print STDERR "unknown option - $_\n";
96 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
97 print STDERR "\nwhere [system] can be one of the following\n";
98 foreach $i (sort keys %ops)
99 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
100 print STDERR <<"EOF";
101 and [options] can be one of
102 no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
103 no-ripemd
104 no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
105 no-bf no-cast no-aes no-camellia no-seed
106 no-rsa no-dsa no-dh - Skip this public key cipher
107 no-ssl2 no-ssl3 - Skip this version of SSL
108 just-ssl - remove all non-ssl keys/digest
109 no-asm - No x86 asm
110 no-krb5 - No KRB5
111 no-srp - No SRP
112 no-ec - No EC
113 no-ecdsa - No ECDSA
114 no-ecdh - No ECDH
115 no-engine - No engine
116 no-hw - No hw
117 nasm - Use NASM for x86 asm
118 nw-nasm - Use NASM x86 asm for NetWare
119 nw-mwasm - Use Metrowerks x86 asm for NetWare
120 gaswin - Use GNU as with Mingw32
121 no-socks - No socket code
122 no-err - No error strings
123 dll/shlib - Build shared libraries (MS)
124 debug - Debug build
125 profile - Profiling build
126 gcc - Use Gcc (unix)
128 Values that can be set
129 TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
131 -L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
132 -<ex_cc_flags> - extra 'cc' flags,
133 added (MS), or replace (unix)
135 exit(1);
137 $platform=$_;
139 foreach (grep(!/^$/, split(/ /, $OPTIONS)))
141 print STDERR "unknown option - $_\n" if !&read_options;
144 $no_static_engine = 0 if (!$shlib);
146 $no_mdc2=1 if ($no_des);
148 $no_ssl3=1 if ($no_md5 || $no_sha);
149 $no_ssl3=1 if ($no_rsa && $no_dh);
151 $no_ssl2=1 if ($no_md5);
152 $no_ssl2=1 if ($no_rsa);
154 $out_def="out";
155 $inc_def="outinc";
156 $tmp_def="tmp";
158 $perl="perl" unless defined $perl;
159 $mkdir="-mkdir" unless defined $mkdir;
161 ($ssl,$crypto)=("ssl","crypto");
162 $ranlib="echo ranlib";
164 $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
165 $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
166 $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
168 # $bin_dir.=$o causes a core dump on my sparc :-(
171 $NT=0;
173 push(@INC,"util/pl","pl");
175 if ($platform eq "auto") {
176 $platform = $mf_platform;
177 print STDERR "Imported platform $mf_platform\n";
180 if (($platform =~ /VC-(.+)/))
182 $FLAVOR=$1;
183 $NT = 1 if $1 eq "NT";
184 require 'VC-32.pl';
186 elsif ($platform eq "Mingw32")
188 require 'Mingw32.pl';
190 elsif ($platform eq "Mingw32-files")
192 require 'Mingw32f.pl';
194 elsif ($platform eq "BC-NT")
196 $bc=1;
197 require 'BC-32.pl';
199 elsif ($platform eq "FreeBSD")
201 require 'unix.pl';
202 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
204 elsif ($platform eq "linux-elf")
206 require "unix.pl";
207 require "linux.pl";
208 $unix=1;
210 elsif ($platform eq "ultrix-mips")
212 require "unix.pl";
213 require "ultrix.pl";
214 $unix=1;
216 elsif ($platform eq "OS2-EMX")
218 $wc=1;
219 require 'OS2-EMX.pl';
221 elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") ||
222 ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock"))
224 $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock";
225 $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock");
226 require 'netware.pl';
228 else
230 require "unix.pl";
232 $unix=1;
233 $cflags.=' -DTERMIO';
236 $fipsdir =~ s/\//${o}/g;
238 $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
239 $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
240 $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
242 $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
244 $cflags= "$xcflags$cflags" if $xcflags ne "";
246 $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
247 $cflags.=" -DOPENSSL_NO_AES" if $no_aes;
248 $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia;
249 $cflags.=" -DOPENSSL_NO_SEED" if $no_seed;
250 $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
251 $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4;
252 $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5;
253 $cflags.=" -DOPENSSL_NO_MD2" if $no_md2;
254 $cflags.=" -DOPENSSL_NO_MD4" if $no_md4;
255 $cflags.=" -DOPENSSL_NO_MD5" if $no_md5;
256 $cflags.=" -DOPENSSL_NO_SHA" if $no_sha;
257 $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1;
258 $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd;
259 $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2;
260 $cflags.=" -DOPENSSL_NO_BF" if $no_bf;
261 $cflags.=" -DOPENSSL_NO_CAST" if $no_cast;
262 $cflags.=" -DOPENSSL_NO_DES" if $no_des;
263 $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa;
264 $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa;
265 $cflags.=" -DOPENSSL_NO_DH" if $no_dh;
266 $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool;
267 $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
268 $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2;
269 $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
270 $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
271 $cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
272 $cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
273 $cflags.=" -DOPENSSL_NO_ERR" if $no_err;
274 $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
275 $cflags.=" -DOPENSSL_NO_EC" if $no_ec;
276 $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa;
277 $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
278 $cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
279 $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
280 $cflags.=" -DOPENSSL_NO_HW" if $no_hw;
281 $cflags.=" -DOPENSSL_FIPS" if $fips;
282 $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake;
283 $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m;
284 $cflags.= " -DZLIB" if $zlib_opt;
285 $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
287 if ($no_static_engine)
289 $cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
291 else
293 $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE";
296 #$cflags.=" -DRSAref" if $rsaref ne "";
298 ## if ($unix)
299 ## { $cflags="$c_flags" if ($c_flags ne ""); }
300 ##else
301 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
303 $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
306 %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
307 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
309 if ($msdos)
311 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
312 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
313 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
314 $banner.="\t\@echo documentation for details.\n";
317 # have to do this to allow $(CC) under unix
318 $link="$bin_dir$link" if ($link !~ /^\$/);
320 $INSTALLTOP =~ s|/|$o|g;
321 $OPENSSLDIR =~ s|/|$o|g;
323 #############################################
324 # We parse in input file and 'store' info for later printing.
325 open(IN,"<$infile") || die "unable to open $infile:$!\n";
326 $_=<IN>;
327 for (;;)
329 chop;
331 ($key,$val)=/^([^=]+)=(.*)/;
332 if ($key eq "RELATIVE_DIRECTORY")
334 if ($lib ne "")
336 $uc=$lib;
337 $uc =~ s/^lib(.*)\.a/$1/;
338 $uc =~ tr/a-z/A-Z/;
339 $lib_nam{$uc}=$uc;
340 $lib_obj{$uc}.=$libobj." ";
342 last if ($val eq "FINISHED");
343 $lib="";
344 $libobj="";
345 $dir=$val;
348 if ($key eq "KRB5_INCLUDES")
349 { $cflags .= " $val";}
351 if ($key eq "ZLIB_INCLUDE")
352 { $cflags .= " $val" if $val ne "";}
354 if ($key eq "LIBZLIB")
355 { $zlib_lib = "$val" if $val ne "";}
357 if ($key eq "LIBKRB5")
358 { $ex_libs .= " $val" if $val ne "";}
360 if ($key eq "TEST")
361 { $test.=&var_add($dir,$val, 0); }
363 if (($key eq "PROGS") || ($key eq "E_OBJ"))
364 { $e_exe.=&var_add($dir,$val, 0); }
366 if ($key eq "LIB")
368 $lib=$val;
369 $lib =~ s/^.*\/([^\/]+)$/$1/;
371 if ($key eq "LIBNAME" && $no_static_engine)
373 $lib=$val;
374 $lib =~ s/^.*\/([^\/]+)$/$1/;
375 $otherlibs .= " $lib";
378 if ($key eq "EXHEADER")
379 { $exheader.=&var_add($dir,$val, 1); }
381 if ($key eq "HEADER")
382 { $header.=&var_add($dir,$val, 1); }
384 if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine))
385 { $libobj=&var_add($dir,$val, 0); }
386 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
387 { $engines.=$val }
389 if (!($_=<IN>))
390 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
392 close(IN);
394 if ($shlib)
396 $extra_install= <<"EOF";
397 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\"
398 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\"
399 \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\"
400 \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
402 if ($no_static_engine)
404 $extra_install .= <<"EOF"
405 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
406 \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
410 else
412 $extra_install= <<"EOF";
413 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\"
414 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
416 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
417 if ($fips)
419 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
420 $ex_l_libs .= " \$(O_FIPSCANISTER)";
424 $defs= <<"EOF";
425 # This makefile has been automatically generated from the OpenSSL distribution.
426 # This single makefile will build the complete OpenSSL distribution and
427 # by default leave the 'intertesting' output files in .${o}out and the stuff
428 # that needs deleting in .${o}tmp.
429 # The file was generated by running 'make makefile.one', which
430 # does a 'make files', which writes all the environment variables from all
431 # the makefiles to the file call MINFO. This file is used by
432 # util${o}mk1mf.pl to generate makefile.one.
433 # The 'makefile per directory' system suites me when developing this
434 # library and also so I can 'distribute' indervidual library sections.
435 # The one monster makefile better suits building in non-unix
436 # environments.
440 $defs .= $preamble if defined $preamble;
442 $defs.= <<"EOF";
443 INSTALLTOP=$INSTALLTOP
444 OPENSSLDIR=$OPENSSLDIR
446 # Set your compiler options
447 PLATFORM=$platform
448 CC=$bin_dir${cc}
449 CFLAG=$cflags
450 APP_CFLAG=$app_cflag
451 LIB_CFLAG=$lib_cflag
452 SHLIB_CFLAG=$shl_cflag
453 APP_EX_OBJ=$app_ex_obj
454 SHLIB_EX_OBJ=$shlib_ex_obj
455 # add extra libraries to this define, for solaris -lsocket -lnsl would
456 # be added
457 EX_LIBS=$ex_libs
459 # The OpenSSL directory
460 SRC_D=$src_dir
462 LINK=$link
463 LFLAGS=$lflags
464 RSC=$rsc
466 # The output directory for everything intersting
467 OUT_D=$out_dir
468 # The output directory for all the temporary muck
469 TMP_D=$tmp_dir
470 # The output directory for the header files
471 INC_D=$inc_dir
472 INCO_D=$inc_dir${o}openssl
474 PERL=$perl
475 CP=$cp
476 RM=$rm
477 RANLIB=$ranlib
478 MKDIR=$mkdir
479 MKLIB=$bin_dir$mklib
480 MLFLAGS=$mlflags
481 ASM=$bin_dir$asm
483 # FIPS validated module and support file locations
485 FIPSDIR=$fipsdir
486 BASEADDR=$baseaddr
487 FIPSLIB_D=\$(FIPSDIR)${o}lib
488 FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c
489 O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib
490 FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep}
491 E_PREMAIN_DSO=fips_premain_dso
492 PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep
493 FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl
495 ######################################################
496 # You should not need to touch anything below this point
497 ######################################################
499 E_EXE=openssl
500 SSL=$ssl
501 CRYPTO=$crypto
503 # BIN_D - Binary output directory
504 # TEST_D - Binary test file output directory
505 # LIB_D - library output directory
506 # ENG_D - dynamic engine output directory
507 # Note: if you change these point to different directories then uncomment out
508 # the lines around the 'NB' comment below.
510 BIN_D=\$(OUT_D)
511 TEST_D=\$(OUT_D)
512 LIB_D=\$(OUT_D)
513 ENG_D=\$(OUT_D)
515 # INCL_D - local library directory
516 # OBJ_D - temp object file directory
517 OBJ_D=\$(TMP_D)
518 INCL_D=\$(TMP_D)
520 O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
521 O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
522 SO_SSL= $plib\$(SSL)$so_shlibp
523 SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
524 L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
525 L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
527 L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
529 ######################################################
530 # Don't touch anything below this point
531 ######################################################
533 INC=-I\$(INC_D) -I\$(INCL_D)
534 APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
535 LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
536 SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
537 LIBS_DEP=\$(O_CRYPTO) \$(O_SSL)
539 #############################################
542 $rules=<<"EOF";
543 all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets
545 banner:
546 $banner
548 \$(TMP_D):
549 \$(MKDIR) \"\$(TMP_D)\"
550 # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
551 #\$(BIN_D):
552 # \$(MKDIR) \$(BIN_D)
554 #\$(TEST_D):
555 # \$(MKDIR) \$(TEST_D)
557 \$(LIB_D):
558 \$(MKDIR) \"\$(LIB_D)\"
560 \$(INCO_D): \$(INC_D)
561 \$(MKDIR) \"\$(INCO_D)\"
563 \$(INC_D):
564 \$(MKDIR) \"\$(INC_D)\"
566 headers: \$(HEADER) \$(EXHEADER)
569 lib: \$(LIBS_DEP) \$(E_SHLIB)
571 exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep
573 install: all
574 \$(MKDIR) \"\$(INSTALLTOP)\"
575 \$(MKDIR) \"\$(INSTALLTOP)${o}bin\"
576 \$(MKDIR) \"\$(INSTALLTOP)${o}include\"
577 \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
578 \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
579 \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
580 \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
581 \$(MKDIR) \"\$(OPENSSLDIR)\"
582 \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
583 $extra_install
586 test: \$(T_EXE)
587 cd \$(BIN_D)
588 ..${o}ms${o}test
590 clean:
591 \$(RM) \$(TMP_D)$o*.*
593 vclean:
594 \$(RM) \$(TMP_D)$o*.*
595 \$(RM) \$(OUT_D)$o*.*
599 my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
600 $platform_cpp_symbol =~ s/-/_/g;
601 if (open(IN,"crypto/buildinf.h"))
603 # Remove entry for this platform in existing file buildinf.h.
605 my $old_buildinf_h = "";
606 while (<IN>)
608 if (/^\#ifdef $platform_cpp_symbol$/)
610 while (<IN>) { last if (/^\#endif/); }
612 else
614 $old_buildinf_h .= $_;
617 close(IN);
619 open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
620 print OUT $old_buildinf_h;
621 close(OUT);
624 open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
625 printf OUT <<EOF;
626 #ifdef $platform_cpp_symbol
627 /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
628 #define CFLAGS "$cc $cflags"
629 #define PLATFORM "$platform"
631 printf OUT " #define DATE \"%s\"\n", scalar gmtime();
632 printf OUT "#endif\n";
633 close(OUT);
635 # Strip of trailing ' '
636 foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
637 $test=&clean_up_ws($test);
638 $e_exe=&clean_up_ws($e_exe);
639 $exheader=&clean_up_ws($exheader);
640 $header=&clean_up_ws($header);
642 # First we strip the exheaders from the headers list
643 foreach (split(/\s+/,$exheader)){ $h{$_}=1; }
644 foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; }
645 chop($h); $header=$h;
647 $defs.=&do_defs("HEADER",$header,"\$(INCL_D)","");
648 $rules.=&do_copy_rule("\$(INCL_D)",$header,"");
650 $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)","");
651 $rules.=&do_copy_rule("\$(INCO_D)",$exheader,"");
653 $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
654 $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
656 $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
657 $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
659 # Special case rule for fips_premain_dso
661 if ($fips)
663 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
664 "\$(FIPS_PREMAIN_SRC)",
665 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", "");
666 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
669 foreach (values %lib_nam)
671 $lib_obj=$lib_obj{$_};
672 local($slib)=$shlib;
674 if (($_ eq "SSL") && $no_ssl2 && $no_ssl3)
676 $rules.="\$(O_SSL):\n\n";
677 next;
680 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
681 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
682 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
685 # hack to add version info on MSVC
686 if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A")
687 || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) {
688 $rules.= <<"EOF";
689 \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
690 \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
692 \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
693 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
698 $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
699 foreach (split(/\s+/,$test))
701 $t=&bname($_);
702 $tt="\$(OBJ_D)${o}$t${obj}";
703 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
706 $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
708 foreach (split(/\s+/,$engines))
710 $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib);
711 $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,"");
716 $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
718 if ($fips)
720 if ($shlib)
722 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
723 "\$(O_CRYPTO)", "$crypto",
724 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
726 else
728 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
729 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
730 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
731 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
734 else
736 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
737 "\$(SO_CRYPTO)");
740 foreach (split(" ",$otherlibs))
742 my $uc = $_;
743 $uc =~ tr /a-z/A-Z/;
744 $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, "");
748 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
750 print $defs;
752 if ($platform eq "linux-elf") {
753 print <<"EOF";
754 # Generate perlasm output files
755 %.cpp:
756 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F))
759 print "###################################################################\n";
760 print $rules;
762 ###############################################
763 # strip off any trailing .[och] and append the relative directory
764 # also remembering to do nothing if we are in one of the dropped
765 # directories
766 sub var_add
768 local($dir,$val,$keepext)=@_;
769 local(@a,$_,$ret);
771 return("") if $no_engine && $dir =~ /\/engine/;
772 return("") if $no_hw && $dir =~ /\/hw/;
773 return("") if $no_idea && $dir =~ /\/idea/;
774 return("") if $no_aes && $dir =~ /\/aes/;
775 return("") if $no_camellia && $dir =~ /\/camellia/;
776 return("") if $no_seed && $dir =~ /\/seed/;
777 return("") if $no_rc2 && $dir =~ /\/rc2/;
778 return("") if $no_rc4 && $dir =~ /\/rc4/;
779 return("") if $no_rc5 && $dir =~ /\/rc5/;
780 return("") if $no_rsa && $dir =~ /\/rsa/;
781 return("") if $no_rsa && $dir =~ /^rsaref/;
782 return("") if $no_dsa && $dir =~ /\/dsa/;
783 return("") if $no_dh && $dir =~ /\/dh/;
784 return("") if $no_ec && $dir =~ /\/ec/;
785 return("") if $no_gost && $dir =~ /\/ccgost/;
786 return("") if $no_cms && $dir =~ /\/cms/;
787 return("") if $no_jpake && $dir =~ /\/jpake/;
788 if ($no_des && $dir =~ /\/des/)
790 if ($val =~ /read_pwd/)
791 { return("$dir/read_pwd "); }
792 else
793 { return(""); }
795 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
796 return("") if $no_sock && $dir =~ /\/proxy/;
797 return("") if $no_bf && $dir =~ /\/bf/;
798 return("") if $no_cast && $dir =~ /\/cast/;
799 return("") if $no_whirlpool && $dir =~ /\/whrlpool/;
801 $val =~ s/^\s*(.*)\s*$/$1/;
802 @a=split(/\s+/,$val);
803 grep(s/\.[och]$//,@a) unless $keepext;
805 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
806 @a=grep(!/^e_.*_d$/,@a) if $no_des;
807 @a=grep(!/^e_.*_ae$/,@a) if $no_idea;
808 @a=grep(!/^e_.*_i$/,@a) if $no_aes;
809 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
810 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
811 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
812 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
813 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
814 @a=grep(!/^e_camellia$/,@a) if $no_camellia;
815 @a=grep(!/^e_seed$/,@a) if $no_seed;
817 #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
818 #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
820 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
822 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
823 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4;
824 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
825 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
827 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
828 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
829 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
831 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
832 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
834 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
836 @a=grep(!/_dhp$/,@a) if $no_dh;
838 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
839 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
840 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
842 @a=grep(!/(srp)/,@a) if $no_srp;
844 @a=grep(!/^engine$/,@a) if $no_engine;
845 @a=grep(!/^hw$/,@a) if $no_hw;
846 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
847 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
848 @a=grep(!/^gendsa$/,@a) if $no_sha1;
849 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
851 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
853 grep($_="$dir/$_",@a);
854 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
855 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
856 $ret=join(' ',@a)." ";
857 return($ret);
860 # change things so that each 'token' is only separated by one space
861 sub clean_up_ws
863 local($w)=@_;
865 $w =~ s/^\s*(.*)\s*$/$1/;
866 $w =~ s/\s+/ /g;
867 return($w);
870 sub do_defs
872 local($var,$files,$location,$postfix)=@_;
873 local($_,$ret,$pf);
874 local(*OUT,$tmp,$t);
876 $files =~ s/\//$o/g if $o ne '/';
877 $ret="$var=";
878 $n=1;
879 $Vars{$var}.="";
880 foreach (split(/ /,$files))
882 $orig=$_;
883 $_=&bname($_) unless /^\$/;
884 if ($n++ == 2)
886 $n=0;
887 $ret.="\\\n\t";
889 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
890 { $pf=".c"; }
891 else { $pf=$postfix; }
892 if ($_ =~ /BN_ASM/) { $t="$_ "; }
893 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
894 elsif ($_ =~ /AES_ASM/){ $t="$_ "; }
895 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
896 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
897 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
898 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
899 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
900 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
901 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
902 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
903 elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; }
904 elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; }
905 else { $t="$location${o}$_$pf "; }
907 $Vars{$var}.="$t ";
908 $ret.=$t;
910 # hack to add version info on MSVC
911 if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT")))
913 if ($var eq "CRYPTOOBJ")
914 { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
915 elsif ($var eq "SSLOBJ")
916 { $ret.="\$(OBJ_D)\\\$(SSL).res "; }
918 chomp($ret);
919 $ret.="\n\n";
920 return($ret);
923 # return the name with the leading path removed
924 sub bname
926 local($ret)=@_;
927 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
928 return($ret);
931 # return the leading path
932 sub dname
934 my $ret=shift;
935 $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/;
936 return($ret);
939 ##############################################################
940 # do a rule for each file that says 'compile' to new direcory
941 # compile the files in '$files' into $to
942 sub do_compile_rule
944 local($to,$files,$ex)=@_;
945 local($ret,$_,$n,$d,$s);
947 $files =~ s/\//$o/g if $o ne '/';
948 foreach (split(/\s+/,$files))
950 $n=&bname($_);
951 $d=&dname($_);
952 if (-f "${_}.c")
954 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
956 elsif (-f ($s="${d}${o}asm${o}${n}.pl") or
957 ($s=~s/sha256/sha512/ and -f $s) or
958 -f ($s="${d}${o}${n}.pl"))
960 $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n);
962 elsif (-f ($s="${d}${o}asm${o}${n}.S") or
963 -f ($s="${d}${o}${n}.S"))
965 $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n);
967 else { die "no rule for $_"; }
969 return($ret);
972 ##############################################################
973 # do a rule for each file that says 'compile' to new direcory
974 sub perlasm_compile_target
976 my($target,$source,$bname)=@_;
977 my($ret);
979 $bname =~ s/(.*)\.[^\.]$/$1/;
980 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
981 $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n";
982 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
983 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
984 return($ret);
987 sub Sasm_compile_target
989 my($target,$source,$bname)=@_;
990 my($ret);
992 $bname =~ s/(.*)\.[^\.]$/$1/;
993 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
994 $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n";
995 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
996 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
997 return($ret);
1000 sub cc_compile_target
1002 local($target,$source,$ex_flags, $srcd)=@_;
1003 local($ret);
1005 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
1006 $target =~ s/\//$o/g if $o ne "/";
1007 $source =~ s/\//$o/g if $o ne "/";
1008 $srcd = "\$(SRC_D)$o" unless defined $srcd;
1009 $ret ="$target: $srcd$source\n\t";
1010 $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n";
1011 return($ret);
1014 ##############################################################
1015 sub do_asm_rule
1017 local($target,$src)=@_;
1018 local($ret,@s,@t,$i);
1020 $target =~ s/\//$o/g if $o ne "/";
1021 $src =~ s/\//$o/g if $o ne "/";
1023 @t=split(/\s+/,$target);
1024 @s=split(/\s+/,$src);
1027 for ($i=0; $i<=$#s; $i++)
1029 my $objfile = $t[$i];
1030 my $srcfile = $s[$i];
1032 if ($perl_asm == 1)
1034 my $plasm = $objfile;
1035 $plasm =~ s/${obj}/.pl/;
1036 $ret.="$srcfile: $plasm\n";
1037 $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n";
1040 $ret.="$objfile: $srcfile\n";
1041 $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n";
1043 return($ret);
1046 sub do_shlib_rule
1048 local($n,$def)=@_;
1049 local($ret,$nn);
1050 local($t);
1052 ($nn=$n) =~ tr/a-z/A-Z/;
1053 $ret.="$n.dll: \$(${nn}OBJ)\n";
1054 if ($vc && $w32)
1056 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
1058 $ret.="\n";
1059 return($ret);
1062 # do a rule for each file that says 'copy' to new direcory on change
1063 sub do_copy_rule
1065 local($to,$files,$p)=@_;
1066 local($ret,$_,$n,$pp);
1068 $files =~ s/\//$o/g if $o ne '/';
1069 foreach (split(/\s+/,$files))
1071 $n=&bname($_);
1072 if ($n =~ /bss_file/)
1073 { $pp=".c"; }
1074 else { $pp=$p; }
1075 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
1077 return($ret);
1080 sub read_options
1082 # Many options are handled in a similar way. In particular
1083 # no-xxx sets zero or more scalars to 1.
1084 # Process these using a hash containing the option name and
1085 # reference to the scalars to set.
1087 my %valid_options = (
1088 "no-rc2" => \$no_rc2,
1089 "no-rc4" => \$no_rc4,
1090 "no-rc5" => \$no_rc5,
1091 "no-idea" => \$no_idea,
1092 "no-aes" => \$no_aes,
1093 "no-camellia" => \$no_camellia,
1094 "no-seed" => \$no_seed,
1095 "no-des" => \$no_des,
1096 "no-bf" => \$no_bf,
1097 "no-cast" => \$no_cast,
1098 "no-md2" => \$no_md2,
1099 "no-md4" => \$no_md4,
1100 "no-md5" => \$no_md5,
1101 "no-sha" => \$no_sha,
1102 "no-sha1" => \$no_sha1,
1103 "no-ripemd" => \$no_ripemd,
1104 "no-mdc2" => \$no_mdc2,
1105 "no-whirlpool" => \$no_whirlpool,
1106 "no-patents" =>
1107 [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa],
1108 "no-rsa" => \$no_rsa,
1109 "no-dsa" => \$no_dsa,
1110 "no-dh" => \$no_dh,
1111 "no-hmac" => \$no_hmac,
1112 "no-asm" => \$no_asm,
1113 "nasm" => \$nasm,
1114 "nw-nasm" => \$nw_nasm,
1115 "nw-mwasm" => \$nw_mwasm,
1116 "gaswin" => \$gaswin,
1117 "no-ssl2" => \$no_ssl2,
1118 "no-ssl3" => \$no_ssl3,
1119 "no-tlsext" => \$no_tlsext,
1120 "no-srp" => \$no_srp,
1121 "no-cms" => \$no_cms,
1122 "no-ec2m" => \$no_ec2m,
1123 "no-jpake" => \$no_jpake,
1124 "no-ec_nistp_64_gcc_128" => 0,
1125 "no-err" => \$no_err,
1126 "no-sock" => \$no_sock,
1127 "no-krb5" => \$no_krb5,
1128 "no-ec" => \$no_ec,
1129 "no-ecdsa" => \$no_ecdsa,
1130 "no-ecdh" => \$no_ecdh,
1131 "no-gost" => \$no_gost,
1132 "no-engine" => \$no_engine,
1133 "no-hw" => \$no_hw,
1134 "no-rsax" => 0,
1135 "just-ssl" =>
1136 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
1137 \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh,
1138 \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5,
1139 \$no_aes, \$no_camellia, \$no_seed, \$no_srp],
1140 "rsaref" => 0,
1141 "gcc" => \$gcc,
1142 "debug" => \$debug,
1143 "profile" => \$profile,
1144 "shlib" => \$shlib,
1145 "dll" => \$shlib,
1146 "shared" => 0,
1147 "no-sctp" => 0,
1148 "no-gmp" => 0,
1149 "no-rfc3779" => 0,
1150 "no-montasm" => 0,
1151 "no-shared" => 0,
1152 "no-store" => 0,
1153 "no-zlib" => 0,
1154 "no-zlib-dynamic" => 0,
1155 "fips" => \$fips
1158 if (exists $valid_options{$_})
1160 my $r = $valid_options{$_};
1161 if ( ref $r eq "SCALAR")
1162 { $$r = 1;}
1163 elsif ( ref $r eq "ARRAY")
1165 my $r2;
1166 foreach $r2 (@$r)
1168 $$r2 = 1;
1172 elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; }
1173 elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
1174 elsif (/^enable-zlib-dynamic$/)
1176 $zlib_opt = 2;
1178 elsif (/^no-static-engine/)
1180 $no_static_engine = 1;
1182 elsif (/^enable-static-engine/)
1184 $no_static_engine = 0;
1186 # There are also enable-xxx options which correspond to
1187 # the no-xxx. Since the scalars are enabled by default
1188 # these can be ignored.
1189 elsif (/^enable-/)
1191 my $t = $_;
1192 $t =~ s/^enable/no/;
1193 if (exists $valid_options{$t})
1194 {return 1;}
1195 return 0;
1197 # experimental-xxx is mostly like enable-xxx, but opensslconf.v
1198 # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx.
1199 # (No need to fail if we don't know the algorithm -- this is for adventurous users only.)
1200 elsif (/^experimental-/)
1202 my $algo, $ALGO;
1203 ($algo = $_) =~ s/^experimental-//;
1204 ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/;
1206 $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags";
1209 elsif (/^--with-krb5-flavor=(.*)$/)
1211 my $krb5_flavor = $1;
1212 if ($krb5_flavor =~ /^force-[Hh]eimdal$/)
1214 $xcflags="-DKRB5_HEIMDAL $xcflags";
1216 elsif ($krb5_flavor =~ /^MIT/i)
1218 $xcflags="-DKRB5_MIT $xcflags";
1219 if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i)
1221 $xcflags="-DKRB5_MIT_OLD11 $xcflags"
1225 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
1226 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1227 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1228 { $c_flags.="$_ "; }
1229 else { return(0); }
1230 return(1);