configure.in revision 234010
1224092Sdougb# Copyright (C) 2004-2011  Internet Systems Consortium, Inc. ("ISC")
2135446Strhodes# Copyright (C) 1998-2003  Internet Software Consortium.
3135446Strhodes#
4174187Sdougb# Permission to use, copy, modify, and/or distribute this software for any
5135446Strhodes# purpose with or without fee is hereby granted, provided that the above
6135446Strhodes# copyright notice and this permission notice appear in all copies.
7135446Strhodes#
8135446Strhodes# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9135446Strhodes# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10135446Strhodes# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11135446Strhodes# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12135446Strhodes# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13135446Strhodes# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14135446Strhodes# PERFORMANCE OF THIS SOFTWARE.
15135446Strhodes
16135446Strhodesdnl
17135446StrhodesAC_DIVERT_PUSH(1)dnl
18135446Strhodesesyscmd([sed "s/^/# /" COPYRIGHT])dnl
19135446StrhodesAC_DIVERT_POP()dnl
20135446Strhodes
21234010SdougbAC_REVISION($Revision: 1.512.8.15 $)
22135446Strhodes
23135446StrhodesAC_INIT(lib/dns/name.c)
24170222SdougbAC_PREREQ(2.59)
25135446Strhodes
26135446StrhodesAC_CONFIG_HEADER(config.h)
27135446Strhodes
28135446StrhodesAC_CANONICAL_HOST
29135446Strhodes
30135446StrhodesAC_PROG_MAKE_SET
31204619Sdougb
32204619Sdougb#
33204619Sdougb# GNU libtool support
34204619Sdougb#
35204619Sdougbcase $build_os in
36204619Sdougbsunos*)
37204619Sdougb    # Just set the maximum command line length for sunos as it otherwise
38204619Sdougb    # takes a exceptionally long time to work it out. Required for libtool.
39224092Sdougb     
40204619Sdougb    lt_cv_sys_max_cmd_len=4096;
41204619Sdougb    ;;
42204619Sdougbesac
43204619Sdougb
44193149SdougbAC_PROG_LIBTOOL
45135446StrhodesAC_PROG_INSTALL
46170222SdougbAC_PROG_LN_S
47135446Strhodes
48135446StrhodesAC_SUBST(STD_CINCLUDES)
49135446StrhodesAC_SUBST(STD_CDEFINES)
50135446StrhodesAC_SUBST(STD_CWARNINGS)
51135446StrhodesAC_SUBST(CCOPT)
52135446Strhodes
53193149Sdougb# Warn if the user specified libbind, which is now deprecated
54193149SdougbAC_ARG_ENABLE(libbind, [  --enable-libbind	  deprecated])
55193149Sdougb
56193149Sdougbcase "$enable_libbind" in
57193149Sdougb	yes)
58193149Sdougb		AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
59193149SdougbIt is available from http://www.isc.org as a separate download.])
60193149Sdougb		;;
61193149Sdougb	no|'')
62193149Sdougb		;;
63193149Sdougbesac
64193149Sdougb
65234010SdougbAC_ARG_ENABLE(developer, [  --enable-developer     enable developer build settings])
66234010Sdougbcase "$enable_developer" in
67234010Sdougbyes)
68234010Sdougb	test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
69234010Sdougb	test "${with_atf+set}" = set || with_atf=yes
70234010Sdougb	test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
71234010Sdougb	test "${enable_rpz_nsip+set}" = set || enable_rpz_nsip=yes
72234010Sdougb	test "${enable_rpz_nsdname+set}" = set || enable_rpz_nsdname=yes
73234010Sdougb	test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
74234010Sdougb	case "$host" in
75234010Sdougb	*-darwin*)
76234010Sdougb		test "${enable_exportlib+set}" = set || enable_exportlib=yes
77234010Sdougb		;;
78234010Sdougb	*-linux*)
79234010Sdougb		test "${enable_exportlib+set}" = set || enable_exportlib=yes
80234010Sdougb		;;
81234010Sdougb	esac
82234010Sdougb	;;
83234010Sdougbesac
84170222Sdougb#
85170222Sdougb# Make very sure that these are the first files processed by
86170222Sdougb# config.status, since we use the processed output as the input for
87193149Sdougb# AC_SUBST_FILE() substitutions in other files.
88170222Sdougb#
89170222SdougbAC_CONFIG_FILES([make/rules make/includes])
90170222Sdougb
91135446StrhodesAC_PATH_PROG(AR, ar)
92135446StrhodesARFLAGS="cruv"
93135446StrhodesAC_SUBST(AR)
94135446StrhodesAC_SUBST(ARFLAGS)
95135446Strhodes
96135446Strhodes# The POSIX ln(1) program.  Non-POSIX systems may substitute
97135446Strhodes# "copy" or something.
98135446StrhodesLN=ln
99135446StrhodesAC_SUBST(LN)
100135446Strhodes
101135446Strhodescase "$AR" in
102135446Strhodes	"")
103135446Strhodes		AC_MSG_ERROR([
104135446Strhodesar program not found.  Please fix your PATH to include the directory in
105135446Strhodeswhich ar resides, or set AR in the environment with the full path to ar.
106135446Strhodes])
107135446Strhodes
108135446Strhodes		;;
109135446Strhodesesac
110135446Strhodes
111135446Strhodes#
112135446Strhodes# Etags.
113135446Strhodes#
114135446StrhodesAC_PATH_PROGS(ETAGS, etags emacs-etags)
115135446Strhodes
116135446Strhodes#
117135446Strhodes# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
118135446Strhodes# GNU emacs etags, and it requires the -L flag.
119135446Strhodes#
120135446Strhodesif test "X$ETAGS" != "X"; then
121135446Strhodes	AC_MSG_CHECKING(for Exuberant Ctags etags)
122135446Strhodes	if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
123135446Strhodes		AC_MSG_RESULT(yes)
124135446Strhodes		ETAGS="$ETAGS -L"
125135446Strhodes	else
126135446Strhodes		AC_MSG_RESULT(no)
127135446Strhodes	fi
128135446Strhodesfi
129135446StrhodesAC_SUBST(ETAGS)
130135446Strhodes
131135446Strhodes#
132135446Strhodes# Perl is optional; it is used only by some of the system test scripts.
133224092Sdougb# Note: the backtrace feature (see below) uses perl to build the symbol table,
134224092Sdougb# but it still compiles without perl, in which case an empty table will be used.
135135446Strhodes#
136135446StrhodesAC_PATH_PROGS(PERL, perl5 perl)
137135446StrhodesAC_SUBST(PERL)
138135446Strhodes
139135446Strhodes#
140135446Strhodes# Special processing of paths depending on whether --prefix,
141135446Strhodes# --sysconfdir or --localstatedir arguments were given.  What's
142135446Strhodes# desired is some compatibility with the way previous versions
143135446Strhodes# of BIND built; they defaulted to /usr/local for most parts of
144135446Strhodes# the installation, but named.boot/named.conf was in /etc
145135446Strhodes# and named.pid was in /var/run.
146135446Strhodes#
147135446Strhodes# So ... if none of --prefix, --sysconfdir or --localstatedir are
148135446Strhodes# specified, set things up that way.  If --prefix is given, use
149135446Strhodes# it for sysconfdir and localstatedir the way configure normally
150135446Strhodes# would.  To change the prefix for everything but leave named.conf
151135446Strhodes# in /etc or named.pid in /var/run, then do this the usual configure way:
152135446Strhodes# ./configure --prefix=/somewhere --sysconfdir=/etc
153135446Strhodes# ./configure --prefix=/somewhere --localstatedir=/var
154135446Strhodes#
155135446Strhodes# To put named.conf and named.pid in /usr/local with everything else,
156135446Strhodes# set the prefix explicitly to /usr/local even though that's the default:
157135446Strhodes# ./configure --prefix=/usr/local
158135446Strhodes#
159135446Strhodescase "$prefix" in
160193149Sdougb	NONE)
161193149Sdougb		case "$sysconfdir" in
162193149Sdougb			'${prefix}/etc')
163193149Sdougb				sysconfdir=/etc
164193149Sdougb				;;
165193149Sdougb		esac
166193149Sdougb		case "$localstatedir" in
167193149Sdougb			'${prefix}/var')
168193149Sdougb				localstatedir=/var
169193149Sdougb				;;
170193149Sdougb		esac
171193149Sdougb		;;
172135446Strhodesesac
173135446Strhodes
174135446Strhodes#
175135446Strhodes# Make sure INSTALL uses an absolute path, else it will be wrong in all
176135446Strhodes# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
177135446Strhodes# configure based on the location of the file where it is substituted.
178135446Strhodes# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
179135446Strhodes# subdirectory of install-sh, This relative path will be wrong for all
180135446Strhodes# directories more than one level down from install-sh.
181135446Strhodes#
182135446Strhodescase "$INSTALL" in
183135446Strhodes	/*)
184193149Sdougb		;;
185193149Sdougb	*)
186193149Sdougb		#
187193149Sdougb		# Not all systems have dirname.
188193149Sdougb		#
189193149Sdougb		changequote({, })
190193149Sdougb		ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
191193149Sdougb		changequote([, ])
192135446Strhodes
193193149Sdougb		ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
194193149Sdougb		test "$ac_dir" = "$ac_prog" && ac_dir=.
195193149Sdougb		test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
196193149Sdougb		INSTALL="$ac_dir/$ac_prog"
197193149Sdougb		;;
198135446Strhodesesac
199135446Strhodes
200135446Strhodes#
201135446Strhodes# On these hosts, we really want to use cc, not gcc, even if it is
202135446Strhodes# found.  The gcc that these systems have will not correctly handle
203135446Strhodes# pthreads.
204135446Strhodes#
205135446Strhodes# However, if the user sets $CC to be something, let that override
206135446Strhodes# our change.
207135446Strhodes#
208135446Strhodesif test "X$CC" = "X" ; then
209135446Strhodes	case "$host" in
210135446Strhodes		*-dec-osf*)
211135446Strhodes			CC="cc"
212135446Strhodes			;;
213135446Strhodes		*-solaris*)
214193149Sdougb			# Use Sun's cc if it is available, but watch
215193149Sdougb			# out for /usr/ucb/cc; it will never be the right
216193149Sdougb			# compiler to use.
217193149Sdougb			#
218193149Sdougb			# If setting CC here fails, the AC_PROG_CC done
219193149Sdougb			# below might still find gcc.
220135446Strhodes			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
221135446Strhodes			for ac_dir in $PATH; do
222135446Strhodes				test -z "$ac_dir" && ac_dir=.
223135446Strhodes				case "$ac_dir" in
224135446Strhodes				/usr/ucb)
225135446Strhodes					# exclude
226135446Strhodes					;;
227135446Strhodes				*)
228135446Strhodes					if test -f "$ac_dir/cc"; then
229135446Strhodes						CC="$ac_dir/cc"
230135446Strhodes						break
231135446Strhodes					fi
232135446Strhodes					;;
233135446Strhodes				esac
234135446Strhodes			done
235135446Strhodes			IFS="$ac_save_ifs"
236135446Strhodes			;;
237135446Strhodes		*-hp-hpux*)
238135446Strhodes			CC="cc"
239135446Strhodes			;;
240135446Strhodes		mips-sgi-irix*)
241135446Strhodes			CC="cc"
242135446Strhodes			;;
243135446Strhodes	esac
244135446Strhodesfi
245135446Strhodes
246135446StrhodesAC_PROG_CC
247135446Strhodes
248135446Strhodes#
249135446Strhodes# gcc's optimiser is broken at -02 for ultrasparc
250135446Strhodes#
251135446Strhodesif test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
252135446Strhodes	case "$host" in
253135446Strhodes	sparc-*)
254135446Strhodes		CCFLAGS="-g -O1"
255135446Strhodes		;;
256135446Strhodes	esac
257135446Strhodesfi
258135446Strhodes
259135446Strhodes#
260135446Strhodes# OS dependent CC flags
261135446Strhodes#
262135446Strhodescase "$host" in
263193149Sdougb	# OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
264135446Strhodes	# -D_XOPEN_SOURCE_EXTENDED.
265135446Strhodes	*-dec-osf*)
266135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
267135446Strhodes		CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
268135446Strhodes		;;
269135446Strhodes	#HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
270135446Strhodes	*-hp-hpux*)
271135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
272135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
273135446Strhodes		LIBS="-lxnet $LIBS"
274135446Strhodes		;;
275135446Strhodes	# Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
276135446Strhodes	*-solaris*)
277135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
278135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
279135446Strhodes		;;
280186462Sdougb	# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
281186462Sdougb	# parts of the IPv6 Advanced Socket API as a result.  This is stupid
282186462Sdougb	# as it breaks how the two halves (Basic and Advanced) of the IPv6
283186462Sdougb	# Socket API were designed to be used but we have to live with it.
284186462Sdougb	# Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
285234010Sdougb	*-linux* | *-kfreebsd*-gnu)
286186462Sdougb		STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
287186462Sdougb		CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
288186462Sdougb		;;
289225361Sdougb	#
290225361Sdougb	# Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
291225361Sdougb	# Setting this is sufficient to select the correct behavior for BIND 9.
292225361Sdougb	#
293225361Sdougb	*-darwin*)
294225361Sdougb	  STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
295225361Sdougb	  CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
296225361Sdougb	  ;;
297135446Strhodesesac
298135446Strhodes
299135446StrhodesAC_HEADER_STDC
300135446Strhodes
301224092SdougbAC_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,,,
302135446Strhodes[$ac_includes_default
303135446Strhodes#ifdef HAVE_SYS_PARAM_H
304135446Strhodes# include <sys/param.h>
305135446Strhodes#endif
306135446Strhodes])
307135446Strhodes
308135446StrhodesAC_C_CONST
309135446StrhodesAC_C_INLINE
310186462SdougbAC_C_VOLATILE
311135446StrhodesAC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
312218384SdougbAC_C_FLEXIBLE_ARRAY_MEMBER
313135446Strhodes
314135446Strhodes#
315224092Sdougb# Older versions of HP/UX don't define seteuid() and setegid()
316224092Sdougb#
317224092SdougbAC_CHECK_FUNCS(seteuid setresuid)
318224092SdougbAC_CHECK_FUNCS(setegid setresgid)
319224092Sdougb
320224092Sdougb#
321135446Strhodes# UnixWare 7.1.1 with the feature supplement to the UDK compiler
322135446Strhodes# is reported to not support "static inline" (RT #1212).
323135446Strhodes#
324135446StrhodesAC_MSG_CHECKING(for static inline breakage)
325135446StrhodesAC_TRY_COMPILE(, [
326135446Strhodes		foo1();
327135446Strhodes	}
328135446Strhodes
329135446Strhodes	static inline int foo1() {
330135446Strhodes		return 0;
331135446Strhodes	}
332135446Strhodes
333135446Strhodes	static inline int foo2() {
334135446Strhodes		return foo1();
335135446Strhodes	],
336135446Strhodes	[AC_MSG_RESULT(no)],
337135446Strhodes	[AC_MSG_RESULT(yes)
338224092Sdougb	 AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
339135446Strhodes
340135446StrhodesAC_TYPE_SIZE_T
341135446StrhodesAC_CHECK_TYPE(ssize_t, int)
342153816SdougbAC_CHECK_TYPE(uintptr_t,unsigned long)
343143731SdougbAC_CHECK_TYPE(socklen_t,
344143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
345143731Sdougb[
346143731SdougbAC_TRY_COMPILE(
347143731Sdougb[
348143731Sdougb#include <sys/types.h>
349143731Sdougb#include <sys/socket.h>
350143731Sdougbint getsockname(int, struct sockaddr *, size_t *);
351143731Sdougb],[],
352143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
353143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
354143731Sdougb],
355143731Sdougb[
356143731Sdougb#include <sys/types.h>
357143731Sdougb#include <sys/socket.h>
358143731Sdougb])
359143731SdougbAC_SUBST(ISC_SOCKADDR_LEN_T)
360135446StrhodesAC_HEADER_TIME
361135446StrhodesAC_MSG_CHECKING(for long long)
362135446StrhodesAC_TRY_COMPILE([],[long long i = 0; return (0);],
363135446Strhodes	[AC_MSG_RESULT(yes)
364135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
365135446Strhodes	[AC_MSG_RESULT(no)
366135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
367135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELONGLONG)
368135446Strhodes
369135446Strhodes#
370224092Sdougb# check for GCC noreturn attribute
371224092Sdougb#
372224092SdougbAC_MSG_CHECKING(for GCC noreturn attribute)
373224092SdougbAC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
374224092Sdougb	[AC_MSG_RESULT(yes)
375224092Sdougb		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
376224092Sdougb		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
377224092Sdougb	[AC_MSG_RESULT(no)
378224092Sdougb		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
379224092Sdougb		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
380224092SdougbAC_SUBST(ISC_PLATFORM_NORETURN_PRE)
381224092SdougbAC_SUBST(ISC_PLATFORM_NORETURN_POST)
382224092Sdougb
383224092Sdougb#
384135446Strhodes# check if we have lifconf
385135446Strhodes#
386135446StrhodesAC_MSG_CHECKING(for struct lifconf)
387135446StrhodesAC_TRY_COMPILE([
388135446Strhodes#include <sys/types.h>
389135446Strhodes#include <sys/socket.h>
390135446Strhodes#include <net/if.h>
391135446Strhodes],
392135446Strhodes[
393135446Strhodesstruct lifconf lifconf;
394135446Strhodeslifconf.lifc_len = 0;
395135446Strhodes]
396135446Strhodes,
397135446Strhodes	[AC_MSG_RESULT(yes)
398135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
399135446Strhodes	[AC_MSG_RESULT(no)
400135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
401135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELIFCONF)
402135446Strhodes
403186462Sdougb#
404186462Sdougb# check if we have kqueue
405186462Sdougb#
406186462SdougbAC_ARG_ENABLE(kqueue,
407186462Sdougb	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
408186462Sdougb	      want_kqueue="$enableval",  want_kqueue="yes")
409186462Sdougbcase $want_kqueue in
410186462Sdougbyes)
411186462Sdougb	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
412186462Sdougb	case $ac_cv_have_kqueue in
413186462Sdougb	yes)
414186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
415186462Sdougb		;;
416186462Sdougb	*)
417186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
418186462Sdougb		;;
419186462Sdougb	esac
420186462Sdougb	;;
421186462Sdougb*)
422186462Sdougb	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
423186462Sdougb	;;
424186462Sdougbesac
425186462SdougbAC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
426135446Strhodes
427135446Strhodes#
428186462Sdougb# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
429186462Sdougb# so we need to try running the code, not just test its existence.
430186462Sdougb#
431186462SdougbAC_ARG_ENABLE(epoll,
432193149Sdougb[  --enable-epoll          use Linux epoll when available [[default=auto]]],
433193149Sdougb	      want_epoll="$enableval",  want_epoll="auto")
434186462Sdougbcase $want_epoll in
435193149Sdougbauto)
436186462Sdougb	AC_MSG_CHECKING(epoll support)
437186462Sdougb	AC_TRY_RUN([
438186462Sdougb#include <sys/epoll.h>
439186462Sdougbint main() {
440186462Sdougb	if (epoll_create(1) < 0)
441186462Sdougb		return (1);
442186462Sdougb	return (0);
443186462Sdougb}
444186462Sdougb],
445186462Sdougb	[AC_MSG_RESULT(yes)
446186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
447186462Sdougb	[AC_MSG_RESULT(no)
448186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
449186462Sdougb	;;
450193149Sdougbyes)
451193149Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
452193149Sdougb	;;
453186462Sdougb*)
454186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
455186462Sdougb	;;
456186462Sdougbesac
457186462SdougbAC_SUBST(ISC_PLATFORM_HAVEEPOLL)
458186462Sdougb
459186462Sdougb#
460186462Sdougb# check if we support /dev/poll
461186462Sdougb#
462186462SdougbAC_ARG_ENABLE(devpoll,
463186462Sdougb	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
464186462Sdougb	      want_devpoll="$enableval",  want_devpoll="yes")
465186462Sdougbcase $want_devpoll in
466186462Sdougbyes)
467218384Sdougb	AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
468186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
469186462Sdougb	,
470186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
471186462Sdougb	)
472186462Sdougb	;;
473186462Sdougb*)
474186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
475186462Sdougb	;;
476186462Sdougbesac
477186462SdougbAC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
478186462Sdougb
479186462Sdougb#
480135446Strhodes# check if we need to #include sys/select.h explicitly
481135446Strhodes#
482135446Strhodescase $ac_cv_header_unistd_h in
483135446Strhodesyes)
484135446StrhodesAC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
485135446StrhodesAC_TRY_COMPILE([
486135446Strhodes#include <sys/types.h> /* Ultrix */
487135446Strhodes#include <unistd.h>],
488135446Strhodes[fd_set read_set; return (0);],
489135446Strhodes	[AC_MSG_RESULT(yes)
490135446Strhodes	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
491135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
492135446Strhodes	[AC_MSG_RESULT(no)
493135446Strhodes	case $ac_cv_header_sys_select_h in
494135446Strhodes	yes)
495193149Sdougb	 ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
496135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
497135446Strhodes		;;
498135446Strhodes	no)
499135446Strhodes		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
500135446Strhodes		;;
501135446Strhodes	esac
502135446Strhodes	])
503135446Strhodes	;;
504135446Strhodesno)
505135446Strhodes	case $ac_cv_header_sys_select_h in
506135446Strhodes	yes)
507193149Sdougb	     ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
508135446Strhodes	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
509135446Strhodes		;;
510135446Strhodes	no)
511135446Strhodes		AC_MSG_ERROR([need either unistd.h or sys/select.h])
512135446Strhodes		;;
513135446Strhodes	esac
514135446Strhodes	;;
515135446Strhodesesac
516135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
517135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
518135446Strhodes
519135446Strhodes#
520135446Strhodes# Find the machine's endian flavor.
521135446Strhodes#
522135446StrhodesAC_C_BIGENDIAN
523135446Strhodes
524135446Strhodes#
525135446Strhodes# was --with-openssl specified?
526135446Strhodes#
527163976SdougbOPENSSL_WARNING=
528135446StrhodesAC_MSG_CHECKING(for OpenSSL library)
529135446StrhodesAC_ARG_WITH(openssl,
530204619Sdougb[  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
531193149Sdougb			  (Required for DNSSEC)],
532135446Strhodes    use_openssl="$withval", use_openssl="auto")
533135446Strhodes
534165071Sdougbopenssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
535143731Sdougbif test "$use_openssl" = "auto"
536143731Sdougbthen
537143731Sdougb	for d in $openssldirs
538143731Sdougb	do
539143731Sdougb		if test -f $d/include/openssl/opensslv.h
540143731Sdougb		then
541143731Sdougb			use_openssl=$d
542143731Sdougb			break
543143731Sdougb		fi
544143731Sdougb	done
545143731Sdougbfi
546224092SdougbOPENSSL_GOST=""
547135446Strhodescase "$use_openssl" in
548135446Strhodes	no)
549135446Strhodes		AC_MSG_RESULT(no)
550135446Strhodes		DST_OPENSSL_INC=""
551135446Strhodes		USE_OPENSSL=""
552218384Sdougb		OPENSSLLINKOBJS=""
553218384Sdougb		OPENSSLLINKSRCS=""
554135446Strhodes		;;
555143731Sdougb	auto)
556143731Sdougb		DST_OPENSSL_INC=""
557143731Sdougb		USE_OPENSSL=""
558218384Sdougb		OPENSSLLINKOBJS=""
559218384Sdougb		OPENSSLLINKSRCS=""
560204619Sdougb		AC_MSG_ERROR(
561204619Sdougb[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
562204619SdougbIf you don't want OpenSSL, use --without-openssl])
563143731Sdougb		;;
564135446Strhodes	*)
565143731Sdougb		if test "$use_openssl" = "yes"
566135446Strhodes		then
567193149Sdougb			# User did not specify a path - guess it
568135446Strhodes			for d in $openssldirs
569135446Strhodes			do
570135446Strhodes				if test -f $d/include/openssl/opensslv.h
571135446Strhodes				then
572193149Sdougb					use_openssl=$d
573135446Strhodes					break
574135446Strhodes				fi
575135446Strhodes			done
576135446Strhodes			if test "$use_openssl" = "yes"
577135446Strhodes			then
578193149Sdougb				AC_MSG_RESULT(not found)
579135446Strhodes				AC_MSG_ERROR(
580135446Strhodes[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
581135446Strhodes			fi
582193149Sdougb		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
583193149Sdougb		then
584193149Sdougb			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
585135446Strhodes		fi
586135446Strhodes		USE_OPENSSL='-DOPENSSL'
587135446Strhodes		if test "$use_openssl" = "/usr"
588135446Strhodes		then
589135446Strhodes			DST_OPENSSL_INC=""
590135446Strhodes			DNS_OPENSSL_LIBS="-lcrypto"
591135446Strhodes		else
592135446Strhodes			DST_OPENSSL_INC="-I$use_openssl/include"
593135446Strhodes			case $host in
594135446Strhodes			*-solaris*)
595135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
596135446Strhodes				;;
597165071Sdougb			*-hp-hpux*)
598165071Sdougb				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
599165071Sdougb				;;
600174187Sdougb			*-apple-darwin*)
601174187Sdougb				#
602174187Sdougb				# Apple's ld seaches for serially for dynamic
603174187Sdougb				# then static libraries.  This means you can't
604174187Sdougb				# use -L to override dynamic system libraries
605174187Sdougb				# with static ones when linking.  Instead
606174187Sdougb				# we specify a absolute path.
607174187Sdougb				#
608174187Sdougb				if test -f "$use_openssl/lib/libcrypto.dylib"
609174187Sdougb				then
610174187Sdougb					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
611174187Sdougb				else
612174187Sdougb					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
613174187Sdougb				fi
614174187Sdougb				;;
615135446Strhodes			*)
616135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
617135446Strhodes				;;
618135446Strhodes			esac
619135446Strhodes		fi
620193149Sdougb		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
621135446Strhodes
622135446Strhodes		saved_cflags="$CFLAGS"
623135446Strhodes		saved_libs="$LIBS"
624135446Strhodes		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
625135446Strhodes		LIBS="$LIBS $DNS_OPENSSL_LIBS"
626135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL works)
627135446Strhodes		AC_TRY_RUN([
628135446Strhodes#include <openssl/err.h>
629135446Strhodesint main() {
630135446Strhodes	ERR_clear_error();
631135446Strhodes	return (0);
632135446Strhodes}
633135446Strhodes],
634193149Sdougb		[AC_MSG_RESULT(yes)],
635135446Strhodes		[AC_MSG_RESULT(no)
636135446Strhodes		 AC_MSG_ERROR(Could not run test program using OpenSSL from
637135446Strhodes$use_openssl/lib and $use_openssl/include.
638135446StrhodesPlease check the argument to --with-openssl and your
639135446Strhodesshared library configuration (e.g., LD_LIBRARY_PATH).)],
640135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
641135446Strhodes
642135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
643135446Strhodes		AC_TRY_LINK([
644135446Strhodes#include <openssl/err.h>],
645135446Strhodes[ DSO_METHOD_dlfcn(); ],
646135446Strhodes		[AC_MSG_RESULT(no)],
647135446Strhodes		[LIBS="$LIBS -ldl"
648135446Strhodes		AC_TRY_LINK([
649135446Strhodes#include <openssl/err.h>
650135446Strhodes],[ DSO_METHOD_dlfcn(); ],
651135446Strhodes		[AC_MSG_RESULT(yes)
652135446Strhodes		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
653135446Strhodes		],
654135446Strhodes		 [AC_MSG_RESULT(unknown)
655135446Strhodes		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
656135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
657135446Strhodes		],
658135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)]
659135446Strhodes		)
660135446Strhodes		 
661163976SdougbAC_ARG_ENABLE(openssl-version-check,
662163976Sdougb[AC_HELP_STRING([--enable-openssl-version-check],
663193149Sdougb	[Check OpenSSL Version @<:@default=yes@:>@])])
664163976Sdougbcase "$enable_openssl_version_check" in
665163976Sdougbyes|'')
666135446Strhodes		AC_MSG_CHECKING(OpenSSL library version)
667135446Strhodes		AC_TRY_RUN([
668135446Strhodes#include <stdio.h>
669135446Strhodes#include <openssl/opensslv.h>
670135446Strhodesint main() {
671193149Sdougb	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
672165071Sdougb	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
673165071Sdougb	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
674193149Sdougb		return (0);
675135446Strhodes	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
676135446Strhodes		OPENSSL_VERSION_NUMBER);
677163976Sdougb	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
678163976Sdougb	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
679193149Sdougb	return (1);
680135446Strhodes}
681163976Sdougb		],
682193149Sdougb		[AC_MSG_RESULT(ok)],
683135446Strhodes		[AC_MSG_RESULT(not compatible)
684193149Sdougb		 OPENSSL_WARNING=yes
685163976Sdougb		],
686135446Strhodes		[AC_MSG_RESULT(assuming target platform has compatible version)])
687163976Sdougb;;
688163976Sdougbno)
689163976Sdougb	AC_MSG_RESULT(Skipped OpenSSL version check)
690163976Sdougb;;
691163976Sdougbesac
692163976Sdougb
693135446Strhodes		AC_MSG_CHECKING(for OpenSSL DSA support)
694135446Strhodes		if test -f $use_openssl/include/openssl/dsa.h
695135446Strhodes		then
696135446Strhodes			AC_DEFINE(HAVE_OPENSSL_DSA)
697135446Strhodes			AC_MSG_RESULT(yes)
698135446Strhodes		else
699135446Strhodes			AC_MSG_RESULT(no)
700135446Strhodes		fi
701204619Sdougb		AC_CHECK_FUNCS(EVP_sha256 EVP_sha512)
702224092Sdougb
703224092Sdougb		AC_MSG_CHECKING(for OpenSSL GOST support)
704224092Sdougb		have_gost=""
705224092Sdougb		AC_TRY_RUN([
706224092Sdougb#include <openssl/conf.h>
707224092Sdougb#include <openssl/engine.h>
708224092Sdougbint main() {
709224092Sdougb#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
710224092Sdougb	ENGINE *e;
711225361Sdougb	EC_KEY *ek;
712224092Sdougb
713225361Sdougb	ek = NULL;
714224092Sdougb	OPENSSL_config(NULL);
715224092Sdougb
716224092Sdougb	e = ENGINE_by_id("gost");
717224092Sdougb	if (e == NULL)
718224092Sdougb		return (1);
719224092Sdougb	if (ENGINE_init(e) <= 0)
720224092Sdougb		return (1);
721224092Sdougb	return (0);
722224092Sdougb#else
723224092Sdougb	return (1);
724224092Sdougb#endif
725224092Sdougb}
726224092Sdougb],
727224092Sdougb		[AC_MSG_RESULT(yes)
728224092Sdougb		have_gost="yes"],
729224092Sdougb		[AC_MSG_RESULT(no)
730225361Sdougb		have_gost="no"],
731225361Sdougb		[AC_MSG_RESULT(using --with-gost)])
732225361Sdougb		AC_ARG_WITH(gost, , with_gost="$withval", with_gost="auto")
733225361Sdougb		case "$with_gost" in
734225361Sdougb		yes)
735225361Sdougb		    case "$have_gost" in
736225361Sdougb		    no)  AC_MSG_ERROR([gost not supported]) ;;
737225361Sdougb		    *)  have_gost=yes ;;
738225361Sdougb		    esac
739225361Sdougb		    ;;
740225361Sdougb		no)
741225361Sdougb		    have_gost=no ;;
742225361Sdougb		*)
743225361Sdougb		    case "$have_gost" in
744225361Sdougb		    yes|no) ;;
745225361Sdougb		    *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
746225361Sdougb		    esac
747225361Sdougb		    ;;
748225361Sdougb		esac
749224092Sdougb		case $have_gost in
750224092Sdougb		yes)
751224092Sdougb			OPENSSL_GOST="yes"
752224092Sdougb			AC_DEFINE(HAVE_OPENSSL_GOST, 1,
753224092Sdougb				  [Define if your OpenSSL version supports GOST.])
754224092Sdougb			;;
755224092Sdougb		*)
756224092Sdougb			;;
757224092Sdougb		esac
758135446Strhodes		CFLAGS="$saved_cflags"
759135446Strhodes		LIBS="$saved_libs"
760218384Sdougb		OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
761218384Sdougb		OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
762204619Sdougb
763135446Strhodes		;;
764135446Strhodesesac
765135446Strhodes
766135446Strhodes#
767135446Strhodes# This would include the system openssl path (and linker options to use
768135446Strhodes# it as needed) if it is found.
769135446Strhodes#
770135446Strhodes
771135446StrhodesAC_SUBST(USE_OPENSSL)
772135446StrhodesAC_SUBST(DST_OPENSSL_INC)
773218384SdougbAC_SUBST(OPENSSLLINKOBJS)
774218384SdougbAC_SUBST(OPENSSLLINKSRCS)
775224092SdougbAC_SUBST(OPENSSL_GOST)
776135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
777135446Strhodes
778135446Strhodes#
779224092Sdougb# Use OpenSSL for hash functions
780224092Sdougb#
781224092Sdougb
782224092SdougbAC_ARG_ENABLE(openssl-hash,
783224092Sdougb	[  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
784224092Sdougb	want_openssl_hash="$enableval", want_openssl_hash="no")
785224092Sdougbcase $want_openssl_hash in
786224092Sdougb	yes)
787224092Sdougb		if test "$USE_OPENSSL" = ""
788224092Sdougb		then
789224092Sdougb			AC_MSG_ERROR([No OpenSSL for hash functions])
790224092Sdougb		fi
791224092Sdougb		ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
792224092Sdougb		ISC_OPENSSL_INC="$DST_OPENSSL_INC"
793224092Sdougb		;;
794224092Sdougb	no)
795224092Sdougb		ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
796224092Sdougb		ISC_OPENSSL_INC=""
797224092Sdougb		;;
798224092Sdougbesac
799224092SdougbAC_SUBST(ISC_PLATFORM_OPENSSLHASH)
800224092SdougbAC_SUBST(ISC_OPENSSL_INC)
801224092Sdougb
802224092Sdougb#
803193149Sdougb# PKCS11 (aka crypto hardware) support
804135446Strhodes#
805193149Sdougb# This works only with the right OpenSSL with PKCS11 engine!
806135446Strhodes#
807135446Strhodes
808193149SdougbAC_MSG_CHECKING(for PKCS11 support)
809193149SdougbAC_ARG_WITH(pkcs11,
810224092Sdougb[  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
811224092Sdougb                          (PATH is for the PKCS11 provider)],
812224092Sdougb   use_pkcs11="$withval", use_pkcs11="no")
813135446Strhodes
814193149Sdougbcase "$use_pkcs11" in
815224092Sdougb	no|'')
816193149Sdougb		AC_MSG_RESULT(disabled)
817224092Sdougb		USE_PKCS11=''
818224092Sdougb		PKCS11_TOOLS=''
819193149Sdougb		;;
820224092Sdougb	yes|*)
821193149Sdougb		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
822193149Sdougb		USE_PKCS11='-DUSE_PKCS11'
823224092Sdougb		PKCS11_TOOLS=pkcs11
824193149Sdougb		;;
825193149Sdougbesac
826193149SdougbAC_SUBST(USE_PKCS11)
827224092SdougbAC_SUBST(PKCS11_TOOLS)
828193149Sdougb
829224092SdougbAC_MSG_CHECKING(for PKCS11 tools)
830224092Sdougbcase "$use_pkcs11" in
831224092Sdougb	no|yes|'')
832224092Sdougb		AC_MSG_RESULT(disabled)
833224092Sdougb		PKCS11_PROVIDER="undefined"
834224092Sdougb		;;
835224092Sdougb       *)
836224092Sdougb		AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
837224092Sdougb		PKCS11_PROVIDER="$use_pkcs11"
838224092Sdougb		;;
839224092Sdougbesac
840224092SdougbAC_SUBST(PKCS11_PROVIDER)
841224092Sdougb
842193149SdougbAC_MSG_CHECKING(for GSSAPI library)
843193149SdougbAC_ARG_WITH(gssapi,
844225361Sdougb[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
845225361Sdougb    use_gssapi="$withval", use_gssapi="yes")
846193149Sdougb
847225361Sdougb# gssapi is just the framework, we really require kerberos v5, so
848225361Sdougb# look for those headers (the gssapi headers must be there, too)
849225361Sdougb# The problem with this implementation is that it doesn't allow
850225361Sdougb# for the specification of gssapi and krb5 headers in different locations,
851225361Sdougb# which probably ought to be fixed although fixing might raise the issue of
852225361Sdougb# trying to build with incompatible versions of gssapi and krb5.
853193149Sdougbif test "$use_gssapi" = "yes"
854193149Sdougbthen
855225361Sdougb	# first, deal with the obvious
856225361Sdougb	if test \( -f /usr/include/kerberosv5/krb5.h -o \
857225361Sdougb		   -f /usr/include/krb5/krb5.h -o \
858225361Sdougb		   -f /usr/include/krb5.h \)   -a \
859225361Sdougb		\( -f /usr/include/gssapi.h -o \
860225361Sdougb		   -f /usr/include/gssapi/gssapi.h \)
861225361Sdougb	then
862225361Sdougb		use_gssapi=/usr
863225361Sdougb	else
864225361Sdougb	    krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
865225361Sdougb	    for d in $krb5dirs
866225361Sdougb	    do
867225361Sdougb		if test -f $d/include/gssapi/gssapi_krb5.h -o \
868225361Sdougb		        -f $d/include/krb5.h
869193149Sdougb		then
870225361Sdougb			if test -f $d/include/gssapi/gssapi.h -o \
871225361Sdougb			        -f $d/include/gssapi.h
872225361Sdougb			then
873225361Sdougb				use_gssapi=$d
874225361Sdougb				break
875225361Sdougb			fi
876193149Sdougb		fi
877225361Sdougb		use_gssapi="no"
878225361Sdougb	    done
879225361Sdougb	fi
880193149Sdougbfi
881193149Sdougb
882193149Sdougbcase "$use_gssapi" in
883193149Sdougb	no)
884193149Sdougb		AC_MSG_RESULT(disabled)
885193149Sdougb		USE_GSSAPI=''
886193149Sdougb		;;
887193149Sdougb	yes)
888193149Sdougb		AC_MSG_ERROR([--with-gssapi must specify a path])
889193149Sdougb		;;
890193149Sdougb	*)
891193149Sdougb		AC_MSG_RESULT(looking in $use_gssapi/lib)
892193149Sdougb		USE_GSSAPI='-DGSSAPI'
893193149Sdougb		saved_cppflags="$CPPFLAGS"
894193149Sdougb		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
895193149Sdougb		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
896193149Sdougb		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
897193149Sdougb
898193149Sdougb		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
899193149Sdougb		    AC_MSG_ERROR([gssapi.h not found])
900193149Sdougb		fi
901193149Sdougb
902224092Sdougb		AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
903224092Sdougb		    [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"])
904224092Sdougb
905218384Sdougb		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
906218384Sdougb		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
907218384Sdougb
908218384Sdougb		if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
909218384Sdougb		    AC_MSG_ERROR([krb5.h not found])
910218384Sdougb		fi
911218384Sdougb
912193149Sdougb		CPPFLAGS="$saved_cppflags"
913193149Sdougb
914193149Sdougb		#
915193149Sdougb		# XXXDCL This probably doesn't work right on all systems.
916193149Sdougb		# It will need to be worked on as problems become evident.
917193149Sdougb		#
918193149Sdougb		# Essentially the problems here relate to two different
919193149Sdougb		# areas.  The first area is building with either KTH
920193149Sdougb		# or MIT Kerberos, particularly when both are present on
921193149Sdougb		# the machine.  The other is static versus dynamic linking.
922193149Sdougb		#
923193149Sdougb		# On the KTH vs MIT issue, Both have libkrb5 that can mess
924193149Sdougb		# up the works if one implementation ends up trying to
925193149Sdougb		# use the other's krb.  This is unfortunately a situation
926193149Sdougb		# that very easily arises.
927193149Sdougb		#
928193149Sdougb		# Dynamic linking when the dependency information is built
929193149Sdougb		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
930193149Sdougb		# all such problems go away, but when that setup is not
931193149Sdougb		# present, because either the dynamic libraries lack
932193149Sdougb		# dependencies or static linking is being done, then the
933193149Sdougb		# problems start to show up.
934193149Sdougb		saved_libs="$LIBS"
935193149Sdougb		for TRY_LIBS in \
936193149Sdougb		    "-lgssapi_krb5" \
937193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
938193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
939193149Sdougb		    "-lgssapi" \
940193149Sdougb		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
941193149Sdougb		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
942218384Sdougb		    "-lgss -lkrb5"
943193149Sdougb		do
944193149Sdougb		    # Note that this does not include $saved_libs, because
945193149Sdougb		    # on FreeBSD machines this configure script has added
946193149Sdougb		    # -L/usr/local/lib to LIBS, which can make the
947193149Sdougb		    # -lgssapi_krb5 test succeed with shared libraries even
948193149Sdougb		    # when you are trying to build with KTH in /usr/lib.
949224092Sdougb		    if test "$use_gssapi" = "/usr"
950224092Sdougb		    then
951224092Sdougb			    LIBS="$TRY_LIBS"
952224092Sdougb		    else
953224092Sdougb			    LIBS="-L$use_gssapi/lib $TRY_LIBS"
954224092Sdougb		    fi
955193149Sdougb		    AC_MSG_CHECKING(linking as $TRY_LIBS)
956218384Sdougb		    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
957193149Sdougb				gssapi_linked=yes, gssapi_linked=no)
958193149Sdougb		    case $gssapi_linked in
959193149Sdougb		    yes) AC_MSG_RESULT(yes); break ;;
960193149Sdougb		    no)  AC_MSG_RESULT(no) ;;
961193149Sdougb		    esac
962193149Sdougb		done
963193149Sdougb
964193149Sdougb		case $gssapi_linked in
965193149Sdougb		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
966193149Sdougb		esac
967193149Sdougb
968193149Sdougb		#
969193149Sdougb		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
970193149Sdougb		# but MIT in /usr/local/lib and trying to build with KTH.
971193149Sdougb		# /usr/local/lib can end up earlier on the link lines.
972193149Sdougb		# Like most kludges, this one is not only inelegant it
973193149Sdougb		# is also likely to be the wrong thing to do at least as
974193149Sdougb		# many times as it is the right thing.  Something better
975193149Sdougb		# needs to be done.
976193149Sdougb		#
977193149Sdougb		if test "$use_gssapi" = "/usr" -a \
978193149Sdougb			-f /usr/local/lib/libkrb5.a; then
979193149Sdougb		    FIX_KTH_VS_MIT=yes
980193149Sdougb		fi
981193149Sdougb
982193149Sdougb		case "$FIX_KTH_VS_MIT" in
983193149Sdougb		yes)
984193149Sdougb		    case "$enable_static_linking" in
985193149Sdougb		    yes) gssapi_lib_suffix=".a"  ;;
986193149Sdougb		    *)   gssapi_lib_suffix=".so" ;;
987193149Sdougb		    esac
988193149Sdougb
989193149Sdougb		    for lib in $LIBS; do
990193149Sdougb			case $lib in
991193149Sdougb			-L*)
992193149Sdougb			    ;;
993193149Sdougb			-l*)
994193149Sdougb			    new_lib=`echo $lib |
995193149Sdougb				     sed -e s%^-l%$use_gssapi/lib/lib% \
996193149Sdougb					 -e s%$%$gssapi_lib_suffix%`
997193149Sdougb			    NEW_LIBS="$NEW_LIBS $new_lib"
998193149Sdougb			    ;;
999193149Sdougb			*)
1000193149Sdougb			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1001193149Sdougb			    ;;
1002193149Sdougb			esac
1003193149Sdougb		    done
1004193149Sdougb		    LIBS="$NEW_LIBS"
1005193149Sdougb		    ;;
1006193149Sdougb		esac
1007193149Sdougb
1008193149Sdougb		DST_GSSAPI_INC="-I$use_gssapi/include"
1009193149Sdougb		DNS_GSSAPI_LIBS="$LIBS"
1010193149Sdougb
1011193149Sdougb		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1012193149Sdougb		LIBS="$saved_libs"
1013193149Sdougb		;;
1014193149Sdougbesac
1015193149Sdougb
1016193149SdougbAC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1017193149SdougbAC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1018224092SdougbAC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1019218384SdougbAC_SUBST(ISC_PLATFORM_KRB5HEADER)
1020193149Sdougb
1021135446StrhodesAC_SUBST(USE_GSSAPI)
1022135446StrhodesAC_SUBST(DST_GSSAPI_INC)
1023193149SdougbAC_SUBST(DNS_GSSAPI_LIBS)
1024193149SdougbDNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
1025135446Strhodes
1026135446Strhodes#
1027135446Strhodes# Applications linking with libdns also need to link with these libraries.
1028135446Strhodes#
1029135446Strhodes
1030135446StrhodesAC_SUBST(DNS_CRYPTO_LIBS)
1031135446Strhodes
1032135446Strhodes#
1033135446Strhodes# was --with-randomdev specified?
1034135446Strhodes#
1035135446StrhodesAC_MSG_CHECKING(for random device)
1036135446StrhodesAC_ARG_WITH(randomdev,
1037204619Sdougb[  --with-randomdev=PATH   Specify path for random device],
1038135446Strhodes    use_randomdev="$withval", use_randomdev="unspec")
1039135446Strhodes
1040135446Strhodescase "$use_randomdev" in
1041135446Strhodes	unspec)
1042135446Strhodes		case "$host" in
1043135446Strhodes			*-openbsd*)
1044135446Strhodes				devrandom=/dev/arandom
1045135446Strhodes				;;
1046135446Strhodes			*)
1047135446Strhodes				devrandom=/dev/random
1048135446Strhodes				;;
1049135446Strhodes		esac
1050135446Strhodes		AC_MSG_RESULT($devrandom)
1051135446Strhodes		AC_CHECK_FILE($devrandom,
1052135446Strhodes			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1053135446Strhodes						 "$devrandom"),)
1054135446Strhodes		;;
1055135446Strhodes	yes)
1056135446Strhodes		AC_MSG_ERROR([--with-randomdev must specify a path])
1057135446Strhodes		;;
1058135446Strhodes	no)
1059135446Strhodes		AC_MSG_RESULT(disabled)
1060135446Strhodes		;;
1061135446Strhodes	*)
1062135446Strhodes		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1063135446Strhodes		AC_MSG_RESULT(using "$use_randomdev")
1064135446Strhodes		;;
1065135446Strhodesesac
1066135446Strhodes
1067135446Strhodes#
1068135446Strhodes# Do we have arc4random() ?
1069135446Strhodes#
1070135446StrhodesAC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1071135446Strhodes
1072153816Sdougbsinclude(config.threads.in)dnl
1073135446Strhodes
1074135446Strhodesif $use_threads
1075135446Strhodesthen
1076165071Sdougb	if test "X$GCC" = "Xyes"; then
1077165071Sdougb		case "$host" in
1078165071Sdougb		*-freebsd*)
1079165071Sdougb			CC="$CC -pthread"
1080165071Sdougb			CCOPT="$CCOPT -pthread"
1081165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1082165071Sdougb			;;
1083165071Sdougb		*-openbsd*)
1084165071Sdougb			CC="$CC -pthread"
1085165071Sdougb			CCOPT="$CCOPT -pthread"
1086165071Sdougb			;;
1087165071Sdougb		*-solaris*)
1088165071Sdougb			LIBS="$LIBS -lthread"
1089165071Sdougb			;;
1090165071Sdougb		*-ibm-aix*)
1091165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1092165071Sdougb			;;
1093165071Sdougb		esac
1094165071Sdougb	else
1095165071Sdougb		case $host in
1096165071Sdougb		*-dec-osf*)
1097165071Sdougb			CC="$CC -pthread"
1098165071Sdougb			CCOPT="$CCOPT -pthread"
1099165071Sdougb			;;
1100165071Sdougb		*-solaris*)
1101165071Sdougb			CC="$CC -mt"
1102165071Sdougb			CCOPT="$CCOPT -mt"
1103165071Sdougb			;;
1104165071Sdougb		*-ibm-aix*)
1105165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1106165071Sdougb			;;
1107165071Sdougb		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
1108165071Sdougb			CC="$CC -Kthread"
1109165071Sdougb			CCOPT="$CCOPT -Kthread"
1110165071Sdougb			;;
1111165071Sdougb		*-*-sysv*OpenUNIX*)
1112165071Sdougb			CC="$CC -Kpthread"
1113165071Sdougb			CCOPT="$CCOPT -Kpthread"
1114165071Sdougb			;;
1115165071Sdougb		esac
1116165071Sdougb	fi
1117165071Sdougb	ALWAYS_DEFINES="-D_REENTRANT"
1118165071Sdougb	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1119218384Sdougb	THREADOPTOBJS='${THREADOPTOBJS}'
1120218384Sdougb	THREADOPTSRCS='${THREADOPTSRCS}'
1121165071Sdougb	thread_dir=pthreads
1122135446Strhodes	#
1123135446Strhodes	# We'd like to use sigwait() too
1124135446Strhodes	#
1125165071Sdougb	AC_CHECK_FUNC(sigwait,
1126165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
1127165071Sdougb		      AC_CHECK_LIB(c, sigwait,
1128165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
1129165071Sdougb		      AC_CHECK_LIB(pthread, sigwait,
1130165071Sdougb				   AC_DEFINE(HAVE_SIGWAIT),
1131165071Sdougb				   AC_CHECK_LIB(pthread, _Psigwait,
1132193149Sdougb						AC_DEFINE(HAVE_SIGWAIT),))))
1133135446Strhodes
1134135446Strhodes	AC_CHECK_FUNC(pthread_attr_getstacksize,
1135135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1136135446Strhodes
1137135446Strhodes	AC_CHECK_FUNC(pthread_attr_setstacksize,
1138135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1139135446Strhodes
1140135446Strhodes	#
1141135446Strhodes	# Additional OS-specific issues related to pthreads and sigwait.
1142135446Strhodes	#
1143135446Strhodes	case "$host" in
1144135446Strhodes		#
1145135446Strhodes		# One more place to look for sigwait.
1146135446Strhodes		#
1147135446Strhodes		*-freebsd*)
1148135446Strhodes			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1149143731Sdougb			case $host in
1150153816Sdougb			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1151153816Sdougb			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1152143731Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1153143731Sdougb				;;
1154153816Sdougb			*-freebsd6.*)
1155153816Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1156153816Sdougb				;;
1157143731Sdougb			esac
1158135446Strhodes			;;
1159135446Strhodes		#
1160135446Strhodes		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
1161135446Strhodes		# called before certain pthreads calls.	 This is deprecated
1162135446Strhodes		# in BSD/OS 4.1.
1163135446Strhodes		#
1164135446Strhodes		*-bsdi3.*|*-bsdi4.0*)
1165135446Strhodes			AC_DEFINE(NEED_PTHREAD_INIT)
1166135446Strhodes			;;
1167135446Strhodes		#
1168135446Strhodes		# LinuxThreads requires some changes to the way we
1169135446Strhodes		# deal with signals.
1170135446Strhodes		#
1171135446Strhodes		*-linux*)
1172135446Strhodes			AC_DEFINE(HAVE_LINUXTHREADS)
1173135446Strhodes			;;
1174135446Strhodes		#
1175135446Strhodes		# Ensure the right sigwait() semantics on Solaris and make
1176135446Strhodes		# sure we call pthread_setconcurrency.
1177135446Strhodes		#
1178135446Strhodes		*-solaris*)
1179135446Strhodes			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1180135446Strhodes			AC_CHECK_FUNC(pthread_setconcurrency,
1181135446Strhodes				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1182135446Strhodes			;;
1183135446Strhodes		#
1184135446Strhodes		# UnixWare does things its own way.
1185135446Strhodes		#
1186135446Strhodes		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1187135446Strhodes			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1188135446Strhodes			;;
1189135446Strhodes	esac
1190135446Strhodes
1191135446Strhodes	#
1192135446Strhodes	# Look for sysconf to allow detection of the number of processors.
1193135446Strhodes	#
1194135446Strhodes	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1195135446Strhodes
1196135446Strhodeselse
1197135446Strhodes	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1198135446Strhodes	thread_dir=nothreads
1199218384Sdougb	THREADOPTOBJS=""
1200218384Sdougb	THREADOPTSRCS=""
1201135446Strhodes	ALWAYS_DEFINES=""
1202135446Strhodesfi
1203135446Strhodes
1204135446StrhodesAC_SUBST(ALWAYS_DEFINES)
1205135446StrhodesAC_SUBST(ISC_PLATFORM_USETHREADS)
1206218384SdougbAC_SUBST(THREADOPTOBJS)
1207218384SdougbAC_SUBST(THREADOPTSRCS)
1208135446StrhodesISC_THREAD_DIR=$thread_dir
1209135446StrhodesAC_SUBST(ISC_THREAD_DIR)
1210135446Strhodes
1211135446Strhodes#
1212193149Sdougb# was --with-libxml2 specified?
1213193149Sdougb#
1214193149SdougbAC_MSG_CHECKING(for libxml2 library)
1215193149SdougbAC_ARG_WITH(libxml2,
1216204619Sdougb[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1217193149Sdougb    use_libxml2="$withval", use_libxml2="auto")
1218193149Sdougb
1219193149Sdougbcase "$use_libxml2" in
1220193149Sdougb	no)
1221193149Sdougb		DST_LIBXML2_INC=""
1222193149Sdougb		;;
1223193149Sdougb	auto|yes)
1224193149Sdougb		case X`(xml2-config --version) 2>/dev/null` in
1225193149Sdougb		X2.[[67]].*)
1226193149Sdougb			libxml2_libs=`xml2-config --libs`
1227193149Sdougb			libxml2_cflags=`xml2-config --cflags`
1228193149Sdougb			;;
1229193149Sdougb		*)
1230193149Sdougb			libxml2_libs=
1231193149Sdougb			libxml2_cflags=
1232193149Sdougb			;;
1233193149Sdougb		esac
1234193149Sdougb		;;
1235193149Sdougb	*)
1236193149Sdougb		if test -f "$use_libxml2/bin/xml2-config" ; then
1237193149Sdougb			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1238193149Sdougb			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1239193149Sdougb		fi
1240193149Sdougb		;;
1241193149Sdougbesac
1242193149Sdougb
1243193149Sdougbif test "X$libxml2_libs" != "X"
1244193149Sdougbthen
1245193149Sdougb	AC_MSG_RESULT(yes)
1246193149Sdougb	CFLAGS="$CFLAGS $libxml2_cflags"
1247193149Sdougb	LIBS="$LIBS $libxml2_libs"
1248193149Sdougb	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1249193149Sdougbelse
1250193149Sdougb	AC_MSG_RESULT(no)
1251193149Sdougbfi
1252193149Sdougb
1253193149Sdougb#
1254135446Strhodes# In solaris 10, SMF can manage named service
1255135446Strhodes#
1256135446StrhodesAC_CHECK_LIB(scf, smf_enable_instance)
1257135446Strhodes
1258135446Strhodes#
1259135446Strhodes# flockfile is usually provided by pthreads, but we may want to use it
1260135446Strhodes# even if compiled with --disable-threads.  getc_unlocked might also not
1261135446Strhodes# be defined.
1262135446Strhodes#
1263135446StrhodesAC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1264135446StrhodesAC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1265135446Strhodes
1266135446Strhodes# 
1267135446Strhodes# Indicate what the final decision was regarding threads.
1268135446Strhodes#
1269135446StrhodesAC_MSG_CHECKING(whether to build with threads)
1270135446Strhodesif $use_threads; then
1271135446Strhodes	AC_MSG_RESULT(yes)
1272135446Strhodeselse
1273135446Strhodes	AC_MSG_RESULT(no)
1274135446Strhodesfi
1275135446Strhodes
1276135446Strhodes# 
1277135446Strhodes# End of pthreads stuff.
1278135446Strhodes#
1279135446Strhodes
1280135446Strhodes#
1281135446Strhodes# Large File
1282135446Strhodes#
1283135446StrhodesAC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1284135446Strhodes	      want_largefile="yes", want_largefile="no")
1285135446Strhodescase $want_largefile in
1286135446Strhodes	yes)
1287135446Strhodes		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1288135446Strhodes		;;
1289135446Strhodes	*)
1290135446Strhodes		;;
1291135446Strhodesesac
1292135446Strhodes
1293135446Strhodes#
1294135446Strhodes# Additional compiler settings.
1295135446Strhodes#
1296135446StrhodesMKDEPCC="$CC"
1297135446StrhodesMKDEPCFLAGS="-M"
1298135446StrhodesIRIX_DNSSEC_WARNINGS_HACK=""
1299135446Strhodes
1300135446Strhodesif test "X$GCC" = "Xyes"; then
1301165071Sdougb	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1302165071Sdougb	SAVE_CFLAGS=$CFLAGS
1303218384Sdougb	CFLAGS="$CFLAGS -fno-strict-aliasing"
1304165071Sdougb	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1305165071Sdougb	CFLAGS=$SAVE_CFLAGS
1306165071Sdougb	if test "$FNOSTRICTALIASING" = "yes"; then
1307165071Sdougb		AC_MSG_RESULT(yes)
1308165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1309165071Sdougb	else
1310165071Sdougb		AC_MSG_RESULT(no)
1311165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1312165071Sdougb	fi
1313143731Sdougb	case "$host" in
1314143731Sdougb	*-hp-hpux*)
1315153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1316143731Sdougb		;;
1317143731Sdougb	esac
1318135446Strhodeselse
1319135446Strhodes	case $host in
1320135446Strhodes	*-dec-osf*)
1321135446Strhodes		CC="$CC -std"
1322135446Strhodes		CCOPT="$CCOPT -std"
1323135446Strhodes		MKDEPCC="$CC"
1324135446Strhodes		;;
1325135446Strhodes	*-hp-hpux*)
1326135446Strhodes		CC="$CC -Ae -z"
1327135446Strhodes		# The version of the C compiler that constantly warns about
1328193149Sdougb		# 'const' as well as alignment issues is unfortunately not
1329193149Sdougb		# able to be discerned via the version of the operating
1330193149Sdougb		# system, nor does cc have a version flag.
1331135446Strhodes		case "`$CC +W 123 2>&1`" in
1332135446Strhodes		*Unknown?option*)
1333135446Strhodes			STD_CWARNINGS="+w1"
1334135446Strhodes			;;
1335135446Strhodes		*)
1336135446Strhodes			# Turn off the pointlessly noisy warnings.
1337153816Sdougb			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1338135446Strhodes			;;
1339135446Strhodes		esac
1340135446Strhodes		CCOPT="$CCOPT -Ae -z"
1341153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1342135446Strhodes		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1343135446Strhodes		;;
1344135446Strhodes	*-sgi-irix*)
1345135446Strhodes		STD_CWARNINGS="-fullwarn -woff 1209"
1346135446Strhodes		#
1347135446Strhodes		# Silence more than 250 instances of
1348135446Strhodes		#   "prototyped function redeclared without prototype"
1349135446Strhodes		# and 11 instances of
1350135446Strhodes		#   "variable ... was set but never used"
1351135446Strhodes		# from lib/dns/sec/openssl.
1352135446Strhodes		#
1353135446Strhodes		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1354135446Strhodes		;;
1355135446Strhodes	*-solaris*)
1356135446Strhodes		MKDEPCFLAGS="-xM"
1357135446Strhodes		;;
1358135446Strhodes	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1359193149Sdougb		# UnixWare
1360135446Strhodes		CC="$CC -w"
1361135446Strhodes		;;
1362135446Strhodes	esac
1363135446Strhodesfi
1364135446Strhodes
1365135446StrhodesAC_SUBST(MKDEPCC)
1366135446StrhodesAC_SUBST(MKDEPCFLAGS)
1367135446StrhodesAC_SUBST(MKDEPPROG)
1368135446StrhodesAC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1369135446Strhodes
1370135446Strhodes#
1371135446Strhodes# NLS
1372135446Strhodes#
1373135446StrhodesAC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1374135446Strhodes
1375135446Strhodes#
1376135446Strhodes# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1377135446Strhodes#
1378135446Strhodes# AC_CHECK_LIB(xnet, socket, ,
1379135446Strhodes#    AC_CHECK_LIB(socket, socket)
1380135446Strhodes# )
1381135446Strhodes#
1382135446Strhodes# Use this for now, instead:
1383135446Strhodes#
1384135446Strhodescase "$host" in
1385135446Strhodes	mips-sgi-irix*)
1386135446Strhodes		;;
1387193149Sdougb	*-linux*)
1388193149Sdougb		;;
1389135446Strhodes	*)
1390135446Strhodes		AC_CHECK_LIB(socket, socket)
1391193149Sdougb		AC_CHECK_LIB(nsl, inet_addr)
1392135446Strhodes		;;
1393135446Strhodesesac
1394135446Strhodes
1395135446Strhodes#
1396186462Sdougb# Work around Solaris's select() limitations.
1397186462Sdougb#
1398186462Sdougbcase "$host" in
1399186462Sdougb	*-solaris2.[[89]]|*-solaris2.1?)
1400186462Sdougb	AC_DEFINE(FD_SETSIZE, 65536,
1401186462Sdougb		  [Solaris hack to get select_large_fdset.])
1402186462Sdougb	;;
1403186462Sdougbesac
1404186462Sdougb
1405186462Sdougb#
1406135446Strhodes# Purify support
1407135446Strhodes#
1408135446StrhodesAC_MSG_CHECKING(whether to use purify)
1409135446StrhodesAC_ARG_WITH(purify,
1410204619Sdougb	[  --with-purify[=PATH]      use Rational purify],
1411135446Strhodes	use_purify="$withval", use_purify="no")
1412135446Strhodes
1413135446Strhodescase "$use_purify" in
1414135446Strhodes	no)
1415135446Strhodes		;;
1416135446Strhodes	yes)
1417135446Strhodes		AC_PATH_PROG(purify_path, purify, purify)
1418135446Strhodes		;;
1419135446Strhodes	*)
1420135446Strhodes		purify_path="$use_purify"
1421135446Strhodes		;;
1422135446Strhodesesac
1423135446Strhodes
1424135446Strhodescase "$use_purify" in
1425135446Strhodes	no)
1426135446Strhodes		AC_MSG_RESULT(no)
1427135446Strhodes		PURIFY=""
1428135446Strhodes		;;
1429135446Strhodes	*)
1430135446Strhodes		if test -f $purify_path || test $purify_path = purify; then
1431135446Strhodes			AC_MSG_RESULT($purify_path)
1432135446Strhodes			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1433135446Strhodes			PURIFY="$purify_path $PURIFYFLAGS"
1434135446Strhodes		else
1435135446Strhodes			AC_MSG_ERROR([$purify_path not found.
1436135446Strhodes
1437135446StrhodesPlease choose the proper path with the following command:
1438135446Strhodes
1439135446Strhodes    configure --with-purify=PATH
1440135446Strhodes])
1441135446Strhodes		fi
1442135446Strhodes		;;
1443135446Strhodesesac
1444135446Strhodes
1445135446StrhodesAC_SUBST(PURIFY)
1446135446Strhodes
1447186462Sdougb
1448135446StrhodesAC_ARG_WITH(libtool,
1449204619Sdougb	    [  --with-libtool          use GNU libtool],
1450135446Strhodes	    use_libtool="$withval", use_libtool="no")
1451135446Strhodes
1452135446Strhodescase $use_libtool in
1453135446Strhodes	yes)
1454135446Strhodes		AM_PROG_LIBTOOL
1455135446Strhodes		O=lo
1456135446Strhodes		A=la
1457135446Strhodes		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1458234010Sdougb		LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1459234010Sdougb		LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1460234010Sdougb		LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1461143731Sdougb		case "$host" in
1462143731Sdougb		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1463143731Sdougb		esac
1464143731Sdougb		case "$host" in
1465143731Sdougb		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1466143731Sdougb		*) LIBTOOL_IN_MAIN= ;;
1467143731Sdougb		esac;
1468135446Strhodes		;;
1469135446Strhodes	*)
1470135446Strhodes		O=o
1471135446Strhodes		A=a
1472135446Strhodes		LIBTOOL=
1473135446Strhodes		AC_SUBST(LIBTOOL)
1474135446Strhodes		LIBTOOL_MKDEP_SED=
1475135446Strhodes		LIBTOOL_MODE_COMPILE=
1476135446Strhodes		LIBTOOL_MODE_INSTALL=
1477135446Strhodes		LIBTOOL_MODE_LINK=
1478143731Sdougb		LIBTOOL_ALLOW_UNDEFINED=
1479143731Sdougb		LIBTOOL_IN_MAIN=
1480135446Strhodes		;;
1481135446Strhodesesac
1482135446Strhodes
1483135446Strhodes#
1484224092Sdougb# enable/disable dumping stack backtrace.  Also check if the system supports
1485224092Sdougb# glibc-compatible backtrace() function.
1486224092Sdougb#
1487224092SdougbAC_ARG_ENABLE(backtrace,
1488224092Sdougb[  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
1489224092Sdougb	      want_backtrace="$enableval",  want_backtrace="yes")
1490224092Sdougbcase $want_backtrace in
1491224092Sdougbyes)
1492224092Sdougb	ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
1493224092Sdougb	AC_TRY_LINK([#include <execinfo.h>],
1494224092Sdougb	[return (backtrace((void **)0, 0));],
1495224092Sdougb	[AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
1496224092Sdougb	;;
1497224092Sdougb*)
1498224092Sdougb	ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
1499224092Sdougb	;;
1500224092Sdougbesac
1501224092SdougbAC_SUBST(ISC_PLATFORM_USEBACKTRACE)
1502224092Sdougb
1503224092SdougbAC_ARG_ENABLE(symtable,
1504224092Sdougb[  --enable-symtable       use internal symbol table for backtrace
1505224092Sdougb                          [[all|minimal(default)|none]]],
1506224092Sdougb		want_symtable="$enableval",  want_symtable="minimal")
1507224092Sdougbcase $want_symtable in
1508224092Sdougbyes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
1509224092Sdougb	if test "$PERL" = ""
1510224092Sdougb	then
1511224092Sdougb		AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1512224092SdougbInstall perl or explicitly disable the feature by --disable-symtable.])
1513224092Sdougb	fi
1514224092Sdougb	if test "$use_libtool" = "yes"; then
1515224092Sdougb		AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
1516224092Sdougb	else
1517224092Sdougb		# we generate the internal symbol table only for those systems
1518224092Sdougb		# known to work to avoid unexpected build failure.  Also, warn
1519224092Sdougb		# about unsupported systems when the feature is enabled
1520224092Sdougb		#  manually.
1521224092Sdougb		case $host_os in
1522224092Sdougb		freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1523224092Sdougb			MKSYMTBL_PROGRAM="$PERL"
1524224092Sdougb			if test $want_symtable = all; then
1525224092Sdougb				ALWAYS_MAKE_SYMTABLE="yes"
1526224092Sdougb			fi
1527224092Sdougb			;;
1528224092Sdougb		*)
1529224092Sdougb			if test $want_symtable = yes -o $want_symtable = all
1530224092Sdougb			then
1531224092Sdougb				AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1532224092Sdougb			fi
1533224092Sdougb		esac
1534224092Sdougb	fi
1535224092Sdougb	;;
1536224092Sdougb*)
1537224092Sdougb	;;
1538224092Sdougbesac
1539224092SdougbAC_SUBST(MKSYMTBL_PROGRAM)
1540224092SdougbAC_SUBST(ALWAYS_MAKE_SYMTABLE)
1541224092Sdougb
1542224092Sdougb#
1543135446Strhodes# File name extension for static archive files, for those few places
1544135446Strhodes# where they are treated differently from dynamic ones.
1545135446Strhodes#
1546135446StrhodesSA=a
1547135446Strhodes
1548135446StrhodesAC_SUBST(O)
1549135446StrhodesAC_SUBST(A)
1550135446StrhodesAC_SUBST(SA)
1551135446StrhodesAC_SUBST(LIBTOOL_MKDEP_SED)
1552135446StrhodesAC_SUBST(LIBTOOL_MODE_COMPILE)
1553135446StrhodesAC_SUBST(LIBTOOL_MODE_INSTALL)
1554135446StrhodesAC_SUBST(LIBTOOL_MODE_LINK)
1555143731SdougbAC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1556143731SdougbAC_SUBST(LIBTOOL_IN_MAIN)
1557135446Strhodes
1558135446Strhodes#
1559224092Sdougb# build exportable DNS library?
1560224092Sdougb#
1561224092SdougbAC_ARG_ENABLE(exportlib,
1562224092Sdougb	[  --enable-exportlib	build exportable library (GNU make required)
1563224092Sdougb                        [[default=no]]])
1564224092Sdougbcase "$enable_exportlib" in
1565224092Sdougb	yes)
1566224092Sdougb		gmake=
1567224092Sdougb		for x in gmake gnumake make; do
1568224092Sdougb			if $x --version 2>/dev/null | grep GNU > /dev/null; then
1569224092Sdougb				gmake=$x
1570224092Sdougb				break;
1571224092Sdougb			fi
1572224092Sdougb		done
1573224092Sdougb		if test -z "$gmake"; then
1574224092Sdougb			AC_MSG_ERROR([exportlib requires GNU make.  Install it or disable the feature.])
1575224092Sdougb		fi
1576224092Sdougb		LIBEXPORT=lib/export
1577224092Sdougb		AC_SUBST(LIBEXPORT)
1578224092Sdougb		BIND9_CO_RULE="%.$O:  \${srcdir}/%.c"
1579224092Sdougb		;;
1580224092Sdougb	no|*)
1581224092Sdougb		BIND9_CO_RULE=".c.$O:"
1582224092Sdougb		;;
1583224092Sdougbesac
1584224092SdougbAC_SUBST(BIND9_CO_RULE)
1585224092Sdougb
1586224092SdougbAC_ARG_WITH(export-libdir,
1587224092Sdougb	[  --with-export-libdir[=PATH]
1588224092Sdougb                        installation directory for the export library
1589224092Sdougb                        [[EPREFIX/lib/bind9]]],
1590224092Sdougb	export_libdir="$withval",)
1591224092Sdougbif test -z "$export_libdir"; then
1592224092Sdougb	export_libdir="\${exec_prefix}/lib/bind9/"
1593224092Sdougbfi
1594224092SdougbAC_SUBST(export_libdir)
1595224092Sdougb
1596224092SdougbAC_ARG_WITH(export-includedir,
1597224092Sdougb	[  --with-export-includedir[=PATH]
1598224092Sdougb                        installation directory for the header files of the
1599224092Sdougb                        export library [[PREFIX/include/bind9]]],
1600224092Sdougb	export_includedir="$withval",)
1601224092Sdougbif test -z "$export_includedir"; then
1602224092Sdougb	export_includedir="\${prefix}/include/bind9/"
1603224092Sdougbfi
1604224092SdougbAC_SUBST(export_includedir)
1605224092Sdougb
1606224092Sdougb#
1607135446Strhodes# Here begins a very long section to determine the system's networking
1608193149Sdougb# capabilities.  The order of the tests is significant.
1609135446Strhodes#
1610135446Strhodes
1611135446Strhodes#
1612135446Strhodes# IPv6
1613135446Strhodes#
1614135446StrhodesAC_ARG_ENABLE(ipv6,
1615204619Sdougb	[  --enable-ipv6           use IPv6 [default=autodetect]])
1616135446Strhodes
1617135446Strhodescase "$enable_ipv6" in
1618135446Strhodes	yes|''|autodetect)
1619135446Strhodes		AC_DEFINE(WANT_IPV6)
1620135446Strhodes		;;
1621135446Strhodes	no)
1622135446Strhodes		;;
1623135446Strhodesesac
1624135446Strhodes
1625135446Strhodes#
1626135446Strhodes# We do the IPv6 compilation checking after libtool so that we can put
1627135446Strhodes# the right suffix on the files.
1628135446Strhodes#
1629135446StrhodesAC_MSG_CHECKING(for IPv6 structures)
1630135446StrhodesAC_TRY_COMPILE([
1631135446Strhodes#include <sys/types.h>
1632135446Strhodes#include <sys/socket.h>
1633135446Strhodes#include <netinet/in.h>],
1634135446Strhodes[struct sockaddr_in6 sin6; return (0);],
1635135446Strhodes	[AC_MSG_RESULT(yes)
1636135446Strhodes	 found_ipv6=yes],
1637135446Strhodes	[AC_MSG_RESULT(no)
1638135446Strhodes	 found_ipv6=no])
1639135446Strhodes
1640135446Strhodes#
1641135446Strhodes# See whether IPv6 support is provided via a Kame add-on.
1642135446Strhodes# This is done before other IPv6 linking tests to LIBS is properly set.
1643135446Strhodes#
1644135446StrhodesAC_MSG_CHECKING(for Kame IPv6 support)
1645135446StrhodesAC_ARG_WITH(kame,
1646204619Sdougb	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1647135446Strhodes	use_kame="$withval", use_kame="no")
1648135446Strhodes
1649135446Strhodescase "$use_kame" in
1650135446Strhodes	no)
1651135446Strhodes		;;
1652135446Strhodes	yes)
1653135446Strhodes		kame_path=/usr/local/v6
1654135446Strhodes		;;
1655135446Strhodes	*)
1656135446Strhodes		kame_path="$use_kame"
1657135446Strhodes		;;
1658135446Strhodesesac
1659135446Strhodes
1660135446Strhodescase "$use_kame" in
1661135446Strhodes	no)
1662135446Strhodes		AC_MSG_RESULT(no)
1663135446Strhodes		;;
1664135446Strhodes	*)
1665135446Strhodes		if test -f $kame_path/lib/libinet6.a; then
1666135446Strhodes			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1667135446Strhodes			LIBS="-L$kame_path/lib -linet6 $LIBS"
1668135446Strhodes		else
1669135446Strhodes			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1670135446Strhodes
1671135446StrhodesPlease choose the proper path with the following command:
1672135446Strhodes
1673135446Strhodes    configure --with-kame=PATH
1674135446Strhodes])
1675135446Strhodes		fi
1676135446Strhodes		;;
1677135446Strhodesesac
1678135446Strhodes
1679135446Strhodes#
1680135446Strhodes# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1681135446Strhodes# Including it on Kame-using platforms is very bad, though, because
1682135446Strhodes# Kame uses #error against direct inclusion.   So include it on only
1683135446Strhodes# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1684135446Strhodes# This is done before the in6_pktinfo check because that's what
1685135446Strhodes# netinet6/in6.h is needed for.
1686135446Strhodes#
1687135446Strhodeschangequote({, })
1688135446Strhodescase "$host" in
1689135446Strhodes*-bsdi4.[01]*)
1690135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1691135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1692135446Strhodes	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1693135446Strhodes	;;
1694135446Strhodes*)
1695135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1696135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1697135446Strhodes	isc_netinet6in6_hack=""
1698135446Strhodes	;;
1699135446Strhodesesac
1700135446Strhodeschangequote([, ])
1701135446Strhodes
1702135446Strhodes#
1703135446Strhodes# This is similar to the netinet6/in6.h issue.
1704135446Strhodes#
1705135446Strhodescase "$host" in
1706135446Strhodes*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1707193149Sdougb	# UnixWare
1708135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1709135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1710193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1711135446Strhodes	isc_netinetin6_hack="#include <netinet/in6.h>"
1712135446Strhodes	;;
1713135446Strhodes*)
1714135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1715135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1716193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1717135446Strhodes	isc_netinetin6_hack=""
1718135446Strhodes	;;
1719135446Strhodesesac
1720135446Strhodes
1721135446Strhodes#
1722135446Strhodes# Now delve deeper into the suitability of the IPv6 support.
1723135446Strhodes#
1724135446Strhodescase "$found_ipv6" in
1725135446Strhodes	yes)
1726135446Strhodes		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1727135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1728135446Strhodes
1729135446Strhodes		AC_MSG_CHECKING(for in6_addr)
1730135446Strhodes		AC_TRY_COMPILE([
1731135446Strhodes#include <sys/types.h>
1732135446Strhodes#include <sys/socket.h>
1733135446Strhodes#include <netinet/in.h>
1734135446Strhodes$isc_netinetin6_hack
1735135446Strhodes$isc_netinet6in6_hack
1736135446Strhodes],
1737135446Strhodes[struct in6_addr in6; return (0);],
1738135446Strhodes		[AC_MSG_RESULT(yes)
1739135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1740135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1741135446Strhodes		 isc_in_addr6_hack=""],
1742135446Strhodes		[AC_MSG_RESULT(no)
1743135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1744135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1745135446Strhodes		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1746135446Strhodes
1747135446Strhodes		AC_MSG_CHECKING(for in6addr_any)
1748135446Strhodes		AC_TRY_LINK([
1749135446Strhodes#include <sys/types.h>
1750135446Strhodes#include <sys/socket.h>
1751135446Strhodes#include <netinet/in.h>
1752135446Strhodes$isc_netinetin6_hack
1753135446Strhodes$isc_netinet6in6_hack
1754135446Strhodes$isc_in_addr6_hack
1755135446Strhodes],
1756135446Strhodes		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1757135446Strhodes			[AC_MSG_RESULT(yes)
1758135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1759135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1760135446Strhodes			[AC_MSG_RESULT(no)
1761135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1762135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1763135446Strhodes
1764135446Strhodes		AC_MSG_CHECKING(for in6addr_loopback)
1765135446Strhodes		AC_TRY_LINK([
1766135446Strhodes#include <sys/types.h>
1767135446Strhodes#include <sys/socket.h>
1768135446Strhodes#include <netinet/in.h>
1769135446Strhodes$isc_netinetin6_hack
1770135446Strhodes$isc_netinet6in6_hack
1771135446Strhodes$isc_in_addr6_hack
1772135446Strhodes],
1773135446Strhodes		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1774135446Strhodes			[AC_MSG_RESULT(yes)
1775135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1776135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1777135446Strhodes			[AC_MSG_RESULT(no)
1778135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1779135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1780135446Strhodes
1781135446Strhodes		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1782135446Strhodes		AC_TRY_COMPILE([
1783135446Strhodes#include <sys/types.h>
1784135446Strhodes#include <sys/socket.h>
1785135446Strhodes#include <netinet/in.h>
1786135446Strhodes$isc_netinetin6_hack
1787135446Strhodes$isc_netinet6in6_hack
1788135446Strhodes],
1789135446Strhodes		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1790135446Strhodes			[AC_MSG_RESULT(yes)
1791135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1792135446Strhodes			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1793135446Strhodes			[AC_MSG_RESULT(no)
1794135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1795135446Strhodes			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1796135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1797135446Strhodes
1798135446Strhodes		AC_MSG_CHECKING(for in6_pktinfo)
1799135446Strhodes		AC_TRY_COMPILE([
1800135446Strhodes#include <sys/types.h>
1801135446Strhodes#include <sys/socket.h>
1802135446Strhodes#include <netinet/in.h>
1803135446Strhodes$isc_netinetin6_hack
1804135446Strhodes$isc_netinet6in6_hack
1805135446Strhodes],
1806135446Strhodes		[struct in6_pktinfo xyzzy; return (0);],
1807135446Strhodes			[AC_MSG_RESULT(yes)
1808135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1809135446Strhodes			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1810135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1811135446Strhodes		;;
1812135446Strhodes	no)
1813135446Strhodes		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1814135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1815135446Strhodes		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1816135446Strhodes		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1817135446Strhodes		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1818135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1819135446Strhodes		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1820135446Strhodes		ISC_IPV6_H="ipv6.h"
1821135446Strhodes		ISC_IPV6_O="ipv6.$O"
1822135446Strhodes		ISC_ISCIPV6_O="unix/ipv6.$O"
1823135446Strhodes		ISC_IPV6_C="ipv6.c"
1824135446Strhodes		;;
1825135446Strhodesesac
1826135446Strhodes
1827135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIPV6)
1828135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1829135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1830135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1831135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1832135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1833135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1834135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1835135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1836135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1837135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1838135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1839135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1840135446StrhodesAC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1841135446StrhodesAC_SUBST(ISC_IPV6_H)
1842135446StrhodesAC_SUBST(ISC_IPV6_O)
1843135446StrhodesAC_SUBST(ISC_ISCIPV6_O)
1844135446StrhodesAC_SUBST(ISC_IPV6_C)
1845135446StrhodesAC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1846135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1847135446Strhodes
1848135446StrhodesAC_MSG_CHECKING([for struct if_laddrreq])
1849135446StrhodesAC_TRY_LINK([
1850135446Strhodes#include <sys/types.h>
1851135446Strhodes#include <net/if6.h>
1852135446Strhodes],[ struct if_laddrreq a; ],
1853135446Strhodes	[AC_MSG_RESULT(yes)
1854135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1855135446Strhodes	[AC_MSG_RESULT(no)
1856135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1857135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1858135446Strhodes
1859135446StrhodesAC_MSG_CHECKING([for struct if_laddrconf])
1860135446StrhodesAC_TRY_LINK([
1861135446Strhodes#include <sys/types.h>
1862135446Strhodes#include <net/if6.h>
1863135446Strhodes],[ struct if_laddrconf a; ],
1864135446Strhodes	[AC_MSG_RESULT(yes)
1865135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1866135446Strhodes	[AC_MSG_RESULT(no)
1867135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1868135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1869135446Strhodes
1870135446Strhodes#
1871135446Strhodes# Check for network functions that are often missing.  We do this
1872135446Strhodes# after the libtool checking, so we can put the right suffix on
1873135446Strhodes# the files.  It also needs to come after checking for a Kame add-on,
1874135446Strhodes# which provides some (all?) of the desired functions.
1875135446Strhodes#
1876135446Strhodes
1877135446StrhodesAC_MSG_CHECKING([for inet_ntop with IPv6 support])
1878135446StrhodesAC_TRY_RUN([
1879135446Strhodes#include <sys/types.h>
1880135446Strhodes#include <sys/socket.h>
1881135446Strhodes#include <netinet/in.h>
1882135446Strhodes#include <arpa/inet.h>
1883135446Strhodesmain() {
1884135446Strhodeschar a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1885193149Sdougb	[AC_MSG_RESULT(yes)
1886193149Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1887135446Strhodes
1888193149Sdougb	[AC_MSG_RESULT(no)
1889193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1890193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1891193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1892225361Sdougb	[AC_MSG_RESULT(assuming inet_ntop not needed)
1893225361Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
1894135446Strhodes
1895135446Strhodes
1896135446Strhodes# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1897135446Strhodes# addresses with less than four octets, like "1.2.3".  Also leading
1898135446Strhodes# zeros should also be rejected.
1899135446Strhodes
1900135446StrhodesAC_MSG_CHECKING([for working inet_pton with IPv6 support])
1901135446StrhodesAC_TRY_RUN([
1902135446Strhodes#include <sys/types.h>
1903135446Strhodes#include <sys/socket.h>
1904135446Strhodes#include <netinet/in.h>
1905135446Strhodes#include <arpa/inet.h>
1906135446Strhodesmain() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1907135446Strhodes			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1908135446Strhodes			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1909193149Sdougb	[AC_MSG_RESULT(yes)
1910193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1911193149Sdougb	[AC_MSG_RESULT(no)
1912193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1913193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1914193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1915193149Sdougb	[AC_MSG_RESULT(assuming inet_pton needed)
1916193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1917193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1918225361Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
1919135446Strhodes
1920135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNTOP)
1921135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPTON)
1922135446Strhodes
1923135446Strhodes#
1924135446Strhodes# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1925135446Strhodes#
1926135446Strhodescase "$host" in
1927135446Strhodes	*-dec-osf*)
1928135446Strhodes		# Turn on 4.4BSD style sa_len support.
1929135446Strhodes		AC_DEFINE(_SOCKADDR_LEN)
1930135446Strhodes		;;
1931135446Strhodesesac
1932135446Strhodes
1933135446StrhodesAC_MSG_CHECKING(for sa_len in struct sockaddr)
1934135446StrhodesAC_TRY_COMPILE([
1935135446Strhodes#include <sys/types.h>
1936135446Strhodes#include <sys/socket.h>],
1937135446Strhodes[struct sockaddr sa; sa.sa_len = 0; return (0);],
1938135446Strhodes	[AC_MSG_RESULT(yes)
1939135446Strhodes	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1940135446Strhodes	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1941135446Strhodes	[AC_MSG_RESULT(no)
1942135446Strhodes	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1943135446Strhodes	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1944135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESALEN)
1945135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVESALEN)
1946135446Strhodes
1947135446Strhodes#
1948135446Strhodes# Look for a 4.4BSD or 4.3BSD struct msghdr
1949135446Strhodes#
1950135446StrhodesAC_MSG_CHECKING(for struct msghdr flavor)
1951135446StrhodesAC_TRY_COMPILE([
1952135446Strhodes#include <sys/types.h>
1953135446Strhodes#include <sys/socket.h>],
1954135446Strhodes[struct msghdr msg; msg.msg_flags = 0; return (0);],
1955135446Strhodes	[AC_MSG_RESULT(4.4BSD)
1956135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1957135446Strhodes	[AC_MSG_RESULT(4.3BSD)
1958135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1959135446StrhodesAC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1960135446Strhodes
1961135446Strhodes#
1962135446Strhodes# Look for in_port_t.
1963135446Strhodes#
1964135446StrhodesAC_MSG_CHECKING(for type in_port_t)
1965135446StrhodesAC_TRY_COMPILE([
1966135446Strhodes#include <sys/types.h>
1967135446Strhodes#include <netinet/in.h>],
1968135446Strhodes[in_port_t port = 25; return (0);],
1969135446Strhodes	[AC_MSG_RESULT(yes)
1970135446Strhodes	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1971193149Sdougb	[AC_MSG_RESULT(no)
1972135446Strhodes	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1973135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPORTT)
1974135446Strhodes
1975135446Strhodes#
1976135446Strhodes# Check for addrinfo
1977135446Strhodes#
1978135446StrhodesAC_MSG_CHECKING(for struct addrinfo)
1979135446StrhodesAC_TRY_COMPILE([
1980135446Strhodes#include <netdb.h>],
1981135446Strhodes[struct addrinfo a; return (0);],
1982135446Strhodes	[AC_MSG_RESULT(yes)
1983135446Strhodes	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
1984224092Sdougb	ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
1985135446Strhodes	AC_DEFINE(HAVE_ADDRINFO)],
1986135446Strhodes	[AC_MSG_RESULT(no)
1987224092Sdougb	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
1988224092Sdougb	ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
1989135446StrhodesAC_SUBST(ISC_LWRES_NEEDADDRINFO)
1990224092SdougbAC_SUBST(ISC_IRS_NEEDADDRINFO)
1991135446Strhodes
1992135446Strhodes#
1993135446Strhodes# Check for rrsetinfo
1994135446Strhodes#
1995135446StrhodesAC_MSG_CHECKING(for struct rrsetinfo)
1996135446StrhodesAC_TRY_COMPILE([
1997135446Strhodes#include <netdb.h>],
1998135446Strhodes[struct rrsetinfo r; return (0);],
1999135446Strhodes	[AC_MSG_RESULT(yes)
2000135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
2001135446Strhodes	[AC_MSG_RESULT(no)
2002135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
2003135446StrhodesAC_SUBST(ISC_LWRES_NEEDRRSETINFO)
2004135446Strhodes
2005135446StrhodesAC_MSG_CHECKING(for int sethostent)
2006135446StrhodesAC_TRY_COMPILE([
2007135446Strhodes#include <netdb.h>],
2008135446Strhodes[int i = sethostent(0); return(0);],
2009135446Strhodes	[AC_MSG_RESULT(yes)
2010135446Strhodes	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
2011135446Strhodes	[AC_MSG_RESULT(no)
2012135446Strhodes	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
2013135446StrhodesAC_SUBST(ISC_LWRES_SETHOSTENTINT)
2014135446Strhodes
2015135446StrhodesAC_MSG_CHECKING(for int endhostent)
2016135446StrhodesAC_TRY_COMPILE([
2017135446Strhodes#include <netdb.h>],
2018135446Strhodes[int i = endhostent(); return(0);],
2019135446Strhodes	[AC_MSG_RESULT(yes)
2020135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
2021135446Strhodes	[AC_MSG_RESULT(no)
2022135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
2023135446StrhodesAC_SUBST(ISC_LWRES_ENDHOSTENTINT)
2024135446Strhodes
2025135446StrhodesAC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
2026135446StrhodesAC_TRY_COMPILE([
2027135446Strhodes#include <netdb.h>
2028135446Strhodesstruct netent *getnetbyaddr(in_addr_t, int);],
2029135446Strhodes[],
2030135446Strhodes	[AC_MSG_RESULT(yes)
2031135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
2032135446Strhodes	[AC_MSG_RESULT(no)
2033135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
2034135446StrhodesAC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
2035135446Strhodes
2036135446StrhodesAC_MSG_CHECKING(for int setnetent)
2037135446StrhodesAC_TRY_COMPILE([
2038135446Strhodes#include <netdb.h>],
2039135446Strhodes[int i = setnetent(0); return(0);],
2040135446Strhodes	[AC_MSG_RESULT(yes)
2041135446Strhodes	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
2042135446Strhodes	[AC_MSG_RESULT(no)
2043135446Strhodes	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
2044135446StrhodesAC_SUBST(ISC_LWRES_SETNETENTINT)
2045135446Strhodes
2046135446StrhodesAC_MSG_CHECKING(for int endnetent)
2047135446StrhodesAC_TRY_COMPILE([
2048135446Strhodes#include <netdb.h>],
2049135446Strhodes[int i = endnetent(); return(0);],
2050135446Strhodes	[AC_MSG_RESULT(yes)
2051135446Strhodes	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
2052135446Strhodes	[AC_MSG_RESULT(no)
2053135446Strhodes	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
2054135446StrhodesAC_SUBST(ISC_LWRES_ENDNETENTINT)
2055135446Strhodes
2056135446StrhodesAC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
2057135446StrhodesAC_TRY_COMPILE([
2058135446Strhodes#include <netdb.h>
2059135446Strhodesstruct hostent *gethostbyaddr(const void *, size_t, int);],
2060135446Strhodes[return(0);],
2061135446Strhodes	[AC_MSG_RESULT(yes)
2062135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
2063135446Strhodes	[AC_MSG_RESULT(no)
2064135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
2065135446StrhodesAC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
2066135446Strhodes
2067135446StrhodesAC_MSG_CHECKING(for h_errno in netdb.h)
2068135446StrhodesAC_TRY_COMPILE([
2069135446Strhodes#include <netdb.h>],
2070135446Strhodes[h_errno = 1; return(0);],
2071135446Strhodes	[AC_MSG_RESULT(yes)
2072135446Strhodes	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
2073135446Strhodes	[AC_MSG_RESULT(no)
2074135446Strhodes	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
2075135446StrhodesAC_SUBST(ISC_LWRES_NEEDHERRNO)
2076135446Strhodes
2077224092Sdougb#
2078224092Sdougb# Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
2079224092Sdougb# known variations here:
2080224092Sdougb#
2081224092SdougbAC_MSG_CHECKING(for getnameinfo prototype definitions)
2082224092SdougbAC_TRY_COMPILE([
2083224092Sdougb#include <sys/types.h>
2084224092Sdougb#include <sys/socket.h>
2085224092Sdougb#include <netdb.h>
2086224092Sdougbint getnameinfo(const struct sockaddr *, socklen_t, char *,
2087224092Sdougb                socklen_t, char *, socklen_t, unsigned int);],
2088224092Sdougb[ return (0);],
2089224092Sdougb	[AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
2090224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
2091224092Sdougb		   [Define to the buffer length type used by getnameinfo(3).])
2092224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
2093224092Sdougb		   [Define to the flags type used by getnameinfo(3).])],
2094224092Sdougb[AC_TRY_COMPILE([
2095224092Sdougb#include <sys/types.h>
2096224092Sdougb#include <sys/socket.h>
2097224092Sdougb#include <netdb.h>
2098224092Sdougbint getnameinfo(const struct sockaddr *, socklen_t, char *,
2099224092Sdougb                size_t, char *, size_t, int);],
2100224092Sdougb[ return (0);],
2101224092Sdougb	[AC_MSG_RESULT(size_t for buflen; int for flags)
2102224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
2103224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
2104224092Sdougb[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2105224092SdougbAC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
2106224092SdougbAC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
2107224092Sdougb
2108224092Sdougb#
2109224092Sdougb# ...and same for gai_strerror().
2110224092Sdougb#
2111224092SdougbAC_MSG_CHECKING(for gai_strerror prototype definitions)
2112224092SdougbAC_TRY_COMPILE([
2113224092Sdougb#include <sys/types.h>
2114224092Sdougb#include <sys/socket.h>
2115224092Sdougb#include <netdb.h>
2116224092Sdougbchar *gai_strerror(int ecode);],
2117224092Sdougb[ return (0); ],
2118224092Sdougb	[AC_MSG_RESULT(returning char *)
2119224092Sdougb	 AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
2120224092Sdougb	 [return type of gai_strerror])],
2121224092Sdougb[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2122224092SdougbAC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
2123224092Sdougb
2124135446StrhodesAC_CHECK_FUNC(getipnodebyname,
2125193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
2126193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
2127135446StrhodesAC_CHECK_FUNC(getnameinfo,
2128193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
2129193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
2130135446StrhodesAC_CHECK_FUNC(getaddrinfo,
2131193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
2132135446Strhodes	AC_DEFINE(HAVE_GETADDRINFO)],
2133193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
2134135446StrhodesAC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
2135135446StrhodesAC_SUBST(ISC_LWRES_GETIPNODEPROTO)
2136135446StrhodesAC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
2137135446StrhodesAC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
2138224092SdougbAC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
2139135446Strhodes
2140135446StrhodesAC_ARG_ENABLE(getifaddrs,
2141204619Sdougb[  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
2142135446Strhodes    want_getifaddrs="$enableval",  want_getifaddrs="yes")
2143135446Strhodes
2144193149Sdougb#
2145193149Sdougb# This interface iteration code for getifaddrs() will fall back to using
2146193149Sdougb# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
2147193149Sdougb# addresses.
2148193149Sdougb# 
2149135446Strhodescase $want_getifaddrs in
2150193149Sdougbglibc)
2151193149SdougbAC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
2152193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2153135446Strhodes;;
2154193149Sdougbyes)
2155193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2156193149Sdougb;;
2157135446Strhodesno)
2158135446Strhodes;;
2159135446Strhodesesac
2160135446Strhodes
2161135446Strhodes#
2162135446Strhodes# Look for a sysctl call to get the list of network interfaces.
2163135446Strhodes#
2164135446Strhodescase $ac_cv_header_sys_sysctl_h in
2165135446Strhodesyes)
2166135446StrhodesAC_MSG_CHECKING(for interface list sysctl)
2167135446StrhodesAC_EGREP_CPP(found_rt_iflist, [
2168135446Strhodes#include <sys/param.h>
2169135446Strhodes#include <sys/sysctl.h>
2170135446Strhodes#include <sys/socket.h>
2171135446Strhodes#ifdef NET_RT_IFLIST
2172135446Strhodesfound_rt_iflist
2173135446Strhodes#endif
2174135446Strhodes],
2175135446Strhodes	[AC_MSG_RESULT(yes)
2176135446Strhodes	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
2177135446Strhodes	[AC_MSG_RESULT(no)])
2178135446Strhodes;;
2179135446Strhodesesac
2180135446Strhodes
2181135446Strhodes#
2182135446Strhodes# Check for some other useful functions that are not ever-present.
2183135446Strhodes#
2184135446Strhodes
2185135446Strhodes# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
2186135446Strhodes# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
2187135446Strhodes# reportedly defines strsep() without declaring it in <string.h> when
2188135446Strhodes# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
2189135446Strhodes# AC_CHECK_FUNC() incorrectly succeeds because it declares
2190135446Strhodes# the function itself.
2191135446StrhodesAC_MSG_CHECKING(for correctly declared strsep())
2192135446StrhodesAC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
2193135446Strhodes	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
2194135446Strhodes	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
2195135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
2196135446Strhodes
2197135446StrhodesAC_CHECK_FUNC(memmove,
2198135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
2199135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
2200135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
2201135446Strhodes
2202135446StrhodesAC_CHECK_FUNC(strtoul,
2203153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
2204165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
2205153816Sdougb	 GENRANDOMLIB=""],
2206153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
2207165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
2208165071Sdougb	 GENRANDOMLIB='${ISCLIBS}'])
2209135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
2210153816SdougbAC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
2211153816SdougbAC_SUBST(GENRANDOMLIB)
2212135446Strhodes
2213135446StrhodesAC_CHECK_FUNC(strlcpy,
2214135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
2215135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
2216135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
2217135446Strhodes
2218135446StrhodesAC_CHECK_FUNC(strlcat,
2219135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
2220135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
2221135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
2222135446Strhodes
2223135446StrhodesISC_PRINT_OBJS=
2224135446StrhodesISC_PRINT_SRCS=
2225135446StrhodesAC_MSG_CHECKING(sprintf)
2226135446StrhodesAC_TRY_COMPILE([
2227135446Strhodes#include <stdio.h>
2228135446Strhodes],
2229135446Strhodes[ char buf[2]; return(*sprintf(buf,"x"));],
2230135446Strhodes[
2231135446StrhodesISC_PRINT_OBJS="print.$O"
2232135446StrhodesISC_PRINT_SRCS="print.c"
2233135446StrhodesISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
2234135446StrhodesLWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
2235135446Strhodes],
2236135446Strhodes[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
2237135446Strhodes LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
2238135446Strhodes)
2239135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
2240135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
2241135446Strhodes
2242135446StrhodesAC_CHECK_FUNC(vsnprintf,
2243135446Strhodes	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
2244135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
2245135446Strhodes	[ISC_PRINT_OBJS="print.$O"
2246135446Strhodes	 ISC_PRINT_SRCS="print.c"
2247135446Strhodes	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
2248135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
2249135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
2250135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
2251135446StrhodesISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
2252135446StrhodesISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
2253135446Strhodes
2254135446StrhodesAC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
2255135446Strhodes
2256135446StrhodesAC_SUBST(ISC_EXTRA_OBJS)
2257135446StrhodesAC_SUBST(ISC_EXTRA_SRCS)
2258135446Strhodes
2259193149Sdougb#
2260193149Sdougb# Use our own SPNEGO implementation?
2261193149Sdougb#
2262193149SdougbAC_ARG_ENABLE(isc-spnego,
2263204619Sdougb	[  --disable-isc-spnego    use SPNEGO from GSSAPI library])
2264193149Sdougb
2265193149Sdougbif test -n "$USE_GSSAPI"
2266193149Sdougbthen
2267193149Sdougb	case "$enable_isc_spnego" in
2268193149Sdougb		yes|'')
2269193149Sdougb			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
2270193149Sdougb			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
2271193149Sdougb			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
2272193149Sdougb			AC_MSG_RESULT(using SPNEGO from lib/dns)
2273193149Sdougb			;;
2274193149Sdougb		no)
2275193149Sdougb			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
2276193149Sdougb			;;
2277193149Sdougb	esac
2278193149Sdougbfi
2279193149Sdougb
2280193149SdougbAC_SUBST(USE_ISC_SPNEGO)
2281193149Sdougb
2282193149SdougbAC_SUBST(DST_EXTRA_OBJS)
2283193149SdougbAC_SUBST(DST_EXTRA_SRCS)
2284193149Sdougb
2285135446Strhodes# Determine the printf format characters to use when printing
2286135446Strhodes# values of type isc_int64_t. This will normally be "ll", but where
2287135446Strhodes# the compiler treats "long long" as a alias for "long" and printf
2288135446Strhodes# doesn't know about "long long" use "l".  Hopefully the sprintf
2289193149Sdougb# will produce a inconsistent result in the later case.  If the compiler
2290135446Strhodes# fails due to seeing "%lld" we fall back to "l".
2291135446Strhodes#
2292153816Sdougb# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
2293153816Sdougb# %ld even for (long long)/
2294153816Sdougb#
2295135446Strhodes# Win32 uses "%I64d", but that's defined elsewhere since we don't use
2296135446Strhodes# configure on Win32.
2297135446Strhodes#
2298135446StrhodesAC_MSG_CHECKING(printf format modifier for 64-bit integers)
2299135446StrhodesAC_TRY_RUN([
2300135446Strhodes#include <stdio.h>
2301135446Strhodesmain() {
2302135446Strhodes	long long int j = 0;
2303135446Strhodes	char buf[100];
2304135446Strhodes	buf[0] = 0;
2305135446Strhodes	sprintf(buf, "%lld", j);
2306135446Strhodes	exit((sizeof(long long int) != sizeof(long int))? 0 :
2307135446Strhodes	     (strcmp(buf, "0") != 0));
2308135446Strhodes} 
2309135446Strhodes],
2310135446Strhodes	[AC_MSG_RESULT(ll)
2311153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2312153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
2313135446Strhodes	[AC_MSG_RESULT(l)
2314153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
2315153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
2316135446Strhodes	[AC_MSG_RESULT(assuming target platform uses ll)
2317153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2318153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
2319135446StrhodesAC_SUBST(ISC_PLATFORM_QUADFORMAT)
2320153816SdougbAC_SUBST(LWRES_PLATFORM_QUADFORMAT)
2321135446Strhodes
2322135446Strhodes#
2323135446Strhodes# Security Stuff
2324135446Strhodes#
2325193149Sdougb# Note it is very recommended to *not* disable chroot(),
2326193149Sdougb# this is only because chroot() was made obsolete by Posix.
2327193149SdougbAC_ARG_ENABLE(chroot,
2328204619Sdougb	[  --disable-chroot        disable chroot])
2329193149Sdougbcase "$enable_chroot" in
2330193149Sdougb	yes|'')
2331193149Sdougb		AC_CHECK_FUNCS(chroot)
2332193149Sdougb		;;
2333193149Sdougb	no)
2334193149Sdougb		;;
2335193149Sdougbesac
2336135446StrhodesAC_ARG_ENABLE(linux-caps,
2337204619Sdougb	[  --disable-linux-caps	  disable linux capabilities])
2338135446Strhodescase "$enable_linux_caps" in
2339135446Strhodes	yes|'')
2340186462Sdougb		AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
2341193149Sdougb		AC_CHECK_LIB(cap, cap_set_proc)
2342135446Strhodes		;;
2343135446Strhodes	no)
2344135446Strhodes		;;
2345135446Strhodesesac
2346135446StrhodesAC_CHECK_HEADERS(sys/prctl.h)
2347135446Strhodes
2348170222SdougbAC_CHECK_HEADERS(sys/un.h,
2349170222SdougbISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
2350170222Sdougb,
2351170222SdougbISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2352170222Sdougb)
2353170222SdougbAC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2354170222Sdougb
2355170222Sdougbcase "$host" in
2356170222Sdougb*-solaris*)
2357170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2358170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2359170222Sdougb	;;
2360170222Sdougb*-sunos*)
2361170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2362170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2363170222Sdougb	;;
2364170222Sdougbesac
2365170222Sdougb
2366135446Strhodes#
2367135446Strhodes# Time Zone Stuff
2368135446Strhodes#
2369135446StrhodesAC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2370135446Strhodes
2371193149SdougbAC_MSG_CHECKING(for optarg declaration)
2372153816SdougbAC_TRY_COMPILE([
2373153816Sdougb#include <unistd.h>
2374153816Sdougb],
2375153816Sdougb[optarg = 0;],
2376153816Sdougb[AC_MSG_RESULT(yes)],
2377153816Sdougb[AC_MSG_RESULT(no)
2378165071SdougbGEN_NEED_OPTARG="-DNEED_OPTARG=1"
2379153816SdougbAC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2380153816Sdougb
2381135446Strhodes#
2382135446Strhodes# BSD/OS, and perhaps some others, don't define rlim_t.
2383135446Strhodes#
2384135446StrhodesAC_MSG_CHECKING(for type rlim_t)
2385135446StrhodesAC_TRY_COMPILE([
2386135446Strhodes#include <sys/types.h>
2387135446Strhodes#include <sys/time.h>
2388135446Strhodes#include <sys/resource.h>],
2389135446Strhodes[rlim_t rl = 19671212; return (0);],
2390135446Strhodes[AC_MSG_RESULT(yes)
2391135446Strhodes ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2392135446Strhodes[AC_MSG_RESULT(no)
2393135446Strhodes
2394135446StrhodesAC_MSG_CHECKING(type of rlim_cur)
2395135446StrhodesAC_TRY_RUN([
2396135446Strhodes#include <sys/types.h>
2397135446Strhodes#include <sys/time.h>
2398135446Strhodes#include <sys/resource.h>
2399135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2400135446Strhodes[AC_MSG_RESULT(int)
2401135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2402135446Strhodes[
2403135446StrhodesAC_TRY_RUN([
2404135446Strhodes#include <sys/types.h>
2405135446Strhodes#include <sys/time.h>
2406135446Strhodes#include <sys/resource.h>
2407135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2408135446Strhodes[AC_MSG_RESULT(long int)
2409135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2410135446Strhodes[
2411135446StrhodesAC_TRY_RUN([
2412135446Strhodes#include <sys/types.h>
2413135446Strhodes#include <sys/time.h>
2414135446Strhodes#include <sys/resource.h>
2415135446Strhodesmain() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2416135446Strhodes[AC_MSG_RESULT(long long int)
2417135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2418135446Strhodes[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2419135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2420135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2421153816Sdougb],[
2422225361SdougbAC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
2423225361SdougbISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
2424225361SdougbAC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
2425135446Strhodes])
2426135446StrhodesAC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2427135446Strhodes
2428135446Strhodes#
2429186462Sdougb# Older HP-UX doesn't have gettune
2430186462Sdougb#
2431186462Sdougbcase "$host" in
2432186462Sdougb  	*-hp-hpux*)
2433186462Sdougb		AC_CHECK_HEADERS(sys/dyntune.h)
2434186462Sdougb		;;
2435186462Sdougb	*)
2436186462Sdougb		;;
2437186462Sdougbesac
2438186462Sdougb
2439186462Sdougb
2440186462Sdougb#
2441135446Strhodes# Compaq TruCluster requires more code for handling cluster IP aliases
2442135446Strhodes#
2443135446Strhodescase "$host" in
2444135446Strhodes	*-dec-osf*)
2445135446Strhodes		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2446135446Strhodes		AC_CHECK_FUNC(clua_getaliasaddress,
2447135446Strhodes				AC_DEFINE(HAVE_TRUCLUSTER, 1,
2448135446Strhodes					[Define if running under Compaq TruCluster]))
2449135446Strhodes		;;
2450135446Strhodes	*)
2451135446Strhodes		;;
2452135446Strhodesesac
2453135446Strhodes
2454135446Strhodes#
2455165071Sdougb# Some hosts need msg_namelen to match the size of the socket structure.
2456165071Sdougb# Some hosts don't set msg_namelen appropriately on return from recvmsg().
2457165071Sdougb#
2458165071Sdougbcase $host in
2459165071Sdougb*os2*|*hp-mpeix*)
2460165071Sdougb	AC_DEFINE(BROKEN_RECVMSG, 1,
2461165071Sdougb		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2462165071Sdougb	;;
2463165071Sdougbesac
2464165071Sdougb
2465165071Sdougb#
2466135446Strhodes# Microsoft has their own way of handling shared libraries that requires
2467135446Strhodes# additional qualifiers on extern variables.  Unix systems don't need it.
2468135446Strhodes#
2469135446StrhodesAC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2470135446StrhodesISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2471135446StrhodesAC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2472135446StrhodesLWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2473224092SdougbAC_SUBST(IRS_PLATFORM_USEDECLSPEC)
2474224092SdougbIRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
2475135446Strhodes
2476135446Strhodes#
2477135446Strhodes# Random remaining OS-specific issues involving compiler warnings.
2478135446Strhodes# XXXDCL print messages to indicate some compensation is being done?
2479135446Strhodes#
2480135446StrhodesAC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2481135446StrhodesISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2482135446Strhodes
2483135446Strhodescase "$host" in
2484165071Sdougb	*-aix5.[[123]].*)
2485143731Sdougb		hack_shutup_pthreadonceinit=yes
2486143731Sdougb		;;
2487135446Strhodes	*-bsdi3.1*)
2488135446Strhodes		hack_shutup_sputaux=yes
2489135446Strhodes		;;
2490135446Strhodes	*-bsdi4.0*)
2491135446Strhodes		hack_shutup_sigwait=yes
2492135446Strhodes		hack_shutup_sputaux=yes
2493135446Strhodes		;;
2494135446Strhodes	[*-bsdi4.[12]*])
2495135446Strhodes		hack_shutup_stdargcast=yes
2496135446Strhodes		;;
2497135446Strhodes	[*-solaris2.[89]])
2498135446Strhodes		hack_shutup_pthreadonceinit=yes
2499135446Strhodes		;;
2500186462Sdougb	*-solaris2.1[[0-9]])
2501193149Sdougb		AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2502165071Sdougb		;;
2503135446Strhodesesac
2504135446Strhodes
2505135446Strhodescase "$hack_shutup_pthreadonceinit" in
2506135446Strhodes	yes)
2507135446Strhodes		#
2508135446Strhodes		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2509135446Strhodes		#
2510135446Strhodes		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2511135446Strhodes		;;
2512135446Strhodesesac
2513135446Strhodes
2514135446Strhodescase "$hack_shutup_sigwait" in
2515135446Strhodes	yes)
2516135446Strhodes		#
2517135446Strhodes		# Shut up a -Wmissing-prototypes warning for sigwait().
2518135446Strhodes		#
2519135446Strhodes		AC_DEFINE(SHUTUP_SIGWAIT)
2520135446Strhodes		;;
2521135446Strhodesesac
2522135446Strhodes
2523135446Strhodescase "$hack_shutup_sputaux" in
2524135446Strhodes	yes)
2525135446Strhodes		#
2526135446Strhodes		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
2527135446Strhodes		#
2528135446Strhodes		AC_DEFINE(SHUTUP_SPUTAUX)
2529135446Strhodes		;;
2530135446Strhodesesac
2531135446Strhodes
2532135446Strhodescase "$hack_shutup_stdargcast" in
2533135446Strhodes	yes)
2534135446Strhodes		#
2535135446Strhodes		# Shut up a -Wcast-qual warning from va_start().
2536135446Strhodes		#
2537135446Strhodes		AC_DEFINE(SHUTUP_STDARG_CAST)
2538135446Strhodes		;;
2539135446Strhodesesac
2540135446Strhodes
2541174187SdougbAC_CHECK_HEADERS(strings.h,
2542174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2543174187Sdougb,
2544174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2545174187Sdougb)
2546174187SdougbAC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2547174187Sdougb
2548135446Strhodes#
2549135446Strhodes# Check for if_nametoindex() for IPv6 scoped addresses support
2550135446Strhodes#
2551135446StrhodesAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2552135446Strhodes		ac_cv_have_if_nametoindex=no)
2553135446Strhodescase $ac_cv_have_if_nametoindex in
2554135446Strhodesno)
2555135446Strhodes	case "$host" in
2556193149Sdougb	*-hp-hpux*)
2557193149Sdougb		AC_CHECK_LIB(ipv6, if_nametoindex,
2558135446Strhodes				ac_cv_have_if_nametoindex=yes
2559135446Strhodes				LIBS="-lipv6 $LIBS",)
2560193149Sdougb	;;
2561135446Strhodes	esac
2562135446Strhodesesac
2563135446Strhodescase $ac_cv_have_if_nametoindex in
2564135446Strhodesyes)
2565135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2566135446Strhodes	;;
2567135446Strhodes*)
2568135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2569135446Strhodes	;;
2570135446Strhodesesac
2571135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2572135446Strhodes
2573193149SdougbAC_CHECK_FUNCS(nanosleep)
2574193149Sdougb
2575135446Strhodes#
2576170222Sdougb# Machine architecture dependent features
2577170222Sdougb#
2578170222SdougbAC_ARG_ENABLE(atomic,
2579204619Sdougb	[  --enable-atomic	  enable machine specific atomic operations
2580204619Sdougb			  [[default=autodetect]]],
2581170222Sdougb			enable_atomic="$enableval",
2582170222Sdougb			enable_atomic="autodetect")
2583170222Sdougbcase "$enable_atomic" in
2584170222Sdougb	yes|''|autodetect)
2585204619Sdougb		case "$host" in
2586204619Sdougb		powerpc-ibm-aix*)
2587204619Sdougb			if test "X$GCC" = "Xyes"; then
2588204619Sdougb				AC_MSG_CHECKING([if asm("isc"); works])
2589204619Sdougb				AC_TRY_COMPILE(,[
2590204619Sdougb				main() { asm("ics"); exit(0); }
2591204619Sdougb				],
2592204619Sdougb				[AC_MSG_RESULT(yes)
2593204619Sdougb				 use_atomic=yes],
2594204619Sdougb				[
2595204619Sdougb				saved_cflags="$CFLAGS"
2596204619Sdougb				CFLAGS="$CFLAGS -Wa,-many"
2597204619Sdougb				AC_TRY_RUN([
2598204619Sdougb				main() { asm("ics"); exit(0); }
2599204619Sdougb				],
2600204619Sdougb				[AC_MSG_RESULT([yes, required -Wa,-many])
2601204619Sdougb				 use_atomic=yes],
2602204619Sdougb				[AC_MSG_RESULT([no, use_atomic disabled])
2603204619Sdougb				 CFLAGS="$saved_cflags"
2604204619Sdougb				 use_atomic=no],
2605204619Sdougb				[AC_MSG_RESULT([cross compile, assume yes])
2606204619Sdougb				 CFLAGS="$saved_cflags"
2607204619Sdougb				 use_atomic=yes])
2608204619Sdougb				]
2609204619Sdougb				)
2610218384Sdougb			else
2611218384Sdougb				use_atomic=yes
2612204619Sdougb			fi
2613204619Sdougb			;;
2614204619Sdougb		*)
2615204619Sdougb			use_atomic=yes
2616204619Sdougb			;;
2617204619Sdougb		esac
2618170222Sdougb		;;
2619170222Sdougb	no)
2620170222Sdougb		use_atomic=no
2621170222Sdougb		arch=noatomic
2622170222Sdougb		;;
2623170222Sdougbesac
2624170222Sdougb
2625170222SdougbISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2626170222Sdougbif test "$use_atomic" = "yes"; then
2627170222Sdougb	AC_MSG_CHECKING([architecture type for atomic operations])
2628170222Sdougb	have_atomic=yes		# set default
2629170222Sdougb	case "$host" in
2630170222Sdougb	[i[3456]86-*])
2631170222Sdougb		# XXX: some old x86 architectures actually do not support
2632170222Sdougb		#      (some of) these operations.  Do we need stricter checks?
2633225361Sdougb                AC_CHECK_SIZEOF([void *])
2634225361Sdougb		if test $ac_cv_sizeof_void_p = 8; then
2635225361Sdougb			arch=x86_64
2636225361Sdougb			have_xaddq=yes
2637225361Sdougb		else
2638225361Sdougb			arch=x86_32
2639225361Sdougb		fi
2640170222Sdougb	;;
2641193149Sdougb	x86_64-*|amd64-*)
2642225361Sdougb                AC_CHECK_SIZEOF([void *])
2643225361Sdougb		if test $ac_cv_sizeof_void_p = 8; then
2644225361Sdougb			arch=x86_64
2645225361Sdougb			have_xaddq=yes
2646225361Sdougb		else
2647225361Sdougb			arch=x86_32
2648225361Sdougb		fi
2649170222Sdougb	;;
2650170222Sdougb	alpha*-*)
2651170222Sdougb		arch=alpha
2652170222Sdougb	;;
2653218384Sdougb	powerpc-*|powerpc64-*)
2654170222Sdougb		arch=powerpc
2655170222Sdougb	;;
2656170222Sdougb	mips-*|mipsel-*|mips64-*|mips64el-*)
2657170222Sdougb		arch=mips
2658170222Sdougb	;;
2659170222Sdougb	ia64-*)
2660170222Sdougb		arch=ia64
2661170222Sdougb	;;
2662170222Sdougb	*)
2663170222Sdougb		have_atomic=no
2664170222Sdougb		arch=noatomic
2665170222Sdougb	;;
2666170222Sdougb	esac
2667170222Sdougb	AC_MSG_RESULT($arch)
2668170222Sdougbfi
2669170222Sdougb
2670170222Sdougbif test "$have_atomic" = "yes"; then
2671170222Sdougb	AC_MSG_CHECKING([compiler support for inline assembly code])
2672170222Sdougb
2673170222Sdougb	compiler=generic
2674170222Sdougb	# Check whether the compiler supports the assembly syntax we provide.
2675170222Sdougb	if test "X$GCC" = "Xyes"; then
2676170222Sdougb		# GCC's ASM extension always works
2677170222Sdougb		compiler=gcc
2678170222Sdougb		if test $arch = "x86_64"; then
2679170222Sdougb			# We can share the same code for gcc with x86_32
2680170222Sdougb			arch=x86_32
2681170222Sdougb		fi
2682170222Sdougb		if test $arch = "powerpc"; then
2683170222Sdougb			#
2684170222Sdougb			# The MacOS (and maybe others) uses "r0" for register
2685170222Sdougb			# zero. Under linux/ibm it is "0" for register 0.
2686170222Sdougb			# Probe to see if we have a MacOS style assembler.
2687170222Sdougb			#
2688170222Sdougb			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2689170222Sdougb			AC_TRY_COMPILE(, [
2690170222Sdougb			__asm__ volatile ("li r0, 0x0\n"::);
2691170222Sdougb			], [
2692170222Sdougb			AC_MSG_RESULT(yes)
2693170222Sdougb			compiler="mac"
2694170222Sdougb			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2695170222Sdougb			], [AC_MSG_RESULT(no)])
2696170222Sdougb		fi
2697170222Sdougb	else
2698170222Sdougb		case "$host" in
2699170222Sdougb		alpha*-dec-osf*)
2700170222Sdougb			# Tru64 compiler has its own syntax for inline 
2701170222Sdougb			# assembly.
2702170222Sdougb			AC_TRY_COMPILE(, [
2703170222Sdougb#ifndef __DECC
2704170222Sdougb#error "unexpected compiler"
2705170222Sdougb#endif
2706170222Sdougb				return (0);],
2707170222Sdougb				[compiler=osf],)
2708170222Sdougb		;;
2709170222Sdougb		powerpc-ibm-aix*)
2710170222Sdougb			compiler=aix
2711170222Sdougb		;;
2712170222Sdougb		esac
2713170222Sdougb	fi
2714170222Sdougb	case "$compiler" in
2715170222Sdougb	gcc)
2716170222Sdougb		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2717170222Sdougb		;;
2718170222Sdougb	osf)
2719170222Sdougb		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2720170222Sdougb		;;
2721170222Sdougb	aix)
2722170222Sdougb		;;
2723170222Sdougb	mac)
2724170222Sdougb		;;
2725170222Sdougb	*)
2726170222Sdougb		# See if the generic __asm function works.  If not,
2727170222Sdougb		# we need to disable the atomic operations.
2728170222Sdougb		AC_TRY_LINK(, [
2729170222Sdougb					__asm("nop")
2730170222Sdougb				],
2731170222Sdougb		[compiler="standard"
2732170222Sdougb		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2733170222Sdougb		[compiler="not supported (atomic operations disabled)"
2734170222Sdougb		have_atomic=no
2735170222Sdougb		arch=noatomic ]);
2736170222Sdougb		;;
2737170222Sdougb	esac
2738170222Sdougb
2739170222Sdougb	AC_MSG_RESULT($compiler)
2740170222Sdougbfi
2741170222Sdougb
2742170222Sdougbif test "$have_atomic" = "yes"; then
2743170222Sdougb	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2744170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2745170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2746170222Sdougbelse
2747170222Sdougb	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2748170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2749170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2750170222Sdougbfi
2751170222Sdougb
2752193149Sdougbif test "$have_xaddq" = "yes"; then
2753204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
2754193149Sdougbelse
2755204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
2756193149Sdougbfi
2757193149Sdougb
2758170222SdougbAC_SUBST(ISC_PLATFORM_HAVEXADD)
2759193149SdougbAC_SUBST(ISC_PLATFORM_HAVEXADDQ)
2760170222SdougbAC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2761170222SdougbAC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2762170222Sdougb
2763170222SdougbAC_SUBST(ISC_PLATFORM_USEGCCASM)
2764170222SdougbAC_SUBST(ISC_PLATFORM_USEOSFASM)
2765170222SdougbAC_SUBST(ISC_PLATFORM_USESTDASM)
2766170222SdougbAC_SUBST(ISC_PLATFORM_USEMACASM)
2767170222Sdougb
2768170222SdougbISC_ARCH_DIR=$arch
2769170222SdougbAC_SUBST(ISC_ARCH_DIR)
2770170222Sdougb
2771170222Sdougb#
2772193149Sdougb# Activate "rrset-order fixed" or not?
2773193149Sdougb#
2774193149SdougbAC_ARG_ENABLE(fixed-rrset,
2775204619Sdougb	[  --enable-fixed-rrset    enable fixed rrset ordering
2776204619Sdougb			  [[default=no]]],
2777193149Sdougb			enable_fixed="$enableval",
2778193149Sdougb			enable_fixed="no")
2779193149Sdougbcase "$enable_fixed" in
2780193149Sdougb	yes)
2781193149Sdougb		AC_DEFINE(DNS_RDATASET_FIXED, 1,
2782204619Sdougb			  [Define to enable "rrset-order fixed" syntax.])
2783193149Sdougb		;;
2784193149Sdougb	no)
2785193149Sdougb		;;
2786193149Sdougb	*)
2787193149Sdougb		;;
2788193149Sdougbesac
2789193149Sdougb
2790193149Sdougb#
2791224092Sdougb# Enable response policy rewriting using NS IP addresses
2792224092Sdougb#
2793224092SdougbAC_ARG_ENABLE(rpz-nsip,
2794224092Sdougb	[  --enable-rpz-nsip	  enable rpz-nsip rules [[default=no]]],
2795224092Sdougb			enable_nsip="$enableval",
2796224092Sdougb			enable_nsip="no")
2797224092Sdougbcase "$enable_nsip" in
2798224092Sdougb	yes)
2799224092Sdougb		AC_DEFINE(ENABLE_RPZ_NSIP, 1,
2800224092Sdougb			  [Define to enable rpz-nsip rules.])
2801224092Sdougb		;;
2802224092Sdougb	no)
2803224092Sdougb		;;
2804224092Sdougb	*)
2805224092Sdougb		;;
2806224092Sdougbesac
2807224092Sdougb
2808224092Sdougb#
2809224092Sdougb# Enable response policy rewriting using NS name
2810224092Sdougb#
2811224092SdougbAC_ARG_ENABLE(rpz-nsdname,
2812224092Sdougb	[  --enable-rpz-nsdname	  enable rpz-nsdname rules [[default=no]]],
2813224092Sdougb			enable_nsdname="$enableval",
2814224092Sdougb			enable_nsdname="no")
2815224092Sdougbcase "$enable_nsdname" in
2816224092Sdougb	yes)
2817224092Sdougb		AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
2818224092Sdougb			  [Define to enable rpz-nsdname rules.])
2819224092Sdougb		;;
2820224092Sdougb	no)
2821224092Sdougb		;;
2822224092Sdougb	*)
2823224092Sdougb		;;
2824224092Sdougbesac
2825224092Sdougb
2826224092Sdougb#
2827224092Sdougb# Activate "filter-aaaa-on-v4" or not?
2828224092Sdougb#
2829224092SdougbAC_ARG_ENABLE(filter-aaaa,
2830224092Sdougb	[  --enable-filter-aaaa    enable filtering of AAAA records over IPv4
2831224092Sdougb			  [[default=no]]],
2832224092Sdougb			enable_filter="$enableval",
2833224092Sdougb			enable_filter="no")
2834224092Sdougbcase "$enable_filter" in
2835224092Sdougb	yes)
2836224092Sdougb		AC_DEFINE(ALLOW_FILTER_AAAA_ON_V4, 1,
2837224092Sdougb			  [Define to enable the "filter-aaaa-on-v4" option.])
2838224092Sdougb		;;
2839224092Sdougb	no)
2840224092Sdougb		;;
2841224092Sdougb	*)
2842224092Sdougb		;;
2843224092Sdougbesac
2844224092Sdougb
2845224092Sdougb#
2846153816Sdougb#  The following sets up how non-blocking i/o is established.
2847153816Sdougb#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
2848153816Sdougb#
2849153816Sdougbcase "$host" in
2850153816Sdougb*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2851153816Sdougb*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2852153816Sdougb*-solaris2.[[01234]])
2853153816Sdougb	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2854153816Sdougb	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2855153816Sdougb		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2856153816Sdougb	;;
2857153816Sdougb*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2858153816Sdougb	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2859153816Sdougb	;;
2860153816Sdougbesac
2861153816Sdougb#
2862165071Sdougb# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2863165071Sdougb# This prevents the source address being set.
2864165071Sdougb#
2865165071Sdougbcase "$host" in
2866165071Sdougb*-solaris2.[[012345]]|*-solaris2.5.1)
2867165071Sdougb	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2868165071Sdougb		  [Define if you cannot bind() before connect() for TCP sockets.])
2869165071Sdougb	;;
2870165071Sdougbesac
2871165071Sdougb#
2872135446Strhodes# The following sections deal with tools used for formatting
2873135446Strhodes# the documentation.  They are all optional, unless you are
2874135446Strhodes# a developer editing the documentation source.
2875135446Strhodes#
2876135446Strhodes
2877153816Sdougb#
2878153816Sdougb# Look for TeX.
2879153816Sdougb#
2880135446Strhodes
2881153816SdougbAC_PATH_PROGS(LATEX, latex, latex)
2882153816SdougbAC_SUBST(LATEX)
2883153816Sdougb
2884153816SdougbAC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2885153816SdougbAC_SUBST(PDFLATEX)
2886153816Sdougb
2887135446Strhodes#
2888170222Sdougb# Look for w3m
2889170222Sdougb#
2890170222Sdougb
2891170222SdougbAC_PATH_PROGS(W3M, w3m, w3m)
2892170222SdougbAC_SUBST(W3M)
2893170222Sdougb
2894170222Sdougb#
2895153816Sdougb# Look for xsltproc (libxslt)
2896135446Strhodes#
2897135446Strhodes
2898153816SdougbAC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2899153816SdougbAC_SUBST(XSLTPROC)
2900135446Strhodes
2901135446Strhodes#
2902153816Sdougb# Look for xmllint (libxml2)
2903135446Strhodes#
2904135446Strhodes
2905153816SdougbAC_PATH_PROG(XMLLINT, xmllint, xmllint)
2906153816SdougbAC_SUBST(XMLLINT)
2907135446Strhodes
2908135446Strhodes#
2909193149Sdougb# Look for Doxygen
2910193149Sdougb#
2911193149Sdougb
2912193149SdougbAC_PATH_PROG(DOXYGEN, doxygen, doxygen)
2913193149SdougbAC_SUBST(DOXYGEN)
2914193149Sdougb
2915193149Sdougb#
2916135446Strhodes# Subroutine for searching for an ordinary file (e.g., a stylesheet)
2917135446Strhodes# in a number of directories:
2918135446Strhodes#
2919135446Strhodes#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2920135446Strhodes#
2921135446Strhodes# If the file FILENAME is found in one of the DIRECTORIES, the shell
2922135446Strhodes# variable VARIABLE is defined to its absolute pathname.  Otherwise, 
2923135446Strhodes# it is set to FILENAME, with no directory prefix (that's not terribly
2924135446Strhodes# useful, but looks less confusing in substitutions than leaving it
2925135446Strhodes# empty).  The variable VARIABLE will be substituted into output files.
2926135446Strhodes# 
2927135446Strhodes
2928135446StrhodesAC_DEFUN(NOM_PATH_FILE, [
2929135446Strhodes$1=""
2930135446StrhodesAC_MSG_CHECKING(for $2)
2931135446Strhodesfor d in $3
2932135446Strhodesdo
2933135446Strhodes	f=$d/$2
2934135446Strhodes	if test -f $f
2935135446Strhodes	then
2936135446Strhodes		$1=$f
2937135446Strhodes		AC_MSG_RESULT($f)
2938135446Strhodes		break
2939135446Strhodes	fi
2940135446Strhodesdone
2941135446Strhodesif test "X[$]$1" = "X"
2942135446Strhodesthen
2943135446Strhodes	AC_MSG_RESULT("not found");
2944135446Strhodes	$1=$2
2945135446Strhodesfi
2946135446StrhodesAC_SUBST($1)
2947135446Strhodes])
2948135446Strhodes
2949135446Strhodes#
2950186462Sdougb# Look for Docbook-XSL stylesheets.  Location probably varies by system.
2951186462Sdougb# If it's not explicitly specified, guess where it might be found, based on
2952186462Sdougb# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2953186462Sdougb# of at the moment).
2954135446Strhodes#
2955186462SdougbAC_MSG_CHECKING(for Docbook-XSL path)
2956186462SdougbAC_ARG_WITH(docbook-xsl,
2957204619Sdougb[  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
2958186462Sdougb   docbook_path="$withval", docbook_path="auto")
2959186462Sdougbcase "$docbook_path" in
2960186462Sdougbauto)
2961186462Sdougb	AC_MSG_RESULT(auto)
2962186462Sdougb	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
2963186462Sdougb	;;
2964186462Sdougb*)
2965186462Sdougb	docbook_xsl_trees="$withval"
2966186462Sdougb    	AC_MSG_RESULT($docbook_xsl_trees)
2967186462Sdougb	;;
2968186462Sdougbesac
2969153816Sdougb
2970135446Strhodes#
2971153816Sdougb# Look for stylesheets we need.
2972153816Sdougb#
2973135446Strhodes
2974186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
2975186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
2976186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
2977186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
2978186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
2979186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
2980186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
2981186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
2982186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
2983153816Sdougb
2984135446Strhodes#
2985153816Sdougb# Same dance for db2latex
2986135446Strhodes#
2987153816Sdougb# No idea where this lives except on FreeBSD.
2988135446Strhodes#
2989135446Strhodes
2990153816Sdougbdb2latex_xsl_trees="/usr/local/share"
2991135446Strhodes
2992135446Strhodes#
2993153816Sdougb# Look for stylesheets we need.
2994135446Strhodes#
2995135446Strhodes
2996153816SdougbNOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
2997135446Strhodes
2998135446Strhodes#
2999153816Sdougb# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
3000153816Sdougb# because it's a directory, so just do the same things, inline.
3001135446Strhodes#
3002135446Strhodes
3003153816SdougbAC_MSG_CHECKING(for db2latex/xsl/figures)
3004153816Sdougbfor d in $db2latex_xsl_trees
3005153816Sdougbdo
3006153816Sdougb	dd=$d/db2latex/xsl/figures
3007153816Sdougb	if test -d $dd
3008153816Sdougb	then
3009153816Sdougb		XSLT_DB2LATEX_ADMONITIONS=$dd
3010153816Sdougb		AC_MSG_RESULT($dd)
3011153816Sdougb		break
3012153816Sdougb	fi
3013153816Sdougbdone
3014153816Sdougbif test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
3015153816Sdougbthen
3016153816Sdougb	AC_MSG_RESULT(not found)
3017153816Sdougb	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
3018153816Sdougbfi
3019153816SdougbAC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
3020135446Strhodes
3021135446Strhodes#
3022170222Sdougb# IDN support
3023170222Sdougb#
3024170222SdougbAC_ARG_WITH(idn,
3025204619Sdougb	[  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
3026170222Sdougb	use_idn="$withval", use_idn="no")
3027170222Sdougbcase "$use_idn" in
3028170222Sdougbyes)
3029170222Sdougb	if test X$prefix = XNONE ; then
3030170222Sdougb		idn_path=/usr/local
3031170222Sdougb	else
3032170222Sdougb		idn_path=$prefix
3033170222Sdougb	fi
3034170222Sdougb	;;
3035170222Sdougbno)
3036170222Sdougb	;;
3037170222Sdougb*)
3038170222Sdougb	idn_path="$use_idn"
3039170222Sdougb	;;
3040170222Sdougbesac
3041170222Sdougb
3042170222Sdougbiconvinc=
3043170222Sdougbiconvlib=
3044170222SdougbAC_ARG_WITH(libiconv,
3045204619Sdougb	[  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
3046170222Sdougb	use_libiconv="$withval", use_libiconv="no")
3047170222Sdougbcase "$use_libiconv" in
3048170222Sdougbyes)
3049170222Sdougb	if test X$prefix = XNONE ; then
3050170222Sdougb		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
3051170222Sdougb	else
3052170222Sdougb		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
3053170222Sdougb	fi
3054170222Sdougb	;;
3055170222Sdougbno)
3056170222Sdougb	iconvlib=
3057170222Sdougb	;;
3058170222Sdougb*)
3059170222Sdougb	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
3060170222Sdougb	;;
3061170222Sdougbesac
3062170222Sdougb
3063170222SdougbAC_ARG_WITH(iconv,
3064204619Sdougb	[  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
3065170222Sdougb	iconvlib="$withval")
3066170222Sdougbcase "$iconvlib" in
3067170222Sdougbno)
3068170222Sdougb	iconvlib=
3069170222Sdougb	;;
3070170222Sdougbyes)
3071170222Sdougb	iconvlib=-liconv
3072170222Sdougb	;;
3073170222Sdougbesac
3074170222Sdougb
3075170222SdougbAC_ARG_WITH(idnlib,
3076204619Sdougb	[  --with-idnlib=ARG       specify libidnkit],
3077170222Sdougb	idnlib="$withval", idnlib="no")
3078170222Sdougbif test "$idnlib" = yes; then
3079170222Sdougb	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
3080170222Sdougbfi
3081170222Sdougb
3082170222SdougbIDNLIBS=
3083170222Sdougbif test "$use_idn" != no; then
3084170222Sdougb	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
3085170222Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
3086170222Sdougb	if test "$idnlib" != no; then
3087170222Sdougb		IDNLIBS="$idnlib $iconvlib"
3088170222Sdougb	else
3089170222Sdougb		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
3090170222Sdougb	fi
3091170222Sdougbfi
3092170222SdougbAC_SUBST(IDNLIBS)
3093170222Sdougb
3094225361Sdougb#
3095225361Sdougb# Check whether to build Automated Test Framework unit tests
3096225361Sdougb#
3097225361SdougbAC_ARG_WITH(atf,
3098225361Sdougb	[  --with-atf=ARG       Automated Test Framework support],
3099225361Sdougb	atf="$withval", atf="no")
3100225361Sdougbif test "$atf" = yes; then
3101225361Sdougb	atf=`pwd`/unit/atf
3102225361Sdougb	ATFBUILD=atf-src
3103225361Sdougb	AC_SUBST(ATFBUILD)
3104225361Sdougb	AC_CONFIG_COMMANDS([atf-config],
3105225361Sdougb		[cd unit/atf-src; ${SHELL} ./configure MISSING=: --prefix $atfdir; cd ../..],
3106225361Sdougb		[atfdir=`pwd`/unit/atf])
3107225361Sdougb	AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
3108225361Sdougbfi
3109225361Sdougb
3110225361SdougbATFLIBS=
3111225361Sdougbif test "$atf" != no; then
3112225361Sdougb	AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
3113225361Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
3114225361Sdougb	ATFBIN="$atf/bin"
3115225361Sdougb	ATFLIBS="-L$atf/lib -latf-c"
3116225361Sdougb	UNITTESTS=tests
3117225361Sdougbfi
3118225361SdougbAC_SUBST(ATFBIN)
3119225361SdougbAC_SUBST(ATFLIBS)
3120225361SdougbAC_SUBST(UNITTESTS)
3121225361Sdougb
3122170222SdougbAC_CHECK_HEADERS(locale.h)
3123170222SdougbAC_CHECK_FUNCS(setlocale)
3124170222Sdougb
3125170222Sdougb#
3126135446Strhodes# Substitutions
3127135446Strhodes#
3128135446StrhodesAC_SUBST(BIND9_TOP_BUILDDIR)
3129135446StrhodesBIND9_TOP_BUILDDIR=`pwd`
3130135446Strhodes
3131135446StrhodesAC_SUBST(BIND9_ISC_BUILDINCLUDE)
3132135446StrhodesAC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
3133135446StrhodesAC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
3134135446StrhodesAC_SUBST(BIND9_DNS_BUILDINCLUDE)
3135135446StrhodesAC_SUBST(BIND9_LWRES_BUILDINCLUDE)
3136135446StrhodesAC_SUBST(BIND9_BIND9_BUILDINCLUDE)
3137135446Strhodesif test "X$srcdir" != "X"; then
3138135446Strhodes	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
3139135446Strhodes	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
3140135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
3141135446Strhodes	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
3142135446Strhodes	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
3143135446Strhodes	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
3144135446Strhodeselse
3145135446Strhodes	BIND9_ISC_BUILDINCLUDE=""
3146135446Strhodes	BIND9_ISCCC_BUILDINCLUDE=""
3147135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE=""
3148135446Strhodes	BIND9_DNS_BUILDINCLUDE=""
3149135446Strhodes	BIND9_LWRES_BUILDINCLUDE=""
3150135446Strhodes	BIND9_BIND9_BUILDINCLUDE=""
3151135446Strhodesfi
3152135446Strhodes
3153135446StrhodesAC_SUBST_FILE(BIND9_MAKE_INCLUDES)
3154135446StrhodesBIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
3155135446Strhodes
3156135446StrhodesAC_SUBST_FILE(BIND9_MAKE_RULES)
3157135446StrhodesBIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
3158135446Strhodes
3159135446Strhodes. $srcdir/version
3160204619SdougbBIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}"
3161135446StrhodesAC_SUBST(BIND9_VERSION)
3162135446Strhodes
3163193149Sdougbif test -z "$ac_configure_args"; then
3164193149Sdougb	BIND9_CONFIGARGS="defaults"
3165193149Sdougbelse
3166193149Sdougb	for a in $ac_configure_args
3167193149Sdougb	do
3168193149Sdougb		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
3169193149Sdougb	done
3170193149Sdougbfi
3171193149SdougbBIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
3172193149SdougbBIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
3173193149SdougbAC_SUBST(BIND9_CONFIGARGS)
3174193149Sdougb
3175135446StrhodesAC_SUBST_FILE(LIBISC_API)
3176135446StrhodesLIBISC_API=$srcdir/lib/isc/api
3177135446Strhodes
3178135446StrhodesAC_SUBST_FILE(LIBISCCC_API)
3179135446StrhodesLIBISCCC_API=$srcdir/lib/isccc/api
3180135446Strhodes
3181135446StrhodesAC_SUBST_FILE(LIBISCCFG_API)
3182135446StrhodesLIBISCCFG_API=$srcdir/lib/isccfg/api
3183135446Strhodes
3184135446StrhodesAC_SUBST_FILE(LIBDNS_API)
3185135446StrhodesLIBDNS_API=$srcdir/lib/dns/api
3186135446Strhodes
3187135446StrhodesAC_SUBST_FILE(LIBBIND9_API)
3188135446StrhodesLIBBIND9_API=$srcdir/lib/bind9/api
3189135446Strhodes
3190135446StrhodesAC_SUBST_FILE(LIBLWRES_API)
3191135446StrhodesLIBLWRES_API=$srcdir/lib/lwres/api
3192135446Strhodes
3193224092SdougbAC_SUBST_FILE(LIBIRS_API)
3194224092SdougbLIBIRS_API=$srcdir/lib/irs/api
3195224092Sdougb
3196170222Sdougb#
3197170222Sdougb# Configure any DLZ drivers.
3198170222Sdougb#
3199170222Sdougb# If config.dlz.in selects one or more DLZ drivers, it will set
3200225361Sdougb# CONTRIB_DLZ to a non-empty value, which will be our clue to
3201225361Sdougb# build DLZ drivers in contrib.
3202170222Sdougb#
3203170222Sdougb# This section has to come after the libtool stuff because it needs to
3204170222Sdougb# know how to name the driver object files.
3205170222Sdougb#
3206170222Sdougb
3207225361SdougbCONTRIB_DLZ=""
3208170222SdougbDLZ_DRIVER_INCLUDES=""
3209170222SdougbDLZ_DRIVER_LIBS=""
3210170222SdougbDLZ_DRIVER_SRCS=""
3211170222SdougbDLZ_DRIVER_OBJS=""
3212218384SdougbDLZ_SYSTEM_TEST=""
3213170222Sdougb
3214225361Sdougb# 
3215225361Sdougb# Configure support for building a shared library object
3216225361Sdougb#
3217225361Sdougb# Even when libtool is available it can't always be relied upon
3218225361Sdougb# to build an object that can be dlopen()'ed, but this is necessary
3219225361Sdougb# for building the dlzexternal system test, so we'll try it the
3220225361Sdougb# old-fashioned way.
3221225361Sdougb#
3222225361SdougbSO="so"
3223225361SdougbSO_CFLAGS=""
3224225361SdougbSO_LD=""
3225225361SdougbSO_TARGETS=""
3226225361Sdougb
3227225361SdougbAC_ARG_WITH(dlopen,
3228225361Sdougb	[  --with-dlopen=ARG       Support dynamically loadable DLZ drivers],
3229225361Sdougb	dlopen="$withval", dlopen="yes")
3230225361Sdougb
3231225361Sdougbif test "$dlopen" = "yes"; then
3232225361Sdougb	AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
3233225361Sdougb	if test "$have_dl" = "yes"; then
3234225361Sdougb		LIBS="-ldl $LIBS"
3235225361Sdougb	fi
3236225361Sdougb        AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
3237225361Sdougbfi
3238225361Sdougb
3239225361Sdougbif test "$dlopen" = "yes"; then
3240225361Sdougb	case $host in
3241225361Sdougb		*-linux*)
3242225361Sdougb			SO_CFLAGS="-fPIC"
3243225361Sdougb			if test "$have_dl" = "yes"
3244225361Sdougb			then
3245225361Sdougb				SO_LD="${CC} -shared"
3246225361Sdougb			else
3247225361Sdougb				SO_LD="ld -shared"
3248225361Sdougb			fi
3249225361Sdougb			;;
3250225361Sdougb		*-freebsd*|*-openbsd*|*-netbsd*)
3251225361Sdougb			SO_CFLAGS="-fpic"
3252225361Sdougb			SO_LD="ld -Bshareable -x"
3253225361Sdougb			;;
3254225361Sdougb		*-solaris*)
3255225361Sdougb			SO_CFLAGS="-KPIC"
3256225361Sdougb			SO_LD="ld -G -z text"
3257225361Sdougb                        ;;
3258225361Sdougb		*-hp-hpux*)
3259225361Sdougb			SO=sl
3260225361Sdougb			SO_CFLAGS="+z"
3261225361Sdougb			SO_LD="ld -b"
3262225361Sdougb                        ;;
3263225361Sdougb		*)
3264225361Sdougb			SO_CFLAGS="-fPIC"
3265225361Sdougb			;;
3266225361Sdougb	esac
3267225361Sdougb
3268225361Sdougb	if test "X$GCC" = "Xyes"; then
3269225361Sdougb		SO_CFLAGS="-fPIC"
3270225361Sdougb                test -n "$SO_LD" || SO_LD="${CC} -shared"
3271225361Sdougb	fi
3272225361Sdougb
3273225361Sdougb	# If we still don't know how to make shared objects, don't make any.
3274225361Sdougb	if test -n "$SO_LD"; then
3275225361Sdougb		SO_TARGETS="\${SO_TARGETS}"
3276225361Sdougb		AC_DEFINE(ISC_DLZ_DLOPEN, 1,
3277225361Sdougb			  [Define to allow building of objects for dlopen().])
3278225361Sdougb	fi
3279225361Sdougbfi
3280225361Sdougb
3281225361SdougbAC_SUBST(SO)
3282225361SdougbAC_SUBST(SO_CFLAGS)
3283225361SdougbAC_SUBST(SO_LD)
3284225361SdougbAC_SUBST(SO_TARGETS)
3285225361Sdougb
3286170222Sdougbsinclude(contrib/dlz/config.dlz.in)
3287225361SdougbAC_MSG_CHECKING(contributed DLZ drivers)
3288170222Sdougb
3289225361Sdougbif test -n "$CONTRIB_DLZ"
3290170222Sdougbthen
3291170222Sdougb	AC_MSG_RESULT(yes)
3292170222Sdougb	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
3293170222Sdougb	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
3294170222Sdougbelse
3295170222Sdougb	AC_MSG_RESULT(no)
3296170222Sdougb	DLZ_DRIVER_RULES=/dev/null
3297170222Sdougbfi
3298170222Sdougb
3299225361SdougbAC_SUBST(CONTRIB_DLZ)
3300170222SdougbAC_SUBST(DLZ_DRIVER_INCLUDES)
3301170222SdougbAC_SUBST(DLZ_DRIVER_LIBS)
3302170222SdougbAC_SUBST(DLZ_DRIVER_SRCS)
3303170222SdougbAC_SUBST(DLZ_DRIVER_OBJS)
3304218384SdougbAC_SUBST(DLZ_SYSTEM_TEST)
3305170222SdougbAC_SUBST_FILE(DLZ_DRIVER_RULES)
3306170222Sdougb
3307165071Sdougbif test "$cross_compiling" = "yes"; then
3308165071Sdougb	if test -z "$BUILD_CC"; then
3309165071Sdougb		AC_ERROR([BUILD_CC not set])
3310165071Sdougb	fi
3311165071Sdougb	BUILD_CFLAGS="$BUILD_CFLAGS"
3312165071Sdougb	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
3313165071Sdougb	BUILD_LDFLAGS="$BUILD_LDFLAGS"
3314165071Sdougb	BUILD_LIBS="$BUILD_LIBS"
3315165071Sdougbelse
3316165071Sdougb	BUILD_CC="$CC" 
3317165071Sdougb	BUILD_CFLAGS="$CFLAGS" 
3318165071Sdougb	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
3319165071Sdougb	BUILD_LDFLAGS="$LDFLAGS"
3320165071Sdougb	BUILD_LIBS="$LIBS"
3321165071Sdougbfi
3322165071Sdougb
3323193149SdougbNEWFLAGS=""
3324193149Sdougbfor e in $BUILD_LDFLAGS ; do
3325193149Sdougb    case $e in
3326193149Sdougb	-L*)
3327193149Sdougb	    case $host_os in
3328193149Sdougb		netbsd*)
3329193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3330193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3331193149Sdougb		    ;;
3332193149Sdougb		freebsd*)
3333193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3334193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3335193149Sdougb		    ;;
3336193149Sdougb		solaris*)
3337193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3338193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3339193149Sdougb		    ;;
3340193149Sdougb		*)
3341193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3342193149Sdougb		    ;;
3343193149Sdougb		esac
3344193149Sdougb	    ;;
3345193149Sdougb	*)
3346193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3347193149Sdougb	    ;;
3348193149Sdougb    esac
3349193149Sdougbdone
3350193149SdougbBUILD_LDFLAGS="$NEWFLAGS"
3351193149Sdougb
3352193149SdougbNEWFLAGS=""
3353193149Sdougbfor e in $DNS_GSSAPI_LIBS ; do
3354193149Sdougb    case $e in
3355193149Sdougb	-L*)
3356193149Sdougb	    case $host_os in
3357193149Sdougb		netbsd*)
3358193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3359193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3360193149Sdougb		    ;;
3361193149Sdougb		freebsd*)
3362193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3363193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3364193149Sdougb		    ;;
3365193149Sdougb		solaris*)
3366193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3367193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3368193149Sdougb		    ;;
3369193149Sdougb		*)
3370193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3371193149Sdougb		    ;;
3372193149Sdougb		esac
3373193149Sdougb	    ;;
3374193149Sdougb	*)
3375193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3376193149Sdougb	    ;;
3377193149Sdougb    esac
3378193149Sdougbdone
3379193149SdougbDNS_GSSAPI_LIBS="$NEWFLAGS"
3380193149Sdougb
3381193149SdougbNEWFLAGS=""
3382193149Sdougbfor e in $DNS_CRYPTO_LIBS ; do
3383193149Sdougb    case $e in
3384193149Sdougb	-L*)
3385193149Sdougb	    case $host_os in
3386193149Sdougb		netbsd*)
3387193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3388193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3389193149Sdougb		    ;;
3390193149Sdougb		freebsd*)
3391193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3392193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3393193149Sdougb		    ;;
3394193149Sdougb		solaris*)
3395193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3396193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3397193149Sdougb		    ;;
3398193149Sdougb		*)
3399193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3400193149Sdougb		    ;;
3401193149Sdougb		esac
3402193149Sdougb	    ;;
3403193149Sdougb	*)
3404193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3405193149Sdougb	    ;;
3406193149Sdougb    esac
3407193149Sdougbdone
3408193149SdougbDNS_CRYPTO_LIBS="$NEWFLAGS"
3409193149Sdougb
3410165071SdougbAC_SUBST(BUILD_CC)
3411165071SdougbAC_SUBST(BUILD_CFLAGS)
3412165071SdougbAC_SUBST(BUILD_CPPFLAGS)
3413165071SdougbAC_SUBST(BUILD_LDFLAGS)
3414165071SdougbAC_SUBST(BUILD_LIBS)
3415165071Sdougb
3416170222Sdougb#
3417170222Sdougb# Commands to run at the end of config.status.
3418170222Sdougb# Don't just put these into configure, it won't work right if somebody
3419170222Sdougb# runs config.status directly (which autoconf allows).
3420170222Sdougb#
3421170222Sdougb
3422170222SdougbAC_CONFIG_COMMANDS(
3423170222Sdougb	[chmod],
3424193149Sdougb	[chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
3425170222Sdougb
3426170222Sdougb#
3427170222Sdougb# Files to configure.  These are listed here because we used to
3428170222Sdougb# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
3429170222Sdougb# elsewhere if there's a good reason for doing so.
3430170222Sdougb#
3431170222Sdougb
3432170222SdougbAC_CONFIG_FILES([
3433224092Sdougb  make/Makefile
3434224092Sdougb  make/mkdep
3435135446Strhodes	Makefile
3436224092Sdougb	bin/Makefile
3437224092Sdougb	bin/check/Makefile
3438224092Sdougb	bin/confgen/Makefile
3439224092Sdougb	bin/confgen/unix/Makefile
3440224092Sdougb	bin/dig/Makefile
3441224092Sdougb	bin/dnssec/Makefile
3442224092Sdougb	bin/named/Makefile
3443224092Sdougb	bin/named/unix/Makefile
3444224092Sdougb	bin/nsupdate/Makefile
3445224092Sdougb	bin/pkcs11/Makefile
3446224092Sdougb	bin/rndc/Makefile
3447224092Sdougb	bin/tests/Makefile
3448224092Sdougb	bin/tests/atomic/Makefile
3449224092Sdougb	bin/tests/db/Makefile
3450224092Sdougb	bin/tests/dst/Makefile
3451224092Sdougb	bin/tests/hashes/Makefile
3452224092Sdougb	bin/tests/headerdep_test.sh
3453224092Sdougb	bin/tests/master/Makefile
3454224092Sdougb	bin/tests/mem/Makefile
3455224092Sdougb	bin/tests/names/Makefile
3456224092Sdougb	bin/tests/net/Makefile
3457224092Sdougb	bin/tests/rbt/Makefile
3458224092Sdougb	bin/tests/resolver/Makefile
3459224092Sdougb	bin/tests/sockaddr/Makefile
3460224092Sdougb	bin/tests/system/Makefile
3461224092Sdougb	bin/tests/system/conf.sh
3462225361Sdougb	bin/tests/system/dlz/prereq.sh
3463225361Sdougb	bin/tests/system/dlzexternal/Makefile
3464225361Sdougb	bin/tests/system/dlzexternal/ns1/named.conf
3465224092Sdougb	bin/tests/system/filter-aaaa/Makefile
3466224092Sdougb	bin/tests/system/gost/prereq.sh
3467224092Sdougb	bin/tests/system/lwresd/Makefile
3468224092Sdougb	bin/tests/system/rpz/Makefile
3469224092Sdougb	bin/tests/system/tkey/Makefile
3470225361Sdougb	bin/tests/system/tsiggss/Makefile
3471224092Sdougb	bin/tests/tasks/Makefile
3472224092Sdougb	bin/tests/timers/Makefile
3473224092Sdougb	bin/tests/virtual-time/Makefile
3474224092Sdougb	bin/tests/virtual-time/conf.sh
3475224092Sdougb	bin/tools/Makefile
3476224092Sdougb	contrib/check-secure-delegation.pl
3477224092Sdougb	contrib/zone-edit.sh
3478224092Sdougb	doc/Makefile
3479224092Sdougb	doc/arm/Makefile
3480224092Sdougb	doc/doxygen/Doxyfile
3481224092Sdougb	doc/doxygen/Makefile
3482224092Sdougb	doc/doxygen/doxygen-input-filter
3483224092Sdougb	doc/misc/Makefile
3484224092Sdougb	doc/xsl/Makefile
3485224092Sdougb	doc/xsl/isc-docbook-chunk.xsl
3486224092Sdougb	doc/xsl/isc-docbook-html.xsl
3487224092Sdougb	doc/xsl/isc-docbook-latex.xsl
3488224092Sdougb	doc/xsl/isc-manpage.xsl
3489224092Sdougb	isc-config.sh
3490135446Strhodes	lib/Makefile
3491224092Sdougb	lib/bind9/Makefile
3492224092Sdougb	lib/bind9/include/Makefile
3493224092Sdougb	lib/bind9/include/bind9/Makefile
3494224092Sdougb	lib/dns/Makefile
3495224092Sdougb	lib/dns/include/Makefile
3496224092Sdougb	lib/dns/include/dns/Makefile
3497224092Sdougb	lib/dns/include/dst/Makefile
3498225361Sdougb	lib/dns/tests/Makefile
3499224092Sdougb	lib/export/Makefile
3500224092Sdougb	lib/export/dns/Makefile
3501224092Sdougb	lib/export/dns/include/Makefile
3502224092Sdougb	lib/export/dns/include/dns/Makefile
3503224092Sdougb	lib/export/dns/include/dst/Makefile
3504224092Sdougb	lib/export/irs/Makefile
3505224092Sdougb	lib/export/irs/include/Makefile
3506224092Sdougb	lib/export/irs/include/irs/Makefile
3507224092Sdougb	lib/export/isc/$thread_dir/Makefile
3508224092Sdougb	lib/export/isc/$thread_dir/include/Makefile
3509224092Sdougb	lib/export/isc/$thread_dir/include/isc/Makefile
3510224092Sdougb	lib/export/isc/Makefile
3511224092Sdougb	lib/export/isc/include/Makefile
3512224092Sdougb	lib/export/isc/include/isc/Makefile
3513224092Sdougb	lib/export/isc/nls/Makefile
3514224092Sdougb	lib/export/isc/unix/Makefile
3515224092Sdougb	lib/export/isc/unix/include/Makefile
3516224092Sdougb	lib/export/isc/unix/include/isc/Makefile
3517224092Sdougb	lib/export/isccfg/Makefile
3518224092Sdougb	lib/export/isccfg/include/Makefile
3519224092Sdougb	lib/export/isccfg/include/isccfg/Makefile
3520224092Sdougb	lib/export/samples/Makefile
3521224092Sdougb	lib/export/samples/Makefile-postinstall
3522224092Sdougb	lib/irs/Makefile
3523224092Sdougb	lib/irs/include/Makefile
3524224092Sdougb	lib/irs/include/irs/Makefile
3525224092Sdougb	lib/irs/include/irs/netdb.h
3526224092Sdougb	lib/irs/include/irs/platform.h
3527224092Sdougb	lib/isc/$arch/Makefile
3528224092Sdougb	lib/isc/$arch/include/Makefile
3529224092Sdougb	lib/isc/$arch/include/isc/Makefile
3530224092Sdougb	lib/isc/$thread_dir/Makefile
3531224092Sdougb	lib/isc/$thread_dir/include/Makefile
3532224092Sdougb	lib/isc/$thread_dir/include/isc/Makefile
3533135446Strhodes	lib/isc/Makefile
3534135446Strhodes	lib/isc/include/Makefile
3535135446Strhodes	lib/isc/include/isc/Makefile
3536135446Strhodes	lib/isc/include/isc/platform.h
3537225361Sdougb	lib/isc/tests/Makefile
3538224092Sdougb	lib/isc/nls/Makefile
3539135446Strhodes	lib/isc/unix/Makefile
3540135446Strhodes	lib/isc/unix/include/Makefile
3541135446Strhodes	lib/isc/unix/include/isc/Makefile
3542135446Strhodes	lib/isccc/Makefile
3543135446Strhodes	lib/isccc/include/Makefile
3544135446Strhodes	lib/isccc/include/isccc/Makefile
3545135446Strhodes	lib/isccfg/Makefile
3546135446Strhodes	lib/isccfg/include/Makefile
3547135446Strhodes	lib/isccfg/include/isccfg/Makefile
3548135446Strhodes	lib/lwres/Makefile
3549135446Strhodes	lib/lwres/include/Makefile
3550135446Strhodes	lib/lwres/include/lwres/Makefile
3551135446Strhodes	lib/lwres/include/lwres/netdb.h
3552135446Strhodes	lib/lwres/include/lwres/platform.h
3553135446Strhodes	lib/lwres/man/Makefile
3554135446Strhodes	lib/lwres/unix/Makefile
3555135446Strhodes	lib/lwres/unix/include/Makefile
3556135446Strhodes	lib/lwres/unix/include/lwres/Makefile
3557135446Strhodes	lib/tests/Makefile
3558135446Strhodes	lib/tests/include/Makefile
3559135446Strhodes	lib/tests/include/tests/Makefile
3560225361Sdougb	unit/Makefile
3561225361Sdougb	unit/unittest.sh
3562170222Sdougb])
3563135446Strhodes
3564170222Sdougb#
3565170222Sdougb# Do it
3566170222Sdougb#
3567170222Sdougb
3568170222SdougbAC_OUTPUT
3569170222Sdougb
3570218384Sdougb#
3571218384Sdougb# Now that the Makefiles exist we can ensure that everything is rebuilt.
3572218384Sdougb#
3573218384SdougbAC_ARG_WITH(make-clean,
3574218384Sdougb[  --with-make-clean      Run "make clean" at end of configure [[yes|no]].],
3575218384Sdougb    make_clean="$withval", make_clean="yes")
3576218384Sdougbcase "$make_clean" in
3577218384Sdougbyes)
3578218384Sdougb	make clean
3579218384Sdougb	;;
3580218384Sdougbesac
3581218384Sdougb
3582204619Sdougbif test "X$USE_OPENSSL" = "X"; then
3583204619Sdougbcat << \EOF                                                             
3584204619SdougbBIND is being built without OpenSSL. This means it will not have DNSSEC support.
3585204619SdougbEOF
3586204619Sdougbfi
3587204619Sdougb
3588163976Sdougbif test "X$OPENSSL_WARNING" != "X"; then
3589163976Sdougbcat << \EOF
3590163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3591163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3592163976SdougbWARNING                                                                 WARNING
3593163976SdougbWARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
3594163976SdougbWARNING         one or more of the the following known security         WARNING
3595163976SdougbWARNING         flaws:                                                  WARNING
3596163976SdougbWARNING                                                                 WARNING
3597163976SdougbWARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
3598163976SdougbWARNING         CVE-2006-2940.                                          WARNING
3599163976SdougbWARNING                                                                 WARNING
3600163976SdougbWARNING         It is recommended that you upgrade to OpenSSL           WARNING
3601163976SdougbWARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
3602163976SdougbWARNING                                                                 WARNING
3603163976SdougbWARNING         You can disable this warning by specifying:             WARNING
3604163976SdougbWARNING                                                                 WARNING
3605163976SdougbWARNING               --disable-openssl-version-check          	        WARNING
3606163976SdougbWARNING                                                                 WARNING
3607163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3608163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3609163976SdougbEOF
3610163976Sdougbfi
3611163976Sdougb
3612135446Strhodes# Tell Emacs to edit this file in shell mode.
3613135446Strhodes# Local Variables:
3614135446Strhodes# mode: sh
3615135446Strhodes# End:
3616