]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/bind9/configure.in
Update BIND to 9.9.6-P1
[FreeBSD/stable/9.git] / contrib / bind9 / configure.in
1 # Copyright (C) 2004-2014  Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 1998-2003  Internet Software Consortium.
3 #
4 # Permission to use, copy, modify, and/or distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
7 #
8 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 # PERFORMANCE OF THIS SOFTWARE.
15
16 dnl
17 AC_DIVERT_PUSH(1)dnl
18 esyscmd([sed -e 's/^/# /' -e '/Portions of this code/,$d' COPYRIGHT])dnl
19 AC_DIVERT_POP()dnl
20
21 AC_INIT(BIND, [9.9], [bind9-bugs@isc.org], [], [https://www.isc.org/downloads/BIND/])
22 AC_PREREQ(2.59)
23
24 AC_CONFIG_HEADER(config.h)
25 AC_CONFIG_MACRO_DIR([libtool.m4])
26
27 AC_CANONICAL_HOST
28
29 AC_PROG_MAKE_SET
30
31 #
32 # GNU libtool support
33 #
34 case $build_os in
35 sunos*)
36     # Just set the maximum command line length for sunos as it otherwise
37     # takes a exceptionally long time to work it out. Required for libtool.
38
39     lt_cv_sys_max_cmd_len=4096;
40     ;;
41 esac
42
43 AC_PROG_LIBTOOL
44 AC_PROG_INSTALL
45 AC_PROG_LN_S
46
47 AC_SUBST(STD_CINCLUDES)
48 AC_SUBST(STD_CDEFINES)
49 AC_SUBST(STD_CWARNINGS)
50 AC_SUBST(CCOPT)
51 AC_SUBST(CCNOOPT)
52 AC_SUBST(BACKTRACECFLAGS)
53
54 # Warn if the user specified libbind, which is now deprecated
55 AC_ARG_ENABLE(libbind, [  --enable-libbind        deprecated])
56
57 case "$enable_libbind" in
58         yes)
59                 AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
60 It is available from http://www.isc.org as a separate download.])
61                 ;;
62         no|'')
63                 ;;
64 esac
65
66 AC_ARG_ENABLE(warn_error, [  --enable-warn-error          turn on -Werror when compiling])
67
68 AC_ARG_ENABLE(developer, [  --enable-developer      enable developer build settings])
69 case "$enable_developer" in
70 yes)
71         STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
72         test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
73         test "${with_atf+set}" = set || with_atf=yes
74         test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
75         test "${enable_rrl+set}" = set || enable_rrl=yes
76         test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
77         case "$host" in
78         *-darwin*)
79                 test "${enable_exportlib+set}" = set || enable_exportlib=yes
80                 ;;
81         *-linux*)
82                 test "${enable_exportlib+set}" = set || enable_exportlib=yes
83                 ;;
84         esac
85         test "${enable_symtable+set}" = set || enable_symtable=all
86         test "${enable_warn_error+set}" = set || enable_warn_error=yes
87         ;;
88 esac
89 #
90 # Make very sure that these are the first files processed by
91 # config.status, since we use the processed output as the input for
92 # AC_SUBST_FILE() substitutions in other files.
93 #
94 AC_CONFIG_FILES([make/rules make/includes])
95
96 AC_PATH_PROG(AR, ar)
97 ARFLAGS="cruv"
98 AC_SUBST(AR)
99 AC_SUBST(ARFLAGS)
100
101 # The POSIX ln(1) program.  Non-POSIX systems may substitute
102 # "copy" or something.
103 LN=ln
104 AC_SUBST(LN)
105
106 case "$AR" in
107         "")
108                 AC_MSG_ERROR([
109 ar program not found.  Please fix your PATH to include the directory in
110 which ar resides, or set AR in the environment with the full path to ar.
111 ])
112
113                 ;;
114 esac
115
116 #
117 # Etags.
118 #
119 AC_PATH_PROGS(ETAGS, etags emacs-etags)
120
121 #
122 # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
123 # GNU emacs etags, and it requires the -L flag.
124 #
125 if test "X$ETAGS" != "X"; then
126         AC_MSG_CHECKING(for Exuberant Ctags etags)
127         if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
128                 AC_MSG_RESULT(yes)
129                 ETAGS="$ETAGS -L"
130         else
131                 AC_MSG_RESULT(no)
132         fi
133 fi
134 AC_SUBST(ETAGS)
135
136 #
137 # Perl is optional; it is used only by some of the system test scripts.
138 # Note: the backtrace feature (see below) uses perl to build the symbol table,
139 # but it still compiles without perl, in which case an empty table will be used.
140 #
141 AC_PATH_PROGS(PERL, perl5 perl)
142 AC_SUBST(PERL)
143
144 #
145 # Python is also optional; it is used by the tools in bin/python.
146 # If python is unavailable, we simply don't build those.
147 #
148 AC_ARG_WITH(python,
149 [  --with-python=PATH      Specify path to python interpreter],
150     use_python="$withval", use_python="unspec")
151
152 python="python python3 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5 python2.4"
153 testscript='try: import argparse
154 except: exit(1)'
155 case "$use_python" in
156         no)
157                 AC_MSG_CHECKING([for python support])
158                 AC_MSG_RESULT(disabled)
159                 ;;
160         unspec|yes|*)
161                 case "$use_python" in
162                 unspec|yes|'')
163                         for p in $python
164                         do
165                                 AC_PATH_PROGS(PYTHON, $p)
166                                 if test "X$PYTHON" == "X"; then
167                                         continue;
168                                 fi
169                                 AC_MSG_CHECKING([python module 'argparse'])
170                                 if ${PYTHON:-false} -c "$testscript"; then
171                                         AC_MSG_RESULT([found, using $PYTHON])
172                                         break
173                                 fi
174                                 AC_MSG_RESULT([not found])
175                                 unset ac_cv_path_PYTHON
176                                 unset PYTHON
177                         done
178                         if test "X$PYTHON" == "X"
179                         then
180                                 AC_MSG_CHECKING([for python support])
181                                 case "$use_python" in
182                                 unspec)
183                                         AC_MSG_RESULT(disabled)
184                                         ;;
185                                 yes)
186                                         AC_MSG_ERROR([missing python])
187                                         ;;
188                                 esac
189                         fi
190                         ;;
191                 *)
192                         case "$use_python" in
193                         /*)
194                                 PYTHON="$use_python"
195                                 ;;
196                         *)
197                                 AC_PATH_PROGS(PYTHON, $use_python)
198                                 ;;
199                         esac
200                         AC_MSG_CHECKING([python module 'argparse'])
201                         if ${PYTHON:-false} -c "$testscript"; then
202                                 AC_MSG_RESULT([found, using $PYTHON])
203                                 break
204                         else
205                                 AC_MSG_ERROR([not found])
206                         fi
207                         ;;
208                 esac
209                 ;;
210 esac
211
212 PYTHON_TOOLS=''
213 CHECKDS=''
214 COVERAGE=''
215 if test "X$PYTHON" != "X"; then
216         PYTHON_TOOLS=python
217         CHECKDS=checkds
218         COVERAGE=coverage
219 fi
220 AC_SUBST(CHECKDS)
221 AC_SUBST(COVERAGE)
222 AC_SUBST(PYTHON_TOOLS)
223
224 #
225 # Special processing of paths depending on whether --prefix,
226 # --sysconfdir or --localstatedir arguments were given.  What's
227 # desired is some compatibility with the way previous versions
228 # of BIND built; they defaulted to /usr/local for most parts of
229 # the installation, but named.boot/named.conf was in /etc
230 # and named.pid was in /var/run.
231 #
232 # So ... if none of --prefix, --sysconfdir or --localstatedir are
233 # specified, set things up that way.  If --prefix is given, use
234 # it for sysconfdir and localstatedir the way configure normally
235 # would.  To change the prefix for everything but leave named.conf
236 # in /etc or named.pid in /var/run, then do this the usual configure way:
237 # ./configure --prefix=/somewhere --sysconfdir=/etc
238 # ./configure --prefix=/somewhere --localstatedir=/var
239 #
240 # To put named.conf and named.pid in /usr/local with everything else,
241 # set the prefix explicitly to /usr/local even though that's the default:
242 # ./configure --prefix=/usr/local
243 #
244 case "$prefix" in
245         NONE)
246                 case "$sysconfdir" in
247                         '${prefix}/etc')
248                                 sysconfdir=/etc
249                                 ;;
250                 esac
251                 case "$localstatedir" in
252                         '${prefix}/var')
253                                 localstatedir=/var
254                                 ;;
255                 esac
256                 ;;
257 esac
258
259 #
260 # Make sure INSTALL uses an absolute path, else it will be wrong in all
261 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
262 # configure based on the location of the file where it is substituted.
263 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
264 # subdirectory of install-sh, This relative path will be wrong for all
265 # directories more than one level down from install-sh.
266 #
267 case "$INSTALL" in
268         /*)
269                 ;;
270         *)
271                 #
272                 # Not all systems have dirname.
273                 #
274                 changequote({, })
275                 ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
276                 changequote([, ])
277
278                 ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
279                 test "$ac_dir" = "$ac_prog" && ac_dir=.
280                 test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
281                 INSTALL="$ac_dir/$ac_prog"
282                 ;;
283 esac
284
285 #
286 # On these hosts, we really want to use cc, not gcc, even if it is
287 # found.  The gcc that these systems have will not correctly handle
288 # pthreads.
289 #
290 # However, if the user sets $CC to be something, let that override
291 # our change.
292 #
293 if test "X$CC" = "X" ; then
294         case "$host" in
295                 *-dec-osf*)
296                         CC="cc"
297                         ;;
298                 *-solaris*)
299                         # Use Sun's cc if it is available, but watch
300                         # out for /usr/ucb/cc; it will never be the right
301                         # compiler to use.
302                         #
303                         # If setting CC here fails, the AC_PROG_CC done
304                         # below might still find gcc.
305                         IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
306                         for ac_dir in $PATH; do
307                                 test -z "$ac_dir" && ac_dir=.
308                                 case "$ac_dir" in
309                                 /usr/ucb)
310                                         # exclude
311                                         ;;
312                                 *)
313                                         if test -f "$ac_dir/cc"; then
314                                                 CC="$ac_dir/cc"
315                                                 break
316                                         fi
317                                         ;;
318                                 esac
319                         done
320                         IFS="$ac_save_ifs"
321                         ;;
322                 *-hp-hpux*)
323                         CC="cc"
324                         ;;
325                 mips-sgi-irix*)
326                         CC="cc"
327                         ;;
328         esac
329 fi
330
331 AC_PROG_CC
332
333 #
334 # gcc's optimiser is broken at -02 for ultrasparc
335 #
336 if test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
337         case "$host" in
338         sparc-*)
339                 CCFLAGS="-g -O1"
340                 ;;
341         esac
342 fi
343
344 #
345 # OS dependent CC flags
346 #
347 case "$host" in
348         # OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
349         # -D_XOPEN_SOURCE_EXTENDED.
350         *-dec-osf*)
351                 STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
352                 CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
353                 ;;
354         #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
355         *-hp-hpux*)
356                 STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
357                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
358                 LIBS="-lxnet $LIBS"
359                 ;;
360         # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
361         *-solaris*)
362                 STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
363                 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
364                 ;;
365         # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
366         # parts of the IPv6 Advanced Socket API as a result.  This is stupid
367         # as it breaks how the two halves (Basic and Advanced) of the IPv6
368         # Socket API were designed to be used but we have to live with it.
369         # Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
370         *-linux* | *-kfreebsd*-gnu*)
371                 STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
372                 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
373                 ;;
374         #
375         # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
376         # Setting this is sufficient to select the correct behavior for BIND 9.
377         #
378         *-darwin*)
379           STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
380           CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
381           ;;
382 esac
383
384 #
385 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
386 #
387 if test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then
388         CCNOOPT="-O0"
389 fi
390
391 AC_HEADER_STDC
392
393 AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
394 [$ac_includes_default
395 #ifdef HAVE_SYS_PARAM_H
396 # include <sys/param.h>
397 #endif
398 ])
399
400 AC_C_CONST
401 AC_C_INLINE
402 AC_C_VOLATILE
403 AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
404 AC_C_FLEXIBLE_ARRAY_MEMBER
405
406 #
407 # Older versions of HP/UX don't define seteuid() and setegid()
408 #
409 AC_CHECK_FUNCS(seteuid setresuid)
410 AC_CHECK_FUNCS(setegid setresgid)
411
412 #
413 # UnixWare 7.1.1 with the feature supplement to the UDK compiler
414 # is reported to not support "static inline" (RT #1212).
415 #
416 AC_MSG_CHECKING(for static inline breakage)
417 AC_TRY_COMPILE([
418         static inline int foo1() {
419                 return 0;
420         }
421
422         static inline int foo2() {
423                 return foo1();
424         }
425         ], [foo1();],
426         [AC_MSG_RESULT(no)],
427         [AC_MSG_RESULT(yes)
428          AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
429
430 AC_TYPE_SIZE_T
431 AC_CHECK_TYPE(ssize_t, int)
432 AC_CHECK_TYPE(uintptr_t,unsigned long)
433 AC_CHECK_TYPE(socklen_t,
434 [AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
435 [
436 AC_TRY_COMPILE(
437 [
438 #include <sys/types.h>
439 #include <sys/socket.h>
440 int getsockname(int, struct sockaddr *, size_t *);
441 ],[],
442 [AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
443 [AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
444 ],
445 [
446 #include <sys/types.h>
447 #include <sys/socket.h>
448 ])
449 AC_SUBST(ISC_SOCKADDR_LEN_T)
450 AC_HEADER_TIME
451 AC_MSG_CHECKING(for long long)
452 AC_TRY_COMPILE([],[long long i = 0; return (0);],
453         [AC_MSG_RESULT(yes)
454                 ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
455         [AC_MSG_RESULT(no)
456                 ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
457 AC_SUBST(ISC_PLATFORM_HAVELONGLONG)
458
459 #
460 # check for GCC noreturn attribute
461 #
462 AC_MSG_CHECKING(for GCC noreturn attribute)
463 AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
464         [AC_MSG_RESULT(yes)
465                 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
466                 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
467         [AC_MSG_RESULT(no)
468                 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
469                 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
470 AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
471 AC_SUBST(ISC_PLATFORM_NORETURN_POST)
472
473 #
474 # check if we have lifconf
475 #
476 AC_MSG_CHECKING(for struct lifconf)
477 AC_TRY_COMPILE([
478 #include <sys/types.h>
479 #include <sys/socket.h>
480 #include <net/if.h>
481 ],
482 [
483 struct lifconf lifconf;
484 lifconf.lifc_len = 0;
485 ]
486 ,
487         [AC_MSG_RESULT(yes)
488                 ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
489         [AC_MSG_RESULT(no)
490                 ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
491 AC_SUBST(ISC_PLATFORM_HAVELIFCONF)
492
493 #
494 # check if we want the new statistics
495 #
496 AC_ARG_ENABLE(newstats,
497         [  --enable-newstats       use the new statistics])
498 case "$enable_newstats" in
499 yes)
500         AC_DEFINE(NEWSTATS, 1, [Use the new XML schema for statistics])
501         ;;
502 *)
503         ;;
504 esac
505
506 #
507 # check if we want DNS RRL
508 #
509 AC_ARG_ENABLE(rrl,
510         [  --enable-rrl            use DNS Response Rate Limiting])
511 case "$enable_rrl" in
512 yes)
513         AC_DEFINE(USE_RRL, 1, [Enable DNS Response Rate Limiting])
514         RRLLINKOBJS='${RRLOBJS}'
515         RRLLINKSRCS='${RRLSRCS}'
516         ;;
517 *)
518         RRLLINKOBJS=""
519         RRLLINKSRCS=""
520         ;;
521 esac
522 AC_SUBST(RRLLINKOBJS)
523 AC_SUBST(RRLLINKSRCS)
524
525 #
526 # check if we have kqueue
527 #
528 AC_ARG_ENABLE(kqueue,
529         [  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
530               want_kqueue="$enableval",  want_kqueue="yes")
531 case $want_kqueue in
532 yes)
533         AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
534         case $ac_cv_have_kqueue in
535         yes)
536                 ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
537                 ;;
538         *)
539                 ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
540                 ;;
541         esac
542         ;;
543 *)
544         ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
545         ;;
546 esac
547 AC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
548
549 #
550 # check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
551 # so we need to try running the code, not just test its existence.
552 #
553 AC_ARG_ENABLE(epoll,
554 [  --enable-epoll          use Linux epoll when available [[default=auto]]],
555               want_epoll="$enableval",  want_epoll="auto")
556 case $want_epoll in
557 auto)
558         AC_MSG_CHECKING(epoll support)
559         AC_TRY_RUN([
560 #include <sys/epoll.h>
561 int main() {
562         if (epoll_create(1) < 0)
563                 return (1);
564         return (0);
565 }
566 ],
567         [AC_MSG_RESULT(yes)
568         ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
569         [AC_MSG_RESULT(no)
570         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"],
571         [AC_MSG_RESULT(no)
572         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
573         ;;
574 yes)
575         ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
576         ;;
577 *)
578         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
579         ;;
580 esac
581 AC_SUBST(ISC_PLATFORM_HAVEEPOLL)
582
583 #
584 # check if we support /dev/poll
585 #
586 AC_ARG_ENABLE(devpoll,
587         [  --enable-devpoll        use /dev/poll when available [[default=yes]]],
588               want_devpoll="$enableval",  want_devpoll="yes")
589 case $want_devpoll in
590 yes)
591         AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
592         ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
593         ,
594         ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
595         )
596         ;;
597 *)
598         ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
599         ;;
600 esac
601 AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
602
603 #
604 # check if we need to #include sys/select.h explicitly
605 #
606 case $ac_cv_header_unistd_h in
607 yes)
608 AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
609 AC_TRY_COMPILE([
610 #include <sys/types.h> /* Ultrix */
611 #include <unistd.h>],
612 [fd_set read_set; return (0);],
613         [AC_MSG_RESULT(yes)
614          ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
615          LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
616         [AC_MSG_RESULT(no)
617         case $ac_cv_header_sys_select_h in
618         yes)
619          ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
620          LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
621                 ;;
622         no)
623                 AC_MSG_ERROR([need either working unistd.h or sys/select.h])
624                 ;;
625         esac
626         ])
627         ;;
628 no)
629         case $ac_cv_header_sys_select_h in
630         yes)
631              ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
632              LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
633                 ;;
634         no)
635                 AC_MSG_ERROR([need either unistd.h or sys/select.h])
636                 ;;
637         esac
638         ;;
639 esac
640 AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
641 AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
642
643 #
644 # Find the machine's endian flavor.
645 #
646 AC_C_BIGENDIAN
647
648 #
649 # was --with-openssl specified?
650 #
651 OPENSSL_WARNING=
652 AC_MSG_CHECKING(for OpenSSL library)
653 AC_ARG_WITH(openssl,
654 [  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
655                           (Required for DNSSEC)],
656     use_openssl="$withval", use_openssl="auto")
657
658 openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
659 if test "$use_openssl" = "auto"
660 then
661         for d in $openssldirs
662         do
663                 if test -f $d/include/openssl/opensslv.h
664                 then
665                         use_openssl=$d
666                         break
667                 fi
668         done
669 fi
670 OPENSSL_ECDSA=""
671 OPENSSL_GOST=""
672 case "$use_openssl" in
673         no)
674                 AC_MSG_RESULT(no)
675                 DST_OPENSSL_INC=""
676                 USE_OPENSSL=""
677                 OPENSSLGOSTLINKOBJS=""
678                 OPENSSLGOSTLINKSRS=""
679                 OPENSSLLINKOBJS=""
680                 OPENSSLLINKSRCS=""
681                 ;;
682         auto)
683                 DST_OPENSSL_INC=""
684                 USE_OPENSSL=""
685                 OPENSSLGOSTLINKOBJS=""
686                 OPENSSLGOSTLINKSRS=""
687                 OPENSSLLINKOBJS=""
688                 OPENSSLLINKSRCS=""
689                 AC_MSG_ERROR(
690 [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
691 If you don't want OpenSSL, use --without-openssl])
692                 ;;
693         *)
694                 if test "$use_openssl" = "yes"
695                 then
696                         # User did not specify a path - guess it
697                         for d in $openssldirs
698                         do
699                                 if test -f $d/include/openssl/opensslv.h
700                                 then
701                                         use_openssl=$d
702                                         break
703                                 fi
704                         done
705                         if test "$use_openssl" = "yes"
706                         then
707                                 AC_MSG_RESULT(not found)
708                                 AC_MSG_ERROR(
709 [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
710                         fi
711                 elif ! test -f "$use_openssl"/include/openssl/opensslv.h
712                 then
713                         AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
714                 fi
715                 USE_OPENSSL='-DOPENSSL'
716                 if test "$use_openssl" = "/usr"
717                 then
718                         DST_OPENSSL_INC=""
719                         DNS_OPENSSL_LIBS="-lcrypto"
720                 else
721                         DST_OPENSSL_INC="-I$use_openssl/include"
722                         case $host in
723                         *-solaris*)
724                                 DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
725                                 ;;
726                         *-hp-hpux*)
727                                 DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
728                                 ;;
729                         *-apple-darwin*)
730                                 #
731                                 # Apple's ld seaches for serially for dynamic
732                                 # then static libraries.  This means you can't
733                                 # use -L to override dynamic system libraries
734                                 # with static ones when linking.  Instead
735                                 # we specify a absolute path.
736                                 #
737                                 if test -f "$use_openssl/lib/libcrypto.dylib"
738                                 then
739                                         DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
740                                 else
741                                         DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
742                                 fi
743                                 ;;
744                         *)
745                                 DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
746                                 ;;
747                         esac
748                 fi
749                 AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
750
751                 saved_cflags="$CFLAGS"
752                 saved_libs="$LIBS"
753                 CFLAGS="$CFLAGS $DST_OPENSSL_INC"
754                 LIBS="$LIBS $DNS_OPENSSL_LIBS"
755                 AC_MSG_CHECKING(whether linking with OpenSSL works)
756                 AC_TRY_RUN([
757 #include <openssl/err.h>
758 int main() {
759         ERR_clear_error();
760         return (0);
761 }
762 ],
763                 [AC_MSG_RESULT(yes)],
764                 [AC_MSG_RESULT(no)
765                  AC_MSG_ERROR(Could not run test program using OpenSSL from
766 $use_openssl/lib and $use_openssl/include.
767 Please check the argument to --with-openssl and your
768 shared library configuration (e.g., LD_LIBRARY_PATH).)],
769                 [AC_MSG_RESULT(assuming it does work on target platform)])
770
771                 AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
772                 AC_TRY_LINK([
773 #include <openssl/err.h>],
774 [ DSO_METHOD_dlfcn(); ],
775                 [AC_MSG_RESULT(no)],
776                 [LIBS="$LIBS -ldl"
777                 AC_TRY_LINK([
778 #include <openssl/err.h>
779 ],[ DSO_METHOD_dlfcn(); ],
780                 [AC_MSG_RESULT(yes)
781                 DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
782                 ],
783                  [AC_MSG_RESULT(unknown)
784                  AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
785                 [AC_MSG_RESULT(assuming it does work on target platform)])
786                 ],
787                 [AC_MSG_RESULT(assuming it does work on target platform)]
788                 )
789                 
790 AC_ARG_ENABLE(openssl-version-check,
791 [AC_HELP_STRING([--enable-openssl-version-check],
792         [Check OpenSSL Version @<:@default=yes@:>@])])
793 case "$enable_openssl_version_check" in
794 yes|'')
795                 AC_MSG_CHECKING(OpenSSL library version)
796                 AC_TRY_RUN([
797 #include <stdio.h>
798 #include <openssl/opensslv.h>
799 int main() {
800         if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
801              OPENSSL_VERSION_NUMBER < 0x00908000L) ||
802              OPENSSL_VERSION_NUMBER >= 0x0090804fL)
803                 return (0);
804         printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
805                 OPENSSL_VERSION_NUMBER);
806         printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
807                "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
808         return (1);
809 }
810                 ],
811                 [AC_MSG_RESULT(ok)],
812                 [AC_MSG_RESULT(not compatible)
813                  OPENSSL_WARNING=yes
814                 ],
815                 [AC_MSG_RESULT(assuming target platform has compatible version)])
816 ;;
817 no)
818         AC_MSG_RESULT(Skipped OpenSSL version check)
819 ;;
820 esac
821
822         AC_MSG_CHECKING(for OpenSSL DSA support)
823         if test -f $use_openssl/include/openssl/dsa.h
824         then
825                 AC_DEFINE(HAVE_OPENSSL_DSA)
826                 AC_MSG_RESULT(yes)
827         else
828                 AC_MSG_RESULT(no)
829         fi
830
831         AC_CHECK_FUNCS(EVP_sha256 EVP_sha384 EVP_sha512)
832
833         AC_MSG_CHECKING(for OpenSSL ECDSA support)
834         have_ecdsa=""
835         AC_TRY_RUN([
836 #include <stdio.h>
837 #include <openssl/ecdsa.h>
838 #include <openssl/objects.h>
839 int main() {
840         EC_KEY *ec256, *ec384;
841
842 #if !defined(HAVE_EVP_SHA256) || !defined(HAVE_EVP_SHA384)
843         return (1);
844 #endif
845         ec256 = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
846         ec384 = EC_KEY_new_by_curve_name(NID_secp384r1);
847         if (ec256 == NULL || ec384 == NULL)
848                 return (2);
849         return (0);
850 }
851 ],
852         [AC_MSG_RESULT(yes)
853         have_ecdsa="yes"],
854         [AC_MSG_RESULT(no)
855         have_ecdsa="no"],
856         [AC_MSG_RESULT(using --with-ecdsa)])
857         AC_ARG_WITH(ecdsa, [  --with-ecdsa            OpenSSL ECDSA],
858                     with_ecdsa="$withval", with_ecdsa="auto")
859         case "$with_ecdsa" in
860         yes)
861             case "$have_ecdsa" in
862             no)  AC_MSG_ERROR([ecdsa not supported]) ;;
863             *)  have_ecdsa=yes ;;
864             esac
865             ;;
866         no)
867             have_ecdsa=no ;;
868         *)
869             case "$have_ecdsa" in
870             yes|no) ;;
871             *) AC_MSG_ERROR([need --with-ecdsa=[[yes or no]]]) ;;
872             esac
873             ;;
874         esac
875         case $have_ecdsa in
876         yes)
877                 OPENSSL_ECDSA="yes"
878                 AC_DEFINE(HAVE_OPENSSL_ECDSA, 1,
879                           [Define if your OpenSSL version supports ECDSA.])
880                 ;;
881         *)
882                 ;;
883         esac
884
885         AC_MSG_CHECKING(for OpenSSL GOST support)
886         have_gost=""
887         AC_TRY_RUN([
888 #include <openssl/conf.h>
889 #include <openssl/engine.h>
890 int main() {
891 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
892         ENGINE *e;
893         EC_KEY *ek;
894
895         ek = NULL;
896         OPENSSL_config(NULL);
897
898         e = ENGINE_by_id("gost");
899         if (e == NULL)
900                 return (1);
901         if (ENGINE_init(e) <= 0)
902                 return (1);
903         return (0);
904 #else
905         return (1);
906 #endif
907 }
908 ],
909         [AC_MSG_RESULT(yes)
910         have_gost="yes"],
911         [AC_MSG_RESULT(no)
912         have_gost="no"],
913         [AC_MSG_RESULT(using --with-gost)])
914         AC_ARG_WITH(gost, [  --with-gost             OpenSSL GOST],
915                     with_gost="$withval", with_gost="auto")
916         case "$with_gost" in
917         yes)
918             case "$have_gost" in
919             no)  AC_MSG_ERROR([gost not supported]) ;;
920             *)  have_gost=yes ;;
921             esac
922             ;;
923         no)
924             have_gost=no ;;
925         *)
926             case "$have_gost" in
927             yes|no) ;;
928             *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
929             esac
930             ;;
931         esac
932         case $have_gost in
933         yes)
934                 OPENSSL_GOST="yes"
935                 OPENSSLGOSTLINKOBJS='${OPENSSLGOSTLINKOBJS}'
936                 OPENSSLGOSTLINKSRCS='${OPENSSLGOSTLINKSRCS}'
937                 AC_DEFINE(HAVE_OPENSSL_GOST, 1,
938                           [Define if your OpenSSL version supports GOST.])
939                 ;;
940         *)
941                 ;;
942         esac
943         CFLAGS="$saved_cflags"
944         LIBS="$saved_libs"
945         OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
946         OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
947
948         ;;
949 esac
950
951 #
952 # This would include the system openssl path (and linker options to use
953 # it as needed) if it is found.
954 #
955
956 AC_SUBST(USE_OPENSSL)
957 AC_SUBST(DST_OPENSSL_INC)
958 AC_SUBST(OPENSSLGOSTLINKOBJS)
959 AC_SUBST(OPENSSLGOSTLINKSRCS)
960 AC_SUBST(OPENSSLLINKOBJS)
961 AC_SUBST(OPENSSLLINKSRCS)
962 AC_SUBST(OPENSSL_ECDSA)
963 AC_SUBST(OPENSSL_GOST)
964
965 DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
966
967 #
968 # Use OpenSSL for hash functions
969 #
970
971 AC_ARG_ENABLE(openssl-hash,
972         [  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
973         want_openssl_hash="$enableval", want_openssl_hash="no")
974 case $want_openssl_hash in
975         yes)
976                 if test "$USE_OPENSSL" = ""
977                 then
978                         AC_MSG_ERROR([No OpenSSL for hash functions])
979                 fi
980                 ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
981                 ISC_OPENSSL_INC="$DST_OPENSSL_INC"
982                 ;;
983         no)
984                 ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
985                 ISC_OPENSSL_INC=""
986                 ;;
987 esac
988 AC_SUBST(ISC_PLATFORM_OPENSSLHASH)
989 AC_SUBST(ISC_OPENSSL_INC)
990
991 #
992 # PKCS11 (aka crypto hardware) support
993 #
994 # This works only with the right OpenSSL with PKCS11 engine!
995 #
996
997 AC_MSG_CHECKING(for PKCS11 support)
998 AC_ARG_WITH(pkcs11,
999 [  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
1000                           (PATH is for the PKCS11 provider)],
1001    use_pkcs11="$withval", use_pkcs11="no")
1002
1003 case "$use_pkcs11" in
1004         no|'')
1005                 AC_MSG_RESULT(disabled)
1006                 USE_PKCS11=''
1007                 PKCS11_TOOLS=''
1008                 ;;
1009         yes|*)
1010                 AC_MSG_RESULT(using OpenSSL with PKCS11 support)
1011                 USE_PKCS11='-DUSE_PKCS11'
1012                 PKCS11_TOOLS=pkcs11
1013                 ;;
1014 esac
1015 AC_SUBST(USE_PKCS11)
1016 AC_SUBST(PKCS11_TOOLS)
1017
1018 AC_MSG_CHECKING(for PKCS11 tools)
1019 case "$use_pkcs11" in
1020         no|yes|'')
1021                 AC_MSG_RESULT(disabled)
1022                 PKCS11_PROVIDER="undefined"
1023                 ;;
1024        *)
1025                 AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
1026                 PKCS11_PROVIDER="$use_pkcs11"
1027                 ;;
1028 esac
1029 AC_SUBST(PKCS11_PROVIDER)
1030
1031 AC_MSG_CHECKING(for GSSAPI library)
1032 AC_ARG_WITH(gssapi,
1033 [  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
1034     use_gssapi="$withval", use_gssapi="yes")
1035
1036 # gssapi is just the framework, we really require kerberos v5, so
1037 # look for those headers (the gssapi headers must be there, too)
1038 # The problem with this implementation is that it doesn't allow
1039 # for the specification of gssapi and krb5 headers in different locations,
1040 # which probably ought to be fixed although fixing might raise the issue of
1041 # trying to build with incompatible versions of gssapi and krb5.
1042 if test "$use_gssapi" = "yes"
1043 then
1044         # first, deal with the obvious
1045         if test \( -f /usr/include/kerberosv5/krb5.h -o \
1046                    -f /usr/include/krb5/krb5.h -o \
1047                    -f /usr/include/krb5.h \)   -a \
1048                 \( -f /usr/include/gssapi.h -o \
1049                    -f /usr/include/gssapi/gssapi.h \)
1050         then
1051                 use_gssapi=/usr
1052         else
1053             krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
1054             for d in $krb5dirs
1055             do
1056                 if test -f $d/include/gssapi/gssapi_krb5.h -o \
1057                         -f $d/include/krb5.h
1058                 then
1059                         if test -f $d/include/gssapi/gssapi.h -o \
1060                                 -f $d/include/gssapi.h
1061                         then
1062                                 use_gssapi=$d
1063                                 break
1064                         fi
1065                 fi
1066                 use_gssapi="no"
1067             done
1068         fi
1069 fi
1070
1071 case "$use_gssapi" in
1072         no)
1073                 AC_MSG_RESULT(disabled)
1074                 USE_GSSAPI=''
1075                 ;;
1076         yes)
1077                 AC_MSG_ERROR([--with-gssapi must specify a path])
1078                 ;;
1079         *)
1080                 AC_MSG_RESULT(looking in $use_gssapi/lib)
1081                 USE_GSSAPI='-DGSSAPI'
1082                 saved_cppflags="$CPPFLAGS"
1083                 CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
1084                 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
1085                     [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"
1086                      gssapi_hack="#include <$ac_header>"])
1087
1088                 if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
1089                     AC_MSG_ERROR([gssapi.h not found])
1090                 fi
1091
1092                 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
1093                     [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"
1094                      gssapi_krb5_hack="#include <$ac_header>"])
1095
1096                 AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
1097                     [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"
1098                     krb5_hack="#include <$ac_header>"])
1099
1100                 if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
1101                     AC_MSG_ERROR([krb5.h not found])
1102                 fi
1103
1104                 #
1105                 # XXXDCL This probably doesn't work right on all systems.
1106                 # It will need to be worked on as problems become evident.
1107                 #
1108                 # Essentially the problems here relate to two different
1109                 # areas.  The first area is building with either KTH
1110                 # or MIT Kerberos, particularly when both are present on
1111                 # the machine.  The other is static versus dynamic linking.
1112                 #
1113                 # On the KTH vs MIT issue, Both have libkrb5 that can mess
1114                 # up the works if one implementation ends up trying to
1115                 # use the other's krb.  This is unfortunately a situation
1116                 # that very easily arises.
1117                 #
1118                 # Dynamic linking when the dependency information is built
1119                 # into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
1120                 # all such problems go away, but when that setup is not
1121                 # present, because either the dynamic libraries lack
1122                 # dependencies or static linking is being done, then the
1123                 # problems start to show up.
1124                 saved_libs="$LIBS"
1125                 for TRY_LIBS in \
1126                     "-lgssapi_krb5" \
1127                     "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
1128                     "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
1129                     "-lgssapi" \
1130                     "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
1131                     "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
1132                     "-lgssapi -lkrb5 -lgssapi_krb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
1133                     "-lgssapi -lkrb5 -lhx509 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
1134                     "-lgss -lkrb5"
1135                 do
1136                     # Note that this does not include $saved_libs, because
1137                     # on FreeBSD machines this configure script has added
1138                     # -L/usr/local/lib to LIBS, which can make the
1139                     # -lgssapi_krb5 test succeed with shared libraries even
1140                     # when you are trying to build with KTH in /usr/lib.
1141                     if test "$use_gssapi" = "/usr"
1142                     then
1143                             LIBS="$TRY_LIBS"
1144                     else
1145                             LIBS="-L$use_gssapi/lib $TRY_LIBS"
1146                     fi
1147                     AC_MSG_CHECKING(linking as $TRY_LIBS)
1148                     AC_TRY_LINK([
1149 #include <sys/types.h>
1150 $gssapi_hack
1151 $gssapi_krb5_hack
1152 $krb5_hack
1153                                 ] , [gss_acquire_cred(NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);krb5_init_context(NULL);
1154 #if defined(HAVE_GSSAPI_KRB5_H) || defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
1155 gsskrb5_register_acceptor_identity(NULL);
1156 #endif],
1157                                 gssapi_linked=yes, gssapi_linked=no)
1158                     case $gssapi_linked in
1159                     yes) AC_MSG_RESULT(yes); break ;;
1160                     no)  AC_MSG_RESULT(no) ;;
1161                     esac
1162                 done
1163
1164                 CPPFLAGS="$saved_cppflags"
1165
1166                 case $gssapi_linked in
1167                 no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
1168                 esac
1169
1170                 #
1171                 # XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
1172                 # but MIT in /usr/local/lib and trying to build with KTH.
1173                 # /usr/local/lib can end up earlier on the link lines.
1174                 # Like most kludges, this one is not only inelegant it
1175                 # is also likely to be the wrong thing to do at least as
1176                 # many times as it is the right thing.  Something better
1177                 # needs to be done.
1178                 #
1179                 if test "$use_gssapi" = "/usr" -a \
1180                         -f /usr/local/lib/libkrb5.a; then
1181                     FIX_KTH_VS_MIT=yes
1182                 fi
1183
1184                 case "$FIX_KTH_VS_MIT" in
1185                 yes)
1186                     case "$enable_static_linking" in
1187                     yes) gssapi_lib_suffix=".a"  ;;
1188                     *)   gssapi_lib_suffix=".so" ;;
1189                     esac
1190
1191                     for lib in $LIBS; do
1192                         case $lib in
1193                         -L*)
1194                             ;;
1195                         -l*)
1196                             new_lib=`echo $lib |
1197                                      sed -e s%^-l%$use_gssapi/lib/lib% \
1198                                          -e s%$%$gssapi_lib_suffix%`
1199                             NEW_LIBS="$NEW_LIBS $new_lib"
1200                             ;;
1201                         *)
1202                            AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1203                             ;;
1204                         esac
1205                     done
1206                     LIBS="$NEW_LIBS"
1207                     ;;
1208                 esac
1209
1210                 DST_GSSAPI_INC="-I$use_gssapi/include"
1211                 DNS_GSSAPI_LIBS="$LIBS"
1212
1213                 AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1214                 LIBS="$saved_libs"
1215                 ;;
1216 esac
1217
1218 AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1219 AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1220 AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1221 AC_SUBST(ISC_PLATFORM_KRB5HEADER)
1222
1223 AC_SUBST(USE_GSSAPI)
1224 AC_SUBST(DST_GSSAPI_INC)
1225 AC_SUBST(DNS_GSSAPI_LIBS)
1226 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
1227
1228 #
1229 # Applications linking with libdns also need to link with these libraries.
1230 #
1231
1232 AC_SUBST(DNS_CRYPTO_LIBS)
1233
1234 #
1235 # was --with-randomdev specified?
1236 #
1237 AC_MSG_CHECKING(for random device)
1238 AC_ARG_WITH(randomdev,
1239 [  --with-randomdev=PATH   Specify path for random device],
1240     use_randomdev="$withval", use_randomdev="unspec")
1241
1242 case "$use_randomdev" in
1243         unspec)
1244                 case "$cross_compiling" in
1245                 yes)
1246                         AC_MSG_RESULT(unspecified)
1247                         AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
1248                 esac
1249                 case "$host" in
1250                         *-openbsd*)
1251                                 devrandom=/dev/arandom
1252                                 ;;
1253                         *)
1254                                 devrandom=/dev/random
1255                                 ;;
1256                 esac
1257                 AC_MSG_RESULT($devrandom)
1258                 AC_CHECK_FILE($devrandom,
1259                               AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1260                                                  "$devrandom"),)
1261                               
1262                 ;;
1263         yes)
1264                 AC_MSG_ERROR([--with-randomdev must specify a path])
1265                 ;;
1266         no)
1267                 AC_MSG_RESULT(disabled)
1268                 ;;
1269         *)
1270                 AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1271                 AC_MSG_RESULT(using "$use_randomdev")
1272                 ;;
1273 esac
1274
1275 #
1276 # Only check dsa signature generation on these platforms when performing
1277 # system tests.
1278 #
1279 CHECK_DSA=0
1280 if grep "#define PATH_RANDOMDEV " confdefs.h > /dev/null
1281 then
1282         case "$host" in
1283         *darwin*|*freebsd*)
1284                 CHECK_DSA=1
1285                 ;;
1286         esac
1287 fi
1288 AC_SUBST(CHECK_DSA)
1289
1290 #
1291 # Do we have arc4random(), etc ? arc4random_addrandom() has been removed
1292 # from OpenBSD 5.5 onwards.
1293 #
1294 AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1295 AC_CHECK_FUNC(arc4random_addrandom, AC_DEFINE(HAVE_ARC4RANDOM_ADDRANDOM))
1296
1297 sinclude(config.threads.in)dnl
1298
1299 if $use_threads
1300 then
1301         if test "X$GCC" = "Xyes"; then
1302                 case "$host" in
1303                 *-freebsd*)
1304                         CC="$CC -pthread"
1305                         CCOPT="$CCOPT -pthread"
1306                         CCNOOPT="$CCNOOPT -pthread"
1307                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1308                         ;;
1309                 *-openbsd*)
1310                         CC="$CC -pthread"
1311                         CCOPT="$CCOPT -pthread"
1312                         CCNOOPT="$CCNOOPT -pthread"
1313                         ;;
1314                 *-solaris*)
1315                         LIBS="$LIBS -lthread"
1316                         ;;
1317                 *-ibm-aix*)
1318                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1319                         ;;
1320                 esac
1321         else
1322                 case $host in
1323                 *-dec-osf*)
1324                         CC="$CC -pthread"
1325                         CCOPT="$CCOPT -pthread"
1326                         CCNOOPT="$CCNOOPT -pthread"
1327                         ;;
1328                 *-solaris*)
1329                         CC="$CC -mt"
1330                         CCOPT="$CCOPT -mt"
1331                         CCNOOPT="$CCNOOPT -mt"
1332                         ;;
1333                 *-ibm-aix*)
1334                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1335                         ;;
1336                 *-sco-sysv*uw*|*-*-sysv*UnixWare*)
1337                         CC="$CC -Kthread"
1338                         CCOPT="$CCOPT -Kthread"
1339                         CCNOOPT="$CCNOOPT -Kthread"
1340                         ;;
1341                 *-*-sysv*OpenUNIX*)
1342                         CC="$CC -Kpthread"
1343                         CCOPT="$CCOPT -Kpthread"
1344                         CCNOOPT="$CCNOOPT -Kpthread"
1345                         ;;
1346                 esac
1347         fi
1348         ALWAYS_DEFINES="-D_REENTRANT"
1349         ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1350         THREADOPTOBJS='${THREADOPTOBJS}'
1351         THREADOPTSRCS='${THREADOPTSRCS}'
1352         thread_dir=pthreads
1353         #
1354         # We'd like to use sigwait() too
1355         #
1356         AC_CHECK_FUNC(sigwait,
1357                       AC_DEFINE(HAVE_SIGWAIT),
1358                       AC_CHECK_LIB(c, sigwait,
1359                       AC_DEFINE(HAVE_SIGWAIT),
1360                       AC_CHECK_LIB(pthread, sigwait,
1361                                    AC_DEFINE(HAVE_SIGWAIT),
1362                                    AC_CHECK_LIB(pthread, _Psigwait,
1363                                                 AC_DEFINE(HAVE_SIGWAIT),))))
1364
1365         AC_CHECK_FUNC(pthread_attr_getstacksize,
1366                       AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1367
1368         AC_CHECK_FUNC(pthread_attr_setstacksize,
1369                       AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1370
1371         AC_CHECK_HEADERS(sched.h)
1372
1373         case "$host" in
1374         *solaris-*)
1375                 AC_CHECK_LIB(rt, sched_yield)
1376                 ;;
1377         esac
1378
1379         AC_CHECK_FUNCS(sched_yield pthread_yield pthread_yield_np)
1380
1381         #
1382         # Additional OS-specific issues related to pthreads and sigwait.
1383         #
1384         case "$host" in
1385                 #
1386                 # One more place to look for sigwait.
1387                 #
1388                 *-freebsd*)
1389                         AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1390                         case $host in
1391                         *-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1392                         *-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1393                                 AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1394                                 ;;
1395                         *-freebsd6.*)
1396                                 AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1397                                 ;;
1398                         esac
1399                         ;;
1400                 #
1401                 # BSDI 3.0 through 4.0.1 needs pthread_init() to be
1402                 # called before certain pthreads calls.  This is deprecated
1403                 # in BSD/OS 4.1.
1404                 #
1405                 *-bsdi3.*|*-bsdi4.0*)
1406                         AC_DEFINE(NEED_PTHREAD_INIT)
1407                         ;;
1408                 #
1409                 # LinuxThreads requires some changes to the way we
1410                 # deal with signals.
1411                 #
1412                 *-linux*)
1413                         AC_DEFINE(HAVE_LINUXTHREADS)
1414                         ;;
1415                 #
1416                 # Ensure the right sigwait() semantics on Solaris and make
1417                 # sure we call pthread_setconcurrency.
1418                 #
1419                 *-solaris*)
1420                         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1421                         AC_CHECK_FUNC(pthread_setconcurrency,
1422                                       AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1423                         ;;
1424                 #
1425                 # UnixWare does things its own way.
1426                 #
1427                 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1428                         AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1429                         ;;
1430         esac
1431
1432         #
1433         # Look for sysconf to allow detection of the number of processors.
1434         #
1435         AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1436 else
1437         ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1438         thread_dir=nothreads
1439         THREADOPTOBJS=""
1440         THREADOPTSRCS=""
1441         ALWAYS_DEFINES=""
1442 fi
1443
1444 AC_SUBST(ALWAYS_DEFINES)
1445 AC_SUBST(ISC_PLATFORM_USETHREADS)
1446 AC_SUBST(THREADOPTOBJS)
1447 AC_SUBST(THREADOPTSRCS)
1448 ISC_THREAD_DIR=$thread_dir
1449 AC_SUBST(ISC_THREAD_DIR)
1450
1451 #
1452 # was --with-libxml2 specified?
1453 #
1454 AC_MSG_CHECKING(for libxml2 library)
1455 AC_ARG_WITH(libxml2,
1456 [  --with-libxml2[=PATH]     Build with libxml2 library [yes|no|path]],
1457     use_libxml2="$withval", use_libxml2="auto")
1458
1459 case "$use_libxml2" in
1460         no)
1461                 DST_LIBXML2_INC=""
1462                 ;;
1463         auto|yes)
1464                 case X`(xml2-config --version) 2>/dev/null` in
1465                 X2.[[6789]].*)
1466                         libxml2_libs=`xml2-config --libs`
1467                         libxml2_cflags=`xml2-config --cflags`
1468                         ;;
1469                 *)
1470                         libxml2_libs=
1471                         libxml2_cflags=
1472                         ;;
1473                 esac
1474                 ;;
1475         *)
1476                 if test -f "$use_libxml2/bin/xml2-config" ; then
1477                         libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1478                         libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1479                 fi
1480                 ;;
1481 esac
1482
1483 if test "X$libxml2_libs" != "X"
1484 then
1485         CFLAGS="$CFLAGS $libxml2_cflags"
1486         LIBS="$LIBS $libxml2_libs"
1487         #
1488         # Sanity check xml2-config output.
1489         #
1490         AC_TRY_LINK([#include <libxml/xmlwriter.h>],
1491                     [return(xmlTextWriterStartElement(NULL, NULL));],
1492                     AC_MSG_RESULT(yes),
1493                     AC_MSG_ERROR(xml2-config returns badness))
1494         AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1495 else
1496         AC_MSG_RESULT(no)
1497 fi
1498
1499 #
1500 # In solaris 10, SMF can manage named service
1501 #
1502 AC_CHECK_LIB(scf, smf_enable_instance)
1503
1504 #
1505 # flockfile is usually provided by pthreads, but we may want to use it
1506 # even if compiled with --disable-threads.  getc_unlocked might also not
1507 # be defined.
1508 #
1509 AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
1510 AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
1511
1512 #
1513 # Indicate what the final decision was regarding threads.
1514 #
1515 AC_MSG_CHECKING(whether to build with threads)
1516 if $use_threads; then
1517         AC_MSG_RESULT(yes)
1518 else
1519         AC_MSG_RESULT(no)
1520 fi
1521
1522 #
1523 # End of pthreads stuff.
1524 #
1525
1526 #
1527 # Large File
1528 #
1529 AC_ARG_ENABLE(largefile, [  --enable-largefile    64-bit file support],
1530               want_largefile="yes", want_largefile="no")
1531 case $want_largefile in
1532         yes)
1533                 ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1534                 ;;
1535         *)
1536                 ;;
1537 esac
1538
1539 #
1540 # Additional compiler settings.
1541 #
1542 MKDEPCC="$CC"
1543 MKDEPCFLAGS="-M"
1544 IRIX_DNSSEC_WARNINGS_HACK=""
1545
1546 if test "X$GCC" = "Xyes"; then
1547         STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1548         AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1549         SAVE_CFLAGS="$CFLAGS"
1550         CFLAGS="$CFLAGS -fno-strict-aliasing"
1551         AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1552         CFLAGS="$SAVE_CFLAGS"
1553         if test "$FNOSTRICTALIASING" = "yes"; then
1554                 AC_MSG_RESULT(yes)
1555                 STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"
1556         else
1557                 AC_MSG_RESULT(no)
1558         fi
1559         #
1560         # turn off delete null pointer checks
1561         #
1562         AC_MSG_CHECKING(if "$CC" supports -fno-delete-null-pointer-checks)
1563         SAVE_CFLAGS="$CFLAGS"
1564         CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
1565         AC_TRY_COMPILE(,, [FNODELETENULLPOINTERCHECKS=yes],
1566                           [FNODELETENULLPOINTERCHECKS=no])
1567         CFLAGS="$SAVE_CFLAGS"
1568         if test "$FNODELETENULLPOINTERCHECKS" = "yes"; then
1569                 AC_MSG_RESULT(yes)
1570                 STD_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"
1571         else
1572                 AC_MSG_RESULT(no)
1573         fi
1574         case "$host" in
1575         *-hp-hpux*)
1576                 CFLAGS="$CFLAGS -Wl,+vnocompatwarnings"
1577                 BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings"
1578                 ;;
1579         esac
1580         if test "X$enable_warn_error" = Xyes; then
1581                 STD_CWARNINGS="$STD_CWARNINGS -Werror"
1582         fi
1583 else
1584         case $host in
1585         *-dec-osf*)
1586                 CC="$CC -std"
1587                 CCOPT="$CCOPT -std"
1588                 CCNOOPT="$CCNOOPT -std"
1589                 MKDEPCC="$CC"
1590                 ;;
1591         *-hp-hpux*)
1592                 CC="$CC -Ae -z"
1593                 # The version of the C compiler that constantly warns about
1594                 # 'const' as well as alignment issues is unfortunately not
1595                 # able to be discerned via the version of the operating
1596                 # system, nor does cc have a version flag.
1597                 case "`$CC +W 123 2>&1`" in
1598                 *Unknown?option*)
1599                         STD_CWARNINGS="+w1"
1600                         ;;
1601                 *)
1602                         # Turn off the pointlessly noisy warnings.
1603                         STD_CWARNINGS="+w1 +W 474,530,2193,2236"
1604                         ;;
1605                 esac
1606                 CCOPT="$CCOPT -Ae -z"
1607                 CCNOOPT="$CCNOOPT -Ae -z"
1608                 CFLAGS="$CFLAGS -Wl,+vnocompatwarnings"
1609                 BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings"
1610                 MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
1611                 ;;
1612         *-sgi-irix*)
1613                 STD_CWARNINGS="-fullwarn -woff 1209"
1614                 #
1615                 # Silence more than 250 instances of
1616                 #   "prototyped function redeclared without prototype"
1617                 # and 11 instances of
1618                 #   "variable ... was set but never used"
1619                 # from lib/dns/sec/openssl.
1620                 #
1621                 IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
1622                 ;;
1623         *-solaris*)
1624                 MKDEPCFLAGS="-xM"
1625                 ;;
1626         *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1627                 # UnixWare
1628                 CC="$CC -w"
1629                 ;;
1630         esac
1631 fi
1632
1633 AC_SUBST(MKDEPCC)
1634 AC_SUBST(MKDEPCFLAGS)
1635 AC_SUBST(MKDEPPROG)
1636 AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
1637
1638 #
1639 # NLS
1640 #
1641 AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1642
1643 #
1644 # -lxnet buys us one big porting headache...  standards, gotta love 'em.
1645 #
1646 # AC_CHECK_LIB(xnet, socket, ,
1647 #    AC_CHECK_LIB(socket, socket)
1648 # )
1649 #
1650 # Use this for now, instead:
1651 #
1652 case "$host" in
1653         mips-sgi-irix*)
1654                 ;;
1655         *-linux*)
1656                 ;;
1657         *)
1658                 AC_CHECK_LIB(socket, socket)
1659                 AC_CHECK_LIB(nsl, inet_addr)
1660                 ;;
1661 esac
1662
1663 #
1664 # Work around Solaris's select() limitations.
1665 #
1666 case "$host" in
1667         *-solaris2.[[89]]|*-solaris2.1?)
1668         AC_DEFINE(FD_SETSIZE, 65536,
1669                   [Solaris hack to get select_large_fdset.])
1670         ;;
1671 esac
1672
1673 #
1674 # Purify support
1675 #
1676 AC_MSG_CHECKING(whether to use purify)
1677 AC_ARG_WITH(purify,
1678         [  --with-purify[=PATH]      use Rational purify],
1679         use_purify="$withval", use_purify="no")
1680
1681 case "$use_purify" in
1682         no)
1683                 ;;
1684         yes)
1685                 AC_PATH_PROG(purify_path, purify, purify)
1686                 ;;
1687         *)
1688                 purify_path="$use_purify"
1689                 ;;
1690 esac
1691
1692 case "$use_purify" in
1693         no)
1694                 AC_MSG_RESULT(no)
1695                 PURIFY=""
1696                 ;;
1697         *)
1698                 if test -f $purify_path || test $purify_path = purify; then
1699                         AC_MSG_RESULT($purify_path)
1700                         PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1701                         PURIFY="$purify_path $PURIFYFLAGS"
1702                 else
1703                         AC_MSG_ERROR([$purify_path not found.
1704
1705 Please choose the proper path with the following command:
1706
1707     configure --with-purify=PATH
1708 ])
1709                 fi
1710                 ;;
1711 esac
1712
1713 AC_SUBST(PURIFY)
1714
1715 AC_ARG_WITH(libtool,
1716             [  --with-libtool          use GNU libtool],
1717             use_libtool="$withval", use_libtool="no")
1718
1719 case $use_libtool in
1720         yes)
1721                 AM_PROG_LIBTOOL
1722                 O=lo
1723                 A=la
1724                 LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1725                 LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1726                 LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1727                 LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1728                 INSTALL_LIBRARY='${INSTALL_PROGRAM}'
1729                 case "$host" in
1730                 *) LIBTOOL_ALLOW_UNDEFINED= ;;
1731                 esac
1732                 case "$host" in
1733                 *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1734                 *) LIBTOOL_IN_MAIN= ;;
1735                 esac;
1736                 ;;
1737         *)
1738                 O=o
1739                 A=a
1740                 LIBTOOL=
1741                 AC_SUBST(LIBTOOL)
1742                 LIBTOOL_MKDEP_SED=
1743                 LIBTOOL_MODE_COMPILE=
1744                 LIBTOOL_MODE_INSTALL=
1745                 LIBTOOL_MODE_LINK=
1746                 LIBTOOL_ALLOW_UNDEFINED=
1747                 LIBTOOL_IN_MAIN=
1748                 INSTALL_LIBRARY='${INSTALL_DATA}'
1749                 ;;
1750 esac
1751 AC_SUBST(INSTALL_LIBRARY)
1752
1753 #
1754 # enable/disable dumping stack backtrace.  Also check if the system supports
1755 # glibc-compatible backtrace() function.
1756 #
1757 AC_ARG_ENABLE(backtrace,
1758 [  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
1759               want_backtrace="$enableval",  want_backtrace="yes")
1760 case $want_backtrace in
1761 yes)
1762         ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
1763         AC_TRY_LINK([#include <execinfo.h>],
1764         [return (backtrace((void **)0, 0));],
1765         [AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
1766         ;;
1767 *)
1768         ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
1769         ;;
1770 esac
1771 AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
1772
1773 AC_ARG_ENABLE(symtable,
1774 [  --enable-symtable       use internal symbol table for backtrace
1775                           [[all|minimal(default)|none]]],
1776                 want_symtable="$enableval",  want_symtable="minimal")
1777 case $want_symtable in
1778 yes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
1779         if test "$PERL" = ""
1780         then
1781                 AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1782 Install perl or explicitly disable the feature by --disable-symtable.])
1783         fi
1784         if test "$use_libtool" = "yes"; then
1785                 AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
1786         else
1787                 # we generate the internal symbol table only for those systems
1788                 # known to work to avoid unexpected build failure.  Also, warn
1789                 # about unsupported systems when the feature is enabled
1790                 #  manually.
1791                 case $host_os in
1792                 freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1793                         MKSYMTBL_PROGRAM="$PERL"
1794                         if test $want_symtable = all; then
1795                                 ALWAYS_MAKE_SYMTABLE="yes"
1796                         fi
1797                         ;;
1798                 *)
1799                         if test $want_symtable = yes -o $want_symtable = all
1800                         then
1801                                 AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1802                         fi
1803                 esac
1804         fi
1805         ;;
1806 *)
1807         ;;
1808 esac
1809 AC_SUBST(MKSYMTBL_PROGRAM)
1810 AC_SUBST(ALWAYS_MAKE_SYMTABLE)
1811
1812 #
1813 # File name extension for static archive files, for those few places
1814 # where they are treated differently from dynamic ones.
1815 #
1816 SA=a
1817
1818 AC_SUBST(O)
1819 AC_SUBST(A)
1820 AC_SUBST(SA)
1821 AC_SUBST(LIBTOOL_MKDEP_SED)
1822 AC_SUBST(LIBTOOL_MODE_COMPILE)
1823 AC_SUBST(LIBTOOL_MODE_INSTALL)
1824 AC_SUBST(LIBTOOL_MODE_LINK)
1825 AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1826 AC_SUBST(LIBTOOL_IN_MAIN)
1827
1828 #
1829 # build exportable DNS library?
1830 #
1831 AC_ARG_ENABLE(exportlib,
1832         [  --enable-exportlib     build exportable library (GNU make required)
1833                           [[default=no]]])
1834 case "$enable_exportlib" in
1835         yes)
1836                 gmake=
1837                 for x in gmake gnumake make; do
1838                         if $x --version 2>/dev/null | grep GNU > /dev/null; then
1839                                 gmake=$x
1840                                 break;
1841                         fi
1842                 done
1843                 if test -z "$gmake"; then
1844                         AC_MSG_ERROR([exportlib requires GNU make.  Install it or disable the feature.])
1845                 fi
1846                 LIBEXPORT=lib/export
1847                 AC_SUBST(LIBEXPORT)
1848                 BIND9_CO_RULE="%.$O:  \${srcdir}/%.c"
1849                 ;;
1850         no|*)
1851                 BIND9_CO_RULE=".c.$O:"
1852                 ;;
1853 esac
1854 AC_SUBST(BIND9_CO_RULE)
1855
1856 AC_ARG_WITH(export-libdir,
1857         [  --with-export-libdir[=PATH]
1858                           installation directory for the export library
1859                           [[EPREFIX/lib/bind9]]],
1860         export_libdir="$withval",)
1861 if test -z "$export_libdir"; then
1862         export_libdir="\${exec_prefix}/lib/bind9/"
1863 fi
1864 AC_SUBST(export_libdir)
1865
1866 AC_ARG_WITH(export-includedir,
1867         [  --with-export-includedir[=PATH]
1868                           installation directory for the header files of the
1869                           export library [[PREFIX/include/bind9]]],
1870         export_includedir="$withval",)
1871 if test -z "$export_includedir"; then
1872         export_includedir="\${prefix}/include/bind9/"
1873 fi
1874 AC_SUBST(export_includedir)
1875
1876 #
1877 # Here begins a very long section to determine the system's networking
1878 # capabilities.  The order of the tests is significant.
1879 #
1880
1881 #
1882 # IPv6
1883 #
1884 AC_ARG_ENABLE(ipv6,
1885         [  --enable-ipv6           use IPv6 [default=autodetect]])
1886
1887 case "$enable_ipv6" in
1888         yes|''|autodetect)
1889                 AC_DEFINE(WANT_IPV6)
1890                 ;;
1891         no)
1892                 ;;
1893 esac
1894
1895 #
1896 # We do the IPv6 compilation checking after libtool so that we can put
1897 # the right suffix on the files.
1898 #
1899 AC_MSG_CHECKING(for IPv6 structures)
1900 AC_TRY_COMPILE([
1901 #include <sys/types.h>
1902 #include <sys/socket.h>
1903 #include <netinet/in.h>],
1904 [struct sockaddr_in6 sin6; return (0);],
1905         [AC_MSG_RESULT(yes)
1906          found_ipv6=yes],
1907         [AC_MSG_RESULT(no)
1908          found_ipv6=no])
1909
1910 #
1911 # See whether IPv6 support is provided via a Kame add-on.
1912 # This is done before other IPv6 linking tests to LIBS is properly set.
1913 #
1914 AC_MSG_CHECKING(for Kame IPv6 support)
1915 AC_ARG_WITH(kame,
1916         [  --with-kame[=PATH]     use Kame IPv6 [default path /usr/local/v6]],
1917         use_kame="$withval", use_kame="no")
1918
1919 case "$use_kame" in
1920         no)
1921                 ;;
1922         yes)
1923                 kame_path=/usr/local/v6
1924                 ;;
1925         *)
1926                 kame_path="$use_kame"
1927                 ;;
1928 esac
1929
1930 case "$use_kame" in
1931         no)
1932                 AC_MSG_RESULT(no)
1933                 ;;
1934         *)
1935                 if test -f $kame_path/lib/libinet6.a; then
1936                         AC_MSG_RESULT($kame_path/lib/libinet6.a)
1937                         LIBS="-L$kame_path/lib -linet6 $LIBS"
1938                 else
1939                         AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1940
1941 Please choose the proper path with the following command:
1942
1943     configure --with-kame=PATH
1944 ])
1945                 fi
1946                 ;;
1947 esac
1948
1949 #
1950 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1951 # Including it on Kame-using platforms is very bad, though, because
1952 # Kame uses #error against direct inclusion.   So include it on only
1953 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1954 # This is done before the in6_pktinfo check because that's what
1955 # netinet6/in6.h is needed for.
1956 #
1957 changequote({, })
1958 case "$host" in
1959 *-bsdi4.[01]*)
1960         ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1961         LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1962         isc_netinet6in6_hack="#include <netinet6/in6.h>"
1963         ;;
1964 *)
1965         ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1966         LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1967         isc_netinet6in6_hack=""
1968         ;;
1969 esac
1970 changequote([, ])
1971
1972 #
1973 # This is similar to the netinet6/in6.h issue.
1974 #
1975 case "$host" in
1976 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1977         # UnixWare
1978         ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1979         LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1980         ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1981         isc_netinetin6_hack="#include <netinet/in6.h>"
1982         ;;
1983 *)
1984         ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1985         LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1986         ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1987         isc_netinetin6_hack=""
1988         ;;
1989 esac
1990
1991 #
1992 # Now delve deeper into the suitability of the IPv6 support.
1993 #
1994 case "$found_ipv6" in
1995         yes)
1996                 ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1997                 LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1998
1999                 AC_MSG_CHECKING(for in6_addr)
2000                 AC_TRY_COMPILE([
2001 #include <sys/types.h>
2002 #include <sys/socket.h>
2003 #include <netinet/in.h>
2004 $isc_netinetin6_hack
2005 $isc_netinet6in6_hack
2006 ],
2007 [struct in6_addr in6; return (0);],
2008                 [AC_MSG_RESULT(yes)
2009                  ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
2010                  LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
2011                  isc_in_addr6_hack=""],
2012                 [AC_MSG_RESULT(no)
2013                  ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
2014                  LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
2015                  isc_in_addr6_hack="#define in6_addr in_addr6"])
2016
2017                 AC_MSG_CHECKING(for in6addr_any)
2018                 AC_TRY_LINK([
2019 #include <sys/types.h>
2020 #include <sys/socket.h>
2021 #include <netinet/in.h>
2022 $isc_netinetin6_hack
2023 $isc_netinet6in6_hack
2024 $isc_in_addr6_hack
2025 ],
2026                 [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
2027                         [AC_MSG_RESULT(yes)
2028                          ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
2029                          LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
2030                         [AC_MSG_RESULT(no)
2031                          ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
2032                          LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
2033
2034                 AC_MSG_CHECKING(for in6addr_loopback)
2035                 AC_TRY_LINK([
2036 #include <sys/types.h>
2037 #include <sys/socket.h>
2038 #include <netinet/in.h>
2039 $isc_netinetin6_hack
2040 $isc_netinet6in6_hack
2041 $isc_in_addr6_hack
2042 ],
2043                 [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
2044                         [AC_MSG_RESULT(yes)
2045                          ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
2046                          LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
2047                         [AC_MSG_RESULT(no)
2048                          ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
2049                          LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
2050
2051                 AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
2052                 AC_TRY_COMPILE([
2053 #include <sys/types.h>
2054 #include <sys/socket.h>
2055 #include <netinet/in.h>
2056 $isc_netinetin6_hack
2057 $isc_netinet6in6_hack
2058 ],
2059                 [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
2060                         [AC_MSG_RESULT(yes)
2061                          ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
2062                          result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
2063                         [AC_MSG_RESULT(no)
2064                          ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
2065                          result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
2066                 LWRES_HAVE_SIN6_SCOPE_ID="$result"
2067
2068                 AC_MSG_CHECKING(for in6_pktinfo)
2069                 AC_TRY_COMPILE([
2070 #include <sys/types.h>
2071 #include <sys/socket.h>
2072 #include <netinet/in.h>
2073 $isc_netinetin6_hack
2074 $isc_netinet6in6_hack
2075 ],
2076                 [struct in6_pktinfo xyzzy; return (0);],
2077                         [AC_MSG_RESULT(yes)
2078                          ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
2079                         [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
2080                          ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
2081                 ;;
2082         no)
2083                 ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
2084                 LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
2085                 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
2086                 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
2087                 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
2088                 LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
2089                 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
2090                 ISC_IPV6_H="ipv6.h"
2091                 ISC_IPV6_O="ipv6.$O"
2092                 ISC_ISCIPV6_O="unix/ipv6.$O"
2093                 ISC_IPV6_C="ipv6.c"
2094                 ;;
2095 esac
2096
2097 AC_SUBST(ISC_PLATFORM_HAVEIPV6)
2098 AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
2099 AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
2100 AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
2101 AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
2102 AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
2103 AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
2104 AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
2105 AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
2106 AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
2107 AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
2108 AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
2109 AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
2110 AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
2111 AC_SUBST(ISC_IPV6_H)
2112 AC_SUBST(ISC_IPV6_O)
2113 AC_SUBST(ISC_ISCIPV6_O)
2114 AC_SUBST(ISC_IPV6_C)
2115 AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
2116 AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
2117
2118 AC_MSG_CHECKING([for struct if_laddrreq])
2119 AC_TRY_LINK([
2120 #include <sys/types.h>
2121 #include <net/if6.h>
2122 ],[ struct if_laddrreq a; ],
2123         [AC_MSG_RESULT(yes)
2124         ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
2125         [AC_MSG_RESULT(no)
2126         ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
2127 AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
2128
2129 AC_MSG_CHECKING([for struct if_laddrconf])
2130 AC_TRY_LINK([
2131 #include <sys/types.h>
2132 #include <net/if6.h>
2133 ],[ struct if_laddrconf a; ],
2134         [AC_MSG_RESULT(yes)
2135         ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
2136         [AC_MSG_RESULT(no)
2137         ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
2138 AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
2139
2140 #
2141 # Check for network functions that are often missing.  We do this
2142 # after the libtool checking, so we can put the right suffix on
2143 # the files.  It also needs to come after checking for a Kame add-on,
2144 # which provides some (all?) of the desired functions.
2145 #
2146
2147 AC_MSG_CHECKING([for inet_ntop with IPv6 support])
2148 AC_TRY_RUN([
2149 #include <sys/types.h>
2150 #include <sys/socket.h>
2151 #include <netinet/in.h>
2152 #include <arpa/inet.h>
2153 main() {
2154 char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
2155         [AC_MSG_RESULT(yes)
2156         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
2157
2158         [AC_MSG_RESULT(no)
2159         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
2160         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
2161         ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
2162         [AC_MSG_RESULT(assuming inet_ntop not needed)
2163         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
2164
2165
2166 # On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
2167 # addresses with less than four octets, like "1.2.3".  Also leading
2168 # zeros should also be rejected.
2169
2170 AC_MSG_CHECKING([for working inet_pton with IPv6 support])
2171 AC_TRY_RUN([
2172 #include <sys/types.h>
2173 #include <sys/socket.h>
2174 #include <netinet/in.h>
2175 #include <arpa/inet.h>
2176 main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
2177                              inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
2178                              (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
2179         [AC_MSG_RESULT(yes)
2180         ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
2181         [AC_MSG_RESULT(no)
2182         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2183         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2184         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
2185         [AC_MSG_RESULT(assuming inet_pton needed)
2186         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2187         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2188         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
2189
2190 AC_SUBST(ISC_PLATFORM_NEEDNTOP)
2191 AC_SUBST(ISC_PLATFORM_NEEDPTON)
2192
2193 #
2194 # Look for a 4.4BSD-style sa_len member in struct sockaddr.
2195 #
2196 case "$host" in
2197         *-dec-osf*)
2198                 # Turn on 4.4BSD style sa_len support.
2199                 AC_DEFINE(_SOCKADDR_LEN)
2200                 ;;
2201 esac
2202
2203 AC_MSG_CHECKING(for sa_len in struct sockaddr)
2204 AC_TRY_COMPILE([
2205 #include <sys/types.h>
2206 #include <sys/socket.h>],
2207 [struct sockaddr sa; sa.sa_len = 0; return (0);],
2208         [AC_MSG_RESULT(yes)
2209         ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
2210         LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
2211         [AC_MSG_RESULT(no)
2212         ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
2213         LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
2214 AC_SUBST(ISC_PLATFORM_HAVESALEN)
2215 AC_SUBST(LWRES_PLATFORM_HAVESALEN)
2216
2217 #
2218 # Look for a 4.4BSD or 4.3BSD struct msghdr
2219 #
2220 AC_MSG_CHECKING(for struct msghdr flavor)
2221 AC_TRY_COMPILE([
2222 #include <sys/types.h>
2223 #include <sys/socket.h>],
2224 [struct msghdr msg; msg.msg_flags = 0; return (0);],
2225         [AC_MSG_RESULT(4.4BSD)
2226         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
2227         [AC_MSG_RESULT(4.3BSD)
2228         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
2229 AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
2230
2231 #
2232 # Look for in_port_t.
2233 #
2234 AC_MSG_CHECKING(for type in_port_t)
2235 AC_TRY_COMPILE([
2236 #include <sys/types.h>
2237 #include <netinet/in.h>],
2238 [in_port_t port = 25; return (0);],
2239         [AC_MSG_RESULT(yes)
2240         ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
2241         [AC_MSG_RESULT(no)
2242         ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
2243 AC_SUBST(ISC_PLATFORM_NEEDPORTT)
2244
2245 #
2246 # Check for addrinfo
2247 #
2248 AC_MSG_CHECKING(for struct addrinfo)
2249 AC_TRY_COMPILE([
2250 #include <netdb.h>],
2251 [struct addrinfo a; return (0);],
2252         [AC_MSG_RESULT(yes)
2253         ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
2254         ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
2255         AC_DEFINE(HAVE_ADDRINFO)],
2256         [AC_MSG_RESULT(no)
2257         ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
2258         ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
2259 AC_SUBST(ISC_LWRES_NEEDADDRINFO)
2260 AC_SUBST(ISC_IRS_NEEDADDRINFO)
2261
2262 #
2263 # Check for rrsetinfo
2264 #
2265 AC_MSG_CHECKING(for struct rrsetinfo)
2266 AC_TRY_COMPILE([
2267 #include <netdb.h>],
2268 [struct rrsetinfo r; return (0);],
2269         [AC_MSG_RESULT(yes)
2270         ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
2271         [AC_MSG_RESULT(no)
2272         ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
2273 AC_SUBST(ISC_LWRES_NEEDRRSETINFO)
2274
2275 AC_MSG_CHECKING(for int sethostent)
2276 AC_TRY_COMPILE([
2277 #include <netdb.h>],
2278 [int i = sethostent(0); return(0);],
2279         [AC_MSG_RESULT(yes)
2280         ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
2281         [AC_MSG_RESULT(no)
2282         ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
2283 AC_SUBST(ISC_LWRES_SETHOSTENTINT)
2284
2285 AC_MSG_CHECKING(for int endhostent)
2286 AC_TRY_COMPILE([
2287 #include <netdb.h>],
2288 [int i = endhostent(); return(0);],
2289         [AC_MSG_RESULT(yes)
2290         ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
2291         [AC_MSG_RESULT(no)
2292         ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
2293 AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
2294
2295 AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
2296 AC_TRY_COMPILE([
2297 #include <netdb.h>
2298 struct netent *getnetbyaddr(in_addr_t, int);],
2299 [],
2300         [AC_MSG_RESULT(yes)
2301         ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
2302         [AC_MSG_RESULT(no)
2303         ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
2304 AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
2305
2306 AC_MSG_CHECKING(for int setnetent)
2307 AC_TRY_COMPILE([
2308 #include <netdb.h>],
2309 [int i = setnetent(0); return(0);],
2310         [AC_MSG_RESULT(yes)
2311         ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
2312         [AC_MSG_RESULT(no)
2313         ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
2314 AC_SUBST(ISC_LWRES_SETNETENTINT)
2315
2316 AC_MSG_CHECKING(for int endnetent)
2317 AC_TRY_COMPILE([
2318 #include <netdb.h>],
2319 [int i = endnetent(); return(0);],
2320         [AC_MSG_RESULT(yes)
2321         ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
2322         [AC_MSG_RESULT(no)
2323         ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
2324 AC_SUBST(ISC_LWRES_ENDNETENTINT)
2325
2326 AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
2327 AC_TRY_COMPILE([
2328 #include <netdb.h>
2329 struct hostent *gethostbyaddr(const void *, size_t, int);],
2330 [return(0);],
2331         [AC_MSG_RESULT(yes)
2332         ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
2333         [AC_MSG_RESULT(no)
2334         ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
2335 AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
2336
2337 AC_MSG_CHECKING(for h_errno in netdb.h)
2338 AC_TRY_COMPILE([
2339 #include <netdb.h>],
2340 [h_errno = 1; return(0);],
2341         [AC_MSG_RESULT(yes)
2342         ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
2343         [AC_MSG_RESULT(no)
2344         ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
2345 AC_SUBST(ISC_LWRES_NEEDHERRNO)
2346
2347 #
2348 # Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
2349 # known variations here:
2350 #
2351 AC_MSG_CHECKING(for getnameinfo prototype definitions)
2352 AC_TRY_COMPILE([
2353 #include <sys/types.h>
2354 #include <sys/socket.h>
2355 #include <netdb.h>
2356 int getnameinfo(const struct sockaddr *, socklen_t, char *,
2357                 socklen_t, char *, socklen_t, unsigned int);],
2358 [ return (0);],
2359         [AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
2360          AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
2361                    [Define to the buffer length type used by getnameinfo(3).])
2362          AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
2363                    [Define to the flags type used by getnameinfo(3).])],
2364 [AC_TRY_COMPILE([
2365 #include <sys/types.h>
2366 #include <sys/socket.h>
2367 #include <netdb.h>
2368 int getnameinfo(const struct sockaddr *, socklen_t, char *,
2369                 size_t, char *, size_t, int);],
2370 [ return (0);],
2371         [AC_MSG_RESULT(size_t for buflen; int for flags)
2372          AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
2373          AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
2374 [AC_MSG_RESULT(not match any subspecies; assume standard definition)
2375 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
2376 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
2377
2378 #
2379 # ...and same for gai_strerror().
2380 #
2381 AC_MSG_CHECKING(for gai_strerror prototype definitions)
2382 AC_TRY_COMPILE([
2383 #include <sys/types.h>
2384 #include <sys/socket.h>
2385 #include <netdb.h>
2386 char *gai_strerror(int ecode);],
2387 [ return (0); ],
2388         [AC_MSG_RESULT(returning char *)
2389          AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
2390          [return type of gai_strerror])],
2391 [AC_MSG_RESULT(not match any subspecies; assume standard definition)
2392 AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
2393
2394 AC_CHECK_FUNC(getipnodebyname,
2395         [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
2396         [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
2397 AC_CHECK_FUNC(getnameinfo,
2398         [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
2399         [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
2400 AC_CHECK_FUNC(getaddrinfo,
2401         [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
2402         AC_DEFINE(HAVE_GETADDRINFO)],
2403         [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
2404 AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
2405 AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
2406 AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
2407 AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
2408 AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
2409
2410 AC_ARG_ENABLE(getifaddrs,
2411 [  --enable-getifaddrs     Enable the use of getifaddrs() [[yes|no]].],
2412     want_getifaddrs="$enableval",  want_getifaddrs="yes")
2413
2414 #
2415 # This interface iteration code for getifaddrs() will fall back to using
2416 # /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
2417 # addresses.
2418 #
2419 case $want_getifaddrs in
2420 glibc)
2421 AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
2422 AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2423 ;;
2424 yes)
2425 AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
2426 ;;
2427 no)
2428 ;;
2429 esac
2430
2431 #
2432 # Look for a sysctl call to get the list of network interfaces.
2433 #
2434 case $ac_cv_header_sys_sysctl_h in
2435 yes)
2436 AC_MSG_CHECKING(for interface list sysctl)
2437 AC_EGREP_CPP(found_rt_iflist, [
2438 #include <sys/param.h>
2439 #include <sys/sysctl.h>
2440 #include <sys/socket.h>
2441 #ifdef NET_RT_IFLIST
2442 found_rt_iflist
2443 #endif
2444 ],
2445         [AC_MSG_RESULT(yes)
2446          AC_DEFINE(HAVE_IFLIST_SYSCTL)],
2447         [AC_MSG_RESULT(no)])
2448 ;;
2449 esac
2450
2451 #
2452 # Check for some other useful functions that are not ever-present.
2453 #
2454
2455 # We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
2456 # because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
2457 # reportedly defines strsep() without declaring it in <string.h> when
2458 # -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
2459 # AC_CHECK_FUNC() incorrectly succeeds because it declares
2460 # the function itself.
2461 AC_MSG_CHECKING(for correctly declared strsep())
2462 AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
2463         [AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
2464         [AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
2465 AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
2466
2467 AC_CHECK_FUNC(memmove,
2468         [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
2469         [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
2470 AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
2471
2472 AC_CHECK_FUNC(strtoul,
2473         [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
2474          LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
2475          GENRANDOMLIB=""],
2476         [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
2477          LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
2478          GENRANDOMLIB='${ISCLIBS}'])
2479 AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
2480 AC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
2481 AC_SUBST(GENRANDOMLIB)
2482
2483 AC_CHECK_FUNC(strlcpy,
2484         [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"
2485          LWRES_PLATFORM_NEEDSTRLCPY="#undef LWRES_PLATFORM_NEEDSTRLCPY"],
2486         [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"
2487          LWRES_PLATFORM_NEEDSTRLCPY="#define LWRES_PLATFORM_NEEDSTRLCPY 1"])
2488 AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
2489 AC_SUBST(LWRES_PLATFORM_NEEDSTRLCPY)
2490
2491 AC_CHECK_FUNC(strlcat,
2492         [ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
2493         [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
2494 AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
2495
2496 AC_CHECK_FUNC(strcasestr,
2497         [ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR"],
2498         [ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1"])
2499 AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR)
2500
2501 AC_SUBST(READLINE_LIB)
2502 AC_ARG_WITH(readline,
2503         [  --with-readline[=LIBSPEC]    specify readline library [default -lreadline]],
2504         readline="$withval", readline="-lreadline")
2505 case "$readline" in
2506 no)     ;;
2507 *)
2508         if test "x$readline" = "xyes"
2509         then
2510                 readline=-lreadline
2511         fi
2512         saved_LIBS="$LIBS"
2513         LIBS="$readline"
2514         AC_CHECK_FUNCS(readline)
2515         if test "$ac_cv_func_readline" = "yes"
2516         then
2517                 READLINE_LIB="$readline"
2518         fi
2519         LIBS="$saved_LIBS"
2520         ;;
2521 esac
2522
2523 ISC_PRINT_OBJS=
2524 ISC_PRINT_SRCS=
2525 AC_MSG_CHECKING(sprintf)
2526 AC_TRY_COMPILE([
2527 #include <stdio.h>
2528 ],
2529 [ char buf[2]; return(*sprintf(buf,"x"));],
2530 [
2531 ISC_PRINT_OBJS="print.$O"
2532 ISC_PRINT_SRCS="print.c"
2533 ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
2534 LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
2535 ],
2536 [ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
2537  LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
2538 )
2539 AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
2540 AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
2541
2542 AC_CHECK_FUNC(vsnprintf,
2543         [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
2544          LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
2545         [ISC_PRINT_OBJS="print.$O"
2546          ISC_PRINT_SRCS="print.c"
2547          ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
2548          LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
2549 AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
2550 AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
2551 ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
2552 ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
2553
2554 AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
2555
2556 AC_SUBST(ISC_EXTRA_OBJS)
2557 AC_SUBST(ISC_EXTRA_SRCS)
2558
2559 #
2560 # Use our own SPNEGO implementation?
2561 #
2562 AC_ARG_ENABLE(isc-spnego,
2563         [  --disable-isc-spnego    use SPNEGO from GSSAPI library])
2564
2565 if test -n "$USE_GSSAPI"
2566 then
2567         case "$enable_isc_spnego" in
2568                 yes|'')
2569                         USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
2570                         DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
2571                         DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
2572                         AC_MSG_RESULT(using SPNEGO from lib/dns)
2573                         ;;
2574                 no)
2575                         AC_MSG_RESULT(using SPNEGO from GSSAPI library)
2576                         ;;
2577         esac
2578 fi
2579
2580 AC_SUBST(USE_ISC_SPNEGO)
2581
2582 AC_SUBST(DST_EXTRA_OBJS)
2583 AC_SUBST(DST_EXTRA_SRCS)
2584
2585 # Determine the printf format characters to use when printing
2586 # values of type isc_int64_t. This will normally be "ll", but where
2587 # the compiler treats "long long" as a alias for "long" and printf
2588 # doesn't know about "long long" use "l".  Hopefully the sprintf
2589 # will produce a inconsistent result in the later case.  If the compiler
2590 # fails due to seeing "%lld" we fall back to "l".
2591 #
2592 # Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
2593 # %ld even for (long long)/
2594 #
2595 # Win32 uses "%I64d", but that's defined elsewhere since we don't use
2596 # configure on Win32.
2597 #
2598 AC_MSG_CHECKING(printf format modifier for 64-bit integers)
2599 AC_TRY_RUN([
2600 #include <stdio.h>
2601 main() {
2602         long long int j = 0;
2603         char buf[100];
2604         buf[0] = 0;
2605         sprintf(buf, "%lld", j);
2606         exit((sizeof(long long int) != sizeof(long int))? 0 :
2607              (strcmp(buf, "0") != 0));
2608 }
2609 ],
2610         [AC_MSG_RESULT(ll)
2611         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2612         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
2613         [AC_MSG_RESULT(l)
2614         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
2615         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
2616         [AC_MSG_RESULT(assuming target platform uses ll)
2617         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
2618         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
2619 AC_SUBST(ISC_PLATFORM_QUADFORMAT)
2620 AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
2621
2622 #
2623 # Security Stuff
2624 #
2625 # Note it is very recommended to *not* disable chroot(),
2626 # this is only because chroot() was made obsolete by Posix.
2627 AC_ARG_ENABLE(chroot,
2628         [  --disable-chroot        disable chroot])
2629 case "$enable_chroot" in
2630         yes|'')
2631                 AC_CHECK_FUNCS(chroot)
2632                 ;;
2633         no)
2634                 ;;
2635 esac
2636 AC_ARG_ENABLE(linux-caps,
2637         [  --disable-linux-caps   disable linux capabilities])
2638 case "$enable_linux_caps" in
2639         yes|'')
2640                 AC_CHECK_HEADERS(linux/types.h)
2641                 AC_CHECK_HEADERS([sys/capability.h])
2642                 AC_CHECK_HEADERS([linux/capability.h], [], [],
2643                                  [#ifdef HAVE_LINUX_TYPES_H
2644                                   #include <linux/types.h>
2645                                   #endif
2646                                  ])
2647                 AC_CHECK_LIB(cap, cap_set_proc)
2648                 ;;
2649         no)
2650                 ;;
2651 esac
2652 AC_CHECK_HEADERS(sys/prctl.h)
2653
2654 AC_CHECK_HEADERS(sys/un.h,
2655 ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
2656 ,
2657 ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
2658 )
2659 AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
2660
2661 case "$host" in
2662 *-solaris*)
2663         AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2664                   [Define if connect does not honour the permission on the UNIX domain socket.])
2665         ;;
2666 *-sunos*)
2667         AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
2668                   [Define if connect does not honour the permission on the UNIX domain socket.])
2669         ;;
2670 esac
2671
2672 #
2673 # Time Zone Stuff
2674 #
2675 AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
2676
2677 AC_MSG_CHECKING(for optarg declaration)
2678 AC_TRY_COMPILE([
2679 #include <unistd.h>
2680 ],
2681 [optarg = 0;],
2682 [AC_MSG_RESULT(yes)],
2683 [AC_MSG_RESULT(no)
2684 GEN_NEED_OPTARG="-DNEED_OPTARG=1"
2685 AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
2686
2687 #
2688 # BSD/OS, and perhaps some others, don't define rlim_t.
2689 #
2690 AC_MSG_CHECKING(for type rlim_t)
2691 AC_TRY_COMPILE([
2692 #include <sys/types.h>
2693 #include <sys/time.h>
2694 #include <sys/resource.h>],
2695 [rlim_t rl = 19671212; return (0);],
2696 [AC_MSG_RESULT(yes)
2697  ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
2698 [AC_MSG_RESULT(no)
2699
2700 AC_MSG_CHECKING(type of rlim_cur)
2701 AC_TRY_RUN([
2702 #include <sys/types.h>
2703 #include <sys/time.h>
2704 #include <sys/resource.h>
2705 main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
2706 [AC_MSG_RESULT(int)
2707 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
2708 [
2709 AC_TRY_RUN([
2710 #include <sys/types.h>
2711 #include <sys/time.h>
2712 #include <sys/resource.h>
2713 main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
2714 [AC_MSG_RESULT(long int)
2715 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
2716 [
2717 AC_TRY_RUN([
2718 #include <sys/types.h>
2719 #include <sys/time.h>
2720 #include <sys/resource.h>
2721 main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
2722 [AC_MSG_RESULT(long long int)
2723 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
2724 [AC_MSG_ERROR([unable to determine sizeof rlim_cur])
2725 ],[AC_MSG_ERROR(this cannot happen)])
2726 ],[AC_MSG_ERROR(this cannot happen)])
2727 ],[
2728 AC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
2729 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
2730 AC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
2731 ])
2732 AC_SUBST(ISC_PLATFORM_RLIMITTYPE)
2733
2734 #
2735 # Older HP-UX doesn't have gettune
2736 #
2737 case "$host" in
2738         *-hp-hpux*)
2739                 AC_CHECK_HEADERS(sys/dyntune.h)
2740                 ;;
2741         *)
2742                 ;;
2743 esac
2744
2745
2746 #
2747 # Compaq TruCluster requires more code for handling cluster IP aliases
2748 #
2749 case "$host" in
2750         *-dec-osf*)
2751                 AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
2752                 AC_CHECK_FUNC(clua_getaliasaddress,
2753                                 AC_DEFINE(HAVE_TRUCLUSTER, 1,
2754                                         [Define if running under Compaq TruCluster]))
2755                 ;;
2756         *)
2757                 ;;
2758 esac
2759
2760 #
2761 # Some hosts need msg_namelen to match the size of the socket structure.
2762 # Some hosts don't set msg_namelen appropriately on return from recvmsg().
2763 #
2764 case $host in
2765 *os2*|*hp-mpeix*)
2766         AC_DEFINE(BROKEN_RECVMSG, 1,
2767                   [Define if recvmsg() does not meet all of the BSD socket API specifications.])
2768         ;;
2769 esac
2770
2771 #
2772 # Microsoft has their own way of handling shared libraries that requires
2773 # additional qualifiers on extern variables.  Unix systems don't need it.
2774 #
2775 AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
2776 ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
2777 AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
2778 LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
2779 AC_SUBST(IRS_PLATFORM_USEDECLSPEC)
2780 IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
2781
2782 #
2783 # Random remaining OS-specific issues involving compiler warnings.
2784 # XXXDCL print messages to indicate some compensation is being done?
2785 #
2786 AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
2787 ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
2788
2789 case "$host" in
2790         *-aix5.[[123]].*)
2791                 hack_shutup_pthreadonceinit=yes
2792                 ;;
2793         *-bsdi3.1*)
2794                 hack_shutup_sputaux=yes
2795                 ;;
2796         *-bsdi4.0*)
2797                 hack_shutup_sigwait=yes
2798                 hack_shutup_sputaux=yes
2799                 ;;
2800         [*-bsdi4.[12]*])
2801                 hack_shutup_stdargcast=yes
2802                 ;;
2803         [*-solaris2.[89]])
2804                 hack_shutup_pthreadonceinit=yes
2805                 ;;
2806         *-solaris2.1[[0-9]])
2807                 AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
2808                 ;;
2809 esac
2810
2811 case "$hack_shutup_pthreadonceinit" in
2812         yes)
2813                 #
2814                 # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
2815                 #
2816                 ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
2817                 ;;
2818 esac
2819
2820 case "$hack_shutup_sigwait" in
2821         yes)
2822                 #
2823                 # Shut up a -Wmissing-prototypes warning for sigwait().
2824                 #
2825                 AC_DEFINE(SHUTUP_SIGWAIT)
2826                 ;;
2827 esac
2828
2829 case "$hack_shutup_sputaux" in
2830         yes)
2831                 #
2832                 # Shut up a -Wmissing-prototypes warning from <stdio.h>.
2833                 #
2834                 AC_DEFINE(SHUTUP_SPUTAUX)
2835                 ;;
2836 esac
2837
2838 case "$hack_shutup_stdargcast" in
2839         yes)
2840                 #
2841                 # Shut up a -Wcast-qual warning from va_start().
2842                 #
2843                 AC_DEFINE(SHUTUP_STDARG_CAST)
2844                 ;;
2845 esac
2846
2847 AC_CHECK_HEADERS(strings.h,
2848   ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
2849 ,
2850   ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
2851 )
2852 AC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
2853
2854 #
2855 # Check for if_nametoindex() for IPv6 scoped addresses support
2856 #
2857 AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
2858                 ac_cv_have_if_nametoindex=no)
2859 case $ac_cv_have_if_nametoindex in
2860 no)
2861         case "$host" in
2862         *-hp-hpux*)
2863                 AC_CHECK_LIB(ipv6, if_nametoindex,
2864                                 ac_cv_have_if_nametoindex=yes
2865                                 LIBS="-lipv6 $LIBS",)
2866         ;;
2867         esac
2868 esac
2869 case $ac_cv_have_if_nametoindex in
2870 yes)
2871         ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
2872         AC_DEFINE(HAVE_IF_NAMETOINDEX, 1)
2873         ;;
2874 *)
2875         ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
2876         ;;
2877 esac
2878 AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
2879
2880 AC_CHECK_FUNCS(nanosleep usleep)
2881
2882 #
2883 # Machine architecture dependent features
2884 #
2885 AC_ARG_ENABLE(atomic,
2886         [  --enable-atomic        enable machine specific atomic operations
2887                           [[default=autodetect]]],
2888                         enable_atomic="$enableval",
2889                         enable_atomic="autodetect")
2890 case "$enable_atomic" in
2891         yes|''|autodetect)
2892                 case "$host" in
2893                 powerpc-ibm-aix*)
2894                         if test "X$GCC" = "Xyes"; then
2895                                 AC_MSG_CHECKING([if asm("isc"); works])
2896                                 AC_TRY_COMPILE(,[
2897                                 main() { asm("ics"); exit(0); }
2898                                 ],
2899                                 [AC_MSG_RESULT(yes)
2900                                  use_atomic=yes],
2901                                 [
2902                                 saved_cflags="$CFLAGS"
2903                                 CFLAGS="$CFLAGS -Wa,-many"
2904                                 AC_TRY_RUN([
2905                                 main() { asm("ics"); exit(0); }
2906                                 ],
2907                                 [AC_MSG_RESULT([yes, required -Wa,-many])
2908                                  use_atomic=yes],
2909                                 [AC_MSG_RESULT([no, use_atomic disabled])
2910                                  CFLAGS="$saved_cflags"
2911                                  use_atomic=no],
2912                                 [AC_MSG_RESULT([cross compile, assume yes])
2913                                  CFLAGS="$saved_cflags"
2914                                  use_atomic=yes])
2915                                 ]
2916                                 )
2917                         else
2918                                 use_atomic=yes
2919                         fi
2920                         ;;
2921                 *)
2922                         use_atomic=yes
2923                         ;;
2924                 esac
2925                 ;;
2926         no)
2927                 use_atomic=no
2928                 arch=noatomic
2929                 ;;
2930 esac
2931
2932 ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
2933 if test "$use_atomic" = "yes"; then
2934         AC_MSG_CHECKING([architecture type for atomic operations])
2935         have_atomic=yes         # set default
2936         case "$host" in
2937         [i[3456]86-*])
2938                 # XXX: some old x86 architectures actually do not support
2939                 #      (some of) these operations.  Do we need stricter checks?
2940                 AC_CHECK_SIZEOF([void *])
2941                 if test $ac_cv_sizeof_void_p = 8; then
2942                         arch=x86_64
2943                         have_xaddq=yes
2944                 else
2945                         arch=x86_32
2946                 fi
2947         ;;
2948         x86_64-*|amd64-*)
2949                 AC_CHECK_SIZEOF([void *])
2950                 if test $ac_cv_sizeof_void_p = 8; then
2951                         arch=x86_64
2952                         have_xaddq=yes
2953                 else
2954                         arch=x86_32
2955                 fi
2956         ;;
2957         alpha*-*)
2958                 arch=alpha
2959         ;;
2960         powerpc-*|powerpc64-*)
2961                 arch=powerpc
2962         ;;
2963         mips-*|mipsel-*|mips64-*|mips64el-*)
2964                 arch=mips
2965         ;;
2966         ia64-*)
2967                 arch=ia64
2968         ;;
2969         *)
2970                 have_atomic=no
2971                 arch=noatomic
2972         ;;
2973         esac
2974         AC_MSG_RESULT($arch)
2975 fi
2976
2977 if test "$have_atomic" = "yes"; then
2978         AC_MSG_CHECKING([compiler support for inline assembly code])
2979
2980         compiler=generic
2981         # Check whether the compiler supports the assembly syntax we provide.
2982         if test "X$GCC" = "Xyes"; then
2983                 # GCC's ASM extension always works
2984                 compiler=gcc
2985                 if test $arch = "x86_64"; then
2986                         # We can share the same code for gcc with x86_32
2987                         arch=x86_32
2988                 fi
2989                 if test $arch = "powerpc"; then
2990                         #
2991                         # The MacOS (and maybe others) uses "r0" for register
2992                         # zero. Under linux/ibm it is "0" for register 0.
2993                         # Probe to see if we have a MacOS style assembler.
2994                         #
2995                         AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
2996                         AC_TRY_COMPILE(, [
2997                         __asm__ volatile ("li r0, 0x0\n"::);
2998                         ], [
2999                         AC_MSG_RESULT(yes)
3000                         compiler="mac"
3001                         ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
3002                         ], [AC_MSG_RESULT(no)])
3003                 fi
3004         else
3005                 case "$host" in
3006                 alpha*-dec-osf*)
3007                         # Tru64 compiler has its own syntax for inline
3008                         # assembly.
3009                         AC_TRY_COMPILE(, [
3010 #ifndef __DECC
3011 #error "unexpected compiler"
3012 #endif
3013                                 return (0);],
3014                                 [compiler=osf],)
3015                 ;;
3016                 powerpc-ibm-aix*)
3017                         compiler=aix
3018                 ;;
3019                 esac
3020         fi
3021         case "$compiler" in
3022         gcc)
3023                 ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
3024                 ;;
3025         osf)
3026                 ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
3027                 ;;
3028         aix)
3029                 ;;
3030         mac)
3031                 ;;
3032         *)
3033                 # See if the generic __asm function works.  If not,
3034                 # we need to disable the atomic operations.
3035                 AC_TRY_LINK(, [
3036                                         __asm("nop")
3037                                 ],
3038                 [compiler="standard"
3039                 ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
3040                 [compiler="not supported (atomic operations disabled)"
3041                 have_atomic=no
3042                 arch=noatomic ]);
3043                 ;;
3044         esac
3045
3046         AC_MSG_RESULT($compiler)
3047 fi
3048
3049 if test "$have_atomic" = "yes"; then
3050         ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
3051         ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
3052         ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
3053 else
3054         ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
3055         ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
3056         ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
3057 fi
3058
3059 if test "$have_xaddq" = "yes"; then
3060         ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
3061 else
3062         ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
3063 fi
3064
3065 AC_SUBST(ISC_PLATFORM_HAVEXADD)
3066 AC_SUBST(ISC_PLATFORM_HAVEXADDQ)
3067 AC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
3068 AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
3069
3070 AC_SUBST(ISC_PLATFORM_USEGCCASM)
3071 AC_SUBST(ISC_PLATFORM_USEOSFASM)
3072 AC_SUBST(ISC_PLATFORM_USESTDASM)
3073 AC_SUBST(ISC_PLATFORM_USEMACASM)
3074
3075 ISC_ARCH_DIR=$arch
3076 AC_SUBST(ISC_ARCH_DIR)
3077
3078 #
3079 # Activate "rrset-order fixed" or not?
3080 #
3081 AC_ARG_ENABLE(fixed-rrset,
3082         [  --enable-fixed-rrset    enable fixed rrset ordering
3083                           [[default=no]]],
3084                         enable_fixed="$enableval",
3085                         enable_fixed="no")
3086 case "$enable_fixed" in
3087         yes)
3088                 AC_DEFINE(DNS_RDATASET_FIXED, 1,
3089                           [Define to enable "rrset-order fixed" syntax.])
3090                 ;;
3091         no)
3092                 ;;
3093         *)
3094                 ;;
3095 esac
3096
3097 #
3098 # Enable response policy rewriting using NS IP addresses
3099 #
3100 AC_ARG_ENABLE(rpz-nsip,
3101         [  --disable-rpz-nsip     disable rpz-nsip rules [[default=enabled]]],
3102                         enable_nsip="$enableval",
3103                         enable_nsip="yes")
3104 case "$enable_nsip" in
3105         yes)
3106                 AC_DEFINE(ENABLE_RPZ_NSIP, 1,
3107                           [Define to enable rpz-nsip rules.])
3108                 ;;
3109         no)
3110                 ;;
3111         *)
3112                 ;;
3113 esac
3114
3115 #
3116 # Enable response policy rewriting using NS name
3117 #
3118 AC_ARG_ENABLE(rpz-nsdname,
3119         [  --disable-rpz-nsdname          disable rpz-nsdname rules [[default=enabled]]],
3120                         enable_nsdname="$enableval",
3121                         enable_nsdname="yes")
3122 case "$enable_nsdname" in
3123         yes)
3124                 AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
3125                           [Define to enable rpz-nsdname rules.])
3126                 ;;
3127         no)
3128                 ;;
3129         *)
3130                 ;;
3131 esac
3132
3133 #
3134 # Activate "filter-aaaa-on-v4" or not?
3135 #
3136 AC_ARG_ENABLE(filter-aaaa,
3137         [  --enable-filter-aaaa    enable filtering of AAAA records over IPv4
3138                           [[default=no]]],
3139                         enable_filter="$enableval",
3140                         enable_filter="no")
3141 case "$enable_filter" in
3142         yes)
3143                 AC_DEFINE(ALLOW_FILTER_AAAA_ON_V4, 1,
3144                           [Define to enable the "filter-aaaa-on-v4" option.])
3145                 ;;
3146         no)
3147                 ;;
3148         *)
3149                 ;;
3150 esac
3151
3152 #
3153 #  The following sets up how non-blocking i/o is established.
3154 #  Sunos, cygwin and solaris 2.x (x<5) require special handling.
3155 #
3156 case "$host" in
3157 *-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3158 *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3159 *-solaris2.[[01234]])
3160         AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
3161         AC_DEFINE(USE_FIONBIO_IOCTL, 1,
3162                   [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
3163         ;;
3164 *) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
3165              [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
3166         ;;
3167 esac
3168 #
3169 # Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
3170 # This prevents the source address being set.
3171 #
3172 case "$host" in
3173 *-solaris2.[[012345]]|*-solaris2.5.1)
3174         AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
3175                   [Define if you cannot bind() before connect() for TCP sockets.])
3176         ;;
3177 esac
3178 #
3179 # The following sections deal with tools used for formatting
3180 # the documentation.  They are all optional, unless you are
3181 # a developer editing the documentation source.
3182 #
3183
3184 #
3185 # Look for TeX.
3186 #
3187
3188 AC_PATH_PROGS(LATEX, latex, latex)
3189 AC_SUBST(LATEX)
3190
3191 AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
3192 AC_SUBST(PDFLATEX)
3193
3194 #
3195 # Look for w3m
3196 #
3197
3198 AC_PATH_PROGS(W3M, w3m, w3m)
3199 AC_SUBST(W3M)
3200
3201 #
3202 # Look for xsltproc (libxslt)
3203 #
3204
3205 AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
3206 AC_SUBST(XSLTPROC)
3207
3208 #
3209 # Look for xmllint (libxml2)
3210 #
3211
3212 AC_PATH_PROG(XMLLINT, xmllint, xmllint)
3213 AC_SUBST(XMLLINT)
3214
3215 #
3216 # Look for Doxygen
3217 #
3218
3219 AC_PATH_PROG(DOXYGEN, doxygen, doxygen)
3220 AC_SUBST(DOXYGEN)
3221
3222 #
3223 # Subroutine for searching for an ordinary file (e.g., a stylesheet)
3224 # in a number of directories:
3225 #
3226 #   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
3227 #
3228 # If the file FILENAME is found in one of the DIRECTORIES, the shell
3229 # variable VARIABLE is defined to its absolute pathname.  Otherwise,
3230 # it is set to FILENAME, with no directory prefix (that's not terribly
3231 # useful, but looks less confusing in substitutions than leaving it
3232 # empty).  The variable VARIABLE will be substituted into output files.
3233 #
3234
3235 AC_DEFUN(NOM_PATH_FILE, [
3236 $1=""
3237 AC_MSG_CHECKING(for $2)
3238 for d in $3
3239 do
3240         f=$d/$2
3241         if test -f $f
3242         then
3243                 $1=$f
3244                 AC_MSG_RESULT($f)
3245                 break
3246         fi
3247 done
3248 if test "X[$]$1" = "X"
3249 then
3250         AC_MSG_RESULT("not found");
3251         $1=$2
3252 fi
3253 AC_SUBST($1)
3254 ])
3255
3256 #
3257 # Look for Docbook-XSL stylesheets.  Location probably varies by system.
3258 # If it's not explicitly specified, guess where it might be found, based on
3259 # where SGML stuff lives on some systems (FreeBSD is the only one we're sure
3260 # of at the moment).
3261 #
3262 AC_MSG_CHECKING(for Docbook-XSL path)
3263 AC_ARG_WITH(docbook-xsl,
3264 [  --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
3265    docbook_path="$withval", docbook_path="auto")
3266 case "$docbook_path" in
3267 auto)
3268         AC_MSG_RESULT(auto)
3269         docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook /opt/local/share/xsl/docbook-xsl"
3270         ;;
3271 *)
3272         docbook_xsl_trees="$withval"
3273         AC_MSG_RESULT($docbook_xsl_trees)
3274         ;;
3275 esac
3276
3277 #
3278 # Look for stylesheets we need.
3279 #
3280
3281 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
3282 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
3283 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
3284 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
3285 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
3286 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
3287 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
3288 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
3289 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
3290
3291 #
3292 # Same dance for db2latex
3293 #
3294 # No idea where this lives except on FreeBSD.
3295 #
3296
3297 db2latex_xsl_trees="/usr/local/share"
3298
3299 #
3300 # Look for stylesheets we need.
3301 #
3302
3303 NOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
3304
3305 #
3306 # Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
3307 # because it's a directory, so just do the same things, inline.
3308 #
3309
3310 AC_MSG_CHECKING(for db2latex/xsl/figures)
3311 for d in $db2latex_xsl_trees
3312 do
3313         dd=$d/db2latex/xsl/figures
3314         if test -d $dd
3315         then
3316                 XSLT_DB2LATEX_ADMONITIONS=$dd
3317                 AC_MSG_RESULT($dd)
3318                 break
3319         fi
3320 done
3321 if test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
3322 then
3323         AC_MSG_RESULT(not found)
3324         XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
3325 fi
3326 AC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
3327
3328 #
3329 # IDN support
3330 #
3331 AC_ARG_WITH(idn,
3332         [  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
3333         use_idn="$withval", use_idn="no")
3334 case "$use_idn" in
3335 yes)
3336         if test X$prefix = XNONE ; then
3337                 idn_path=/usr/local
3338         else
3339                 idn_path=$prefix
3340         fi
3341         ;;
3342 no)
3343         ;;
3344 *)
3345         idn_path="$use_idn"
3346         ;;
3347 esac
3348
3349 iconvinc=
3350 iconvlib=
3351 AC_ARG_WITH(libiconv,
3352         [  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
3353         use_libiconv="$withval", use_libiconv="no")
3354 case "$use_libiconv" in
3355 yes)
3356         if test X$prefix = XNONE ; then
3357                 iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
3358         else
3359                 iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
3360         fi
3361         ;;
3362 no)
3363         iconvlib=
3364         ;;
3365 *)
3366         iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
3367         ;;
3368 esac
3369
3370 AC_ARG_WITH(iconv,
3371         [  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
3372         iconvlib="$withval")
3373 case "$iconvlib" in
3374 no)
3375         iconvlib=
3376         ;;
3377 yes)
3378         iconvlib=-liconv
3379         ;;
3380 esac
3381
3382 AC_ARG_WITH(idnlib,
3383         [  --with-idnlib=ARG       specify libidnkit],
3384         idnlib="$withval", idnlib="no")
3385 if test "$idnlib" = yes; then
3386         AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
3387 fi
3388
3389 IDNLIBS=
3390 if test "$use_idn" != no; then
3391         AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
3392         STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
3393         if test "$idnlib" != no; then
3394                 IDNLIBS="$idnlib $iconvlib"
3395         else
3396                 IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
3397         fi
3398 fi
3399 AC_SUBST(IDNLIBS)
3400
3401 #
3402 # Check whether to build Automated Test Framework unit tests
3403 #
3404 AC_ARG_WITH(atf,
3405         [  --with-atf=ARG          Automated Test Framework support],
3406         atf="$withval", atf="no")
3407 if test "$atf" = yes; then
3408         atf=`pwd`/unit/atf
3409         ATFBUILD=atf-src
3410         AC_SUBST(ATFBUILD)
3411         AC_CONFIG_COMMANDS([atf-config],
3412                 [(
3413                  mkdir -p unit/atf-src;
3414                  cd unit/atf-src;
3415                  case "$srcdir" in
3416                  /*) ;;
3417                  *) srcdir="../../$srcdir";;
3418                  esac
3419                  ${SHELL} "${srcdir}${srcdir:+/unit/atf-src/}./configure" --enable-tools --disable-shared MISSING=: --prefix $atfdir;
3420                 ) ],
3421                 [atfdir=`pwd`/unit/atf])
3422         AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
3423 fi
3424
3425 ATFLIBS=
3426 if test "$atf" != no; then
3427         AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
3428         STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
3429         ATFBIN="$atf/bin"
3430         ATFLIBS="-L$atf/lib -latf-c"
3431         if test "$want_openssl_hash" = yes; then
3432                 ATFLIBS="-L$atf/lib -latf-c $DNS_CRYPTO_LIBS"
3433         fi
3434         UNITTESTS=tests
3435 fi
3436 AC_SUBST(ATFBIN)
3437 AC_SUBST(ATFLIBS)
3438 AC_SUBST(UNITTESTS)
3439
3440 AC_CHECK_HEADERS(locale.h)
3441 AC_CHECK_FUNCS(setlocale)
3442
3443 #
3444 # Substitutions
3445 #
3446 AC_SUBST(BIND9_TOP_BUILDDIR)
3447 BIND9_TOP_BUILDDIR=`pwd`
3448
3449 AC_SUBST(BIND9_ISC_BUILDINCLUDE)
3450 AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
3451 AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
3452 AC_SUBST(BIND9_DNS_BUILDINCLUDE)
3453 AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
3454 AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
3455 if test "X$srcdir" != "X"; then
3456         BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
3457         BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
3458         BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
3459         BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
3460         BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
3461         BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
3462 else
3463         BIND9_ISC_BUILDINCLUDE=""
3464         BIND9_ISCCC_BUILDINCLUDE=""
3465         BIND9_ISCCFG_BUILDINCLUDE=""
3466         BIND9_DNS_BUILDINCLUDE=""
3467         BIND9_LWRES_BUILDINCLUDE=""
3468         BIND9_BIND9_BUILDINCLUDE=""
3469 fi
3470
3471 AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
3472 BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
3473
3474 AC_SUBST_FILE(BIND9_MAKE_RULES)
3475 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
3476
3477 . "$srcdir/version"
3478 BIND9_PRODUCT="PRODUCT=\"${PRODUCT}\""
3479 AC_SUBST(BIND9_PRODUCT)
3480 BIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\""
3481 AC_SUBST(BIND9_DESCRIPTION)
3482 BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
3483 AC_SUBST(BIND9_VERSION)
3484
3485 BIND9_SRCID="SRCID=unset"
3486 if test -f "${srcdir}/srcid"; then
3487         . "${srcdir}/srcid"
3488         BIND9_SRCID="SRCID=$SRCID"
3489 elif test -d "${srcdir}/.git"; then
3490         BIND9_SRCID="SRCID="`(cd "${srcdir}";git rev-parse --short HEAD)`
3491 fi
3492
3493 AC_SUBST(BIND9_SRCID)
3494
3495 if test -z "$ac_configure_args"; then
3496         BIND9_CONFIGARGS="defaults"
3497 else
3498         for a in $ac_configure_args
3499         do
3500                 BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
3501         done
3502 fi
3503 BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
3504 BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
3505 AC_SUBST(BIND9_CONFIGARGS)
3506
3507 AC_SUBST_FILE(LIBISC_API)
3508 LIBISC_API="$srcdir/lib/isc/api"
3509
3510 AC_SUBST_FILE(LIBISCCC_API)
3511 LIBISCCC_API="$srcdir/lib/isccc/api"
3512
3513 AC_SUBST_FILE(LIBISCCFG_API)
3514 LIBISCCFG_API="$srcdir/lib/isccfg/api"
3515
3516 AC_SUBST_FILE(LIBDNS_API)
3517 LIBDNS_API="$srcdir/lib/dns/api"
3518
3519 AC_SUBST_FILE(LIBBIND9_API)
3520 LIBBIND9_API="$srcdir/lib/bind9/api"
3521
3522 AC_SUBST_FILE(LIBLWRES_API)
3523 LIBLWRES_API="$srcdir/lib/lwres/api"
3524
3525 AC_SUBST_FILE(LIBIRS_API)
3526 LIBIRS_API="$srcdir/lib/irs/api"
3527
3528 #
3529 # Configure any DLZ drivers.
3530 #
3531 # If config.dlz.in selects one or more DLZ drivers, it will set
3532 # CONTRIB_DLZ to a non-empty value, which will be our clue to
3533 # build DLZ drivers in contrib.
3534 #
3535 # This section has to come after the libtool stuff because it needs to
3536 # know how to name the driver object files.
3537 #
3538
3539 CONTRIB_DLZ=""
3540 DLZ_DRIVER_INCLUDES=""
3541 DLZ_DRIVER_LIBS=""
3542 DLZ_DRIVER_SRCS=""
3543 DLZ_DRIVER_OBJS=""
3544 DLZ_SYSTEM_TEST=""
3545
3546 #
3547 # Configure support for building a shared library object
3548 #
3549 # Even when libtool is available it can't always be relied upon
3550 # to build an object that can be dlopen()'ed, but this is necessary
3551 # for building the dlzexternal system test, so we'll try it the
3552 # old-fashioned way.
3553 #
3554 SO="so"
3555 SO_CFLAGS=""
3556 SO_LDFLAGS=""
3557 SO_LD=""
3558 SO_TARGETS=""
3559
3560 AC_ARG_WITH(dlopen,
3561         [  --with-dlopen=ARG       Support dynamically loadable DLZ drivers],
3562         dlopen="$withval", dlopen="yes")
3563
3564 case $host in
3565         *-sunos*) dlopen="no"
3566                 ;;
3567 esac
3568
3569 if test "$dlopen" = "yes"; then
3570         AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
3571         if test "$have_dl" = "yes"; then
3572                 LIBS="-ldl $LIBS"
3573         fi
3574         AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
3575 fi
3576
3577 if test "$dlopen" = "yes"; then
3578         case $host in
3579                 *-linux*|*-gnu*)
3580                         SO_CFLAGS="-fPIC"
3581                         SO_LDFLAGS=""
3582                         if test "$have_dl" = "yes"
3583                         then
3584                                 if test "$use_libtool" = "yes"; then
3585                                         SO_LDFLAGS="-Xcompiler -shared"
3586                                         SO_LD="${CC}"
3587                                 else
3588                                         SO_LDFLAGS="-shared"
3589                                         SO_LD="${CC}"
3590                                 fi
3591                         else
3592                                 SO_LDFLAGS="-shared"
3593                                 SO_LD="ld"
3594                         fi
3595                         ;;
3596                 *-freebsd*|*-openbsd*|*-netbsd*)
3597                         SO_CFLAGS="-fpic"
3598                         SO_LDFLAGS="-Bshareable -x"
3599                         SO_LD="ld"
3600                         ;;
3601                 *-solaris*)
3602                         SO_CFLAGS="-KPIC"
3603                         SO_LDFLAGS="-G -z text"
3604                         SO_LD="ld"
3605                         ;;
3606                 *-hp-hpux*)
3607                         SO=sl
3608                         SO_CFLAGS="+z"
3609                         SO_LDFLAGS="-b +vnocompatwarnings"
3610                         SO_LD="ld"
3611                         ;;
3612                 *)
3613                         SO_CFLAGS="-fPIC"
3614                         ;;
3615         esac
3616
3617         if test "X$GCC" = "Xyes"; then
3618                 SO_CFLAGS="-fPIC"
3619                 if test -z "$SO_LD"
3620                 then
3621                         if test "$use_libtool" = "yes"; then
3622                                 SO_LDFLAGS="-Xcompiler -shared"
3623                                 SO_LD="${CC}"
3624                         else
3625                                 SO_LDFLAGS="-shared"
3626                                 SO_LD="${CC}"
3627                         fi
3628                 fi
3629         fi
3630
3631         # If we still don't know how to make shared objects, don't make any.
3632         if test -n "$SO_LD"; then
3633                 SO_TARGETS="\${SO_TARGETS}"
3634                 AC_DEFINE(ISC_DLZ_DLOPEN, 1,
3635                           [Define to allow building of objects for dlopen().])
3636         fi
3637 fi
3638
3639 AC_SUBST(SO)
3640 AC_SUBST(SO_CFLAGS)
3641 AC_SUBST(SO_LDFLAGS)
3642 AC_SUBST(SO_LD)
3643 AC_SUBST(SO_TARGETS)
3644
3645 sinclude(contrib/dlz/config.dlz.in)
3646 AC_MSG_CHECKING(contributed DLZ drivers)
3647
3648 if test -n "$CONTRIB_DLZ"
3649 then
3650         AC_MSG_RESULT(yes)
3651         DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
3652         AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
3653 else
3654         AC_MSG_RESULT(no)
3655         DLZ_DRIVER_RULES=/dev/null
3656 fi
3657
3658 AC_SUBST(CONTRIB_DLZ)
3659 AC_SUBST(DLZ_DRIVER_INCLUDES)
3660 AC_SUBST(DLZ_DRIVER_LIBS)
3661 AC_SUBST(DLZ_DRIVER_SRCS)
3662 AC_SUBST(DLZ_DRIVER_OBJS)
3663 AC_SUBST(DLZ_SYSTEM_TEST)
3664 AC_SUBST_FILE(DLZ_DRIVER_RULES)
3665
3666 if test "$cross_compiling" = "yes"; then
3667         if test -z "$BUILD_CC"; then
3668                 AC_MSG_ERROR([BUILD_CC not set])
3669         fi
3670         BUILD_CFLAGS="$BUILD_CFLAGS"
3671         BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
3672         BUILD_LDFLAGS="$BUILD_LDFLAGS"
3673         BUILD_LIBS="$BUILD_LIBS"
3674 else
3675         BUILD_CC="$CC"
3676         BUILD_CFLAGS="$CFLAGS"
3677         BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
3678         BUILD_LDFLAGS="$LDFLAGS"
3679         BUILD_LIBS="$LIBS"
3680 fi
3681
3682 NEWFLAGS=""
3683 for e in $BUILD_LDFLAGS ; do
3684     case $e in
3685         -L*)
3686             case $host_os in
3687                 netbsd*)
3688                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3689                     NEWFLAGS="$NEWFLAGS $e $ee"
3690                     ;;
3691                 freebsd*)
3692                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3693                     NEWFLAGS="$NEWFLAGS $e $ee"
3694                     ;;
3695                 solaris*)
3696                     ee=`echo $e | sed -e 's%^-L%-R%'`
3697                     NEWFLAGS="$NEWFLAGS $e $ee"
3698                     ;;
3699                 *)
3700                     NEWFLAGS="$NEWFLAGS $e"
3701                     ;;
3702                 esac
3703             ;;
3704         *)
3705             NEWFLAGS="$NEWFLAGS $e"
3706             ;;
3707     esac
3708 done
3709 BUILD_LDFLAGS="$NEWFLAGS"
3710
3711 NEWFLAGS=""
3712 for e in $DNS_GSSAPI_LIBS ; do
3713     case $e in
3714         -L*)
3715             case $host_os in
3716                 netbsd*)
3717                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3718                     NEWFLAGS="$NEWFLAGS $e $ee"
3719                     ;;
3720                 freebsd*)
3721                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3722                     NEWFLAGS="$NEWFLAGS $e $ee"
3723                     ;;
3724                 solaris*)
3725                     ee=`echo $e | sed -e 's%^-L%-R%'`
3726                     NEWFLAGS="$NEWFLAGS $e $ee"
3727                     ;;
3728                 *)
3729                     NEWFLAGS="$NEWFLAGS $e"
3730                     ;;
3731                 esac
3732             ;;
3733         *)
3734             NEWFLAGS="$NEWFLAGS $e"
3735             ;;
3736     esac
3737 done
3738 DNS_GSSAPI_LIBS="$NEWFLAGS"
3739
3740 NEWFLAGS=""
3741 for e in $DNS_CRYPTO_LIBS ; do
3742     case $e in
3743         -L*)
3744             case $host_os in
3745                 netbsd*)
3746                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3747                     NEWFLAGS="$NEWFLAGS $e $ee"
3748                     ;;
3749                 freebsd*)
3750                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
3751                     NEWFLAGS="$NEWFLAGS $e $ee"
3752                     ;;
3753                 solaris*)
3754                     ee=`echo $e | sed -e 's%^-L%-R%'`
3755                     NEWFLAGS="$NEWFLAGS $e $ee"
3756                     ;;
3757                 *)
3758                     NEWFLAGS="$NEWFLAGS $e"
3759                     ;;
3760                 esac
3761             ;;
3762         *)
3763             NEWFLAGS="$NEWFLAGS $e"
3764             ;;
3765     esac
3766 done
3767 DNS_CRYPTO_LIBS="$NEWFLAGS"
3768
3769 AC_SUBST(BUILD_CC)
3770 AC_SUBST(BUILD_CFLAGS)
3771 AC_SUBST(BUILD_CPPFLAGS)
3772 AC_SUBST(BUILD_LDFLAGS)
3773 AC_SUBST(BUILD_LIBS)
3774
3775 #
3776 # Commands to run at the end of config.status.
3777 # Don't just put these into configure, it won't work right if somebody
3778 # runs config.status directly (which autoconf allows).
3779 #
3780
3781 AC_CONFIG_COMMANDS(
3782         [chmod],
3783         [chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
3784
3785 #
3786 # Files to configure.  These are listed here because we used to
3787 # specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
3788 # elsewhere if there's a good reason for doing so.
3789 #
3790
3791 AC_CONFIG_FILES([
3792   make/Makefile
3793   make/mkdep
3794         Makefile
3795         bin/Makefile
3796         bin/check/Makefile
3797         bin/confgen/Makefile
3798         bin/confgen/unix/Makefile
3799         bin/dig/Makefile
3800         bin/dnssec/Makefile
3801         bin/named/Makefile
3802         bin/named/unix/Makefile
3803         bin/nsupdate/Makefile
3804         bin/pkcs11/Makefile
3805         bin/python/Makefile
3806         bin/python/dnssec-checkds.py
3807         bin/python/dnssec-coverage.py
3808         bin/rndc/Makefile
3809         bin/tests/Makefile
3810         bin/tests/atomic/Makefile
3811         bin/tests/db/Makefile
3812         bin/tests/dst/Makefile
3813         bin/tests/dst/Kdh.+002+18602.key
3814         bin/tests/dst/Kdh.+002+18602.private
3815         bin/tests/dst/Kdh.+002+48957.key
3816         bin/tests/dst/Kdh.+002+48957.private
3817         bin/tests/dst/Ktest.+001+00002.key
3818         bin/tests/dst/Ktest.+001+54622.key
3819         bin/tests/dst/Ktest.+001+54622.private
3820         bin/tests/dst/Ktest.+003+23616.key
3821         bin/tests/dst/Ktest.+003+23616.private
3822         bin/tests/dst/Ktest.+003+49667.key
3823         bin/tests/dst/dst_2_data
3824         bin/tests/dst/t2_data_1
3825         bin/tests/dst/t2_data_2
3826         bin/tests/dst/t2_dsasig
3827         bin/tests/dst/t2_rsasig
3828         bin/tests/hashes/Makefile
3829         bin/tests/headerdep_test.sh
3830         bin/tests/master/Makefile
3831         bin/tests/mem/Makefile
3832         bin/tests/names/Makefile
3833         bin/tests/net/Makefile
3834         bin/tests/rbt/Makefile
3835         bin/tests/resolver/Makefile
3836         bin/tests/sockaddr/Makefile
3837         bin/tests/system/Makefile
3838         bin/tests/system/conf.sh
3839         bin/tests/system/builtin/Makefile
3840         bin/tests/system/dlz/prereq.sh
3841         bin/tests/system/dlzexternal/Makefile
3842         bin/tests/system/dlzexternal/ns1/named.conf
3843         bin/tests/system/filter-aaaa/Makefile
3844         bin/tests/system/inline/checkdsa.sh
3845         bin/tests/system/lwresd/Makefile
3846         bin/tests/system/rpz/Makefile
3847         bin/tests/system/rrl/Makefile
3848         bin/tests/system/rsabigexponent/Makefile
3849         bin/tests/system/tkey/Makefile
3850         bin/tests/system/tsiggss/Makefile
3851         bin/tests/tasks/Makefile
3852         bin/tests/timers/Makefile
3853         bin/tests/virtual-time/Makefile
3854         bin/tests/virtual-time/conf.sh
3855         bin/tools/Makefile
3856         contrib/check-secure-delegation.pl
3857         contrib/zone-edit.sh
3858         doc/Makefile
3859         doc/arm/Makefile
3860         doc/doxygen/Doxyfile
3861         doc/doxygen/Makefile
3862         doc/doxygen/doxygen-input-filter
3863         doc/misc/Makefile
3864         doc/xsl/Makefile
3865         doc/xsl/isc-docbook-chunk.xsl
3866         doc/xsl/isc-docbook-html.xsl
3867         doc/xsl/isc-docbook-latex.xsl
3868         doc/xsl/isc-manpage.xsl
3869         isc-config.sh
3870         lib/Makefile
3871         lib/bind9/Makefile
3872         lib/bind9/include/Makefile
3873         lib/bind9/include/bind9/Makefile
3874         lib/dns/Makefile
3875         lib/dns/include/Makefile
3876         lib/dns/include/dns/Makefile
3877         lib/dns/include/dst/Makefile
3878         lib/dns/tests/Makefile
3879         lib/export/Makefile
3880         lib/export/dns/Makefile
3881         lib/export/dns/include/Makefile
3882         lib/export/dns/include/dns/Makefile
3883         lib/export/dns/include/dst/Makefile
3884         lib/export/irs/Makefile
3885         lib/export/irs/include/Makefile
3886         lib/export/irs/include/irs/Makefile
3887         lib/export/isc/$thread_dir/Makefile
3888         lib/export/isc/$thread_dir/include/Makefile
3889         lib/export/isc/$thread_dir/include/isc/Makefile
3890         lib/export/isc/Makefile
3891         lib/export/isc/include/Makefile
3892         lib/export/isc/include/isc/Makefile
3893         lib/export/isc/nls/Makefile
3894         lib/export/isc/unix/Makefile
3895         lib/export/isc/unix/include/Makefile
3896         lib/export/isc/unix/include/isc/Makefile
3897         lib/export/isccfg/Makefile
3898         lib/export/isccfg/include/Makefile
3899         lib/export/isccfg/include/isccfg/Makefile
3900         lib/export/samples/Makefile
3901         lib/export/samples/Makefile-postinstall
3902         lib/irs/Makefile
3903         lib/irs/include/Makefile
3904         lib/irs/include/irs/Makefile
3905         lib/irs/include/irs/netdb.h
3906         lib/irs/include/irs/platform.h
3907         lib/isc/$arch/Makefile
3908         lib/isc/$arch/include/Makefile
3909         lib/isc/$arch/include/isc/Makefile
3910         lib/isc/$thread_dir/Makefile
3911         lib/isc/$thread_dir/include/Makefile
3912         lib/isc/$thread_dir/include/isc/Makefile
3913         lib/isc/Makefile
3914         lib/isc/include/Makefile
3915         lib/isc/include/isc/Makefile
3916         lib/isc/include/isc/platform.h
3917         lib/isc/tests/Makefile
3918         lib/isc/nls/Makefile
3919         lib/isc/unix/Makefile
3920         lib/isc/unix/include/Makefile
3921         lib/isc/unix/include/isc/Makefile
3922         lib/isccc/Makefile
3923         lib/isccc/include/Makefile
3924         lib/isccc/include/isccc/Makefile
3925         lib/isccfg/Makefile
3926         lib/isccfg/include/Makefile
3927         lib/isccfg/include/isccfg/Makefile
3928         lib/lwres/Makefile
3929         lib/lwres/include/Makefile
3930         lib/lwres/include/lwres/Makefile
3931         lib/lwres/include/lwres/netdb.h
3932         lib/lwres/include/lwres/platform.h
3933         lib/lwres/man/Makefile
3934         lib/lwres/tests/Makefile
3935         lib/lwres/unix/Makefile
3936         lib/lwres/unix/include/Makefile
3937         lib/lwres/unix/include/lwres/Makefile
3938         lib/tests/Makefile
3939         lib/tests/include/Makefile
3940         lib/tests/include/tests/Makefile
3941         unit/Makefile
3942         unit/unittest.sh
3943 ])
3944
3945 #
3946 # Do it
3947 #
3948
3949 AC_OUTPUT
3950
3951 #
3952 # Now that the Makefiles exist we can ensure that everything is rebuilt.
3953 #
3954 AC_ARG_WITH(make-clean,
3955 [  --with-make-clean      Run "make clean" at end of configure [[yes|no]].],
3956     make_clean="$withval", make_clean="yes")
3957 case "$make_clean" in
3958 yes)
3959         make clean
3960         ;;
3961 esac
3962
3963 AC_ARG_ENABLE(full-report,
3964         [  --enable-full-report   report values of all configure options])
3965
3966 echo "========================================================================"
3967 echo "Configuration summary:"
3968 echo "------------------------------------------------------------------------"
3969 echo "Optional features enabled:"
3970 $use_threads && echo "    Multiprocessing support (--enable-threads)"
3971
3972 test "$enable_rrl" = "yes" && \
3973     echo "    Response Rate Limiting (--enable-rrl)"
3974 test "$use_gssapi" = "no" || echo "    GSS-API (--with-gssapi)"
3975 test "$use_pkcs11" = "no" || echo "    PKCS#11/Cryptoki support (--with-pkcs11)"
3976 test "$enable_newstats" = "yes" && \
3977     echo "    New statistics (--enable-newstats)"
3978 test "$enable_fixed" = "yes" && \
3979     echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
3980 test "$enable_filter" = "yes" && \
3981     echo "    AAAA filtering (--enable-filter-aaaa)"
3982 test "$want_backtrace" = "yes" && \
3983     echo "    Print backtrace on crash (--enable-backtrace)"
3984 test "$want_symtable" = "minimal" && \
3985     echo "    Use symbol table for backtrace, named only (--enable-symtable)"
3986 test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \
3987     echo "    Use symbol table for backtrace, all binaries (--enable-symtable=all)"
3988 test "$atf" = "no" || echo "    Automated Testing Framework (--with-atf)"
3989
3990 # these lines are only printed if run with --enable-full-report 
3991 if test "$enable_full_report" = "yes"; then
3992     test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" || \
3993         echo "    IPv6 support (--enable-ipv6)"
3994     test "X$USE_OPENSSL" = "X" || \
3995             echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
3996     test "$OPENSSL_GOST" != "yes" || \
3997             echo "    GOST algorithm support (--with-gost)"
3998     test "$OPENSSL_ECDSA" != "yes" || \
3999             echo "    ECDSA algorithm support (--with-ecdsa)"
4000     test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
4001     test "X$libxml2_libs" = "X" || echo "    XML statistics (--with-libxml2)"
4002 fi
4003
4004 echo "    Dynamically loadable zone (DLZ) drivers:"
4005 test "$use_dlz_bdb" = "no" || \
4006     echo "        Berkeley DB (--with-dlz-bdb)"
4007 test "$use_dlz_ldap" = "no" || \
4008     echo "        LDAP (--with-dlz-ldap)"
4009 test "$use_dlz_mysql" = "no" || \
4010     echo "        MySQL (--with-dlz-mysql)"
4011 test "$use_dlz_odbc" = "no" || \
4012     echo "        ODBC (--with-dlz-odbc)"
4013 test "$use_dlz_postgres" = "no" || \
4014     echo "        Postgres (--with-dlz-postgres)"
4015 test "$use_dlz_filesystem" = "no" || \
4016     echo "        Filesystem (--with-dlz-filesystem)"
4017 test "$use_dlz_stub" = "no" || \
4018     echo "        Stub (--with-dlz-stub)"
4019 test "$use_dlz_bdb $use_dlz_ldap $use_dlz_mysql $use_dlz_odbc $use_dlz_postgres $use_dlz_filesystem $use_dlz_stub" = "no no no no no no no" && echo "        None"
4020 echo
4021
4022 echo "Features disabled or unavailable on this platform:"
4023 $use_threads || echo "    Multiprocessing support (--enable-threads)"
4024 test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" && \
4025         echo "    IPv6 support (--enable-ipv6)"
4026 test "$enable_rrl" = "yes" || \
4027     echo "    Response Rate Limiting (--enable-rrl)"
4028 test "$use_gssapi" = "no" && echo "    GSS-API (--with-gssapi)"
4029 test "$use_pkcs11" = "no" && echo "    PKCS#11/Cryptoki support (--with-pkcs11)"
4030 test "X$enable_newstats" = "X" && echo "    New statistics (--enable-newstats)"
4031 test "$enable_fixed" = "yes" || \
4032     echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
4033 test "$want_backtrace" = "yes" || \
4034     echo "    Print backtrace on crash (--enable-backtrace)"
4035 test "$atf" = "no" && echo "    Automated Testing Framework (--with-atf)"
4036 test "X$USE_OPENSSL" = "X" && \
4037         echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
4038 test "X$USE_OPENSSL" != "X" -a "$OPENSSL_GOST" != "yes" && \
4039     echo "    GOST algorithm support (--with-gost)"
4040 test "X$USE_OPENSSL" != "X" -a "$OPENSSL_ECDSA" != "yes" && \
4041     echo "    ECDSA algorithm support (--with-ecdsa)"
4042 test "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
4043 test "X$libxml2_libs" = "X" && echo "    XML statistics (--with-libxml2)"
4044
4045 if test "X$ac_unrecognized_opts" != "X"; then
4046     echo
4047     echo "Unrecognized options:"
4048     echo "    $ac_unrecognized_opts"
4049 fi
4050 echo "========================================================================"
4051
4052 if test "X$USE_OPENSSL" = "X"; then
4053 cat << \EOF
4054 BIND is being built without OpenSSL. This means it will not have DNSSEC support.
4055 EOF
4056 fi
4057
4058 if test "X$OPENSSL_WARNING" != "X"; then
4059 cat << \EOF
4060 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4061 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4062 WARNING                                                                 WARNING
4063 WARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
4064 WARNING         one or more of the the following known security         WARNING
4065 WARNING         flaws:                                                  WARNING
4066 WARNING                                                                 WARNING
4067 WARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
4068 WARNING         CVE-2006-2940.                                          WARNING
4069 WARNING                                                                 WARNING
4070 WARNING         It is recommended that you upgrade to OpenSSL           WARNING
4071 WARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
4072 WARNING                                                                 WARNING
4073 WARNING         You can disable this warning by specifying:             WARNING
4074 WARNING                                                                 WARNING
4075 WARNING               --disable-openssl-version-check                   WARNING
4076 WARNING                                                                 WARNING
4077 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4078 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4079 EOF
4080 fi
4081
4082 # Tell Emacs to edit this file in shell mode.
4083 # Local Variables:
4084 # mode: sh
4085 # End: