Configure 108 KB
Newer Older
1 2
#!/usr/bin/perl
#
3
# Copyright (C) 2013-2017  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 11 12 13 14 15 16

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

require 5.000;
use strict;
use File::Spec;
17
use Cwd;
18 19 20

# files to configure

21
my $configfile = "..\\config.h";
22
my $platformfile = "..\\lib\\isc\\win32\\include\\isc\\platform.h";
23 24
my $confshfile = "..\\bin\\tests\\system\\conf.sh";
my $icshfile = "..\\isc-config.sh";
25 26 27 28 29 30 31 32 33 34 35

my @filelist = ("..\\bin\\check\\win32\\checktool.dsp",
                "..\\bin\\check\\win32\\checkconf.dsp",
                "..\\bin\\check\\win32\\checkconf.mak",
                "..\\bin\\check\\win32\\checkzone.dsp",
                "..\\bin\\check\\win32\\checkzone.mak",
                "..\\bin\\confgen\\win32\\confgentool.dsp",
                "..\\bin\\confgen\\win32\\ddnsconfgen.dsp",
                "..\\bin\\confgen\\win32\\ddnsconfgen.mak",
                "..\\bin\\confgen\\win32\\rndcconfgen.dsp",
                "..\\bin\\confgen\\win32\\rndcconfgen.mak",
36 37
                "..\\bin\\delv\\win32\\delv.dsp",
                "..\\bin\\delv\\win32\\delv.mak",
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
                "..\\bin\\dig\\win32\\dig.dsp",
                "..\\bin\\dig\\win32\\dig.mak",
                "..\\bin\\dig\\win32\\dighost.dsp",
                "..\\bin\\dig\\win32\\host.dsp",
                "..\\bin\\dig\\win32\\host.mak",
                "..\\bin\\dig\\win32\\nslookup.dsp",
                "..\\bin\\dig\\win32\\nslookup.mak",
                "..\\bin\\dnssec\\win32\\dnssectool.dsp",
                "..\\bin\\dnssec\\win32\\dsfromkey.dsp",
                "..\\bin\\dnssec\\win32\\dsfromkey.mak",
                "..\\bin\\dnssec\\win32\\importkey.dsp",
                "..\\bin\\dnssec\\win32\\importkey.mak",
                "..\\bin\\dnssec\\win32\\keyfromlabel.dsp",
                "..\\bin\\dnssec\\win32\\keyfromlabel.mak",
                "..\\bin\\dnssec\\win32\\keygen.dsp",
                "..\\bin\\dnssec\\win32\\keygen.mak",
                "..\\bin\\dnssec\\win32\\revoke.dsp",
                "..\\bin\\dnssec\\win32\\revoke.mak",
                "..\\bin\\dnssec\\win32\\settime.dsp",
                "..\\bin\\dnssec\\win32\\settime.mak",
                "..\\bin\\dnssec\\win32\\signzone.dsp",
                "..\\bin\\dnssec\\win32\\signzone.mak",
                "..\\bin\\dnssec\\win32\\verify.dsp",
                "..\\bin\\dnssec\\win32\\verify.mak",
                "..\\bin\\named\\win32\\named.dsp",
                "..\\bin\\named\\win32\\named.mak",
                "..\\bin\\nsupdate\\win32\\nsupdate.dsp",
                "..\\bin\\nsupdate\\win32\\nsupdate.mak",
                "..\\bin\\pkcs11\\win32\\pk11destroy.dsp",
                "..\\bin\\pkcs11\\win32\\pk11destroy.mak",
                "..\\bin\\pkcs11\\win32\\pk11keygen.dsp",
                "..\\bin\\pkcs11\\win32\\pk11keygen.mak",
                "..\\bin\\pkcs11\\win32\\pk11list.dsp",
                "..\\bin\\pkcs11\\win32\\pk11list.mak",
Evan Hunt's avatar
Evan Hunt committed
72 73
                "..\\bin\\pkcs11\\win32\\pk11tokens.dsp",
                "..\\bin\\pkcs11\\win32\\pk11tokens.mak",
74 75
                "..\\bin\\python\\dnssec-checkds.py",
                "..\\bin\\python\\dnssec-coverage.py",
76
                "..\\bin\\python\\dnssec-keymgr.py",
77 78 79 80 81 82 83 84 85 86 87 88 89 90
                "..\\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",
91
                "..\\bin\\python\\isc\\utils.py",
92 93 94
                "..\\bin\\rndc\\win32\\rndc.dsp",
                "..\\bin\\rndc\\win32\\rndc.mak",
                "..\\bin\\rndc\\win32\\rndcutil.dsp",
95
                "..\\bin\\tests\\system\\dlz\\prereq.sh",
96 97 98 99 100 101 102 103
                "..\\bin\\tools\\win32\\arpaname.dsp",
                "..\\bin\\tools\\win32\\arpaname.mak",
                "..\\bin\\tools\\win32\\genrandom.dsp",
                "..\\bin\\tools\\win32\\genrandom.mak",
                "..\\bin\\tools\\win32\\ischmacfixup.dsp",
                "..\\bin\\tools\\win32\\ischmacfixup.mak",
                "..\\bin\\tools\\win32\\journalprint.dsp",
                "..\\bin\\tools\\win32\\journalprint.mak",
Francis Dupont's avatar
Francis Dupont committed
104 105
                "..\\bin\\tools\\win32\\mdig.dsp",
                "..\\bin\\tools\\win32\\mdig.mak",
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
                "..\\bin\\tools\\win32\\nsec3hash.dsp",
                "..\\bin\\tools\\win32\\nsec3hash.mak",
                "..\\bin\\tools\\win32\\rrchecker.dsp",
                "..\\bin\\tools\\win32\\rrchecker.mak",
                "..\\bin\\tests\\atomic\\win32\\t_atomic.dsp",
                "..\\bin\\tests\\atomic\\win32\\t_atomic.mak",
                "..\\bin\\tests\\db\\win32\\t_db.dsp",
                "..\\bin\\tests\\db\\win32\\t_db.mak",
                "..\\bin\\tests\\dst\\win32\\t_dst.dsp",
                "..\\bin\\tests\\dst\\win32\\t_dst.mak",
                "..\\bin\\tests\\master\\win32\\t_master.dsp",
                "..\\bin\\tests\\master\\win32\\t_master.mak",
                "..\\bin\\tests\\mem\\win32\\t_mem.dsp",
                "..\\bin\\tests\\mem\\win32\\t_mem.mak",
                "..\\bin\\tests\\hashes\\win32\\t_hashes.dsp",
                "..\\bin\\tests\\hashes\\win32\\t_hashes.mak",
                "..\\bin\\tests\\names\\win32\\t_names.dsp",
                "..\\bin\\tests\\names\\win32\\t_names.mak",
                "..\\bin\\tests\\rbt\\win32\\t_rbt.dsp",
                "..\\bin\\tests\\rbt\\win32\\t_rbt.mak",
                "..\\bin\\tests\\resolver\\win32\\t_resolver.dsp",
                "..\\bin\\tests\\resolver\\win32\\t_resolver.mak",
                "..\\bin\\tests\\sockaddr\\win32\\t_sockaddr.dsp",
                "..\\bin\\tests\\sockaddr\\win32\\t_sockaddr.mak",
                "..\\bin\\tests\\tasks\\win32\\t_tasks.dsp",
                "..\\bin\\tests\\tasks\\win32\\t_tasks.mak",
                "..\\bin\\tests\\timers\\win32\\t_timers.dsp",
                "..\\bin\\tests\\timers\\win32\\t_timers.mak",
134 135
                "..\\bin\\tests\\system\\win32\\bigkey.dsp",
                "..\\bin\\tests\\system\\win32\\bigkey.mak",
136 137
                "..\\bin\\tests\\system\\win32\\feature-test.dsp",
                "..\\bin\\tests\\system\\win32\\feature-test.mak",
138 139 140 141 142 143 144 145 146 147
                "..\\bin\\tests\\system\\win32\\gencheck.dsp",
                "..\\bin\\tests\\system\\win32\\gencheck.mak",
                "..\\bin\\tests\\system\\win32\\keycreate.dsp",
                "..\\bin\\tests\\system\\win32\\keycreate.mak",
                "..\\bin\\tests\\system\\win32\\keydelete.dsp",
                "..\\bin\\tests\\system\\win32\\keydelete.mak",
                "..\\bin\\tests\\system\\win32\\lwtest.dsp",
                "..\\bin\\tests\\system\\win32\\lwtest.mak",
                "..\\bin\\tests\\system\\win32\\pipequeries.dsp",
                "..\\bin\\tests\\system\\win32\\pipequeries.mak",
148 149 150 151
                "..\\bin\\tests\\win32\\backtrace_test.dsp",
                "..\\bin\\tests\\win32\\backtrace_test.mak",
                "..\\bin\\tests\\win32\\inter_test.dsp",
                "..\\bin\\tests\\win32\\inter_test.mak",
152 153
                "..\\bin\\tests\\win32\\makejournal.dsp",
                "..\\bin\\tests\\win32\\makejournal.mak",
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
                "..\\bin\\tests\\win32\\rwlock_test.dsp",
                "..\\bin\\tests\\win32\\rwlock_test.mak",
                "..\\bin\\tests\\win32\\shutdown_test.dsp",
                "..\\bin\\tests\\win32\\shutdown_test.mak",
                "..\\bin\\tests\\win32\\sock_test.dsp",
                "..\\bin\\tests\\win32\\sock_test.mak",
                "..\\bin\\tests\\win32\\task_test.dsp",
                "..\\bin\\tests\\win32\\task_test.mak",
                "..\\bin\\tests\\win32\\timer_test.dsp",
                "..\\bin\\tests\\win32\\timer_test.mak",
                "..\\bin\\tests\\win32\\inter_test.dsp",
                "..\\bin\\tests\\win32\\inter_test.mak",
                "..\\bin\\tests\\win32\\rwlock_test.dsp",
                "..\\bin\\tests\\win32\\rwlock_test.mak",
                "..\\bin\\tests\\win32\\shutdown_test.dsp",
                "..\\bin\\tests\\win32\\shutdown_test.mak",
                "..\\bin\\tests\\win32\\sock_test.dsp",
                "..\\bin\\tests\\win32\\sock_test.mak",
                "..\\bin\\tests\\win32\\task_test.dsp",
                "..\\bin\\tests\\win32\\task_test.mak",
                "..\\bin\\tests\\win32\\timer_test.dsp",
                "..\\bin\\tests\\win32\\timer_test.mak",
                "..\\bin\\win32\\BINDInstall\\BINDInstall.dsp",
                "..\\bin\\win32\\BINDInstall\\BINDInstall.mak",
                "..\\lib\\bind9\\win32\\libbind9.dsp",
                "..\\lib\\bind9\\win32\\libbind9.mak",
                "..\\lib\\dns\\win32\\gen.dsp",
                "..\\lib\\dns\\win32\\gen.mak",
                "..\\lib\\dns\\win32\\libdns.def",
                "..\\lib\\dns\\win32\\libdns.dsp",
                "..\\lib\\dns\\win32\\libdns.mak",
185 186
                "..\\lib\\irs\\win32\\libirs.dsp",
                "..\\lib\\irs\\win32\\libirs.mak",
187 188 189 190 191 192 193 194 195
                "..\\lib\\isc\\win32\\libisc.def",
                "..\\lib\\isc\\win32\\libisc.dsp",
                "..\\lib\\isc\\win32\\libisc.mak",
                "..\\lib\\isccc\\win32\\libisccc.dsp",
                "..\\lib\\isccc\\win32\\libisccc.mak",
                "..\\lib\\isccfg\\win32\\libisccfg.dsp",
                "..\\lib\\isccfg\\win32\\libisccfg.mak",
                "..\\lib\\lwres\\win32\\liblwres.dsp",
                "..\\lib\\lwres\\win32\\liblwres.mak",
196 197 198 199 200 201 202 203 204 205 206 207
                "..\\lib\\samples\\win32\\async.dsp",
                "..\\lib\\samples\\win32\\async.mak",
                "..\\lib\\samples\\win32\\gai.dsp",
                "..\\lib\\samples\\win32\\gai.mak",
                "..\\lib\\samples\\win32\\nsprobe.dsp",
                "..\\lib\\samples\\win32\\nsprobe.mak",
                "..\\lib\\samples\\win32\\request.dsp",
                "..\\lib\\samples\\win32\\request.mak",
                "..\\lib\\samples\\win32\\resolve.dsp",
                "..\\lib\\samples\\win32\\resolve.mak",
                "..\\lib\\samples\\win32\\update.dsp",
                "..\\lib\\samples\\win32\\update.mak",
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
                "..\\lib\\tests\\win32\\libtests.dsp",
                "..\\lib\\tests\\win32\\libtests.mak",
                "..\\lib\\win32\\bindevt\\bindevt.dsp",
                "..\\lib\\win32\\bindevt\\bindevt.mak",
                "legacy\\BINDBuild.dsw",
                "legacy\\BuildAll.bat",
                "legacy\\BuildPost.bat",
                "legacy\\BuildSetup.bat");

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",
229 230
                   "..\\bin\\delv\\win32\\delv.vcxproj",
                   "..\\bin\\delv\\win32\\delv.vcxproj.filters",
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
                   "..\\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
