Configure 103 KB
Newer Older
1 2
#!/usr/bin/perl
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4
#
5 6 7
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 9 10
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
11 12 13 14 15 16 17 18 19

# Configure
#
# This script builds nmake and visual studio build files
#

require 5.000;
use strict;
use File::Spec;
20
use Cwd;
21 22 23

# files to configure

24
my $configfile = "..\\config.h";
25
my $platformfile = "..\\lib\\isc\\win32\\include\\isc\\platform.h";
26 27
my $confshfile = "..\\bin\\tests\\system\\conf.sh";
my $icshfile = "..\\isc-config.sh";
28

29
my @filelist = ("..\\bin\\python\\dnssec-checkds.py",
30
                "..\\bin\\python\\dnssec-coverage.py",
31
                "..\\bin\\python\\dnssec-keymgr.py",
32 33 34 35 36 37 38 39 40 41 42 43 44 45
                "..\\bin\\python\\isc\\__init__.py",
                "..\\bin\\python\\isc\\checkds.py",
                "..\\bin\\python\\isc\\coverage.py",
                "..\\bin\\python\\isc\\dnskey.py",
                "..\\bin\\python\\isc\\eventlist.py",
                "..\\bin\\python\\isc\\keydict.py",
                "..\\bin\\python\\isc\\keyevent.py",
                "..\\bin\\python\\isc\\keymgr.py",
                "..\\bin\\python\\isc\\keyseries.py",
                "..\\bin\\python\\isc\\keyzone.py",
                "..\\bin\\python\\isc\\policy.py",
                "..\\bin\\python\\isc\\rndc.py",
                "..\\bin\\python\\isc\\tests\\dnskey_test.py",
                "..\\bin\\python\\isc\\tests\\policy_test.py",
46
                "..\\bin\\python\\isc\\utils.py",
47
                "..\\bin\\tests\\system\\dlz\\prereq.sh",
48
                "..\\lib\\dns\\win32\\libdns.def",
49
                "..\\lib\\isc\\win32\\libisc.def");
50 51 52 53 54 55 56 57 58 59 60 61 62

my @projectlist = ("..\\bin\\check\\win32\\checkconf.vcxproj",
                   "..\\bin\\check\\win32\\checkconf.vcxproj.filters",
                   "..\\bin\\check\\win32\\checktool.vcxproj",
                   "..\\bin\\check\\win32\\checktool.vcxproj.filters",
                   "..\\bin\\check\\win32\\checkzone.vcxproj",
                   "..\\bin\\check\\win32\\checkzone.vcxproj.filters",
                   "..\\bin\\confgen\\win32\\confgentool.vcxproj",
                   "..\\bin\\confgen\\win32\\confgentool.vcxproj.filters",
                   "..\\bin\\confgen\\win32\\ddnsconfgen.vcxproj",
                   "..\\bin\\confgen\\win32\\ddnsconfgen.vcxproj.filters",
                   "..\\bin\\confgen\\win32\\rndcconfgen.vcxproj",
                   "..\\bin\\confgen\\win32\\rndcconfgen.vcxproj.filters",
63 64
                   "..\\bin\\delv\\win32\\delv.vcxproj",
                   "..\\bin\\delv\\win32\\delv.vcxproj.filters",
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
                   "..\\bin\\dig\\win32\\dig.vcxproj",
                   "..\\bin\\dig\\win32\\dig.vcxproj.filters",
                   "..\\bin\\dig\\win32\\dighost.vcxproj",
                   "..\\bin\\dig\\win32\\dighost.vcxproj.filters",
                   "..\\bin\\dig\\win32\\host.vcxproj",
                   "..\\bin\\dig\\win32\\host.vcxproj.filters",
                   "..\\bin\\dig\\win32\\nslookup.vcxproj",
                   "..\\bin\\dig\\win32\\nslookup.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\dnssectool.vcxproj",
                   "..\\bin\\dnssec\\win32\\dnssectool.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\dsfromkey.vcxproj",
                   "..\\bin\\dnssec\\win32\\dsfromkey.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\importkey.vcxproj",
                   "..\\bin\\dnssec\\win32\\importkey.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\keyfromlabel.vcxproj",
                   "..\\bin\\dnssec\\win32\\keyfromlabel.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\keygen.vcxproj",
                   "..\\bin\\dnssec\\win32\\keygen.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\revoke.vcxproj",
                   "..\\bin\\dnssec\\win32\\revoke.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\settime.vcxproj",
                   "..\\bin\\dnssec\\win32\\settime.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\signzone.vcxproj",
                   "..\\bin\\dnssec\\win32\\signzone.vcxproj.filters",
                   "..\\bin\\dnssec\\win32\\verify.vcxproj",
                   "..\\bin\\dnssec\\win32\\verify.vcxproj.filters",
                   "..\\bin\\named\\win32\\named.vcxproj",
                   "..\\bin\\named\\win32\\named.vcxproj.filters",
                   "..\\bin\\nsupdate\\win32\\nsupdate.vcxproj",
                   "..\\bin\\nsupdate\\win32\\nsupdate.vcxproj.filters",
                   "..\\bin\\pkcs11\\win32\\pk11destroy.vcxproj",
                   "..\\bin\\pkcs11\\win32\\pk11destroy.vcxproj.filters",
                   "..\\bin\\pkcs11\\win32\\pk11keygen.vcxproj",
                   "..\\bin\\pkcs11\\win32\\pk11keygen.vcxproj.filters",
                   "..\\bin\\pkcs11\\win32\\pk11list.vcxproj",
                   "..\\bin\\pkcs11\\win32\\pk11list.vcxproj.filters",
Evan Hunt's avatar
Evan Hunt committed
101 102
                   "..\\bin\\pkcs11\\win32\\pk11tokens.vcxproj",
                   "..\\bin\\pkcs11\\win32\\pk11tokens.vcxproj.filters",
103 104 105 106 107 108 109 110 111 112
                   "..\\bin\\rndc\\win32\\rndc.vcxproj",
                   "..\\bin\\rndc\\win32\\rndc.vcxproj.filters",
                   "..\\bin\\rndc\\win32\\rndcutil.vcxproj",
                   "..\\bin\\rndc\\win32\\rndcutil.vcxproj.filters",
                   "..\\bin\\tools\\win32\\arpaname.vcxproj",
                   "..\\bin\\tools\\win32\\arpaname.vcxproj.filters",
                   "..\\bin\\tools\\win32\\genrandom.vcxproj",
                   "..\\bin\\tools\\win32\\genrandom.vcxproj.filters",
                   "..\\bin\\tools\\win32\\journalprint.vcxproj",
                   "..\\bin\\tools\\win32\\journalprint.vcxproj.filters",
Francis Dupont's avatar
Francis Dupont committed
113 114
                   "..\\bin\\tools\\win32\\mdig.vcxproj",
                   "..\\bin\\tools\\win32\\mdig.vcxproj.filters",
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
                   "..\\bin\\tools\\win32\\nsec3hash.vcxproj",
                   "..\\bin\\tools\\win32\\nsec3hash.vcxproj.filters",
                   "..\\bin\\tools\\win32\\rrchecker.vcxproj",
                   "..\\bin\\tools\\win32\\rrchecker.vcxproj.filters",
                   "..\\bin\\tests\\atomic\\win32\\t_atomic.vcxproj",
                   "..\\bin\\tests\\atomic\\win32\\t_atomic.vcxproj.filters",
                   "..\\bin\\tests\\db\\win32\\t_db.vcxproj",
                   "..\\bin\\tests\\db\\win32\\t_db.vcxproj.filters",
                   "..\\bin\\tests\\dst\\win32\\t_dst.vcxproj",
                   "..\\bin\\tests\\dst\\win32\\t_dst.vcxproj.filters",
                   "..\\bin\\tests\\names\\win32\\t_names.vcxproj",
                   "..\\bin\\tests\\names\\win32\\t_names.vcxproj.filters",
                   "..\\bin\\tests\\rbt\\win32\\t_rbt.vcxproj",
                   "..\\bin\\tests\\rbt\\win32\\t_rbt.vcxproj.filters",
                   "..\\bin\\tests\\resolver\\win32\\t_resolver.vcxproj",
                   "..\\bin\\tests\\resolver\\win32\\t_resolver.vcxproj.filters",
131 132
                   "..\\bin\\tests\\system\\win32\\bigkey.vcxproj",
                   "..\\bin\\tests\\system\\win32\\bigkey.vcxproj.filters",
133 134
                   "..\\bin\\tests\\system\\win32\\feature-test.vcxproj",
                   "..\\bin\\tests\\system\\win32\\feature-test.vcxproj.filters",
135 136 137 138 139 140 141 142
                   "..\\bin\\tests\\system\\win32\\gencheck.vcxproj",
                   "..\\bin\\tests\\system\\win32\\gencheck.vcxproj.filters",
                   "..\\bin\\tests\\system\\win32\\keycreate.vcxproj",
                   "..\\bin\\tests\\system\\win32\\keycreate.vcxproj.filters",
                   "..\\bin\\tests\\system\\win32\\keydelete.vcxproj",
                   "..\\bin\\tests\\system\\win32\\keydelete.vcxproj.filters",
                   "..\\bin\\tests\\system\\win32\\pipequeries.vcxproj",
                   "..\\bin\\tests\\system\\win32\\pipequeries.vcxproj.filters",
143 144 145 146 147 148 149 150
                   "..\\bin\\tests\\tasks\\win32\\t_tasks.vcxproj",
                   "..\\bin\\tests\\tasks\\win32\\t_tasks.vcxproj.filters",
                   "..\\bin\\tests\\timers\\win32\\t_timers.vcxproj",
                   "..\\bin\\tests\\timers\\win32\\t_timers.vcxproj.filters",
                   "..\\bin\\tests\\win32\\backtrace_test.vcxproj",
                   "..\\bin\\tests\\win32\\backtrace_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\inter_test.vcxproj",
                   "..\\bin\\tests\\win32\\inter_test.vcxproj.filters",
151 152
                   "..\\bin\\tests\\win32\\makejournal.vcxproj",
                   "..\\bin\\tests\\win32\\makejournal.vcxproj.filters",
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
                   "..\\bin\\tests\\win32\\rwlock_test.vcxproj",
                   "..\\bin\\tests\\win32\\rwlock_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\shutdown_test.vcxproj",
                   "..\\bin\\tests\\win32\\shutdown_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\sock_test.vcxproj",
                   "..\\bin\\tests\\win32\\sock_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\task_test.vcxproj",
                   "..\\bin\\tests\\win32\\task_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\timer_test.vcxproj",
                   "..\\bin\\tests\\win32\\timer_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\inter_test.vcxproj",
                   "..\\bin\\tests\\win32\\inter_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\rwlock_test.vcxproj",
                   "..\\bin\\tests\\win32\\rwlock_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\shutdown_test.vcxproj",
                   "..\\bin\\tests\\win32\\shutdown_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\sock_test.vcxproj",
                   "..\\bin\\tests\\win32\\sock_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\task_test.vcxproj",
                   "..\\bin\\tests\\win32\\task_test.vcxproj.filters",
                   "..\\bin\\tests\\win32\\timer_test.vcxproj",
                   "..\\bin\\tests\\win32\\timer_test.vcxproj.filters",
                   "..\\bin\\win32\\BINDInstall\\BINDInstall.vcxproj",
                   "..\\bin\\win32\\BINDInstall\\BINDInstall.vcxproj.filters",
                   "..\\lib\\bind9\\win32\\libbind9.vcxproj",
                   "..\\lib\\bind9\\win32\\libbind9.vcxproj.filters",
                   "..\\lib\\dns\\win32\\gen.vcxproj",
                   "..\\lib\\dns\\win32\\gen.vcxproj.filters",
                   "..\\lib\\dns\\win32\\libdns.vcxproj",
                   "..\\lib\\dns\\win32\\libdns.vcxproj.filters",
183 184
                   "..\\lib\\irs\\win32\\libirs.vcxproj",
                   "..\\lib\\irs\\win32\\libirs.vcxproj.filters",
185 186 187 188 189 190
                   "..\\lib\\isc\\win32\\libisc.vcxproj",
                   "..\\lib\\isc\\win32\\libisc.vcxproj.filters",
                   "..\\lib\\isccc\\win32\\libisccc.vcxproj",
                   "..\\lib\\isccc\\win32\\libisccc.vcxproj.filters",
                   "..\\lib\\isccfg\\win32\\libisccfg.vcxproj",
                   "..\\lib\\isccfg\\win32\\libisccfg.vcxproj.filters",
191
                   "..\\lib\\ns\\win32\\libns.vcxproj",
192 193 194 195 196 197 198 199 200 201 202 203
                   "..\\lib\\samples\\win32\\resolve.vcxproj",
                   "..\\lib\\samples\\win32\\resolve.vcxproj.filters",
                   "..\\lib\\samples\\win32\\async.vcxproj",
                   "..\\lib\\samples\\win32\\async.vcxproj.filters",
                   "..\\lib\\samples\\win32\\gai.vcxproj",
                   "..\\lib\\samples\\win32\\gai.vcxproj.filters",
                   "..\\lib\\samples\\win32\\update.vcxproj",
                   "..\\lib\\samples\\win32\\update.vcxproj.filters",
                   "..\\lib\\samples\\win32\\request.vcxproj",
                   "..\\lib\\samples\\win32\\request.vcxproj.filters",
                   "..\\lib\\samples\\win32\\nsprobe.vcxproj",
                   "..\\lib\\samples\\win32\\nsprobe.vcxproj.filters",
204 205 206 207 208 209 210 211 212 213
                   "..\\lib\\tests\\win32\\libtests.vcxproj",
                   "..\\lib\\tests\\win32\\libtests.vcxproj.filters",
                   "..\\lib\\win32\\bindevt\\bindevt.vcxproj",
                   "..\\lib\\win32\\bindevt\\bindevt.vcxproj.filters",
                   "bind9.sln");

