configure.in revision 186462
1182645Sdougb# Copyright (C) 2004-2008  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
21186462SdougbAC_REVISION($Revision: 1.355.18.85 $)
22135446Strhodes
23135446StrhodesAC_INIT(lib/dns/name.c)
24170222SdougbAC_PREREQ(2.59)
25135446Strhodes
26135446StrhodesAC_CONFIG_HEADER(config.h)
27135446StrhodesAC_CONFIG_SUBDIRS(lib/bind)
28135446Strhodes
29135446StrhodesAC_CANONICAL_HOST
30135446Strhodes
31135446StrhodesAC_PROG_MAKE_SET
32135446StrhodesAC_PROG_RANLIB
33135446StrhodesAC_PROG_INSTALL
34170222SdougbAC_PROG_LN_S
35135446Strhodes
36135446StrhodesAC_SUBST(STD_CINCLUDES)
37135446StrhodesAC_SUBST(STD_CDEFINES)
38135446StrhodesAC_SUBST(STD_CWARNINGS)
39135446StrhodesAC_SUBST(CCOPT)
40135446Strhodes
41170222Sdougb#
42170222Sdougb# Make very sure that these are the first files processed by
43170222Sdougb# config.status, since we use the processed output as the input for
44170222Sdougb# AC_SUBST_FILE() subsitutions in other files.
45170222Sdougb#
46170222SdougbAC_CONFIG_FILES([make/rules make/includes])
47170222Sdougb
48135446StrhodesAC_PATH_PROG(AR, ar)
49135446StrhodesARFLAGS="cruv"
50135446StrhodesAC_SUBST(AR)
51135446StrhodesAC_SUBST(ARFLAGS)
52135446Strhodes
53135446Strhodes# The POSIX ln(1) program.  Non-POSIX systems may substitute
54135446Strhodes# "copy" or something.
55135446StrhodesLN=ln
56135446StrhodesAC_SUBST(LN)
57135446Strhodes
58135446Strhodescase "$AR" in
59135446Strhodes	"")
60135446Strhodes		AC_MSG_ERROR([
61135446Strhodesar program not found.  Please fix your PATH to include the directory in
62135446Strhodeswhich ar resides, or set AR in the environment with the full path to ar.
63135446Strhodes])
64135446Strhodes
65135446Strhodes		;;
66135446Strhodesesac
67135446Strhodes
68135446Strhodes#
69135446Strhodes# Etags.
70135446Strhodes#
71135446StrhodesAC_PATH_PROGS(ETAGS, etags emacs-etags)
72135446Strhodes
73135446Strhodes#
74135446Strhodes# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
75135446Strhodes# GNU emacs etags, and it requires the -L flag.
76135446Strhodes#
77135446Strhodesif test "X$ETAGS" != "X"; then
78135446Strhodes	AC_MSG_CHECKING(for Exuberant Ctags etags)
79135446Strhodes	if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
80135446Strhodes		AC_MSG_RESULT(yes)
81135446Strhodes		ETAGS="$ETAGS -L"
82135446Strhodes	else
83135446Strhodes		AC_MSG_RESULT(no)
84135446Strhodes	fi
85135446Strhodesfi
86135446StrhodesAC_SUBST(ETAGS)
87135446Strhodes
88135446Strhodes#
89135446Strhodes# Perl is optional; it is used only by some of the system test scripts.
90135446Strhodes#
91135446StrhodesAC_PATH_PROGS(PERL, perl5 perl)
92135446StrhodesAC_SUBST(PERL)
93135446Strhodes
94135446Strhodes#
95135446Strhodes# Special processing of paths depending on whether --prefix,
96135446Strhodes# --sysconfdir or --localstatedir arguments were given.  What's
97135446Strhodes# desired is some compatibility with the way previous versions
98135446Strhodes# of BIND built; they defaulted to /usr/local for most parts of
99135446Strhodes# the installation, but named.boot/named.conf was in /etc
100135446Strhodes# and named.pid was in /var/run.
101135446Strhodes#
102135446Strhodes# So ... if none of --prefix, --sysconfdir or --localstatedir are
103135446Strhodes# specified, set things up that way.  If --prefix is given, use
104135446Strhodes# it for sysconfdir and localstatedir the way configure normally
105135446Strhodes# would.  To change the prefix for everything but leave named.conf
106135446Strhodes# in /etc or named.pid in /var/run, then do this the usual configure way:
107135446Strhodes# ./configure --prefix=/somewhere --sysconfdir=/etc
108135446Strhodes# ./configure --prefix=/somewhere --localstatedir=/var
109135446Strhodes#
110135446Strhodes# To put named.conf and named.pid in /usr/local with everything else,
111135446Strhodes# set the prefix explicitly to /usr/local even though that's the default:
112135446Strhodes# ./configure --prefix=/usr/local
113135446Strhodes#
114135446Strhodescase "$prefix" in
115135446Strhodes        NONE)
116135446Strhodes                case "$sysconfdir" in
117135446Strhodes                        '${prefix}/etc')
118135446Strhodes                                sysconfdir=/etc
119135446Strhodes                                ;;
120135446Strhodes                esac
121135446Strhodes                case "$localstatedir" in
122135446Strhodes                        '${prefix}/var')
123135446Strhodes                                localstatedir=/var
124135446Strhodes                                ;;
125135446Strhodes                esac
126135446Strhodes                ;;
127135446Strhodesesac
128135446Strhodes
129135446Strhodes#
130135446Strhodes# Make sure INSTALL uses an absolute path, else it will be wrong in all
131135446Strhodes# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
132135446Strhodes# configure based on the location of the file where it is substituted.
133135446Strhodes# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
134135446Strhodes# subdirectory of install-sh, This relative path will be wrong for all
135135446Strhodes# directories more than one level down from install-sh.
136135446Strhodes#
137135446Strhodescase "$INSTALL" in
138135446Strhodes	/*)
139135446Strhodes                ;;
140135446Strhodes        *)
141135446Strhodes                #
142135446Strhodes                # Not all systems have dirname.
143135446Strhodes                #
144135446Strhodes                changequote({, })
145135446Strhodes                ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
146135446Strhodes                changequote([, ])
147135446Strhodes
148135446Strhodes                ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
149135446Strhodes                test "$ac_dir" = "$ac_prog" && ac_dir=.
150135446Strhodes                test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
151135446Strhodes                INSTALL="$ac_dir/$ac_prog"
152135446Strhodes                ;;
153135446Strhodesesac
154135446Strhodes
155135446Strhodes#
156135446Strhodes# On these hosts, we really want to use cc, not gcc, even if it is
157135446Strhodes# found.  The gcc that these systems have will not correctly handle
158135446Strhodes# pthreads.
159135446Strhodes#
160135446Strhodes# However, if the user sets $CC to be something, let that override
161135446Strhodes# our change.
162135446Strhodes#
163135446Strhodesif test "X$CC" = "X" ; then
164135446Strhodes	case "$host" in
165135446Strhodes		*-dec-osf*)
166135446Strhodes			CC="cc"
167135446Strhodes			;;
168135446Strhodes		*-solaris*)
169135446Strhodes                        # Use Sun's cc if it is available, but watch
170135446Strhodes                        # out for /usr/ucb/cc; it will never be the right
171135446Strhodes                        # compiler to use.
172135446Strhodes                        #
173135446Strhodes                        # If setting CC here fails, the AC_PROG_CC done
174135446Strhodes                        # below might still find gcc.
175135446Strhodes			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
176135446Strhodes			for ac_dir in $PATH; do
177135446Strhodes				test -z "$ac_dir" && ac_dir=.
178135446Strhodes				case "$ac_dir" in
179135446Strhodes				/usr/ucb)
180135446Strhodes					# exclude
181135446Strhodes					;;
182135446Strhodes				*)
183135446Strhodes					if test -f "$ac_dir/cc"; then
184135446Strhodes						CC="$ac_dir/cc"
185135446Strhodes						break
186135446Strhodes					fi
187135446Strhodes					;;
188135446Strhodes				esac
189135446Strhodes			done
190135446Strhodes			IFS="$ac_save_ifs"
191135446Strhodes			;;
192135446Strhodes		*-hp-hpux*)
193135446Strhodes			CC="cc"
194135446Strhodes			;;
195135446Strhodes		mips-sgi-irix*)
196135446Strhodes			CC="cc"
197135446Strhodes			;;
198135446Strhodes	esac
199135446Strhodesfi
200135446Strhodes
201135446StrhodesAC_PROG_CC
202135446Strhodes
203135446Strhodes#
204135446Strhodes# gcc's optimiser is broken at -02 for ultrasparc
205135446Strhodes#
206135446Strhodesif test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
207135446Strhodes	case "$host" in
208135446Strhodes	sparc-*)
209135446Strhodes		CCFLAGS="-g -O1"
210135446Strhodes		;;
211135446Strhodes	esac
212135446Strhodesfi
213135446Strhodes
214135446Strhodes#
215135446Strhodes# OS dependent CC flags
216135446Strhodes#
217135446Strhodescase "$host" in
218135446Strhodes	# OSF 5.0: recv/send are only avaliable with -D_POSIX_PII_SOCKET or
219135446Strhodes	# -D_XOPEN_SOURCE_EXTENDED.
220135446Strhodes	*-dec-osf*)
221135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
222135446Strhodes		CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
223135446Strhodes		;;
224135446Strhodes	#HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
225135446Strhodes	*-hp-hpux*)
226135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
227135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
228135446Strhodes		LIBS="-lxnet $LIBS"
229135446Strhodes		;;
230135446Strhodes	# Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
231135446Strhodes	*-solaris*)
232135446Strhodes		STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
233135446Strhodes		CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
234135446Strhodes		;;
235186462Sdougb	# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
236186462Sdougb	# parts of the IPv6 Advanced Socket API as a result.  This is stupid
237186462Sdougb	# as it breaks how the two halves (Basic and Advanced) of the IPv6
238186462Sdougb	# Socket API were designed to be used but we have to live with it.
239186462Sdougb	# Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
240186462Sdougb	*-linux*)
241186462Sdougb		STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
242186462Sdougb		CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
243186462Sdougb		;;
244135446Strhodesesac
245135446Strhodes
246135446StrhodesAC_HEADER_STDC
247135446Strhodes
248135446StrhodesAC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
249135446Strhodes[$ac_includes_default
250135446Strhodes#ifdef HAVE_SYS_PARAM_H
251135446Strhodes# include <sys/param.h>
252135446Strhodes#endif
253135446Strhodes])
254135446Strhodes
255135446StrhodesAC_C_CONST
256135446StrhodesAC_C_INLINE
257186462SdougbAC_C_VOLATILE
258135446StrhodesAC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
259135446Strhodes
260135446Strhodes#
261135446Strhodes# UnixWare 7.1.1 with the feature supplement to the UDK compiler
262135446Strhodes# is reported to not support "static inline" (RT #1212).
263135446Strhodes#
264135446StrhodesAC_MSG_CHECKING(for static inline breakage)
265135446StrhodesAC_TRY_COMPILE(, [
266135446Strhodes		foo1();
267135446Strhodes	}
268135446Strhodes
269135446Strhodes	static inline int foo1() {
270135446Strhodes		return 0;
271135446Strhodes	}
272135446Strhodes
273135446Strhodes	static inline int foo2() {
274135446Strhodes		return foo1();
275135446Strhodes	],
276135446Strhodes	[AC_MSG_RESULT(no)],
277135446Strhodes	[AC_MSG_RESULT(yes)
278135446Strhodes         AC_DEFINE(inline, )])
279135446Strhodes
280135446StrhodesAC_TYPE_SIZE_T
281135446StrhodesAC_CHECK_TYPE(ssize_t, int)
282153816SdougbAC_CHECK_TYPE(uintptr_t,unsigned long)
283143731SdougbAC_CHECK_TYPE(socklen_t,
284143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
285143731Sdougb[
286143731SdougbAC_TRY_COMPILE(
287143731Sdougb[
288143731Sdougb#include <sys/types.h>
289143731Sdougb#include <sys/socket.h>
290143731Sdougbint getsockname(int, struct sockaddr *, size_t *);
291143731Sdougb],[],
292143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
293143731Sdougb[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
294143731Sdougb],
295143731Sdougb[
296143731Sdougb#include <sys/types.h>
297143731Sdougb#include <sys/socket.h>
298143731Sdougb])
299143731SdougbAC_SUBST(ISC_SOCKADDR_LEN_T)
300135446StrhodesAC_HEADER_TIME
301135446StrhodesAC_MSG_CHECKING(for long long)
302135446StrhodesAC_TRY_COMPILE([],[long long i = 0; return (0);],
303135446Strhodes	[AC_MSG_RESULT(yes)
304135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
305135446Strhodes	[AC_MSG_RESULT(no)
306135446Strhodes		ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
307135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELONGLONG)
308135446Strhodes
309135446Strhodes#
310135446Strhodes# check if we have lifconf
311135446Strhodes#
312135446StrhodesAC_MSG_CHECKING(for struct lifconf)
313135446StrhodesAC_TRY_COMPILE([
314135446Strhodes#include <sys/types.h>
315135446Strhodes#include <sys/socket.h>
316135446Strhodes#include <net/if.h>
317135446Strhodes],
318135446Strhodes[
319135446Strhodesstruct lifconf lifconf;
320135446Strhodeslifconf.lifc_len = 0;
321135446Strhodes]
322135446Strhodes,
323135446Strhodes	[AC_MSG_RESULT(yes)
324135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
325135446Strhodes	[AC_MSG_RESULT(no)
326135446Strhodes		ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
327135446StrhodesAC_SUBST(ISC_PLATFORM_HAVELIFCONF)
328135446Strhodes
329186462Sdougb#
330186462Sdougb# check if we have kqueue
331186462Sdougb#
332186462SdougbAC_ARG_ENABLE(kqueue,
333186462Sdougb	[  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
334186462Sdougb	      want_kqueue="$enableval",  want_kqueue="yes")
335186462Sdougbcase $want_kqueue in
336186462Sdougbyes)
337186462Sdougb	AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
338186462Sdougb	case $ac_cv_have_kqueue in
339186462Sdougb	yes)
340186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
341186462Sdougb		;;
342186462Sdougb	*)
343186462Sdougb		ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
344186462Sdougb		;;
345186462Sdougb	esac
346186462Sdougb	;;
347186462Sdougb*)
348186462Sdougb	ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
349186462Sdougb	;;
350186462Sdougbesac
351186462SdougbAC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
352135446Strhodes
353135446Strhodes#
354186462Sdougb# check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
355186462Sdougb# so we need to try running the code, not just test its existence.
356186462Sdougb#
357186462SdougbAC_ARG_ENABLE(epoll,
358186462Sdougb	[  --enable-epoll          use Linux epoll when available [[default=yes]]],
359186462Sdougb	      want_epoll="$enableval",  want_epoll="yes")
360186462Sdougbcase $want_epoll in
361186462Sdougbyes)
362186462Sdougb	AC_MSG_CHECKING(epoll support)
363186462Sdougb	AC_TRY_RUN([
364186462Sdougb#include <sys/epoll.h>
365186462Sdougbint main() {
366186462Sdougb	if (epoll_create(1) < 0)
367186462Sdougb		return (1);
368186462Sdougb	return (0);
369186462Sdougb}
370186462Sdougb],
371186462Sdougb	[AC_MSG_RESULT(yes)
372186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
373186462Sdougb	[AC_MSG_RESULT(no)
374186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
375186462Sdougb	;;
376186462Sdougb*)
377186462Sdougb	ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
378186462Sdougb	;;
379186462Sdougbesac
380186462SdougbAC_SUBST(ISC_PLATFORM_HAVEEPOLL)
381186462Sdougb
382186462Sdougb#
383186462Sdougb# check if we support /dev/poll
384186462Sdougb#
385186462SdougbAC_ARG_ENABLE(devpoll,
386186462Sdougb	[  --enable-devpoll        use /dev/poll when available [[default=yes]]],
387186462Sdougb	      want_devpoll="$enableval",  want_devpoll="yes")
388186462Sdougbcase $want_devpoll in
389186462Sdougbyes)
390186462Sdougb	AC_CHECK_HEADERS(sys/devpoll.h,
391186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
392186462Sdougb	,
393186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
394186462Sdougb	)
395186462Sdougb	;;
396186462Sdougb*)
397186462Sdougb	ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
398186462Sdougb	;;
399186462Sdougbesac
400186462SdougbAC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
401186462Sdougb
402186462Sdougb#
403135446Strhodes# check if we need to #include sys/select.h explicitly
404135446Strhodes#
405135446Strhodescase $ac_cv_header_unistd_h in
406135446Strhodesyes)
407135446StrhodesAC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
408135446StrhodesAC_TRY_COMPILE([
409135446Strhodes#include <sys/types.h> /* Ultrix */
410135446Strhodes#include <unistd.h>],
411135446Strhodes[fd_set read_set; return (0);],
412135446Strhodes	[AC_MSG_RESULT(yes)
413135446Strhodes	 ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
414135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
415135446Strhodes	[AC_MSG_RESULT(no)
416135446Strhodes	case $ac_cv_header_sys_select_h in
417135446Strhodes	yes)
418135446Strhodes         ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
419135446Strhodes	 LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
420135446Strhodes		;;
421135446Strhodes	no)
422135446Strhodes		AC_MSG_ERROR([need either working unistd.h or sys/select.h])
423135446Strhodes		;;
424135446Strhodes	esac
425135446Strhodes	])
426135446Strhodes	;;
427135446Strhodesno)
428135446Strhodes	case $ac_cv_header_sys_select_h in
429135446Strhodes	yes)
430135446Strhodes             ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
431135446Strhodes	     LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
432135446Strhodes		;;
433135446Strhodes	no)
434135446Strhodes		AC_MSG_ERROR([need either unistd.h or sys/select.h])
435135446Strhodes		;;
436135446Strhodes	esac
437135446Strhodes	;;
438135446Strhodesesac
439135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
440135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
441135446Strhodes
442135446Strhodes#
443135446Strhodes# Find the machine's endian flavor.
444135446Strhodes#
445135446StrhodesAC_C_BIGENDIAN
446135446Strhodes
447170222Sdougb
448135446Strhodes#
449135446Strhodes# was --with-openssl specified?
450135446Strhodes#
451163976SdougbOPENSSL_WARNING=
452135446StrhodesAC_MSG_CHECKING(for OpenSSL library)
453135446StrhodesAC_ARG_WITH(openssl,
454135446Strhodes[  --with-openssl[=PATH]   Build with OpenSSL [yes|no|path].
455135446Strhodes                          (Required for DNSSEC)],
456135446Strhodes    use_openssl="$withval", use_openssl="auto")
457135446Strhodes
458165071Sdougbopenssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
459143731Sdougbif test "$use_openssl" = "auto"
460143731Sdougbthen
461143731Sdougb	for d in $openssldirs
462143731Sdougb	do
463143731Sdougb		if test -f $d/include/openssl/opensslv.h
464143731Sdougb		then
465143731Sdougb			use_openssl=$d
466143731Sdougb			break
467143731Sdougb		fi
468143731Sdougb	done
469143731Sdougbfi
470135446Strhodescase "$use_openssl" in
471135446Strhodes	no)
472135446Strhodes		AC_MSG_RESULT(no)
473135446Strhodes		DST_OPENSSL_INC=""
474135446Strhodes		USE_OPENSSL=""
475135446Strhodes		;;
476143731Sdougb	auto)
477143731Sdougb		DST_OPENSSL_INC=""
478143731Sdougb		USE_OPENSSL=""
479143731Sdougb		AC_MSG_RESULT(not found)
480143731Sdougb		;;
481135446Strhodes	*)
482143731Sdougb		if test "$use_openssl" = "yes"
483135446Strhodes		then
484135446Strhodes		    	# User did not specify a path - guess it
485135446Strhodes			for d in $openssldirs
486135446Strhodes			do
487135446Strhodes				if test -f $d/include/openssl/opensslv.h
488135446Strhodes				then
489135446Strhodes				 	use_openssl=$d
490135446Strhodes					break
491135446Strhodes				fi
492135446Strhodes			done
493135446Strhodes			if test "$use_openssl" = "yes"
494135446Strhodes			then
495135446Strhodes			    	AC_MSG_RESULT(not found)
496135446Strhodes				AC_MSG_ERROR(
497135446Strhodes[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
498135446Strhodes			fi
499135446Strhodes		fi
500135446Strhodes		USE_OPENSSL='-DOPENSSL'
501135446Strhodes		if test "$use_openssl" = "/usr"
502135446Strhodes		then
503135446Strhodes			DST_OPENSSL_INC=""
504135446Strhodes			DNS_OPENSSL_LIBS="-lcrypto"
505135446Strhodes		else
506135446Strhodes			DST_OPENSSL_INC="-I$use_openssl/include"
507135446Strhodes			case $host in
508135446Strhodes			*-solaris*)
509135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
510135446Strhodes				;;
511165071Sdougb			*-hp-hpux*)
512165071Sdougb				DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
513165071Sdougb				;;
514174187Sdougb			*-apple-darwin*)
515174187Sdougb				#
516174187Sdougb				# Apple's ld seaches for serially for dynamic
517174187Sdougb				# then static libraries.  This means you can't
518174187Sdougb				# use -L to override dynamic system libraries
519174187Sdougb				# with static ones when linking.  Instead
520174187Sdougb				# we specify a absolute path.
521174187Sdougb				#
522174187Sdougb				if test -f "$use_openssl/lib/libcrypto.dylib"
523174187Sdougb				then
524174187Sdougb					DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
525174187Sdougb				else
526174187Sdougb					DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
527174187Sdougb				fi
528174187Sdougb				;;
529135446Strhodes			*)
530135446Strhodes				DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
531135446Strhodes				;;
532135446Strhodes			esac
533135446Strhodes		fi
534135446Strhodes		AC_MSG_RESULT(using openssl from $use_openssl/lib and $use_openssl/include)
535135446Strhodes
536135446Strhodes		saved_cflags="$CFLAGS"
537135446Strhodes		saved_libs="$LIBS"
538135446Strhodes		CFLAGS="$CFLAGS $DST_OPENSSL_INC"
539135446Strhodes		LIBS="$LIBS $DNS_OPENSSL_LIBS"
540135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL works)
541135446Strhodes		AC_TRY_RUN([
542135446Strhodes#include <openssl/err.h>
543135446Strhodesint main() {
544135446Strhodes	ERR_clear_error();
545135446Strhodes	return (0);
546135446Strhodes}
547135446Strhodes],
548135446Strhodes	        [AC_MSG_RESULT(yes)],
549135446Strhodes		[AC_MSG_RESULT(no)
550135446Strhodes		 AC_MSG_ERROR(Could not run test program using OpenSSL from
551135446Strhodes$use_openssl/lib and $use_openssl/include.
552135446StrhodesPlease check the argument to --with-openssl and your
553135446Strhodesshared library configuration (e.g., LD_LIBRARY_PATH).)],
554135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
555135446Strhodes
556135446Strhodes		AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
557135446Strhodes		AC_TRY_LINK([
558135446Strhodes#include <openssl/err.h>],
559135446Strhodes[ DSO_METHOD_dlfcn(); ],
560135446Strhodes		[AC_MSG_RESULT(no)],
561135446Strhodes		[LIBS="$LIBS -ldl"
562135446Strhodes		AC_TRY_LINK([
563135446Strhodes#include <openssl/err.h>
564135446Strhodes],[ DSO_METHOD_dlfcn(); ],
565135446Strhodes		[AC_MSG_RESULT(yes)
566135446Strhodes		DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
567135446Strhodes		],
568135446Strhodes		 [AC_MSG_RESULT(unknown)
569135446Strhodes		 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
570135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)])
571135446Strhodes		],
572135446Strhodes		[AC_MSG_RESULT(assuming it does work on target platform)]
573135446Strhodes		)
574135446Strhodes		 
575163976SdougbAC_ARG_ENABLE(openssl-version-check,
576163976Sdougb[AC_HELP_STRING([--enable-openssl-version-check],
577165071Sdougb        [Check OpenSSL Version @<:@default=yes@:>@])])
578163976Sdougbcase "$enable_openssl_version_check" in
579163976Sdougbyes|'')
580135446Strhodes		AC_MSG_CHECKING(OpenSSL library version)
581135446Strhodes		AC_TRY_RUN([
582135446Strhodes#include <stdio.h>
583135446Strhodes#include <openssl/opensslv.h>
584135446Strhodesint main() {
585165071Sdougb        if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
586165071Sdougb	     OPENSSL_VERSION_NUMBER < 0x00908000L) ||
587165071Sdougb	     OPENSSL_VERSION_NUMBER >= 0x0090804fL)
588135446Strhodes                return (0);
589135446Strhodes	printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
590135446Strhodes		OPENSSL_VERSION_NUMBER);
591163976Sdougb	printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
592163976Sdougb	       "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
593135446Strhodes        return (1);
594135446Strhodes}
595163976Sdougb		],
596135446Strhodes	        [AC_MSG_RESULT(ok)],
597135446Strhodes		[AC_MSG_RESULT(not compatible)
598163976Sdougb                 OPENSSL_WARNING=yes
599163976Sdougb		],
600135446Strhodes		[AC_MSG_RESULT(assuming target platform has compatible version)])
601163976Sdougb;;
602163976Sdougbno)
603163976Sdougb	AC_MSG_RESULT(Skipped OpenSSL version check)
604163976Sdougb;;
605163976Sdougbesac
606163976Sdougb
607135446Strhodes		AC_MSG_CHECKING(for OpenSSL DSA support)
608135446Strhodes		if test -f $use_openssl/include/openssl/dsa.h
609135446Strhodes		then
610135446Strhodes			AC_DEFINE(HAVE_OPENSSL_DSA)
611135446Strhodes			AC_MSG_RESULT(yes)
612135446Strhodes		else
613135446Strhodes			AC_MSG_RESULT(no)
614135446Strhodes		fi
615135446Strhodes		CFLAGS="$saved_cflags"
616135446Strhodes		LIBS="$saved_libs"
617135446Strhodes		;;
618135446Strhodesesac
619135446Strhodes
620135446Strhodes#
621135446Strhodes# This would include the system openssl path (and linker options to use
622135446Strhodes# it as needed) if it is found.
623135446Strhodes#
624135446Strhodes
625135446StrhodesAC_SUBST(USE_OPENSSL)
626135446StrhodesAC_SUBST(DST_OPENSSL_INC)
627135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
628135446Strhodes
629135446Strhodes#
630135446Strhodes# was --with-gssapi specified?
631135446Strhodes#
632135446Strhodes#AC_MSG_CHECKING(for GSSAPI library)
633135446Strhodes#AC_ARG_WITH(gssapi,
634135446Strhodes#[  --with-gssapi=PATH   Specify path for system-supplied GSSAPI],
635135446Strhodes#    use_gssapi="$withval", use_gssapi="no")
636135446Strhodes#
637135446Strhodes#case "$use_gssapi" in
638135446Strhodes#	no)
639135446Strhodes#		USE_GSSAPI=''
640135446Strhodes#		DST_GSSAPI_INC=''
641135446Strhodes#		DNS_GSSAPI_LIBS=''
642135446Strhodes#		AC_MSG_RESULT(not specified)
643135446Strhodes#		;;
644135446Strhodes#	yes)
645135446Strhodes#		AC_MSG_ERROR([--with-gssapi must specify a path])
646135446Strhodes#		;;
647135446Strhodes#	*)
648135446Strhodes#		USE_GSSAPI='-DGSSAPI'
649135446Strhodes#		DST_GSSAPI_INC="-I$use_gssapi/include"
650135446Strhodes#		DNS_GSSAPI_LIBS="-L$use_gssapi/lib -lgssapi_krb5"
651135446Strhodes#		AC_MSG_RESULT(using gssapi from $use_gssapi/lib and $use_gssapi/include)
652135446Strhodes#		;;
653135446Strhodes#esac
654135446Strhodes
655135446StrhodesUSE_GSSAPI=''
656135446StrhodesDST_GSSAPI_INC=''
657135446StrhodesDNS_GSSAPI_LIBS=''
658135446Strhodes
659135446StrhodesAC_SUBST(USE_GSSAPI)
660135446StrhodesAC_SUBST(DST_GSSAPI_INC)
661135446StrhodesDNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_GSSAPI_LIBS"
662135446Strhodes
663135446Strhodes#
664135446Strhodes# Applications linking with libdns also need to link with these libraries.
665135446Strhodes#
666135446Strhodes
667135446StrhodesAC_SUBST(DNS_CRYPTO_LIBS)
668135446Strhodes
669135446Strhodes#
670135446Strhodes# was --with-randomdev specified?
671135446Strhodes#
672135446StrhodesAC_MSG_CHECKING(for random device)
673135446StrhodesAC_ARG_WITH(randomdev,
674135446Strhodes[  --with-randomdev=PATH Specify path for random device],
675135446Strhodes    use_randomdev="$withval", use_randomdev="unspec")
676135446Strhodes
677135446Strhodescase "$use_randomdev" in
678135446Strhodes	unspec)
679135446Strhodes		case "$host" in
680135446Strhodes			*-openbsd*)
681135446Strhodes				devrandom=/dev/arandom
682135446Strhodes				;;
683135446Strhodes			*)
684135446Strhodes				devrandom=/dev/random
685135446Strhodes				;;
686135446Strhodes		esac
687135446Strhodes		AC_MSG_RESULT($devrandom)
688135446Strhodes		AC_CHECK_FILE($devrandom,
689135446Strhodes			      AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
690135446Strhodes						 "$devrandom"),)
691135446Strhodes		;;
692135446Strhodes	yes)
693135446Strhodes		AC_MSG_ERROR([--with-randomdev must specify a path])
694135446Strhodes		;;
695135446Strhodes	no)
696135446Strhodes		AC_MSG_RESULT(disabled)
697135446Strhodes		;;
698135446Strhodes	*)
699135446Strhodes		AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
700135446Strhodes		AC_MSG_RESULT(using "$use_randomdev")
701135446Strhodes		;;
702135446Strhodesesac
703135446Strhodes
704135446Strhodes#
705135446Strhodes# Do we have arc4random() ?
706135446Strhodes#
707135446StrhodesAC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
708135446Strhodes
709153816Sdougbsinclude(config.threads.in)dnl
710135446Strhodes
711135446Strhodesif $use_threads
712135446Strhodesthen
713165071Sdougb	if test "X$GCC" = "Xyes"; then
714165071Sdougb		case "$host" in
715165071Sdougb		*-freebsd*)
716165071Sdougb			CC="$CC -pthread"
717165071Sdougb			CCOPT="$CCOPT -pthread"
718165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
719165071Sdougb			;;
720165071Sdougb		*-openbsd*)
721165071Sdougb			CC="$CC -pthread"
722165071Sdougb			CCOPT="$CCOPT -pthread"
723165071Sdougb			;;
724165071Sdougb		*-solaris*)
725165071Sdougb			LIBS="$LIBS -lthread"
726165071Sdougb			;;
727165071Sdougb		*-ibm-aix*)
728165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
729165071Sdougb			;;
730165071Sdougb		esac
731165071Sdougb	else
732165071Sdougb		case $host in
733165071Sdougb		*-dec-osf*)
734165071Sdougb			CC="$CC -pthread"
735165071Sdougb			CCOPT="$CCOPT -pthread"
736165071Sdougb			;;
737165071Sdougb		*-solaris*)
738165071Sdougb			CC="$CC -mt"
739165071Sdougb			CCOPT="$CCOPT -mt"
740165071Sdougb			;;
741165071Sdougb		*-ibm-aix*)
742165071Sdougb			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
743165071Sdougb			;;
744165071Sdougb		*-sco-sysv*uw*|*-*-sysv*UnixWare*)
745165071Sdougb			CC="$CC -Kthread"
746165071Sdougb			CCOPT="$CCOPT -Kthread"
747165071Sdougb			;;
748165071Sdougb		*-*-sysv*OpenUNIX*)
749165071Sdougb			CC="$CC -Kpthread"
750165071Sdougb			CCOPT="$CCOPT -Kpthread"
751165071Sdougb			;;
752165071Sdougb		esac
753165071Sdougb	fi
754165071Sdougb	ALWAYS_DEFINES="-D_REENTRANT"
755165071Sdougb	ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
756165071Sdougb	thread_dir=pthreads
757135446Strhodes	#
758135446Strhodes	# We'd like to use sigwait() too
759135446Strhodes	#
760165071Sdougb	AC_CHECK_FUNC(sigwait,
761165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
762165071Sdougb		      AC_CHECK_LIB(c, sigwait,
763165071Sdougb		      AC_DEFINE(HAVE_SIGWAIT),
764165071Sdougb		      AC_CHECK_LIB(pthread, sigwait,
765165071Sdougb				   AC_DEFINE(HAVE_SIGWAIT),
766165071Sdougb				   AC_CHECK_LIB(pthread, _Psigwait,
767165071Sdougb					        AC_DEFINE(HAVE_SIGWAIT),))))
768135446Strhodes
769135446Strhodes	AC_CHECK_FUNC(pthread_attr_getstacksize,
770135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
771135446Strhodes
772135446Strhodes	AC_CHECK_FUNC(pthread_attr_setstacksize,
773135446Strhodes		      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
774135446Strhodes
775135446Strhodes	#
776135446Strhodes	# Additional OS-specific issues related to pthreads and sigwait.
777135446Strhodes	#
778135446Strhodes	case "$host" in
779135446Strhodes		#
780135446Strhodes		# One more place to look for sigwait.
781135446Strhodes		#
782135446Strhodes		*-freebsd*)
783135446Strhodes			AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
784143731Sdougb			case $host in
785153816Sdougb			*-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
786153816Sdougb			*-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
787143731Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
788143731Sdougb				;;
789153816Sdougb			*-freebsd6.*)
790153816Sdougb				AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
791153816Sdougb				;;
792143731Sdougb			esac
793135446Strhodes			;;
794135446Strhodes		#
795135446Strhodes		# BSDI 3.0 through 4.0.1 needs pthread_init() to be
796135446Strhodes		# called before certain pthreads calls.	 This is deprecated
797135446Strhodes		# in BSD/OS 4.1.
798135446Strhodes		#
799135446Strhodes		*-bsdi3.*|*-bsdi4.0*)
800135446Strhodes			AC_DEFINE(NEED_PTHREAD_INIT)
801135446Strhodes			;;
802135446Strhodes		#
803135446Strhodes		# LinuxThreads requires some changes to the way we
804135446Strhodes		# deal with signals.
805135446Strhodes		#
806135446Strhodes		*-linux*)
807135446Strhodes			AC_DEFINE(HAVE_LINUXTHREADS)
808135446Strhodes			;;
809135446Strhodes		#
810135446Strhodes		# Ensure the right sigwait() semantics on Solaris and make
811135446Strhodes		# sure we call pthread_setconcurrency.
812135446Strhodes		#
813135446Strhodes		*-solaris*)
814135446Strhodes			AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
815135446Strhodes			AC_CHECK_FUNC(pthread_setconcurrency,
816135446Strhodes				      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
817135446Strhodes			;;
818135446Strhodes		#
819135446Strhodes		# UnixWare does things its own way.
820135446Strhodes		#
821135446Strhodes		*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
822135446Strhodes			AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
823135446Strhodes			;;
824135446Strhodes	esac
825135446Strhodes
826135446Strhodes	#
827135446Strhodes	# Look for sysconf to allow detection of the number of processors.
828135446Strhodes	#
829135446Strhodes	AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
830135446Strhodes
831135446Strhodeselse
832135446Strhodes	ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
833135446Strhodes	thread_dir=nothreads
834135446Strhodes	ALWAYS_DEFINES=""
835135446Strhodesfi
836135446Strhodes
837135446StrhodesAC_SUBST(ALWAYS_DEFINES)
838135446StrhodesAC_SUBST(ISC_PLATFORM_USETHREADS)
839135446StrhodesISC_THREAD_DIR=$thread_dir
840135446StrhodesAC_SUBST(ISC_THREAD_DIR)
841135446Strhodes
842135446Strhodes#
843135446Strhodes# In solaris 10, SMF can manage named service
844135446Strhodes#
845135446StrhodesAC_CHECK_LIB(scf, smf_enable_instance)
846135446Strhodes
847135446Strhodes#
848135446Strhodes# flockfile is usually provided by pthreads, but we may want to use it
849135446Strhodes# even if compiled with --disable-threads.  getc_unlocked might also not
850135446Strhodes# be defined.
851135446Strhodes#
852135446StrhodesAC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
853135446StrhodesAC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
854135446Strhodes
855135446Strhodes# 
856135446Strhodes# Indicate what the final decision was regarding threads.
857135446Strhodes#
858135446StrhodesAC_MSG_CHECKING(whether to build with threads)
859135446Strhodesif $use_threads; then
860135446Strhodes	AC_MSG_RESULT(yes)
861135446Strhodeselse
862135446Strhodes	AC_MSG_RESULT(no)
863135446Strhodesfi
864135446Strhodes
865135446Strhodes# 
866135446Strhodes# End of pthreads stuff.
867135446Strhodes#
868135446Strhodes
869135446Strhodes#
870135446Strhodes# Large File
871135446Strhodes#
872135446StrhodesAC_ARG_ENABLE(largefile, [  --enable-largefile	  64-bit file support],
873135446Strhodes	      want_largefile="yes", want_largefile="no")
874135446Strhodescase $want_largefile in
875135446Strhodes	yes)
876135446Strhodes		ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
877135446Strhodes		;;
878135446Strhodes	*)
879135446Strhodes		;;
880135446Strhodesesac
881135446Strhodes
882135446Strhodes#
883135446Strhodes# Additional compiler settings.
884135446Strhodes#
885135446StrhodesMKDEPCC="$CC"
886135446StrhodesMKDEPCFLAGS="-M"
887135446StrhodesIRIX_DNSSEC_WARNINGS_HACK=""
888135446Strhodes
889135446Strhodesif test "X$GCC" = "Xyes"; then
890165071Sdougb	AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
891165071Sdougb	SAVE_CFLAGS=$CFLAGS
892165071Sdougb	CFLAGS=-fno-strict-aliasing
893165071Sdougb	AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
894165071Sdougb	CFLAGS=$SAVE_CFLAGS
895165071Sdougb	if test "$FNOSTRICTALIASING" = "yes"; then
896165071Sdougb		AC_MSG_RESULT(yes)
897165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
898165071Sdougb	else
899165071Sdougb		AC_MSG_RESULT(no)
900165071Sdougb	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
901165071Sdougb	fi
902143731Sdougb	case "$host" in
903143731Sdougb	*-hp-hpux*)
904153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
905143731Sdougb		;;
906143731Sdougb	esac
907135446Strhodeselse
908135446Strhodes	case $host in
909135446Strhodes	*-dec-osf*)
910135446Strhodes		CC="$CC -std"
911135446Strhodes		CCOPT="$CCOPT -std"
912135446Strhodes		MKDEPCC="$CC"
913135446Strhodes		;;
914135446Strhodes	*-hp-hpux*)
915135446Strhodes		CC="$CC -Ae -z"
916135446Strhodes		# The version of the C compiler that constantly warns about
917135446Strhodes                # 'const' as well as alignment issues is unfortunately not
918135446Strhodes                # able to be discerned via the version of the operating
919135446Strhodes                # system, nor does cc have a version flag.
920135446Strhodes		case "`$CC +W 123 2>&1`" in
921135446Strhodes		*Unknown?option*)
922135446Strhodes			STD_CWARNINGS="+w1"
923135446Strhodes			;;
924135446Strhodes		*)
925135446Strhodes			# Turn off the pointlessly noisy warnings.
926153816Sdougb			STD_CWARNINGS="+w1 +W 474,530,2193,2236"
927135446Strhodes			;;
928135446Strhodes		esac
929135446Strhodes		CCOPT="$CCOPT -Ae -z"
930153816Sdougb		LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
931135446Strhodes		MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
932135446Strhodes		;;
933135446Strhodes	*-sgi-irix*)
934135446Strhodes		STD_CWARNINGS="-fullwarn -woff 1209"
935135446Strhodes		#
936135446Strhodes		# Silence more than 250 instances of
937135446Strhodes		#   "prototyped function redeclared without prototype"
938135446Strhodes		# and 11 instances of
939135446Strhodes		#   "variable ... was set but never used"
940135446Strhodes		# from lib/dns/sec/openssl.
941135446Strhodes		#
942135446Strhodes		IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
943135446Strhodes		;;
944135446Strhodes	*-solaris*)
945135446Strhodes		MKDEPCFLAGS="-xM"
946135446Strhodes		;;
947135446Strhodes	*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
948135446Strhodes                # UnixWare
949135446Strhodes		CC="$CC -w"
950135446Strhodes		;;
951135446Strhodes	esac
952135446Strhodesfi
953135446Strhodes
954135446StrhodesAC_SUBST(MKDEPCC)
955135446StrhodesAC_SUBST(MKDEPCFLAGS)
956135446StrhodesAC_SUBST(MKDEPPROG)
957135446StrhodesAC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
958135446Strhodes
959135446Strhodes#
960135446Strhodes# NLS
961135446Strhodes#
962135446StrhodesAC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
963135446Strhodes
964135446Strhodes#
965135446Strhodes# -lxnet buys us one big porting headache...  standards, gotta love 'em.
966135446Strhodes#
967135446Strhodes# AC_CHECK_LIB(xnet, socket, ,
968135446Strhodes#    AC_CHECK_LIB(socket, socket)
969135446Strhodes#    AC_CHECK_LIB(nsl, inet_ntoa)
970135446Strhodes# )
971135446Strhodes#
972135446Strhodes# Use this for now, instead:
973135446Strhodes#
974135446Strhodescase "$host" in
975135446Strhodes	mips-sgi-irix*)
976135446Strhodes		;;
977135446Strhodes	*)
978135446Strhodes		AC_CHECK_LIB(socket, socket)
979135446Strhodes		AC_CHECK_LIB(nsl, inet_ntoa)
980135446Strhodes		;;
981135446Strhodesesac
982135446Strhodes
983135446Strhodes#
984186462Sdougb# Work around Solaris's select() limitations.
985186462Sdougb#
986186462Sdougbcase "$host" in
987186462Sdougb	*-solaris2.[[89]]|*-solaris2.1?)
988186462Sdougb	AC_DEFINE(FD_SETSIZE, 65536,
989186462Sdougb		  [Solaris hack to get select_large_fdset.])
990186462Sdougb	;;
991186462Sdougbesac
992186462Sdougb
993186462Sdougb#
994135446Strhodes# Purify support
995135446Strhodes#
996135446StrhodesAC_MSG_CHECKING(whether to use purify)
997135446StrhodesAC_ARG_WITH(purify,
998135446Strhodes	[  --with-purify[=PATH]	use Rational purify],
999135446Strhodes	use_purify="$withval", use_purify="no")
1000135446Strhodes
1001135446Strhodescase "$use_purify" in
1002135446Strhodes	no)
1003135446Strhodes		;;
1004135446Strhodes	yes)
1005135446Strhodes		AC_PATH_PROG(purify_path, purify, purify)
1006135446Strhodes		;;
1007135446Strhodes	*)
1008135446Strhodes		purify_path="$use_purify"
1009135446Strhodes		;;
1010135446Strhodesesac
1011135446Strhodes
1012135446Strhodescase "$use_purify" in
1013135446Strhodes	no)
1014135446Strhodes		AC_MSG_RESULT(no)
1015135446Strhodes		PURIFY=""
1016135446Strhodes		;;
1017135446Strhodes	*)
1018135446Strhodes		if test -f $purify_path || test $purify_path = purify; then
1019135446Strhodes			AC_MSG_RESULT($purify_path)
1020135446Strhodes			PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1021135446Strhodes			PURIFY="$purify_path $PURIFYFLAGS"
1022135446Strhodes		else
1023135446Strhodes			AC_MSG_ERROR([$purify_path not found.
1024135446Strhodes
1025135446StrhodesPlease choose the proper path with the following command:
1026135446Strhodes
1027135446Strhodes    configure --with-purify=PATH
1028135446Strhodes])
1029135446Strhodes		fi
1030135446Strhodes		;;
1031135446Strhodesesac
1032135446Strhodes
1033135446StrhodesAC_SUBST(PURIFY)
1034135446Strhodes
1035135446Strhodes#
1036135446Strhodes# GNU libtool support
1037135446Strhodes#
1038186462Sdougbcase $build_os in
1039186462Sdougbsunos*)
1040186462Sdougb    # Just set the maximum command line length for sunos as it otherwise
1041186462Sdougb    # takes a exceptionally long time to work it out. Required for libtool.
1042186462Sdougb    lt_cv_sys_max_cmd_len=4096;
1043186462Sdougb    ;;
1044186462Sdougbesac
1045186462Sdougb
1046135446StrhodesAC_ARG_WITH(libtool,
1047135446Strhodes	    [  --with-libtool	use GNU libtool (following indented options supported)],
1048135446Strhodes	    use_libtool="$withval", use_libtool="no")
1049135446Strhodes
1050135446Strhodescase $use_libtool in
1051135446Strhodes	yes)
1052135446Strhodes		AM_PROG_LIBTOOL
1053135446Strhodes		O=lo
1054135446Strhodes		A=la
1055135446Strhodes		LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1056135446Strhodes		LIBTOOL_MODE_COMPILE='--mode=compile'
1057135446Strhodes		LIBTOOL_MODE_INSTALL='--mode=install'
1058135446Strhodes		LIBTOOL_MODE_LINK='--mode=link'
1059143731Sdougb		case "$host" in
1060143731Sdougb		*) LIBTOOL_ALLOW_UNDEFINED= ;;
1061143731Sdougb		esac
1062143731Sdougb		case "$host" in
1063143731Sdougb		*-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1064143731Sdougb		*) LIBTOOL_IN_MAIN= ;;
1065143731Sdougb		esac;
1066135446Strhodes		;;
1067135446Strhodes	*)
1068135446Strhodes		O=o
1069135446Strhodes		A=a
1070135446Strhodes		LIBTOOL=
1071135446Strhodes		AC_SUBST(LIBTOOL)
1072135446Strhodes		LIBTOOL_MKDEP_SED=
1073135446Strhodes		LIBTOOL_MODE_COMPILE=
1074135446Strhodes		LIBTOOL_MODE_INSTALL=
1075135446Strhodes		LIBTOOL_MODE_LINK=
1076143731Sdougb		LIBTOOL_ALLOW_UNDEFINED=
1077143731Sdougb		LIBTOOL_IN_MAIN=
1078135446Strhodes		;;
1079135446Strhodesesac
1080135446Strhodes
1081135446Strhodes#
1082135446Strhodes# File name extension for static archive files, for those few places
1083135446Strhodes# where they are treated differently from dynamic ones.
1084135446Strhodes#
1085135446StrhodesSA=a
1086135446Strhodes
1087135446StrhodesAC_SUBST(O)
1088135446StrhodesAC_SUBST(A)
1089135446StrhodesAC_SUBST(SA)
1090135446StrhodesAC_SUBST(LIBTOOL_MKDEP_SED)
1091135446StrhodesAC_SUBST(LIBTOOL_MODE_COMPILE)
1092135446StrhodesAC_SUBST(LIBTOOL_MODE_INSTALL)
1093135446StrhodesAC_SUBST(LIBTOOL_MODE_LINK)
1094143731SdougbAC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1095143731SdougbAC_SUBST(LIBTOOL_IN_MAIN)
1096135446Strhodes
1097135446Strhodes#
1098135446Strhodes# build libbind?
1099135446Strhodes#
1100135446StrhodesAC_ARG_ENABLE(libbind,
1101135446Strhodes	[  --enable-libbind		build libbind [default=no]])
1102135446Strhodes
1103135446Strhodescase "$enable_libbind" in
1104135446Strhodes	yes)
1105135446Strhodes		LIBBIND=lib/bind
1106135446Strhodes		AC_SUBST(LIBBIND)
1107135446Strhodes		;;
1108135446Strhodes	no|'')
1109135446Strhodes		;;
1110135446Strhodesesac
1111135446Strhodes
1112170222Sdougb
1113135446Strhodes#
1114135446Strhodes# Here begins a very long section to determine the system's networking
1115135446Strhodes# capabilities.  The order of the tests is signficant.
1116135446Strhodes#
1117135446Strhodes
1118135446Strhodes#
1119135446Strhodes# IPv6
1120135446Strhodes#
1121135446StrhodesAC_ARG_ENABLE(ipv6,
1122135446Strhodes	[  --enable-ipv6		use IPv6 [default=autodetect]])
1123135446Strhodes
1124135446Strhodescase "$enable_ipv6" in
1125135446Strhodes	yes|''|autodetect)
1126135446Strhodes		AC_DEFINE(WANT_IPV6)
1127135446Strhodes		;;
1128135446Strhodes	no)
1129135446Strhodes		;;
1130135446Strhodesesac
1131135446Strhodes
1132135446Strhodes#
1133135446Strhodes# We do the IPv6 compilation checking after libtool so that we can put
1134135446Strhodes# the right suffix on the files.
1135135446Strhodes#
1136135446StrhodesAC_MSG_CHECKING(for IPv6 structures)
1137135446StrhodesAC_TRY_COMPILE([
1138135446Strhodes#include <sys/types.h>
1139135446Strhodes#include <sys/socket.h>
1140135446Strhodes#include <netinet/in.h>],
1141135446Strhodes[struct sockaddr_in6 sin6; return (0);],
1142135446Strhodes	[AC_MSG_RESULT(yes)
1143135446Strhodes	 found_ipv6=yes],
1144135446Strhodes	[AC_MSG_RESULT(no)
1145135446Strhodes	 found_ipv6=no])
1146135446Strhodes
1147135446Strhodes#
1148135446Strhodes# See whether IPv6 support is provided via a Kame add-on.
1149135446Strhodes# This is done before other IPv6 linking tests to LIBS is properly set.
1150135446Strhodes#
1151135446StrhodesAC_MSG_CHECKING(for Kame IPv6 support)
1152135446StrhodesAC_ARG_WITH(kame,
1153135446Strhodes	[  --with-kame[=PATH]	use Kame IPv6 [default path /usr/local/v6]],
1154135446Strhodes	use_kame="$withval", use_kame="no")
1155135446Strhodes
1156135446Strhodescase "$use_kame" in
1157135446Strhodes	no)
1158135446Strhodes		;;
1159135446Strhodes	yes)
1160135446Strhodes		kame_path=/usr/local/v6
1161135446Strhodes		;;
1162135446Strhodes	*)
1163135446Strhodes		kame_path="$use_kame"
1164135446Strhodes		;;
1165135446Strhodesesac
1166135446Strhodes
1167135446Strhodescase "$use_kame" in
1168135446Strhodes	no)
1169135446Strhodes		AC_MSG_RESULT(no)
1170135446Strhodes		;;
1171135446Strhodes	*)
1172135446Strhodes		if test -f $kame_path/lib/libinet6.a; then
1173135446Strhodes			AC_MSG_RESULT($kame_path/lib/libinet6.a)
1174135446Strhodes			LIBS="-L$kame_path/lib -linet6 $LIBS"
1175135446Strhodes		else
1176135446Strhodes			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1177135446Strhodes
1178135446StrhodesPlease choose the proper path with the following command:
1179135446Strhodes
1180135446Strhodes    configure --with-kame=PATH
1181135446Strhodes])
1182135446Strhodes		fi
1183135446Strhodes		;;
1184135446Strhodesesac
1185135446Strhodes
1186135446Strhodes#
1187135446Strhodes# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1188135446Strhodes# Including it on Kame-using platforms is very bad, though, because
1189135446Strhodes# Kame uses #error against direct inclusion.   So include it on only
1190135446Strhodes# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1191135446Strhodes# This is done before the in6_pktinfo check because that's what
1192135446Strhodes# netinet6/in6.h is needed for.
1193135446Strhodes#
1194135446Strhodeschangequote({, })
1195135446Strhodescase "$host" in
1196135446Strhodes*-bsdi4.[01]*)
1197135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1198135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1199135446Strhodes	isc_netinet6in6_hack="#include <netinet6/in6.h>"
1200135446Strhodes	;;
1201135446Strhodes*)
1202135446Strhodes	ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1203135446Strhodes	LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1204135446Strhodes	isc_netinet6in6_hack=""
1205135446Strhodes	;;
1206135446Strhodesesac
1207135446Strhodeschangequote([, ])
1208135446Strhodes
1209135446Strhodes#
1210135446Strhodes# This is similar to the netinet6/in6.h issue.
1211135446Strhodes#
1212135446Strhodescase "$host" in
1213135446Strhodes*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1214135446Strhodes        # UnixWare
1215135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1216135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1217135446Strhodes        ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1218135446Strhodes	isc_netinetin6_hack="#include <netinet/in6.h>"
1219135446Strhodes	;;
1220135446Strhodes*)
1221135446Strhodes	ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1222135446Strhodes	LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1223135446Strhodes        ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1224135446Strhodes	isc_netinetin6_hack=""
1225135446Strhodes	;;
1226135446Strhodesesac
1227135446Strhodes
1228135446Strhodes#
1229135446Strhodes# Now delve deeper into the suitability of the IPv6 support.
1230135446Strhodes#
1231135446Strhodescase "$found_ipv6" in
1232135446Strhodes	yes)
1233135446Strhodes		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1234135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1235135446Strhodes
1236135446Strhodes		AC_MSG_CHECKING(for in6_addr)
1237135446Strhodes		AC_TRY_COMPILE([
1238135446Strhodes#include <sys/types.h>
1239135446Strhodes#include <sys/socket.h>
1240135446Strhodes#include <netinet/in.h>
1241135446Strhodes$isc_netinetin6_hack
1242135446Strhodes$isc_netinet6in6_hack
1243135446Strhodes],
1244135446Strhodes[struct in6_addr in6; return (0);],
1245135446Strhodes		[AC_MSG_RESULT(yes)
1246135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1247135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1248135446Strhodes		 isc_in_addr6_hack=""],
1249135446Strhodes		[AC_MSG_RESULT(no)
1250135446Strhodes		 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1251135446Strhodes		 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1252135446Strhodes		 isc_in_addr6_hack="#define in6_addr in_addr6"])
1253135446Strhodes
1254135446Strhodes		AC_MSG_CHECKING(for in6addr_any)
1255135446Strhodes		AC_TRY_LINK([
1256135446Strhodes#include <sys/types.h>
1257135446Strhodes#include <sys/socket.h>
1258135446Strhodes#include <netinet/in.h>
1259135446Strhodes$isc_netinetin6_hack
1260135446Strhodes$isc_netinet6in6_hack
1261135446Strhodes$isc_in_addr6_hack
1262135446Strhodes],
1263135446Strhodes		[struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1264135446Strhodes			[AC_MSG_RESULT(yes)
1265135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1266135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1267135446Strhodes			[AC_MSG_RESULT(no)
1268135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1269135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1270135446Strhodes
1271135446Strhodes		AC_MSG_CHECKING(for in6addr_loopback)
1272135446Strhodes		AC_TRY_LINK([
1273135446Strhodes#include <sys/types.h>
1274135446Strhodes#include <sys/socket.h>
1275135446Strhodes#include <netinet/in.h>
1276135446Strhodes$isc_netinetin6_hack
1277135446Strhodes$isc_netinet6in6_hack
1278135446Strhodes$isc_in_addr6_hack
1279135446Strhodes],
1280135446Strhodes		[struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1281135446Strhodes			[AC_MSG_RESULT(yes)
1282135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1283135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1284135446Strhodes			[AC_MSG_RESULT(no)
1285135446Strhodes			 ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1286135446Strhodes			 LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1287135446Strhodes
1288135446Strhodes		AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1289135446Strhodes		AC_TRY_COMPILE([
1290135446Strhodes#include <sys/types.h>
1291135446Strhodes#include <sys/socket.h>
1292135446Strhodes#include <netinet/in.h>
1293135446Strhodes$isc_netinetin6_hack
1294135446Strhodes$isc_netinet6in6_hack
1295135446Strhodes],
1296135446Strhodes		[struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1297135446Strhodes			[AC_MSG_RESULT(yes)
1298135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1299135446Strhodes			 result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1300135446Strhodes			[AC_MSG_RESULT(no)
1301135446Strhodes			 ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1302135446Strhodes			 result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1303135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="$result"
1304135446Strhodes
1305135446Strhodes		AC_MSG_CHECKING(for in6_pktinfo)
1306135446Strhodes		AC_TRY_COMPILE([
1307135446Strhodes#include <sys/types.h>
1308135446Strhodes#include <sys/socket.h>
1309135446Strhodes#include <netinet/in.h>
1310135446Strhodes$isc_netinetin6_hack
1311135446Strhodes$isc_netinet6in6_hack
1312135446Strhodes],
1313135446Strhodes		[struct in6_pktinfo xyzzy; return (0);],
1314135446Strhodes			[AC_MSG_RESULT(yes)
1315135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1316135446Strhodes			[AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1317135446Strhodes			 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1318135446Strhodes		;;
1319135446Strhodes	no)
1320135446Strhodes		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1321135446Strhodes		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1322135446Strhodes		ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1323135446Strhodes		LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1324135446Strhodes		ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1325135446Strhodes		LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1326135446Strhodes		ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1327135446Strhodes		ISC_IPV6_H="ipv6.h"
1328135446Strhodes		ISC_IPV6_O="ipv6.$O"
1329135446Strhodes		ISC_ISCIPV6_O="unix/ipv6.$O"
1330135446Strhodes		ISC_IPV6_C="ipv6.c"
1331135446Strhodes		;;
1332135446Strhodesesac
1333135446Strhodes
1334135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIPV6)
1335135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1336135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1337135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1338135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1339135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1340135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1341135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1342135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1343135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1344135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1345135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1346135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1347135446StrhodesAC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1348135446StrhodesAC_SUBST(ISC_IPV6_H)
1349135446StrhodesAC_SUBST(ISC_IPV6_O)
1350135446StrhodesAC_SUBST(ISC_ISCIPV6_O)
1351135446StrhodesAC_SUBST(ISC_IPV6_C)
1352135446StrhodesAC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1353135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1354135446Strhodes
1355135446StrhodesAC_MSG_CHECKING([for struct if_laddrreq])
1356135446StrhodesAC_TRY_LINK([
1357135446Strhodes#include <sys/types.h>
1358135446Strhodes#include <net/if6.h>
1359135446Strhodes],[ struct if_laddrreq a; ],
1360135446Strhodes	[AC_MSG_RESULT(yes)
1361135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1362135446Strhodes	[AC_MSG_RESULT(no)
1363135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1364135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1365135446Strhodes
1366135446StrhodesAC_MSG_CHECKING([for struct if_laddrconf])
1367135446StrhodesAC_TRY_LINK([
1368135446Strhodes#include <sys/types.h>
1369135446Strhodes#include <net/if6.h>
1370135446Strhodes],[ struct if_laddrconf a; ],
1371135446Strhodes	[AC_MSG_RESULT(yes)
1372135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1373135446Strhodes	[AC_MSG_RESULT(no)
1374135446Strhodes	ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1375135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1376135446Strhodes
1377135446Strhodes#
1378135446Strhodes# Check for network functions that are often missing.  We do this
1379135446Strhodes# after the libtool checking, so we can put the right suffix on
1380135446Strhodes# the files.  It also needs to come after checking for a Kame add-on,
1381135446Strhodes# which provides some (all?) of the desired functions.
1382135446Strhodes#
1383135446Strhodes
1384135446StrhodesAC_MSG_CHECKING([for inet_ntop with IPv6 support])
1385135446StrhodesAC_TRY_RUN([
1386135446Strhodes#include <sys/types.h>
1387135446Strhodes#include <sys/socket.h>
1388135446Strhodes#include <netinet/in.h>
1389135446Strhodes#include <arpa/inet.h>
1390135446Strhodesmain() {
1391135446Strhodeschar a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1392135446Strhodes        [AC_MSG_RESULT(yes)
1393135446Strhodes        ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1394135446Strhodes
1395135446Strhodes        [AC_MSG_RESULT(no)
1396135446Strhodes        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1397135446Strhodes        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1398153816Sdougb        ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
1399153816Sdougb        [AC_MSG_RESULT(assuming inet_ntop needed)
1400153816Sdougb        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1401153816Sdougb        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1402135446Strhodes        ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
1403135446Strhodes
1404135446Strhodes
1405135446Strhodes# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1406135446Strhodes# addresses with less than four octets, like "1.2.3".  Also leading
1407135446Strhodes# zeros should also be rejected.
1408135446Strhodes
1409135446StrhodesAC_MSG_CHECKING([for working inet_pton with IPv6 support])
1410135446StrhodesAC_TRY_RUN([
1411135446Strhodes#include <sys/types.h>
1412135446Strhodes#include <sys/socket.h>
1413135446Strhodes#include <netinet/in.h>
1414135446Strhodes#include <arpa/inet.h>
1415135446Strhodesmain() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1416135446Strhodes			     inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
1417135446Strhodes			     (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1418135446Strhodes        [AC_MSG_RESULT(yes)
1419135446Strhodes        ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1420135446Strhodes        [AC_MSG_RESULT(no)
1421135446Strhodes        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1422135446Strhodes        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1423135446Strhodes        ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1424135446Strhodes	[AC_MSG_RESULT(assuming target platform has working inet_pton)
1425153816Sdougb	ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1426153816Sdougb        [AC_MSG_RESULT(assuming inet_pton needed)
1427153816Sdougb        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1428153816Sdougb        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1429153816Sdougb        ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1430153816Sdougb        [AC_MSG_RESULT(assuming target platform has working inet_pton)
1431153816Sdougb        ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"])
1432135446Strhodes
1433135446StrhodesAC_MSG_CHECKING([for inet_aton])
1434135446StrhodesAC_TRY_LINK([
1435135446Strhodes#include <sys/types.h>
1436135446Strhodes#include <netinet/in.h>
1437135446Strhodes#include <arpa/inet.h>],
1438135446Strhodes        [struct in_addr in; inet_aton(0, &in); return (0);],
1439135446Strhodes        [AC_MSG_RESULT(yes)
1440135446Strhodes        ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
1441135446Strhodes
1442135446Strhodes        [AC_MSG_RESULT(no)
1443135446Strhodes        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
1444135446Strhodes        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
1445135446Strhodes        ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"])
1446135446Strhodes
1447135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDNTOP)
1448135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPTON)
1449135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDATON)
1450135446Strhodes
1451135446Strhodes#
1452135446Strhodes# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1453135446Strhodes#
1454135446Strhodescase "$host" in
1455135446Strhodes	*-dec-osf*)
1456135446Strhodes		# Turn on 4.4BSD style sa_len support.
1457135446Strhodes		AC_DEFINE(_SOCKADDR_LEN)
1458135446Strhodes		;;
1459135446Strhodesesac
1460135446Strhodes
1461135446StrhodesAC_MSG_CHECKING(for sa_len in struct sockaddr)
1462135446StrhodesAC_TRY_COMPILE([
1463135446Strhodes#include <sys/types.h>
1464135446Strhodes#include <sys/socket.h>],
1465135446Strhodes[struct sockaddr sa; sa.sa_len = 0; return (0);],
1466135446Strhodes	[AC_MSG_RESULT(yes)
1467135446Strhodes	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1468135446Strhodes	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1469135446Strhodes	[AC_MSG_RESULT(no)
1470135446Strhodes	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1471135446Strhodes	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1472135446StrhodesAC_SUBST(ISC_PLATFORM_HAVESALEN)
1473135446StrhodesAC_SUBST(LWRES_PLATFORM_HAVESALEN)
1474135446Strhodes
1475135446Strhodes#
1476135446Strhodes# Look for a 4.4BSD or 4.3BSD struct msghdr
1477135446Strhodes#
1478135446StrhodesAC_MSG_CHECKING(for struct msghdr flavor)
1479135446StrhodesAC_TRY_COMPILE([
1480135446Strhodes#include <sys/types.h>
1481135446Strhodes#include <sys/socket.h>],
1482135446Strhodes[struct msghdr msg; msg.msg_flags = 0; return (0);],
1483135446Strhodes	[AC_MSG_RESULT(4.4BSD)
1484135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1485135446Strhodes	[AC_MSG_RESULT(4.3BSD)
1486135446Strhodes	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1487135446StrhodesAC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1488135446Strhodes
1489135446Strhodes#
1490135446Strhodes# Look for in_port_t.
1491135446Strhodes#
1492135446StrhodesAC_MSG_CHECKING(for type in_port_t)
1493135446StrhodesAC_TRY_COMPILE([
1494135446Strhodes#include <sys/types.h>
1495135446Strhodes#include <netinet/in.h>],
1496135446Strhodes[in_port_t port = 25; return (0);],
1497135446Strhodes	[AC_MSG_RESULT(yes)
1498135446Strhodes	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1499135446Strhodes        [AC_MSG_RESULT(no)
1500135446Strhodes	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1501135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDPORTT)
1502135446Strhodes
1503135446Strhodes#
1504135446Strhodes# Check for addrinfo
1505135446Strhodes#
1506135446StrhodesAC_MSG_CHECKING(for struct addrinfo)
1507135446StrhodesAC_TRY_COMPILE([
1508135446Strhodes#include <netdb.h>],
1509135446Strhodes[struct addrinfo a; return (0);],
1510135446Strhodes	[AC_MSG_RESULT(yes)
1511135446Strhodes	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
1512135446Strhodes	AC_DEFINE(HAVE_ADDRINFO)],
1513135446Strhodes	[AC_MSG_RESULT(no)
1514135446Strhodes	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
1515135446StrhodesAC_SUBST(ISC_LWRES_NEEDADDRINFO)
1516135446Strhodes
1517135446Strhodes#
1518135446Strhodes# Check for rrsetinfo
1519135446Strhodes#
1520135446StrhodesAC_MSG_CHECKING(for struct rrsetinfo)
1521135446StrhodesAC_TRY_COMPILE([
1522135446Strhodes#include <netdb.h>],
1523135446Strhodes[struct rrsetinfo r; return (0);],
1524135446Strhodes	[AC_MSG_RESULT(yes)
1525135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
1526135446Strhodes	[AC_MSG_RESULT(no)
1527135446Strhodes	ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
1528135446StrhodesAC_SUBST(ISC_LWRES_NEEDRRSETINFO)
1529135446Strhodes
1530135446StrhodesAC_MSG_CHECKING(for int sethostent)
1531135446StrhodesAC_TRY_COMPILE([
1532135446Strhodes#include <netdb.h>],
1533135446Strhodes[int i = sethostent(0); return(0);],
1534135446Strhodes	[AC_MSG_RESULT(yes)
1535135446Strhodes	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
1536135446Strhodes	[AC_MSG_RESULT(no)
1537135446Strhodes	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
1538135446StrhodesAC_SUBST(ISC_LWRES_SETHOSTENTINT)
1539135446Strhodes
1540135446StrhodesAC_MSG_CHECKING(for int endhostent)
1541135446StrhodesAC_TRY_COMPILE([
1542135446Strhodes#include <netdb.h>],
1543135446Strhodes[int i = endhostent(); return(0);],
1544135446Strhodes	[AC_MSG_RESULT(yes)
1545135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1546135446Strhodes	[AC_MSG_RESULT(no)
1547135446Strhodes	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1548135446StrhodesAC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1549135446Strhodes
1550135446StrhodesAC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
1551135446StrhodesAC_TRY_COMPILE([
1552135446Strhodes#include <netdb.h>
1553135446Strhodesstruct netent *getnetbyaddr(in_addr_t, int);],
1554135446Strhodes[],
1555135446Strhodes	[AC_MSG_RESULT(yes)
1556135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
1557135446Strhodes	[AC_MSG_RESULT(no)
1558135446Strhodes	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
1559135446StrhodesAC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
1560135446Strhodes
1561135446StrhodesAC_MSG_CHECKING(for int setnetent)
1562135446StrhodesAC_TRY_COMPILE([
1563135446Strhodes#include <netdb.h>],
1564135446Strhodes[int i = setnetent(0); return(0);],
1565135446Strhodes	[AC_MSG_RESULT(yes)
1566135446Strhodes	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1567135446Strhodes	[AC_MSG_RESULT(no)
1568135446Strhodes	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1569135446StrhodesAC_SUBST(ISC_LWRES_SETNETENTINT)
1570135446Strhodes
1571135446StrhodesAC_MSG_CHECKING(for int endnetent)
1572135446StrhodesAC_TRY_COMPILE([
1573135446Strhodes#include <netdb.h>],
1574135446Strhodes[int i = endnetent(); return(0);],
1575135446Strhodes	[AC_MSG_RESULT(yes)
1576135446Strhodes	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1577135446Strhodes	[AC_MSG_RESULT(no)
1578135446Strhodes	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1579135446StrhodesAC_SUBST(ISC_LWRES_ENDNETENTINT)
1580135446Strhodes
1581135446StrhodesAC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1582135446StrhodesAC_TRY_COMPILE([
1583135446Strhodes#include <netdb.h>
1584135446Strhodesstruct hostent *gethostbyaddr(const void *, size_t, int);],
1585135446Strhodes[return(0);],
1586135446Strhodes	[AC_MSG_RESULT(yes)
1587135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1588135446Strhodes	[AC_MSG_RESULT(no)
1589135446Strhodes	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1590135446StrhodesAC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1591135446Strhodes
1592135446StrhodesAC_MSG_CHECKING(for h_errno in netdb.h)
1593135446StrhodesAC_TRY_COMPILE([
1594135446Strhodes#include <netdb.h>],
1595135446Strhodes[h_errno = 1; return(0);],
1596135446Strhodes	[AC_MSG_RESULT(yes)
1597135446Strhodes	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1598135446Strhodes	[AC_MSG_RESULT(no)
1599135446Strhodes	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1600135446StrhodesAC_SUBST(ISC_LWRES_NEEDHERRNO)
1601135446Strhodes
1602135446StrhodesAC_CHECK_FUNC(getipnodebyname,
1603135446Strhodes        [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1604135446Strhodes        [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1605135446StrhodesAC_CHECK_FUNC(getnameinfo,
1606135446Strhodes        [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1607135446Strhodes        [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1608135446StrhodesAC_CHECK_FUNC(getaddrinfo,
1609135446Strhodes        [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1610135446Strhodes	AC_DEFINE(HAVE_GETADDRINFO)],
1611135446Strhodes        [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1612135446StrhodesAC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1613135446StrhodesAC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1614135446StrhodesAC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1615135446StrhodesAC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1616135446Strhodes
1617135446StrhodesAC_ARG_ENABLE(getifaddrs,
1618135446Strhodes[  --enable-getifaddrs    Enable the use of getifaddrs() [[yes|no|glibc]].
1619135446Strhodes             glibc: Use getifaddrs() in glibc if you know it supports IPv6.],
1620135446Strhodes    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1621135446Strhodes
1622135446Strhodescase $want_getifaddrs in
1623135446Strhodesyes|glibc)
1624135446Strhodes#
1625135446Strhodes# Do we have getifaddrs() ?
1626135446Strhodes#
1627135446Strhodescase $host in
1628135446Strhodes*-linux*)
1629135446Strhodes	# Some recent versions of glibc support getifaddrs() which does not
1630135446Strhodes	# provide AF_INET6 addresses while the function provided by the USAGI
1631135446Strhodes	# project handles the AF_INET6 case correctly.  We need to avoid
1632135446Strhodes	# using the former but prefer the latter unless overridden by
1633135446Strhodes	# --enable-getifaddrs=glibc.
1634143731Sdougb	if test $want_getifaddrs = glibc
1635135446Strhodes	then
1636135446Strhodes		AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1637135446Strhodes	else
1638135446Strhodes		save_LIBS="$LIBS"
1639135446Strhodes		LIBS="-L/usr/local/v6/lib $LIBS"
1640135446Strhodes		AC_CHECK_LIB(inet6, getifaddrs,
1641135446Strhodes			LIBS="$LIBS -linet6"
1642135446Strhodes			AC_DEFINE(HAVE_GETIFADDRS),
1643135446Strhodes			LIBS=${save_LIBS})
1644135446Strhodes	fi
1645135446Strhodes	;;
1646135446Strhodes*)
1647135446Strhodes	AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1648135446Strhodes	;;
1649135446Strhodesesac
1650135446Strhodes;;
1651135446Strhodesno)
1652135446Strhodes;;
1653135446Strhodesesac
1654135446Strhodes
1655135446Strhodes#
1656135446Strhodes# Look for a sysctl call to get the list of network interfaces.
1657135446Strhodes#
1658135446Strhodescase $ac_cv_header_sys_sysctl_h in
1659135446Strhodesyes)
1660135446StrhodesAC_MSG_CHECKING(for interface list sysctl)
1661135446StrhodesAC_EGREP_CPP(found_rt_iflist, [
1662135446Strhodes#include <sys/param.h>
1663135446Strhodes#include <sys/sysctl.h>
1664135446Strhodes#include <sys/socket.h>
1665135446Strhodes#ifdef NET_RT_IFLIST
1666135446Strhodesfound_rt_iflist
1667135446Strhodes#endif
1668135446Strhodes],
1669135446Strhodes	[AC_MSG_RESULT(yes)
1670135446Strhodes	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1671135446Strhodes	[AC_MSG_RESULT(no)])
1672135446Strhodes;;
1673135446Strhodesesac
1674135446Strhodes
1675135446Strhodes#
1676135446Strhodes# Check for some other useful functions that are not ever-present.
1677135446Strhodes#
1678135446Strhodes
1679135446Strhodes# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
1680135446Strhodes# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
1681135446Strhodes# reportedly defines strsep() without declaring it in <string.h> when
1682135446Strhodes# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
1683135446Strhodes# AC_CHECK_FUNC() incorrectly succeeds because it declares
1684135446Strhodes# the function itself.
1685135446StrhodesAC_MSG_CHECKING(for correctly declared strsep())
1686135446StrhodesAC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
1687135446Strhodes	[AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1688135446Strhodes	[AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1689135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1690135446Strhodes
1691135446StrhodesAC_CHECK_FUNC(memmove,
1692135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
1693135446Strhodes	[ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
1694135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
1695135446Strhodes
1696135446StrhodesAC_CHECK_FUNC(strtoul,
1697153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
1698165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
1699153816Sdougb	 GENRANDOMLIB=""],
1700153816Sdougb	[ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
1701165071Sdougb	 LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
1702165071Sdougb	 GENRANDOMLIB='${ISCLIBS}'])
1703135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
1704153816SdougbAC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
1705153816SdougbAC_SUBST(GENRANDOMLIB)
1706135446Strhodes
1707135446StrhodesAC_CHECK_FUNC(strlcpy,
1708135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
1709135446Strhodes	[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
1710135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
1711135446Strhodes
1712135446StrhodesAC_CHECK_FUNC(strlcat,
1713135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
1714135446Strhodes	[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
1715135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
1716135446Strhodes
1717135446StrhodesISC_PRINT_OBJS=
1718135446StrhodesISC_PRINT_SRCS=
1719135446StrhodesAC_MSG_CHECKING(sprintf)
1720135446StrhodesAC_TRY_COMPILE([
1721135446Strhodes#include <stdio.h>
1722135446Strhodes],
1723135446Strhodes[ char buf[2]; return(*sprintf(buf,"x"));],
1724135446Strhodes[
1725135446StrhodesISC_PRINT_OBJS="print.$O"
1726135446StrhodesISC_PRINT_SRCS="print.c"
1727135446StrhodesISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
1728135446StrhodesLWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
1729135446Strhodes],
1730135446Strhodes[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
1731135446Strhodes LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
1732135446Strhodes)
1733135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
1734135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
1735135446Strhodes
1736135446StrhodesAC_CHECK_FUNC(vsnprintf,
1737135446Strhodes	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
1738135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
1739135446Strhodes	[ISC_PRINT_OBJS="print.$O"
1740135446Strhodes	 ISC_PRINT_SRCS="print.c"
1741135446Strhodes	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
1742135446Strhodes	 LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
1743135446StrhodesAC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1744135446StrhodesAC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
1745135446StrhodesISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
1746135446StrhodesISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
1747135446Strhodes
1748135446StrhodesAC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
1749135446Strhodes
1750135446StrhodesAC_SUBST(ISC_EXTRA_OBJS)
1751135446StrhodesAC_SUBST(ISC_EXTRA_SRCS)
1752135446Strhodes
1753135446Strhodes# Determine the printf format characters to use when printing
1754135446Strhodes# values of type isc_int64_t. This will normally be "ll", but where
1755135446Strhodes# the compiler treats "long long" as a alias for "long" and printf
1756135446Strhodes# doesn't know about "long long" use "l".  Hopefully the sprintf
1757135446Strhodes# will produce a inconsistant result in the later case.  If the compiler
1758135446Strhodes# fails due to seeing "%lld" we fall back to "l".
1759135446Strhodes#
1760153816Sdougb# Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
1761153816Sdougb# %ld even for (long long)/
1762153816Sdougb#
1763135446Strhodes# Win32 uses "%I64d", but that's defined elsewhere since we don't use
1764135446Strhodes# configure on Win32.
1765135446Strhodes#
1766135446StrhodesAC_MSG_CHECKING(printf format modifier for 64-bit integers)
1767135446StrhodesAC_TRY_RUN([
1768135446Strhodes#include <stdio.h>
1769135446Strhodesmain() {
1770135446Strhodes	long long int j = 0;
1771135446Strhodes	char buf[100];
1772135446Strhodes	buf[0] = 0;
1773135446Strhodes	sprintf(buf, "%lld", j);
1774135446Strhodes	exit((sizeof(long long int) != sizeof(long int))? 0 :
1775135446Strhodes	     (strcmp(buf, "0") != 0));
1776135446Strhodes} 
1777135446Strhodes],
1778135446Strhodes	[AC_MSG_RESULT(ll)
1779153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1780153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
1781135446Strhodes	[AC_MSG_RESULT(l)
1782153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
1783153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
1784135446Strhodes	[AC_MSG_RESULT(assuming target platform uses ll)
1785153816Sdougb	ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
1786153816Sdougb	LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
1787135446StrhodesAC_SUBST(ISC_PLATFORM_QUADFORMAT)
1788153816SdougbAC_SUBST(LWRES_PLATFORM_QUADFORMAT)
1789135446Strhodes
1790135446Strhodes#
1791135446Strhodes# Security Stuff
1792135446Strhodes#
1793135446StrhodesAC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
1794135446StrhodesAC_ARG_ENABLE(linux-caps,
1795135446Strhodes	[  --disable-linux-caps	disable linux capabilities])
1796135446Strhodescase "$enable_linux_caps" in
1797135446Strhodes	yes|'')
1798186462Sdougb		AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
1799186462Sdougb		AC_CHECK_FUNCS(capset)
1800135446Strhodes		;;
1801135446Strhodes	no)
1802135446Strhodes		;;
1803135446Strhodesesac
1804135446StrhodesAC_CHECK_HEADERS(sys/prctl.h)
1805135446Strhodes
1806170222SdougbAC_CHECK_HEADERS(sys/un.h,
1807170222SdougbISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
1808170222Sdougb,
1809170222SdougbISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
1810170222Sdougb)
1811170222SdougbAC_SUBST(ISC_PLATFORM_HAVESYSUNH)
1812170222Sdougb
1813170222Sdougbcase "$host" in
1814170222Sdougb*-solaris*)
1815170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
1816170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
1817170222Sdougb	;;
1818170222Sdougb*-sunos*)
1819170222Sdougb	AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
1820170222Sdougb		  [Define if connect does not honour the permission on the UNIX domain socket.])
1821170222Sdougb	;;
1822170222Sdougbesac
1823170222Sdougb
1824135446Strhodes#
1825135446Strhodes# Time Zone Stuff
1826135446Strhodes#
1827135446StrhodesAC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
1828135446Strhodes
1829153816SdougbAC_MSG_CHECKING(for optarg decarartion)
1830153816SdougbAC_TRY_COMPILE([
1831153816Sdougb#include <unistd.h>
1832153816Sdougb],
1833153816Sdougb[optarg = 0;],
1834153816Sdougb[AC_MSG_RESULT(yes)],
1835153816Sdougb[AC_MSG_RESULT(no)
1836165071SdougbGEN_NEED_OPTARG="-DNEED_OPTARG=1"
1837153816SdougbAC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
1838153816Sdougb
1839135446Strhodes#
1840135446Strhodes# BSD/OS, and perhaps some others, don't define rlim_t.
1841135446Strhodes#
1842135446StrhodesAC_MSG_CHECKING(for type rlim_t)
1843135446StrhodesAC_TRY_COMPILE([
1844135446Strhodes#include <sys/types.h>
1845135446Strhodes#include <sys/time.h>
1846135446Strhodes#include <sys/resource.h>],
1847135446Strhodes[rlim_t rl = 19671212; return (0);],
1848135446Strhodes[AC_MSG_RESULT(yes)
1849135446Strhodes ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
1850135446Strhodes[AC_MSG_RESULT(no)
1851135446Strhodes
1852135446StrhodesAC_MSG_CHECKING(type of rlim_cur)
1853135446StrhodesAC_TRY_RUN([
1854135446Strhodes#include <sys/types.h>
1855135446Strhodes#include <sys/time.h>
1856135446Strhodes#include <sys/resource.h>
1857135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
1858135446Strhodes[AC_MSG_RESULT(int)
1859135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
1860135446Strhodes[
1861135446StrhodesAC_TRY_RUN([
1862135446Strhodes#include <sys/types.h>
1863135446Strhodes#include <sys/time.h>
1864135446Strhodes#include <sys/resource.h>
1865135446Strhodesmain() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
1866135446Strhodes[AC_MSG_RESULT(long int)
1867135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
1868135446Strhodes[
1869135446StrhodesAC_TRY_RUN([
1870135446Strhodes#include <sys/types.h>
1871135446Strhodes#include <sys/time.h>
1872135446Strhodes#include <sys/resource.h>
1873135446Strhodesmain() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
1874135446Strhodes[AC_MSG_RESULT(long long int)
1875135446StrhodesISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
1876135446Strhodes[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
1877135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
1878135446Strhodes],[AC_MSG_ERROR(this cannot happen)])
1879153816Sdougb],[
1880153816SdougbISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"
1881153816SdougbAC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming long long int)])
1882135446Strhodes])
1883135446StrhodesAC_SUBST(ISC_PLATFORM_RLIMITTYPE)
1884135446Strhodes
1885135446Strhodes#
1886186462Sdougb# Older HP-UX doesn't have gettune
1887186462Sdougb#
1888186462Sdougbcase "$host" in
1889186462Sdougb  	*-hp-hpux*)
1890186462Sdougb		AC_CHECK_HEADERS(sys/dyntune.h)
1891186462Sdougb		;;
1892186462Sdougb	*)
1893186462Sdougb		;;
1894186462Sdougbesac
1895186462Sdougb
1896186462Sdougb
1897186462Sdougb#
1898135446Strhodes# Compaq TruCluster requires more code for handling cluster IP aliases
1899135446Strhodes#
1900135446Strhodescase "$host" in
1901135446Strhodes	*-dec-osf*)
1902135446Strhodes		AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
1903135446Strhodes		AC_CHECK_FUNC(clua_getaliasaddress,
1904135446Strhodes				AC_DEFINE(HAVE_TRUCLUSTER, 1,
1905135446Strhodes					[Define if running under Compaq TruCluster]))
1906135446Strhodes		;;
1907135446Strhodes	*)
1908135446Strhodes		;;
1909135446Strhodesesac
1910135446Strhodes
1911135446Strhodes#
1912165071Sdougb# Some hosts need msg_namelen to match the size of the socket structure.
1913165071Sdougb# Some hosts don't set msg_namelen appropriately on return from recvmsg().
1914165071Sdougb#
1915165071Sdougbcase $host in
1916165071Sdougb*os2*|*hp-mpeix*)
1917165071Sdougb	AC_DEFINE(BROKEN_RECVMSG, 1,
1918165071Sdougb		  [Define if recvmsg() does not meet all of the BSD socket API specifications.])
1919165071Sdougb	;;
1920165071Sdougbesac
1921165071Sdougb
1922165071Sdougb#
1923135446Strhodes# Microsoft has their own way of handling shared libraries that requires
1924135446Strhodes# additional qualifiers on extern variables.  Unix systems don't need it.
1925135446Strhodes#
1926135446StrhodesAC_SUBST(ISC_PLATFORM_USEDECLSPEC)
1927135446StrhodesISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
1928135446StrhodesAC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
1929135446StrhodesLWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
1930135446Strhodes
1931135446Strhodes#
1932135446Strhodes# Random remaining OS-specific issues involving compiler warnings.
1933135446Strhodes# XXXDCL print messages to indicate some compensation is being done?
1934135446Strhodes#
1935135446StrhodesAC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
1936135446StrhodesISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
1937135446Strhodes
1938135446Strhodescase "$host" in
1939165071Sdougb	*-aix5.[[123]].*)
1940143731Sdougb		hack_shutup_pthreadonceinit=yes
1941143731Sdougb		;;
1942135446Strhodes	*-bsdi3.1*)
1943135446Strhodes		hack_shutup_sputaux=yes
1944135446Strhodes		;;
1945135446Strhodes	*-bsdi4.0*)
1946135446Strhodes		hack_shutup_sigwait=yes
1947135446Strhodes		hack_shutup_sputaux=yes
1948135446Strhodes		;;
1949135446Strhodes	[*-bsdi4.[12]*])
1950135446Strhodes		hack_shutup_stdargcast=yes
1951135446Strhodes		;;
1952135446Strhodes	[*-solaris2.[89]])
1953135446Strhodes		hack_shutup_pthreadonceinit=yes
1954135446Strhodes		;;
1955186462Sdougb	*-solaris2.1[[0-9]])
1956165071Sdougb		hack_shutup_pthreadonceinit=yes
1957165071Sdougb		;;
1958135446Strhodesesac
1959135446Strhodes
1960135446Strhodescase "$hack_shutup_pthreadonceinit" in
1961135446Strhodes	yes)
1962135446Strhodes		#
1963135446Strhodes		# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
1964135446Strhodes		#
1965135446Strhodes		ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
1966135446Strhodes		;;
1967135446Strhodesesac
1968135446Strhodes
1969135446Strhodescase "$hack_shutup_sigwait" in
1970135446Strhodes	yes)
1971135446Strhodes		#
1972135446Strhodes		# Shut up a -Wmissing-prototypes warning for sigwait().
1973135446Strhodes		#
1974135446Strhodes		AC_DEFINE(SHUTUP_SIGWAIT)
1975135446Strhodes		;;
1976135446Strhodesesac
1977135446Strhodes
1978135446Strhodescase "$hack_shutup_sputaux" in
1979135446Strhodes	yes)
1980135446Strhodes		#
1981135446Strhodes		# Shut up a -Wmissing-prototypes warning from <stdio.h>.
1982135446Strhodes		#
1983135446Strhodes		AC_DEFINE(SHUTUP_SPUTAUX)
1984135446Strhodes		;;
1985135446Strhodesesac
1986135446Strhodes
1987135446Strhodescase "$hack_shutup_stdargcast" in
1988135446Strhodes	yes)
1989135446Strhodes		#
1990135446Strhodes		# Shut up a -Wcast-qual warning from va_start().
1991135446Strhodes		#
1992135446Strhodes		AC_DEFINE(SHUTUP_STDARG_CAST)
1993135446Strhodes		;;
1994135446Strhodesesac
1995135446Strhodes
1996174187SdougbAC_CHECK_HEADERS(strings.h,
1997174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
1998174187Sdougb,
1999174187Sdougb  ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2000174187Sdougb)
2001174187SdougbAC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2002174187Sdougb
2003135446Strhodes#
2004135446Strhodes# Check for if_nametoindex() for IPv6 scoped addresses support
2005135446Strhodes#
2006135446StrhodesAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2007135446Strhodes		ac_cv_have_if_nametoindex=no)
2008135446Strhodescase $ac_cv_have_if_nametoindex in
2009135446Strhodesno)
2010135446Strhodes	case "$host" in
2011135446Strhodes  	*-hp-hpux*)
2012135446Strhodes  		AC_CHECK_LIB(ipv6, if_nametoindex,
2013135446Strhodes				ac_cv_have_if_nametoindex=yes
2014135446Strhodes				LIBS="-lipv6 $LIBS",)
2015135446Strhodes  	;;
2016135446Strhodes	esac
2017135446Strhodesesac
2018135446Strhodescase $ac_cv_have_if_nametoindex in
2019135446Strhodesyes)
2020135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2021135446Strhodes	;;
2022135446Strhodes*)
2023135446Strhodes	ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2024135446Strhodes	;;
2025135446Strhodesesac
2026135446StrhodesAC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2027135446Strhodes
2028135446Strhodes#
2029170222Sdougb# Machine architecture dependent features
2030170222Sdougb#
2031170222SdougbAC_ARG_ENABLE(atomic,
2032170222Sdougb	[  --enable-atomic	enable machine specific atomic operations
2033170222Sdougb                        [[default=autodetect]]],
2034170222Sdougb			enable_atomic="$enableval",
2035170222Sdougb			enable_atomic="autodetect")
2036170222Sdougbcase "$enable_atomic" in
2037170222Sdougb	yes|''|autodetect)
2038170222Sdougb		use_atomic=yes
2039170222Sdougb		;;
2040170222Sdougb	no)
2041170222Sdougb		use_atomic=no
2042170222Sdougb		arch=noatomic
2043170222Sdougb		;;
2044170222Sdougbesac
2045170222Sdougb
2046170222SdougbISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2047170222Sdougbif test "$use_atomic" = "yes"; then
2048170222Sdougb	AC_MSG_CHECKING([architecture type for atomic operations])
2049170222Sdougb	have_atomic=yes		# set default
2050170222Sdougb	case "$host" in
2051170222Sdougb	[i[3456]86-*])
2052170222Sdougb		# XXX: some old x86 architectures actually do not support
2053170222Sdougb		#      (some of) these operations.  Do we need stricter checks?
2054170222SdougbAC_TRY_RUN([
2055170222Sdougbmain() {
2056170222Sdougb	exit((sizeof(void *) == 8) ? 0 : 1);
2057170222Sdougb}
2058170222Sdougb],
2059170222Sdougb		[arch=x86_64],
2060170222Sdougb		[arch=x86_32],
2061170222Sdougb	        [arch=x86_32])
2062170222Sdougb	;;
2063170222Sdougb	x86_64-*)
2064170222Sdougb		arch=x86_64
2065170222Sdougb	;;
2066170222Sdougb	alpha*-*)
2067170222Sdougb		arch=alpha
2068170222Sdougb	;;
2069170222Sdougb	powerpc-*)
2070170222Sdougb		arch=powerpc
2071170222Sdougb	;;
2072170222Sdougb	mips-*|mipsel-*|mips64-*|mips64el-*)
2073170222Sdougb		arch=mips
2074170222Sdougb	;;
2075170222Sdougb	ia64-*)
2076170222Sdougb		arch=ia64
2077170222Sdougb	;;
2078170222Sdougb	*)
2079170222Sdougb		have_atomic=no
2080170222Sdougb		arch=noatomic
2081170222Sdougb	;;
2082170222Sdougb	esac
2083170222Sdougb	AC_MSG_RESULT($arch)
2084170222Sdougbfi
2085170222Sdougb
2086170222Sdougbif test "$have_atomic" = "yes"; then
2087170222Sdougb	AC_MSG_CHECKING([compiler support for inline assembly code])
2088170222Sdougb
2089170222Sdougb	compiler=generic
2090170222Sdougb	# Check whether the compiler supports the assembly syntax we provide.
2091170222Sdougb	if test "X$GCC" = "Xyes"; then
2092170222Sdougb		# GCC's ASM extension always works
2093170222Sdougb		compiler=gcc
2094170222Sdougb		if test $arch = "x86_64"; then
2095170222Sdougb			# We can share the same code for gcc with x86_32
2096170222Sdougb			arch=x86_32
2097170222Sdougb		fi
2098170222Sdougb		if test $arch = "powerpc"; then
2099170222Sdougb			#
2100170222Sdougb			# The MacOS (and maybe others) uses "r0" for register
2101170222Sdougb			# zero. Under linux/ibm it is "0" for register 0.
2102170222Sdougb			# Probe to see if we have a MacOS style assembler.
2103170222Sdougb			#
2104170222Sdougb			AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2105170222Sdougb			AC_TRY_COMPILE(, [
2106170222Sdougb			__asm__ volatile ("li r0, 0x0\n"::);
2107170222Sdougb			], [
2108170222Sdougb			AC_MSG_RESULT(yes)
2109170222Sdougb			compiler="mac"
2110170222Sdougb			ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
2111170222Sdougb			], [AC_MSG_RESULT(no)])
2112170222Sdougb		fi
2113170222Sdougb	else
2114170222Sdougb		case "$host" in
2115170222Sdougb		alpha*-dec-osf*)
2116170222Sdougb			# Tru64 compiler has its own syntax for inline 
2117170222Sdougb			# assembly.
2118170222Sdougb			AC_TRY_COMPILE(, [
2119170222Sdougb#ifndef __DECC
2120170222Sdougb#error "unexpected compiler"
2121170222Sdougb#endif
2122170222Sdougb				return (0);],
2123170222Sdougb				[compiler=osf],)
2124170222Sdougb		;;
2125170222Sdougb		powerpc-ibm-aix*)
2126170222Sdougb			compiler=aix
2127170222Sdougb		;;
2128170222Sdougb		esac
2129170222Sdougb	fi
2130170222Sdougb	case "$compiler" in
2131170222Sdougb	gcc)
2132170222Sdougb		ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
2133170222Sdougb		;;
2134170222Sdougb	osf)
2135170222Sdougb		ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
2136170222Sdougb		;;
2137170222Sdougb	aix)
2138170222Sdougb		;;
2139170222Sdougb	mac)
2140170222Sdougb		;;
2141170222Sdougb	*)
2142170222Sdougb		# See if the generic __asm function works.  If not,
2143170222Sdougb		# we need to disable the atomic operations.
2144170222Sdougb		AC_TRY_LINK(, [
2145170222Sdougb					__asm("nop")
2146170222Sdougb				],
2147170222Sdougb		[compiler="standard"
2148170222Sdougb		ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
2149170222Sdougb		[compiler="not supported (atomic operations disabled)"
2150170222Sdougb		have_atomic=no
2151170222Sdougb		arch=noatomic ]);
2152170222Sdougb		;;
2153170222Sdougb	esac
2154170222Sdougb
2155170222Sdougb	AC_MSG_RESULT($compiler)
2156170222Sdougbfi
2157170222Sdougb
2158170222Sdougbif test "$have_atomic" = "yes"; then
2159170222Sdougb	ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
2160170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
2161170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
2162170222Sdougbelse
2163170222Sdougb	ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
2164170222Sdougb	ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
2165170222Sdougb	ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
2166170222Sdougbfi
2167170222Sdougb
2168170222SdougbAC_SUBST(ISC_PLATFORM_HAVEXADD)
2169170222SdougbAC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
2170170222SdougbAC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
2171170222Sdougb
2172170222SdougbAC_SUBST(ISC_PLATFORM_USEGCCASM)
2173170222SdougbAC_SUBST(ISC_PLATFORM_USEOSFASM)
2174170222SdougbAC_SUBST(ISC_PLATFORM_USESTDASM)
2175170222SdougbAC_SUBST(ISC_PLATFORM_USEMACASM)
2176170222Sdougb
2177170222SdougbISC_ARCH_DIR=$arch
2178170222SdougbAC_SUBST(ISC_ARCH_DIR)
2179170222Sdougb
2180170222Sdougb#
2181153816Sdougb#  The following sets up how non-blocking i/o is established.
2182153816Sdougb#  Sunos, cygwin and solaris 2.x (x<5) require special handling.
2183153816Sdougb#
2184153816Sdougbcase "$host" in
2185153816Sdougb*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2186153816Sdougb*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2187153816Sdougb*-solaris2.[[01234]])
2188153816Sdougb	AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2189153816Sdougb	AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2190153816Sdougb		  [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2191153816Sdougb	;;
2192153816Sdougb*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2193153816Sdougb	     [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2194153816Sdougb	;;
2195153816Sdougbesac
2196153816Sdougb#
2197165071Sdougb# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2198165071Sdougb# This prevents the source address being set.
2199165071Sdougb#
2200165071Sdougbcase "$host" in
2201165071Sdougb*-solaris2.[[012345]]|*-solaris2.5.1)
2202165071Sdougb	AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2203165071Sdougb		  [Define if you cannot bind() before connect() for TCP sockets.])
2204165071Sdougb	;;
2205165071Sdougbesac
2206165071Sdougb#
2207135446Strhodes# The following sections deal with tools used for formatting
2208135446Strhodes# the documentation.  They are all optional, unless you are
2209135446Strhodes# a developer editing the documentation source.
2210135446Strhodes#
2211135446Strhodes
2212153816Sdougb#
2213153816Sdougb# Look for TeX.
2214153816Sdougb#
2215135446Strhodes
2216153816SdougbAC_PATH_PROGS(LATEX, latex, latex)
2217153816SdougbAC_SUBST(LATEX)
2218153816Sdougb
2219153816SdougbAC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2220153816SdougbAC_SUBST(PDFLATEX)
2221153816Sdougb
2222135446Strhodes#
2223170222Sdougb# Look for w3m
2224170222Sdougb#
2225170222Sdougb
2226170222SdougbAC_PATH_PROGS(W3M, w3m, w3m)
2227170222SdougbAC_SUBST(W3M)
2228170222Sdougb
2229170222Sdougb#
2230153816Sdougb# Look for xsltproc (libxslt)
2231135446Strhodes#
2232135446Strhodes
2233153816SdougbAC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2234153816SdougbAC_SUBST(XSLTPROC)
2235135446Strhodes
2236135446Strhodes#
2237153816Sdougb# Look for xmllint (libxml2)
2238135446Strhodes#
2239135446Strhodes
2240153816SdougbAC_PATH_PROG(XMLLINT, xmllint, xmllint)
2241153816SdougbAC_SUBST(XMLLINT)
2242135446Strhodes
2243135446Strhodes#
2244135446Strhodes# Subroutine for searching for an ordinary file (e.g., a stylesheet)
2245135446Strhodes# in a number of directories:
2246135446Strhodes#
2247135446Strhodes#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2248135446Strhodes#
2249135446Strhodes# If the file FILENAME is found in one of the DIRECTORIES, the shell
2250135446Strhodes# variable VARIABLE is defined to its absolute pathname.  Otherwise, 
2251135446Strhodes# it is set to FILENAME, with no directory prefix (that's not terribly
2252135446Strhodes# useful, but looks less confusing in substitutions than leaving it
2253135446Strhodes# empty).  The variable VARIABLE will be substituted into output files.
2254135446Strhodes# 
2255135446Strhodes
2256135446StrhodesAC_DEFUN(NOM_PATH_FILE, [
2257135446Strhodes$1=""
2258135446StrhodesAC_MSG_CHECKING(for $2)
2259135446Strhodesfor d in $3
2260135446Strhodesdo
2261135446Strhodes	f=$d/$2
2262135446Strhodes	if test -f $f
2263135446Strhodes	then
2264135446Strhodes		$1=$f
2265135446Strhodes		AC_MSG_RESULT($f)
2266135446Strhodes		break
2267135446Strhodes	fi
2268135446Strhodesdone
2269135446Strhodesif test "X[$]$1" = "X"
2270135446Strhodesthen
2271135446Strhodes	AC_MSG_RESULT("not found");
2272135446Strhodes	$1=$2
2273135446Strhodesfi
2274135446StrhodesAC_SUBST($1)
2275135446Strhodes])
2276135446Strhodes
2277135446Strhodes#
2278186462Sdougb# Look for Docbook-XSL stylesheets.  Location probably varies by system.
2279186462Sdougb# If it's not explicitly specified, guess where it might be found, based on
2280186462Sdougb# where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2281186462Sdougb# of at the moment).
2282135446Strhodes#
2283186462SdougbAC_MSG_CHECKING(for Docbook-XSL path)
2284186462SdougbAC_ARG_WITH(docbook-xsl,
2285186462Sdougb[  --with-docbook-xsl=PATH    Specify path for Docbook-XSL stylesheets],
2286186462Sdougb   docbook_path="$withval", docbook_path="auto")
2287186462Sdougbcase "$docbook_path" in
2288186462Sdougbauto)
2289186462Sdougb	AC_MSG_RESULT(auto)
2290186462Sdougb	docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
2291186462Sdougb	;;
2292186462Sdougb*)
2293186462Sdougb	docbook_xsl_trees="$withval"
2294186462Sdougb    	AC_MSG_RESULT($docbook_xsl_trees)
2295186462Sdougb	;;
2296186462Sdougbesac
2297153816Sdougb
2298135446Strhodes#
2299153816Sdougb# Look for stylesheets we need.
2300153816Sdougb#
2301135446Strhodes
2302186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
2303186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
2304186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
2305186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
2306186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
2307186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
2308186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
2309186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
2310186462SdougbNOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
2311153816Sdougb
2312135446Strhodes#
2313153816Sdougb# Same dance for db2latex
2314135446Strhodes#
2315153816Sdougb# No idea where this lives except on FreeBSD.
2316135446Strhodes#
2317135446Strhodes
2318153816Sdougbdb2latex_xsl_trees="/usr/local/share"
2319135446Strhodes
2320135446Strhodes#
2321153816Sdougb# Look for stylesheets we need.
2322135446Strhodes#
2323135446Strhodes
2324153816SdougbNOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
2325135446Strhodes
2326135446Strhodes#
2327153816Sdougb# Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
2328153816Sdougb# because it's a directory, so just do the same things, inline.
2329135446Strhodes#
2330135446Strhodes
2331153816SdougbAC_MSG_CHECKING(for db2latex/xsl/figures)
2332153816Sdougbfor d in $db2latex_xsl_trees
2333153816Sdougbdo
2334153816Sdougb	dd=$d/db2latex/xsl/figures
2335153816Sdougb	if test -d $dd
2336153816Sdougb	then
2337153816Sdougb		XSLT_DB2LATEX_ADMONITIONS=$dd
2338153816Sdougb		AC_MSG_RESULT($dd)
2339153816Sdougb		break
2340153816Sdougb	fi
2341153816Sdougbdone
2342153816Sdougbif test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
2343153816Sdougbthen
2344153816Sdougb	AC_MSG_RESULT(not found)
2345153816Sdougb	XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
2346153816Sdougbfi
2347153816SdougbAC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
2348135446Strhodes
2349135446Strhodes#
2350170222Sdougb# IDN support
2351170222Sdougb#
2352170222SdougbAC_ARG_WITH(idn,
2353170222Sdougb	[  --with-idn[=MPREFIX]   enable IDN support using idnkit [default PREFIX]],
2354170222Sdougb	use_idn="$withval", use_idn="no")
2355170222Sdougbcase "$use_idn" in
2356170222Sdougbyes)
2357170222Sdougb	if test X$prefix = XNONE ; then
2358170222Sdougb		idn_path=/usr/local
2359170222Sdougb	else
2360170222Sdougb		idn_path=$prefix
2361170222Sdougb	fi
2362170222Sdougb	;;
2363170222Sdougbno)
2364170222Sdougb	;;
2365170222Sdougb*)
2366170222Sdougb	idn_path="$use_idn"
2367170222Sdougb	;;
2368170222Sdougbesac
2369170222Sdougb
2370170222Sdougbiconvinc=
2371170222Sdougbiconvlib=
2372170222SdougbAC_ARG_WITH(libiconv,
2373170222Sdougb	[  --with-libiconv[=IPREFIX]   GNU libiconv are in IPREFIX [default PREFIX]],
2374170222Sdougb	use_libiconv="$withval", use_libiconv="no")
2375170222Sdougbcase "$use_libiconv" in
2376170222Sdougbyes)
2377170222Sdougb	if test X$prefix = XNONE ; then
2378170222Sdougb		iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
2379170222Sdougb	else
2380170222Sdougb		iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
2381170222Sdougb	fi
2382170222Sdougb	;;
2383170222Sdougbno)
2384170222Sdougb	iconvlib=
2385170222Sdougb	;;
2386170222Sdougb*)
2387170222Sdougb	iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
2388170222Sdougb	;;
2389170222Sdougbesac
2390170222Sdougb
2391170222SdougbAC_ARG_WITH(iconv,
2392170222Sdougb	[  --with-iconv[=LIBSPEC]   specify iconv library [default -liconv]],
2393170222Sdougb	iconvlib="$withval")
2394170222Sdougbcase "$iconvlib" in
2395170222Sdougbno)
2396170222Sdougb	iconvlib=
2397170222Sdougb	;;
2398170222Sdougbyes)
2399170222Sdougb	iconvlib=-liconv
2400170222Sdougb	;;
2401170222Sdougbesac
2402170222Sdougb
2403170222SdougbAC_ARG_WITH(idnlib,
2404170222Sdougb	[  --with-idnlib=ARG    specify libidnkit],
2405170222Sdougb	idnlib="$withval", idnlib="no")
2406170222Sdougbif test "$idnlib" = yes; then
2407170222Sdougb	AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
2408170222Sdougbfi
2409170222Sdougb
2410170222SdougbIDNLIBS=
2411170222Sdougbif test "$use_idn" != no; then
2412170222Sdougb	AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
2413170222Sdougb	STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
2414170222Sdougb	if test "$idnlib" != no; then
2415170222Sdougb		IDNLIBS="$idnlib $iconvlib"
2416170222Sdougb	else
2417170222Sdougb		IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
2418170222Sdougb	fi
2419170222Sdougbfi
2420170222SdougbAC_SUBST(IDNLIBS)
2421170222Sdougb
2422170222SdougbAC_CHECK_HEADERS(locale.h)
2423170222SdougbAC_CHECK_FUNCS(setlocale)
2424170222Sdougb
2425170222Sdougb#
2426135446Strhodes# Substitutions
2427135446Strhodes#
2428135446StrhodesAC_SUBST(BIND9_TOP_BUILDDIR)
2429135446StrhodesBIND9_TOP_BUILDDIR=`pwd`
2430135446Strhodes
2431135446StrhodesAC_SUBST(BIND9_ISC_BUILDINCLUDE)
2432135446StrhodesAC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
2433135446StrhodesAC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
2434135446StrhodesAC_SUBST(BIND9_DNS_BUILDINCLUDE)
2435135446StrhodesAC_SUBST(BIND9_LWRES_BUILDINCLUDE)
2436135446StrhodesAC_SUBST(BIND9_BIND9_BUILDINCLUDE)
2437135446Strhodesif test "X$srcdir" != "X"; then
2438135446Strhodes	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
2439135446Strhodes	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
2440135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
2441135446Strhodes	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
2442135446Strhodes	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
2443135446Strhodes	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
2444135446Strhodeselse
2445135446Strhodes	BIND9_ISC_BUILDINCLUDE=""
2446135446Strhodes	BIND9_ISCCC_BUILDINCLUDE=""
2447135446Strhodes	BIND9_ISCCFG_BUILDINCLUDE=""
2448135446Strhodes	BIND9_DNS_BUILDINCLUDE=""
2449135446Strhodes	BIND9_LWRES_BUILDINCLUDE=""
2450135446Strhodes	BIND9_BIND9_BUILDINCLUDE=""
2451135446Strhodesfi
2452135446Strhodes
2453135446StrhodesAC_SUBST_FILE(BIND9_MAKE_INCLUDES)
2454135446StrhodesBIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2455135446Strhodes
2456135446StrhodesAC_SUBST_FILE(BIND9_MAKE_RULES)
2457135446StrhodesBIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2458135446Strhodes
2459135446Strhodes. $srcdir/version
2460135446StrhodesBIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
2461135446StrhodesAC_SUBST(BIND9_VERSION)
2462135446Strhodes
2463135446StrhodesAC_SUBST_FILE(LIBISC_API)
2464135446StrhodesLIBISC_API=$srcdir/lib/isc/api
2465135446Strhodes
2466135446StrhodesAC_SUBST_FILE(LIBISCCC_API)
2467135446StrhodesLIBISCCC_API=$srcdir/lib/isccc/api
2468135446Strhodes
2469135446StrhodesAC_SUBST_FILE(LIBISCCFG_API)
2470135446StrhodesLIBISCCFG_API=$srcdir/lib/isccfg/api
2471135446Strhodes
2472135446StrhodesAC_SUBST_FILE(LIBDNS_API)
2473135446StrhodesLIBDNS_API=$srcdir/lib/dns/api
2474135446Strhodes
2475135446StrhodesAC_SUBST_FILE(LIBBIND9_API)
2476135446StrhodesLIBBIND9_API=$srcdir/lib/bind9/api
2477135446Strhodes
2478135446StrhodesAC_SUBST_FILE(LIBLWRES_API)
2479135446StrhodesLIBLWRES_API=$srcdir/lib/lwres/api
2480135446Strhodes
2481170222Sdougb#
2482170222Sdougb# Configure any DLZ drivers.
2483170222Sdougb#
2484170222Sdougb# If config.dlz.in selects one or more DLZ drivers, it will set
2485170222Sdougb# USE_DLZ to a non-empty value, which will be our clue to
2486170222Sdougb# enable the DLZ core functions.
2487170222Sdougb#
2488170222Sdougb# This section has to come after the libtool stuff because it needs to
2489170222Sdougb# know how to name the driver object files.
2490170222Sdougb#
2491170222Sdougb
2492170222SdougbUSE_DLZ=""
2493170222SdougbDLZ_DRIVER_INCLUDES=""
2494170222SdougbDLZ_DRIVER_LIBS=""
2495170222SdougbDLZ_DRIVER_SRCS=""
2496170222SdougbDLZ_DRIVER_OBJS=""
2497170222Sdougb
2498170222Sdougbsinclude(contrib/dlz/config.dlz.in)
2499170222Sdougb
2500170222SdougbAC_MSG_CHECKING(for DLZ)
2501170222Sdougb
2502170222Sdougbif test -n "$USE_DLZ"
2503170222Sdougbthen
2504170222Sdougb	AC_MSG_RESULT(yes)
2505170222Sdougb	USE_DLZ="-DDLZ $USE_DLZ"
2506170222Sdougb	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
2507170222Sdougb	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
2508170222Sdougbelse
2509170222Sdougb	AC_MSG_RESULT(no)
2510170222Sdougb	DLZ_DRIVER_RULES=/dev/null
2511170222Sdougbfi
2512170222Sdougb
2513170222SdougbAC_SUBST(USE_DLZ)
2514170222SdougbAC_SUBST(DLZ_DRIVER_INCLUDES)
2515170222SdougbAC_SUBST(DLZ_DRIVER_LIBS)
2516170222SdougbAC_SUBST(DLZ_DRIVER_SRCS)
2517170222SdougbAC_SUBST(DLZ_DRIVER_OBJS)
2518170222SdougbAC_SUBST_FILE(DLZ_DRIVER_RULES)
2519170222Sdougb
2520165071Sdougbif test "$cross_compiling" = "yes"; then
2521165071Sdougb	if test -z "$BUILD_CC"; then
2522165071Sdougb		AC_ERROR([BUILD_CC not set])
2523165071Sdougb	fi
2524165071Sdougb	BUILD_CFLAGS="$BUILD_CFLAGS"
2525165071Sdougb	BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
2526165071Sdougb	BUILD_LDFLAGS="$BUILD_LDFLAGS"
2527165071Sdougb	BUILD_LIBS="$BUILD_LIBS"
2528165071Sdougbelse
2529165071Sdougb	BUILD_CC="$CC" 
2530165071Sdougb	BUILD_CFLAGS="$CFLAGS" 
2531165071Sdougb	BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
2532165071Sdougb	BUILD_LDFLAGS="$LDFLAGS"
2533165071Sdougb	BUILD_LIBS="$LIBS"
2534165071Sdougbfi
2535165071Sdougb
2536165071SdougbAC_SUBST(BUILD_CC)
2537165071SdougbAC_SUBST(BUILD_CFLAGS)
2538165071SdougbAC_SUBST(BUILD_CPPFLAGS)
2539165071SdougbAC_SUBST(BUILD_LDFLAGS)
2540165071SdougbAC_SUBST(BUILD_LIBS)
2541165071Sdougb
2542170222Sdougb#
2543170222Sdougb# Commands to run at the end of config.status.
2544170222Sdougb# Don't just put these into configure, it won't work right if somebody
2545170222Sdougb# runs config.status directly (which autoconf allows).
2546170222Sdougb#
2547170222Sdougb
2548170222SdougbAC_CONFIG_COMMANDS(
2549170222Sdougb	[chmod],
2550170222Sdougb	[chmod a+x isc-config.sh])
2551170222Sdougb
2552170222Sdougb#
2553170222Sdougb# Files to configure.  These are listed here because we used to
2554170222Sdougb# specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
2555170222Sdougb# elsewhere if there's a good reason for doing so.
2556170222Sdougb#
2557170222Sdougb
2558170222SdougbAC_CONFIG_FILES([
2559135446Strhodes	Makefile
2560135446Strhodes	make/Makefile
2561135446Strhodes	make/mkdep
2562135446Strhodes	lib/Makefile
2563135446Strhodes	lib/isc/Makefile
2564135446Strhodes	lib/isc/include/Makefile
2565135446Strhodes	lib/isc/include/isc/Makefile
2566135446Strhodes	lib/isc/include/isc/platform.h
2567135446Strhodes	lib/isc/unix/Makefile
2568135446Strhodes	lib/isc/unix/include/Makefile
2569135446Strhodes	lib/isc/unix/include/isc/Makefile
2570135446Strhodes	lib/isc/nls/Makefile
2571135446Strhodes	lib/isc/$thread_dir/Makefile
2572135446Strhodes	lib/isc/$thread_dir/include/Makefile
2573135446Strhodes	lib/isc/$thread_dir/include/isc/Makefile
2574174187Sdougb	lib/isc/$arch/Makefile
2575174187Sdougb	lib/isc/$arch/include/Makefile
2576174187Sdougb	lib/isc/$arch/include/isc/Makefile
2577135446Strhodes	lib/isccc/Makefile
2578135446Strhodes	lib/isccc/include/Makefile
2579135446Strhodes	lib/isccc/include/isccc/Makefile
2580135446Strhodes	lib/isccfg/Makefile
2581135446Strhodes	lib/isccfg/include/Makefile
2582135446Strhodes	lib/isccfg/include/isccfg/Makefile
2583135446Strhodes	lib/dns/Makefile
2584135446Strhodes	lib/dns/include/Makefile
2585135446Strhodes	lib/dns/include/dns/Makefile
2586143731Sdougb	lib/dns/include/dst/Makefile
2587135446Strhodes	lib/bind9/Makefile
2588135446Strhodes	lib/bind9/include/Makefile
2589135446Strhodes	lib/bind9/include/bind9/Makefile
2590135446Strhodes	lib/lwres/Makefile
2591135446Strhodes	lib/lwres/include/Makefile
2592135446Strhodes	lib/lwres/include/lwres/Makefile
2593135446Strhodes	lib/lwres/include/lwres/netdb.h
2594135446Strhodes	lib/lwres/include/lwres/platform.h
2595135446Strhodes	lib/lwres/man/Makefile
2596135446Strhodes	lib/lwres/unix/Makefile
2597135446Strhodes	lib/lwres/unix/include/Makefile
2598135446Strhodes	lib/lwres/unix/include/lwres/Makefile
2599135446Strhodes	lib/tests/Makefile
2600135446Strhodes	lib/tests/include/Makefile
2601135446Strhodes	lib/tests/include/tests/Makefile
2602135446Strhodes	bin/Makefile
2603135446Strhodes	bin/check/Makefile
2604135446Strhodes	bin/named/Makefile
2605135446Strhodes	bin/named/unix/Makefile
2606135446Strhodes	bin/rndc/Makefile
2607135446Strhodes	bin/rndc/unix/Makefile
2608135446Strhodes	bin/dig/Makefile
2609135446Strhodes	bin/nsupdate/Makefile
2610135446Strhodes	bin/tests/Makefile
2611135446Strhodes	bin/tests/names/Makefile
2612135446Strhodes	bin/tests/master/Makefile
2613135446Strhodes	bin/tests/rbt/Makefile
2614135446Strhodes	bin/tests/db/Makefile
2615135446Strhodes	bin/tests/tasks/Makefile
2616135446Strhodes	bin/tests/timers/Makefile
2617135446Strhodes	bin/tests/dst/Makefile
2618135446Strhodes	bin/tests/mem/Makefile
2619135446Strhodes	bin/tests/net/Makefile
2620135446Strhodes	bin/tests/sockaddr/Makefile
2621135446Strhodes	bin/tests/system/Makefile
2622135446Strhodes	bin/tests/system/conf.sh
2623135446Strhodes	bin/tests/system/lwresd/Makefile
2624135446Strhodes	bin/tests/system/tkey/Makefile
2625135446Strhodes	bin/tests/headerdep_test.sh
2626135446Strhodes	bin/dnssec/Makefile
2627135446Strhodes	doc/Makefile
2628135446Strhodes	doc/arm/Makefile
2629135446Strhodes	doc/misc/Makefile
2630170222Sdougb	isc-config.sh
2631153816Sdougb	doc/xsl/Makefile
2632153816Sdougb	doc/xsl/isc-docbook-chunk.xsl
2633153816Sdougb	doc/xsl/isc-docbook-html.xsl
2634153816Sdougb	doc/xsl/isc-docbook-latex.xsl
2635153816Sdougb	doc/xsl/isc-manpage.xsl
2636170222Sdougb])
2637135446Strhodes
2638170222Sdougb#
2639170222Sdougb# Do it
2640170222Sdougb#
2641170222Sdougb
2642170222SdougbAC_OUTPUT
2643170222Sdougb
2644163976Sdougbif test "X$OPENSSL_WARNING" != "X"; then
2645163976Sdougbcat << \EOF
2646163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2647163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2648163976SdougbWARNING                                                                 WARNING
2649163976SdougbWARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
2650163976SdougbWARNING         one or more of the the following known security         WARNING
2651163976SdougbWARNING         flaws:                                                  WARNING
2652163976SdougbWARNING                                                                 WARNING
2653163976SdougbWARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
2654163976SdougbWARNING         CVE-2006-2940.                                          WARNING
2655163976SdougbWARNING                                                                 WARNING
2656163976SdougbWARNING         It is recommended that you upgrade to OpenSSL           WARNING
2657163976SdougbWARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
2658163976SdougbWARNING                                                                 WARNING
2659163976SdougbWARNING         You can disable this warning by specifying:             WARNING
2660163976SdougbWARNING                                                                 WARNING
2661163976SdougbWARNING               --disable-openssl-version-check          	        WARNING
2662163976SdougbWARNING                                                                 WARNING
2663163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2664163976SdougbWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2665163976SdougbEOF
2666163976Sdougbfi
2667163976Sdougb
2668135446Strhodes# Tell Emacs to edit this file in shell mode.
2669135446Strhodes# Local Variables:
2670135446Strhodes# mode: sh
2671135446Strhodes# End:
2672