267 268
                   "..\\bin\\pkcs11\\win32\\pk11tokens.vcxproj",
                   "..\\bin\\pkcs11\\win32\\pk11tokens.vcxproj.filters",
269 270 271 272 273 274 275 276 277 278 279 280
                   "..\\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\\ischmacfixup.vcxproj",
                   "..\\bin\\tools\\win32\\ischmacfixup.vcxproj.filters",
                   "..\\bin\\tools\\win32\\journalprint.vcxproj",
                   "..\\bin\\tools\\win32\\journalprint.vcxproj.filters",
Francis Dupont's avatar
Francis Dupont committed
281 282
                   "..\\bin\\tools\\win32\\mdig.vcxproj",
                   "..\\bin\\tools\\win32\\mdig.vcxproj.filters",
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
                   "..\\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\\master\\win32\\t_master.vcxproj",
                   "..\\bin\\tests\\master\\win32\\t_master.vcxproj.filters",
                   "..\\bin\\tests\\mem\\win32\\t_mem.vcxproj",
                   "..\\bin\\tests\\mem\\win32\\t_mem.vcxproj.filters",
                   "..\\bin\\tests\\hashes\\win32\\t_hashes.vcxproj",
                   "..\\bin\\tests\\hashes\\win32\\t_hashes.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",
                   "..\\bin\\tests\\sockaddr\\win32\\t_sockaddr.vcxproj",
                   "..\\bin\\tests\\sockaddr\\win32\\t_sockaddr.vcxproj.filters",
