Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / configure.in
blob8b84f434f1896205df06eed02836a452252a1c1a
1 # Copyright (C) 2004-2015  Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 1998-2003  Internet Software Consortium.
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.
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.
16 # Copyright (C) 1998-2003  Internet Software Consortium.
18 # Permission to use, copy, modify, and/or distribute this software for any
19 # purpose with or without fee is hereby granted, provided that the above
20 # copyright notice and this permission notice appear in all copies.
22 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
23 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
25 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
27 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28 # PERFORMANCE OF THIS SOFTWARE.
30 dnl
31 AC_DIVERT_PUSH(1)dnl
32 esyscmd([sed -e 's/^/# /' -e '/Portions of this code/,$d' COPYRIGHT])dnl
33 AC_DIVERT_POP()dnl
35 AC_INIT(BIND, [9.10], [bind9-bugs@isc.org], [], [https://www.isc.org/downloads/BIND/])
36 AC_PREREQ(2.59)
38 AC_CONFIG_HEADER(config.h)
39 AC_CONFIG_MACRO_DIR([m4])
41 AC_CANONICAL_HOST
43 AC_PROG_MAKE_SET
46 # GNU libtool support
48 case $build_os in
49 sunos*)
50     # Just set the maximum command line length for sunos as it otherwise
51     # takes a exceptionally long time to work it out. Required for libtool.
52      
53     lt_cv_sys_max_cmd_len=4096;
54     ;;
55 esac
57 AC_PROG_LIBTOOL
58 AC_PROG_INSTALL
59 AC_PROG_LN_S
61 AC_SUBST(STD_CINCLUDES)
62 AC_SUBST(STD_CDEFINES)
63 AC_SUBST(STD_CWARNINGS)
64 AC_SUBST(CCOPT)
65 AC_SUBST(CCNOOPT)
66 AC_SUBST(BACKTRACECFLAGS)
68 # Warn if the user specified libbind, which is now deprecated
69 AC_ARG_ENABLE(libbind, [  --enable-libbind        deprecated])
71 case "$enable_libbind" in
72         yes)
73                 AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
74 It is available from http://www.isc.org as a separate download.])
75                 ;;
76         no|'')
77                 ;;
78 esac
80 AC_ARG_ENABLE(warn_shadow, [  --enable-warn-shadow        turn on -Wshadow when compiling])
82 AC_ARG_ENABLE(warn_error, [  --enable-warn-error          turn on -Werror when compiling])
84 AC_ARG_ENABLE(developer, [  --enable-developer      enable developer build settings])
85 case "$enable_developer" in
86 yes)
87         STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
88         test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
89         test "${with_atf+set}" = set || with_atf=yes
90         test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
91         test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
92         test "${enable_symtable+set}" = set || enable_symtable=all
93         test "${enable_sit+set}" = set || enable_sit=yes
94         test "${enable_warn_error+set}" = set || enable_warn_error=yes
95         test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes
96         ;;
97 esac
99 #libseccomp sandboxing
100 AC_ARG_ENABLE(seccomp,
101         AS_HELP_STRING([--enable-seccomp],[enable support for libseccomp system call filtering [default=no]]))
102 case "$enable_seccomp" in
103         yes)
104         case $host_os in
105         linux*)
106                 ;;
107         *)
108                 AC_MSG_WARN([seccomp is not supported on non-linux platforms; disabling it])
109                 enable_seccomp=no
110                 ;;
111         esac
112         AC_SEARCH_LIBS(seccomp_init, [seccomp])
113         if test "$ac_cv_search_seccomp_init" = "-lseccomp" ; then
114                 AC_TRY_RUN([
115                 #include <stdio.h>
116                 #include <stdlib.h>
117                 #include <errno.h>
118                 #include <sys/prctl.h>
119                 #include <linux/seccomp.h>
121                 int main(void)
122                 {
123                         int ret;
125                         ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
126                         if (ret < 0) {
127                                 switch (errno) {
128                                 case ENOSYS:
129                                         return 1;
130                                 case EINVAL:
131                                         return 1;
132                                 default:
133                                         return 1;
134                                 }
135                         }
136                         ret = 
137                         prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
138                         if (ret < 0) {
139                                 switch (errno) {
140                                 case EINVAL:
141                                         return 1;
142                                 case EFAULT:
143                                         return 0;
144                                 default:
145                                         return 1;
146                         }
147                 }
148         return 1;
149         }
150         ]
151         , AC_DEFINE([HAVE_LIBSECCOMP], 1, 
152         [Define to use libseccomp system call filtering.])   
153         , []
154         )
155         fi
156                 ;;
157         *)
158                 ;;
159 esac
162 # Make very sure that these are the first files processed by
163 # config.status, since we use the processed output as the input for
164 # AC_SUBST_FILE() substitutions in other files.
166 AC_CONFIG_FILES([make/rules make/includes])
168 AC_PATH_PROG(AR, ar)
169 ARFLAGS="cruv"
170 AC_SUBST(AR)
171 AC_SUBST(ARFLAGS)
173 # The POSIX ln(1) program.  Non-POSIX systems may substitute
174 # "copy" or something.
175 LN=ln
176 AC_SUBST(LN)
178 case "$AR" in
179         "")
180                 AC_MSG_ERROR([
181 ar program not found.  Please fix your PATH to include the directory in
182 which ar resides, or set AR in the environment with the full path to ar.
185                 ;;
186 esac
189 # Etags.
191 AC_PATH_PROGS(ETAGS, etags emacs-etags)
194 # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
195 # GNU emacs etags, and it requires the -L flag.
197 if test "X$ETAGS" != "X"; then
198         AC_MSG_CHECKING(for Exuberant Ctags etags)
199         if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
200                 AC_MSG_RESULT(yes)
201                 ETAGS="$ETAGS -L"
202         else
203                 AC_MSG_RESULT(no)
204         fi
206 AC_SUBST(ETAGS)
209 # Perl is optional; it is used only by some of the system test scripts.
210 # Note: the backtrace feature (see below) uses perl to build the symbol table,
211 # but it still compiles without perl, in which case an empty table will be used.
213 AC_PATH_PROGS(PERL, perl5 perl)
214 AC_SUBST(PERL)
217 # Python is also optional; it is used by the tools in bin/python.
218 # If python is unavailable, we simply don't build those.
220 AC_ARG_WITH(python,
221 [  --with-python=PATH      specify path to python interpreter],
222     use_python="$withval", use_python="unspec")
224 python="python python3 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5 python2.4"
225 testscript='try: import argparse
226 except: exit(1)'
227 case "$use_python" in
228         no)
229                 AC_MSG_CHECKING([for python support])
230                 AC_MSG_RESULT(disabled)
231                 ;;
232         unspec|yes|*)
233                 case "$use_python" in
234                 unspec|yes|'')
235                         for p in $python
236                         do
237                                 AC_PATH_PROGS(PYTHON, $p)
238                                 if test "X$PYTHON" == "X"; then
239                                         continue;
240                                 fi
241                                 AC_MSG_CHECKING([python module 'argparse'])
242                                 if ${PYTHON:-false} -c "$testscript"; then
243                                         AC_MSG_RESULT([found, using $PYTHON])
244                                         break
245                                 fi
246                                 AC_MSG_RESULT([not found])
247                                 unset ac_cv_path_PYTHON
248                                 unset PYTHON
249                         done
250                         if test "X$PYTHON" == "X"
251                         then
252                                 AC_MSG_CHECKING([for python support])
253                                 case "$use_python" in
254                                 unspec)
255                                         AC_MSG_RESULT(disabled)
256                                         ;;
257                                 yes)
258                                         AC_MSG_ERROR([missing python])
259                                         ;;
260                                 esac
261                         fi
262                         ;;
263                 *)
264                         case "$use_python" in
265                         /*)
266                                 PYTHON="$use_python"
267                                 ;;
268                         *)
269                                 AC_PATH_PROGS(PYTHON, $use_python)
270                                 ;;
271                         esac
272                         AC_MSG_CHECKING([python module 'argparse'])
273                         if ${PYTHON:-false} -c "$testscript"; then
274                                 AC_MSG_RESULT([found, using $PYTHON])
275                                 break
276                         else
277                                 AC_MSG_ERROR([not found])
278                         fi
279                         ;;
280                 esac
281                 ;;
282 esac
284 PYTHON_TOOLS=''
285 CHECKDS=''
286 COVERAGE=''
287 if test "X$PYTHON" != "X"; then
288         PYTHON_TOOLS=python
289         CHECKDS=checkds
290         COVERAGE=coverage
292 AC_SUBST(CHECKDS)
293 AC_SUBST(COVERAGE)
294 AC_SUBST(PYTHON_TOOLS)
297 # Special processing of paths depending on whether --prefix,
298 # --sysconfdir or --localstatedir arguments were given.  What's
299 # desired is some compatibility with the way previous versions
300 # of BIND built; they defaulted to /usr/local for most parts of
301 # the installation, but named.boot/named.conf was in /etc
302 # and named.pid was in /var/run.
304 # So ... if none of --prefix, --sysconfdir or --localstatedir are
305 # specified, set things up that way.  If --prefix is given, use
306 # it for sysconfdir and localstatedir the way configure normally
307 # would.  To change the prefix for everything but leave named.conf
308 # in /etc or named.pid in /var/run, then do this the usual configure way:
309 # ./configure --prefix=/somewhere --sysconfdir=/etc
310 # ./configure --prefix=/somewhere --localstatedir=/var
312 # To put named.conf and named.pid in /usr/local with everything else,
313 # set the prefix explicitly to /usr/local even though that's the default:
314 # ./configure --prefix=/usr/local
316 case "$prefix" in
317         NONE)
318                 case "$sysconfdir" in
319                         '${prefix}/etc')
320                                 sysconfdir=/etc
321                                 ;;
322                 esac
323                 case "$localstatedir" in
324                         '${prefix}/var')
325                                 localstatedir=/var
326                                 ;;
327                 esac
328                 ;;
329 esac
332 # Make sure INSTALL uses an absolute path, else it will be wrong in all
333 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
334 # configure based on the location of the file where it is substituted.
335 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
336 # subdirectory of install-sh, This relative path will be wrong for all
337 # directories more than one level down from install-sh.
339 case "$INSTALL" in
340         /*)
341                 ;;
342         *)
343                 #
344                 # Not all systems have dirname.
345                 #
346                 changequote({, })
347                 ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
348                 changequote([, ])
350                 ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
351                 test "$ac_dir" = "$ac_prog" && ac_dir=.
352                 test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
353                 INSTALL="$ac_dir/$ac_prog"
354                 ;;
355 esac
358 # On these hosts, we really want to use cc, not gcc, even if it is
359 # found.  The gcc that these systems have will not correctly handle
360 # pthreads.
362 # However, if the user sets $CC to be something, let that override
363 # our change.
365 if test "X$CC" = "X" ; then
366         case "$host" in
367                 *-dec-osf*)
368                         CC="cc"
369                         ;;
370                 *-solaris*)
371                         # Use Sun's cc if it is available, but watch
372                         # out for /usr/ucb/cc; it will never be the right
373                         # compiler to use.
374                         #
375                         # If setting CC here fails, the AC_PROG_CC done
376                         # below might still find gcc.
377                         IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
378                         for ac_dir in $PATH; do
379                                 test -z "$ac_dir" && ac_dir=.
380                                 case "$ac_dir" in
381                                 /usr/ucb)
382                                         # exclude
383                                         ;;
384                                 *)
385                                         if test -f "$ac_dir/cc"; then
386                                                 CC="$ac_dir/cc"
387                                                 break
388                                         fi
389                                         ;;
390                                 esac
391                         done
392                         IFS="$ac_save_ifs"
393                         ;;
394                 *-hp-hpux*)
395                         CC="cc"
396                         ;;
397                 mips-sgi-irix*)
398                         CC="cc"
399                         ;;
400         esac
403 AC_PROG_CC
406 # gcc's optimiser is broken at -02 for ultrasparc
408 if test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
409         case "$host" in
410         sparc-*)
411                 CCFLAGS="-g -O1"
412                 ;;
413         esac
417 # OS dependent CC flags
419 case "$host" in
420         # OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
421         # -D_XOPEN_SOURCE_EXTENDED.
422         *-dec-osf*)
423                 STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
424                 CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
425                 ;;
426         #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
427         *-hp-hpux*)
428                 STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
429                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
430                 LIBS="-lxnet $LIBS"
431                 ;;
432         # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
433         *-solaris*)
434                 STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
435                 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
436                 ;;
437         # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
438         # parts of the IPv6 Advanced Socket API as a result.  This is stupid
439         # as it breaks how the two halves (Basic and Advanced) of the IPv6
440         # Socket API were designed to be used but we have to live with it.
441         # Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
442         *-linux* | *-kfreebsd*-gnu*)
443                 STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
444                 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
445                 ;;
446         #
447         # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
448         # Setting this is sufficient to select the correct behavior for BIND 9.
449         #
450         *-darwin*)
451           STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
452           CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
453           ;;
454 esac
457 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
459 if test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then
460         CCNOOPT="-O0"
463 AC_HEADER_STDC
465 AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h sys/socket.h net/route.h linux/netlink.h linux/rtnetlink.h,,,
466 [$ac_includes_default
467 #ifdef HAVE_SYS_PARAM_H
468 # include <sys/param.h>
469 #endif
470 #ifdef HAVE_SYS_SOCKET_H
471 # include <sys/socket.h>
472 #endif
475 AC_C_CONST
476 AC_C_INLINE
477 AC_C_VOLATILE
478 AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
479 AC_C_FLEXIBLE_ARRAY_MEMBER
482 # Check for the existence of mmap to enable the fast format zones
484 AC_CHECK_FUNCS(mmap)
487 # Older versions of HP/UX don't define seteuid() and setegid()
489 AC_CHECK_FUNCS(seteuid setresuid)
490 AC_CHECK_FUNCS(setegid setresgid)
492 # BSDI doesn't have ftello fseeko
493 AC_CHECK_FUNCS(ftello fseeko)
496 # UnixWare 7.1.1 with the feature supplement to the UDK compiler
497 # is reported to not support "static inline" (RT #1212).
499 AC_MSG_CHECKING(for static inline breakage)
500 AC_TRY_COMPILE([
501         static inline int foo1() {
502                 return 0;
503         }
505         static inline int foo2() {
506                 return foo1();
507         }
508         ], [foo1();],
509         [AC_MSG_RESULT(no)],
510         [AC_MSG_RESULT(yes)
511          AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
513 AC_TYPE_SIZE_T
514 AC_CHECK_TYPE(ssize_t, int)
515 AC_CHECK_TYPE(uintptr_t,unsigned long)
516 AC_CHECK_TYPE(socklen_t,
517 [AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
519 AC_TRY_COMPILE(
521 #include <sys/types.h>
522 #include <sys/socket.h>
523 int getsockname(int, struct sockaddr *, size_t *);
524 ],[],
525 [AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
526 [AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
529 #include <sys/types.h>
530 #include <sys/socket.h>
532 AC_SUBST(ISC_SOCKADDR_LEN_T)
533 AC_HEADER_TIME
534 AC_MSG_CHECKING(for long long)
535 AC_TRY_COMPILE([],[long long i = 0; return (0);],
536         [AC_MSG_RESULT(yes)
537                 ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
538         [AC_MSG_RESULT(no)
539                 ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
540 AC_SUBST(ISC_PLATFORM_HAVELONGLONG)
543 # check for GCC noreturn attribute
545 AC_MSG_CHECKING(for GCC noreturn attribute)
546 AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
547         [AC_MSG_RESULT(yes)
548                 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
549                 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
550         [AC_MSG_RESULT(no)
551                 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
552                 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
553 AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
554 AC_SUBST(ISC_PLATFORM_NORETURN_POST)
557 # check if we have lifconf
559 AC_MSG_CHECKING(for struct lifconf)
560 AC_TRY_COMPILE([
561 #include <sys/types.h>
562 #include <sys/socket.h>
563 #include <net/if.h>
566 struct lifconf lifconf;
567 lifconf.lifc_len = 0;
570         [AC_MSG_RESULT(yes)
571                 ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
572         [AC_MSG_RESULT(no)
573                 ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
574 AC_SUBST(ISC_PLATFORM_HAVELIFCONF)
577 # check if we have kqueue
579 AC_ARG_ENABLE(kqueue,
580         [  --enable-kqueue         use BSD kqueue when available [[default=yes]]],
581               want_kqueue="$enableval",  want_kqueue="yes")
582 case $want_kqueue in
583 yes)
584         AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
585         case $ac_cv_have_kqueue in
586         yes)
587                 ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
588                 ;;
589         *)
590                 ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
591                 ;;
592         esac
593         ;;
595         ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
596         ;;
597 esac
598 AC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
601 # check if we have epoll.  Linux kernel 2.4 has epoll_create() which fails,
602 # so we need to try running the code, not just test its existence.
604 AC_ARG_ENABLE(epoll,
605 [  --enable-epoll          use Linux epoll when available [[default=auto]]],
606               want_epoll="$enableval",  want_epoll="auto")
607 case $want_epoll in
608 auto)
609         AC_MSG_CHECKING(epoll support)
610         AC_TRY_RUN([
611 #include <sys/epoll.h>
612 int main() {
613         if (epoll_create(1) < 0)
614                 return (1);
615         return (0);
618         [AC_MSG_RESULT(yes)
619         ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
620         [AC_MSG_RESULT(no)
621         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"],
622         [AC_MSG_RESULT(no)
623         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
624         ;;
625 yes)
626         ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
627         ;;
629         ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
630         ;;
631 esac
632 AC_SUBST(ISC_PLATFORM_HAVEEPOLL)
635 # check if we support /dev/poll
637 AC_ARG_ENABLE(devpoll,
638         [  --enable-devpoll        use /dev/poll when available [[default=yes]]],
639               want_devpoll="$enableval",  want_devpoll="yes")
640 case $want_devpoll in
641 yes)
642         AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
643         ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
644         ,
645         ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
646         )
647         ;;
649         ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
650         ;;
651 esac
652 AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
655 # check if we need to #include sys/select.h explicitly
657 case $ac_cv_header_unistd_h in
658 yes)
659 AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
660 AC_TRY_COMPILE([
661 #include <sys/types.h> /* Ultrix */
662 #include <unistd.h>],
663 [fd_set read_set; return (0);],
664         [AC_MSG_RESULT(yes)
665          ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
666          LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
667         [AC_MSG_RESULT(no)
668         case $ac_cv_header_sys_select_h in
669         yes)
670          ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
671          LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
672                 ;;
673         no)
674                 AC_MSG_ERROR([need either working unistd.h or sys/select.h])
675                 ;;
676         esac
677         ])
678         ;;
680         case $ac_cv_header_sys_select_h in
681         yes)
682              ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
683              LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
684                 ;;
685         no)
686                 AC_MSG_ERROR([need either unistd.h or sys/select.h])
687                 ;;
688         esac
689         ;;
690 esac
691 AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
692 AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
695 # Find the machine's endian flavor.
697 AC_C_BIGENDIAN
700 # GeoIP support?
702 GEOIPLINKSRCS=
703 GEOIPLINKOBJS=
704 AC_ARG_WITH(geoip,
705 [  --with-geoip=PATH       Build with GeoIP support (yes|no|path)],
706     use_geoip="$withval", use_geoip="no")
708 if test "$use_geoip" = "yes"
709 then
710         for d in /usr /usr/local /opt/local
711         do
712                 if test -f $d/include/GeoIP.h
713                 then
714                         use_geoip=$d
715                         break
716                 fi
717         done
720 case "$use_geoip" in
721         no|'')
722                 AC_MSG_CHECKING([for GeoIP support])
723                 AC_MSG_RESULT([disabled])
724                 ;;
725         *)
726                 if test -d "$use_geoip" -o -L "$use_geoip"
727                 then
728                         CFLAGS="$CFLAGS -I$use_geoip/include"
729                         CPPFLAGS="$CPPFLAGS -I$use_geoip/include"
730                         LIBS="$LIBS -L$use_geoip/lib"
731                         case "$host_os" in
732                                 netbsd*|openbsd*|solaris*)
733                                         LIBS="$LIBS -Wl,-rpath=$use_geoip/lib"
734                                         ;;
735                         esac
736                 elif test "$use_geoip" = "yes"
737                 then
738                         AC_MSG_ERROR([GeoIP path not found])
739                 else
740                         AC_MSG_ERROR([GeoIP path $use_geoip does not exist])
741                 fi
742                 AC_CHECK_HEADER(GeoIP.h, [],
743                         [AC_MSG_ERROR([GeoIP header file not found])]
744                 )
745                 AC_SEARCH_LIBS(GeoIP_open, GeoIP, [],
746                         [AC_MSG_ERROR([GeoIP library not found])]
747                 )
748                 AC_SEARCH_LIBS(fabsf, m, [],
749                         [AC_MSG_ERROR([Math library not found])]
750                 )
751                 AC_DEFINE(HAVE_GEOIP, 1, Build with GeoIP support)
752                 GEOIPLINKSRCS='${GEOIPLINKSRCS}'
753                 GEOIPLINKOBJS='${GEOIPLINKOBJS}'
754                 AC_MSG_CHECKING([for GeoIP support])
755                 AC_MSG_RESULT([yes])
757                 AC_MSG_CHECKING([for GeoIP Country IPv6 support])
758                 AC_COMPILE_IFELSE(
759                         [AC_LANG_PROGRAM([
760                                 #include <GeoIP.h>
761                                 #include <netinet/in.h>
762                         ], [
763                                 struct in6_addr in6;
764                                 GeoIP_country_name_by_ipnum_v6(NULL, in6);
765                         ])],
766                         [
767                                 AC_MSG_RESULT([yes])
768                                 AC_DEFINE(HAVE_GEOIP_V6, 1, Build with GeoIP Country IPv6 support)
769                         ],
770                         [AC_MSG_RESULT([no])]
771                 )
773                 AC_MSG_CHECKING([for GeoIP City IPv6 support])
774                 AC_COMPILE_IFELSE(
775                         [AC_LANG_PROGRAM([
776                                 #include <GeoIP.h>
777                                 #include <GeoIPCity.h>
778                                 #include <netinet/in.h>
779                         ], [
780                                 struct in6_addr in6;
781                                 int i = GEOIP_CITY_EDITION_REV0_V6;
782                                 GeoIP_record_by_ipnum_v6(NULL, in6);
783                         ])],
784                         [
785                                 AC_MSG_RESULT([yes])
786                                 AC_DEFINE(HAVE_GEOIP_CITY_V6, 1, Build with GeoIP City IPv6 support)
787                         ],
788                         [AC_MSG_RESULT([no])]
789                 )
790                 ;;
791 esac
792 AC_SUBST(GEOIPLINKSRCS)
793 AC_SUBST(GEOIPLINKOBJS)
795 AC_MSG_CHECKING(for GSSAPI library)
796 AC_ARG_WITH(gssapi,
797 [  --with-gssapi=PATH      Specify path for system-supplied GSSAPI [[default=yes]]],
798     use_gssapi="$withval", use_gssapi="yes")
800 # gssapi is just the framework, we really require kerberos v5, so
801 # look for those headers (the gssapi headers must be there, too)
802 # The problem with this implementation is that it doesn't allow
803 # for the specification of gssapi and krb5 headers in different locations,
804 # which probably ought to be fixed although fixing might raise the issue of
805 # trying to build with incompatible versions of gssapi and krb5.
806 if test "$use_gssapi" = "yes"
807 then
808         # first, deal with the obvious
809         if test \( -f /usr/include/kerberosv5/krb5.h -o \
810                    -f /usr/include/krb5/krb5.h -o \
811                    -f /usr/include/krb5.h \)   -a \
812                 \( -f /usr/include/gssapi.h -o \
813                    -f /usr/include/gssapi/gssapi.h \)
814         then
815                 use_gssapi=/usr
816         else
817             krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
818             for d in $krb5dirs
819             do
820                 if test -f $d/include/gssapi/gssapi_krb5.h -o \
821                         -f $d/include/krb5.h
822                 then
823                         if test -f $d/include/gssapi/gssapi.h -o \
824                                 -f $d/include/gssapi.h
825                         then
826                                 use_gssapi=$d
827                                 break
828                         fi
829                 fi
830                 use_gssapi="no"
831             done
832         fi
835 case "$use_gssapi" in
836         no)
837                 AC_MSG_RESULT(disabled)
838                 USE_GSSAPI=''
839                 ;;
840         yes)
841                 AC_MSG_ERROR([--with-gssapi must specify a path])
842                 ;;
843         *)
844                 AC_MSG_RESULT(looking in $use_gssapi/lib)
845                 USE_GSSAPI='-DGSSAPI'
846                 saved_cppflags="$CPPFLAGS"
847                 CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
848                 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
849                     [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"
850                      gssapi_hack="#include <$ac_header>"])
852                 if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
853                     AC_MSG_ERROR([gssapi.h not found])
854                 fi
856                 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
857                     [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"
858                      gssapi_krb5_hack="#include <$ac_header>"])
860                 AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
861                     [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"
862                     krb5_hack="#include <$ac_header>"])
864                 if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
865                     AC_MSG_ERROR([krb5.h not found])
866                 fi
868                 #
869                 # XXXDCL This probably doesn't work right on all systems.
870                 # It will need to be worked on as problems become evident.
871                 #
872                 # Essentially the problems here relate to two different
873                 # areas.  The first area is building with either KTH
874                 # or MIT Kerberos, particularly when both are present on
875                 # the machine.  The other is static versus dynamic linking.
876                 #
877                 # On the KTH vs MIT issue, Both have libkrb5 that can mess
878                 # up the works if one implementation ends up trying to
879                 # use the other's krb.  This is unfortunately a situation
880                 # that very easily arises.
881                 #
882                 # Dynamic linking when the dependency information is built
883                 # into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
884                 # all such problems go away, but when that setup is not
885                 # present, because either the dynamic libraries lack
886                 # dependencies or static linking is being done, then the
887                 # problems start to show up.
888                 saved_libs="$LIBS"
889                 for TRY_LIBS in \
890                     "-lgssapi_krb5" \
891                     "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
892                     "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
893                     "-lgssapi" \
894                     "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
895                     "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
896                     "-lgssapi -lkrb5 -lgssapi_krb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
897                     "-lgssapi -lkrb5 -lhx509 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
898                     "-lgss -lkrb5"
899                 do
900                     # Note that this does not include $saved_libs, because
901                     # on FreeBSD machines this configure script has added
902                     # -L/usr/local/lib to LIBS, which can make the
903                     # -lgssapi_krb5 test succeed with shared libraries even
904                     # when you are trying to build with KTH in /usr/lib.
905                     if test "$use_gssapi" = "/usr"
906                     then
907                             LIBS="$TRY_LIBS"
908                     else
909                             LIBS="-L$use_gssapi/lib $TRY_LIBS"
910                     fi
911                     AC_MSG_CHECKING(linking as $TRY_LIBS)
912                     AC_TRY_LINK([
913 #include <sys/types.h>
914 $gssapi_hack
915 $gssapi_krb5_hack
916 $krb5_hack
917                                 ] , [gss_acquire_cred(NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);krb5_init_context(NULL);
918 #if defined(HAVE_GSSAPI_KRB5_H) || defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
919 gsskrb5_register_acceptor_identity(NULL);
920 #endif],
921                                 gssapi_linked=yes, gssapi_linked=no)
922                     case $gssapi_linked in
923                     yes) AC_MSG_RESULT(yes); break ;;
924                     no)  AC_MSG_RESULT(no) ;;
925                     esac
926                 done
928                 CPPFLAGS="$saved_cppflags"
930                 case $gssapi_linked in
931                 no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
932                 esac
934                 #
935                 # XXXDCL Major kludge.  Tries to cope with KTH in /usr/lib
936                 # but MIT in /usr/local/lib and trying to build with KTH.
937                 # /usr/local/lib can end up earlier on the link lines.
938                 # Like most kludges, this one is not only inelegant it
939                 # is also likely to be the wrong thing to do at least as
940                 # many times as it is the right thing.  Something better
941                 # needs to be done.
942                 #
943                 if test "$use_gssapi" = "/usr" -a \
944                         -f /usr/local/lib/libkrb5.a; then
945                     FIX_KTH_VS_MIT=yes
946                 fi
948                 case "$FIX_KTH_VS_MIT" in
949                 yes)
950                     case "$enable_static_linking" in
951                     yes) gssapi_lib_suffix=".a"  ;;
952                     *)   gssapi_lib_suffix=".so" ;;
953                     esac
955                     for lib in $LIBS; do
956                         case $lib in
957                         -L*)
958                             ;;
959                         -l*)
960                             new_lib=`echo $lib |
961                                      sed -e s%^-l%$use_gssapi/lib/lib% \
962                                          -e s%$%$gssapi_lib_suffix%`
963                             NEW_LIBS="$NEW_LIBS $new_lib"
964                             ;;
965                         *)
966                            AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
967                             ;;
968                         esac
969                     done
970                     LIBS="$NEW_LIBS"
971                     ;;
972                 esac
974                 DST_GSSAPI_INC="-I$use_gssapi/include"
975                 DNS_GSSAPI_LIBS="$LIBS"
977                 AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
978                 LIBS="$saved_libs"
979                 ;;
980 esac
982 AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
983 AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
984 AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
985 AC_SUBST(ISC_PLATFORM_KRB5HEADER)
987 AC_SUBST(USE_GSSAPI)
988 AC_SUBST(DST_GSSAPI_INC)
989 AC_SUBST(DNS_GSSAPI_LIBS)
990 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
993 # Applications linking with libdns also need to link with these libraries.
996 AC_SUBST(DNS_CRYPTO_LIBS)
999 # was --with-randomdev specified?
1001 AC_MSG_CHECKING(for random device)
1002 AC_ARG_WITH(randomdev,
1003 [  --with-randomdev=PATH   Specify path for random device],
1004     use_randomdev="$withval", use_randomdev="unspec")
1006 case "$use_randomdev" in
1007         unspec)
1008                 case "$cross_compiling" in
1009                 yes)
1010                         AC_MSG_RESULT(unspecified)
1011                         AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
1012                 esac
1013                 case "$host" in
1014                         *-openbsd*)
1015                                 devrandom=/dev/arandom
1016                                 ;;
1017                         *)
1018                                 devrandom=/dev/urandom
1019                                 ;;
1020                 esac
1021                 AC_MSG_RESULT($devrandom)
1022                 AC_CHECK_FILE($devrandom,
1023                               AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
1024                                                  "$devrandom"),)
1025                               
1026                 ;;
1027         yes)
1028                 AC_MSG_ERROR([--with-randomdev must specify a path])
1029                 ;;
1030         no)
1031                 AC_MSG_RESULT(disabled)
1032                 ;;
1033         *)
1034                 AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
1035                 AC_MSG_RESULT(using "$use_randomdev")
1036                 ;;
1037 esac
1040 # Only check dsa signature generation on these platforms when performing
1041 # system tests.
1043 CHECK_DSA=0
1044 if grep "#define PATH_RANDOMDEV " confdefs.h > /dev/null
1045 then
1046         case "$host" in
1047         *darwin*|*freebsd*)
1048                 CHECK_DSA=1
1049                 ;;
1050         esac
1052 AC_SUBST(CHECK_DSA)
1055 # Do we have arc4random(), etc ? arc4random_addrandom() has been removed
1056 # from OpenBSD 5.5 onwards.
1058 AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
1059 AC_CHECK_FUNC(arc4random_addrandom, AC_DEFINE(HAVE_ARC4RANDOM_ADDRANDOM))
1061 sinclude(config.threads.in)dnl
1063 if $use_threads
1064 then
1065         if test "X$GCC" = "Xyes"; then
1066                 case "$host" in
1067                 *-freebsd*)
1068                         CC="$CC -pthread"
1069                         CCOPT="$CCOPT -pthread"
1070                         CCNOOPT="$CCNOOPT -pthread"
1071                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1072                         ;;
1073                 *-openbsd*)
1074                         CC="$CC -pthread"
1075                         CCOPT="$CCOPT -pthread"
1076                         CCNOOPT="$CCNOOPT -pthread"
1077                         ;;
1078                 *-solaris*)
1079                         LIBS="$LIBS -lthread"
1080                         ;;
1081                 *-ibm-aix*)
1082                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1083                         ;;
1084                 esac
1085         else
1086                 case $host in
1087                 *-dec-osf*)
1088                         CC="$CC -pthread"
1089                         CCOPT="$CCOPT -pthread"
1090                         CCNOOPT="$CCNOOPT -pthread"
1091                         ;;
1092                 *-solaris*)
1093                         CC="$CC -mt"
1094                         CCOPT="$CCOPT -mt"
1095                         CCNOOPT="$CCNOOPT -mt"
1096                         ;;
1097                 *-ibm-aix*)
1098                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
1099                         ;;
1100                 *-sco-sysv*uw*|*-*-sysv*UnixWare*)
1101                         CC="$CC -Kthread"
1102                         CCOPT="$CCOPT -Kthread"
1103                         CCNOOPT="$CCNOOPT -Kthread"
1104                         ;;
1105                 *-*-sysv*OpenUNIX*)
1106                         CC="$CC -Kpthread"
1107                         CCOPT="$CCOPT -Kpthread"
1108                         CCNOOPT="$CCNOOPT -Kpthread"
1109                         ;;
1110                 esac
1111         fi
1112         ALWAYS_DEFINES="-D_REENTRANT"
1113         ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
1114         THREADOPTOBJS='${THREADOPTOBJS}'
1115         THREADOPTSRCS='${THREADOPTSRCS}'
1116         thread_dir=pthreads
1117         #
1118         # We'd like to use sigwait() too
1119         #
1120         AC_CHECK_FUNC(sigwait,
1121                       AC_DEFINE(HAVE_SIGWAIT),
1122                       AC_CHECK_LIB(c, sigwait,
1123                       AC_DEFINE(HAVE_SIGWAIT),
1124                       AC_CHECK_LIB(pthread, sigwait,
1125                                    AC_DEFINE(HAVE_SIGWAIT),
1126                                    AC_CHECK_LIB(pthread, _Psigwait,
1127                                                 AC_DEFINE(HAVE_SIGWAIT),))))
1129         AC_CHECK_FUNC(pthread_attr_getstacksize,
1130                       AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
1132         AC_CHECK_FUNC(pthread_attr_setstacksize,
1133                       AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
1135         AC_ARG_WITH(locktype,
1136                 [  --with-locktype=ARG     Specify mutex lock type (adaptive or standard)],
1137                 locktype="$withval", locktype="adaptive")
1139         case "$locktype" in
1140                 adaptive)
1141                         AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1143                         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1144                           #define _GNU_SOURCE
1145                           #include <pthread.h>
1146                         ]], [[
1147                           return (PTHREAD_MUTEX_ADAPTIVE_NP);
1148                         ]])],
1149                         [ AC_MSG_RESULT(using adaptive lock type)
1150                           AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1151                                     [Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
1152                         [ AC_MSG_RESULT(using standard lock type) ])
1153                         ;;
1154                 standard)
1155                         AC_MSG_RESULT(using standard lock type)
1156                         ;;
1157                 *)
1158                         AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])
1159                         ;;
1160         esac
1162         AC_CHECK_HEADERS(sched.h)
1164         case "$host" in
1165         *solaris-*)
1166                 AC_CHECK_LIB(rt, sched_yield)
1167                 ;;
1168         esac
1170         AC_CHECK_FUNCS(sched_yield pthread_yield pthread_yield_np)
1172         #
1173         # Additional OS-specific issues related to pthreads and sigwait.
1174         #
1175         case "$host" in
1176                 #
1177                 # One more place to look for sigwait.
1178                 #
1179                 *-freebsd*)
1180                         AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
1181                         case $host in
1182                         *-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
1183                         *-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
1184                                 AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1185                                 ;;
1186                         *-freebsd6.*)
1187                                 AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
1188                                 ;;
1189                         esac
1190                         ;;
1191                 #
1192                 # BSDI 3.0 through 4.0.1 needs pthread_init() to be
1193                 # called before certain pthreads calls.  This is deprecated
1194                 # in BSD/OS 4.1.
1195                 #
1196                 *-bsdi3.*|*-bsdi4.0*)
1197                         AC_DEFINE(NEED_PTHREAD_INIT)
1198                         ;;
1199                 #
1200                 # LinuxThreads requires some changes to the way we
1201                 # deal with signals.
1202                 #
1203                 *-linux*)
1204                         AC_DEFINE(HAVE_LINUXTHREADS)
1205                         ;;
1206                 #
1207                 # Ensure the right sigwait() semantics on Solaris and make
1208                 # sure we call pthread_setconcurrency.
1209                 #
1210                 *-solaris*)
1211                         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1212                         AC_CHECK_FUNC(pthread_setconcurrency,
1213                                       AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
1214                         ;;
1215                 #
1216                 # UnixWare does things its own way.
1217                 #
1218                 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1219                         AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
1220                         ;;
1221         esac
1223         #
1224         # Look for sysconf to allow detection of the number of processors.
1225         #
1226         AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
1228 else
1229         ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
1230         thread_dir=nothreads
1231         THREADOPTOBJS=""
1232         THREADOPTSRCS=""
1233         ALWAYS_DEFINES=""
1236 AC_SUBST(ALWAYS_DEFINES)
1237 AC_SUBST(ISC_PLATFORM_USETHREADS)
1238 AC_SUBST(THREADOPTOBJS)
1239 AC_SUBST(THREADOPTSRCS)
1240 ISC_THREAD_DIR=$thread_dir
1241 AC_SUBST(ISC_THREAD_DIR)
1243 AC_MSG_CHECKING(for libtool)
1244 AC_ARG_WITH(libtool,
1245             [  --with-libtool          use GNU libtool],
1246             use_libtool="$withval", use_libtool="no")
1248 case $use_libtool in
1249         yes)
1250                 AC_MSG_RESULT(yes)
1251                 AM_PROG_LIBTOOL
1252                 O=lo
1253                 A=la
1254                 LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1255                 LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
1256                 LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
1257                 LIBTOOL_MODE_LINK='--mode=link --tag=CC'
1258                 INSTALL_LIBRARY='${INSTALL_PROGRAM}'
1259                 case "$host" in
1260                 *) LIBTOOL_ALLOW_UNDEFINED= ;;
1261                 esac
1262                 case "$host" in
1263                 *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1264                 *) LIBTOOL_IN_MAIN= ;;
1265                 esac;
1266                 ;;
1267         *)
1268                 AC_MSG_RESULT(no)
1269                 O=o
1270                 A=a
1271                 LIBTOOL=
1272                 AC_SUBST(LIBTOOL)
1273                 LIBTOOL_MKDEP_SED=
1274                 LIBTOOL_MODE_COMPILE=
1275                 LIBTOOL_MODE_INSTALL=
1276                 LIBTOOL_MODE_LINK=
1277                 LIBTOOL_ALLOW_UNDEFINED=
1278                 LIBTOOL_IN_MAIN=
1279                 INSTALL_LIBRARY='${INSTALL_DATA}'
1280                 ;;
1281 esac
1282 AC_SUBST(INSTALL_LIBRARY)
1285 # was --enable-native-pkcs11 specified?
1286 #  (note it implies both --without-openssl and --with-pkcs11)
1288 AC_ARG_ENABLE(native-pkcs11,
1289         [  --enable-native-pkcs11  use native PKCS11 for all crypto [[default=no]]],
1290         want_native_pkcs11="$enableval", want_native_pkcs11="no")
1293 # was --with-openssl specified?
1295 AC_ARG_WITH(openssl,
1296 [  --with-openssl[=PATH]     Build with OpenSSL [yes|no|path].
1297                           (Crypto is required for DNSSEC)],
1298     use_openssl="$withval", use_openssl="auto")
1301 # was --with-pkcs11 specified?
1303 AC_ARG_WITH(pkcs11,
1304 [  --with-pkcs11[=PATH]      Build with PKCS11 support [yes|no|path]
1305                           (PATH is for the PKCS11 provider)],
1306    use_pkcs11="$withval", use_pkcs11="auto")
1309 # were --with-ecdsa, --with-gost, --with-aes specified
1311 AC_ARG_WITH(ecdsa, [  --with-ecdsa            Crypto ECDSA],
1312             with_ecdsa="$withval", with_ecdsa="auto")
1313 AC_ARG_WITH(gost, [  --with-gost             Crypto GOST [yes|no|raw|asn1].],
1314             with_gost="$withval", with_gost="auto")
1315 AC_ARG_WITH(aes, [  --with-aes              Crypto AES],
1316             with_aes="$withval", with_aes="checksit")
1319 # was --enable-openssl-hash specified?
1321 AC_ARG_ENABLE(openssl-hash,
1322         [  --enable-openssl-hash   use OpenSSL for hash functions [[default=no]]],
1323         want_openssl_hash="$enableval", want_openssl_hash="checksit")
1326 # Enable Source Identity Token support
1328 AC_MSG_CHECKING(for Source Identity Token support)
1329 AC_ARG_ENABLE(sit,
1330         [  --enable-sit            enable source identity token [[default=no]]],
1331         enable_sit="$enableval", enable_sit="no")
1332 HAVE_SIT=
1333 ISC_PLATFORM_USESIT="#undef ISC_PLATFORM_USESIT"
1335 case "$enable_sit" in
1336 yes)
1337         AC_MSG_RESULT(yes)
1338         ISC_PLATFORM_USESIT="#define ISC_PLATFORM_USESIT 1"
1339         HAVE_SIT=1
1340         ;;
1342         AC_MSG_RESULT(no)
1343         ;;
1345         AC_MSG_ERROR("enable-sit requires yes or no")
1346         ;;
1347 esac
1348 AC_SUBST(ISC_PLATFORM_USESIT)
1349 AC_SUBST(HAVE_SIT)
1352 # Source Identity Token algorithm choice
1354 AC_ARG_WITH(sit-alg,
1355         [  --with-sit-alg=ALG      choose the algorithm for SIT [[aes|sha1|sha256]]],
1356         with_sit_alg="$withval", with_sit_alg="auto")
1358 if test "$enable_sit" = "yes"
1359 then
1360         case $with_sit_alg in
1361                 *1)
1362                         with_sit_alg="sha1"
1363                         ;;
1364                 *2*)
1365                         with_sit_alg="sha256"
1366                         ;;
1367                 auto)
1368                         if test "$with_aes" != "no"
1369                         then
1370                                 with_aes="yes"
1371                         fi
1372                         ;;
1373                 *)
1374                         with_sit_alg="aes"
1375                         if test "$with_aes" != "no"
1376                         then
1377                                 with_aes="yes"
1378                         fi
1379                         ;;
1380         esac
1382 if test "with_aes" = "checksit"
1383 then
1384         with_aes="no"
1387 AC_MSG_CHECKING(for OpenSSL library)
1388 OPENSSL_WARNING=
1389 openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
1390 if test "$use_openssl" = "auto"
1391 then
1392         if test "$want_native_pkcs11" = "yes"
1393         then
1394                 use_openssl="native_pkcs11"
1395         else
1396                 for d in $openssldirs
1397                 do
1398                         if test -f $d/include/openssl/opensslv.h
1399                         then
1400                                 use_openssl=$d
1401                                 break
1402                         fi
1403                 done
1404         fi
1406 OPENSSL_ECDSA=""
1407 OPENSSL_GOST=""
1408 gosttype="raw"
1409 case "$with_gost" in
1410         raw)
1411                 with_gost="yes"
1412                 ;;
1413         asn1)
1414                 AC_DEFINE(PREFER_GOSTASN1, 1,
1415                           [Define if GOST private keys are encoded in ASN.1.])
1416                 gosttype="asn1"
1417                 with_gost="yes"
1418                 ;;
1419         auto|yes|no)
1420                 ;;
1421         *)
1422                 AC_MSG_ERROR(unknown GOST private key encoding)
1423                 ;;
1424 esac
1426 case "$use_openssl" in
1427         native_pkcs11)
1428                 AC_MSG_RESULT(disabled because of native PKCS11)
1429                 DST_OPENSSL_INC=""
1430                 CRYPTO="-DPKCS11CRYPTO"
1431                 OPENSSLGOSTLINKOBJS=""
1432                 OPENSSLGOSTLINKSRS=""
1433                 OPENSSLLINKOBJS=""
1434                 OPENSSLLINKSRCS=""
1435                 ;;
1436         no)
1437                 AC_MSG_RESULT(no)
1438                 DST_OPENSSL_INC=""
1439                 CRYPTO=""
1440                 OPENSSLGOSTLINKOBJS=""
1441                 OPENSSLGOSTLINKSRS=""
1442                 OPENSSLLINKOBJS=""
1443                 OPENSSLLINKSRCS=""
1444                 ;;
1445         auto)
1446                 DST_OPENSSL_INC=""
1447                 CRYPTO=""
1448                 OPENSSLGOSTLINKOBJS=""
1449                 OPENSSLGOSTLINKSRS=""
1450                 OPENSSLLINKOBJS=""
1451                 OPENSSLLINKSRCS=""
1452                 AC_MSG_ERROR(
1453 [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
1454 If you don't want OpenSSL, use --without-openssl])
1455                 ;;
1456         *)
1457                 if test "$want_native_pkcs11" = "yes"
1458                 then
1459                         AC_MSG_RESULT()
1460                         AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.])
1461                 fi
1462                 if test "$use_openssl" = "yes"
1463                 then
1464                         # User did not specify a path - guess it
1465                         for d in $openssldirs
1466                         do
1467                                 if test -f $d/include/openssl/opensslv.h
1468                                 then
1469                                         use_openssl=$d
1470                                         break
1471                                 fi
1472                         done
1473                         if test "$use_openssl" = "yes"
1474                         then
1475                                 AC_MSG_RESULT(not found)
1476                                 AC_MSG_ERROR(
1477 [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
1478                         fi
1479                 elif ! test -f "$use_openssl"/include/openssl/opensslv.h
1480                 then
1481                         AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
1482                 fi
1483                 CRYPTO='-DOPENSSL'
1484                 if test "$use_openssl" = "/usr"
1485                 then
1486                         DST_OPENSSL_INC=""
1487                         DST_OPENSSL_LIBS="-lcrypto"
1488                 else
1489                         DST_OPENSSL_INC="-I$use_openssl/include"
1490                         case $host in
1491                         *-solaris*)
1492                                 DST_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
1493                                 ;;
1494                         *-hp-hpux*)
1495                                 DST_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
1496                                 ;;
1497                         *-apple-darwin*)
1498                                 #
1499                                 # Apple's ld seaches for serially for dynamic
1500                                 # then static libraries.  This means you can't
1501                                 # use -L to override dynamic system libraries
1502                                 # with static ones when linking.  Instead
1503                                 # we specify a absolute path.
1504                                 #
1505                                 if test -f "$use_openssl/lib/libcrypto.dylib"
1506                                 then
1507                                         DST_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
1508                                 else
1509                                         DST_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
1510                                 fi
1511                                 ;;
1512                         *)
1513                                 DST_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
1514                                 ;;
1515                         esac
1516                 fi
1517                 AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
1519                 saved_cc="$CC"
1520                 saved_cflags="$CFLAGS"
1521                 saved_libs="$LIBS"
1522                 CFLAGS="$CFLAGS $DST_OPENSSL_INC"
1523                 LIBS="$LIBS $DST_OPENSSL_LIBS"
1524                 AC_MSG_CHECKING(whether linking with OpenSSL works)
1525                 AC_TRY_RUN([
1526 #include <openssl/err.h>
1527 int main() {
1528         ERR_clear_error();
1529         return (0);
1532                 [AC_MSG_RESULT(yes)],
1533                 [AC_MSG_RESULT(no)
1534                  AC_MSG_ERROR(Could not run test program using OpenSSL from
1535 $use_openssl/lib and $use_openssl/include.
1536 Please check the argument to --with-openssl and your
1537 shared library configuration (e.g., LD_LIBRARY_PATH).)],
1538                 [AC_MSG_RESULT(assuming it does work on target platform)])
1540                 AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
1541                 AC_TRY_LINK([
1542 #include <openssl/err.h>],
1543 [ DSO_METHOD_dlfcn(); ],
1544                 [AC_MSG_RESULT(no)],
1545                 [LIBS="$LIBS -ldl"
1546                 AC_TRY_LINK([
1547 #include <openssl/err.h>
1548 ],[ DSO_METHOD_dlfcn(); ],
1549                 [AC_MSG_RESULT(yes)
1550                 DST_OPENSSL_LIBS="$DST_OPENSSL_LIBS -ldl"
1551                 ],
1552                  [AC_MSG_RESULT(unknown)
1553                  AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
1554                 [AC_MSG_RESULT(assuming it does work on target platform)])
1555                 ],
1556                 [AC_MSG_RESULT(assuming it does work on target platform)]
1557                 )
1558                  
1559 AC_ARG_ENABLE(openssl-version-check,
1560 [AC_HELP_STRING([--enable-openssl-version-check],
1561         [check OpenSSL version @<:@default=yes@:>@])])
1562 case "$enable_openssl_version_check" in
1563 yes|'')
1564                 AC_MSG_CHECKING(OpenSSL library version)
1565                 AC_TRY_RUN([
1566 #include <stdio.h>
1567 #include <openssl/opensslv.h>
1568 int main() {
1569         if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
1570              OPENSSL_VERSION_NUMBER < 0x00908000L) ||
1571              OPENSSL_VERSION_NUMBER >= 0x0090804fL)
1572                 return (0);
1573         printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
1574                 OPENSSL_VERSION_NUMBER);
1575         printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
1576                "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
1577         return (1);
1579                 ],
1580                 [AC_MSG_RESULT(ok)],
1581                 [AC_MSG_RESULT(not compatible)
1582                  OPENSSL_WARNING=yes
1583                 ],
1584                 [AC_MSG_RESULT(assuming target platform has compatible version)])
1587         AC_MSG_RESULT(Skipped OpenSSL version check)
1589 esac
1591         AC_MSG_CHECKING(for OpenSSL DSA support)
1592         if test -f $use_openssl/include/openssl/dsa.h
1593         then
1594                 AC_DEFINE(HAVE_OPENSSL_DSA)
1595                 AC_MSG_RESULT(yes)
1596         else
1597                 AC_MSG_RESULT(no)
1598         fi
1600         AC_CHECK_FUNCS(EVP_sha256 EVP_sha384 EVP_sha512)
1602         AC_MSG_CHECKING(for OpenSSL ECDSA support)
1603         have_ecdsa=""
1604         AC_TRY_RUN([
1605 #include <openssl/ecdsa.h>
1606 #include <openssl/objects.h>
1607 int main() {
1608         EC_KEY *ec256, *ec384;
1610 #if !defined(HAVE_EVP_SHA256) || !defined(HAVE_EVP_SHA384)
1611         return (1);
1612 #endif
1613         ec256 = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
1614         ec384 = EC_KEY_new_by_curve_name(NID_secp384r1);
1615         if (ec256 == NULL || ec384 == NULL)
1616                 return (2);
1617         return (0);
1620         [AC_MSG_RESULT(yes)
1621         have_ecdsa="yes"],
1622         [AC_MSG_RESULT(no)
1623         have_ecdsa="no"],
1624         [AC_MSG_RESULT(using --with-ecdsa)])
1625         case "$with_ecdsa" in
1626         yes)
1627             case "$have_ecdsa" in
1628             no)  AC_MSG_ERROR([ecdsa not supported]) ;;
1629             *)  have_ecdsa=yes ;;
1630             esac
1631             ;;
1632         no)
1633             have_ecdsa=no ;;
1634         *)
1635             case "$have_ecdsa" in
1636             yes|no) ;;
1637             *) AC_MSG_ERROR([need --with-ecdsa=[[yes or no]]]) ;;
1638             esac
1639             ;;
1640         esac
1641         case $have_ecdsa in
1642         yes)
1643                 OPENSSL_ECDSA="yes"
1644                 AC_DEFINE(HAVE_OPENSSL_ECDSA, 1,
1645                           [Define if your OpenSSL version supports ECDSA.])
1646                 ;;
1647         *)
1648                 ;;
1649         esac
1651         AC_MSG_CHECKING(for OpenSSL GOST support)
1652         have_gost=""
1653         case "$use_pkcs11" in
1654                 auto|no)
1655                         ;;
1656                 *)
1657                         if $use_threads; then
1658                                 CC="$CC -pthread"
1659                         fi
1660                         ;;
1661         esac
1662         AC_TRY_RUN([
1663 #include <openssl/conf.h>
1664 #include <openssl/engine.h>
1665 int main() {
1666 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
1667         ENGINE *e;
1668         EC_KEY *ek;
1670         ek = NULL;
1671         OPENSSL_config(NULL);
1673         e = ENGINE_by_id("gost");
1674         if (e == NULL)
1675                 return (1);
1676         if (ENGINE_init(e) <= 0)
1677                 return (1);
1678         return (0);
1679 #else
1680         return (1);
1681 #endif
1684         [AC_MSG_RESULT(yes)
1685         have_gost="yes"],
1686         [AC_MSG_RESULT(no)
1687         have_gost="no"],
1688         [AC_MSG_RESULT(using --with-gost)])
1689         case "$with_gost" in
1690         yes)
1691             case "$have_gost" in
1692             no)  AC_MSG_ERROR([gost not supported]) ;;
1693             *)  have_gost=yes ;;
1694             esac
1695             ;;
1696         no)
1697             have_gost=no ;;
1698         *)
1699             case "$have_gost" in
1700             yes|no) ;;
1701             *) AC_MSG_ERROR([need --with-gost=[[yes, no, raw or asn1]]]) ;;
1702             esac
1703             ;;
1704         esac
1705         case $have_gost in
1706         yes)
1707                 OPENSSL_GOST="yes"
1708                 OPENSSLGOSTLINKOBJS='${OPENSSLGOSTLINKOBJS}'
1709                 OPENSSLGOSTLINKSRCS='${OPENSSLGOSTLINKSRCS}'
1710                 AC_DEFINE(HAVE_OPENSSL_GOST, 1,
1711                           [Define if your OpenSSL version supports GOST.])
1712                 ;;
1713         *)
1714                 ;;
1715         esac
1717         have_aes="no"
1718         AC_MSG_CHECKING(for OpenSSL AES support)
1719         AC_TRY_RUN([
1720 #include <openssl/evp.h>
1721 int main() {
1722         EVP_CIPHER *aes128, *aes192, *aes256;
1724         aes128 = EVP_aes_128_ecb();
1725         aes192 = EVP_aes_192_ecb();
1726         aes256 = EVP_aes_256_ecb();
1727         if (aes128 == NULL || aes192 == NULL || aes256 == NULL)
1728                 return (1);
1729         return (0);
1732         [AC_MSG_RESULT(yes)
1733          have_aes="evp"],
1734         [AC_CHECK_FUNC(AES_encrypt,
1735         [AC_MSG_RESULT(yes)
1736          have_aes="yes"],
1737         [AC_MSG_RESULT(no)])],
1738         [AC_MSG_RESULT(using --with-aes)])
1740         ISC_OPENSSL_INC=""
1741         ISC_OPENSSL_LIBS=""
1742         if test "$with_aes" = "yes"
1743         then
1744                 case "$have_aes" in
1745                 evp)
1746                         AC_DEFINE(HAVE_OPENSSL_EVP_AES, 1,
1747                                   [Define if your OpenSSL version supports EVP AES])
1748                         ISC_OPENSSL_INC="$DST_OPENSSL_INC"
1749                         ISC_OPENSSL_LIBS="$DST_OPENSSL_LIBS"
1750                         ;;
1751                 yes)    
1752                         AC_DEFINE(HAVE_OPENSSL_AES, 1,
1753                                   [Define if your OpenSSL version supports AES])
1754                         ISC_OPENSSL_INC="$DST_OPENSSL_INC"
1755                         ISC_OPENSSL_LIBS="$DST_OPENSSL_LIBS"
1756                         ;;
1757                 *)
1758                         ;;
1759                 esac
1760         fi
1762         CC="$saved_cc"
1763         CFLAGS="$saved_cflags"
1764         LIBS="$saved_libs"
1765         OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
1766         OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
1768         ;;
1769 esac
1772 # This would include the system openssl path (and linker options to use
1773 # it as needed) if it is found.
1776 AC_SUBST(DST_OPENSSL_INC)
1777 AC_SUBST(OPENSSLGOSTLINKOBJS)
1778 AC_SUBST(OPENSSLGOSTLINKSRCS)
1779 AC_SUBST(OPENSSLLINKOBJS)
1780 AC_SUBST(OPENSSLLINKSRCS)
1781 AC_SUBST(OPENSSL_ECDSA)
1782 AC_SUBST(OPENSSL_GOST)
1784 DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DST_OPENSSL_LIBS"
1786 ISC_PLATFORM_WANTAES="#undef ISC_PLATFORM_WANTAES"
1787 if test "$with_aes" = "yes"
1788 then
1789         if test "X$CRYPTO" = "X"
1790         then
1791                 with_aes="no"
1792         fi
1794 if test "$with_aes" = "yes"
1795 then
1796         ISC_PLATFORM_WANTAES="#define ISC_PLATFORM_WANTAES 1"
1798 AC_SUBST(ISC_PLATFORM_WANTAES)
1801 # Choose SIT algorithm
1804 if test "$enable_sit" = "yes"
1805 then
1806         AC_MSG_CHECKING(for the Algorithm for SIT)
1807         if test "$with_sit_alg" = "auto"
1808         then
1809                 if test "$with_aes" = "yes"
1810                 then
1811                         with_sit_alg="aes"
1812                 else
1813                         with_sit_alg="sha256"
1814                 fi
1815         fi
1817 case $with_sit_alg in
1818         sha1)
1819                 if test "$enable_sit" != "yes"
1820                 then
1821                         AC_MSG_ERROR("with-sit-alg requires enable-sit");
1822                 fi
1823                 AC_MSG_RESULT(sha1)
1824                 if test "$CRYPTO" = "-DOPENSSL"
1825                 then
1826                         if test "$want_openssl_hash" = "checksit"
1827                         then
1828                                 want_openssl_hash="yes"
1829                         fi
1830                 fi
1831                 AC_DEFINE(HMAC_SHA1_SIT, 1,
1832                           [Use HMAC-SHA1 for Source Identity Token generation])
1833                 ;;
1834         sha256)
1835                 if test "$enable_sit" != "yes"
1836                 then
1837                         AC_MSG_ERROR("with-sit-alg requires enable-sit");
1838                 fi
1839                 AC_MSG_RESULT(sha256)
1840                 if test "$CRYPTO" = "-DOPENSSL"
1841                 then
1842                         if test "$want_openssl_hash" = "checksit"
1843                         then
1844                                 want_openssl_hash="yes"
1845                         fi
1846                 fi
1847                 AC_DEFINE(HMAC_SHA256_SIT, 1,
1848                           [Use HMAC-SHA256 for Source Identity Token generation])
1849                 ;;
1850         aes)
1851                 if test "$enable_sit" != "yes"
1852                 then
1853                         AC_MSG_ERROR("with-sit-alg requires enable-sit");
1854                 fi
1855                 AC_MSG_RESULT(aes)
1856                 if test "$with_aes" != "yes"
1857                 then
1858                         AC_MSG_ERROR("SIT wants to use unavailable AES");
1859                 fi
1860                 AC_DEFINE(AES_SIT, 1,
1861                           [Use AES for Source Identity Token generation])
1862                 ;;
1863 esac
1864 if test "$want_openssl_hash" = "checksit"
1865 then
1866         want_openssl_hash="no"
1870 # Use OpenSSL for hash functions
1873 AC_MSG_CHECKING(for using OpenSSL for hash functions)
1874 ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
1875 case $want_openssl_hash in
1876         yes)
1877                 if test "$CRYPTO" != "-DOPENSSL"
1878                 then
1879                         AC_MSG_ERROR([No OpenSSL for hash functions])
1880                 fi
1881                 AC_MSG_RESULT(yes)
1882                 ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
1883                 ISC_OPENSSL_INC="$DST_OPENSSL_INC"
1884                 ISC_OPENSSL_LIBS="$DST_OPENSSL_LIBS"
1885                 saved_cflags="$CFLAGS"
1886                 save_libs="$LIBS"
1887                 CFLAGS="$CFLAGS $ISC_OPENSSL_INC"
1888                 LIBS="$LIBS $ISC_OPENSSL_LIBS"
1889                 AC_MSG_CHECKING([HMAC_Init() return type])
1890                 AC_TRY_COMPILE([
1891                 #include <openssl/hmac.h>],[
1892                 HMAC_CTX ctx;
1893                 int n = HMAC_Init(&ctx, NULL, 0, NULL);
1894                 n += HMAC_Update(&ctx, NULL, 0);
1895                 n += HMAC_Final(&ctx, NULL, NULL);],[
1896                 AC_MSG_RESULT(int)
1897                 AC_DEFINE(HMAC_RETURN_INT, 1, [HMAC_*() return ints])],[
1898                 AC_MSG_RESULT(void)])
1899                 CFLAGS="$saved_cflags"
1900                 LIBS="$save_libs"
1901                 ;;
1902         no)
1903                 AC_MSG_RESULT(no)
1904                 ;;
1905 esac
1906 AC_SUBST(ISC_PLATFORM_OPENSSLHASH)
1907 AC_SUBST(ISC_OPENSSL_INC)
1908 AC_SUBST(ISC_OPENSSL_LIBS)
1911 # PKCS11 (aka crypto hardware) support (--with moved just after openssl)
1913 AC_MSG_CHECKING(for PKCS11 support)
1915 if test "$use_pkcs11" = "auto"
1916 then
1917         if test "$want_native_pkcs11" = "yes"
1918         then
1919                 use_pkcs11="yes"
1920         else
1921                 use_pkcs11="no"
1922         fi
1925 case "$use_pkcs11" in
1926         no)
1927                 AC_MSG_RESULT(no)
1928                 USE_PKCS11=""
1929                 PKCS11_TEST=""
1930                 PKCS11_TOOLS=""
1931                 ISC_PK11_C=""
1932                 ISC_PK11_O=""
1933                 ISC_PK11_API_C=""
1934                 ISC_PK11_API_O=""
1935                 ISC_PK11_RESULT_C=""
1936                 ISC_PK11_RESULT_O=""
1937                 ISC_ISCPK11_API_C=""
1938                 ISC_ISCPK11_API_O=""
1939                 ;;
1940         yes|*)
1941                 AC_MSG_RESULT(yes)
1942                 if ! $use_threads; then
1943                         AC_MSG_ERROR([PKCS11 requires thread support])
1944                 fi
1945                 if test "$CRYPTO" = "-DOPENSSL"
1946                 then
1947                         AC_MSG_CHECKING(for OpenSSL with PKCS11 support)
1948                         saved_cc="$CC"
1949                         saved_cflags="$CFLAGS"
1950                         saved_libs="$LIBS"
1951                         CC="$CC -pthread"
1952                         CFLAGS="$CFLAGS $DST_OPENSSL_INC"
1953                         LIBS="$LIBS $DST_OPENSSL_LIBS"
1954                         AC_TRY_RUN([
1955 #include <openssl/conf.h>
1956 #include <openssl/engine.h>
1957 int main() {
1958         ENGINE *e;
1960         OPENSSL_config(NULL);
1961         e = ENGINE_by_id("pkcs11");
1962         if (e == NULL)
1963                 return (1);
1964         if (ENGINE_init(e) <= 0)
1965                 return (1);
1966         return (0);
1969                         [AC_MSG_RESULT(yes)
1970                         PKCS11_TEST=pkcs11ssl
1971                         PKCS11_ENGINE='-DPKCS11_ENGINE="\"pkcs11\""'],
1972                         [AC_MSG_RESULT(no)
1973                         PKCS11_TEST=''
1974                         PKCS11_ENGINE='-DPKCS11_ENGINE=NULL'],
1975                         [AC_MSG_RESULT(cross compile, defaulting to no)
1976                         PKCS11_TEST=''
1977                         PKCS11_ENGINE='-DPKCS11_ENGINE=NULL'])
1978                         CC="$saved_cc"
1979                         CFLAGS="$saved_cflags"
1980                         LIBS="$saved_libs"
1981                 else
1982                         PKCS11_TEST=''
1983                         PKCS11_ENGINE='-DPKCS11_ENGINE=NULL'
1985                 fi
1986                 USE_PKCS11='-DUSE_PKCS11'
1987                 PKCS11_TOOLS=pkcs11
1988                 AC_CHECK_FUNC(getpassphrase, AC_DEFINE(HAVE_GETPASSPHRASE),)
1989                 ISC_PK11_C="pk11.c"
1990                 ISC_PK11_O="pk11.$O"
1991                 ISC_PK11_API_C="pk11_api.c"
1992                 ISC_PK11_API_O="pk11_api.$O"
1993                 ISC_PK11_RESULT_C="pk11_result.c"
1994                 ISC_PK11_RESULT_O="pk11_result.$O"
1995                 ISC_ISCPK11_API_C="unix/pk11_api.c"
1996                 ISC_ISCPK11_API_O="unix/pk11_api.$O"
1997                 ;;
1998 esac
1999 AC_SUBST(USE_PKCS11)
2000 AC_SUBST(PKCS11_TOOLS)
2001 AC_SUBST(PKCS11_ENGINE)
2002 AC_SUBST(ISC_PK11_C)
2003 AC_SUBST(ISC_PK11_O)
2004 AC_SUBST(ISC_PK11_API_C)
2005 AC_SUBST(ISC_PK11_API_O)
2006 AC_SUBST(ISC_PK11_RESULT_C)
2007 AC_SUBST(ISC_PK11_RESULT_O)
2008 AC_SUBST(ISC_ISCPK11_API_C)
2009 AC_SUBST(ISC_ISCPK11_API_O)
2011 AC_MSG_CHECKING(for PKCS11 tools)
2012 case "$use_pkcs11" in
2013         no)
2014                 PKCS11_PROVIDER="undefined"
2015                 AC_MSG_RESULT(disabled)
2016                 ;;
2017         yes|'')
2018                 PKCS11_PROVIDER="undefined"
2019                 AC_MSG_RESULT(enabled)
2020                 ;;
2021         *)
2022                 PKCS11_PROVIDER="$use_pkcs11"
2023                 AC_MSG_RESULT([enabled, PKCS11 provider is $PKCS11_PROVIDER])
2024                 ;;
2025 esac
2027 AC_SUBST(PKCS11_PROVIDER)
2029 PKCS11_ECDSA=""
2030 PKCS11_GOST=""
2031 AC_MSG_CHECKING(for native PKCS11)
2033 case "$want_native_pkcs11" in
2034         yes)
2035                 AC_MSG_RESULT(using native PKCS11 crypto)
2036                 PKCS11LINKOBJS='${PKCS11LINKOBJS}'
2037                 PKCS11LINKSRCS='${PKCS11LINKSRCS}'
2038                 PKCS11_TEST=pkcs11
2039                 AC_MSG_CHECKING(for PKCS11 ECDSA)
2040                 case "$with_ecdsa" in
2041                 no)
2042                         AC_MSG_RESULT(disabled)
2043                         ;;
2044                 *)
2045                         AC_MSG_RESULT(enabled)
2046                         PKCS11_ECDSA="yes"
2047                         AC_DEFINE(HAVE_PKCS11_ECDSA, 1,
2048                                   [Define if your PKCS11 provider supports ECDSA.])
2049                         ;;
2050                 esac
2051                 AC_MSG_CHECKING(for PKCS11 GOST)
2052                 case "$with_gost" in
2053                 yes)
2054                         AC_MSG_RESULT(enabled)
2055                         PKCS11_GOST="yes"
2056                         AC_DEFINE(HAVE_PKCS11_GOST, 1,
2057                                   [Define if your PKCS11 provider supports GOST.])
2058                         ;;
2059                 *)
2060                         AC_MSG_RESULT(disabled)
2061                         ;;
2062                 esac
2063                 ;;
2064         no|'')
2065                 AC_MSG_RESULT(disabled)
2066                 ;;
2067 esac
2069 AC_SUBST(PKCS11LINKOBJS)
2070 AC_SUBST(PKCS11LINKSRCS)
2071 AC_SUBST(CRYPTO)
2072 AC_SUBST(PKCS11_ECDSA)
2073 AC_SUBST(PKCS11_GOST)
2074 AC_SUBST(PKCS11_TEST)
2076 # for PKCS11 benchmarks
2078 have_clock_gt=no
2079 AC_CHECK_FUNC(clock_gettime,have_clock_gt=yes,)
2080 if test "$have_clock_gt" = "no"; then
2081         AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=rt,)
2084 if test "$have_clock_gt" != "no"; then
2085         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available.])
2088 if test "$have_clock_gt" = "rt"; then
2089         LIBS="-lrt $LIBS"
2093 # was --with-libxml2 specified?
2095 AC_MSG_CHECKING(for libxml2 library)
2096 AC_ARG_WITH(libxml2,
2097 [  --with-libxml2[=PATH]     build with libxml2 library [yes|no|path]],
2098     use_libxml2="$withval", use_libxml2="auto")
2100 case "$use_libxml2" in
2101         no)
2102                 DST_LIBXML2_INC=""
2103                 ;;
2104         auto|yes)
2105                 case X`(xml2-config --version) 2>/dev/null` in
2106                 X2.[[6789]].*)
2107                         libxml2_libs=`xml2-config --libs`
2108                         libxml2_cflags=`xml2-config --cflags`
2109                         ;;
2110                 *)
2111                         libxml2_libs=
2112                         libxml2_cflags=
2113                         ;;
2114                 esac
2115                 ;;
2116         *)
2117                 if test -f "$use_libxml2/bin/xml2-config" ; then
2118                         libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
2119                         libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
2120                 fi
2121                 ;;
2122 esac
2124 if test "X$libxml2_libs" != "X"
2125 then
2126         CFLAGS="$CFLAGS $libxml2_cflags"
2127         LIBS="$LIBS $libxml2_libs"
2128         #
2129         # Sanity check xml2-config output.
2130         #
2131         AC_TRY_LINK([#include <libxml/xmlwriter.h>],
2132                     [return(xmlTextWriterStartElement(NULL, NULL));],
2133                     AC_MSG_RESULT(yes),
2134                     AC_MSG_ERROR(xml2-config returns badness))
2135         AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
2136 else
2137         AC_MSG_RESULT(no)
2141 # was --with-libjson specified?
2143 AC_MSG_CHECKING(for json library)
2144 AC_ARG_WITH(libjson,
2145 [  --with-libjson[=PATH]     build with libjson0 library [yes|no|path]],
2146     use_libjson="$withval", use_libjson="auto")
2148 have_libjson=""
2149 case "$use_libjson" in
2150         no)
2151                 libjson_libs=""
2152                 ;;
2153         auto|yes)
2154                 for d in /usr /usr/local /opt/local
2155                 do
2156                         if test -f "${d}/include/json/json.h"
2157                         then
2158                                 libjson_cflags="-I ${d}/include/json"
2159                                 if test ${d} != /usr
2160                                 then
2161                                         LIBS="$LIBS -L${d}/lib"
2162                                 fi
2163                                 have_libjson="yes"
2164                         elif test -f "${d}/include/json-c/json.h"
2165                         then
2166                                 libjson_cflags="-I ${d}/include/json-c"
2167                                 if test ${d} != /usr
2168                                 then
2169                                         LIBS="$LIBS -L${d}/lib"
2170                                 fi
2171                                 have_libjson="yes"
2172                         fi
2173                 done
2174                 ;;
2175         *)
2176                 if test -f "${use_libjson}/include/json/json.h"
2177                 then
2178                         libjson_cflags="-I${use_libjson}/include/json"
2179                         LIBS="$LIBS -L${use_libjson}/lib"
2180                         have_libjson="yes"
2181                 elif test -f "${use_libjson}/include/json-c/json.h"
2182                 then
2183                         libjson_cflags="-I${use_libjson}/include/json-c"
2184                         LIBS="$LIBS -L${use_libjson}/lib"
2185                         have_libjson="yes"
2186                 else
2187                         AC_MSG_ERROR([$use_libjson/include/json{,-c}/json.h not found.])
2188                 fi
2189                 ;;
2190 esac
2192 if test "X${have_libjson}" != "X"
2193 then
2194         AC_MSG_RESULT(yes)
2195         AC_SEARCH_LIBS([json_object_new_int64], [json json-c], [],
2196                        [AC_MSG_ERROR([found libjson include but not library.])
2197                         have_libjson=""])
2198 elif test "X$use_libjson" = Xyes
2199 then
2200         AC_MSG_ERROR([include/json{,-c}/json.h not found.])
2201 else
2202         AC_MSG_RESULT(no)
2205 if test "X${have_libjson}" != "X"
2206 then
2207         CFLAGS="$CFLAGS $libjson_cflags"
2208         AC_DEFINE(HAVE_JSON, 1, [Define if libjson was found])
2212 # In solaris 10, SMF can manage named service
2214 AC_CHECK_LIB(scf, smf_enable_instance)
2217 # flockfile is usually provided by pthreads, but we may want to use it
2218 # even if compiled with --disable-threads.  getc_unlocked might also not
2219 # be defined.
2221 AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
2222 AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
2225 # Indicate what the final decision was regarding threads.
2227 AC_MSG_CHECKING(whether to build with threads)
2228 if $use_threads; then
2229         AC_MSG_RESULT(yes)
2230 else
2231         AC_MSG_RESULT(no)
2235 # End of pthreads stuff.
2239 # Large File
2241 AC_ARG_ENABLE(largefile, [  --enable-largefile    64-bit file support],
2242               want_largefile="yes", want_largefile="no")
2243 case $want_largefile in
2244         yes)
2245                 ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
2246                 ;;
2247         *)
2248                 ;;
2249 esac
2252 # Additional compiler settings.
2254 MKDEPCC="$CC"
2255 MKDEPCFLAGS="-M"
2256 IRIX_DNSSEC_WARNINGS_HACK=""
2258 if test "X$GCC" = "Xyes"; then
2259         STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
2260         AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
2261         SAVE_CFLAGS="$CFLAGS"
2262         CFLAGS="$CFLAGS -fno-strict-aliasing"
2263         AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
2264         CFLAGS="$SAVE_CFLAGS"
2265         if test "$FNOSTRICTALIASING" = "yes"; then
2266                 AC_MSG_RESULT(yes)
2267                 STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"
2268         else
2269                 AC_MSG_RESULT(no)
2270         fi
2271         #
2272         # turn off delete null pointer checks
2273         #
2274         AC_MSG_CHECKING(if "$CC" supports -fno-delete-null-pointer-checks)
2275         SAVE_CFLAGS="$CFLAGS"
2276         CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
2277         AC_TRY_COMPILE(,, [FNODELETENULLPOINTERCHECKS=yes],
2278                           [FNODELETENULLPOINTERCHECKS=no])
2279         CFLAGS="$SAVE_CFLAGS"
2280         if test "$FNODELETENULLPOINTERCHECKS" = "yes"; then
2281                 AC_MSG_RESULT(yes)
2282                 STD_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"
2283         else
2284                 AC_MSG_RESULT(no)
2285         fi
2286         case "$host" in
2287         *-hp-hpux*)
2288                 CFLAGS="$CFLAGS -Wl,+vnocompatwarnings"
2289                 BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings"
2290                 ;;
2291         esac
2292         if test "X$enable_warn_shadow" = Xyes; then
2293                 STD_CWARNINGS="$STD_CWARNINGS -Wshadow"
2294         fi
2295         if test "X$enable_warn_error" = Xyes; then
2296                 STD_CWARNINGS="$STD_CWARNINGS -Werror"
2297         fi
2298 else
2299         case $host in
2300         *-dec-osf*)
2301                 CC="$CC -std"
2302                 CCOPT="$CCOPT -std"
2303                 CCNOOPT="$CCNOOPT -std"
2304                 MKDEPCC="$CC"
2305                 ;;
2306         *-hp-hpux*)
2307                 CC="$CC -Ae -z"
2308                 # The version of the C compiler that constantly warns about
2309                 # 'const' as well as alignment issues is unfortunately not
2310                 # able to be discerned via the version of the operating
2311                 # system, nor does cc have a version flag.
2312                 case "`$CC +W 123 2>&1`" in
2313                 *Unknown?option*)
2314                         STD_CWARNINGS="+w1"
2315                         ;;
2316                 *)
2317                         # Turn off the pointlessly noisy warnings.
2318                         STD_CWARNINGS="+w1 +W 474,530,2193,2236"
2319                         ;;
2320                 esac
2321                 CCOPT="$CCOPT -Ae -z"
2322                 CCNOOPT="$CCNOOPT -Ae -z"
2323                 CFLAGS="$CFLAGS -Wl,+vnocompatwarnings"
2324                 BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings"
2325                 MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
2326                 ;;
2327         *-sgi-irix*)
2328                 STD_CWARNINGS="-fullwarn -woff 1209"
2329                 #
2330                 # Silence more than 250 instances of
2331                 #   "prototyped function redeclared without prototype"
2332                 # and 11 instances of
2333                 #   "variable ... was set but never used"
2334                 # from lib/dns/sec/openssl.
2335                 #
2336                 IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
2337                 ;;
2338         *-solaris*)
2339                 MKDEPCFLAGS="-xM"
2340                 ;;
2341         *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
2342                 # UnixWare
2343                 CC="$CC -w"
2344                 ;;
2345         esac
2348 AC_SUBST(MKDEPCC)
2349 AC_SUBST(MKDEPCFLAGS)
2350 AC_SUBST(MKDEPPROG)
2351 AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
2354 # NLS
2356 AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
2359 # -lxnet buys us one big porting headache...  standards, gotta love 'em.
2361 # AC_CHECK_LIB(xnet, socket, ,
2362 #    AC_CHECK_LIB(socket, socket)
2363 # )
2365 # Use this for now, instead:
2367 case "$host" in
2368         mips-sgi-irix*)
2369                 ;;
2370         *-linux*)
2371                 ;;
2372         *)
2373                 AC_CHECK_LIB(socket, socket)
2374                 AC_CHECK_LIB(nsl, inet_addr)
2375                 ;;
2376 esac
2379 # Work around Solaris's select() limitations.
2381 case "$host" in
2382         *-solaris2.[[89]]|*-solaris2.1?)
2383         AC_DEFINE(FD_SETSIZE, 65536,
2384                   [Solaris hack to get select_large_fdset.])
2385         ;;
2386 esac
2389 # Purify support
2391 AC_MSG_CHECKING(whether to use purify)
2392 AC_ARG_WITH(purify,
2393         [  --with-purify[=PATH]      use Rational purify],
2394         use_purify="$withval", use_purify="no")
2396 case "$use_purify" in
2397         no)
2398                 ;;
2399         yes)
2400                 AC_PATH_PROG(purify_path, purify, purify)
2401                 ;;
2402         *)
2403                 purify_path="$use_purify"
2404                 ;;
2405 esac
2407 case "$use_purify" in
2408         no)
2409                 AC_MSG_RESULT(no)
2410                 PURIFY=""
2411                 ;;
2412         *)
2413                 if test -f $purify_path || test $purify_path = purify; then
2414                         AC_MSG_RESULT($purify_path)
2415                         PURIFYFLAGS="`echo $PURIFYOPTIONS`"
2416                         PURIFY="$purify_path $PURIFYFLAGS"
2417                 else
2418                         AC_MSG_ERROR([$purify_path not found.
2420 Please choose the proper path with the following command:
2422     configure --with-purify=PATH
2424                 fi
2425                 ;;
2426 esac
2428 AC_SUBST(PURIFY)
2431 # Google/Great Performance Tools CPU Profiler
2433 AC_MSG_CHECKING(whether to use gperftools profiler)
2434 AC_ARG_WITH(gperftools-profiler,
2435         [  --with-gperftools-profiler  use gperftools CPU profiler],
2436         use_profiler="$withval", use_profiler="no")
2438 case $use_profiler in
2439         yes)
2440                 AC_MSG_RESULT(yes)
2441                 AC_DEFINE([HAVE_GPERFTOOLS_PROFILER], 1,
2442                 [Define to use gperftools CPU profiler.])
2443                 LIBS="$LIBS -lprofiler"
2444                 ;;
2445         *)
2446                 AC_MSG_RESULT(no)
2447                 ;;
2448 esac
2451 # enable/disable dumping stack backtrace.  Also check if the system supports
2452 # glibc-compatible backtrace() function.
2454 AC_ARG_ENABLE(backtrace,
2455 [  --enable-backtrace      log stack backtrace on abort [[default=yes]]],
2456               want_backtrace="$enableval",  want_backtrace="yes")
2457 case $want_backtrace in
2458 yes)
2459         ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
2460         AC_TRY_LINK([#include <execinfo.h>],
2461         [return (backtrace((void **)0, 0));],
2462         [AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
2463         ;;
2465         ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
2466         ;;
2467 esac
2468 AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
2470 AC_ARG_ENABLE(symtable,
2471 [  --enable-symtable       use internal symbol table for backtrace
2472                           [[all|minimal(default)|none]]],
2473                 want_symtable="$enableval",  want_symtable="minimal")
2474 case $want_symtable in
2475 yes|all|minimal)     # "yes" is a hidden value equivalent to "minimal"
2476         if test "$PERL" = ""
2477         then
2478                 AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
2479 Install perl or explicitly disable the feature by --disable-symtable.])
2480         fi
2481         if test "$use_libtool" = "yes"; then
2482                 AC_MSG_WARN([Internal symbol table does not work with libtool.  Disabling symbol table.])
2483         else
2484                 # we generate the internal symbol table only for those systems
2485                 # known to work to avoid unexpected build failure.  Also, warn
2486                 # about unsupported systems when the feature is enabled
2487                 #  manually.
2488                 case $host_os in
2489                 freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
2490                         MKSYMTBL_PROGRAM="$PERL"
2491                         if test $want_symtable = all; then
2492                                 ALWAYS_MAKE_SYMTABLE="yes"
2493                         fi
2494                         ;;
2495                 *)
2496                         if test $want_symtable = yes -o $want_symtable = all
2497                         then
2498                                 AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
2499                         fi
2500                 esac
2501         fi
2502         ;;
2504         ;;
2505 esac
2506 AC_SUBST(MKSYMTBL_PROGRAM)
2507 AC_SUBST(ALWAYS_MAKE_SYMTABLE)
2510 # File name extension for static archive files, for those few places
2511 # where they are treated differently from dynamic ones.
2513 SA=a
2515 AC_SUBST(O)
2516 AC_SUBST(A)
2517 AC_SUBST(SA)
2518 AC_SUBST(LIBTOOL_MKDEP_SED)
2519 AC_SUBST(LIBTOOL_MODE_COMPILE)
2520 AC_SUBST(LIBTOOL_MODE_INSTALL)
2521 AC_SUBST(LIBTOOL_MODE_LINK)
2522 AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
2523 AC_SUBST(LIBTOOL_IN_MAIN)
2525 BIND9_CO_RULE=".c.$O:"
2526 AC_SUBST(BIND9_CO_RULE)
2529 # Here begins a very long section to determine the system's networking
2530 # capabilities.  The order of the tests is significant.
2534 # IPv6
2536 AC_ARG_ENABLE(ipv6,
2537         [  --enable-ipv6           use IPv6 [default=autodetect]])
2539 case "$enable_ipv6" in
2540         yes|''|autodetect)
2541                 AC_DEFINE(WANT_IPV6)
2542                 ;;
2543         no)
2544                 ;;
2545 esac
2548 # We do the IPv6 compilation checking after libtool so that we can put
2549 # the right suffix on the files.
2551 AC_MSG_CHECKING(for IPv6 structures)
2552 AC_TRY_COMPILE([
2553 #include <sys/types.h>
2554 #include <sys/socket.h>
2555 #include <netinet/in.h>],
2556 [struct sockaddr_in6 sin6; return (0);],
2557         [AC_MSG_RESULT(yes)
2558          found_ipv6=yes],
2559         [AC_MSG_RESULT(no)
2560          found_ipv6=no])
2563 # See whether IPv6 support is provided via a Kame add-on.
2564 # This is done before other IPv6 linking tests to LIBS is properly set.
2566 AC_MSG_CHECKING(for Kame IPv6 support)
2567 AC_ARG_WITH(kame,
2568         [  --with-kame[=PATH]     use Kame IPv6 [default path /usr/local/v6]],
2569         use_kame="$withval", use_kame="no")
2571 case "$use_kame" in
2572         no)
2573                 ;;
2574         yes)
2575                 kame_path=/usr/local/v6
2576                 ;;
2577         *)
2578                 kame_path="$use_kame"
2579                 ;;
2580 esac
2582 case "$use_kame" in
2583         no)
2584                 AC_MSG_RESULT(no)
2585                 ;;
2586         *)
2587                 if test -f $kame_path/lib/libinet6.a; then
2588                         AC_MSG_RESULT($kame_path/lib/libinet6.a)
2589                         LIBS="-L$kame_path/lib -linet6 $LIBS"
2590                 else
2591                         AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
2593 Please choose the proper path with the following command:
2595     configure --with-kame=PATH
2597                 fi
2598                 ;;
2599 esac
2602 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
2603 # Including it on Kame-using platforms is very bad, though, because
2604 # Kame uses #error against direct inclusion.   So include it on only
2605 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
2606 # This is done before the in6_pktinfo check because that's what
2607 # netinet6/in6.h is needed for.
2609 changequote({, })
2610 case "$host" in
2611 *-bsdi4.[01]*)
2612         ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
2613         LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
2614         isc_netinet6in6_hack="#include <netinet6/in6.h>"
2615         ;;
2617         ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
2618         LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
2619         isc_netinet6in6_hack=""
2620         ;;
2621 esac
2622 changequote([, ])
2625 # This is similar to the netinet6/in6.h issue.
2627 case "$host" in
2628 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
2629         # UnixWare
2630         ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
2631         LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
2632         ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
2633         isc_netinetin6_hack="#include <netinet/in6.h>"
2634         ;;
2636         ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
2637         LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
2638         ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
2639         isc_netinetin6_hack=""
2640         ;;
2641 esac
2644 # Now delve deeper into the suitability of the IPv6 support.
2646 case "$found_ipv6" in
2647         yes)
2648                 ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
2649                 LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
2651                 AC_MSG_CHECKING(for in6_addr)
2652                 AC_TRY_COMPILE([
2653 #include <sys/types.h>
2654 #include <sys/socket.h>
2655 #include <netinet/in.h>
2656 $isc_netinetin6_hack
2657 $isc_netinet6in6_hack
2659 [struct in6_addr in6; return (0);],
2660                 [AC_MSG_RESULT(yes)
2661                  ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
2662                  LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
2663                  isc_in_addr6_hack=""],
2664                 [AC_MSG_RESULT(no)
2665                  ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
2666                  LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
2667                  isc_in_addr6_hack="#define in6_addr in_addr6"])
2669                 AC_MSG_CHECKING(for in6addr_any)
2670                 AC_TRY_LINK([
2671 #include <sys/types.h>
2672 #include <sys/socket.h>
2673 #include <netinet/in.h>
2674 $isc_netinetin6_hack
2675 $isc_netinet6in6_hack
2676 $isc_in_addr6_hack
2678                 [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
2679                         [AC_MSG_RESULT(yes)
2680                          ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
2681                          LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
2682                         [AC_MSG_RESULT(no)
2683                          ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
2684                          LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
2686                 AC_MSG_CHECKING(for in6addr_loopback)
2687                 AC_TRY_LINK([
2688 #include <sys/types.h>
2689 #include <sys/socket.h>
2690 #include <netinet/in.h>
2691 $isc_netinetin6_hack
2692 $isc_netinet6in6_hack
2693 $isc_in_addr6_hack
2695                 [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
2696                         [AC_MSG_RESULT(yes)
2697                          ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
2698                          LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
2699                         [AC_MSG_RESULT(no)
2700                          ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
2701                          LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
2703                 AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
2704                 AC_TRY_COMPILE([
2705 #include <sys/types.h>
2706 #include <sys/socket.h>
2707 #include <netinet/in.h>
2708 $isc_netinetin6_hack
2709 $isc_netinet6in6_hack
2711                 [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
2712                         [AC_MSG_RESULT(yes)
2713                          ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
2714                          result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
2715                         [AC_MSG_RESULT(no)
2716                          ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
2717                          result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
2718                 LWRES_HAVE_SIN6_SCOPE_ID="$result"
2720                 AC_MSG_CHECKING(for in6_pktinfo)
2721                 AC_TRY_COMPILE([
2722 #include <sys/types.h>
2723 #include <sys/socket.h>
2724 #include <netinet/in.h>
2725 $isc_netinetin6_hack
2726 $isc_netinet6in6_hack
2728                 [struct in6_pktinfo xyzzy; return (0);],
2729                         [AC_MSG_RESULT(yes)
2730                          ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
2731                         [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
2732                          ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
2733                 ;;
2734         no)
2735                 ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
2736                 LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
2737                 ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
2738                 LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
2739                 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
2740                 LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
2741                 ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
2742                 ISC_IPV6_H="ipv6.h"
2743                 ISC_IPV6_O="ipv6.$O"
2744                 ISC_ISCIPV6_O="unix/ipv6.$O"
2745                 ISC_IPV6_C="ipv6.c"
2746                 ;;
2747 esac
2749 AC_MSG_CHECKING(for struct sockaddr_storage)
2750 AC_TRY_COMPILE([
2751 #include <sys/types.h>
2752 #include <sys/socket.h>
2753 $isc_netinetin6_hack
2754 $isc_netinet6in6_hack
2756 [struct sockaddr_storage storage; return (0);],
2757 [AC_MSG_RESULT(yes)
2758 ISC_PLATFORM_HAVESOCKADDRSTORAGE="#define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1"],
2759 [AC_MSG_RESULT(no)
2760 ISC_PLATFORM_HAVESOCKADDRSTORAGE="#undef ISC_PLATFORM_HAVESOCKADDRSTORAGE"])
2762 AC_SUBST(ISC_PLATFORM_HAVEIPV6)
2763 AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
2764 AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
2765 AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
2766 AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
2767 AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
2768 AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
2769 AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
2770 AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
2771 AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
2772 AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
2773 AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
2774 AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
2775 AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
2776 AC_SUBST(ISC_PLATFORM_HAVESOCKADDRSTORAGE)
2777 AC_SUBST(ISC_IPV6_H)
2778 AC_SUBST(ISC_IPV6_O)
2779 AC_SUBST(ISC_ISCIPV6_O)
2780 AC_SUBST(ISC_IPV6_C)
2781 AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
2782 AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
2784 AC_MSG_CHECKING([for struct if_laddrreq])
2785 AC_TRY_LINK([
2786 #include <sys/types.h>
2787 #include <net/if6.h>
2788 ],[ struct if_laddrreq a; ],
2789         [AC_MSG_RESULT(yes)
2790         ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
2791         [AC_MSG_RESULT(no)
2792         ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
2793 AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
2795 AC_MSG_CHECKING([for struct if_laddrconf])
2796 AC_TRY_LINK([
2797 #include <sys/types.h>
2798 #include <net/if6.h>
2799 ],[ struct if_laddrconf a; ],
2800         [AC_MSG_RESULT(yes)
2801         ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
2802         [AC_MSG_RESULT(no)
2803         ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
2804 AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
2807 # Check for network functions that are often missing.  We do this
2808 # after the libtool checking, so we can put the right suffix on
2809 # the files.  It also needs to come after checking for a Kame add-on,
2810 # which provides some (all?) of the desired functions.
2813 AC_MSG_CHECKING([for inet_ntop with IPv6 support])
2814 AC_TRY_RUN([
2815 #include <sys/types.h>
2816 #include <sys/socket.h>
2817 #include <netinet/in.h>
2818 #include <arpa/inet.h>
2819 main() {
2820 char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
2821         [AC_MSG_RESULT(yes)
2822         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
2824         [AC_MSG_RESULT(no)
2825         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
2826         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
2827         ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
2828         [AC_MSG_RESULT(assuming inet_ntop not needed)
2829         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
2832 # On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
2833 # addresses with less than four octets, like "1.2.3".  Also leading
2834 # zeros should also be rejected.
2836 AC_MSG_CHECKING([for working inet_pton with IPv6 support])
2837 AC_TRY_RUN([
2838 #include <sys/types.h>
2839 #include <sys/socket.h>
2840 #include <netinet/in.h>
2841 #include <arpa/inet.h>
2842 main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
2843                              inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 : 
2844                              (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
2845         [AC_MSG_RESULT(yes)
2846         ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
2847         [AC_MSG_RESULT(no)
2848         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2849         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2850         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
2851         [AC_MSG_RESULT(assuming inet_pton needed)
2852         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
2853         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
2854         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
2856 AC_SUBST(ISC_PLATFORM_NEEDNTOP)
2857 AC_SUBST(ISC_PLATFORM_NEEDPTON)
2860 # Look for a 4.4BSD-style sa_len member in struct sockaddr.
2862 case "$host" in
2863         *-dec-osf*)
2864                 # Turn on 4.4BSD style sa_len support.
2865                 AC_DEFINE(_SOCKADDR_LEN)
2866                 ;;
2867 esac
2869 AC_MSG_CHECKING(for sa_len in struct sockaddr)
2870 AC_TRY_COMPILE([
2871 #include <sys/types.h>
2872 #include <sys/socket.h>],
2873 [struct sockaddr sa; sa.sa_len = 0; return (0);],
2874         [AC_MSG_RESULT(yes)
2875         ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
2876         LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
2877         [AC_MSG_RESULT(no)
2878         ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
2879         LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
2880 AC_SUBST(ISC_PLATFORM_HAVESALEN)
2881 AC_SUBST(LWRES_PLATFORM_HAVESALEN)
2884 # Look for a 4.4BSD or 4.3BSD struct msghdr
2886 AC_MSG_CHECKING(for struct msghdr flavor)
2887 AC_TRY_COMPILE([
2888 #include <sys/types.h>
2889 #include <sys/socket.h>],
2890 [struct msghdr msg; msg.msg_flags = 0; return (0);],
2891         [AC_MSG_RESULT(4.4BSD)
2892         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
2893         [AC_MSG_RESULT(4.3BSD)
2894         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
2895 AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
2898 # Look for in_port_t.
2900 AC_MSG_CHECKING(for type in_port_t)
2901 AC_TRY_COMPILE([
2902 #include <sys/types.h>
2903 #include <netinet/in.h>],
2904 [in_port_t port = 25; return (0);],
2905         [AC_MSG_RESULT(yes)
2906         ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
2907         [AC_MSG_RESULT(no)
2908         ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
2909 AC_SUBST(ISC_PLATFORM_NEEDPORTT)
2912 # Check for addrinfo
2914 AC_MSG_CHECKING(for struct addrinfo)
2915 AC_TRY_COMPILE([
2916 #include <netdb.h>],
2917 [struct addrinfo a; return (0);],
2918         [AC_MSG_RESULT(yes)
2919         ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
2920         ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
2921         AC_DEFINE(HAVE_ADDRINFO)],
2922         [AC_MSG_RESULT(no)
2923         ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
2924         ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
2925 AC_SUBST(ISC_LWRES_NEEDADDRINFO)
2926 AC_SUBST(ISC_IRS_NEEDADDRINFO)
2929 # Check for rrsetinfo
2931 AC_MSG_CHECKING(for struct rrsetinfo)
2932 AC_TRY_COMPILE([
2933 #include <netdb.h>],
2934 [struct rrsetinfo r; return (0);],
2935         [AC_MSG_RESULT(yes)
2936         ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
2937         [AC_MSG_RESULT(no)
2938         ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
2939 AC_SUBST(ISC_LWRES_NEEDRRSETINFO)
2941 AC_MSG_CHECKING(for int sethostent)
2942 AC_TRY_COMPILE([
2943 #include <netdb.h>],
2944 [int i = sethostent(0); return(0);],
2945         [AC_MSG_RESULT(yes)
2946         ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
2947         [AC_MSG_RESULT(no)
2948         ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
2949 AC_SUBST(ISC_LWRES_SETHOSTENTINT)
2951 AC_MSG_CHECKING(for int endhostent)
2952 AC_TRY_COMPILE([
2953 #include <netdb.h>],
2954 [int i = endhostent(); return(0);],
2955         [AC_MSG_RESULT(yes)
2956         ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
2957         [AC_MSG_RESULT(no)
2958         ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
2959 AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
2961 AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
2962 AC_TRY_COMPILE([
2963 #include <netdb.h>
2964 struct netent *getnetbyaddr(in_addr_t, int);],
2966         [AC_MSG_RESULT(yes)
2967         ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
2968         [AC_MSG_RESULT(no)
2969         ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
2970 AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
2972 AC_MSG_CHECKING(for int setnetent)
2973 AC_TRY_COMPILE([
2974 #include <netdb.h>],
2975 [int i = setnetent(0); return(0);],
2976         [AC_MSG_RESULT(yes)
2977         ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
2978         [AC_MSG_RESULT(no)
2979         ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
2980 AC_SUBST(ISC_LWRES_SETNETENTINT)
2982 AC_MSG_CHECKING(for int endnetent)
2983 AC_TRY_COMPILE([
2984 #include <netdb.h>],
2985 [int i = endnetent(); return(0);],
2986         [AC_MSG_RESULT(yes)
2987         ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
2988         [AC_MSG_RESULT(no)
2989         ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
2990 AC_SUBST(ISC_LWRES_ENDNETENTINT)
2992 AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
2993 AC_TRY_COMPILE([
2994 #include <netdb.h>
2995 struct hostent *gethostbyaddr(const void *, size_t, int);],
2996 [return(0);],
2997         [AC_MSG_RESULT(yes)
2998         ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
2999         [AC_MSG_RESULT(no)
3000         ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
3001 AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
3003 AC_MSG_CHECKING(for h_errno in netdb.h)
3004 AC_TRY_COMPILE([
3005 #include <netdb.h>],
3006 [h_errno = 1; return(0);],
3007         [AC_MSG_RESULT(yes)
3008         ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
3009         [AC_MSG_RESULT(no)
3010         ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
3011 AC_SUBST(ISC_LWRES_NEEDHERRNO)
3014 # Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
3015 # known variations here:
3017 AC_MSG_CHECKING(for getnameinfo prototype definitions)
3018 AC_TRY_COMPILE([
3019 #include <sys/types.h>
3020 #include <sys/socket.h>
3021 #include <netdb.h>
3022 int getnameinfo(const struct sockaddr *, socklen_t, char *,
3023                 socklen_t, char *, socklen_t, unsigned int);],
3024 [ return (0);],
3025         [AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
3026          AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t,
3027                    [Define to the sockaddr length type used by getnameinfo(3).])
3028          AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
3029                    [Define to the buffer length type used by getnameinfo(3).])
3030          AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
3031                    [Define to the flags type used by getnameinfo(3).])],
3032 [AC_TRY_COMPILE([
3033 #include <sys/types.h>
3034 #include <sys/socket.h>
3035 #include <netdb.h>
3036 int getnameinfo(const struct sockaddr *, socklen_t, char *,
3037                 size_t, char *, size_t, int);],
3038 [ return (0);],
3039         [AC_MSG_RESULT(size_t for buflen; int for flags)
3040          AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t)
3041          AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
3042          AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
3043 [AC_TRY_COMPILE([
3044 #include <sys/types.h>
3045 #include <sys/socket.h>
3046 #include <netdb.h>
3047 int getnameinfo(const struct sockaddr *, size_t, char *,
3048                 size_t, char *, size_t, int);],
3049 [ return (0);],
3050         [AC_MSG_RESULT(size_t for buflen; int for flags)
3051          AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, size_t)
3052          AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
3053          AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
3054 [AC_MSG_RESULT(not match any subspecies; assume standard definition)
3055 AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t)
3056 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
3057 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])])
3060 # ...and same for gai_strerror().
3062 AC_MSG_CHECKING(for gai_strerror prototype definitions)
3063 AC_TRY_COMPILE([
3064 #include <sys/types.h>
3065 #include <sys/socket.h>
3066 #include <netdb.h>
3067 char *gai_strerror(int ecode);],
3068 [ return (0); ],
3069         [AC_MSG_RESULT(returning char *)
3070          AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
3071          [return type of gai_strerror])],
3072 [AC_MSG_RESULT(not match any subspecies; assume standard definition)
3073 AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
3075 AC_CHECK_FUNC(getipnodebyname,
3076         [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
3077         [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
3078 AC_CHECK_FUNC(getnameinfo,
3079         [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
3080         [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
3081 AC_CHECK_FUNC(getaddrinfo,
3082         [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
3083         AC_DEFINE(HAVE_GETADDRINFO)],
3084         [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
3085 AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
3086 AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
3087 AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
3088 AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
3089 AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
3091 AC_ARG_ENABLE(getifaddrs,
3092 [  --enable-getifaddrs     enable the use of getifaddrs() [[yes|no]].],
3093     want_getifaddrs="$enableval",  want_getifaddrs="yes")
3096 # This interface iteration code for getifaddrs() will fall back to using
3097 # /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
3098 # addresses.
3100 case $want_getifaddrs in
3101 glibc)
3102 AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
3103 AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
3105 yes)
3106 AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
3110 esac
3113 # Look for a sysctl call to get the list of network interfaces.
3115 case $ac_cv_header_sys_sysctl_h in
3116 yes)
3117 AC_MSG_CHECKING(for interface list sysctl)
3118 AC_EGREP_CPP(found_rt_iflist, [
3119 #include <sys/param.h>
3120 #include <sys/sysctl.h>
3121 #include <sys/socket.h>
3122 #ifdef NET_RT_IFLIST
3123 found_rt_iflist
3124 #endif
3126         [AC_MSG_RESULT(yes)
3127          AC_DEFINE(HAVE_IFLIST_SYSCTL)],
3128         [AC_MSG_RESULT(no)])
3130 esac
3133 # Check for some other useful functions that are not ever-present.
3136 # We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
3137 # because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
3138 # reportedly defines strsep() without declaring it in <string.h> when
3139 # -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
3140 # AC_CHECK_FUNC() incorrectly succeeds because it declares
3141 # the function itself.
3142 AC_MSG_CHECKING(for correctly declared strsep())
3143 AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
3144         [AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
3145         [AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
3146 AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
3148 AC_CHECK_FUNC(memmove,
3149         [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
3150         [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
3151 AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
3153 AC_CHECK_FUNC(strtoul,
3154         [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
3155          LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
3156          GENRANDOMLIB=""],
3157         [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
3158          LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
3159          GENRANDOMLIB='${ISCLIBS}'])
3160 AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
3161 AC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
3162 AC_SUBST(GENRANDOMLIB)
3164 AC_CHECK_FUNC(strlcpy,
3165         [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"
3166          LWRES_PLATFORM_NEEDSTRLCPY="#undef LWRES_PLATFORM_NEEDSTRLCPY"],
3167         [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"
3168          LWRES_PLATFORM_NEEDSTRLCPY="#define LWRES_PLATFORM_NEEDSTRLCPY 1"])
3169 AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
3170 AC_SUBST(LWRES_PLATFORM_NEEDSTRLCPY)
3172 AC_CHECK_FUNC(strlcat,
3173         [ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
3174         [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
3175 AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
3177 AC_CHECK_FUNC(strcasestr,
3178         [ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR"],
3179         [ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1"])
3180 AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR)
3182 AC_SUBST(READLINE_LIB)
3183 AC_ARG_WITH(readline,
3184         [  --with-readline[=LIBSPEC]    specify readline library [default -lreadline]],
3185         readline="$withval", readline="-lreadline")
3186 case "$readline" in
3187 no)     ;;
3189         if test "x$readline" = "xyes"
3190         then
3191                 readline=-lreadline
3192         fi
3193         saved_LIBS="$LIBS"
3194         LIBS="$readline"
3195         AC_CHECK_FUNCS(readline)
3196         if test "$ac_cv_func_readline" = "yes"
3197         then
3198                 READLINE_LIB="$readline"
3199         fi
3200         LIBS="$saved_LIBS"
3201         ;;
3202 esac
3205 ISC_PRINT_OBJS=
3206 ISC_PRINT_SRCS=
3207 AC_MSG_CHECKING(sprintf)
3208 AC_TRY_COMPILE([
3209 #include <stdio.h>
3211 [ char buf[2]; return(*sprintf(buf,"x"));],
3213 ISC_PRINT_OBJS="print.$O"
3214 ISC_PRINT_SRCS="print.c"
3215 ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
3216 LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
3218 [ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
3219  LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
3221 AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
3222 AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
3224 AC_CHECK_FUNC(vsnprintf,
3225         [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
3226          LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
3227         [ISC_PRINT_OBJS="print.$O"
3228          ISC_PRINT_SRCS="print.c"
3229          ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
3230          LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
3231 AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
3232 AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
3233 ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
3234 ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
3236 AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
3238 AC_SUBST(ISC_EXTRA_OBJS)
3239 AC_SUBST(ISC_EXTRA_SRCS)
3242 # Use our own SPNEGO implementation?
3244 AC_ARG_ENABLE(isc-spnego,
3245         [  --disable-isc-spnego    use SPNEGO from GSSAPI library])
3247 if test -n "$USE_GSSAPI"
3248 then
3249         case "$enable_isc_spnego" in
3250                 yes|'')
3251                         USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
3252                         DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
3253                         DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
3254                         AC_MSG_RESULT(using SPNEGO from lib/dns)
3255                         ;;
3256                 no)
3257                         AC_MSG_RESULT(using SPNEGO from GSSAPI library)
3258                         ;;
3259         esac
3262 AC_SUBST(USE_ISC_SPNEGO)
3264 AC_SUBST(DST_EXTRA_OBJS)
3265 AC_SUBST(DST_EXTRA_SRCS)
3267 # Determine the printf format characters to use when printing
3268 # values of type isc_int64_t. This will normally be "ll", but where
3269 # the compiler treats "long long" as a alias for "long" and printf
3270 # doesn't know about "long long" use "l".  Hopefully the sprintf
3271 # will produce a inconsistent result in the later case.  If the compiler
3272 # fails due to seeing "%lld" we fall back to "l".
3274 # Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
3275 # %ld even for (long long)/
3277 # Win32 uses "%I64d", but that's defined elsewhere since we don't use
3278 # configure on Win32.
3280 AC_MSG_CHECKING(printf format modifier for 64-bit integers)
3281 AC_TRY_RUN([
3282 #include <stdio.h>
3283 main() {
3284         long long int j = 0;
3285         char buf[100];
3286         buf[0] = 0;
3287         sprintf(buf, "%lld", j);
3288         exit((sizeof(long long int) != sizeof(long int))? 0 :
3289              (strcmp(buf, "0") != 0));
3292         [AC_MSG_RESULT(ll)
3293         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
3294         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
3295         [AC_MSG_RESULT(l)
3296         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
3297         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
3298         [AC_MSG_RESULT(assuming target platform uses ll)
3299         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
3300         LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
3301 AC_SUBST(ISC_PLATFORM_QUADFORMAT)
3302 AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
3305 # Security Stuff
3307 # Note it is very recommended to *not* disable chroot(),
3308 # this is only because chroot() was made obsolete by Posix.
3309 AC_ARG_ENABLE(chroot,
3310         [  --disable-chroot        disable chroot])
3311 case "$enable_chroot" in
3312         yes|'')
3313                 AC_CHECK_FUNCS(chroot)
3314                 ;;
3315         no)
3316                 ;;
3317 esac
3318 AC_ARG_ENABLE(linux-caps,
3319         [  --disable-linux-caps   disable linux capabilities])
3320 case "$enable_linux_caps" in
3321         yes|'')
3322                 AC_CHECK_HEADERS(linux/types.h)
3323                 AC_CHECK_HEADERS([sys/capability.h])
3324                 AC_CHECK_HEADERS([linux/capability.h], [], [],
3325                                  [#ifdef HAVE_LINUX_TYPES_H
3326                                   #include <linux/types.h>
3327                                   #endif
3328                                  ])
3329                 AC_CHECK_LIB(cap, cap_set_proc)
3330                 ;;
3331         no)
3332                 ;;
3333 esac
3334 AC_CHECK_HEADERS(sys/prctl.h)
3336 AC_CHECK_HEADERS(sys/un.h,
3337 ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
3339 ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
3341 AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
3343 case "$host" in
3344 *-solaris*)
3345         AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
3346                   [Define if connect does not honour the permission on the UNIX domain socket.])
3347         ;;
3348 *-sunos*)
3349         AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
3350                   [Define if connect does not honour the permission on the UNIX domain socket.])
3351         ;;
3352 esac
3355 # Time Zone Stuff
3357 AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
3359 AC_MSG_CHECKING(for optarg declaration)
3360 AC_TRY_COMPILE([
3361 #include <unistd.h>
3363 [optarg = 0;],
3364 [AC_MSG_RESULT(yes)],
3365 [AC_MSG_RESULT(no)
3366 GEN_NEED_OPTARG="-DNEED_OPTARG=1"
3367 AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
3370 # BSD/OS, and perhaps some others, don't define rlim_t.
3372 AC_MSG_CHECKING(for type rlim_t)
3373 AC_TRY_COMPILE([
3374 #include <sys/types.h>
3375 #include <sys/time.h>
3376 #include <sys/resource.h>],
3377 [rlim_t rl = 19671212; return (0);],
3378 [AC_MSG_RESULT(yes)
3379  ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
3380 [AC_MSG_RESULT(no)
3382 AC_MSG_CHECKING(type of rlim_cur)
3383 AC_TRY_RUN([
3384 #include <sys/types.h>
3385 #include <sys/time.h>
3386 #include <sys/resource.h>
3387 main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
3388 [AC_MSG_RESULT(int)
3389 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
3391 AC_TRY_RUN([
3392 #include <sys/types.h>
3393 #include <sys/time.h>
3394 #include <sys/resource.h>
3395 main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
3396 [AC_MSG_RESULT(long int)
3397 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
3399 AC_TRY_RUN([
3400 #include <sys/types.h>
3401 #include <sys/time.h>
3402 #include <sys/resource.h>
3403 main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
3404 [AC_MSG_RESULT(long long int)
3405 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
3406 [AC_MSG_ERROR([unable to determine sizeof rlim_cur])
3407 ],[AC_MSG_ERROR(this cannot happen)])
3408 ],[AC_MSG_ERROR(this cannot happen)])
3410 AC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
3411 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
3412 AC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
3414 AC_SUBST(ISC_PLATFORM_RLIMITTYPE)
3417 # Older HP-UX doesn't have gettune
3419 case "$host" in
3420         *-hp-hpux*)
3421                 AC_CHECK_HEADERS(sys/dyntune.h)
3422                 ;;
3423         *)
3424                 ;;
3425 esac
3429 # Compaq TruCluster requires more code for handling cluster IP aliases
3431 case "$host" in
3432         *-dec-osf*)
3433                 AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
3434                 AC_CHECK_FUNC(clua_getaliasaddress,
3435                                 AC_DEFINE(HAVE_TRUCLUSTER, 1,
3436                                         [Define if running under Compaq TruCluster]))
3437                 ;;
3438         *)
3439                 ;;
3440 esac
3443 # Some hosts need msg_namelen to match the size of the socket structure.
3444 # Some hosts don't set msg_namelen appropriately on return from recvmsg().
3446 case $host in
3447 *os2*|*hp-mpeix*)
3448         AC_DEFINE(BROKEN_RECVMSG, 1,
3449                   [Define if recvmsg() does not meet all of the BSD socket API specifications.])
3450         ;;
3451 esac
3454 # Microsoft has their own way of handling shared libraries that requires
3455 # additional qualifiers on extern variables.  Unix systems don't need it.
3457 AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
3458 ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
3459 AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
3460 LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
3461 AC_SUBST(IRS_PLATFORM_USEDECLSPEC)
3462 IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
3465 # Random remaining OS-specific issues involving compiler warnings.
3466 # XXXDCL print messages to indicate some compensation is being done?
3468 AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
3469 ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
3471 case "$host" in
3472         *-aix5.[[123]].*)
3473                 hack_shutup_pthreadonceinit=yes
3474                 ;;
3475         *-bsdi3.1*)
3476                 hack_shutup_sputaux=yes
3477                 ;;
3478         *-bsdi4.0*)
3479                 hack_shutup_sigwait=yes
3480                 hack_shutup_sputaux=yes
3481                 ;;
3482         [*-bsdi4.[12]*])
3483                 hack_shutup_stdargcast=yes
3484                 ;;
3485         [*-solaris2.[89]])
3486                 hack_shutup_pthreadonceinit=yes
3487                 ;;
3488         *-solaris2.1[[0-9]])
3489                 AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
3490                 ;;
3491 esac
3493 case "$hack_shutup_pthreadonceinit" in
3494         yes)
3495                 #
3496                 # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
3497                 #
3498                 ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
3499                 ;;
3500 esac
3502 case "$hack_shutup_sigwait" in
3503         yes)
3504                 #
3505                 # Shut up a -Wmissing-prototypes warning for sigwait().
3506                 #
3507                 AC_DEFINE(SHUTUP_SIGWAIT)
3508                 ;;
3509 esac
3511 case "$hack_shutup_sputaux" in
3512         yes)
3513                 #
3514                 # Shut up a -Wmissing-prototypes warning from <stdio.h>.
3515                 #
3516                 AC_DEFINE(SHUTUP_SPUTAUX)
3517                 ;;
3518 esac
3520 case "$hack_shutup_stdargcast" in
3521         yes)
3522                 #
3523                 # Shut up a -Wcast-qual warning from va_start().
3524                 #
3525                 AC_DEFINE(SHUTUP_STDARG_CAST)
3526                 ;;
3527 esac
3529 AC_CHECK_HEADERS(strings.h,
3530   ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
3532   ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
3534 AC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
3537 # Check for if_nametoindex() for IPv6 scoped addresses support
3539 AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
3540                 ac_cv_have_if_nametoindex=no)
3541 case $ac_cv_have_if_nametoindex in
3543         case "$host" in
3544         *-hp-hpux*)
3545                 AC_CHECK_LIB(ipv6, if_nametoindex,
3546                                 ac_cv_have_if_nametoindex=yes
3547                                 LIBS="-lipv6 $LIBS",)
3548         ;;
3549         esac
3550 esac
3551 case $ac_cv_have_if_nametoindex in
3552 yes)
3553         ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
3554         AC_DEFINE(HAVE_IF_NAMETOINDEX, 1,
3555                   [Define to 1 if you have the if_nametoindex function.])
3557         ;;
3559         ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
3560         ;;
3561 esac
3562 AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
3564 AC_CHECK_FUNCS(nanosleep usleep)
3567 # Machine architecture dependent features
3569 AC_ARG_ENABLE(atomic,
3570         [  --enable-atomic        enable machine specific atomic operations
3571                           [[default=autodetect]]],
3572                         enable_atomic="$enableval",
3573                         enable_atomic="autodetect")
3574 case "$enable_atomic" in
3575         yes|''|autodetect)
3576                 case "$host" in
3577                 powerpc-ibm-aix*)
3578                         if test "X$GCC" = "Xyes"; then
3579                                 AC_MSG_CHECKING([if asm("isc"); works])
3580                                 AC_TRY_COMPILE(,[
3581                                 main() { asm("ics"); exit(0); }
3582                                 ],
3583                                 [AC_MSG_RESULT(yes)
3584                                  use_atomic=yes],
3585                                 [
3586                                 saved_cflags="$CFLAGS"
3587                                 CFLAGS="$CFLAGS -Wa,-many"
3588                                 AC_TRY_RUN([
3589                                 main() { asm("ics"); exit(0); }
3590                                 ],
3591                                 [AC_MSG_RESULT([yes, required -Wa,-many])
3592                                  use_atomic=yes],
3593                                 [AC_MSG_RESULT([no, use_atomic disabled])
3594                                  CFLAGS="$saved_cflags"
3595                                  use_atomic=no],
3596                                 [AC_MSG_RESULT([cross compile, assume yes])
3597                                  CFLAGS="$saved_cflags"
3598                                  use_atomic=yes])
3599                                 ]
3600                                 )
3601                         else
3602                                 use_atomic=yes
3603                         fi
3604                         ;;
3605                 *)
3606                         use_atomic=yes
3607                         ;;
3608                 esac
3609                 ;;
3610         no)
3611                 use_atomic=no
3612                 arch=noatomic
3613                 ;;
3614 esac
3616 ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
3617 if test "$use_atomic" = "yes"; then
3618         AC_MSG_CHECKING([architecture type for atomic operations])
3619         have_atomic=yes         # set default
3620         case "$host" in
3621         [i[3456]86-*])
3622                 # XXX: some old x86 architectures actually do not support
3623                 #      (some of) these operations.  Do we need stricter checks?
3624                 AC_CHECK_SIZEOF([void *])
3625                 if test $ac_cv_sizeof_void_p = 8; then
3626                         arch=x86_64
3627                         have_xaddq=yes
3628                 else
3629                         arch=x86_32
3630                 fi
3631         ;;
3632         x86_64-*|amd64-*)
3633                 AC_CHECK_SIZEOF([void *])
3634                 if test $ac_cv_sizeof_void_p = 8; then
3635                         arch=x86_64
3636                         have_xaddq=yes
3637                 else
3638                         arch=x86_32
3639                 fi
3640         ;;
3641         alpha*-*)
3642                 arch=alpha
3643         ;;
3644         powerpc-*|powerpc64-*)
3645                 arch=powerpc
3646         ;;
3647         mips-*|mipsel-*|mips64-*|mips64el-*)
3648                 arch=mips
3649         ;;
3650         ia64-*)
3651                 arch=ia64
3652         ;;
3653         *)
3654                 have_atomic=no
3655                 arch=noatomic
3656         ;;
3657         esac
3658         AC_MSG_RESULT($arch)
3661 if test "$have_atomic" = "yes"; then
3662         AC_MSG_CHECKING([compiler support for inline assembly code])
3664         compiler=generic
3665         # Check whether the compiler supports the assembly syntax we provide.
3666         if test "X$GCC" = "Xyes"; then
3667                 # GCC's ASM extension always works
3668                 compiler=gcc
3669                 if test $arch = "x86_64"; then
3670                         # We can share the same code for gcc with x86_32
3671                         arch=x86_32
3672                 fi
3673                 if test $arch = "powerpc"; then
3674                         #
3675                         # The MacOS (and maybe others) uses "r0" for register
3676                         # zero. Under linux/ibm it is "0" for register 0.
3677                         # Probe to see if we have a MacOS style assembler.
3678                         #
3679                         AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
3680                         AC_TRY_COMPILE(, [
3681                         __asm__ volatile ("li r0, 0x0\n"::);
3682                         ], [
3683                         AC_MSG_RESULT(yes)
3684                         compiler="mac"
3685                         ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
3686                         ], [AC_MSG_RESULT(no)])
3687                 fi
3688         else
3689                 case "$host" in
3690                 alpha*-dec-osf*)
3691                         # Tru64 compiler has its own syntax for inline 
3692                         # assembly.
3693                         AC_TRY_COMPILE(, [
3694 #ifndef __DECC
3695 #error "unexpected compiler"
3696 #endif
3697                                 return (0);],
3698                                 [compiler=osf],)
3699                 ;;
3700                 powerpc-ibm-aix*)
3701                         compiler=aix
3702                 ;;
3703                 esac
3704         fi
3705         case "$compiler" in
3706         gcc)
3707                 ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
3708                 ;;
3709         osf)
3710                 ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
3711                 ;;
3712         aix)
3713                 ;;
3714         mac)
3715                 ;;
3716         *)
3717                 # See if the generic __asm function works.  If not,
3718                 # we need to disable the atomic operations.
3719                 AC_TRY_LINK(, [
3720                                         __asm("nop")
3721                                 ],
3722                 [compiler="standard"
3723                 ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
3724                 [compiler="not supported (atomic operations disabled)"
3725                 have_atomic=no
3726                 arch=noatomic ]);
3727                 ;;
3728         esac
3730         AC_MSG_RESULT($compiler)
3733 if test "$have_atomic" = "yes"; then
3734         ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
3735         ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
3736         ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
3737 else
3738         ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
3739         ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
3740         ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
3743 if test "$have_xaddq" = "yes"; then
3744         ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
3745 else
3746         ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
3749 AC_SUBST(ISC_PLATFORM_HAVEXADD)
3750 AC_SUBST(ISC_PLATFORM_HAVEXADDQ)
3751 AC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
3752 AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
3754 AC_SUBST(ISC_PLATFORM_USEGCCASM)
3755 AC_SUBST(ISC_PLATFORM_USEOSFASM)
3756 AC_SUBST(ISC_PLATFORM_USESTDASM)
3757 AC_SUBST(ISC_PLATFORM_USEMACASM)
3759 ISC_ARCH_DIR=$arch
3760 AC_SUBST(ISC_ARCH_DIR)
3763 # Activate "rrset-order fixed" or not?
3765 AC_ARG_ENABLE(fixed-rrset,
3766         [  --enable-fixed-rrset    enable fixed rrset ordering [[default=no]]],
3767                         enable_fixed="$enableval",
3768                         enable_fixed="no")
3769 case "$enable_fixed" in
3770         yes)
3771                 AC_DEFINE(DNS_RDATASET_FIXED, 1,
3772                           [Define to enable "rrset-order fixed" syntax.])
3773                 ;;
3774         no)
3775                 ;;
3776         *)
3777                 ;;
3778 esac
3781 # Enable response policy rewriting using NS IP addresses
3783 AC_ARG_ENABLE(rpz-nsip,
3784         [  --disable-rpz-nsip     disable rpz-nsip rules [[default=enabled]]],
3785                         enable_nsip="$enableval",
3786                         enable_nsip="yes")
3787 case "$enable_nsip" in
3788         yes)
3789                 AC_DEFINE(ENABLE_RPZ_NSIP, 1,
3790                           [Define to enable rpz-nsip rules.])
3791                 ;;
3792         no)
3793                 ;;
3794         *)
3795                 ;;
3796 esac
3799 # Enable response policy rewriting using NS name
3801 AC_ARG_ENABLE(rpz-nsdname,
3802         [  --disable-rpz-nsdname          disable rpz-nsdname rules [[default=enabled]]],
3803                         enable_nsdname="$enableval",
3804                         enable_nsdname="yes")
3805 case "$enable_nsdname" in
3806         yes)
3807                 AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
3808                           [Define to enable rpz-nsdname rules.])
3809                 ;;
3810         no)
3811                 ;;
3812         *)
3813                 ;;
3814 esac
3817 # Activate "filter-aaaa-on-v4/v6" or not?
3819 AC_ARG_ENABLE(filter-aaaa,
3820         [  --enable-filter-aaaa    enable filtering of AAAA records [[default=no]]],
3821                         enable_filter="$enableval",
3822                         enable_filter="no")
3823 case "$enable_filter" in
3824         yes)
3825                 AC_DEFINE(ALLOW_FILTER_AAAA, 1,
3826                           [Define to enable the "filter-aaaa-on-v4" and "filter-aaaa-on-v6" options.])
3827                 ;;
3828         no)
3829                 ;;
3830         *)
3831                 ;;
3832 esac
3835 #  The following sets up how non-blocking i/o is established.
3836 #  Sunos, cygwin and solaris 2.x (x<5) require special handling.
3838 case "$host" in
3839 *-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3840 *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
3841 *-solaris2.[[01234]])
3842         AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
3843         AC_DEFINE(USE_FIONBIO_IOCTL, 1,
3844                   [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
3845         ;;
3846 *) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
3847              [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
3848         ;;
3849 esac
3851 # Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
3852 # This prevents the source address being set.
3854 case "$host" in
3855 *-solaris2.[[012345]]|*-solaris2.5.1)
3856         AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
3857                   [Define if you cannot bind() before connect() for TCP sockets.])
3858         ;;
3859 esac
3861 # The following sections deal with tools used for formatting
3862 # the documentation.  They are all optional, unless you are
3863 # a developer editing the documentation source.
3867 # Look for TeX.
3870 AC_PATH_PROGS(LATEX, latex, latex)
3871 AC_SUBST(LATEX)
3873 AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
3874 AC_SUBST(PDFLATEX)
3877 # Look for w3m
3880 AC_PATH_PROGS(W3M, w3m, w3m)
3881 AC_SUBST(W3M)
3884 # Look for xsltproc (libxslt)
3887 AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
3888 AC_SUBST(XSLTPROC)
3891 # Look for xmllint (libxml2)
3894 AC_PATH_PROG(XMLLINT, xmllint, xmllint)
3895 AC_SUBST(XMLLINT)
3898 # Look for Doxygen
3901 AC_PATH_PROG(DOXYGEN, doxygen, doxygen)
3902 AC_SUBST(DOXYGEN)
3905 # Subroutine for searching for an ordinary file (e.g., a stylesheet)
3906 # in a number of directories:
3908 #   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
3910 # If the file FILENAME is found in one of the DIRECTORIES, the shell
3911 # variable VARIABLE is defined to its absolute pathname.  Otherwise, 
3912 # it is set to FILENAME, with no directory prefix (that's not terribly
3913 # useful, but looks less confusing in substitutions than leaving it
3914 # empty).  The variable VARIABLE will be substituted into output files.
3917 AC_DEFUN(NOM_PATH_FILE, [
3918 $1=""
3919 AC_MSG_CHECKING(for $2)
3920 for d in $3
3922         f=$d/$2
3923         if test -f $f
3924         then
3925                 $1=$f
3926                 AC_MSG_RESULT($f)
3927                 break
3928         fi
3929 done
3930 if test "X[$]$1" = "X"
3931 then
3932         AC_MSG_RESULT("not found");
3933         $1=$2
3935 AC_SUBST($1)
3939 # Look for Docbook-XSL stylesheets.  Location probably varies by system.
3940 # If it's not explicitly specified, guess where it might be found, based on
3941 # where SGML stuff lives on some systems (FreeBSD is the only one we're sure
3942 # of at the moment).
3944 AC_MSG_CHECKING(for Docbook-XSL path)
3945 AC_ARG_WITH(docbook-xsl,
3946 [  --with-docbook-xsl=PATH specify path for Docbook-XSL stylesheets],
3947    docbook_path="$withval", docbook_path="auto")
3948 case "$docbook_path" in
3949 auto)
3950         AC_MSG_RESULT(auto)
3951         docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook /opt/local/share/xsl/docbook-xsl"
3952         ;;
3954         docbook_xsl_trees="$withval"
3955         AC_MSG_RESULT($docbook_xsl_trees)
3956         ;;
3957 esac
3960 # Look for stylesheets we need.
3963 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
3964 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
3965 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
3966 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
3967 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
3968 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
3969 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
3970 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
3971 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
3974 # Same dance for db2latex
3977 db2latex_xsl_trees="/usr/local/share/db2latex/xsl /usr/pkg/share/xsl/db2latex"
3980 # Look for stylesheets we need.
3983 NOM_PATH_FILE(XSLT_DB2LATEX_STYLE, docbook.xsl, $db2latex_xsl_trees)
3986 # Look for "admonition" image directory.  Can't use NOM_PATH_FILE()
3987 # because it's a directory, so just do the same things, inline.
3990 AC_MSG_CHECKING(for db2latex xsl figures)
3991 for d in $db2latex_xsl_trees
3993         if test -d $d/figures
3994         then
3995                 XSLT_DB2LATEX_ADMONITIONS=$d/figures
3996                 AC_MSG_RESULT($d/figures)
3997                 break
3998         fi
3999 done
4000 if test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
4001 then
4002         AC_MSG_RESULT(not found)
4003         XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
4005 AC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
4008 # IDN support
4010 AC_ARG_WITH(idn,
4011         [  --with-idn[=MPREFIX]      enable IDN support using idnkit [default PREFIX]],
4012         use_idn="$withval", use_idn="no")
4013 case "$use_idn" in
4014 yes)
4015         if test X$prefix = XNONE ; then
4016                 idn_path=/usr/local
4017         else
4018                 idn_path=$prefix
4019         fi
4020         ;;
4022         ;;
4024         idn_path="$use_idn"
4025         ;;
4026 esac
4028 iconvinc=
4029 iconvlib=
4030 AC_ARG_WITH(libiconv,
4031         [  --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
4032         use_libiconv="$withval", use_libiconv="no")
4033 case "$use_libiconv" in
4034 yes)
4035         if test X$prefix = XNONE ; then
4036                 iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
4037         else
4038                 iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
4039         fi
4040         ;;
4042         iconvlib=
4043         ;;
4045         iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
4046         ;;
4047 esac
4049 AC_ARG_WITH(iconv,
4050         [  --with-iconv[=LIBSPEC]    specify iconv library [default -liconv]],
4051         iconvlib="$withval")
4052 case "$iconvlib" in
4054         iconvlib=
4055         ;;
4056 yes)
4057         iconvlib=-liconv
4058         ;;
4059 esac
4061 AC_ARG_WITH(idnlib,
4062         [  --with-idnlib=ARG       specify libidnkit],
4063         idnlib="$withval", idnlib="no")
4064 if test "$idnlib" = yes; then
4065         AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
4068 IDNLIBS=
4069 if test "$use_idn" != no; then
4070         AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
4071         STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
4072         if test "$idnlib" != no; then
4073                 IDNLIBS="$idnlib $iconvlib"
4074         else
4075                 IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
4076         fi
4078 AC_SUBST(IDNLIBS)
4081 # Check whether to build Automated Test Framework unit tests
4083 AC_ARG_WITH(atf,
4084         [  --with-atf=ARG          support Automated Test Framework],
4085         atf="$withval", atf="no")
4086 if test "$atf" = yes; then
4087         atf=`pwd`/unit/atf
4088         ATFBUILD=atf-src
4089         AC_SUBST(ATFBUILD)
4090         AC_CONFIG_COMMANDS([atf-config],
4091                 [(
4092                  mkdir -p unit/atf-src;
4093                  cd unit/atf-src;
4094                  case "$srcdir" in
4095                  /*) ;;
4096                  *) srcdir="../../$srcdir";;
4097                  esac
4098                  ${SHELL} "${srcdir}${srcdir:+/unit/atf-src/}./configure" --enable-tools --disable-shared MISSING=: --prefix $atfdir;
4099                 ) ],
4100                 [atfdir=`pwd`/unit/atf])
4101         AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
4104 ATFLIBS=
4105 if test "$atf" != no; then
4106         AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
4107         STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
4108         ATFBIN="$atf/bin"
4109         ATFLIBS="-L$atf/lib -latf-c"
4110         UNITTESTS=tests
4112 AC_SUBST(ATFBIN)
4113 AC_SUBST(ATFLIBS)
4114 AC_SUBST(UNITTESTS)
4116 AC_CHECK_HEADERS(locale.h)
4117 AC_CHECK_FUNCS(setlocale)
4120 # was --with-tuning specified?
4122 AC_ARG_WITH(tuning,
4123         [  --with-tuning=ARG       Specify server tuning (large or default)],
4124         use_tuning="$withval", use_tuning="no")
4126 case "$use_tuning" in
4127         large)
4128                 if ! $use_threads; then
4129                         AC_MSG_ERROR([Large-system tuning requires threads.])
4130                 fi
4131                 AC_DEFINE(TUNE_LARGE, 1, [Define to use large-system tuning.])
4132                 AC_MSG_RESULT(using large-system tuning)
4133                 ;;
4134         no|default)
4135                 AC_MSG_RESULT(using default tuning)
4136                 ;;
4137         yes|*)
4138                 AC_MSG_ERROR([You must specify "large" or "default" for --with-tuning.])
4139                 ;;
4140 esac
4143 # Substitutions
4145 AC_SUBST(BIND9_TOP_BUILDDIR)
4146 BIND9_TOP_BUILDDIR=`pwd`
4148 AC_SUBST(BIND9_ISC_BUILDINCLUDE)
4149 AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
4150 AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
4151 AC_SUBST(BIND9_DNS_BUILDINCLUDE)
4152 AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
4153 AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
4154 AC_SUBST(BIND9_IRS_BUILDINCLUDE)
4155 if test "X$srcdir" != "X"; then
4156         BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
4157         BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
4158         BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
4159         BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
4160         BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
4161         BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
4162         BIND9_IRS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/irs/include"
4163 else
4164         BIND9_ISC_BUILDINCLUDE=""
4165         BIND9_ISCCC_BUILDINCLUDE=""
4166         BIND9_ISCCFG_BUILDINCLUDE=""
4167         BIND9_DNS_BUILDINCLUDE=""
4168         BIND9_LWRES_BUILDINCLUDE=""
4169         BIND9_BIND9_BUILDINCLUDE=""
4170         BIND9_IRS_BUILDINCLUDE=""
4173 AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
4174 BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
4176 AC_SUBST_FILE(BIND9_MAKE_RULES)
4177 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
4179 . "$srcdir/version"
4180 BIND9_PRODUCT="PRODUCT=\"${PRODUCT}\""
4181 AC_SUBST(BIND9_PRODUCT)
4182 BIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\""
4183 AC_SUBST(BIND9_DESCRIPTION)
4184 BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
4185 AC_SUBST(BIND9_VERSION)
4186 BIND9_MAJOR="MAJOR=${MAJORVER}.${MINORVER}"
4187 AC_SUBST(BIND9_MAJOR)
4188 BIND9_VERSIONSTRING="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}${DESCRIPTION:+ }${DESCRIPTION}"
4189 AC_SUBST(BIND9_VERSIONSTRING)
4191 BIND9_SRCID="SRCID=unset"
4192 if test -f "${srcdir}/srcid"; then
4193         . "${srcdir}/srcid"
4194         BIND9_SRCID="SRCID=$SRCID"
4195 elif test -d "${srcdir}/.git"; then
4196         BIND9_SRCID="SRCID="`(cd "${srcdir}";git rev-parse --short HEAD)`
4199 AC_SUBST(BIND9_SRCID)
4201 if test -z "$ac_configure_args"; then
4202         BIND9_CONFIGARGS="defaults"
4203 else
4204         for a in $ac_configure_args
4205         do
4206                 BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
4207         done
4209 BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
4210 BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
4211 AC_SUBST(BIND9_CONFIGARGS)
4213 AC_SUBST_FILE(LIBISC_API)
4214 LIBISC_API="$srcdir/lib/isc/api"
4216 AC_SUBST_FILE(LIBISCCC_API)
4217 LIBISCCC_API="$srcdir/lib/isccc/api"
4219 AC_SUBST_FILE(LIBISCCFG_API)
4220 LIBISCCFG_API="$srcdir/lib/isccfg/api"
4222 AC_SUBST_FILE(LIBDNS_API)
4223 LIBDNS_API="$srcdir/lib/dns/api"
4225 AC_SUBST_FILE(LIBDNS_MAPAPI)
4226 LIBDNS_MAPAPI="$srcdir/lib/dns/mapapi"
4228 AC_SUBST_FILE(LIBBIND9_API)
4229 LIBBIND9_API="$srcdir/lib/bind9/api"
4231 AC_SUBST_FILE(LIBLWRES_API)
4232 LIBLWRES_API="$srcdir/lib/lwres/api"
4234 AC_SUBST_FILE(LIBIRS_API)
4235 LIBIRS_API="$srcdir/lib/irs/api"
4238 # Configure any DLZ drivers.
4240 # If config.dlz.in selects one or more DLZ drivers, it will set
4241 # CONTRIB_DLZ to a non-empty value, which will be our clue to
4242 # build DLZ drivers in contrib.
4244 # This section has to come after the libtool stuff because it needs to
4245 # know how to name the driver object files.
4248 CONTRIB_DLZ=""
4249 DLZ_DRIVER_INCLUDES=""
4250 DLZ_DRIVER_LIBS=""
4251 DLZ_DRIVER_SRCS=""
4252 DLZ_DRIVER_OBJS=""
4253 DLZ_SYSTEM_TEST=""
4256 # Configure support for building a shared library object
4258 # Even when libtool is available it can't always be relied upon
4259 # to build an object that can be dlopen()'ed, but this is necessary
4260 # for building the dlzexternal system test, so we'll try it the
4261 # old-fashioned way.
4263 SO="so"
4264 SO_CFLAGS=""
4265 SO_LDFLAGS=""
4266 SO_LD=""
4267 SO_TARGETS=""
4269 AC_ARG_WITH(dlopen,
4270         [  --with-dlopen=ARG       support dynamically loadable DLZ drivers],
4271         dlopen="$withval", dlopen="yes")
4273 case $host in
4274         *-sunos*) dlopen="no"
4275                 ;;
4276 esac
4278 if test "$dlopen" = "yes"; then
4279         AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
4280         if test "$have_dl" = "yes"; then
4281                 LIBS="-ldl $LIBS"
4282         fi
4283         AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
4286 if test "$dlopen" = "yes"; then
4287         case $host in
4288                 *-linux*|*-gnu*)
4289                         SO_CFLAGS="-fPIC"
4290                         SO_LDFLAGS=""
4291                         if test "$have_dl" = "yes"
4292                         then
4293                                 if test "$use_libtool" = "yes"; then
4294                                         SO_LDFLAGS="-Xcompiler -shared"
4295                                         SO_LD="${CC}"
4296                                 else
4297                                         SO_LDFLAGS="-shared"
4298                                         SO_LD="${CC}"
4299                                 fi
4300                         else
4301                                 SO_LDFLAGS="-shared"
4302                                 SO_LD="ld"
4303                         fi
4304                         ;;
4305                 *-freebsd*|*-openbsd*|*-netbsd*)
4306                         SO_CFLAGS="-fpic"
4307                         SO_LDFLAGS="-Bshareable -x"
4308                         SO_LD="ld"
4309                         ;;
4310                 *-solaris*)
4311                         SO_CFLAGS="-KPIC"
4312                         SO_LDFLAGS="-G -z text"
4313                         SO_LD="ld"
4314                         ;;
4315                 *-hp-hpux*)
4316                         SO=sl
4317                         SO_CFLAGS="+z"
4318                         SO_LDFLAGS="-b +vnocompatwarnings"
4319                         SO_LD="ld"
4320                         ;;
4321                 *)
4322                         SO_CFLAGS="-fPIC"
4323                         ;;
4324         esac
4326         if test "X$GCC" = "Xyes"; then
4327                 SO_CFLAGS="-fPIC"
4328                 if test -z "$SO_LD"
4329                 then
4330                         if test "$use_libtool" = "yes"; then
4331                                 SO_LDFLAGS="-Xcompiler -shared"
4332                                 SO_LD="${CC}"
4333                         else
4334                                 SO_LDFLAGS="-shared"
4335                                 SO_LD="${CC}"
4336                         fi
4337                 fi
4338         fi
4340         # If we still don't know how to make shared objects, don't make any.
4341         if test -n "$SO_LD"; then
4342                 SO_TARGETS="\${SO_TARGETS}"
4343                 AC_DEFINE(ISC_DLZ_DLOPEN, 1,
4344                           [Define to allow building of objects for dlopen().])
4345         fi
4348 AC_SUBST(SO)
4349 AC_SUBST(SO_CFLAGS)
4350 AC_SUBST(SO_LDFLAGS)
4351 AC_SUBST(SO_LD)
4352 AC_SUBST(SO_TARGETS)
4354 sinclude(contrib/dlz/config.dlz.in)
4355 AC_MSG_CHECKING(contributed DLZ drivers)
4357 if test -n "$CONTRIB_DLZ"
4358 then
4359         AC_MSG_RESULT(yes)
4360         DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
4361         AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
4362 else
4363         AC_MSG_RESULT(no)
4364         DLZ_DRIVER_RULES=/dev/null
4367 AC_SUBST(CONTRIB_DLZ)
4368 AC_SUBST(DLZ_DRIVER_INCLUDES)
4369 AC_SUBST(DLZ_DRIVER_LIBS)
4370 AC_SUBST(DLZ_DRIVER_SRCS)
4371 AC_SUBST(DLZ_DRIVER_OBJS)
4372 AC_SUBST(DLZ_SYSTEM_TEST)
4373 AC_SUBST_FILE(DLZ_DRIVER_RULES)
4375 if test "$cross_compiling" = "yes"; then
4376         if test -z "$BUILD_CC"; then
4377                 AC_MSG_ERROR([BUILD_CC not set])
4378         fi
4379         BUILD_CFLAGS="$BUILD_CFLAGS"
4380         BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
4381         BUILD_LDFLAGS="$BUILD_LDFLAGS"
4382         BUILD_LIBS="$BUILD_LIBS"
4383 else
4384         BUILD_CC="$CC" 
4385         BUILD_CFLAGS="$CFLAGS" 
4386         BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
4387         BUILD_LDFLAGS="$LDFLAGS"
4388         BUILD_LIBS="$LIBS"
4391 NEWFLAGS=""
4392 for e in $BUILD_LDFLAGS ; do
4393     case $e in
4394         -L*)
4395             case $host_os in
4396                 netbsd*)
4397                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4398                     NEWFLAGS="$NEWFLAGS $e $ee"
4399                     ;;
4400                 freebsd*)
4401                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4402                     NEWFLAGS="$NEWFLAGS $e $ee"
4403                     ;;
4404                 solaris*)
4405                     ee=`echo $e | sed -e 's%^-L%-R%'`
4406                     NEWFLAGS="$NEWFLAGS $e $ee"
4407                     ;;
4408                 *)
4409                     NEWFLAGS="$NEWFLAGS $e"
4410                     ;;
4411                 esac
4412             ;;
4413         *)
4414             NEWFLAGS="$NEWFLAGS $e"
4415             ;;
4416     esac
4417 done
4418 BUILD_LDFLAGS="$NEWFLAGS"
4420 NEWFLAGS=""
4421 for e in $DNS_GSSAPI_LIBS ; do
4422     case $e in
4423         -L*)
4424             case $host_os in
4425                 netbsd*)
4426                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4427                     NEWFLAGS="$NEWFLAGS $e $ee"
4428                     ;;
4429                 freebsd*)
4430                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4431                     NEWFLAGS="$NEWFLAGS $e $ee"
4432                     ;;
4433                 solaris*)
4434                     ee=`echo $e | sed -e 's%^-L%-R%'`
4435                     NEWFLAGS="$NEWFLAGS $e $ee"
4436                     ;;
4437                 *)
4438                     NEWFLAGS="$NEWFLAGS $e"
4439                     ;;
4440                 esac
4441             ;;
4442         *)
4443             NEWFLAGS="$NEWFLAGS $e"
4444             ;;
4445     esac
4446 done
4447 DNS_GSSAPI_LIBS="$NEWFLAGS"
4449 NEWFLAGS=""
4450 for e in $ISC_OPENSSL_LIBS ; do
4451     case $e in
4452         -L*)
4453             case $host_os in
4454                 netbsd*)
4455                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4456                     NEWFLAGS="$NEWFLAGS $e $ee"
4457                     ;;
4458                 freebsd*)
4459                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4460                     NEWFLAGS="$NEWFLAGS $e $ee"
4461                     ;;
4462                 solaris*)
4463                     ee=`echo $e | sed -e 's%^-L%-R%'`
4464                     NEWFLAGS="$NEWFLAGS $e $ee"
4465                     ;;
4466                 *)
4467                     NEWFLAGS="$NEWFLAGS $e"
4468                     ;;
4469                 esac
4470             ;;
4471         *)
4472             NEWFLAGS="$NEWFLAGS $e"
4473             ;;
4474     esac
4475 done
4476 ISC_OPENSSL_LIBS="$NEWFLAGS"
4478 NEWFLAGS=""
4479 for e in $DNS_CRYPTO_LIBS ; do
4480     case $e in
4481         -L*)
4482             case $host_os in
4483                 netbsd*)
4484                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4485                     NEWFLAGS="$NEWFLAGS $e $ee"
4486                     ;;
4487                 freebsd*)
4488                     ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
4489                     NEWFLAGS="$NEWFLAGS $e $ee"
4490                     ;;
4491                 solaris*)
4492                     ee=`echo $e | sed -e 's%^-L%-R%'`
4493                     NEWFLAGS="$NEWFLAGS $e $ee"
4494                     ;;
4495                 *)
4496                     NEWFLAGS="$NEWFLAGS $e"
4497                     ;;
4498                 esac
4499             ;;
4500         *)
4501             NEWFLAGS="$NEWFLAGS $e"
4502             ;;
4503     esac
4504 done
4505 DNS_CRYPTO_LIBS="$NEWFLAGS"
4507 AC_SUBST(BUILD_CC)
4508 AC_SUBST(BUILD_CFLAGS)
4509 AC_SUBST(BUILD_CPPFLAGS)
4510 AC_SUBST(BUILD_LDFLAGS)
4511 AC_SUBST(BUILD_LIBS)
4514 # Commands to run at the end of config.status.
4515 # Don't just put these into configure, it won't work right if somebody
4516 # runs config.status directly (which autoconf allows).
4519 AC_CONFIG_COMMANDS(
4520         [chmod],
4521         [chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
4524 # Files to configure.  These are listed here because we used to
4525 # specify them as arguments to AC_OUTPUT.  It's (now) ok to move these
4526 # elsewhere if there's a good reason for doing so.
4529 AC_CONFIG_FILES([
4530   make/Makefile
4531   make/mkdep
4532         Makefile
4533         bin/Makefile
4534         bin/check/Makefile
4535         bin/confgen/Makefile
4536         bin/confgen/unix/Makefile
4537         bin/delv/Makefile
4538         bin/dig/Makefile
4539         bin/dnssec/Makefile
4540         bin/named/Makefile
4541         bin/named/unix/Makefile
4542         bin/nsupdate/Makefile
4543         bin/pkcs11/Makefile
4544         bin/python/Makefile
4545         bin/python/dnssec-checkds.py
4546         bin/python/dnssec-coverage.py
4547         bin/rndc/Makefile
4548         bin/tests/Makefile
4549         bin/tests/atomic/Makefile
4550         bin/tests/db/Makefile
4551         bin/tests/dst/Makefile
4552         bin/tests/dst/Kdh.+002+18602.key
4553         bin/tests/dst/Kdh.+002+18602.private
4554         bin/tests/dst/Kdh.+002+48957.key
4555         bin/tests/dst/Kdh.+002+48957.private
4556         bin/tests/dst/Ktest.+001+00002.key
4557         bin/tests/dst/Ktest.+001+54622.key
4558         bin/tests/dst/Ktest.+001+54622.private
4559         bin/tests/dst/Ktest.+003+23616.key
4560         bin/tests/dst/Ktest.+003+23616.private
4561         bin/tests/dst/Ktest.+003+49667.key
4562         bin/tests/dst/dst_2_data
4563         bin/tests/dst/t2_data_1
4564         bin/tests/dst/t2_data_2
4565         bin/tests/dst/t2_dsasig
4566         bin/tests/dst/t2_rsasig
4567         bin/tests/hashes/Makefile
4568         bin/tests/headerdep_test.sh
4569         bin/tests/master/Makefile
4570         bin/tests/mem/Makefile
4571         bin/tests/names/Makefile
4572         bin/tests/net/Makefile
4573         bin/tests/pkcs11/Makefile
4574         bin/tests/pkcs11/benchmarks/Makefile
4575         bin/tests/rbt/Makefile
4576         bin/tests/resolver/Makefile
4577         bin/tests/sockaddr/Makefile
4578         bin/tests/system/Makefile
4579         bin/tests/system/conf.sh
4580         bin/tests/system/builtin/Makefile
4581         bin/tests/system/dlz/prereq.sh
4582         bin/tests/system/dlzexternal/Makefile
4583         bin/tests/system/dlzexternal/ns1/named.conf
4584         bin/tests/system/dlzredir/prereq.sh
4585         bin/tests/system/filter-aaaa/Makefile
4586         bin/tests/system/geoip/Makefile
4587         bin/tests/system/inline/checkdsa.sh
4588         bin/tests/system/lwresd/Makefile
4589         bin/tests/system/sit/prereq.sh
4590         bin/tests/system/rpz/Makefile
4591         bin/tests/system/rsabigexponent/Makefile
4592         bin/tests/system/tkey/Makefile
4593         bin/tests/system/tsiggss/Makefile
4594         bin/tests/tasks/Makefile
4595         bin/tests/timers/Makefile
4596         bin/tests/virtual-time/Makefile
4597         bin/tests/virtual-time/conf.sh
4598         bin/tools/Makefile
4599         contrib/scripts/check-secure-delegation.pl
4600         contrib/scripts/zone-edit.sh
4601         doc/Makefile
4602         doc/arm/Makefile
4603         doc/doxygen/Doxyfile
4604         doc/doxygen/Makefile
4605         doc/doxygen/doxygen-input-filter
4606         doc/misc/Makefile
4607         doc/xsl/Makefile
4608         doc/xsl/isc-docbook-chunk.xsl
4609         doc/xsl/isc-docbook-html.xsl
4610         doc/xsl/isc-docbook-latex.xsl
4611         doc/xsl/isc-manpage.xsl
4612         doc/xsl/isc-notes-html.xsl
4613         doc/xsl/isc-notes-latex.xsl
4614         isc-config.sh
4615         lib/Makefile
4616         lib/bind9/Makefile
4617         lib/bind9/include/Makefile
4618         lib/bind9/include/bind9/Makefile
4619         lib/dns/Makefile
4620         lib/dns/include/Makefile
4621         lib/dns/include/dns/Makefile
4622         lib/dns/include/dst/Makefile
4623         lib/dns/tests/Makefile
4624         lib/irs/Makefile
4625         lib/irs/include/Makefile
4626         lib/irs/include/irs/Makefile
4627         lib/irs/include/irs/netdb.h
4628         lib/irs/include/irs/platform.h
4629         lib/isc/$arch/Makefile
4630         lib/isc/$arch/include/Makefile
4631         lib/isc/$arch/include/isc/Makefile
4632         lib/isc/$thread_dir/Makefile
4633         lib/isc/$thread_dir/include/Makefile
4634         lib/isc/$thread_dir/include/isc/Makefile
4635         lib/isc/Makefile
4636         lib/isc/include/Makefile
4637         lib/isc/include/isc/Makefile
4638         lib/isc/include/isc/platform.h
4639         lib/isc/include/pk11/Makefile
4640         lib/isc/include/pkcs11/Makefile
4641         lib/isc/tests/Makefile
4642         lib/isc/nls/Makefile
4643         lib/isc/unix/Makefile
4644         lib/isc/unix/include/Makefile
4645         lib/isc/unix/include/isc/Makefile
4646         lib/isc/unix/include/pkcs11/Makefile
4647         lib/isccc/Makefile
4648         lib/isccc/include/Makefile
4649         lib/isccc/include/isccc/Makefile
4650         lib/isccfg/Makefile
4651         lib/isccfg/include/Makefile
4652         lib/isccfg/include/isccfg/Makefile
4653         lib/lwres/Makefile
4654         lib/lwres/include/Makefile
4655         lib/lwres/include/lwres/Makefile
4656         lib/lwres/include/lwres/netdb.h
4657         lib/lwres/include/lwres/platform.h
4658         lib/lwres/man/Makefile
4659         lib/lwres/tests/Makefile
4660         lib/lwres/unix/Makefile
4661         lib/lwres/unix/include/Makefile
4662         lib/lwres/unix/include/lwres/Makefile
4663         lib/tests/Makefile
4664         lib/tests/include/Makefile
4665         lib/tests/include/tests/Makefile
4666         lib/samples/Makefile
4667         lib/samples/Makefile-postinstall
4668         unit/Makefile
4669         unit/unittest.sh
4673 # Do it
4676 AC_OUTPUT
4679 # Now that the Makefiles exist we can ensure that everything is rebuilt.
4681 AC_ARG_WITH(make-clean,
4682 [  --with-make-clean       run "make clean" at end of configure [[yes|no]]],
4683     make_clean="$withval", make_clean="yes")
4684 case "$make_clean" in
4685 yes)
4686         make clean
4687         ;;
4688 esac
4690 AC_ARG_ENABLE(full-report,
4691         [  --enable-full-report   report values of all configure options])
4693 echo "========================================================================"
4694 echo "Configuration summary:"
4695 echo "------------------------------------------------------------------------"
4696 echo "Optional features enabled:"
4697 if $use_threads; then
4698     echo "    Multiprocessing support (--enable-threads)"
4699     if test "$enable_full_report" = "yes" -o "$locktype" = "standard"; then
4700         echo "        Mutex lock type: $locktype"
4701     fi
4703 test "$use_tuning" = "large" && echo "    Large-system tuning (--with-tuning)"
4704 test "$use_geoip" = "no" || echo "    GeoIP access control (--with-geoip)"
4705 test "$use_gssapi" = "no" || echo "    GSS-API (--with-gssapi)"
4706 if test "$enable_sit" != "no"; then
4707     echo "    Source Identity Token support (--enable-sit)"
4708     if test "$enable_full_report" = "yes" -o "$with_sit_alg" != "aes"; then
4709         echo "        Algorithm: $with_sit_alg"
4710     fi
4713 # these lines are only printed if run with --enable-full-report 
4714 if test "$enable_full_report" = "yes"; then
4715     test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" || \
4716         echo "    IPv6 support (--enable-ipv6)"
4717     test "X$CRYPTO" = "X" -o "$want_native_pkcs11" = "yes" || \
4718             echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
4719     test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
4720     test "X$libxml2_libs" = "X" || echo "    XML statistics (--with-libxml2)"
4721     test "X$have_libjson" = "X" || echo "    JSON statistics (--with-libjson)"
4724 if test "$use_pkcs11" != "no"; then
4725     if test "$want_native_pkcs11" = "yes"; then
4726         echo "    Native PKCS#11/Cryptoki support (--enable-native-pkcs11)"
4727     else
4728         echo "    PKCS#11/Cryptoki support using OpenSSL (--with-pkcs11)"
4729     fi
4730     echo "        Provider library: $PKCS11_PROVIDER"
4732 if test "$OPENSSL_GOST" = "yes" -o "$PKCS11_GOST" = "yes"; then
4733     echo "    GOST algorithm support (encoding: $gosttype) (--with-gost)"
4735 test "$OPENSSL_ECDSA" = "yes" -o "$PKCS11_ECDSA" = "yes" && \
4736     echo "    ECDSA algorithm support (--with-ecdsa)"
4737 test "$enable_fixed" = "yes" && \
4738     echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
4739 test "$enable_filter" = "yes" && \
4740     echo "    AAAA filtering (--enable-filter-aaaa)"
4741 test "$enable_seccomp" = yes && \
4742     echo "    Use libseccomp system call filtering (--enable-seccomp)"
4743 test "$want_backtrace" = "yes" && \
4744     echo "    Print backtrace on crash (--enable-backtrace)"
4745 test "$want_symtable" = "minimal" && \
4746     echo "    Use symbol table for backtrace, named only (--enable-symtable)"
4747 test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \
4748     echo "    Use symbol table for backtrace, all binaries (--enable-symtable=all)"
4749 test "$use_libtool" = "no" || echo "    Use GNU libtool (--with-libtool)"
4750 test "$atf" = "no" || echo "    Automated Testing Framework (--with-atf)"
4752 echo "    Dynamically loadable zone (DLZ) drivers:"
4753 test "$use_dlz_bdb" = "no" || \
4754     echo "        Berkeley DB (--with-dlz-bdb)"
4755 test "$use_dlz_ldap" = "no" || \
4756     echo "        LDAP (--with-dlz-ldap)"
4757 test "$use_dlz_mysql" = "no" || \
4758     echo "        MySQL (--with-dlz-mysql)"
4759 test "$use_dlz_odbc" = "no" || \
4760     echo "        ODBC (--with-dlz-odbc)"
4761 test "$use_dlz_postgres" = "no" || \
4762     echo "        Postgres (--with-dlz-postgres)"
4763 test "$use_dlz_filesystem" = "no" || \
4764     echo "        Filesystem (--with-dlz-filesystem)"
4765 test "$use_dlz_stub" = "no" || \
4766     echo "        Stub (--with-dlz-stub)"
4767 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"
4768 echo
4770 echo "Features disabled or unavailable on this platform:"
4771 $use_threads || echo "    Multiprocessing support (--enable-threads)"
4772 test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" && \
4773         echo "    IPv6 support (--enable-ipv6)"
4774 test "$use_tuning" = "large" || echo "    Large-system tuning (--with-tuning)"
4776 test "$use_geoip" = "no" && echo "    GeoIP access control (--with-geoip)"
4777 test "$use_gssapi" = "no" && echo "    GSS-API (--with-gssapi)"
4778 test "$enable_sit" = "no" && echo "    Source Identity Token support (--enable-sit)"
4780 test "$enable_fixed" = "yes" || \
4781     echo "    Allow 'fixed' rrset-order (--enable-fixed-rrset)"
4783 if test "X$CRYPTO" = "X" -o "$want_native_pkcs11" = "yes"
4784 then
4785     echo "    OpenSSL cryptography/DNSSEC (--with-openssl)"
4786 elif test "$use_pkcs11" = "no"; then
4787     echo "    PKCS#11/Cryptoki support (--with-pkcs11)"
4789 test "$want_native_pkcs11" = "yes" ||
4790     echo "    Native PKCS#11/Cryptoki support (--enable-native-pkcs11)"
4791 test "X$CRYPTO" = "X" -o "$OPENSSL_GOST" = "yes" -o "$PKCS11_GOST" = "yes" || \
4792     echo "    GOST algorithm support (--with-gost)"
4793 test "X$CRYPTO" = "X" -o "$OPENSSL_ECDSA" = "yes" -o "$PKCS11_ECDSA" = "yes" || \
4794     echo "    ECDSA algorithm support (--with-ecdsa)"
4796 test "$enable_seccomp" = yes || \
4797     echo "    Use libseccomp system call filtering (--enable-seccomp)"
4798 test "$want_backtrace" = "yes" || \
4799     echo "    Print backtrace on crash (--enable-backtrace)"
4800 test "$use_libtool" = "yes" || echo "    Use GNU libtool (--with-libtool)"
4801 test "$atf" = "no" && echo "    Automated Testing Framework (--with-atf)"
4803 test "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
4804 test "X$libxml2_libs" = "X" && echo "    XML statistics (--with-libxml2)"
4805 test "X$have_libjson" = "X" && echo "    JSON statistics (--with-libjson)"
4807 if test "X$ac_unrecognized_opts" != "X"; then
4808     echo
4809     echo "Unrecognized options:"
4810     echo "    $ac_unrecognized_opts"
4812 echo "========================================================================"
4814 if test "X$CRYPTO" = "X"; then
4815 cat << \EOF                                                             
4816 BIND 9 is being built without cryptography support. This means it will
4817 not have DNSSEC support. Use --with-openssl, or --with-pkcs11 and
4818 --enable-native-pkcs11 to enable cryptography.
4822 if test "X$OPENSSL_WARNING" != "X"; then
4823 cat << \EOF
4824 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4825 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4826 WARNING                                                                 WARNING
4827 WARNING         Your OpenSSL crypto library may be vulnerable to        WARNING
4828 WARNING         one or more of the the following known security         WARNING
4829 WARNING         flaws:                                                  WARNING
4830 WARNING                                                                 WARNING
4831 WARNING         CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and         WARNING
4832 WARNING         CVE-2006-2940.                                          WARNING
4833 WARNING                                                                 WARNING
4834 WARNING         It is recommended that you upgrade to OpenSSL           WARNING
4835 WARNING         version 0.9.8d/0.9.7l (or greater).                     WARNING
4836 WARNING                                                                 WARNING
4837 WARNING         You can disable this warning by specifying:             WARNING
4838 WARNING                                                                 WARNING
4839 WARNING               --disable-openssl-version-check                   WARNING
4840 WARNING                                                                 WARNING
4841 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4842 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4846 # Tell Emacs to edit this file in shell mode.
4847 # Local Variables:
4848 # mode: sh
4849 # End: