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