307 308
                   "..\\bin\\tests\\system\\win32\\bigkey.vcxproj",
                   "..\\bin\\tests\\system\\win32\\bigkey.vcxproj.filters",
309 310
                   "..\\bin\\tests\\system\\win32\\feature-test.vcxproj",
                   "..\\bin\\tests\\system\\win32\\feature-test.vcxproj.filters",
311 312 313 314 315 316 317 318 319 320
                   "..\\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\\lwtest.vcxproj",
                   "..\\bin\\tests\\system\\win32\\lwtest.vcxproj.filters",
                   "..\\bin\\tests\\system\\win32\\pipequeries.vcxproj",
                   "..\\bin\\tests\\system\\win32\\pipequeries.vcxproj.filters",
321 322 323 324 325 326 327 328
                   "..\\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",
329 330
                   "..\\bin\\tests\\win32\\makejournal.vcxproj",
                   "..\\bin\\tests\\win32\\makejournal.vcxproj.filters",
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
                   "..\\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",
361 362
                   "..\\lib\\irs\\win32\\libirs.vcxproj",
                   "..\\lib\\irs\\win32\\libirs.vcxproj.filters",
363 364 365 366 367 368 369 370
                   "..\\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",
                   "..\\lib\\lwres\\win32\\liblwres.vcxproj",
                   "..\\lib\\lwres\\win32\\liblwres.vcxproj.filters",