# for config.h

my %configdefh;

Francis Dupont's avatar
Francis Dupont committed
214
my @substdefh = ("AES_CC",
215 216 217 218 219 220 221
                 "CONFIGARGS",
                 "DNS_RDATASET_FIXED",
                 "ENABLE_RPZ_NSDNAME",
                 "ENABLE_RPZ_NSIP",
                 "HAVE_EVP_SHA256",
                 "HAVE_EVP_SHA384",
                 "HAVE_EVP_SHA512",
222
                 "HAVE_FIPS_MODE",
223 224
                 "HAVE_GEOIP",
                 "HAVE_GEOIP_CITY_V6",
225
                 "HAVE_GEOIP_V6",
226
                 "HAVE_LIBXML2",
227
                 "HAVE_OPENSSL_AES",
228 229
                 "HAVE_OPENSSL_DSA",
                 "HAVE_OPENSSL_ECDSA",
230 231
                 "HAVE_OPENSSL_ED25519",
                 "HAVE_OPENSSL_ED448",
232
                 "HAVE_OPENSSL_EVP_AES",
233
                 "HAVE_OPENSSL_GOST",
Evan Hunt's avatar
Evan Hunt committed
234
                 "HAVE_PKCS11_ECDSA",
235 236
                 "HAVE_PKCS11_ED25519",
                 "HAVE_PKCS11_ED448",
Evan Hunt's avatar
Evan Hunt committed
237
                 "HAVE_PKCS11_GOST",
238
                 "HAVE_READLINE",
Francis Dupont's avatar
Francis Dupont committed
239 240 241
                 "HAVE_ZLIB",
                 "HMAC_SHA1_CC",
                 "HMAC_SHA256_CC",
242
                 "ISC_LIST_CHECKINIT",
243
                 "PREFER_GOSTASN1",
244
                 "TUNE_LARGE",
245
                 "WANT_QUERYTRACE",
246
                 "WITH_IDN");
247 248 249 250 251

# for platform.h

my %configdefp;

Evan Hunt's avatar
Evan Hunt committed
252
my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP",
Evan Hunt's avatar
Evan Hunt committed
253
                 "ISC_PLATFORM_CRYPTORANDOM",
Evan Hunt's avatar
Evan Hunt committed
254
                 "ISC_PLATFORM_HAVEATOMICSTORE",
255
                 "ISC_PLATFORM_HAVEATOMICSTOREQ",
256 257 258
                 "ISC_PLATFORM_HAVECMPXCHG",
                 "ISC_PLATFORM_HAVEXADD",
                 "ISC_PLATFORM_HAVEXADDQ",
Evan Hunt's avatar
Evan Hunt committed
259
                 "ISC_PLATFORM_NEEDSTRCASESTR",
260 261
                 "ISC_PLATFORM_USEBACKTRACE",
                 "ISC_PLATFORM_WANTAES");
262

263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
# for conf.sh

my %configtest;

