PageRenderTime 54ms CodeModel.GetById 25ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/bind9/configure.in

https://bitbucket.org/freebsd/freebsd-head/
Autoconf | 3615 lines | 2647 code | 287 blank | 681 comment | 155 complexity | 556ae3bcc788f39e8f3ac74535031dae MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1# Copyright (C) 2004-2011  Internet Systems Consortium, Inc. ("ISC")
   2# Copyright (C) 1998-2003  Internet Software Consortium.
   3#
   4# Permission to use, copy, modify, and/or distribute this software for any
   5# purpose with or without fee is hereby granted, provided that the above
   6# copyright notice and this permission notice appear in all copies.
   7#
   8# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
   9# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  10# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  11# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  13# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14# PERFORMANCE OF THIS SOFTWARE.
  15
  16dnl
  17AC_DIVERT_PUSH(1)dnl
  18esyscmd([sed "s/^/# /" COPYRIGHT])dnl
  19AC_DIVERT_POP()dnl
  20
  21AC_REVISION($Revision: 1.512.8.15 $)
  22
  23AC_INIT(lib/dns/name.c)
  24AC_PREREQ(2.59)
  25
  26AC_CONFIG_HEADER(config.h)
  27
  28AC_CANONICAL_HOST
  29
  30AC_PROG_MAKE_SET
  31
  32#
  33# GNU libtool support
  34#
  35case $build_os in
  36sunos*)
  37    # Just set the maximum command line length for sunos as it otherwise
  38    # takes a exceptionally long time to work it out. Required for libtool.
  39     
  40    lt_cv_sys_max_cmd_len=4096;
  41    ;;
  42esac
  43
  44AC_PROG_LIBTOOL
  45AC_PROG_INSTALL
  46AC_PROG_LN_S
  47
  48AC_SUBST(STD_CINCLUDES)
  49AC_SUBST(STD_CDEFINES)
  50AC_SUBST(STD_CWARNINGS)
  51AC_SUBST(CCOPT)
  52
  53# Warn if the user specified libbind, which is now deprecated
  54AC_ARG_ENABLE(libbind, [  --enable-libbind	  deprecated])
  55
  56case "$enable_libbind" in
  57	yes)
  58		AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
  59It is available from http://www.isc.org as a separate download.])
  60		;;
  61	no|'')
  62		;;
  63esac
  64
  65AC_ARG_ENABLE(developer, [  --enable-developer     enable developer build settings])
  66case "$enable_developer" in
  67yes)
  68	test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
  69	test "${with_atf+set}" = set || with_atf=yes
  70	test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
  71	test "${enable_rpz_nsip+set}" = set || enable_rpz_nsip=yes
  72	test "${enable_rpz_nsdname+set}" = set || enable_rpz_nsdname=yes
  73	test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
  74	case "$host" in
  75	*-darwin*)
  76		test "${enable_exportlib+set}" = set || enable_exportlib=yes
  77		;;
  78	*-linux*)
  79		test "${enable_exportlib+set}" = set || enable_exportlib=yes
  80		;;
  81	esac
  82	;;
  83esac
  84#
  85# Make very sure that these are the first files processed by
  86# config.status, since we use the processed output as the input for
  87# AC_SUBST_FILE() substitutions in other files.
  88#
  89AC_CONFIG_FILES([make/rules make/includes])
  90
  91AC_PATH_PROG(AR, ar)
  92ARFLAGS="cruv"
  93AC_SUBST(AR)
  94AC_SUBST(ARFLAGS)
  95
  96# The POSIX ln(1) program.  Non-POSIX systems may substitute
  97# "copy" or something.
  98LN=ln
  99AC_SUBST(LN)
 100
 101case "$AR" in
 102	"")
 103		AC_MSG_ERROR([
 104ar program not found.  Please fix your PATH to include the directory in
 105which ar resides, or set AR in the environment with the full path to ar.
 106])
 107
 108		;;
 109esac
 110
 111#
 112# Etags.
 113#
 114AC_PATH_PROGS(ETAGS, etags emacs-etags)
 115
 116#
 117# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
 118# GNU emacs etags, and it requires the -L flag.
 119#
 120if test "X$ETAGS" != "X"; then
 121	AC_MSG_CHECKING(for Exuberant Ctags etags)
 122	if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
 123		AC_MSG_RESULT(yes)
 124		ETAGS="$ETAGS -L"
 125	else
 126		AC_MSG_RESULT(no)
 127	fi
 128fi
 129AC_SUBST(ETAGS)
 130
 131#
 132# Perl is optional; it is used only by some of the system test scripts.
 133# Note: the backtrace feature (see below) uses perl to build the symbol table,
 134# but it still compiles without perl, in which case an empty table will be used.
 135#
 136AC_PATH_PROGS(PERL, perl5 perl)
 137AC_SUBST(PERL)
 138
 139#
 140# Special processing of paths depending on whether --prefix,
 141# --sysconfdir or --localstatedir arguments were given.  What's
 142# desired is some compatibility with the way previous versions
 143# of BIND built; they defaulted to /usr/local for most parts of
 144# the installation, but named.boot/named.conf was in /etc
 145# and named.pid was in /var/run.
 146#
 147# So ... if none of --prefix, --sysconfdir or --localstatedir are
 148# specified, set things up that way.  If --prefix is given, use
 149# it for sysconfdir and localstatedir the way configure normally
 150# would.  To change the prefix for everything but leave named.conf
 151# in /etc or named.pid in /var/run, then do this the usual configure way:
 152# ./configure --prefix=/somewhere --sysconfdir=/etc
 153# ./configure --prefix=/somewhere --localstatedir=/var
 154#
 155# To put named.conf and named.pid in /usr/local with everything else,
 156# set the prefix explicitly to /usr/local even though that's the default:
 157# ./configure --prefix=/usr/local
 158#
 159case "$prefix" in
 160	NONE)
 161		case "$sysconfdir" in
 162			'${prefix}/etc')
 163				sysconfdir=/etc
 164				;;
 165		esac
 166		case "$localstatedir" in
 167			'${prefix}/var')
 168				localstatedir=/var
 169				;;
 170		esac
 171		;;
 172esac
 173
 174#
 175# Make sure INSTALL uses an absolute path, else it will be wrong in all
 176# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
 177# configure based on the location of the file where it is substituted.
 178# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
 179# subdirectory of install-sh, This relative path will be wrong for all
 180# directories more than one level down from install-sh.
 181#
 182case "$INSTALL" in
 183	/*)
 184		;;
 185	*)
 186		#
 187		# Not all systems have dirname.
 188		#
 189		changequote({, })
 190		ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
 191		changequote([, ])
 192
 193		ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
 194		test "$ac_dir" = "$ac_prog" && ac_dir=.
 195		test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
 196		INSTALL="$ac_dir/$ac_prog"
 197		;;
 198esac
 199
 200#
 201# On these hosts, we really want to use cc, not gcc, even if it is
 202# found.  The gcc that these systems have will not correctly handle
 203# pthreads.
 204#
 205# However, if the user sets $CC to be something, let that override
 206# our change.
 207#
 208if test "X$CC" = "X" ; then
 209	case "$host" in
 210		*-dec-osf*)
 211			CC="cc"
 212			;;
 213		*-solaris*)
 214			# Use Sun's cc if it is available, but watch
 215			# out for /usr/ucb/cc; it will never be the right
 216			# compiler to use.
 217			#
 218			# If setting CC here fails, the AC_PROG_CC done
 219			# below might still find gcc.
 220			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
 221			for ac_dir in $PATH; do
 222				test -z "$ac_dir" && ac_dir=.
 223				case "$ac_dir" in
 224				/usr/ucb)
 225					# exclude
 226					;;
 227				*)
 228					if test -f "$ac_dir/cc"; then
 229						CC="$ac_dir/cc"
 230						break
 231					fi
 232					;;
 233				esac
 234			done
 235			IFS="$ac_save_ifs"
 236			;;
 237		*-hp-hpux*)
 238			CC="cc"
 239			;;
 240		mips-sgi-irix*)
 241			CC="cc"
 242			;;
 243	esac
 244fi
 245
 246AC_PROG_CC
 247
 248#
 249# gcc's optimiser is broken at -02 for ultrasparc
 250#
 251if test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
 252	case "$host" in
 253	sparc-*)
 254		CCFLAGS="-g -O1"
 255		;;
 256	esac
 257fi
 258
 259#
 260# OS dependent CC flags
 261#
 262case "$host" in
 263	# OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
 264	# -D_XOPEN_SOURCE_EXTENDED.
 265	*-dec-osf*)
 266		STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
 267		CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
 268		;;
 269	#HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
 270	*-hp-hpux*)
 271		STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
 272		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 273		LIBS="-lxnet $LIBS"
 274		;;
 275	# Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
 276	*-solaris*)
 277		STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
 278		CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
 279		;;
 280	# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
 281	# parts of the IPv6 Advanced Socket API as a result.  This is stupid
 282	# as it breaks how the two halves (Basic and Advanced) of the IPv6
 283	# Socket API were designed to be used but we have to live with it.
 284	# Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
 285	*-linux* | *-kfreebsd*-gnu)
 286		STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
 287		CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 288		;;
 289	#
 290	# Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
 291	# Setting this is sufficient to select the correct behavior for BIND 9.
 292	#
 293	*-darwin*)
 294	  STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
 295	  CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
 296	  ;;
 297esac
 298
 299AC_HEADER_STDC
 300
 301AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
 302[$ac_includes_default
 303#ifdef HAVE_SYS_PARAM_H
 304# include <sys/param.h>
 305#endif
 306])
 307
 308AC_C_CONST
 309AC_C_INLINE
 310AC_C_VOLATILE
 311AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
 312AC_C_FLEXIBLE_ARRAY_MEMBER
 313
 314#
 315# Older versions of HP/UX don't define seteuid() and setegid()
 316#
 317AC_CHECK_FUNCS(seteuid setresuid)
 318AC_CHECK_FUNCS(setegid setresgid)
 319
 320#
 321# UnixWare 7.1.1 with the feature supplement to the UDK compiler
 322# is reported to not support "static inline" (RT #1212).
 323#
 324AC_MSG_CHECKING(for static inline breakage)
 325AC_TRY_COMPILE(, [
 326		foo1();
 327	}
 328
 329	static inline int foo1() {
 330		return 0;
 331	}
 332
 333	static inline int foo2() {
 334		return foo1();
 335	],
 336	[AC_MSG_RESULT(no)],
 337	[AC_MSG_RESULT(yes)
 338	 AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
 339
 340AC_TYPE_SIZE_T
 341AC_CHECK_TYPE(ssize_t, int)
 342AC_CHECK_TYPE(uintptr_t,unsigned long)
 343AC_CHECK_TYPE(socklen_t,
 344[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
 345[
 346AC_TRY_COMPILE(
 347[
 348#include <sys/types.h>
 349#include <sys/socket.h>
 350int getsockname(int, struct sockaddr *, size_t *);
 351],[],
 352[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
 353[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
 354],
 355[
 356#include <sys/types.h>
 357#include <sys/socket.h>
 358])
 359AC_SUBST(ISC_SOCKADDR_LEN_T)
 360AC_HEADER_TIME
 361AC_MSG_CHECKING(for long long)
 362AC_TRY_COMPILE([],[long long i = 0; return (0);],
 363	[AC_MSG_RESULT(yes)
 364		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
 365	[AC_MSG_RESULT(no)
 366		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
 367AC_SUBST(ISC_PLATFORM_HAVELONGLONG)
 368
 369#
 370# check for GCC noreturn attribute
 371#
 372AC_MSG_CHECKING(for GCC noreturn attribute)
 373AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
 374	[AC_MSG_RESULT(yes)
 375		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
 376		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
 377	[AC_MSG_RESULT(no)
 378		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
 379		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
 380AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
 381AC_SUBST(ISC_PLATFORM_NORETURN_POST)
 382
 383#
 384# check if we have lifconf
 385#
 386AC_MSG_CHECKING(for struct lifconf)
 387AC_TRY_COMPILE([
 388#include <sys/types.h>
 389#include <sys/socket.h>
 390#include <net/if.h>
 391],
 392[
 393struct lifconf lifconf;
 394lifconf.lifc_len = 0;
 395]
 396,
 397	[AC_MSG_RESULT(yes)
 398		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
 399	[AC_MSG_RESULT(no)
 400		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
 401AC_SUBST(ISC_PLATFORM_HAVELIFCONF)
 402
 403#
 404# check if we have kqueue
 405#
 406AC_ARG_ENABLE(kqueue,
 407	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
 408	      want_kqueue="$enableval",  want_kqueue="yes")
 409case $want_kqueue in
 410yes)
 411	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
 412	case $ac_cv_have_kqueue in
 413	yes)
 414		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
 415		;;
 416	*)
 417		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
 418		;;
 419	esac
 420	;;
 421*)
 422	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
 423	;;
 424esac
 425AC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
 426
 427#
 428# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
 429# so we need to try running the code, not just test its existence.
 430#
 431AC_ARG_ENABLE(epoll,
 432[  --enable-epoll          use Linux epoll when available [[default=auto]]],
 433	      want_epoll="$enableval",  want_epoll="auto")
 434case $want_epoll in
 435auto)
 436	AC_MSG_CHECKING(epoll support)
 437	AC_TRY_RUN([
 438#include <sys/epoll.h>
 439int main() {
 440	if (epoll_create(1) < 0)
 441		return (1);
 442	return (0);
 443}
 444],
 445	[AC_MSG_RESULT(yes)
 446	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
 447	[AC_MSG_RESULT(no)
 448	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
 449	;;
 450yes)
 451	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
 452	;;
 453*)
 454	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
 455	;;
 456esac
 457AC_SUBST(ISC_PLATFORM_HAVEEPOLL)
 458
 459#
 460# check if we support /dev/poll
 461#
 462AC_ARG_ENABLE(devpoll,
 463	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
 464	      want_devpoll="$enableval",  want_devpoll="yes")
 465case $want_devpoll in
 466yes)
 467	AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
 468	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
 469	,
 470	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
 471	)
 472	;;
 473*)
 474	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
 475	;;
 476esac
 477AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
 478
 479#
 480# check if we need to #include sys/select.h explicitly
 481#
 482case $ac_cv_header_unistd_h in
 483yes)
 484AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
 485AC_TRY_COMPILE([
 486#include <sys/types.h> /* Ultrix */
 487#include <unistd.h>],
 488[fd_set read_set; return (0);],
 489	[AC_MSG_RESULT(yes)
 490	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
 491	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
 492	[AC_MSG_RESULT(no)
 493	case $ac_cv_header_sys_select_h in
 494	yes)
 495	 ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
 496	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
 497		;;
 498	no)
 499		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
 500		;;
 501	esac
 502	])
 503	;;
 504no)
 505	case $ac_cv_header_sys_select_h in
 506	yes)
 507	     ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
 508	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
 509		;;
 510	no)
 511		AC_MSG_ERROR([need either unistd.h or sys/select.h])
 512		;;
 513	esac
 514	;;
 515esac
 516AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
 517AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
 518
 519#
 520# Find the machine's endian flavor.
 521#
 522AC_C_BIGENDIAN
 523
 524#
 525# was --with-openssl specified?
 526#
 527OPENSSL_WARNING=
 528AC_MSG_CHECKING(for OpenSSL library)
 529AC_ARG_WITH(openssl,
 530[  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
 531			  (Required for DNSSEC)],
 532    use_openssl="$withval", use_openssl="auto")
 533
 534openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
 535if test "$use_openssl" = "auto"
 536then
 537	for d in $openssldirs
 538	do
 539		if test -f $d/include/openssl/opensslv.h
 540		then
 541			use_openssl=$d
 542			break
 543		fi
 544	done
 545fi
 546OPENSSL_GOST=""
 547case "$use_openssl" in
 548	no)
 549		AC_MSG_RESULT(no)
 550		DST_OPENSSL_INC=""
 551		USE_OPENSSL=""
 552		OPENSSLLINKOBJS=""
 553		OPENSSLLINKSRCS=""
 554		;;
 555	auto)
 556		DST_OPENSSL_INC=""
 557		USE_OPENSSL=""
 558		OPENSSLLINKOBJS=""
 559		OPENSSLLINKSRCS=""
 560		AC_MSG_ERROR(
 561[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
 562If you don't want OpenSSL, use --without-openssl])
 563		;;
 564	*)
 565		if test "$use_openssl" = "yes"
 566		then
 567			# User did not specify a path - guess it
 568			for d in $openssldirs
 569			do
 570				if test -f $d/include/openssl/opensslv.h
 571				then
 572					use_openssl=$d
 573					break
 574				fi
 575			done
 576			if test "$use_openssl" = "yes"
 577			then
 578				AC_MSG_RESULT(not found)
 579				AC_MSG_ERROR(
 580[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
 581			fi
 582		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
 583		then
 584			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
 585		fi
 586		USE_OPENSSL='-DOPENSSL'
 587		if test "$use_openssl" = "/usr"
 588		then
 589			DST_OPENSSL_INC=""
 590			DNS_OPENSSL_LIBS="-lcrypto"
 591		else
 592			DST_OPENSSL_INC="-I$use_openssl/include"
 593			case $host in
 594			*-solaris*)
 595				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
 596				;;
 597			*-hp-hpux*)
 598				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
 599				;;
 600			*-apple-darwin*)
 601				#
 602				# Apple's ld seaches for serially for dynamic
 603				# then static libraries.  This means you can't
 604				# use -L to override dynamic system libraries
 605				# with static ones when linking.  Instead
 606				# we specify a absolute path.
 607				#
 608				if test -f "$use_openssl/lib/libcrypto.dylib"
 609				then
 610					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
 611				else
 612					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
 613				fi
 614				;;
 615			*)
 616				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
 617				;;
 618			esac
 619		fi
 620		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
 621
 622		saved_cflags="$CFLAGS"
 623		saved_libs="$LIBS"
 624		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
 625		LIBS="$LIBS $DNS_OPENSSL_LIBS"
 626		AC_MSG_CHECKING(whether linking with OpenSSL works)
 627		AC_TRY_RUN([
 628#include <openssl/err.h>
 629int main() {
 630	ERR_clear_error();
 631	return (0);
 632}
 633],
 634		[AC_MSG_RESULT(yes)],
 635		[AC_MSG_RESULT(no)
 636		 AC_MSG_ERROR(Could not run test program using OpenSSL from
 637$use_openssl/lib and $use_openssl/include.
 638Please check the argument to --with-openssl and your
 639shared library configuration (e.g., LD_LIBRARY_PATH).)],
 640		[AC_MSG_RESULT(assuming it does work on target platform)])
 641
 642		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
 643		AC_TRY_LINK([
 644#include <openssl/err.h>],
 645[ DSO_METHOD_dlfcn(); ],
 646		[AC_MSG_RESULT(no)],
 647		[LIBS="$LIBS -ldl"
 648		AC_TRY_LINK([
 649#include <openssl/err.h>
 650],[ DSO_METHOD_dlfcn(); ],
 651		[AC_MSG_RESULT(yes)
 652		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
 653		],
 654		 [AC_MSG_RESULT(unknown)
 655		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
 656		[AC_MSG_RESULT(assuming it does work on target platform)])
 657		],
 658		[AC_MSG_RESULT(assuming it does work on target platform)]
 659		)
 660		 
 661AC_ARG_ENABLE(openssl-version-check,
 662[AC_HELP_STRING([--enable-openssl-version-check],
 663	[Check OpenSSL Version @<:@default=yes@:>@])])
 664case "$enable_openssl_version_check" in
 665yes|'')
 666		AC_MSG_CHECKING(OpenSSL library version)
 667		AC_TRY_RUN([
 668#include <stdio.h>
 669#include <openssl/opensslv.h>
 670int main() {
 671	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
 672	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
 673	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
 674		return (0);
 675	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
 676		OPENSSL_VERSION_NUMBER);
 677	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
 678	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
 679	return (1);
 680}
 681		],
 682		[AC_MSG_RESULT(ok)],
 683		[AC_MSG_RESULT(not compatible)
 684		 OPENSSL_WARNING=yes
 685		],
 686		[AC_MSG_RESULT(assuming target platform has compatible version)])
 687;;
 688no)
 689	AC_MSG_RESULT(Skipped OpenSSL version check)
 690;;
 691esac
 692
 693		AC_MSG_CHECKING(for OpenSSL DSA support)
 694		if test -f $use_openssl/include/openssl/dsa.h
 695		then
 696			AC_DEFINE(HAVE_OPENSSL_DSA)
 697			AC_MSG_RESULT(yes)
 698		else
 699			AC_MSG_RESULT(no)
 700		fi
 701		AC_CHECK_FUNCS(EVP_sha256 EVP_sha512)
 702
 703		AC_MSG_CHECKING(for OpenSSL GOST support)
 704		have_gost=""
 705		AC_TRY_RUN([
 706#include <openssl/conf.h>
 707#include <openssl/engine.h>
 708int main() {
 709#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
 710	ENGINE *e;
 711	EC_KEY *ek;
 712
 713	ek = NULL;
 714	OPENSSL_config(NULL);
 715
 716	e = ENGINE_by_id("gost");
 717	if (e == NULL)
 718		return (1);
 719	if (ENGINE_init(e) <= 0)
 720		return (1);
 721	return (0);
 722#else
 723	return (1);
 724#endif
 725}
 726],
 727		[AC_MSG_RESULT(yes)
 728		have_gost="yes"],
 729		[AC_MSG_RESULT(no)
 730		have_gost="no"],
 731		[AC_MSG_RESULT(using --with-gost)])
 732		AC_ARG_WITH(gost, , with_gost="$withval", with_gost="auto")
 733		case "$with_gost" in
 734		yes)
 735		    case "$have_gost" in
 736		    no)  AC_MSG_ERROR([gost not supported]) ;;
 737		    *)  have_gost=yes ;;
 738		    esac
 739		    ;;
 740		no)
 741		    have_gost=no ;;
 742		*)
 743		    case "$have_gost" in
 744		    yes|no) ;;
 745		    *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
 746		    esac
 747		    ;;
 748		esac
 749		case $have_gost in
 750		yes)
 751			OPENSSL_GOST="yes"
 752			AC_DEFINE(HAVE_OPENSSL_GOST, 1,
 753				  [Define if your OpenSSL version supports GOST.])
 754			;;
 755		*)
 756			;;
 757		esac
 758		CFLAGS="$saved_cflags"
 759		LIBS="$saved_libs"
 760		OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
 761		OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
 762
 763		;;
 764esac
 765
 766#
 767# This would include the system openssl path (and linker options to use
 768# it as needed) if it is found.
 769#
 770
 771AC_SUBST(USE_OPENSSL)
 772AC_SUBST(DST_OPENSSL_INC)
 773AC_SUBST(OPENSSLLINKOBJS)
 774AC_SUBST(OPENSSLLINKSRCS)
 775AC_SUBST(OPENSSL_GOST)
 776DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
 777
 778#
 779# Use OpenSSL for hash functions
 780#
 781
 782AC_ARG_ENABLE(openssl-hash,
 783	[  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
 784	want_openssl_hash="$enableval", want_openssl_hash="no")
 785case $want_openssl_hash in
 786	yes)
 787		if test "$USE_OPENSSL" = ""
 788		then
 789			AC_MSG_ERROR([No OpenSSL for hash functions])
 790		fi
 791		ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
 792		ISC_OPENSSL_INC="$DST_OPENSSL_INC"
 793		;;
 794	no)
 795		ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
 796		ISC_OPENSSL_INC=""
 797		;;
 798esac
 799AC_SUBST(ISC_PLATFORM_OPENSSLHASH)
 800AC_SUBST(ISC_OPENSSL_INC)
 801
 802#
 803# PKCS11 (aka crypto hardware) support
 804#
 805# This works only with the right OpenSSL with PKCS11 engine!
 806#
 807
 808AC_MSG_CHECKING(for PKCS11 support)
 809AC_ARG_WITH(pkcs11,
 810[  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
 811                          (PATH is for the PKCS11 provider)],
 812   use_pkcs11="$withval", use_pkcs11="no")
 813
 814case "$use_pkcs11" in
 815	no|'')
 816		AC_MSG_RESULT(disabled)
 817		USE_PKCS11=''
 818		PKCS11_TOOLS=''
 819		;;
 820	yes|*)
 821		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
 822		USE_PKCS11='-DUSE_PKCS11'
 823		PKCS11_TOOLS=pkcs11
 824		;;
 825esac
 826AC_SUBST(USE_PKCS11)
 827AC_SUBST(PKCS11_TOOLS)
 828
 829AC_MSG_CHECKING(for PKCS11 tools)
 830case "$use_pkcs11" in
 831	no|yes|'')
 832		AC_MSG_RESULT(disabled)
 833		PKCS11_PROVIDER="undefined"
 834		;;
 835       *)
 836		AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
 837		PKCS11_PROVIDER="$use_pkcs11"
 838		;;
 839esac
 840AC_SUBST(PKCS11_PROVIDER)
 841
 842AC_MSG_CHECKING(for GSSAPI library)
 843AC_ARG_WITH(gssapi,
 844[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
 845    use_gssapi="$withval", use_gssapi="yes")
 846
 847# gssapi is just the framework, we really require kerberos v5, so
 848# look for those headers (the gssapi headers must be there, too)
 849# The problem with this implementation is that it doesn't allow
 850# for the specification of gssapi and krb5 headers in different locations,
 851# which probably ought to be fixed although fixing might raise the issue of
 852# trying to build with incompatible versions of gssapi and krb5.
 853if test "$use_gssapi" = "yes"
 854then
 855	# first, deal with the obvious
 856	if test \( -f /usr/include/kerberosv5/krb5.h -o \
 857		   -f /usr/include/krb5/krb5.h -o \
 858		   -f /usr/include/krb5.h \)   -a \
 859		\( -f /usr/include/gssapi.h -o \
 860		   -f /usr/include/gssapi/gssapi.h \)
 861	then
 862		use_gssapi=/usr
 863	else
 864	    krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
 865	    for d in $krb5dirs
 866	    do
 867		if test -f $d/include/gssapi/gssapi_krb5.h -o \
 868		        -f $d/include/krb5.h
 869		then
 870			if test -f $d/include/gssapi/gssapi.h -o \
 871			        -f $d/include/gssapi.h
 872			then
 873				use_gssapi=$d
 874				break
 875			fi
 876		fi
 877		use_gssapi="no"
 878	    done
 879	fi
 880fi
 881
 882case "$use_gssapi" in
 883	no)
 884		AC_MSG_RESULT(disabled)
 885		USE_GSSAPI=''
 886		;;
 887	yes)
 888		AC_MSG_ERROR([--with-gssapi must specify a path])
 889		;;
 890	*)
 891		AC_MSG_RESULT(looking in $use_gssapi/lib)
 892		USE_GSSAPI='-DGSSAPI'
 893		saved_cppflags="$CPPFLAGS"
 894		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
 895		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
 896		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
 897
 898		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
 899		    AC_MSG_ERROR([gssapi.h not found])
 900		fi
 901
 902		AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
 903		    [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"])
 904
 905		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
 906		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
 907
 908		if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
 909		    AC_MSG_ERROR([krb5.h not found])
 910		fi
 911
 912		CPPFLAGS="$saved_cppflags"
 913
 914		#
 915		# XXXDCL This probably doesn't work right on all systems.
 916		# It will need to be worked on as problems become evident.
 917		#
 918		# Essentially the problems here relate to two different
 919		# areas.  The first area is building with either KTH
 920		# or MIT Kerberos, particularly when both are present on
 921		# the machine.  The other is static versus dynamic linking.
 922		#
 923		# On the KTH vs MIT issue, Both have libkrb5 that can mess
 924		# up the works if one implementation ends up trying to
 925		# use the other's krb.  This is unfortunately a situation
 926		# that very easily arises.
 927		#
 928		# Dynamic linking when the dependency information is built
 929		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
 930		# all such problems go away, but when that setup is not
 931		# present, because either the dynamic libraries lack
 932		# dependencies or static linking is being done, then the
 933		# problems start to show up.
 934		saved_libs="$LIBS"
 935		for TRY_LIBS in \
 936		    "-lgssapi_krb5" \
 937		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
 938		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
 939		    "-lgssapi" \
 940		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
 941		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
 942		    "-lgss -lkrb5"
 943		do
 944		    # Note that this does not include $saved_libs, because
 945		    # on FreeBSD machines this configure script has added
 946		    # -L/usr/local/lib to LIBS, which can make the
 947		    # -lgssapi_krb5 test succeed with shared libraries even
 948		    # when you are trying to build with KTH in /usr/lib.
 949		    if test "$use_gssapi" = "/usr"
 950		    then
 951			    LIBS="$TRY_LIBS"
 952		    else
 953			    LIBS="-L$use_gssapi/lib $TRY_LIBS"
 954		    fi
 955		    AC_MSG_CHECKING(linking as $TRY_LIBS)
 956		    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
 957				gssapi_linked=yes, gssapi_linked=no)
 958		    case $gssapi_linked in
 959		    yes) AC_MSG_RESULT(yes); break ;;
 960		    no)  AC_MSG_RESULT(no) ;;
 961		    esac
 962		done
 963
 964		case $gssapi_linked in
 965		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
 966		esac
 967
 968		#
 969		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
 970		# but MIT in /usr/local/lib and trying to build with KTH.
 971		# /usr/local/lib can end up earlier on the link lines.
 972		# Like most kludges, this one is not only inelegant it
 973		# is also likely to be the wrong thing to do at least as
 974		# many times as it is the right thing.  Something better
 975		# needs to be done.
 976		#
 977		if test "$use_gssapi" = "/usr" -a \
 978			-f /usr/local/lib/libkrb5.a; then
 979		    FIX_KTH_VS_MIT=yes
 980		fi
 981
 982		case "$FIX_KTH_VS_MIT" in
 983		yes)
 984		    case "$enable_static_linking" in
 985		    yes) gssapi_lib_suffix=".a"  ;;
 986		    *)   gssapi_lib_suffix=".so" ;;
 987		    esac
 988
 989		    for lib in $LIBS; do
 990			case $lib in
 991			-L*)
 992			    ;;
 993			-l*)
 994			    new_lib=`echo $lib |
 995				     sed -e s%^-l%$use_gssapi/lib/lib% \
 996					 -e s%$%$gssapi_lib_suffix%`
 997			    NEW_LIBS="$NEW_LIBS $new_lib"
 998			    ;;
 999			*)