371 372 373 374 375 376 377 378 379 380 381 382
                   "..\\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",
383 384 385 386 387 388 389 390 391 392
                   "..\\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
393
my @substdefh = ("AES_CC",
394
                 "ALLOW_FILTER_AAAA",
395 396 397 398 399 400 401 402 403
                 "CONFIGARGS",
                 "DNS_RDATASET_FIXED",
                 "ENABLE_RPZ_NSDNAME",
                 "ENABLE_RPZ_NSIP",
                 "HAVE_EVP_SHA256",
                 "HAVE_EVP_SHA384",
                 "HAVE_EVP_SHA512",
                 "HAVE_GEOIP",
                 "HAVE_GEOIP_CITY_V6",
404
                 "HAVE_GEOIP_V6",
405
                 "HAVE_LIBXML2",
406
                 "HAVE_OPENSSL_AES",
407 408
                 "HAVE_OPENSSL_DSA",
                 "HAVE_OPENSSL_ECDSA",
409
                 "HAVE_OPENSSL_EVP_AES",
410
                 "HAVE_OPENSSL_GOST",
Evan Hunt's avatar
Evan Hunt committed
411 412
                 "HAVE_PKCS11_ECDSA",
                 "HAVE_PKCS11_GOST",
413
                 "HAVE_READLINE",
Francis Dupont's avatar
Francis Dupont committed
414 415 416
                 "HAVE_ZLIB",
                 "HMAC_SHA1_CC",
                 "HMAC_SHA256_CC",
417
                 "ISC_LIST_CHECKINIT",
418
                 "PREFER_GOSTASN1",
419
                 "TUNE_LARGE",
420
                 "WANT_QUERYTRACE",
421
                 "WITH_IDN");
