source: trunk/third/bind/configure.in @ 21744

Revision 21744, 56.7 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21743, which included commits to RCS files with non-trunk default branches.
Line 
1# Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2# Copyright (C) 1998-2003  Internet Software Consortium.
3#
4# Permission to use, copy, modify, and distribute this software for any
5# purpose with or without fee is hereby granted, provided that the above
6# copyright notice and this permission notice appear in all copies.
7#
8# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14# PERFORMANCE OF THIS SOFTWARE.
15
16dnl
17AC_DIVERT_PUSH(1)dnl
18esyscmd([sed "s/^/# /" COPYRIGHT])dnl
19AC_DIVERT_POP()dnl
20
21AC_REVISION($Revision: 1.1.1.4 $)
22
23AC_INIT(lib/dns/name.c)
24AC_PREREQ(2.13)
25
26AC_CONFIG_HEADER(config.h)
27AC_CONFIG_SUBDIRS(lib/bind)
28
29AC_CANONICAL_HOST
30
31AC_PROG_MAKE_SET
32AC_PROG_RANLIB
33AC_PROG_INSTALL
34
35AC_SUBST(STD_CINCLUDES)
36AC_SUBST(STD_CDEFINES)
37AC_SUBST(STD_CWARNINGS)
38AC_SUBST(CCOPT)
39
40AC_PATH_PROG(AR, ar)
41ARFLAGS="cruv"
42AC_SUBST(AR)
43AC_SUBST(ARFLAGS)
44
45# The POSIX ln(1) program.  Non-POSIX systems may substitute
46# "copy" or something.
47LN=ln
48AC_SUBST(LN)
49
50case "$AR" in
51        "")
52                AC_MSG_ERROR([
53ar program not found.  Please fix your PATH to include the directory in
54which ar resides, or set AR in the environment with the full path to ar.
55])
56
57                ;;
58esac
59
60#
61# Etags.
62#
63AC_PATH_PROGS(ETAGS, etags emacs-etags)
64
65#
66# Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
67# GNU emacs etags, and it requires the -L flag.
68#
69if test "X$ETAGS" != "X"; then
70        AC_MSG_CHECKING(for Exuberant Ctags etags)
71        if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
72                AC_MSG_RESULT(yes)
73                ETAGS="$ETAGS -L"
74        else
75                AC_MSG_RESULT(no)
76        fi
77fi
78AC_SUBST(ETAGS)
79
80#
81# Perl is optional; it is used only by some of the system test scripts.
82#
83AC_PATH_PROGS(PERL, perl5 perl)
84AC_SUBST(PERL)
85
86#
87# Special processing of paths depending on whether --prefix,
88# --sysconfdir or --localstatedir arguments were given.  What's
89# desired is some compatibility with the way previous versions
90# of BIND built; they defaulted to /usr/local for most parts of
91# the installation, but named.boot/named.conf was in /etc
92# and named.pid was in /var/run.
93#
94# So ... if none of --prefix, --sysconfdir or --localstatedir are
95# specified, set things up that way.  If --prefix is given, use
96# it for sysconfdir and localstatedir the way configure normally
97# would.  To change the prefix for everything but leave named.conf
98# in /etc or named.pid in /var/run, then do this the usual configure way:
99# ./configure --prefix=/somewhere --sysconfdir=/etc
100# ./configure --prefix=/somewhere --localstatedir=/var
101#
102# To put named.conf and named.pid in /usr/local with everything else,
103# set the prefix explicitly to /usr/local even though that's the default:
104# ./configure --prefix=/usr/local
105#
106case "$prefix" in
107        NONE)
108                case "$sysconfdir" in
109                        '${prefix}/etc')
110                                sysconfdir=/etc
111                                ;;
112                esac
113                case "$localstatedir" in
114                        '${prefix}/var')
115                                localstatedir=/var
116                                ;;
117                esac
118                ;;
119esac
120
121#
122# Make sure INSTALL uses an absolute path, else it will be wrong in all
123# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
124# configure based on the location of the file where it is substituted.
125# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
126# subdirectory of install-sh, This relative path will be wrong for all
127# directories more than one level down from install-sh.
128#
129case "$INSTALL" in
130        /*)
131                ;;
132        *)
133                #
134                # Not all systems have dirname.
135                #
136                changequote({, })
137                ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
138                changequote([, ])
139
140                ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
141                test "$ac_dir" = "$ac_prog" && ac_dir=.
142                test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
143                INSTALL="$ac_dir/$ac_prog"
144                ;;
145esac
146
147#
148# On these hosts, we really want to use cc, not gcc, even if it is
149# found.  The gcc that these systems have will not correctly handle
150# pthreads.
151#
152# However, if the user sets $CC to be something, let that override
153# our change.
154#
155if test "X$CC" = "X" ; then
156        case "$host" in
157                *-dec-osf*)
158                        CC="cc"
159                        ;;
160                *-solaris*)
161                        # Use Sun's cc if it is available, but watch
162                        # out for /usr/ucb/cc; it will never be the right
163                        # compiler to use.
164                        #
165                        # If setting CC here fails, the AC_PROG_CC done
166                        # below might still find gcc.
167                        IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
168                        for ac_dir in $PATH; do
169                                test -z "$ac_dir" && ac_dir=.
170                                case "$ac_dir" in
171                                /usr/ucb)
172                                        # exclude
173                                        ;;
174                                *)
175                                        if test -f "$ac_dir/cc"; then
176                                                CC="$ac_dir/cc"
177                                                break
178                                        fi
179                                        ;;
180                                esac
181                        done
182                        IFS="$ac_save_ifs"
183                        ;;
184                *-hp-hpux*)
185                        CC="cc"
186                        ;;
187                mips-sgi-irix*)
188                        CC="cc"
189                        ;;
190        esac
191fi
192
193AC_PROG_CC
194
195#
196# gcc's optimiser is broken at -02 for ultrasparc
197#
198if test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
199        case "$host" in
200        sparc-*)
201                CCFLAGS="-g -O1"
202                ;;
203        esac
204fi
205
206#
207# OS dependent CC flags
208#
209case "$host" in
210        # OSF 5.0: recv/send are only avaliable with -D_POSIX_PII_SOCKET or
211        # -D_XOPEN_SOURCE_EXTENDED.
212        *-dec-osf*)
213                STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
214                CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
215                ;;
216        #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
217        *-hp-hpux*)
218                STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
219                CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
220                LIBS="-lxnet $LIBS"
221                ;;
222        # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
223        *-solaris*)
224                STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
225                CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
226                ;;
227esac
228
229AC_HEADER_STDC
230
231AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
232[$ac_includes_default
233#ifdef HAVE_SYS_PARAM_H
234# include <sys/param.h>
235#endif
236])
237
238AC_C_CONST
239AC_C_INLINE
240AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
241
242#
243# UnixWare 7.1.1 with the feature supplement to the UDK compiler
244# is reported to not support "static inline" (RT #1212).
245#
246AC_MSG_CHECKING(for static inline breakage)
247AC_TRY_COMPILE(, [
248                foo1();
249        }
250
251        static inline int foo1() {
252                return 0;
253        }
254
255        static inline int foo2() {
256                return foo1();
257        ],
258        [AC_MSG_RESULT(no)],
259        [AC_MSG_RESULT(yes)
260         AC_DEFINE(inline, )])
261
262AC_TYPE_SIZE_T
263AC_CHECK_TYPE(ssize_t, int)
264AC_CHECK_TYPE(socklen_t,
265[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
266[
267AC_TRY_COMPILE(
268[
269#include <sys/types.h>
270#include <sys/socket.h>
271int getsockname(int, struct sockaddr *, size_t *);
272],[],
273[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
274[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
275],
276[
277#include <sys/types.h>
278#include <sys/socket.h>
279])
280AC_SUBST(ISC_SOCKADDR_LEN_T)
281AC_HEADER_TIME
282AC_MSG_CHECKING(for long long)
283AC_TRY_COMPILE([],[long long i = 0; return (0);],
284        [AC_MSG_RESULT(yes)
285                ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
286        [AC_MSG_RESULT(no)
287                ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
288AC_SUBST(ISC_PLATFORM_HAVELONGLONG)
289
290#
291# check if we have lifconf
292#
293AC_MSG_CHECKING(for struct lifconf)
294AC_TRY_COMPILE([
295#include <sys/types.h>
296#include <sys/socket.h>
297#include <net/if.h>
298],
299[
300struct lifconf lifconf;
301lifconf.lifc_len = 0;
302]
303,
304        [AC_MSG_RESULT(yes)
305                ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
306        [AC_MSG_RESULT(no)
307                ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
308AC_SUBST(ISC_PLATFORM_HAVELIFCONF)
309
310
311#
312# check if we need to #include sys/select.h explicitly
313#
314case $ac_cv_header_unistd_h in
315yes)
316AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
317AC_TRY_COMPILE([
318#include <sys/types.h> /* Ultrix */
319#include <unistd.h>],
320[fd_set read_set; return (0);],
321        [AC_MSG_RESULT(yes)
322         ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
323         LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
324        [AC_MSG_RESULT(no)
325        case $ac_cv_header_sys_select_h in
326        yes)
327         ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
328         LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
329                ;;
330        no)
331                AC_MSG_ERROR([need either working unistd.h or sys/select.h])
332                ;;
333        esac
334        ])
335        ;;
336no)
337        case $ac_cv_header_sys_select_h in
338        yes)
339             ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
340             LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
341                ;;
342        no)
343                AC_MSG_ERROR([need either unistd.h or sys/select.h])
344                ;;
345        esac
346        ;;
347esac
348AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
349AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
350
351#
352# Find the machine's endian flavor.
353#
354AC_C_BIGENDIAN
355
356#
357# was --with-openssl specified?
358#
359AC_MSG_CHECKING(for OpenSSL library)
360AC_ARG_WITH(openssl,
361[  --with-openssl[=PATH]   Build with OpenSSL [yes|no|path].
362                          (Required for DNSSEC)],
363    use_openssl="$withval", use_openssl="auto")
364
365openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg"
366if test "$use_openssl" = "auto"
367then
368        for d in $openssldirs
369        do
370                if test -f $d/include/openssl/opensslv.h
371                then
372                        use_openssl=$d
373                        break
374                fi
375        done
376fi
377case "$use_openssl" in
378        no)
379                AC_MSG_RESULT(no)
380                DST_OPENSSL_INC=""
381                USE_OPENSSL=""
382                ;;
383        auto)
384                DST_OPENSSL_INC=""
385                USE_OPENSSL=""
386                AC_MSG_RESULT(not found)
387                ;;
388        *)
389                if test "$use_openssl" = "yes"
390                then
391                        # User did not specify a path - guess it
392                        for d in $openssldirs
393                        do
394                                if test -f $d/include/openssl/opensslv.h
395                                then
396                                        use_openssl=$d
397                                        break
398                                fi
399                        done
400                        if test "$use_openssl" = "yes"
401                        then
402                                AC_MSG_RESULT(not found)
403                                AC_MSG_ERROR(
404[OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
405                        fi
406                fi
407                USE_OPENSSL='-DOPENSSL'
408                if test "$use_openssl" = "/usr"
409                then
410                        DST_OPENSSL_INC=""
411                        DNS_OPENSSL_LIBS="-lcrypto"
412                else
413                        DST_OPENSSL_INC="-I$use_openssl/include"
414                        case $host in
415                        *-solaris*)
416                                DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
417                                ;;
418                        *)
419                                DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
420                                ;;
421                        esac
422                fi
423                AC_MSG_RESULT(using openssl from $use_openssl/lib and $use_openssl/include)
424
425                saved_cflags="$CFLAGS"
426                saved_libs="$LIBS"
427                CFLAGS="$CFLAGS $DST_OPENSSL_INC"
428                LIBS="$LIBS $DNS_OPENSSL_LIBS"
429                AC_MSG_CHECKING(whether linking with OpenSSL works)
430                AC_TRY_RUN([
431#include <openssl/err.h>
432int main() {
433        ERR_clear_error();
434        return (0);
435}
436],
437                [AC_MSG_RESULT(yes)],
438                [AC_MSG_RESULT(no)
439                 AC_MSG_ERROR(Could not run test program using OpenSSL from
440$use_openssl/lib and $use_openssl/include.
441Please check the argument to --with-openssl and your
442shared library configuration (e.g., LD_LIBRARY_PATH).)],
443                [AC_MSG_RESULT(assuming it does work on target platform)])
444
445                AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
446                AC_TRY_LINK([
447#include <openssl/err.h>],
448[ DSO_METHOD_dlfcn(); ],
449                [AC_MSG_RESULT(no)],
450                [LIBS="$LIBS -ldl"
451                AC_TRY_LINK([
452#include <openssl/err.h>
453],[ DSO_METHOD_dlfcn(); ],
454                [AC_MSG_RESULT(yes)
455                DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
456                ],
457                 [AC_MSG_RESULT(unknown)
458                 AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
459                [AC_MSG_RESULT(assuming it does work on target platform)])
460                ],
461                [AC_MSG_RESULT(assuming it does work on target platform)]
462                )
463                 
464#
465#       OpenSSLDie is new with CERT CS-2002-23.  If we see it we have may
466#       have a patched library otherwise check that we are greater than
467#       the fixed versions
468#
469                AC_CHECK_FUNC(OpenSSLDie,
470                AC_MSG_CHECKING(OpenSSL library version)
471                AC_TRY_RUN([
472#include <stdio.h>
473#include <openssl/opensslv.h>
474int main() {
475        if (OPENSSL_VERSION_NUMBER >= 0x0090581fL)
476                return (0);
477        printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
478                OPENSSL_VERSION_NUMBER);
479        printf("Require OPENSSL_VERSION_NUMBER 0x0090581f or greater\n\n");
480        return (1);
481}
482],
483                [AC_MSG_RESULT(ok)],
484                [AC_MSG_RESULT(not compatible)
485                 AC_MSG_ERROR(you need OpenSSL 0.9.5a or newer)],
486                [AC_MSG_RESULT(assuming target platform has compatible version)])
487                ,
488                AC_MSG_RESULT(did not find fixes for CERT CA-2002-23)
489                AC_MSG_CHECKING(OpenSSL library version)
490                AC_TRY_RUN([
491#include <stdio.h>
492#include <openssl/opensslv.h>
493int main() {
494        if ((OPENSSL_VERSION_NUMBER >= 0x0090605fL &&
495             OPENSSL_VERSION_NUMBER < 0x009070000L) ||
496             OPENSSL_VERSION_NUMBER >= 0x00907003L)
497                return (0);
498        printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
499                OPENSSL_VERSION_NUMBER);
500        printf("Require OPENSSL_VERSION_NUMBER 0x0090605f or greater (0.9.6e)\n"
501               "Require OPENSSL_VERSION_NUMBER 0x00907003 or greater (0.9.7-beta2)\n\n");
502        return (1);
503}
504],
505                [AC_MSG_RESULT(ok)],
506                [AC_MSG_RESULT(not compatible)
507                 AC_MSG_ERROR(you need OpenSSL 0.9.6e/0.9.7-beta2 (or newer): CERT CA-2002-23)],
508                [AC_MSG_RESULT(assuming target platform has compatible version)]))
509                AC_MSG_CHECKING(for OpenSSL DSA support)
510                if test -f $use_openssl/include/openssl/dsa.h
511                then
512                        AC_DEFINE(HAVE_OPENSSL_DSA)
513                        AC_MSG_RESULT(yes)
514                else
515                        AC_MSG_RESULT(no)
516                fi
517                CFLAGS="$saved_cflags"
518                LIBS="$saved_libs"
519                ;;
520esac
521
522#
523# This would include the system openssl path (and linker options to use
524# it as needed) if it is found.
525#
526
527AC_SUBST(USE_OPENSSL)
528AC_SUBST(DST_OPENSSL_INC)
529DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
530
531#
532# was --with-gssapi specified?
533#
534#AC_MSG_CHECKING(for GSSAPI library)
535#AC_ARG_WITH(gssapi,
536#[  --with-gssapi=PATH   Specify path for system-supplied GSSAPI],
537#    use_gssapi="$withval", use_gssapi="no")
538#
539#case "$use_gssapi" in
540#       no)
541#               USE_GSSAPI=''
542#               DST_GSSAPI_INC=''
543#               DNS_GSSAPI_LIBS=''
544#               AC_MSG_RESULT(not specified)
545#               ;;
546#       yes)
547#               AC_MSG_ERROR([--with-gssapi must specify a path])
548#               ;;
549#       *)
550#               USE_GSSAPI='-DGSSAPI'
551#               DST_GSSAPI_INC="-I$use_gssapi/include"
552#               DNS_GSSAPI_LIBS="-L$use_gssapi/lib -lgssapi_krb5"
553#               AC_MSG_RESULT(using gssapi from $use_gssapi/lib and $use_gssapi/include)
554#               ;;
555#esac
556
557USE_GSSAPI=''
558DST_GSSAPI_INC=''
559DNS_GSSAPI_LIBS=''
560
561AC_SUBST(USE_GSSAPI)
562AC_SUBST(DST_GSSAPI_INC)
563DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_GSSAPI_LIBS"
564
565#
566# Applications linking with libdns also need to link with these libraries.
567#
568
569AC_SUBST(DNS_CRYPTO_LIBS)
570
571#
572# was --with-randomdev specified?
573#
574AC_MSG_CHECKING(for random device)
575AC_ARG_WITH(randomdev,
576[  --with-randomdev=PATH Specify path for random device],
577    use_randomdev="$withval", use_randomdev="unspec")
578
579case "$use_randomdev" in
580        unspec)
581                case "$host" in
582                        *-openbsd*)
583                                devrandom=/dev/arandom
584                                ;;
585                        *)
586                                devrandom=/dev/random
587                                ;;
588                esac
589                AC_MSG_RESULT($devrandom)
590                AC_CHECK_FILE($devrandom,
591                              AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
592                                                 "$devrandom"),)
593                ;;
594        yes)
595                AC_MSG_ERROR([--with-randomdev must specify a path])
596                ;;
597        no)
598                AC_MSG_RESULT(disabled)
599                ;;
600        *)
601                AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
602                AC_MSG_RESULT(using "$use_randomdev")
603                ;;
604esac
605
606#
607# Do we have arc4random() ?
608#
609AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
610
611#
612# Begin pthreads checking.
613#
614# First, decide whether to use multithreading or not.
615#
616# Enable multithreading by default on systems where it is known
617# to work well, and where debugging of multithreaded programs
618# is supported.
619#
620
621AC_MSG_CHECKING(whether to build with thread support)
622
623case $host in
624*-dec-osf*)
625        use_threads=true ;;
626[*-solaris2.[0-6]])
627        # Thread signals are broken on Solaris 2.6; they are sometimes
628        # delivered to the wrong thread.
629        use_threads=false ;;
630*-solaris*)
631        use_threads=true ;;
632*-ibm-aix*)
633        use_threads=true ;;
634*-hp-hpux10*)
635        use_threads=false ;;
636*-hp-hpux11*)
637        use_threads=true ;;
638*-sgi-irix*)
639        use_threads=true ;;
640*-sco-sysv*uw*|*-*-sysv*UnixWare*)
641        # UnixWare
642        use_threads=false ;;
643*-*-sysv*OpenUNIX*)
644        # UnixWare
645        use_threads=true ;;
646*-netbsd*)
647        if test -r /usr/lib/libpthread.so ; then
648            use_threads=true
649        else
650            # Socket I/O optimizations introduced in 9.2 expose a
651            # bug in unproven-pthreads; see PR #12650
652            use_threads=false
653        fi
654        ;;
655*-openbsd*)
656        # OpenBSD users have reported that named dumps core on
657        # startup when built with threads.
658        use_threads=false ;;
659*-freebsd*)
660        use_threads=false ;;
661*-bsdi[234]*)
662        # Thread signals do not work reliably on some versions of BSD/OS.
663        use_threads=false ;;
664*-bsdi5*)
665        use_threads=true ;;
666*-linux*)
667        # Threads are disabled on Linux by default because most
668        # Linux kernels produce unusable core dumps from multithreaded
669        # programs, and because of limitations in setuid().
670        use_threads=false ;;   
671*)
672        use_threads=false ;;
673esac
674
675AC_ARG_ENABLE(threads,
676        [  --enable-threads     enable multithreading])
677case "$enable_threads" in
678        yes)
679                use_threads=true
680                ;;
681        no)
682                use_threads=false
683                ;;
684        '')
685                # Use system-dependent default
686                ;;
687        *)
688                AC_MSG_ERROR([--enable-threads takes yes or no])
689                ;;
690esac
691
692if $use_threads
693then
694        AC_MSG_RESULT(yes)
695else
696        AC_MSG_RESULT(no)       
697fi
698
699if $use_threads
700then
701        #
702        # Search for / configure pthreads in a system-dependent fashion.
703        #
704        case "$host" in
705          *-netbsd*)
706                # NetBSD has multiple pthreads implementations.  The
707                # recommended one to use is "unproven-pthreads".  The
708                # older "mit-pthreads" may also work on some NetBSD
709                # versions.  The PTL2 thread library does not
710                # currently work with bind9, but can be chosen with
711                # the --with-ptl2 option for those who wish to
712                # experiment with it.
713                CC="gcc"
714                AC_MSG_CHECKING(which NetBSD thread library to use)
715
716                AC_ARG_WITH(ptl2,
717[  --with-ptl2          on NetBSD, use the ptl2 thread library (experimental)],
718                    use_ptl2="$withval", use_ptl2="no")
719
720                : ${LOCALBASE:=/usr/pkg}
721
722                if test "X$use_ptl2" = "Xyes"
723                then
724                        AC_MSG_RESULT(PTL2)
725                        AC_MSG_WARN(
726[linking with PTL2 is highly experimental and not expected to work])
727                        CC=ptlgcc
728                else
729                        if test -r /usr/lib/libpthread.so
730                        then
731                                AC_MSG_RESULT(native)
732                                LIBS="-lpthread $LIBS"
733                        else
734                                if test ! -d $LOCALBASE/pthreads
735                                then
736                                        AC_MSG_RESULT(none)
737                                        AC_MSG_ERROR("could not find thread libraries")
738                                fi
739
740                                if $use_threads
741                                then
742                                        AC_MSG_RESULT(mit-pthreads/unproven-pthreads)
743                                        pkg="$LOCALBASE/pthreads"
744                                        lib1="-L$pkg/lib -Wl,-R$pkg/lib"
745                                        lib2="-lpthread -lm -lgcc -lpthread"
746                                        LIBS="$lib1 $lib2 $LIBS"
747                                        CPPFLAGS="$CPPFLAGS -I$pkg/include"
748                                        STD_CINCLUDES="$STD_CINCLUDES -I$pkg/include"
749                                fi
750                        fi
751                fi
752                ;;
753                *)
754                        AC_CHECK_LIB(pthread, pthread_create,,
755                                AC_CHECK_LIB(pthread, __pthread_create,,
756                                AC_CHECK_LIB(pthread, __pthread_create_system,,
757                                AC_CHECK_LIB(c_r, pthread_create,,
758                                AC_CHECK_LIB(c, pthread_create,,
759                                AC_MSG_ERROR("could not find thread libraries"))))))
760                ;;
761        esac
762fi
763
764if $use_threads
765then
766        #
767        # We'd like to use sigwait() too
768        #
769        AC_CHECK_LIB(c, sigwait,
770                     AC_DEFINE(HAVE_SIGWAIT),
771                     AC_CHECK_LIB(pthread, sigwait,
772                                  AC_DEFINE(HAVE_SIGWAIT),
773                                  AC_CHECK_LIB(pthread, _Psigwait,
774                                               AC_DEFINE(HAVE_SIGWAIT),))
775        )
776
777        AC_CHECK_FUNC(pthread_attr_getstacksize,
778                      AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
779
780        AC_CHECK_FUNC(pthread_attr_setstacksize,
781                      AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
782
783        #
784        # Additional OS-specific issues related to pthreads and sigwait.
785        #
786        case "$host" in
787                #
788                # One more place to look for sigwait.
789                #
790                *-freebsd*)
791                        AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
792                        case $host in
793                        *-freebsd5.3|*-freebsd5.3.*)
794                                AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
795                                ;;
796                        esac
797                        ;;
798                #
799                # BSDI 3.0 through 4.0.1 needs pthread_init() to be
800                # called before certain pthreads calls.  This is deprecated
801                # in BSD/OS 4.1.
802                #
803                *-bsdi3.*|*-bsdi4.0*)
804                        AC_DEFINE(NEED_PTHREAD_INIT)
805                        ;;
806                #
807                # LinuxThreads requires some changes to the way we
808                # deal with signals.
809                #
810                *-linux*)
811                        AC_DEFINE(HAVE_LINUXTHREADS)
812                        ;;
813                #
814                # Ensure the right sigwait() semantics on Solaris and make
815                # sure we call pthread_setconcurrency.
816                #
817                *-solaris*)
818                        AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
819                        AC_CHECK_FUNC(pthread_setconcurrency,
820                                      AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
821                        ;;
822                #
823                # UnixWare does things its own way.
824                #
825                *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
826                        AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
827                        ;;
828        esac
829
830        #
831        # Look for sysconf to allow detection of the number of processors.
832        #
833        AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
834
835        if test "X$GCC" = "Xyes"; then
836                case "$host" in
837                *-freebsd*)
838                        CC="$CC -pthread"
839                        CCOPT="$CCOPT -pthread"
840                        STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
841                        ;;
842                *-openbsd*)
843                        CC="$CC -pthread"
844                        CCOPT="$CCOPT -pthread"
845                        ;;
846                *-solaris*)
847                        LIBS="$LIBS -lthread"
848                        ;;
849                *-ibm-aix*)
850                        STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
851                        ;;
852                esac
853        else
854                case $host in
855                *-dec-osf*)
856                        CC="$CC -pthread"
857                        CCOPT="$CCOPT -pthread"
858                        ;;
859                *-solaris*)
860                        CC="$CC -mt"
861                        CCOPT="$CCOPT -mt"
862                        ;;
863                *-ibm-aix*)
864                        STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
865                        ;;
866                *-sco-sysv*uw*|*-*-sysv*UnixWare*)
867                        CC="$CC -Kthread"
868                        CCOPT="$CCOPT -Kthread"
869                        ;;
870                *-*-sysv*OpenUNIX*)
871                        CC="$CC -Kpthread"
872                        CCOPT="$CCOPT -Kpthread"
873                        ;;
874                esac
875        fi
876        ALWAYS_DEFINES="-D_REENTRANT"
877        ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
878        thread_dir=pthreads
879else
880        ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
881        thread_dir=nothreads
882        ALWAYS_DEFINES=""
883fi
884
885AC_SUBST(ALWAYS_DEFINES)
886AC_SUBST(ISC_PLATFORM_USETHREADS)
887
888ISC_THREAD_DIR=$thread_dir
889AC_SUBST(ISC_THREAD_DIR)
890
891#
892# In solaris 10, SMF can manage named service
893#
894AC_CHECK_LIB(scf, smf_enable_instance)
895
896#
897# flockfile is usually provided by pthreads, but we may want to use it
898# even if compiled with --disable-threads.  getc_unlocked might also not
899# be defined.
900#
901AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
902AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
903
904#
905# Indicate what the final decision was regarding threads.
906#
907AC_MSG_CHECKING(whether to build with threads)
908if $use_threads; then
909        AC_MSG_RESULT(yes)
910else
911        AC_MSG_RESULT(no)
912fi
913
914#
915# End of pthreads stuff.
916#
917
918#
919# Large File
920#
921AC_ARG_ENABLE(largefile, [  --enable-largefile    64-bit file support],
922              want_largefile="yes", want_largefile="no")
923case $want_largefile in
924        yes)
925                ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
926                ;;
927        *)
928                ;;
929esac
930
931#
932# Additional compiler settings.
933#
934MKDEPCC="$CC"
935MKDEPCFLAGS="-M"
936IRIX_DNSSEC_WARNINGS_HACK=""
937
938if test "X$GCC" = "Xyes"; then
939        STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat"
940        case "$host" in
941        *-hp-hpux*)
942                LDFLAGS="-Wl,+vnocompatwarnings $LDFALGS"
943                ;;
944        esac
945else
946        case $host in
947        *-dec-osf*)
948                CC="$CC -std"
949                CCOPT="$CCOPT -std"
950                MKDEPCC="$CC"
951                ;;
952        *-hp-hpux*)
953                CC="$CC -Ae -z"
954                # The version of the C compiler that constantly warns about
955                # 'const' as well as alignment issues is unfortunately not
956                # able to be discerned via the version of the operating
957                # system, nor does cc have a version flag.
958                case "`$CC +W 123 2>&1`" in
959                *Unknown?option*)
960                        STD_CWARNINGS="+w1"
961                        ;;
962                *)
963                        # Turn off the pointlessly noisy warnings.
964                        STD_CWARNINGS="+w1 +W 474,530"
965                        ;;
966                esac
967                CCOPT="$CCOPT -Ae -z"
968                LDFLAGS="-Wl,+vnocompatwarnings $LDFALGS"
969                MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
970                ;;
971        *-sgi-irix*)
972                STD_CWARNINGS="-fullwarn -woff 1209"
973                #
974                # Silence more than 250 instances of
975                #   "prototyped function redeclared without prototype"
976                # and 11 instances of
977                #   "variable ... was set but never used"
978                # from lib/dns/sec/openssl.
979                #
980                IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
981                ;;
982        *-solaris*)
983                MKDEPCFLAGS="-xM"
984                ;;
985        *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
986                # UnixWare
987                CC="$CC -w"
988                ;;
989        esac
990fi
991
992AC_SUBST(MKDEPCC)
993AC_SUBST(MKDEPCFLAGS)
994AC_SUBST(MKDEPPROG)
995AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
996
997#
998# NLS
999#
1000AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
1001
1002#
1003# -lxnet buys us one big porting headache...  standards, gotta love 'em.
1004#
1005# AC_CHECK_LIB(xnet, socket, ,
1006#    AC_CHECK_LIB(socket, socket)
1007#    AC_CHECK_LIB(nsl, inet_ntoa)
1008# )
1009#
1010# Use this for now, instead:
1011#
1012case "$host" in
1013        mips-sgi-irix*)
1014                ;;
1015        *)
1016                AC_CHECK_LIB(socket, socket)
1017                AC_CHECK_LIB(nsl, inet_ntoa)
1018                ;;
1019esac
1020
1021#
1022# Purify support
1023#
1024AC_MSG_CHECKING(whether to use purify)
1025AC_ARG_WITH(purify,
1026        [  --with-purify[=PATH] use Rational purify],
1027        use_purify="$withval", use_purify="no")
1028
1029case "$use_purify" in
1030        no)
1031                ;;
1032        yes)
1033                AC_PATH_PROG(purify_path, purify, purify)
1034                ;;
1035        *)
1036                purify_path="$use_purify"
1037                ;;
1038esac
1039
1040case "$use_purify" in
1041        no)
1042                AC_MSG_RESULT(no)
1043                PURIFY=""
1044                ;;
1045        *)
1046                if test -f $purify_path || test $purify_path = purify; then
1047                        AC_MSG_RESULT($purify_path)
1048                        PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1049                        PURIFY="$purify_path $PURIFYFLAGS"
1050                else
1051                        AC_MSG_ERROR([$purify_path not found.
1052
1053Please choose the proper path with the following command:
1054
1055    configure --with-purify=PATH
1056])
1057                fi
1058                ;;
1059esac
1060
1061AC_SUBST(PURIFY)
1062
1063#
1064# GNU libtool support
1065#
1066AC_ARG_WITH(libtool,
1067            [  --with-libtool   use GNU libtool (following indented options supported)],
1068            use_libtool="$withval", use_libtool="no")
1069
1070case $use_libtool in
1071        yes)
1072                AM_PROG_LIBTOOL
1073                O=lo
1074                A=la
1075                LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
1076                LIBTOOL_MODE_COMPILE='--mode=compile'
1077                LIBTOOL_MODE_INSTALL='--mode=install'
1078                LIBTOOL_MODE_LINK='--mode=link'
1079                case "$host" in
1080                *) LIBTOOL_ALLOW_UNDEFINED= ;;
1081                esac
1082                case "$host" in
1083                *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
1084                *) LIBTOOL_IN_MAIN= ;;
1085                esac;
1086                ;;
1087        *)
1088                O=o
1089                A=a
1090                LIBTOOL=
1091                AC_SUBST(LIBTOOL)
1092                LIBTOOL_MKDEP_SED=
1093                LIBTOOL_MODE_COMPILE=
1094                LIBTOOL_MODE_INSTALL=
1095                LIBTOOL_MODE_LINK=
1096                LIBTOOL_ALLOW_UNDEFINED=
1097                LIBTOOL_IN_MAIN=
1098                ;;
1099esac
1100
1101#
1102# File name extension for static archive files, for those few places
1103# where they are treated differently from dynamic ones.
1104#
1105SA=a
1106
1107AC_SUBST(O)
1108AC_SUBST(A)
1109AC_SUBST(SA)
1110AC_SUBST(LIBTOOL_MKDEP_SED)
1111AC_SUBST(LIBTOOL_MODE_COMPILE)
1112AC_SUBST(LIBTOOL_MODE_INSTALL)
1113AC_SUBST(LIBTOOL_MODE_LINK)
1114AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
1115AC_SUBST(LIBTOOL_IN_MAIN)
1116
1117#
1118# build libbind?
1119#
1120AC_ARG_ENABLE(libbind,
1121        [  --enable-libbind             build libbind [default=no]])
1122
1123case "$enable_libbind" in
1124        yes)
1125                LIBBIND=lib/bind
1126                AC_SUBST(LIBBIND)
1127                ;;
1128        no|'')
1129                ;;
1130esac
1131
1132#
1133# Here begins a very long section to determine the system's networking
1134# capabilities.  The order of the tests is signficant.
1135#
1136
1137#
1138# IPv6
1139#
1140AC_ARG_ENABLE(ipv6,
1141        [  --enable-ipv6                use IPv6 [default=autodetect]])
1142
1143case "$enable_ipv6" in
1144        yes|''|autodetect)
1145                AC_DEFINE(WANT_IPV6)
1146                ;;
1147        no)
1148                ;;
1149esac
1150
1151#
1152# We do the IPv6 compilation checking after libtool so that we can put
1153# the right suffix on the files.
1154#
1155AC_MSG_CHECKING(for IPv6 structures)
1156AC_TRY_COMPILE([
1157#include <sys/types.h>
1158#include <sys/socket.h>
1159#include <netinet/in.h>],
1160[struct sockaddr_in6 sin6; return (0);],
1161        [AC_MSG_RESULT(yes)
1162         found_ipv6=yes],
1163        [AC_MSG_RESULT(no)
1164         found_ipv6=no])
1165
1166#
1167# See whether IPv6 support is provided via a Kame add-on.
1168# This is done before other IPv6 linking tests to LIBS is properly set.
1169#
1170AC_MSG_CHECKING(for Kame IPv6 support)
1171AC_ARG_WITH(kame,
1172        [  --with-kame[=PATH]   use Kame IPv6 [default path /usr/local/v6]],
1173        use_kame="$withval", use_kame="no")
1174
1175case "$use_kame" in
1176        no)
1177                ;;
1178        yes)
1179                kame_path=/usr/local/v6
1180                ;;
1181        *)
1182                kame_path="$use_kame"
1183                ;;
1184esac
1185
1186case "$use_kame" in
1187        no)
1188                AC_MSG_RESULT(no)
1189                ;;
1190        *)
1191                if test -f $kame_path/lib/libinet6.a; then
1192                        AC_MSG_RESULT($kame_path/lib/libinet6.a)
1193                        LIBS="-L$kame_path/lib -linet6 $LIBS"
1194                else
1195                        AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
1196
1197Please choose the proper path with the following command:
1198
1199    configure --with-kame=PATH
1200])
1201                fi
1202                ;;
1203esac
1204
1205#
1206# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
1207# Including it on Kame-using platforms is very bad, though, because
1208# Kame uses #error against direct inclusion.   So include it on only
1209# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
1210# This is done before the in6_pktinfo check because that's what
1211# netinet6/in6.h is needed for.
1212#
1213changequote({, })
1214case "$host" in
1215*-bsdi4.[01]*)
1216        ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
1217        LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
1218        isc_netinet6in6_hack="#include <netinet6/in6.h>"
1219        ;;
1220*)
1221        ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
1222        LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
1223        isc_netinet6in6_hack=""
1224        ;;
1225esac
1226changequote([, ])
1227
1228#
1229# This is similar to the netinet6/in6.h issue.
1230#
1231case "$host" in
1232*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
1233        # UnixWare
1234        ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
1235        LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
1236        ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
1237        isc_netinetin6_hack="#include <netinet/in6.h>"
1238        ;;
1239*)
1240        ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
1241        LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
1242        ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
1243        isc_netinetin6_hack=""
1244        ;;
1245esac
1246
1247#
1248# Now delve deeper into the suitability of the IPv6 support.
1249#
1250case "$found_ipv6" in
1251        yes)
1252                ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
1253                LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
1254
1255                AC_MSG_CHECKING(for in6_addr)
1256                AC_TRY_COMPILE([
1257#include <sys/types.h>
1258#include <sys/socket.h>
1259#include <netinet/in.h>
1260$isc_netinetin6_hack
1261$isc_netinet6in6_hack
1262],
1263[struct in6_addr in6; return (0);],
1264                [AC_MSG_RESULT(yes)
1265                 ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
1266                 LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
1267                 isc_in_addr6_hack=""],
1268                [AC_MSG_RESULT(no)
1269                 ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
1270                 LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
1271                 isc_in_addr6_hack="#define in6_addr in_addr6"])
1272
1273                AC_MSG_CHECKING(for in6addr_any)
1274                AC_TRY_LINK([
1275#include <sys/types.h>
1276#include <sys/socket.h>
1277#include <netinet/in.h>
1278$isc_netinetin6_hack
1279$isc_netinet6in6_hack
1280$isc_in_addr6_hack
1281],
1282                [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
1283                        [AC_MSG_RESULT(yes)
1284                         ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1285                         LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
1286                        [AC_MSG_RESULT(no)
1287                         ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
1288                         LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
1289
1290                AC_MSG_CHECKING(for in6addr_loopback)
1291                AC_TRY_LINK([
1292#include <sys/types.h>
1293#include <sys/socket.h>
1294#include <netinet/in.h>
1295$isc_netinetin6_hack
1296$isc_netinet6in6_hack
1297$isc_in_addr6_hack
1298],
1299                [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
1300                        [AC_MSG_RESULT(yes)
1301                         ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
1302                         LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
1303                        [AC_MSG_RESULT(no)
1304                         ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
1305                         LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
1306
1307                AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
1308                AC_TRY_COMPILE([
1309#include <sys/types.h>
1310#include <sys/socket.h>
1311#include <netinet/in.h>
1312$isc_netinetin6_hack
1313$isc_netinet6in6_hack
1314],
1315                [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
1316                        [AC_MSG_RESULT(yes)
1317                         ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1318                         result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
1319                        [AC_MSG_RESULT(no)
1320                         ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
1321                         result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
1322                LWRES_HAVE_SIN6_SCOPE_ID="$result"
1323
1324                AC_MSG_CHECKING(for in6_pktinfo)
1325                AC_TRY_COMPILE([
1326#include <sys/types.h>
1327#include <sys/socket.h>
1328#include <netinet/in.h>
1329$isc_netinetin6_hack
1330$isc_netinet6in6_hack
1331],
1332                [struct in6_pktinfo xyzzy; return (0);],
1333                        [AC_MSG_RESULT(yes)
1334                         ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
1335                        [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
1336                         ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
1337                ;;
1338        no)
1339                ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
1340                LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
1341                ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
1342                LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
1343                ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
1344                LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
1345                ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
1346                ISC_IPV6_H="ipv6.h"
1347                ISC_IPV6_O="ipv6.$O"
1348                ISC_ISCIPV6_O="unix/ipv6.$O"
1349                ISC_IPV6_C="ipv6.c"
1350                ;;
1351esac
1352
1353AC_SUBST(ISC_PLATFORM_HAVEIPV6)
1354AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
1355AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
1356AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
1357AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
1358AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
1359AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
1360AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
1361AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
1362AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
1363AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
1364AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
1365AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
1366AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
1367AC_SUBST(ISC_IPV6_H)
1368AC_SUBST(ISC_IPV6_O)
1369AC_SUBST(ISC_ISCIPV6_O)
1370AC_SUBST(ISC_IPV6_C)
1371AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
1372AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
1373
1374AC_MSG_CHECKING([for struct if_laddrreq])
1375AC_TRY_LINK([
1376#include <sys/types.h>
1377#include <net/if6.h>
1378],[ struct if_laddrreq a; ],
1379        [AC_MSG_RESULT(yes)
1380        ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
1381        [AC_MSG_RESULT(no)
1382        ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
1383AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
1384
1385AC_MSG_CHECKING([for struct if_laddrconf])
1386AC_TRY_LINK([
1387#include <sys/types.h>
1388#include <net/if6.h>
1389],[ struct if_laddrconf a; ],
1390        [AC_MSG_RESULT(yes)
1391        ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
1392        [AC_MSG_RESULT(no)
1393        ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
1394AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
1395
1396#
1397# Check for network functions that are often missing.  We do this
1398# after the libtool checking, so we can put the right suffix on
1399# the files.  It also needs to come after checking for a Kame add-on,
1400# which provides some (all?) of the desired functions.
1401#
1402
1403AC_MSG_CHECKING([for inet_ntop with IPv6 support])
1404AC_TRY_RUN([
1405#include <sys/types.h>
1406#include <sys/socket.h>
1407#include <netinet/in.h>
1408#include <arpa/inet.h>
1409main() {
1410char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
1411        [AC_MSG_RESULT(yes)
1412        ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
1413
1414        [AC_MSG_RESULT(no)
1415        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
1416        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
1417        ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
1418
1419
1420# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
1421# addresses with less than four octets, like "1.2.3".  Also leading
1422# zeros should also be rejected.
1423
1424AC_MSG_CHECKING([for working inet_pton with IPv6 support])
1425AC_TRY_RUN([
1426#include <sys/types.h>
1427#include <sys/socket.h>
1428#include <netinet/in.h>
1429#include <arpa/inet.h>
1430main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
1431                             inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
1432                             (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
1433        [AC_MSG_RESULT(yes)
1434        ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
1435        [AC_MSG_RESULT(no)
1436        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
1437        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1438        ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
1439        [AC_MSG_RESULT(assuming target platform has working inet_pton)
1440        ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"])
1441
1442AC_MSG_CHECKING([for inet_aton])
1443AC_TRY_LINK([
1444#include <sys/types.h>
1445#include <netinet/in.h>
1446#include <arpa/inet.h>],
1447        [struct in_addr in; inet_aton(0, &in); return (0);],
1448        [AC_MSG_RESULT(yes)
1449        ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
1450
1451        [AC_MSG_RESULT(no)
1452        ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
1453        ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
1454        ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"])
1455
1456AC_SUBST(ISC_PLATFORM_NEEDNTOP)
1457AC_SUBST(ISC_PLATFORM_NEEDPTON)
1458AC_SUBST(ISC_PLATFORM_NEEDATON)
1459
1460#
1461# Look for a 4.4BSD-style sa_len member in struct sockaddr.
1462#
1463case "$host" in
1464        *-dec-osf*)
1465                # Turn on 4.4BSD style sa_len support.
1466                AC_DEFINE(_SOCKADDR_LEN)
1467                ;;
1468esac
1469
1470AC_MSG_CHECKING(for sa_len in struct sockaddr)
1471AC_TRY_COMPILE([
1472#include <sys/types.h>
1473#include <sys/socket.h>],
1474[struct sockaddr sa; sa.sa_len = 0; return (0);],
1475        [AC_MSG_RESULT(yes)
1476        ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
1477        LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
1478        [AC_MSG_RESULT(no)
1479        ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
1480        LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
1481AC_SUBST(ISC_PLATFORM_HAVESALEN)
1482AC_SUBST(LWRES_PLATFORM_HAVESALEN)
1483
1484#
1485# Look for a 4.4BSD or 4.3BSD struct msghdr
1486#
1487AC_MSG_CHECKING(for struct msghdr flavor)
1488AC_TRY_COMPILE([
1489#include <sys/types.h>
1490#include <sys/socket.h>],
1491[struct msghdr msg; msg.msg_flags = 0; return (0);],
1492        [AC_MSG_RESULT(4.4BSD)
1493        ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1494        [AC_MSG_RESULT(4.3BSD)
1495        ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1496AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1497
1498#
1499# Look for in_port_t.
1500#
1501AC_MSG_CHECKING(for type in_port_t)
1502AC_TRY_COMPILE([
1503#include <sys/types.h>
1504#include <netinet/in.h>],
1505[in_port_t port = 25; return (0);],
1506        [AC_MSG_RESULT(yes)
1507        ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1508        [AC_MSG_RESULT(no)
1509        ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1510AC_SUBST(ISC_PLATFORM_NEEDPORTT)
1511
1512#
1513# Check for addrinfo
1514#
1515AC_MSG_CHECKING(for struct addrinfo)
1516AC_TRY_COMPILE([
1517#include <netdb.h>],
1518[struct addrinfo a; return (0);],
1519        [AC_MSG_RESULT(yes)
1520        ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
1521        AC_DEFINE(HAVE_ADDRINFO)],
1522        [AC_MSG_RESULT(no)
1523        ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
1524AC_SUBST(ISC_LWRES_NEEDADDRINFO)
1525
1526#
1527# Check for rrsetinfo
1528#
1529AC_MSG_CHECKING(for struct rrsetinfo)
1530AC_TRY_COMPILE([
1531#include <netdb.h>],
1532[struct rrsetinfo r; return (0);],
1533        [AC_MSG_RESULT(yes)
1534        ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
1535        [AC_MSG_RESULT(no)
1536        ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
1537AC_SUBST(ISC_LWRES_NEEDRRSETINFO)
1538
1539AC_MSG_CHECKING(for int sethostent)
1540AC_TRY_COMPILE([
1541#include <netdb.h>],
1542[int i = sethostent(0); return(0);],
1543        [AC_MSG_RESULT(yes)
1544        ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
1545        [AC_MSG_RESULT(no)
1546        ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
1547AC_SUBST(ISC_LWRES_SETHOSTENTINT)
1548
1549AC_MSG_CHECKING(for int endhostent)
1550AC_TRY_COMPILE([
1551#include <netdb.h>],
1552[int i = endhostent(); return(0);],
1553        [AC_MSG_RESULT(yes)
1554        ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1555        [AC_MSG_RESULT(no)
1556        ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1557AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1558
1559AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
1560AC_TRY_COMPILE([
1561#include <netdb.h>
1562struct netent *getnetbyaddr(in_addr_t, int);],
1563[],
1564        [AC_MSG_RESULT(yes)
1565        ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
1566        [AC_MSG_RESULT(no)
1567        ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
1568AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
1569
1570AC_MSG_CHECKING(for int setnetent)
1571AC_TRY_COMPILE([
1572#include <netdb.h>],
1573[int i = setnetent(0); return(0);],
1574        [AC_MSG_RESULT(yes)
1575        ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1576        [AC_MSG_RESULT(no)
1577        ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1578AC_SUBST(ISC_LWRES_SETNETENTINT)
1579
1580AC_MSG_CHECKING(for int endnetent)
1581AC_TRY_COMPILE([
1582#include <netdb.h>],
1583[int i = endnetent(); return(0);],
1584        [AC_MSG_RESULT(yes)
1585        ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1586        [AC_MSG_RESULT(no)
1587        ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1588AC_SUBST(ISC_LWRES_ENDNETENTINT)
1589
1590AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1591AC_TRY_COMPILE([
1592#include <netdb.h>
1593struct hostent *gethostbyaddr(const void *, size_t, int);],
1594[return(0);],
1595        [AC_MSG_RESULT(yes)
1596        ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1597        [AC_MSG_RESULT(no)
1598        ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1599AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1600
1601AC_MSG_CHECKING(for h_errno in netdb.h)
1602AC_TRY_COMPILE([
1603#include <netdb.h>],
1604[h_errno = 1; return(0);],
1605        [AC_MSG_RESULT(yes)
1606        ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1607        [AC_MSG_RESULT(no)
1608        ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1609AC_SUBST(ISC_LWRES_NEEDHERRNO)
1610
1611AC_CHECK_FUNC(getipnodebyname,
1612        [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1613        [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1614AC_CHECK_FUNC(getnameinfo,
1615        [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1616        [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1617AC_CHECK_FUNC(getaddrinfo,
1618        [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1619        AC_DEFINE(HAVE_GETADDRINFO)],
1620        [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1621AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1622AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1623AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1624AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1625
1626AC_ARG_ENABLE(getifaddrs,
1627[  --enable-getifaddrs    Enable the use of getifaddrs() [[yes|no|glibc]].
1628             glibc: Use getifaddrs() in glibc if you know it supports IPv6.],
1629    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1630
1631case $want_getifaddrs in
1632yes|glibc)
1633#
1634# Do we have getifaddrs() ?
1635#
1636case $host in
1637*-linux*)
1638        # Some recent versions of glibc support getifaddrs() which does not
1639        # provide AF_INET6 addresses while the function provided by the USAGI
1640        # project handles the AF_INET6 case correctly.  We need to avoid
1641        # using the former but prefer the latter unless overridden by
1642        # --enable-getifaddrs=glibc.
1643        if test $want_getifaddrs = glibc
1644        then
1645                AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1646        else
1647                save_LIBS="$LIBS"
1648                LIBS="-L/usr/local/v6/lib $LIBS"
1649                AC_CHECK_LIB(inet6, getifaddrs,
1650                        LIBS="$LIBS -linet6"
1651                        AC_DEFINE(HAVE_GETIFADDRS),
1652                        LIBS=${save_LIBS})
1653        fi
1654        ;;
1655*)
1656        AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
1657        ;;
1658esac
1659;;
1660no)
1661;;
1662esac
1663
1664#
1665# Look for a sysctl call to get the list of network interfaces.
1666#
1667case $ac_cv_header_sys_sysctl_h in
1668yes)
1669AC_MSG_CHECKING(for interface list sysctl)
1670AC_EGREP_CPP(found_rt_iflist, [
1671#include <sys/param.h>
1672#include <sys/sysctl.h>
1673#include <sys/socket.h>
1674#ifdef NET_RT_IFLIST
1675found_rt_iflist
1676#endif
1677],
1678        [AC_MSG_RESULT(yes)
1679         AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1680        [AC_MSG_RESULT(no)])
1681;;
1682esac
1683
1684#
1685# Check for some other useful functions that are not ever-present.
1686#
1687
1688# We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
1689# because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
1690# reportedly defines strsep() without declaring it in <string.h> when
1691# -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
1692# AC_CHECK_FUNC() incorrectly succeeds because it declares
1693# the function itself.
1694AC_MSG_CHECKING(for correctly declared strsep())
1695AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
1696        [AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1697        [AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1698AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1699
1700AC_CHECK_FUNC(memmove,
1701        [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
1702        [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
1703AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
1704
1705AC_CHECK_FUNC(strtoul,
1706        [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"],
1707        [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"])
1708AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
1709
1710AC_CHECK_FUNC(strlcpy,
1711        [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
1712        [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
1713AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
1714
1715AC_CHECK_FUNC(strlcat,
1716        [ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
1717        [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
1718AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
1719
1720ISC_PRINT_OBJS=
1721ISC_PRINT_SRCS=
1722AC_MSG_CHECKING(sprintf)
1723AC_TRY_COMPILE([
1724#include <stdio.h>
1725],
1726[ char buf[2]; return(*sprintf(buf,"x"));],
1727[
1728ISC_PRINT_OBJS="print.$O"
1729ISC_PRINT_SRCS="print.c"
1730ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
1731LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
1732],
1733[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
1734 LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
1735)
1736AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
1737AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
1738
1739AC_CHECK_FUNC(vsnprintf,
1740        [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
1741         LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
1742        [ISC_PRINT_OBJS="print.$O"
1743         ISC_PRINT_SRCS="print.c"
1744         ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
1745         LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
1746AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1747AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
1748ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
1749ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
1750
1751AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
1752
1753AC_SUBST(ISC_EXTRA_OBJS)
1754AC_SUBST(ISC_EXTRA_SRCS)
1755
1756# Determine the printf format characters to use when printing
1757# values of type isc_int64_t. This will normally be "ll", but where
1758# the compiler treats "long long" as a alias for "long" and printf
1759# doesn't know about "long long" use "l".  Hopefully the sprintf
1760# will produce a inconsistant result in the later case.  If the compiler
1761# fails due to seeing "%lld" we fall back to "l".
1762#
1763# Win32 uses "%I64d", but that's defined elsewhere since we don't use
1764# configure on Win32.
1765#
1766AC_MSG_CHECKING(printf format modifier for 64-bit integers)
1767AC_TRY_RUN([
1768#include <stdio.h>
1769main() {
1770        long long int j = 0;
1771        char buf[100];
1772        buf[0] = 0;
1773        sprintf(buf, "%lld", j);
1774        exit((sizeof(long long int) != sizeof(long int))? 0 :
1775             (strcmp(buf, "0") != 0));
1776}
1777],
1778        [AC_MSG_RESULT(ll)
1779        ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'],
1780        [AC_MSG_RESULT(l)
1781        ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'],
1782        [AC_MSG_RESULT(assuming target platform uses ll)
1783        ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'])
1784AC_SUBST(ISC_PLATFORM_QUADFORMAT)
1785
1786#
1787# Security Stuff
1788#
1789AC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
1790AC_ARG_ENABLE(linux-caps,
1791        [  --disable-linux-caps disable linux capabilities])
1792case "$enable_linux_caps" in
1793        yes|'')
1794                AC_CHECK_HEADERS(linux/capability.h)
1795                ;;
1796        no)
1797                ;;
1798esac
1799AC_CHECK_HEADERS(sys/prctl.h)
1800
1801#
1802# Time Zone Stuff
1803#
1804AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
1805
1806#
1807# BSD/OS, and perhaps some others, don't define rlim_t.
1808#
1809AC_MSG_CHECKING(for type rlim_t)
1810AC_TRY_COMPILE([
1811#include <sys/types.h>
1812#include <sys/time.h>
1813#include <sys/resource.h>],
1814[rlim_t rl = 19671212; return (0);],
1815[AC_MSG_RESULT(yes)
1816 ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
1817[AC_MSG_RESULT(no)
1818
1819AC_MSG_CHECKING(type of rlim_cur)
1820AC_TRY_RUN([
1821#include <sys/types.h>
1822#include <sys/time.h>
1823#include <sys/resource.h>
1824main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
1825[AC_MSG_RESULT(int)
1826ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
1827[
1828AC_TRY_RUN([
1829#include <sys/types.h>
1830#include <sys/time.h>
1831#include <sys/resource.h>
1832main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
1833[AC_MSG_RESULT(long int)
1834ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
1835[
1836AC_TRY_RUN([
1837#include <sys/types.h>
1838#include <sys/time.h>
1839#include <sys/resource.h>
1840main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
1841[AC_MSG_RESULT(long long int)
1842ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
1843[AC_MSG_ERROR([unable to determine sizeof rlim_cur])
1844],[AC_MSG_ERROR(this cannot happen)])
1845],[AC_MSG_ERROR(this cannot happen)])
1846],[AC_MSG_ERROR(cannot determine type of rlim_cur when cross compiling - define rlim_t)])
1847])
1848AC_SUBST(ISC_PLATFORM_RLIMITTYPE)
1849
1850#
1851# Compaq TruCluster requires more code for handling cluster IP aliases
1852#
1853case "$host" in
1854        *-dec-osf*)
1855                AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
1856                AC_CHECK_FUNC(clua_getaliasaddress,
1857                                AC_DEFINE(HAVE_TRUCLUSTER, 1,
1858                                        [Define if running under Compaq TruCluster]))
1859                ;;
1860        *)
1861                ;;
1862esac
1863
1864#
1865# Microsoft has their own way of handling shared libraries that requires
1866# additional qualifiers on extern variables.  Unix systems don't need it.
1867#
1868AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
1869ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
1870AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
1871LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
1872
1873#
1874# Random remaining OS-specific issues involving compiler warnings.
1875# XXXDCL print messages to indicate some compensation is being done?
1876#
1877AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
1878ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
1879
1880case "$host" in
1881        *-aix5.1.*)
1882                hack_shutup_pthreadonceinit=yes
1883                ;;
1884        *-bsdi3.1*)
1885                hack_shutup_sputaux=yes
1886                ;;
1887        *-bsdi4.0*)
1888                hack_shutup_sigwait=yes
1889                hack_shutup_sputaux=yes
1890                ;;
1891        [*-bsdi4.[12]*])
1892                hack_shutup_stdargcast=yes
1893                ;;
1894        [*-solaris2.[89]])
1895                hack_shutup_pthreadonceinit=yes
1896                ;;
1897esac
1898
1899case "$hack_shutup_pthreadonceinit" in
1900        yes)
1901                #
1902                # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
1903                #
1904                ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
1905                ;;
1906esac
1907
1908case "$hack_shutup_sigwait" in
1909        yes)
1910                #
1911                # Shut up a -Wmissing-prototypes warning for sigwait().
1912                #
1913                AC_DEFINE(SHUTUP_SIGWAIT)
1914                ;;
1915esac
1916
1917case "$hack_shutup_sputaux" in
1918        yes)
1919                #
1920                # Shut up a -Wmissing-prototypes warning from <stdio.h>.
1921                #
1922                AC_DEFINE(SHUTUP_SPUTAUX)
1923                ;;
1924esac
1925
1926case "$hack_shutup_stdargcast" in
1927        yes)
1928                #
1929                # Shut up a -Wcast-qual warning from va_start().
1930                #
1931                AC_DEFINE(SHUTUP_STDARG_CAST)
1932                ;;
1933esac
1934
1935#
1936# Check for if_nametoindex() for IPv6 scoped addresses support
1937#
1938AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
1939                ac_cv_have_if_nametoindex=no)
1940case $ac_cv_have_if_nametoindex in
1941no)
1942        case "$host" in
1943        *-hp-hpux*)
1944                AC_CHECK_LIB(ipv6, if_nametoindex,
1945                                ac_cv_have_if_nametoindex=yes
1946                                LIBS="-lipv6 $LIBS",)
1947        ;;
1948        esac
1949esac
1950case $ac_cv_have_if_nametoindex in
1951yes)
1952        ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
1953        ;;
1954*)
1955        ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
1956        ;;
1957esac
1958AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
1959
1960#
1961# The following sections deal with tools used for formatting
1962# the documentation.  They are all optional, unless you are
1963# a developer editing the documentation source.
1964#
1965
1966# Directory trees where SGML files are commonly found.
1967sgmltrees="/usr/pkg/share/sgml /usr/local/share/sgml /usr/share/sgml"
1968
1969#
1970# Look for openjade.  Plain jade is no longer supported.
1971#
1972
1973AC_PATH_PROGS(OPENJADE, openjade, openjade)
1974AC_SUBST(OPENJADE)
1975
1976#
1977# Look for TeX.
1978#
1979
1980AC_PATH_PROGS(JADETEX, jadetex, jadetex)
1981AC_SUBST(JADETEX)
1982
1983AC_PATH_PROGS(PDFJADETEX, pdfjadetex, pdfjadetex)
1984AC_SUBST(PDFJADETEX)
1985
1986#
1987# Subroutine for searching for an ordinary file (e.g., a stylesheet)
1988# in a number of directories:
1989#
1990#   NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
1991#
1992# If the file FILENAME is found in one of the DIRECTORIES, the shell
1993# variable VARIABLE is defined to its absolute pathname.  Otherwise,
1994# it is set to FILENAME, with no directory prefix (that's not terribly
1995# useful, but looks less confusing in substitutions than leaving it
1996# empty).  The variable VARIABLE will be substituted into output files.
1997#
1998
1999AC_DEFUN(NOM_PATH_FILE, [
2000$1=""
2001AC_MSG_CHECKING(for $2)
2002for d in $3
2003do
2004        f=$d/$2
2005        if test -f $f
2006        then
2007                $1=$f
2008                AC_MSG_RESULT($f)
2009                break
2010        fi
2011done
2012if test "X[$]$1" = "X"
2013then
2014        AC_MSG_RESULT("not found");
2015        $1=$2
2016fi
2017AC_SUBST($1)
2018])
2019
2020#
2021# Look for the SGML catalog.
2022# Its location varies, so far we have seen:
2023#
2024#       NetBSD  /usr/pkg/share/sgml/docbook/catalog
2025#       FreeBSD /usr/local/share/sgml/docbook/catalog
2026#       Linux   /usr/local/share/dsssl/docbook/catalog
2027#               /usr/share/sgml/docbook/dsssl-stylesheets/catalog
2028#
2029catalogpath=""
2030for d in $sgmltrees
2031do
2032        catalogpath="$catalogpath $d"
2033        for s in docbook/dsssl-stylesheets
2034        do
2035                catalogpath="$catalogpath $d/$s"
2036        done
2037done
2038NOM_PATH_FILE(SGMLCATALOG, catalog, $catalogpath)
2039
2040#
2041# Look for the HTML stylesheet html/docbook.dsl, used for
2042# formatting man pages in HTML.  Its location varies,
2043# so far we have seen:
2044#
2045#       NetBSD  /usr/pkg/share/sgml/docbook/dsssl/modular/
2046#       FreeBSD /usr/local/share/sgml/docbook/dsssl/modular/
2047#       Linux   /usr/local/share/dsssl/docbook/
2048#               /usr/share/sgml/docbook/dsssl-stylesheets/
2049#
2050# Ditto for the print stylesheet print/docbook.dsl.
2051#
2052
2053stylepath=""
2054for d in $sgmltrees
2055do
2056        for s in docbook/dsssl/modular dsssl/docbook docbook/dsssl-stylesheets
2057        do
2058                stylepath="$stylepath $d/$s"
2059        done
2060done
2061NOM_PATH_FILE(HTMLSTYLE, html/docbook.dsl, $stylepath)
2062NOM_PATH_FILE(PRINTSTYLE, print/docbook.dsl, $stylepath)
2063
2064#
2065# Look for XML declarations.
2066# Its location varies, so far we have seen:
2067#
2068#       NetBSD  /usr/pkg/share/sgml/docbook/dsssl/modular/dtds/decls/
2069#       FreeBSD /usr/local/share/sgml/docbook/dsssl/modular/dtds/decls/
2070#       Linux   /usr/local/share/dsssl/docbook/dtds/decls/
2071#               /usr/share/sgml/docbook/dsssl-stylesheets/dtds/decls/
2072#
2073
2074xmlpath=""
2075for d in $sgmltrees
2076do
2077        for s in docbook/dsssl/modular dsssl/docbook docbook/dsssl-stylesheets
2078        do
2079                xmlpath="$xmlpath $d/$s"
2080        done
2081done
2082NOM_PATH_FILE(XMLDCL, dtds/decls/xml.dcl, $xmlpath)
2083
2084#
2085# Look for docbook2man-spec.pl
2086#
2087
2088NOM_PATH_FILE(DOCBOOK2MANSPEC, docbook2X/docbook2man-spec.pl, $sgmltrees)
2089
2090#
2091# Substitutions
2092#
2093AC_SUBST(BIND9_TOP_BUILDDIR)
2094BIND9_TOP_BUILDDIR=`pwd`
2095
2096AC_SUBST(BIND9_ISC_BUILDINCLUDE)
2097AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
2098AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
2099AC_SUBST(BIND9_DNS_BUILDINCLUDE)
2100AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
2101AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
2102if test "X$srcdir" != "X"; then
2103        BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
2104        BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
2105        BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
2106        BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
2107        BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
2108        BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
2109else
2110        BIND9_ISC_BUILDINCLUDE=""
2111        BIND9_ISCCC_BUILDINCLUDE=""
2112        BIND9_ISCCFG_BUILDINCLUDE=""
2113        BIND9_DNS_BUILDINCLUDE=""
2114        BIND9_LWRES_BUILDINCLUDE=""
2115        BIND9_BIND9_BUILDINCLUDE=""
2116fi
2117
2118AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
2119BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2120
2121AC_SUBST_FILE(BIND9_MAKE_RULES)
2122BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2123
2124. $srcdir/version
2125BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
2126AC_SUBST(BIND9_VERSION)
2127
2128AC_SUBST_FILE(LIBISC_API)
2129LIBISC_API=$srcdir/lib/isc/api
2130
2131AC_SUBST_FILE(LIBISCCC_API)
2132LIBISCCC_API=$srcdir/lib/isccc/api
2133
2134AC_SUBST_FILE(LIBISCCFG_API)
2135LIBISCCFG_API=$srcdir/lib/isccfg/api
2136
2137AC_SUBST_FILE(LIBDNS_API)
2138LIBDNS_API=$srcdir/lib/dns/api
2139
2140AC_SUBST_FILE(LIBBIND9_API)
2141LIBBIND9_API=$srcdir/lib/bind9/api
2142
2143AC_SUBST_FILE(LIBLWRES_API)
2144LIBLWRES_API=$srcdir/lib/lwres/api
2145
2146AC_OUTPUT(
2147        make/rules
2148        make/includes
2149        Makefile
2150        make/Makefile
2151        make/mkdep
2152        lib/Makefile
2153        lib/isc/Makefile
2154        lib/isc/include/Makefile
2155        lib/isc/include/isc/Makefile
2156        lib/isc/include/isc/platform.h
2157        lib/isc/unix/Makefile
2158        lib/isc/unix/include/Makefile
2159        lib/isc/unix/include/isc/Makefile
2160        lib/isc/nls/Makefile
2161        lib/isc/$thread_dir/Makefile
2162        lib/isc/$thread_dir/include/Makefile
2163        lib/isc/$thread_dir/include/isc/Makefile
2164        lib/isccc/Makefile
2165        lib/isccc/include/Makefile
2166        lib/isccc/include/isccc/Makefile
2167        lib/isccfg/Makefile
2168        lib/isccfg/include/Makefile
2169        lib/isccfg/include/isccfg/Makefile
2170        lib/dns/Makefile
2171        lib/dns/include/Makefile
2172        lib/dns/include/dns/Makefile
2173        lib/dns/include/dst/Makefile
2174        lib/bind9/Makefile
2175        lib/bind9/include/Makefile
2176        lib/bind9/include/bind9/Makefile
2177        lib/lwres/Makefile
2178        lib/lwres/include/Makefile
2179        lib/lwres/include/lwres/Makefile
2180        lib/lwres/include/lwres/netdb.h
2181        lib/lwres/include/lwres/platform.h
2182        lib/lwres/man/Makefile
2183        lib/lwres/unix/Makefile
2184        lib/lwres/unix/include/Makefile
2185        lib/lwres/unix/include/lwres/Makefile
2186        lib/tests/Makefile
2187        lib/tests/include/Makefile
2188        lib/tests/include/tests/Makefile
2189        bin/Makefile
2190        bin/check/Makefile
2191        bin/named/Makefile
2192        bin/named/unix/Makefile
2193        bin/rndc/Makefile
2194        bin/rndc/unix/Makefile
2195        bin/dig/Makefile
2196        bin/nsupdate/Makefile
2197        bin/tests/Makefile
2198        bin/tests/names/Makefile
2199        bin/tests/master/Makefile
2200        bin/tests/rbt/Makefile
2201        bin/tests/db/Makefile
2202        bin/tests/tasks/Makefile
2203        bin/tests/timers/Makefile
2204        bin/tests/dst/Makefile
2205        bin/tests/mem/Makefile
2206        bin/tests/net/Makefile
2207        bin/tests/sockaddr/Makefile
2208        bin/tests/system/Makefile
2209        bin/tests/system/conf.sh
2210        bin/tests/system/lwresd/Makefile
2211        bin/tests/system/tkey/Makefile
2212        bin/tests/headerdep_test.sh
2213        bin/dnssec/Makefile
2214        doc/Makefile
2215        doc/arm/Makefile
2216        doc/arm/nominum-docbook-html.dsl
2217        doc/arm/nominum-docbook-print.dsl
2218        doc/arm/validate.sh
2219        doc/misc/Makefile
2220        docutil/docbook2man-wrapper.sh
2221        isc-config.sh
2222)
2223chmod a+x isc-config.sh
2224
2225# Tell Emacs to edit this file in shell mode.
2226# Local Variables:
2227# mode: sh
2228# End:
Note: See TracBrowser for help on using the repository browser.