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