422 423 424 425 426

# for platform.h

my %configdefp;

Evan Hunt's avatar
Evan Hunt committed
427 428
my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP",
                 "ISC_PLATFORM_HAVEATOMICSTORE",
429
                 "ISC_PLATFORM_HAVEATOMICSTOREQ",
430 431 432
                 "ISC_PLATFORM_HAVECMPXCHG",
                 "ISC_PLATFORM_HAVEXADD",
                 "ISC_PLATFORM_HAVEXADDQ",
Evan Hunt's avatar
Evan Hunt committed
433
                 "ISC_PLATFORM_NEEDSTRCASESTR",
434 435
                 "ISC_PLATFORM_USEBACKTRACE",
                 "ISC_PLATFORM_WANTAES");
436

437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
# for conf.sh

my %configtest;

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

453 454 455 456 457 458 459 460 461
# includes

my %configinc;

my @substinc = ("GSSAPI_INC",
                "GEOIP_INC",
                "IDN_INC",
                "LIBXML2_INC",
                "OPENSSL_INC",
Francis Dupont's avatar
Francis Dupont committed
462 463
                "READLINE_INC",
                "ZLIB_INC");
464 465 466 467 468 469 470 471 472 473 474 475

# 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
476 477
                "READLINE_LIBD",
                "ZLIB_LIB");
478 479 480 481 482 483 484 485 486 487 488 489 490 491

# 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
492 493
                "WSHELP_DLL",
                "ZLIB_DLL");
494 495 496 497 498

# variables

my %configvar;