my @substtest = ("CHECK_DSA",
                 "CHECKDS",
                 "COVERAGE",
                 "DNSTAP",
                 "FSTRM_CAPTURE",
                 "JSONSTATS",
                 "KEYMGR",
                 "NZD_TOOLS",
                 "PKCS11_TEST",
                 "XMLSTATS",
                 "ZLIB"),

279 280 281 282 283 284 285 286 287
# includes

my %configinc;

my @substinc = ("GSSAPI_INC",
                "GEOIP_INC",
                "IDN_INC",
                "LIBXML2_INC",
                "OPENSSL_INC",
Francis Dupont's avatar
Francis Dupont committed
288 289
                "READLINE_INC",
                "ZLIB_INC");
290 291 292 293 294 295 296 297 298 299 300 301

# libraries

my %configlib;

my @substlib = ("GSSAPI_LIB",
                "GEOIP_LIB",
                "IDN_LIB",
                "KRB5_LIB",
                "LIBXML2_LIB",
                "OPENSSL_LIB",
                "READLINE_LIB",
Francis Dupont's avatar
Francis Dupont committed
302 303
                "READLINE_LIBD",
                "ZLIB_LIB");
304 305 306 307 308 309 310 311 312 313 314 315 316 317

# DLLs

my %configdll;

my @substdll = ("COMERR_DLL",
                "GSSAPI_DLL",
                "GEOIP_DLL",
                "ICONV_DLL",
                "IDN_DLL",
                "KRB5_DLL",
                "K5SPRT_DLL",
                "LIBXML2_DLL",
                "OPENSSL_DLL",
Francis Dupont's avatar
Francis Dupont committed
318 319
                "WSHELP_DLL",
                "ZLIB_DLL");
320 321 322 323 324

# variables

my %configvar;

Francis Dupont's avatar
Francis Dupont committed
325 326
my @substvar = ("BIND9_VERSION",
                "BUILD_MACHINE",
327 328 329 330 331 332
                "BUILD_PLATFORM",
                "COPTI",
                "COPTML",
                "COPTMLD",
                "COPTX",
                "COPTY",
333 334
                "DLZ_SYSTEM_TEST",
                "EXEEXT",
335
                "expanded_sysconfdir",
336 337 338 339 340 341
                "INTRINSIC",
                "MACHINE",
                "OPENSSL_PATH",
                "PLATFORM",
                "PKCS11_TOOLS",
                "prefix",
342
                "PSSUSPEND",
343
                "PYTHON",
Mark Andrews's avatar
Mark Andrews committed
344
                "PYTHON_INSTALL_DIR",
345 346 347 348 349 350
                "VCREDIST_PATH"),

# defines

my %configdefd;

Evan Hunt's avatar
Evan Hunt committed
351 352
my @substdefd = ("CRYPTO",
                 "PK11_LIB_LOCATION",
353 354 355 356 357 358 359 360 361
                 "USE_GSSAPI",
                 "USE_PKCS11",
                 "USE_PYTHON",
                 "USE_ISC_SPNEGO");

# conditions

my %configcond;

362 363
my @substcond = ("AES",
                 "ATOMIC",
364 365 366 367 368 369 370
                 "GSSAPI",
                 "GEOIP",
                 "IDNKIT",
                 "LIBXML2",
                 "OPENSSL",
                 "PKCS11",
                 "PYTHON",
371
                 "SAMPLES",
372
                 "STESTS",
373
                 "TESTS",
Francis Dupont's avatar
Francis Dupont committed
374 375 376 377
                 "XTESTS",
                 "ZLIB");

my @allcond = (@substcond, "NOTYET", "NOLONGER");
378 379 380 381 382

# arguments

# enable-xxx/disable-xxx

Evan Hunt's avatar
Evan Hunt committed
383 384
my @enablelist = ("crypto-rand",
                  "developer",
385 386 387
                  "fixed-rrset",
                  "intrinsics",
                  "isc-spnego",
Evan Hunt's avatar
Evan Hunt committed
388
                  "native-pkcs11",
389 390
                  "openssl-hash",
                  "filter-aaaa",
391
                  "querytrace",
392
                  "rpz-nsdname",
Francis Dupont's avatar
Francis Dupont committed
393
                  "rpz-nsip");
394 395 396

# with-xxx/without-xxx

397
my @withlist = ("aes",
398
                "cc-alg",
399
                "cross-compile",
400
                "ecdsa",
401
                "eddsa",
402 403 404 405 406 407 408 409 410
                "extra-tests",
                "gssapi",
                "geoip",
                "gost",
                "iconv",
                "idn",
                "openssl",
                "libxml2",
                "pkcs11",
411
                "pssuspend",
412 413
                "python",
                "readline",
414
                "samples",
415
                "system-tests",
416
                "tests",
417
                "tuning",
Francis Dupont's avatar
Francis Dupont committed
418 419
                "vcredist",
                "zlib");
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

# general arguments

my @optionlist = ("help", "verbose", "legacy", "win32", "x64", "clean");

# usage

my @usage = ("Usage: perl Configure help\n",
             "       perl Configure options* win32|x64\n",
             "       perl Configure clean\n");

# help

my @help = (
"'Configure' configures BIND9 build files.\n\n",
@usage,
"\nGeneral Options and Commands:\n",
"  verbose               (options) print messages\n",
"  help                  (command) print this help\n",
"  win32                 (command) configure for Win32 platform\n",
"  x64                   (command) configure for x64 platform\n",
"  clean                 (command) clean up generated files\n",
"  <none>                (command) print a summary of the configuration\n",
"\nOptional Features:\n",
"  enable-intrinsics     enable instrinsic/atomic functions [default=yes]\n",
Evan Hunt's avatar
Evan Hunt committed
445
"  enable-native-pkcs11  use native PKCS#11 for all crypto [default=no]\n",
Evan Hunt's avatar
Evan Hunt committed
446
"  enable-crypto-rand    use crypto provider for random [default=yes]\n",
447
"  enable-openssl-hash   use OpenSSL for hash functions [default=yes]\n",
448 449 450
"  enable-isc-spnego     use SPNEGO from lib/dns [default=yes]\n",
"  enable-fixed-rrset    enable fixed rrset ordering [default=no]\n",
"  enable-developer      enable developer build settings [default=no]\n",
451
"  enable-querytrace     enable very verbose query trace [default=no]\n",
452 453 454 455 456
"  enable-rpz-nsip       enable rpz-nsip rules [default=yes]\n",
"  enable-rpz-nsdname    enable rpz-nsdname rules [default=yes]\n",
"\nOptional Packages:\n",
"  with-tests            build with test suite\n",
"  with-extra-tests      build with extra test suite\n",
457
"  with-system-tests     build with system test suite\n",
458
"  with-samples          build with sample programs\n",
459 460 461
"  with-openssl[=PATH]   build with OpenSSL yes|no|path\n",
"  with-pkcs11[=PATH]    build with PKCS#11 support yes|no|provider-path\n",
"  with-ecdsa            crypto ECDSA\n",
462
"  with-eddsa            crypto EDDSA yes|all|no\n",
463
"  with-gost[=ENC]       crypto GOST yes|no|raw|ans1\n",
464
"  with-aes              crypto AES\n",
Francis Dupont's avatar
Francis Dupont committed
465
"  with-cc-alg           choose the algorithm for cookies aes|sha1|sha256\n",
466 467 468
"  with-gssapi[=PATH]    build with MIT KfW GSSAPI yes|no|path\n",
"  with-libxml2[=PATH]   build with libxml2 library yes|no|path\n",
"  with-geoip[=PATH]     build with GeoIP support yes|no|path\n",
469
"  with-pssuspend[=COMMAND] specify pssuspend command\n",
470 471 472 473
"  with-python[=COMMAND] specify python interpreter python|command\n",
"  with-readline[=PATH]  build with readline library support yes|no|path\n",
"  with-idn[=PATH]       build with IDN kit support yes|no|path\n",
"  with-iconv[=PATH]     path of the iconv DLL [default=same than idn]\n",
Francis Dupont's avatar
Francis Dupont committed
474
"  with-zlib[=PATH]      build with zlib library yes|no|path\n",
Evan Hunt's avatar
Evan Hunt committed
475
"  with-vcredist[=PATH]  visual C++ redistributable package yes|path\n",
476
"  with-tuning=OPTION    tune for plaform size (large|default)\n",
477 478 479 480 481 482 483 484 485 486 487 488 489
"  with-cross-compile    32 / 64 bit build / host plaforms\n");

# Parse arguments

