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