1000			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1001			    ;;
1002			esac
1003		    done
1004		    LIBS="$NEW_LIBS"
1005		    ;;
1006		esac
1007
1008		DST_GSSAPI_INC="-I$use_gssapi/include"
1009		DNS_GSSAPI_LIBS="$LIBS"
1010
1011		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1012		LIBS="$saved_libs"
1013		;;
1014esac
1015
1016AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1017AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1018AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1019AC_SUBST(ISC_PLATFORM_KRB5HEADER)
1020
1021AC_SUBST(USE_GSSAPI)
1022AC_SUBST(DST_GSSAPI_INC)
1023AC_SUBST(DNS_GSSAPI_LIBS)
1024DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
1025
1026#
1027# Applications linking with libdns also need to link with these libraries.
1028#
1029
1030AC_SUBST(DNS_CRYPTO_LIBS)
1031
1032#
1033# was --with-randomdev specified?
1034#
1035AC_MSG_CHECKING(for random device)
1036AC_ARG_WITH(randomdev,
1037[  --with-randomdev=PATH   Specify path for random device],
1038    use_randomdev="$withval", use_randomdev="unspec")
1039
1040case "$use_randomdev" in
1041	unspec)
1042		case "$host" in
1043			*-openbsd*)
1044				devrandom=/dev/arandom
1045				;;
1046			*)
1047				devrandom=/dev/random
1048				;;
1049		esac
1050		AC_MSG_RESULT($devrandom)
1051		AC_CHECK_FILE($devrandom,
1052			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1053						 "$devrandom"),)
1054		;;
1055	yes)
1056		AC_MSG_ERROR([--with-randomdev must specify a path])
1057		;;
1058	no)
1059		AC_MSG_RESULT(disabled)
1060		;;
1061	*)
1062		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1063		AC_MSG_RESULT(using "$use_randomdev")
1064		;;
1065esac
1066
1067#
1068# Do we have arc4random() ?
1069#
1070AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1071
1072sinclude(config.threads.in)dnl
1073
1074if $use_threads
1075then
1076	if test "X$GCC" = "Xyes"; then
1077		case "$host" in
1078		*-freebsd*)
1079			CC="$CC -pthread"
1080			CCOPT="$CCOPT -pthread"
1081			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1082			;;
1083		*-openbsd*)
1084			CC="$CC -pthread"
1085			CCOPT="$CCOPT -pthread"
1086			;;
1087		*-solaris*)
1088			LIBS="$LIBS -lthread"
1089			;;
1090		*-ibm-aix*)
1091			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1092			;;
1093		esac
1094	else
1095		case $host in
1096		*-dec-osf*)
1097			CC="$CC -pthread"
1098			CCOPT="$CCOPT -pthread"
1099			;;
1100		*-solaris*)
1101			CC="$CC -mt"
1102			CCOPT="$CCOPT -mt"
1103			;;
1104		*-ibm-aix*)
1105			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1106			;;
1107		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
1108			CC="$CC -Kthread"
1109			CCOPT="$CCOPT -Kthread"
1110			;;
1111		*-*-sysv*OpenUNIX*)
1112			CC="$CC -Kpthread"
1113			CCOPT="$CCOPT -Kpthread"
1114			;;
1115		esac
1116	fi
1117	ALWAYS_DEFINES="-D_REENTRANT"
1118	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1119	THREADOPTOBJS='${THREADOPTOBJS}'
1120	THREADOPTSRCS='${THREADOPTSRCS}'
1121	thread_dir=pthreads
1122	#
1123	# We'd like to use sigwait() too
1124	#
1125	AC_CHECK_FUNC(sigwait,
1126		      AC_DEFINE(HAVE_SIGWAIT),
1127		      AC_CHECK_LIB(c, sigwait,
1128		      AC_DEFINE(HAVE_SIGWAIT),
1129		      AC_CHECK_LIB(pthread, sigwait,
1130				   AC_DEFINE(HAVE_SIGWAIT),
1131				   AC_CHECK_LIB(pthread, _Psigwait,
1132						AC_DEFINE(HAVE_SIGWAIT),))))
1133
1134	AC_CHECK_FUNC(pthread_attr_getstacksize,
1135		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1136
1137	AC_CHECK_FUNC(pthread_attr_setstacksize,
1138		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1139
1140	#
1141	# Additional OS-specific issues related to pthreads and sigwait.
1142	#
1143	case "$host" in
1144		#
1145		# One more place to look for sigwait.
1146		#
1147		*-freebsd*)
1148			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1149			case $host in
1150			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1151			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1152				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1153				;;
1154			*-freebsd6.*)
1155				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1156				;;
1157			esac
1158			;;
1159		#
1160		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
1161		# called before certain pthreads calls.	 This is deprecated
1162		# in BSD/OS 4.1.
1163		#
1164		*-bsdi3.*|*-bsdi4.0*)
1165			AC_DEFINE(NEED_PTHREAD_INIT)
1166			;;
1167		#
1168		# LinuxThreads requires some changes to the way we
1169		# deal with signals.
1170		#
1171		*-linux*)
1172			AC_DEFINE(HAVE_LINUXTHREADS)
1173			;;
1174		#
1175		# Ensure the right sigwait() semantics on Solaris and make
1176		# sure we call pthread_setconcurrency.
1177		#
1178		*-solaris*)
1179			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1180			AC_CHECK_FUNC(pthread_setconcurrency,
1181				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1182			;;
1183		#
1184		# UnixWare does things its own way.
1185		#
1186		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1187			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1188			;;
1189	esac
1190
1191	#
1192	# Look for sysconf to allow detection of the number of processors.
1193	#
1194	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1195
1196else
1197	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1198	thread_dir=nothreads
1199	THREADOPTOBJS=""
1200	THREADOPTSRCS=""
1201	ALWAYS_DEFINES=""
1202fi
1203
1204AC_SUBST(ALWAYS_DEFINES)
1205AC_SUBST(ISC_PLATFORM_USETHREADS)
1206AC_SUBST(THREADOPTOBJS)
1207AC_SUBST(THREADOPTSRCS)
1208ISC_THREAD_DIR=$thread_dir
1209AC_SUBST(ISC_THREAD_DIR)
1210
1211#
1212# was --with-libxml2 specified?
1213#
1214AC_MSG_CHECKING(for libxml2 library)
1215AC_ARG_WITH(libxml2,
1216[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1217    use_libxml2="$withval", use_libxml2="auto")
1218
1219case "$use_libxml2" in
1220	no)
1221		DST_LIBXML2_INC=""
1222		;;
1223	auto|yes)
1224		case X`(xml2-config --version) 2>/dev/null` in
1225		X2.[[67]].*)
1226			libxml2_libs=`xml2-config --libs`
1227			libxml2_cflags=`xml2-config --cflags`
1228			;;
1229		*)
1230			libxml2_libs=
1231			libxml2_cflags=
1232			;;
1233		esac
1234		;;
1235	*)
1236		if test -f "$use_libxml2/bin/xml2-config" ; then
1237			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1238			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1239		fi
1240		;;
1241esac
1242
1243if test "X$libxml2_libs" != "X"
1244then
1245	AC_MSG_RESULT(yes)
1246	CFLAGS="$CFLAGS $libxml2_cflags"
1247	LIBS="$LIBS $libxml2_libs"
1248	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1249else
1250	AC_MSG_RESULT(no)
1251fi
1252
1253#
1254# In solaris 10, SMF can manage named service
1255#
1256AC_CHECK_LIB(scf, smf_enable_instance)
1257
1258#
1259# flockfile is usually provided by pthreads, but we may want to use it
1260# even if compiled with --disable-threads.  getc_unlocked might also not
1261# be defined.
1262#
1263AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1264AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1265
1266# 
1267# Indicate what the final decision was regarding threads.
1268#
1269AC_MSG_CHECKING(whether to build with threads)
1270if $use_threads; then
1271	AC_MSG_RESULT(yes)
1272else
1273	AC_MSG_RESULT(no)
1274fi
1275
1276# 
1277# End of pthreads stuff.
1278#
1279
1280#
1281# Large File
1282#
1283AC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1284	      want_largefile="yes", want_largefile="no")
1285case $want_largefile in
1286	yes)
1287		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1288		;;
1289	*)
1290		;;
1291esac
1292
1293#
1294# Additional compiler settings.
1295#
1296MKDEPCC="$CC"
1297MKDEPCFLAGS="-M"
1298IRIX_DNSSEC_WARNINGS_HACK=""
1299
1300if test "X$GCC" = "Xyes"; then
1301	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1302	SAVE_CFLAGS=$CFLAGS
1303	CFLAGS="$CFLAGS -fno-strict-aliasing"
1304	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1305	CFLAGS=$SAVE_CFLAGS
1306	if test "$FNOSTRICTALIASING" = "yes"; then
1307		AC_MSG_RESULT(yes)
1308	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1309	else
1310		AC_MSG_RESULT(no)
1311	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1312	fi
1313	case "$host" in
1314	*-hp-hpux*)
1315		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1316		;;
1317	esac
1318else
1319	case $host in
1320	*-dec-osf*)
1321		CC="$CC -std"
1322		CCOPT="$CCOPT -std"
1323		MKDEPCC="$CC"
1324		;;
1325	*-hp-hpux*)
1326		CC="$CC -Ae -z"
1327		# The version of the C compiler that constantly warns about
1328		# 'const' as well as alignment issues is unfortunately not
1329		# able to be discerned via the version of the operating
1330		# system, nor does cc have a version flag.
1331		case "`$CC +W 123 2>&1`" in
1332		*Unknown?option*)
1333			STD_CWARNINGS="+w1"
1334			;;
1335		*)
1336			# Turn off the pointlessly noisy warnings.
1337			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1338			;;
1339		esac
1340		CCOPT="$CCOPT -Ae -z"
1341		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1342		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1343		;;
1344	*-sgi-irix*)
1345		STD_CWARNINGS="-fullwarn -woff 1209"
1346		#
1347		# Silence more than 250 instances of
1348		#   "prototyped function redeclared without prototype"
1349		# and 11 instances of
1350		#   "variable ... was set but never used"
1351		# from lib/dns/sec/openssl.
1352		#
1353		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1354		;;
1355	*-solaris*)
1356		MKDEPCFLAGS="-xM"
1357		;;
1358	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1359		# UnixWare
1360		CC="$CC -w"
1361		;;
1362	esac
1363fi
1364
1365AC_SUBST(MKDEPCC)
1366AC_SUBST(MKDEPCFLAGS)
1367AC_SUBST(MKDEPPROG)
1368AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1369
1370#
1371# NLS
1372#
1373AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1374
1375#
1376# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1377#
1378# AC_CHECK_LIB(xnet, socket, ,
1379#    AC_CHECK_LIB(socket, socket)
1380# )
1381#
1382# Use this for now, instead:
1383#
1384case "$host" in
1385	mips-sgi-irix*)
1386		;;
1387	*-linux*)
1388		;;
1389	*)
1390		AC_CHECK_LIB(socket, socket)
1391		AC_CHECK_LIB(nsl, inet_addr)
1392		;;
1393esac
1394
1395#
1396# Work around Solaris's select() limitations.
1397#
1398case "$host" in
1399	*-solaris2.[[89]]|*-solaris2.1?)
1400	AC_DEFINE(FD_SETSIZE, 65536,
1401		  [Solaris hack to get select_large_fdset.])
1402	;;
1403esac
1404
1405#
1406# Purify support
1407#
1408AC_MSG_CHECKING(whether to use purify)
1409AC_ARG_WITH(purify,
1410	[  --with-purify[=PATH]      use Rational purify],
1411	use_purify="$withval", use_purify="no")
1412
1413case "$use_purify" in
1414	no)
1415		;;
1416	yes)
1417		AC_PATH_PROG(purify_path, purify, purify)
1418		;;
1419	*)
1420		purify_path="$use_purify"
1421		;;
1422esac
1423
1424case "$use_purify" in
1425	no)
1426		AC_MSG_RESULT(no)
1427		PURIFY=""
1428		;;
1429	*)
1430		if test -f $purify_path || test $purify_path = purify; then
1431			AC_MSG_RESULT($purify_path)
1432			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1433			PURIFY="$purify_path $PURIFYFLAGS"
1434		else
1435			AC_MSG_ERROR([$purify_path not found.
1436
1437Please choose the proper path with the following command:
1438
1439    configure --with-purify=PATH
1440])
1441		fi
1442		;;
1443esac
1444
1445AC_SUBST(PURIFY)
1446
1447
1448AC_ARG_WITH(libtool,
1449	    [  --with-libtool          use GNU libtool],
1450	    use_libtool="$withval", use_libtool="no")
1451
1452case $use_libtool in
1453	yes)
1454		AM_PROG_LIBTOOL
1455		O=lo
1456		A=la
1457		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1458		LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1459		LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1460		LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1461		case "$host" in
1462		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1463		esac
1464		case "$host" in
1465		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1466		*) LIBTOOL_IN_MAIN= ;;
1467		esac;
1468		;;
1469	*)
1470		O=o
1471		A=a
1472		LIBTOOL=
1473		AC_SUBST(LIBTOOL)
1474		LIBTOOL_MKDEP_SED=
1475		LIBTOOL_MODE_COMPILE=
1476		LIBTOOL_MODE_INSTALL=
1477		LIBTOOL_MODE_LINK=
1478		LIBTOOL_ALLOW_UNDEFINED=
1479		LIBTOOL_IN_MAIN=
1480		;;
1481esac
1482
1483#
1484# enable/disable dumping stack backtrace.  Also check if the system supports
1485# glibc-compatible backtrace() function.
1486#
1487AC_ARG_ENABLE(backtrace,
1488[  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
1489	      want_backtrace="$enableval",  want_backtrace="yes")
1490case $want_backtrace in
1491yes)
1492	ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
1493	AC_TRY_LINK([#include <execinfo.h>],
1494	[return (backtrace((void **)0, 0));],
1495	[AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
1496	;;
1497*)
1498	ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
1499	;;
1500esac
1501AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
1502
1503AC_ARG_ENABLE(symtable,
1504[  --enable-symtable       use internal symbol table for backtrace
1505                          [[all|minimal(default)|none]]],
1506		want_symtable="$enableval",  want_symtable="minimal")
1507case $want_symtable in
1508yes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
1509	if test "$PERL" = ""
1510	then
1511		AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1512Install perl or explicitly disable the feature by --disable-symtable.])
1513	fi
1514	if test "$use_libtool" = "yes"; then
1515		AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
1516	else
1517		# we generate the internal symbol table only for those systems
1518		# known to work to avoid unexpected build failure.  Also, warn
1519		# about unsupported systems when the feature is enabled
1520		#  manually.
1521		case $host_os in
1522		freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1523			MKSYMTBL_PROGRAM="$PERL"
1524			if test $want_symtable = all; then
1525				ALWAYS_MAKE_SYMTABLE="yes"
1526			fi
1527			;;
1528		*)
1529			if test $want_symtable = yes -o $want_symtable = all
1530			then
1531				AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1532			fi
1533		esac
1534	fi
1535	;;
1536*)
1537	;;
1538esac
1539AC_SUBST(MKSYMTBL_PROGRAM)
1540AC_SUBST(ALWAYS_MAKE_SYMTABLE)
1541
1542#
1543# File name extension for static archive files, for those few places
1544# where they are treated differently from dynamic ones.
1545#
1546SA=a
1547
1548AC_SUBST(O)
1549AC_SUBST(A)
1550AC_SUBST(SA)
1551AC_SUBST(LIBTOOL_MKDEP_SED)
1552AC_SUBST(LIBTOOL_MODE_COMPILE)
1553AC_SUBST(LIBTOOL_MODE_INSTALL)
1554AC_SUBST(LIBTOOL_MODE_LINK)
1555AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1556AC_SUBST(LIBTOOL_IN_MAIN)
1557
1558#
1559# build exportable DNS library?
1560#
1561AC_ARG_ENABLE(exportlib,
1562	[  --enable-exportlib	build exportable library (GNU make required)
1563                        [[default=no]]])
1564case "$enable_exportlib" in
1565	yes)
1566		gmake=
1567		for x in gmake gnumake make; do
1568			if $x --version 2>/dev/null | grep GNU > /dev/null; then
1569				gmake=$x
1570				break;
1571			fi
1572		done
1573		if test -z "$gmake"; then
1574			AC_MSG_ERROR([exportlib requires GNU make.  Install it or disable the feature.])
1575		fi
1576		LIBEXPORT=lib/export
1577		AC_SUBST(LIBEXPORT)
1578		BIND9_CO_RULE="%.$O:  \${srcdir}/%.c"
1579		;;
1580	no|*)
1581		BIND9_CO_RULE=".c.$O:"
1582		;;
1583esac
1584AC_SUBST(BIND9_CO_RULE)
1585
1586AC_ARG_WITH(export-libdir,
1587	[  --with-export-libdir[=PATH]
1588                        installation directory for the export library
1589                        [[EPREFIX/lib/bind9]]],
1590	export_libdir="$withval",)
1591if test -z "$export_libdir"; then
1592	export_libdir="\${exec_prefix}/lib/bind9/"
1593fi
1594AC_SUBST(export_libdir)
1595
1596AC_ARG_WITH(export-includedir,
1597	[  --with-export-includedir[=PATH]
1598                        installation directory for the header files of the
1599                        export library [[PREFIX/include/bind9]]],
1600	export_includedir="$withval",)
1601if test -z "$export_includedir"; then
1602	export_includedir="\${prefix}/include/bind9/"
1603fi
1604AC_SUBST(export_includedir)
1605
1606#
1607# Here begins a very long section to determine the system's networking
1608# capabilities.  The order of the tests is significant.
1609#
1610
1611#
1612# IPv6
1613#
1614AC_ARG_ENABLE(ipv6,
1615	[  --enable-ipv6           use IPv6 [default=autodetect]])
1616
1617case "$enable_ipv6" in
1618	yes|''|autodetect)
1619		AC_DEFINE(WANT_IPV6)
1620		;;
1621	no)
1622		;;
1623esac
1624
1625#
1626# We do the IPv6 compilation checking after libtool so that we can put
1627# the right suffix on the files.
1628#
1629AC_MSG_CHECKING(for IPv6 structures)
1630AC_TRY_COMPILE([
1631#include <sys/types.h>
1632#include <sys/socket.h>
1633#include <netinet/in.h>],
1634[struct sockaddr_in6 sin6; return (0);],
1635	[AC_MSG_RESULT(yes)
1636	 found_ipv6=yes],
1637	[AC_MSG_RESULT(no)
1638	 found_ipv6=no])
1639
1640#
1641# See whether IPv6 support is provided via a Kame add-on.
1642# This is done before other IPv6 linking tests to LIBS is properly set.
1643#
1644AC_MSG_CHECKING(for Kame IPv6 support)
1645AC_ARG_WITH(kame,
1646	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1647	use_kame="$withval", use_kame="no")
1648
1649case "$use_kame" in
1650	no)
1651		;;
1652	yes)
1653		kame_path=/usr/local/v6
1654		;;
1655	*)
1656		kame_path="$use_kame"
1657		;;
1658esac
1659
1660case "$use_kame" in
1661	no)
1662		AC_MSG_RESULT(no)
1663		;;
1664	*)
1665		if test -f $kame_path/lib/libinet6.a; then
1666			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1667			LIBS="-L$kame_path/lib -linet6 $LIBS"
1668		else
1669			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1670
1671Please choose the proper path with the following command:
1672
1673    configure --with-kame=PATH
1674])
1675		fi
1676		;;
1677esac
1678
1679#
1680# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1681# Including it on Kame-using platforms is very bad, though, because
1682# Kame uses #error against direct inclusion.   So include it on only
1683# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1684# This is done before the in6_pktinfo check because that's what
1685# netinet6/in6.h is needed for.
1686#
1687changequote({, })
1688case "$host" in
1689*-bsdi4.[01]*)
1690	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1691	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1692	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1693	;;
1694*)
1695	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1696	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1697	isc_netinet6in6_hack=""
1698	;;
1699esac
1700changequote([, ])
1701
1702#
1703# This is similar to the netinet6/in6.h issue.
1704#
1705case "$host" in
1706*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1707	# UnixWare
1708	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1709	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1710	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1711	isc_netinetin6_hack="#include <netinet/in6.h>"
1712	;;
1713*)
1714	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1715	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1716	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1717	isc_netinetin6_hack=""
1718	;;
1719esac
1720
1721#
1722# Now delve deeper into the suitability of the IPv6 support.
1723#
1724case "$found_ipv6" in
1725	yes)
1726		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1727		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1728
1729		AC_MSG_CHECKING(for in6_addr)
1730		AC_TRY_COMPILE([
1731#include <sys/types.h>
1732#include <sys/socket.h>
1733#include <netinet/in.h>
1734$isc_netinetin6_hack
1735$isc_netinet6in6_hack
1736],
1737[struct in6_addr in6; return (0);],
1738		[AC_MSG_RESULT(yes)
1739		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1740		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1741		 isc_in_addr6_hack=""],
1742		[AC_MSG_RESULT(no)
1743		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1744		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1745		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1746
1747		AC_MSG_CHECKING(for in6addr_any)
1748		AC_TRY_LINK([
1749#include <sys/types.h>
1750#include <sys/socket.h>
1751#include <netinet/in.h>
1752$isc_netinetin6_hack
1753$isc_netinet6in6_hack
1754$isc_in_addr6_hack
1755],
1756		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1757			[AC_MSG_RESULT(yes)
1758			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1759			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1760			[AC_MSG_RESULT(no)
1761			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1762			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1763
1764		AC_MSG_CHECKING(for in6addr_loopback)
1765		AC_TRY_LINK([
1766#include <sys/types.h>
1767#include <sys/socket.h>
1768#include <netinet/in.h>
1769$isc_netinetin6_hack
1770$isc_netinet6in6_hack
1771$isc_in_addr6_hack
1772],
1773		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1774			[AC_MSG_RESULT(yes)
1775			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1776			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1777			[AC_MSG_RESULT(no)
1778			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1779			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1780
1781		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1782		AC_TRY_COMPILE([
1783#include <sys/types.h>
1784#include <sys/socket.h>
1785#include <netinet/in.h>
1786$isc_netinetin6_hack
1787$isc_netinet6in6_hack
1788],
1789		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1790			[AC_MSG_RESULT(yes)
1791			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1792			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1793			[AC_MSG_RESULT(no)
1794			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1795			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1796		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1797
1798		AC_MSG_CHECKING(for in6_pktinfo)
1799		AC_TRY_COMPILE([
1800#include <sys/types.h>
1801#include <sys/socket.h>
1802#include <netinet/in.h>
1803$isc_netinetin6_hack
1804$isc_netinet6in6_hack
1805],
1806		[struct in6_pktinfo xyzzy; return (0);],
1807			[AC_MSG_RESULT(yes)
1808			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1809			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1810			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1811		;;
1812	no)
1813		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1814		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1815		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1816		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1817		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1818		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1819		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1820		ISC_IPV6_H="ipv6.h"
1821		ISC_IPV6_O="ipv6.$O"
1822		ISC_ISCIPV6_O="unix/ipv6.$O"
1823		ISC_IPV6_C="ipv6.c"
1824		;;
1825esac
1826
1827AC_SUBST(ISC_PLATFORM_HAVEIPV6)
1828AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1829AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1830AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1831AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1832AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1833AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1834AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1835AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1836AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1837AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1838AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1839AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1840AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1841AC_SUBST(ISC_IPV6_H)
1842AC_SUBST(ISC_IPV6_O)
1843AC_SUBST(ISC_ISCIPV6_O)
1844AC_SUBST(ISC_IPV6_C)
1845AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1846AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1847
1848AC_MSG_CHECKING([for struct if_laddrreq])
1849AC_TRY_LINK([
1850#include <sys/types.h>
1851#include <net/if6.h>
1852],[ struct if_laddrreq a; ],
1853	[AC_MSG_RESULT(yes)
1854	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1855	[AC_MSG_RESULT(no)
1856	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1857AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1858
1859AC_MSG_CHECKING([for struct if_laddrconf])
1860AC_TRY_LINK([
1861#include <sys/types.h>
1862#include <net/if6.h>
1863],[ struct if_laddrconf a; ],
1864	[AC_MSG_RESULT(yes)
1865	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1866	[AC_MSG_RESULT(no)
1867	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1868AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1869
1870#
1871# Check for network functions that are often missing.  We do this
1872# after the libtool checking, so we can put the right suffix on
1873# the files.  It also needs to come after checking for a Kame add-on,
1874# which provides some (all?) of the desired functions.
1875#
1876
1877AC_MSG_CHECKING([for inet_ntop with IPv6 support])
1878AC_TRY_RUN([
1879#include <sys/types.h>
1880#include <sys/socket.h>
1881#include <netinet/in.h>
1882#include <arpa/inet.h>
1883main() {
1884char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1885	[AC_MSG_RESULT(yes)
1886	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1887
1888	[AC_MSG_RESULT(no)
1889	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1890	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1891	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1892	[AC_MSG_RESULT(assuming inet_ntop not needed)
1893	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
1894
1895
1896# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1897# addresses with less than four octets, like "1.2.3".  Also leading
1898# zeros should also be rejected.
1899
1900AC_MSG_CHECKING([for working inet_pton with IPv6 support])
1901AC_TRY_RUN([
1902#include <sys/types.h>
1903#include <sys/socket.h>
1904#include <netinet/in.h>
1905#include <arpa/inet.h>
1906main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1907			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1908			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1909	[AC_MSG_RESULT(yes)
1910	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1911	[AC_MSG_RESULT(no)
1912	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1913	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1914	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1915	[AC_MSG_RESULT(assuming inet_pton needed)
1916	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1917	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1918	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFOR…

Large files files are truncated, but you can click here to view the full file