configure.in revision 218384
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
21218384SdougbAC_REVISION($Revision: 1.457.26.28 $)
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))
283218384SdougbAC_C_FLEXIBLE_ARRAY_MEMBER
284135446Strhodes
285135446Strhodes#
286135446Strhodes# UnixWare 7.1.1 with the feature supplement to the UDK compiler
287135446Strhodes# is reported to not support "static inline" (RT #1212).
288135446Strhodes#
289135446StrhodesAC_MSG_CHECKING(for static inline breakage)
290135446StrhodesAC_TRY_COMPILE(, [
291135446Strhodes		foo1();
292135446Strhodes	}
293135446Strhodes
294135446Strhodes	static inline int foo1() {
295135446Strhodes		return 0;
296135446Strhodes	}
297135446Strhodes
298135446Strhodes	static inline int foo2() {
299135446Strhodes		return foo1();
300135446Strhodes	],
301135446Strhodes	[AC_MSG_RESULT(no)],
302135446Strhodes	[AC_MSG_RESULT(yes)
303193149Sdougb	 AC_DEFINE(inline, )])
304135446Strhodes
305135446StrhodesAC_TYPE_SIZE_T
306135446StrhodesAC_CHECK_TYPE(ssize_t, int)
307153816SdougbAC_CHECK_TYPE(uintptr_t,unsigned long)
308143731SdougbAC_CHECK_TYPE(socklen_t,
309143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
310143731Sdougb[
311143731SdougbAC_TRY_COMPILE(
312143731Sdougb[
313143731Sdougb#include <sys/types.h>
314143731Sdougb#include <sys/socket.h>
315143731Sdougbint getsockname(int, struct sockaddr *, size_t *);
316143731Sdougb],[],
317143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
318143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
319143731Sdougb],
320143731Sdougb[
321143731Sdougb#include <sys/types.h>
322143731Sdougb#include <sys/socket.h>
323143731Sdougb])
324143731SdougbAC_SUBST(ISC_SOCKADDR_LEN_T)
325135446StrhodesAC_HEADER_TIME
326135446StrhodesAC_MSG_CHECKING(for long long)
327135446StrhodesAC_TRY_COMPILE([],[long long i = 0; return (0);],
328135446Strhodes	[AC_MSG_RESULT(yes)
329135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
330135446Strhodes	[AC_MSG_RESULT(no)
331135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
332135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELONGLONG)
333135446Strhodes
334135446Strhodes#
335135446Strhodes# check if we have lifconf
336135446Strhodes#
337135446StrhodesAC_MSG_CHECKING(for struct lifconf)
338135446StrhodesAC_TRY_COMPILE([
339135446Strhodes#include <sys/types.h>
340135446Strhodes#include <sys/socket.h>
341135446Strhodes#include <net/if.h>
342135446Strhodes],
343135446Strhodes[
344135446Strhodesstruct lifconf lifconf;
345135446Strhodeslifconf.lifc_len = 0;
346135446Strhodes]
347135446Strhodes,
348135446Strhodes	[AC_MSG_RESULT(yes)
349135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
350135446Strhodes	[AC_MSG_RESULT(no)
351135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
352135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELIFCONF)
353135446Strhodes
354186462Sdougb#
355186462Sdougb# check if we have kqueue
356186462Sdougb#
357186462SdougbAC_ARG_ENABLE(kqueue,
358186462Sdougb	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
359186462Sdougb	      want_kqueue="$enableval",  want_kqueue="yes")
360186462Sdougbcase $want_kqueue in
361186462Sdougbyes)
362186462Sdougb	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
363186462Sdougb	case $ac_cv_have_kqueue in
364186462Sdougb	yes)
365186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
366186462Sdougb		;;
367186462Sdougb	*)
368186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
369186462Sdougb		;;
370186462Sdougb	esac
371186462Sdougb	;;
372186462Sdougb*)
373186462Sdougb	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
374186462Sdougb	;;
375186462Sdougbesac
376186462SdougbAC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
377135446Strhodes
378135446Strhodes#
379186462Sdougb# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
380186462Sdougb# so we need to try running the code, not just test its existence.
381186462Sdougb#
382186462SdougbAC_ARG_ENABLE(epoll,
383193149Sdougb[  --enable-epoll          use Linux epoll when available [[default=auto]]],
384193149Sdougb	      want_epoll="$enableval",  want_epoll="auto")
385186462Sdougbcase $want_epoll in
386193149Sdougbauto)
387186462Sdougb	AC_MSG_CHECKING(epoll support)
388186462Sdougb	AC_TRY_RUN([
389186462Sdougb#include <sys/epoll.h>
390186462Sdougbint main() {
391186462Sdougb	if (epoll_create(1) < 0)
392186462Sdougb		return (1);
393186462Sdougb	return (0);
394186462Sdougb}
395186462Sdougb],
396186462Sdougb	[AC_MSG_RESULT(yes)
397186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
398186462Sdougb	[AC_MSG_RESULT(no)
399186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
400186462Sdougb	;;
401193149Sdougbyes)
402193149Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
403193149Sdougb	;;
404186462Sdougb*)
405186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
406186462Sdougb	;;
407186462Sdougbesac
408186462SdougbAC_SUBST(ISC_PLATFORM_HAVEEPOLL)
409186462Sdougb
410186462Sdougb#
411186462Sdougb# check if we support /dev/poll
412186462Sdougb#
413186462SdougbAC_ARG_ENABLE(devpoll,
414186462Sdougb	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
415186462Sdougb	      want_devpoll="$enableval",  want_devpoll="yes")
416186462Sdougbcase $want_devpoll in
417186462Sdougbyes)
418218384Sdougb	AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
419186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
420186462Sdougb	,
421186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
422186462Sdougb	)
423186462Sdougb	;;
424186462Sdougb*)
425186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
426186462Sdougb	;;
427186462Sdougbesac
428186462SdougbAC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
429186462Sdougb
430186462Sdougb#
431135446Strhodes# check if we need to #include sys/select.h explicitly
432135446Strhodes#
433135446Strhodescase $ac_cv_header_unistd_h in
434135446Strhodesyes)
435135446StrhodesAC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
436135446StrhodesAC_TRY_COMPILE([
437135446Strhodes#include <sys/types.h> /* Ultrix */
438135446Strhodes#include <unistd.h>],
439135446Strhodes[fd_set read_set; return (0);],
440135446Strhodes	[AC_MSG_RESULT(yes)
441135446Strhodes	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
442135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
443135446Strhodes	[AC_MSG_RESULT(no)
444135446Strhodes	case $ac_cv_header_sys_select_h in
445135446Strhodes	yes)
446193149Sdougb	 ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
447135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
448135446Strhodes		;;
449135446Strhodes	no)
450135446Strhodes		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
451135446Strhodes		;;
452135446Strhodes	esac
453135446Strhodes	])
454135446Strhodes	;;
455135446Strhodesno)
456135446Strhodes	case $ac_cv_header_sys_select_h in
457135446Strhodes	yes)
458193149Sdougb	     ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
459135446Strhodes	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
460135446Strhodes		;;
461135446Strhodes	no)
462135446Strhodes		AC_MSG_ERROR([need either unistd.h or sys/select.h])
463135446Strhodes		;;
464135446Strhodes	esac
465135446Strhodes	;;
466135446Strhodesesac
467135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
468135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
469135446Strhodes
470135446Strhodes#
471135446Strhodes# Find the machine's endian flavor.
472135446Strhodes#
473135446StrhodesAC_C_BIGENDIAN
474135446Strhodes
475170222Sdougb
476135446Strhodes#
477135446Strhodes# was --with-openssl specified?
478135446Strhodes#
479163976SdougbOPENSSL_WARNING=
480135446StrhodesAC_MSG_CHECKING(for OpenSSL library)
481135446StrhodesAC_ARG_WITH(openssl,
482204619Sdougb[  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
483193149Sdougb			  (Required for DNSSEC)],
484135446Strhodes    use_openssl="$withval", use_openssl="auto")
485135446Strhodes
486165071Sdougbopenssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
487143731Sdougbif test "$use_openssl" = "auto"
488143731Sdougbthen
489143731Sdougb	for d in $openssldirs
490143731Sdougb	do
491143731Sdougb		if test -f $d/include/openssl/opensslv.h
492143731Sdougb		then
493143731Sdougb			use_openssl=$d
494143731Sdougb			break
495143731Sdougb		fi
496143731Sdougb	done
497143731Sdougbfi
498135446Strhodescase "$use_openssl" in
499135446Strhodes	no)
500135446Strhodes		AC_MSG_RESULT(no)
501135446Strhodes		DST_OPENSSL_INC=""
502135446Strhodes		USE_OPENSSL=""
503218384Sdougb		OPENSSLLINKOBJS=""
504218384Sdougb		OPENSSLLINKSRCS=""
505135446Strhodes		;;
506143731Sdougb	auto)
507143731Sdougb		DST_OPENSSL_INC=""
508143731Sdougb		USE_OPENSSL=""
509218384Sdougb		OPENSSLLINKOBJS=""
510218384Sdougb		OPENSSLLINKSRCS=""
511204619Sdougb		AC_MSG_ERROR(
512204619Sdougb[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
513204619SdougbIf you don't want OpenSSL, use --without-openssl])
514143731Sdougb		;;
515135446Strhodes	*)
516143731Sdougb		if test "$use_openssl" = "yes"
517135446Strhodes		then
518193149Sdougb			# User did not specify a path - guess it
519135446Strhodes			for d in $openssldirs
520135446Strhodes			do
521135446Strhodes				if test -f $d/include/openssl/opensslv.h
522135446Strhodes				then
523193149Sdougb					use_openssl=$d
524135446Strhodes					break
525135446Strhodes				fi
526135446Strhodes			done
527135446Strhodes			if test "$use_openssl" = "yes"
528135446Strhodes			then
529193149Sdougb				AC_MSG_RESULT(not found)
530135446Strhodes				AC_MSG_ERROR(
531135446Strhodes[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
532135446Strhodes			fi
533193149Sdougb		elif ! test -f "$use_openssl"/include/openssl/opensslv.h
534193149Sdougb		then
535193149Sdougb			AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
536135446Strhodes		fi
537135446Strhodes		USE_OPENSSL='-DOPENSSL'
538135446Strhodes		if test "$use_openssl" = "/usr"
539135446Strhodes		then
540135446Strhodes			DST_OPENSSL_INC=""
541135446Strhodes			DNS_OPENSSL_LIBS="-lcrypto"
542135446Strhodes		else
543135446Strhodes			DST_OPENSSL_INC="-I$use_openssl/include"
544135446Strhodes			case $host in
545135446Strhodes			*-solaris*)
546135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
547135446Strhodes				;;
548165071Sdougb			*-hp-hpux*)
549165071Sdougb				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
550165071Sdougb				;;
551174187Sdougb			*-apple-darwin*)
552174187Sdougb				#
553174187Sdougb				# Apple's ld seaches for serially for dynamic
554174187Sdougb				# then static libraries.  This means you can't
555174187Sdougb				# use -L to override dynamic system libraries
556174187Sdougb				# with static ones when linking.  Instead
557174187Sdougb				# we specify a absolute path.
558174187Sdougb				#
559174187Sdougb				if test -f "$use_openssl/lib/libcrypto.dylib"
560174187Sdougb				then
561174187Sdougb					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
562174187Sdougb				else
563174187Sdougb					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
564174187Sdougb				fi
565174187Sdougb				;;
566135446Strhodes			*)
567135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
568135446Strhodes				;;
569135446Strhodes			esac
570135446Strhodes		fi
571193149Sdougb		AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
572135446Strhodes
573135446Strhodes		saved_cflags="$CFLAGS"
574135446Strhodes		saved_libs="$LIBS"
575135446Strhodes		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
576135446Strhodes		LIBS="$LIBS $DNS_OPENSSL_LIBS"
577135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL works)
578135446Strhodes		AC_TRY_RUN([
579135446Strhodes#include <openssl/err.h>
580135446Strhodesint main() {
581135446Strhodes	ERR_clear_error();
582135446Strhodes	return (0);
583135446Strhodes}
584135446Strhodes],
585193149Sdougb		[AC_MSG_RESULT(yes)],
586135446Strhodes		[AC_MSG_RESULT(no)
587135446Strhodes		 AC_MSG_ERROR(Could not run test program using OpenSSL from
588135446Strhodes$use_openssl/lib and $use_openssl/include.
589135446StrhodesPlease check the argument to --with-openssl and your
590135446Strhodesshared library configuration (e.g., LD_LIBRARY_PATH).)],
591135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
592135446Strhodes
593135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
594135446Strhodes		AC_TRY_LINK([
595135446Strhodes#include <openssl/err.h>],
596135446Strhodes[ DSO_METHOD_dlfcn(); ],
597135446Strhodes		[AC_MSG_RESULT(no)],
598135446Strhodes		[LIBS="$LIBS -ldl"
599135446Strhodes		AC_TRY_LINK([
600135446Strhodes#include <openssl/err.h>
601135446Strhodes],[ DSO_METHOD_dlfcn(); ],
602135446Strhodes		[AC_MSG_RESULT(yes)
603135446Strhodes		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
604135446Strhodes		],
605135446Strhodes		 [AC_MSG_RESULT(unknown)
606135446Strhodes		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
607135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
608135446Strhodes		],
609135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)]
610135446Strhodes		)
611135446Strhodes		 
612163976SdougbAC_ARG_ENABLE(openssl-version-check,
613163976Sdougb[AC_HELP_STRING([--enable-openssl-version-check],
614193149Sdougb	[Check OpenSSL Version @<:@default=yes@:>@])])
615163976Sdougbcase "$enable_openssl_version_check" in
616163976Sdougbyes|'')
617135446Strhodes		AC_MSG_CHECKING(OpenSSL library version)
618135446Strhodes		AC_TRY_RUN([
619135446Strhodes#include <stdio.h>
620135446Strhodes#include <openssl/opensslv.h>
621135446Strhodesint main() {
622193149Sdougb	if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
623165071Sdougb	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
624165071Sdougb	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
625193149Sdougb		return (0);
626135446Strhodes	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
627135446Strhodes		OPENSSL_VERSION_NUMBER);
628163976Sdougb	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
629163976Sdougb	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
630193149Sdougb	return (1);
631135446Strhodes}
632163976Sdougb		],
633193149Sdougb		[AC_MSG_RESULT(ok)],
634135446Strhodes		[AC_MSG_RESULT(not compatible)
635193149Sdougb		 OPENSSL_WARNING=yes
636163976Sdougb		],
637135446Strhodes		[AC_MSG_RESULT(assuming target platform has compatible version)])
638163976Sdougb;;
639163976Sdougbno)
640163976Sdougb	AC_MSG_RESULT(Skipped OpenSSL version check)
641163976Sdougb;;
642163976Sdougbesac
643163976Sdougb
644135446Strhodes		AC_MSG_CHECKING(for OpenSSL DSA support)
645135446Strhodes		if test -f $use_openssl/include/openssl/dsa.h
646135446Strhodes		then
647135446Strhodes			AC_DEFINE(HAVE_OPENSSL_DSA)
648135446Strhodes			AC_MSG_RESULT(yes)
649135446Strhodes		else
650135446Strhodes			AC_MSG_RESULT(no)
651135446Strhodes		fi
652204619Sdougb		AC_CHECK_FUNCS(EVP_sha256 EVP_sha512)
653135446Strhodes		CFLAGS="$saved_cflags"
654135446Strhodes		LIBS="$saved_libs"
655218384Sdougb		OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
656218384Sdougb		OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
657204619Sdougb
658135446Strhodes		;;
659135446Strhodesesac
660135446Strhodes
661135446Strhodes#
662135446Strhodes# This would include the system openssl path (and linker options to use
663135446Strhodes# it as needed) if it is found.
664135446Strhodes#
665135446Strhodes
666135446StrhodesAC_SUBST(USE_OPENSSL)
667135446StrhodesAC_SUBST(DST_OPENSSL_INC)
668218384SdougbAC_SUBST(OPENSSLLINKOBJS)
669218384SdougbAC_SUBST(OPENSSLLINKSRCS)
670135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
671135446Strhodes
672135446Strhodes#
673193149Sdougb# PKCS11 (aka crypto hardware) support
674135446Strhodes#
675193149Sdougb# This works only with the right OpenSSL with PKCS11 engine!
676135446Strhodes#
677135446Strhodes
678193149SdougbAC_MSG_CHECKING(for PKCS11 support)
679193149SdougbAC_ARG_WITH(pkcs11,
680204619Sdougb[  --with-pkcs11           Build with PKCS11 support],
681193149Sdougb   use_pkcs11="yes", use_pkcs11="no")
682135446Strhodes
683193149Sdougbcase "$use_pkcs11" in
684193149Sdougb	no)
685193149Sdougb		AC_MSG_RESULT(disabled)
686193149Sdougb		USE_PKCS11=""
687193149Sdougb		;;
688193149Sdougb	yes)
689193149Sdougb		AC_MSG_RESULT(using OpenSSL with PKCS11 support)
690193149Sdougb		USE_PKCS11='-DUSE_PKCS11'
691193149Sdougb		;;
692193149Sdougbesac
693193149Sdougb
694193149SdougbAC_SUBST(USE_PKCS11)
695193149Sdougb
696193149SdougbAC_MSG_CHECKING(for GSSAPI library)
697193149SdougbAC_ARG_WITH(gssapi,
698204619Sdougb[  --with-gssapi=PATH      Specify path for system-supplied GSSAPI],
699193149Sdougb    use_gssapi="$withval", use_gssapi="no")
700193149Sdougb
701193149Sdougbgssapidirs="/usr/local /usr/pkg /usr/kerberos /usr"
702193149Sdougbif test "$use_gssapi" = "yes"
703193149Sdougbthen
704193149Sdougb	for d in $gssapidirs
705193149Sdougb	do
706193149Sdougb		if test -f $d/include/gssapi/gssapi.h -o -f $d/include/gssapi.h
707193149Sdougb		then
708193149Sdougb			use_gssapi=$d
709193149Sdougb			break
710193149Sdougb		fi
711193149Sdougb	done
712193149Sdougbfi
713193149Sdougb
714193149Sdougbcase "$use_gssapi" in
715193149Sdougb	no)
716193149Sdougb		AC_MSG_RESULT(disabled)
717193149Sdougb		USE_GSSAPI=''
718193149Sdougb		;;
719193149Sdougb	yes)
720193149Sdougb		AC_MSG_ERROR([--with-gssapi must specify a path])
721193149Sdougb		;;
722193149Sdougb	*)
723193149Sdougb		AC_MSG_RESULT(looking in $use_gssapi/lib)
724193149Sdougb		USE_GSSAPI='-DGSSAPI'
725193149Sdougb		saved_cppflags="$CPPFLAGS"
726193149Sdougb		CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
727193149Sdougb		AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
728193149Sdougb		    [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
729193149Sdougb
730193149Sdougb		if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
731193149Sdougb		    AC_MSG_ERROR([gssapi.h not found])
732193149Sdougb		fi
733193149Sdougb
734218384Sdougb		AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
735218384Sdougb		    [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
736218384Sdougb
737218384Sdougb		if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
738218384Sdougb		    AC_MSG_ERROR([krb5.h not found])
739218384Sdougb		fi
740218384Sdougb
741193149Sdougb		CPPFLAGS="$saved_cppflags"
742193149Sdougb
743193149Sdougb		#
744193149Sdougb		# XXXDCL This probably doesn't work right on all systems.
745193149Sdougb		# It will need to be worked on as problems become evident.
746193149Sdougb		#
747193149Sdougb		# Essentially the problems here relate to two different
748193149Sdougb		# areas.  The first area is building with either KTH
749193149Sdougb		# or MIT Kerberos, particularly when both are present on
750193149Sdougb		# the machine.  The other is static versus dynamic linking.
751193149Sdougb		#
752193149Sdougb		# On the KTH vs MIT issue, Both have libkrb5 that can mess
753193149Sdougb		# up the works if one implementation ends up trying to
754193149Sdougb		# use the other's krb.  This is unfortunately a situation
755193149Sdougb		# that very easily arises.
756193149Sdougb		#
757193149Sdougb		# Dynamic linking when the dependency information is built
758193149Sdougb		# into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
759193149Sdougb		# all such problems go away, but when that setup is not
760193149Sdougb		# present, because either the dynamic libraries lack
761193149Sdougb		# dependencies or static linking is being done, then the
762193149Sdougb		# problems start to show up.
763193149Sdougb		saved_libs="$LIBS"
764193149Sdougb		for TRY_LIBS in \
765193149Sdougb		    "-lgssapi_krb5" \
766193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
767193149Sdougb		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
768193149Sdougb		    "-lgssapi" \
769193149Sdougb		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
770193149Sdougb		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
771218384Sdougb		    "-lgss -lkrb5"
772193149Sdougb		do
773193149Sdougb		    # Note that this does not include $saved_libs, because
774193149Sdougb		    # on FreeBSD machines this configure script has added
775193149Sdougb		    # -L/usr/local/lib to LIBS, which can make the
776193149Sdougb		    # -lgssapi_krb5 test succeed with shared libraries even
777193149Sdougb		    # when you are trying to build with KTH in /usr/lib.
778193149Sdougb		    LIBS="-L$use_gssapi/lib $TRY_LIBS"
779193149Sdougb		    AC_MSG_CHECKING(linking as $TRY_LIBS)
780218384Sdougb		    AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
781193149Sdougb				gssapi_linked=yes, gssapi_linked=no)
782193149Sdougb		    case $gssapi_linked in
783193149Sdougb		    yes) AC_MSG_RESULT(yes); break ;;
784193149Sdougb		    no)  AC_MSG_RESULT(no) ;;
785193149Sdougb		    esac
786193149Sdougb		done
787193149Sdougb
788193149Sdougb		case $gssapi_linked in
789193149Sdougb		no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
790193149Sdougb		esac
791193149Sdougb
792193149Sdougb		#
793193149Sdougb		# XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
794193149Sdougb		# but MIT in /usr/local/lib and trying to build with KTH.
795193149Sdougb		# /usr/local/lib can end up earlier on the link lines.
796193149Sdougb		# Like most kludges, this one is not only inelegant it
797193149Sdougb		# is also likely to be the wrong thing to do at least as
798193149Sdougb		# many times as it is the right thing.  Something better
799193149Sdougb		# needs to be done.
800193149Sdougb		#
801193149Sdougb		if test "$use_gssapi" = "/usr" -a \
802193149Sdougb			-f /usr/local/lib/libkrb5.a; then
803193149Sdougb		    FIX_KTH_VS_MIT=yes
804193149Sdougb		fi
805193149Sdougb
806193149Sdougb		case "$FIX_KTH_VS_MIT" in
807193149Sdougb		yes)
808193149Sdougb		    case "$enable_static_linking" in
809193149Sdougb		    yes) gssapi_lib_suffix=".a"  ;;
810193149Sdougb		    *)   gssapi_lib_suffix=".so" ;;
811193149Sdougb		    esac
812193149Sdougb
813193149Sdougb		    for lib in $LIBS; do
814193149Sdougb			case $lib in
815193149Sdougb			-L*)
816193149Sdougb			    ;;
817193149Sdougb			-l*)
818193149Sdougb			    new_lib=`echo $lib |
819193149Sdougb				     sed -e s%^-l%$use_gssapi/lib/lib% \
820193149Sdougb					 -e s%$%$gssapi_lib_suffix%`
821193149Sdougb			    NEW_LIBS="$NEW_LIBS $new_lib"
822193149Sdougb			    ;;
823193149Sdougb			*)
824193149Sdougb			   AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
825193149Sdougb			    ;;
826193149Sdougb			esac
827193149Sdougb		    done
828193149Sdougb		    LIBS="$NEW_LIBS"
829193149Sdougb		    ;;
830193149Sdougb		esac
831193149Sdougb
832193149Sdougb		DST_GSSAPI_INC="-I$use_gssapi/include"
833193149Sdougb		DNS_GSSAPI_LIBS="$LIBS"
834193149Sdougb
835193149Sdougb		AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
836193149Sdougb		LIBS="$saved_libs"
837193149Sdougb		;;
838193149Sdougbesac
839193149Sdougb
840193149SdougbAC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
841193149SdougbAC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
842218384SdougbAC_SUBST(ISC_PLATFORM_KRB5HEADER)
843193149Sdougb
844135446StrhodesAC_SUBST(USE_GSSAPI)
845135446StrhodesAC_SUBST(DST_GSSAPI_INC)
846193149SdougbAC_SUBST(DNS_GSSAPI_LIBS)
847193149SdougbDNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
848135446Strhodes
849135446Strhodes#
850135446Strhodes# Applications linking with libdns also need to link with these libraries.
851135446Strhodes#
852135446Strhodes
853135446StrhodesAC_SUBST(DNS_CRYPTO_LIBS)
854135446Strhodes
855135446Strhodes#
856135446Strhodes# was --with-randomdev specified?
857135446Strhodes#
858135446StrhodesAC_MSG_CHECKING(for random device)
859135446StrhodesAC_ARG_WITH(randomdev,
860204619Sdougb[  --with-randomdev=PATH   Specify path for random device],
861135446Strhodes    use_randomdev="$withval", use_randomdev="unspec")
862135446Strhodes
863135446Strhodescase "$use_randomdev" in
864135446Strhodes	unspec)
865135446Strhodes		case "$host" in
866135446Strhodes			*-openbsd*)
867135446Strhodes				devrandom=/dev/arandom
868135446Strhodes				;;
869135446Strhodes			*)
870135446Strhodes				devrandom=/dev/random
871135446Strhodes				;;
872135446Strhodes		esac
873135446Strhodes		AC_MSG_RESULT($devrandom)
874135446Strhodes		AC_CHECK_FILE($devrandom,
875135446Strhodes			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
876135446Strhodes						 "$devrandom"),)
877135446Strhodes		;;
878135446Strhodes	yes)
879135446Strhodes		AC_MSG_ERROR([--with-randomdev must specify a path])
880135446Strhodes		;;
881135446Strhodes	no)
882135446Strhodes		AC_MSG_RESULT(disabled)
883135446Strhodes		;;
884135446Strhodes	*)
885135446Strhodes		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
886135446Strhodes		AC_MSG_RESULT(using "$use_randomdev")
887135446Strhodes		;;
888135446Strhodesesac
889135446Strhodes
890135446Strhodes#
891135446Strhodes# Do we have arc4random() ?
892135446Strhodes#
893135446StrhodesAC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
894135446Strhodes
895153816Sdougbsinclude(config.threads.in)dnl
896135446Strhodes
897135446Strhodesif $use_threads
898135446Strhodesthen
899165071Sdougb	if test "X$GCC" = "Xyes"; then
900165071Sdougb		case "$host" in
901165071Sdougb		*-freebsd*)
902165071Sdougb			CC="$CC -pthread"
903165071Sdougb			CCOPT="$CCOPT -pthread"
904165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
905165071Sdougb			;;
906165071Sdougb		*-openbsd*)
907165071Sdougb			CC="$CC -pthread"
908165071Sdougb			CCOPT="$CCOPT -pthread"
909165071Sdougb			;;
910165071Sdougb		*-solaris*)
911165071Sdougb			LIBS="$LIBS -lthread"
912165071Sdougb			;;
913165071Sdougb		*-ibm-aix*)
914165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
915165071Sdougb			;;
916165071Sdougb		esac
917165071Sdougb	else
918165071Sdougb		case $host in
919165071Sdougb		*-dec-osf*)
920165071Sdougb			CC="$CC -pthread"
921165071Sdougb			CCOPT="$CCOPT -pthread"
922165071Sdougb			;;
923165071Sdougb		*-solaris*)
924165071Sdougb			CC="$CC -mt"
925165071Sdougb			CCOPT="$CCOPT -mt"
926165071Sdougb			;;
927165071Sdougb		*-ibm-aix*)
928165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
929165071Sdougb			;;
930165071Sdougb		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
931165071Sdougb			CC="$CC -Kthread"
932165071Sdougb			CCOPT="$CCOPT -Kthread"
933165071Sdougb			;;
934165071Sdougb		*-*-sysv*OpenUNIX*)
935165071Sdougb			CC="$CC -Kpthread"
936165071Sdougb			CCOPT="$CCOPT -Kpthread"
937165071Sdougb			;;
938165071Sdougb		esac
939165071Sdougb	fi
940165071Sdougb	ALWAYS_DEFINES="-D_REENTRANT"
941165071Sdougb	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
942218384Sdougb	THREADOPTOBJS='${THREADOPTOBJS}'
943218384Sdougb	THREADOPTSRCS='${THREADOPTSRCS}'
944165071Sdougb	thread_dir=pthreads
945135446Strhodes	#
946135446Strhodes	# We'd like to use sigwait() too
947135446Strhodes	#
948165071Sdougb	AC_CHECK_FUNC(sigwait,
949165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
950165071Sdougb		      AC_CHECK_LIB(c, sigwait,
951165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
952165071Sdougb		      AC_CHECK_LIB(pthread, sigwait,
953165071Sdougb				   AC_DEFINE(HAVE_SIGWAIT),
954165071Sdougb				   AC_CHECK_LIB(pthread, _Psigwait,
955193149Sdougb						AC_DEFINE(HAVE_SIGWAIT),))))
956135446Strhodes
957135446Strhodes	AC_CHECK_FUNC(pthread_attr_getstacksize,
958135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
959135446Strhodes
960135446Strhodes	AC_CHECK_FUNC(pthread_attr_setstacksize,
961135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
962135446Strhodes
963135446Strhodes	#
964135446Strhodes	# Additional OS-specific issues related to pthreads and sigwait.
965135446Strhodes	#
966135446Strhodes	case "$host" in
967135446Strhodes		#
968135446Strhodes		# One more place to look for sigwait.
969135446Strhodes		#
970135446Strhodes		*-freebsd*)
971135446Strhodes			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
972143731Sdougb			case $host in
973153816Sdougb			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
974153816Sdougb			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
975143731Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
976143731Sdougb				;;
977153816Sdougb			*-freebsd6.*)
978153816Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
979153816Sdougb				;;
980143731Sdougb			esac
981135446Strhodes			;;
982135446Strhodes		#
983135446Strhodes		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
984135446Strhodes		# called before certain pthreads calls.	 This is deprecated
985135446Strhodes		# in BSD/OS 4.1.
986135446Strhodes		#
987135446Strhodes		*-bsdi3.*|*-bsdi4.0*)
988135446Strhodes			AC_DEFINE(NEED_PTHREAD_INIT)
989135446Strhodes			;;
990135446Strhodes		#
991135446Strhodes		# LinuxThreads requires some changes to the way we
992135446Strhodes		# deal with signals.
993135446Strhodes		#
994135446Strhodes		*-linux*)
995135446Strhodes			AC_DEFINE(HAVE_LINUXTHREADS)
996135446Strhodes			;;
997135446Strhodes		#
998135446Strhodes		# Ensure the right sigwait() semantics on Solaris and make
999135446Strhodes		# sure we call pthread_setconcurrency.
1000135446Strhodes		#
1001135446Strhodes		*-solaris*)
1002135446Strhodes			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1003135446Strhodes			AC_CHECK_FUNC(pthread_setconcurrency,
1004135446Strhodes				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1005135446Strhodes			;;
1006135446Strhodes		#
1007135446Strhodes		# UnixWare does things its own way.
1008135446Strhodes		#
1009135446Strhodes		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1010135446Strhodes			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1011135446Strhodes			;;
1012135446Strhodes	esac
1013135446Strhodes
1014135446Strhodes	#
1015135446Strhodes	# Look for sysconf to allow detection of the number of processors.
1016135446Strhodes	#
1017135446Strhodes	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1018135446Strhodes
1019135446Strhodeselse
1020135446Strhodes	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1021135446Strhodes	thread_dir=nothreads
1022218384Sdougb	THREADOPTOBJS=""
1023218384Sdougb	THREADOPTSRCS=""
1024135446Strhodes	ALWAYS_DEFINES=""
1025135446Strhodesfi
1026135446Strhodes
1027135446StrhodesAC_SUBST(ALWAYS_DEFINES)
1028135446StrhodesAC_SUBST(ISC_PLATFORM_USETHREADS)
1029218384SdougbAC_SUBST(THREADOPTOBJS)
1030218384SdougbAC_SUBST(THREADOPTSRCS)
1031135446StrhodesISC_THREAD_DIR=$thread_dir
1032135446StrhodesAC_SUBST(ISC_THREAD_DIR)
1033135446Strhodes
1034135446Strhodes#
1035193149Sdougb# was --with-libxml2 specified?
1036193149Sdougb#
1037193149SdougbAC_MSG_CHECKING(for libxml2 library)
1038193149SdougbAC_ARG_WITH(libxml2,
1039204619Sdougb[  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1040193149Sdougb    use_libxml2="$withval", use_libxml2="auto")
1041193149Sdougb
1042193149Sdougbcase "$use_libxml2" in
1043193149Sdougb	no)
1044193149Sdougb		DST_LIBXML2_INC=""
1045193149Sdougb		;;
1046193149Sdougb	auto|yes)
1047193149Sdougb		case X`(xml2-config --version) 2>/dev/null` in
1048193149Sdougb		X2.[[67]].*)
1049193149Sdougb			libxml2_libs=`xml2-config --libs`
1050193149Sdougb			libxml2_cflags=`xml2-config --cflags`
1051193149Sdougb			;;
1052193149Sdougb		*)
1053193149Sdougb			libxml2_libs=
1054193149Sdougb			libxml2_cflags=
1055193149Sdougb			;;
1056193149Sdougb		esac
1057193149Sdougb		;;
1058193149Sdougb	*)
1059193149Sdougb		if test -f "$use_libxml2/bin/xml2-config" ; then
1060193149Sdougb			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1061193149Sdougb			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1062193149Sdougb		fi
1063193149Sdougb		;;
1064193149Sdougbesac
1065193149Sdougb
1066193149Sdougbif test "X$libxml2_libs" != "X"
1067193149Sdougbthen
1068193149Sdougb	AC_MSG_RESULT(yes)
1069193149Sdougb	CFLAGS="$CFLAGS $libxml2_cflags"
1070193149Sdougb	LIBS="$LIBS $libxml2_libs"
1071193149Sdougb	AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1072193149Sdougbelse
1073193149Sdougb	AC_MSG_RESULT(no)
1074193149Sdougbfi
1075193149Sdougb
1076193149Sdougb#
1077135446Strhodes# In solaris 10, SMF can manage named service
1078135446Strhodes#
1079135446StrhodesAC_CHECK_LIB(scf, smf_enable_instance)
1080135446Strhodes
1081135446Strhodes#
1082135446Strhodes# flockfile is usually provided by pthreads, but we may want to use it
1083135446Strhodes# even if compiled with --disable-threads.  getc_unlocked might also not
1084135446Strhodes# be defined.
1085135446Strhodes#
1086135446StrhodesAC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1087135446StrhodesAC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1088135446Strhodes
1089135446Strhodes# 
1090135446Strhodes# Indicate what the final decision was regarding threads.
1091135446Strhodes#
1092135446StrhodesAC_MSG_CHECKING(whether to build with threads)
1093135446Strhodesif $use_threads; then
1094135446Strhodes	AC_MSG_RESULT(yes)
1095135446Strhodeselse
1096135446Strhodes	AC_MSG_RESULT(no)
1097135446Strhodesfi
1098135446Strhodes
1099135446Strhodes# 
1100135446Strhodes# End of pthreads stuff.
1101135446Strhodes#
1102135446Strhodes
1103135446Strhodes#
1104135446Strhodes# Large File
1105135446Strhodes#
1106135446StrhodesAC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
1107135446Strhodes	      want_largefile="yes", want_largefile="no")
1108135446Strhodescase $want_largefile in
1109135446Strhodes	yes)
1110135446Strhodes		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1111135446Strhodes		;;
1112135446Strhodes	*)
1113135446Strhodes		;;
1114135446Strhodesesac
1115135446Strhodes
1116135446Strhodes#
1117135446Strhodes# Additional compiler settings.
1118135446Strhodes#
1119135446StrhodesMKDEPCC="$CC"
1120135446StrhodesMKDEPCFLAGS="-M"
1121135446StrhodesIRIX_DNSSEC_WARNINGS_HACK=""
1122135446Strhodes
1123135446Strhodesif test "X$GCC" = "Xyes"; then
1124165071Sdougb	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1125165071Sdougb	SAVE_CFLAGS=$CFLAGS
1126218384Sdougb	CFLAGS="$CFLAGS -fno-strict-aliasing"
1127165071Sdougb	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1128165071Sdougb	CFLAGS=$SAVE_CFLAGS
1129165071Sdougb	if test "$FNOSTRICTALIASING" = "yes"; then
1130165071Sdougb		AC_MSG_RESULT(yes)
1131165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
1132165071Sdougb	else
1133165071Sdougb		AC_MSG_RESULT(no)
1134165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1135165071Sdougb	fi
1136143731Sdougb	case "$host" in
1137143731Sdougb	*-hp-hpux*)
1138153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1139143731Sdougb		;;
1140143731Sdougb	esac
1141135446Strhodeselse
1142135446Strhodes	case $host in
1143135446Strhodes	*-dec-osf*)
1144135446Strhodes		CC="$CC -std"
1145135446Strhodes		CCOPT="$CCOPT -std"
1146135446Strhodes		MKDEPCC="$CC"
1147135446Strhodes		;;
1148135446Strhodes	*-hp-hpux*)
1149135446Strhodes		CC="$CC -Ae -z"
1150135446Strhodes		# The version of the C compiler that constantly warns about
1151193149Sdougb		# 'const' as well as alignment issues is unfortunately not
1152193149Sdougb		# able to be discerned via the version of the operating
1153193149Sdougb		# system, nor does cc have a version flag.
1154135446Strhodes		case "`$CC +W 123 2>&1`" in
1155135446Strhodes		*Unknown?option*)
1156135446Strhodes			STD_CWARNINGS="+w1"
1157135446Strhodes			;;
1158135446Strhodes		*)
1159135446Strhodes			# Turn off the pointlessly noisy warnings.
1160153816Sdougb			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1161135446Strhodes			;;
1162135446Strhodes		esac
1163135446Strhodes		CCOPT="$CCOPT -Ae -z"
1164153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
1165135446Strhodes		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1166135446Strhodes		;;
1167135446Strhodes	*-sgi-irix*)
1168135446Strhodes		STD_CWARNINGS="-fullwarn -woff 1209"
1169135446Strhodes		#
1170135446Strhodes		# Silence more than 250 instances of
1171135446Strhodes		#   "prototyped function redeclared without prototype"
1172135446Strhodes		# and 11 instances of
1173135446Strhodes		#   "variable ... was set but never used"
1174135446Strhodes		# from lib/dns/sec/openssl.
1175135446Strhodes		#
1176135446Strhodes		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1177135446Strhodes		;;
1178135446Strhodes	*-solaris*)
1179135446Strhodes		MKDEPCFLAGS="-xM"
1180135446Strhodes		;;
1181135446Strhodes	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1182193149Sdougb		# UnixWare
1183135446Strhodes		CC="$CC -w"
1184135446Strhodes		;;
1185135446Strhodes	esac
1186135446Strhodesfi
1187135446Strhodes
1188135446StrhodesAC_SUBST(MKDEPCC)
1189135446StrhodesAC_SUBST(MKDEPCFLAGS)
1190135446StrhodesAC_SUBST(MKDEPPROG)
1191135446StrhodesAC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1192135446Strhodes
1193135446Strhodes#
1194135446Strhodes# NLS
1195135446Strhodes#
1196135446StrhodesAC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1197135446Strhodes
1198135446Strhodes#
1199135446Strhodes# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1200135446Strhodes#
1201135446Strhodes# AC_CHECK_LIB(xnet, socket, ,
1202135446Strhodes#    AC_CHECK_LIB(socket, socket)
1203135446Strhodes# )
1204135446Strhodes#
1205135446Strhodes# Use this for now, instead:
1206135446Strhodes#
1207135446Strhodescase "$host" in
1208135446Strhodes	mips-sgi-irix*)
1209135446Strhodes		;;
1210193149Sdougb	*-linux*)
1211193149Sdougb		;;
1212135446Strhodes	*)
1213135446Strhodes		AC_CHECK_LIB(socket, socket)
1214193149Sdougb		AC_CHECK_LIB(nsl, inet_addr)
1215135446Strhodes		;;
1216135446Strhodesesac
1217135446Strhodes
1218135446Strhodes#
1219186462Sdougb# Work around Solaris's select() limitations.
1220186462Sdougb#
1221186462Sdougbcase "$host" in
1222186462Sdougb	*-solaris2.[[89]]|*-solaris2.1?)
1223186462Sdougb	AC_DEFINE(FD_SETSIZE, 65536,
1224186462Sdougb		  [Solaris hack to get select_large_fdset.])
1225186462Sdougb	;;
1226186462Sdougbesac
1227186462Sdougb
1228186462Sdougb#
1229135446Strhodes# Purify support
1230135446Strhodes#
1231135446StrhodesAC_MSG_CHECKING(whether to use purify)
1232135446StrhodesAC_ARG_WITH(purify,
1233204619Sdougb	[  --with-purify[=PATH]      use Rational purify],
1234135446Strhodes	use_purify="$withval", use_purify="no")
1235135446Strhodes
1236135446Strhodescase "$use_purify" in
1237135446Strhodes	no)
1238135446Strhodes		;;
1239135446Strhodes	yes)
1240135446Strhodes		AC_PATH_PROG(purify_path, purify, purify)
1241135446Strhodes		;;
1242135446Strhodes	*)
1243135446Strhodes		purify_path="$use_purify"
1244135446Strhodes		;;
1245135446Strhodesesac
1246135446Strhodes
1247135446Strhodescase "$use_purify" in
1248135446Strhodes	no)
1249135446Strhodes		AC_MSG_RESULT(no)
1250135446Strhodes		PURIFY=""
1251135446Strhodes		;;
1252135446Strhodes	*)
1253135446Strhodes		if test -f $purify_path || test $purify_path = purify; then
1254135446Strhodes			AC_MSG_RESULT($purify_path)
1255135446Strhodes			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1256135446Strhodes			PURIFY="$purify_path $PURIFYFLAGS"
1257135446Strhodes		else
1258135446Strhodes			AC_MSG_ERROR([$purify_path not found.
1259135446Strhodes
1260135446StrhodesPlease choose the proper path with the following command:
1261135446Strhodes
1262135446Strhodes    configure --with-purify=PATH
1263135446Strhodes])
1264135446Strhodes		fi
1265135446Strhodes		;;
1266135446Strhodesesac
1267135446Strhodes
1268135446StrhodesAC_SUBST(PURIFY)
1269135446Strhodes
1270186462Sdougb
1271135446StrhodesAC_ARG_WITH(libtool,
1272204619Sdougb	    [  --with-libtool          use GNU libtool],
1273135446Strhodes	    use_libtool="$withval", use_libtool="no")
1274135446Strhodes
1275135446Strhodescase $use_libtool in
1276135446Strhodes	yes)
1277135446Strhodes		AM_PROG_LIBTOOL
1278135446Strhodes		O=lo
1279135446Strhodes		A=la
1280135446Strhodes		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1281135446Strhodes		LIBTOOL_MODE_COMPILE='--mode=compile'
1282135446Strhodes		LIBTOOL_MODE_INSTALL='--mode=install'
1283135446Strhodes		LIBTOOL_MODE_LINK='--mode=link'
1284143731Sdougb		case "$host" in
1285143731Sdougb		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1286143731Sdougb		esac
1287143731Sdougb		case "$host" in
1288143731Sdougb		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1289143731Sdougb		*) LIBTOOL_IN_MAIN= ;;
1290143731Sdougb		esac;
1291135446Strhodes		;;
1292135446Strhodes	*)
1293135446Strhodes		O=o
1294135446Strhodes		A=a
1295135446Strhodes		LIBTOOL=
1296135446Strhodes		AC_SUBST(LIBTOOL)
1297135446Strhodes		LIBTOOL_MKDEP_SED=
1298135446Strhodes		LIBTOOL_MODE_COMPILE=
1299135446Strhodes		LIBTOOL_MODE_INSTALL=
1300135446Strhodes		LIBTOOL_MODE_LINK=
1301143731Sdougb		LIBTOOL_ALLOW_UNDEFINED=
1302143731Sdougb		LIBTOOL_IN_MAIN=
1303135446Strhodes		;;
1304135446Strhodesesac
1305135446Strhodes
1306135446Strhodes#
1307135446Strhodes# File name extension for static archive files, for those few places
1308135446Strhodes# where they are treated differently from dynamic ones.
1309135446Strhodes#
1310135446StrhodesSA=a
1311135446Strhodes
1312135446StrhodesAC_SUBST(O)
1313135446StrhodesAC_SUBST(A)
1314135446StrhodesAC_SUBST(SA)
1315135446StrhodesAC_SUBST(LIBTOOL_MKDEP_SED)
1316135446StrhodesAC_SUBST(LIBTOOL_MODE_COMPILE)
1317135446StrhodesAC_SUBST(LIBTOOL_MODE_INSTALL)
1318135446StrhodesAC_SUBST(LIBTOOL_MODE_LINK)
1319143731SdougbAC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1320143731SdougbAC_SUBST(LIBTOOL_IN_MAIN)
1321135446Strhodes
1322135446Strhodes#
1323135446Strhodes# Here begins a very long section to determine the system's networking
1324193149Sdougb# capabilities.  The order of the tests is significant.
1325135446Strhodes#
1326135446Strhodes
1327135446Strhodes#
1328135446Strhodes# IPv6
1329135446Strhodes#
1330135446StrhodesAC_ARG_ENABLE(ipv6,
1331204619Sdougb	[  --enable-ipv6           use IPv6 [default=autodetect]])
1332135446Strhodes
1333135446Strhodescase "$enable_ipv6" in
1334135446Strhodes	yes|''|autodetect)
1335135446Strhodes		AC_DEFINE(WANT_IPV6)
1336135446Strhodes		;;
1337135446Strhodes	no)
1338135446Strhodes		;;
1339135446Strhodesesac
1340135446Strhodes
1341135446Strhodes#
1342135446Strhodes# We do the IPv6 compilation checking after libtool so that we can put
1343135446Strhodes# the right suffix on the files.
1344135446Strhodes#
1345135446StrhodesAC_MSG_CHECKING(for IPv6 structures)
1346135446StrhodesAC_TRY_COMPILE([
1347135446Strhodes#include <sys/types.h>
1348135446Strhodes#include <sys/socket.h>
1349135446Strhodes#include <netinet/in.h>],
1350135446Strhodes[struct sockaddr_in6 sin6; return (0);],
1351135446Strhodes	[AC_MSG_RESULT(yes)
1352135446Strhodes	 found_ipv6=yes],
1353135446Strhodes	[AC_MSG_RESULT(no)
1354135446Strhodes	 found_ipv6=no])
1355135446Strhodes
1356135446Strhodes#
1357135446Strhodes# See whether IPv6 support is provided via a Kame add-on.
1358135446Strhodes# This is done before other IPv6 linking tests to LIBS is properly set.
1359135446Strhodes#
1360135446StrhodesAC_MSG_CHECKING(for Kame IPv6 support)
1361135446StrhodesAC_ARG_WITH(kame,
1362204619Sdougb	[  --with-kame[=PATH]	  use Kame IPv6 [default path /usr/local/v6]],
1363135446Strhodes	use_kame="$withval", use_kame="no")
1364135446Strhodes
1365135446Strhodescase "$use_kame" in
1366135446Strhodes	no)
1367135446Strhodes		;;
1368135446Strhodes	yes)
1369135446Strhodes		kame_path=/usr/local/v6
1370135446Strhodes		;;
1371135446Strhodes	*)
1372135446Strhodes		kame_path="$use_kame"
1373135446Strhodes		;;
1374135446Strhodesesac
1375135446Strhodes
1376135446Strhodescase "$use_kame" in
1377135446Strhodes	no)
1378135446Strhodes		AC_MSG_RESULT(no)
1379135446Strhodes		;;
1380135446Strhodes	*)
1381135446Strhodes		if test -f $kame_path/lib/libinet6.a; then
1382135446Strhodes			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1383135446Strhodes			LIBS="-L$kame_path/lib -linet6 $LIBS"
1384135446Strhodes		else
1385135446Strhodes			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1386135446Strhodes
1387135446StrhodesPlease choose the proper path with the following command:
1388135446Strhodes
1389135446Strhodes    configure --with-kame=PATH
1390135446Strhodes])
1391135446Strhodes		fi
1392135446Strhodes		;;
1393135446Strhodesesac
1394135446Strhodes
1395135446Strhodes#
1396135446Strhodes# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1397135446Strhodes# Including it on Kame-using platforms is very bad, though, because
1398135446Strhodes# Kame uses #error against direct inclusion.   So include it on only
1399135446Strhodes# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1400135446Strhodes# This is done before the in6_pktinfo check because that's what
1401135446Strhodes# netinet6/in6.h is needed for.
1402135446Strhodes#
1403135446Strhodeschangequote({, })
1404135446Strhodescase "$host" in
1405135446Strhodes*-bsdi4.[01]*)
1406135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1407135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1408135446Strhodes	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1409135446Strhodes	;;
1410135446Strhodes*)
1411135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1412135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1413135446Strhodes	isc_netinet6in6_hack=""
1414135446Strhodes	;;
1415135446Strhodesesac
1416135446Strhodeschangequote([, ])
1417135446Strhodes
1418135446Strhodes#
1419135446Strhodes# This is similar to the netinet6/in6.h issue.
1420135446Strhodes#
1421135446Strhodescase "$host" in
1422135446Strhodes*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1423193149Sdougb	# UnixWare
1424135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1425135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1426193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1427135446Strhodes	isc_netinetin6_hack="#include <netinet/in6.h>"
1428135446Strhodes	;;
1429135446Strhodes*)
1430135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1431135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1432193149Sdougb	ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1433135446Strhodes	isc_netinetin6_hack=""
1434135446Strhodes	;;
1435135446Strhodesesac
1436135446Strhodes
1437135446Strhodes#
1438135446Strhodes# Now delve deeper into the suitability of the IPv6 support.
1439135446Strhodes#
1440135446Strhodescase "$found_ipv6" in
1441135446Strhodes	yes)
1442135446Strhodes		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1443135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1444135446Strhodes
1445135446Strhodes		AC_MSG_CHECKING(for in6_addr)
1446135446Strhodes		AC_TRY_COMPILE([
1447135446Strhodes#include <sys/types.h>
1448135446Strhodes#include <sys/socket.h>
1449135446Strhodes#include <netinet/in.h>
1450135446Strhodes$isc_netinetin6_hack
1451135446Strhodes$isc_netinet6in6_hack
1452135446Strhodes],
1453135446Strhodes[struct in6_addr in6; return (0);],
1454135446Strhodes		[AC_MSG_RESULT(yes)
1455135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1456135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1457135446Strhodes		 isc_in_addr6_hack=""],
1458135446Strhodes		[AC_MSG_RESULT(no)
1459135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1460135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1461135446Strhodes		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1462135446Strhodes
1463135446Strhodes		AC_MSG_CHECKING(for in6addr_any)
1464135446Strhodes		AC_TRY_LINK([
1465135446Strhodes#include <sys/types.h>
1466135446Strhodes#include <sys/socket.h>
1467135446Strhodes#include <netinet/in.h>
1468135446Strhodes$isc_netinetin6_hack
1469135446Strhodes$isc_netinet6in6_hack
1470135446Strhodes$isc_in_addr6_hack
1471135446Strhodes],
1472135446Strhodes		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1473135446Strhodes			[AC_MSG_RESULT(yes)
1474135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1475135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1476135446Strhodes			[AC_MSG_RESULT(no)
1477135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1478135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1479135446Strhodes
1480135446Strhodes		AC_MSG_CHECKING(for in6addr_loopback)
1481135446Strhodes		AC_TRY_LINK([
1482135446Strhodes#include <sys/types.h>
1483135446Strhodes#include <sys/socket.h>
1484135446Strhodes#include <netinet/in.h>
1485135446Strhodes$isc_netinetin6_hack
1486135446Strhodes$isc_netinet6in6_hack
1487135446Strhodes$isc_in_addr6_hack
1488135446Strhodes],
1489135446Strhodes		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1490135446Strhodes			[AC_MSG_RESULT(yes)
1491135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1492135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1493135446Strhodes			[AC_MSG_RESULT(no)
1494135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1495135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1496135446Strhodes
1497135446Strhodes		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1498135446Strhodes		AC_TRY_COMPILE([
1499135446Strhodes#include <sys/types.h>
1500135446Strhodes#include <sys/socket.h>
1501135446Strhodes#include <netinet/in.h>
1502135446Strhodes$isc_netinetin6_hack
1503135446Strhodes$isc_netinet6in6_hack
1504135446Strhodes],
1505135446Strhodes		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1506135446Strhodes			[AC_MSG_RESULT(yes)
1507135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1508135446Strhodes			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1509135446Strhodes			[AC_MSG_RESULT(no)
1510135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1511135446Strhodes			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1512135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1513135446Strhodes
1514135446Strhodes		AC_MSG_CHECKING(for in6_pktinfo)
1515135446Strhodes		AC_TRY_COMPILE([
1516135446Strhodes#include <sys/types.h>
1517135446Strhodes#include <sys/socket.h>
1518135446Strhodes#include <netinet/in.h>
1519135446Strhodes$isc_netinetin6_hack
1520135446Strhodes$isc_netinet6in6_hack
1521135446Strhodes],
1522135446Strhodes		[struct in6_pktinfo xyzzy; return (0);],
1523135446Strhodes			[AC_MSG_RESULT(yes)
1524135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1525135446Strhodes			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1526135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1527135446Strhodes		;;
1528135446Strhodes	no)
1529135446Strhodes		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1530135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1531135446Strhodes		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1532135446Strhodes		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1533135446Strhodes		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1534135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1535135446Strhodes		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1536135446Strhodes		ISC_IPV6_H="ipv6.h"
1537135446Strhodes		ISC_IPV6_O="ipv6.$O"
1538135446Strhodes		ISC_ISCIPV6_O="unix/ipv6.$O"
1539135446Strhodes		ISC_IPV6_C="ipv6.c"
1540135446Strhodes		;;
1541135446Strhodesesac
1542135446Strhodes
1543135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIPV6)
1544135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1545135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1546135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1547135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1548135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1549135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1550135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1551135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1552135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1553135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1554135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1555135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1556135446StrhodesAC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1557135446StrhodesAC_SUBST(ISC_IPV6_H)
1558135446StrhodesAC_SUBST(ISC_IPV6_O)
1559135446StrhodesAC_SUBST(ISC_ISCIPV6_O)
1560135446StrhodesAC_SUBST(ISC_IPV6_C)
1561135446StrhodesAC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1562135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1563135446Strhodes
1564135446StrhodesAC_MSG_CHECKING([for struct if_laddrreq])
1565135446StrhodesAC_TRY_LINK([
1566135446Strhodes#include <sys/types.h>
1567135446Strhodes#include <net/if6.h>
1568135446Strhodes],[ struct if_laddrreq a; ],
1569135446Strhodes	[AC_MSG_RESULT(yes)
1570135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1571135446Strhodes	[AC_MSG_RESULT(no)
1572135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1573135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1574135446Strhodes
1575135446StrhodesAC_MSG_CHECKING([for struct if_laddrconf])
1576135446StrhodesAC_TRY_LINK([
1577135446Strhodes#include <sys/types.h>
1578135446Strhodes#include <net/if6.h>
1579135446Strhodes],[ struct if_laddrconf a; ],
1580135446Strhodes	[AC_MSG_RESULT(yes)
1581135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1582135446Strhodes	[AC_MSG_RESULT(no)
1583135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1584135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1585135446Strhodes
1586135446Strhodes#
1587135446Strhodes# Check for network functions that are often missing.  We do this
1588135446Strhodes# after the libtool checking, so we can put the right suffix on
1589135446Strhodes# the files.  It also needs to come after checking for a Kame add-on,
1590135446Strhodes# which provides some (all?) of the desired functions.
1591135446Strhodes#
1592135446Strhodes
1593135446StrhodesAC_MSG_CHECKING([for inet_ntop with IPv6 support])
1594135446StrhodesAC_TRY_RUN([
1595135446Strhodes#include <sys/types.h>
1596135446Strhodes#include <sys/socket.h>
1597135446Strhodes#include <netinet/in.h>
1598135446Strhodes#include <arpa/inet.h>
1599135446Strhodesmain() {
1600135446Strhodeschar a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1601193149Sdougb	[AC_MSG_RESULT(yes)
1602193149Sdougb	ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1603135446Strhodes
1604193149Sdougb	[AC_MSG_RESULT(no)
1605193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1606193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1607193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1608193149Sdougb	[AC_MSG_RESULT(assuming inet_ntop needed)
1609193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1610193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1611193149Sdougb	ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
1612135446Strhodes
1613135446Strhodes
1614135446Strhodes# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1615135446Strhodes# addresses with less than four octets, like "1.2.3".  Also leading
1616135446Strhodes# zeros should also be rejected.
1617135446Strhodes
1618135446StrhodesAC_MSG_CHECKING([for working inet_pton with IPv6 support])
1619135446StrhodesAC_TRY_RUN([
1620135446Strhodes#include <sys/types.h>
1621135446Strhodes#include <sys/socket.h>
1622135446Strhodes#include <netinet/in.h>
1623135446Strhodes#include <arpa/inet.h>
1624135446Strhodesmain() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1625135446Strhodes			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1626135446Strhodes			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1627193149Sdougb	[AC_MSG_RESULT(yes)
1628193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1629193149Sdougb	[AC_MSG_RESULT(no)
1630193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1631193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1632193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1633135446Strhodes	[AC_MSG_RESULT(assuming target platform has working inet_pton)
1634153816Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1635193149Sdougb	[AC_MSG_RESULT(assuming inet_pton needed)
1636193149Sdougb	ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1637193149Sdougb	ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1638193149Sdougb	ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1639193149Sdougb	[AC_MSG_RESULT(assuming target platform has working inet_pton)
1640193149Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"])
1641135446Strhodes
1642135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNTOP)
1643135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPTON)
1644135446Strhodes
1645135446Strhodes#
1646135446Strhodes# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1647135446Strhodes#
1648135446Strhodescase "$host" in
1649135446Strhodes	*-dec-osf*)
1650135446Strhodes		# Turn on 4.4BSD style sa_len support.
1651135446Strhodes		AC_DEFINE(_SOCKADDR_LEN)
1652135446Strhodes		;;
1653135446Strhodesesac
1654135446Strhodes
1655135446StrhodesAC_MSG_CHECKING(for sa_len in struct sockaddr)
1656135446StrhodesAC_TRY_COMPILE([
1657135446Strhodes#include <sys/types.h>
1658135446Strhodes#include <sys/socket.h>],
1659135446Strhodes[struct sockaddr sa; sa.sa_len = 0; return (0);],
1660135446Strhodes	[AC_MSG_RESULT(yes)
1661135446Strhodes	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1662135446Strhodes	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1663135446Strhodes	[AC_MSG_RESULT(no)
1664135446Strhodes	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1665135446Strhodes	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1666135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESALEN)
1667135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVESALEN)
1668135446Strhodes
1669135446Strhodes#
1670135446Strhodes# Look for a 4.4BSD or 4.3BSD struct msghdr
1671135446Strhodes#
1672135446StrhodesAC_MSG_CHECKING(for struct msghdr flavor)
1673135446StrhodesAC_TRY_COMPILE([
1674135446Strhodes#include <sys/types.h>
1675135446Strhodes#include <sys/socket.h>],
1676135446Strhodes[struct msghdr msg; msg.msg_flags = 0; return (0);],
1677135446Strhodes	[AC_MSG_RESULT(4.4BSD)
1678135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1679135446Strhodes	[AC_MSG_RESULT(4.3BSD)
1680135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1681135446StrhodesAC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1682135446Strhodes
1683135446Strhodes#
1684135446Strhodes# Look for in_port_t.
1685135446Strhodes#
1686135446StrhodesAC_MSG_CHECKING(for type in_port_t)
1687135446StrhodesAC_TRY_COMPILE([
1688135446Strhodes#include <sys/types.h>
1689135446Strhodes#include <netinet/in.h>],
1690135446Strhodes[in_port_t port = 25; return (0);],
1691135446Strhodes	[AC_MSG_RESULT(yes)
1692135446Strhodes	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1693193149Sdougb	[AC_MSG_RESULT(no)
1694135446Strhodes	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1695135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPORTT)
1696135446Strhodes
1697135446Strhodes#
1698135446Strhodes# Check for addrinfo
1699135446Strhodes#
1700135446StrhodesAC_MSG_CHECKING(for struct addrinfo)
1701135446StrhodesAC_TRY_COMPILE([
1702135446Strhodes#include <netdb.h>],
1703135446Strhodes[struct addrinfo a; return (0);],
1704135446Strhodes	[AC_MSG_RESULT(yes)
1705135446Strhodes	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
1706135446Strhodes	AC_DEFINE(HAVE_ADDRINFO)],
1707135446Strhodes	[AC_MSG_RESULT(no)
1708135446Strhodes	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
1709135446StrhodesAC_SUBST(ISC_LWRES_NEEDADDRINFO)
1710135446Strhodes
1711135446Strhodes#
1712135446Strhodes# Check for rrsetinfo
1713135446Strhodes#
1714135446StrhodesAC_MSG_CHECKING(for struct rrsetinfo)
1715135446StrhodesAC_TRY_COMPILE([
1716135446Strhodes#include <netdb.h>],
1717135446Strhodes[struct rrsetinfo r; return (0);],
1718135446Strhodes	[AC_MSG_RESULT(yes)
1719135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
1720135446Strhodes	[AC_MSG_RESULT(no)
1721135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
1722135446StrhodesAC_SUBST(ISC_LWRES_NEEDRRSETINFO)
1723135446Strhodes
1724135446StrhodesAC_MSG_CHECKING(for int sethostent)
1725135446StrhodesAC_TRY_COMPILE([
1726135446Strhodes#include <netdb.h>],
1727135446Strhodes[int i = sethostent(0); return(0);],
1728135446Strhodes	[AC_MSG_RESULT(yes)
1729135446Strhodes	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
1730135446Strhodes	[AC_MSG_RESULT(no)
1731135446Strhodes	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
1732135446StrhodesAC_SUBST(ISC_LWRES_SETHOSTENTINT)
1733135446Strhodes
1734135446StrhodesAC_MSG_CHECKING(for int endhostent)
1735135446StrhodesAC_TRY_COMPILE([
1736135446Strhodes#include <netdb.h>],
1737135446Strhodes[int i = endhostent(); return(0);],
1738135446Strhodes	[AC_MSG_RESULT(yes)
1739135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1740135446Strhodes	[AC_MSG_RESULT(no)
1741135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1742135446StrhodesAC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1743135446Strhodes
1744135446StrhodesAC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
1745135446StrhodesAC_TRY_COMPILE([
1746135446Strhodes#include <netdb.h>
1747135446Strhodesstruct netent *getnetbyaddr(in_addr_t, int);],
1748135446Strhodes[],
1749135446Strhodes	[AC_MSG_RESULT(yes)
1750135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
1751135446Strhodes	[AC_MSG_RESULT(no)
1752135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
1753135446StrhodesAC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
1754135446Strhodes
1755135446StrhodesAC_MSG_CHECKING(for int setnetent)
1756135446StrhodesAC_TRY_COMPILE([
1757135446Strhodes#include <netdb.h>],
1758135446Strhodes[int i = setnetent(0); return(0);],
1759135446Strhodes	[AC_MSG_RESULT(yes)
1760135446Strhodes	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1761135446Strhodes	[AC_MSG_RESULT(no)
1762135446Strhodes	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1763135446StrhodesAC_SUBST(ISC_LWRES_SETNETENTINT)
1764135446Strhodes
1765135446StrhodesAC_MSG_CHECKING(for int endnetent)
1766135446StrhodesAC_TRY_COMPILE([
1767135446Strhodes#include <netdb.h>],
1768135446Strhodes[int i = endnetent(); return(0);],
1769135446Strhodes	[AC_MSG_RESULT(yes)
1770135446Strhodes	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1771135446Strhodes	[AC_MSG_RESULT(no)
1772135446Strhodes	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1773135446StrhodesAC_SUBST(ISC_LWRES_ENDNETENTINT)
1774135446Strhodes
1775135446StrhodesAC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1776135446StrhodesAC_TRY_COMPILE([
1777135446Strhodes#include <netdb.h>
1778135446Strhodesstruct hostent *gethostbyaddr(const void *, size_t, int);],
1779135446Strhodes[return(0);],
1780135446Strhodes	[AC_MSG_RESULT(yes)
1781135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1782135446Strhodes	[AC_MSG_RESULT(no)
1783135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1784135446StrhodesAC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1785135446Strhodes
1786135446StrhodesAC_MSG_CHECKING(for h_errno in netdb.h)
1787135446StrhodesAC_TRY_COMPILE([
1788135446Strhodes#include <netdb.h>],
1789135446Strhodes[h_errno = 1; return(0);],
1790135446Strhodes	[AC_MSG_RESULT(yes)
1791135446Strhodes	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1792135446Strhodes	[AC_MSG_RESULT(no)
1793135446Strhodes	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1794135446StrhodesAC_SUBST(ISC_LWRES_NEEDHERRNO)
1795135446Strhodes
1796135446StrhodesAC_CHECK_FUNC(getipnodebyname,
1797193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1798193149Sdougb	[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1799135446StrhodesAC_CHECK_FUNC(getnameinfo,
1800193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1801193149Sdougb	[ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1802135446StrhodesAC_CHECK_FUNC(getaddrinfo,
1803193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1804135446Strhodes	AC_DEFINE(HAVE_GETADDRINFO)],
1805193149Sdougb	[ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1806135446StrhodesAC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1807135446StrhodesAC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1808135446StrhodesAC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1809135446StrhodesAC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1810135446Strhodes
1811135446StrhodesAC_ARG_ENABLE(getifaddrs,
1812204619Sdougb[  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
1813135446Strhodes    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1814135446Strhodes
1815193149Sdougb#
1816193149Sdougb# This interface iteration code for getifaddrs() will fall back to using
1817193149Sdougb# /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
1818193149Sdougb# addresses.
1819193149Sdougb# 
1820135446Strhodescase $want_getifaddrs in
1821193149Sdougbglibc)
1822193149SdougbAC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
1823193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1824135446Strhodes;;
1825193149Sdougbyes)
1826193149SdougbAC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1827193149Sdougb;;
1828135446Strhodesno)
1829135446Strhodes;;
1830135446Strhodesesac
1831135446Strhodes
1832135446Strhodes#
1833135446Strhodes# Look for a sysctl call to get the list of network interfaces.
1834135446Strhodes#
1835135446Strhodescase $ac_cv_header_sys_sysctl_h in
1836135446Strhodesyes)
1837135446StrhodesAC_MSG_CHECKING(for interface list sysctl)
1838135446StrhodesAC_EGREP_CPP(found_rt_iflist, [
1839135446Strhodes#include <sys/param.h>
1840135446Strhodes#include <sys/sysctl.h>
1841135446Strhodes#include <sys/socket.h>
1842135446Strhodes#ifdef NET_RT_IFLIST
1843135446Strhodesfound_rt_iflist
1844135446Strhodes#endif
1845135446Strhodes],
1846135446Strhodes	[AC_MSG_RESULT(yes)
1847135446Strhodes	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1848135446Strhodes	[AC_MSG_RESULT(no)])
1849135446Strhodes;;
1850135446Strhodesesac
1851135446Strhodes
1852135446Strhodes#
1853135446Strhodes# Check for some other useful functions that are not ever-present.
1854135446Strhodes#
1855135446Strhodes
1856135446Strhodes# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
1857135446Strhodes# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
1858135446Strhodes# reportedly defines strsep() without declaring it in <string.h> when
1859135446Strhodes# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
1860135446Strhodes# AC_CHECK_FUNC() incorrectly succeeds because it declares
1861135446Strhodes# the function itself.
1862135446StrhodesAC_MSG_CHECKING(for correctly declared strsep())
1863135446StrhodesAC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
1864135446Strhodes	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1865135446Strhodes	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1866135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1867135446Strhodes
1868135446StrhodesAC_CHECK_FUNC(memmove,
1869135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
1870135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
1871135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
1872135446Strhodes
1873135446StrhodesAC_CHECK_FUNC(strtoul,
1874153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
1875165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
1876153816Sdougb	 GENRANDOMLIB=""],
1877153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
1878165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
1879165071Sdougb	 GENRANDOMLIB='${ISCLIBS}'])
1880135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
1881153816SdougbAC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
1882153816SdougbAC_SUBST(GENRANDOMLIB)
1883135446Strhodes
1884135446StrhodesAC_CHECK_FUNC(strlcpy,
1885135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
1886135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
1887135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
1888135446Strhodes
1889135446StrhodesAC_CHECK_FUNC(strlcat,
1890135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
1891135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
1892135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
1893135446Strhodes
1894135446StrhodesISC_PRINT_OBJS=
1895135446StrhodesISC_PRINT_SRCS=
1896135446StrhodesAC_MSG_CHECKING(sprintf)
1897135446StrhodesAC_TRY_COMPILE([
1898135446Strhodes#include <stdio.h>
1899135446Strhodes],
1900135446Strhodes[ char buf[2]; return(*sprintf(buf,"x"));],
1901135446Strhodes[
1902135446StrhodesISC_PRINT_OBJS="print.$O"
1903135446StrhodesISC_PRINT_SRCS="print.c"
1904135446StrhodesISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
1905135446StrhodesLWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
1906135446Strhodes],
1907135446Strhodes[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
1908135446Strhodes LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
1909135446Strhodes)
1910135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
1911135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
1912135446Strhodes
1913135446StrhodesAC_CHECK_FUNC(vsnprintf,
1914135446Strhodes	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
1915135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
1916135446Strhodes	[ISC_PRINT_OBJS="print.$O"
1917135446Strhodes	 ISC_PRINT_SRCS="print.c"
1918135446Strhodes	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
1919135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
1920135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1921135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
1922135446StrhodesISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
1923135446StrhodesISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
1924135446Strhodes
1925135446StrhodesAC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
1926135446Strhodes
1927135446StrhodesAC_SUBST(ISC_EXTRA_OBJS)
1928135446StrhodesAC_SUBST(ISC_EXTRA_SRCS)
1929135446Strhodes
1930193149Sdougb#
1931193149Sdougb# Use our own SPNEGO implementation?
1932193149Sdougb#
1933193149SdougbAC_ARG_ENABLE(isc-spnego,
1934204619Sdougb	[  --disable-isc-spnego    use SPNEGO from GSSAPI library])
1935193149Sdougb
1936193149Sdougbif test -n "$USE_GSSAPI"
1937193149Sdougbthen
1938193149Sdougb	case "$enable_isc_spnego" in
1939193149Sdougb		yes|'')
1940193149Sdougb			USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
1941193149Sdougb			DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
1942193149Sdougb			DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
1943193149Sdougb			AC_MSG_RESULT(using SPNEGO from lib/dns)
1944193149Sdougb			;;
1945193149Sdougb		no)
1946193149Sdougb			AC_MSG_RESULT(using SPNEGO from GSSAPI library)
1947193149Sdougb			;;
1948193149Sdougb	esac
1949193149Sdougbfi
1950193149Sdougb
1951193149SdougbAC_SUBST(USE_ISC_SPNEGO)
1952193149Sdougb
1953193149SdougbAC_SUBST(DST_EXTRA_OBJS)
1954193149SdougbAC_SUBST(DST_EXTRA_SRCS)
1955193149Sdougb
1956135446Strhodes# Determine the printf format characters to use when printing
1957135446Strhodes# values of type isc_int64_t. This will normally be "ll", but where
1958135446Strhodes# the compiler treats "long long" as a alias for "long" and printf
1959135446Strhodes# doesn't know about "long long" use "l".  Hopefully the sprintf
1960193149Sdougb# will produce a inconsistent result in the later case.  If the compiler
1961135446Strhodes# fails due to seeing "%lld" we fall back to "l".
1962135446Strhodes#
1963153816Sdougb# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
1964153816Sdougb# %ld even for (long long)/
1965153816Sdougb#
1966135446Strhodes# Win32 uses "%I64d", but that's defined elsewhere since we don't use
1967135446Strhodes# configure on Win32.
1968135446Strhodes#
1969135446StrhodesAC_MSG_CHECKING(printf format modifier for 64-bit integers)
1970135446StrhodesAC_TRY_RUN([
1971135446Strhodes#include <stdio.h>
1972135446Strhodesmain() {
1973135446Strhodes	long long int j = 0;
1974135446Strhodes	char buf[100];
1975135446Strhodes	buf[0] = 0;
1976135446Strhodes	sprintf(buf, "%lld", j);
1977135446Strhodes	exit((sizeof(long long int) != sizeof(long int))? 0 :
1978135446Strhodes	     (strcmp(buf, "0") != 0));
1979135446Strhodes} 
1980135446Strhodes],
1981135446Strhodes	[AC_MSG_RESULT(ll)
1982153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1983153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
1984135446Strhodes	[AC_MSG_RESULT(l)
1985153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
1986153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
1987135446Strhodes	[AC_MSG_RESULT(assuming target platform uses ll)
1988153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1989153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
1990135446StrhodesAC_SUBST(ISC_PLATFORM_QUADFORMAT)
1991153816SdougbAC_SUBST(LWRES_PLATFORM_QUADFORMAT)
1992135446Strhodes
1993135446Strhodes#
1994135446Strhodes# Security Stuff
1995135446Strhodes#
1996193149Sdougb# Note it is very recommended to *not* disable chroot(),
1997193149Sdougb# this is only because chroot() was made obsolete by Posix.
1998193149SdougbAC_ARG_ENABLE(chroot,
1999204619Sdougb	[  --disable-chroot        disable chroot])
2000193149Sdougbcase "$enable_chroot" in
2001193149Sdougb	yes|'')
2002193149Sdougb		AC_CHECK_FUNCS(chroot)
2003193149Sdougb		;;
2004193149Sdougb	no)
2005193149Sdougb		;;
2006193149Sdougbesac
2007135446StrhodesAC_ARG_ENABLE(linux-caps,
2008204619Sdougb	[  --disable-linux-caps	  disable linux capabilities])
2009135446Strhodescase "$enable_linux_caps" in
2010135446Strhodes	yes|'')
2011186462Sdougb		AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
2012193149Sdougb		AC_CHECK_LIB(cap, cap_set_proc)
2013135446Strhodes		;;
2014135446Strhodes	no)
2015135446Strhodes		;;
2016135446Strhodesesac
2017135446StrhodesAC_CHECK_HEADERS(sys/prctl.h)
2018135446Strhodes
2019170222SdougbAC_CHECK_HEADERS(sys/un.h,
2020170222SdougbISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
2021170222Sdougb,
2022170222SdougbISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2023170222Sdougb)
2024170222SdougbAC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2025170222Sdougb
2026170222Sdougbcase "$host" in
2027170222Sdougb*-solaris*)
2028170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2029170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2030170222Sdougb	;;
2031170222Sdougb*-sunos*)
2032170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2033170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
2034170222Sdougb	;;
2035170222Sdougbesac
2036170222Sdougb
2037135446Strhodes#
2038135446Strhodes# Time Zone Stuff
2039135446Strhodes#
2040135446StrhodesAC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2041135446Strhodes
2042193149SdougbAC_MSG_CHECKING(for optarg declaration)
2043153816SdougbAC_TRY_COMPILE([
2044153816Sdougb#include <unistd.h>
2045153816Sdougb],
2046153816Sdougb[optarg = 0;],
2047153816Sdougb[AC_MSG_RESULT(yes)],
2048153816Sdougb[AC_MSG_RESULT(no)
2049165071SdougbGEN_NEED_OPTARG="-DNEED_OPTARG=1"
2050153816SdougbAC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2051153816Sdougb
2052135446Strhodes#
2053135446Strhodes# BSD/OS, and perhaps some others, don't define rlim_t.
2054135446Strhodes#
2055135446StrhodesAC_MSG_CHECKING(for type rlim_t)
2056135446StrhodesAC_TRY_COMPILE([
2057135446Strhodes#include <sys/types.h>
2058135446Strhodes#include <sys/time.h>
2059135446Strhodes#include <sys/resource.h>],
2060135446Strhodes[rlim_t rl = 19671212; return (0);],
2061135446Strhodes[AC_MSG_RESULT(yes)
2062135446Strhodes ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2063135446Strhodes[AC_MSG_RESULT(no)
2064135446Strhodes
2065135446StrhodesAC_MSG_CHECKING(type of rlim_cur)
2066135446StrhodesAC_TRY_RUN([
2067135446Strhodes#include <sys/types.h>
2068135446Strhodes#include <sys/time.h>
2069135446Strhodes#include <sys/resource.h>
2070135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2071135446Strhodes[AC_MSG_RESULT(int)
2072135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2073135446Strhodes[
2074135446StrhodesAC_TRY_RUN([
2075135446Strhodes#include <sys/types.h>
2076135446Strhodes#include <sys/time.h>
2077135446Strhodes#include <sys/resource.h>
2078135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2079135446Strhodes[AC_MSG_RESULT(long int)
2080135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2081135446Strhodes[
2082135446StrhodesAC_TRY_RUN([
2083135446Strhodes#include <sys/types.h>
2084135446Strhodes#include <sys/time.h>
2085135446Strhodes#include <sys/resource.h>
2086135446Strhodesmain() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2087135446Strhodes[AC_MSG_RESULT(long long int)
2088135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2089135446Strhodes[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2090135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2091135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
2092153816Sdougb],[
2093153816SdougbISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"
2094153816SdougbAC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming long long int)])
2095135446Strhodes])
2096135446StrhodesAC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2097135446Strhodes
2098135446Strhodes#
2099186462Sdougb# Older HP-UX doesn't have gettune
2100186462Sdougb#
2101186462Sdougbcase "$host" in
2102186462Sdougb  	*-hp-hpux*)
2103186462Sdougb		AC_CHECK_HEADERS(sys/dyntune.h)
2104186462Sdougb		;;
2105186462Sdougb	*)
2106186462Sdougb		;;
2107186462Sdougbesac
2108186462Sdougb
2109186462Sdougb
2110186462Sdougb#
2111135446Strhodes# Compaq TruCluster requires more code for handling cluster IP aliases
2112135446Strhodes#
2113135446Strhodescase "$host" in
2114135446Strhodes	*-dec-osf*)
2115135446Strhodes		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2116135446Strhodes		AC_CHECK_FUNC(clua_getaliasaddress,
2117135446Strhodes				AC_DEFINE(HAVE_TRUCLUSTER, 1,
2118135446Strhodes					[Define if running under Compaq TruCluster]))
2119135446Strhodes		;;
2120135446Strhodes	*)
2121135446Strhodes		;;
2122135446Strhodesesac
2123135446Strhodes
2124135446Strhodes#
2125165071Sdougb# Some hosts need msg_namelen to match the size of the socket structure.
2126165071Sdougb# Some hosts don't set msg_namelen appropriately on return from recvmsg().
2127165071Sdougb#
2128165071Sdougbcase $host in
2129165071Sdougb*os2*|*hp-mpeix*)
2130165071Sdougb	AC_DEFINE(BROKEN_RECVMSG, 1,
2131165071Sdougb		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2132165071Sdougb	;;
2133165071Sdougbesac
2134165071Sdougb
2135165071Sdougb#
2136135446Strhodes# Microsoft has their own way of handling shared libraries that requires
2137135446Strhodes# additional qualifiers on extern variables.  Unix systems don't need it.
2138135446Strhodes#
2139135446StrhodesAC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2140135446StrhodesISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2141135446StrhodesAC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2142135446StrhodesLWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2143135446Strhodes
2144135446Strhodes#
2145135446Strhodes# Random remaining OS-specific issues involving compiler warnings.
2146135446Strhodes# XXXDCL print messages to indicate some compensation is being done?
2147135446Strhodes#
2148135446StrhodesAC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2149135446StrhodesISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2150135446Strhodes
2151135446Strhodescase "$host" in
2152165071Sdougb	*-aix5.[[123]].*)
2153143731Sdougb		hack_shutup_pthreadonceinit=yes
2154143731Sdougb		;;
2155135446Strhodes	*-bsdi3.1*)
2156135446Strhodes		hack_shutup_sputaux=yes
2157135446Strhodes		;;
2158135446Strhodes	*-bsdi4.0*)
2159135446Strhodes		hack_shutup_sigwait=yes
2160135446Strhodes		hack_shutup_sputaux=yes
2161135446Strhodes		;;
2162135446Strhodes	[*-bsdi4.[12]*])
2163135446Strhodes		hack_shutup_stdargcast=yes
2164135446Strhodes		;;
2165135446Strhodes	[*-solaris2.[89]])
2166135446Strhodes		hack_shutup_pthreadonceinit=yes
2167135446Strhodes		;;
2168186462Sdougb	*-solaris2.1[[0-9]])
2169193149Sdougb		AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2170165071Sdougb		;;
2171135446Strhodesesac
2172135446Strhodes
2173135446Strhodescase "$hack_shutup_pthreadonceinit" in
2174135446Strhodes	yes)
2175135446Strhodes		#
2176135446Strhodes		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2177135446Strhodes		#
2178135446Strhodes		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2179135446Strhodes		;;
2180135446Strhodesesac
2181135446Strhodes
2182135446Strhodescase "$hack_shutup_sigwait" in
2183135446Strhodes	yes)
2184135446Strhodes		#
2185135446Strhodes		# Shut up a -Wmissing-prototypes warning for sigwait().
2186135446Strhodes		#
2187135446Strhodes		AC_DEFINE(SHUTUP_SIGWAIT)
2188135446Strhodes		;;
2189135446Strhodesesac
2190135446Strhodes
2191135446Strhodescase "$hack_shutup_sputaux" in
2192135446Strhodes	yes)
2193135446Strhodes		#
2194135446Strhodes		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
2195135446Strhodes		#
2196135446Strhodes		AC_DEFINE(SHUTUP_SPUTAUX)
2197135446Strhodes		;;
2198135446Strhodesesac
2199135446Strhodes
2200135446Strhodescase "$hack_shutup_stdargcast" in
2201135446Strhodes	yes)
2202135446Strhodes		#
2203135446Strhodes		# Shut up a -Wcast-qual warning from va_start().
2204135446Strhodes		#
2205135446Strhodes		AC_DEFINE(SHUTUP_STDARG_CAST)
2206135446Strhodes		;;
2207135446Strhodesesac
2208135446Strhodes
2209174187SdougbAC_CHECK_HEADERS(strings.h,
2210174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2211174187Sdougb,
2212174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2213174187Sdougb)
2214174187SdougbAC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2215174187Sdougb
2216135446Strhodes#
2217135446Strhodes# Check for if_nametoindex() for IPv6 scoped addresses support
2218135446Strhodes#
2219135446StrhodesAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2220135446Strhodes		ac_cv_have_if_nametoindex=no)
2221135446Strhodescase $ac_cv_have_if_nametoindex in
2222135446Strhodesno)
2223135446Strhodes	case "$host" in
2224193149Sdougb	*-hp-hpux*)
2225193149Sdougb		AC_CHECK_LIB(ipv6, if_nametoindex,
2226135446Strhodes				ac_cv_have_if_nametoindex=yes
2227135446Strhodes				LIBS="-lipv6 $LIBS",)
2228193149Sdougb	;;
2229135446Strhodes	esac
2230135446Strhodesesac
2231135446Strhodescase $ac_cv_have_if_nametoindex in
2232135446Strhodesyes)
2233135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2234135446Strhodes	;;
2235135446Strhodes*)
2236135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2237135446Strhodes	;;
2238135446Strhodesesac
2239135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2240135446Strhodes
2241193149SdougbAC_CHECK_FUNCS(nanosleep)
2242193149Sdougb
2243135446Strhodes#
2244170222Sdougb# Machine architecture dependent features
2245170222Sdougb#
2246170222SdougbAC_ARG_ENABLE(atomic,
2247204619Sdougb	[  --enable-atomic	  enable machine specific atomic operations
2248204619Sdougb			  [[default=autodetect]]],
2249170222Sdougb			enable_atomic="$enableval",
2250170222Sdougb			enable_atomic="autodetect")
2251170222Sdougbcase "$enable_atomic" in
2252170222Sdougb	yes|''|autodetect)
2253204619Sdougb		case "$host" in
2254204619Sdougb		powerpc-ibm-aix*)
2255204619Sdougb			if test "X$GCC" = "Xyes"; then
2256204619Sdougb				AC_MSG_CHECKING([if asm("isc"); works])
2257204619Sdougb				AC_TRY_COMPILE(,[
2258204619Sdougb				main() { asm("ics"); exit(0); }
2259204619Sdougb				],
2260204619Sdougb				[AC_MSG_RESULT(yes)
2261204619Sdougb				 use_atomic=yes],
2262204619Sdougb				[
2263204619Sdougb				saved_cflags="$CFLAGS"
2264204619Sdougb				CFLAGS="$CFLAGS -Wa,-many"
2265204619Sdougb				AC_TRY_RUN([
2266204619Sdougb				main() { asm("ics"); exit(0); }
2267204619Sdougb				],
2268204619Sdougb				[AC_MSG_RESULT([yes, required -Wa,-many])
2269204619Sdougb				 use_atomic=yes],
2270204619Sdougb				[AC_MSG_RESULT([no, use_atomic disabled])
2271204619Sdougb				 CFLAGS="$saved_cflags"
2272204619Sdougb				 use_atomic=no],
2273204619Sdougb				[AC_MSG_RESULT([cross compile, assume yes])
2274204619Sdougb				 CFLAGS="$saved_cflags"
2275204619Sdougb				 use_atomic=yes])
2276204619Sdougb				]
2277204619Sdougb				)
2278218384Sdougb			else
2279218384Sdougb				use_atomic=yes
2280204619Sdougb			fi
2281204619Sdougb			;;
2282204619Sdougb		*)
2283204619Sdougb			use_atomic=yes
2284204619Sdougb			;;
2285204619Sdougb		esac
2286170222Sdougb		;;
2287170222Sdougb	no)
2288170222Sdougb		use_atomic=no
2289170222Sdougb		arch=noatomic
2290170222Sdougb		;;
2291170222Sdougbesac
2292170222Sdougb
2293170222SdougbISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2294170222Sdougbif test "$use_atomic" = "yes"; then
2295170222Sdougb	AC_MSG_CHECKING([architecture type for atomic operations])
2296170222Sdougb	have_atomic=yes		# set default
2297170222Sdougb	case "$host" in
2298170222Sdougb	[i[3456]86-*])
2299170222Sdougb		# XXX: some old x86 architectures actually do not support
2300170222Sdougb		#      (some of) these operations.  Do we need stricter checks?
2301170222SdougbAC_TRY_RUN([
2302170222Sdougbmain() {
2303170222Sdougb	exit((sizeof(void *) == 8) ? 0 : 1);
2304170222Sdougb}
2305170222Sdougb],
2306193149Sdougb		[arch=x86_64
2307193149Sdougb		have_xaddq=yes],
2308170222Sdougb		[arch=x86_32],
2309193149Sdougb		[arch=x86_32])
2310170222Sdougb	;;
2311193149Sdougb	x86_64-*|amd64-*)
2312204619SdougbAC_TRY_RUN([
2313204619Sdougbmain() {
2314204619Sdougb       exit((sizeof(void *) == 8) ? 0 : 1);
2315204619Sdougb}
2316204619Sdougb],
2317204619Sdougb	       [arch=x86_64
2318204619Sdougb	       have_xaddq=yes],
2319204619Sdougb	       [arch=x86_32],
2320204619Sdougb	       [arch=x86_64
2321204619Sdougb	       have_xaddq=yes])
2322170222Sdougb	;;
2323170222Sdougb	alpha*-*)
2324170222Sdougb		arch=alpha
2325170222Sdougb	;;
2326218384Sdougb	powerpc-*|powerpc64-*)
2327170222Sdougb		arch=powerpc
2328170222Sdougb	;;
2329170222Sdougb	mips-*|mipsel-*|mips64-*|mips64el-*)
2330170222Sdougb		arch=mips
2331170222Sdougb	;;
2332170222Sdougb	ia64-*)
2333170222Sdougb		arch=ia64
2334170222Sdougb	;;
2335170222Sdougb	*)
2336170222Sdougb		have_atomic=no
2337170222Sdougb		arch=noatomic
2338170222Sdougb	;;
2339170222Sdougb	esac
2340170222Sdougb	AC_MSG_RESULT($arch)
2341170222Sdougbfi
2342170222Sdougb
2343170222Sdougbif test "$have_atomic" = "yes"; then
2344170222Sdougb	AC_MSG_CHECKING([compiler support for inline assembly code])
2345170222Sdougb
2346170222Sdougb	compiler=generic
2347170222Sdougb	# Check whether the compiler supports the assembly syntax we provide.
2348170222Sdougb	if test "X$GCC" = "Xyes"; then
2349170222Sdougb		# GCC's ASM extension always works
2350170222Sdougb		compiler=gcc
2351170222Sdougb		if test $arch = "x86_64"; then
2352170222Sdougb			# We can share the same code for gcc with x86_32
2353170222Sdougb			arch=x86_32
2354170222Sdougb		fi
2355170222Sdougb		if test $arch = "powerpc"; then
2356170222Sdougb			#
2357170222Sdougb			# The MacOS (and maybe others) uses "r0" for register
2358170222Sdougb			# zero. Under linux/ibm it is "0" for register 0.
2359170222Sdougb			# Probe to see if we have a MacOS style assembler.
2360170222Sdougb			#
2361170222Sdougb			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2362170222Sdougb			AC_TRY_COMPILE(, [
2363170222Sdougb			__asm__ volatile ("li r0, 0x0\n"::);
2364170222Sdougb			], [
2365170222Sdougb			AC_MSG_RESULT(yes)
2366170222Sdougb			compiler="mac"
2367170222Sdougb			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2368170222Sdougb			], [AC_MSG_RESULT(no)])
2369170222Sdougb		fi
2370170222Sdougb	else
2371170222Sdougb		case "$host" in
2372170222Sdougb		alpha*-dec-osf*)
2373170222Sdougb			# Tru64 compiler has its own syntax for inline 
2374170222Sdougb			# assembly.
2375170222Sdougb			AC_TRY_COMPILE(, [
2376170222Sdougb#ifndef __DECC
2377170222Sdougb#error "unexpected compiler"
2378170222Sdougb#endif
2379170222Sdougb				return (0);],
2380170222Sdougb				[compiler=osf],)
2381170222Sdougb		;;
2382170222Sdougb		powerpc-ibm-aix*)
2383170222Sdougb			compiler=aix
2384170222Sdougb		;;
2385170222Sdougb		esac
2386170222Sdougb	fi
2387170222Sdougb	case "$compiler" in
2388170222Sdougb	gcc)
2389170222Sdougb		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2390170222Sdougb		;;
2391170222Sdougb	osf)
2392170222Sdougb		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2393170222Sdougb		;;
2394170222Sdougb	aix)
2395170222Sdougb		;;
2396170222Sdougb	mac)
2397170222Sdougb		;;
2398170222Sdougb	*)
2399170222Sdougb		# See if the generic __asm function works.  If not,
2400170222Sdougb		# we need to disable the atomic operations.
2401170222Sdougb		AC_TRY_LINK(, [
2402170222Sdougb					__asm("nop")
2403170222Sdougb				],
2404170222Sdougb		[compiler="standard"
2405170222Sdougb		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2406170222Sdougb		[compiler="not supported (atomic operations disabled)"
2407170222Sdougb		have_atomic=no
2408170222Sdougb		arch=noatomic ]);
2409170222Sdougb		;;
2410170222Sdougb	esac
2411170222Sdougb
2412170222Sdougb	AC_MSG_RESULT($compiler)
2413170222Sdougbfi
2414170222Sdougb
2415170222Sdougbif test "$have_atomic" = "yes"; then
2416170222Sdougb	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2417170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2418170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2419170222Sdougbelse
2420170222Sdougb	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2421170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2422170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2423170222Sdougbfi
2424170222Sdougb
2425193149Sdougbif test "$have_xaddq" = "yes"; then
2426204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
2427193149Sdougbelse
2428204619Sdougb	ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
2429193149Sdougbfi
2430193149Sdougb
2431170222SdougbAC_SUBST(ISC_PLATFORM_HAVEXADD)
2432193149SdougbAC_SUBST(ISC_PLATFORM_HAVEXADDQ)
2433170222SdougbAC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2434170222SdougbAC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2435170222Sdougb
2436170222SdougbAC_SUBST(ISC_PLATFORM_USEGCCASM)
2437170222SdougbAC_SUBST(ISC_PLATFORM_USEOSFASM)
2438170222SdougbAC_SUBST(ISC_PLATFORM_USESTDASM)
2439170222SdougbAC_SUBST(ISC_PLATFORM_USEMACASM)
2440170222Sdougb
2441170222SdougbISC_ARCH_DIR=$arch
2442170222SdougbAC_SUBST(ISC_ARCH_DIR)
2443170222Sdougb
2444170222Sdougb#
2445193149Sdougb# Activate "rrset-order fixed" or not?
2446193149Sdougb#
2447193149SdougbAC_ARG_ENABLE(fixed-rrset,
2448204619Sdougb	[  --enable-fixed-rrset    enable fixed rrset ordering
2449204619Sdougb			  [[default=no]]],
2450193149Sdougb			enable_fixed="$enableval",
2451193149Sdougb			enable_fixed="no")
2452193149Sdougbcase "$enable_fixed" in
2453193149Sdougb	yes)
2454193149Sdougb		AC_DEFINE(DNS_RDATASET_FIXED, 1,
2455204619Sdougb			  [Define to enable "rrset-order fixed" syntax.])
2456193149Sdougb		;;
2457193149Sdougb	no)
2458193149Sdougb		;;
2459193149Sdougb	*)
2460193149Sdougb		;;
2461193149Sdougbesac
2462193149Sdougb
2463193149Sdougb#
2464153816Sdougb#  The following sets up how non-blocking i/o is established.
2465153816Sdougb#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
2466153816Sdougb#
2467153816Sdougbcase "$host" in
2468153816Sdougb*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2469153816Sdougb*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2470153816Sdougb*-solaris2.[[01234]])
2471153816Sdougb	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2472153816Sdougb	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2473153816Sdougb		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2474153816Sdougb	;;
2475153816Sdougb*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2476153816Sdougb	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2477153816Sdougb	;;
2478153816Sdougbesac
2479153816Sdougb#
2480165071Sdougb# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2481165071Sdougb# This prevents the source address being set.
2482165071Sdougb#
2483165071Sdougbcase "$host" in
2484165071Sdougb*-solaris2.[[012345]]|*-solaris2.5.1)
2485165071Sdougb	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2486165071Sdougb		  [Define if you cannot bind() before connect() for TCP sockets.])
2487165071Sdougb	;;
2488165071Sdougbesac
2489165071Sdougb#
2490135446Strhodes# The following sections deal with tools used for formatting
2491135446Strhodes# the documentation.  They are all optional, unless you are
2492135446Strhodes# a developer editing the documentation source.
2493135446Strhodes#
2494135446Strhodes
2495153816Sdougb#
2496153816Sdougb# Look for TeX.
2497153816Sdougb#
2498135446Strhodes
2499153816SdougbAC_PATH_PROGS(LATEX, latex, latex)
2500153816SdougbAC_SUBST(LATEX)
2501153816Sdougb
2502153816SdougbAC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2503153816SdougbAC_SUBST(PDFLATEX)
2504153816Sdougb
2505135446Strhodes#
2506170222Sdougb# Look for w3m
2507170222Sdougb#
2508170222Sdougb
2509170222SdougbAC_PATH_PROGS(W3M, w3m, w3m)
2510170222SdougbAC_SUBST(W3M)
2511170222Sdougb
2512170222Sdougb#
2513153816Sdougb# Look for xsltproc (libxslt)
2514135446Strhodes#
2515135446Strhodes
2516153816SdougbAC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2517153816SdougbAC_SUBST(XSLTPROC)
2518135446Strhodes
2519135446Strhodes#
2520153816Sdougb# Look for xmllint (libxml2)
2521135446Strhodes#
2522135446Strhodes
2523153816SdougbAC_PATH_PROG(XMLLINT, xmllint, xmllint)
2524153816SdougbAC_SUBST(XMLLINT)
2525135446Strhodes
2526135446Strhodes#
2527193149Sdougb# Look for Doxygen
2528193149Sdougb#
2529193149Sdougb
2530193149SdougbAC_PATH_PROG(DOXYGEN, doxygen, doxygen)
2531193149SdougbAC_SUBST(DOXYGEN)
2532193149Sdougb
2533193149Sdougb#
2534135446Strhodes# Subroutine for searching for an ordinary file (e.g., a stylesheet)
2535135446Strhodes# in a number of directories:
2536135446Strhodes#
2537135446Strhodes#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2538135446Strhodes#
2539135446Strhodes# If the file FILENAME is found in one of the DIRECTORIES, the shell
2540135446Strhodes# variable VARIABLE is defined to its absolute pathname.  Otherwise, 
2541135446Strhodes# it is set to FILENAME, with no directory prefix (that's not terribly
2542135446Strhodes# useful, but looks less confusing in substitutions than leaving it
2543135446Strhodes# empty).  The variable VARIABLE will be substituted into output files.
2544135446Strhodes# 
2545135446Strhodes
2546135446StrhodesAC_DEFUN(NOM_PATH_FILE, [
2547135446Strhodes$1=""
2548135446StrhodesAC_MSG_CHECKING(for $2)
2549135446Strhodesfor d in $3
2550135446Strhodesdo
2551135446Strhodes	f=$d/$2
2552135446Strhodes	if test -f $f
2553135446Strhodes	then
2554135446Strhodes		$1=$f
2555135446Strhodes		AC_MSG_RESULT($f)
2556135446Strhodes		break
2557135446Strhodes	fi
2558135446Strhodesdone
2559135446Strhodesif test "X[$]$1" = "X"
2560135446Strhodesthen
2561135446Strhodes	AC_MSG_RESULT("not found");
2562135446Strhodes	$1=$2
2563135446Strhodesfi
2564135446StrhodesAC_SUBST($1)
2565135446Strhodes])
2566135446Strhodes
2567135446Strhodes#
2568186462Sdougb# Look for Docbook-XSL stylesheets.  Location probably varies by system.
2569186462Sdougb# If it's not explicitly specified, guess where it might be found, based on
2570186462Sdougb# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2571186462Sdougb# of at the moment).
2572135446Strhodes#
2573186462SdougbAC_MSG_CHECKING(for Docbook-XSL path)
2574186462SdougbAC_ARG_WITH(docbook-xsl,
2575204619Sdougb[  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
2576186462Sdougb   docbook_path="$withval", docbook_path="auto")
2577186462Sdougbcase "$docbook_path" in
2578186462Sdougbauto)
2579186462Sdougb	AC_MSG_RESULT(auto)
2580186462Sdougb	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
2581186462Sdougb	;;
2582186462Sdougb*)
2583186462Sdougb	docbook_xsl_trees="$withval"
2584186462Sdougb    	AC_MSG_RESULT($docbook_xsl_trees)
2585186462Sdougb	;;
2586186462Sdougbesac
2587153816Sdougb
2588135446Strhodes#
2589153816Sdougb# Look for stylesheets we need.
2590153816Sdougb#
2591135446Strhodes
2592186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
2593186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
2594186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
2595186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
2596186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
2597186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
2598186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
2599186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
2600186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
2601153816Sdougb
2602135446Strhodes#
2603153816Sdougb# Same dance for db2latex
2604135446Strhodes#
2605153816Sdougb# No idea where this lives except on FreeBSD.
2606135446Strhodes#
2607135446Strhodes
2608153816Sdougbdb2latex_xsl_trees="/usr/local/share"
2609135446Strhodes
2610135446Strhodes#
2611153816Sdougb# Look for stylesheets we need.
2612135446Strhodes#
2613135446Strhodes
2614153816SdougbNOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
2615135446Strhodes
2616135446Strhodes#
2617153816Sdougb# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
2618153816Sdougb# because it's a directory, so just do the same things, inline.
2619135446Strhodes#
2620135446Strhodes
2621153816SdougbAC_MSG_CHECKING(for db2latex/xsl/figures)
2622153816Sdougbfor d in $db2latex_xsl_trees
2623153816Sdougbdo
2624153816Sdougb	dd=$d/db2latex/xsl/figures
2625153816Sdougb	if test -d $dd
2626153816Sdougb	then
2627153816Sdougb		XSLT_DB2LATEX_ADMONITIONS=$dd
2628153816Sdougb		AC_MSG_RESULT($dd)
2629153816Sdougb		break
2630153816Sdougb	fi
2631153816Sdougbdone
2632153816Sdougbif test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
2633153816Sdougbthen
2634153816Sdougb	AC_MSG_RESULT(not found)
2635153816Sdougb	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
2636153816Sdougbfi
2637153816SdougbAC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
2638135446Strhodes
2639135446Strhodes#
2640170222Sdougb# IDN support
2641170222Sdougb#
2642170222SdougbAC_ARG_WITH(idn,
2643204619Sdougb	[  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
2644170222Sdougb	use_idn="$withval", use_idn="no")
2645170222Sdougbcase "$use_idn" in
2646170222Sdougbyes)
2647170222Sdougb	if test X$prefix = XNONE ; then
2648170222Sdougb		idn_path=/usr/local
2649170222Sdougb	else
2650170222Sdougb		idn_path=$prefix
2651170222Sdougb	fi
2652170222Sdougb	;;
2653170222Sdougbno)
2654170222Sdougb	;;
2655170222Sdougb*)
2656170222Sdougb	idn_path="$use_idn"
2657170222Sdougb	;;
2658170222Sdougbesac
2659170222Sdougb
2660170222Sdougbiconvinc=
2661170222Sdougbiconvlib=
2662170222SdougbAC_ARG_WITH(libiconv,
2663204619Sdougb	[  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
2664170222Sdougb	use_libiconv="$withval", use_libiconv="no")
2665170222Sdougbcase "$use_libiconv" in
2666170222Sdougbyes)
2667170222Sdougb	if test X$prefix = XNONE ; then
2668170222Sdougb		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
2669170222Sdougb	else
2670170222Sdougb		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
2671170222Sdougb	fi
2672170222Sdougb	;;
2673170222Sdougbno)
2674170222Sdougb	iconvlib=
2675170222Sdougb	;;
2676170222Sdougb*)
2677170222Sdougb	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
2678170222Sdougb	;;
2679170222Sdougbesac
2680170222Sdougb
2681170222SdougbAC_ARG_WITH(iconv,
2682204619Sdougb	[  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
2683170222Sdougb	iconvlib="$withval")
2684170222Sdougbcase "$iconvlib" in
2685170222Sdougbno)
2686170222Sdougb	iconvlib=
2687170222Sdougb	;;
2688170222Sdougbyes)
2689170222Sdougb	iconvlib=-liconv
2690170222Sdougb	;;
2691170222Sdougbesac
2692170222Sdougb
2693170222SdougbAC_ARG_WITH(idnlib,
2694204619Sdougb	[  --with-idnlib=ARG       specify libidnkit],
2695170222Sdougb	idnlib="$withval", idnlib="no")
2696170222Sdougbif test "$idnlib" = yes; then
2697170222Sdougb	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
2698170222Sdougbfi
2699170222Sdougb
2700170222SdougbIDNLIBS=
2701170222Sdougbif test "$use_idn" != no; then
2702170222Sdougb	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
2703170222Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
2704170222Sdougb	if test "$idnlib" != no; then
2705170222Sdougb		IDNLIBS="$idnlib $iconvlib"
2706170222Sdougb	else
2707170222Sdougb		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
2708170222Sdougb	fi
2709170222Sdougbfi
2710170222SdougbAC_SUBST(IDNLIBS)
2711170222Sdougb
2712170222SdougbAC_CHECK_HEADERS(locale.h)
2713170222SdougbAC_CHECK_FUNCS(setlocale)
2714170222Sdougb
2715170222Sdougb#
2716135446Strhodes# Substitutions
2717135446Strhodes#
2718135446StrhodesAC_SUBST(BIND9_TOP_BUILDDIR)
2719135446StrhodesBIND9_TOP_BUILDDIR=`pwd`
2720135446Strhodes
2721135446StrhodesAC_SUBST(BIND9_ISC_BUILDINCLUDE)
2722135446StrhodesAC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
2723135446StrhodesAC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
2724135446StrhodesAC_SUBST(BIND9_DNS_BUILDINCLUDE)
2725135446StrhodesAC_SUBST(BIND9_LWRES_BUILDINCLUDE)
2726135446StrhodesAC_SUBST(BIND9_BIND9_BUILDINCLUDE)
2727135446Strhodesif test "X$srcdir" != "X"; then
2728135446Strhodes	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
2729135446Strhodes	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
2730135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
2731135446Strhodes	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
2732135446Strhodes	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
2733135446Strhodes	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
2734135446Strhodeselse
2735135446Strhodes	BIND9_ISC_BUILDINCLUDE=""
2736135446Strhodes	BIND9_ISCCC_BUILDINCLUDE=""
2737135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE=""
2738135446Strhodes	BIND9_DNS_BUILDINCLUDE=""
2739135446Strhodes	BIND9_LWRES_BUILDINCLUDE=""
2740135446Strhodes	BIND9_BIND9_BUILDINCLUDE=""
2741135446Strhodesfi
2742135446Strhodes
2743135446StrhodesAC_SUBST_FILE(BIND9_MAKE_INCLUDES)
2744135446StrhodesBIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2745135446Strhodes
2746135446StrhodesAC_SUBST_FILE(BIND9_MAKE_RULES)
2747135446StrhodesBIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2748135446Strhodes
2749135446Strhodes. $srcdir/version
2750204619SdougbBIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}"
2751135446StrhodesAC_SUBST(BIND9_VERSION)
2752135446Strhodes
2753193149Sdougbif test -z "$ac_configure_args"; then
2754193149Sdougb	BIND9_CONFIGARGS="defaults"
2755193149Sdougbelse
2756193149Sdougb	for a in $ac_configure_args
2757193149Sdougb	do
2758193149Sdougb		BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
2759193149Sdougb	done
2760193149Sdougbfi
2761193149SdougbBIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
2762193149SdougbBIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
2763193149SdougbAC_SUBST(BIND9_CONFIGARGS)
2764193149Sdougb
2765135446StrhodesAC_SUBST_FILE(LIBISC_API)
2766135446StrhodesLIBISC_API=$srcdir/lib/isc/api
2767135446Strhodes
2768135446StrhodesAC_SUBST_FILE(LIBISCCC_API)
2769135446StrhodesLIBISCCC_API=$srcdir/lib/isccc/api
2770135446Strhodes
2771135446StrhodesAC_SUBST_FILE(LIBISCCFG_API)
2772135446StrhodesLIBISCCFG_API=$srcdir/lib/isccfg/api
2773135446Strhodes
2774135446StrhodesAC_SUBST_FILE(LIBDNS_API)
2775135446StrhodesLIBDNS_API=$srcdir/lib/dns/api
2776135446Strhodes
2777135446StrhodesAC_SUBST_FILE(LIBBIND9_API)
2778135446StrhodesLIBBIND9_API=$srcdir/lib/bind9/api
2779135446Strhodes
2780135446StrhodesAC_SUBST_FILE(LIBLWRES_API)
2781135446StrhodesLIBLWRES_API=$srcdir/lib/lwres/api
2782135446Strhodes
2783170222Sdougb#
2784170222Sdougb# Configure any DLZ drivers.
2785170222Sdougb#
2786170222Sdougb# If config.dlz.in selects one or more DLZ drivers, it will set
2787170222Sdougb# USE_DLZ to a non-empty value, which will be our clue to
2788170222Sdougb# enable the DLZ core functions.
2789170222Sdougb#
2790170222Sdougb# This section has to come after the libtool stuff because it needs to
2791170222Sdougb# know how to name the driver object files.
2792170222Sdougb#
2793170222Sdougb
2794170222SdougbUSE_DLZ=""
2795170222SdougbDLZ_DRIVER_INCLUDES=""
2796170222SdougbDLZ_DRIVER_LIBS=""
2797170222SdougbDLZ_DRIVER_SRCS=""
2798170222SdougbDLZ_DRIVER_OBJS=""
2799218384SdougbDLZ_SYSTEM_TEST=""
2800170222Sdougb
2801170222Sdougbsinclude(contrib/dlz/config.dlz.in)
2802170222Sdougb
2803170222SdougbAC_MSG_CHECKING(for DLZ)
2804170222Sdougb
2805170222Sdougbif test -n "$USE_DLZ"
2806170222Sdougbthen
2807170222Sdougb	AC_MSG_RESULT(yes)
2808170222Sdougb	USE_DLZ="-DDLZ $USE_DLZ"
2809170222Sdougb	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
2810170222Sdougb	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
2811170222Sdougbelse
2812170222Sdougb	AC_MSG_RESULT(no)
2813170222Sdougb	DLZ_DRIVER_RULES=/dev/null
2814170222Sdougbfi
2815170222Sdougb
2816170222SdougbAC_SUBST(USE_DLZ)
2817170222SdougbAC_SUBST(DLZ_DRIVER_INCLUDES)
2818170222SdougbAC_SUBST(DLZ_DRIVER_LIBS)
2819170222SdougbAC_SUBST(DLZ_DRIVER_SRCS)
2820170222SdougbAC_SUBST(DLZ_DRIVER_OBJS)
2821218384SdougbAC_SUBST(DLZ_SYSTEM_TEST)
2822170222SdougbAC_SUBST_FILE(DLZ_DRIVER_RULES)
2823170222Sdougb
2824165071Sdougbif test "$cross_compiling" = "yes"; then
2825165071Sdougb	if test -z "$BUILD_CC"; then
2826165071Sdougb		AC_ERROR([BUILD_CC not set])
2827165071Sdougb	fi
2828165071Sdougb	BUILD_CFLAGS="$BUILD_CFLAGS"
2829165071Sdougb	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
2830165071Sdougb	BUILD_LDFLAGS="$BUILD_LDFLAGS"
2831165071Sdougb	BUILD_LIBS="$BUILD_LIBS"
2832165071Sdougbelse
2833165071Sdougb	BUILD_CC="$CC" 
2834165071Sdougb	BUILD_CFLAGS="$CFLAGS" 
2835165071Sdougb	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
2836165071Sdougb	BUILD_LDFLAGS="$LDFLAGS"
2837165071Sdougb	BUILD_LIBS="$LIBS"
2838165071Sdougbfi
2839165071Sdougb
2840193149SdougbNEWFLAGS=""
2841193149Sdougbfor e in $BUILD_LDFLAGS ; do
2842193149Sdougb    case $e in
2843193149Sdougb	-L*)
2844193149Sdougb	    case $host_os in
2845193149Sdougb		netbsd*)
2846193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2847193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2848193149Sdougb		    ;;
2849193149Sdougb		freebsd*)
2850193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2851193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2852193149Sdougb		    ;;
2853193149Sdougb		solaris*)
2854193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2855193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2856193149Sdougb		    ;;
2857193149Sdougb		*)
2858193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2859193149Sdougb		    ;;
2860193149Sdougb		esac
2861193149Sdougb	    ;;
2862193149Sdougb	*)
2863193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2864193149Sdougb	    ;;
2865193149Sdougb    esac
2866193149Sdougbdone
2867193149SdougbBUILD_LDFLAGS="$NEWFLAGS"
2868193149Sdougb
2869193149SdougbNEWFLAGS=""
2870193149Sdougbfor e in $DNS_GSSAPI_LIBS ; do
2871193149Sdougb    case $e in
2872193149Sdougb	-L*)
2873193149Sdougb	    case $host_os in
2874193149Sdougb		netbsd*)
2875193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2876193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2877193149Sdougb		    ;;
2878193149Sdougb		freebsd*)
2879193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2880193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2881193149Sdougb		    ;;
2882193149Sdougb		solaris*)
2883193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2884193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2885193149Sdougb		    ;;
2886193149Sdougb		*)
2887193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2888193149Sdougb		    ;;
2889193149Sdougb		esac
2890193149Sdougb	    ;;
2891193149Sdougb	*)
2892193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2893193149Sdougb	    ;;
2894193149Sdougb    esac
2895193149Sdougbdone
2896193149SdougbDNS_GSSAPI_LIBS="$NEWFLAGS"
2897193149Sdougb
2898193149SdougbNEWFLAGS=""
2899193149Sdougbfor e in $DNS_CRYPTO_LIBS ; do
2900193149Sdougb    case $e in
2901193149Sdougb	-L*)
2902193149Sdougb	    case $host_os in
2903193149Sdougb		netbsd*)
2904193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2905193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2906193149Sdougb		    ;;
2907193149Sdougb		freebsd*)
2908193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2909193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2910193149Sdougb		    ;;
2911193149Sdougb		solaris*)
2912193149Sdougb		    ee=`echo $e | sed -e 's%^-L%-R%'`
2913193149Sdougb		    NEWFLAGS="$NEWFLAGS $e $ee"
2914193149Sdougb		    ;;
2915193149Sdougb		*)
2916193149Sdougb		    NEWFLAGS="$NEWFLAGS $e"
2917193149Sdougb		    ;;
2918193149Sdougb		esac
2919193149Sdougb	    ;;
2920193149Sdougb	*)
2921193149Sdougb	    NEWFLAGS="$NEWFLAGS $e"
2922193149Sdougb	    ;;
2923193149Sdougb    esac
2924193149Sdougbdone
2925193149SdougbDNS_CRYPTO_LIBS="$NEWFLAGS"
2926193149Sdougb
2927165071SdougbAC_SUBST(BUILD_CC)
2928165071SdougbAC_SUBST(BUILD_CFLAGS)
2929165071SdougbAC_SUBST(BUILD_CPPFLAGS)
2930165071SdougbAC_SUBST(BUILD_LDFLAGS)
2931165071SdougbAC_SUBST(BUILD_LIBS)
2932165071Sdougb
2933170222Sdougb#
2934170222Sdougb# Commands to run at the end of config.status.
2935170222Sdougb# Don't just put these into configure, it won't work right if somebody
2936170222Sdougb# runs config.status directly (which autoconf allows).
2937170222Sdougb#
2938170222Sdougb
2939170222SdougbAC_CONFIG_COMMANDS(
2940170222Sdougb	[chmod],
2941193149Sdougb	[chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
2942170222Sdougb
2943170222Sdougb#
2944170222Sdougb# Files to configure.  These are listed here because we used to
2945170222Sdougb# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
2946170222Sdougb# elsewhere if there's a good reason for doing so.
2947170222Sdougb#
2948170222Sdougb
2949170222SdougbAC_CONFIG_FILES([
2950135446Strhodes	Makefile
2951135446Strhodes	make/Makefile
2952135446Strhodes	make/mkdep
2953135446Strhodes	lib/Makefile
2954135446Strhodes	lib/isc/Makefile
2955135446Strhodes	lib/isc/include/Makefile
2956135446Strhodes	lib/isc/include/isc/Makefile
2957135446Strhodes	lib/isc/include/isc/platform.h
2958135446Strhodes	lib/isc/unix/Makefile
2959135446Strhodes	lib/isc/unix/include/Makefile
2960135446Strhodes	lib/isc/unix/include/isc/Makefile
2961135446Strhodes	lib/isc/nls/Makefile
2962135446Strhodes	lib/isc/$thread_dir/Makefile
2963135446Strhodes	lib/isc/$thread_dir/include/Makefile
2964135446Strhodes	lib/isc/$thread_dir/include/isc/Makefile
2965174187Sdougb	lib/isc/$arch/Makefile
2966174187Sdougb	lib/isc/$arch/include/Makefile
2967174187Sdougb	lib/isc/$arch/include/isc/Makefile
2968135446Strhodes	lib/isccc/Makefile
2969135446Strhodes	lib/isccc/include/Makefile
2970135446Strhodes	lib/isccc/include/isccc/Makefile
2971135446Strhodes	lib/isccfg/Makefile
2972135446Strhodes	lib/isccfg/include/Makefile
2973135446Strhodes	lib/isccfg/include/isccfg/Makefile
2974135446Strhodes	lib/dns/Makefile
2975135446Strhodes	lib/dns/include/Makefile
2976135446Strhodes	lib/dns/include/dns/Makefile
2977143731Sdougb	lib/dns/include/dst/Makefile
2978135446Strhodes	lib/bind9/Makefile
2979135446Strhodes	lib/bind9/include/Makefile
2980135446Strhodes	lib/bind9/include/bind9/Makefile
2981135446Strhodes	lib/lwres/Makefile
2982135446Strhodes	lib/lwres/include/Makefile
2983135446Strhodes	lib/lwres/include/lwres/Makefile
2984135446Strhodes	lib/lwres/include/lwres/netdb.h
2985135446Strhodes	lib/lwres/include/lwres/platform.h
2986135446Strhodes	lib/lwres/man/Makefile
2987135446Strhodes	lib/lwres/unix/Makefile
2988135446Strhodes	lib/lwres/unix/include/Makefile
2989135446Strhodes	lib/lwres/unix/include/lwres/Makefile
2990135446Strhodes	lib/tests/Makefile
2991135446Strhodes	lib/tests/include/Makefile
2992135446Strhodes	lib/tests/include/tests/Makefile
2993135446Strhodes	bin/Makefile
2994135446Strhodes	bin/check/Makefile
2995135446Strhodes	bin/named/Makefile
2996135446Strhodes	bin/named/unix/Makefile
2997135446Strhodes	bin/rndc/Makefile
2998135446Strhodes	bin/rndc/unix/Makefile
2999135446Strhodes	bin/dig/Makefile
3000135446Strhodes	bin/nsupdate/Makefile
3001135446Strhodes	bin/tests/Makefile
3002135446Strhodes	bin/tests/names/Makefile
3003135446Strhodes	bin/tests/master/Makefile
3004135446Strhodes	bin/tests/rbt/Makefile
3005135446Strhodes	bin/tests/db/Makefile
3006135446Strhodes	bin/tests/tasks/Makefile
3007135446Strhodes	bin/tests/timers/Makefile
3008135446Strhodes	bin/tests/dst/Makefile
3009135446Strhodes	bin/tests/mem/Makefile
3010218384Sdougb	bin/tests/hashes/Makefile
3011135446Strhodes	bin/tests/net/Makefile
3012135446Strhodes	bin/tests/sockaddr/Makefile
3013135446Strhodes	bin/tests/system/Makefile
3014135446Strhodes	bin/tests/system/conf.sh
3015135446Strhodes	bin/tests/system/lwresd/Makefile
3016135446Strhodes	bin/tests/system/tkey/Makefile
3017135446Strhodes	bin/tests/headerdep_test.sh
3018135446Strhodes	bin/dnssec/Makefile
3019135446Strhodes	doc/Makefile
3020135446Strhodes	doc/arm/Makefile
3021135446Strhodes	doc/misc/Makefile
3022170222Sdougb	isc-config.sh
3023153816Sdougb	doc/xsl/Makefile
3024153816Sdougb	doc/xsl/isc-docbook-chunk.xsl
3025153816Sdougb	doc/xsl/isc-docbook-html.xsl
3026153816Sdougb	doc/xsl/isc-docbook-latex.xsl
3027153816Sdougb	doc/xsl/isc-manpage.xsl
3028193149Sdougb	doc/doxygen/Doxyfile
3029193149Sdougb	doc/doxygen/Makefile
3030193149Sdougb	doc/doxygen/doxygen-input-filter
3031170222Sdougb])
3032135446Strhodes
3033170222Sdougb#
3034170222Sdougb# Do it
3035170222Sdougb#
3036170222Sdougb
3037170222SdougbAC_OUTPUT
3038170222Sdougb
3039218384Sdougb#
3040218384Sdougb# Now that the Makefiles exist we can ensure that everything is rebuilt.
3041218384Sdougb#
3042218384SdougbAC_ARG_WITH(make-clean,
3043218384Sdougb[  --with-make-clean      Run "make clean" at end of configure [[yes|no]].],
3044218384Sdougb    make_clean="$withval", make_clean="yes")
3045218384Sdougbcase "$make_clean" in
3046218384Sdougbyes)
3047218384Sdougb	make clean
3048218384Sdougb	;;
3049218384Sdougbesac
3050218384Sdougb
3051204619Sdougbif test "X$USE_OPENSSL" = "X"; then
3052204619Sdougbcat << \EOF                                                             
3053204619SdougbBIND is being built without OpenSSL. This means it will not have DNSSEC support.
3054204619SdougbEOF
3055204619Sdougbfi
3056204619Sdougb
3057163976Sdougbif test "X$OPENSSL_WARNING" != "X"; then
3058163976Sdougbcat << \EOF
3059163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3060163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3061163976SdougbWARNING                                                                 WARNING
3062163976SdougbWARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
3063163976SdougbWARNING         one or more of the the following known security         WARNING
3064163976SdougbWARNING         flaws:                                                  WARNING
3065163976SdougbWARNING                                                                 WARNING
3066163976SdougbWARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
3067163976SdougbWARNING         CVE-2006-2940.                                          WARNING
3068163976SdougbWARNING                                                                 WARNING
3069163976SdougbWARNING         It is recommended that you upgrade to OpenSSL           WARNING
3070163976SdougbWARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
3071163976SdougbWARNING                                                                 WARNING
3072163976SdougbWARNING         You can disable this warning by specifying:             WARNING
3073163976SdougbWARNING                                                                 WARNING
3074163976SdougbWARNING               --disable-openssl-version-check          	        WARNING
3075163976SdougbWARNING                                                                 WARNING
3076163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3077163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3078163976SdougbEOF
3079163976Sdougbfi
3080163976Sdougb
3081135446Strhodes# Tell Emacs to edit this file in shell mode.
3082135446Strhodes# Local Variables:
3083135446Strhodes# mode: sh
3084135446Strhodes# End:
3085