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