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