my $verbose = 0;
my $legacy_only = 0;
my $want_help = "no";
my $want_win32 = "no";
my $want_x64 = "no";
my $want_clean = "no";
my $want_unknown = "no";
my $unknown_value;
my $enable_intrinsics = "yes";
Evan Hunt's avatar
Evan Hunt committed
490
my $cryptolib = "";
Evan Hunt's avatar
Evan Hunt committed
491
my $enable_native_pkcs11 = "no";
Evan Hunt's avatar
Evan Hunt committed
492
my $enable_crypto_rand = "yes";
493
my $enable_openssl_hash = "auto";
494 495 496
my $enable_isc_spnego = "yes";
my $enable_fixed_rrset = "no";
my $enable_developer = "no";
497
my $enable_querytrace = "no";
498 499 500 501
my $enable_rpz_nsip = "yes";
my $enable_rpz_nsdname = "yes";
my $use_tests = "no";
my $use_xtests = "no";
502
my $use_stests = "no";
503
my $use_samples = "no";
504 505 506 507 508
my $use_openssl = "auto";
my $openssl_path = "..\\..\\";
my $use_pkcs11 = "no";
my $pkcs11_path = "unknown";
my $use_ecdsa = "auto";
509 510
my $use_eddsa = "auto";
my $use_ed448 = "auto";
511
my $use_gost = "auto";
512
my $gost_encoding = "raw";
513
my $use_aes = "auto";
Francis Dupont's avatar
Francis Dupont committed
514
my $cookie_algorithm = "aes";
515 516 517 518 519 520
my $use_gssapi = "no";
my $gssapi_path = "C:\\Program\ Files\\MIT\\Kerberos\\";
my $use_geoip = "no";
my $geoip_path = "";
my $use_libxml2 = "auto";
my $libxml2_path = "..\\..\\";
521 522
my $with_pssuspend = "no";
my $pssuspend_command = "pssuspend.exe";
523
my $use_python = "auto";
524
my $python_command = "python.exe";
525 526 527 528 529
my $use_readline = "no";
my $readline_path = "..\\..\\";
my $use_idn = "no";
my $idn_path = "..\\..\\";
my $iconv_path = " --idn-- ";
Francis Dupont's avatar
Francis Dupont committed
530 531
my $use_zlib = "no";
my $zlib_path = "..\\..\\";
532 533 534
my $use_vcredist = "yes";
my $vcredist_path = " --infer-- ";
my $cross_compile = "no";
535
my $tuning = "default";
536
my $want_checkfiles = "no";
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556

# no arguments -> usage

if ($#ARGV < 0) {
    foreach (@usage) {
        print $_;
    }
    exit 1;
}

# parse arguments

foreach (@ARGV) {
    if (/^verbose$/i) {
        $verbose = 1;
    } elsif (/^help$/i) {
        $want_help = "yes";
    } elsif (/^disable-(.*)$/i) {
        appargs($_);
        myenable($1, "no");
Francis Dupont's avatar
Francis Dupont committed
557
    } elsif (/^enable-(.*)$/i) {
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
        appargs($_);
        myenable($1, "yes");
    } elsif (/^without-(.*)$/i) {
        appargs($_);
        mywith($1, "no");
    } elsif (/^with-(.*)=(.*)$/i) {
        appargs($_);
        mywith($1, $2);
    } elsif (/^with-(.*)$/i) {
        appargs($_);
        mywith($1, "yes");
    } elsif (/^legacy$/i) {
        $legacy_only = 1;
    } elsif (/^win32$/i) {
        $want_win32 = "yes";
    } elsif (/^x64$/i) {
        appargs($_);
        $want_x64 = "yes";
    } elsif (/^clean$/i) {
        $want_clean = "yes";
578 579
    } elsif (/^checkfiles$/i) {
        $want_checkfiles = "yes";
580 581 582 583 584 585
    } else {
        $want_unknown = "yes";
        $unknown_value = $_;
    }
}

586
# old legacy mode
587

588 589
if ($legacy_only) {
    print "legacy mode is obsolete (so ignored)\n";
590 591
}

592
if ($want_checkfiles eq "yes") {
593 594 595 596 597 598 599 600 601 602 603 604 605
        foreach (@filelist) {
                next if -r $_ . ".in";
                s/\\/\//g;
                next if -r $_ . ".in";
                print "missing $_.in from filelist\n";
        }
        foreach (@projectlist) {
                next if -r $_ . ".in";
                s/\\/\//g;
                next if -r $_ . ".in";
                print "missing $_.in from projectlist\n";
        }
        exit(0);
606 607
}

608 609 610 611 612 613 614 615 616
# configure the platform

if (($want_win32 eq "yes") && ($want_x64 eq "yes")) {
    die "can't ask for both Win32 and x64 platforms\n";
} elsif ($want_win32 eq "yes") {
    $configvar{"PLATFORM"} = "Win32";
    $configvar{"BUILD_PLATFORM"} = "Win32";
    $configvar{"MACHINE"} = "/machine:X86";
    $configvar{"BUILD_MACHINE"} = "/machine:X86";
Evan Hunt's avatar
Evan Hunt committed
617
    $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "__asm { rep nop }";
618 619 620 621 622
} elsif ($want_x64 eq "yes") {
    $configvar{"PLATFORM"} = "x64";
    $configvar{"BUILD_PLATFORM"} = "x64";
    $configvar{"MACHINE"} = "/machine:X64";
    $configvar{"BUILD_MACHINE"} = "/machine:X64";
623
    $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "_mm_pause()";
624
}
625 626
# Standard configure variable
$configvar{"EXEEXT"} = ".exe";
627

Francis Dupont's avatar
Francis Dupont committed
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
# get the version information

my %Versions;

