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