configure.in revision 245163
1# Copyright (C) 2004-2012  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_ECDSA=""
547OPENSSL_GOST=""
548case "$use_openssl" in
549	no)
550		AC_MSG_RESULT(no)
551		DST_OPENSSL_INC=""
552		USE_OPENSSL=""
553		OPENSSLLINKOBJS=""
554		OPENSSLLINKSRCS=""
555		;;
556	auto)
557		DST_OPENSSL_INC=""
558		USE_OPENSSL=""
559		OPENSSLLINKOBJS=""
560		OPENSSLLINKSRCS=""
561		AC_MSG_ERROR(
562[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
563If you don't want OpenSSL, use --without-openssl])
564		;;
565	*)
566		if test "$use_openssl" = "yes"
567		then
568			# User did not specify a path - guess it
569			for d in $openssldirs
570			do
571				if test -f $d/include/openssl/opensslv.h
572				then
573					use_openssl=$d
574					break
575				fi
576			done
577			if test "$use_openssl" = "yes"
578			then
579				AC_MSG_RESULT(not found)
580				AC_MSG_ERROR(
581[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
582			fi
583		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
584		then
585			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
586		fi
587		USE_OPENSSL='-DOPENSSL'
588		if test "$use_openssl" = "/usr"
589		then
590			DST_OPENSSL_INC=""
591			DNS_OPENSSL_LIBS="-lcrypto"
592		else
593			DST_OPENSSL_INC="-I$use_openssl/include"
594			case $host in
595			*-solaris*)
596				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
597				;;
598			*-hp-hpux*)
599				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
600				;;
601			*-apple-darwin*)
602				#
603				# Apple's ld seaches for serially for dynamic
604				# then static libraries.  This means you can't
605				# use -L to override dynamic system libraries
606				# with static ones when linking.  Instead
607				# we specify a absolute path.
608				#
609				if test -f "$use_openssl/lib/libcrypto.dylib"
610				then
611					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
612				else
613					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
614				fi
615				;;
616			*)
617				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
618				;;
619			esac
620		fi
621		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
622
623		saved_cflags="$CFLAGS"
624		saved_libs="$LIBS"
625		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
626		LIBS="$LIBS $DNS_OPENSSL_LIBS"
627		AC_MSG_CHECKING(whether linking with OpenSSL works)
628		AC_TRY_RUN([
629#include <openssl/err.h>
630int main() {
631	ERR_clear_error();
632	return (0);
633}
634],
635		[AC_MSG_RESULT(yes)],
636		[AC_MSG_RESULT(no)
637		 AC_MSG_ERROR(Could not run test program using OpenSSL from
638$use_openssl/lib and $use_openssl/include.
639Please check the argument to --with-openssl and your
640shared library configuration (e.g., LD_LIBRARY_PATH).)],
641		[AC_MSG_RESULT(assuming it does work on target platform)])
642
643		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
644		AC_TRY_LINK([
645#include <openssl/err.h>],
646[ DSO_METHOD_dlfcn(); ],
647		[AC_MSG_RESULT(no)],
648		[LIBS="$LIBS -ldl"
649		AC_TRY_LINK([
650#include <openssl/err.h>
651],[ DSO_METHOD_dlfcn(); ],
652		[AC_MSG_RESULT(yes)
653		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
654		],
655		 [AC_MSG_RESULT(unknown)
656		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
657		[AC_MSG_RESULT(assuming it does work on target platform)])
658		],
659		[AC_MSG_RESULT(assuming it does work on target platform)]
660		)
661		 
662AC_ARG_ENABLE(openssl-version-check,
663[AC_HELP_STRING([--enable-openssl-version-check],
664	[Check OpenSSL Version @<:@default=yes@:>@])])
665case "$enable_openssl_version_check" in
666yes|'')
667		AC_MSG_CHECKING(OpenSSL library version)
668		AC_TRY_RUN([
669#include <stdio.h>
670#include <openssl/opensslv.h>
671int main() {
672	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
673	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
674	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
675		return (0);
676	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
677		OPENSSL_VERSION_NUMBER);
678	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
679	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
680	return (1);
681}
682		],
683		[AC_MSG_RESULT(ok)],
684		[AC_MSG_RESULT(not compatible)
685		 OPENSSL_WARNING=yes
686		],
687		[AC_MSG_RESULT(assuming target platform has compatible version)])
688;;
689no)
690	AC_MSG_RESULT(Skipped OpenSSL version check)
691;;
692esac
693
694		AC_MSG_CHECKING(for OpenSSL DSA support)
695		if test -f $use_openssl/include/openssl/dsa.h
696		then
697			AC_DEFINE(HAVE_OPENSSL_DSA)
698			AC_MSG_RESULT(yes)
699		else
700			AC_MSG_RESULT(no)
701		fi
702
703		AC_CHECK_FUNCS(EVP_sha256 EVP_sha384 EVP_sha512)
704
705		AC_MSG_CHECKING(for OpenSSL ECDSA support)
706		have_ecdsa=""
707		AC_TRY_RUN([
708#include <stdio.h>
709#include <openssl/ecdsa.h>
710#include <openssl/objects.h>
711int main() {
712	EC_KEY *ec256, *ec384;
713
714#if !defined(HAVE_EVP_SHA256) || !defined(HAVE_EVP_SHA384)
715	return (1);
716#endif
717	ec256 = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
718	ec384 = EC_KEY_new_by_curve_name(NID_secp384r1);
719	if (ec256 == NULL || ec384 == NULL)
720		return (2);
721	return (0);
722}
723],
724		[AC_MSG_RESULT(yes)
725		have_ecdsa="yes"],
726		[AC_MSG_RESULT(no)
727		have_ecdsa="no"])
728		case $have_ecdsa in
729		yes)
730			OPENSSL_ECDSA="yes"
731			AC_DEFINE(HAVE_OPENSSL_ECDSA)
732			;;
733		*)
734			;;
735		esac
736
737		AC_MSG_CHECKING(for OpenSSL GOST support)
738		have_gost=""
739		AC_TRY_RUN([
740#include <openssl/conf.h>
741#include <openssl/engine.h>
742int main() {
743#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
744	ENGINE *e;
745	EC_KEY *ek;
746
747	ek = NULL;
748	OPENSSL_config(NULL);
749
750	e = ENGINE_by_id("gost");
751	if (e == NULL)
752		return (1);
753	if (ENGINE_init(e) <= 0)
754		return (1);
755	return (0);
756#else
757	return (1);
758#endif
759}
760],
761		[AC_MSG_RESULT(yes)
762		have_gost="yes"],
763		[AC_MSG_RESULT(no)
764		have_gost="no"],
765		[AC_MSG_RESULT(using --with-gost)])
766		AC_ARG_WITH(gost, , with_gost="$withval", with_gost="auto")
767		case "$with_gost" in
768		yes)
769		    case "$have_gost" in
770		    no)  AC_MSG_ERROR([gost not supported]) ;;
771		    *)  have_gost=yes ;;
772		    esac
773		    ;;
774		no)
775		    have_gost=no ;;
776		*)
777		    case "$have_gost" in
778		    yes|no) ;;
779		    *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
780		    esac
781		    ;;
782		esac
783		case $have_gost in
784		yes)
785			OPENSSL_GOST="yes"
786			AC_DEFINE(HAVE_OPENSSL_GOST, 1,
787				  [Define if your OpenSSL version supports GOST.])
788			;;
789		*)
790			;;
791		esac
792		CFLAGS="$saved_cflags"
793		LIBS="$saved_libs"
794		OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
795		OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
796
797		;;
798esac
799
800#
801# This would include the system openssl path (and linker options to use
802# it as needed) if it is found.
803#
804
805AC_SUBST(USE_OPENSSL)
806AC_SUBST(DST_OPENSSL_INC)
807AC_SUBST(OPENSSLLINKOBJS)
808AC_SUBST(OPENSSLLINKSRCS)
809AC_SUBST(OPENSSL_ECDSA)
810AC_SUBST(OPENSSL_GOST)
811
812DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
813
814#
815# Use OpenSSL for hash functions
816#
817
818AC_ARG_ENABLE(openssl-hash,
819	[  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
820	want_openssl_hash="$enableval", want_openssl_hash="no")
821case $want_openssl_hash in
822	yes)
823		if test "$USE_OPENSSL" = ""
824		then
825			AC_MSG_ERROR([No OpenSSL for hash functions])
826		fi
827		ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
828		ISC_OPENSSL_INC="$DST_OPENSSL_INC"
829		;;
830	no)
831		ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
832		ISC_OPENSSL_INC=""
833		;;
834esac
835AC_SUBST(ISC_PLATFORM_OPENSSLHASH)
836AC_SUBST(ISC_OPENSSL_INC)
837
838#
839# PKCS11 (aka crypto hardware) support
840#
841# This works only with the right OpenSSL with PKCS11 engine!
842#
843
844AC_MSG_CHECKING(for PKCS11 support)
845AC_ARG_WITH(pkcs11,
846[  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
847                          (PATH is for the PKCS11 provider)],
848   use_pkcs11="$withval", use_pkcs11="no")
849
850case "$use_pkcs11" in
851	no|'')
852		AC_MSG_RESULT(disabled)
853		USE_PKCS11=''
854		PKCS11_TOOLS=''
855		;;
856	yes|*)
857		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
858		USE_PKCS11='-DUSE_PKCS11'
859		PKCS11_TOOLS=pkcs11
860		;;
861esac
862AC_SUBST(USE_PKCS11)
863AC_SUBST(PKCS11_TOOLS)
864
865AC_MSG_CHECKING(for PKCS11 tools)
866case "$use_pkcs11" in
867	no|yes|'')
868		AC_MSG_RESULT(disabled)
869		PKCS11_PROVIDER="undefined"
870		;;
871       *)
872		AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
873		PKCS11_PROVIDER="$use_pkcs11"
874		;;
875esac
876AC_SUBST(PKCS11_PROVIDER)
877
878AC_MSG_CHECKING(for GSSAPI library)
879AC_ARG_WITH(gssapi,
880[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
881    use_gssapi="$withval", use_gssapi="yes")
882
883# gssapi is just the framework, we really require kerberos v5, so
884# look for those headers (the gssapi headers must be there, too)
885# The problem with this implementation is that it doesn't allow
886# for the specification of gssapi and krb5 headers in different locations,
887# which probably ought to be fixed although fixing might raise the issue of
888# trying to build with incompatible versions of gssapi and krb5.
889if test "$use_gssapi" = "yes"
890then
891	# first, deal with the obvious
892	if test \( -f /usr/include/kerberosv5/krb5.h -o \
893		   -f /usr/include/krb5/krb5.h -o \
894		   -f /usr/include/krb5.h \)   -a \
895		\( -f /usr/include/gssapi.h -o \
896		   -f /usr/include/gssapi/gssapi.h \)
897	then
898		use_gssapi=/usr
899	else
900	    krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
901	    for d in $krb5dirs
902	    do
903		if test -f $d/include/gssapi/gssapi_krb5.h -o \
904		        -f $d/include/krb5.h
905		then
906			if test -f $d/include/gssapi/gssapi.h -o \
907			        -f $d/include/gssapi.h
908			then
909				use_gssapi=$d
910				break
911			fi
912		fi
913		use_gssapi="no"
914	    done
915	fi
916fi
917
918case "$use_gssapi" in
919	no)
920		AC_MSG_RESULT(disabled)
921		USE_GSSAPI=''
922		;;
923	yes)
924		AC_MSG_ERROR([--with-gssapi must specify a path])
925		;;
926	*)
927		AC_MSG_RESULT(looking in $use_gssapi/lib)
928		USE_GSSAPI='-DGSSAPI'
929		saved_cppflags="$CPPFLAGS"
930		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
931		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
932		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
933
934		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
935		    AC_MSG_ERROR([gssapi.h not found])
936		fi
937
938		AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
939		    [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"])
940
941		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
942		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
943
944		if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
945		    AC_MSG_ERROR([krb5.h not found])
946		fi
947
948		CPPFLAGS="$saved_cppflags"
949
950		#
951		# XXXDCL This probably doesn't work right on all systems.
952		# It will need to be worked on as problems become evident.
953		#
954		# Essentially the problems here relate to two different
955		# areas.  The first area is building with either KTH
956		# or MIT Kerberos, particularly when both are present on
957		# the machine.  The other is static versus dynamic linking.
958		#
959		# On the KTH vs MIT issue, Both have libkrb5 that can mess
960		# up the works if one implementation ends up trying to
961		# use the other's krb.  This is unfortunately a situation
962		# that very easily arises.
963		#
964		# Dynamic linking when the dependency information is built
965		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
966		# all such problems go away, but when that setup is not
967		# present, because either the dynamic libraries lack
968		# dependencies or static linking is being done, then the
969		# problems start to show up.
970		saved_libs="$LIBS"
971		for TRY_LIBS in \
972		    "-lgssapi_krb5" \
973		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
974		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
975		    "-lgssapi" \
976		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
977		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
978		    "-lgss -lkrb5"
979		do
980		    # Note that this does not include $saved_libs, because
981		    # on FreeBSD machines this configure script has added
982		    # -L/usr/local/lib to LIBS, which can make the
983		    # -lgssapi_krb5 test succeed with shared libraries even
984		    # when you are trying to build with KTH in /usr/lib.
985		    if test "$use_gssapi" = "/usr"
986		    then
987			    LIBS="$TRY_LIBS"
988		    else
989			    LIBS="-L$use_gssapi/lib $TRY_LIBS"
990		    fi
991		    AC_MSG_CHECKING(linking as $TRY_LIBS)
992		    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
993				gssapi_linked=yes, gssapi_linked=no)
994		    case $gssapi_linked in
995		    yes) AC_MSG_RESULT(yes); break ;;
996		    no)  AC_MSG_RESULT(no) ;;
997		    esac
998		done
999
1000		case $gssapi_linked in
1001		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
1002		esac
1003
1004		#
1005		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
1006		# but MIT in /usr/local/lib and trying to build with KTH.
1007		# /usr/local/lib can end up earlier on the link lines.
1008		# Like most kludges, this one is not only inelegant it
1009		# is also likely to be the wrong thing to do at least as
1010		# many times as it is the right thing.  Something better
1011		# needs to be done.
1012		#
1013		if test "$use_gssapi" = "/usr" -a \
1014			-f /usr/local/lib/libkrb5.a; then
1015		    FIX_KTH_VS_MIT=yes
1016		fi
1017
1018		case "$FIX_KTH_VS_MIT" in
1019		yes)
1020		    case "$enable_static_linking" in
1021		    yes) gssapi_lib_suffix=".a"  ;;
1022		    *)   gssapi_lib_suffix=".so" ;;
1023		    esac
1024
1025		    for lib in $LIBS; do
1026			case $lib in
1027			-L*)
1028			    ;;
1029			-l*)
1030			    new_lib=`echo $lib |
1031				     sed -e s%^-l%$use_gssapi/lib/lib% \
1032					 -e s%$%$gssapi_lib_suffix%`
1033			    NEW_LIBS="$NEW_LIBS $new_lib"
1034			    ;;
1035			*)
1036			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1037			    ;;
1038			esac
1039		    done
1040		    LIBS="$NEW_LIBS"
1041		    ;;
1042		esac
1043
1044		DST_GSSAPI_INC="-I$use_gssapi/include"
1045		DNS_GSSAPI_LIBS="$LIBS"
1046
1047		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1048		LIBS="$saved_libs"
1049		;;
1050esac
1051
1052AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1053AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1054AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1055AC_SUBST(ISC_PLATFORM_KRB5HEADER)
1056
1057AC_SUBST(USE_GSSAPI)
1058AC_SUBST(DST_GSSAPI_INC)
1059AC_SUBST(DNS_GSSAPI_LIBS)
1060DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
1061
1062#
1063# Applications linking with libdns also need to link with these libraries.
1064#
1065
1066AC_SUBST(DNS_CRYPTO_LIBS)
1067
1068#
1069# was --with-randomdev specified?
1070#
1071AC_MSG_CHECKING(for random device)
1072AC_ARG_WITH(randomdev,
1073[  --with-randomdev=PATH   Specify path for random device],
1074    use_randomdev="$withval", use_randomdev="unspec")
1075
1076case "$use_randomdev" in
1077	unspec)
1078		case "$host" in
1079			*-openbsd*)
1080				devrandom=/dev/arandom
1081				;;
1082			*)
1083				devrandom=/dev/random
1084				;;
1085		esac
1086		AC_MSG_RESULT($devrandom)
1087		AC_CHECK_FILE($devrandom,
1088			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1089						 "$devrandom"),)
1090		;;
1091	yes)
1092		AC_MSG_ERROR([--with-randomdev must specify a path])
1093		;;
1094	no)
1095		AC_MSG_RESULT(disabled)
1096		;;
1097	*)
1098		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1099		AC_MSG_RESULT(using "$use_randomdev")
1100		;;
1101esac
1102
1103#
1104# Do we have arc4random() ?
1105#
1106AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1107
1108sinclude(config.threads.in)dnl
1109
1110if $use_threads
1111then
1112	if test "X$GCC" = "Xyes"; then
1113		case "$host" in
1114		*-freebsd*)
1115			CC="$CC -pthread"
1116			CCOPT="$CCOPT -pthread"
1117			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1118			;;
1119		*-openbsd*)
1120			CC="$CC -pthread"
1121			CCOPT="$CCOPT -pthread"
1122			;;
1123		*-solaris*)
1124			LIBS="$LIBS -lthread"
1125			;;
1126		*-ibm-aix*)
1127			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1128			;;
1129		esac
1130	else
1131		case $host in
1132		*-dec-osf*)
1133			CC="$CC -pthread"
1134			CCOPT="$CCOPT -pthread"
1135			;;
1136		*-solaris*)
1137			CC="$CC -mt"
1138			CCOPT="$CCOPT -mt"
1139			;;
1140		*-ibm-aix*)
1141			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1142			;;
1143		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
1144			CC="$CC -Kthread"
1145			CCOPT="$CCOPT -Kthread"
1146			;;
1147		*-*-sysv*OpenUNIX*)
1148			CC="$CC -Kpthread"
1149			CCOPT="$CCOPT -Kpthread"
1150			;;
1151		esac
1152	fi
1153	ALWAYS_DEFINES="-D_REENTRANT"
1154	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1155	THREADOPTOBJS='${THREADOPTOBJS}'
1156	THREADOPTSRCS='${THREADOPTSRCS}'
1157	thread_dir=pthreads
1158	#
1159	# We'd like to use sigwait() too
1160	#
1161	AC_CHECK_FUNC(sigwait,
1162		      AC_DEFINE(HAVE_SIGWAIT),
1163		      AC_CHECK_LIB(c, sigwait,
1164		      AC_DEFINE(HAVE_SIGWAIT),
1165		      AC_CHECK_LIB(pthread, sigwait,
1166				   AC_DEFINE(HAVE_SIGWAIT),
1167				   AC_CHECK_LIB(pthread, _Psigwait,
1168						AC_DEFINE(HAVE_SIGWAIT),))))
1169
1170	AC_CHECK_FUNC(pthread_attr_getstacksize,
1171		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1172
1173	AC_CHECK_FUNC(pthread_attr_setstacksize,
1174		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1175
1176	#
1177	# Additional OS-specific issues related to pthreads and sigwait.
1178	#
1179	case "$host" in
1180		#
1181		# One more place to look for sigwait.
1182		#
1183		*-freebsd*)
1184			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1185			case $host in
1186			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1187			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1188				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1189				;;
1190			*-freebsd6.*)
1191				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1192				;;
1193			esac
1194			;;
1195		#
1196		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
1197		# called before certain pthreads calls.	 This is deprecated
1198		# in BSD/OS 4.1.
1199		#
1200		*-bsdi3.*|*-bsdi4.0*)
1201			AC_DEFINE(NEED_PTHREAD_INIT)
1202			;;
1203		#
1204		# LinuxThreads requires some changes to the way we
1205		# deal with signals.
1206		#
1207		*-linux*)
1208			AC_DEFINE(HAVE_LINUXTHREADS)
1209			;;
1210		#
1211		# Ensure the right sigwait() semantics on Solaris and make
1212		# sure we call pthread_setconcurrency.
1213		#
1214		*-solaris*)
1215			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1216			AC_CHECK_FUNC(pthread_setconcurrency,
1217				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1218			;;
1219		#
1220		# UnixWare does things its own way.
1221		#
1222		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1223			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1224			;;
1225	esac
1226
1227	#
1228	# Look for sysconf to allow detection of the number of processors.
1229	#
1230	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1231
1232else
1233	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1234	thread_dir=nothreads
1235	THREADOPTOBJS=""
1236	THREADOPTSRCS=""
1237	ALWAYS_DEFINES=""
1238fi
1239
1240AC_SUBST(ALWAYS_DEFINES)
1241AC_SUBST(ISC_PLATFORM_USETHREADS)
1242AC_SUBST(THREADOPTOBJS)
1243AC_SUBST(THREADOPTSRCS)
1244ISC_THREAD_DIR=$thread_dir
1245AC_SUBST(ISC_THREAD_DIR)
1246
1247#
1248# was --with-libxml2 specified?
1249#
1250AC_MSG_CHECKING(for libxml2 library)
1251AC_ARG_WITH(libxml2,
1252[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1253    use_libxml2="$withval", use_libxml2="auto")
1254
1255case "$use_libxml2" in
1256	no)
1257		DST_LIBXML2_INC=""
1258		;;
1259	auto|yes)
1260		case X`(xml2-config --version) 2>/dev/null` in
1261		X2.[[678]].*)
1262			libxml2_libs=`xml2-config --libs`
1263			libxml2_cflags=`xml2-config --cflags`
1264			;;
1265		*)
1266			libxml2_libs=
1267			libxml2_cflags=
1268			;;
1269		esac
1270		;;
1271	*)
1272		if test -f "$use_libxml2/bin/xml2-config" ; then
1273			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1274			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1275		fi
1276		;;
1277esac
1278
1279if test "X$libxml2_libs" != "X"
1280then
1281	AC_MSG_RESULT(yes)
1282	CFLAGS="$CFLAGS $libxml2_cflags"
1283	LIBS="$LIBS $libxml2_libs"
1284	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1285else
1286	AC_MSG_RESULT(no)
1287fi
1288
1289#
1290# In solaris 10, SMF can manage named service
1291#
1292AC_CHECK_LIB(scf, smf_enable_instance)
1293
1294#
1295# flockfile is usually provided by pthreads, but we may want to use it
1296# even if compiled with --disable-threads.  getc_unlocked might also not
1297# be defined.
1298#
1299AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1300AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1301
1302# 
1303# Indicate what the final decision was regarding threads.
1304#
1305AC_MSG_CHECKING(whether to build with threads)
1306if $use_threads; then
1307	AC_MSG_RESULT(yes)
1308else
1309	AC_MSG_RESULT(no)
1310fi
1311
1312# 
1313# End of pthreads stuff.
1314#
1315
1316#
1317# Large File
1318#
1319AC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1320	      want_largefile="yes", want_largefile="no")
1321case $want_largefile in
1322	yes)
1323		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1324		;;
1325	*)
1326		;;
1327esac
1328
1329#
1330# Additional compiler settings.
1331#
1332MKDEPCC="$CC"
1333MKDEPCFLAGS="-M"
1334IRIX_DNSSEC_WARNINGS_HACK=""
1335
1336if test "X$GCC" = "Xyes"; then
1337	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1338	SAVE_CFLAGS=$CFLAGS
1339	CFLAGS="$CFLAGS -fno-strict-aliasing"
1340	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1341	CFLAGS=$SAVE_CFLAGS
1342	if test "$FNOSTRICTALIASING" = "yes"; then
1343		AC_MSG_RESULT(yes)
1344	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1345	else
1346		AC_MSG_RESULT(no)
1347	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1348	fi
1349	case "$host" in
1350	*-hp-hpux*)
1351		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1352		;;
1353	esac
1354else
1355	case $host in
1356	*-dec-osf*)
1357		CC="$CC -std"
1358		CCOPT="$CCOPT -std"
1359		MKDEPCC="$CC"
1360		;;
1361	*-hp-hpux*)
1362		CC="$CC -Ae -z"
1363		# The version of the C compiler that constantly warns about
1364		# 'const' as well as alignment issues is unfortunately not
1365		# able to be discerned via the version of the operating
1366		# system, nor does cc have a version flag.
1367		case "`$CC +W 123 2>&1`" in
1368		*Unknown?option*)
1369			STD_CWARNINGS="+w1"
1370			;;
1371		*)
1372			# Turn off the pointlessly noisy warnings.
1373			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1374			;;
1375		esac
1376		CCOPT="$CCOPT -Ae -z"
1377		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1378		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1379		;;
1380	*-sgi-irix*)
1381		STD_CWARNINGS="-fullwarn -woff 1209"
1382		#
1383		# Silence more than 250 instances of
1384		#   "prototyped function redeclared without prototype"
1385		# and 11 instances of
1386		#   "variable ... was set but never used"
1387		# from lib/dns/sec/openssl.
1388		#
1389		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1390		;;
1391	*-solaris*)
1392		MKDEPCFLAGS="-xM"
1393		;;
1394	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1395		# UnixWare
1396		CC="$CC -w"
1397		;;
1398	esac
1399fi
1400
1401AC_SUBST(MKDEPCC)
1402AC_SUBST(MKDEPCFLAGS)
1403AC_SUBST(MKDEPPROG)
1404AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1405
1406#
1407# NLS
1408#
1409AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1410
1411#
1412# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1413#
1414# AC_CHECK_LIB(xnet, socket, ,
1415#    AC_CHECK_LIB(socket, socket)
1416# )
1417#
1418# Use this for now, instead:
1419#
1420case "$host" in
1421	mips-sgi-irix*)
1422		;;
1423	*-linux*)
1424		;;
1425	*)
1426		AC_CHECK_LIB(socket, socket)
1427		AC_CHECK_LIB(nsl, inet_addr)
1428		;;
1429esac
1430
1431#
1432# Work around Solaris's select() limitations.
1433#
1434case "$host" in
1435	*-solaris2.[[89]]|*-solaris2.1?)
1436	AC_DEFINE(FD_SETSIZE, 65536,
1437		  [Solaris hack to get select_large_fdset.])
1438	;;
1439esac
1440
1441#
1442# Purify support
1443#
1444AC_MSG_CHECKING(whether to use purify)
1445AC_ARG_WITH(purify,
1446	[  --with-purify[=PATH]      use Rational purify],
1447	use_purify="$withval", use_purify="no")
1448
1449case "$use_purify" in
1450	no)
1451		;;
1452	yes)
1453		AC_PATH_PROG(purify_path, purify, purify)
1454		;;
1455	*)
1456		purify_path="$use_purify"
1457		;;
1458esac
1459
1460case "$use_purify" in
1461	no)
1462		AC_MSG_RESULT(no)
1463		PURIFY=""
1464		;;
1465	*)
1466		if test -f $purify_path || test $purify_path = purify; then
1467			AC_MSG_RESULT($purify_path)
1468			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1469			PURIFY="$purify_path $PURIFYFLAGS"
1470		else
1471			AC_MSG_ERROR([$purify_path not found.
1472
1473Please choose the proper path with the following command:
1474
1475    configure --with-purify=PATH
1476])
1477		fi
1478		;;
1479esac
1480
1481AC_SUBST(PURIFY)
1482
1483
1484AC_ARG_WITH(libtool,
1485	    [  --with-libtool          use GNU libtool],
1486	    use_libtool="$withval", use_libtool="no")
1487
1488case $use_libtool in
1489	yes)
1490		AM_PROG_LIBTOOL
1491		O=lo
1492		A=la
1493		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1494		LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1495		LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1496		LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1497		case "$host" in
1498		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1499		esac
1500		case "$host" in
1501		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1502		*) LIBTOOL_IN_MAIN= ;;
1503		esac;
1504		;;
1505	*)
1506		O=o
1507		A=a
1508		LIBTOOL=
1509		AC_SUBST(LIBTOOL)
1510		LIBTOOL_MKDEP_SED=
1511		LIBTOOL_MODE_COMPILE=
1512		LIBTOOL_MODE_INSTALL=
1513		LIBTOOL_MODE_LINK=
1514		LIBTOOL_ALLOW_UNDEFINED=
1515		LIBTOOL_IN_MAIN=
1516		;;
1517esac
1518
1519#
1520# enable/disable dumping stack backtrace.  Also check if the system supports
1521# glibc-compatible backtrace() function.
1522#
1523AC_ARG_ENABLE(backtrace,
1524[  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
1525	      want_backtrace="$enableval",  want_backtrace="yes")
1526case $want_backtrace in
1527yes)
1528	ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
1529	AC_TRY_LINK([#include <execinfo.h>],
1530	[return (backtrace((void **)0, 0));],
1531	[AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
1532	;;
1533*)
1534	ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
1535	;;
1536esac
1537AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
1538
1539AC_ARG_ENABLE(symtable,
1540[  --enable-symtable       use internal symbol table for backtrace
1541                          [[all|minimal(default)|none]]],
1542		want_symtable="$enableval",  want_symtable="minimal")
1543case $want_symtable in
1544yes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
1545	if test "$PERL" = ""
1546	then
1547		AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1548Install perl or explicitly disable the feature by --disable-symtable.])
1549	fi
1550	if test "$use_libtool" = "yes"; then
1551		AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
1552	else
1553		# we generate the internal symbol table only for those systems
1554		# known to work to avoid unexpected build failure.  Also, warn
1555		# about unsupported systems when the feature is enabled
1556		#  manually.
1557		case $host_os in
1558		freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1559			MKSYMTBL_PROGRAM="$PERL"
1560			if test $want_symtable = all; then
1561				ALWAYS_MAKE_SYMTABLE="yes"
1562			fi
1563			;;
1564		*)
1565			if test $want_symtable = yes -o $want_symtable = all
1566			then
1567				AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1568			fi
1569		esac
1570	fi
1571	;;
1572*)
1573	;;
1574esac
1575AC_SUBST(MKSYMTBL_PROGRAM)
1576AC_SUBST(ALWAYS_MAKE_SYMTABLE)
1577
1578#
1579# File name extension for static archive files, for those few places
1580# where they are treated differently from dynamic ones.
1581#
1582SA=a
1583
1584AC_SUBST(O)
1585AC_SUBST(A)
1586AC_SUBST(SA)
1587AC_SUBST(LIBTOOL_MKDEP_SED)
1588AC_SUBST(LIBTOOL_MODE_COMPILE)
1589AC_SUBST(LIBTOOL_MODE_INSTALL)
1590AC_SUBST(LIBTOOL_MODE_LINK)
1591AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1592AC_SUBST(LIBTOOL_IN_MAIN)
1593
1594#
1595# build exportable DNS library?
1596#
1597AC_ARG_ENABLE(exportlib,
1598	[  --enable-exportlib	build exportable library (GNU make required)
1599                        [[default=no]]])
1600case "$enable_exportlib" in
1601	yes)
1602		gmake=
1603		for x in gmake gnumake make; do
1604			if $x --version 2>/dev/null | grep GNU > /dev/null; then
1605				gmake=$x
1606				break;
1607			fi
1608		done
1609		if test -z "$gmake"; then
1610			AC_MSG_ERROR([exportlib requires GNU make.  Install it or disable the feature.])
1611		fi
1612		LIBEXPORT=lib/export
1613		AC_SUBST(LIBEXPORT)
1614		BIND9_CO_RULE="%.$O:  \${srcdir}/%.c"
1615		;;
1616	no|*)
1617		BIND9_CO_RULE=".c.$O:"
1618		;;
1619esac
1620AC_SUBST(BIND9_CO_RULE)
1621
1622AC_ARG_WITH(export-libdir,
1623	[  --with-export-libdir[=PATH]
1624                        installation directory for the export library
1625                        [[EPREFIX/lib/bind9]]],
1626	export_libdir="$withval",)
1627if test -z "$export_libdir"; then
1628	export_libdir="\${exec_prefix}/lib/bind9/"
1629fi
1630AC_SUBST(export_libdir)
1631
1632AC_ARG_WITH(export-includedir,
1633	[  --with-export-includedir[=PATH]
1634                        installation directory for the header files of the
1635                        export library [[PREFIX/include/bind9]]],
1636	export_includedir="$withval",)
1637if test -z "$export_includedir"; then
1638	export_includedir="\${prefix}/include/bind9/"
1639fi
1640AC_SUBST(export_includedir)
1641
1642#
1643# Here begins a very long section to determine the system's networking
1644# capabilities.  The order of the tests is significant.
1645#
1646
1647#
1648# IPv6
1649#
1650AC_ARG_ENABLE(ipv6,
1651	[  --enable-ipv6           use IPv6 [default=autodetect]])
1652
1653case "$enable_ipv6" in
1654	yes|''|autodetect)
1655		AC_DEFINE(WANT_IPV6)
1656		;;
1657	no)
1658		;;
1659esac
1660
1661#
1662# We do the IPv6 compilation checking after libtool so that we can put
1663# the right suffix on the files.
1664#
1665AC_MSG_CHECKING(for IPv6 structures)
1666AC_TRY_COMPILE([
1667#include <sys/types.h>
1668#include <sys/socket.h>
1669#include <netinet/in.h>],
1670[struct sockaddr_in6 sin6; return (0);],
1671	[AC_MSG_RESULT(yes)
1672	 found_ipv6=yes],
1673	[AC_MSG_RESULT(no)
1674	 found_ipv6=no])
1675
1676#
1677# See whether IPv6 support is provided via a Kame add-on.
1678# This is done before other IPv6 linking tests to LIBS is properly set.
1679#
1680AC_MSG_CHECKING(for Kame IPv6 support)
1681AC_ARG_WITH(kame,
1682	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1683	use_kame="$withval", use_kame="no")
1684
1685case "$use_kame" in
1686	no)
1687		;;
1688	yes)
1689		kame_path=/usr/local/v6
1690		;;
1691	*)
1692		kame_path="$use_kame"
1693		;;
1694esac
1695
1696case "$use_kame" in
1697	no)
1698		AC_MSG_RESULT(no)
1699		;;
1700	*)
1701		if test -f $kame_path/lib/libinet6.a; then
1702			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1703			LIBS="-L$kame_path/lib -linet6 $LIBS"
1704		else
1705			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1706
1707Please choose the proper path with the following command:
1708
1709    configure --with-kame=PATH
1710])
1711		fi
1712		;;
1713esac
1714
1715#
1716# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1717# Including it on Kame-using platforms is very bad, though, because
1718# Kame uses #error against direct inclusion.   So include it on only
1719# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1720# This is done before the in6_pktinfo check because that's what
1721# netinet6/in6.h is needed for.
1722#
1723changequote({, })
1724case "$host" in
1725*-bsdi4.[01]*)
1726	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1727	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1728	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1729	;;
1730*)
1731	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1732	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1733	isc_netinet6in6_hack=""
1734	;;
1735esac
1736changequote([, ])
1737
1738#
1739# This is similar to the netinet6/in6.h issue.
1740#
1741case "$host" in
1742*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1743	# UnixWare
1744	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1745	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1746	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1747	isc_netinetin6_hack="#include <netinet/in6.h>"
1748	;;
1749*)
1750	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1751	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1752	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1753	isc_netinetin6_hack=""
1754	;;
1755esac
1756
1757#
1758# Now delve deeper into the suitability of the IPv6 support.
1759#
1760case "$found_ipv6" in
1761	yes)
1762		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1763		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1764
1765		AC_MSG_CHECKING(for in6_addr)
1766		AC_TRY_COMPILE([
1767#include <sys/types.h>
1768#include <sys/socket.h>
1769#include <netinet/in.h>
1770$isc_netinetin6_hack
1771$isc_netinet6in6_hack
1772],
1773[struct in6_addr in6; return (0);],
1774		[AC_MSG_RESULT(yes)
1775		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1776		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1777		 isc_in_addr6_hack=""],
1778		[AC_MSG_RESULT(no)
1779		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1780		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1781		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1782
1783		AC_MSG_CHECKING(for in6addr_any)
1784		AC_TRY_LINK([
1785#include <sys/types.h>
1786#include <sys/socket.h>
1787#include <netinet/in.h>
1788$isc_netinetin6_hack
1789$isc_netinet6in6_hack
1790$isc_in_addr6_hack
1791],
1792		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1793			[AC_MSG_RESULT(yes)
1794			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1795			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1796			[AC_MSG_RESULT(no)
1797			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1798			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1799
1800		AC_MSG_CHECKING(for in6addr_loopback)
1801		AC_TRY_LINK([
1802#include <sys/types.h>
1803#include <sys/socket.h>
1804#include <netinet/in.h>
1805$isc_netinetin6_hack
1806$isc_netinet6in6_hack
1807$isc_in_addr6_hack
1808],
1809		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1810			[AC_MSG_RESULT(yes)
1811			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1812			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1813			[AC_MSG_RESULT(no)
1814			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1815			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1816
1817		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1818		AC_TRY_COMPILE([
1819#include <sys/types.h>
1820#include <sys/socket.h>
1821#include <netinet/in.h>
1822$isc_netinetin6_hack
1823$isc_netinet6in6_hack
1824],
1825		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1826			[AC_MSG_RESULT(yes)
1827			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1828			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1829			[AC_MSG_RESULT(no)
1830			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1831			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1832		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1833
1834		AC_MSG_CHECKING(for in6_pktinfo)
1835		AC_TRY_COMPILE([
1836#include <sys/types.h>
1837#include <sys/socket.h>
1838#include <netinet/in.h>
1839$isc_netinetin6_hack
1840$isc_netinet6in6_hack
1841],
1842		[struct in6_pktinfo xyzzy; return (0);],
1843			[AC_MSG_RESULT(yes)
1844			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1845			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1846			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1847		;;
1848	no)
1849		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1850		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1851		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1852		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1853		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1854		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1855		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1856		ISC_IPV6_H="ipv6.h"
1857		ISC_IPV6_O="ipv6.$O"
1858		ISC_ISCIPV6_O="unix/ipv6.$O"
1859		ISC_IPV6_C="ipv6.c"
1860		;;
1861esac
1862
1863AC_SUBST(ISC_PLATFORM_HAVEIPV6)
1864AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1865AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1866AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1867AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1868AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1869AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1870AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1871AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1872AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1873AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1874AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1875AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1876AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1877AC_SUBST(ISC_IPV6_H)
1878AC_SUBST(ISC_IPV6_O)
1879AC_SUBST(ISC_ISCIPV6_O)
1880AC_SUBST(ISC_IPV6_C)
1881AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1882AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1883
1884AC_MSG_CHECKING([for struct if_laddrreq])
1885AC_TRY_LINK([
1886#include <sys/types.h>
1887#include <net/if6.h>
1888],[ struct if_laddrreq a; ],
1889	[AC_MSG_RESULT(yes)
1890	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1891	[AC_MSG_RESULT(no)
1892	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1893AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1894
1895AC_MSG_CHECKING([for struct if_laddrconf])
1896AC_TRY_LINK([
1897#include <sys/types.h>
1898#include <net/if6.h>
1899],[ struct if_laddrconf a; ],
1900	[AC_MSG_RESULT(yes)
1901	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1902	[AC_MSG_RESULT(no)
1903	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1904AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1905
1906#
1907# Check for network functions that are often missing.  We do this
1908# after the libtool checking, so we can put the right suffix on
1909# the files.  It also needs to come after checking for a Kame add-on,
1910# which provides some (all?) of the desired functions.
1911#
1912
1913AC_MSG_CHECKING([for inet_ntop with IPv6 support])
1914AC_TRY_RUN([
1915#include <sys/types.h>
1916#include <sys/socket.h>
1917#include <netinet/in.h>
1918#include <arpa/inet.h>
1919main() {
1920char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1921	[AC_MSG_RESULT(yes)
1922	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1923
1924	[AC_MSG_RESULT(no)
1925	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1926	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1927	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1928	[AC_MSG_RESULT(assuming inet_ntop not needed)
1929	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
1930
1931
1932# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1933# addresses with less than four octets, like "1.2.3".  Also leading
1934# zeros should also be rejected.
1935
1936AC_MSG_CHECKING([for working inet_pton with IPv6 support])
1937AC_TRY_RUN([
1938#include <sys/types.h>
1939#include <sys/socket.h>
1940#include <netinet/in.h>
1941#include <arpa/inet.h>
1942main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1943			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1944			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1945	[AC_MSG_RESULT(yes)
1946	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1947	[AC_MSG_RESULT(no)
1948	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1949	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1950	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1951	[AC_MSG_RESULT(assuming inet_pton needed)
1952	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1953	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1954	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
1955
1956AC_SUBST(ISC_PLATFORM_NEEDNTOP)
1957AC_SUBST(ISC_PLATFORM_NEEDPTON)
1958
1959#
1960# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1961#
1962case "$host" in
1963	*-dec-osf*)
1964		# Turn on 4.4BSD style sa_len support.
1965		AC_DEFINE(_SOCKADDR_LEN)
1966		;;
1967esac
1968
1969AC_MSG_CHECKING(for sa_len in struct sockaddr)
1970AC_TRY_COMPILE([
1971#include <sys/types.h>
1972#include <sys/socket.h>],
1973[struct sockaddr sa; sa.sa_len = 0; return (0);],
1974	[AC_MSG_RESULT(yes)
1975	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1976	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1977	[AC_MSG_RESULT(no)
1978	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1979	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1980AC_SUBST(ISC_PLATFORM_HAVESALEN)
1981AC_SUBST(LWRES_PLATFORM_HAVESALEN)
1982
1983#
1984# Look for a 4.4BSD or 4.3BSD struct msghdr
1985#
1986AC_MSG_CHECKING(for struct msghdr flavor)
1987AC_TRY_COMPILE([
1988#include <sys/types.h>
1989#include <sys/socket.h>],
1990[struct msghdr msg; msg.msg_flags = 0; return (0);],
1991	[AC_MSG_RESULT(4.4BSD)
1992	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1993	[AC_MSG_RESULT(4.3BSD)
1994	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1995AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1996
1997#
1998# Look for in_port_t.
1999#
2000AC_MSG_CHECKING(for type in_port_t)
2001AC_TRY_COMPILE([
2002#include <sys/types.h>
2003#include <netinet/in.h>],
2004[in_port_t port = 25; return (0);],
2005	[AC_MSG_RESULT(yes)
2006	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
2007	[AC_MSG_RESULT(no)
2008	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
2009AC_SUBST(ISC_PLATFORM_NEEDPORTT)
2010
2011#
2012# Check for addrinfo
2013#
2014AC_MSG_CHECKING(for struct addrinfo)
2015AC_TRY_COMPILE([
2016#include <netdb.h>],
2017[struct addrinfo a; return (0);],
2018	[AC_MSG_RESULT(yes)
2019	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
2020	ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
2021	AC_DEFINE(HAVE_ADDRINFO)],
2022	[AC_MSG_RESULT(no)
2023	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
2024	ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
2025AC_SUBST(ISC_LWRES_NEEDADDRINFO)
2026AC_SUBST(ISC_IRS_NEEDADDRINFO)
2027
2028#
2029# Check for rrsetinfo
2030#
2031AC_MSG_CHECKING(for struct rrsetinfo)
2032AC_TRY_COMPILE([
2033#include <netdb.h>],
2034[struct rrsetinfo r; return (0);],
2035	[AC_MSG_RESULT(yes)
2036	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
2037	[AC_MSG_RESULT(no)
2038	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
2039AC_SUBST(ISC_LWRES_NEEDRRSETINFO)
2040
2041AC_MSG_CHECKING(for int sethostent)
2042AC_TRY_COMPILE([
2043#include <netdb.h>],
2044[int i = sethostent(0); return(0);],
2045	[AC_MSG_RESULT(yes)
2046	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
2047	[AC_MSG_RESULT(no)
2048	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
2049AC_SUBST(ISC_LWRES_SETHOSTENTINT)
2050
2051AC_MSG_CHECKING(for int endhostent)
2052AC_TRY_COMPILE([
2053#include <netdb.h>],
2054[int i = endhostent(); return(0);],
2055	[AC_MSG_RESULT(yes)
2056	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
2057	[AC_MSG_RESULT(no)
2058	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
2059AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
2060
2061AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
2062AC_TRY_COMPILE([
2063#include <netdb.h>
2064struct netent *getnetbyaddr(in_addr_t, int);],
2065[],
2066	[AC_MSG_RESULT(yes)
2067	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
2068	[AC_MSG_RESULT(no)
2069	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
2070AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
2071
2072AC_MSG_CHECKING(for int setnetent)
2073AC_TRY_COMPILE([
2074#include <netdb.h>],
2075[int i = setnetent(0); return(0);],
2076	[AC_MSG_RESULT(yes)
2077	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
2078	[AC_MSG_RESULT(no)
2079	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
2080AC_SUBST(ISC_LWRES_SETNETENTINT)
2081
2082AC_MSG_CHECKING(for int endnetent)
2083AC_TRY_COMPILE([
2084#include <netdb.h>],
2085[int i = endnetent(); return(0);],
2086	[AC_MSG_RESULT(yes)
2087	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
2088	[AC_MSG_RESULT(no)
2089	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
2090AC_SUBST(ISC_LWRES_ENDNETENTINT)
2091
2092AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
2093AC_TRY_COMPILE([
2094#include <netdb.h>
2095struct hostent *gethostbyaddr(const void *, size_t, int);],
2096[return(0);],
2097	[AC_MSG_RESULT(yes)
2098	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
2099	[AC_MSG_RESULT(no)
2100	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
2101AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
2102
2103AC_MSG_CHECKING(for h_errno in netdb.h)
2104AC_TRY_COMPILE([
2105#include <netdb.h>],
2106[h_errno = 1; return(0);],
2107	[AC_MSG_RESULT(yes)
2108	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
2109	[AC_MSG_RESULT(no)
2110	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
2111AC_SUBST(ISC_LWRES_NEEDHERRNO)
2112
2113#
2114# Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
2115# known variations here:
2116#
2117AC_MSG_CHECKING(for getnameinfo prototype definitions)
2118AC_TRY_COMPILE([
2119#include <sys/types.h>
2120#include <sys/socket.h>
2121#include <netdb.h>
2122int getnameinfo(const struct sockaddr *, socklen_t, char *,
2123                socklen_t, char *, socklen_t, unsigned int);],
2124[ return (0);],
2125	[AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
2126	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
2127		   [Define to the buffer length type used by getnameinfo(3).])
2128	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
2129		   [Define to the flags type used by getnameinfo(3).])],
2130[AC_TRY_COMPILE([
2131#include <sys/types.h>
2132#include <sys/socket.h>
2133#include <netdb.h>
2134int getnameinfo(const struct sockaddr *, socklen_t, char *,
2135                size_t, char *, size_t, int);],
2136[ return (0);],
2137	[AC_MSG_RESULT(size_t for buflen; int for flags)
2138	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
2139	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
2140[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2141AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
2142AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
2143
2144#
2145# ...and same for gai_strerror().
2146#
2147AC_MSG_CHECKING(for gai_strerror prototype definitions)
2148AC_TRY_COMPILE([
2149#include <sys/types.h>
2150#include <sys/socket.h>
2151#include <netdb.h>
2152char *gai_strerror(int ecode);],
2153[ return (0); ],
2154	[AC_MSG_RESULT(returning char *)
2155	 AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
2156	 [return type of gai_strerror])],
2157[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2158AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
2159
2160AC_CHECK_FUNC(getipnodebyname,
2161	[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
2162	[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
2163AC_CHECK_FUNC(getnameinfo,
2164	[ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
2165	[ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
2166AC_CHECK_FUNC(getaddrinfo,
2167	[ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
2168	AC_DEFINE(HAVE_GETADDRINFO)],
2169	[ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
2170AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
2171AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
2172AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
2173AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
2174AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
2175
2176AC_ARG_ENABLE(getifaddrs,
2177[  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
2178    want_getifaddrs="$enableval",  want_getifaddrs="yes")
2179
2180#
2181# This interface iteration code for getifaddrs() will fall back to using
2182# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
2183# addresses.
2184# 
2185case $want_getifaddrs in
2186glibc)
2187AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
2188AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2189;;
2190yes)
2191AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2192;;
2193no)
2194;;
2195esac
2196
2197#
2198# Look for a sysctl call to get the list of network interfaces.
2199#
2200case $ac_cv_header_sys_sysctl_h in
2201yes)
2202AC_MSG_CHECKING(for interface list sysctl)
2203AC_EGREP_CPP(found_rt_iflist, [
2204#include <sys/param.h>
2205#include <sys/sysctl.h>
2206#include <sys/socket.h>
2207#ifdef NET_RT_IFLIST
2208found_rt_iflist
2209#endif
2210],
2211	[AC_MSG_RESULT(yes)
2212	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
2213	[AC_MSG_RESULT(no)])
2214;;
2215esac
2216
2217#
2218# Check for some other useful functions that are not ever-present.
2219#
2220
2221# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
2222# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
2223# reportedly defines strsep() without declaring it in <string.h> when
2224# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
2225# AC_CHECK_FUNC() incorrectly succeeds because it declares
2226# the function itself.
2227AC_MSG_CHECKING(for correctly declared strsep())
2228AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
2229	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
2230	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
2231AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
2232
2233AC_CHECK_FUNC(memmove,
2234	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
2235	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
2236AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
2237
2238AC_CHECK_FUNC(strtoul,
2239	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
2240	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
2241	 GENRANDOMLIB=""],
2242	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
2243	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
2244	 GENRANDOMLIB='${ISCLIBS}'])
2245AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
2246AC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
2247AC_SUBST(GENRANDOMLIB)
2248
2249AC_CHECK_FUNC(strlcpy,
2250	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
2251	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
2252AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
2253
2254AC_CHECK_FUNC(strlcat,
2255	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
2256	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
2257AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
2258
2259ISC_PRINT_OBJS=
2260ISC_PRINT_SRCS=
2261AC_MSG_CHECKING(sprintf)
2262AC_TRY_COMPILE([
2263#include <stdio.h>
2264],
2265[ char buf[2]; return(*sprintf(buf,"x"));],
2266[
2267ISC_PRINT_OBJS="print.$O"
2268ISC_PRINT_SRCS="print.c"
2269ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
2270LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
2271],
2272[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
2273 LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
2274)
2275AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
2276AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
2277
2278AC_CHECK_FUNC(vsnprintf,
2279	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
2280	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
2281	[ISC_PRINT_OBJS="print.$O"
2282	 ISC_PRINT_SRCS="print.c"
2283	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
2284	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
2285AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
2286AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
2287ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
2288ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
2289
2290AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
2291
2292AC_SUBST(ISC_EXTRA_OBJS)
2293AC_SUBST(ISC_EXTRA_SRCS)
2294
2295#
2296# Use our own SPNEGO implementation?
2297#
2298AC_ARG_ENABLE(isc-spnego,
2299	[  --disable-isc-spnego    use SPNEGO from GSSAPI library])
2300
2301if test -n "$USE_GSSAPI"
2302then
2303	case "$enable_isc_spnego" in
2304		yes|'')
2305			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
2306			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
2307			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
2308			AC_MSG_RESULT(using SPNEGO from lib/dns)
2309			;;
2310		no)
2311			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
2312			;;
2313	esac
2314fi
2315
2316AC_SUBST(USE_ISC_SPNEGO)
2317
2318AC_SUBST(DST_EXTRA_OBJS)
2319AC_SUBST(DST_EXTRA_SRCS)
2320
2321# Determine the printf format characters to use when printing
2322# values of type isc_int64_t. This will normally be "ll", but where
2323# the compiler treats "long long" as a alias for "long" and printf
2324# doesn't know about "long long" use "l".  Hopefully the sprintf
2325# will produce a inconsistent result in the later case.  If the compiler
2326# fails due to seeing "%lld" we fall back to "l".
2327#
2328# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
2329# %ld even for (long long)/
2330#
2331# Win32 uses "%I64d", but that's defined elsewhere since we don't use
2332# configure on Win32.
2333#
2334AC_MSG_CHECKING(printf format modifier for 64-bit integers)
2335AC_TRY_RUN([
2336#include <stdio.h>
2337main() {
2338	long long int j = 0;
2339	char buf[100];
2340	buf[0] = 0;
2341	sprintf(buf, "%lld", j);
2342	exit((sizeof(long long int) != sizeof(long int))? 0 :
2343	     (strcmp(buf, "0") != 0));
2344} 
2345],
2346	[AC_MSG_RESULT(ll)
2347	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2348	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
2349	[AC_MSG_RESULT(l)
2350	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
2351	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
2352	[AC_MSG_RESULT(assuming target platform uses ll)
2353	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2354	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
2355AC_SUBST(ISC_PLATFORM_QUADFORMAT)
2356AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
2357
2358#
2359# Security Stuff
2360#
2361# Note it is very recommended to *not* disable chroot(),
2362# this is only because chroot() was made obsolete by Posix.
2363AC_ARG_ENABLE(chroot,
2364	[  --disable-chroot        disable chroot])
2365case "$enable_chroot" in
2366	yes|'')
2367		AC_CHECK_FUNCS(chroot)
2368		;;
2369	no)
2370		;;
2371esac
2372AC_ARG_ENABLE(linux-caps,
2373	[  --disable-linux-caps	  disable linux capabilities])
2374case "$enable_linux_caps" in
2375	yes|'')
2376		AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
2377		AC_CHECK_LIB(cap, cap_set_proc)
2378		;;
2379	no)
2380		;;
2381esac
2382AC_CHECK_HEADERS(sys/prctl.h)
2383
2384AC_CHECK_HEADERS(sys/un.h,
2385ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
2386,
2387ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2388)
2389AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2390
2391case "$host" in
2392*-solaris*)
2393	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2394		  [Define if connect does not honour the permission on the UNIX domain socket.])
2395	;;
2396*-sunos*)
2397	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2398		  [Define if connect does not honour the permission on the UNIX domain socket.])
2399	;;
2400esac
2401
2402#
2403# Time Zone Stuff
2404#
2405AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2406
2407AC_MSG_CHECKING(for optarg declaration)
2408AC_TRY_COMPILE([
2409#include <unistd.h>
2410],
2411[optarg = 0;],
2412[AC_MSG_RESULT(yes)],
2413[AC_MSG_RESULT(no)
2414GEN_NEED_OPTARG="-DNEED_OPTARG=1"
2415AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2416
2417#
2418# BSD/OS, and perhaps some others, don't define rlim_t.
2419#
2420AC_MSG_CHECKING(for type rlim_t)
2421AC_TRY_COMPILE([
2422#include <sys/types.h>
2423#include <sys/time.h>
2424#include <sys/resource.h>],
2425[rlim_t rl = 19671212; return (0);],
2426[AC_MSG_RESULT(yes)
2427 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2428[AC_MSG_RESULT(no)
2429
2430AC_MSG_CHECKING(type of rlim_cur)
2431AC_TRY_RUN([
2432#include <sys/types.h>
2433#include <sys/time.h>
2434#include <sys/resource.h>
2435main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2436[AC_MSG_RESULT(int)
2437ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2438[
2439AC_TRY_RUN([
2440#include <sys/types.h>
2441#include <sys/time.h>
2442#include <sys/resource.h>
2443main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2444[AC_MSG_RESULT(long int)
2445ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2446[
2447AC_TRY_RUN([
2448#include <sys/types.h>
2449#include <sys/time.h>
2450#include <sys/resource.h>
2451main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2452[AC_MSG_RESULT(long long int)
2453ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2454[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2455],[AC_MSG_ERROR(this cannot happen)])
2456],[AC_MSG_ERROR(this cannot happen)])
2457],[
2458AC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
2459ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
2460AC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
2461])
2462AC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2463
2464#
2465# Older HP-UX doesn't have gettune
2466#
2467case "$host" in
2468  	*-hp-hpux*)
2469		AC_CHECK_HEADERS(sys/dyntune.h)
2470		;;
2471	*)
2472		;;
2473esac
2474
2475
2476#
2477# Compaq TruCluster requires more code for handling cluster IP aliases
2478#
2479case "$host" in
2480	*-dec-osf*)
2481		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2482		AC_CHECK_FUNC(clua_getaliasaddress,
2483				AC_DEFINE(HAVE_TRUCLUSTER, 1,
2484					[Define if running under Compaq TruCluster]))
2485		;;
2486	*)
2487		;;
2488esac
2489
2490#
2491# Some hosts need msg_namelen to match the size of the socket structure.
2492# Some hosts don't set msg_namelen appropriately on return from recvmsg().
2493#
2494case $host in
2495*os2*|*hp-mpeix*)
2496	AC_DEFINE(BROKEN_RECVMSG, 1,
2497		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2498	;;
2499esac
2500
2501#
2502# Microsoft has their own way of handling shared libraries that requires
2503# additional qualifiers on extern variables.  Unix systems don't need it.
2504#
2505AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2506ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2507AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2508LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2509AC_SUBST(IRS_PLATFORM_USEDECLSPEC)
2510IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
2511
2512#
2513# Random remaining OS-specific issues involving compiler warnings.
2514# XXXDCL print messages to indicate some compensation is being done?
2515#
2516AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2517ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2518
2519case "$host" in
2520	*-aix5.[[123]].*)
2521		hack_shutup_pthreadonceinit=yes
2522		;;
2523	*-bsdi3.1*)
2524		hack_shutup_sputaux=yes
2525		;;
2526	*-bsdi4.0*)
2527		hack_shutup_sigwait=yes
2528		hack_shutup_sputaux=yes
2529		;;
2530	[*-bsdi4.[12]*])
2531		hack_shutup_stdargcast=yes
2532		;;
2533	[*-solaris2.[89]])
2534		hack_shutup_pthreadonceinit=yes
2535		;;
2536	*-solaris2.1[[0-9]])
2537		AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2538		;;
2539esac
2540
2541case "$hack_shutup_pthreadonceinit" in
2542	yes)
2543		#
2544		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2545		#
2546		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2547		;;
2548esac
2549
2550case "$hack_shutup_sigwait" in
2551	yes)
2552		#
2553		# Shut up a -Wmissing-prototypes warning for sigwait().
2554		#
2555		AC_DEFINE(SHUTUP_SIGWAIT)
2556		;;
2557esac
2558
2559case "$hack_shutup_sputaux" in
2560	yes)
2561		#
2562		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
2563		#
2564		AC_DEFINE(SHUTUP_SPUTAUX)
2565		;;
2566esac
2567
2568case "$hack_shutup_stdargcast" in
2569	yes)
2570		#
2571		# Shut up a -Wcast-qual warning from va_start().
2572		#
2573		AC_DEFINE(SHUTUP_STDARG_CAST)
2574		;;
2575esac
2576
2577AC_CHECK_HEADERS(strings.h,
2578  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2579,
2580  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2581)
2582AC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2583
2584#
2585# Check for if_nametoindex() for IPv6 scoped addresses support
2586#
2587AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2588		ac_cv_have_if_nametoindex=no)
2589case $ac_cv_have_if_nametoindex in
2590no)
2591	case "$host" in
2592	*-hp-hpux*)
2593		AC_CHECK_LIB(ipv6, if_nametoindex,
2594				ac_cv_have_if_nametoindex=yes
2595				LIBS="-lipv6 $LIBS",)
2596	;;
2597	esac
2598esac
2599case $ac_cv_have_if_nametoindex in
2600yes)
2601	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2602	;;
2603*)
2604	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2605	;;
2606esac
2607AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2608
2609AC_CHECK_FUNCS(nanosleep)
2610
2611#
2612# Machine architecture dependent features
2613#
2614AC_ARG_ENABLE(atomic,
2615	[  --enable-atomic	  enable machine specific atomic operations
2616			  [[default=autodetect]]],
2617			enable_atomic="$enableval",
2618			enable_atomic="autodetect")
2619case "$enable_atomic" in
2620	yes|''|autodetect)
2621		case "$host" in
2622		powerpc-ibm-aix*)
2623			if test "X$GCC" = "Xyes"; then
2624				AC_MSG_CHECKING([if asm("isc"); works])
2625				AC_TRY_COMPILE(,[
2626				main() { asm("ics"); exit(0); }
2627				],
2628				[AC_MSG_RESULT(yes)
2629				 use_atomic=yes],
2630				[
2631				saved_cflags="$CFLAGS"
2632				CFLAGS="$CFLAGS -Wa,-many"
2633				AC_TRY_RUN([
2634				main() { asm("ics"); exit(0); }
2635				],
2636				[AC_MSG_RESULT([yes, required -Wa,-many])
2637				 use_atomic=yes],
2638				[AC_MSG_RESULT([no, use_atomic disabled])
2639				 CFLAGS="$saved_cflags"
2640				 use_atomic=no],
2641				[AC_MSG_RESULT([cross compile, assume yes])
2642				 CFLAGS="$saved_cflags"
2643				 use_atomic=yes])
2644				]
2645				)
2646			else
2647				use_atomic=yes
2648			fi
2649			;;
2650		*)
2651			use_atomic=yes
2652			;;
2653		esac
2654		;;
2655	no)
2656		use_atomic=no
2657		arch=noatomic
2658		;;
2659esac
2660
2661ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2662if test "$use_atomic" = "yes"; then
2663	AC_MSG_CHECKING([architecture type for atomic operations])
2664	have_atomic=yes		# set default
2665	case "$host" in
2666	[i[3456]86-*])
2667		# XXX: some old x86 architectures actually do not support
2668		#      (some of) these operations.  Do we need stricter checks?
2669                AC_CHECK_SIZEOF([void *])
2670		if test $ac_cv_sizeof_void_p = 8; then
2671			arch=x86_64
2672			have_xaddq=yes
2673		else
2674			arch=x86_32
2675		fi
2676	;;
2677	x86_64-*|amd64-*)
2678                AC_CHECK_SIZEOF([void *])
2679		if test $ac_cv_sizeof_void_p = 8; then
2680			arch=x86_64
2681			have_xaddq=yes
2682		else
2683			arch=x86_32
2684		fi
2685	;;
2686	alpha*-*)
2687		arch=alpha
2688	;;
2689	powerpc-*|powerpc64-*)
2690		arch=powerpc
2691	;;
2692	mips-*|mipsel-*|mips64-*|mips64el-*)
2693		arch=mips
2694	;;
2695	ia64-*)
2696		arch=ia64
2697	;;
2698	*)
2699		have_atomic=no
2700		arch=noatomic
2701	;;
2702	esac
2703	AC_MSG_RESULT($arch)
2704fi
2705
2706if test "$have_atomic" = "yes"; then
2707	AC_MSG_CHECKING([compiler support for inline assembly code])
2708
2709	compiler=generic
2710	# Check whether the compiler supports the assembly syntax we provide.
2711	if test "X$GCC" = "Xyes"; then
2712		# GCC's ASM extension always works
2713		compiler=gcc
2714		if test $arch = "x86_64"; then
2715			# We can share the same code for gcc with x86_32
2716			arch=x86_32
2717		fi
2718		if test $arch = "powerpc"; then
2719			#
2720			# The MacOS (and maybe others) uses "r0" for register
2721			# zero. Under linux/ibm it is "0" for register 0.
2722			# Probe to see if we have a MacOS style assembler.
2723			#
2724			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2725			AC_TRY_COMPILE(, [
2726			__asm__ volatile ("li r0, 0x0\n"::);
2727			], [
2728			AC_MSG_RESULT(yes)
2729			compiler="mac"
2730			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2731			], [AC_MSG_RESULT(no)])
2732		fi
2733	else
2734		case "$host" in
2735		alpha*-dec-osf*)
2736			# Tru64 compiler has its own syntax for inline 
2737			# assembly.
2738			AC_TRY_COMPILE(, [
2739#ifndef __DECC
2740#error "unexpected compiler"
2741#endif
2742				return (0);],
2743				[compiler=osf],)
2744		;;
2745		powerpc-ibm-aix*)
2746			compiler=aix
2747		;;
2748		esac
2749	fi
2750	case "$compiler" in
2751	gcc)
2752		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2753		;;
2754	osf)
2755		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2756		;;
2757	aix)
2758		;;
2759	mac)
2760		;;
2761	*)
2762		# See if the generic __asm function works.  If not,
2763		# we need to disable the atomic operations.
2764		AC_TRY_LINK(, [
2765					__asm("nop")
2766				],
2767		[compiler="standard"
2768		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2769		[compiler="not supported (atomic operations disabled)"
2770		have_atomic=no
2771		arch=noatomic ]);
2772		;;
2773	esac
2774
2775	AC_MSG_RESULT($compiler)
2776fi
2777
2778if test "$have_atomic" = "yes"; then
2779	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2780	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2781	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2782else
2783	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2784	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2785	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2786fi
2787
2788if test "$have_xaddq" = "yes"; then
2789	ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
2790else
2791	ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
2792fi
2793
2794AC_SUBST(ISC_PLATFORM_HAVEXADD)
2795AC_SUBST(ISC_PLATFORM_HAVEXADDQ)
2796AC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2797AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2798
2799AC_SUBST(ISC_PLATFORM_USEGCCASM)
2800AC_SUBST(ISC_PLATFORM_USEOSFASM)
2801AC_SUBST(ISC_PLATFORM_USESTDASM)
2802AC_SUBST(ISC_PLATFORM_USEMACASM)
2803
2804ISC_ARCH_DIR=$arch
2805AC_SUBST(ISC_ARCH_DIR)
2806
2807#
2808# Activate "rrset-order fixed" or not?
2809#
2810AC_ARG_ENABLE(fixed-rrset,
2811	[  --enable-fixed-rrset    enable fixed rrset ordering
2812			  [[default=no]]],
2813			enable_fixed="$enableval",
2814			enable_fixed="no")
2815case "$enable_fixed" in
2816	yes)
2817		AC_DEFINE(DNS_RDATASET_FIXED, 1,
2818			  [Define to enable "rrset-order fixed" syntax.])
2819		;;
2820	no)
2821		;;
2822	*)
2823		;;
2824esac
2825
2826#
2827# Enable response policy rewriting using NS IP addresses
2828#
2829AC_ARG_ENABLE(rpz-nsip,
2830	[  --enable-rpz-nsip	  enable rpz-nsip rules [[default=no]]],
2831			enable_nsip="$enableval",
2832			enable_nsip="no")
2833case "$enable_nsip" in
2834	yes)
2835		AC_DEFINE(ENABLE_RPZ_NSIP, 1,
2836			  [Define to enable rpz-nsip rules.])
2837		;;
2838	no)
2839		;;
2840	*)
2841		;;
2842esac
2843
2844#
2845# Enable response policy rewriting using NS name
2846#
2847AC_ARG_ENABLE(rpz-nsdname,
2848	[  --enable-rpz-nsdname	  enable rpz-nsdname rules [[default=no]]],
2849			enable_nsdname="$enableval",
2850			enable_nsdname="no")
2851case "$enable_nsdname" in
2852	yes)
2853		AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
2854			  [Define to enable rpz-nsdname rules.])
2855		;;
2856	no)
2857		;;
2858	*)
2859		;;
2860esac
2861
2862#
2863# Activate "filter-aaaa-on-v4" or not?
2864#
2865AC_ARG_ENABLE(filter-aaaa,
2866	[  --enable-filter-aaaa    enable filtering of AAAA records over IPv4
2867			  [[default=no]]],
2868			enable_filter="$enableval",
2869			enable_filter="no")
2870case "$enable_filter" in
2871	yes)
2872		AC_DEFINE(ALLOW_FILTER_AAAA_ON_V4, 1,
2873			  [Define to enable the "filter-aaaa-on-v4" option.])
2874		;;
2875	no)
2876		;;
2877	*)
2878		;;
2879esac
2880
2881#
2882#  The following sets up how non-blocking i/o is established.
2883#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
2884#
2885case "$host" in
2886*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2887*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2888*-solaris2.[[01234]])
2889	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2890	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2891		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2892	;;
2893*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2894	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2895	;;
2896esac
2897#
2898# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2899# This prevents the source address being set.
2900#
2901case "$host" in
2902*-solaris2.[[012345]]|*-solaris2.5.1)
2903	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2904		  [Define if you cannot bind() before connect() for TCP sockets.])
2905	;;
2906esac
2907#
2908# The following sections deal with tools used for formatting
2909# the documentation.  They are all optional, unless you are
2910# a developer editing the documentation source.
2911#
2912
2913#
2914# Look for TeX.
2915#
2916
2917AC_PATH_PROGS(LATEX, latex, latex)
2918AC_SUBST(LATEX)
2919
2920AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2921AC_SUBST(PDFLATEX)
2922
2923#
2924# Look for w3m
2925#
2926
2927AC_PATH_PROGS(W3M, w3m, w3m)
2928AC_SUBST(W3M)
2929
2930#
2931# Look for xsltproc (libxslt)
2932#
2933
2934AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2935AC_SUBST(XSLTPROC)
2936
2937#
2938# Look for xmllint (libxml2)
2939#
2940
2941AC_PATH_PROG(XMLLINT, xmllint, xmllint)
2942AC_SUBST(XMLLINT)
2943
2944#
2945# Look for Doxygen
2946#
2947
2948AC_PATH_PROG(DOXYGEN, doxygen, doxygen)
2949AC_SUBST(DOXYGEN)
2950
2951#
2952# Subroutine for searching for an ordinary file (e.g., a stylesheet)
2953# in a number of directories:
2954#
2955#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2956#
2957# If the file FILENAME is found in one of the DIRECTORIES, the shell
2958# variable VARIABLE is defined to its absolute pathname.  Otherwise, 
2959# it is set to FILENAME, with no directory prefix (that's not terribly
2960# useful, but looks less confusing in substitutions than leaving it
2961# empty).  The variable VARIABLE will be substituted into output files.
2962# 
2963
2964AC_DEFUN(NOM_PATH_FILE, [
2965$1=""
2966AC_MSG_CHECKING(for $2)
2967for d in $3
2968do
2969	f=$d/$2
2970	if test -f $f
2971	then
2972		$1=$f
2973		AC_MSG_RESULT($f)
2974		break
2975	fi
2976done
2977if test "X[$]$1" = "X"
2978then
2979	AC_MSG_RESULT("not found");
2980	$1=$2
2981fi
2982AC_SUBST($1)
2983])
2984
2985#
2986# Look for Docbook-XSL stylesheets.  Location probably varies by system.
2987# If it's not explicitly specified, guess where it might be found, based on
2988# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2989# of at the moment).
2990#
2991AC_MSG_CHECKING(for Docbook-XSL path)
2992AC_ARG_WITH(docbook-xsl,
2993[  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
2994   docbook_path="$withval", docbook_path="auto")
2995case "$docbook_path" in
2996auto)
2997	AC_MSG_RESULT(auto)
2998	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
2999	;;
3000*)
3001	docbook_xsl_trees="$withval"
3002    	AC_MSG_RESULT($docbook_xsl_trees)
3003	;;
3004esac
3005
3006#
3007# Look for stylesheets we need.
3008#
3009
3010NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
3011NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
3012NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
3013NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
3014NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
3015NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
3016NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
3017NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
3018NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
3019
3020#
3021# Same dance for db2latex
3022#
3023# No idea where this lives except on FreeBSD.
3024#
3025
3026db2latex_xsl_trees="/usr/local/share"
3027
3028#
3029# Look for stylesheets we need.
3030#
3031
3032NOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
3033
3034#
3035# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
3036# because it's a directory, so just do the same things, inline.
3037#
3038
3039AC_MSG_CHECKING(for db2latex/xsl/figures)
3040for d in $db2latex_xsl_trees
3041do
3042	dd=$d/db2latex/xsl/figures
3043	if test -d $dd
3044	then
3045		XSLT_DB2LATEX_ADMONITIONS=$dd
3046		AC_MSG_RESULT($dd)
3047		break
3048	fi
3049done
3050if test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
3051then
3052	AC_MSG_RESULT(not found)
3053	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
3054fi
3055AC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
3056
3057#
3058# IDN support
3059#
3060AC_ARG_WITH(idn,
3061	[  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
3062	use_idn="$withval", use_idn="no")
3063case "$use_idn" in
3064yes)
3065	if test X$prefix = XNONE ; then
3066		idn_path=/usr/local
3067	else
3068		idn_path=$prefix
3069	fi
3070	;;
3071no)
3072	;;
3073*)
3074	idn_path="$use_idn"
3075	;;
3076esac
3077
3078iconvinc=
3079iconvlib=
3080AC_ARG_WITH(libiconv,
3081	[  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
3082	use_libiconv="$withval", use_libiconv="no")
3083case "$use_libiconv" in
3084yes)
3085	if test X$prefix = XNONE ; then
3086		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
3087	else
3088		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
3089	fi
3090	;;
3091no)
3092	iconvlib=
3093	;;
3094*)
3095	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
3096	;;
3097esac
3098
3099AC_ARG_WITH(iconv,
3100	[  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
3101	iconvlib="$withval")
3102case "$iconvlib" in
3103no)
3104	iconvlib=
3105	;;
3106yes)
3107	iconvlib=-liconv
3108	;;
3109esac
3110
3111AC_ARG_WITH(idnlib,
3112	[  --with-idnlib=ARG       specify libidnkit],
3113	idnlib="$withval", idnlib="no")
3114if test "$idnlib" = yes; then
3115	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
3116fi
3117
3118IDNLIBS=
3119if test "$use_idn" != no; then
3120	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
3121	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
3122	if test "$idnlib" != no; then
3123		IDNLIBS="$idnlib $iconvlib"
3124	else
3125		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
3126	fi
3127fi
3128AC_SUBST(IDNLIBS)
3129
3130#
3131# Check whether to build Automated Test Framework unit tests
3132#
3133AC_ARG_WITH(atf,
3134	[  --with-atf=ARG       Automated Test Framework support],
3135	atf="$withval", atf="no")
3136if test "$atf" = yes; then
3137	atf=`pwd`/unit/atf
3138	ATFBUILD=atf-src
3139	AC_SUBST(ATFBUILD)
3140	AC_CONFIG_COMMANDS([atf-config],
3141		[cd unit/atf-src; ${SHELL} ./configure MISSING=: --prefix $atfdir; cd ../..],
3142		[atfdir=`pwd`/unit/atf])
3143	AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
3144fi
3145
3146ATFLIBS=
3147if test "$atf" != no; then
3148	AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
3149	STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
3150	ATFBIN="$atf/bin"
3151	ATFLIBS="-L$atf/lib -latf-c"
3152	UNITTESTS=tests
3153fi
3154AC_SUBST(ATFBIN)
3155AC_SUBST(ATFLIBS)
3156AC_SUBST(UNITTESTS)
3157
3158AC_CHECK_HEADERS(locale.h)
3159AC_CHECK_FUNCS(setlocale)
3160
3161#
3162# Substitutions
3163#
3164AC_SUBST(BIND9_TOP_BUILDDIR)
3165BIND9_TOP_BUILDDIR=`pwd`
3166
3167AC_SUBST(BIND9_ISC_BUILDINCLUDE)
3168AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
3169AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
3170AC_SUBST(BIND9_DNS_BUILDINCLUDE)
3171AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
3172AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
3173if test "X$srcdir" != "X"; then
3174	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
3175	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
3176	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
3177	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
3178	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
3179	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
3180else
3181	BIND9_ISC_BUILDINCLUDE=""
3182	BIND9_ISCCC_BUILDINCLUDE=""
3183	BIND9_ISCCFG_BUILDINCLUDE=""
3184	BIND9_DNS_BUILDINCLUDE=""
3185	BIND9_LWRES_BUILDINCLUDE=""
3186	BIND9_BIND9_BUILDINCLUDE=""
3187fi
3188
3189AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
3190BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
3191
3192AC_SUBST_FILE(BIND9_MAKE_RULES)
3193BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
3194
3195. $srcdir/version
3196BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}"
3197AC_SUBST(BIND9_VERSION)
3198
3199if test -z "$ac_configure_args"; then
3200	BIND9_CONFIGARGS="defaults"
3201else
3202	for a in $ac_configure_args
3203	do
3204		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
3205	done
3206fi
3207BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
3208BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
3209AC_SUBST(BIND9_CONFIGARGS)
3210
3211AC_SUBST_FILE(LIBISC_API)
3212LIBISC_API=$srcdir/lib/isc/api
3213
3214AC_SUBST_FILE(LIBISCCC_API)
3215LIBISCCC_API=$srcdir/lib/isccc/api
3216
3217AC_SUBST_FILE(LIBISCCFG_API)
3218LIBISCCFG_API=$srcdir/lib/isccfg/api
3219
3220AC_SUBST_FILE(LIBDNS_API)
3221LIBDNS_API=$srcdir/lib/dns/api
3222
3223AC_SUBST_FILE(LIBBIND9_API)
3224LIBBIND9_API=$srcdir/lib/bind9/api
3225
3226AC_SUBST_FILE(LIBLWRES_API)
3227LIBLWRES_API=$srcdir/lib/lwres/api
3228
3229AC_SUBST_FILE(LIBIRS_API)
3230LIBIRS_API=$srcdir/lib/irs/api
3231
3232#
3233# Configure any DLZ drivers.
3234#
3235# If config.dlz.in selects one or more DLZ drivers, it will set
3236# CONTRIB_DLZ to a non-empty value, which will be our clue to
3237# build DLZ drivers in contrib.
3238#
3239# This section has to come after the libtool stuff because it needs to
3240# know how to name the driver object files.
3241#
3242
3243CONTRIB_DLZ=""
3244DLZ_DRIVER_INCLUDES=""
3245DLZ_DRIVER_LIBS=""
3246DLZ_DRIVER_SRCS=""
3247DLZ_DRIVER_OBJS=""
3248DLZ_SYSTEM_TEST=""
3249
3250# 
3251# Configure support for building a shared library object
3252#
3253# Even when libtool is available it can't always be relied upon
3254# to build an object that can be dlopen()'ed, but this is necessary
3255# for building the dlzexternal system test, so we'll try it the
3256# old-fashioned way.
3257#
3258SO="so"
3259SO_CFLAGS=""
3260SO_LD=""
3261SO_TARGETS=""
3262
3263AC_ARG_WITH(dlopen,
3264	[  --with-dlopen=ARG       Support dynamically loadable DLZ drivers],
3265	dlopen="$withval", dlopen="yes")
3266
3267if test "$dlopen" = "yes"; then
3268	AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
3269	if test "$have_dl" = "yes"; then
3270		LIBS="-ldl $LIBS"
3271	fi
3272        AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
3273fi
3274
3275if test "$dlopen" = "yes"; then
3276	case $host in
3277		*-linux*)
3278			SO_CFLAGS="-fPIC"
3279			if test "$have_dl" = "yes"
3280			then
3281				SO_LD="${CC} -shared"
3282			else
3283				SO_LD="ld -shared"
3284			fi
3285			;;
3286		*-freebsd*|*-openbsd*|*-netbsd*)
3287			SO_CFLAGS="-fpic"
3288			SO_LD="ld -Bshareable -x"
3289			;;
3290		*-solaris*)
3291			SO_CFLAGS="-KPIC"
3292			SO_LD="ld -G -z text"
3293                        ;;
3294		*-hp-hpux*)
3295			SO=sl
3296			SO_CFLAGS="+z"
3297			SO_LD="ld -b"
3298                        ;;
3299		*)
3300			SO_CFLAGS="-fPIC"
3301			;;
3302	esac
3303
3304	if test "X$GCC" = "Xyes"; then
3305		SO_CFLAGS="-fPIC"
3306                test -n "$SO_LD" || SO_LD="${CC} -shared"
3307	fi
3308
3309	# If we still don't know how to make shared objects, don't make any.
3310	if test -n "$SO_LD"; then
3311		SO_TARGETS="\${SO_TARGETS}"
3312		AC_DEFINE(ISC_DLZ_DLOPEN, 1,
3313			  [Define to allow building of objects for dlopen().])
3314	fi
3315fi
3316
3317AC_SUBST(SO)
3318AC_SUBST(SO_CFLAGS)
3319AC_SUBST(SO_LD)
3320AC_SUBST(SO_TARGETS)
3321
3322sinclude(contrib/dlz/config.dlz.in)
3323AC_MSG_CHECKING(contributed DLZ drivers)
3324
3325if test -n "$CONTRIB_DLZ"
3326then
3327	AC_MSG_RESULT(yes)
3328	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
3329	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
3330else
3331	AC_MSG_RESULT(no)
3332	DLZ_DRIVER_RULES=/dev/null
3333fi
3334
3335AC_SUBST(CONTRIB_DLZ)
3336AC_SUBST(DLZ_DRIVER_INCLUDES)
3337AC_SUBST(DLZ_DRIVER_LIBS)
3338AC_SUBST(DLZ_DRIVER_SRCS)
3339AC_SUBST(DLZ_DRIVER_OBJS)
3340AC_SUBST(DLZ_SYSTEM_TEST)
3341AC_SUBST_FILE(DLZ_DRIVER_RULES)
3342
3343if test "$cross_compiling" = "yes"; then
3344	if test -z "$BUILD_CC"; then
3345		AC_ERROR([BUILD_CC not set])
3346	fi
3347	BUILD_CFLAGS="$BUILD_CFLAGS"
3348	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
3349	BUILD_LDFLAGS="$BUILD_LDFLAGS"
3350	BUILD_LIBS="$BUILD_LIBS"
3351else
3352	BUILD_CC="$CC" 
3353	BUILD_CFLAGS="$CFLAGS" 
3354	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
3355	BUILD_LDFLAGS="$LDFLAGS"
3356	BUILD_LIBS="$LIBS"
3357fi
3358
3359NEWFLAGS=""
3360for e in $BUILD_LDFLAGS ; do
3361    case $e in
3362	-L*)
3363	    case $host_os in
3364		netbsd*)
3365		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3366		    NEWFLAGS="$NEWFLAGS $e $ee"
3367		    ;;
3368		freebsd*)
3369		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3370		    NEWFLAGS="$NEWFLAGS $e $ee"
3371		    ;;
3372		solaris*)
3373		    ee=`echo $e | sed -e 's%^-L%-R%'`
3374		    NEWFLAGS="$NEWFLAGS $e $ee"
3375		    ;;
3376		*)
3377		    NEWFLAGS="$NEWFLAGS $e"
3378		    ;;
3379		esac
3380	    ;;
3381	*)
3382	    NEWFLAGS="$NEWFLAGS $e"
3383	    ;;
3384    esac
3385done
3386BUILD_LDFLAGS="$NEWFLAGS"
3387
3388NEWFLAGS=""
3389for e in $DNS_GSSAPI_LIBS ; do
3390    case $e in
3391	-L*)
3392	    case $host_os in
3393		netbsd*)
3394		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3395		    NEWFLAGS="$NEWFLAGS $e $ee"
3396		    ;;
3397		freebsd*)
3398		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3399		    NEWFLAGS="$NEWFLAGS $e $ee"
3400		    ;;
3401		solaris*)
3402		    ee=`echo $e | sed -e 's%^-L%-R%'`
3403		    NEWFLAGS="$NEWFLAGS $e $ee"
3404		    ;;
3405		*)
3406		    NEWFLAGS="$NEWFLAGS $e"
3407		    ;;
3408		esac
3409	    ;;
3410	*)
3411	    NEWFLAGS="$NEWFLAGS $e"
3412	    ;;
3413    esac
3414done
3415DNS_GSSAPI_LIBS="$NEWFLAGS"
3416
3417NEWFLAGS=""
3418for e in $DNS_CRYPTO_LIBS ; do
3419    case $e in
3420	-L*)
3421	    case $host_os in
3422		netbsd*)
3423		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3424		    NEWFLAGS="$NEWFLAGS $e $ee"
3425		    ;;
3426		freebsd*)
3427		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3428		    NEWFLAGS="$NEWFLAGS $e $ee"
3429		    ;;
3430		solaris*)
3431		    ee=`echo $e | sed -e 's%^-L%-R%'`
3432		    NEWFLAGS="$NEWFLAGS $e $ee"
3433		    ;;
3434		*)
3435		    NEWFLAGS="$NEWFLAGS $e"
3436		    ;;
3437		esac
3438	    ;;
3439	*)
3440	    NEWFLAGS="$NEWFLAGS $e"
3441	    ;;
3442    esac
3443done
3444DNS_CRYPTO_LIBS="$NEWFLAGS"
3445
3446AC_SUBST(BUILD_CC)
3447AC_SUBST(BUILD_CFLAGS)
3448AC_SUBST(BUILD_CPPFLAGS)
3449AC_SUBST(BUILD_LDFLAGS)
3450AC_SUBST(BUILD_LIBS)
3451
3452#
3453# Commands to run at the end of config.status.
3454# Don't just put these into configure, it won't work right if somebody
3455# runs config.status directly (which autoconf allows).
3456#
3457
3458AC_CONFIG_COMMANDS(
3459	[chmod],
3460	[chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
3461
3462#
3463# Files to configure.  These are listed here because we used to
3464# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
3465# elsewhere if there's a good reason for doing so.
3466#
3467
3468AC_CONFIG_FILES([
3469  make/Makefile
3470  make/mkdep
3471	Makefile
3472	bin/Makefile
3473	bin/check/Makefile
3474	bin/confgen/Makefile
3475	bin/confgen/unix/Makefile
3476	bin/dig/Makefile
3477	bin/dnssec/Makefile
3478	bin/named/Makefile
3479	bin/named/unix/Makefile
3480	bin/nsupdate/Makefile
3481	bin/pkcs11/Makefile
3482	bin/rndc/Makefile
3483	bin/tests/Makefile
3484	bin/tests/atomic/Makefile
3485	bin/tests/db/Makefile
3486	bin/tests/dst/Makefile
3487	bin/tests/hashes/Makefile
3488	bin/tests/headerdep_test.sh
3489	bin/tests/master/Makefile
3490	bin/tests/mem/Makefile
3491	bin/tests/names/Makefile
3492	bin/tests/net/Makefile
3493	bin/tests/rbt/Makefile
3494	bin/tests/resolver/Makefile
3495	bin/tests/sockaddr/Makefile
3496	bin/tests/system/Makefile
3497	bin/tests/system/conf.sh
3498	bin/tests/system/dlz/prereq.sh
3499	bin/tests/system/dlzexternal/Makefile
3500	bin/tests/system/dlzexternal/ns1/named.conf
3501	bin/tests/system/ecdsa/prereq.sh
3502	bin/tests/system/filter-aaaa/Makefile
3503	bin/tests/system/gost/prereq.sh
3504	bin/tests/system/lwresd/Makefile
3505	bin/tests/system/rpz/Makefile
3506	bin/tests/system/tkey/Makefile
3507	bin/tests/system/tsiggss/Makefile
3508	bin/tests/tasks/Makefile
3509	bin/tests/timers/Makefile
3510	bin/tests/virtual-time/Makefile
3511	bin/tests/virtual-time/conf.sh
3512	bin/tools/Makefile
3513	contrib/check-secure-delegation.pl
3514	contrib/zone-edit.sh
3515	doc/Makefile
3516	doc/arm/Makefile
3517	doc/doxygen/Doxyfile
3518	doc/doxygen/Makefile
3519	doc/doxygen/doxygen-input-filter
3520	doc/misc/Makefile
3521	doc/xsl/Makefile
3522	doc/xsl/isc-docbook-chunk.xsl
3523	doc/xsl/isc-docbook-html.xsl
3524	doc/xsl/isc-docbook-latex.xsl
3525	doc/xsl/isc-manpage.xsl
3526	isc-config.sh
3527	lib/Makefile
3528	lib/bind9/Makefile
3529	lib/bind9/include/Makefile
3530	lib/bind9/include/bind9/Makefile
3531	lib/dns/Makefile
3532	lib/dns/include/Makefile
3533	lib/dns/include/dns/Makefile
3534	lib/dns/include/dst/Makefile
3535	lib/dns/tests/Makefile
3536	lib/export/Makefile
3537	lib/export/dns/Makefile
3538	lib/export/dns/include/Makefile
3539	lib/export/dns/include/dns/Makefile
3540	lib/export/dns/include/dst/Makefile
3541	lib/export/irs/Makefile
3542	lib/export/irs/include/Makefile
3543	lib/export/irs/include/irs/Makefile
3544	lib/export/isc/$thread_dir/Makefile
3545	lib/export/isc/$thread_dir/include/Makefile
3546	lib/export/isc/$thread_dir/include/isc/Makefile
3547	lib/export/isc/Makefile
3548	lib/export/isc/include/Makefile
3549	lib/export/isc/include/isc/Makefile
3550	lib/export/isc/nls/Makefile
3551	lib/export/isc/unix/Makefile
3552	lib/export/isc/unix/include/Makefile
3553	lib/export/isc/unix/include/isc/Makefile
3554	lib/export/isccfg/Makefile
3555	lib/export/isccfg/include/Makefile
3556	lib/export/isccfg/include/isccfg/Makefile
3557	lib/export/samples/Makefile
3558	lib/export/samples/Makefile-postinstall
3559	lib/irs/Makefile
3560	lib/irs/include/Makefile
3561	lib/irs/include/irs/Makefile
3562	lib/irs/include/irs/netdb.h
3563	lib/irs/include/irs/platform.h
3564	lib/isc/$arch/Makefile
3565	lib/isc/$arch/include/Makefile
3566	lib/isc/$arch/include/isc/Makefile
3567	lib/isc/$thread_dir/Makefile
3568	lib/isc/$thread_dir/include/Makefile
3569	lib/isc/$thread_dir/include/isc/Makefile
3570	lib/isc/Makefile
3571	lib/isc/include/Makefile
3572	lib/isc/include/isc/Makefile
3573	lib/isc/include/isc/platform.h
3574	lib/isc/tests/Makefile
3575	lib/isc/nls/Makefile
3576	lib/isc/unix/Makefile
3577	lib/isc/unix/include/Makefile
3578	lib/isc/unix/include/isc/Makefile
3579	lib/isccc/Makefile
3580	lib/isccc/include/Makefile
3581	lib/isccc/include/isccc/Makefile
3582	lib/isccfg/Makefile
3583	lib/isccfg/include/Makefile
3584	lib/isccfg/include/isccfg/Makefile
3585	lib/lwres/Makefile
3586	lib/lwres/include/Makefile
3587	lib/lwres/include/lwres/Makefile
3588	lib/lwres/include/lwres/netdb.h
3589	lib/lwres/include/lwres/platform.h
3590	lib/lwres/man/Makefile
3591	lib/lwres/unix/Makefile
3592	lib/lwres/unix/include/Makefile
3593	lib/lwres/unix/include/lwres/Makefile
3594	lib/tests/Makefile
3595	lib/tests/include/Makefile
3596	lib/tests/include/tests/Makefile
3597	unit/Makefile
3598	unit/unittest.sh
3599])
3600
3601#
3602# Do it
3603#
3604
3605AC_OUTPUT
3606
3607#
3608# Now that the Makefiles exist we can ensure that everything is rebuilt.
3609#
3610AC_ARG_WITH(make-clean,
3611[  --with-make-clean      Run "make clean" at end of configure [[yes|no]].],
3612    make_clean="$withval", make_clean="yes")
3613case "$make_clean" in
3614yes)
3615	make clean
3616	;;
3617esac
3618
3619if test "X$USE_OPENSSL" = "X"; then
3620cat << \EOF                                                             
3621BIND is being built without OpenSSL. This means it will not have DNSSEC support.
3622EOF
3623fi
3624
3625if test "X$OPENSSL_WARNING" != "X"; then
3626cat << \EOF
3627WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3628WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3629WARNING                                                                 WARNING
3630WARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
3631WARNING         one or more of the the following known security         WARNING
3632WARNING         flaws:                                                  WARNING
3633WARNING                                                                 WARNING
3634WARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
3635WARNING         CVE-2006-2940.                                          WARNING
3636WARNING                                                                 WARNING
3637WARNING         It is recommended that you upgrade to OpenSSL           WARNING
3638WARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
3639WARNING                                                                 WARNING
3640WARNING         You can disable this warning by specifying:             WARNING
3641WARNING                                                                 WARNING
3642WARNING               --disable-openssl-version-check          	        WARNING
3643WARNING                                                                 WARNING
3644WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3645WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3646EOF
3647fi
3648
3649# Tell Emacs to edit this file in shell mode.
3650# Local Variables:
3651# mode: sh
3652# End:
3653