#
# Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
#
# 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/.
# Configure
#
# This script builds nmake and visual studio build files
#
require 5.000;
use strict;
use Cwd;
# files to configure
my $configfile = "..\\config.h";
my $platformfile = "..\\lib\\isc\\win32\\include\\isc\\platform.h";
my $confshfile = "..\\bin\\tests\\system\\conf.sh";
my $icshfile = "..\\isc-config.sh";
# for config.h
my %configdefh;
"ALLOW_FILTER_AAAA",
"CONFIGARGS",
"DNS_RDATASET_FIXED",
"ENABLE_RPZ_NSDNAME",
"ENABLE_RPZ_NSIP",
"HAVE_EVP_SHA256",
"HAVE_EVP_SHA384",
"HAVE_EVP_SHA512",
"HAVE_FIPS_MODE",
"HAVE_GEOIP",
"HAVE_GEOIP_CITY_V6",
"HAVE_GEOIP_V6",
"HAVE_LIBXML2",
"HAVE_OPENSSL_AES",
"HAVE_OPENSSL_DSA",
"HAVE_OPENSSL_ECDSA",
"HAVE_OPENSSL_ED25519",
"HAVE_OPENSSL_ED448",
"HAVE_OPENSSL_EVP_AES",
"HAVE_OPENSSL_GOST",
"HAVE_PKCS11_ECDSA",
"HAVE_PKCS11_ED25519",
"HAVE_PKCS11_ED448",
"HAVE_PKCS11_GOST",
"HAVE_READLINE",
"HAVE_ZLIB",
"HMAC_SHA1_CC",
"HMAC_SHA256_CC",
"ISC_LIST_CHECKINIT",
"PREFER_GOSTASN1",
"TUNE_LARGE",
"WANT_QUERYTRACE",
"WITH_IDN");
# for platform.h
my %configdefp;
"ISC_PLATFORM_HAVEATOMICSTORE",
"ISC_PLATFORM_HAVEATOMICSTOREQ",
"ISC_PLATFORM_HAVECMPXCHG",
"ISC_PLATFORM_HAVEXADD",
"ISC_PLATFORM_HAVEXADDQ",
"ISC_PLATFORM_NEEDSTRCASESTR",
"ISC_PLATFORM_USEBACKTRACE",
"ISC_PLATFORM_WANTAES");
# for conf.sh
my %configtest;
"CHECKDS",
"COVERAGE",
"DNSTAP",
"FSTRM_CAPTURE",
"JSONSTATS",
"KEYMGR",
"NZD_TOOLS",
"PKCS11_TEST",
"XMLSTATS",
"ZLIB"),
# includes
my %configinc;
"GEOIP_INC",
"IDN_INC",
"LIBXML2_INC",
"OPENSSL_INC",
"READLINE_INC",
"ZLIB_INC");
# libraries
my %configlib;
"GEOIP_LIB",
"IDN_LIB",
"KRB5_LIB",
"LIBXML2_LIB",
"OPENSSL_LIB",
"READLINE_LIB",
"READLINE_LIBD",
"ZLIB_LIB");
# DLLs
my %configdll;
"GSSAPI_DLL",
"GEOIP_DLL",
"ICONV_DLL",
"IDN_DLL",
"KRB5_DLL",
"K5SPRT_DLL",
"LIBXML2_DLL",
"OPENSSL_DLL",
"WSHELP_DLL",
"ZLIB_DLL");
# variables
my %configvar;
"BUILD_MACHINE",
"BUILD_PLATFORM",
"COPTI",
"COPTML",
"COPTMLD",
"COPTX",
"COPTY",
"DLZ_SYSTEM_TEST",
"EXEEXT",
"expanded_sysconfdir",
"INTRINSIC",
"MACHINE",
"OPENSSL_PATH",
"PLATFORM",
"PKCS11_TOOLS",
"prefix",
"PYTHON",
"PYTHON_INSTALL_DIR",
"VCREDIST_PATH"),
# defines
my %configdefd;
"PK11_LIB_LOCATION",
"USE_GSSAPI",
"USE_PKCS11",
"USE_PYTHON",
"USE_ISC_SPNEGO");
# conditions
my %configcond;
"ATOMIC",
"GSSAPI",
"GEOIP",
"IDNKIT",
"LIBXML2",
"OPENSSL",
"PKCS11",
"PYTHON",
"SAMPLES",
"STESTS",
"TESTS",
"XTESTS",
"ZLIB");
# arguments
"fixed-rrset",
"intrinsics",
"isc-spnego",
"native-pkcs11",
"openssl-hash",
"filter-aaaa",
"querytrace",
"rpz-nsdname",
"rpz-nsip");
"cc-alg",
"cross-compile",
"ecdsa",
"eddsa",
"extra-tests",
"gssapi",
"geoip",
"gost",
"iconv",
"idn",
"openssl",
"libxml2",
"pkcs11",
"python",
"readline",
"samples",
"system-tests",
"tests",
"tuning",
"vcredist",
"zlib");
# general arguments
# usage
" 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",
" enable-native-pkcs11 use native PKCS#11 for all crypto [default=no]\n",
" enable-openssl-hash use OpenSSL for hash functions [default=yes]\n",
" enable-filter-aaaa enable filtering of AAAA records [default=yes]\n",
" enable-fixed-rrset enable fixed rrset ordering [default=no]\n",
" enable-developer enable developer build settings [default=no]\n",
" enable-querytrace enable very verbose query trace [default=no]\n",
" 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",
" with-system-tests build with system test suite\n",
" with-samples build with sample programs\n",
" 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",
" with-eddsa crypto EDDSA yes|all|no\n",
" with-gost[=ENC] crypto GOST yes|no|raw|ans1\n",
" with-aes crypto AES\n",
" with-cc-alg choose the algorithm for cookies aes|sha1|sha256\n",
" 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",
" with-zlib[=PATH] build with zlib library yes|no|path\n",
" with-vcredist[=PATH] visual C++ redistributable package yes|path\n",
" with-tuning=OPTION tune for plaform size (large|default)\n",
" 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";
my $enable_native_pkcs11 = "no";
my $enable_openssl_hash = "auto";
my $enable_filter_aaaa = "yes";
my $enable_isc_spnego = "yes";
my $enable_fixed_rrset = "no";
my $enable_developer = "no";
my $enable_querytrace = "no";
my $enable_rpz_nsip = "yes";
my $enable_rpz_nsdname = "yes";
my $use_tests = "no";
my $use_xtests = "no";
my $use_stests = "no";
my $use_samples = "no";
my $use_openssl = "auto";
my $openssl_path = "..\\..\\";
my $use_pkcs11 = "no";
my $pkcs11_path = "unknown";
my $use_ecdsa = "auto";
my $use_eddsa = "auto";
my $use_ed448 = "auto";
my $use_gost = "auto";
my $gost_encoding = "raw";
my $use_aes = "auto";
my $cookie_algorithm = "aes";
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";
my $python_command = "python.exe";
my $use_readline = "no";
my $readline_path = "..\\..\\";
my $use_idn = "no";
my $idn_path = "..\\..\\";
my $iconv_path = " --idn-- ";
my $use_zlib = "no";
my $zlib_path = "..\\..\\";
my $use_vcredist = "yes";
my $vcredist_path = " --infer-- ";
my $cross_compile = "no";
my $tuning = "default";
my $want_checkfiles = "no";
# no arguments -> usage
if ($#ARGV < 0) {
print $_;
}
exit 1;
}
# parse arguments
foreach (@ARGV) {
$verbose = 1;
$legacy_only = 1;
} else {
$unknown_value = $_;
}
}
# legacy default to win32
}
next if -r $_ . ".in";
s/\\/\//g;
next if -r $_ . ".in";
}
next if -r $_ . ".in";
s/\\/\//g;
next if -r $_ . ".in";
}
exit(0);
}
# configure the platform
}
# Standard configure variable
# get the version information
my %Versions;
sub getversion {
my $data;
my $name;
my $value;
my $version;
while (<V>) {
($value) =~ s/["\s]+$//;
} else {
}
}
}
close V;
}
}
getversion();
# append seen args to CONFIGARGS define
sub appargs {
my $arg = $_[0];
# escape backslashes, spaces and double quotes
} else {
}
}
} else {
}
sub myenable {
my $key = $_[0];
my $val = $_[1];
if ($key =~ /^intrinsics$/i) {
if ($val =~ /^no$/i) {
}
} elsif ($key =~ /^native-pkcs11$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^openssl-hash$/i) {
if ($val =~ /^yes$/i) {
} elsif ($val =~ /^no$/i) {
}
} elsif ($key =~ /^isc-spnego$/i) {
if ($val =~ /^no$/i) {
}
} elsif ($key =~ /^filter-aaaa$/i) {
if ($val =~ /^no$/i) {
}
} elsif ($key =~ /^fixed-rrset$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^developer$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^querytrace$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^rpz-nsip$/i) {
if ($val =~ /^no$/i) {
}
} elsif ($key =~ /^rpz-nsdname$/i) {
if ($val =~ /^no$/i) {
}
} else {
} else {
}
}
}
# enable-developer expansion now
# no atf on WIN32
# TODO: dlz filesystem
}
sub mywith {
my $key = $_[0];
my $val = $_[1];
if ($key =~ /^tests$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^extra-tests$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^system-tests$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^samples$/i) {
if ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^openssl$/i) {
if ($val =~ /^no$/i) {
} elsif ($val !~ /^yes$/i) {
}
} elsif ($key =~ /^pkcs11$/i) {
if ($val =~ /^yes$/i) {
} elsif ($val !~ /^no$/i) {
$pkcs11_path = $val;
$pkcs11_path =~ s/\.dll$//i;
}
} elsif ($key =~ /^ecdsa$/i) {
if ($val =~ /^no$/i) {
} elsif ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^eddsa$/i) {
if ($val =~ /^no$/i) {
} elsif ($val !~ /^no$/i) {
if ($val =~ /^all$/i) {
}
}
} elsif ($key =~ /^gost$/i) {
if ($val =~ /^no$/i) {
} elsif ($val !~ /^no$/i) {
}
} elsif ($key =~ /^aes$/i) {
if ($val =~ /^no$/i) {
} elsif ($val =~ /^yes$/i) {
}
} elsif ($key =~ /^cc-alg$/i) {
} elsif ($key =~ /^gssapi$/i) {
if ($val !~ /^no$/i) {
if ($val !~ /^yes$/i) {
$gssapi_path = $val;
}
}
} elsif ($key =~ /^libxml2$/i) {
if ($val =~ /^no$/i) {
} elsif ($val !~ /^yes$/i) {
}
} elsif ($key =~ /^geoip$/i) {
if ($val !~ /^no$/i) {
if ($val !~ /^yes$/i) {
$geoip_path = $val;
}
}
} elsif ($key =~ /^readline$/i) {
if ($val !~ /^no$/i) {
if ($val !~ /^yes$/i) {
}
}
} elsif ($key =~ /^idn$/i) {
if ($val !~ /^no$/i) {
if ($val !~ /^yes$/i) {
}
}
} elsif ($key =~ /^iconv$/i) {
if ($val =~ /^no$/i) {
} elsif ($val !~ /^yes$/i) {
$iconv_path = $val;
}
} elsif ($key =~ /^zlib$/i) {
if ($val !~ /^no$/i) {
$use_zlib = "yes";
if ($val !~ /^yes$/i) {
$zlib_path = $val;
}
}
} 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";
}
} elsif ($key =~ /^tuning$/i) {
if ($val =~ /^large$/i) {
$tuning = "large";
}
} else {
$want_unknown = "yes";
if ($val eq "no") {
$unknown_value = "without-" . $key;
} else {
$unknown_value = "with-" . $key;
}
}
}
# 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";
}
}
if ($want_help ne "no") {
foreach (@help) {
print $_;
}
exit 1;
}
# clean up and exit if requested
if ($want_clean eq "yes") {
my $file;
unlink($configfile);
unlink($platformfile);
unlink($confshfile);
unlink($icshfile);
foreach $file (@filelist) {
unlink($file);
}
foreach $file (@projectlist) {
unlink($file);
}
exit 0;
}
if ($want_unknown ne "no") {
exit 1;
}
if ($verbose) {
}
}
} else {
print "\n";
}
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
}
}
}
}
} else {
}
} else {
}
} else {
} else {
}
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
}
} else {
}
} else {
}
}
# Check environment
# infer vcredist when not given
if ($verbose) {
}
my @vcpaths = {};
push(@vcpaths, File::Spec->catfile( cwd(), "..", ".." ));
}
}
}
}
my $rfile;
} else {
}
foreach (@vcpaths) {
if (-f $vp) {
last;
}
}
}
if ($verbose) {
}
}
my $msc_ver = 0;
print F << 'EOF';
#include <windows.h>
#include <stdio.h>
int
main(void)
{
printf("%d\n", _MSC_VER);
return(0);
}
EOF
close F;
} else {
}
if ($verbose) {
print "_MSC_VER == $msc_ver\n";
}
if ($msc_ver < 1600) {
print STDERR "only the legacy (cf legacy\\win32-build.txt) will work\n";
}
# 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;
}
# no version of MSVS supports strcasestr() yet
$configdefp{"ISC_PLATFORM_NEEDSTRCASESTR"} = 1;
# 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 $!;
#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 {
}
} else {
print F << 'EOF';
#include <windows.h>
#include <stdio.h>
int
main(void)
{
#ifndef _WIN64
#endif
return(0);
}
EOF
close F;
if ($cross) {
print STDERR $cross;
}
} else {
}
}
# 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;
$configdefp{"ISC_PLATFORM_HAVEATOMICSTOREQ"} = 1;
}
$configdefp{"ISC_PLATFORM_HAVEATOMICSTORE"} = 1;
$configdefp{"ISC_PLATFORM_HAVECMPXCHG"} = 1;
} else {
$configvar{"INTRINSIC"} = "false";
}
# enable-native-pkcs11
if ($enable_native_pkcs11 eq "yes") {
if ($use_openssl eq "auto") {
$use_openssl = "no";
}
if ($use_openssl ne "no") {
}
print "native PKCS#11 support: force with-pkcs11\n";
}
}
print "native PKCS#11 support: no PKCS#11 provider defined?\n";
}
}
print "no ECDSA support in native PKCS#11\n";
}
} else {
print "enabled ECDSA support in native PKCS#11\n";
}
}
print "no EDDSA support in native PKCS#11\n";
}
} else {
print "enabled Ed25519 support in native PKCS#11\n";
}
print "no Ed448 support in native PKCS#11\n";
}
} else {
print "enabled Ed448 support in native PKCS#11\n";
}
}
}
print "no GOST support in native PKCS#11\n";
}
} else {
print "enabled GOST support in native PKCS#11\n";
}
}
print "no AES support in native PKCS#11\n";
}
} else {
print "enabled AES support in native PKCS#11\n";
}
}
}
# enable-filter-aaaa
}
# enable-fixed-rrset
}
# enable-rpz-nsip
}
# enable-querytrace
}
# enable-rpz-nsdname
}
# with-tests
}
# with-extra-tests
}
# with-system-tests
}
# with-samples
}
# with-openssl
print "OpenSSL library is disabled\n";
}
print "checking for an OpenSSL built directory at sibling root\n";
}
# Make sure we have something
}
# Now see if we have a directory or just a file.
# Make sure we are case insensitive
my $file;
last;
}
last;
}
}
# If we have one use it otherwise report the error
}
}
# falls into (so no else)
}
my $openssl_new = 0;
$openssl_new = 1;
}
}
# Check libraries are where we expect
}
}
} else {
# OpenSSL >= 1.1 is easier at the exception of the DLL
print "new (>= 1.1) OpenSSL version\n";
}
}
# We must get one file only
}
}
}
print "OpenSSL DSA support is disabled\n";
}
}
# check OpenSSL
print "checking whether linking with OpenSSL works\n";
}
if ($? != 0) {
}
print F << 'EOF';
int
main(void)
{
return(0);
}
close F;
if ($? != 0) {
}
} else {
}
}
# check OpenSSL version
}
print F << 'EOF';
#include <stdio.h>
#include <openssl/opensslv.h>
OPENSSL_VERSION_NUMBER < 0x00908000L) ||
OPENSSL_VERSION_NUMBER >= 0x0090804fL)
return (0);
"Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
return (1);
}
close F;
if ($? != 0) {
}
} else {
}
}
# check FIPS_mode
}
print F << 'EOF';
}
close F;
} else {
print "disabling FIPS_mode\n";
}
}
}
# check EVP_sha256 / EVP_sha384 / EVP_sha512
}
print F << 'EOF';
}
close F;
if ($? == 0) {
print "EVP_sha256 test failed: disabling EVP_sha256\n";
}
} else {
}
} else {
print "disabling EVP_sha256\n";
}
}
}
print F << 'EOF';
}
close F;
if ($? == 0) {
print "EVP_sha384 test failed: disabling EVP_sha384\n";
}
} else {
}
} else {
print "disabling EVP_sha384\n";
}
}
}
print F << 'EOF';
}
close F;
if ($? == 0) {
print "EVP_sha512 test failed: disabling EVP_sha512\n";
}
} else {
}
} else {
print "disabling EVP_sha512\n";
}
}
}
# with-ecdsa
}
print "checking for OpenSSL ECDSA support\n";
}
print F << 'EOF';
int
main(void)
{
return (2);
return (0);
}
close F;
if ($? != 0) {
print "ECDSA test failed: disabling ECDSA\n";
}
}
} else {
print "disabling ECDSA\n";
}
}
}
}
# with-eddsa
}
print "checking for OpenSSL ED25519 support\n";
}
print F << 'EOF';
int
main(void)
{
return (2);
return (0);
}
close F;
if ($? != 0) {
print "EDDSA test failed: disabling EDDSA\n";
}
}
} else {
print "disabling EDDSA\n";
}
}
}
} else {
}
print "checking for OpenSSL ED448 support\n";
}
print F << 'EOF';
int
main(void)
{
return (2);
return (0);
}
close F;
if ($? != 0) {
print "ED448 test failed: disabling ED448\n";
}
}
} else {
print "disabling ED448\n";
}
}
}
}
# with-gost
}
print "checking for OpenSSL GOST support\n";
}
print F << 'EOF';
int
main(void)
{
#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
ENGINE *e;
if (e == NULL)
return (1);
return (1);
return (0);
#else
return (1);
#endif
}
close F;
if ($? != 0) {
print "GOST test failed: disabling GOST\n";
}
}
} else {
print "disabling GOST\n";
}
}
}
}
}
# with-aes
}
}
print "checking for OpenSSL EVP AES support\n";
}
print F << 'EOF';
int
main(void)
{
EVP_CIPHER *aes128, *aes192, *aes256;
return (1);
return (0);
}
close F;
if ($? != 0) {
print "EVP AES test failed: disabling EVP AES\n";
}
}
} else {
print "disabling EVP AES\n";
}
}
}
print "checking for OpenSSL native AES support\n";
}
print F << 'EOF';
AES_KEY k;
const unsigned char bufin[16];
unsigned char bufout[16];
int
main(void)
{
return (0);
}
close F;
if ($? != 0) {
print "native AES test failed: disabling AES\n";
}
}
} else {
print "disabling AES\n";
}
}
}
}
}
# with-cc-alg
} else {
}
}
}
# enable-openssl-hash
}
}
# with-pkcs11
}
# with-gssapi
print "gssapi library is disabled\n";
}
} else {
}
}
}
}
my $gssapi_lib;
my $krb5_lib;
"gssapi${bits}.lib")) {
}
"gssapi${bits}.lib");
"krb5_${bits}.lib")) {
}
"krb5_${bits}.lib");
"gssapi${bits}.lib")) {
}
"gssapi${bits}.lib");
"krb5_${bits}.lib")) {
}
"krb5_${bits}.lib");
} else {
}
}
}
}
}
}
"gssapi${bits}.dll");
"krb5_${bits}.dll");
"comerr${bits}.dll");
"k5sprt${bits}.dll");
"wshelp${bits}.dll");
}
# enable-isc-spnego
}
}
# with-geoip
print "geoip library is disabled\n";
}
} else {
}
}
}
}
print "checking for GeoIP support\n";
}
if ($? != 0) {
}
print F << 'EOF';
return GeoIP_open != 0;
}
close F;
if ($? == 0) {
}
} else {
}
print "checking for GeoIP Country IPv6 support\n";
}
print F << 'EOF';
#include <GeoIP.h>
int flag = 1;
if (flag)
return 1;
}
close F;
if ($? == 0) {
}
} else {
}
print "checking for GeoIP City IPv6 support\n";
}
print F << 'EOF';
#include <GeoIP.h>
#include <GeoIPCity.h>
int i = GEOIP_CITY_EDITION_REV0_V6;
int flag = 1;
if (flag)
return 1;
}
close F;
if ($? == 0) {
}
} else {
}
}
# with-readline
print "readline library is disabled\n";
}
} else {
}
}
}
my $readline_lib = File::Spec->catfile($readline_path,
my $readline_libd = File::Spec->catfile($readline_path,
} else {
}
}
# with-idn (including with-iconv)
print "IDN kit is disabled\n";
}
} else {
}
}
}
}
} else {
}
}
# with-libxml2
print "libxml2 library is disabled\n";
}
print "checking for a libxml2 built directory at sibling root\n";
}
# Make sure we have something
}
# Now see if we have a directory or just a file.
# Make sure we are case insensitive
my $file;
"include\\libxml",
last;
}
}
# If we have one use it otherwise report the error
}
}
# falls into (so no else)
}
"include\\libxml",
}
}
}
}
# with-zlib
print "zlib library is disabled\n";
}
} else {
}
}
}
}
}
# with-python
print "python is disabled\n";
}
print "checking for python in path\n";
}
if ($? != 0) {
}
}
}
if ($? != 0) {
}
}
}
# tried to use the full path without success here
print "checking for python module 'argparse'\n";
}
if ($? != 0) {
} else {
}
}
print "checking for python module 'ply'\n";
}
if ($? != 0) {
} else {
}
}
}
print "checking for python module 'win32api'\n";
}
if ($? != 0) {
} else {
print STDERR
}
}
}
print "checking for python module 'win32con'\n";
}
if ($? != 0) {
} else {
print STDERR
}
}
}
# Doesn't matter
}
}
# with-vcredist
} else {
}
# tuning
}
# escape spaces
sub kw {
if ($_[0] =~ / /) {
return "\"$_[0]\"";
} else {
return "$_[0]";
}
}
# setup config.h with %configdefh
sub setupconfigh {
my $line;
my @Lines;
@Lines = <F>;
close F;
} else {
}
}
}
}
}
close F;
}
# setup platform.h with %configdefp
sub setupplatformh {
my $line;
my @Lines;
@Lines = <F>;
close F;
} else {
}
}
}
}
}
close F;
}
# setup conf.sh with %configtest and %configvar
sub setupconfsh {
my $line;
my @Lines;
my $val;
@Lines = <F>;
close F;
} else {
$line = "$`$'";
}
} elsif ($1 ~~ @substvar) {
if (defined($configvar{$1})) {
$val = kw($configvar{$1});
} else {
}
} else {
die "unknown control $& in $confshfile.win32\n";
}
}
}
open F, ">" . $confshfile || die $!;
if ($verbose) {
print "Setting up $confshfile\n";
}
binmode(F);
foreach $line (@Lines) {
print F $line . "\n";
}
close F;
}
# setup isc-config.sh with %configvar accepting undefined
sub setupicsh {
my $line;
my @Lines;
my $val;
open F, $icshfile . ".in" || die $!;
@Lines = <F>;
close F;
foreach $line (@Lines) {
chomp $line;
while ($line =~ /@([^@]+)\@/) {
if ($1 ~~ @substvar) {
if (defined($configvar{$1})) {
$val = kw($configvar{$1});
$line = "$`$val$'";
} else {
}
} else {
}
}
}
open F, ">" . $icshfile || die $!;
if ($verbose) {
print "Setting up $icshfile\n";
}
binmode(F);
foreach $line (@Lines) {
print F $line . "\n";
}
close F;
}
# setup a file with %configcond stack and %config{var,defd,inc,lib,dll,test}
sub setupfile {
my $line;
my @Linesin;
my @Linesout;
my $filename = $_[0];
my $cond;
my @conds;
my $pass = 1;
my @passes;
my $val;
open F, $filename . ".in" || die $!;
@Linesin = <F>;
close F;
foreach $line (@Linesin) {
chomp $line;
if ($line =~ /^\@IF (.*)$/) {
if (defined($cond)) {
unshift(@conds, $cond);
unshift(@passes, $pass);
}
if ($1 ~~ @allcond) {
$cond = $1;
if (defined($configcond{$cond})) {
# do nothing
} else {
$pass = 0;
}
} else {
die "unknown condition \@IF $1 in $filename\n";
}
next;
} elsif ($line =~ /^\@ELSE (.*)$/) {
if ($cond ne $1) {
die "\@ELSE $1 mismatch in $filename\n";
}
if (defined($configcond{$cond})) {
$pass = 0;
} else {
if (scalar(@conds) > 0) {
$pass = $passes[0];
} else {
$pass = 1;
}
}
next;
} elsif ($line =~ /^\@END (.*)$/) {
if ($cond ne $1) {
die "\@END $1 mismatch in $filename\n";
}
$cond = shift(@conds);
if (scalar(@passes) > 0) {
$pass = shift(@passes);
} else {
$pass = 1;
}
next;
}
if ($pass == 0) {
next;
}
while ($line =~ /@([^@ ]*)@/) {
if ($1 ~~ @substvar) {
if (defined($configvar{$1})) {
$val = kw($configvar{$1});
$line = "$`$val$'";
} else {
}
my $def = $configdefd{$1};
my $post = "$'";
$def =~ s/([\\ "])/\\$1/g;
$line = qq($pre/D "$def"$post);
} else {
$line = "$`$'";
}
} elsif ($1 ~~ @substinc) {
if (defined($configinc{$1})) {
} else {
$line = "$`$'";
}
} elsif ($1 ~~ @substlib) {
if (defined($configlib{$1})) {
$val = kw($configlib{$1});
} else {
}
} elsif ($1 ~~ @substdll) {
if (defined($configdll{$1})) {
$val = kw($configdll{$1});
$line = "$`$val$'";
} else {
}
} else {
}
}
}
}
}
}
close F;
}
# setup a project with %configcond stack and %config{var,defd,inc,lib,dll}
sub setupproject {
my $line;
my @Linesin;
my @Linesout;
my $projectname = $_[0];
my $cond;
my @conds;
my $pass = 1;
my @passes;
my $val;
@Linesin = <F>;
close F;
}
$cond = $1;
# do nothing
} else {
$pass = 0;
}
} else {
}
next;
}
$pass = 0;
} else {
} else {
$pass = 1;
}
}
next;
}
} else {
$pass = 1;
}
next;
}
next;
}
} else {
$line = "$`$'";
}
} elsif ($1 ~~ @substdefd) {
if (defined($configdefd{$1})) {
$val = kw($configdefd{$1});
} else {
}
} elsif ($1 ~~ @substinc) {
if (defined($configinc{$1})) {
$val = kw($configinc{$1});
$line = "$`$val;$'";
} else {
}
} else {
$line = "$`$'";
}
} elsif ($1 ~~ @substdll) {
if (defined($configdll{$1})) {
$val = kw($configdll{$1});
} else {
}
} else {
die "unknown control $& in $projectname\n";
}
}
push @Linesout, $line;
}
open F, ">" . $projectname || die $!;
if ($verbose) {
print "Setting up $projectname\n";
}
foreach $line (@Linesout) {
print F $line . "\n";
}
close F;
}
# make versions.h
sub makeversion {
# List of directories with version files
my @dirlist = ("isc", "dns", "isccc", "isccfg", "lwres", "bind9", "irs");
my %LibMacros = (
"bind9" => "LIBBIND9_EXPORTS",
"dns" => "LIBDNS_EXPORTS",
"irs" => "LIBIRS_EXPORTS",
"isc" => "LIBISC_EXPORTS",
"isccc" => "LIBISCCC_EXPORTS",
"isccfg" => "LIBISCCFG_EXPORTS",
"lwres" => "LIBLWRES_EXPORTS");
my @VersionNames = ("LIBINTERFACE", "LIBREVISION", "LIBAGE");
my $Version;
my %ApiVersions;
my $Mapapi;
my $versionfile = "versions.h";
my $versionpath = "..\\$versionfile";
my $data;
my $name;
my $value;
# And the mapapi one
open M, "..\\lib\\dns\\mapapi" || die $!;
while (<M>) {
chomp;
($data) = split(/\#/);
if ($data) {
($name, $value) = split(/=/, $data);
($name) = split(/\s+/, $name);
($value) =~ s/^["\s]+//;
($value) =~ s/["\s]+$//;
} else {
($value) = split(/\s+/, $value);
}
$Mapapi = $value;
}
}
close M;
# Now set up the output version file
my $ThisDate = scalar localtime();
open O, ">$versionpath" ||
# Standard Header
print O '/*
*
* 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/.
*/
';
print O "/*\n";
print O " */\n\n";
print O '
#ifndef VERSIONS_H
#define VERSIONS_H 1
';
if ($Versions{'PATCHVER'} ne "") {
}
if ($verbose) {
}
print O "#define VERSION \"$Version\"\n";
print O
my $dir;
my $apifile;
while (<A>) {
$name =~ s/\s+//;
$value =~ s/\s+//;
$ApiVersions{$name} = $value;
}
}
close A;
}
print O "#endif\n\n";
}
print O "#endif /* VERSIONS_H */\n";
close O;
}
# make srcid.h
sub makesrcid {
my $data;
my $name;
my $value;
}
}
}
# Now set up the output version file
# Standard Header
print SOUT '/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* 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/.
*/
';
print SOUT '
#ifndef SRCID_H
#define SRCID_H 1
';
}
}
# Build install files
sub makeinstallfile {
}
}
}
}
my $v;
my $d;
my $name;
}
}
} else {
}
}
}
}
}
}
}
# Adjust system tests
# WIN32 not a BSD
# dnstap not supported
#$configtest{"DNSTAP"} = "dnstap";
#$configtest{"FSTRM_CAPTURE"} = "fstrm_capture";
# no json-c library for WIN32
#$configtest{"JSONSTATS"} = 1;
# lmdb not supported
#$configtest{"NZD_TOOLS"} = "nzd";
# TODO check for pkcs11ssl and set PKCS11_TEST
# Status
my $name;
print "Configuration Status\n";
} else {
}
}
} else {
}
}
} else {
}
}
print "\tconditions:\n";
} else {
}
}
print "\tsubstitutions:\n";
}
}
print "\tdefines:\n";
}
}
print "\tincludes:\n";
}
}
print "\tlibraries:\n";
}
}
print "\tDLLs:\n";
}
}
print "\n";
}
# Setup
my $file;
}
}
}
print "Configured.\n";
} else {
print "add win32 or x64 to commit configuration to build files\n";
}
exit 0;
# Notes: Unix configure.in options
# --enable-developer partially supported
# --enable-newstats (9.9/9.9sub only)
# --enable-native-pkcs11 supported
# --enable-openssl-version-check included without a way to disable it
# --enable-openssl-hash supported
# --enable-threads included without a way to disable it
# --enable-backtrace backtrace included without a way to disable it
# --enable-symtable incompatible with DLLs (or libtool)
# --enable-ipv6 included without a way to disable it
# --enable-atomic supported (renamed to intrinsic)
# --enable-isc-spnego supported (part of GSSAPI)
# --enable-fixed-rrset supported
# --enable-querytrace supported
# --disable-rpz-nsip supported
# --disable-rpz-nsdname supported
# --enable-filter-aaaa supported
# --enable-full-report supported by verbose
# --enable-dnstap not supported (requires libfstrm support on WIN32)
# --enable-seccomp not supported (Linux specific)
# --enable-afl not supported (not yet available on Visual Studio C++)
# --with-python supported
# --with-openssl supported
# --with-pkcs11 supported
# --with-ecdsa supported
# --with-eddsa supported
# --with-gost supported
# --with-aes supported
# --with-cc-alg supported
# --with-geoip supported
# --with-gssapi supported with MIT (K)erberos (f)or (W)indows
# --with-lmdb no supported on WIN32 (port is not reliable)
# --with-libxml2 supported
# --with-libjson not supported on WIN32 (package not available on WIN32)
# --with-zlib supported
# --with-purify not supported (package available on WIN32 but for free?)
# --with-gperftools-profiler not supported (package not available on WIN32)
# --with-libtool not supported on WIN32 (never)
# --with-locktype not supported on WIN32 (not yet available on WIN32)
# --with-readline supported
# --with-protobuf-c not supported (no reason to until libfstrm is ready)
# --with-libfrtrm not supported (not yet available on WIN32)
# --with-docbook-xsl not supported (?)
# --with-idn[lib] supported
# --with-[lib]iconv supported (part of IDN)
# --with-atf not supported on WIN32 (package not available on WIN32)
# --with-tuning supported
# --with-dlopen included without a way to disable it
# --with-dlz-* ?
#
# Notes: MSVC versions
# MSVC 15.x _MSC_VER == 191y (VS 2017)
# MSVC 14.0 _MSC_VER == 1900 (VS 2015)
# MSVC 12.0 _MSC_VER == 1800 (VS 2013)
# MSVC 11.0 _MSC_VER == 1700 (VS 2012)
# MSVC 10.0 _MSC_VER == 1600 (VS 2010)
# MSVC 9.0 _MSC_VER == 1500 (VS 2008)
# MSVC 8.0 _MSC_VER == 1400 (VS 2005)
# MSVC 7.1 _MSC_VER == 1310 (VS .NET 2003)
# MSVC 7.0 _MSC_VER == 1300 (VS .NET (2002))
# MSVC 6.0 _MSC_VER == 1200 (VS 6.0 (1998))
# MSVC 5.0 _MSC_VER == 1100 (VS 97)