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