Francis Dupont's avatar
Francis Dupont committed
499 500
my @substvar = ("BIND9_VERSION",
                "BUILD_MACHINE",
501 502 503 504 505 506
                "BUILD_PLATFORM",
                "COPTI",
                "COPTML",
                "COPTMLD",
                "COPTX",
                "COPTY",
507 508
                "DLZ_SYSTEM_TEST",
                "EXEEXT",
509
                "expanded_sysconfdir",
510 511 512 513 514 515 516 517 518 519 520 521 522
                "INTRINSIC",
                "MACHINE",
                "OPENSSL_PATH",
                "PLATFORM",
                "PKCS11_TOOLS",
                "prefix",
                "PYTHON",
                "VCREDIST_PATH"),

# defines

my %configdefd;

Evan Hunt's avatar
Evan Hunt committed
523 524
my @substdefd = ("CRYPTO",
                 "PK11_LIB_LOCATION",
525 526 527 528 529 530 531 532 533
                 "USE_GSSAPI",
                 "USE_PKCS11",
                 "USE_PYTHON",
                 "USE_ISC_SPNEGO");

# conditions

my %configcond;

534 535
my @substcond = ("AES",
                 "ATOMIC",
536 537 538 539 540 541 542
                 "GSSAPI",
                 "GEOIP",
                 "IDNKIT",
                 "LIBXML2",
                 "OPENSSL",
                 "PKCS11",
                 "PYTHON",
543
                 "SAMPLES",
544
                 "STESTS",
545
                 "TESTS",
Francis Dupont's avatar
Francis Dupont committed
546 547 548 549
                 "XTESTS",
                 "ZLIB");

my @allcond = (@substcond, "NOTYET", "NOLONGER");
550 551 552 553 554 555 556 557 558

# arguments

# enable-xxx/disable-xxx

my @enablelist = ("developer",
                  "fixed-rrset",
                  "intrinsics",
                  "isc-spnego",
Evan Hunt's avatar
Evan Hunt committed
559
                  "native-pkcs11",
560 561
                  "openssl-hash",
                  "filter-aaaa",
562
                  "querytrace",
563
                  "rpz-nsdname",
Francis Dupont's avatar
Francis Dupont committed
564
                  "rpz-nsip");
565 566 567

# with-xxx/without-xxx

568
my @withlist = ("aes",
569
                "cc-alg",
570
                "cross-compile",
571 572 573 574 575 576 577 578 579 580 581 582
                "ecdsa",
                "extra-tests",
                "gssapi",
                "geoip",
                "gost",
                "iconv",
                "idn",
                "openssl",
                "libxml2",
                "pkcs11",
                "python",
                "readline",
583
                "samples",
584
                "system-tests",
585
                "tests",
586
                "tuning",
Francis Dupont's avatar
Francis Dupont committed
587 588
                "vcredist",
                "zlib");
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614

