configure.in revision 204619
1204619Sdougb# Copyright (C) 2004-2010  Internet Systems Consortium, Inc. ("ISC")
2135446Strhodes# Copyright (C) 1998-2003  Internet Software Consortium.
3135446Strhodes#
4174187Sdougb# Permission to use, copy, modify, and/or distribute this software for any
5135446Strhodes# purpose with or without fee is hereby granted, provided that the above
6135446Strhodes# copyright notice and this permission notice appear in all copies.
7135446Strhodes#
8135446Strhodes# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9135446Strhodes# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10135446Strhodes# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11135446Strhodes# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12135446Strhodes# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13135446Strhodes# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14135446Strhodes# PERFORMANCE OF THIS SOFTWARE.
15135446Strhodes
16135446Strhodesdnl
17135446StrhodesAC_DIVERT_PUSH(1)dnl
18135446Strhodesesyscmd([sed "s/^/# /" COPYRIGHT])dnl
19135446StrhodesAC_DIVERT_POP()dnl
20135446Strhodes
21204619SdougbAC_REVISION($Revision: 1.457.26.16 $)
22135446Strhodes
23135446StrhodesAC_INIT(lib/dns/name.c)
24170222SdougbAC_PREREQ(2.59)
25135446Strhodes
26135446StrhodesAC_CONFIG_HEADER(config.h)
27135446Strhodes
28135446StrhodesAC_CANONICAL_HOST
29135446Strhodes
30135446StrhodesAC_PROG_MAKE_SET
31204619Sdougb
32204619Sdougb#
33204619Sdougb# GNU libtool support
34204619Sdougb#
35204619Sdougbcase $build_os in
36204619Sdougbsunos*)
37204619Sdougb    # Just set the maximum command line length for sunos as it otherwise
38204619Sdougb    # takes a exceptionally long time to work it out. Required for libtool.
39204619Sdougb    lt_cv_sys_max_cmd_len=4096;
40204619Sdougb    ;;
41204619Sdougbesac
42204619Sdougb
43193149SdougbAC_PROG_LIBTOOL
44135446StrhodesAC_PROG_INSTALL
45170222SdougbAC_PROG_LN_S
46135446Strhodes
47135446StrhodesAC_SUBST(STD_CINCLUDES)
48135446StrhodesAC_SUBST(STD_CDEFINES)
49135446StrhodesAC_SUBST(STD_CWARNINGS)
50135446StrhodesAC_SUBST(CCOPT)
51135446Strhodes
52193149Sdougb# Warn if the user specified libbind, which is now deprecated
53193149SdougbAC_ARG_ENABLE(libbind, [  --enable-libbind	  deprecated])
54193149Sdougb
55193149Sdougbcase "$enable_libbind" in
56193149Sdougb	yes)
57193149Sdougb		AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
58193149SdougbIt is available from http://www.isc.org as a separate download.])
59193149Sdougb		;;
60193149Sdougb	no|'')
61193149Sdougb		;;
62193149Sdougbesac
63193149Sdougb
64193149Sdougb
65170222Sdougb#
66170222Sdougb# Make very sure that these are the first files processed by
67170222Sdougb# config.status, since we use the processed output as the input for
68193149Sdougb# AC_SUBST_FILE() substitutions in other files.
69170222Sdougb#
70170222SdougbAC_CONFIG_FILES([make/rules make/includes])
71170222Sdougb
72135446StrhodesAC_PATH_PROG(AR, ar)
73135446StrhodesARFLAGS="cruv"
74135446StrhodesAC_SUBST(AR)
75135446StrhodesAC_SUBST(ARFLAGS)
76135446Strhodes
77135446Strhodes# The POSIX ln(1) program.  Non-POSIX systems may substitute
78135446Strhodes# "copy" or something.
79135446StrhodesLN=ln
80135446StrhodesAC_SUBST(LN)
81135446Strhodes
82135446Strhodescase "$AR" in
83135446Strhodes	"")
84135446Strhodes		AC_MSG_ERROR([
85135446Strhodesar program not found.  Please fix your PATH to include the directory in
86135446Strhodeswhich ar resides, or set AR in the environment with the full path to ar.
87135446Strhodes])
88135446Strhodes
89135446Strhodes		;;
90135446Strhodesesac
91135446Strhodes
92135446Strhodes#
93135446Strhodes# Etags.
94135446Strhodes#
95135446StrhodesAC_PATH_PROGS(ETAGS, etags emacs-etags)
96135446Strhodes
97135446Strhodes#
98135446Strhodes# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
99135446Strhodes# GNU emacs etags, and it requires the -L flag.
100135446Strhodes#
101135446Strhodesif test "X$ETAGS" != "X"; then
102135446Strhodes	AC_MSG_CHECKING(for Exuberant Ctags etags)
103135446Strhodes	if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
104135446Strhodes		AC_MSG_RESULT(yes)
105135446Strhodes		ETAGS="$ETAGS -L"
106135446Strhodes	else
107135446Strhodes		AC_MSG_RESULT(no)
108135446Strhodes	fi
109135446Strhodesfi
110135446StrhodesAC_SUBST(ETAGS)
111135446Strhodes
112135446Strhodes#
113135446Strhodes# Perl is optional; it is used only by some of the system test scripts.
114135446Strhodes#
115135446StrhodesAC_PATH_PROGS(PERL, perl5 perl)
116135446StrhodesAC_SUBST(PERL)
117135446Strhodes
118135446Strhodes#
119135446Strhodes# Special processing of paths depending on whether --prefix,
120135446Strhodes# --sysconfdir or --localstatedir arguments were given.  What's
121135446Strhodes# desired is some compatibility with the way previous versions
122135446Strhodes# of BIND built; they defaulted to /usr/local for most parts of
123135446Strhodes# the installation, but named.boot/named.conf was in /etc
124135446Strhodes# and named.pid was in /var/run.
125135446Strhodes#
126135446Strhodes# So ... if none of --prefix, --sysconfdir or --localstatedir are
127135446Strhodes# specified, set things up that way.  If --prefix is given, use
128135446Strhodes# it for sysconfdir and localstatedir the way configure normally
129135446Strhodes# would.  To change the prefix for everything but leave named.conf
130135446Strhodes# in /etc or named.pid in /var/run, then do this the usual configure way:
131135446Strhodes# ./configure --prefix=/somewhere --sysconfdir=/etc
132135446Strhodes# ./configure --prefix=/somewhere --localstatedir=/var
133135446Strhodes#
134135446Strhodes# To put named.conf and named.pid in /usr/local with everything else,
135135446Strhodes# set the prefix explicitly to /usr/local even though that's the default:
136135446Strhodes# ./configure --prefix=/usr/local
137135446Strhodes#
138135446Strhodescase "$prefix" in
139193149Sdougb	NONE)
140193149Sdougb		case "$sysconfdir" in
141193149Sdougb			'${prefix}/etc')
142193149Sdougb				sysconfdir=/etc
143193149Sdougb				;;
144193149Sdougb		esac
145193149Sdougb		case "$localstatedir" in
146193149Sdougb			'${prefix}/var')
147193149Sdougb				localstatedir=/var
148193149Sdougb				;;
149193149Sdougb		esac
150193149Sdougb		;;
151135446Strhodesesac
152135446Strhodes
153135446Strhodes#
154135446Strhodes# Make sure INSTALL uses an absolute path, else it will be wrong in all
155135446Strhodes# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
156135446Strhodes# configure based on the location of the file where it is substituted.
157135446Strhodes# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
158135446Strhodes# subdirectory of install-sh, This relative path will be wrong for all
159135446Strhodes# directories more than one level down from install-sh.
160135446Strhodes#
161135446Strhodescase "$INSTALL" in
162135446Strhodes	/*)
163193149Sdougb		;;
164193149Sdougb	*)
165193149Sdougb		#
166193149Sdougb		# Not all systems have dirname.
167193149Sdougb		#
168193149Sdougb		changequote({, })
169193149Sdougb		ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
170193149Sdougb		changequote([, ])
171135446Strhodes
172193149Sdougb		ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
173193149Sdougb		test "$ac_dir" = "$ac_prog" && ac_dir=.
174193149Sdougb		test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
175193149Sdougb		INSTALL="$ac_dir/$ac_prog"
176193149Sdougb		;;
177135446Strhodesesac
178135446Strhodes
179135446Strhodes#
180135446Strhodes# On these hosts, we really want to use cc, not gcc, even if it is
181135446Strhodes# found.  The gcc that these systems have will not correctly handle
182135446Strhodes# pthreads.
183135446Strhodes#
184135446Strhodes# However, if the user sets $CC to be something, let that override
185135446Strhodes# our change.
186135446Strhodes#
187135446Strhodesif test "X$CC" = "X" ; then
188135446Strhodes	case "$host" in
189135446Strhodes		*-dec-osf*)
190135446Strhodes			CC="cc"
191135446Strhodes			;;
192135446Strhodes		*-solaris*)
193193149Sdougb			# Use Sun's cc if it is available, but watch
194193149Sdougb			# out for /usr/ucb/cc; it will never be the right
195193149Sdougb			# compiler to use.
196193149Sdougb			#
197193149Sdougb			# If setting CC here fails, the AC_PROG_CC done
198193149Sdougb			# below might still find gcc.
199135446Strhodes			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
200135446Strhodes			for ac_dir in $PATH; do
201135446Strhodes				test -z "$ac_dir" && ac_dir=.
202135446Strhodes				case "$ac_dir" in
203135446Strhodes				/usr/ucb)
204135446Strhodes					# exclude
205135446Strhodes					;;
206135446Strhodes				*)
207135446Strhodes					if test -f "$ac_dir/cc"; then
208135446Strhodes						CC="$ac_dir/cc"
209135446Strhodes						break
210135446Strhodes					fi
211135446Strhodes					;;
212135446Strhodes				esac
213135446Strhodes			done
214135446Strhodes			IFS="$ac_save_ifs"
215135446Strhodes			;;
216135446Strhodes		*-hp-hpux*)
217135446Strhodes			CC="cc"
218135446Strhodes			;;
219135446Strhodes		mips-sgi-irix*)
220135446Strhodes			CC="cc"
221135446Strhodes			;;
222135446Strhodes	esac
223135446Strhodesfi
224135446Strhodes
225135446StrhodesAC_PROG_CC
226135446Strhodes
227135446Strhodes#
228135446Strhodes# gcc's optimiser is broken at -02 for ultrasparc
229135446Strhodes#
230135446Strhodesif test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
231135446Strhodes	case "$host" in
232135446Strhodes	sparc-*)
233135446Strhodes		CCFLAGS="-g -O1"
234135446Strhodes		;;
235135446Strhodes	esac
236135446Strhodesfi
237135446Strhodes
238135446Strhodes#
239135446Strhodes# OS dependent CC flags
240135446Strhodes#
241135446Strhodescase "$host" in
242193149Sdougb	# OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
243135446Strhodes	# -D_XOPEN_SOURCE_EXTENDED.
244135446Strhodes	*-dec-osf*)
245135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
246135446Strhodes		CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
247135446Strhodes		;;
248135446Strhodes	#HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
249135446Strhodes	*-hp-hpux*)
250135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
251135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
252135446Strhodes		LIBS="-lxnet $LIBS"
253135446Strhodes		;;
254135446Strhodes	# Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
255135446Strhodes	*-solaris*)
256135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
257135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
258135446Strhodes		;;
259186462Sdougb	# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
260186462Sdougb	# parts of the IPv6 Advanced Socket API as a result.  This is stupid
261186462Sdougb	# as it breaks how the two halves (Basic and Advanced) of the IPv6
262186462Sdougb	# Socket API were designed to be used but we have to live with it.
263186462Sdougb	# Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
264186462Sdougb	*-linux*)
265186462Sdougb		STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
266186462Sdougb		CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
267186462Sdougb		;;
268135446Strhodesesac
269135446Strhodes
270135446StrhodesAC_HEADER_STDC
271135446Strhodes
272135446StrhodesAC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
273135446Strhodes[$ac_includes_default
274135446Strhodes#ifdef HAVE_SYS_PARAM_H
275135446Strhodes# include <sys/param.h>
276135446Strhodes#endif
277135446Strhodes])
278135446Strhodes
279135446StrhodesAC_C_CONST
280135446StrhodesAC_C_INLINE
281186462SdougbAC_C_VOLATILE
282135446StrhodesAC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
283135446Strhodes
284135446Strhodes#
285135446Strhodes# UnixWare 7.1.1 with the feature supplement to the UDK compiler
286135446Strhodes# is reported to not support "static inline" (RT #1212).
287135446Strhodes#
288135446StrhodesAC_MSG_CHECKING(for static inline breakage)
289135446StrhodesAC_TRY_COMPILE(, [
290135446Strhodes		foo1();
291135446Strhodes	}
292135446Strhodes
293135446Strhodes	static inline int foo1() {
294135446Strhodes		return 0;
295135446Strhodes	}
296135446Strhodes
297135446Strhodes	static inline int foo2() {
298135446Strhodes		return foo1();
299135446Strhodes	],
300135446Strhodes	[AC_MSG_RESULT(no)],
301135446Strhodes	[AC_MSG_RESULT(yes)
302193149Sdougb	 AC_DEFINE(inline, )])
303135446Strhodes
304135446StrhodesAC_TYPE_SIZE_T
305135446StrhodesAC_CHECK_TYPE(ssize_t, int)
306153816SdougbAC_CHECK_TYPE(uintptr_t,unsigned long)
307143731SdougbAC_CHECK_TYPE(socklen_t,
308143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
309143731Sdougb[
310143731SdougbAC_TRY_COMPILE(
311143731Sdougb[
312143731Sdougb#include <sys/types.h>
313143731Sdougb#include <sys/socket.h>
314143731Sdougbint getsockname(int, struct sockaddr *, size_t *);
315143731Sdougb],[],
316143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
317143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
318143731Sdougb],
319143731Sdougb[
320143731Sdougb#include <sys/types.h>
321143731Sdougb#include <sys/socket.h>
322143731Sdougb])
323143731SdougbAC_SUBST(ISC_SOCKADDR_LEN_T)
324135446StrhodesAC_HEADER_TIME
325135446StrhodesAC_MSG_CHECKING(for long long)
326135446StrhodesAC_TRY_COMPILE([],[long long i = 0; return (0);],
327135446Strhodes	[AC_MSG_RESULT(yes)
328135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
329135446Strhodes	[AC_MSG_RESULT(no)
330135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
331135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELONGLONG)
332135446Strhodes
333135446Strhodes#
334135446Strhodes# check if we have lifconf
335135446Strhodes#
336135446StrhodesAC_MSG_CHECKING(for struct lifconf)
337135446StrhodesAC_TRY_COMPILE([
338135446Strhodes#include <sys/types.h>
339135446Strhodes#include <sys/socket.h>
340135446Strhodes#include <net/if.h>
341135446Strhodes],
342135446Strhodes[
343135446Strhodesstruct lifconf lifconf;
344135446Strhodeslifconf.lifc_len = 0;
345135446Strhodes]
346135446Strhodes,
347135446Strhodes	[AC_MSG_RESULT(yes)
348135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
349135446Strhodes	[AC_MSG_RESULT(no)
350135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
351135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELIFCONF)
352135446Strhodes
353186462Sdougb#
354186462Sdougb# check if we have kqueue
355186462Sdougb#
356186462SdougbAC_ARG_ENABLE(kqueue,
357186462Sdougb	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
358186462Sdougb	      want_kqueue="$enableval",  want_kqueue="yes")
359186462Sdougbcase $want_kqueue in
360186462Sdougbyes)
361186462Sdougb	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
362186462Sdougb	case $ac_cv_have_kqueue in
363186462Sdougb	yes)
364186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
365186462Sdougb		;;
366186462Sdougb	*)
367186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
368186462Sdougb		;;
369186462Sdougb	esac
370186462Sdougb	;;
371186462Sdougb*)
372186462Sdougb	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
373186462Sdougb	;;
374186462Sdougbesac
375186462SdougbAC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
376135446Strhodes
377135446Strhodes#
378186462Sdougb# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
379186462Sdougb# so we need to try running the code, not just test its existence.
380186462Sdougb#
381186462SdougbAC_ARG_ENABLE(epoll,
382193149Sdougb[  --enable-epoll          use Linux epoll when available [[default=auto]]],
383193149Sdougb	      want_epoll="$enableval",  want_epoll="auto")
384186462Sdougbcase $want_epoll in
385193149Sdougbauto)
386186462Sdougb	AC_MSG_CHECKING(epoll support)
387186462Sdougb	AC_TRY_RUN([
388186462Sdougb#include <sys/epoll.h>
389186462Sdougbint main() {
390186462Sdougb	if (epoll_create(1) < 0)
391186462Sdougb		return (1);
392186462Sdougb	return (0);
393186462Sdougb}
394186462Sdougb],
395186462Sdougb	[AC_MSG_RESULT(yes)
396186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
397186462Sdougb	[AC_MSG_RESULT(no)
398186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
399186462Sdougb	;;
400193149Sdougbyes)
401193149Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
402193149Sdougb	;;
403186462Sdougb*)
404186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
405186462Sdougb	;;
406186462Sdougbesac
407186462SdougbAC_SUBST(ISC_PLATFORM_HAVEEPOLL)
408186462Sdougb
409186462Sdougb#
410186462Sdougb# check if we support /dev/poll
411186462Sdougb#
412186462SdougbAC_ARG_ENABLE(devpoll,
413186462Sdougb	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
414186462Sdougb	      want_devpoll="$enableval",  want_devpoll="yes")
415186462Sdougbcase $want_devpoll in
416186462Sdougbyes)
417186462Sdougb	AC_CHECK_HEADERS(sys/devpoll.h,
418186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
419186462Sdougb	,
420186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
421186462Sdougb	)
422186462Sdougb	;;
423186462Sdougb*)
424186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
425186462Sdougb	;;
426186462Sdougbesac
427186462SdougbAC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
428186462Sdougb
429186462Sdougb#
430135446Strhodes# check if we need to #include sys/select.h explicitly
431135446Strhodes#
432135446Strhodescase $ac_cv_header_unistd_h in
433135446Strhodesyes)
434135446StrhodesAC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
435135446StrhodesAC_TRY_COMPILE([
436135446Strhodes#include <sys/types.h> /* Ultrix */
437135446Strhodes#include <unistd.h>],
438135446Strhodes[fd_set read_set; return (0);],
439135446Strhodes	[AC_MSG_RESULT(yes)
440135446Strhodes	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
441135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
442135446Strhodes	[AC_MSG_RESULT(no)
443135446Strhodes	case $ac_cv_header_sys_select_h in
444135446Strhodes	yes)
445193149Sdougb	 ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
446135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
447135446Strhodes		;;
448135446Strhodes	no)
449135446Strhodes		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
450135446Strhodes		;;
451135446Strhodes	esac
452135446Strhodes	])
453135446Strhodes	;;
454135446Strhodesno)
455135446Strhodes	case $ac_cv_header_sys_select_h in
456135446Strhodes	yes)
457193149Sdougb	     ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
458135446Strhodes	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
459135446Strhodes		;;
460135446Strhodes	no)
461135446Strhodes		AC_MSG_ERROR([need either unistd.h or sys/select.h])
462135446Strhodes		;;
463135446Strhodes	esac
464135446Strhodes	;;
465135446Strhodesesac
466135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
467135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
468135446Strhodes
469135446Strhodes#
470135446Strhodes# Find the machine's endian flavor.
471135446Strhodes#
472135446StrhodesAC_C_BIGENDIAN
473135446Strhodes
474170222Sdougb
475135446Strhodes#
476135446Strhodes# was --with-openssl specified?
477135446Strhodes#
478163976SdougbOPENSSL_WARNING=
479135446StrhodesAC_MSG_CHECKING(for OpenSSL library)
480135446StrhodesAC_ARG_WITH(openssl,
481204619Sdougb[  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
482193149Sdougb			  (Required for DNSSEC)],
483135446Strhodes    use_openssl="$withval", use_openssl="auto")
484135446Strhodes
485165071Sdougbopenssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
486143731Sdougbif test "$use_openssl" = "auto"
487143731Sdougbthen
488143731Sdougb	for d in $openssldirs
489143731Sdougb	do
490143731Sdougb		if test -f $d/include/openssl/opensslv.h
491143731Sdougb		then
492143731Sdougb			use_openssl=$d
493143731Sdougb			break
494143731Sdougb		fi
495143731Sdougb	done
496143731Sdougbfi
497135446Strhodescase "$use_openssl" in
498135446Strhodes	no)
499135446Strhodes		AC_MSG_RESULT(no)
500135446Strhodes		DST_OPENSSL_INC=""
501135446Strhodes		USE_OPENSSL=""
502135446Strhodes		;;
503143731Sdougb	auto)
504143731Sdougb		DST_OPENSSL_INC=""
505143731Sdougb		USE_OPENSSL=""
506204619Sdougb		AC_MSG_ERROR(
507204619Sdougb[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
508204619SdougbIf you don't want OpenSSL, use --without-openssl])
509143731Sdougb		;;
510135446Strhodes	*)
511143731Sdougb		if test "$use_openssl" = "yes"
512135446Strhodes		then
513193149Sdougb			# User did not specify a path - guess it
514135446Strhodes			for d in $openssldirs
515135446Strhodes			do
516135446Strhodes				if test -f $d/include/openssl/opensslv.h
517135446Strhodes				then
518193149Sdougb					use_openssl=$d
519135446Strhodes					break
520135446Strhodes				fi
521135446Strhodes			done
522135446Strhodes			if test "$use_openssl" = "yes"
523135446Strhodes			then
524193149Sdougb				AC_MSG_RESULT(not found)
525135446Strhodes				AC_MSG_ERROR(
526135446Strhodes[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
527135446Strhodes			fi
528193149Sdougb		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
529193149Sdougb		then
530193149Sdougb			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
531135446Strhodes		fi
532135446Strhodes		USE_OPENSSL='-DOPENSSL'
533135446Strhodes		if test "$use_openssl" = "/usr"
534135446Strhodes		then
535135446Strhodes			DST_OPENSSL_INC=""
536135446Strhodes			DNS_OPENSSL_LIBS="-lcrypto"
537135446Strhodes		else
538135446Strhodes			DST_OPENSSL_INC="-I$use_openssl/include"
539135446Strhodes			case $host in
540135446Strhodes			*-solaris*)
541135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
542135446Strhodes				;;
543165071Sdougb			*-hp-hpux*)
544165071Sdougb				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
545165071Sdougb				;;
546174187Sdougb			*-apple-darwin*)
547174187Sdougb				#
548174187Sdougb				# Apple's ld seaches for serially for dynamic
549174187Sdougb				# then static libraries.  This means you can't
550174187Sdougb				# use -L to override dynamic system libraries
551174187Sdougb				# with static ones when linking.  Instead
552174187Sdougb				# we specify a absolute path.
553174187Sdougb				#
554174187Sdougb				if test -f "$use_openssl/lib/libcrypto.dylib"
555174187Sdougb				then
556174187Sdougb					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
557174187Sdougb				else
558174187Sdougb					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
559174187Sdougb				fi
560174187Sdougb				;;
561135446Strhodes			*)
562135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
563135446Strhodes				;;
564135446Strhodes			esac
565135446Strhodes		fi
566193149Sdougb		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
567135446Strhodes
568135446Strhodes		saved_cflags="$CFLAGS"
569135446Strhodes		saved_libs="$LIBS"
570135446Strhodes		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
571135446Strhodes		LIBS="$LIBS $DNS_OPENSSL_LIBS"
572135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL works)
573135446Strhodes		AC_TRY_RUN([
574135446Strhodes#include <openssl/err.h>
575135446Strhodesint main() {
576135446Strhodes	ERR_clear_error();
577135446Strhodes	return (0);
578135446Strhodes}
579135446Strhodes],
580193149Sdougb		[AC_MSG_RESULT(yes)],
581135446Strhodes		[AC_MSG_RESULT(no)
582135446Strhodes		 AC_MSG_ERROR(Could not run test program using OpenSSL from
583135446Strhodes$use_openssl/lib and $use_openssl/include.
584135446StrhodesPlease check the argument to --with-openssl and your
585135446Strhodesshared library configuration (e.g., LD_LIBRARY_PATH).)],
586135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
587135446Strhodes
588135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
589135446Strhodes		AC_TRY_LINK([
590135446Strhodes#include <openssl/err.h>],
591135446Strhodes[ DSO_METHOD_dlfcn(); ],
592135446Strhodes		[AC_MSG_RESULT(no)],
593135446Strhodes		[LIBS="$LIBS -ldl"
594135446Strhodes		AC_TRY_LINK([
595135446Strhodes#include <openssl/err.h>
596135446Strhodes],[ DSO_METHOD_dlfcn(); ],
597135446Strhodes		[AC_MSG_RESULT(yes)
598135446Strhodes		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
599135446Strhodes		],
600135446Strhodes		 [AC_MSG_RESULT(unknown)
601135446Strhodes		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
602135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
603135446Strhodes		],
604135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)]
605135446Strhodes		)
606135446Strhodes		 
607163976SdougbAC_ARG_ENABLE(openssl-version-check,
608163976Sdougb[AC_HELP_STRING([--enable-openssl-version-check],
609193149Sdougb	[Check OpenSSL Version @<:@default=yes@:>@])])
610163976Sdougbcase "$enable_openssl_version_check" in
611163976Sdougbyes|'')
612135446Strhodes		AC_MSG_CHECKING(OpenSSL library version)
613135446Strhodes		AC_TRY_RUN([
614135446Strhodes#include <stdio.h>
615135446Strhodes#include <openssl/opensslv.h>
616135446Strhodesint main() {
617193149Sdougb	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
618165071Sdougb	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
619165071Sdougb	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
620193149Sdougb		return (0);
621135446Strhodes	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
622135446Strhodes		OPENSSL_VERSION_NUMBER);
623163976Sdougb	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
624163976Sdougb	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
625193149Sdougb	return (1);
626135446Strhodes}
627163976Sdougb		],
628193149Sdougb		[AC_MSG_RESULT(ok)],
629135446Strhodes		[AC_MSG_RESULT(not compatible)
630193149Sdougb		 OPENSSL_WARNING=yes
631163976Sdougb		],
632135446Strhodes		[AC_MSG_RESULT(assuming target platform has compatible version)])
633163976Sdougb;;
634163976Sdougbno)
635163976Sdougb	AC_MSG_RESULT(Skipped OpenSSL version check)
636163976Sdougb;;
637163976Sdougbesac
638163976Sdougb
639135446Strhodes		AC_MSG_CHECKING(for OpenSSL DSA support)
640135446Strhodes		if test -f $use_openssl/include/openssl/dsa.h
641135446Strhodes		then
642135446Strhodes			AC_DEFINE(HAVE_OPENSSL_DSA)
643135446Strhodes			AC_MSG_RESULT(yes)
644135446Strhodes		else
645135446Strhodes			AC_MSG_RESULT(no)
646135446Strhodes		fi
647204619Sdougb		AC_CHECK_FUNCS(EVP_sha256 EVP_sha512)
648135446Strhodes		CFLAGS="$saved_cflags"
649135446Strhodes		LIBS="$saved_libs"
650204619Sdougb
651135446Strhodes		;;
652135446Strhodesesac
653135446Strhodes
654135446Strhodes#
655135446Strhodes# This would include the system openssl path (and linker options to use
656135446Strhodes# it as needed) if it is found.
657135446Strhodes#
658135446Strhodes
659135446StrhodesAC_SUBST(USE_OPENSSL)
660135446StrhodesAC_SUBST(DST_OPENSSL_INC)
661135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
662135446Strhodes
663135446Strhodes#
664193149Sdougb# PKCS11 (aka crypto hardware) support
665135446Strhodes#
666193149Sdougb# This works only with the right OpenSSL with PKCS11 engine!
667135446Strhodes#
668135446Strhodes
669193149SdougbAC_MSG_CHECKING(for PKCS11 support)
670193149SdougbAC_ARG_WITH(pkcs11,
671204619Sdougb[  --with-pkcs11           Build with PKCS11 support],
672193149Sdougb   use_pkcs11="yes", use_pkcs11="no")
673135446Strhodes
674193149Sdougbcase "$use_pkcs11" in
675193149Sdougb	no)
676193149Sdougb		AC_MSG_RESULT(disabled)
677193149Sdougb		USE_PKCS11=""
678193149Sdougb		;;
679193149Sdougb	yes)
680193149Sdougb		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
681193149Sdougb		USE_PKCS11='-DUSE_PKCS11'
682193149Sdougb		;;
683193149Sdougbesac
684193149Sdougb
685193149SdougbAC_SUBST(USE_PKCS11)
686193149Sdougb
687193149SdougbAC_MSG_CHECKING(for GSSAPI library)
688193149SdougbAC_ARG_WITH(gssapi,
689204619Sdougb[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI],
690193149Sdougb    use_gssapi="$withval", use_gssapi="no")
691193149Sdougb
692193149Sdougbgssapidirs="/usr/local /usr/pkg /usr/kerberos /usr"
693193149Sdougbif test "$use_gssapi" = "yes"
694193149Sdougbthen
695193149Sdougb	for d in $gssapidirs
696193149Sdougb	do
697193149Sdougb		if test -f $d/include/gssapi/gssapi.h -o -f $d/include/gssapi.h
698193149Sdougb		then
699193149Sdougb			use_gssapi=$d
700193149Sdougb			break
701193149Sdougb		fi
702193149Sdougb	done
703193149Sdougbfi
704193149Sdougb
705193149Sdougbcase "$use_gssapi" in
706193149Sdougb	no)
707193149Sdougb		AC_MSG_RESULT(disabled)
708193149Sdougb		USE_GSSAPI=''
709193149Sdougb		;;
710193149Sdougb	yes)
711193149Sdougb		AC_MSG_ERROR([--with-gssapi must specify a path])
712193149Sdougb		;;
713193149Sdougb	*)
714193149Sdougb		AC_MSG_RESULT(looking in $use_gssapi/lib)
715193149Sdougb		USE_GSSAPI='-DGSSAPI'
716193149Sdougb		saved_cppflags="$CPPFLAGS"
717193149Sdougb		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
718193149Sdougb		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
719193149Sdougb		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
720193149Sdougb
721193149Sdougb		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
722193149Sdougb		    AC_MSG_ERROR([gssapi.h not found])
723193149Sdougb		fi
724193149Sdougb
725193149Sdougb		CPPFLAGS="$saved_cppflags"
726193149Sdougb
727193149Sdougb		#
728193149Sdougb		# XXXDCL This probably doesn't work right on all systems.
729193149Sdougb		# It will need to be worked on as problems become evident.
730193149Sdougb		#
731193149Sdougb		# Essentially the problems here relate to two different
732193149Sdougb		# areas.  The first area is building with either KTH
733193149Sdougb		# or MIT Kerberos, particularly when both are present on
734193149Sdougb		# the machine.  The other is static versus dynamic linking.
735193149Sdougb		#
736193149Sdougb		# On the KTH vs MIT issue, Both have libkrb5 that can mess
737193149Sdougb		# up the works if one implementation ends up trying to
738193149Sdougb		# use the other's krb.  This is unfortunately a situation
739193149Sdougb		# that very easily arises.
740193149Sdougb		#
741193149Sdougb		# Dynamic linking when the dependency information is built
742193149Sdougb		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
743193149Sdougb		# all such problems go away, but when that setup is not
744193149Sdougb		# present, because either the dynamic libraries lack
745193149Sdougb		# dependencies or static linking is being done, then the
746193149Sdougb		# problems start to show up.
747193149Sdougb		saved_libs="$LIBS"
748193149Sdougb		for TRY_LIBS in \
749193149Sdougb		    "-lgssapi_krb5" \
750193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
751193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
752193149Sdougb		    "-lgssapi" \
753193149Sdougb		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
754193149Sdougb		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
755193149Sdougb		    "-lgss"
756193149Sdougb		do
757193149Sdougb		    # Note that this does not include $saved_libs, because
758193149Sdougb		    # on FreeBSD machines this configure script has added
759193149Sdougb		    # -L/usr/local/lib to LIBS, which can make the
760193149Sdougb		    # -lgssapi_krb5 test succeed with shared libraries even
761193149Sdougb		    # when you are trying to build with KTH in /usr/lib.
762193149Sdougb		    LIBS="-L$use_gssapi/lib $TRY_LIBS"
763193149Sdougb		    AC_MSG_CHECKING(linking as $TRY_LIBS)
764193149Sdougb		    AC_TRY_LINK( , [gss_acquire_cred();],
765193149Sdougb				gssapi_linked=yes, gssapi_linked=no)
766193149Sdougb		    case $gssapi_linked in
767193149Sdougb		    yes) AC_MSG_RESULT(yes); break ;;
768193149Sdougb		    no)  AC_MSG_RESULT(no) ;;
769193149Sdougb		    esac
770193149Sdougb		done
771193149Sdougb
772193149Sdougb		case $gssapi_linked in
773193149Sdougb		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
774193149Sdougb		esac
775193149Sdougb
776193149Sdougb		#
777193149Sdougb		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
778193149Sdougb		# but MIT in /usr/local/lib and trying to build with KTH.
779193149Sdougb		# /usr/local/lib can end up earlier on the link lines.
780193149Sdougb		# Like most kludges, this one is not only inelegant it
781193149Sdougb		# is also likely to be the wrong thing to do at least as
782193149Sdougb		# many times as it is the right thing.  Something better
783193149Sdougb		# needs to be done.
784193149Sdougb		#
785193149Sdougb		if test "$use_gssapi" = "/usr" -a \
786193149Sdougb			-f /usr/local/lib/libkrb5.a; then
787193149Sdougb		    FIX_KTH_VS_MIT=yes
788193149Sdougb		fi
789193149Sdougb
790193149Sdougb		case "$FIX_KTH_VS_MIT" in
791193149Sdougb		yes)
792193149Sdougb		    case "$enable_static_linking" in
793193149Sdougb		    yes) gssapi_lib_suffix=".a"  ;;
794193149Sdougb		    *)   gssapi_lib_suffix=".so" ;;
795193149Sdougb		    esac
796193149Sdougb
797193149Sdougb		    for lib in $LIBS; do
798193149Sdougb			case $lib in
799193149Sdougb			-L*)
800193149Sdougb			    ;;
801193149Sdougb			-l*)
802193149Sdougb			    new_lib=`echo $lib |
803193149Sdougb				     sed -e s%^-l%$use_gssapi/lib/lib% \
804193149Sdougb					 -e s%$%$gssapi_lib_suffix%`
805193149Sdougb			    NEW_LIBS="$NEW_LIBS $new_lib"
806193149Sdougb			    ;;
807193149Sdougb			*)
808193149Sdougb			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
809193149Sdougb			    ;;
810193149Sdougb			esac
811193149Sdougb		    done
812193149Sdougb		    LIBS="$NEW_LIBS"
813193149Sdougb		    ;;
814193149Sdougb		esac
815193149Sdougb
816193149Sdougb		DST_GSSAPI_INC="-I$use_gssapi/include"
817193149Sdougb		DNS_GSSAPI_LIBS="$LIBS"
818193149Sdougb
819193149Sdougb		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
820193149Sdougb		LIBS="$saved_libs"
821193149Sdougb		;;
822193149Sdougbesac
823193149Sdougb
824193149SdougbAC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
825193149SdougbAC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
826193149Sdougb
827135446StrhodesAC_SUBST(USE_GSSAPI)
828135446StrhodesAC_SUBST(DST_GSSAPI_INC)
829193149SdougbAC_SUBST(DNS_GSSAPI_LIBS)
830193149SdougbDNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
831135446Strhodes
832135446Strhodes#
833135446Strhodes# Applications linking with libdns also need to link with these libraries.
834135446Strhodes#
835135446Strhodes
836135446StrhodesAC_SUBST(DNS_CRYPTO_LIBS)
837135446Strhodes
838135446Strhodes#
839135446Strhodes# was --with-randomdev specified?
840135446Strhodes#
841135446StrhodesAC_MSG_CHECKING(for random device)
842135446StrhodesAC_ARG_WITH(randomdev,
843204619Sdougb[  --with-randomdev=PATH   Specify path for random device],
844135446Strhodes    use_randomdev="$withval", use_randomdev="unspec")
845135446Strhodes
846135446Strhodescase "$use_randomdev" in
847135446Strhodes	unspec)
848135446Strhodes		case "$host" in
849135446Strhodes			*-openbsd*)
850135446Strhodes				devrandom=/dev/arandom
851135446Strhodes				;;
852135446Strhodes			*)
853135446Strhodes				devrandom=/dev/random
854135446Strhodes				;;
855135446Strhodes		esac
856135446Strhodes		AC_MSG_RESULT($devrandom)
857135446Strhodes		AC_CHECK_FILE($devrandom,
858135446Strhodes			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
859135446Strhodes						 "$devrandom"),)
860135446Strhodes		;;
861135446Strhodes	yes)
862135446Strhodes		AC_MSG_ERROR([--with-randomdev must specify a path])
863135446Strhodes		;;
864135446Strhodes	no)
865135446Strhodes		AC_MSG_RESULT(disabled)
866135446Strhodes		;;
867135446Strhodes	*)
868135446Strhodes		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
869135446Strhodes		AC_MSG_RESULT(using "$use_randomdev")
870135446Strhodes		;;
871135446Strhodesesac
872135446Strhodes
873135446Strhodes#
874135446Strhodes# Do we have arc4random() ?
875135446Strhodes#
876135446StrhodesAC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
877135446Strhodes
878153816Sdougbsinclude(config.threads.in)dnl
879135446Strhodes
880135446Strhodesif $use_threads
881135446Strhodesthen
882165071Sdougb	if test "X$GCC" = "Xyes"; then
883165071Sdougb		case "$host" in
884165071Sdougb		*-freebsd*)
885165071Sdougb			CC="$CC -pthread"
886165071Sdougb			CCOPT="$CCOPT -pthread"
887165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
888165071Sdougb			;;
889165071Sdougb		*-openbsd*)
890165071Sdougb			CC="$CC -pthread"
891165071Sdougb			CCOPT="$CCOPT -pthread"
892165071Sdougb			;;
893165071Sdougb		*-solaris*)
894165071Sdougb			LIBS="$LIBS -lthread"
895165071Sdougb			;;
896165071Sdougb		*-ibm-aix*)
897165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
898165071Sdougb			;;
899165071Sdougb		esac
900165071Sdougb	else
901165071Sdougb		case $host in
902165071Sdougb		*-dec-osf*)
903165071Sdougb			CC="$CC -pthread"
904165071Sdougb			CCOPT="$CCOPT -pthread"
905165071Sdougb			;;
906165071Sdougb		*-solaris*)
907165071Sdougb			CC="$CC -mt"
908165071Sdougb			CCOPT="$CCOPT -mt"
909165071Sdougb			;;
910165071Sdougb		*-ibm-aix*)
911165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
912165071Sdougb			;;
913165071Sdougb		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
914165071Sdougb			CC="$CC -Kthread"
915165071Sdougb			CCOPT="$CCOPT -Kthread"
916165071Sdougb			;;
917165071Sdougb		*-*-sysv*OpenUNIX*)
918165071Sdougb			CC="$CC -Kpthread"
919165071Sdougb			CCOPT="$CCOPT -Kpthread"
920165071Sdougb			;;
921165071Sdougb		esac
922165071Sdougb	fi
923165071Sdougb	ALWAYS_DEFINES="-D_REENTRANT"
924165071Sdougb	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
925165071Sdougb	thread_dir=pthreads
926135446Strhodes	#
927135446Strhodes	# We'd like to use sigwait() too
928135446Strhodes	#
929165071Sdougb	AC_CHECK_FUNC(sigwait,
930165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
931165071Sdougb		      AC_CHECK_LIB(c, sigwait,
932165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
933165071Sdougb		      AC_CHECK_LIB(pthread, sigwait,
934165071Sdougb				   AC_DEFINE(HAVE_SIGWAIT),
935165071Sdougb				   AC_CHECK_LIB(pthread, _Psigwait,
936193149Sdougb						AC_DEFINE(HAVE_SIGWAIT),))))
937135446Strhodes
938135446Strhodes	AC_CHECK_FUNC(pthread_attr_getstacksize,
939135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
940135446Strhodes
941135446Strhodes	AC_CHECK_FUNC(pthread_attr_setstacksize,
942135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
943135446Strhodes
944135446Strhodes	#
945135446Strhodes	# Additional OS-specific issues related to pthreads and sigwait.
946135446Strhodes	#
947135446Strhodes	case "$host" in
948135446Strhodes		#
949135446Strhodes		# One more place to look for sigwait.
950135446Strhodes		#
951135446Strhodes		*-freebsd*)
952135446Strhodes			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
953143731Sdougb			case $host in
954153816Sdougb			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
955153816Sdougb			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
956143731Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
957143731Sdougb				;;
958153816Sdougb			*-freebsd6.*)
959153816Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
960153816Sdougb				;;
961143731Sdougb			esac
962135446Strhodes			;;
963135446Strhodes		#
964135446Strhodes		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
965135446Strhodes		# called before certain pthreads calls.	 This is deprecated
966135446Strhodes		# in BSD/OS 4.1.
967135446Strhodes		#
968135446Strhodes		*-bsdi3.*|*-bsdi4.0*)
969135446Strhodes			AC_DEFINE(NEED_PTHREAD_INIT)
970135446Strhodes			;;
971135446Strhodes		#
972135446Strhodes		# LinuxThreads requires some changes to the way we
973135446Strhodes		# deal with signals.
974135446Strhodes		#
975135446Strhodes		*-linux*)
976135446Strhodes			AC_DEFINE(HAVE_LINUXTHREADS)
977135446Strhodes			;;
978135446Strhodes		#
979135446Strhodes		# Ensure the right sigwait() semantics on Solaris and make
980135446Strhodes		# sure we call pthread_setconcurrency.
981135446Strhodes		#
982135446Strhodes		*-solaris*)
983135446Strhodes			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
984135446Strhodes			AC_CHECK_FUNC(pthread_setconcurrency,
985135446Strhodes				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
986135446Strhodes			;;
987135446Strhodes		#
988135446Strhodes		# UnixWare does things its own way.
989135446Strhodes		#
990135446Strhodes		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
991135446Strhodes			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
992135446Strhodes			;;
993135446Strhodes	esac
994135446Strhodes
995135446Strhodes	#
996135446Strhodes	# Look for sysconf to allow detection of the number of processors.
997135446Strhodes	#
998135446Strhodes	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
999135446Strhodes
1000135446Strhodeselse
1001135446Strhodes	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1002135446Strhodes	thread_dir=nothreads
1003135446Strhodes	ALWAYS_DEFINES=""
1004135446Strhodesfi
1005135446Strhodes
1006135446StrhodesAC_SUBST(ALWAYS_DEFINES)
1007135446StrhodesAC_SUBST(ISC_PLATFORM_USETHREADS)
1008135446StrhodesISC_THREAD_DIR=$thread_dir
1009135446StrhodesAC_SUBST(ISC_THREAD_DIR)
1010135446Strhodes
1011135446Strhodes#
1012193149Sdougb# was --with-libxml2 specified?
1013193149Sdougb#
1014193149SdougbAC_MSG_CHECKING(for libxml2 library)
1015193149SdougbAC_ARG_WITH(libxml2,
1016204619Sdougb[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1017193149Sdougb    use_libxml2="$withval", use_libxml2="auto")
1018193149Sdougb
1019193149Sdougbcase "$use_libxml2" in
1020193149Sdougb	no)
1021193149Sdougb		DST_LIBXML2_INC=""
1022193149Sdougb		;;
1023193149Sdougb	auto|yes)
1024193149Sdougb		case X`(xml2-config --version) 2>/dev/null` in
1025193149Sdougb		X2.[[67]].*)
1026193149Sdougb			libxml2_libs=`xml2-config --libs`
1027193149Sdougb			libxml2_cflags=`xml2-config --cflags`
1028193149Sdougb			;;
1029193149Sdougb		*)
1030193149Sdougb			libxml2_libs=
1031193149Sdougb			libxml2_cflags=
1032193149Sdougb			;;
1033193149Sdougb		esac
1034193149Sdougb		;;
1035193149Sdougb	*)
1036193149Sdougb		if test -f "$use_libxml2/bin/xml2-config" ; then
1037193149Sdougb			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1038193149Sdougb			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1039193149Sdougb		fi
1040193149Sdougb		;;
1041193149Sdougbesac
1042193149Sdougb
1043193149Sdougbif test "X$libxml2_libs" != "X"
1044193149Sdougbthen
1045193149Sdougb	AC_MSG_RESULT(yes)
1046193149Sdougb	CFLAGS="$CFLAGS $libxml2_cflags"
1047193149Sdougb	LIBS="$LIBS $libxml2_libs"
1048193149Sdougb	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1049193149Sdougbelse
1050193149Sdougb	AC_MSG_RESULT(no)
1051193149Sdougbfi
1052193149Sdougb
1053193149Sdougb#
1054135446Strhodes# In solaris 10, SMF can manage named service
1055135446Strhodes#
1056135446StrhodesAC_CHECK_LIB(scf, smf_enable_instance)
1057135446Strhodes
1058135446Strhodes#
1059135446Strhodes# flockfile is usually provided by pthreads, but we may want to use it
1060135446Strhodes# even if compiled with --disable-threads.  getc_unlocked might also not
1061135446Strhodes# be defined.
1062135446Strhodes#
1063135446StrhodesAC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1064135446StrhodesAC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1065135446Strhodes
1066135446Strhodes# 
1067135446Strhodes# Indicate what the final decision was regarding threads.
1068135446Strhodes#
1069135446StrhodesAC_MSG_CHECKING(whether to build with threads)
1070135446Strhodesif $use_threads; then
1071135446Strhodes	AC_MSG_RESULT(yes)
1072135446Strhodeselse
1073135446Strhodes	AC_MSG_RESULT(no)
1074135446Strhodesfi
1075135446Strhodes
1076135446Strhodes# 
1077135446Strhodes# End of pthreads stuff.
1078135446Strhodes#
1079135446Strhodes
1080135446Strhodes#
1081135446Strhodes# Large File
1082135446Strhodes#
1083135446StrhodesAC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1084135446Strhodes	      want_largefile="yes", want_largefile="no")
1085135446Strhodescase $want_largefile in
1086135446Strhodes	yes)
1087135446Strhodes		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1088135446Strhodes		;;
1089135446Strhodes	*)
1090135446Strhodes		;;
1091135446Strhodesesac
1092135446Strhodes
1093135446Strhodes#
1094135446Strhodes# Additional compiler settings.
1095135446Strhodes#
1096135446StrhodesMKDEPCC="$CC"
1097135446StrhodesMKDEPCFLAGS="-M"
1098135446StrhodesIRIX_DNSSEC_WARNINGS_HACK=""
1099135446Strhodes
1100135446Strhodesif test "X$GCC" = "Xyes"; then
1101165071Sdougb	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1102165071Sdougb	SAVE_CFLAGS=$CFLAGS
1103165071Sdougb	CFLAGS=-fno-strict-aliasing
1104165071Sdougb	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1105165071Sdougb	CFLAGS=$SAVE_CFLAGS
1106165071Sdougb	if test "$FNOSTRICTALIASING" = "yes"; then
1107165071Sdougb		AC_MSG_RESULT(yes)
1108165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1109165071Sdougb	else
1110165071Sdougb		AC_MSG_RESULT(no)
1111165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1112165071Sdougb	fi
1113143731Sdougb	case "$host" in
1114143731Sdougb	*-hp-hpux*)
1115153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1116143731Sdougb		;;
1117143731Sdougb	esac
1118135446Strhodeselse
1119135446Strhodes	case $host in
1120135446Strhodes	*-dec-osf*)
1121135446Strhodes		CC="$CC -std"
1122135446Strhodes		CCOPT="$CCOPT -std"
1123135446Strhodes		MKDEPCC="$CC"
1124135446Strhodes		;;
1125135446Strhodes	*-hp-hpux*)
1126135446Strhodes		CC="$CC -Ae -z"
1127135446Strhodes		# The version of the C compiler that constantly warns about
1128193149Sdougb		# 'const' as well as alignment issues is unfortunately not
1129193149Sdougb		# able to be discerned via the version of the operating
1130193149Sdougb		# system, nor does cc have a version flag.
1131135446Strhodes		case "`$CC +W 123 2>&1`" in
1132135446Strhodes		*Unknown?option*)
1133135446Strhodes			STD_CWARNINGS="+w1"
1134135446Strhodes			;;
1135135446Strhodes		*)
1136135446Strhodes			# Turn off the pointlessly noisy warnings.
1137153816Sdougb			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1138135446Strhodes			;;
1139135446Strhodes		esac
1140135446Strhodes		CCOPT="$CCOPT -Ae -z"
1141153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1142135446Strhodes		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1143135446Strhodes		;;
1144135446Strhodes	*-sgi-irix*)
1145135446Strhodes		STD_CWARNINGS="-fullwarn -woff 1209"
1146135446Strhodes		#
1147135446Strhodes		# Silence more than 250 instances of
1148135446Strhodes		#   "prototyped function redeclared without prototype"
1149135446Strhodes		# and 11 instances of
1150135446Strhodes		#   "variable ... was set but never used"
1151135446Strhodes		# from lib/dns/sec/openssl.
1152135446Strhodes		#
1153135446Strhodes		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1154135446Strhodes		;;
1155135446Strhodes	*-solaris*)
1156135446Strhodes		MKDEPCFLAGS="-xM"
1157135446Strhodes		;;
1158135446Strhodes	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1159193149Sdougb		# UnixWare
1160135446Strhodes		CC="$CC -w"
1161135446Strhodes		;;
1162135446Strhodes	esac
1163135446Strhodesfi
1164135446Strhodes
1165135446StrhodesAC_SUBST(MKDEPCC)
1166135446StrhodesAC_SUBST(MKDEPCFLAGS)
1167135446StrhodesAC_SUBST(MKDEPPROG)
1168135446StrhodesAC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1169135446Strhodes
1170135446Strhodes#
1171135446Strhodes# NLS
1172135446Strhodes#
1173135446StrhodesAC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1174135446Strhodes
1175135446Strhodes#
1176135446Strhodes# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1177135446Strhodes#
1178135446Strhodes# AC_CHECK_LIB(xnet, socket, ,
1179135446Strhodes#    AC_CHECK_LIB(socket, socket)
1180135446Strhodes# )
1181135446Strhodes#
1182135446Strhodes# Use this for now, instead:
1183135446Strhodes#
1184135446Strhodescase "$host" in
1185135446Strhodes	mips-sgi-irix*)
1186135446Strhodes		;;
1187193149Sdougb	*-linux*)
1188193149Sdougb		;;
1189135446Strhodes	*)
1190135446Strhodes		AC_CHECK_LIB(socket, socket)
1191193149Sdougb		AC_CHECK_LIB(nsl, inet_addr)
1192135446Strhodes		;;
1193135446Strhodesesac
1194135446Strhodes
1195135446Strhodes#
1196186462Sdougb# Work around Solaris's select() limitations.
1197186462Sdougb#
1198186462Sdougbcase "$host" in
1199186462Sdougb	*-solaris2.[[89]]|*-solaris2.1?)
1200186462Sdougb	AC_DEFINE(FD_SETSIZE, 65536,
1201186462Sdougb		  [Solaris hack to get select_large_fdset.])
1202186462Sdougb	;;
1203186462Sdougbesac
1204186462Sdougb
1205186462Sdougb#
1206135446Strhodes# Purify support
1207135446Strhodes#
1208135446StrhodesAC_MSG_CHECKING(whether to use purify)
1209135446StrhodesAC_ARG_WITH(purify,
1210204619Sdougb	[  --with-purify[=PATH]      use Rational purify],
1211135446Strhodes	use_purify="$withval", use_purify="no")
1212135446Strhodes
1213135446Strhodescase "$use_purify" in
1214135446Strhodes	no)
1215135446Strhodes		;;
1216135446Strhodes	yes)
1217135446Strhodes		AC_PATH_PROG(purify_path, purify, purify)
1218135446Strhodes		;;
1219135446Strhodes	*)
1220135446Strhodes		purify_path="$use_purify"
1221135446Strhodes		;;
1222135446Strhodesesac
1223135446Strhodes
1224135446Strhodescase "$use_purify" in
1225135446Strhodes	no)
1226135446Strhodes		AC_MSG_RESULT(no)
1227135446Strhodes		PURIFY=""
1228135446Strhodes		;;
1229135446Strhodes	*)
1230135446Strhodes		if test -f $purify_path || test $purify_path = purify; then
1231135446Strhodes			AC_MSG_RESULT($purify_path)
1232135446Strhodes			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1233135446Strhodes			PURIFY="$purify_path $PURIFYFLAGS"
1234135446Strhodes		else
1235135446Strhodes			AC_MSG_ERROR([$purify_path not found.
1236135446Strhodes
1237135446StrhodesPlease choose the proper path with the following command:
1238135446Strhodes
1239135446Strhodes    configure --with-purify=PATH
1240135446Strhodes])
1241135446Strhodes		fi
1242135446Strhodes		;;
1243135446Strhodesesac
1244135446Strhodes
1245135446StrhodesAC_SUBST(PURIFY)
1246135446Strhodes
1247186462Sdougb
1248135446StrhodesAC_ARG_WITH(libtool,
1249204619Sdougb	    [  --with-libtool          use GNU libtool],
1250135446Strhodes	    use_libtool="$withval", use_libtool="no")
1251135446Strhodes
1252135446Strhodescase $use_libtool in
1253135446Strhodes	yes)
1254135446Strhodes		AM_PROG_LIBTOOL
1255135446Strhodes		O=lo
1256135446Strhodes		A=la
1257135446Strhodes		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1258135446Strhodes		LIBTOOL_MODE_COMPILE='--mode=compile'
1259135446Strhodes		LIBTOOL_MODE_INSTALL='--mode=install'
1260135446Strhodes		LIBTOOL_MODE_LINK='--mode=link'
1261143731Sdougb		case "$host" in
1262143731Sdougb		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1263143731Sdougb		esac
1264143731Sdougb		case "$host" in
1265143731Sdougb		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1266143731Sdougb		*) LIBTOOL_IN_MAIN= ;;
1267143731Sdougb		esac;
1268135446Strhodes		;;
1269135446Strhodes	*)
1270135446Strhodes		O=o
1271135446Strhodes		A=a
1272135446Strhodes		LIBTOOL=
1273135446Strhodes		AC_SUBST(LIBTOOL)
1274135446Strhodes		LIBTOOL_MKDEP_SED=
1275135446Strhodes		LIBTOOL_MODE_COMPILE=
1276135446Strhodes		LIBTOOL_MODE_INSTALL=
1277135446Strhodes		LIBTOOL_MODE_LINK=
1278143731Sdougb		LIBTOOL_ALLOW_UNDEFINED=
1279143731Sdougb		LIBTOOL_IN_MAIN=
1280135446Strhodes		;;
1281135446Strhodesesac
1282135446Strhodes
1283135446Strhodes#
1284135446Strhodes# File name extension for static archive files, for those few places
1285135446Strhodes# where they are treated differently from dynamic ones.
1286135446Strhodes#
1287135446StrhodesSA=a
1288135446Strhodes
1289135446StrhodesAC_SUBST(O)
1290135446StrhodesAC_SUBST(A)
1291135446StrhodesAC_SUBST(SA)
1292135446StrhodesAC_SUBST(LIBTOOL_MKDEP_SED)
1293135446StrhodesAC_SUBST(LIBTOOL_MODE_COMPILE)
1294135446StrhodesAC_SUBST(LIBTOOL_MODE_INSTALL)
1295135446StrhodesAC_SUBST(LIBTOOL_MODE_LINK)
1296143731SdougbAC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1297143731SdougbAC_SUBST(LIBTOOL_IN_MAIN)
1298135446Strhodes
1299135446Strhodes#
1300135446Strhodes# Here begins a very long section to determine the system's networking
1301193149Sdougb# capabilities.  The order of the tests is significant.
1302135446Strhodes#
1303135446Strhodes
1304135446Strhodes#
1305135446Strhodes# IPv6
1306135446Strhodes#
1307135446StrhodesAC_ARG_ENABLE(ipv6,
1308204619Sdougb	[  --enable-ipv6           use IPv6 [default=autodetect]])
1309135446Strhodes
1310135446Strhodescase "$enable_ipv6" in
1311135446Strhodes	yes|''|autodetect)
1312135446Strhodes		AC_DEFINE(WANT_IPV6)
1313135446Strhodes		;;
1314135446Strhodes	no)
1315135446Strhodes		;;
1316135446Strhodesesac
1317135446Strhodes
1318135446Strhodes#
1319135446Strhodes# We do the IPv6 compilation checking after libtool so that we can put
1320135446Strhodes# the right suffix on the files.
1321135446Strhodes#
1322135446StrhodesAC_MSG_CHECKING(for IPv6 structures)
1323135446StrhodesAC_TRY_COMPILE([
1324135446Strhodes#include <sys/types.h>
1325135446Strhodes#include <sys/socket.h>
1326135446Strhodes#include <netinet/in.h>],
1327135446Strhodes[struct sockaddr_in6 sin6; return (0);],
1328135446Strhodes	[AC_MSG_RESULT(yes)
1329135446Strhodes	 found_ipv6=yes],
1330135446Strhodes	[AC_MSG_RESULT(no)
1331135446Strhodes	 found_ipv6=no])
1332135446Strhodes
1333135446Strhodes#
1334135446Strhodes# See whether IPv6 support is provided via a Kame add-on.
1335135446Strhodes# This is done before other IPv6 linking tests to LIBS is properly set.
1336135446Strhodes#
1337135446StrhodesAC_MSG_CHECKING(for Kame IPv6 support)
1338135446StrhodesAC_ARG_WITH(kame,
1339204619Sdougb	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1340135446Strhodes	use_kame="$withval", use_kame="no")
1341135446Strhodes
1342135446Strhodescase "$use_kame" in
1343135446Strhodes	no)
1344135446Strhodes		;;
1345135446Strhodes	yes)
1346135446Strhodes		kame_path=/usr/local/v6
1347135446Strhodes		;;
1348135446Strhodes	*)
1349135446Strhodes		kame_path="$use_kame"
1350135446Strhodes		;;
1351135446Strhodesesac
1352135446Strhodes
1353135446Strhodescase "$use_kame" in
1354135446Strhodes	no)
1355135446Strhodes		AC_MSG_RESULT(no)
1356135446Strhodes		;;
1357135446Strhodes	*)
1358135446Strhodes		if test -f $kame_path/lib/libinet6.a; then
1359135446Strhodes			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1360135446Strhodes			LIBS="-L$kame_path/lib -linet6 $LIBS"
1361135446Strhodes		else
1362135446Strhodes			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1363135446Strhodes
1364135446StrhodesPlease choose the proper path with the following command:
1365135446Strhodes
1366135446Strhodes    configure --with-kame=PATH
1367135446Strhodes])
1368135446Strhodes		fi
1369135446Strhodes		;;
1370135446Strhodesesac
1371135446Strhodes
1372135446Strhodes#
1373135446Strhodes# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1374135446Strhodes# Including it on Kame-using platforms is very bad, though, because
1375135446Strhodes# Kame uses #error against direct inclusion.   So include it on only
1376135446Strhodes# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1377135446Strhodes# This is done before the in6_pktinfo check because that's what
1378135446Strhodes# netinet6/in6.h is needed for.
1379135446Strhodes#
1380135446Strhodeschangequote({, })
1381135446Strhodescase "$host" in
1382135446Strhodes*-bsdi4.[01]*)
1383135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1384135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1385135446Strhodes	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1386135446Strhodes	;;
1387135446Strhodes*)
1388135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1389135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1390135446Strhodes	isc_netinet6in6_hack=""
1391135446Strhodes	;;
1392135446Strhodesesac
1393135446Strhodeschangequote([, ])
1394135446Strhodes
1395135446Strhodes#
1396135446Strhodes# This is similar to the netinet6/in6.h issue.
1397135446Strhodes#
1398135446Strhodescase "$host" in
1399135446Strhodes*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1400193149Sdougb	# UnixWare
1401135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1402135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1403193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1404135446Strhodes	isc_netinetin6_hack="#include <netinet/in6.h>"
1405135446Strhodes	;;
1406135446Strhodes*)
1407135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1408135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1409193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1410135446Strhodes	isc_netinetin6_hack=""
1411135446Strhodes	;;
1412135446Strhodesesac
1413135446Strhodes
1414135446Strhodes#
1415135446Strhodes# Now delve deeper into the suitability of the IPv6 support.
1416135446Strhodes#
1417135446Strhodescase "$found_ipv6" in
1418135446Strhodes	yes)
1419135446Strhodes		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1420135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1421135446Strhodes
1422135446Strhodes		AC_MSG_CHECKING(for in6_addr)
1423135446Strhodes		AC_TRY_COMPILE([
1424135446Strhodes#include <sys/types.h>
1425135446Strhodes#include <sys/socket.h>
1426135446Strhodes#include <netinet/in.h>
1427135446Strhodes$isc_netinetin6_hack
1428135446Strhodes$isc_netinet6in6_hack
1429135446Strhodes],
1430135446Strhodes[struct in6_addr in6; return (0);],
1431135446Strhodes		[AC_MSG_RESULT(yes)
1432135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1433135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1434135446Strhodes		 isc_in_addr6_hack=""],
1435135446Strhodes		[AC_MSG_RESULT(no)
1436135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1437135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1438135446Strhodes		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1439135446Strhodes
1440135446Strhodes		AC_MSG_CHECKING(for in6addr_any)
1441135446Strhodes		AC_TRY_LINK([
1442135446Strhodes#include <sys/types.h>
1443135446Strhodes#include <sys/socket.h>
1444135446Strhodes#include <netinet/in.h>
1445135446Strhodes$isc_netinetin6_hack
1446135446Strhodes$isc_netinet6in6_hack
1447135446Strhodes$isc_in_addr6_hack
1448135446Strhodes],
1449135446Strhodes		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1450135446Strhodes			[AC_MSG_RESULT(yes)
1451135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1452135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1453135446Strhodes			[AC_MSG_RESULT(no)
1454135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1455135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1456135446Strhodes
1457135446Strhodes		AC_MSG_CHECKING(for in6addr_loopback)
1458135446Strhodes		AC_TRY_LINK([
1459135446Strhodes#include <sys/types.h>
1460135446Strhodes#include <sys/socket.h>
1461135446Strhodes#include <netinet/in.h>
1462135446Strhodes$isc_netinetin6_hack
1463135446Strhodes$isc_netinet6in6_hack
1464135446Strhodes$isc_in_addr6_hack
1465135446Strhodes],
1466135446Strhodes		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1467135446Strhodes			[AC_MSG_RESULT(yes)
1468135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1469135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1470135446Strhodes			[AC_MSG_RESULT(no)
1471135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1472135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1473135446Strhodes
1474135446Strhodes		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1475135446Strhodes		AC_TRY_COMPILE([
1476135446Strhodes#include <sys/types.h>
1477135446Strhodes#include <sys/socket.h>
1478135446Strhodes#include <netinet/in.h>
1479135446Strhodes$isc_netinetin6_hack
1480135446Strhodes$isc_netinet6in6_hack
1481135446Strhodes],
1482135446Strhodes		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1483135446Strhodes			[AC_MSG_RESULT(yes)
1484135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1485135446Strhodes			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1486135446Strhodes			[AC_MSG_RESULT(no)
1487135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1488135446Strhodes			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1489135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1490135446Strhodes
1491135446Strhodes		AC_MSG_CHECKING(for in6_pktinfo)
1492135446Strhodes		AC_TRY_COMPILE([
1493135446Strhodes#include <sys/types.h>
1494135446Strhodes#include <sys/socket.h>
1495135446Strhodes#include <netinet/in.h>
1496135446Strhodes$isc_netinetin6_hack
1497135446Strhodes$isc_netinet6in6_hack
1498135446Strhodes],
1499135446Strhodes		[struct in6_pktinfo xyzzy; return (0);],
1500135446Strhodes			[AC_MSG_RESULT(yes)
1501135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1502135446Strhodes			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1503135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1504135446Strhodes		;;
1505135446Strhodes	no)
1506135446Strhodes		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1507135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1508135446Strhodes		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1509135446Strhodes		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1510135446Strhodes		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1511135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1512135446Strhodes		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1513135446Strhodes		ISC_IPV6_H="ipv6.h"
1514135446Strhodes		ISC_IPV6_O="ipv6.$O"
1515135446Strhodes		ISC_ISCIPV6_O="unix/ipv6.$O"
1516135446Strhodes		ISC_IPV6_C="ipv6.c"
1517135446Strhodes		;;
1518135446Strhodesesac
1519135446Strhodes
1520135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIPV6)
1521135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1522135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1523135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1524135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1525135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1526135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1527135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1528135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1529135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1530135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1531135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1532135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1533135446StrhodesAC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1534135446StrhodesAC_SUBST(ISC_IPV6_H)
1535135446StrhodesAC_SUBST(ISC_IPV6_O)
1536135446StrhodesAC_SUBST(ISC_ISCIPV6_O)
1537135446StrhodesAC_SUBST(ISC_IPV6_C)
1538135446StrhodesAC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1539135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1540135446Strhodes
1541135446StrhodesAC_MSG_CHECKING([for struct if_laddrreq])
1542135446StrhodesAC_TRY_LINK([
1543135446Strhodes#include <sys/types.h>
1544135446Strhodes#include <net/if6.h>
1545135446Strhodes],[ struct if_laddrreq a; ],
1546135446Strhodes	[AC_MSG_RESULT(yes)
1547135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1548135446Strhodes	[AC_MSG_RESULT(no)
1549135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1550135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1551135446Strhodes
1552135446StrhodesAC_MSG_CHECKING([for struct if_laddrconf])
1553135446StrhodesAC_TRY_LINK([
1554135446Strhodes#include <sys/types.h>
1555135446Strhodes#include <net/if6.h>
1556135446Strhodes],[ struct if_laddrconf a; ],
1557135446Strhodes	[AC_MSG_RESULT(yes)
1558135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1559135446Strhodes	[AC_MSG_RESULT(no)
1560135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1561135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1562135446Strhodes
1563135446Strhodes#
1564135446Strhodes# Check for network functions that are often missing.  We do this
1565135446Strhodes# after the libtool checking, so we can put the right suffix on
1566135446Strhodes# the files.  It also needs to come after checking for a Kame add-on,
1567135446Strhodes# which provides some (all?) of the desired functions.
1568135446Strhodes#
1569135446Strhodes
1570135446StrhodesAC_MSG_CHECKING([for inet_ntop with IPv6 support])
1571135446StrhodesAC_TRY_RUN([
1572135446Strhodes#include <sys/types.h>
1573135446Strhodes#include <sys/socket.h>
1574135446Strhodes#include <netinet/in.h>
1575135446Strhodes#include <arpa/inet.h>
1576135446Strhodesmain() {
1577135446Strhodeschar a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1578193149Sdougb	[AC_MSG_RESULT(yes)
1579193149Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1580135446Strhodes
1581193149Sdougb	[AC_MSG_RESULT(no)
1582193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1583193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1584193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1585193149Sdougb	[AC_MSG_RESULT(assuming inet_ntop needed)
1586193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1587193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1588193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
1589135446Strhodes
1590135446Strhodes
1591135446Strhodes# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1592135446Strhodes# addresses with less than four octets, like "1.2.3".  Also leading
1593135446Strhodes# zeros should also be rejected.
1594135446Strhodes
1595135446StrhodesAC_MSG_CHECKING([for working inet_pton with IPv6 support])
1596135446StrhodesAC_TRY_RUN([
1597135446Strhodes#include <sys/types.h>
1598135446Strhodes#include <sys/socket.h>
1599135446Strhodes#include <netinet/in.h>
1600135446Strhodes#include <arpa/inet.h>
1601135446Strhodesmain() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1602135446Strhodes			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1603135446Strhodes			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1604193149Sdougb	[AC_MSG_RESULT(yes)
1605193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1606193149Sdougb	[AC_MSG_RESULT(no)
1607193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1608193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1609193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1610135446Strhodes	[AC_MSG_RESULT(assuming target platform has working inet_pton)
1611153816Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1612193149Sdougb	[AC_MSG_RESULT(assuming inet_pton needed)
1613193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1614193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1615193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1616193149Sdougb	[AC_MSG_RESULT(assuming target platform has working inet_pton)
1617193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"])
1618135446Strhodes
1619135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNTOP)
1620135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPTON)
1621135446Strhodes
1622135446Strhodes#
1623135446Strhodes# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1624135446Strhodes#
1625135446Strhodescase "$host" in
1626135446Strhodes	*-dec-osf*)
1627135446Strhodes		# Turn on 4.4BSD style sa_len support.
1628135446Strhodes		AC_DEFINE(_SOCKADDR_LEN)
1629135446Strhodes		;;
1630135446Strhodesesac
1631135446Strhodes
1632135446StrhodesAC_MSG_CHECKING(for sa_len in struct sockaddr)
1633135446StrhodesAC_TRY_COMPILE([
1634135446Strhodes#include <sys/types.h>
1635135446Strhodes#include <sys/socket.h>],
1636135446Strhodes[struct sockaddr sa; sa.sa_len = 0; return (0);],
1637135446Strhodes	[AC_MSG_RESULT(yes)
1638135446Strhodes	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1639135446Strhodes	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1640135446Strhodes	[AC_MSG_RESULT(no)
1641135446Strhodes	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1642135446Strhodes	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1643135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESALEN)
1644135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVESALEN)
1645135446Strhodes
1646135446Strhodes#
1647135446Strhodes# Look for a 4.4BSD or 4.3BSD struct msghdr
1648135446Strhodes#
1649135446StrhodesAC_MSG_CHECKING(for struct msghdr flavor)
1650135446StrhodesAC_TRY_COMPILE([
1651135446Strhodes#include <sys/types.h>
1652135446Strhodes#include <sys/socket.h>],
1653135446Strhodes[struct msghdr msg; msg.msg_flags = 0; return (0);],
1654135446Strhodes	[AC_MSG_RESULT(4.4BSD)
1655135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1656135446Strhodes	[AC_MSG_RESULT(4.3BSD)
1657135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1658135446StrhodesAC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1659135446Strhodes
1660135446Strhodes#
1661135446Strhodes# Look for in_port_t.
1662135446Strhodes#
1663135446StrhodesAC_MSG_CHECKING(for type in_port_t)
1664135446StrhodesAC_TRY_COMPILE([
1665135446Strhodes#include <sys/types.h>
1666135446Strhodes#include <netinet/in.h>],
1667135446Strhodes[in_port_t port = 25; return (0);],
1668135446Strhodes	[AC_MSG_RESULT(yes)
1669135446Strhodes	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1670193149Sdougb	[AC_MSG_RESULT(no)
1671135446Strhodes	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1672135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPORTT)
1673135446Strhodes
1674135446Strhodes#
1675135446Strhodes# Check for addrinfo
1676135446Strhodes#
1677135446StrhodesAC_MSG_CHECKING(for struct addrinfo)
1678135446StrhodesAC_TRY_COMPILE([
1679135446Strhodes#include <netdb.h>],
1680135446Strhodes[struct addrinfo a; return (0);],
1681135446Strhodes	[AC_MSG_RESULT(yes)
1682135446Strhodes	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
1683135446Strhodes	AC_DEFINE(HAVE_ADDRINFO)],
1684135446Strhodes	[AC_MSG_RESULT(no)
1685135446Strhodes	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
1686135446StrhodesAC_SUBST(ISC_LWRES_NEEDADDRINFO)
1687135446Strhodes
1688135446Strhodes#
1689135446Strhodes# Check for rrsetinfo
1690135446Strhodes#
1691135446StrhodesAC_MSG_CHECKING(for struct rrsetinfo)
1692135446StrhodesAC_TRY_COMPILE([
1693135446Strhodes#include <netdb.h>],
1694135446Strhodes[struct rrsetinfo r; return (0);],
1695135446Strhodes	[AC_MSG_RESULT(yes)
1696135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
1697135446Strhodes	[AC_MSG_RESULT(no)
1698135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
1699135446StrhodesAC_SUBST(ISC_LWRES_NEEDRRSETINFO)
1700135446Strhodes
1701135446StrhodesAC_MSG_CHECKING(for int sethostent)
1702135446StrhodesAC_TRY_COMPILE([
1703135446Strhodes#include <netdb.h>],
1704135446Strhodes[int i = sethostent(0); return(0);],
1705135446Strhodes	[AC_MSG_RESULT(yes)
1706135446Strhodes	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
1707135446Strhodes	[AC_MSG_RESULT(no)
1708135446Strhodes	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
1709135446StrhodesAC_SUBST(ISC_LWRES_SETHOSTENTINT)
1710135446Strhodes
1711135446StrhodesAC_MSG_CHECKING(for int endhostent)
1712135446StrhodesAC_TRY_COMPILE([
1713135446Strhodes#include <netdb.h>],
1714135446Strhodes[int i = endhostent(); return(0);],
1715135446Strhodes	[AC_MSG_RESULT(yes)
1716135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1717135446Strhodes	[AC_MSG_RESULT(no)
1718135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1719135446StrhodesAC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1720135446Strhodes
1721135446StrhodesAC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
1722135446StrhodesAC_TRY_COMPILE([
1723135446Strhodes#include <netdb.h>
1724135446Strhodesstruct netent *getnetbyaddr(in_addr_t, int);],
1725135446Strhodes[],
1726135446Strhodes	[AC_MSG_RESULT(yes)
1727135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
1728135446Strhodes	[AC_MSG_RESULT(no)
1729135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
1730135446StrhodesAC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
1731135446Strhodes
1732135446StrhodesAC_MSG_CHECKING(for int setnetent)
1733135446StrhodesAC_TRY_COMPILE([
1734135446Strhodes#include <netdb.h>],
1735135446Strhodes[int i = setnetent(0); return(0);],
1736135446Strhodes	[AC_MSG_RESULT(yes)
1737135446Strhodes	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1738135446Strhodes	[AC_MSG_RESULT(no)
1739135446Strhodes	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1740135446StrhodesAC_SUBST(ISC_LWRES_SETNETENTINT)
1741135446Strhodes
1742135446StrhodesAC_MSG_CHECKING(for int endnetent)
1743135446StrhodesAC_TRY_COMPILE([
1744135446Strhodes#include <netdb.h>],
1745135446Strhodes[int i = endnetent(); return(0);],
1746135446Strhodes	[AC_MSG_RESULT(yes)
1747135446Strhodes	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1748135446Strhodes	[AC_MSG_RESULT(no)
1749135446Strhodes	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1750135446StrhodesAC_SUBST(ISC_LWRES_ENDNETENTINT)
1751135446Strhodes
1752135446StrhodesAC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1753135446StrhodesAC_TRY_COMPILE([
1754135446Strhodes#include <netdb.h>
1755135446Strhodesstruct hostent *gethostbyaddr(const void *, size_t, int);],
1756135446Strhodes[return(0);],
1757135446Strhodes	[AC_MSG_RESULT(yes)
1758135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1759135446Strhodes	[AC_MSG_RESULT(no)
1760135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1761135446StrhodesAC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1762135446Strhodes
1763135446StrhodesAC_MSG_CHECKING(for h_errno in netdb.h)
1764135446StrhodesAC_TRY_COMPILE([
1765135446Strhodes#include <netdb.h>],
1766135446Strhodes[h_errno = 1; return(0);],
1767135446Strhodes	[AC_MSG_RESULT(yes)
1768135446Strhodes	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1769135446Strhodes	[AC_MSG_RESULT(no)
1770135446Strhodes	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1771135446StrhodesAC_SUBST(ISC_LWRES_NEEDHERRNO)
1772135446Strhodes
1773135446StrhodesAC_CHECK_FUNC(getipnodebyname,
1774193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1775193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1776135446StrhodesAC_CHECK_FUNC(getnameinfo,
1777193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1778193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1779135446StrhodesAC_CHECK_FUNC(getaddrinfo,
1780193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1781135446Strhodes	AC_DEFINE(HAVE_GETADDRINFO)],
1782193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1783135446StrhodesAC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1784135446StrhodesAC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1785135446StrhodesAC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1786135446StrhodesAC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1787135446Strhodes
1788135446StrhodesAC_ARG_ENABLE(getifaddrs,
1789204619Sdougb[  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
1790135446Strhodes    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1791135446Strhodes
1792193149Sdougb#
1793193149Sdougb# This interface iteration code for getifaddrs() will fall back to using
1794193149Sdougb# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
1795193149Sdougb# addresses.
1796193149Sdougb# 
1797135446Strhodescase $want_getifaddrs in
1798193149Sdougbglibc)
1799193149SdougbAC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
1800193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1801135446Strhodes;;
1802193149Sdougbyes)
1803193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1804193149Sdougb;;
1805135446Strhodesno)
1806135446Strhodes;;
1807135446Strhodesesac
1808135446Strhodes
1809135446Strhodes#
1810135446Strhodes# Look for a sysctl call to get the list of network interfaces.
1811135446Strhodes#
1812135446Strhodescase $ac_cv_header_sys_sysctl_h in
1813135446Strhodesyes)
1814135446StrhodesAC_MSG_CHECKING(for interface list sysctl)
1815135446StrhodesAC_EGREP_CPP(found_rt_iflist, [
1816135446Strhodes#include <sys/param.h>
1817135446Strhodes#include <sys/sysctl.h>
1818135446Strhodes#include <sys/socket.h>
1819135446Strhodes#ifdef NET_RT_IFLIST
1820135446Strhodesfound_rt_iflist
1821135446Strhodes#endif
1822135446Strhodes],
1823135446Strhodes	[AC_MSG_RESULT(yes)
1824135446Strhodes	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1825135446Strhodes	[AC_MSG_RESULT(no)])
1826135446Strhodes;;
1827135446Strhodesesac
1828135446Strhodes
1829135446Strhodes#
1830135446Strhodes# Check for some other useful functions that are not ever-present.
1831135446Strhodes#
1832135446Strhodes
1833135446Strhodes# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
1834135446Strhodes# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
1835135446Strhodes# reportedly defines strsep() without declaring it in <string.h> when
1836135446Strhodes# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
1837135446Strhodes# AC_CHECK_FUNC() incorrectly succeeds because it declares
1838135446Strhodes# the function itself.
1839135446StrhodesAC_MSG_CHECKING(for correctly declared strsep())
1840135446StrhodesAC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
1841135446Strhodes	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1842135446Strhodes	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1843135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1844135446Strhodes
1845135446StrhodesAC_CHECK_FUNC(memmove,
1846135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
1847135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
1848135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
1849135446Strhodes
1850135446StrhodesAC_CHECK_FUNC(strtoul,
1851153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
1852165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
1853153816Sdougb	 GENRANDOMLIB=""],
1854153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
1855165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
1856165071Sdougb	 GENRANDOMLIB='${ISCLIBS}'])
1857135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
1858153816SdougbAC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
1859153816SdougbAC_SUBST(GENRANDOMLIB)
1860135446Strhodes
1861135446StrhodesAC_CHECK_FUNC(strlcpy,
1862135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
1863135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
1864135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
1865135446Strhodes
1866135446StrhodesAC_CHECK_FUNC(strlcat,
1867135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
1868135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
1869135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
1870135446Strhodes
1871135446StrhodesISC_PRINT_OBJS=
1872135446StrhodesISC_PRINT_SRCS=
1873135446StrhodesAC_MSG_CHECKING(sprintf)
1874135446StrhodesAC_TRY_COMPILE([
1875135446Strhodes#include <stdio.h>
1876135446Strhodes],
1877135446Strhodes[ char buf[2]; return(*sprintf(buf,"x"));],
1878135446Strhodes[
1879135446StrhodesISC_PRINT_OBJS="print.$O"
1880135446StrhodesISC_PRINT_SRCS="print.c"
1881135446StrhodesISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
1882135446StrhodesLWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
1883135446Strhodes],
1884135446Strhodes[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
1885135446Strhodes LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
1886135446Strhodes)
1887135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
1888135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
1889135446Strhodes
1890135446StrhodesAC_CHECK_FUNC(vsnprintf,
1891135446Strhodes	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
1892135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
1893135446Strhodes	[ISC_PRINT_OBJS="print.$O"
1894135446Strhodes	 ISC_PRINT_SRCS="print.c"
1895135446Strhodes	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
1896135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
1897135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1898135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
1899135446StrhodesISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
1900135446StrhodesISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
1901135446Strhodes
1902135446StrhodesAC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
1903135446Strhodes
1904135446StrhodesAC_SUBST(ISC_EXTRA_OBJS)
1905135446StrhodesAC_SUBST(ISC_EXTRA_SRCS)
1906135446Strhodes
1907193149Sdougb#
1908193149Sdougb# Use our own SPNEGO implementation?
1909193149Sdougb#
1910193149SdougbAC_ARG_ENABLE(isc-spnego,
1911204619Sdougb	[  --disable-isc-spnego    use SPNEGO from GSSAPI library])
1912193149Sdougb
1913193149Sdougbif test -n "$USE_GSSAPI"
1914193149Sdougbthen
1915193149Sdougb	case "$enable_isc_spnego" in
1916193149Sdougb		yes|'')
1917193149Sdougb			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
1918193149Sdougb			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
1919193149Sdougb			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
1920193149Sdougb			AC_MSG_RESULT(using SPNEGO from lib/dns)
1921193149Sdougb			;;
1922193149Sdougb		no)
1923193149Sdougb			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
1924193149Sdougb			;;
1925193149Sdougb	esac
1926193149Sdougbfi
1927193149Sdougb
1928193149SdougbAC_SUBST(USE_ISC_SPNEGO)
1929193149Sdougb
1930193149SdougbAC_SUBST(DST_EXTRA_OBJS)
1931193149SdougbAC_SUBST(DST_EXTRA_SRCS)
1932193149Sdougb
1933135446Strhodes# Determine the printf format characters to use when printing
1934135446Strhodes# values of type isc_int64_t. This will normally be "ll", but where
1935135446Strhodes# the compiler treats "long long" as a alias for "long" and printf
1936135446Strhodes# doesn't know about "long long" use "l".  Hopefully the sprintf
1937193149Sdougb# will produce a inconsistent result in the later case.  If the compiler
1938135446Strhodes# fails due to seeing "%lld" we fall back to "l".
1939135446Strhodes#
1940153816Sdougb# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
1941153816Sdougb# %ld even for (long long)/
1942153816Sdougb#
1943135446Strhodes# Win32 uses "%I64d", but that's defined elsewhere since we don't use
1944135446Strhodes# configure on Win32.
1945135446Strhodes#
1946135446StrhodesAC_MSG_CHECKING(printf format modifier for 64-bit integers)
1947135446StrhodesAC_TRY_RUN([
1948135446Strhodes#include <stdio.h>
1949135446Strhodesmain() {
1950135446Strhodes	long long int j = 0;
1951135446Strhodes	char buf[100];
1952135446Strhodes	buf[0] = 0;
1953135446Strhodes	sprintf(buf, "%lld", j);
1954135446Strhodes	exit((sizeof(long long int) != sizeof(long int))? 0 :
1955135446Strhodes	     (strcmp(buf, "0") != 0));
1956135446Strhodes} 
1957135446Strhodes],
1958135446Strhodes	[AC_MSG_RESULT(ll)
1959153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1960153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
1961135446Strhodes	[AC_MSG_RESULT(l)
1962153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
1963153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
1964135446Strhodes	[AC_MSG_RESULT(assuming target platform uses ll)
1965153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1966153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
1967135446StrhodesAC_SUBST(ISC_PLATFORM_QUADFORMAT)
1968153816SdougbAC_SUBST(LWRES_PLATFORM_QUADFORMAT)
1969135446Strhodes
1970135446Strhodes#
1971135446Strhodes# Security Stuff
1972135446Strhodes#
1973193149Sdougb# Note it is very recommended to *not* disable chroot(),
1974193149Sdougb# this is only because chroot() was made obsolete by Posix.
1975193149SdougbAC_ARG_ENABLE(chroot,
1976204619Sdougb	[  --disable-chroot        disable chroot])
1977193149Sdougbcase "$enable_chroot" in
1978193149Sdougb	yes|'')
1979193149Sdougb		AC_CHECK_FUNCS(chroot)
1980193149Sdougb		;;
1981193149Sdougb	no)
1982193149Sdougb		;;
1983193149Sdougbesac
1984135446StrhodesAC_ARG_ENABLE(linux-caps,
1985204619Sdougb	[  --disable-linux-caps	  disable linux capabilities])
1986135446Strhodescase "$enable_linux_caps" in
1987135446Strhodes	yes|'')
1988186462Sdougb		AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
1989193149Sdougb		AC_CHECK_LIB(cap, cap_set_proc)
1990135446Strhodes		;;
1991135446Strhodes	no)
1992135446Strhodes		;;
1993135446Strhodesesac
1994135446StrhodesAC_CHECK_HEADERS(sys/prctl.h)
1995135446Strhodes
1996170222SdougbAC_CHECK_HEADERS(sys/un.h,
1997170222SdougbISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
1998170222Sdougb,
1999170222SdougbISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2000170222Sdougb)
2001170222SdougbAC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2002170222Sdougb
2003170222Sdougbcase "$host" in
2004170222Sdougb*-solaris*)
2005170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2006170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2007170222Sdougb	;;
2008170222Sdougb*-sunos*)
2009170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2010170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2011170222Sdougb	;;
2012170222Sdougbesac
2013170222Sdougb
2014135446Strhodes#
2015135446Strhodes# Time Zone Stuff
2016135446Strhodes#
2017135446StrhodesAC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2018135446Strhodes
2019193149SdougbAC_MSG_CHECKING(for optarg declaration)
2020153816SdougbAC_TRY_COMPILE([
2021153816Sdougb#include <unistd.h>
2022153816Sdougb],
2023153816Sdougb[optarg = 0;],
2024153816Sdougb[AC_MSG_RESULT(yes)],
2025153816Sdougb[AC_MSG_RESULT(no)
2026165071SdougbGEN_NEED_OPTARG="-DNEED_OPTARG=1"
2027153816SdougbAC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2028153816Sdougb
2029135446Strhodes#
2030135446Strhodes# BSD/OS, and perhaps some others, don't define rlim_t.
2031135446Strhodes#
2032135446StrhodesAC_MSG_CHECKING(for type rlim_t)
2033135446StrhodesAC_TRY_COMPILE([
2034135446Strhodes#include <sys/types.h>
2035135446Strhodes#include <sys/time.h>
2036135446Strhodes#include <sys/resource.h>],
2037135446Strhodes[rlim_t rl = 19671212; return (0);],
2038135446Strhodes[AC_MSG_RESULT(yes)
2039135446Strhodes ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2040135446Strhodes[AC_MSG_RESULT(no)
2041135446Strhodes
2042135446StrhodesAC_MSG_CHECKING(type of rlim_cur)
2043135446StrhodesAC_TRY_RUN([
2044135446Strhodes#include <sys/types.h>
2045135446Strhodes#include <sys/time.h>
2046135446Strhodes#include <sys/resource.h>
2047135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2048135446Strhodes[AC_MSG_RESULT(int)
2049135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2050135446Strhodes[
2051135446StrhodesAC_TRY_RUN([
2052135446Strhodes#include <sys/types.h>
2053135446Strhodes#include <sys/time.h>
2054135446Strhodes#include <sys/resource.h>
2055135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2056135446Strhodes[AC_MSG_RESULT(long int)
2057135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2058135446Strhodes[
2059135446StrhodesAC_TRY_RUN([
2060135446Strhodes#include <sys/types.h>
2061135446Strhodes#include <sys/time.h>
2062135446Strhodes#include <sys/resource.h>
2063135446Strhodesmain() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2064135446Strhodes[AC_MSG_RESULT(long long int)
2065135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2066135446Strhodes[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2067135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2068135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2069153816Sdougb],[
2070153816SdougbISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"
2071153816SdougbAC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming long long int)])
2072135446Strhodes])
2073135446StrhodesAC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2074135446Strhodes
2075135446Strhodes#
2076186462Sdougb# Older HP-UX doesn't have gettune
2077186462Sdougb#
2078186462Sdougbcase "$host" in
2079186462Sdougb  	*-hp-hpux*)
2080186462Sdougb		AC_CHECK_HEADERS(sys/dyntune.h)
2081186462Sdougb		;;
2082186462Sdougb	*)
2083186462Sdougb		;;
2084186462Sdougbesac
2085186462Sdougb
2086186462Sdougb
2087186462Sdougb#
2088135446Strhodes# Compaq TruCluster requires more code for handling cluster IP aliases
2089135446Strhodes#
2090135446Strhodescase "$host" in
2091135446Strhodes	*-dec-osf*)
2092135446Strhodes		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2093135446Strhodes		AC_CHECK_FUNC(clua_getaliasaddress,
2094135446Strhodes				AC_DEFINE(HAVE_TRUCLUSTER, 1,
2095135446Strhodes					[Define if running under Compaq TruCluster]))
2096135446Strhodes		;;
2097135446Strhodes	*)
2098135446Strhodes		;;
2099135446Strhodesesac
2100135446Strhodes
2101135446Strhodes#
2102165071Sdougb# Some hosts need msg_namelen to match the size of the socket structure.
2103165071Sdougb# Some hosts don't set msg_namelen appropriately on return from recvmsg().
2104165071Sdougb#
2105165071Sdougbcase $host in
2106165071Sdougb*os2*|*hp-mpeix*)
2107165071Sdougb	AC_DEFINE(BROKEN_RECVMSG, 1,
2108165071Sdougb		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2109165071Sdougb	;;
2110165071Sdougbesac
2111165071Sdougb
2112165071Sdougb#
2113135446Strhodes# Microsoft has their own way of handling shared libraries that requires
2114135446Strhodes# additional qualifiers on extern variables.  Unix systems don't need it.
2115135446Strhodes#
2116135446StrhodesAC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2117135446StrhodesISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2118135446StrhodesAC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2119135446StrhodesLWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2120135446Strhodes
2121135446Strhodes#
2122135446Strhodes# Random remaining OS-specific issues involving compiler warnings.
2123135446Strhodes# XXXDCL print messages to indicate some compensation is being done?
2124135446Strhodes#
2125135446StrhodesAC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2126135446StrhodesISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2127135446Strhodes
2128135446Strhodescase "$host" in
2129165071Sdougb	*-aix5.[[123]].*)
2130143731Sdougb		hack_shutup_pthreadonceinit=yes
2131143731Sdougb		;;
2132135446Strhodes	*-bsdi3.1*)
2133135446Strhodes		hack_shutup_sputaux=yes
2134135446Strhodes		;;
2135135446Strhodes	*-bsdi4.0*)
2136135446Strhodes		hack_shutup_sigwait=yes
2137135446Strhodes		hack_shutup_sputaux=yes
2138135446Strhodes		;;
2139135446Strhodes	[*-bsdi4.[12]*])
2140135446Strhodes		hack_shutup_stdargcast=yes
2141135446Strhodes		;;
2142135446Strhodes	[*-solaris2.[89]])
2143135446Strhodes		hack_shutup_pthreadonceinit=yes
2144135446Strhodes		;;
2145186462Sdougb	*-solaris2.1[[0-9]])
2146193149Sdougb		AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2147165071Sdougb		;;
2148135446Strhodesesac
2149135446Strhodes
2150135446Strhodescase "$hack_shutup_pthreadonceinit" in
2151135446Strhodes	yes)
2152135446Strhodes		#
2153135446Strhodes		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2154135446Strhodes		#
2155135446Strhodes		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2156135446Strhodes		;;
2157135446Strhodesesac
2158135446Strhodes
2159135446Strhodescase "$hack_shutup_sigwait" in
2160135446Strhodes	yes)
2161135446Strhodes		#
2162135446Strhodes		# Shut up a -Wmissing-prototypes warning for sigwait().
2163135446Strhodes		#
2164135446Strhodes		AC_DEFINE(SHUTUP_SIGWAIT)
2165135446Strhodes		;;
2166135446Strhodesesac
2167135446Strhodes
2168135446Strhodescase "$hack_shutup_sputaux" in
2169135446Strhodes	yes)
2170135446Strhodes		#
2171135446Strhodes		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
2172135446Strhodes		#
2173135446Strhodes		AC_DEFINE(SHUTUP_SPUTAUX)
2174135446Strhodes		;;
2175135446Strhodesesac
2176135446Strhodes
2177135446Strhodescase "$hack_shutup_stdargcast" in
2178135446Strhodes	yes)
2179135446Strhodes		#
2180135446Strhodes		# Shut up a -Wcast-qual warning from va_start().
2181135446Strhodes		#
2182135446Strhodes		AC_DEFINE(SHUTUP_STDARG_CAST)
2183135446Strhodes		;;
2184135446Strhodesesac
2185135446Strhodes
2186174187SdougbAC_CHECK_HEADERS(strings.h,
2187174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2188174187Sdougb,
2189174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2190174187Sdougb)
2191174187SdougbAC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2192174187Sdougb
2193135446Strhodes#
2194135446Strhodes# Check for if_nametoindex() for IPv6 scoped addresses support
2195135446Strhodes#
2196135446StrhodesAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2197135446Strhodes		ac_cv_have_if_nametoindex=no)
2198135446Strhodescase $ac_cv_have_if_nametoindex in
2199135446Strhodesno)
2200135446Strhodes	case "$host" in
2201193149Sdougb	*-hp-hpux*)
2202193149Sdougb		AC_CHECK_LIB(ipv6, if_nametoindex,
2203135446Strhodes				ac_cv_have_if_nametoindex=yes
2204135446Strhodes				LIBS="-lipv6 $LIBS",)
2205193149Sdougb	;;
2206135446Strhodes	esac
2207135446Strhodesesac
2208135446Strhodescase $ac_cv_have_if_nametoindex in
2209135446Strhodesyes)
2210135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2211135446Strhodes	;;
2212135446Strhodes*)
2213135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2214135446Strhodes	;;
2215135446Strhodesesac
2216135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2217135446Strhodes
2218193149SdougbAC_CHECK_FUNCS(nanosleep)
2219193149Sdougb
2220135446Strhodes#
2221170222Sdougb# Machine architecture dependent features
2222170222Sdougb#
2223170222SdougbAC_ARG_ENABLE(atomic,
2224204619Sdougb	[  --enable-atomic	  enable machine specific atomic operations
2225204619Sdougb			  [[default=autodetect]]],
2226170222Sdougb			enable_atomic="$enableval",
2227170222Sdougb			enable_atomic="autodetect")
2228170222Sdougbcase "$enable_atomic" in
2229170222Sdougb	yes|''|autodetect)
2230204619Sdougb		case "$host" in
2231204619Sdougb		powerpc-ibm-aix*)
2232204619Sdougb			if test "X$GCC" = "Xyes"; then
2233204619Sdougb				AC_MSG_CHECKING([if asm("isc"); works])
2234204619Sdougb				AC_TRY_COMPILE(,[
2235204619Sdougb				main() { asm("ics"); exit(0); }
2236204619Sdougb				],
2237204619Sdougb				[AC_MSG_RESULT(yes)
2238204619Sdougb				 use_atomic=yes],
2239204619Sdougb				[
2240204619Sdougb				saved_cflags="$CFLAGS"
2241204619Sdougb				CFLAGS="$CFLAGS -Wa,-many"
2242204619Sdougb				AC_TRY_RUN([
2243204619Sdougb				main() { asm("ics"); exit(0); }
2244204619Sdougb				],
2245204619Sdougb				[AC_MSG_RESULT([yes, required -Wa,-many])
2246204619Sdougb				 use_atomic=yes],
2247204619Sdougb				[AC_MSG_RESULT([no, use_atomic disabled])
2248204619Sdougb				 CFLAGS="$saved_cflags"
2249204619Sdougb				 use_atomic=no],
2250204619Sdougb				[AC_MSG_RESULT([cross compile, assume yes])
2251204619Sdougb				 CFLAGS="$saved_cflags"
2252204619Sdougb				 use_atomic=yes])
2253204619Sdougb				]
2254204619Sdougb				)
2255204619Sdougb			fi
2256204619Sdougb			;;
2257204619Sdougb		*)
2258204619Sdougb			use_atomic=yes
2259204619Sdougb			;;
2260204619Sdougb		esac
2261170222Sdougb		;;
2262170222Sdougb	no)
2263170222Sdougb		use_atomic=no
2264170222Sdougb		arch=noatomic
2265170222Sdougb		;;
2266170222Sdougbesac
2267170222Sdougb
2268170222SdougbISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2269170222Sdougbif test "$use_atomic" = "yes"; then
2270170222Sdougb	AC_MSG_CHECKING([architecture type for atomic operations])
2271170222Sdougb	have_atomic=yes		# set default
2272170222Sdougb	case "$host" in
2273170222Sdougb	[i[3456]86-*])
2274170222Sdougb		# XXX: some old x86 architectures actually do not support
2275170222Sdougb		#      (some of) these operations.  Do we need stricter checks?
2276170222SdougbAC_TRY_RUN([
2277170222Sdougbmain() {
2278170222Sdougb	exit((sizeof(void *) == 8) ? 0 : 1);
2279170222Sdougb}
2280170222Sdougb],
2281193149Sdougb		[arch=x86_64
2282193149Sdougb		have_xaddq=yes],
2283170222Sdougb		[arch=x86_32],
2284193149Sdougb		[arch=x86_32])
2285170222Sdougb	;;
2286193149Sdougb	x86_64-*|amd64-*)
2287204619SdougbAC_TRY_RUN([
2288204619Sdougbmain() {
2289204619Sdougb       exit((sizeof(void *) == 8) ? 0 : 1);
2290204619Sdougb}
2291204619Sdougb],
2292204619Sdougb	       [arch=x86_64
2293204619Sdougb	       have_xaddq=yes],
2294204619Sdougb	       [arch=x86_32],
2295204619Sdougb	       [arch=x86_64
2296204619Sdougb	       have_xaddq=yes])
2297170222Sdougb	;;
2298170222Sdougb	alpha*-*)
2299170222Sdougb		arch=alpha
2300170222Sdougb	;;
2301170222Sdougb	powerpc-*)
2302170222Sdougb		arch=powerpc
2303170222Sdougb	;;
2304170222Sdougb	mips-*|mipsel-*|mips64-*|mips64el-*)
2305170222Sdougb		arch=mips
2306170222Sdougb	;;
2307170222Sdougb	ia64-*)
2308170222Sdougb		arch=ia64
2309170222Sdougb	;;
2310170222Sdougb	*)
2311170222Sdougb		have_atomic=no
2312170222Sdougb		arch=noatomic
2313170222Sdougb	;;
2314170222Sdougb	esac
2315170222Sdougb	AC_MSG_RESULT($arch)
2316170222Sdougbfi
2317170222Sdougb
2318170222Sdougbif test "$have_atomic" = "yes"; then
2319170222Sdougb	AC_MSG_CHECKING([compiler support for inline assembly code])
2320170222Sdougb
2321170222Sdougb	compiler=generic
2322170222Sdougb	# Check whether the compiler supports the assembly syntax we provide.
2323170222Sdougb	if test "X$GCC" = "Xyes"; then
2324170222Sdougb		# GCC's ASM extension always works
2325170222Sdougb		compiler=gcc
2326170222Sdougb		if test $arch = "x86_64"; then
2327170222Sdougb			# We can share the same code for gcc with x86_32
2328170222Sdougb			arch=x86_32
2329170222Sdougb		fi
2330170222Sdougb		if test $arch = "powerpc"; then
2331170222Sdougb			#
2332170222Sdougb			# The MacOS (and maybe others) uses "r0" for register
2333170222Sdougb			# zero. Under linux/ibm it is "0" for register 0.
2334170222Sdougb			# Probe to see if we have a MacOS style assembler.
2335170222Sdougb			#
2336170222Sdougb			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2337170222Sdougb			AC_TRY_COMPILE(, [
2338170222Sdougb			__asm__ volatile ("li r0, 0x0\n"::);
2339170222Sdougb			], [
2340170222Sdougb			AC_MSG_RESULT(yes)
2341170222Sdougb			compiler="mac"
2342170222Sdougb			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2343170222Sdougb			], [AC_MSG_RESULT(no)])
2344170222Sdougb		fi
2345170222Sdougb	else
2346170222Sdougb		case "$host" in
2347170222Sdougb		alpha*-dec-osf*)
2348170222Sdougb			# Tru64 compiler has its own syntax for inline 
2349170222Sdougb			# assembly.
2350170222Sdougb			AC_TRY_COMPILE(, [
2351170222Sdougb#ifndef __DECC
2352170222Sdougb#error "unexpected compiler"
2353170222Sdougb#endif
2354170222Sdougb				return (0);],
2355170222Sdougb				[compiler=osf],)
2356170222Sdougb		;;
2357170222Sdougb		powerpc-ibm-aix*)
2358170222Sdougb			compiler=aix
2359170222Sdougb		;;
2360170222Sdougb		esac
2361170222Sdougb	fi
2362170222Sdougb	case "$compiler" in
2363170222Sdougb	gcc)
2364170222Sdougb		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2365170222Sdougb		;;
2366170222Sdougb	osf)
2367170222Sdougb		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2368170222Sdougb		;;
2369170222Sdougb	aix)
2370170222Sdougb		;;
2371170222Sdougb	mac)
2372170222Sdougb		;;
2373170222Sdougb	*)
2374170222Sdougb		# See if the generic __asm function works.  If not,
2375170222Sdougb		# we need to disable the atomic operations.
2376170222Sdougb		AC_TRY_LINK(, [
2377170222Sdougb					__asm("nop")
2378170222Sdougb				],
2379170222Sdougb		[compiler="standard"
2380170222Sdougb		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2381170222Sdougb		[compiler="not supported (atomic operations disabled)"
2382170222Sdougb		have_atomic=no
2383170222Sdougb		arch=noatomic ]);
2384170222Sdougb		;;
2385170222Sdougb	esac
2386170222Sdougb
2387170222Sdougb	AC_MSG_RESULT($compiler)
2388170222Sdougbfi
2389170222Sdougb
2390170222Sdougbif test "$have_atomic" = "yes"; then
2391170222Sdougb	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2392170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2393170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2394170222Sdougbelse
2395170222Sdougb	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2396170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2397170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2398170222Sdougbfi
2399170222Sdougb
2400193149Sdougbif test "$have_xaddq" = "yes"; then
2401204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
2402193149Sdougbelse
2403204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
2404193149Sdougbfi
2405193149Sdougb
2406170222SdougbAC_SUBST(ISC_PLATFORM_HAVEXADD)
2407193149SdougbAC_SUBST(ISC_PLATFORM_HAVEXADDQ)
2408170222SdougbAC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2409170222SdougbAC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2410170222Sdougb
2411170222SdougbAC_SUBST(ISC_PLATFORM_USEGCCASM)
2412170222SdougbAC_SUBST(ISC_PLATFORM_USEOSFASM)
2413170222SdougbAC_SUBST(ISC_PLATFORM_USESTDASM)
2414170222SdougbAC_SUBST(ISC_PLATFORM_USEMACASM)
2415170222Sdougb
2416170222SdougbISC_ARCH_DIR=$arch
2417170222SdougbAC_SUBST(ISC_ARCH_DIR)
2418170222Sdougb
2419170222Sdougb#
2420193149Sdougb# Activate "rrset-order fixed" or not?
2421193149Sdougb#
2422193149SdougbAC_ARG_ENABLE(fixed-rrset,
2423204619Sdougb	[  --enable-fixed-rrset    enable fixed rrset ordering
2424204619Sdougb			  [[default=no]]],
2425193149Sdougb			enable_fixed="$enableval",
2426193149Sdougb			enable_fixed="no")
2427193149Sdougbcase "$enable_fixed" in
2428193149Sdougb	yes)
2429193149Sdougb		AC_DEFINE(DNS_RDATASET_FIXED, 1,
2430204619Sdougb			  [Define to enable "rrset-order fixed" syntax.])
2431193149Sdougb		;;
2432193149Sdougb	no)
2433193149Sdougb		;;
2434193149Sdougb	*)
2435193149Sdougb		;;
2436193149Sdougbesac
2437193149Sdougb
2438193149Sdougb#
2439153816Sdougb#  The following sets up how non-blocking i/o is established.
2440153816Sdougb#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
2441153816Sdougb#
2442153816Sdougbcase "$host" in
2443153816Sdougb*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2444153816Sdougb*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2445153816Sdougb*-solaris2.[[01234]])
2446153816Sdougb	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2447153816Sdougb	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2448153816Sdougb		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2449153816Sdougb	;;
2450153816Sdougb*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2451153816Sdougb	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2452153816Sdougb	;;
2453153816Sdougbesac
2454153816Sdougb#
2455165071Sdougb# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2456165071Sdougb# This prevents the source address being set.
2457165071Sdougb#
2458165071Sdougbcase "$host" in
2459165071Sdougb*-solaris2.[[012345]]|*-solaris2.5.1)
2460165071Sdougb	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2461165071Sdougb		  [Define if you cannot bind() before connect() for TCP sockets.])
2462165071Sdougb	;;
2463165071Sdougbesac
2464165071Sdougb#
2465135446Strhodes# The following sections deal with tools used for formatting
2466135446Strhodes# the documentation.  They are all optional, unless you are
2467135446Strhodes# a developer editing the documentation source.
2468135446Strhodes#
2469135446Strhodes
2470153816Sdougb#
2471153816Sdougb# Look for TeX.
2472153816Sdougb#
2473135446Strhodes
2474153816SdougbAC_PATH_PROGS(LATEX, latex, latex)
2475153816SdougbAC_SUBST(LATEX)
2476153816Sdougb
2477153816SdougbAC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2478153816SdougbAC_SUBST(PDFLATEX)
2479153816Sdougb
2480135446Strhodes#
2481170222Sdougb# Look for w3m
2482170222Sdougb#
2483170222Sdougb
2484170222SdougbAC_PATH_PROGS(W3M, w3m, w3m)
2485170222SdougbAC_SUBST(W3M)
2486170222Sdougb
2487170222Sdougb#
2488153816Sdougb# Look for xsltproc (libxslt)
2489135446Strhodes#
2490135446Strhodes
2491153816SdougbAC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2492153816SdougbAC_SUBST(XSLTPROC)
2493135446Strhodes
2494135446Strhodes#
2495153816Sdougb# Look for xmllint (libxml2)
2496135446Strhodes#
2497135446Strhodes
2498153816SdougbAC_PATH_PROG(XMLLINT, xmllint, xmllint)
2499153816SdougbAC_SUBST(XMLLINT)
2500135446Strhodes
2501135446Strhodes#
2502193149Sdougb# Look for Doxygen
2503193149Sdougb#
2504193149Sdougb
2505193149SdougbAC_PATH_PROG(DOXYGEN, doxygen, doxygen)
2506193149SdougbAC_SUBST(DOXYGEN)
2507193149Sdougb
2508193149Sdougb#
2509135446Strhodes# Subroutine for searching for an ordinary file (e.g., a stylesheet)
2510135446Strhodes# in a number of directories:
2511135446Strhodes#
2512135446Strhodes#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2513135446Strhodes#
2514135446Strhodes# If the file FILENAME is found in one of the DIRECTORIES, the shell
2515135446Strhodes# variable VARIABLE is defined to its absolute pathname.  Otherwise, 
2516135446Strhodes# it is set to FILENAME, with no directory prefix (that's not terribly
2517135446Strhodes# useful, but looks less confusing in substitutions than leaving it
2518135446Strhodes# empty).  The variable VARIABLE will be substituted into output files.
2519135446Strhodes# 
2520135446Strhodes
2521135446StrhodesAC_DEFUN(NOM_PATH_FILE, [
2522135446Strhodes$1=""
2523135446StrhodesAC_MSG_CHECKING(for $2)
2524135446Strhodesfor d in $3
2525135446Strhodesdo
2526135446Strhodes	f=$d/$2
2527135446Strhodes	if test -f $f
2528135446Strhodes	then
2529135446Strhodes		$1=$f
2530135446Strhodes		AC_MSG_RESULT($f)
2531135446Strhodes		break
2532135446Strhodes	fi
2533135446Strhodesdone
2534135446Strhodesif test "X[$]$1" = "X"
2535135446Strhodesthen
2536135446Strhodes	AC_MSG_RESULT("not found");
2537135446Strhodes	$1=$2
2538135446Strhodesfi
2539135446StrhodesAC_SUBST($1)
2540135446Strhodes])
2541135446Strhodes
2542135446Strhodes#
2543186462Sdougb# Look for Docbook-XSL stylesheets.  Location probably varies by system.
2544186462Sdougb# If it's not explicitly specified, guess where it might be found, based on
2545186462Sdougb# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2546186462Sdougb# of at the moment).
2547135446Strhodes#
2548186462SdougbAC_MSG_CHECKING(for Docbook-XSL path)
2549186462SdougbAC_ARG_WITH(docbook-xsl,
2550204619Sdougb[  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
2551186462Sdougb   docbook_path="$withval", docbook_path="auto")
2552186462Sdougbcase "$docbook_path" in
2553186462Sdougbauto)
2554186462Sdougb	AC_MSG_RESULT(auto)
2555186462Sdougb	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
2556186462Sdougb	;;
2557186462Sdougb*)
2558186462Sdougb	docbook_xsl_trees="$withval"
2559186462Sdougb    	AC_MSG_RESULT($docbook_xsl_trees)
2560186462Sdougb	;;
2561186462Sdougbesac
2562153816Sdougb
2563135446Strhodes#
2564153816Sdougb# Look for stylesheets we need.
2565153816Sdougb#
2566135446Strhodes
2567186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
2568186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
2569186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
2570186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
2571186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
2572186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
2573186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
2574186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
2575186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
2576153816Sdougb
2577135446Strhodes#
2578153816Sdougb# Same dance for db2latex
2579135446Strhodes#
2580153816Sdougb# No idea where this lives except on FreeBSD.
2581135446Strhodes#
2582135446Strhodes
2583153816Sdougbdb2latex_xsl_trees="/usr/local/share"
2584135446Strhodes
2585135446Strhodes#
2586153816Sdougb# Look for stylesheets we need.
2587135446Strhodes#
2588135446Strhodes
2589153816SdougbNOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
2590135446Strhodes
2591135446Strhodes#
2592153816Sdougb# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
2593153816Sdougb# because it's a directory, so just do the same things, inline.
2594135446Strhodes#
2595135446Strhodes
2596153816SdougbAC_MSG_CHECKING(for db2latex/xsl/figures)
2597153816Sdougbfor d in $db2latex_xsl_trees
2598153816Sdougbdo
2599153816Sdougb	dd=$d/db2latex/xsl/figures
2600153816Sdougb	if test -d $dd
2601153816Sdougb	then
2602153816Sdougb		XSLT_DB2LATEX_ADMONITIONS=$dd
2603153816Sdougb		AC_MSG_RESULT($dd)
2604153816Sdougb		break
2605153816Sdougb	fi
2606153816Sdougbdone
2607153816Sdougbif test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
2608153816Sdougbthen
2609153816Sdougb	AC_MSG_RESULT(not found)
2610153816Sdougb	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
2611153816Sdougbfi
2612153816SdougbAC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
2613135446Strhodes
2614135446Strhodes#
2615170222Sdougb# IDN support
2616170222Sdougb#
2617170222SdougbAC_ARG_WITH(idn,
2618204619Sdougb	[  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
2619170222Sdougb	use_idn="$withval", use_idn="no")
2620170222Sdougbcase "$use_idn" in
2621170222Sdougbyes)
2622170222Sdougb	if test X$prefix = XNONE ; then
2623170222Sdougb		idn_path=/usr/local
2624170222Sdougb	else
2625170222Sdougb		idn_path=$prefix
2626170222Sdougb	fi
2627170222Sdougb	;;
2628170222Sdougbno)
2629170222Sdougb	;;
2630170222Sdougb*)
2631170222Sdougb	idn_path="$use_idn"
2632170222Sdougb	;;
2633170222Sdougbesac
2634170222Sdougb
2635170222Sdougbiconvinc=
2636170222Sdougbiconvlib=
2637170222SdougbAC_ARG_WITH(libiconv,
2638204619Sdougb	[  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
2639170222Sdougb	use_libiconv="$withval", use_libiconv="no")
2640170222Sdougbcase "$use_libiconv" in
2641170222Sdougbyes)
2642170222Sdougb	if test X$prefix = XNONE ; then
2643170222Sdougb		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
2644170222Sdougb	else
2645170222Sdougb		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
2646170222Sdougb	fi
2647170222Sdougb	;;
2648170222Sdougbno)
2649170222Sdougb	iconvlib=
2650170222Sdougb	;;
2651170222Sdougb*)
2652170222Sdougb	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
2653170222Sdougb	;;
2654170222Sdougbesac
2655170222Sdougb
2656170222SdougbAC_ARG_WITH(iconv,
2657204619Sdougb	[  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
2658170222Sdougb	iconvlib="$withval")
2659170222Sdougbcase "$iconvlib" in
2660170222Sdougbno)
2661170222Sdougb	iconvlib=
2662170222Sdougb	;;
2663170222Sdougbyes)
2664170222Sdougb	iconvlib=-liconv
2665170222Sdougb	;;
2666170222Sdougbesac
2667170222Sdougb
2668170222SdougbAC_ARG_WITH(idnlib,
2669204619Sdougb	[  --with-idnlib=ARG       specify libidnkit],
2670170222Sdougb	idnlib="$withval", idnlib="no")
2671170222Sdougbif test "$idnlib" = yes; then
2672170222Sdougb	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
2673170222Sdougbfi
2674170222Sdougb
2675170222SdougbIDNLIBS=
2676170222Sdougbif test "$use_idn" != no; then
2677170222Sdougb	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
2678170222Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
2679170222Sdougb	if test "$idnlib" != no; then
2680170222Sdougb		IDNLIBS="$idnlib $iconvlib"
2681170222Sdougb	else
2682170222Sdougb		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
2683170222Sdougb	fi
2684170222Sdougbfi
2685170222SdougbAC_SUBST(IDNLIBS)
2686170222Sdougb
2687170222SdougbAC_CHECK_HEADERS(locale.h)
2688170222SdougbAC_CHECK_FUNCS(setlocale)
2689170222Sdougb
2690170222Sdougb#
2691135446Strhodes# Substitutions
2692135446Strhodes#
2693135446StrhodesAC_SUBST(BIND9_TOP_BUILDDIR)
2694135446StrhodesBIND9_TOP_BUILDDIR=`pwd`
2695135446Strhodes
2696135446StrhodesAC_SUBST(BIND9_ISC_BUILDINCLUDE)
2697135446StrhodesAC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
2698135446StrhodesAC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
2699135446StrhodesAC_SUBST(BIND9_DNS_BUILDINCLUDE)
2700135446StrhodesAC_SUBST(BIND9_LWRES_BUILDINCLUDE)
2701135446StrhodesAC_SUBST(BIND9_BIND9_BUILDINCLUDE)
2702135446Strhodesif test "X$srcdir" != "X"; then
2703135446Strhodes	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
2704135446Strhodes	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
2705135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
2706135446Strhodes	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
2707135446Strhodes	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
2708135446Strhodes	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
2709135446Strhodeselse
2710135446Strhodes	BIND9_ISC_BUILDINCLUDE=""
2711135446Strhodes	BIND9_ISCCC_BUILDINCLUDE=""
2712135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE=""
2713135446Strhodes	BIND9_DNS_BUILDINCLUDE=""
2714135446Strhodes	BIND9_LWRES_BUILDINCLUDE=""
2715135446Strhodes	BIND9_BIND9_BUILDINCLUDE=""
2716135446Strhodesfi
2717135446Strhodes
2718135446StrhodesAC_SUBST_FILE(BIND9_MAKE_INCLUDES)
2719135446StrhodesBIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2720135446Strhodes
2721135446StrhodesAC_SUBST_FILE(BIND9_MAKE_RULES)
2722135446StrhodesBIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2723135446Strhodes
2724135446Strhodes. $srcdir/version
2725204619SdougbBIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}"
2726135446StrhodesAC_SUBST(BIND9_VERSION)
2727135446Strhodes
2728193149Sdougbif test -z "$ac_configure_args"; then
2729193149Sdougb	BIND9_CONFIGARGS="defaults"
2730193149Sdougbelse
2731193149Sdougb	for a in $ac_configure_args
2732193149Sdougb	do
2733193149Sdougb		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
2734193149Sdougb	done
2735193149Sdougbfi
2736193149SdougbBIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
2737193149SdougbBIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
2738193149SdougbAC_SUBST(BIND9_CONFIGARGS)
2739193149Sdougb
2740135446StrhodesAC_SUBST_FILE(LIBISC_API)
2741135446StrhodesLIBISC_API=$srcdir/lib/isc/api
2742135446Strhodes
2743135446StrhodesAC_SUBST_FILE(LIBISCCC_API)
2744135446StrhodesLIBISCCC_API=$srcdir/lib/isccc/api
2745135446Strhodes
2746135446StrhodesAC_SUBST_FILE(LIBISCCFG_API)
2747135446StrhodesLIBISCCFG_API=$srcdir/lib/isccfg/api
2748135446Strhodes
2749135446StrhodesAC_SUBST_FILE(LIBDNS_API)
2750135446StrhodesLIBDNS_API=$srcdir/lib/dns/api
2751135446Strhodes
2752135446StrhodesAC_SUBST_FILE(LIBBIND9_API)
2753135446StrhodesLIBBIND9_API=$srcdir/lib/bind9/api
2754135446Strhodes
2755135446StrhodesAC_SUBST_FILE(LIBLWRES_API)
2756135446StrhodesLIBLWRES_API=$srcdir/lib/lwres/api
2757135446Strhodes
2758170222Sdougb#
2759170222Sdougb# Configure any DLZ drivers.
2760170222Sdougb#
2761170222Sdougb# If config.dlz.in selects one or more DLZ drivers, it will set
2762170222Sdougb# USE_DLZ to a non-empty value, which will be our clue to
2763170222Sdougb# enable the DLZ core functions.
2764170222Sdougb#
2765170222Sdougb# This section has to come after the libtool stuff because it needs to
2766170222Sdougb# know how to name the driver object files.
2767170222Sdougb#
2768170222Sdougb
2769170222SdougbUSE_DLZ=""
2770170222SdougbDLZ_DRIVER_INCLUDES=""
2771170222SdougbDLZ_DRIVER_LIBS=""
2772170222SdougbDLZ_DRIVER_SRCS=""
2773170222SdougbDLZ_DRIVER_OBJS=""
2774170222Sdougb
2775170222Sdougbsinclude(contrib/dlz/config.dlz.in)
2776170222Sdougb
2777170222SdougbAC_MSG_CHECKING(for DLZ)
2778170222Sdougb
2779170222Sdougbif test -n "$USE_DLZ"
2780170222Sdougbthen
2781170222Sdougb	AC_MSG_RESULT(yes)
2782170222Sdougb	USE_DLZ="-DDLZ $USE_DLZ"
2783170222Sdougb	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
2784170222Sdougb	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
2785170222Sdougbelse
2786170222Sdougb	AC_MSG_RESULT(no)
2787170222Sdougb	DLZ_DRIVER_RULES=/dev/null
2788170222Sdougbfi
2789170222Sdougb
2790170222SdougbAC_SUBST(USE_DLZ)
2791170222SdougbAC_SUBST(DLZ_DRIVER_INCLUDES)
2792170222SdougbAC_SUBST(DLZ_DRIVER_LIBS)
2793170222SdougbAC_SUBST(DLZ_DRIVER_SRCS)
2794170222SdougbAC_SUBST(DLZ_DRIVER_OBJS)
2795170222SdougbAC_SUBST_FILE(DLZ_DRIVER_RULES)
2796170222Sdougb
2797165071Sdougbif test "$cross_compiling" = "yes"; then
2798165071Sdougb	if test -z "$BUILD_CC"; then
2799165071Sdougb		AC_ERROR([BUILD_CC not set])
2800165071Sdougb	fi
2801165071Sdougb	BUILD_CFLAGS="$BUILD_CFLAGS"
2802165071Sdougb	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
2803165071Sdougb	BUILD_LDFLAGS="$BUILD_LDFLAGS"
2804165071Sdougb	BUILD_LIBS="$BUILD_LIBS"
2805165071Sdougbelse
2806165071Sdougb	BUILD_CC="$CC" 
2807165071Sdougb	BUILD_CFLAGS="$CFLAGS" 
2808165071Sdougb	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
2809165071Sdougb	BUILD_LDFLAGS="$LDFLAGS"
2810165071Sdougb	BUILD_LIBS="$LIBS"
2811165071Sdougbfi
2812165071Sdougb
2813193149SdougbNEWFLAGS=""
2814193149Sdougbfor e in $BUILD_LDFLAGS ; do
2815193149Sdougb    case $e in
2816193149Sdougb	-L*)
2817193149Sdougb	    case $host_os in
2818193149Sdougb		netbsd*)
2819193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2820193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2821193149Sdougb		    ;;
2822193149Sdougb		freebsd*)
2823193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2824193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2825193149Sdougb		    ;;
2826193149Sdougb		solaris*)
2827193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2828193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2829193149Sdougb		    ;;
2830193149Sdougb		*)
2831193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2832193149Sdougb		    ;;
2833193149Sdougb		esac
2834193149Sdougb	    ;;
2835193149Sdougb	*)
2836193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2837193149Sdougb	    ;;
2838193149Sdougb    esac
2839193149Sdougbdone
2840193149SdougbBUILD_LDFLAGS="$NEWFLAGS"
2841193149Sdougb
2842193149SdougbNEWFLAGS=""
2843193149Sdougbfor e in $DNS_GSSAPI_LIBS ; do
2844193149Sdougb    case $e in
2845193149Sdougb	-L*)
2846193149Sdougb	    case $host_os in
2847193149Sdougb		netbsd*)
2848193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2849193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2850193149Sdougb		    ;;
2851193149Sdougb		freebsd*)
2852193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2853193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2854193149Sdougb		    ;;
2855193149Sdougb		solaris*)
2856193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2857193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2858193149Sdougb		    ;;
2859193149Sdougb		*)
2860193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2861193149Sdougb		    ;;
2862193149Sdougb		esac
2863193149Sdougb	    ;;
2864193149Sdougb	*)
2865193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2866193149Sdougb	    ;;
2867193149Sdougb    esac
2868193149Sdougbdone
2869193149SdougbDNS_GSSAPI_LIBS="$NEWFLAGS"
2870193149Sdougb
2871193149SdougbNEWFLAGS=""
2872193149Sdougbfor e in $DNS_CRYPTO_LIBS ; do
2873193149Sdougb    case $e in
2874193149Sdougb	-L*)
2875193149Sdougb	    case $host_os in
2876193149Sdougb		netbsd*)
2877193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2878193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2879193149Sdougb		    ;;
2880193149Sdougb		freebsd*)
2881193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2882193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2883193149Sdougb		    ;;
2884193149Sdougb		solaris*)
2885193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2886193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2887193149Sdougb		    ;;
2888193149Sdougb		*)
2889193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2890193149Sdougb		    ;;
2891193149Sdougb		esac
2892193149Sdougb	    ;;
2893193149Sdougb	*)
2894193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2895193149Sdougb	    ;;
2896193149Sdougb    esac
2897193149Sdougbdone
2898193149SdougbDNS_CRYPTO_LIBS="$NEWFLAGS"
2899193149Sdougb
2900165071SdougbAC_SUBST(BUILD_CC)
2901165071SdougbAC_SUBST(BUILD_CFLAGS)
2902165071SdougbAC_SUBST(BUILD_CPPFLAGS)
2903165071SdougbAC_SUBST(BUILD_LDFLAGS)
2904165071SdougbAC_SUBST(BUILD_LIBS)
2905165071Sdougb
2906170222Sdougb#
2907170222Sdougb# Commands to run at the end of config.status.
2908170222Sdougb# Don't just put these into configure, it won't work right if somebody
2909170222Sdougb# runs config.status directly (which autoconf allows).
2910170222Sdougb#
2911170222Sdougb
2912170222SdougbAC_CONFIG_COMMANDS(
2913170222Sdougb	[chmod],
2914193149Sdougb	[chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
2915170222Sdougb
2916170222Sdougb#
2917170222Sdougb# Files to configure.  These are listed here because we used to
2918170222Sdougb# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
2919170222Sdougb# elsewhere if there's a good reason for doing so.
2920170222Sdougb#
2921170222Sdougb
2922170222SdougbAC_CONFIG_FILES([
2923135446Strhodes	Makefile
2924135446Strhodes	make/Makefile
2925135446Strhodes	make/mkdep
2926135446Strhodes	lib/Makefile
2927135446Strhodes	lib/isc/Makefile
2928135446Strhodes	lib/isc/include/Makefile
2929135446Strhodes	lib/isc/include/isc/Makefile
2930135446Strhodes	lib/isc/include/isc/platform.h
2931135446Strhodes	lib/isc/unix/Makefile
2932135446Strhodes	lib/isc/unix/include/Makefile
2933135446Strhodes	lib/isc/unix/include/isc/Makefile
2934135446Strhodes	lib/isc/nls/Makefile
2935135446Strhodes	lib/isc/$thread_dir/Makefile
2936135446Strhodes	lib/isc/$thread_dir/include/Makefile
2937135446Strhodes	lib/isc/$thread_dir/include/isc/Makefile
2938174187Sdougb	lib/isc/$arch/Makefile
2939174187Sdougb	lib/isc/$arch/include/Makefile
2940174187Sdougb	lib/isc/$arch/include/isc/Makefile
2941135446Strhodes	lib/isccc/Makefile
2942135446Strhodes	lib/isccc/include/Makefile
2943135446Strhodes	lib/isccc/include/isccc/Makefile
2944135446Strhodes	lib/isccfg/Makefile
2945135446Strhodes	lib/isccfg/include/Makefile
2946135446Strhodes	lib/isccfg/include/isccfg/Makefile
2947135446Strhodes	lib/dns/Makefile
2948135446Strhodes	lib/dns/include/Makefile
2949135446Strhodes	lib/dns/include/dns/Makefile
2950143731Sdougb	lib/dns/include/dst/Makefile
2951135446Strhodes	lib/bind9/Makefile
2952135446Strhodes	lib/bind9/include/Makefile
2953135446Strhodes	lib/bind9/include/bind9/Makefile
2954135446Strhodes	lib/lwres/Makefile
2955135446Strhodes	lib/lwres/include/Makefile
2956135446Strhodes	lib/lwres/include/lwres/Makefile
2957135446Strhodes	lib/lwres/include/lwres/netdb.h
2958135446Strhodes	lib/lwres/include/lwres/platform.h
2959135446Strhodes	lib/lwres/man/Makefile
2960135446Strhodes	lib/lwres/unix/Makefile
2961135446Strhodes	lib/lwres/unix/include/Makefile
2962135446Strhodes	lib/lwres/unix/include/lwres/Makefile
2963135446Strhodes	lib/tests/Makefile
2964135446Strhodes	lib/tests/include/Makefile
2965135446Strhodes	lib/tests/include/tests/Makefile
2966135446Strhodes	bin/Makefile
2967135446Strhodes	bin/check/Makefile
2968135446Strhodes	bin/named/Makefile
2969135446Strhodes	bin/named/unix/Makefile
2970135446Strhodes	bin/rndc/Makefile
2971135446Strhodes	bin/rndc/unix/Makefile
2972135446Strhodes	bin/dig/Makefile
2973135446Strhodes	bin/nsupdate/Makefile
2974135446Strhodes	bin/tests/Makefile
2975135446Strhodes	bin/tests/names/Makefile
2976135446Strhodes	bin/tests/master/Makefile
2977135446Strhodes	bin/tests/rbt/Makefile
2978135446Strhodes	bin/tests/db/Makefile
2979135446Strhodes	bin/tests/tasks/Makefile
2980135446Strhodes	bin/tests/timers/Makefile
2981135446Strhodes	bin/tests/dst/Makefile
2982135446Strhodes	bin/tests/mem/Makefile
2983135446Strhodes	bin/tests/net/Makefile
2984135446Strhodes	bin/tests/sockaddr/Makefile
2985135446Strhodes	bin/tests/system/Makefile
2986135446Strhodes	bin/tests/system/conf.sh
2987135446Strhodes	bin/tests/system/lwresd/Makefile
2988135446Strhodes	bin/tests/system/tkey/Makefile
2989135446Strhodes	bin/tests/headerdep_test.sh
2990135446Strhodes	bin/dnssec/Makefile
2991135446Strhodes	doc/Makefile
2992135446Strhodes	doc/arm/Makefile
2993135446Strhodes	doc/misc/Makefile
2994170222Sdougb	isc-config.sh
2995153816Sdougb	doc/xsl/Makefile
2996153816Sdougb	doc/xsl/isc-docbook-chunk.xsl
2997153816Sdougb	doc/xsl/isc-docbook-html.xsl
2998153816Sdougb	doc/xsl/isc-docbook-latex.xsl
2999153816Sdougb	doc/xsl/isc-manpage.xsl
3000193149Sdougb	doc/doxygen/Doxyfile
3001193149Sdougb	doc/doxygen/Makefile
3002193149Sdougb	doc/doxygen/doxygen-input-filter
3003170222Sdougb])
3004135446Strhodes
3005170222Sdougb#
3006170222Sdougb# Do it
3007170222Sdougb#
3008170222Sdougb
3009170222SdougbAC_OUTPUT
3010170222Sdougb
3011204619Sdougbif test "X$USE_OPENSSL" = "X"; then
3012204619Sdougbcat << \EOF                                                             
3013204619SdougbBIND is being built without OpenSSL. This means it will not have DNSSEC support.
3014204619SdougbEOF
3015204619Sdougbfi
3016204619Sdougb
3017163976Sdougbif test "X$OPENSSL_WARNING" != "X"; then
3018163976Sdougbcat << \EOF
3019163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3020163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3021163976SdougbWARNING                                                                 WARNING
3022163976SdougbWARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
3023163976SdougbWARNING         one or more of the the following known security         WARNING
3024163976SdougbWARNING         flaws:                                                  WARNING
3025163976SdougbWARNING                                                                 WARNING
3026163976SdougbWARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
3027163976SdougbWARNING         CVE-2006-2940.                                          WARNING
3028163976SdougbWARNING                                                                 WARNING
3029163976SdougbWARNING         It is recommended that you upgrade to OpenSSL           WARNING
3030163976SdougbWARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
3031163976SdougbWARNING                                                                 WARNING
3032163976SdougbWARNING         You can disable this warning by specifying:             WARNING
3033163976SdougbWARNING                                                                 WARNING
3034163976SdougbWARNING               --disable-openssl-version-check          	        WARNING
3035163976SdougbWARNING                                                                 WARNING
3036163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3037163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3038163976SdougbEOF
3039163976Sdougbfi
3040163976Sdougb
3041135446Strhodes# Tell Emacs to edit this file in shell mode.
3042135446Strhodes# Local Variables:
3043135446Strhodes# mode: sh
3044135446Strhodes# End:
3045