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