# 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",
"  legacy                (options) process only files for legacy build\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
615
"  enable-native-pkcs11  use native PKCS#11 for all crypto [default=no]\n",
616
"  enable-openssl-hash   use OpenSSL for hash functions [default=yes]\n",
617 618 619 620
"  enable-isc-spnego     use SPNEGO from lib/dns [default=yes]\n",
"  enable-filter-aaaa    enable filtering of AAAA records [default=no]\n",
"  enable-fixed-rrset    enable fixed rrset ordering [default=no]\n",
"  enable-developer      enable developer build settings [default=no]\n",
621
"  enable-querytrace     enable very verbose query trace [default=no]\n",
622 623 624 625 626
"  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",
627
"  with-system-tests     build with system test suite\n",
628
"  with-samples          build with sample programs\n",
629 630 631
"  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",
632
"  with-gost[=ENC]       crypto GOST yes|no|raw|ans1\n",
633
"  with-aes              crypto AES\n",
Francis Dupont's avatar
Francis Dupont committed
634
"  with-cc-alg           choose the algorithm for cookies aes|sha1|sha256\n",
635 636 637 638 639 640 641
"  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",
"  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
642
"  with-zlib[=PATH]      build with zlib library yes|no|path\n",
Evan Hunt's avatar
Evan Hunt committed
643
"  with-vcredist[=PATH]  visual C++ redistributable package yes|path\n",
644
"  with-tuning=OPTION    tune for plaform size (large|default)\n",
645 646 647 648 649 650 651 652 653 654 655 656 657
"  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
658
my $enable_native_pkcs11 = "no";
659
my $enable_openssl_hash = "auto";
660 661 662 663
my $enable_filter_aaaa = "no";
my $enable_isc_spnego = "yes";
my $enable_fixed_rrset = "no";
my $enable_developer = "no";
664
my $enable_querytrace = "no";
665 666 667 668
my $enable_rpz_nsip = "yes";
my $enable_rpz_nsdname = "yes";
my $use_tests = "no";
my $use_xtests = "no";
669
my $use_stests = "no";
670
my $use_samples = "no";
671 672 673 674 675 676
my $use_openssl = "auto";
my $openssl_path = "..\\..\\";
my $use_pkcs11 = "no";
my $pkcs11_path = "unknown";
my $use_ecdsa = "auto";
my $use_gost = "auto";
677
my $gost_encoding = "raw";
678
my $use_aes = "auto";
Francis Dupont's avatar
Francis Dupont committed
679
my $cookie_algorithm = "aes";
680 681 682 683 684 685 686
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 = "..\\..\\";
my $use_python = "auto";
687
my $python_command = "python.exe";
688 689 690 691 692
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
693 694
my $use_zlib = "no";
my $zlib_path = "..\\..\\";
695 696 697
my $use_vcredist = "yes";
my $vcredist_path = " --infer-- ";
my $cross_compile = "no";
698
my $tuning = "default";
699
my $want_checkfiles = "no";
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719

# 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
720
    } elsif (/^enable-(.*)$/i) {
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
        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";
741 742
    } elsif (/^checkfiles$/i) {
        $want_checkfiles = "yes";
743 744 745 746 747 748 749 750 751 752 753 754
    } else {
        $want_unknown = "yes";
        $unknown_value = $_;
    }
}

# legacy default to win32

if ($legacy_only && ($want_x64 ne "yes")) {
    $want_win32 = "yes";
}

755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770
if ($want_checkfiles eq "yes") {
	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);
}

771 772 773 774 775 776 777 778 779
# 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
780
    $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "__asm { rep nop }";
781 782 783 784 785
} elsif ($want_x64 eq "yes") {
    $configvar{"PLATFORM"} = "x64";
    $configvar{"BUILD_PLATFORM"} = "x64";
    $configvar{"MACHINE"} = "/machine:X64";
    $configvar{"BUILD_MACHINE"} = "/machine:X64";
786
    $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "_mm_pause()";
787
}
788 789
# Standard configure variable
$configvar{"EXEEXT"} = ".exe";
790

Francis Dupont's avatar
Francis Dupont committed
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
# 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();

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
# 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
861 862 863 864
    } elsif ($key =~ /^native-pkcs11$/i) {
        if ($val =~ /^yes$/i) {
            $enable_native_pkcs11 = "yes";
        }
865 866 867
    } elsif ($key =~ /^openssl-hash$/i) {
        if ($val =~ /^yes$/i) {
            $enable_openssl_hash = "yes";
868 869
        } elsif ($val =~ /^no$/i) {
            $enable_openssl_hash = "no";
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886
        }
    } elsif ($key =~ /^isc-spnego$/i) {
        if ($val =~ /^no$/i) {
            $enable_isc_spnego = "no";
        }
    } elsif ($key =~ /^filter-aaaa$/i) {
        if ($val =~ /^yes$/i) {
            $enable_filter_aaaa = "yes";
        }
    } elsif ($key =~ /^fixed-rrset$/i) {
        if ($val =~ /^yes$/i) {
            $enable_fixed_rrset = "yes";
        }
    } elsif ($key =~ /^developer$/i) {
        if ($val =~ /^yes$/i) {
            $enable_developer = "yes";
        }
887 888 889 890
    } elsif ($key =~ /^querytrace$/i) {
        if ($val =~ /^yes$/i) {
            $enable_querytrace = "yes";
        }
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913
    } 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;
    $enable_filter_aaaa = "yes";
