1262706Serwin# Copyright (C) 2004-2014  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
18262706Serwinesyscmd([sed -e 's/^/# /' -e '/Portions of this code/,$d' COPYRIGHT])dnl
19135446StrhodesAC_DIVERT_POP()dnl
20135446Strhodes
21254897SerwinAC_REVISION($Revision: 1.533 $)
22135446Strhodes
23135446StrhodesAC_INIT(lib/dns/name.c)
24170222SdougbAC_PREREQ(2.59)
25135446Strhodes
26135446StrhodesAC_CONFIG_HEADER(config.h)
27254402SerwinAC_CONFIG_MACRO_DIR([libtool.m4])
28135446Strhodes
29135446StrhodesAC_CANONICAL_HOST
30135446Strhodes
31135446StrhodesAC_PROG_MAKE_SET
32204619Sdougb
33204619Sdougb#
34204619Sdougb# GNU libtool support
35204619Sdougb#
36204619Sdougbcase $build_os in
37204619Sdougbsunos*)
38204619Sdougb    # Just set the maximum command line length for sunos as it otherwise
39204619Sdougb    # takes a exceptionally long time to work it out. Required for libtool.
40254897Serwin
41204619Sdougb    lt_cv_sys_max_cmd_len=4096;
42204619Sdougb    ;;
43204619Sdougbesac
44204619Sdougb
45193149SdougbAC_PROG_LIBTOOL
46135446StrhodesAC_PROG_INSTALL
47170222SdougbAC_PROG_LN_S
48135446Strhodes
49135446StrhodesAC_SUBST(STD_CINCLUDES)
50135446StrhodesAC_SUBST(STD_CDEFINES)
51135446StrhodesAC_SUBST(STD_CWARNINGS)
52135446StrhodesAC_SUBST(CCOPT)
53262706SerwinAC_SUBST(CCNOOPT)
54135446Strhodes
55193149Sdougb# Warn if the user specified libbind, which is now deprecated
56193149SdougbAC_ARG_ENABLE(libbind, [  --enable-libbind	  deprecated])
57193149Sdougb
58193149Sdougbcase "$enable_libbind" in
59193149Sdougb	yes)
60193149Sdougb		AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
61193149SdougbIt is available from http://www.isc.org as a separate download.])
62193149Sdougb		;;
63193149Sdougb	no|'')
64193149Sdougb		;;
65193149Sdougbesac
66193149Sdougb
67254402SerwinAC_ARG_ENABLE(developer, [  --enable-developer      enable developer build settings])
68234010Sdougbcase "$enable_developer" in
69234010Sdougbyes)
70254402Serwin	STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
71234010Sdougb	test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
72234010Sdougb	test "${with_atf+set}" = set || with_atf=yes
73234010Sdougb	test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
74262706Serwin	test "${enable_rrl+set}" = set || enable_rrl=yes
75234010Sdougb	test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
76234010Sdougb	case "$host" in
77234010Sdougb	*-darwin*)
78234010Sdougb		test "${enable_exportlib+set}" = set || enable_exportlib=yes
79234010Sdougb		;;
80234010Sdougb	*-linux*)
81234010Sdougb		test "${enable_exportlib+set}" = set || enable_exportlib=yes
82234010Sdougb		;;
83234010Sdougb	esac
84262706Serwin	test "${enable_symtable+set}" = set || enable_symtable=all
85234010Sdougb	;;
86234010Sdougbesac
87170222Sdougb#
88170222Sdougb# Make very sure that these are the first files processed by
89170222Sdougb# config.status, since we use the processed output as the input for
90193149Sdougb# AC_SUBST_FILE() substitutions in other files.
91170222Sdougb#
92170222SdougbAC_CONFIG_FILES([make/rules make/includes])
93170222Sdougb
94135446StrhodesAC_PATH_PROG(AR, ar)
95135446StrhodesARFLAGS="cruv"
96135446StrhodesAC_SUBST(AR)
97135446StrhodesAC_SUBST(ARFLAGS)
98135446Strhodes
99135446Strhodes# The POSIX ln(1) program.  Non-POSIX systems may substitute
100135446Strhodes# "copy" or something.
101135446StrhodesLN=ln
102135446StrhodesAC_SUBST(LN)
103135446Strhodes
104135446Strhodescase "$AR" in
105135446Strhodes	"")
106135446Strhodes		AC_MSG_ERROR([
107135446Strhodesar program not found.  Please fix your PATH to include the directory in
108135446Strhodeswhich ar resides, or set AR in the environment with the full path to ar.
109135446Strhodes])
110135446Strhodes
111135446Strhodes		;;
112135446Strhodesesac
113135446Strhodes
114135446Strhodes#
115135446Strhodes# Etags.
116135446Strhodes#
117135446StrhodesAC_PATH_PROGS(ETAGS, etags emacs-etags)
118135446Strhodes
119135446Strhodes#
120135446Strhodes# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
121135446Strhodes# GNU emacs etags, and it requires the -L flag.
122135446Strhodes#
123135446Strhodesif test "X$ETAGS" != "X"; then
124135446Strhodes	AC_MSG_CHECKING(for Exuberant Ctags etags)
125135446Strhodes	if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
126135446Strhodes		AC_MSG_RESULT(yes)
127135446Strhodes		ETAGS="$ETAGS -L"
128135446Strhodes	else
129135446Strhodes		AC_MSG_RESULT(no)
130135446Strhodes	fi
131135446Strhodesfi
132135446StrhodesAC_SUBST(ETAGS)
133135446Strhodes
134135446Strhodes#
135135446Strhodes# Perl is optional; it is used only by some of the system test scripts.
136224092Sdougb# Note: the backtrace feature (see below) uses perl to build the symbol table,
137224092Sdougb# but it still compiles without perl, in which case an empty table will be used.
138135446Strhodes#
139135446StrhodesAC_PATH_PROGS(PERL, perl5 perl)
140135446StrhodesAC_SUBST(PERL)
141135446Strhodes
142135446Strhodes#
143254897Serwin# Python is also optional; it is used by the tools in bin/python.
144254897Serwin# If python is unavailable, we simply don't build those.
145254897Serwin#
146254897SerwinAC_ARG_WITH(python,
147254897Serwin[  --with-python=PATH      Specify path to python interpreter],
148254897Serwin    use_python="$withval", use_python="unspec")
149254897Serwin
150254897Serwincase "$use_python" in
151254897Serwin	no)
152254897Serwin		AC_MSG_RESULT(disabled)
153254897Serwin		;;
154254897Serwin	unspec|yes|*)
155254897Serwin		case "$use_python" in
156254897Serwin		unspec|yes|'')
157254897Serwin			AC_PATH_PROGS(PYTHON, python)
158254897Serwin			;;
159254897Serwin		*)
160254897Serwin			AC_PATH_PROGS(PYTHON, $use_python)
161254897Serwin			;;
162254897Serwin		esac
163254897Serwin		if test "X$PYTHON" == "X"
164254897Serwin		then
165254897Serwin			case "$use_python" in
166254897Serwin			unspec)
167254897Serwin				AC_MSG_RESULT(disabled)
168254897Serwin				;;
169254897Serwin			yes|*)
170254897Serwin				AC_MSG_ERROR([missing python])
171254897Serwin				;;
172254897Serwin			esac
173254897Serwin			break
174254897Serwin		fi
175254897Serwin                testscript='try: import argparse
176254897Serwinexcept: exit(1)'
177254897Serwin		AC_MSG_CHECKING([python module 'argparse'])
178254897Serwin                if $PYTHON -c "$testscript"; then
179254897Serwin                        AC_MSG_RESULT([found, using $PYTHON])
180254897Serwin                else
181254897Serwin			case "$use_python" in
182254897Serwin			unspec)
183254897Serwin				PYTHON=""
184254897Serwin				AC_SUBST(CHECKDS)
185254897Serwin				AC_SUBST(COVERAGE)
186254897Serwin				AC_MSG_RESULT([not found, python disabled])
187254897Serwin				;;
188254897Serwin			yes)
189254897Serwin                        AC_MSG_RESULT([no found])
190254897Serwin                        AC_MSG_ERROR([python 'argparse' module not supported])
191254897Serwin				;;
192254897Serwin			esac
193254897Serwin                fi
194254897Serwin		;;
195254897Serwinesac
196254897Serwin
197254897SerwinPYTHON_TOOLS=''
198254897SerwinCHECKDS=''
199254897SerwinCOVERAGE=''
200254897Serwinif test "X$PYTHON" != "X"; then
201254897Serwin        PYTHON_TOOLS=python
202254897Serwin	CHECKDS=checkds
203254897Serwin	COVERAGE=coverage
204254897Serwinfi
205254897SerwinAC_SUBST(CHECKDS)
206254897SerwinAC_SUBST(COVERAGE)
207254897SerwinAC_SUBST(PYTHON_TOOLS)
208254897Serwin
209254897Serwin#
210135446Strhodes# Special processing of paths depending on whether --prefix,
211135446Strhodes# --sysconfdir or --localstatedir arguments were given.  What's
212135446Strhodes# desired is some compatibility with the way previous versions
213135446Strhodes# of BIND built; they defaulted to /usr/local for most parts of
214135446Strhodes# the installation, but named.boot/named.conf was in /etc
215135446Strhodes# and named.pid was in /var/run.
216135446Strhodes#
217135446Strhodes# So ... if none of --prefix, --sysconfdir or --localstatedir are
218135446Strhodes# specified, set things up that way.  If --prefix is given, use
219135446Strhodes# it for sysconfdir and localstatedir the way configure normally
220135446Strhodes# would.  To change the prefix for everything but leave named.conf
221135446Strhodes# in /etc or named.pid in /var/run, then do this the usual configure way:
222135446Strhodes# ./configure --prefix=/somewhere --sysconfdir=/etc
223135446Strhodes# ./configure --prefix=/somewhere --localstatedir=/var
224135446Strhodes#
225135446Strhodes# To put named.conf and named.pid in /usr/local with everything else,
226135446Strhodes# set the prefix explicitly to /usr/local even though that's the default:
227135446Strhodes# ./configure --prefix=/usr/local
228135446Strhodes#
229135446Strhodescase "$prefix" in
230193149Sdougb	NONE)
231193149Sdougb		case "$sysconfdir" in
232193149Sdougb			'${prefix}/etc')
233193149Sdougb				sysconfdir=/etc
234193149Sdougb				;;
235193149Sdougb		esac
236193149Sdougb		case "$localstatedir" in
237193149Sdougb			'${prefix}/var')
238193149Sdougb				localstatedir=/var
239193149Sdougb				;;
240193149Sdougb		esac
241193149Sdougb		;;
242135446Strhodesesac
243135446Strhodes
244135446Strhodes#
245135446Strhodes# Make sure INSTALL uses an absolute path, else it will be wrong in all
246135446Strhodes# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
247135446Strhodes# configure based on the location of the file where it is substituted.
248135446Strhodes# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
249135446Strhodes# subdirectory of install-sh, This relative path will be wrong for all
250135446Strhodes# directories more than one level down from install-sh.
251135446Strhodes#
252135446Strhodescase "$INSTALL" in
253135446Strhodes	/*)
254193149Sdougb		;;
255193149Sdougb	*)
256193149Sdougb		#
257193149Sdougb		# Not all systems have dirname.
258193149Sdougb		#
259193149Sdougb		changequote({, })
260193149Sdougb		ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
261193149Sdougb		changequote([, ])
262135446Strhodes
263193149Sdougb		ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
264193149Sdougb		test "$ac_dir" = "$ac_prog" && ac_dir=.
265193149Sdougb		test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
266193149Sdougb		INSTALL="$ac_dir/$ac_prog"
267193149Sdougb		;;
268135446Strhodesesac
269135446Strhodes
270135446Strhodes#
271135446Strhodes# On these hosts, we really want to use cc, not gcc, even if it is
272135446Strhodes# found.  The gcc that these systems have will not correctly handle
273135446Strhodes# pthreads.
274135446Strhodes#
275135446Strhodes# However, if the user sets $CC to be something, let that override
276135446Strhodes# our change.
277135446Strhodes#
278135446Strhodesif test "X$CC" = "X" ; then
279135446Strhodes	case "$host" in
280135446Strhodes		*-dec-osf*)
281135446Strhodes			CC="cc"
282135446Strhodes			;;
283135446Strhodes		*-solaris*)
284193149Sdougb			# Use Sun's cc if it is available, but watch
285193149Sdougb			# out for /usr/ucb/cc; it will never be the right
286193149Sdougb			# compiler to use.
287193149Sdougb			#
288193149Sdougb			# If setting CC here fails, the AC_PROG_CC done
289193149Sdougb			# below might still find gcc.
290135446Strhodes			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
291135446Strhodes			for ac_dir in $PATH; do
292135446Strhodes				test -z "$ac_dir" && ac_dir=.
293135446Strhodes				case "$ac_dir" in
294135446Strhodes				/usr/ucb)
295135446Strhodes					# exclude
296135446Strhodes					;;
297135446Strhodes				*)
298135446Strhodes					if test -f "$ac_dir/cc"; then
299135446Strhodes						CC="$ac_dir/cc"
300135446Strhodes						break
301135446Strhodes					fi
302135446Strhodes					;;
303135446Strhodes				esac
304135446Strhodes			done
305135446Strhodes			IFS="$ac_save_ifs"
306135446Strhodes			;;
307135446Strhodes		*-hp-hpux*)
308135446Strhodes			CC="cc"
309135446Strhodes			;;
310135446Strhodes		mips-sgi-irix*)
311135446Strhodes			CC="cc"
312135446Strhodes			;;
313135446Strhodes	esac
314135446Strhodesfi
315135446Strhodes
316135446StrhodesAC_PROG_CC
317135446Strhodes
318135446Strhodes#
319135446Strhodes# gcc's optimiser is broken at -02 for ultrasparc
320135446Strhodes#
321135446Strhodesif test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
322135446Strhodes	case "$host" in
323135446Strhodes	sparc-*)
324135446Strhodes		CCFLAGS="-g -O1"
325135446Strhodes		;;
326135446Strhodes	esac
327135446Strhodesfi
328135446Strhodes
329135446Strhodes#
330135446Strhodes# OS dependent CC flags
331135446Strhodes#
332135446Strhodescase "$host" in
333193149Sdougb	# OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
334135446Strhodes	# -D_XOPEN_SOURCE_EXTENDED.
335135446Strhodes	*-dec-osf*)
336135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
337135446Strhodes		CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
338135446Strhodes		;;
339135446Strhodes	#HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
340135446Strhodes	*-hp-hpux*)
341135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
342135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
343135446Strhodes		LIBS="-lxnet $LIBS"
344135446Strhodes		;;
345135446Strhodes	# Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
346135446Strhodes	*-solaris*)
347135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
348135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
349135446Strhodes		;;
350186462Sdougb	# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
351186462Sdougb	# parts of the IPv6 Advanced Socket API as a result.  This is stupid
352186462Sdougb	# as it breaks how the two halves (Basic and Advanced) of the IPv6
353186462Sdougb	# Socket API were designed to be used but we have to live with it.
354186462Sdougb	# Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
355234010Sdougb	*-linux* | *-kfreebsd*-gnu)
356186462Sdougb		STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
357186462Sdougb		CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
358186462Sdougb		;;
359225361Sdougb	#
360225361Sdougb	# Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
361225361Sdougb	# Setting this is sufficient to select the correct behavior for BIND 9.
362225361Sdougb	#
363225361Sdougb	*-darwin*)
364225361Sdougb	  STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
365225361Sdougb	  CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
366225361Sdougb	  ;;
367135446Strhodesesac
368135446Strhodes
369262706Serwin#
370262706Serwin# CCNOOPT defaults to -O0 on gcc and disables optimization when is last
371262706Serwin#
372262706Serwinif test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then
373262706Serwin	CCNOOPT="-O0"
374262706Serwinfi
375262706Serwin
376135446StrhodesAC_HEADER_STDC
377135446Strhodes
378254402SerwinAC_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,,,
379135446Strhodes[$ac_includes_default
380135446Strhodes#ifdef HAVE_SYS_PARAM_H
381135446Strhodes# include <sys/param.h>
382135446Strhodes#endif
383135446Strhodes])
384135446Strhodes
385135446StrhodesAC_C_CONST
386135446StrhodesAC_C_INLINE
387186462SdougbAC_C_VOLATILE
388135446StrhodesAC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
389218384SdougbAC_C_FLEXIBLE_ARRAY_MEMBER
390135446Strhodes
391135446Strhodes#
392224092Sdougb# Older versions of HP/UX don't define seteuid() and setegid()
393224092Sdougb#
394224092SdougbAC_CHECK_FUNCS(seteuid setresuid)
395224092SdougbAC_CHECK_FUNCS(setegid setresgid)
396224092Sdougb
397224092Sdougb#
398135446Strhodes# UnixWare 7.1.1 with the feature supplement to the UDK compiler
399135446Strhodes# is reported to not support "static inline" (RT #1212).
400135446Strhodes#
401135446StrhodesAC_MSG_CHECKING(for static inline breakage)
402254402SerwinAC_TRY_COMPILE([
403135446Strhodes	static inline int foo1() {
404135446Strhodes		return 0;
405135446Strhodes	}
406135446Strhodes
407135446Strhodes	static inline int foo2() {
408135446Strhodes		return foo1();
409254402Serwin	}
410254402Serwin	], [foo1();],
411135446Strhodes	[AC_MSG_RESULT(no)],
412135446Strhodes	[AC_MSG_RESULT(yes)
413224092Sdougb	 AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
414135446Strhodes
415135446StrhodesAC_TYPE_SIZE_T
416135446StrhodesAC_CHECK_TYPE(ssize_t, int)
417153816SdougbAC_CHECK_TYPE(uintptr_t,unsigned long)
418143731SdougbAC_CHECK_TYPE(socklen_t,
419143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
420143731Sdougb[
421143731SdougbAC_TRY_COMPILE(
422143731Sdougb[
423143731Sdougb#include <sys/types.h>
424143731Sdougb#include <sys/socket.h>
425143731Sdougbint getsockname(int, struct sockaddr *, size_t *);
426143731Sdougb],[],
427143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
428143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
429143731Sdougb],
430143731Sdougb[
431143731Sdougb#include <sys/types.h>
432143731Sdougb#include <sys/socket.h>
433143731Sdougb])
434143731SdougbAC_SUBST(ISC_SOCKADDR_LEN_T)
435135446StrhodesAC_HEADER_TIME
436135446StrhodesAC_MSG_CHECKING(for long long)
437135446StrhodesAC_TRY_COMPILE([],[long long i = 0; return (0);],
438135446Strhodes	[AC_MSG_RESULT(yes)
439135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
440135446Strhodes	[AC_MSG_RESULT(no)
441135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
442135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELONGLONG)
443135446Strhodes
444135446Strhodes#
445224092Sdougb# check for GCC noreturn attribute
446224092Sdougb#
447224092SdougbAC_MSG_CHECKING(for GCC noreturn attribute)
448224092SdougbAC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
449224092Sdougb	[AC_MSG_RESULT(yes)
450224092Sdougb		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
451224092Sdougb		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
452224092Sdougb	[AC_MSG_RESULT(no)
453224092Sdougb		ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
454224092Sdougb		ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
455224092SdougbAC_SUBST(ISC_PLATFORM_NORETURN_PRE)
456224092SdougbAC_SUBST(ISC_PLATFORM_NORETURN_POST)
457224092Sdougb
458224092Sdougb#
459135446Strhodes# check if we have lifconf
460135446Strhodes#
461135446StrhodesAC_MSG_CHECKING(for struct lifconf)
462135446StrhodesAC_TRY_COMPILE([
463135446Strhodes#include <sys/types.h>
464135446Strhodes#include <sys/socket.h>
465135446Strhodes#include <net/if.h>
466135446Strhodes],
467135446Strhodes[
468135446Strhodesstruct lifconf lifconf;
469135446Strhodeslifconf.lifc_len = 0;
470135446Strhodes]
471135446Strhodes,
472135446Strhodes	[AC_MSG_RESULT(yes)
473135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
474135446Strhodes	[AC_MSG_RESULT(no)
475135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
476135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELIFCONF)
477135446Strhodes
478186462Sdougb#
479254897Serwin# check if we want the new statistics
480254897Serwin#
481254897SerwinAC_ARG_ENABLE(newstats,
482262706Serwin	[  --enable-newstats       use the new statistics])
483254897Serwincase "$enable_newstats" in
484254897Serwinyes)
485254897Serwin        AC_DEFINE(NEWSTATS, 1, [Use the new XML schema for statistics])
486254897Serwin	;;
487254897Serwin*)
488254897Serwin	;;
489254897Serwinesac
490254897Serwin
491254897Serwin#
492262706Serwin# check if we want DNS RRL
493262706Serwin#
494262706SerwinAC_ARG_ENABLE(rrl,
495262706Serwin	[  --enable-rrl            use DNS Response Rate Limiting])
496262706Serwincase "$enable_rrl" in
497262706Serwinyes)
498262706Serwin        AC_DEFINE(USE_RRL, 1, [Enable DNS Response Rate Limiting])
499262706Serwin        RRLLINKOBJS='${RRLOBJS}'
500262706Serwin        RRLLINKSRCS='${RRLSRCS}'
501262706Serwin	;;
502262706Serwin*)
503262706Serwin        RRLLINKOBJS=""
504262706Serwin        RRLLINKSRCS=""
505262706Serwin	;;
506262706Serwinesac
507262706SerwinAC_SUBST(RRLLINKOBJS)
508262706SerwinAC_SUBST(RRLLINKSRCS)
509262706Serwin
510262706Serwin#
511186462Sdougb# check if we have kqueue
512186462Sdougb#
513186462SdougbAC_ARG_ENABLE(kqueue,
514186462Sdougb	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
515186462Sdougb	      want_kqueue="$enableval",  want_kqueue="yes")
516186462Sdougbcase $want_kqueue in
517186462Sdougbyes)
518186462Sdougb	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
519186462Sdougb	case $ac_cv_have_kqueue in
520186462Sdougb	yes)
521186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
522186462Sdougb		;;
523186462Sdougb	*)
524186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
525186462Sdougb		;;
526186462Sdougb	esac
527186462Sdougb	;;
528186462Sdougb*)
529186462Sdougb	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
530186462Sdougb	;;
531186462Sdougbesac
532186462SdougbAC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
533135446Strhodes
534135446Strhodes#
535186462Sdougb# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
536186462Sdougb# so we need to try running the code, not just test its existence.
537186462Sdougb#
538186462SdougbAC_ARG_ENABLE(epoll,
539193149Sdougb[  --enable-epoll          use Linux epoll when available [[default=auto]]],
540193149Sdougb	      want_epoll="$enableval",  want_epoll="auto")
541186462Sdougbcase $want_epoll in
542193149Sdougbauto)
543186462Sdougb	AC_MSG_CHECKING(epoll support)
544186462Sdougb	AC_TRY_RUN([
545186462Sdougb#include <sys/epoll.h>
546186462Sdougbint main() {
547186462Sdougb	if (epoll_create(1) < 0)
548186462Sdougb		return (1);
549186462Sdougb	return (0);
550186462Sdougb}
551186462Sdougb],
552186462Sdougb	[AC_MSG_RESULT(yes)
553186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
554186462Sdougb	[AC_MSG_RESULT(no)
555254402Serwin	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"],
556254402Serwin	[AC_MSG_RESULT(no)
557186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
558186462Sdougb	;;
559193149Sdougbyes)
560193149Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
561193149Sdougb	;;
562186462Sdougb*)
563186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
564186462Sdougb	;;
565186462Sdougbesac
566186462SdougbAC_SUBST(ISC_PLATFORM_HAVEEPOLL)
567186462Sdougb
568186462Sdougb#
569186462Sdougb# check if we support /dev/poll
570186462Sdougb#
571186462SdougbAC_ARG_ENABLE(devpoll,
572186462Sdougb	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
573186462Sdougb	      want_devpoll="$enableval",  want_devpoll="yes")
574186462Sdougbcase $want_devpoll in
575186462Sdougbyes)
576218384Sdougb	AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
577186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
578186462Sdougb	,
579186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
580186462Sdougb	)
581186462Sdougb	;;
582186462Sdougb*)
583186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
584186462Sdougb	;;
585186462Sdougbesac
586186462SdougbAC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
587186462Sdougb
588186462Sdougb#
589135446Strhodes# check if we need to #include sys/select.h explicitly
590135446Strhodes#
591135446Strhodescase $ac_cv_header_unistd_h in
592135446Strhodesyes)
593135446StrhodesAC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
594135446StrhodesAC_TRY_COMPILE([
595135446Strhodes#include <sys/types.h> /* Ultrix */
596135446Strhodes#include <unistd.h>],
597135446Strhodes[fd_set read_set; return (0);],
598135446Strhodes	[AC_MSG_RESULT(yes)
599135446Strhodes	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
600135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
601135446Strhodes	[AC_MSG_RESULT(no)
602135446Strhodes	case $ac_cv_header_sys_select_h in
603135446Strhodes	yes)
604193149Sdougb	 ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
605135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
606135446Strhodes		;;
607135446Strhodes	no)
608135446Strhodes		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
609135446Strhodes		;;
610135446Strhodes	esac
611135446Strhodes	])
612135446Strhodes	;;
613135446Strhodesno)
614135446Strhodes	case $ac_cv_header_sys_select_h in
615135446Strhodes	yes)
616193149Sdougb	     ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
617135446Strhodes	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
618135446Strhodes		;;
619135446Strhodes	no)
620135446Strhodes		AC_MSG_ERROR([need either unistd.h or sys/select.h])
621135446Strhodes		;;
622135446Strhodes	esac
623135446Strhodes	;;
624135446Strhodesesac
625135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
626135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
627135446Strhodes
628135446Strhodes#
629135446Strhodes# Find the machine's endian flavor.
630135446Strhodes#
631135446StrhodesAC_C_BIGENDIAN
632135446Strhodes
633135446Strhodes#
634135446Strhodes# was --with-openssl specified?
635135446Strhodes#
636163976SdougbOPENSSL_WARNING=
637135446StrhodesAC_MSG_CHECKING(for OpenSSL library)
638135446StrhodesAC_ARG_WITH(openssl,
639204619Sdougb[  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
640193149Sdougb			  (Required for DNSSEC)],
641135446Strhodes    use_openssl="$withval", use_openssl="auto")
642135446Strhodes
643165071Sdougbopenssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
644143731Sdougbif test "$use_openssl" = "auto"
645143731Sdougbthen
646143731Sdougb	for d in $openssldirs
647143731Sdougb	do
648143731Sdougb		if test -f $d/include/openssl/opensslv.h
649143731Sdougb		then
650143731Sdougb			use_openssl=$d
651143731Sdougb			break
652143731Sdougb		fi
653143731Sdougb	done
654143731Sdougbfi
655245163SerwinOPENSSL_ECDSA=""
656224092SdougbOPENSSL_GOST=""
657135446Strhodescase "$use_openssl" in
658135446Strhodes	no)
659135446Strhodes		AC_MSG_RESULT(no)
660135446Strhodes		DST_OPENSSL_INC=""
661135446Strhodes		USE_OPENSSL=""
662254402Serwin		OPENSSLGOSTLINKOBJS=""
663254402Serwin		OPENSSLGOSTLINKSRS=""
664218384Sdougb		OPENSSLLINKOBJS=""
665218384Sdougb		OPENSSLLINKSRCS=""
666135446Strhodes		;;
667143731Sdougb	auto)
668143731Sdougb		DST_OPENSSL_INC=""
669143731Sdougb		USE_OPENSSL=""
670254402Serwin		OPENSSLGOSTLINKOBJS=""
671254402Serwin		OPENSSLGOSTLINKSRS=""
672218384Sdougb		OPENSSLLINKOBJS=""
673218384Sdougb		OPENSSLLINKSRCS=""
674204619Sdougb		AC_MSG_ERROR(
675204619Sdougb[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
676204619SdougbIf you don't want OpenSSL, use --without-openssl])
677143731Sdougb		;;
678135446Strhodes	*)
679143731Sdougb		if test "$use_openssl" = "yes"
680135446Strhodes		then
681193149Sdougb			# User did not specify a path - guess it
682135446Strhodes			for d in $openssldirs
683135446Strhodes			do
684135446Strhodes				if test -f $d/include/openssl/opensslv.h
685135446Strhodes				then
686193149Sdougb					use_openssl=$d
687135446Strhodes					break
688135446Strhodes				fi
689135446Strhodes			done
690135446Strhodes			if test "$use_openssl" = "yes"
691135446Strhodes			then
692193149Sdougb				AC_MSG_RESULT(not found)
693135446Strhodes				AC_MSG_ERROR(
694135446Strhodes[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
695135446Strhodes			fi
696193149Sdougb		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
697193149Sdougb		then
698193149Sdougb			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
699135446Strhodes		fi
700135446Strhodes		USE_OPENSSL='-DOPENSSL'
701135446Strhodes		if test "$use_openssl" = "/usr"
702135446Strhodes		then
703135446Strhodes			DST_OPENSSL_INC=""
704135446Strhodes			DNS_OPENSSL_LIBS="-lcrypto"
705135446Strhodes		else
706135446Strhodes			DST_OPENSSL_INC="-I$use_openssl/include"
707135446Strhodes			case $host in
708135446Strhodes			*-solaris*)
709135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
710135446Strhodes				;;
711165071Sdougb			*-hp-hpux*)
712165071Sdougb				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
713165071Sdougb				;;
714174187Sdougb			*-apple-darwin*)
715174187Sdougb				#
716174187Sdougb				# Apple's ld seaches for serially for dynamic
717174187Sdougb				# then static libraries.  This means you can't
718174187Sdougb				# use -L to override dynamic system libraries
719174187Sdougb				# with static ones when linking.  Instead
720174187Sdougb				# we specify a absolute path.
721174187Sdougb				#
722174187Sdougb				if test -f "$use_openssl/lib/libcrypto.dylib"
723174187Sdougb				then
724174187Sdougb					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
725174187Sdougb				else
726174187Sdougb					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
727174187Sdougb				fi
728174187Sdougb				;;
729135446Strhodes			*)
730135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
731135446Strhodes				;;
732135446Strhodes			esac
733135446Strhodes		fi
734193149Sdougb		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
735135446Strhodes
736135446Strhodes		saved_cflags="$CFLAGS"
737135446Strhodes		saved_libs="$LIBS"
738135446Strhodes		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
739135446Strhodes		LIBS="$LIBS $DNS_OPENSSL_LIBS"
740135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL works)
741135446Strhodes		AC_TRY_RUN([
742135446Strhodes#include <openssl/err.h>
743135446Strhodesint main() {
744135446Strhodes	ERR_clear_error();
745135446Strhodes	return (0);
746135446Strhodes}
747135446Strhodes],
748193149Sdougb		[AC_MSG_RESULT(yes)],
749135446Strhodes		[AC_MSG_RESULT(no)
750135446Strhodes		 AC_MSG_ERROR(Could not run test program using OpenSSL from
751135446Strhodes$use_openssl/lib and $use_openssl/include.
752135446StrhodesPlease check the argument to --with-openssl and your
753135446Strhodesshared library configuration (e.g., LD_LIBRARY_PATH).)],
754135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
755135446Strhodes
756135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
757135446Strhodes		AC_TRY_LINK([
758135446Strhodes#include <openssl/err.h>],
759135446Strhodes[ DSO_METHOD_dlfcn(); ],
760135446Strhodes		[AC_MSG_RESULT(no)],
761135446Strhodes		[LIBS="$LIBS -ldl"
762135446Strhodes		AC_TRY_LINK([
763135446Strhodes#include <openssl/err.h>
764135446Strhodes],[ DSO_METHOD_dlfcn(); ],
765135446Strhodes		[AC_MSG_RESULT(yes)
766135446Strhodes		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
767135446Strhodes		],
768135446Strhodes		 [AC_MSG_RESULT(unknown)
769135446Strhodes		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
770135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
771135446Strhodes		],
772135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)]
773135446Strhodes		)
774254897Serwin		
775163976SdougbAC_ARG_ENABLE(openssl-version-check,
776163976Sdougb[AC_HELP_STRING([--enable-openssl-version-check],
777193149Sdougb	[Check OpenSSL Version @<:@default=yes@:>@])])
778163976Sdougbcase "$enable_openssl_version_check" in
779163976Sdougbyes|'')
780135446Strhodes		AC_MSG_CHECKING(OpenSSL library version)
781135446Strhodes		AC_TRY_RUN([
782135446Strhodes#include <stdio.h>
783135446Strhodes#include <openssl/opensslv.h>
784135446Strhodesint main() {
785193149Sdougb	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
786165071Sdougb	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
787165071Sdougb	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
788193149Sdougb		return (0);
789135446Strhodes	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
790135446Strhodes		OPENSSL_VERSION_NUMBER);
791163976Sdougb	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
792163976Sdougb	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
793193149Sdougb	return (1);
794135446Strhodes}
795163976Sdougb		],
796193149Sdougb		[AC_MSG_RESULT(ok)],
797135446Strhodes		[AC_MSG_RESULT(not compatible)
798193149Sdougb		 OPENSSL_WARNING=yes
799163976Sdougb		],
800135446Strhodes		[AC_MSG_RESULT(assuming target platform has compatible version)])
801163976Sdougb;;
802163976Sdougbno)
803163976Sdougb	AC_MSG_RESULT(Skipped OpenSSL version check)
804163976Sdougb;;
805163976Sdougbesac
806163976Sdougb
807254402Serwin        AC_MSG_CHECKING(for OpenSSL DSA support)
808254402Serwin        if test -f $use_openssl/include/openssl/dsa.h
809254402Serwin        then
810254402Serwin                AC_DEFINE(HAVE_OPENSSL_DSA)
811254402Serwin                AC_MSG_RESULT(yes)
812254402Serwin        else
813254402Serwin                AC_MSG_RESULT(no)
814254402Serwin        fi
815224092Sdougb
816254402Serwin        AC_CHECK_FUNCS(EVP_sha256 EVP_sha384 EVP_sha512)
817245163Serwin
818254402Serwin        AC_MSG_CHECKING(for OpenSSL ECDSA support)
819254402Serwin        have_ecdsa=""
820254402Serwin        AC_TRY_RUN([
821245163Serwin#include <stdio.h>
822245163Serwin#include <openssl/ecdsa.h>
823245163Serwin#include <openssl/objects.h>
824245163Serwinint main() {
825245163Serwin	EC_KEY *ec256, *ec384;
826245163Serwin
827245163Serwin#if !defined(HAVE_EVP_SHA256) || !defined(HAVE_EVP_SHA384)
828245163Serwin	return (1);
829245163Serwin#endif
830245163Serwin	ec256 = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
831245163Serwin	ec384 = EC_KEY_new_by_curve_name(NID_secp384r1);
832245163Serwin	if (ec256 == NULL || ec384 == NULL)
833245163Serwin		return (2);
834245163Serwin	return (0);
835245163Serwin}
836245163Serwin],
837254402Serwin        [AC_MSG_RESULT(yes)
838254402Serwin        have_ecdsa="yes"],
839254402Serwin        [AC_MSG_RESULT(no)
840254402Serwin        have_ecdsa="no"],
841254402Serwin        [AC_MSG_RESULT(using --with-ecdsa)])
842254402Serwin        AC_ARG_WITH(ecdsa, [  --with-ecdsa            OpenSSL ECDSA],
843254402Serwin	            with_ecdsa="$withval", with_ecdsa="auto")
844254402Serwin        case "$with_ecdsa" in
845254402Serwin        yes)
846254402Serwin            case "$have_ecdsa" in
847254402Serwin            no)  AC_MSG_ERROR([ecdsa not supported]) ;;
848254402Serwin            *)  have_ecdsa=yes ;;
849254402Serwin            esac
850254402Serwin            ;;
851254402Serwin        no)
852254402Serwin            have_ecdsa=no ;;
853254402Serwin        *)
854254402Serwin            case "$have_ecdsa" in
855254402Serwin            yes|no) ;;
856254402Serwin            *) AC_MSG_ERROR([need --with-ecdsa=[[yes or no]]]) ;;
857254402Serwin            esac
858254402Serwin            ;;
859254402Serwin        esac
860254402Serwin        case $have_ecdsa in
861254402Serwin        yes)
862254402Serwin                OPENSSL_ECDSA="yes"
863254402Serwin                AC_DEFINE(HAVE_OPENSSL_ECDSA, 1,
864254402Serwin                          [Define if your OpenSSL version supports ECDSA.])
865254402Serwin                ;;
866254402Serwin        *)
867254402Serwin                ;;
868254402Serwin        esac
869245163Serwin
870254402Serwin        AC_MSG_CHECKING(for OpenSSL GOST support)
871254402Serwin        have_gost=""
872254402Serwin        AC_TRY_RUN([
873224092Sdougb#include <openssl/conf.h>
874224092Sdougb#include <openssl/engine.h>
875224092Sdougbint main() {
876224092Sdougb#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
877224092Sdougb	ENGINE *e;
878225361Sdougb	EC_KEY *ek;
879224092Sdougb
880225361Sdougb	ek = NULL;
881224092Sdougb	OPENSSL_config(NULL);
882224092Sdougb
883224092Sdougb	e = ENGINE_by_id("gost");
884224092Sdougb	if (e == NULL)
885224092Sdougb		return (1);
886224092Sdougb	if (ENGINE_init(e) <= 0)
887224092Sdougb		return (1);
888224092Sdougb	return (0);
889224092Sdougb#else
890224092Sdougb	return (1);
891224092Sdougb#endif
892224092Sdougb}
893224092Sdougb],
894254402Serwin        [AC_MSG_RESULT(yes)
895254402Serwin        have_gost="yes"],
896254402Serwin        [AC_MSG_RESULT(no)
897254402Serwin        have_gost="no"],
898254402Serwin        [AC_MSG_RESULT(using --with-gost)])
899254402Serwin        AC_ARG_WITH(gost, [  --with-gost             OpenSSL GOST],
900254402Serwin                    with_gost="$withval", with_gost="auto")
901254402Serwin        case "$with_gost" in
902254402Serwin        yes)
903254402Serwin            case "$have_gost" in
904254402Serwin            no)  AC_MSG_ERROR([gost not supported]) ;;
905254402Serwin            *)  have_gost=yes ;;
906254402Serwin            esac
907254402Serwin            ;;
908254402Serwin        no)
909254402Serwin            have_gost=no ;;
910254402Serwin        *)
911254402Serwin            case "$have_gost" in
912254402Serwin            yes|no) ;;
913254402Serwin            *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
914254402Serwin            esac
915254402Serwin            ;;
916254402Serwin        esac
917254402Serwin        case $have_gost in
918254402Serwin        yes)
919254402Serwin		OPENSSL_GOST="yes"
920254402Serwin		OPENSSLGOSTLINKOBJS='${OPENSSLGOSTLINKOBJS}'
921254402Serwin		OPENSSLGOSTLINKSRCS='${OPENSSLGOSTLINKSRCS}'
922254402Serwin		AC_DEFINE(HAVE_OPENSSL_GOST, 1,
923254402Serwin			  [Define if your OpenSSL version supports GOST.])
924254402Serwin		;;
925254402Serwin        *)
926254402Serwin                ;;
927254402Serwin        esac
928254402Serwin        CFLAGS="$saved_cflags"
929254402Serwin        LIBS="$saved_libs"
930254402Serwin        OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
931254402Serwin        OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
932204619Sdougb
933254402Serwin        ;;
934135446Strhodesesac
935135446Strhodes
936135446Strhodes#
937135446Strhodes# This would include the system openssl path (and linker options to use
938135446Strhodes# it as needed) if it is found.
939135446Strhodes#
940135446Strhodes
941135446StrhodesAC_SUBST(USE_OPENSSL)
942135446StrhodesAC_SUBST(DST_OPENSSL_INC)
943254402SerwinAC_SUBST(OPENSSLGOSTLINKOBJS)
944254402SerwinAC_SUBST(OPENSSLGOSTLINKSRCS)
945218384SdougbAC_SUBST(OPENSSLLINKOBJS)
946218384SdougbAC_SUBST(OPENSSLLINKSRCS)
947245163SerwinAC_SUBST(OPENSSL_ECDSA)
948224092SdougbAC_SUBST(OPENSSL_GOST)
949245163Serwin
950135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
951135446Strhodes
952135446Strhodes#
953224092Sdougb# Use OpenSSL for hash functions
954224092Sdougb#
955224092Sdougb
956224092SdougbAC_ARG_ENABLE(openssl-hash,
957224092Sdougb	[  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
958224092Sdougb	want_openssl_hash="$enableval", want_openssl_hash="no")
959224092Sdougbcase $want_openssl_hash in
960224092Sdougb	yes)
961224092Sdougb		if test "$USE_OPENSSL" = ""
962224092Sdougb		then
963224092Sdougb			AC_MSG_ERROR([No OpenSSL for hash functions])
964224092Sdougb		fi
965224092Sdougb		ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
966224092Sdougb		ISC_OPENSSL_INC="$DST_OPENSSL_INC"
967224092Sdougb		;;
968224092Sdougb	no)
969224092Sdougb		ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
970224092Sdougb		ISC_OPENSSL_INC=""
971224092Sdougb		;;
972224092Sdougbesac
973224092SdougbAC_SUBST(ISC_PLATFORM_OPENSSLHASH)
974224092SdougbAC_SUBST(ISC_OPENSSL_INC)
975224092Sdougb
976224092Sdougb#
977193149Sdougb# PKCS11 (aka crypto hardware) support
978135446Strhodes#
979193149Sdougb# This works only with the right OpenSSL with PKCS11 engine!
980135446Strhodes#
981135446Strhodes
982193149SdougbAC_MSG_CHECKING(for PKCS11 support)
983193149SdougbAC_ARG_WITH(pkcs11,
984224092Sdougb[  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
985224092Sdougb                          (PATH is for the PKCS11 provider)],
986224092Sdougb   use_pkcs11="$withval", use_pkcs11="no")
987135446Strhodes
988193149Sdougbcase "$use_pkcs11" in
989224092Sdougb	no|'')
990193149Sdougb		AC_MSG_RESULT(disabled)
991224092Sdougb		USE_PKCS11=''
992224092Sdougb		PKCS11_TOOLS=''
993193149Sdougb		;;
994224092Sdougb	yes|*)
995193149Sdougb		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
996193149Sdougb		USE_PKCS11='-DUSE_PKCS11'
997224092Sdougb		PKCS11_TOOLS=pkcs11
998193149Sdougb		;;
999193149Sdougbesac
1000193149SdougbAC_SUBST(USE_PKCS11)
1001224092SdougbAC_SUBST(PKCS11_TOOLS)
1002193149Sdougb
1003224092SdougbAC_MSG_CHECKING(for PKCS11 tools)
1004224092Sdougbcase "$use_pkcs11" in
1005224092Sdougb	no|yes|'')
1006224092Sdougb		AC_MSG_RESULT(disabled)
1007224092Sdougb		PKCS11_PROVIDER="undefined"
1008224092Sdougb		;;
1009224092Sdougb       *)
1010224092Sdougb		AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
1011224092Sdougb		PKCS11_PROVIDER="$use_pkcs11"
1012224092Sdougb		;;
1013224092Sdougbesac
1014224092SdougbAC_SUBST(PKCS11_PROVIDER)
1015224092Sdougb
1016193149SdougbAC_MSG_CHECKING(for GSSAPI library)
1017193149SdougbAC_ARG_WITH(gssapi,
1018225361Sdougb[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
1019225361Sdougb    use_gssapi="$withval", use_gssapi="yes")
1020193149Sdougb
1021225361Sdougb# gssapi is just the framework, we really require kerberos v5, so
1022225361Sdougb# look for those headers (the gssapi headers must be there, too)
1023225361Sdougb# The problem with this implementation is that it doesn't allow
1024225361Sdougb# for the specification of gssapi and krb5 headers in different locations,
1025225361Sdougb# which probably ought to be fixed although fixing might raise the issue of
1026225361Sdougb# trying to build with incompatible versions of gssapi and krb5.
1027193149Sdougbif test "$use_gssapi" = "yes"
1028193149Sdougbthen
1029225361Sdougb	# first, deal with the obvious
1030225361Sdougb	if test \( -f /usr/include/kerberosv5/krb5.h -o \
1031225361Sdougb		   -f /usr/include/krb5/krb5.h -o \
1032225361Sdougb		   -f /usr/include/krb5.h \)   -a \
1033225361Sdougb		\( -f /usr/include/gssapi.h -o \
1034225361Sdougb		   -f /usr/include/gssapi/gssapi.h \)
1035225361Sdougb	then
1036225361Sdougb		use_gssapi=/usr
1037225361Sdougb	else
1038225361Sdougb	    krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
1039225361Sdougb	    for d in $krb5dirs
1040225361Sdougb	    do
1041225361Sdougb		if test -f $d/include/gssapi/gssapi_krb5.h -o \
1042225361Sdougb		        -f $d/include/krb5.h
1043193149Sdougb		then
1044225361Sdougb			if test -f $d/include/gssapi/gssapi.h -o \
1045225361Sdougb			        -f $d/include/gssapi.h
1046225361Sdougb			then
1047225361Sdougb				use_gssapi=$d
1048225361Sdougb				break
1049225361Sdougb			fi
1050193149Sdougb		fi
1051225361Sdougb		use_gssapi="no"
1052225361Sdougb	    done
1053225361Sdougb	fi
1054193149Sdougbfi
1055193149Sdougb
1056193149Sdougbcase "$use_gssapi" in
1057193149Sdougb	no)
1058193149Sdougb		AC_MSG_RESULT(disabled)
1059193149Sdougb		USE_GSSAPI=''
1060193149Sdougb		;;
1061193149Sdougb	yes)
1062193149Sdougb		AC_MSG_ERROR([--with-gssapi must specify a path])
1063193149Sdougb		;;
1064193149Sdougb	*)
1065193149Sdougb		AC_MSG_RESULT(looking in $use_gssapi/lib)
1066193149Sdougb		USE_GSSAPI='-DGSSAPI'
1067193149Sdougb		saved_cppflags="$CPPFLAGS"
1068193149Sdougb		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
1069193149Sdougb		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
1070193149Sdougb		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
1071193149Sdougb
1072193149Sdougb		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
1073193149Sdougb		    AC_MSG_ERROR([gssapi.h not found])
1074193149Sdougb		fi
1075193149Sdougb
1076224092Sdougb		AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
1077224092Sdougb		    [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"])
1078224092Sdougb
1079218384Sdougb		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
1080218384Sdougb		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
1081218384Sdougb
1082218384Sdougb		if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
1083218384Sdougb		    AC_MSG_ERROR([krb5.h not found])
1084218384Sdougb		fi
1085218384Sdougb
1086193149Sdougb		CPPFLAGS="$saved_cppflags"
1087193149Sdougb
1088193149Sdougb		#
1089193149Sdougb		# XXXDCL This probably doesn't work right on all systems.
1090193149Sdougb		# It will need to be worked on as problems become evident.
1091193149Sdougb		#
1092193149Sdougb		# Essentially the problems here relate to two different
1093193149Sdougb		# areas.  The first area is building with either KTH
1094193149Sdougb		# or MIT Kerberos, particularly when both are present on
1095193149Sdougb		# the machine.  The other is static versus dynamic linking.
1096193149Sdougb		#
1097193149Sdougb		# On the KTH vs MIT issue, Both have libkrb5 that can mess
1098193149Sdougb		# up the works if one implementation ends up trying to
1099193149Sdougb		# use the other's krb.  This is unfortunately a situation
1100193149Sdougb		# that very easily arises.
1101193149Sdougb		#
1102193149Sdougb		# Dynamic linking when the dependency information is built
1103193149Sdougb		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
1104193149Sdougb		# all such problems go away, but when that setup is not
1105193149Sdougb		# present, because either the dynamic libraries lack
1106193149Sdougb		# dependencies or static linking is being done, then the
1107193149Sdougb		# problems start to show up.
1108193149Sdougb		saved_libs="$LIBS"
1109193149Sdougb		for TRY_LIBS in \
1110193149Sdougb		    "-lgssapi_krb5" \
1111193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
1112193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
1113193149Sdougb		    "-lgssapi" \
1114193149Sdougb		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
1115193149Sdougb		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
1116262706Serwin		    "-lgssapi -lkrb5 -lhx509 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
1117218384Sdougb		    "-lgss -lkrb5"
1118193149Sdougb		do
1119193149Sdougb		    # Note that this does not include $saved_libs, because
1120193149Sdougb		    # on FreeBSD machines this configure script has added
1121193149Sdougb		    # -L/usr/local/lib to LIBS, which can make the
1122193149Sdougb		    # -lgssapi_krb5 test succeed with shared libraries even
1123193149Sdougb		    # when you are trying to build with KTH in /usr/lib.
1124224092Sdougb		    if test "$use_gssapi" = "/usr"
1125224092Sdougb		    then
1126224092Sdougb			    LIBS="$TRY_LIBS"
1127224092Sdougb		    else
1128224092Sdougb			    LIBS="-L$use_gssapi/lib $TRY_LIBS"
1129224092Sdougb		    fi
1130193149Sdougb		    AC_MSG_CHECKING(linking as $TRY_LIBS)
1131218384Sdougb		    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
1132193149Sdougb				gssapi_linked=yes, gssapi_linked=no)
1133193149Sdougb		    case $gssapi_linked in
1134193149Sdougb		    yes) AC_MSG_RESULT(yes); break ;;
1135193149Sdougb		    no)  AC_MSG_RESULT(no) ;;
1136193149Sdougb		    esac
1137193149Sdougb		done
1138193149Sdougb
1139193149Sdougb		case $gssapi_linked in
1140193149Sdougb		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
1141193149Sdougb		esac
1142193149Sdougb
1143193149Sdougb		#
1144193149Sdougb		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
1145193149Sdougb		# but MIT in /usr/local/lib and trying to build with KTH.
1146193149Sdougb		# /usr/local/lib can end up earlier on the link lines.
1147193149Sdougb		# Like most kludges, this one is not only inelegant it
1148193149Sdougb		# is also likely to be the wrong thing to do at least as
1149193149Sdougb		# many times as it is the right thing.  Something better
1150193149Sdougb		# needs to be done.
1151193149Sdougb		#
1152193149Sdougb		if test "$use_gssapi" = "/usr" -a \
1153193149Sdougb			-f /usr/local/lib/libkrb5.a; then
1154193149Sdougb		    FIX_KTH_VS_MIT=yes
1155193149Sdougb		fi
1156193149Sdougb
1157193149Sdougb		case "$FIX_KTH_VS_MIT" in
1158193149Sdougb		yes)
1159193149Sdougb		    case "$enable_static_linking" in
1160193149Sdougb		    yes) gssapi_lib_suffix=".a"  ;;
1161193149Sdougb		    *)   gssapi_lib_suffix=".so" ;;
1162193149Sdougb		    esac
1163193149Sdougb
1164193149Sdougb		    for lib in $LIBS; do
1165193149Sdougb			case $lib in
1166193149Sdougb			-L*)
1167193149Sdougb			    ;;
1168193149Sdougb			-l*)
1169193149Sdougb			    new_lib=`echo $lib |
1170193149Sdougb				     sed -e s%^-l%$use_gssapi/lib/lib% \
1171193149Sdougb					 -e s%$%$gssapi_lib_suffix%`
1172193149Sdougb			    NEW_LIBS="$NEW_LIBS $new_lib"
1173193149Sdougb			    ;;
1174193149Sdougb			*)
1175193149Sdougb			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1176193149Sdougb			    ;;
1177193149Sdougb			esac
1178193149Sdougb		    done
1179193149Sdougb		    LIBS="$NEW_LIBS"
1180193149Sdougb		    ;;
1181193149Sdougb		esac
1182193149Sdougb
1183193149Sdougb		DST_GSSAPI_INC="-I$use_gssapi/include"
1184193149Sdougb		DNS_GSSAPI_LIBS="$LIBS"
1185193149Sdougb
1186193149Sdougb		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1187193149Sdougb		LIBS="$saved_libs"
1188193149Sdougb		;;
1189193149Sdougbesac
1190193149Sdougb
1191193149SdougbAC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1192193149SdougbAC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1193224092SdougbAC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1194218384SdougbAC_SUBST(ISC_PLATFORM_KRB5HEADER)
1195193149Sdougb
1196135446StrhodesAC_SUBST(USE_GSSAPI)
1197135446StrhodesAC_SUBST(DST_GSSAPI_INC)
1198193149SdougbAC_SUBST(DNS_GSSAPI_LIBS)
1199193149SdougbDNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
1200135446Strhodes
1201135446Strhodes#
1202135446Strhodes# Applications linking with libdns also need to link with these libraries.
1203135446Strhodes#
1204135446Strhodes
1205135446StrhodesAC_SUBST(DNS_CRYPTO_LIBS)
1206135446Strhodes
1207135446Strhodes#
1208135446Strhodes# was --with-randomdev specified?
1209135446Strhodes#
1210135446StrhodesAC_MSG_CHECKING(for random device)
1211135446StrhodesAC_ARG_WITH(randomdev,
1212204619Sdougb[  --with-randomdev=PATH   Specify path for random device],
1213135446Strhodes    use_randomdev="$withval", use_randomdev="unspec")
1214135446Strhodes
1215135446Strhodescase "$use_randomdev" in
1216135446Strhodes	unspec)
1217254402Serwin		case "$cross_compiling" in
1218254402Serwin		yes)
1219254402Serwin			AC_MSG_RESULT(unspecified)
1220254402Serwin			AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
1221254402Serwin		esac
1222135446Strhodes		case "$host" in
1223135446Strhodes			*-openbsd*)
1224135446Strhodes				devrandom=/dev/arandom
1225135446Strhodes				;;
1226135446Strhodes			*)
1227135446Strhodes				devrandom=/dev/random
1228135446Strhodes				;;
1229135446Strhodes		esac
1230135446Strhodes		AC_MSG_RESULT($devrandom)
1231135446Strhodes		AC_CHECK_FILE($devrandom,
1232135446Strhodes			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1233135446Strhodes						 "$devrandom"),)
1234254402Serwin			      
1235135446Strhodes		;;
1236135446Strhodes	yes)
1237135446Strhodes		AC_MSG_ERROR([--with-randomdev must specify a path])
1238135446Strhodes		;;
1239135446Strhodes	no)
1240135446Strhodes		AC_MSG_RESULT(disabled)
1241135446Strhodes		;;
1242135446Strhodes	*)
1243135446Strhodes		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1244135446Strhodes		AC_MSG_RESULT(using "$use_randomdev")
1245135446Strhodes		;;
1246135446Strhodesesac
1247135446Strhodes
1248135446Strhodes#
1249135446Strhodes# Do we have arc4random() ?
1250135446Strhodes#
1251135446StrhodesAC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1252135446Strhodes
1253153816Sdougbsinclude(config.threads.in)dnl
1254135446Strhodes
1255135446Strhodesif $use_threads
1256135446Strhodesthen
1257165071Sdougb	if test "X$GCC" = "Xyes"; then
1258165071Sdougb		case "$host" in
1259165071Sdougb		*-freebsd*)
1260165071Sdougb			CC="$CC -pthread"
1261165071Sdougb			CCOPT="$CCOPT -pthread"
1262262706Serwin			CCNOOPT="$CCNOOPT -pthread"
1263165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1264165071Sdougb			;;
1265165071Sdougb		*-openbsd*)
1266165071Sdougb			CC="$CC -pthread"
1267165071Sdougb			CCOPT="$CCOPT -pthread"
1268262706Serwin			CCNOOPT="$CCNOOPT -pthread"
1269165071Sdougb			;;
1270165071Sdougb		*-solaris*)
1271165071Sdougb			LIBS="$LIBS -lthread"
1272165071Sdougb			;;
1273165071Sdougb		*-ibm-aix*)
1274165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1275165071Sdougb			;;
1276165071Sdougb		esac
1277165071Sdougb	else
1278165071Sdougb		case $host in
1279165071Sdougb		*-dec-osf*)
1280165071Sdougb			CC="$CC -pthread"
1281165071Sdougb			CCOPT="$CCOPT -pthread"
1282262706Serwin			CCNOOPT="$CCNOOPT -pthread"
1283165071Sdougb			;;
1284165071Sdougb		*-solaris*)
1285165071Sdougb			CC="$CC -mt"
1286165071Sdougb			CCOPT="$CCOPT -mt"
1287262706Serwin			CCNOOPT="$CCNOOPT -mt"
1288165071Sdougb			;;
1289165071Sdougb		*-ibm-aix*)
1290165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1291165071Sdougb			;;
1292165071Sdougb		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
1293165071Sdougb			CC="$CC -Kthread"
1294165071Sdougb			CCOPT="$CCOPT -Kthread"
1295262706Serwin			CCNOOPT="$CCNOOPT -Kthread"
1296165071Sdougb			;;
1297165071Sdougb		*-*-sysv*OpenUNIX*)
1298165071Sdougb			CC="$CC -Kpthread"
1299165071Sdougb			CCOPT="$CCOPT -Kpthread"
1300262706Serwin			CCNOOPT="$CCNOOPT -Kpthread"
1301165071Sdougb			;;
1302165071Sdougb		esac
1303165071Sdougb	fi
1304165071Sdougb	ALWAYS_DEFINES="-D_REENTRANT"
1305165071Sdougb	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1306218384Sdougb	THREADOPTOBJS='${THREADOPTOBJS}'
1307218384Sdougb	THREADOPTSRCS='${THREADOPTSRCS}'
1308165071Sdougb	thread_dir=pthreads
1309135446Strhodes	#
1310135446Strhodes	# We'd like to use sigwait() too
1311135446Strhodes	#
1312165071Sdougb	AC_CHECK_FUNC(sigwait,
1313165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
1314165071Sdougb		      AC_CHECK_LIB(c, sigwait,
1315165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
1316165071Sdougb		      AC_CHECK_LIB(pthread, sigwait,
1317165071Sdougb				   AC_DEFINE(HAVE_SIGWAIT),
1318165071Sdougb				   AC_CHECK_LIB(pthread, _Psigwait,
1319193149Sdougb						AC_DEFINE(HAVE_SIGWAIT),))))
1320135446Strhodes
1321135446Strhodes	AC_CHECK_FUNC(pthread_attr_getstacksize,
1322135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1323135446Strhodes
1324135446Strhodes	AC_CHECK_FUNC(pthread_attr_setstacksize,
1325135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1326135446Strhodes
1327262706Serwin	AC_CHECK_HEADERS(sched.h)
1328262706Serwin
1329262706Serwin	case "$host" in
1330262706Serwin	*solaris-*)
1331262706Serwin		AC_CHECK_LIB(rt, sched_yield)
1332262706Serwin		;;
1333262706Serwin	esac
1334262706Serwin
1335262706Serwin	AC_CHECK_FUNCS(sched_yield pthread_yield pthread_yield_np)
1336262706Serwin
1337135446Strhodes	#
1338135446Strhodes	# Additional OS-specific issues related to pthreads and sigwait.
1339135446Strhodes	#
1340135446Strhodes	case "$host" in
1341135446Strhodes		#
1342135446Strhodes		# One more place to look for sigwait.
1343135446Strhodes		#
1344135446Strhodes		*-freebsd*)
1345135446Strhodes			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1346143731Sdougb			case $host in
1347153816Sdougb			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1348153816Sdougb			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1349143731Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1350143731Sdougb				;;
1351153816Sdougb			*-freebsd6.*)
1352153816Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1353153816Sdougb				;;
1354143731Sdougb			esac
1355135446Strhodes			;;
1356135446Strhodes		#
1357135446Strhodes		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
1358135446Strhodes		# called before certain pthreads calls.	 This is deprecated
1359135446Strhodes		# in BSD/OS 4.1.
1360135446Strhodes		#
1361135446Strhodes		*-bsdi3.*|*-bsdi4.0*)
1362135446Strhodes			AC_DEFINE(NEED_PTHREAD_INIT)
1363135446Strhodes			;;
1364135446Strhodes		#
1365135446Strhodes		# LinuxThreads requires some changes to the way we
1366135446Strhodes		# deal with signals.
1367135446Strhodes		#
1368135446Strhodes		*-linux*)
1369135446Strhodes			AC_DEFINE(HAVE_LINUXTHREADS)
1370135446Strhodes			;;
1371135446Strhodes		#
1372135446Strhodes		# Ensure the right sigwait() semantics on Solaris and make
1373135446Strhodes		# sure we call pthread_setconcurrency.
1374135446Strhodes		#
1375135446Strhodes		*-solaris*)
1376135446Strhodes			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1377135446Strhodes			AC_CHECK_FUNC(pthread_setconcurrency,
1378135446Strhodes				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1379135446Strhodes			;;
1380135446Strhodes		#
1381135446Strhodes		# UnixWare does things its own way.
1382135446Strhodes		#
1383135446Strhodes		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1384135446Strhodes			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1385135446Strhodes			;;
1386135446Strhodes	esac
1387135446Strhodes
1388135446Strhodes	#
1389135446Strhodes	# Look for sysconf to allow detection of the number of processors.
1390135446Strhodes	#
1391135446Strhodes	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1392135446Strhodes
1393135446Strhodeselse
1394135446Strhodes	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1395135446Strhodes	thread_dir=nothreads
1396218384Sdougb	THREADOPTOBJS=""
1397218384Sdougb	THREADOPTSRCS=""
1398135446Strhodes	ALWAYS_DEFINES=""
1399135446Strhodesfi
1400135446Strhodes
1401135446StrhodesAC_SUBST(ALWAYS_DEFINES)
1402135446StrhodesAC_SUBST(ISC_PLATFORM_USETHREADS)
1403218384SdougbAC_SUBST(THREADOPTOBJS)
1404218384SdougbAC_SUBST(THREADOPTSRCS)
1405135446StrhodesISC_THREAD_DIR=$thread_dir
1406135446StrhodesAC_SUBST(ISC_THREAD_DIR)
1407135446Strhodes
1408135446Strhodes#
1409193149Sdougb# was --with-libxml2 specified?
1410193149Sdougb#
1411193149SdougbAC_MSG_CHECKING(for libxml2 library)
1412193149SdougbAC_ARG_WITH(libxml2,
1413204619Sdougb[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1414193149Sdougb    use_libxml2="$withval", use_libxml2="auto")
1415193149Sdougb
1416193149Sdougbcase "$use_libxml2" in
1417193149Sdougb	no)
1418193149Sdougb		DST_LIBXML2_INC=""
1419193149Sdougb		;;
1420193149Sdougb	auto|yes)
1421193149Sdougb		case X`(xml2-config --version) 2>/dev/null` in
1422254402Serwin		X2.[[6789]].*)
1423193149Sdougb			libxml2_libs=`xml2-config --libs`
1424193149Sdougb			libxml2_cflags=`xml2-config --cflags`
1425193149Sdougb			;;
1426193149Sdougb		*)
1427193149Sdougb			libxml2_libs=
1428193149Sdougb			libxml2_cflags=
1429193149Sdougb			;;
1430193149Sdougb		esac
1431193149Sdougb		;;
1432193149Sdougb	*)
1433193149Sdougb		if test -f "$use_libxml2/bin/xml2-config" ; then
1434193149Sdougb			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1435193149Sdougb			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1436193149Sdougb		fi
1437193149Sdougb		;;
1438193149Sdougbesac
1439193149Sdougb
1440193149Sdougbif test "X$libxml2_libs" != "X"
1441193149Sdougbthen
1442193149Sdougb	AC_MSG_RESULT(yes)
1443193149Sdougb	CFLAGS="$CFLAGS $libxml2_cflags"
1444193149Sdougb	LIBS="$LIBS $libxml2_libs"
1445193149Sdougb	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1446193149Sdougbelse
1447193149Sdougb	AC_MSG_RESULT(no)
1448193149Sdougbfi
1449193149Sdougb
1450193149Sdougb#
1451135446Strhodes# In solaris 10, SMF can manage named service
1452135446Strhodes#
1453135446StrhodesAC_CHECK_LIB(scf, smf_enable_instance)
1454135446Strhodes
1455135446Strhodes#
1456135446Strhodes# flockfile is usually provided by pthreads, but we may want to use it
1457135446Strhodes# even if compiled with --disable-threads.  getc_unlocked might also not
1458135446Strhodes# be defined.
1459135446Strhodes#
1460135446StrhodesAC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1461135446StrhodesAC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1462135446Strhodes
1463254897Serwin#
1464135446Strhodes# Indicate what the final decision was regarding threads.
1465135446Strhodes#
1466135446StrhodesAC_MSG_CHECKING(whether to build with threads)
1467135446Strhodesif $use_threads; then
1468135446Strhodes	AC_MSG_RESULT(yes)
1469135446Strhodeselse
1470135446Strhodes	AC_MSG_RESULT(no)
1471135446Strhodesfi
1472135446Strhodes
1473254897Serwin#
1474135446Strhodes# End of pthreads stuff.
1475135446Strhodes#
1476135446Strhodes
1477135446Strhodes#
1478135446Strhodes# Large File
1479135446Strhodes#
1480135446StrhodesAC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1481135446Strhodes	      want_largefile="yes", want_largefile="no")
1482135446Strhodescase $want_largefile in
1483135446Strhodes	yes)
1484135446Strhodes		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1485135446Strhodes		;;
1486135446Strhodes	*)
1487135446Strhodes		;;
1488135446Strhodesesac
1489135446Strhodes
1490135446Strhodes#
1491135446Strhodes# Additional compiler settings.
1492135446Strhodes#
1493135446StrhodesMKDEPCC="$CC"
1494135446StrhodesMKDEPCFLAGS="-M"
1495135446StrhodesIRIX_DNSSEC_WARNINGS_HACK=""
1496135446Strhodes
1497135446Strhodesif test "X$GCC" = "Xyes"; then
1498165071Sdougb	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1499165071Sdougb	SAVE_CFLAGS=$CFLAGS
1500218384Sdougb	CFLAGS="$CFLAGS -fno-strict-aliasing"
1501165071Sdougb	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1502165071Sdougb	CFLAGS=$SAVE_CFLAGS
1503165071Sdougb	if test "$FNOSTRICTALIASING" = "yes"; then
1504165071Sdougb		AC_MSG_RESULT(yes)
1505165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1506165071Sdougb	else
1507165071Sdougb		AC_MSG_RESULT(no)
1508165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1509165071Sdougb	fi
1510143731Sdougb	case "$host" in
1511143731Sdougb	*-hp-hpux*)
1512153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1513143731Sdougb		;;
1514143731Sdougb	esac
1515135446Strhodeselse
1516135446Strhodes	case $host in
1517135446Strhodes	*-dec-osf*)
1518135446Strhodes		CC="$CC -std"
1519135446Strhodes		CCOPT="$CCOPT -std"
1520262706Serwin		CCNOOPT="$CCNOOPT -std"
1521135446Strhodes		MKDEPCC="$CC"
1522135446Strhodes		;;
1523135446Strhodes	*-hp-hpux*)
1524135446Strhodes		CC="$CC -Ae -z"
1525135446Strhodes		# The version of the C compiler that constantly warns about
1526193149Sdougb		# 'const' as well as alignment issues is unfortunately not
1527193149Sdougb		# able to be discerned via the version of the operating
1528193149Sdougb		# system, nor does cc have a version flag.
1529135446Strhodes		case "`$CC +W 123 2>&1`" in
1530135446Strhodes		*Unknown?option*)
1531135446Strhodes			STD_CWARNINGS="+w1"
1532135446Strhodes			;;
1533135446Strhodes		*)
1534135446Strhodes			# Turn off the pointlessly noisy warnings.
1535153816Sdougb			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1536135446Strhodes			;;
1537135446Strhodes		esac
1538135446Strhodes		CCOPT="$CCOPT -Ae -z"
1539262706Serwin		CCNOOPT="$CCNOOPT -Ae -z"
1540153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1541135446Strhodes		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1542135446Strhodes		;;
1543135446Strhodes	*-sgi-irix*)
1544135446Strhodes		STD_CWARNINGS="-fullwarn -woff 1209"
1545135446Strhodes		#
1546135446Strhodes		# Silence more than 250 instances of
1547135446Strhodes		#   "prototyped function redeclared without prototype"
1548135446Strhodes		# and 11 instances of
1549135446Strhodes		#   "variable ... was set but never used"
1550135446Strhodes		# from lib/dns/sec/openssl.
1551135446Strhodes		#
1552135446Strhodes		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1553135446Strhodes		;;
1554135446Strhodes	*-solaris*)
1555135446Strhodes		MKDEPCFLAGS="-xM"
1556135446Strhodes		;;
1557135446Strhodes	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1558193149Sdougb		# UnixWare
1559135446Strhodes		CC="$CC -w"
1560135446Strhodes		;;
1561135446Strhodes	esac
1562135446Strhodesfi
1563135446Strhodes
1564135446StrhodesAC_SUBST(MKDEPCC)
1565135446StrhodesAC_SUBST(MKDEPCFLAGS)
1566135446StrhodesAC_SUBST(MKDEPPROG)
1567135446StrhodesAC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1568135446Strhodes
1569135446Strhodes#
1570135446Strhodes# NLS
1571135446Strhodes#
1572135446StrhodesAC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1573135446Strhodes
1574135446Strhodes#
1575135446Strhodes# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1576135446Strhodes#
1577135446Strhodes# AC_CHECK_LIB(xnet, socket, ,
1578135446Strhodes#    AC_CHECK_LIB(socket, socket)
1579135446Strhodes# )
1580135446Strhodes#
1581135446Strhodes# Use this for now, instead:
1582135446Strhodes#
1583135446Strhodescase "$host" in
1584135446Strhodes	mips-sgi-irix*)
1585135446Strhodes		;;
1586193149Sdougb	*-linux*)
1587193149Sdougb		;;
1588135446Strhodes	*)
1589135446Strhodes		AC_CHECK_LIB(socket, socket)
1590193149Sdougb		AC_CHECK_LIB(nsl, inet_addr)
1591135446Strhodes		;;
1592135446Strhodesesac
1593135446Strhodes
1594135446Strhodes#
1595186462Sdougb# Work around Solaris's select() limitations.
1596186462Sdougb#
1597186462Sdougbcase "$host" in
1598186462Sdougb	*-solaris2.[[89]]|*-solaris2.1?)
1599186462Sdougb	AC_DEFINE(FD_SETSIZE, 65536,
1600186462Sdougb		  [Solaris hack to get select_large_fdset.])
1601186462Sdougb	;;
1602186462Sdougbesac
1603186462Sdougb
1604186462Sdougb#
1605135446Strhodes# Purify support
1606135446Strhodes#
1607135446StrhodesAC_MSG_CHECKING(whether to use purify)
1608135446StrhodesAC_ARG_WITH(purify,
1609204619Sdougb	[  --with-purify[=PATH]      use Rational purify],
1610135446Strhodes	use_purify="$withval", use_purify="no")
1611135446Strhodes
1612135446Strhodescase "$use_purify" in
1613135446Strhodes	no)
1614135446Strhodes		;;
1615135446Strhodes	yes)
1616135446Strhodes		AC_PATH_PROG(purify_path, purify, purify)
1617135446Strhodes		;;
1618135446Strhodes	*)
1619135446Strhodes		purify_path="$use_purify"
1620135446Strhodes		;;
1621135446Strhodesesac
1622135446Strhodes
1623135446Strhodescase "$use_purify" in
1624135446Strhodes	no)
1625135446Strhodes		AC_MSG_RESULT(no)
1626135446Strhodes		PURIFY=""
1627135446Strhodes		;;
1628135446Strhodes	*)
1629135446Strhodes		if test -f $purify_path || test $purify_path = purify; then
1630135446Strhodes			AC_MSG_RESULT($purify_path)
1631135446Strhodes			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1632135446Strhodes			PURIFY="$purify_path $PURIFYFLAGS"
1633135446Strhodes		else
1634135446Strhodes			AC_MSG_ERROR([$purify_path not found.
1635135446Strhodes
1636135446StrhodesPlease choose the proper path with the following command:
1637135446Strhodes
1638135446Strhodes    configure --with-purify=PATH
1639135446Strhodes])
1640135446Strhodes		fi
1641135446Strhodes		;;
1642135446Strhodesesac
1643135446Strhodes
1644135446StrhodesAC_SUBST(PURIFY)
1645135446Strhodes
1646186462Sdougb
1647135446StrhodesAC_ARG_WITH(libtool,
1648204619Sdougb	    [  --with-libtool          use GNU libtool],
1649135446Strhodes	    use_libtool="$withval", use_libtool="no")
1650135446Strhodes
1651135446Strhodescase $use_libtool in
1652135446Strhodes	yes)
1653135446Strhodes		AM_PROG_LIBTOOL
1654135446Strhodes		O=lo
1655135446Strhodes		A=la
1656135446Strhodes		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1657234010Sdougb		LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1658234010Sdougb		LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1659234010Sdougb		LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1660143731Sdougb		case "$host" in
1661143731Sdougb		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1662143731Sdougb		esac
1663143731Sdougb		case "$host" in
1664143731Sdougb		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1665143731Sdougb		*) LIBTOOL_IN_MAIN= ;;
1666143731Sdougb		esac;
1667135446Strhodes		;;
1668135446Strhodes	*)
1669135446Strhodes		O=o
1670135446Strhodes		A=a
1671135446Strhodes		LIBTOOL=
1672135446Strhodes		AC_SUBST(LIBTOOL)
1673135446Strhodes		LIBTOOL_MKDEP_SED=
1674135446Strhodes		LIBTOOL_MODE_COMPILE=
1675135446Strhodes		LIBTOOL_MODE_INSTALL=
1676135446Strhodes		LIBTOOL_MODE_LINK=
1677143731Sdougb		LIBTOOL_ALLOW_UNDEFINED=
1678143731Sdougb		LIBTOOL_IN_MAIN=
1679135446Strhodes		;;
1680135446Strhodesesac
1681135446Strhodes
1682135446Strhodes#
1683224092Sdougb# enable/disable dumping stack backtrace.  Also check if the system supports
1684224092Sdougb# glibc-compatible backtrace() function.
1685224092Sdougb#
1686224092SdougbAC_ARG_ENABLE(backtrace,
1687224092Sdougb[  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
1688224092Sdougb	      want_backtrace="$enableval",  want_backtrace="yes")
1689224092Sdougbcase $want_backtrace in
1690224092Sdougbyes)
1691224092Sdougb	ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
1692224092Sdougb	AC_TRY_LINK([#include <execinfo.h>],
1693224092Sdougb	[return (backtrace((void **)0, 0));],
1694224092Sdougb	[AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
1695224092Sdougb	;;
1696224092Sdougb*)
1697224092Sdougb	ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
1698224092Sdougb	;;
1699224092Sdougbesac
1700224092SdougbAC_SUBST(ISC_PLATFORM_USEBACKTRACE)
1701224092Sdougb
1702224092SdougbAC_ARG_ENABLE(symtable,
1703224092Sdougb[  --enable-symtable       use internal symbol table for backtrace
1704224092Sdougb                          [[all|minimal(default)|none]]],
1705224092Sdougb		want_symtable="$enableval",  want_symtable="minimal")
1706224092Sdougbcase $want_symtable in
1707224092Sdougbyes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
1708224092Sdougb	if test "$PERL" = ""
1709224092Sdougb	then
1710224092Sdougb		AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1711224092SdougbInstall perl or explicitly disable the feature by --disable-symtable.])
1712224092Sdougb	fi
1713224092Sdougb	if test "$use_libtool" = "yes"; then
1714224092Sdougb		AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
1715224092Sdougb	else
1716224092Sdougb		# we generate the internal symbol table only for those systems
1717224092Sdougb		# known to work to avoid unexpected build failure.  Also, warn
1718224092Sdougb		# about unsupported systems when the feature is enabled
1719224092Sdougb		#  manually.
1720224092Sdougb		case $host_os in
1721224092Sdougb		freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1722224092Sdougb			MKSYMTBL_PROGRAM="$PERL"
1723224092Sdougb			if test $want_symtable = all; then
1724224092Sdougb				ALWAYS_MAKE_SYMTABLE="yes"
1725224092Sdougb			fi
1726224092Sdougb			;;
1727224092Sdougb		*)
1728224092Sdougb			if test $want_symtable = yes -o $want_symtable = all
1729224092Sdougb			then
1730224092Sdougb				AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1731224092Sdougb			fi
1732224092Sdougb		esac
1733224092Sdougb	fi
1734224092Sdougb	;;
1735224092Sdougb*)
1736224092Sdougb	;;
1737224092Sdougbesac
1738224092SdougbAC_SUBST(MKSYMTBL_PROGRAM)
1739224092SdougbAC_SUBST(ALWAYS_MAKE_SYMTABLE)
1740224092Sdougb
1741224092Sdougb#
1742135446Strhodes# File name extension for static archive files, for those few places
1743135446Strhodes# where they are treated differently from dynamic ones.
1744135446Strhodes#
1745135446StrhodesSA=a
1746135446Strhodes
1747135446StrhodesAC_SUBST(O)
1748135446StrhodesAC_SUBST(A)
1749135446StrhodesAC_SUBST(SA)
1750135446StrhodesAC_SUBST(LIBTOOL_MKDEP_SED)
1751135446StrhodesAC_SUBST(LIBTOOL_MODE_COMPILE)
1752135446StrhodesAC_SUBST(LIBTOOL_MODE_INSTALL)
1753135446StrhodesAC_SUBST(LIBTOOL_MODE_LINK)
1754143731SdougbAC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1755143731SdougbAC_SUBST(LIBTOOL_IN_MAIN)
1756135446Strhodes
1757135446Strhodes#
1758224092Sdougb# build exportable DNS library?
1759224092Sdougb#
1760224092SdougbAC_ARG_ENABLE(exportlib,
1761254402Serwin	[  --enable-exportlib	  build exportable library (GNU make required)
1762254402Serwin                          [[default=no]]])
1763224092Sdougbcase "$enable_exportlib" in
1764224092Sdougb	yes)
1765224092Sdougb		gmake=
1766224092Sdougb		for x in gmake gnumake make; do
1767224092Sdougb			if $x --version 2>/dev/null | grep GNU > /dev/null; then
1768224092Sdougb				gmake=$x
1769224092Sdougb				break;
1770224092Sdougb			fi
1771224092Sdougb		done
1772224092Sdougb		if test -z "$gmake"; then
1773224092Sdougb			AC_MSG_ERROR([exportlib requires GNU make.  Install it or disable the feature.])
1774224092Sdougb		fi
1775224092Sdougb		LIBEXPORT=lib/export
1776224092Sdougb		AC_SUBST(LIBEXPORT)
1777224092Sdougb		BIND9_CO_RULE="%.$O:  \${srcdir}/%.c"
1778224092Sdougb		;;
1779224092Sdougb	no|*)
1780224092Sdougb		BIND9_CO_RULE=".c.$O:"
1781224092Sdougb		;;
1782224092Sdougbesac
1783224092SdougbAC_SUBST(BIND9_CO_RULE)
1784224092Sdougb
1785224092SdougbAC_ARG_WITH(export-libdir,
1786224092Sdougb	[  --with-export-libdir[=PATH]
1787254402Serwin                          installation directory for the export library
1788254402Serwin                          [[EPREFIX/lib/bind9]]],
1789224092Sdougb	export_libdir="$withval",)
1790224092Sdougbif test -z "$export_libdir"; then
1791224092Sdougb	export_libdir="\${exec_prefix}/lib/bind9/"
1792224092Sdougbfi
1793224092SdougbAC_SUBST(export_libdir)
1794224092Sdougb
1795224092SdougbAC_ARG_WITH(export-includedir,
1796224092Sdougb	[  --with-export-includedir[=PATH]
1797254402Serwin                          installation directory for the header files of the
1798254402Serwin                          export library [[PREFIX/include/bind9]]],
1799224092Sdougb	export_includedir="$withval",)
1800224092Sdougbif test -z "$export_includedir"; then
1801224092Sdougb	export_includedir="\${prefix}/include/bind9/"
1802224092Sdougbfi
1803224092SdougbAC_SUBST(export_includedir)
1804224092Sdougb
1805224092Sdougb#
1806135446Strhodes# Here begins a very long section to determine the system's networking
1807193149Sdougb# capabilities.  The order of the tests is significant.
1808135446Strhodes#
1809135446Strhodes
1810135446Strhodes#
1811135446Strhodes# IPv6
1812135446Strhodes#
1813135446StrhodesAC_ARG_ENABLE(ipv6,
1814204619Sdougb	[  --enable-ipv6           use IPv6 [default=autodetect]])
1815135446Strhodes
1816135446Strhodescase "$enable_ipv6" in
1817135446Strhodes	yes|''|autodetect)
1818135446Strhodes		AC_DEFINE(WANT_IPV6)
1819135446Strhodes		;;
1820135446Strhodes	no)
1821135446Strhodes		;;
1822135446Strhodesesac
1823135446Strhodes
1824135446Strhodes#
1825135446Strhodes# We do the IPv6 compilation checking after libtool so that we can put
1826135446Strhodes# the right suffix on the files.
1827135446Strhodes#
1828135446StrhodesAC_MSG_CHECKING(for IPv6 structures)
1829135446StrhodesAC_TRY_COMPILE([
1830135446Strhodes#include <sys/types.h>
1831135446Strhodes#include <sys/socket.h>
1832135446Strhodes#include <netinet/in.h>],
1833135446Strhodes[struct sockaddr_in6 sin6; return (0);],
1834135446Strhodes	[AC_MSG_RESULT(yes)
1835135446Strhodes	 found_ipv6=yes],
1836135446Strhodes	[AC_MSG_RESULT(no)
1837135446Strhodes	 found_ipv6=no])
1838135446Strhodes
1839135446Strhodes#
1840135446Strhodes# See whether IPv6 support is provided via a Kame add-on.
1841135446Strhodes# This is done before other IPv6 linking tests to LIBS is properly set.
1842135446Strhodes#
1843135446StrhodesAC_MSG_CHECKING(for Kame IPv6 support)
1844135446StrhodesAC_ARG_WITH(kame,
1845204619Sdougb	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1846135446Strhodes	use_kame="$withval", use_kame="no")
1847135446Strhodes
1848135446Strhodescase "$use_kame" in
1849135446Strhodes	no)
1850135446Strhodes		;;
1851135446Strhodes	yes)
1852135446Strhodes		kame_path=/usr/local/v6
1853135446Strhodes		;;
1854135446Strhodes	*)
1855135446Strhodes		kame_path="$use_kame"
1856135446Strhodes		;;
1857135446Strhodesesac
1858135446Strhodes
1859135446Strhodescase "$use_kame" in
1860135446Strhodes	no)
1861135446Strhodes		AC_MSG_RESULT(no)
1862135446Strhodes		;;
1863135446Strhodes	*)
1864135446Strhodes		if test -f $kame_path/lib/libinet6.a; then
1865135446Strhodes			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1866135446Strhodes			LIBS="-L$kame_path/lib -linet6 $LIBS"
1867135446Strhodes		else
1868135446Strhodes			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1869135446Strhodes
1870135446StrhodesPlease choose the proper path with the following command:
1871135446Strhodes
1872135446Strhodes    configure --with-kame=PATH
1873135446Strhodes])
1874135446Strhodes		fi
1875135446Strhodes		;;
1876135446Strhodesesac
1877135446Strhodes
1878135446Strhodes#
1879135446Strhodes# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1880135446Strhodes# Including it on Kame-using platforms is very bad, though, because
1881135446Strhodes# Kame uses #error against direct inclusion.   So include it on only
1882135446Strhodes# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1883135446Strhodes# This is done before the in6_pktinfo check because that's what
1884135446Strhodes# netinet6/in6.h is needed for.
1885135446Strhodes#
1886135446Strhodeschangequote({, })
1887135446Strhodescase "$host" in
1888135446Strhodes*-bsdi4.[01]*)
1889135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1890135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1891135446Strhodes	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1892135446Strhodes	;;
1893135446Strhodes*)
1894135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1895135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1896135446Strhodes	isc_netinet6in6_hack=""
1897135446Strhodes	;;
1898135446Strhodesesac
1899135446Strhodeschangequote([, ])
1900135446Strhodes
1901135446Strhodes#
1902135446Strhodes# This is similar to the netinet6/in6.h issue.
1903135446Strhodes#
1904135446Strhodescase "$host" in
1905135446Strhodes*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1906193149Sdougb	# UnixWare
1907135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1908135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1909193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1910135446Strhodes	isc_netinetin6_hack="#include <netinet/in6.h>"
1911135446Strhodes	;;
1912135446Strhodes*)
1913135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1914135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1915193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1916135446Strhodes	isc_netinetin6_hack=""
1917135446Strhodes	;;
1918135446Strhodesesac
1919135446Strhodes
1920135446Strhodes#
1921135446Strhodes# Now delve deeper into the suitability of the IPv6 support.
1922135446Strhodes#
1923135446Strhodescase "$found_ipv6" in
1924135446Strhodes	yes)
1925135446Strhodes		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1926135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1927135446Strhodes
1928135446Strhodes		AC_MSG_CHECKING(for in6_addr)
1929135446Strhodes		AC_TRY_COMPILE([
1930135446Strhodes#include <sys/types.h>
1931135446Strhodes#include <sys/socket.h>
1932135446Strhodes#include <netinet/in.h>
1933135446Strhodes$isc_netinetin6_hack
1934135446Strhodes$isc_netinet6in6_hack
1935135446Strhodes],
1936135446Strhodes[struct in6_addr in6; return (0);],
1937135446Strhodes		[AC_MSG_RESULT(yes)
1938135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1939135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1940135446Strhodes		 isc_in_addr6_hack=""],
1941135446Strhodes		[AC_MSG_RESULT(no)
1942135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1943135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1944135446Strhodes		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1945135446Strhodes
1946135446Strhodes		AC_MSG_CHECKING(for in6addr_any)
1947135446Strhodes		AC_TRY_LINK([
1948135446Strhodes#include <sys/types.h>
1949135446Strhodes#include <sys/socket.h>
1950135446Strhodes#include <netinet/in.h>
1951135446Strhodes$isc_netinetin6_hack
1952135446Strhodes$isc_netinet6in6_hack
1953135446Strhodes$isc_in_addr6_hack
1954135446Strhodes],
1955135446Strhodes		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1956135446Strhodes			[AC_MSG_RESULT(yes)
1957135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1958135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1959135446Strhodes			[AC_MSG_RESULT(no)
1960135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1961135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1962135446Strhodes
1963135446Strhodes		AC_MSG_CHECKING(for in6addr_loopback)
1964135446Strhodes		AC_TRY_LINK([
1965135446Strhodes#include <sys/types.h>
1966135446Strhodes#include <sys/socket.h>
1967135446Strhodes#include <netinet/in.h>
1968135446Strhodes$isc_netinetin6_hack
1969135446Strhodes$isc_netinet6in6_hack
1970135446Strhodes$isc_in_addr6_hack
1971135446Strhodes],
1972135446Strhodes		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1973135446Strhodes			[AC_MSG_RESULT(yes)
1974135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1975135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1976135446Strhodes			[AC_MSG_RESULT(no)
1977135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1978135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1979135446Strhodes
1980135446Strhodes		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1981135446Strhodes		AC_TRY_COMPILE([
1982135446Strhodes#include <sys/types.h>
1983135446Strhodes#include <sys/socket.h>
1984135446Strhodes#include <netinet/in.h>
1985135446Strhodes$isc_netinetin6_hack
1986135446Strhodes$isc_netinet6in6_hack
1987135446Strhodes],
1988135446Strhodes		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1989135446Strhodes			[AC_MSG_RESULT(yes)
1990135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1991135446Strhodes			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1992135446Strhodes			[AC_MSG_RESULT(no)
1993135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1994135446Strhodes			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1995135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1996135446Strhodes
1997135446Strhodes		AC_MSG_CHECKING(for in6_pktinfo)
1998135446Strhodes		AC_TRY_COMPILE([
1999135446Strhodes#include <sys/types.h>
2000135446Strhodes#include <sys/socket.h>
2001135446Strhodes#include <netinet/in.h>
2002135446Strhodes$isc_netinetin6_hack
2003135446Strhodes$isc_netinet6in6_hack
2004135446Strhodes],
2005135446Strhodes		[struct in6_pktinfo xyzzy; return (0);],
2006135446Strhodes			[AC_MSG_RESULT(yes)
2007135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
2008135446Strhodes			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
2009135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
2010135446Strhodes		;;
2011135446Strhodes	no)
2012135446Strhodes		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
2013135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
2014135446Strhodes		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
2015135446Strhodes		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
2016135446Strhodes		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
2017135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
2018135446Strhodes		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
2019135446Strhodes		ISC_IPV6_H="ipv6.h"
2020135446Strhodes		ISC_IPV6_O="ipv6.$O"
2021135446Strhodes		ISC_ISCIPV6_O="unix/ipv6.$O"
2022135446Strhodes		ISC_IPV6_C="ipv6.c"
2023135446Strhodes		;;
2024135446Strhodesesac
2025135446Strhodes
2026135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIPV6)
2027135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEIPV6)
2028135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
2029135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
2030135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
2031135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
2032135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEINADDR6)
2033135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
2034135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
2035135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
2036135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
2037135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
2038135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
2039135446StrhodesAC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
2040135446StrhodesAC_SUBST(ISC_IPV6_H)
2041135446StrhodesAC_SUBST(ISC_IPV6_O)
2042135446StrhodesAC_SUBST(ISC_ISCIPV6_O)
2043135446StrhodesAC_SUBST(ISC_IPV6_C)
2044135446StrhodesAC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
2045135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESCOPEID)
2046135446Strhodes
2047135446StrhodesAC_MSG_CHECKING([for struct if_laddrreq])
2048135446StrhodesAC_TRY_LINK([
2049135446Strhodes#include <sys/types.h>
2050135446Strhodes#include <net/if6.h>
2051135446Strhodes],[ struct if_laddrreq a; ],
2052135446Strhodes	[AC_MSG_RESULT(yes)
2053135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
2054135446Strhodes	[AC_MSG_RESULT(no)
2055135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
2056135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
2057135446Strhodes
2058135446StrhodesAC_MSG_CHECKING([for struct if_laddrconf])
2059135446StrhodesAC_TRY_LINK([
2060135446Strhodes#include <sys/types.h>
2061135446Strhodes#include <net/if6.h>
2062135446Strhodes],[ struct if_laddrconf a; ],
2063135446Strhodes	[AC_MSG_RESULT(yes)
2064135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
2065135446Strhodes	[AC_MSG_RESULT(no)
2066135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
2067135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
2068135446Strhodes
2069135446Strhodes#
2070135446Strhodes# Check for network functions that are often missing.  We do this
2071135446Strhodes# after the libtool checking, so we can put the right suffix on
2072135446Strhodes# the files.  It also needs to come after checking for a Kame add-on,
2073135446Strhodes# which provides some (all?) of the desired functions.
2074135446Strhodes#
2075135446Strhodes
2076135446StrhodesAC_MSG_CHECKING([for inet_ntop with IPv6 support])
2077135446StrhodesAC_TRY_RUN([
2078135446Strhodes#include <sys/types.h>
2079135446Strhodes#include <sys/socket.h>
2080135446Strhodes#include <netinet/in.h>
2081135446Strhodes#include <arpa/inet.h>
2082135446Strhodesmain() {
2083135446Strhodeschar a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
2084193149Sdougb	[AC_MSG_RESULT(yes)
2085193149Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
2086135446Strhodes
2087193149Sdougb	[AC_MSG_RESULT(no)
2088193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
2089193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
2090193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
2091225361Sdougb	[AC_MSG_RESULT(assuming inet_ntop not needed)
2092225361Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
2093135446Strhodes
2094135446Strhodes
2095135446Strhodes# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
2096135446Strhodes# addresses with less than four octets, like "1.2.3".  Also leading
2097135446Strhodes# zeros should also be rejected.
2098135446Strhodes
2099135446StrhodesAC_MSG_CHECKING([for working inet_pton with IPv6 support])
2100135446StrhodesAC_TRY_RUN([
2101135446Strhodes#include <sys/types.h>
2102135446Strhodes#include <sys/socket.h>
2103135446Strhodes#include <netinet/in.h>
2104135446Strhodes#include <arpa/inet.h>
2105135446Strhodesmain() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
2106254897Serwin			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
2107135446Strhodes			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
2108193149Sdougb	[AC_MSG_RESULT(yes)
2109193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
2110193149Sdougb	[AC_MSG_RESULT(no)
2111193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2112193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2113193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
2114193149Sdougb	[AC_MSG_RESULT(assuming inet_pton needed)
2115193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2116193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2117225361Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
2118135446Strhodes
2119135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNTOP)
2120135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPTON)
2121135446Strhodes
2122135446Strhodes#
2123135446Strhodes# Look for a 4.4BSD-style sa_len member in struct sockaddr.
2124135446Strhodes#
2125135446Strhodescase "$host" in
2126135446Strhodes	*-dec-osf*)
2127135446Strhodes		# Turn on 4.4BSD style sa_len support.
2128135446Strhodes		AC_DEFINE(_SOCKADDR_LEN)
2129135446Strhodes		;;
2130135446Strhodesesac
2131135446Strhodes
2132135446StrhodesAC_MSG_CHECKING(for sa_len in struct sockaddr)
2133135446StrhodesAC_TRY_COMPILE([
2134135446Strhodes#include <sys/types.h>
2135135446Strhodes#include <sys/socket.h>],
2136135446Strhodes[struct sockaddr sa; sa.sa_len = 0; return (0);],
2137135446Strhodes	[AC_MSG_RESULT(yes)
2138135446Strhodes	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
2139135446Strhodes	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
2140135446Strhodes	[AC_MSG_RESULT(no)
2141135446Strhodes	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
2142135446Strhodes	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
2143135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESALEN)
2144135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVESALEN)
2145135446Strhodes
2146135446Strhodes#
2147135446Strhodes# Look for a 4.4BSD or 4.3BSD struct msghdr
2148135446Strhodes#
2149135446StrhodesAC_MSG_CHECKING(for struct msghdr flavor)
2150135446StrhodesAC_TRY_COMPILE([
2151135446Strhodes#include <sys/types.h>
2152135446Strhodes#include <sys/socket.h>],
2153135446Strhodes[struct msghdr msg; msg.msg_flags = 0; return (0);],
2154135446Strhodes	[AC_MSG_RESULT(4.4BSD)
2155135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
2156135446Strhodes	[AC_MSG_RESULT(4.3BSD)
2157135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
2158135446StrhodesAC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
2159135446Strhodes
2160135446Strhodes#
2161135446Strhodes# Look for in_port_t.
2162135446Strhodes#
2163135446StrhodesAC_MSG_CHECKING(for type in_port_t)
2164135446StrhodesAC_TRY_COMPILE([
2165135446Strhodes#include <sys/types.h>
2166135446Strhodes#include <netinet/in.h>],
2167135446Strhodes[in_port_t port = 25; return (0);],
2168135446Strhodes	[AC_MSG_RESULT(yes)
2169135446Strhodes	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
2170193149Sdougb	[AC_MSG_RESULT(no)
2171135446Strhodes	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
2172135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPORTT)
2173135446Strhodes
2174135446Strhodes#
2175135446Strhodes# Check for addrinfo
2176135446Strhodes#
2177135446StrhodesAC_MSG_CHECKING(for struct addrinfo)
2178135446StrhodesAC_TRY_COMPILE([
2179135446Strhodes#include <netdb.h>],
2180135446Strhodes[struct addrinfo a; return (0);],
2181135446Strhodes	[AC_MSG_RESULT(yes)
2182135446Strhodes	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
2183224092Sdougb	ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
2184135446Strhodes	AC_DEFINE(HAVE_ADDRINFO)],
2185135446Strhodes	[AC_MSG_RESULT(no)
2186224092Sdougb	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
2187224092Sdougb	ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
2188135446StrhodesAC_SUBST(ISC_LWRES_NEEDADDRINFO)
2189224092SdougbAC_SUBST(ISC_IRS_NEEDADDRINFO)
2190135446Strhodes
2191135446Strhodes#
2192135446Strhodes# Check for rrsetinfo
2193135446Strhodes#
2194135446StrhodesAC_MSG_CHECKING(for struct rrsetinfo)
2195135446StrhodesAC_TRY_COMPILE([
2196135446Strhodes#include <netdb.h>],
2197135446Strhodes[struct rrsetinfo r; return (0);],
2198135446Strhodes	[AC_MSG_RESULT(yes)
2199135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
2200135446Strhodes	[AC_MSG_RESULT(no)
2201135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
2202135446StrhodesAC_SUBST(ISC_LWRES_NEEDRRSETINFO)
2203135446Strhodes
2204135446StrhodesAC_MSG_CHECKING(for int sethostent)
2205135446StrhodesAC_TRY_COMPILE([
2206135446Strhodes#include <netdb.h>],
2207135446Strhodes[int i = sethostent(0); return(0);],
2208135446Strhodes	[AC_MSG_RESULT(yes)
2209135446Strhodes	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
2210135446Strhodes	[AC_MSG_RESULT(no)
2211135446Strhodes	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
2212135446StrhodesAC_SUBST(ISC_LWRES_SETHOSTENTINT)
2213135446Strhodes
2214135446StrhodesAC_MSG_CHECKING(for int endhostent)
2215135446StrhodesAC_TRY_COMPILE([
2216135446Strhodes#include <netdb.h>],
2217135446Strhodes[int i = endhostent(); return(0);],
2218135446Strhodes	[AC_MSG_RESULT(yes)
2219135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
2220135446Strhodes	[AC_MSG_RESULT(no)
2221135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
2222135446StrhodesAC_SUBST(ISC_LWRES_ENDHOSTENTINT)
2223135446Strhodes
2224135446StrhodesAC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
2225135446StrhodesAC_TRY_COMPILE([
2226135446Strhodes#include <netdb.h>
2227135446Strhodesstruct netent *getnetbyaddr(in_addr_t, int);],
2228135446Strhodes[],
2229135446Strhodes	[AC_MSG_RESULT(yes)
2230135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
2231135446Strhodes	[AC_MSG_RESULT(no)
2232135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
2233135446StrhodesAC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
2234135446Strhodes
2235135446StrhodesAC_MSG_CHECKING(for int setnetent)
2236135446StrhodesAC_TRY_COMPILE([
2237135446Strhodes#include <netdb.h>],
2238135446Strhodes[int i = setnetent(0); return(0);],
2239135446Strhodes	[AC_MSG_RESULT(yes)
2240135446Strhodes	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
2241135446Strhodes	[AC_MSG_RESULT(no)
2242135446Strhodes	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
2243135446StrhodesAC_SUBST(ISC_LWRES_SETNETENTINT)
2244135446Strhodes
2245135446StrhodesAC_MSG_CHECKING(for int endnetent)
2246135446StrhodesAC_TRY_COMPILE([
2247135446Strhodes#include <netdb.h>],
2248135446Strhodes[int i = endnetent(); return(0);],
2249135446Strhodes	[AC_MSG_RESULT(yes)
2250135446Strhodes	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
2251135446Strhodes	[AC_MSG_RESULT(no)
2252135446Strhodes	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
2253135446StrhodesAC_SUBST(ISC_LWRES_ENDNETENTINT)
2254135446Strhodes
2255135446StrhodesAC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
2256135446StrhodesAC_TRY_COMPILE([
2257135446Strhodes#include <netdb.h>
2258135446Strhodesstruct hostent *gethostbyaddr(const void *, size_t, int);],
2259135446Strhodes[return(0);],
2260135446Strhodes	[AC_MSG_RESULT(yes)
2261135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
2262135446Strhodes	[AC_MSG_RESULT(no)
2263135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
2264135446StrhodesAC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
2265135446Strhodes
2266135446StrhodesAC_MSG_CHECKING(for h_errno in netdb.h)
2267135446StrhodesAC_TRY_COMPILE([
2268135446Strhodes#include <netdb.h>],
2269135446Strhodes[h_errno = 1; return(0);],
2270135446Strhodes	[AC_MSG_RESULT(yes)
2271135446Strhodes	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
2272135446Strhodes	[AC_MSG_RESULT(no)
2273135446Strhodes	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
2274135446StrhodesAC_SUBST(ISC_LWRES_NEEDHERRNO)
2275135446Strhodes
2276224092Sdougb#
2277224092Sdougb# Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
2278224092Sdougb# known variations here:
2279224092Sdougb#
2280224092SdougbAC_MSG_CHECKING(for getnameinfo prototype definitions)
2281224092SdougbAC_TRY_COMPILE([
2282224092Sdougb#include <sys/types.h>
2283224092Sdougb#include <sys/socket.h>
2284224092Sdougb#include <netdb.h>
2285224092Sdougbint getnameinfo(const struct sockaddr *, socklen_t, char *,
2286224092Sdougb                socklen_t, char *, socklen_t, unsigned int);],
2287224092Sdougb[ return (0);],
2288224092Sdougb	[AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
2289224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
2290224092Sdougb		   [Define to the buffer length type used by getnameinfo(3).])
2291224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
2292224092Sdougb		   [Define to the flags type used by getnameinfo(3).])],
2293224092Sdougb[AC_TRY_COMPILE([
2294224092Sdougb#include <sys/types.h>
2295224092Sdougb#include <sys/socket.h>
2296224092Sdougb#include <netdb.h>
2297224092Sdougbint getnameinfo(const struct sockaddr *, socklen_t, char *,
2298224092Sdougb                size_t, char *, size_t, int);],
2299224092Sdougb[ return (0);],
2300224092Sdougb	[AC_MSG_RESULT(size_t for buflen; int for flags)
2301224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
2302224092Sdougb	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
2303224092Sdougb[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2304224092SdougbAC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
2305224092SdougbAC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
2306224092Sdougb
2307224092Sdougb#
2308224092Sdougb# ...and same for gai_strerror().
2309224092Sdougb#
2310224092SdougbAC_MSG_CHECKING(for gai_strerror prototype definitions)
2311224092SdougbAC_TRY_COMPILE([
2312224092Sdougb#include <sys/types.h>
2313224092Sdougb#include <sys/socket.h>
2314224092Sdougb#include <netdb.h>
2315224092Sdougbchar *gai_strerror(int ecode);],
2316224092Sdougb[ return (0); ],
2317224092Sdougb	[AC_MSG_RESULT(returning char *)
2318224092Sdougb	 AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
2319224092Sdougb	 [return type of gai_strerror])],
2320224092Sdougb[AC_MSG_RESULT(not match any subspecies; assume standard definition)
2321224092SdougbAC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
2322224092Sdougb
2323135446StrhodesAC_CHECK_FUNC(getipnodebyname,
2324193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
2325193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
2326135446StrhodesAC_CHECK_FUNC(getnameinfo,
2327193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
2328193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
2329135446StrhodesAC_CHECK_FUNC(getaddrinfo,
2330193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
2331135446Strhodes	AC_DEFINE(HAVE_GETADDRINFO)],
2332193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
2333135446StrhodesAC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
2334135446StrhodesAC_SUBST(ISC_LWRES_GETIPNODEPROTO)
2335135446StrhodesAC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
2336135446StrhodesAC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
2337224092SdougbAC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
2338135446Strhodes
2339135446StrhodesAC_ARG_ENABLE(getifaddrs,
2340204619Sdougb[  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
2341135446Strhodes    want_getifaddrs="$enableval",  want_getifaddrs="yes")
2342135446Strhodes
2343193149Sdougb#
2344193149Sdougb# This interface iteration code for getifaddrs() will fall back to using
2345193149Sdougb# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
2346193149Sdougb# addresses.
2347254897Serwin#
2348135446Strhodescase $want_getifaddrs in
2349193149Sdougbglibc)
2350193149SdougbAC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
2351193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2352135446Strhodes;;
2353193149Sdougbyes)
2354193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2355193149Sdougb;;
2356135446Strhodesno)
2357135446Strhodes;;
2358135446Strhodesesac
2359135446Strhodes
2360135446Strhodes#
2361135446Strhodes# Look for a sysctl call to get the list of network interfaces.
2362135446Strhodes#
2363135446Strhodescase $ac_cv_header_sys_sysctl_h in
2364135446Strhodesyes)
2365135446StrhodesAC_MSG_CHECKING(for interface list sysctl)
2366135446StrhodesAC_EGREP_CPP(found_rt_iflist, [
2367135446Strhodes#include <sys/param.h>
2368135446Strhodes#include <sys/sysctl.h>
2369135446Strhodes#include <sys/socket.h>
2370135446Strhodes#ifdef NET_RT_IFLIST
2371135446Strhodesfound_rt_iflist
2372135446Strhodes#endif
2373135446Strhodes],
2374135446Strhodes	[AC_MSG_RESULT(yes)
2375135446Strhodes	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
2376135446Strhodes	[AC_MSG_RESULT(no)])
2377135446Strhodes;;
2378135446Strhodesesac
2379135446Strhodes
2380135446Strhodes#
2381135446Strhodes# Check for some other useful functions that are not ever-present.
2382135446Strhodes#
2383135446Strhodes
2384135446Strhodes# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
2385135446Strhodes# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
2386135446Strhodes# reportedly defines strsep() without declaring it in <string.h> when
2387135446Strhodes# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
2388135446Strhodes# AC_CHECK_FUNC() incorrectly succeeds because it declares
2389135446Strhodes# the function itself.
2390135446StrhodesAC_MSG_CHECKING(for correctly declared strsep())
2391135446StrhodesAC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
2392135446Strhodes	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
2393135446Strhodes	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
2394135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
2395135446Strhodes
2396135446StrhodesAC_CHECK_FUNC(memmove,
2397135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
2398135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
2399135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
2400135446Strhodes
2401135446StrhodesAC_CHECK_FUNC(strtoul,
2402153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
2403165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
2404153816Sdougb	 GENRANDOMLIB=""],
2405153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
2406165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
2407165071Sdougb	 GENRANDOMLIB='${ISCLIBS}'])
2408135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
2409153816SdougbAC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
2410153816SdougbAC_SUBST(GENRANDOMLIB)
2411135446Strhodes
2412135446StrhodesAC_CHECK_FUNC(strlcpy,
2413135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
2414135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
2415135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
2416135446Strhodes
2417135446StrhodesAC_CHECK_FUNC(strlcat,
2418135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
2419135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
2420135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
2421135446Strhodes
2422262706SerwinAC_CHECK_FUNC(strcasestr,
2423262706Serwin	[ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR"],
2424262706Serwin	[ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1"])
2425262706SerwinAC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR)
2426254897Serwin
2427254897SerwinAC_SUBST(READLINE_LIB)
2428254897SerwinAC_ARG_WITH(readline,
2429254897Serwin        [  --with-readline[=LIBSPEC]    specify readline library [default -lreadline]],
2430254897Serwin        readline="$withval", readline="-lreadline")
2431254897Serwincase "$readline" in
2432254897Serwinno)	;;
2433254897Serwin*)
2434254897Serwin	if test "x$readline" = "xyes"
2435254897Serwin	then
2436254897Serwin		readline=-lreadline
2437254897Serwin	fi
2438254897Serwin	saved_LIBS="$LIBS"
2439254897Serwin	LIBS="$readline"
2440254897Serwin	AC_CHECK_FUNCS(readline)
2441254897Serwin	if test "$ac_cv_func_readline" = "yes"
2442254897Serwin	then
2443254897Serwin		READLINE_LIB="$readline"
2444254897Serwin	fi
2445254897Serwin	LIBS="$saved_LIBS"
2446254897Serwin        ;;
2447254897Serwinesac
2448254897Serwin
2449135446StrhodesISC_PRINT_OBJS=
2450135446StrhodesISC_PRINT_SRCS=
2451135446StrhodesAC_MSG_CHECKING(sprintf)
2452135446StrhodesAC_TRY_COMPILE([
2453135446Strhodes#include <stdio.h>
2454135446Strhodes],
2455135446Strhodes[ char buf[2]; return(*sprintf(buf,"x"));],
2456135446Strhodes[
2457135446StrhodesISC_PRINT_OBJS="print.$O"
2458135446StrhodesISC_PRINT_SRCS="print.c"
2459135446StrhodesISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
2460135446StrhodesLWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
2461135446Strhodes],
2462135446Strhodes[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
2463135446Strhodes LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
2464135446Strhodes)
2465135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
2466135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
2467135446Strhodes
2468135446StrhodesAC_CHECK_FUNC(vsnprintf,
2469135446Strhodes	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
2470135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
2471135446Strhodes	[ISC_PRINT_OBJS="print.$O"
2472135446Strhodes	 ISC_PRINT_SRCS="print.c"
2473135446Strhodes	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
2474135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
2475135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
2476135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
2477135446StrhodesISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
2478135446StrhodesISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
2479135446Strhodes
2480135446StrhodesAC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
2481135446Strhodes
2482135446StrhodesAC_SUBST(ISC_EXTRA_OBJS)
2483135446StrhodesAC_SUBST(ISC_EXTRA_SRCS)
2484135446Strhodes
2485193149Sdougb#
2486193149Sdougb# Use our own SPNEGO implementation?
2487193149Sdougb#
2488193149SdougbAC_ARG_ENABLE(isc-spnego,
2489204619Sdougb	[  --disable-isc-spnego    use SPNEGO from GSSAPI library])
2490193149Sdougb
2491193149Sdougbif test -n "$USE_GSSAPI"
2492193149Sdougbthen
2493193149Sdougb	case "$enable_isc_spnego" in
2494193149Sdougb		yes|'')
2495193149Sdougb			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
2496193149Sdougb			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
2497193149Sdougb			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
2498193149Sdougb			AC_MSG_RESULT(using SPNEGO from lib/dns)
2499193149Sdougb			;;
2500193149Sdougb		no)
2501193149Sdougb			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
2502193149Sdougb			;;
2503193149Sdougb	esac
2504193149Sdougbfi
2505193149Sdougb
2506193149SdougbAC_SUBST(USE_ISC_SPNEGO)
2507193149Sdougb
2508193149SdougbAC_SUBST(DST_EXTRA_OBJS)
2509193149SdougbAC_SUBST(DST_EXTRA_SRCS)
2510193149Sdougb
2511135446Strhodes# Determine the printf format characters to use when printing
2512135446Strhodes# values of type isc_int64_t. This will normally be "ll", but where
2513135446Strhodes# the compiler treats "long long" as a alias for "long" and printf
2514135446Strhodes# doesn't know about "long long" use "l".  Hopefully the sprintf
2515193149Sdougb# will produce a inconsistent result in the later case.  If the compiler
2516135446Strhodes# fails due to seeing "%lld" we fall back to "l".
2517135446Strhodes#
2518153816Sdougb# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
2519153816Sdougb# %ld even for (long long)/
2520153816Sdougb#
2521135446Strhodes# Win32 uses "%I64d", but that's defined elsewhere since we don't use
2522135446Strhodes# configure on Win32.
2523135446Strhodes#
2524135446StrhodesAC_MSG_CHECKING(printf format modifier for 64-bit integers)
2525135446StrhodesAC_TRY_RUN([
2526135446Strhodes#include <stdio.h>
2527135446Strhodesmain() {
2528135446Strhodes	long long int j = 0;
2529135446Strhodes	char buf[100];
2530135446Strhodes	buf[0] = 0;
2531135446Strhodes	sprintf(buf, "%lld", j);
2532135446Strhodes	exit((sizeof(long long int) != sizeof(long int))? 0 :
2533135446Strhodes	     (strcmp(buf, "0") != 0));
2534254897Serwin}
2535135446Strhodes],
2536135446Strhodes	[AC_MSG_RESULT(ll)
2537153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2538153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
2539135446Strhodes	[AC_MSG_RESULT(l)
2540153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
2541153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
2542135446Strhodes	[AC_MSG_RESULT(assuming target platform uses ll)
2543153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2544153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
2545135446StrhodesAC_SUBST(ISC_PLATFORM_QUADFORMAT)
2546153816SdougbAC_SUBST(LWRES_PLATFORM_QUADFORMAT)
2547135446Strhodes
2548135446Strhodes#
2549135446Strhodes# Security Stuff
2550135446Strhodes#
2551193149Sdougb# Note it is very recommended to *not* disable chroot(),
2552193149Sdougb# this is only because chroot() was made obsolete by Posix.
2553193149SdougbAC_ARG_ENABLE(chroot,
2554204619Sdougb	[  --disable-chroot        disable chroot])
2555193149Sdougbcase "$enable_chroot" in
2556193149Sdougb	yes|'')
2557193149Sdougb		AC_CHECK_FUNCS(chroot)
2558193149Sdougb		;;
2559193149Sdougb	no)
2560193149Sdougb		;;
2561193149Sdougbesac
2562135446StrhodesAC_ARG_ENABLE(linux-caps,
2563204619Sdougb	[  --disable-linux-caps	  disable linux capabilities])
2564135446Strhodescase "$enable_linux_caps" in
2565135446Strhodes	yes|'')
2566262706Serwin		AC_CHECK_HEADERS(linux/types.h)
2567262706Serwin		AC_CHECK_HEADERS([sys/capability.h])
2568262706Serwin		AC_CHECK_HEADERS([linux/capability.h], [], [],
2569262706Serwin				 [#ifdef HAVE_LINUX_TYPES_H
2570262706Serwin				  #include <linux/types.h>
2571262706Serwin				  #endif
2572262706Serwin				 ])
2573193149Sdougb		AC_CHECK_LIB(cap, cap_set_proc)
2574135446Strhodes		;;
2575135446Strhodes	no)
2576135446Strhodes		;;
2577135446Strhodesesac
2578135446StrhodesAC_CHECK_HEADERS(sys/prctl.h)
2579135446Strhodes
2580170222SdougbAC_CHECK_HEADERS(sys/un.h,
2581170222SdougbISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
2582170222Sdougb,
2583170222SdougbISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2584170222Sdougb)
2585170222SdougbAC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2586170222Sdougb
2587170222Sdougbcase "$host" in
2588170222Sdougb*-solaris*)
2589170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2590170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2591170222Sdougb	;;
2592170222Sdougb*-sunos*)
2593170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2594170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2595170222Sdougb	;;
2596170222Sdougbesac
2597170222Sdougb
2598135446Strhodes#
2599135446Strhodes# Time Zone Stuff
2600135446Strhodes#
2601135446StrhodesAC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2602135446Strhodes
2603193149SdougbAC_MSG_CHECKING(for optarg declaration)
2604153816SdougbAC_TRY_COMPILE([
2605153816Sdougb#include <unistd.h>
2606153816Sdougb],
2607153816Sdougb[optarg = 0;],
2608153816Sdougb[AC_MSG_RESULT(yes)],
2609153816Sdougb[AC_MSG_RESULT(no)
2610165071SdougbGEN_NEED_OPTARG="-DNEED_OPTARG=1"
2611153816SdougbAC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2612153816Sdougb
2613135446Strhodes#
2614135446Strhodes# BSD/OS, and perhaps some others, don't define rlim_t.
2615135446Strhodes#
2616135446StrhodesAC_MSG_CHECKING(for type rlim_t)
2617135446StrhodesAC_TRY_COMPILE([
2618135446Strhodes#include <sys/types.h>
2619135446Strhodes#include <sys/time.h>
2620135446Strhodes#include <sys/resource.h>],
2621135446Strhodes[rlim_t rl = 19671212; return (0);],
2622135446Strhodes[AC_MSG_RESULT(yes)
2623135446Strhodes ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2624135446Strhodes[AC_MSG_RESULT(no)
2625135446Strhodes
2626135446StrhodesAC_MSG_CHECKING(type of rlim_cur)
2627135446StrhodesAC_TRY_RUN([
2628135446Strhodes#include <sys/types.h>
2629135446Strhodes#include <sys/time.h>
2630135446Strhodes#include <sys/resource.h>
2631135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2632135446Strhodes[AC_MSG_RESULT(int)
2633135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2634135446Strhodes[
2635135446StrhodesAC_TRY_RUN([
2636135446Strhodes#include <sys/types.h>
2637135446Strhodes#include <sys/time.h>
2638135446Strhodes#include <sys/resource.h>
2639135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2640135446Strhodes[AC_MSG_RESULT(long int)
2641135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2642135446Strhodes[
2643135446StrhodesAC_TRY_RUN([
2644135446Strhodes#include <sys/types.h>
2645135446Strhodes#include <sys/time.h>
2646135446Strhodes#include <sys/resource.h>
2647135446Strhodesmain() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2648135446Strhodes[AC_MSG_RESULT(long long int)
2649135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2650135446Strhodes[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2651135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2652135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2653153816Sdougb],[
2654225361SdougbAC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
2655225361SdougbISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
2656225361SdougbAC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
2657135446Strhodes])
2658135446StrhodesAC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2659135446Strhodes
2660135446Strhodes#
2661186462Sdougb# Older HP-UX doesn't have gettune
2662186462Sdougb#
2663186462Sdougbcase "$host" in
2664186462Sdougb  	*-hp-hpux*)
2665186462Sdougb		AC_CHECK_HEADERS(sys/dyntune.h)
2666186462Sdougb		;;
2667186462Sdougb	*)
2668186462Sdougb		;;
2669186462Sdougbesac
2670186462Sdougb
2671186462Sdougb
2672186462Sdougb#
2673135446Strhodes# Compaq TruCluster requires more code for handling cluster IP aliases
2674135446Strhodes#
2675135446Strhodescase "$host" in
2676135446Strhodes	*-dec-osf*)
2677135446Strhodes		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2678135446Strhodes		AC_CHECK_FUNC(clua_getaliasaddress,
2679135446Strhodes				AC_DEFINE(HAVE_TRUCLUSTER, 1,
2680135446Strhodes					[Define if running under Compaq TruCluster]))
2681135446Strhodes		;;
2682135446Strhodes	*)
2683135446Strhodes		;;
2684135446Strhodesesac
2685135446Strhodes
2686135446Strhodes#
2687165071Sdougb# Some hosts need msg_namelen to match the size of the socket structure.
2688165071Sdougb# Some hosts don't set msg_namelen appropriately on return from recvmsg().
2689165071Sdougb#
2690165071Sdougbcase $host in
2691165071Sdougb*os2*|*hp-mpeix*)
2692165071Sdougb	AC_DEFINE(BROKEN_RECVMSG, 1,
2693165071Sdougb		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2694165071Sdougb	;;
2695165071Sdougbesac
2696165071Sdougb
2697165071Sdougb#
2698135446Strhodes# Microsoft has their own way of handling shared libraries that requires
2699135446Strhodes# additional qualifiers on extern variables.  Unix systems don't need it.
2700135446Strhodes#
2701135446StrhodesAC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2702135446StrhodesISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2703135446StrhodesAC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2704135446StrhodesLWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2705224092SdougbAC_SUBST(IRS_PLATFORM_USEDECLSPEC)
2706224092SdougbIRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
2707135446Strhodes
2708135446Strhodes#
2709135446Strhodes# Random remaining OS-specific issues involving compiler warnings.
2710135446Strhodes# XXXDCL print messages to indicate some compensation is being done?
2711135446Strhodes#
2712135446StrhodesAC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2713135446StrhodesISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2714135446Strhodes
2715135446Strhodescase "$host" in
2716165071Sdougb	*-aix5.[[123]].*)
2717143731Sdougb		hack_shutup_pthreadonceinit=yes
2718143731Sdougb		;;
2719135446Strhodes	*-bsdi3.1*)
2720135446Strhodes		hack_shutup_sputaux=yes
2721135446Strhodes		;;
2722135446Strhodes	*-bsdi4.0*)
2723135446Strhodes		hack_shutup_sigwait=yes
2724135446Strhodes		hack_shutup_sputaux=yes
2725135446Strhodes		;;
2726135446Strhodes	[*-bsdi4.[12]*])
2727135446Strhodes		hack_shutup_stdargcast=yes
2728135446Strhodes		;;
2729135446Strhodes	[*-solaris2.[89]])
2730135446Strhodes		hack_shutup_pthreadonceinit=yes
2731135446Strhodes		;;
2732186462Sdougb	*-solaris2.1[[0-9]])
2733193149Sdougb		AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2734165071Sdougb		;;
2735135446Strhodesesac
2736135446Strhodes
2737135446Strhodescase "$hack_shutup_pthreadonceinit" in
2738135446Strhodes	yes)
2739135446Strhodes		#
2740135446Strhodes		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2741135446Strhodes		#
2742135446Strhodes		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2743135446Strhodes		;;
2744135446Strhodesesac
2745135446Strhodes
2746135446Strhodescase "$hack_shutup_sigwait" in
2747135446Strhodes	yes)
2748135446Strhodes		#
2749135446Strhodes		# Shut up a -Wmissing-prototypes warning for sigwait().
2750135446Strhodes		#
2751135446Strhodes		AC_DEFINE(SHUTUP_SIGWAIT)
2752135446Strhodes		;;
2753135446Strhodesesac
2754135446Strhodes
2755135446Strhodescase "$hack_shutup_sputaux" in
2756135446Strhodes	yes)
2757135446Strhodes		#
2758135446Strhodes		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
2759135446Strhodes		#
2760135446Strhodes		AC_DEFINE(SHUTUP_SPUTAUX)
2761135446Strhodes		;;
2762135446Strhodesesac
2763135446Strhodes
2764135446Strhodescase "$hack_shutup_stdargcast" in
2765135446Strhodes	yes)
2766135446Strhodes		#
2767135446Strhodes		# Shut up a -Wcast-qual warning from va_start().
2768135446Strhodes		#
2769135446Strhodes		AC_DEFINE(SHUTUP_STDARG_CAST)
2770135446Strhodes		;;
2771135446Strhodesesac
2772135446Strhodes
2773174187SdougbAC_CHECK_HEADERS(strings.h,
2774174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2775174187Sdougb,
2776174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2777174187Sdougb)
2778174187SdougbAC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2779174187Sdougb
2780135446Strhodes#
2781135446Strhodes# Check for if_nametoindex() for IPv6 scoped addresses support
2782135446Strhodes#
2783135446StrhodesAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2784135446Strhodes		ac_cv_have_if_nametoindex=no)
2785135446Strhodescase $ac_cv_have_if_nametoindex in
2786135446Strhodesno)
2787135446Strhodes	case "$host" in
2788193149Sdougb	*-hp-hpux*)
2789193149Sdougb		AC_CHECK_LIB(ipv6, if_nametoindex,
2790135446Strhodes				ac_cv_have_if_nametoindex=yes
2791135446Strhodes				LIBS="-lipv6 $LIBS",)
2792193149Sdougb	;;
2793135446Strhodes	esac
2794135446Strhodesesac
2795135446Strhodescase $ac_cv_have_if_nametoindex in
2796135446Strhodesyes)
2797135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2798135446Strhodes	;;
2799135446Strhodes*)
2800135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2801135446Strhodes	;;
2802135446Strhodesesac
2803135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2804135446Strhodes
2805254897SerwinAC_CHECK_FUNCS(nanosleep usleep)
2806193149Sdougb
2807135446Strhodes#
2808170222Sdougb# Machine architecture dependent features
2809170222Sdougb#
2810170222SdougbAC_ARG_ENABLE(atomic,
2811204619Sdougb	[  --enable-atomic	  enable machine specific atomic operations
2812204619Sdougb			  [[default=autodetect]]],
2813170222Sdougb			enable_atomic="$enableval",
2814170222Sdougb			enable_atomic="autodetect")
2815170222Sdougbcase "$enable_atomic" in
2816170222Sdougb	yes|''|autodetect)
2817204619Sdougb		case "$host" in
2818204619Sdougb		powerpc-ibm-aix*)
2819204619Sdougb			if test "X$GCC" = "Xyes"; then
2820204619Sdougb				AC_MSG_CHECKING([if asm("isc"); works])
2821204619Sdougb				AC_TRY_COMPILE(,[
2822204619Sdougb				main() { asm("ics"); exit(0); }
2823204619Sdougb				],
2824204619Sdougb				[AC_MSG_RESULT(yes)
2825204619Sdougb				 use_atomic=yes],
2826204619Sdougb				[
2827204619Sdougb				saved_cflags="$CFLAGS"
2828204619Sdougb				CFLAGS="$CFLAGS -Wa,-many"
2829204619Sdougb				AC_TRY_RUN([
2830204619Sdougb				main() { asm("ics"); exit(0); }
2831204619Sdougb				],
2832204619Sdougb				[AC_MSG_RESULT([yes, required -Wa,-many])
2833204619Sdougb				 use_atomic=yes],
2834204619Sdougb				[AC_MSG_RESULT([no, use_atomic disabled])
2835204619Sdougb				 CFLAGS="$saved_cflags"
2836204619Sdougb				 use_atomic=no],
2837204619Sdougb				[AC_MSG_RESULT([cross compile, assume yes])
2838204619Sdougb				 CFLAGS="$saved_cflags"
2839204619Sdougb				 use_atomic=yes])
2840204619Sdougb				]
2841204619Sdougb				)
2842218384Sdougb			else
2843218384Sdougb				use_atomic=yes
2844204619Sdougb			fi
2845204619Sdougb			;;
2846204619Sdougb		*)
2847204619Sdougb			use_atomic=yes
2848204619Sdougb			;;
2849204619Sdougb		esac
2850170222Sdougb		;;
2851170222Sdougb	no)
2852170222Sdougb		use_atomic=no
2853170222Sdougb		arch=noatomic
2854170222Sdougb		;;
2855170222Sdougbesac
2856170222Sdougb
2857170222SdougbISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2858170222Sdougbif test "$use_atomic" = "yes"; then
2859170222Sdougb	AC_MSG_CHECKING([architecture type for atomic operations])
2860170222Sdougb	have_atomic=yes		# set default
2861170222Sdougb	case "$host" in
2862170222Sdougb	[i[3456]86-*])
2863170222Sdougb		# XXX: some old x86 architectures actually do not support
2864170222Sdougb		#      (some of) these operations.  Do we need stricter checks?
2865225361Sdougb                AC_CHECK_SIZEOF([void *])
2866225361Sdougb		if test $ac_cv_sizeof_void_p = 8; then
2867225361Sdougb			arch=x86_64
2868225361Sdougb			have_xaddq=yes
2869225361Sdougb		else
2870225361Sdougb			arch=x86_32
2871225361Sdougb		fi
2872170222Sdougb	;;
2873193149Sdougb	x86_64-*|amd64-*)
2874225361Sdougb                AC_CHECK_SIZEOF([void *])
2875225361Sdougb		if test $ac_cv_sizeof_void_p = 8; then
2876225361Sdougb			arch=x86_64
2877225361Sdougb			have_xaddq=yes
2878225361Sdougb		else
2879225361Sdougb			arch=x86_32
2880225361Sdougb		fi
2881170222Sdougb	;;
2882170222Sdougb	alpha*-*)
2883170222Sdougb		arch=alpha
2884170222Sdougb	;;
2885218384Sdougb	powerpc-*|powerpc64-*)
2886170222Sdougb		arch=powerpc
2887170222Sdougb	;;
2888170222Sdougb	mips-*|mipsel-*|mips64-*|mips64el-*)
2889170222Sdougb		arch=mips
2890170222Sdougb	;;
2891170222Sdougb	ia64-*)
2892170222Sdougb		arch=ia64
2893170222Sdougb	;;
2894170222Sdougb	*)
2895170222Sdougb		have_atomic=no
2896170222Sdougb		arch=noatomic
2897170222Sdougb	;;
2898170222Sdougb	esac
2899170222Sdougb	AC_MSG_RESULT($arch)
2900170222Sdougbfi
2901170222Sdougb
2902170222Sdougbif test "$have_atomic" = "yes"; then
2903170222Sdougb	AC_MSG_CHECKING([compiler support for inline assembly code])
2904170222Sdougb
2905170222Sdougb	compiler=generic
2906170222Sdougb	# Check whether the compiler supports the assembly syntax we provide.
2907170222Sdougb	if test "X$GCC" = "Xyes"; then
2908170222Sdougb		# GCC's ASM extension always works
2909170222Sdougb		compiler=gcc
2910170222Sdougb		if test $arch = "x86_64"; then
2911170222Sdougb			# We can share the same code for gcc with x86_32
2912170222Sdougb			arch=x86_32
2913170222Sdougb		fi
2914170222Sdougb		if test $arch = "powerpc"; then
2915170222Sdougb			#
2916170222Sdougb			# The MacOS (and maybe others) uses "r0" for register
2917170222Sdougb			# zero. Under linux/ibm it is "0" for register 0.
2918170222Sdougb			# Probe to see if we have a MacOS style assembler.
2919170222Sdougb			#
2920170222Sdougb			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2921170222Sdougb			AC_TRY_COMPILE(, [
2922170222Sdougb			__asm__ volatile ("li r0, 0x0\n"::);
2923170222Sdougb			], [
2924170222Sdougb			AC_MSG_RESULT(yes)
2925170222Sdougb			compiler="mac"
2926170222Sdougb			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2927170222Sdougb			], [AC_MSG_RESULT(no)])
2928170222Sdougb		fi
2929170222Sdougb	else
2930170222Sdougb		case "$host" in
2931170222Sdougb		alpha*-dec-osf*)
2932254897Serwin			# Tru64 compiler has its own syntax for inline
2933170222Sdougb			# assembly.
2934170222Sdougb			AC_TRY_COMPILE(, [
2935170222Sdougb#ifndef __DECC
2936170222Sdougb#error "unexpected compiler"
2937170222Sdougb#endif
2938170222Sdougb				return (0);],
2939170222Sdougb				[compiler=osf],)
2940170222Sdougb		;;
2941170222Sdougb		powerpc-ibm-aix*)
2942170222Sdougb			compiler=aix
2943170222Sdougb		;;
2944170222Sdougb		esac
2945170222Sdougb	fi
2946170222Sdougb	case "$compiler" in
2947170222Sdougb	gcc)
2948170222Sdougb		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2949170222Sdougb		;;
2950170222Sdougb	osf)
2951170222Sdougb		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2952170222Sdougb		;;
2953170222Sdougb	aix)
2954170222Sdougb		;;
2955170222Sdougb	mac)
2956170222Sdougb		;;
2957170222Sdougb	*)
2958170222Sdougb		# See if the generic __asm function works.  If not,
2959170222Sdougb		# we need to disable the atomic operations.
2960170222Sdougb		AC_TRY_LINK(, [
2961170222Sdougb					__asm("nop")
2962170222Sdougb				],
2963170222Sdougb		[compiler="standard"
2964170222Sdougb		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2965170222Sdougb		[compiler="not supported (atomic operations disabled)"
2966170222Sdougb		have_atomic=no
2967170222Sdougb		arch=noatomic ]);
2968170222Sdougb		;;
2969170222Sdougb	esac
2970170222Sdougb
2971170222Sdougb	AC_MSG_RESULT($compiler)
2972170222Sdougbfi
2973170222Sdougb
2974170222Sdougbif test "$have_atomic" = "yes"; then
2975170222Sdougb	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2976170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2977170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2978170222Sdougbelse
2979170222Sdougb	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2980170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2981170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2982170222Sdougbfi
2983170222Sdougb
2984193149Sdougbif test "$have_xaddq" = "yes"; then
2985204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
2986193149Sdougbelse
2987204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
2988193149Sdougbfi
2989193149Sdougb
2990170222SdougbAC_SUBST(ISC_PLATFORM_HAVEXADD)
2991193149SdougbAC_SUBST(ISC_PLATFORM_HAVEXADDQ)
2992170222SdougbAC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2993170222SdougbAC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2994170222Sdougb
2995170222SdougbAC_SUBST(ISC_PLATFORM_USEGCCASM)
2996170222SdougbAC_SUBST(ISC_PLATFORM_USEOSFASM)
2997170222SdougbAC_SUBST(ISC_PLATFORM_USESTDASM)
2998170222SdougbAC_SUBST(ISC_PLATFORM_USEMACASM)
2999170222Sdougb
3000170222SdougbISC_ARCH_DIR=$arch
3001170222SdougbAC_SUBST(ISC_ARCH_DIR)
3002170222Sdougb
3003170222Sdougb#
3004193149Sdougb# Activate "rrset-order fixed" or not?
3005193149Sdougb#
3006193149SdougbAC_ARG_ENABLE(fixed-rrset,
3007204619Sdougb	[  --enable-fixed-rrset    enable fixed rrset ordering
3008204619Sdougb			  [[default=no]]],
3009193149Sdougb			enable_fixed="$enableval",
3010193149Sdougb			enable_fixed="no")
3011193149Sdougbcase "$enable_fixed" in
3012193149Sdougb	yes)
3013193149Sdougb		AC_DEFINE(DNS_RDATASET_FIXED, 1,
3014204619Sdougb			  [Define to enable "rrset-order fixed" syntax.])
3015193149Sdougb		;;
3016193149Sdougb	no)
3017193149Sdougb		;;
3018193149Sdougb	*)
3019193149Sdougb		;;
3020193149Sdougbesac
3021193149Sdougb
3022193149Sdougb#
3023224092Sdougb# Enable response policy rewriting using NS IP addresses
3024224092Sdougb#
3025224092SdougbAC_ARG_ENABLE(rpz-nsip,
3026254402Serwin	[  --disable-rpz-nsip	  disable rpz-nsip rules [[default=enabled]]],
3027224092Sdougb			enable_nsip="$enableval",
3028254402Serwin			enable_nsip="yes")
3029224092Sdougbcase "$enable_nsip" in
3030224092Sdougb	yes)
3031224092Sdougb		AC_DEFINE(ENABLE_RPZ_NSIP, 1,
3032224092Sdougb			  [Define to enable rpz-nsip rules.])
3033224092Sdougb		;;
3034224092Sdougb	no)
3035224092Sdougb		;;
3036224092Sdougb	*)
3037224092Sdougb		;;
3038224092Sdougbesac
3039224092Sdougb
3040224092Sdougb#
3041224092Sdougb# Enable response policy rewriting using NS name
3042224092Sdougb#
3043224092SdougbAC_ARG_ENABLE(rpz-nsdname,
3044254402Serwin	[  --disable-rpz-nsdname	  disable rpz-nsdname rules [[default=enabled]]],
3045224092Sdougb			enable_nsdname="$enableval",
3046254402Serwin			enable_nsdname="yes")
3047224092Sdougbcase "$enable_nsdname" in
3048224092Sdougb	yes)
3049224092Sdougb		AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
3050224092Sdougb			  [Define to enable rpz-nsdname rules.])
3051224092Sdougb		;;
3052224092Sdougb	no)
3053224092Sdougb		;;
3054224092Sdougb	*)
3055224092Sdougb		;;
3056224092Sdougbesac
3057224092Sdougb
3058224092Sdougb#
3059224092Sdougb# Activate "filter-aaaa-on-v4" or not?
3060224092Sdougb#
3061224092SdougbAC_ARG_ENABLE(filter-aaaa,
3062224092Sdougb	[  --enable-filter-aaaa    enable filtering of AAAA records over IPv4
3063224092Sdougb			  [[default=no]]],
3064224092Sdougb			enable_filter="$enableval",
3065224092Sdougb			enable_filter="no")
3066224092Sdougbcase "$enable_filter" in
3067224092Sdougb	yes)
3068224092Sdougb		AC_DEFINE(ALLOW_FILTER_AAAA_ON_V4, 1,
3069224092Sdougb			  [Define to enable the "filter-aaaa-on-v4" option.])
3070224092Sdougb		;;
3071224092Sdougb	no)
3072224092Sdougb		;;
3073224092Sdougb	*)
3074224092Sdougb		;;
3075224092Sdougbesac
3076224092Sdougb
3077224092Sdougb#
3078153816Sdougb#  The following sets up how non-blocking i/o is established.
3079153816Sdougb#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
3080153816Sdougb#
3081153816Sdougbcase "$host" in
3082153816Sdougb*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3083153816Sdougb*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3084153816Sdougb*-solaris2.[[01234]])
3085153816Sdougb	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
3086153816Sdougb	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
3087153816Sdougb		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
3088153816Sdougb	;;
3089153816Sdougb*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
3090153816Sdougb	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
3091153816Sdougb	;;
3092153816Sdougbesac
3093153816Sdougb#
3094165071Sdougb# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
3095165071Sdougb# This prevents the source address being set.
3096165071Sdougb#
3097165071Sdougbcase "$host" in
3098165071Sdougb*-solaris2.[[012345]]|*-solaris2.5.1)
3099165071Sdougb	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
3100165071Sdougb		  [Define if you cannot bind() before connect() for TCP sockets.])
3101165071Sdougb	;;
3102165071Sdougbesac
3103165071Sdougb#
3104135446Strhodes# The following sections deal with tools used for formatting
3105135446Strhodes# the documentation.  They are all optional, unless you are
3106135446Strhodes# a developer editing the documentation source.
3107135446Strhodes#
3108135446Strhodes
3109153816Sdougb#
3110153816Sdougb# Look for TeX.
3111153816Sdougb#
3112135446Strhodes
3113153816SdougbAC_PATH_PROGS(LATEX, latex, latex)
3114153816SdougbAC_SUBST(LATEX)
3115153816Sdougb
3116153816SdougbAC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
3117153816SdougbAC_SUBST(PDFLATEX)
3118153816Sdougb
3119135446Strhodes#
3120170222Sdougb# Look for w3m
3121170222Sdougb#
3122170222Sdougb
3123170222SdougbAC_PATH_PROGS(W3M, w3m, w3m)
3124170222SdougbAC_SUBST(W3M)
3125170222Sdougb
3126170222Sdougb#
3127153816Sdougb# Look for xsltproc (libxslt)
3128135446Strhodes#
3129135446Strhodes
3130153816SdougbAC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
3131153816SdougbAC_SUBST(XSLTPROC)
3132135446Strhodes
3133135446Strhodes#
3134153816Sdougb# Look for xmllint (libxml2)
3135135446Strhodes#
3136135446Strhodes
3137153816SdougbAC_PATH_PROG(XMLLINT, xmllint, xmllint)
3138153816SdougbAC_SUBST(XMLLINT)
3139135446Strhodes
3140135446Strhodes#
3141193149Sdougb# Look for Doxygen
3142193149Sdougb#
3143193149Sdougb
3144193149SdougbAC_PATH_PROG(DOXYGEN, doxygen, doxygen)
3145193149SdougbAC_SUBST(DOXYGEN)
3146193149Sdougb
3147193149Sdougb#
3148135446Strhodes# Subroutine for searching for an ordinary file (e.g., a stylesheet)
3149135446Strhodes# in a number of directories:
3150135446Strhodes#
3151135446Strhodes#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
3152135446Strhodes#
3153135446Strhodes# If the file FILENAME is found in one of the DIRECTORIES, the shell
3154254897Serwin# variable VARIABLE is defined to its absolute pathname.  Otherwise,
3155135446Strhodes# it is set to FILENAME, with no directory prefix (that's not terribly
3156135446Strhodes# useful, but looks less confusing in substitutions than leaving it
3157135446Strhodes# empty).  The variable VARIABLE will be substituted into output files.
3158254897Serwin#
3159135446Strhodes
3160135446StrhodesAC_DEFUN(NOM_PATH_FILE, [
3161135446Strhodes$1=""
3162135446StrhodesAC_MSG_CHECKING(for $2)
3163135446Strhodesfor d in $3
3164135446Strhodesdo
3165135446Strhodes	f=$d/$2
3166135446Strhodes	if test -f $f
3167135446Strhodes	then
3168135446Strhodes		$1=$f
3169135446Strhodes		AC_MSG_RESULT($f)
3170135446Strhodes		break
3171135446Strhodes	fi
3172135446Strhodesdone
3173135446Strhodesif test "X[$]$1" = "X"
3174135446Strhodesthen
3175135446Strhodes	AC_MSG_RESULT("not found");
3176135446Strhodes	$1=$2
3177135446Strhodesfi
3178135446StrhodesAC_SUBST($1)
3179135446Strhodes])
3180135446Strhodes
3181135446Strhodes#
3182186462Sdougb# Look for Docbook-XSL stylesheets.  Location probably varies by system.
3183186462Sdougb# If it's not explicitly specified, guess where it might be found, based on
3184186462Sdougb# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
3185186462Sdougb# of at the moment).
3186135446Strhodes#
3187186462SdougbAC_MSG_CHECKING(for Docbook-XSL path)
3188186462SdougbAC_ARG_WITH(docbook-xsl,
3189204619Sdougb[  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
3190186462Sdougb   docbook_path="$withval", docbook_path="auto")
3191186462Sdougbcase "$docbook_path" in
3192186462Sdougbauto)
3193186462Sdougb	AC_MSG_RESULT(auto)
3194254402Serwin	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook /opt/local/share/xsl/docbook-xsl"
3195186462Sdougb	;;
3196186462Sdougb*)
3197186462Sdougb	docbook_xsl_trees="$withval"
3198186462Sdougb    	AC_MSG_RESULT($docbook_xsl_trees)
3199186462Sdougb	;;
3200186462Sdougbesac
3201153816Sdougb
3202135446Strhodes#
3203153816Sdougb# Look for stylesheets we need.
3204153816Sdougb#
3205135446Strhodes
3206186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
3207186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
3208186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
3209186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
3210186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
3211186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
3212186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
3213186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
3214186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
3215153816Sdougb
3216135446Strhodes#
3217153816Sdougb# Same dance for db2latex
3218135446Strhodes#
3219153816Sdougb# No idea where this lives except on FreeBSD.
3220135446Strhodes#
3221135446Strhodes
3222153816Sdougbdb2latex_xsl_trees="/usr/local/share"
3223135446Strhodes
3224135446Strhodes#
3225153816Sdougb# Look for stylesheets we need.
3226135446Strhodes#
3227135446Strhodes
3228153816SdougbNOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
3229135446Strhodes
3230135446Strhodes#
3231153816Sdougb# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
3232153816Sdougb# because it's a directory, so just do the same things, inline.
3233135446Strhodes#
3234135446Strhodes
3235153816SdougbAC_MSG_CHECKING(for db2latex/xsl/figures)
3236153816Sdougbfor d in $db2latex_xsl_trees
3237153816Sdougbdo
3238153816Sdougb	dd=$d/db2latex/xsl/figures
3239153816Sdougb	if test -d $dd
3240153816Sdougb	then
3241153816Sdougb		XSLT_DB2LATEX_ADMONITIONS=$dd
3242153816Sdougb		AC_MSG_RESULT($dd)
3243153816Sdougb		break
3244153816Sdougb	fi
3245153816Sdougbdone
3246153816Sdougbif test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
3247153816Sdougbthen
3248153816Sdougb	AC_MSG_RESULT(not found)
3249153816Sdougb	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
3250153816Sdougbfi
3251153816SdougbAC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
3252135446Strhodes
3253135446Strhodes#
3254170222Sdougb# IDN support
3255170222Sdougb#
3256170222SdougbAC_ARG_WITH(idn,
3257204619Sdougb	[  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
3258170222Sdougb	use_idn="$withval", use_idn="no")
3259170222Sdougbcase "$use_idn" in
3260170222Sdougbyes)
3261170222Sdougb	if test X$prefix = XNONE ; then
3262170222Sdougb		idn_path=/usr/local
3263170222Sdougb	else
3264170222Sdougb		idn_path=$prefix
3265170222Sdougb	fi
3266170222Sdougb	;;
3267170222Sdougbno)
3268170222Sdougb	;;
3269170222Sdougb*)
3270170222Sdougb	idn_path="$use_idn"
3271170222Sdougb	;;
3272170222Sdougbesac
3273170222Sdougb
3274170222Sdougbiconvinc=
3275170222Sdougbiconvlib=
3276170222SdougbAC_ARG_WITH(libiconv,
3277204619Sdougb	[  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
3278170222Sdougb	use_libiconv="$withval", use_libiconv="no")
3279170222Sdougbcase "$use_libiconv" in
3280170222Sdougbyes)
3281170222Sdougb	if test X$prefix = XNONE ; then
3282170222Sdougb		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
3283170222Sdougb	else
3284170222Sdougb		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
3285170222Sdougb	fi
3286170222Sdougb	;;
3287170222Sdougbno)
3288170222Sdougb	iconvlib=
3289170222Sdougb	;;
3290170222Sdougb*)
3291170222Sdougb	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
3292170222Sdougb	;;
3293170222Sdougbesac
3294170222Sdougb
3295170222SdougbAC_ARG_WITH(iconv,
3296204619Sdougb	[  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
3297170222Sdougb	iconvlib="$withval")
3298170222Sdougbcase "$iconvlib" in
3299170222Sdougbno)
3300170222Sdougb	iconvlib=
3301170222Sdougb	;;
3302170222Sdougbyes)
3303170222Sdougb	iconvlib=-liconv
3304170222Sdougb	;;
3305170222Sdougbesac
3306170222Sdougb
3307170222SdougbAC_ARG_WITH(idnlib,
3308204619Sdougb	[  --with-idnlib=ARG       specify libidnkit],
3309170222Sdougb	idnlib="$withval", idnlib="no")
3310170222Sdougbif test "$idnlib" = yes; then
3311170222Sdougb	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
3312170222Sdougbfi
3313170222Sdougb
3314170222SdougbIDNLIBS=
3315170222Sdougbif test "$use_idn" != no; then
3316170222Sdougb	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
3317170222Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
3318170222Sdougb	if test "$idnlib" != no; then
3319170222Sdougb		IDNLIBS="$idnlib $iconvlib"
3320170222Sdougb	else
3321170222Sdougb		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
3322170222Sdougb	fi
3323170222Sdougbfi
3324170222SdougbAC_SUBST(IDNLIBS)
3325170222Sdougb
3326225361Sdougb#
3327225361Sdougb# Check whether to build Automated Test Framework unit tests
3328225361Sdougb#
3329225361SdougbAC_ARG_WITH(atf,
3330254402Serwin	[  --with-atf=ARG          Automated Test Framework support],
3331225361Sdougb	atf="$withval", atf="no")
3332225361Sdougbif test "$atf" = yes; then
3333225361Sdougb	atf=`pwd`/unit/atf
3334225361Sdougb	ATFBUILD=atf-src
3335225361Sdougb	AC_SUBST(ATFBUILD)
3336225361Sdougb	AC_CONFIG_COMMANDS([atf-config],
3337254402Serwin		[(
3338254402Serwin		 mkdir -p unit/atf-src;
3339254402Serwin		 cd unit/atf-src;
3340254402Serwin		 case "$srcdir" in
3341254402Serwin		 /*) ;;
3342254402Serwin		 *) srcdir="../../$srcdir";;
3343254402Serwin		 esac
3344262706Serwin		 ${SHELL} "${srcdir}${srcdir:+/unit/atf-src/}./configure" --enable-tools --disable-shared MISSING=: --prefix $atfdir;
3345254402Serwin		) ],
3346225361Sdougb		[atfdir=`pwd`/unit/atf])
3347225361Sdougb	AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
3348225361Sdougbfi
3349225361Sdougb
3350225361SdougbATFLIBS=
3351225361Sdougbif test "$atf" != no; then
3352225361Sdougb	AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
3353225361Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
3354225361Sdougb	ATFBIN="$atf/bin"
3355225361Sdougb	ATFLIBS="-L$atf/lib -latf-c"
3356254402Serwin	if test "$want_openssl_hash" = yes; then
3357254402Serwin		ATFLIBS="-L$atf/lib -latf-c $DNS_CRYPTO_LIBS"
3358254402Serwin	fi
3359225361Sdougb	UNITTESTS=tests
3360225361Sdougbfi
3361225361SdougbAC_SUBST(ATFBIN)
3362225361SdougbAC_SUBST(ATFLIBS)
3363225361SdougbAC_SUBST(UNITTESTS)
3364225361Sdougb
3365170222SdougbAC_CHECK_HEADERS(locale.h)
3366170222SdougbAC_CHECK_FUNCS(setlocale)
3367170222Sdougb
3368170222Sdougb#
3369135446Strhodes# Substitutions
3370135446Strhodes#
3371135446StrhodesAC_SUBST(BIND9_TOP_BUILDDIR)
3372135446StrhodesBIND9_TOP_BUILDDIR=`pwd`
3373135446Strhodes
3374135446StrhodesAC_SUBST(BIND9_ISC_BUILDINCLUDE)
3375135446StrhodesAC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
3376135446StrhodesAC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
3377135446StrhodesAC_SUBST(BIND9_DNS_BUILDINCLUDE)
3378135446StrhodesAC_SUBST(BIND9_LWRES_BUILDINCLUDE)
3379135446StrhodesAC_SUBST(BIND9_BIND9_BUILDINCLUDE)
3380135446Strhodesif test "X$srcdir" != "X"; then
3381135446Strhodes	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
3382135446Strhodes	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
3383135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
3384135446Strhodes	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
3385135446Strhodes	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
3386135446Strhodes	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
3387135446Strhodeselse
3388135446Strhodes	BIND9_ISC_BUILDINCLUDE=""
3389135446Strhodes	BIND9_ISCCC_BUILDINCLUDE=""
3390135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE=""
3391135446Strhodes	BIND9_DNS_BUILDINCLUDE=""
3392135446Strhodes	BIND9_LWRES_BUILDINCLUDE=""
3393135446Strhodes	BIND9_BIND9_BUILDINCLUDE=""
3394135446Strhodesfi
3395135446Strhodes
3396135446StrhodesAC_SUBST_FILE(BIND9_MAKE_INCLUDES)
3397135446StrhodesBIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
3398135446Strhodes
3399135446StrhodesAC_SUBST_FILE(BIND9_MAKE_RULES)
3400135446StrhodesBIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
3401135446Strhodes
3402262706Serwin. "$srcdir/version"
3403254402SerwinBIND9_PRODUCT="PRODUCT=\"${PRODUCT}\""
3404254402SerwinAC_SUBST(BIND9_PRODUCT)
3405254402SerwinBIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\""
3406254402SerwinAC_SUBST(BIND9_DESCRIPTION)
3407262706SerwinBIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
3408135446StrhodesAC_SUBST(BIND9_VERSION)
3409135446Strhodes
3410254402SerwinBIND9_SRCID="SRCID=unset"
3411262706Serwinif test -f "${srcdir}/srcid"; then
3412262706Serwin	. "${srcdir}/srcid"
3413254402Serwin	BIND9_SRCID="SRCID=$SRCID"
3414262706Serwinelif test -d "${srcdir}/.git"; then
3415262706Serwin	BIND9_SRCID="SRCID="`(cd "${srcdir}";git log -n 1 --format=%h)`
3416254402Serwinfi
3417262706Serwin
3418254402SerwinAC_SUBST(BIND9_SRCID)
3419254402Serwin
3420193149Sdougbif test -z "$ac_configure_args"; then
3421193149Sdougb	BIND9_CONFIGARGS="defaults"
3422193149Sdougbelse
3423193149Sdougb	for a in $ac_configure_args
3424193149Sdougb	do
3425193149Sdougb		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
3426193149Sdougb	done
3427193149Sdougbfi
3428193149SdougbBIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
3429193149SdougbBIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
3430193149SdougbAC_SUBST(BIND9_CONFIGARGS)
3431193149Sdougb
3432135446StrhodesAC_SUBST_FILE(LIBISC_API)
3433262706SerwinLIBISC_API="$srcdir/lib/isc/api"
3434135446Strhodes
3435135446StrhodesAC_SUBST_FILE(LIBISCCC_API)
3436262706SerwinLIBISCCC_API="$srcdir/lib/isccc/api"
3437135446Strhodes
3438135446StrhodesAC_SUBST_FILE(LIBISCCFG_API)
3439262706SerwinLIBISCCFG_API="$srcdir/lib/isccfg/api"
3440135446Strhodes
3441135446StrhodesAC_SUBST_FILE(LIBDNS_API)
3442262706SerwinLIBDNS_API="$srcdir/lib/dns/api"
3443135446Strhodes
3444135446StrhodesAC_SUBST_FILE(LIBBIND9_API)
3445262706SerwinLIBBIND9_API="$srcdir/lib/bind9/api"
3446135446Strhodes
3447135446StrhodesAC_SUBST_FILE(LIBLWRES_API)
3448262706SerwinLIBLWRES_API="$srcdir/lib/lwres/api"
3449135446Strhodes
3450224092SdougbAC_SUBST_FILE(LIBIRS_API)
3451262706SerwinLIBIRS_API="$srcdir/lib/irs/api"
3452224092Sdougb
3453170222Sdougb#
3454170222Sdougb# Configure any DLZ drivers.
3455170222Sdougb#
3456170222Sdougb# If config.dlz.in selects one or more DLZ drivers, it will set
3457225361Sdougb# CONTRIB_DLZ to a non-empty value, which will be our clue to
3458225361Sdougb# build DLZ drivers in contrib.
3459170222Sdougb#
3460170222Sdougb# This section has to come after the libtool stuff because it needs to
3461170222Sdougb# know how to name the driver object files.
3462170222Sdougb#
3463170222Sdougb
3464225361SdougbCONTRIB_DLZ=""
3465170222SdougbDLZ_DRIVER_INCLUDES=""
3466170222SdougbDLZ_DRIVER_LIBS=""
3467170222SdougbDLZ_DRIVER_SRCS=""
3468170222SdougbDLZ_DRIVER_OBJS=""
3469218384SdougbDLZ_SYSTEM_TEST=""
3470170222Sdougb
3471254897Serwin#
3472225361Sdougb# Configure support for building a shared library object
3473225361Sdougb#
3474225361Sdougb# Even when libtool is available it can't always be relied upon
3475225361Sdougb# to build an object that can be dlopen()'ed, but this is necessary
3476225361Sdougb# for building the dlzexternal system test, so we'll try it the
3477225361Sdougb# old-fashioned way.
3478225361Sdougb#
3479225361SdougbSO="so"
3480225361SdougbSO_CFLAGS=""
3481225361SdougbSO_LD=""
3482225361SdougbSO_TARGETS=""
3483225361Sdougb
3484225361SdougbAC_ARG_WITH(dlopen,
3485225361Sdougb	[  --with-dlopen=ARG       Support dynamically loadable DLZ drivers],
3486225361Sdougb	dlopen="$withval", dlopen="yes")
3487225361Sdougb
3488254402Serwincase $host in
3489254402Serwin	*-sunos*) dlopen="no"
3490254402Serwin		;;
3491254402Serwinesac
3492254402Serwin
3493225361Sdougbif test "$dlopen" = "yes"; then
3494225361Sdougb	AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
3495225361Sdougb	if test "$have_dl" = "yes"; then
3496225361Sdougb		LIBS="-ldl $LIBS"
3497225361Sdougb	fi
3498225361Sdougb        AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
3499225361Sdougbfi
3500225361Sdougb
3501225361Sdougbif test "$dlopen" = "yes"; then
3502225361Sdougb	case $host in
3503225361Sdougb		*-linux*)
3504225361Sdougb			SO_CFLAGS="-fPIC"
3505225361Sdougb			if test "$have_dl" = "yes"
3506225361Sdougb			then
3507254402Serwin				if test "$use_libtool" = "yes"; then
3508254402Serwin					SO_LD="${CC} -Xcompiler -shared"
3509254402Serwin				else
3510254402Serwin					SO_LD="${CC} -shared"
3511254402Serwin				fi
3512225361Sdougb			else
3513225361Sdougb				SO_LD="ld -shared"
3514225361Sdougb			fi
3515225361Sdougb			;;
3516225361Sdougb		*-freebsd*|*-openbsd*|*-netbsd*)
3517225361Sdougb			SO_CFLAGS="-fpic"
3518225361Sdougb			SO_LD="ld -Bshareable -x"
3519225361Sdougb			;;
3520225361Sdougb		*-solaris*)
3521225361Sdougb			SO_CFLAGS="-KPIC"
3522225361Sdougb			SO_LD="ld -G -z text"
3523225361Sdougb                        ;;
3524225361Sdougb		*-hp-hpux*)
3525225361Sdougb			SO=sl
3526225361Sdougb			SO_CFLAGS="+z"
3527225361Sdougb			SO_LD="ld -b"
3528225361Sdougb                        ;;
3529225361Sdougb		*)
3530225361Sdougb			SO_CFLAGS="-fPIC"
3531225361Sdougb			;;
3532225361Sdougb	esac
3533225361Sdougb
3534225361Sdougb	if test "X$GCC" = "Xyes"; then
3535225361Sdougb		SO_CFLAGS="-fPIC"
3536225361Sdougb                test -n "$SO_LD" || SO_LD="${CC} -shared"
3537225361Sdougb	fi
3538225361Sdougb
3539225361Sdougb	# If we still don't know how to make shared objects, don't make any.
3540225361Sdougb	if test -n "$SO_LD"; then
3541225361Sdougb		SO_TARGETS="\${SO_TARGETS}"
3542225361Sdougb		AC_DEFINE(ISC_DLZ_DLOPEN, 1,
3543225361Sdougb			  [Define to allow building of objects for dlopen().])
3544225361Sdougb	fi
3545225361Sdougbfi
3546225361Sdougb
3547225361SdougbAC_SUBST(SO)
3548225361SdougbAC_SUBST(SO_CFLAGS)
3549225361SdougbAC_SUBST(SO_LD)
3550225361SdougbAC_SUBST(SO_TARGETS)
3551225361Sdougb
3552170222Sdougbsinclude(contrib/dlz/config.dlz.in)
3553225361SdougbAC_MSG_CHECKING(contributed DLZ drivers)
3554170222Sdougb
3555225361Sdougbif test -n "$CONTRIB_DLZ"
3556170222Sdougbthen
3557170222Sdougb	AC_MSG_RESULT(yes)
3558170222Sdougb	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
3559170222Sdougb	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
3560170222Sdougbelse
3561170222Sdougb	AC_MSG_RESULT(no)
3562170222Sdougb	DLZ_DRIVER_RULES=/dev/null
3563170222Sdougbfi
3564170222Sdougb
3565225361SdougbAC_SUBST(CONTRIB_DLZ)
3566170222SdougbAC_SUBST(DLZ_DRIVER_INCLUDES)
3567170222SdougbAC_SUBST(DLZ_DRIVER_LIBS)
3568170222SdougbAC_SUBST(DLZ_DRIVER_SRCS)
3569170222SdougbAC_SUBST(DLZ_DRIVER_OBJS)
3570218384SdougbAC_SUBST(DLZ_SYSTEM_TEST)
3571170222SdougbAC_SUBST_FILE(DLZ_DRIVER_RULES)
3572170222Sdougb
3573165071Sdougbif test "$cross_compiling" = "yes"; then
3574165071Sdougb	if test -z "$BUILD_CC"; then
3575165071Sdougb		AC_ERROR([BUILD_CC not set])
3576165071Sdougb	fi
3577165071Sdougb	BUILD_CFLAGS="$BUILD_CFLAGS"
3578165071Sdougb	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
3579165071Sdougb	BUILD_LDFLAGS="$BUILD_LDFLAGS"
3580165071Sdougb	BUILD_LIBS="$BUILD_LIBS"
3581165071Sdougbelse
3582254897Serwin	BUILD_CC="$CC"
3583254897Serwin	BUILD_CFLAGS="$CFLAGS"
3584165071Sdougb	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
3585165071Sdougb	BUILD_LDFLAGS="$LDFLAGS"
3586165071Sdougb	BUILD_LIBS="$LIBS"
3587165071Sdougbfi
3588165071Sdougb
3589193149SdougbNEWFLAGS=""
3590193149Sdougbfor e in $BUILD_LDFLAGS ; do
3591193149Sdougb    case $e in
3592193149Sdougb	-L*)
3593193149Sdougb	    case $host_os in
3594193149Sdougb		netbsd*)
3595193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3596193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3597193149Sdougb		    ;;
3598193149Sdougb		freebsd*)
3599193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3600193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3601193149Sdougb		    ;;
3602193149Sdougb		solaris*)
3603193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3604193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3605193149Sdougb		    ;;
3606193149Sdougb		*)
3607193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3608193149Sdougb		    ;;
3609193149Sdougb		esac
3610193149Sdougb	    ;;
3611193149Sdougb	*)
3612193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3613193149Sdougb	    ;;
3614193149Sdougb    esac
3615193149Sdougbdone
3616193149SdougbBUILD_LDFLAGS="$NEWFLAGS"
3617193149Sdougb
3618193149SdougbNEWFLAGS=""
3619193149Sdougbfor e in $DNS_GSSAPI_LIBS ; do
3620193149Sdougb    case $e in
3621193149Sdougb	-L*)
3622193149Sdougb	    case $host_os in
3623193149Sdougb		netbsd*)
3624193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3625193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3626193149Sdougb		    ;;
3627193149Sdougb		freebsd*)
3628193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3629193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3630193149Sdougb		    ;;
3631193149Sdougb		solaris*)
3632193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3633193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3634193149Sdougb		    ;;
3635193149Sdougb		*)
3636193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3637193149Sdougb		    ;;
3638193149Sdougb		esac
3639193149Sdougb	    ;;
3640193149Sdougb	*)
3641193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3642193149Sdougb	    ;;
3643193149Sdougb    esac
3644193149Sdougbdone
3645193149SdougbDNS_GSSAPI_LIBS="$NEWFLAGS"
3646193149Sdougb
3647193149SdougbNEWFLAGS=""
3648193149Sdougbfor e in $DNS_CRYPTO_LIBS ; do
3649193149Sdougb    case $e in
3650193149Sdougb	-L*)
3651193149Sdougb	    case $host_os in
3652193149Sdougb		netbsd*)
3653193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3654193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3655193149Sdougb		    ;;
3656193149Sdougb		freebsd*)
3657193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3658193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3659193149Sdougb		    ;;
3660193149Sdougb		solaris*)
3661193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
3662193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
3663193149Sdougb		    ;;
3664193149Sdougb		*)
3665193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
3666193149Sdougb		    ;;
3667193149Sdougb		esac
3668193149Sdougb	    ;;
3669193149Sdougb	*)
3670193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
3671193149Sdougb	    ;;
3672193149Sdougb    esac
3673193149Sdougbdone
3674193149SdougbDNS_CRYPTO_LIBS="$NEWFLAGS"
3675193149Sdougb
3676165071SdougbAC_SUBST(BUILD_CC)
3677165071SdougbAC_SUBST(BUILD_CFLAGS)
3678165071SdougbAC_SUBST(BUILD_CPPFLAGS)
3679165071SdougbAC_SUBST(BUILD_LDFLAGS)
3680165071SdougbAC_SUBST(BUILD_LIBS)
3681165071Sdougb
3682170222Sdougb#
3683170222Sdougb# Commands to run at the end of config.status.
3684170222Sdougb# Don't just put these into configure, it won't work right if somebody
3685170222Sdougb# runs config.status directly (which autoconf allows).
3686170222Sdougb#
3687170222Sdougb
3688170222SdougbAC_CONFIG_COMMANDS(
3689170222Sdougb	[chmod],
3690193149Sdougb	[chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
3691170222Sdougb
3692170222Sdougb#
3693170222Sdougb# Files to configure.  These are listed here because we used to
3694170222Sdougb# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
3695170222Sdougb# elsewhere if there's a good reason for doing so.
3696170222Sdougb#
3697170222Sdougb
3698170222SdougbAC_CONFIG_FILES([
3699224092Sdougb  make/Makefile
3700224092Sdougb  make/mkdep
3701135446Strhodes	Makefile
3702224092Sdougb	bin/Makefile
3703224092Sdougb	bin/check/Makefile
3704224092Sdougb	bin/confgen/Makefile
3705224092Sdougb	bin/confgen/unix/Makefile
3706224092Sdougb	bin/dig/Makefile
3707224092Sdougb	bin/dnssec/Makefile
3708224092Sdougb	bin/named/Makefile
3709224092Sdougb	bin/named/unix/Makefile
3710224092Sdougb	bin/nsupdate/Makefile
3711224092Sdougb	bin/pkcs11/Makefile
3712254897Serwin	bin/python/Makefile
3713254897Serwin	bin/python/dnssec-checkds.py
3714254897Serwin	bin/python/dnssec-coverage.py
3715224092Sdougb	bin/rndc/Makefile
3716224092Sdougb	bin/tests/Makefile
3717224092Sdougb	bin/tests/atomic/Makefile
3718224092Sdougb	bin/tests/db/Makefile
3719224092Sdougb	bin/tests/dst/Makefile
3720254402Serwin	bin/tests/dst/Kdh.+002+18602.key
3721254402Serwin	bin/tests/dst/Kdh.+002+18602.private
3722254402Serwin	bin/tests/dst/Kdh.+002+48957.key
3723254402Serwin	bin/tests/dst/Kdh.+002+48957.private
3724254402Serwin	bin/tests/dst/Ktest.+001+00002.key
3725254402Serwin	bin/tests/dst/Ktest.+001+54622.key
3726254402Serwin	bin/tests/dst/Ktest.+001+54622.private
3727254402Serwin	bin/tests/dst/Ktest.+003+23616.key
3728254402Serwin	bin/tests/dst/Ktest.+003+23616.private
3729254402Serwin	bin/tests/dst/Ktest.+003+49667.key
3730254402Serwin	bin/tests/dst/dst_2_data
3731254402Serwin	bin/tests/dst/t2_data_1
3732254402Serwin	bin/tests/dst/t2_data_2
3733254402Serwin	bin/tests/dst/t2_dsasig
3734254402Serwin	bin/tests/dst/t2_rsasig
3735224092Sdougb	bin/tests/hashes/Makefile
3736224092Sdougb	bin/tests/headerdep_test.sh
3737224092Sdougb	bin/tests/master/Makefile
3738224092Sdougb	bin/tests/mem/Makefile
3739224092Sdougb	bin/tests/names/Makefile
3740224092Sdougb	bin/tests/net/Makefile
3741224092Sdougb	bin/tests/rbt/Makefile
3742224092Sdougb	bin/tests/resolver/Makefile
3743224092Sdougb	bin/tests/sockaddr/Makefile
3744224092Sdougb	bin/tests/system/Makefile
3745224092Sdougb	bin/tests/system/conf.sh
3746225361Sdougb	bin/tests/system/dlz/prereq.sh
3747225361Sdougb	bin/tests/system/dlzexternal/Makefile
3748225361Sdougb	bin/tests/system/dlzexternal/ns1/named.conf
3749245163Serwin	bin/tests/system/ecdsa/prereq.sh
3750224092Sdougb	bin/tests/system/filter-aaaa/Makefile
3751224092Sdougb	bin/tests/system/gost/prereq.sh
3752262706Serwin	bin/tests/system/inline/checkdsa.sh
3753224092Sdougb	bin/tests/system/lwresd/Makefile
3754224092Sdougb	bin/tests/system/rpz/Makefile
3755262706Serwin	bin/tests/system/rrl/Makefile
3756254897Serwin	bin/tests/system/rsabigexponent/Makefile
3757224092Sdougb	bin/tests/system/tkey/Makefile
3758225361Sdougb	bin/tests/system/tsiggss/Makefile
3759224092Sdougb	bin/tests/tasks/Makefile
3760224092Sdougb	bin/tests/timers/Makefile
3761224092Sdougb	bin/tests/virtual-time/Makefile
3762224092Sdougb	bin/tests/virtual-time/conf.sh
3763224092Sdougb	bin/tools/Makefile
3764224092Sdougb	contrib/check-secure-delegation.pl
3765224092Sdougb	contrib/zone-edit.sh
3766224092Sdougb	doc/Makefile
3767224092Sdougb	doc/arm/Makefile
3768224092Sdougb	doc/doxygen/Doxyfile
3769224092Sdougb	doc/doxygen/Makefile
3770224092Sdougb	doc/doxygen/doxygen-input-filter
3771224092Sdougb	doc/misc/Makefile
3772224092Sdougb	doc/xsl/Makefile
3773224092Sdougb	doc/xsl/isc-docbook-chunk.xsl
3774224092Sdougb	doc/xsl/isc-docbook-html.xsl
3775224092Sdougb	doc/xsl/isc-docbook-latex.xsl
3776224092Sdougb	doc/xsl/isc-manpage.xsl
3777224092Sdougb	isc-config.sh
3778135446Strhodes	lib/Makefile
3779224092Sdougb	lib/bind9/Makefile
3780224092Sdougb	lib/bind9/include/Makefile
3781224092Sdougb	lib/bind9/include/bind9/Makefile
3782224092Sdougb	lib/dns/Makefile
3783224092Sdougb	lib/dns/include/Makefile
3784224092Sdougb	lib/dns/include/dns/Makefile
3785224092Sdougb	lib/dns/include/dst/Makefile
3786225361Sdougb	lib/dns/tests/Makefile
3787224092Sdougb	lib/export/Makefile
3788224092Sdougb	lib/export/dns/Makefile
3789224092Sdougb	lib/export/dns/include/Makefile
3790224092Sdougb	lib/export/dns/include/dns/Makefile
3791224092Sdougb	lib/export/dns/include/dst/Makefile
3792224092Sdougb	lib/export/irs/Makefile
3793224092Sdougb	lib/export/irs/include/Makefile
3794224092Sdougb	lib/export/irs/include/irs/Makefile
3795224092Sdougb	lib/export/isc/$thread_dir/Makefile
3796224092Sdougb	lib/export/isc/$thread_dir/include/Makefile
3797224092Sdougb	lib/export/isc/$thread_dir/include/isc/Makefile
3798224092Sdougb	lib/export/isc/Makefile
3799224092Sdougb	lib/export/isc/include/Makefile
3800224092Sdougb	lib/export/isc/include/isc/Makefile
3801224092Sdougb	lib/export/isc/nls/Makefile
3802224092Sdougb	lib/export/isc/unix/Makefile
3803224092Sdougb	lib/export/isc/unix/include/Makefile
3804224092Sdougb	lib/export/isc/unix/include/isc/Makefile
3805224092Sdougb	lib/export/isccfg/Makefile
3806224092Sdougb	lib/export/isccfg/include/Makefile
3807224092Sdougb	lib/export/isccfg/include/isccfg/Makefile
3808224092Sdougb	lib/export/samples/Makefile
3809224092Sdougb	lib/export/samples/Makefile-postinstall
3810224092Sdougb	lib/irs/Makefile
3811224092Sdougb	lib/irs/include/Makefile
3812224092Sdougb	lib/irs/include/irs/Makefile
3813224092Sdougb	lib/irs/include/irs/netdb.h
3814224092Sdougb	lib/irs/include/irs/platform.h
3815224092Sdougb	lib/isc/$arch/Makefile
3816224092Sdougb	lib/isc/$arch/include/Makefile
3817224092Sdougb	lib/isc/$arch/include/isc/Makefile
3818224092Sdougb	lib/isc/$thread_dir/Makefile
3819224092Sdougb	lib/isc/$thread_dir/include/Makefile
3820224092Sdougb	lib/isc/$thread_dir/include/isc/Makefile
3821135446Strhodes	lib/isc/Makefile
3822135446Strhodes	lib/isc/include/Makefile
3823135446Strhodes	lib/isc/include/isc/Makefile
3824135446Strhodes	lib/isc/include/isc/platform.h
3825225361Sdougb	lib/isc/tests/Makefile
3826224092Sdougb	lib/isc/nls/Makefile
3827135446Strhodes	lib/isc/unix/Makefile
3828135446Strhodes	lib/isc/unix/include/Makefile
3829135446Strhodes	lib/isc/unix/include/isc/Makefile
3830135446Strhodes	lib/isccc/Makefile
3831135446Strhodes	lib/isccc/include/Makefile
3832135446Strhodes	lib/isccc/include/isccc/Makefile
3833135446Strhodes	lib/isccfg/Makefile
3834135446Strhodes	lib/isccfg/include/Makefile
3835135446Strhodes	lib/isccfg/include/isccfg/Makefile
3836135446Strhodes	lib/lwres/Makefile
3837135446Strhodes	lib/lwres/include/Makefile
3838135446Strhodes	lib/lwres/include/lwres/Makefile
3839135446Strhodes	lib/lwres/include/lwres/netdb.h
3840135446Strhodes	lib/lwres/include/lwres/platform.h
3841135446Strhodes	lib/lwres/man/Makefile
3842135446Strhodes	lib/lwres/unix/Makefile
3843135446Strhodes	lib/lwres/unix/include/Makefile
3844135446Strhodes	lib/lwres/unix/include/lwres/Makefile
3845135446Strhodes	lib/tests/Makefile
3846135446Strhodes	lib/tests/include/Makefile
3847135446Strhodes	lib/tests/include/tests/Makefile
3848225361Sdougb	unit/Makefile
3849225361Sdougb	unit/unittest.sh
3850170222Sdougb])
3851135446Strhodes
3852170222Sdougb#
3853170222Sdougb# Do it
3854170222Sdougb#
3855170222Sdougb
3856170222SdougbAC_OUTPUT
3857170222Sdougb
3858218384Sdougb#
3859218384Sdougb# Now that the Makefiles exist we can ensure that everything is rebuilt.
3860218384Sdougb#
3861218384SdougbAC_ARG_WITH(make-clean,
3862218384Sdougb[  --with-make-clean      Run "make clean" at end of configure [[yes|no]].],
3863218384Sdougb    make_clean="$withval", make_clean="yes")
3864218384Sdougbcase "$make_clean" in
3865218384Sdougbyes)
3866218384Sdougb	make clean
3867218384Sdougb	;;
3868218384Sdougbesac
3869218384Sdougb
3870262706SerwinAC_ARG_ENABLE(full-report,
3871262706Serwin	[  --enable-full-report	  report values of all configure options])
3872262706Serwin
3873262706Serwinecho "========================================================================"
3874262706Serwinecho "Configuration summary:"
3875262706Serwinecho "------------------------------------------------------------------------"
3876262706Serwinecho "Optional features enabled:"
3877262706Serwin$use_threads && echo "    Multiprocessing support (--enable-threads)"
3878262706Serwin
3879262706Serwintest "$enable_rrl" = "yes" && \
3880262706Serwin    echo "    Response Rate Limiting (--enable-rrl)"
3881262706Serwintest "$use_gssapi" = "no" || echo "    GSS-API (--with-gssapi)"
3882262706Serwintest "$use_pkcs11" = "no" || echo "    PKCS#11/Cryptoki support (--with-pkcs11)"
3883262706Serwintest "$enable_newstats" = "yes" && \
3884262706Serwin    echo "    New statistics (--enable-newstats)"
3885262706Serwintest "$enable_fixed" = "yes" && \
3886262706Serwin    echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
3887262706Serwintest "$enable_filter" = "yes" && \
3888262706Serwin    echo "    AAAA filtering (--enable-filter-aaaa)"
3889262706Serwintest "$want_backtrace" = "yes" && \
3890262706Serwin    echo "    Print backtrace on crash (--enable-backtrace)"
3891262706Serwintest "$want_symtable" = "minimal" && \
3892262706Serwin    echo "    Use symbol table for backtrace, named only (--enable-symtable)"
3893262706Serwintest "$want_symtable" = "yes" -o "$want_symtable" = "all" && \
3894262706Serwin    echo "    Use symbol table for backtrace, all binaries (--enable-symtable=all)"
3895262706Serwintest "$atf" = "no" || echo "    Automated Testing Framework (--with-atf)"
3896262706Serwin
3897262706Serwin# these lines are only printed if run with --enable-full-report 
3898262706Serwinif test "$enable_full_report" = "yes"; then
3899262706Serwin    test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" || \
3900262706Serwin        echo "    IPv6 support (--enable-ipv6)"
3901262706Serwin    test "X$USE_OPENSSL" = "X" || \
3902262706Serwin            echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
3903262706Serwin    test "$OPENSSL_GOST" != "yes" || \
3904262706Serwin            echo "    GOST algorithm support (--with-gost)"
3905262706Serwin    test "$OPENSSL_ECDSA" != "yes" || \
3906262706Serwin            echo "    ECDSA algorithm support (--with-ecdsa)"
3907262706Serwin    test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
3908262706Serwin    test "X$libxml2_libs" = "X" || echo "    XML statistics (--with-libxml2)"
3909262706Serwinfi
3910262706Serwin
3911262706Serwinecho "    Dynamically loadable zone (DLZ) drivers:"
3912262706Serwintest "$use_dlz_bdb" = "no" || \
3913262706Serwin    echo "        Berkeley DB (--with-dlz-bdb)"
3914262706Serwintest "$use_dlz_ldap" = "no" || \
3915262706Serwin    echo "        LDAP (--with-dlz-ldap)"
3916262706Serwintest "$use_dlz_mysql" = "no" || \
3917262706Serwin    echo "        MySQL (--with-dlz-mysql)"
3918262706Serwintest "$use_dlz_odbc" = "no" || \
3919262706Serwin    echo "        ODBC (--with-dlz-bdb)"
3920262706Serwintest "$use_dlz_postgres" = "no" || \
3921262706Serwin    echo "        Postgres (--with-dlz-postgres)"
3922262706Serwintest "$use_dlz_filesystem" = "no" || \
3923262706Serwin    echo "        Filesystem (--with-dlz-filesystem)"
3924262706Serwintest "$use_dlz_stub" = "no" || \
3925262706Serwin    echo "        Stub (--with-dlz-stub)"
3926262706Serwintest "$use_dlz_bdb $use_dlz_ldap $use_dlz_mysql $use_dlz_odbc $use_dlz_postgres $use_dlz_filesystem $use_dlz_stub" = "no no no no no no no" && echo "        None"
3927262706Serwinecho
3928262706Serwin
3929262706Serwinecho "Features disabled or unavailable on this platform:"
3930262706Serwin$use_threads || echo "    Multiprocessing support (--enable-threads)"
3931262706Serwintest "$enable_ipv6" = "no" -o "$found_ipv6" = "no" && \
3932262706Serwin        echo "    IPv6 support (--enable-ipv6)"
3933262706Serwintest "$enable_rrl" = "yes" || \
3934262706Serwin    echo "    Response Rate Limiting (--enable-rrl)"
3935262706Serwintest "$use_gssapi" = "no" && echo "    GSS-API (--with-gssapi)"
3936262706Serwintest "$use_pkcs11" = "no" && echo "    PKCS#11/Cryptoki support (--with-pkcs11)"
3937262706Serwintest "X$enable_newstats" = "X" && echo "    New statistics (--enable-newstats)"
3938262706Serwintest "$enable_fixed" = "yes" || \
3939262706Serwin    echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
3940262706Serwintest "$want_backtrace" = "yes" || \
3941262706Serwin    echo "    Print backtrace on crash (--enable-backtrace)"
3942262706Serwintest "$atf" = "no" && echo "    Automated Testing Framework (--with-atf)"
3943262706Serwintest "X$USE_OPENSSL" = "X" && \
3944262706Serwin        echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
3945262706Serwintest "X$USE_OPENSSL" != "X" -a "$OPENSSL_GOST" != "yes" && \
3946262706Serwin    echo "    GOST algorithm support (--with-gost)"
3947262706Serwintest "X$USE_OPENSSL" != "X" -a "$OPENSSL_ECDSA" != "yes" && \
3948262706Serwin    echo "    ECDSA algorithm support (--with-ecdsa)"
3949262706Serwintest "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
3950262706Serwintest "X$libxml2_libs" = "X" && echo "    XML statistics (--with-libxml2)"
3951262706Serwin
3952262706Serwinecho "========================================================================"
3953262706Serwin
3954204619Sdougbif test "X$USE_OPENSSL" = "X"; then
3955254897Serwincat << \EOF
3956204619SdougbBIND is being built without OpenSSL. This means it will not have DNSSEC support.
3957204619SdougbEOF
3958204619Sdougbfi
3959204619Sdougb
3960163976Sdougbif test "X$OPENSSL_WARNING" != "X"; then
3961163976Sdougbcat << \EOF
3962163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3963163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3964163976SdougbWARNING                                                                 WARNING
3965163976SdougbWARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
3966163976SdougbWARNING         one or more of the the following known security         WARNING
3967163976SdougbWARNING         flaws:                                                  WARNING
3968163976SdougbWARNING                                                                 WARNING
3969163976SdougbWARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
3970163976SdougbWARNING         CVE-2006-2940.                                          WARNING
3971163976SdougbWARNING                                                                 WARNING
3972163976SdougbWARNING         It is recommended that you upgrade to OpenSSL           WARNING
3973163976SdougbWARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
3974163976SdougbWARNING                                                                 WARNING
3975163976SdougbWARNING         You can disable this warning by specifying:             WARNING
3976163976SdougbWARNING                                                                 WARNING
3977163976SdougbWARNING               --disable-openssl-version-check          	        WARNING
3978163976SdougbWARNING                                                                 WARNING
3979163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3980163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3981163976SdougbEOF
3982163976Sdougbfi
3983163976Sdougb
3984135446Strhodes# Tell Emacs to edit this file in shell mode.
3985135446Strhodes# Local Variables:
3986135446Strhodes# mode: sh
3987135446Strhodes# End:
3988