mk1mf.pl revision 298999
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 6# 7 8$INSTALLTOP="/usr/local/ssl"; 9$OPENSSLDIR="/usr/local/ssl"; 10$OPTIONS=""; 11$ssl_version=""; 12$banner="\t\@echo Building OpenSSL"; 13 14my $no_static_engine = 1; 15my $engines = ""; 16my $otherlibs = ""; 17local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic 18local $zlib_lib = ""; 19local $perl_asm = 0; # 1 to autobuild asm files from perl scripts 20 21my $ex_l_libs = ""; 22 23# Options to import from top level Makefile 24 25my %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, 48); 49 50 51open(IN,"<Makefile") || die "unable to open Makefile!\n"; 52while(<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; 57 } 58 } 59} 60close(IN); 61 62$debug = 1 if $mf_platform =~ /^debug-/; 63 64die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; 65 66$infile="MINFO"; 67 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" 87 ); 88 89$platform=""; 90my $xcflags=""; 91foreach (@ARGV) 92 { 93 if (!&read_options && !defined($ops{$_})) 94 { 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"; 101and [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) 127 128Values that can be set 129TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler 130 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) 134EOF 135 exit(1); 136 } 137 $platform=$_; 138 } 139foreach (grep(!/^$/, split(/ /, $OPTIONS))) 140 { 141 print STDERR "unknown option - $_\n" if !&read_options; 142 } 143 144$no_static_engine = 0 if (!$shlib); 145 146$no_mdc2=1 if ($no_des); 147 148$no_ssl3=1 if ($no_md5 || $no_sha); 149$no_ssl3=1 if ($no_rsa && $no_dh); 150 151$no_ssl2=1 if ($no_md5); 152$no_ssl2=1 if ($no_rsa); 153 154$out_def="out"; 155$inc_def="outinc"; 156$tmp_def="tmp"; 157 158$perl="perl" unless defined $perl; 159$mkdir="-mkdir" unless defined $mkdir; 160 161($ssl,$crypto)=("ssl","crypto"); 162$ranlib="echo ranlib"; 163 164$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; 165$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; 166$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; 167 168# $bin_dir.=$o causes a core dump on my sparc :-( 169 170 171$NT=0; 172 173push(@INC,"util/pl","pl"); 174 175if ($platform eq "auto") { 176 $platform = $mf_platform; 177 print STDERR "Imported platform $mf_platform\n"; 178} 179 180if (($platform =~ /VC-(.+)/)) 181 { 182 $FLAVOR=$1; 183 $NT = 1 if $1 eq "NT"; 184 require 'VC-32.pl'; 185 } 186elsif ($platform eq "Mingw32") 187 { 188 require 'Mingw32.pl'; 189 } 190elsif ($platform eq "Mingw32-files") 191 { 192 require 'Mingw32f.pl'; 193 } 194elsif ($platform eq "BC-NT") 195 { 196 $bc=1; 197 require 'BC-32.pl'; 198 } 199elsif ($platform eq "FreeBSD") 200 { 201 require 'unix.pl'; 202 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; 203 } 204elsif ($platform eq "linux-elf") 205 { 206 require "unix.pl"; 207 require "linux.pl"; 208 $unix=1; 209 } 210elsif ($platform eq "ultrix-mips") 211 { 212 require "unix.pl"; 213 require "ultrix.pl"; 214 $unix=1; 215 } 216elsif ($platform eq "OS2-EMX") 217 { 218 $wc=1; 219 require 'OS2-EMX.pl'; 220 } 221elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || 222 ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) 223 { 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'; 227 } 228else 229 { 230 require "unix.pl"; 231 232 $unix=1; 233 $cflags.=' -DTERMIO'; 234 } 235 236$fipsdir =~ s/\//${o}/g; 237 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; 241 242$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); 243 244$cflags= "$xcflags$cflags" if $xcflags ne ""; 245 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.=" -DOPENSSL_NO_WEAK_SSL_CIPHERS" if $no_weak_ssl; 285$cflags.=" -DZLIB" if $zlib_opt; 286$cflags.=" -DZLIB_SHARED" if $zlib_opt == 2; 287$cflags.=" -DOPENSSL_NO_COMP" if $no_comp; 288 289if ($no_static_engine) 290 { 291 $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; 292 } 293else 294 { 295 $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; 296 } 297 298#$cflags.=" -DRSAref" if $rsaref ne ""; 299 300## if ($unix) 301## { $cflags="$c_flags" if ($c_flags ne ""); } 302##else 303 { $cflags="$c_flags$cflags" if ($c_flags ne ""); } 304 305$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); 306 307 308%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", 309 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); 310 311if ($msdos) 312 { 313 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; 314 $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; 315 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; 316 $banner.="\t\@echo documentation for details.\n"; 317 } 318 319# have to do this to allow $(CC) under unix 320$link="$bin_dir$link" if ($link !~ /^\$/); 321 322$INSTALLTOP =~ s|/|$o|g; 323$OPENSSLDIR =~ s|/|$o|g; 324 325############################################# 326# We parse in input file and 'store' info for later printing. 327open(IN,"<$infile") || die "unable to open $infile:$!\n"; 328$_=<IN>; 329for (;;) 330 { 331 s/\s*$//; # was chop, didn't work in mixture of perls for Windows... 332 333 ($key,$val)=/^([^=]+)=(.*)/; 334 if ($key eq "RELATIVE_DIRECTORY") 335 { 336 if ($lib ne "") 337 { 338 $uc=$lib; 339 $uc =~ s/^lib(.*)\.a/$1/; 340 $uc =~ tr/a-z/A-Z/; 341 $lib_nam{$uc}=$uc; 342 $lib_obj{$uc}.=$libobj." "; 343 } 344 last if ($val eq "FINISHED"); 345 $lib=""; 346 $libobj=""; 347 $dir=$val; 348 } 349 350 if ($key eq "KRB5_INCLUDES") 351 { $cflags .= " $val";} 352 353 if ($key eq "ZLIB_INCLUDE") 354 { $cflags .= " $val" if $val ne "";} 355 356 if ($key eq "LIBZLIB") 357 { $zlib_lib = "$val" if $val ne "";} 358 359 if ($key eq "LIBKRB5") 360 { $ex_libs .= " $val" if $val ne "";} 361 362 if ($key eq "TEST") 363 { $test.=&var_add($dir,$val, 0); } 364 365 if (($key eq "PROGS") || ($key eq "E_OBJ")) 366 { $e_exe.=&var_add($dir,$val, 0); } 367 368 if ($key eq "LIB") 369 { 370 $lib=$val; 371 $lib =~ s/^.*\/([^\/]+)$/$1/; 372 } 373 if ($key eq "LIBNAME" && $no_static_engine) 374 { 375 $lib=$val; 376 $lib =~ s/^.*\/([^\/]+)$/$1/; 377 $otherlibs .= " $lib"; 378 } 379 380 if ($key eq "EXHEADER") 381 { $exheader.=&var_add($dir,$val, 1); } 382 383 if ($key eq "HEADER") 384 { $header.=&var_add($dir,$val, 1); } 385 386 if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) 387 { $libobj=&var_add($dir,$val, 0); } 388 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) 389 { $engines.=$val } 390 391 if (!($_=<IN>)) 392 { $_="RELATIVE_DIRECTORY=FINISHED\n"; } 393 } 394close(IN); 395 396if ($shlib) 397 { 398 $extra_install= <<"EOF"; 399 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" 400 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" 401 \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" 402 \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" 403EOF 404 if ($no_static_engine) 405 { 406 $extra_install .= <<"EOF" 407 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" 408 \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" 409EOF 410 } 411 } 412else 413 { 414 $extra_install= <<"EOF"; 415 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" 416 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" 417EOF 418 $ex_libs .= " $zlib_lib" if $zlib_opt == 1; 419 if ($fips) 420 { 421 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; 422 $ex_l_libs .= " \$(O_FIPSCANISTER)"; 423 } 424 } 425 426$defs= <<"EOF"; 427# This makefile has been automatically generated from the OpenSSL distribution. 428# This single makefile will build the complete OpenSSL distribution and 429# by default leave the 'interesting' output files in .${o}out and the stuff 430# that needs deleting in .${o}tmp. 431# The file was generated by running 'make makefile.one', which 432# does a 'make files', which writes all the environment variables from all 433# the makefiles to the file call MINFO. This file is used by 434# util${o}mk1mf.pl to generate makefile.one. 435# The 'makefile per directory' system suites me when developing this 436# library and also so I can 'distribute' indervidual library sections. 437# The one monster makefile better suits building in non-unix 438# environments. 439 440EOF 441 442$defs .= $preamble if defined $preamble; 443 444$defs.= <<"EOF"; 445INSTALLTOP=$INSTALLTOP 446OPENSSLDIR=$OPENSSLDIR 447 448# Set your compiler options 449PLATFORM=$platform 450CC=$bin_dir${cc} 451CFLAG=$cflags 452APP_CFLAG=$app_cflag 453LIB_CFLAG=$lib_cflag 454SHLIB_CFLAG=$shl_cflag 455APP_EX_OBJ=$app_ex_obj 456SHLIB_EX_OBJ=$shlib_ex_obj 457# add extra libraries to this define, for solaris -lsocket -lnsl would 458# be added 459EX_LIBS=$ex_libs 460 461# The OpenSSL directory 462SRC_D=$src_dir 463 464LINK_CMD=$link 465LFLAGS=$lflags 466RSC=$rsc 467 468# The output directory for everything intersting 469OUT_D=$out_dir 470# The output directory for all the temporary muck 471TMP_D=$tmp_dir 472# The output directory for the header files 473INC_D=$inc_dir 474INCO_D=$inc_dir${o}openssl 475 476PERL=$perl 477CP=$cp 478RM=$rm 479RANLIB=$ranlib 480MKDIR=$mkdir 481MKLIB=$bin_dir$mklib 482MLFLAGS=$mlflags 483ASM=$bin_dir$asm 484 485# FIPS validated module and support file locations 486 487FIPSDIR=$fipsdir 488BASEADDR=$baseaddr 489FIPSLIB_D=\$(FIPSDIR)${o}lib 490FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c 491O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib 492FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} 493E_PREMAIN_DSO=fips_premain_dso 494PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep 495FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl 496 497###################################################### 498# You should not need to touch anything below this point 499###################################################### 500 501E_EXE=openssl 502SSL=$ssl 503CRYPTO=$crypto 504 505# BIN_D - Binary output directory 506# TEST_D - Binary test file output directory 507# LIB_D - library output directory 508# ENG_D - dynamic engine output directory 509# Note: if you change these point to different directories then uncomment out 510# the lines around the 'NB' comment below. 511# 512BIN_D=\$(OUT_D) 513TEST_D=\$(OUT_D) 514LIB_D=\$(OUT_D) 515ENG_D=\$(OUT_D) 516 517# INCL_D - local library directory 518# OBJ_D - temp object file directory 519OBJ_D=\$(TMP_D) 520INCL_D=\$(TMP_D) 521 522O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp 523O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp 524SO_SSL= $plib\$(SSL)$so_shlibp 525SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp 526L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp 527L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp 528 529L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs 530 531###################################################### 532# Don't touch anything below this point 533###################################################### 534 535INC=-I\$(INC_D) -I\$(INCL_D) 536APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) 537LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) 538SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) 539LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) 540 541############################################# 542EOF 543 544$rules=<<"EOF"; 545all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets 546 547banner: 548$banner 549 550\$(TMP_D): 551 \$(MKDIR) \"\$(TMP_D)\" 552# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different 553#\$(BIN_D): 554# \$(MKDIR) \$(BIN_D) 555# 556#\$(TEST_D): 557# \$(MKDIR) \$(TEST_D) 558 559\$(LIB_D): 560 \$(MKDIR) \"\$(LIB_D)\" 561 562\$(INCO_D): \$(INC_D) 563 \$(MKDIR) \"\$(INCO_D)\" 564 565\$(INC_D): 566 \$(MKDIR) \"\$(INC_D)\" 567 568headers: \$(HEADER) \$(EXHEADER) 569 @ 570 571lib: \$(LIBS_DEP) \$(E_SHLIB) 572 573exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep 574 575install: all 576 \$(MKDIR) \"\$(INSTALLTOP)\" 577 \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" 578 \$(MKDIR) \"\$(INSTALLTOP)${o}include\" 579 \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" 580 \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" 581 \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" 582 \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" 583 \$(MKDIR) \"\$(OPENSSLDIR)\" 584 \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" 585$extra_install 586 587 588test: \$(T_EXE) 589 cd \$(BIN_D) 590 ..${o}ms${o}test 591 592clean: 593 \$(RM) \$(TMP_D)$o*.* 594 595vclean: 596 \$(RM) \$(TMP_D)$o*.* 597 \$(RM) \$(OUT_D)$o*.* 598 599EOF 600 601my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; 602$platform_cpp_symbol =~ s/-/_/g; 603if (open(IN,"crypto/buildinf.h")) 604 { 605 # Remove entry for this platform in existing file buildinf.h. 606 607 my $old_buildinf_h = ""; 608 while (<IN>) 609 { 610 if (/^\#ifdef $platform_cpp_symbol$/) 611 { 612 while (<IN>) { last if (/^\#endif/); } 613 } 614 else 615 { 616 $old_buildinf_h .= $_; 617 } 618 } 619 close(IN); 620 621 open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; 622 print OUT $old_buildinf_h; 623 close(OUT); 624 } 625 626open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; 627printf OUT <<EOF; 628#ifdef $platform_cpp_symbol 629 /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ 630 #define CFLAGS "compiler: $cc $cflags" 631 #define PLATFORM "$platform" 632EOF 633printf OUT " #define DATE \"%s\"\n", scalar gmtime(); 634printf OUT "#endif\n"; 635close(OUT); 636 637# Strip of trailing ' ' 638foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } 639$test=&clean_up_ws($test); 640$e_exe=&clean_up_ws($e_exe); 641$exheader=&clean_up_ws($exheader); 642$header=&clean_up_ws($header); 643 644# First we strip the exheaders from the headers list 645foreach (split(/\s+/,$exheader)){ $h{$_}=1; } 646foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } 647chop($h); $header=$h; 648 649$defs.=&do_defs("HEADER",$header,"\$(INCL_D)",""); 650$rules.=&do_copy_rule("\$(INCL_D)",$header,""); 651 652$defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",""); 653$rules.=&do_copy_rule("\$(INCO_D)",$exheader,""); 654 655$defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); 656$rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); 657 658$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); 659$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); 660 661# Special case rule for fips_premain_dso 662 663if ($fips) 664 { 665 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", 666 "\$(FIPS_PREMAIN_SRC)", 667 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", ""); 668 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); 669 } 670 671foreach (values %lib_nam) 672 { 673 $lib_obj=$lib_obj{$_}; 674 local($slib)=$shlib; 675 676 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); 677 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; 678 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); 679 } 680 681# hack to add version info on MSVC 682if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") 683 || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { 684 $rules.= <<"EOF"; 685\$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc 686 \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc 687 688\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc 689 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc 690 691EOF 692} 693 694$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); 695foreach (split(/\s+/,$test)) 696 { 697 $t=&bname($_); 698 $tt="\$(OBJ_D)${o}$t${obj}"; 699 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); 700 } 701 702$defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp); 703 704foreach (split(/\s+/,$engines)) 705 { 706 $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib); 707 $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,""); 708 } 709 710 711 712$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); 713 714if ($fips) 715 { 716 if ($shlib) 717 { 718 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", 719 "\$(O_CRYPTO)", "$crypto", 720 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); 721 } 722 else 723 { 724 $rules.= &do_lib_rule("\$(CRYPTOOBJ)", 725 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); 726 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", 727 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); 728 } 729 } 730 else 731 { 732 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, 733 "\$(SO_CRYPTO)"); 734 } 735 736foreach (split(" ",$otherlibs)) 737 { 738 my $uc = $_; 739 $uc =~ tr /a-z/A-Z/; 740 $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, ""); 741 742 } 743 744$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); 745 746print $defs; 747 748if ($platform eq "linux-elf") { 749 print <<"EOF"; 750# Generate perlasm output files 751%.cpp: 752 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) 753EOF 754} 755print "###################################################################\n"; 756print $rules; 757 758############################################### 759# strip off any trailing .[och] and append the relative directory 760# also remembering to do nothing if we are in one of the dropped 761# directories 762sub var_add 763 { 764 local($dir,$val,$keepext)=@_; 765 local(@a,$_,$ret); 766 767 return("") if $no_engine && $dir =~ /\/engine/; 768 return("") if $no_hw && $dir =~ /\/hw/; 769 return("") if $no_idea && $dir =~ /\/idea/; 770 return("") if $no_aes && $dir =~ /\/aes/; 771 return("") if $no_camellia && $dir =~ /\/camellia/; 772 return("") if $no_seed && $dir =~ /\/seed/; 773 return("") if $no_rc2 && $dir =~ /\/rc2/; 774 return("") if $no_rc4 && $dir =~ /\/rc4/; 775 return("") if $no_rc5 && $dir =~ /\/rc5/; 776 return("") if $no_rsa && $dir =~ /\/rsa/; 777 return("") if $no_rsa && $dir =~ /^rsaref/; 778 return("") if $no_dsa && $dir =~ /\/dsa/; 779 return("") if $no_dh && $dir =~ /\/dh/; 780 return("") if $no_ec && $dir =~ /\/ec/; 781 return("") if $no_gost && $dir =~ /\/ccgost/; 782 return("") if $no_cms && $dir =~ /\/cms/; 783 return("") if $no_jpake && $dir =~ /\/jpake/; 784 return("") if $no_comp && $dir =~ /\/comp/; 785 if ($no_des && $dir =~ /\/des/) 786 { 787 if ($val =~ /read_pwd/) 788 { return("$dir/read_pwd "); } 789 else 790 { return(""); } 791 } 792 return("") if $no_mdc2 && $dir =~ /\/mdc2/; 793 return("") if $no_sock && $dir =~ /\/proxy/; 794 return("") if $no_bf && $dir =~ /\/bf/; 795 return("") if $no_cast && $dir =~ /\/cast/; 796 return("") if $no_whirlpool && $dir =~ /\/whrlpool/; 797 798 $val =~ s/^\s*(.*)\s*$/$1/; 799 @a=split(/\s+/,$val); 800 grep(s/\.[och]$//,@a) unless $keepext; 801 802 @a=grep(!/^e_.*_3d$/,@a) if $no_des; 803 @a=grep(!/^e_.*_d$/,@a) if $no_des; 804 @a=grep(!/^e_.*_ae$/,@a) if $no_idea; 805 @a=grep(!/^e_.*_i$/,@a) if $no_aes; 806 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2; 807 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5; 808 @a=grep(!/^e_.*_bf$/,@a) if $no_bf; 809 @a=grep(!/^e_.*_c$/,@a) if $no_cast; 810 @a=grep(!/^e_rc4$/,@a) if $no_rc4; 811 @a=grep(!/^e_camellia$/,@a) if $no_camellia; 812 @a=grep(!/^e_seed$/,@a) if $no_seed; 813 814 #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; 815 #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; 816 817 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; 818 819 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; 820 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; 821 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; 822 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd; 823 824 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; 825 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; 826 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa; 827 828 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa; 829 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa; 830 831 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4; 832 833 @a=grep(!/_dhp$/,@a) if $no_dh; 834 835 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha; 836 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; 837 @a=grep(!/_mdc2$/,@a) if $no_mdc2; 838 839 @a=grep(!/(srp)/,@a) if $no_srp; 840 841 @a=grep(!/^engine$/,@a) if $no_engine; 842 @a=grep(!/^hw$/,@a) if $no_hw; 843 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; 844 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; 845 @a=grep(!/^gendsa$/,@a) if $no_sha1; 846 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; 847 848 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; 849 850 grep($_="$dir/$_",@a); 851 @a=grep(!/(^|\/)s_/,@a) if $no_sock; 852 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock; 853 $ret=join(' ',@a)." "; 854 return($ret); 855 } 856 857# change things so that each 'token' is only separated by one space 858sub clean_up_ws 859 { 860 local($w)=@_; 861 862 $w =~ s/^\s*(.*)\s*$/$1/; 863 $w =~ s/\s+/ /g; 864 return($w); 865 } 866 867sub do_defs 868 { 869 local($var,$files,$location,$postfix)=@_; 870 local($_,$ret,$pf); 871 local(*OUT,$tmp,$t); 872 873 $files =~ s/\//$o/g if $o ne '/'; 874 $ret="$var="; 875 $n=1; 876 $Vars{$var}.=""; 877 foreach (split(/ /,$files)) 878 { 879 $orig=$_; 880 $_=&bname($_) unless /^\$/; 881 if ($n++ == 2) 882 { 883 $n=0; 884 $ret.="\\\n\t"; 885 } 886 if (($_ =~ /bss_file/) && ($postfix eq ".h")) 887 { $pf=".c"; } 888 else { $pf=$postfix; } 889 if ($_ =~ /BN_ASM/) { $t="$_ "; } 890 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } 891 elsif ($_ =~ /AES_ASM/){ $t="$_ "; } 892 elsif ($_ =~ /DES_ENC/) { $t="$_ "; } 893 elsif ($_ =~ /BF_ENC/) { $t="$_ "; } 894 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } 895 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; } 896 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } 897 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } 898 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } 899 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } 900 elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } 901 elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } 902 else { $t="$location${o}$_$pf "; } 903 904 $Vars{$var}.="$t "; 905 $ret.=$t; 906 } 907 # hack to add version info on MSVC 908 if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) 909 { 910 if ($var eq "CRYPTOOBJ") 911 { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } 912 elsif ($var eq "SSLOBJ") 913 { $ret.="\$(OBJ_D)\\\$(SSL).res "; } 914 } 915 chomp($ret); 916 $ret.="\n\n"; 917 return($ret); 918 } 919 920# return the name with the leading path removed 921sub bname 922 { 923 local($ret)=@_; 924 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/; 925 return($ret); 926 } 927 928# return the leading path 929sub dname 930 { 931 my $ret=shift; 932 $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; 933 return($ret); 934 } 935 936############################################################## 937# do a rule for each file that says 'compile' to new direcory 938# compile the files in '$files' into $to 939sub do_compile_rule 940 { 941 local($to,$files,$ex)=@_; 942 local($ret,$_,$n,$d,$s); 943 944 $files =~ s/\//$o/g if $o ne '/'; 945 foreach (split(/\s+/,$files)) 946 { 947 $n=&bname($_); 948 $d=&dname($_); 949 if (-f "${_}.c") 950 { 951 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) 952 } 953 elsif (-f ($s="${d}${o}asm${o}${n}.pl") or 954 ($s=~s/sha256/sha512/ and -f $s) or 955 -f ($s="${d}${o}${n}.pl")) 956 { 957 $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n); 958 } 959 elsif (-f ($s="${d}${o}asm${o}${n}.S") or 960 -f ($s="${d}${o}${n}.S")) 961 { 962 $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n); 963 } 964 else { die "no rule for $_"; } 965 } 966 return($ret); 967 } 968 969############################################################## 970# do a rule for each file that says 'compile' to new direcory 971sub perlasm_compile_target 972 { 973 my($target,$source,$bname)=@_; 974 my($ret); 975 976 $bname =~ s/(.*)\.[^\.]$/$1/; 977 $ret ="\$(TMP_D)$o$bname.asm: $source\n"; 978 $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n"; 979 $ret.="$target: \$(TMP_D)$o$bname.asm\n"; 980 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; 981 return($ret); 982 } 983 984sub Sasm_compile_target 985 { 986 my($target,$source,$bname)=@_; 987 my($ret); 988 989 $bname =~ s/(.*)\.[^\.]$/$1/; 990 $ret ="\$(TMP_D)$o$bname.asm: $source\n"; 991 $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n"; 992 $ret.="$target: \$(TMP_D)$o$bname.asm\n"; 993 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; 994 return($ret); 995 } 996 997sub cc_compile_target 998 { 999 local($target,$source,$ex_flags, $srcd)=@_; 1000 local($ret); 1001 1002 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); 1003 $target =~ s/\//$o/g if $o ne "/"; 1004 $source =~ s/\//$o/g if $o ne "/"; 1005 $srcd = "\$(SRC_D)$o" unless defined $srcd; 1006 $ret ="$target: $srcd$source\n\t"; 1007 $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n"; 1008 return($ret); 1009 } 1010 1011############################################################## 1012sub do_asm_rule 1013 { 1014 local($target,$src)=@_; 1015 local($ret,@s,@t,$i); 1016 1017 $target =~ s/\//$o/g if $o ne "/"; 1018 $src =~ s/\//$o/g if $o ne "/"; 1019 1020 @t=split(/\s+/,$target); 1021 @s=split(/\s+/,$src); 1022 1023 1024 for ($i=0; $i<=$#s; $i++) 1025 { 1026 my $objfile = $t[$i]; 1027 my $srcfile = $s[$i]; 1028 1029 if ($perl_asm == 1) 1030 { 1031 my $plasm = $objfile; 1032 $plasm =~ s/${obj}/.pl/; 1033 $ret.="$srcfile: $plasm\n"; 1034 $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n"; 1035 } 1036 1037 $ret.="$objfile: $srcfile\n"; 1038 $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n"; 1039 } 1040 return($ret); 1041 } 1042 1043sub do_shlib_rule 1044 { 1045 local($n,$def)=@_; 1046 local($ret,$nn); 1047 local($t); 1048 1049 ($nn=$n) =~ tr/a-z/A-Z/; 1050 $ret.="$n.dll: \$(${nn}OBJ)\n"; 1051 if ($vc && $w32) 1052 { 1053 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n"; 1054 } 1055 $ret.="\n"; 1056 return($ret); 1057 } 1058 1059# do a rule for each file that says 'copy' to new direcory on change 1060sub do_copy_rule 1061 { 1062 local($to,$files,$p)=@_; 1063 local($ret,$_,$n,$pp); 1064 1065 $files =~ s/\//$o/g if $o ne '/'; 1066 foreach (split(/\s+/,$files)) 1067 { 1068 $n=&bname($_); 1069 if ($n =~ /bss_file/) 1070 { $pp=".c"; } 1071 else { $pp=$p; } 1072 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; 1073 } 1074 return($ret); 1075 } 1076 1077# Options picked up from the OPTIONS line in the top level Makefile 1078# generated by Configure. 1079 1080sub read_options 1081 { 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 the %valid_options hash containing the option 1085 # name and reference to the scalars to set. In some cases the option 1086 # needs no special handling and can be ignored: this is done by 1087 # setting the value to 0. 1088 1089 my %valid_options = ( 1090 "no-rc2" => \$no_rc2, 1091 "no-rc4" => \$no_rc4, 1092 "no-rc5" => \$no_rc5, 1093 "no-idea" => \$no_idea, 1094 "no-aes" => \$no_aes, 1095 "no-camellia" => \$no_camellia, 1096 "no-seed" => \$no_seed, 1097 "no-des" => \$no_des, 1098 "no-bf" => \$no_bf, 1099 "no-cast" => \$no_cast, 1100 "no-md2" => \$no_md2, 1101 "no-md4" => \$no_md4, 1102 "no-md5" => \$no_md5, 1103 "no-sha" => \$no_sha, 1104 "no-sha1" => \$no_sha1, 1105 "no-ripemd" => \$no_ripemd, 1106 "no-mdc2" => \$no_mdc2, 1107 "no-whirlpool" => \$no_whirlpool, 1108 "no-patents" => 1109 [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], 1110 "no-rsa" => \$no_rsa, 1111 "no-dsa" => \$no_dsa, 1112 "no-dh" => \$no_dh, 1113 "no-hmac" => \$no_hmac, 1114 "no-asm" => \$no_asm, 1115 "nasm" => \$nasm, 1116 "nw-nasm" => \$nw_nasm, 1117 "nw-mwasm" => \$nw_mwasm, 1118 "gaswin" => \$gaswin, 1119 "no-ssl2" => \$no_ssl2, 1120 "no-ssl2-method" => 0, 1121 "no-ssl3" => \$no_ssl3, 1122 "no-ssl3-method" => 0, 1123 "no-tlsext" => \$no_tlsext, 1124 "no-srp" => \$no_srp, 1125 "no-cms" => \$no_cms, 1126 "no-ec2m" => \$no_ec2m, 1127 "no-jpake" => \$no_jpake, 1128 "no-ec_nistp_64_gcc_128" => 0, 1129 "no-weak-ssl-ciphers" => \$no_weak_ssl, 1130 "no-err" => \$no_err, 1131 "no-sock" => \$no_sock, 1132 "no-krb5" => \$no_krb5, 1133 "no-ec" => \$no_ec, 1134 "no-ecdsa" => \$no_ecdsa, 1135 "no-ecdh" => \$no_ecdh, 1136 "no-gost" => \$no_gost, 1137 "no-engine" => \$no_engine, 1138 "no-hw" => \$no_hw, 1139 "no-rsax" => 0, 1140 "just-ssl" => 1141 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, 1142 \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, 1143 \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, 1144 \$no_aes, \$no_camellia, \$no_seed, \$no_srp], 1145 "rsaref" => 0, 1146 "gcc" => \$gcc, 1147 "debug" => \$debug, 1148 "profile" => \$profile, 1149 "shlib" => \$shlib, 1150 "dll" => \$shlib, 1151 "shared" => 0, 1152 "no-sctp" => 0, 1153 "no-srtp" => 0, 1154 "no-gmp" => 0, 1155 "no-rfc3779" => 0, 1156 "no-montasm" => 0, 1157 "no-shared" => 0, 1158 "no-store" => 0, 1159 "no-unit-test" => 0, 1160 "no-zlib" => 0, 1161 "no-zlib-dynamic" => 0, 1162 "no-comp" => \$no_comp, 1163 "fips" => \$fips 1164 ); 1165 1166 if (exists $valid_options{$_}) 1167 { 1168 my $r = $valid_options{$_}; 1169 if ( ref $r eq "SCALAR") 1170 { $$r = 1;} 1171 elsif ( ref $r eq "ARRAY") 1172 { 1173 my $r2; 1174 foreach $r2 (@$r) 1175 { 1176 $$r2 = 1; 1177 } 1178 } 1179 } 1180 elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } 1181 elsif (/^enable-zlib-dynamic$/) 1182 { 1183 $zlib_opt = 2; 1184 } 1185 elsif (/^no-static-engine/) 1186 { 1187 $no_static_engine = 1; 1188 } 1189 elsif (/^enable-static-engine/) 1190 { 1191 $no_static_engine = 0; 1192 } 1193 # There are also enable-xxx options which correspond to 1194 # the no-xxx. Since the scalars are enabled by default 1195 # these can be ignored. 1196 elsif (/^enable-/) 1197 { 1198 my $t = $_; 1199 $t =~ s/^enable/no/; 1200 if (exists $valid_options{$t}) 1201 {return 1;} 1202 return 0; 1203 } 1204 # experimental-xxx is mostly like enable-xxx, but opensslconf.v 1205 # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. 1206 # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) 1207 elsif (/^experimental-/) 1208 { 1209 my $algo, $ALGO; 1210 ($algo = $_) =~ s/^experimental-//; 1211 ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; 1212 1213 $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; 1214 1215 } 1216 elsif (/^--with-krb5-flavor=(.*)$/) 1217 { 1218 my $krb5_flavor = $1; 1219 if ($krb5_flavor =~ /^force-[Hh]eimdal$/) 1220 { 1221 $xcflags="-DKRB5_HEIMDAL $xcflags"; 1222 } 1223 elsif ($krb5_flavor =~ /^MIT/i) 1224 { 1225 $xcflags="-DKRB5_MIT $xcflags"; 1226 if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) 1227 { 1228 $xcflags="-DKRB5_MIT_OLD11 $xcflags" 1229 } 1230 } 1231 } 1232 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } 1233 elsif (/^-[lL].*$/) { $l_flags.="$_ "; } 1234 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) 1235 { $c_flags.="$_ "; } 1236 else { return(0); } 1237 return(1); 1238 } 1239