914
    $enable_querytrace = "yes";
915 916 917 918
    # no atf on WIN32
    $enable_fixed_rrset = "yes";
    # TODO: dlz filesystem
    $use_tests = "yes";
919 920
    $use_xtests = "yes";
    $use_stests = "yes";
921
    $use_samples = "yes";
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938
}

# 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";
        }
939 940 941 942 943
    } elsif ($key =~ /^system-tests$/i) {
        if ($val =~ /^yes$/i) {
            $use_tests = "yes";
            $use_stests = "yes";
        }
944 945 946 947
    } elsif ($key =~ /^samples$/i) {
        if ($val =~ /^yes$/i) {
            $use_samples = "yes";
        }
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973
    } 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";
        }
    } elsif ($key =~ /^gost$/i) {
        if ($val =~ /^no$/i) {
            $use_gost = "no";
        } elsif ($val =~ /^yes$/i) {
            $use_gost = "yes";
974
            $gost_encoding = $val;
975
        }
976 977 978 979 980 981
    } 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
982 983
    } elsif ($key =~ /^cc-alg$/i) {
        $cookie_algorithm = $val;
984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
    } 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
1026 1027 1028 1029 1030 1031 1032
    } elsif ($key =~ /^zlib$/i) {
        if ($val !~ /^no$/i) {
            $use_zlib = "yes";
            if ($val !~ /^yes$/i) {
                $zlib_path = $val;
            }
        }
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
    } 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";
        }
1053 1054 1055 1056
    } elsif ($key =~ /^tuning$/i) {
        if ($val =~ /^large$/i) {
            $tuning = "large";
        }
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
    } else {
        $want_unknown = "yes";
        if ($val eq "no") {
            $unknown_value = "without-" . $key;
        } else {
            $unknown_value = "with-" . $key;
        }
    }
}

1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
# 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";
    }
}

1080 1081 1082 1083 1084 1085 1086 1087 1088 1089
if ($want_help ne "no") {
    foreach (@help) {
        print $_;
    }
    exit 1;
}

# clean up and exit if requested
if ($want_clean eq "yes") {
    my $file;
1090 1091 1092 1093 1094 1095

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

1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
    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
1134 1135 1136 1137 1138
    if ($enable_native_pkcs11 eq "yes") {
        print "native-pkcs11: enabled\n";
    } else {
        print "native-pkcs11: disabled\n";
    }
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
    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_filter_aaaa eq "yes") {
        print "filter-aaaa: enabled\n";
    } else {
        print "filter-aaaa: 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";
    }
1164 1165 1166 1167 1168
    if ($enable_querytrace eq "yes") {
        print "querytrace: enabled\n";
    } else {
        print "querytrace: disabled\n";
    }
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178
    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
1179
    print "cookie algorithm: $cookie_algorithm\n";
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190
    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";
    }
1191 1192 1193
    if ($use_stests eq "yes") {
        print "system tests: enabled\n";
    }
1194 1195 1196
    if ($use_samples eq "yes") {
        print "sample programs: enabled\n";
    }
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210
    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";
    }
    if ($use_gost eq "no") {
        print "gost: disabled\n";
    } else {
        print "gost: enabled\n";
1211
        print "gost private key encoding: $gost_encoding\n";
1212
    }
1213 1214 1215 1216 1217
    if ($use_aes eq "no") {
        print "aes: disabled\n";
    } else {
        print "aes: enabled\n";
    }
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
    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
1246 1247 1248 1249 1250
    if ($use_zlib eq "no") {
        print "zlib: disabled\n";
    } else {
        print "zlib-path: $zlib_path\n";
    }
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265
    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";
    }
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

    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";