sub getversion {
    my $data;
    my $name;
    my $value;
    my $version;

    open V, "..\\version" || die $!;
    while (<V>) {
        chomp;
        ($data) = split(/\#/);
        if ($data) {
            ($name, $value) = split(/=/, $data);
            ($name) = split(/\s+/, $name);
            if ($name eq 'PRODUCT' || $name eq 'DESCRIPTION') {
                ($value) =~ s/^["\s]+//;
                ($value) =~ s/["\s]+$//;
            } else {
                ($value) = split(/\s+/, $value);
            }
            $Versions{$name} = $value;
        }
    }
    close V;

    $version = "$Versions{'MAJORVER'}.$Versions{'MINORVER'}";
    if ($Versions{'PATCHVER'} ne "") {
        $version = "$version.$Versions{'PATCHVER'}";
    }
    $version = "$version$Versions{'RELEASETYPE'}$Versions{'RELEASEVER'}";
    $version = "$version$Versions{'EXTENSIONS'}";
    $configvar{"BIND9_VERSION"} = "$version";
}

getversion();

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
# append seen args to CONFIGARGS define

sub appargs {
    my $arg = $_[0];
    # escape backslashes, spaces and double quotes
    $arg =~ s/([\\ "])/\\$1/g;
    if (defined($configdefh{"CONFIGARGS"})) {
        $configdefh{"CONFIGARGS"} .= " " . $arg;
    } else {
        $configdefh{"CONFIGARGS"} = $arg;
    }
}

if (!$configdefh{"CONFIGARGS"}) {
    # CONFIGARGS default is "default"
    $configdefh{"CONFIGARGS"} = "\"default\"";
} else {
    my $val = $configdefh{"CONFIGARGS"};
    $configdefh{"CONFIGARGS"} = "\"'$val'\"";
}

# parse enable/disable

sub myenable {
    my $key = $_[0];
    my $val = $_[1];

    if ($key =~ /^intrinsics$/i) {
        if ($val =~ /^no$/i) {
            $enable_intrinsics = "no";
        }
Evan Hunt's avatar
Evan Hunt committed
698 699 700 701
    } elsif ($key =~ /^native-pkcs11$/i) {
        if ($val =~ /^yes$/i) {
            $enable_native_pkcs11 = "yes";
        }
Evan Hunt's avatar
Evan Hunt committed
702 703 704 705
    } elsif ($key =~ /^crypto-rand$/i) {
        if ($val =~ /^no$/i) {
            $enable_crypto_rand = "no";
        }
706 707 708
    } elsif ($key =~ /^openssl-hash$/i) {
        if ($val =~ /^yes$/i) {
            $enable_openssl_hash = "yes";
709 710
        } elsif ($val =~ /^no$/i) {
            $enable_openssl_hash = "no";
711 712 713 714 715 716 717 718 719 720 721 722 723
        }
    } elsif ($key =~ /^isc-spnego$/i) {
        if ($val =~ /^no$/i) {
            $enable_isc_spnego = "no";
        }
    } elsif ($key =~ /^fixed-rrset$/i) {
        if ($val =~ /^yes$/i) {
            $enable_fixed_rrset = "yes";
        }
    } elsif ($key =~ /^developer$/i) {
        if ($val =~ /^yes$/i) {
            $enable_developer = "yes";
        }
724 725 726 727
    } elsif ($key =~ /^querytrace$/i) {
        if ($val =~ /^yes$/i) {
            $enable_querytrace = "yes";
        }
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
    } elsif ($key =~ /^rpz-nsip$/i) {
        if ($val =~ /^no$/i) {
            $enable_rpz_nsip = "no";
        }
    } elsif ($key =~ /^rpz-nsdname$/i) {
        if ($val =~ /^no$/i) {
            $enable_rpz_nsdname = "no";
        }
    } else {
        $want_unknown = "yes";
        if ($val eq "no") {
            $unknown_value = "disable-" . $key;
        } else {
            $unknown_value = "enable-". $key;
        }
    }
}

# enable-developer expansion now

if ($enable_developer eq "yes") {
    $configdefh{"ISC_LIST_CHECKINIT"} = 1;
750
    $enable_querytrace = "yes";
751 752 753 754
    # no atf on WIN32
    $enable_fixed_rrset = "yes";
    # TODO: dlz filesystem
    $use_tests = "yes";
755 756
    $use_xtests = "yes";
    $use_stests = "yes";
757
    $use_samples = "yes";
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
}

# parse with/without

sub mywith {
    my $key = $_[0];
    my $val = $_[1];

    if ($key =~ /^tests$/i) {
        if ($val =~ /^yes$/i) {
            $use_tests = "yes";
        }
    } elsif ($key =~ /^extra-tests$/i) {
        if ($val =~ /^yes$/i) {
            $use_tests = "yes";
            $use_xtests = "yes";
        }
775 776 777 778 779
    } elsif ($key =~ /^system-tests$/i) {
        if ($val =~ /^yes$/i) {
            $use_tests = "yes";
            $use_stests = "yes";
        }
780 781 782 783
    } elsif ($key =~ /^samples$/i) {
        if ($val =~ /^yes$/i) {
            $use_samples = "yes";
        }
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804
    } elsif ($key =~ /^openssl$/i) {
        if ($val =~ /^no$/i) {
            $use_openssl = "no";
        } elsif ($val !~ /^yes$/i) {
            $use_openssl = "yes";
            $openssl_path = $val;
        }
    } elsif ($key =~ /^pkcs11$/i) {
        if ($val =~ /^yes$/i) {
            $use_pkcs11 = "yes";
        } elsif ($val !~ /^no$/i) {
            $use_pkcs11= "yes";
            $pkcs11_path = $val;
            $pkcs11_path =~ s/\.dll$//i;
        }
    } elsif ($key =~ /^ecdsa$/i) {
        if ($val =~ /^no$/i) {
            $use_ecdsa = "no";
        } elsif ($val =~ /^yes$/i) {
            $use_ecdsa = "yes";
        }
805 806 807 808 809 810 811 812 813
    } elsif ($key =~ /^eddsa$/i) {
        if ($val =~ /^no$/i) {
            $use_eddsa = "no";
        } elsif ($val !~ /^no$/i) {
            $use_eddsa = "yes";
            if ($val =~ /^all$/i) {
                $use_ed448 = "yes";
            }
        }
814 815 816
    } elsif ($key =~ /^gost$/i) {
        if ($val =~ /^no$/i) {
            $use_gost = "no";
817
        } elsif ($val !~ /^no$/i) {
818
            $use_gost = "yes";
819
            $gost_encoding = $val;
820
        }
821 822 823 824 825 826
    } elsif ($key =~ /^aes$/i) {
        if ($val =~ /^no$/i) {
            $use_aes = "no";
        } elsif ($val =~ /^yes$/i) {
            $use_aes = "yes";
        }
Francis Dupont's avatar
Francis Dupont committed
827 828
    } elsif ($key =~ /^cc-alg$/i) {
        $cookie_algorithm = $val;
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
    } elsif ($key =~ /^gssapi$/i) {
        if ($val !~ /^no$/i) {
            $use_gssapi = "yes";
            if ($val !~ /^yes$/i) {
                $gssapi_path = $val;
            }
        }
    } elsif ($key =~ /^libxml2$/i) {
        if ($val =~ /^no$/i) {
            $use_libxml2 = "no";
        } elsif ($val !~ /^yes$/i) {
            $use_libxml2 = "yes";
            $libxml2_path = $val;
        }
    } elsif ($key =~ /^geoip$/i) {
        if ($val !~ /^no$/i) {
            $use_geoip = "yes";
            if ($val !~ /^yes$/i) {
                $geoip_path = $val;
            }
        }
    } elsif ($key =~ /^readline$/i) {
        if ($val !~ /^no$/i) {
            $use_readline = "yes";
            if ($val !~ /^yes$/i) {
                $readline_path = $val;
            }
        }
    } elsif ($key =~ /^idn$/i) {
        if ($val !~ /^no$/i) {
            $use_idn = "yes";
            if ($val !~ /^yes$/i) {
                $idn_path = $val;
            }
        }
    } elsif ($key =~ /^iconv$/i) {
        if ($val =~ /^no$/i) {
            $want_unknown = "yes";
            $unknown_value = "without-iconv doesn't make sense)";
        } elsif ($val !~ /^yes$/i) {
            $iconv_path = $val;
        }
Francis Dupont's avatar
Francis Dupont committed
871 872 873 874 875 876 877
    } elsif ($key =~ /^zlib$/i) {
        if ($val !~ /^no$/i) {
            $use_zlib = "yes";
            if ($val !~ /^yes$/i) {
                $zlib_path = $val;
            }
        }
878 879 880 881 882 883 884 885
    } elsif ($key =~ /^pssuspend$/i) {
	if ($val =~ /^no$/i) {
	    $with_pssuspend = "no";
	} else {
	    if ($val !~ /^yes$/i) {
	        $pssuspend_command = $val;
	    }
        }
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
    } elsif ($key =~ /^python$/i) {
        if ($val =~ /^no$/i) {
            $use_python = "no";
        } else {
            $use_python = "yes";
            if ($val !~ /^yes$/i) {
                $python_command = $val;
            }
        }
    } elsif ($key =~ /^vcredist$/i) {
        if ($val =~ /^no$/i) {
            $want_unknown = "yes";
            $unknown_value = "without-vcredist (vcredist is required)";
        } elsif ($val !~ /^yes$/i) {
            $vcredist_path = $val;
        }
    } elsif ($key =~ /^cross-compile$/i) {
        if ($val =~ /^yes$/i) {
            $cross_compile = "yes";
        }
906 907 908 909
    } elsif ($key =~ /^tuning$/i) {
        if ($val =~ /^large$/i) {
            $tuning = "large";
        }
910 911 912 913 914 915 916 917 918 919
    } else {
        $want_unknown = "yes";
        if ($val eq "no") {
            $unknown_value = "without-" . $key;
        } else {
            $unknown_value = "with-" . $key;
        }
    }
}

920 921 922 923 924 925 926 927 928 929 930 931 932
# resolve enable-openssl-hash
if ($enable_openssl_hash eq "auto") {
    if ($use_openssl ne "no") {
        if ($enable_native_pkcs11 eq "yes") {
            $enable_openssl_hash="no";
        } else {
            $enable_openssl_hash="yes";
        }
    } else {
        $enable_openssl_hash="no";
    }
}

933 934 935 936 937 938 939 940 941 942
if ($want_help ne "no") {
    foreach (@help) {
        print $_;
    }
    exit 1;
}

# clean up and exit if requested
if ($want_clean eq "yes") {
    my $file;
943 944 945 946 947 948

    unlink($configfile);
    unlink($platformfile);
    unlink($confshfile);
    unlink($icshfile);

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
    foreach $file (@filelist) {
        unlink($file);
    }

    foreach $file (@projectlist) {
        unlink($file);
    }

    exit 0;
}

if ($want_unknown ne "no") {
    print STDERR "can't parse $unknown_value\n";
    exit 1;
}

if ($verbose) {
    if ($want_win32 eq "yes") {
        print "configure for win32\n";
    }
    if ($want_x64 eq "yes") {
        print "configure for x64\n";
    }
    if ($cross_compile eq "yes") {
        print "cross compiling";
        if ($want_x64 eq "yes") {
            print ": build on win32 for x64 host\n";
        } elsif ($want_win32 eq "yes") {
            print ": build on x64 for win32 host\n";
        } else {
            print "\n";
        }
    }
    if ($enable_intrinsics eq "yes") {
        print "intrinsics: enabled\n";
    } else {
        print "intrinsics: disabled\n";
    }
Evan Hunt's avatar
Evan Hunt committed
987 988 989 990 991
    if ($enable_native_pkcs11 eq "yes") {
        print "native-pkcs11: enabled\n";
    } else {
        print "native-pkcs11: disabled\n";
    }
Evan Hunt's avatar
Evan Hunt committed
992 993 994 995 996
    if ($enable_crypto_rand eq "yes") {
        print "crypto-rand: enabled\n";
    } else {
        print "crypto-rand: disabled\n";
    }
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
    if ($enable_openssl_hash eq "yes") {
        print "openssl-hash: enabled\n";
    } else {
        print "openssl-hash: disabled\n";
    }
    if ($enable_isc_spnego eq "yes") {
        print "isc-spnego: enabled\n";
    } else {
        print "isc-spnego: disabled\n";
    }
    if ($enable_fixed_rrset eq "yes") {
        print "fixed-rrset: enabled\n";
    } else {
        print "fixed-rrset: disabled\n";
    }
    if ($enable_developer eq "yes") {
        print "developer: enabled\n";
    } else {
        print "developer: disabled\n";
    }
1017 1018 1019 1020 1021
    if ($enable_querytrace eq "yes") {
        print "querytrace: enabled\n";
    } else {
        print "querytrace: disabled\n";
    }
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
    if ($enable_rpz_nsip eq "yes") {
        print "rpz-nsip: enabled\n";
    } else {
        print "rpz-nsip: disabled\n";
    }
    if ($enable_rpz_nsdname eq "yes") {
        print "rpz-nsdname: enabled\n";
    } else {
        print "rpz-nsdname: disabled\n";
    }
Francis Dupont's avatar
Francis Dupont committed
1032
    print "cookie algorithm: $cookie_algorithm\n";
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
    if ($use_openssl eq "no") {
        print "openssl: disabled\n";
    } else {
        print "openssl-path: $openssl_path\n";
    }
    if ($use_tests eq "yes") {
        print "tests: enabled\n";
    }
    if ($use_xtests eq "yes") {
        print "extra tests: enabled\n";
    }
1044 1045 1046
    if ($use_stests eq "yes") {
        print "system tests: enabled\n";
    }
1047 1048 1049
    if ($use_samples eq "yes") {
        print "sample programs: enabled\n";
    }
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
    if ($use_pkcs11 eq "no") {
        print "pkcs11: disabled\n";
    } else {
        print "pkcs11-provider-path: $pkcs11_path\n";
    }
    if ($use_ecdsa eq "no") {
        print "ecdsa: disabled\n";
    } else {
        print "ecdsa: enabled\n";
    }
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069
    if ($use_eddsa eq "no") {
        print "eddsa: disabled\n";
    } else {
        print "ed25519: enabled\n";
        if ($use_ed448 eq "no") {
            print "ed448: disabled\n";
        } else {
            print "ed448: enabled\n";
        }
    }
1070 1071 1072 1073
    if ($use_gost eq "no") {
        print "gost: disabled\n";
    } else {
        print "gost: enabled\n";
1074
        print "gost private key encoding: $gost_encoding\n";
1075
    }
1076 1077 1078 1079 1080
    if ($use_aes eq "no") {
        print "aes: disabled\n";
    } else {
        print "aes: enabled\n";
    }
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
    if ($use_gssapi eq "no") {
        print "gssapi: disabled\n";
    } else {
        print "gssapi-path: $gssapi_path\n";
    }
    if ($use_libxml2 eq "no") {
        print "libxml2: disabled\n";
    } else {
        print "libxml2-path: $libxml2_path\n";
    }
    if ($use_geoip eq "no") {
        print "geoip: disabled\n";
    } else {
        print "geoip-path: $geoip_path\n";
    }
    if ($use_readline eq "no") {
        print "readline: disabled\n";
    } else {
        print "readline-path: $readline_path\n";
    }
    if ($use_idn eq "no") {
        print "idn: disabled\n";
    } else {
        print "idn-path: $idn_path\n";
        if ($iconv_path ne " --idn-- ") {
            print "iconv-path: $iconv_path\n";
        }
    }
Francis Dupont's avatar
Francis Dupont committed
1109 1110 1111 1112 1113
    if ($use_zlib eq "no") {
        print "zlib: disabled\n";
    } else {
        print "zlib-path: $zlib_path\n";
    }
1114 1115 1116 1117 1118
    if ($with_pssuspend eq "no") {
        print "pssuspend: disabled\n";
    } else {
        print "pssuspend-command: $pssuspend_command\n";
    }
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
    if ($use_python eq "no") {
        print "python: disabled\n";
    } else {
        print "python-command: $python_command\n";
    }
    print "vcredist-path: $vcredist_path\n";
}

# Check environment

# infer vcredist when not given
if ($vcredist_path eq " --infer-- ") {
    if ($verbose) {
        print "trying to infer vcredist path from build environment\n";
    }
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176

    my @vcpaths = {};
    push(@vcpaths, $ENV{"VCRedistPath"}) if ($ENV{"VCRedistPath"} ne "");
    push(@vcpaths, File::Spec->catfile( cwd(), "..", ".." ));

    if ($ENV{"FrameworkSDKDir"} ne "" && $want_win32 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"FrameworkSDKDir"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x86"));
    } elsif ($ENV{"FrameworkSDKDir"} ne "" && $want_x64 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"FrameworkSDKDir"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x64"));
    }

    if ($ENV{"WindowsSDKDir"} ne "" && $want_win32 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"WindowsSDKDir"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x86"));
    } elsif ($ENV{"WindowsSDKDir"} ne "" && $want_x64 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"WindowsSDKDir"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x64"));
    }

    if ($ENV{"WindowsSDKDir_old"} ne "" && $want_win32 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"WindowsSDKDir_old"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x86"));
    } elsif ($ENV{"WindowsSDKDir_old"} ne "" && $want_x64 eq "yes") {
        push(@vcpaths, File::Spec->catfile($ENV{"WindowsSDKDir_old"},
                                           "BootStrapper", "Packages",
                                           "vcredist_x64"));
    }

    if ($ENV{"VCINSTALLDIR"}) {
        push(@vcpaths, File::Spec->catfile($ENV{"VCINSTALLDIR"},
                                           "redist", "1033"));
    }

    my $rfile;
    if ($want_win32 eq "yes") {
        $rfile = "vcredist_x86.exe";
1177
    } else {
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189
        $rfile = "vcredist_x64.exe";
    }

    foreach (@vcpaths) {
        my $vp = File::Spec->catfile($_, $rfile);
        if (-f $vp) {
            $vcredist_path = $vp;
            last;
        }
    }

    if ($vcredist_path eq " --infer-- ") {
1190 1191
        die "with-vcredist is REQUIRED\n";
    }
1192 1193 1194 1195

    if ($verbose) {
        print "found vcredist at " . $vcredist_path . "\n";
    }
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
}

my $msc_ver = 0;

open F, ">mscver.c" || die $!;
print F << 'EOF';
#include <windows.h>
#include <stdio.h>

int
main(void)
{
        printf("%d\n", _MSC_VER);
        return(0);
}
EOF
close F;
my $compret = `cl /nologo /MD mscver.c`;
if (grep { -f and -x } ".\\mscver.exe") {
    $msc_ver = `.\\mscver.exe`;
} else {
    die "can't get _MSC_VER value: $compret\n";
}
if ($verbose) {
Francis Dupont's avatar
Francis Dupont committed
1220
    print "_MSC_VER == $msc_ver\n";
1221 1222
}
if ($msc_ver < 1600) {
1223 1224
    print STDERR "too old version of C++ compiler/Visual Studio\n";
    exit 1;
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
}

# gen single threaded for < VS 2005

if ($msc_ver < 1400) {
    $configvar{"COPTML"} = "/ML";
    $configvar{"COPTMLD"} = "/MLD";
}

# /GX deprecated in VS 2005

if ($msc_ver < 1400) {
    $configvar{"COPTX"} = "/GX";
} else {
    $configvar{"COPTX"} = "/EHsc";
}

# /YX for < VS 2005

if ($msc_ver < 1400) {
    $configvar{"COPTY"} = "/YX";
}

# backtrace for >= VS 2012

if ($msc_ver >= 1700) {
    $configdefp{"ISC_PLATFORM_USEBACKTRACE"} = 1;
}

Evan Hunt's avatar
Evan Hunt committed
1254 1255 1256
# no version of MSVS supports strcasestr() yet
$configdefp{"ISC_PLATFORM_NEEDSTRCASESTR"} = 1;

1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329
# warn when cross compiling

if ($cross_compile eq "yes") {
    if ($want_x64 eq "yes") {
        $configvar{"BUILD_PLATFORM"} = "Win32";
        $configvar{"BUILD_MACHINE"} = "/machine:X86";
    }
    if ($want_win32 eq "yes") {
        $configvar{"BUILD_PLATFORM"} = "x64";
        $configvar{"BUILD_MACHINE"} = "/machine:X64";
    }
} elsif ($want_win32 eq "yes") {
    open F, ">cross.c" || die $!;
    print F << 'EOF';
#include <windows.h>
#include <stdio.h>

int
main(void)
{
#ifdef _WIN64
        fprintf(stderr, "compiling for x64 when win32 was asked?!\n");
#endif
        return(0);
}
EOF
    close F;
    my $compret = `cl /nologo /MD cross.c`;
    if (grep { -f and -x } ".\\cross.exe") {
        my $cross = `.\\cross.exe`;
        if ($cross) {
            print STDERR $cross;
        }
    } else {
        print STDERR "can't check cross compile: $compret\n";
    }
} else {
    open F, ">cross.c" || die $!;
    print F << 'EOF';
#include <windows.h>
#include <stdio.h>

int
main(void)
{
#ifndef _WIN64
        fprintf(stderr, "compiling in 32 bits when x64 was asked?!\n");
#endif
        return(0);
}
EOF
    close F;
    my $compret = `cl /nologo /MD cross.c`;
    if (grep { -f and -x } ".\\cross.exe") {
        my $cross = `.\\cross.exe`;
        if ($cross) {
            print STDERR $cross;
        }
    } else {
        print STDERR "can't check cross compile: $compret\n";
    }
}

# Process arguments

# enable-intrinsics
if ($enable_intrinsics eq "yes") {
    $configcond{"ATOMIC"} = 1;
    $configvar{"INTRINSIC"} = "true";
    $configvar{"COPTI"} = "/Oi";
    $configdefp{"ISC_PLATFORM_HAVEXADD"} = 1;
    if ($want_x64 eq "yes") {
        $configdefp{"ISC_PLATFORM_HAVEXADDQ"} = 1;
1330
        $configdefp{"ISC_PLATFORM_HAVEATOMICSTOREQ"} = 1;
1331 1332 1333 1334 1335 1336 1337
    }
    $configdefp{"ISC_PLATFORM_HAVEATOMICSTORE"} = 1;
    $configdefp{"ISC_PLATFORM_HAVECMPXCHG"} = 1;
} else {
    $configvar{"INTRINSIC"} = "false";
}

Evan Hunt's avatar
Evan Hunt committed
1338 1339
# enable-native-pkcs11
if ($enable_native_pkcs11 eq "yes") {
Evan Hunt's avatar
Evan Hunt committed
1340
    $cryptolib = "pkcs11";
Evan Hunt's avatar
Evan Hunt committed
1341
    if ($use_openssl eq "auto") {
Francis Dupont's avatar
Francis Dupont committed
1342
        $use_openssl = "no";
Evan Hunt's avatar
Evan Hunt committed
1343 1344
    }
    if ($use_openssl ne "no") {
Francis Dupont's avatar
Francis Dupont committed
1345
        die "can't have both OpenSSL and native PKCS#11\n";
Evan Hunt's avatar
Evan Hunt committed
1346 1347
    }
    if ($use_pkcs11 ne "yes") {
Francis Dupont's avatar
Francis Dupont committed
1348 1349 1350 1351
        if ($verbose) {
            print "native PKCS#11 support: force with-pkcs11\n";
        }
        $use_pkcs11 = "yes";
Evan Hunt's avatar
Evan Hunt committed
1352 1353
    }
    if ($pkcs11_path eq "unknown") {
Francis Dupont's avatar
Francis Dupont committed
1354 1355 1356
        if ($verbose) {
            print "native PKCS#11 support: no PKCS#11 provider defined?\n";
        }
Evan Hunt's avatar
Evan Hunt committed
1357 1358 1359
    }
    $configdefd{"CRYPTO"} = "PKCS11CRYPTO";
    if ($use_ecdsa eq "no") {
Francis Dupont's avatar
Francis Dupont committed
1360 1361 1362
        if ($verbose) {
            print "no ECDSA support in native PKCS#11\n";
        }
Evan Hunt's avatar
Evan Hunt committed
1363
    } else {
Francis Dupont's avatar
Francis Dupont committed
1364 1365 1366 1367
        if ($verbose) {
            print "enabled ECDSA support in native PKCS#11\n";
        }
        $configdefh{"HAVE_PKCS11_ECDSA"} = 1;
Evan Hunt's avatar
Evan Hunt committed
1368
    }
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388
    if ($use_eddsa eq "no") {
        if ($verbose) {
            print "no EDDSA support in native PKCS#11\n";
        }
    } else {
        if ($verbose) {
            print "enabled Ed25519 support in native PKCS#11\n";
        }
        $configdefh{"HAVE_PKCS11_ED25519"} = 1;
        if ($use_ed448 eq "no") {
            if ($verbose) {
                print "no Ed448 support in native PKCS#11\n";
            }
        } else {
            if ($verbose) {
                print "enabled Ed448 support in native PKCS#11\n";
            }
            $configdefh{"HAVE_PKCS11_ED448"} = 1;
        }
    }
Evan Hunt's avatar
Evan Hunt committed
1389
    if ($use_gost eq "no") {
Francis Dupont's avatar
Francis Dupont committed
1390 1391 1392
        if ($verbose) {
            print "no GOST support in native PKCS#11\n";
        }
Evan Hunt's avatar
Evan Hunt committed
1393
    } else {
Francis Dupont's avatar
Francis Dupont committed
1394 1395 1396 1397
        if ($verbose) {
            print "enabled GOST support in native PKCS#11\n";
        }
        $configdefh{"HAVE_PKCS11_GOST"} = 1;
Evan Hunt's avatar
Evan Hunt committed
1398
    }
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408
    if ($use_aes eq "no") {
        if ($verbose) {
            print "no AES support in native PKCS#11\n";
        }
    } else {
        if ($verbose) {
            print "enabled AES support in native PKCS#11\n";
        }
        $use_aes = "pkcs11";
    }
Evan Hunt's avatar
Evan Hunt committed
1409 1410
}

1411 1412 1413 1414 1415 1416 1417 1418 1419 1420
# enable-fixed-rrset
if ($enable_fixed_rrset eq "yes") {
    $configdefh{"DNS_RDATASET_FIXED"} = 1;
}

# enable-rpz-nsip
if ($enable_rpz_nsip ne "no") {
    $configdefh{"ENABLE_RPZ_NSIP"} = 1;
}

1421 1422 1423 1424 1425
# enable-querytrace
if ($enable_querytrace eq "yes") {
    $configdefh{"WANT_QUERYTRACE"} = 1;
}

1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
# enable-rpz-nsdname
if ($enable_rpz_nsdname ne "no") {
    $configdefh{"ENABLE_RPZ_NSDNAME"} = 1;
}

# with-tests
if ($use_tests eq "yes") {
    $configcond{"TESTS"} = 1;
}

# with-extra-tests
if ($use_xtests eq "yes") {
    $configcond{"XTESTS"} = 1;
}

1441 1442 1443 1444 1445
# with-system-tests
if ($use_stests eq "yes") {
    $configcond{"STESTS"} = 1;
}

1446 1447 1448 1449 1450
# with-samples
if ($use_samples eq "yes") {
    $configcond{"SAMPLES"} = 1;
}

1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474
# with-openssl
if ($use_openssl eq "no") {
    if ($verbose) {
        print "OpenSSL library is disabled\n";
    }
} elsif ($use_openssl eq "auto") {
    if ($verbose) {
        print "checking for an OpenSSL built directory at sibling root\n";
    }
    opendir DIR, $openssl_path || die "No Directory: $!\n";
    my @dirlist = grep (/^openssl-[0-9]+\.[0-9]+\.[0-9]+[a-z]{0,1}$/i,
                        readdir(DIR));
    closedir(DIR);

    # Make sure we have something
    if (scalar(@dirlist) == 0) {
        die "can't find an OpenSSL at sibling root\n";
    }
    # Now see if we have a directory or just a file.
    # Make sure we are case insensitive
    my $file;
    foreach $file (sort {uc($b) cmp uc($a)} @dirlist) {
        if (-f File::Spec->catfile($openssl_path,
                                   $file,
1475 1476 1477 1478 1479 1480 1481 1482
                                   "inc32\\openssl\\opensslv.h")) {
            $openssl_path = File::Spec->catdir($openssl_path, $file);
            $use_openssl = "yes";
            last;
        }
        if (-f File::Spec->catfile($openssl_path,
                                   $file,
                                   "include\\openssl\\opensslv.h")) {
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499
            $openssl_path = File::Spec->catdir($openssl_path, $file);
            $use_openssl = "yes";
            last;
        }
    }

    # If we have one use it otherwise report the error
    if ($use_openssl eq "auto") {
        die "can't find an OpenSSL built directory at sibling root\n";
    }
}
# falls into (so no else)
if ($use_openssl eq "yes") {
    $openssl_path = File::Spec->rel2abs($openssl_path);
    if ($verbose) {
        print "checking for OpenSSL built directory at \"$openssl_path\"\n";
    }
1500
    my $openssl_new = 0;
1501
    if (!-f File::Spec->catfile($openssl_path,
1502 1503 1504 1505 1506 1507
                                "inc32\\openssl\\opensslv.h")) {
        $openssl_new = 1;
        if (!-f File::Spec->catfile($openssl_path,
                                "include\\openssl\\opensslv.h")) {
            die "can't find OpenSSL opensslv.h include\n";
        }
1508 1509 1510 1511 1512
    }
    my $openssl_inc = File::Spec->catdir($openssl_path, "inc32");
    my $openssl_libdir = File::Spec->catdir($openssl_path, "out32dll");
    my $openssl_lib = File::Spec->catfile($openssl_libdir, "libeay32.lib");
    my $openssl_dll = File::Spec->catfile($openssl_libdir, "libeay32.dll");
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543
    if (!$openssl_new) {
        # Check libraries are where we expect
        if (!-f $openssl_lib) {
            die "can't find OpenSSL libeay32.lib library\n";
        }
        if (!-f $openssl_dll) {
            die "can't find OpenSSL libeay32.dll DLL\n";
        }
    } else {
        # OpenSSL >= 1.1 is easier at the exception of the DLL
        if ($verbose) {
            print "new (>= 1.1) OpenSSL version\n";
        }
        $openssl_inc = File::Spec->catdir($openssl_path, "include");
        $openssl_libdir = $openssl_path;
        $openssl_lib = File::Spec->catfile($openssl_path, "libcrypto.lib");
        if (!-f $openssl_lib) {
            die "can't find OpenSSL libcrypto.lib library\n";
        }
        opendir DIR, $openssl_path || die "No Directory: $!\n";
        my @dirlist = grep (/^libcrypto-[^.]+\.dll$/i, readdir(DIR));
        closedir(DIR);
        # We must get one file only
        if (scalar(@dirlist) == 0) {
            die "can't find OpenSSL libcrypto-*.dll DLL\n";
        }
        if (scalar(@dirlist) != 1) {
            die "find more than one OpenSSL libcrypto-*.dll DLL candidate\n";
        }
        $openssl_dll = File::Spec->catdir($openssl_path, "@dirlist[0]");
    }   
1544

Evan Hunt's avatar
Evan Hunt committed
1545
    $cryptolib = "openssl";
1546
    $configcond{"OPENSSL"} = 1;
Evan Hunt's avatar
Evan Hunt committed
1547
    $configdefd{"CRYPTO"} = "OPENSSL";
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629
    $configvar{"OPENSSL_PATH"} = "$openssl_path";
    $configinc{"OPENSSL_INC"} = "$openssl_inc";
    $configlib{"OPENSSL_LIB"} = "$openssl_lib";
    $configdll{"OPENSSL_DLL"} = "$openssl_dll";
    if (-f File::Spec->catfile($openssl_inc, "openssl", "dsa.h")) {
        $configdefh{"HAVE_OPENSSL_DSA"} = 1;
    } elsif ($verbose) {
        print "OpenSSL DSA support is disabled\n";
    }
}

# check OpenSSL
if ($use_openssl eq "yes") {
    if ($verbose) {
        print "checking whether linking with OpenSSL works\n";
    }
    my $dll = $configdll{"OPENSSL_DLL"};
    my $ret = `copy "$dll" .`;
    if ($? != 0) {
        die "Can't copy OpenSSL DLL to working directory: $ret\n";
    }
    open F, ">testossl.c" || die $!;
    print F << 'EOF';
#include <openssl/err.h>

int
main(void)
{
        ERR_clear_error();
        return(0);
}
EOF
    close F;
    my $include = $configinc{"OPENSSL_INC"};
    my $library = $configlib{"OPENSSL_LIB"};
    $compret = `cl /nologo /MD /I "$include" testossl.c "$library"`;
    if (grep { -f and -x } ".\\testossl.exe") {
        `.\\testossl.exe`;
        if ($? != 0) {
            die "OpenSSL test failed\n";
        }
    } else {
        die "can't compile OpenSSL test: $compret\n";
    }
}

# check OpenSSL version
if ($use_openssl eq "yes") {
    if ($verbose) {
        printf "checking OpenSSL library version\n";
    }
    open F, ">testosslv.c" || die $!;
    print F << 'EOF';
#include <stdio.h>
#include <openssl/opensslv.h>

int main() {
        if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
             OPENSSL_VERSION_NUMBER < 0x00908000L) ||
             OPENSSL_VERSION_NUMBER >= 0x0090804fL)
                return (0);
        printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
               OPENSSL_VERSION_NUMBER);
        printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
               "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
        return (1);
}
EOF
    close F;
    my $include = $configinc{"OPENSSL_INC"};
    my $library = $configlib{"OPENSSL_LIB"};
    $compret = `cl /nologo /MD /I "$include" testosslv.c "$library"`;
    if (grep { -f and -x } ".\\testosslv.exe") {
        `.\\testosslv.exe`;
        if ($? != 0) {
            die "OpenSSL version test failed\n";
        }
    } else {
        die "can't compile OpenSSL version test: $compret\n";
    }
}

1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656
# check FIPS_mode

if ($use_openssl eq "yes") {
    if ($verbose) {
        printf "checking for FIPS_mode\n";
    }
    open F, ">testfips.c" || die $!;
    print F << 'EOF';
extern int FIPS_mode();

int main() {
    return FIPS_mode();
}
EOF
    close F;
    my $library = $configlib{"OPENSSL_LIB"};
    $compret = `cl /nologo /MD testfips.c "$library"`;
    if (grep { -f and -x } ".\\testfips.exe") {
        $configdefh{"HAVE_FIPS_MODE"} = 1;
    } else {
        if ($verbose) {
            print "can't compile FIPS_mode test: $compret\n";
            print "disabling FIPS_mode\n";
        }
    }
}

1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680
# check EVP_sha256 / EVP_sha384 / EVP_sha512

if ($use_openssl eq "yes") {
    if ($verbose) {
        printf "checking for EVP_sha256\n";
    }
    open F, ">testsha256.c" || die $!;
    print F << 'EOF';
extern void *EVP_sha256();

int main() {
        return EVP_sha256() != 0;
}
EOF
    close F;
    my $library = $configlib{"OPENSSL_LIB"};
    $compret = `cl /nologo /MD testsha256.c "$library"`;
    if (grep { -f and -x } ".\\testsha256.exe") {
        `.\\testsha256.exe`;
        if ($? == 0) {
            if ($verbose) {
                print "EVP_sha256 test failed: disabling EVP_sha256\n";
            }
            $use_ecdsa = "no";
1681
            $enable_openssl_hash = "no";
1682 1683 1684 1685 1686 1687 1688 1689 1690
        } else {
            $configdefh{"HAVE_EVP_SHA256"} = 1;
        }
    } else {
        if ($verbose) {
            print "can't compile EVP_sha256 test: $compret\n";
            print "disabling EVP_sha256\n";
        }
        $use_ecdsa = "no";
1691
        $enable_openssl_hash = "no";
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713
    }

    if ($verbose) {
        printf "checking for EVP_sha384\n";
    }
    open F, ">testsha384.c" || die $!;
    print F << 'EOF';
extern void *EVP_sha384();

int main() {
        return EVP_sha384() != 0;
}
EOF
    close F;
    $compret = `cl /nologo /MD testsha384.c "$library"`;
    if (grep { -f