Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / libbind / dist / configure.in
blobee93906a0d66a05294d2a99448a730e1450ac955
1 # Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 2001, 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 AC_REVISION(Revision: 1.145)
18 AC_INIT(resolv/herror.c)
19 AC_PREREQ(2.13)
21 AC_CONFIG_HEADER(config.h)
23 AC_CANONICAL_HOST
25 AC_PROG_MAKE_SET
26 AC_PROG_LIBTOOL
27 AC_PROG_INSTALL
29 AC_SUBST(STD_CINCLUDES)
30 AC_SUBST(STD_CDEFINES)
31 AC_SUBST(STD_CWARNINGS)
32 AC_SUBST(CCOPT)
34 AC_PATH_PROG(AR, ar)
35 ARFLAGS="cruv"
36 AC_SUBST(AR)
37 AC_SUBST(ARFLAGS)
39 AC_PATH_PROG(TBL, tbl)
40 AC_SUBST(TBL)
42 AC_PATH_PROG(NROFF, nroff)
43 AC_SUBST(NROFF)
45 AC_PATH_PROG(SED, sed)
46 AC_SUBST(SED)
48 AC_PATH_PROG(TR, tr)
49 AC_SUBST(TR)
51 # The POSIX ln(1) program.  Non-POSIX systems may substitute
52 # "copy" or something.
53 LN=ln
54 AC_SUBST(LN)
56 case "$AR" in
57         "")
58                 AC_MSG_ERROR([
59 ar program not found.  Please fix your PATH to include the directory in
60 which ar resides, or set AR in the environment with the full path to ar.
63                 ;;
64 esac
67 # Etags.
69 AC_PATH_PROGS(ETAGS, etags emacs-etags)
72 # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
73 # GNU emacs etags, and it requires the -L flag.
75 if test "X$ETAGS" != "X"; then
76         AC_MSG_CHECKING(for Exuberant Ctags etags)
77         if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
78                 AC_MSG_RESULT(yes)
79                 ETAGS="$ETAGS -L"
80         else
81                 AC_MSG_RESULT(no)
82         fi
84 AC_SUBST(ETAGS)
87 # Perl is optional; it is used only by some of the system test scripts.
89 AC_PATH_PROGS(PERL, perl5 perl)
90 AC_SUBST(PERL)
93 # isc/list.h and others clash with BIND 9 and system header files.
94 # Install into non-shared directory.
96 case "$includedir" in
97         '${prefix}/include')
98                 includedir='${prefix}/include/bind'
99                 ;;
100 esac
102 # -lbind can clash with system version.  Install into non-shared directory.
104 case "$libdir" in
105         '${prefix}/lib')
106                 libdir='${prefix}/lib/bind'
107                 ;;
108 esac
111 # Make sure INSTALL uses an absolute path, else it will be wrong in all
112 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
113 # configure based on the location of the file where it is substituted.
114 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
115 # subdirectory of install-sh, This relative path will be wrong for all
116 # directories more than one level down from install-sh.
118 case "$INSTALL" in
119         /*)
120                 ;;
121         *)
122                 #
123                 # Not all systems have dirname.
124                 #
125                 changequote({, })
126                 ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
127                 changequote([, ])
129                 ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
130                 test "$ac_dir" = "$ac_prog" && ac_dir=.
131                 test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
132                 INSTALL="$ac_dir/$ac_prog"
133                 ;;
134 esac
137 # On these hosts, we really want to use cc, not gcc, even if it is
138 # found.  The gcc that these systems have will not correctly handle
139 # pthreads.
141 # However, if the user sets $CC to be something, let that override
142 # our change.
144 if test "X$CC" = "X" ; then
145         case "$host" in
146                 *-dec-osf*)
147                         CC="cc"
148                         ;;
149                 *-solaris*)
150                         # Use Sun's cc if it is available, but watch
151                         # out for /usr/ucb/cc; it will never be the right
152                         # compiler to use.
153                         #
154                         # If setting CC here fails, the AC_PROG_CC done
155                         # below might still find gcc.
156                         IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
157                         for ac_dir in $PATH; do
158                                 test -z "$ac_dir" && ac_dir=.
159                                 case "$ac_dir" in
160                                 /usr/ucb)
161                                         # exclude
162                                         ;;
163                                 *)
164                                         if test -f "$ac_dir/cc"; then
165                                                 CC="$ac_dir/cc"
166                                                 break
167                                         fi
168                                         ;;
169                                 esac
170                         done
171                         IFS="$ac_save_ifs"
172                         ;;
173                 *-hp-hpux*)
174                         CC="cc"
175                         ;;
176                 mips-sgi-irix*)
177                         CC="cc"
178                         ;;
179         esac
183 AC_PROG_CC
185 AC_HEADER_STDC
187 AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/timers.h stropts.h memory.h)
189 AC_C_CONST
190 AC_C_INLINE
191 AC_TYPE_SIZE_T
192 AC_CHECK_TYPE(ssize_t,signed)
193 AC_CHECK_TYPE(uintptr_t,unsigned long)
194 AC_HEADER_TIME
197 # check for clock_gettime() in librt
199 AC_CHECK_LIB(rt, clock_gettime)
202 # check for MD5Init() in libmd5
204 AC_CHECK_LIB(md5, MD5Init)
207 # check if we need to #include sys/select.h explicitly
209 case $ac_cv_header_unistd_h in
210 yes)
211 AC_MSG_CHECKING(if unistd.h defines fd_set)
212 AC_TRY_COMPILE([
213 #include <unistd.h>],
214 [fd_set read_set; return (0);],
215         [AC_MSG_RESULT(yes)
216          ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
217          ],
218         [AC_MSG_RESULT(no)
219         case ac_cv_header_sys_select_h in
220         yes)
221          ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
222                 ;;
223         no)
224                 AC_MSG_ERROR([need either working unistd.h or sys/select.h])
225                 ;;
226         esac
227         ])
228         ;;
230         case ac_cv_header_sys_select_h in
231         yes)
232              ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
233                 ;;
234         no)
235                 AC_MSG_ERROR([need either unistd.h or sys/select.h])
236                 ;;
237         esac
238         ;;
239 esac
240 AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
243 # Find the machine's endian flavor.
245 AC_C_BIGENDIAN
247 AC_ARG_WITH(irs-gr,[  --with-irs-gr             Build with WANT_IRS_GR],
248 want_irs_gr="$withval", want_irs_gr="no")
249 case "$want_irs_gr" in
250 yes) WANT_IRS_GR="#define WANT_IRS_GR 1"
251      WANT_IRS_GR_OBJS="\${WANT_IRS_GR_OBJS}"
252         ;;
253 *) WANT_IRS_GR="#undef WANT_IRS_GR" WANT_IRS_GR_OBJS="";;
254 esac
255 AC_SUBST(WANT_IRS_GR)
256 AC_SUBST(WANT_IRS_GR_OBJS)
258 AC_ARG_WITH(irs-pw,[  --with-irs-pw             Build with WANT_IRS_PW],
259 want_irs_pw="$withval", want_irs_pw="no")
260 case "$want_irs_pw" in
261 yes) WANT_IRS_PW="#define WANT_IRS_PW 1"
262      WANT_IRS_PW_OBJS="\${WANT_IRS_PW_OBJS}";;
263 *) WANT_IRS_PW="#undef WANT_IRS_PW" WANT_IRS_PW_OBJS="";;
264 esac
265 AC_SUBST(WANT_IRS_PW)
266 AC_SUBST(WANT_IRS_PW_OBJS)
268 AC_ARG_WITH(irs-nis,[  --with-irs-nis   Build with WANT_IRS_NIS],
269 want_irs_nis="$withval", want_irs_nis="no")
270 case "$want_irs_nis" in
271 yes)
272         WANT_IRS_NIS="#define WANT_IRS_NIS 1"
273         WANT_IRS_NIS_OBJS="\${WANT_IRS_NIS_OBJS}"
274         case "$want_irs_gr" in
275         yes)
276                 WANT_IRS_NISGR_OBJS="\${WANT_IRS_NISGR_OBJS}";;
277         *)
278                 WANT_IRS_NISGR_OBJS="";;
279         esac
280         case "$want_irs_pw" in
281         yes)
282                 WANT_IRS_NISPW_OBJS="\${WANT_IRS_NISPW_OBJS}";;
283         *)
284                 WANT_IRS_NISPW_OBJS="";;
285         esac
286         ;;
288         WANT_IRS_NIS="#undef WANT_IRS_NIS"
289         WANT_IRS_NIS_OBJS=""
290         WANT_IRS_NISGR_OBJS=""
291         WANT_IRS_NISPW_OBJS="";;
292 esac
293 AC_SUBST(WANT_IRS_NIS)
294 AC_SUBST(WANT_IRS_NIS_OBJS)
295 AC_SUBST(WANT_IRS_NISGR_OBJS)
296 AC_SUBST(WANT_IRS_NISPW_OBJS)
297 AC_TRY_RUN([
298 #ifdef HAVE_DB_H
299 int have_db_h = 1;
300 #else
301 int have_db_h = 0;
302 #endif
303 main() { return(!have_db_h); }
305 WANT_IRS_DBPW_OBJS="\${WANT_IRS_DBPW_OBJS}"
307 WANT_IRS_DBPW_OBJS=""
309 WANT_IRS_DBPW_OBJS=""
311 AC_SUBST(WANT_IRS_DBPW_OBJS)
314 # was --with-randomdev specified?
316 AC_MSG_CHECKING(for random device)
317 AC_ARG_WITH(randomdev,
318 [  --with-randomdev=PATH Specify path for random device],
319     use_randomdev="$withval", use_randomdev="unspec")
321 case "$use_randomdev" in
322         unspec)
323                 case "$host" in
324                         *-openbsd*)
325                                 devrandom=/dev/srandom
326                                 ;;
327                         *)
328                                 devrandom=/dev/random
329                                 ;;
330                 esac
331                 AC_MSG_RESULT($devrandom)
332                 AC_CHECK_FILE($devrandom,
333                               AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
334                                                  "$devrandom"),)
335                 ;;
336         yes)
337                 AC_MSG_ERROR([--with-randomdev must specify a path])
338                 ;;
339         *)
340                 AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
341                 AC_MSG_RESULT(using "$use_randomdev")
342                 ;;
343 esac
345 sinclude(./config.threads.in)dnl
347 if $use_threads
348 then
349         if test "X$GCC" = "Xyes"; then
350                 case "$host" in
351                 *-freebsd*)
352                         CC="$CC -pthread"
353                         CCOPT="$CCOPT -pthread"
354                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
355                         ;;
356                 *-openbsd*)
357                         CC="$CC -pthread"
358                         CCOPT="$CCOPT -pthread"
359                         ;;
360                 *-solaris*)
361                         LIBS="$LIBS -lthread"
362                         ;;
363                 *-ibm-aix*)
364                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
365                         ;;
366                 esac
367         else
368                 case $host in
369                 *-dec-osf*)
370                         CC="$CC -pthread"
371                         CCOPT="$CCOPT -pthread"
372                         ;;
373                 *-solaris*)
374                         CC="$CC -mt"
375                         CCOPT="$CCOPT -mt"
376                         ;;
377                 *-ibm-aix*)
378                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
379                         ;;
380                 *-UnixWare*)
381                         CC="$CC -Kthread"
382                         CCOPT="$CCOPT -Kthread"
383                         ;;
384                 esac
385         fi
386         AC_DEFINE(_REENTRANT)
387         ALWAYS_DEFINES="-D_REENTRANT"
388         DO_PTHREADS="#define DO_PTHREADS 1"
389         WANT_IRS_THREADSGR_OBJS="\${WANT_IRS_THREADSGR_OBJS}"
390         WANT_IRS_THREADSPW_OBJS="\${WANT_IRS_THREADSPW_OBJS}"
391         case $host in
392         ia64-hp-hpux11.*)
393                 WANT_IRS_THREADS_OBJS="";;
394         *)
395                 WANT_IRS_THREADS_OBJS="\${WANT_IRS_THREADS_OBJS}";;
396         esac
397         WANT_THREADS_OBJS="\${WANT_THREADS_OBJS}"
398         thread_dir=pthreads
400         #
401         # We'd like to use sigwait() too
402         #
403         AC_CHECK_FUNC(sigwait,
404                       AC_DEFINE(HAVE_SIGWAIT),
405                       AC_CHECK_LIB(c, sigwait,
406                       AC_DEFINE(HAVE_SIGWAIT),
407                       AC_CHECK_LIB(pthread, sigwait,
408                                    AC_DEFINE(HAVE_SIGWAIT),
409                                    AC_CHECK_LIB(pthread, _Psigwait,
410                                                 AC_DEFINE(HAVE_SIGWAIT),))))
412         AC_CHECK_FUNC(pthread_attr_getstacksize,
413                       AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
415         #
416         # Additional OS-specific issues related to pthreads and sigwait.
417         #
418         case "$host" in
419                 #
420                 # One more place to look for sigwait.
421                 #
422                 *-freebsd*)
423                         AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
424                         ;;
425                 #
426                 # BSDI 3.0 through 4.0.1 needs pthread_init() to be
427                 # called before certain pthreads calls.  This is deprecated
428                 # in BSD/OS 4.1.
429                 #
430                 *-bsdi3.*|*-bsdi4.0*)
431                         AC_DEFINE(NEED_PTHREAD_INIT)
432                         ;;
433                 #
434                 # LinuxThreads requires some changes to the way we
435                 # deal with signals.
436                 #
437                 *-linux*)
438                         AC_DEFINE(HAVE_LINUXTHREADS)
439                         ;;
440                 #
441                 # Ensure the right sigwait() semantics on Solaris and make
442                 # sure we call pthread_setconcurrency.
443                 #
444                 *-solaris*)
445                         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
446                         AC_CHECK_FUNC(pthread_setconcurrency,
447                                       AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
448                         AC_DEFINE(POSIX_GETPWUID_R)
449                         AC_DEFINE(POSIX_GETPWNAM_R)
450                         AC_DEFINE(POSIX_GETGRGID_R)
451                         AC_DEFINE(POSIX_GETGRNAM_R)
452                         ;;
453                 *hpux11*)
454                         AC_DEFINE(NEED_ENDNETGRENT_R)
455                         AC_DEFINE(_PTHREADS_DRAFT4)
456                         ;;
457                 #
458                 # UnixWare does things its own way.
459                 #
460                 *-UnixWare*)
461                         AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
462                         ;;
463         esac
465         #
466         # Look for sysconf to allow detection of the number of processors.
467         #
468         AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
470 else
471         ALWAYS_DEFINES=""
472         DO_PTHREADS="#undef DO_PTHREADS"
473         WANT_IRS_THREADSGR_OBJS=""
474         WANT_IRS_THREADSPW_OBJS=""
475         WANT_IRS_THREADS_OBJS=""
476         WANT_THREADS_OBJS=""
477         thread_dir=nothreads
480 AC_SUBST(ALWAYS_DEFINES)
481 AC_SUBST(DO_PTHREADS)
482 AC_SUBST(WANT_IRS_THREADSGR_OBJS)
483 AC_SUBST(WANT_IRS_THREADSPW_OBJS)
484 AC_SUBST(WANT_IRS_THREADS_OBJS)
485 AC_SUBST(WANT_THREADS_OBJS)
487 AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT))
488 AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE))
489 AC_CHECK_FUNC(memchr, AC_DEFINE(HAVE_MEMCHR))
490 AC_CHECK_FUNC(strtoul, , AC_DEFINE(NEED_STRTOUL))
492 AC_CHECK_FUNC(if_nametoindex,
493         [USE_IFNAMELINKID="#define USE_IFNAMELINKID 1"],
494         [USE_IFNAMELINKID="#undef USE_IFNAMELINKID"])
495 AC_SUBST(USE_IFNAMELINKID)
497 ISC_THREAD_DIR=$thread_dir
498 AC_SUBST(ISC_THREAD_DIR)
500 AC_CHECK_FUNC(daemon,
501 [DAEMON_OBJS="" NEED_DAEMON="#undef NEED_DAEMON"]
503 [DAEMON_OBJS="\${DAEMON_OBJS}" NEED_DAEMON="#define NEED_DAEMON 1"]
505 AC_SUBST(DAEMON_OBJS)
506 AC_SUBST(NEED_DAEMON)
508 AC_CHECK_FUNC(strsep,
509 [STRSEP_OBJS="" NEED_STRSEP="#undef NEED_STRSEP"]
511 [STRSEP_OBJS="\${STRSEP_OBJS}" NEED_STRSEP="#define NEED_STRSEP 1"]
513 AC_SUBST(STRSEP_OBJS)
514 AC_SUBST(NEED_STRSEP)
516 AC_CHECK_FUNC(strerror, [NEED_STRERROR="#undef NEED_STRERROR"],
517 [NEED_STRERROR="#define NEED_STRERROR 1"])
518 AC_SUBST(NEED_STRERROR)
520 if test -n "$NEED_STRERROR"
521 then
522         AC_MSG_CHECKING([for extern char * sys_errlist[]])
523         AC_TRY_LINK([ extern int sys_nerr; extern char *sys_errlist[]; ],
524                     [ const char *p = sys_errlist[0]; ],
525                     AC_MSG_RESULT(yes)
526                     AC_DEFINE(USE_SYSERROR_LIST),
527                     AC_MSG_RESULT(no))
531 # flockfile is usually provided by pthreads, but we may want to use it
532 # even if compiled with --disable-threads.
534 AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
537 # Indicate what the final decision was regarding threads.
539 AC_MSG_CHECKING(whether to build with threads)
540 if $use_threads; then
541         AC_MSG_RESULT(yes)
542 else
543         AC_MSG_RESULT(no)
547 # End of pthreads stuff.
551 # Additional compiler settings.
553 MKDEPCC="$CC"
554 MKDEPCFLAGS="-M"
555 IRIX_DNSSEC_WARNINGS_HACK=""
557 if test "X$GCC" = "Xyes"; then
558         AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
559         SAVE_CFLAGS=$CFLAGS
560         CFLAGS=-fno-strict-aliasing
561         AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
562         CFLAGS=$SAVE_CFLAGS
563         if test "$FNOSTRICTALIASING" = "yes"; then
564                 AC_MSG_RESULT(yes)
565                 STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
566         else
567                 AC_MSG_RESULT(no)
568                 STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
569         fi
570 else
571         case $host in
572         *-dec-osf*)
573                 CC="$CC -std"
574                 CCOPT="$CCOPT -std"
575                 MKDEPCC="$CC"
576                 ;;
577         *-hp-hpux*)
578                 CC="$CC -Ae -z"
579                 # The version of the C compiler that constantly warns about
580                 # 'const' as well as alignment issues is unfortunately not
581                 # able to be discerned via the version of the operating
582                 # system, nor does cc have a version flag.
583                 case "`$CC +W 123 2>&1`" in
584                 *Unknown?option*)
585                         STD_CWARNINGS="+w1"
586                         ;;
587                 *)
588                         # Turn off the pointlessly noisy warnings.
589                         STD_CWARNINGS="+w1 +W 474,530,2193,2236"
590                         ;;
591                 esac
592                 CCOPT="$CCOPT -Ae -z"
593                 LIBS="-Wl,+vnocompatwarnings $LIBS"
594 MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>&1 | awk '"'"'BEGIN {colon=0; rec="";} { for (i = 0 ; i < NF; i++) { if (colon && a[$i]) continue; if ($i == "\\") continue; if (!colon) { rec =  $i continue; } if ($i == ":") { rec = rec " :" colon = 1 continue; } if (length(rec $i) > 76) { print rec " \\"; rec = "\t" $i; a[$i] = 1; } else { rec = rec " " $i a[$i] = 1; } } } END {print rec}'"'"' >>$TMP'
595                 MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
596                 ;;
597         *-sgi-irix*)
598                 STD_CWARNINGS="-fullwarn -woff 1209"
599                 #
600                 # Silence more than 250 instances of
601                 #   "prototyped function redeclared without prototype"
602                 # and 11 instances of
603                 #   "variable ... was set but never used"
604                 # from lib/dns/sec/openssl.
605                 #
606                 IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
607                 ;;
608         *-solaris*)
609                 MKDEPCFLAGS="-xM"
610                 ;;
611         *-UnixWare*)
612                 CC="$CC -w"
613                 ;;
614         esac
618 # _GNU_SOURCE is needed to access the fd_bits field of struct fd_set, which
619 # is supposed to be opaque.
621 case $host in
622         *linux*)
623                 STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
624                 ;;
625 esac
627 AC_SUBST(MKDEPCC)
628 AC_SUBST(MKDEPCFLAGS)
629 AC_SUBST(MKDEPPROG)
630 AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
633 # NLS
635 AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
638 # -lxnet buys us one big porting headache...  standards, gotta love 'em.
640 # AC_CHECK_LIB(xnet, socket, ,
641 #    AC_CHECK_LIB(socket, socket)
642 #    AC_CHECK_LIB(nsl, inet_ntoa)
643 # )
645 # Use this for now, instead:
647 case "$host" in
648         mips-sgi-irix*)
649                 ;;
650         ia64-hp-hpux11.*)
651                 AC_CHECK_LIB(socket, socket)
652                 AC_CHECK_LIB(nsl, inet_ntoa)
653                 ;;
654         *)
655                 AC_CHECK_LIB(d4r, gethostbyname_r)
656                 AC_CHECK_LIB(socket, socket)
657                 AC_CHECK_FUNC(inet_ntoa, [], AC_CHECK_LIB(nsl, inet_ntoa))
658                 ;;
659 esac
662 # Purify support
664 AC_MSG_CHECKING(whether to use purify)
665 AC_ARG_WITH(purify,
666         [  --with-purify[=PATH] use Rational purify],
667         use_purify="$withval", use_purify="no")
669 case "$use_purify" in
670         no)
671                 ;;
672         yes)
673                 AC_PATH_PROG(purify_path, purify, purify)
674                 ;;
675         *)
676                 purify_path="$use_purify"
677                 ;;
678 esac
680 case "$use_purify" in
681         no)
682                 AC_MSG_RESULT(no)
683                 PURIFY=""
684                 ;;
685         *)
686                 if test -f $purify_path || test $purify_path = purify; then
687                         AC_MSG_RESULT($purify_path)
688                         PURIFYFLAGS="`echo $PURIFYOPTIONS`"
689                         PURIFY="$purify_path $PURIFYFLAGS"
690                 else
691                         AC_MSG_ERROR([$purify_path not found.
693 Please choose the proper path with the following command:
695     configure --with-purify=PATH
697                 fi
698                 ;;
699 esac
701 AC_SUBST(PURIFY)
704 # GNU libtool support
706 case $host in
707 sunos*)
708     # Just set the maximum command line length for sunos as it otherwise
709     # takes a exceptionally long time to work it out. Required for libtool.
710     lt_cv_sys_max_cmd_len=4096;
711     ;;
712 esac
714 AC_ARG_WITH(libtool,
715             [  --with-libtool   use GNU libtool (following indented options supported)],
716             use_libtool="$withval", use_libtool="no")
718 case $use_libtool in
719         yes)
720                 AC_PROG_LIBTOOL
721                 O=lo
722                 A=la
723                 LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
724                 LIBTOOL_MODE_COMPILE='--mode=compile'
725                 LIBTOOL_MODE_INSTALL='--mode=install'
726                 LIBTOOL_MODE_LINK='--mode=link'
727                 ;;
728         *)
729                 O=o
730                 A=a
731                 LIBTOOL=
732                 AC_SUBST(LIBTOOL)
733                 LIBTOOL_MKDEP_SED=
734                 LIBTOOL_MODE_COMPILE=
735                 LIBTOOL_MODE_INSTALL=
736                 LIBTOOL_MODE_LINK=
737                 ;;
738 esac
741 # File name extension for static archive files, for those few places
742 # where they are treated differently from dynamic ones.
744 SA=a
746 AC_SUBST(O)
747 AC_SUBST(A)
748 AC_SUBST(SA)
749 AC_SUBST(LIBTOOL_MKDEP_SED)
750 AC_SUBST(LIBTOOL_MODE_COMPILE)
751 AC_SUBST(LIBTOOL_MODE_INSTALL)
752 AC_SUBST(LIBTOOL_MODE_LINK)
755 # Here begins a very long section to determine the system's networking
756 # capabilities.  The order of the tests is signficant.
760 # IPv6
762 AC_ARG_ENABLE(ipv6,
763         [  --enable-ipv6                use IPv6 [default=autodetect]])
765 case "$enable_ipv6" in
766         yes|''|autodetect)
767                 AC_DEFINE(WANT_IPV6)
768                 ;;
769         no)
770                 ;;
771 esac
774 # We do the IPv6 compilation checking after libtool so that we can put
775 # the right suffix on the files.
777 AC_MSG_CHECKING(for IPv6 structures)
778 AC_TRY_COMPILE([
779 #include <sys/types.h>
780 #include <sys/socket.h>
781 #include <netinet/in.h>],
782 [struct sockaddr_in6 sin6; return (0);],
783         [AC_MSG_RESULT(yes)
784          found_ipv6=yes],
785         [AC_MSG_RESULT(no)
786          found_ipv6=no])
789 # See whether IPv6 support is provided via a Kame add-on.
790 # This is done before other IPv6 linking tests to LIBS is properly set.
792 AC_MSG_CHECKING(for Kame IPv6 support)
793 AC_ARG_WITH(kame,
794         [  --with-kame[=PATH]   use Kame IPv6 [default path /usr/local/v6]],
795         use_kame="$withval", use_kame="no")
797 case "$use_kame" in
798         no)
799                 ;;
800         yes)
801                 kame_path=/usr/local/v6
802                 ;;
803         *)
804                 kame_path="$use_kame"
805                 ;;
806 esac
808 case "$use_kame" in
809         no)
810                 AC_MSG_RESULT(no)
811                 ;;
812         *)
813                 if test -f $kame_path/lib/libinet6.a; then
814                         AC_MSG_RESULT($kame_path/lib/libinet6.a)
815                         LIBS="-L$kame_path/lib -linet6 $LIBS"
816                 else
817                         AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
819 Please choose the proper path with the following command:
821     configure --with-kame=PATH
823                 fi
824                 ;;
825 esac
828 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
829 # Including it on Kame-using platforms is very bad, though, because
830 # Kame uses #error against direct inclusion.   So include it on only
831 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
832 # This is done before the in6_pktinfo check because that's what
833 # netinet6/in6.h is needed for.
835 changequote({, })
836 case "$host" in
837 *-bsdi4.[01]*)
838         ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
839         isc_netinet6in6_hack="#include <netinet6/in6.h>"
840         ;;
842         ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
843         isc_netinet6in6_hack=""
844         ;;
845 esac
846 changequote([, ])
849 # This is similar to the netinet6/in6.h issue.
851 case "$host" in
852 *-UnixWare*)
853         ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
854         ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
855         isc_netinetin6_hack="#include <netinet/in6.h>"
856         ;;
858         ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
859         ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
860         isc_netinetin6_hack=""
861         ;;
862 esac
865 # Now delve deeper into the suitability of the IPv6 support.
867 case "$found_ipv6" in
868         yes)
869                 HAS_INET6_STRUCTS="#define HAS_INET6_STRUCTS 1"
871                 AC_MSG_CHECKING(for in6_addr)
872                 AC_TRY_COMPILE([
873 #include <sys/types.h>
874 #include <sys/socket.h>
875 #include <netinet/in.h>
876 $isc_netinetin6_hack
877 $isc_netinet6in6_hack
879 [struct in6_addr in6; return (0);],
880                 [AC_MSG_RESULT(yes)
881                  HAS_IN_ADDR6="#undef HAS_IN_ADDR6"
882                  isc_in_addr6_hack=""],
883                 [AC_MSG_RESULT(no)
884                  HAS_IN_ADDR6="#define HAS_IN_ADDR6 1"
885                  isc_in_addr6_hack="#define in6_addr in_addr6"])
887                 AC_MSG_CHECKING(for in6addr_any)
888                 AC_TRY_LINK([
889 #include <sys/types.h>
890 #include <sys/socket.h>
891 #include <netinet/in.h>
892 $isc_netinetin6_hack
893 $isc_netinet6in6_hack
894 $isc_in_addr6_hack
896                 [struct in6_addr in6; in6 = in6addr_any; return (0);],
897                         [AC_MSG_RESULT(yes)
898                          NEED_IN6ADDR_ANY="#undef NEED_IN6ADDR_ANY"],
899                         [AC_MSG_RESULT(no)
900                          NEED_IN6ADDR_ANY="#define NEED_IN6ADDR_ANY 1"])
902                 AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
903                 AC_TRY_COMPILE([
904 #include <sys/types.h>
905 #include <sys/socket.h>
906 #include <netinet/in.h>
907 $isc_netinetin6_hack
908 $isc_netinet6in6_hack
910                 [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
911                         [AC_MSG_RESULT(yes)
912                          result="#define HAVE_SIN6_SCOPE_ID 1"],
913                         [AC_MSG_RESULT(no)
914                          result="#undef HAVE_SIN6_SCOPE_ID"])
915                 HAVE_SIN6_SCOPE_ID="$result"
917                 AC_MSG_CHECKING(for in6_pktinfo)
918                 AC_TRY_COMPILE([
919 #include <sys/types.h>
920 #include <sys/socket.h>
921 #include <netinet/in.h>
922 $isc_netinetin6_hack
923 $isc_netinet6in6_hack
925                 [struct in6_pktinfo xyzzy; return (0);],
926                         [AC_MSG_RESULT(yes)
927                          ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
928                         [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
929                          ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
930                 ;;
931         no)
932                 HAS_INET6_STRUCTS="#undef HAS_INET6_STRUCTS"
933                 NEED_IN6ADDR_ANY="#undef NEED_IN6ADDR_ANY"
934                 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
935                 HAVE_SIN6_SCOPE_ID="#define HAVE_SIN6_SCOPE_ID 1"
936                 ISC_IPV6_H="ipv6.h"
937                 ISC_IPV6_O="ipv6.$O"
938                 ISC_ISCIPV6_O="unix/ipv6.$O"
939                 ISC_IPV6_C="ipv6.c"
940                 ;;
941 esac
943 AC_MSG_CHECKING(for sockaddr_storage)
944 AC_TRY_COMPILE([
945 #include <sys/types.h>
946 #include <sys/socket.h>
947 #include <netinet/in.h>
949 [struct sockaddr_storage xyzzy; return (0);],
950         [AC_MSG_RESULT(yes)
951          HAVE_SOCKADDR_STORAGE="#define HAVE_SOCKADDR_STORAGE 1"],
952         [AC_MSG_RESULT(no)
953          HAVE_SOCKADDR_STORAGE="#undef HAVE_SOCKADDR_STORAGE"])
955 AC_SUBST(HAS_INET6_STRUCTS)
956 AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
957 AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
958 AC_SUBST(HAS_IN_ADDR6)
959 AC_SUBST(NEED_IN6ADDR_ANY)
960 AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
961 AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
962 AC_SUBST(ISC_IPV6_H)
963 AC_SUBST(ISC_IPV6_O)
964 AC_SUBST(ISC_ISCIPV6_O)
965 AC_SUBST(ISC_IPV6_C)
966 AC_SUBST(HAVE_SIN6_SCOPE_ID)
967 AC_SUBST(HAVE_SOCKADDR_STORAGE)
970 # Check for network functions that are often missing.  We do this
971 # after the libtool checking, so we can put the right suffix on
972 # the files.  It also needs to come after checking for a Kame add-on,
973 # which provides some (all?) of the desired functions.
975 AC_MSG_CHECKING([for inet_ntop])
976 AC_TRY_LINK([
977 #include <sys/types.h>
978 #include <netinet/in.h>
979 #include <arpa/inet.h>],
980         [inet_ntop(0, 0, 0, 0); return (0);],
981         [AC_MSG_RESULT(yes)
982         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
984         [AC_MSG_RESULT(no)
985         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
986         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
987         ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
988 AC_MSG_CHECKING([for inet_pton])
989 AC_TRY_LINK([
990 #include <sys/types.h>
991 #include <netinet/in.h>
992 #include <arpa/inet.h>],
993         [inet_pton(0, 0, 0); return (0);],
994         [AC_MSG_RESULT(yes)
995         ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
997         [AC_MSG_RESULT(no)
998         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
999         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
1000         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
1001 AC_MSG_CHECKING([for inet_aton])
1002 AC_TRY_LINK([
1003 #include <sys/types.h>
1004 #include <netinet/in.h>
1005 #include <arpa/inet.h>],
1006         [struct in_addr in; inet_aton(0, &in); return (0);],
1007         [AC_MSG_RESULT(yes)
1008         ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
1010         [AC_MSG_RESULT(no)
1011         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
1012         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
1013         ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"])
1015 AC_SUBST(ISC_PLATFORM_NEEDNTOP)
1016 AC_SUBST(ISC_PLATFORM_NEEDPTON)
1017 AC_SUBST(ISC_PLATFORM_NEEDATON)
1020 # Look for a 4.4BSD-style sa_len member in struct sockaddr.
1022 case "$host" in
1023         *-dec-osf*)
1024                 # Tru64 broke send() by defining it to send_OBSOLETE
1025                 AC_DEFINE(REENABLE_SEND)
1026                 # Turn on 4.4BSD style sa_len support.
1027                 AC_DEFINE(_SOCKADDR_LEN)
1028                 ;;
1029 esac
1031 AC_MSG_CHECKING(for sa_len in struct sockaddr)
1032 AC_TRY_COMPILE([
1033 #include <sys/types.h>
1034 #include <sys/socket.h>],
1035 [struct sockaddr sa; sa.sa_len = 0; return (0);],
1036         [AC_MSG_RESULT(yes)
1037         HAVE_SA_LEN="#define HAVE_SA_LEN 1"],
1038         [AC_MSG_RESULT(no)
1039         HAVE_SA_LEN="#undef HAVE_SA_LEN"])
1040 AC_SUBST(HAVE_SA_LEN)
1042 # HAVE_MINIMUM_IFREQ
1044 case "$host" in
1045         *-bsdi[2345]*)  have_minimum_ifreq=yes;;
1046         *-darwin*)      have_minimum_ifreq=yes;;
1047         *-freebsd*)     have_minimum_ifreq=yes;;
1048         *-lynxos*)      have_minimum_ifreq=yes;;
1049         *-netbsd*)      have_minimum_ifreq=yes;;
1050         *-next*)        have_minimum_ifreq=yes;;
1051         *-openbsd*)     have_minimum_ifreq=yes;;
1052         *-rhapsody*)    have_minimum_ifreq=yes;;
1053 esac
1055 case "$have_minimum_ifreq" in
1056         yes)
1057                 HAVE_MINIMUM_IFREQ="#define HAVE_MINIMUM_IFREQ 1";;
1058         no)
1059                 HAVE_MINIMUM_IFREQ="#undef HAVE_MINIMUM_IFREQ";;
1060         *)
1061                 HAVE_MINIMUM_IFREQ="#undef HAVE_MINIMUM_IFREQ";;
1062 esac
1063 AC_SUBST(HAVE_MINIMUM_IFREQ)
1065 # PORT_DIR
1066 PORT_DIR=port/unknown
1067 SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES"
1068 BSD_COMP="#undef BSD_COMP"
1069 USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL"
1070 PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK"
1071 HAVE_MD5="#undef HAVE_MD5"
1072 USE_POLL="#undef HAVE_POLL"
1073 SOLARIS2="#undef SOLARIS2"
1074 case "$host" in
1075         *aix3.2*)       PORT_DIR="port/aix32";;
1076         *aix4*)         PORT_DIR="port/aix4";;
1077         *aix5*)         PORT_DIR="port/aix5";;
1078         *aux3*)         PORT_DIR="port/aux3";;
1079         *-bsdi2*)       PORT_DIR="port/bsdos2";;
1080         *-bsdi*)        PORT_DIR="port/bsdos";;
1081         *-cygwin*)
1082                         PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY"
1083                         PORT_DIR="port/cygwin";;
1084         *-darwin*)      PORT_DIR="port/darwin";;
1085         *-dragonfly*)   PORT_DIR="port/dragonfly";;
1086         *-osf*)         PORT_DIR="port/decunix";;
1087         *-freebsd*)     PORT_DIR="port/freebsd";;
1088         *-hpux9*)       PORT_DIR="port/hpux9";;
1089         *-hpux10*)      PORT_DIR="port/hpux10";;
1090         *-hpux11*)      PORT_DIR="port/hpux";;
1091         *-irix*)        PORT_DIR="port/irix";;
1092         *-linux*)       PORT_DIR="port/linux";;
1093         *-lynxos*)      PORT_DIR="port/lynxos";;
1094         *-mpe*)         PORT_DIR="port/mpe";;
1095         *-netbsd*)      PORT_DIR="port/netbsd";;
1096         *-next*)        PORT_DIR="port/next";;
1097         *-openbsd*)     PORT_DIR="port/openbsd";;
1098         *-qnx*)         PORT_DIR="port/qnx";;
1099         *-rhapsody*)    PORT_DIR="port/rhapsody";;
1100         *-sunos4*)
1101                         AC_DEFINE(NEED_SUN4PROTOS)
1102                         PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY"
1103                         PORT_DIR="port/sunos";;
1104         *-solaris2.[[01234]])
1105                         BSD_COMP="#define BSD_COMP 1"
1106                         SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
1107                         USE_FIONBIO_IOCTL="#define USE_FIONBIO_IOCTL 1"
1108                         SOLARIS2="#define SOLARIS2 1"
1109                         PORT_DIR="port/solaris";;
1110         *-solaris2.5)
1111                         BSD_COMP="#define BSD_COMP 1"
1112                         SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
1113                         SOLARIS2="#define SOLARIS2 1"
1114                         PORT_DIR="port/solaris";;
1115         *-solaris2.[[67]])
1116                         BSD_COMP="#define BSD_COMP 1"
1117                         SOLARIS2="#define SOLARIS2 1"
1118                         PORT_DIR="port/solaris";;
1119         *-solaris2*)    BSD_COMP="#define BSD_COMP 1"
1120                         USE_POLL="#define USE_POLL 1"
1121                         HAVE_MD5="#define HAVE_MD5 1"
1122                         SOLARIS2="#define SOLARIS2 1"
1123                         PORT_DIR="port/solaris";;
1124         *-ultrix*)      PORT_DIR="port/ultrix";;
1125         *-sco-sysv*uw2.0*)      PORT_DIR="port/unixware20";;
1126         *-sco-sysv*uw2.1.2*)    PORT_DIR="port/unixware212";;
1127         *-sco-sysv*uw7*)        PORT_DIR="port/unixware7";;
1128 esac
1130 AC_SUBST(BSD_COMP)
1131 AC_SUBST(SOLARIS_BITTYPES)
1132 AC_SUBST(USE_FIONBIO_IOCTL)
1133 AC_SUBST(PORT_NONBLOCK)
1134 AC_SUBST(PORT_DIR)
1135 AC_SUBST(USE_POLL)
1136 AC_SUBST(HAVE_MD5)
1137 AC_SUBST(SOLARIS2)
1138 PORT_INCLUDE=${PORT_DIR}/include
1139 AC_SUBST(PORT_INCLUDE)
1142 # Look for a 4.4BSD or 4.3BSD struct msghdr
1144 AC_MSG_CHECKING(for struct msghdr flavor)
1145 AC_TRY_COMPILE([
1146 #include <sys/types.h>
1147 #include <sys/socket.h>],
1148 [struct msghdr msg; msg.msg_flags = 0; return (0);],
1149         [AC_MSG_RESULT(4.4BSD)
1150         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1151         [AC_MSG_RESULT(4.3BSD)
1152         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1153 AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1156 # Look for in_port_t.
1158 AC_MSG_CHECKING(for type in_port_t)
1159 AC_TRY_COMPILE([
1160 #include <sys/types.h>
1161 #include <netinet/in.h>],
1162 [in_port_t port = 25; return (0);],
1163         [AC_MSG_RESULT(yes)
1164         ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1165         [AC_MSG_RESULT(no)
1166         ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1167 AC_SUBST(ISC_PLATFORM_NEEDPORTT)
1169 AC_MSG_CHECKING(for struct timespec)
1170 AC_TRY_COMPILE([
1171 #include <sys/types.h>
1172 #include <time.h>],
1173 [struct timespec ts = { 0, 0 }; return (0);],
1174         [AC_MSG_RESULT(yes)
1175         ISC_PLATFORM_NEEDTIMESPEC="#undef ISC_PLATFORM_NEEDTIMESPEC"],
1176         [AC_MSG_RESULT(no)
1177         ISC_PLATFORM_NEEDTIMESPEC="#define ISC_PLATFORM_NEEDTIMESPEC 1"])
1178 AC_SUBST(ISC_PLATFORM_NEEDTIMESPEC)
1181 # Check for addrinfo
1183 AC_MSG_CHECKING(for struct addrinfo)
1184 AC_TRY_COMPILE([
1185 #include <netdb.h>],
1186 [struct addrinfo a; return (0);],
1187         [AC_MSG_RESULT(yes)
1188         AC_DEFINE(HAVE_ADDRINFO)],
1189         [AC_MSG_RESULT(no)])
1191 AC_MSG_CHECKING(for int sethostent)
1192 AC_TRY_COMPILE([
1193 #include <netdb.h>],
1194 [int i = sethostent(0); return(0);],
1195         [AC_MSG_RESULT(yes)],
1196         [AC_MSG_RESULT(no)])
1198 AC_MSG_CHECKING(for int endhostent)
1199 AC_TRY_COMPILE([
1200 #include <netdb.h>],
1201 [int i = endhostent(); return(0);],
1202         [AC_MSG_RESULT(yes)
1203         ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1204         [AC_MSG_RESULT(no)
1205         ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1206 AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1208 AC_MSG_CHECKING(for int setnetent)
1209 AC_TRY_COMPILE([
1210 #include <netdb.h>],
1211 [int i = setnetent(0); return(0);],
1212         [AC_MSG_RESULT(yes)
1213         ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1214         [AC_MSG_RESULT(no)
1215         ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1216 AC_SUBST(ISC_LWRES_SETNETENTINT)
1218 AC_MSG_CHECKING(for int endnetent)
1219 AC_TRY_COMPILE([
1220 #include <netdb.h>],
1221 [int i = endnetent(); return(0);],
1222         [AC_MSG_RESULT(yes)
1223         ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1224         [AC_MSG_RESULT(no)
1225         ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1226 AC_SUBST(ISC_LWRES_ENDNETENTINT)
1228 AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1229 AC_TRY_COMPILE([
1230 #include <netdb.h>
1231 struct hostent *gethostbyaddr(const void *, size_t, int);],
1232 [return(0);],
1233         [AC_MSG_RESULT(yes)
1234         ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1235         [AC_MSG_RESULT(no)
1236         ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1237 AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1239 AC_MSG_CHECKING(for h_errno in netdb.h)
1240 AC_TRY_COMPILE([
1241 #include <netdb.h>],
1242 [h_errno = 1; return(0);],
1243         [AC_MSG_RESULT(yes)
1244         ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1245         [AC_MSG_RESULT(no)
1246         ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1247 AC_SUBST(ISC_LWRES_NEEDHERRNO)
1249 AC_CHECK_FUNC(getipnodebyname,
1250         [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1251         [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1252 AC_CHECK_FUNC(getnameinfo,
1253         [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1254         [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1255 AC_CHECK_FUNC(getaddrinfo,
1256         [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1257         AC_DEFINE(HAVE_GETADDRINFO)],
1258         [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1259 AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1260 AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1261 AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1262 AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1263 AC_CHECK_FUNC(pselect,
1264               [NEED_PSELECT="#undef NEED_PSELECT"],
1265               [NEED_PSELECT="#define NEED_PSELECT"])
1266 AC_SUBST(NEED_PSELECT)
1267 AC_CHECK_FUNC(gettimeofday,
1268               [NEED_GETTIMEOFDAY="#undef NEED_GETTIMEOFDAY"],
1269               [NEED_GETTIMEOFDAY="#define NEED_GETTIMEOFDAY 1"])
1270 AC_SUBST(NEED_GETTIMEOFDAY)
1271 AC_CHECK_FUNC(strndup,
1272               [HAVE_STRNDUP="#define HAVE_STRNDUP 1"],
1273               [HAVE_STRNDUP="#undef HAVE_STRNDUP"])
1274 AC_SUBST(HAVE_STRNDUP)
1277 # Look for a sysctl call to get the list of network interfaces.
1279 AC_MSG_CHECKING(for interface list sysctl)
1280 AC_EGREP_CPP(found_rt_iflist, [
1281 #include <sys/param.h>
1282 #include <sys/sysctl.h>
1283 #include <sys/socket.h>
1284 #ifdef NET_RT_IFLIST
1285 found_rt_iflist
1286 #endif
1288         [AC_MSG_RESULT(yes)
1289          AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1290         [AC_MSG_RESULT(no)])
1293 # Check for some other useful functions that are not ever-present.
1295 AC_CHECK_FUNC(strsep,
1296         [ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1297         [ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1300 AC_MSG_CHECKING(for char *sprintf)
1301 AC_TRY_COMPILE([
1302 #include <stdio.h>
1304 [ char buf[2]; return(*sprintf(buf,"x"));],
1305 AC_DEFINE(SPRINTF_CHAR)
1306 AC_MSG_RESULT(yes)
1308 AC_MSG_RESULT(no)
1311 AC_MSG_CHECKING(for char *vsprintf)
1312 case $host in
1313 *sunos4*) # not decared in any header file.
1314 AC_DEFINE(VSPRINTF_CHAR)
1315 AC_MSG_RESULT(yes)
1318 AC_TRY_COMPILE([
1319 #include <stdio.h>
1321 [ char buf[2]; return(*vsprintf(buf,"x"));],
1322 AC_DEFINE(VSPRINTF_CHAR)
1323 AC_MSG_RESULT(yes)
1325 AC_MSG_RESULT(no)
1328 esac
1330 AC_CHECK_FUNC(vsnprintf,
1331         [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
1332         [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
1333          ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS print.c"
1334          ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
1335 AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1336 AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1338 AC_SUBST(ISC_EXTRA_OBJS)
1339 AC_SUBST(ISC_EXTRA_SRCS)
1341 # Determine the printf format characters to use when printing
1342 # values of type isc_int64_t.  We make the assumption that platforms
1343 # where a "long long" is the same size as a "long" (e.g., Alpha/OSF1)
1344 # want "%ld" and everyone else can use "%lld".  Win32 uses "%I64d",
1345 # but that's defined elsewhere since we don't use configure on Win32.
1347 AC_MSG_CHECKING(printf format modifier for 64-bit integers)
1348 AC_TRY_RUN([main() { exit(!(sizeof(long long int) == sizeof(long int))); }],
1349         [AC_MSG_RESULT(l)
1350         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'],
1351         [AC_MSG_RESULT(ll)
1352         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'],
1353         [AC_MSG_RESULT(default ll)
1354         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'])
1355 AC_SUBST(ISC_PLATFORM_QUADFORMAT)
1358 # Security Stuff
1360 AC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
1363 # for accept, recvfrom, getpeername etc.
1365 AC_MSG_CHECKING(for socket length type)
1366 AC_TRY_COMPILE([
1367 #include <sys/types.h>
1368 #include <sys/socket.h>
1369 int accept(int, struct sockaddr *, socklen_t *);
1370 ],[],
1371 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T socklen_t"
1372 AC_MSG_RESULT(socklen_t)]
1374 AC_TRY_COMPILE([
1375 #include <sys/types.h>
1376 #include <sys/socket.h>
1377 int accept(int, struct sockaddr *, unsigned int *);
1378 ],[],
1379 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T unsigned int"
1380 AC_MSG_RESULT(unsigned int)]
1382 AC_TRY_COMPILE([
1383 #include <sys/types.h>
1384 #include <sys/socket.h>
1385 int accept(int, struct sockaddr *, unsigned long *);
1386 ],[],
1387 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T unsigned long"
1388 AC_MSG_RESULT(unsigned long)]
1390 AC_TRY_COMPILE([
1391 #include <sys/types.h>
1392 #include <sys/socket.h>
1393 int accept(int, struct sockaddr *, long *);
1394 ],[],
1395 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T long"
1396 AC_MSG_RESULT(long)]
1398 ISC_SOCKLEN_T="#define ISC_SOCKLEN_T int"
1399 AC_MSG_RESULT(int)
1400 ))))
1401 AC_SUBST(ISC_SOCKLEN_T)
1403 AC_CHECK_FUNC(getgrouplist,
1404 AC_TRY_COMPILE(
1405 [#include <unistd.h>
1407 getgrouplist(const char *name, int basegid, int *groups, int *ngroups) {
1410 [return (0);],
1411 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, int basegid, int *groups, int *ngroups"
1413 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups"
1415 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups"
1416 AC_DEFINE(NEED_GETGROUPLIST)
1418 AC_SUBST(GETGROUPLIST_ARGS)
1420 AC_CHECK_FUNC(setgroupent,,AC_DEFINE(NEED_SETGROUPENT))
1422 case $host in
1423 ia64-hp-hpux11.*)
1426 AC_CHECK_FUNC(getnetbyaddr_r,
1427 AC_TRY_COMPILE(
1429 #undef _REENTRANT
1430 #define _REENTRANT
1431 #define _OSF_SOURCE
1432 #undef __USE_MISC
1433 #define __USE_MISC
1434 #include <netdb.h>
1435 struct netent *
1436 getnetbyaddr_r(long net, int type, struct netent *result, char *buffer,
1437 int buflen) {}
1439 [return (0)],
1441 NET_R_ARGS="#define NET_R_ARGS char *buf, int buflen"
1442 NET_R_BAD="#define NET_R_BAD NULL"
1443 NET_R_COPY="#define NET_R_COPY buf, buflen"
1444 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS NET_R_ARGS"
1445 NET_R_OK="#define NET_R_OK nptr"
1446 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1447 NET_R_RETURN="#define NET_R_RETURN struct netent *"
1448 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1449 NETENT_DATA="#undef NETENT_DATA"
1451 AC_TRY_COMPILE(
1453 #undef _REENTRANT
1454 #define _REENTRANT
1455 #define _OSF_SOURCE
1456 #undef __USE_MISC
1457 #define __USE_MISC
1458 #include <netdb.h>
1459 int getnetbyaddr_r (unsigned long int, int, struct netent *,
1460                     char *, size_t, struct netent **, int *);
1462 [return (0)],
1464 NET_R_ARGS="#define NET_R_ARGS char *buf, size_t buflen, struct netent **answerp, int *h_errnop"
1465 NET_R_BAD="#define NET_R_BAD ERANGE"
1466 NET_R_COPY="#define NET_R_COPY buf, buflen"
1467 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS char *buf, size_t buflen"
1468 NET_R_OK="#define NET_R_OK 0"
1469 NET_R_SETANSWER="#define NET_R_SETANSWER 1"
1470 NET_R_RETURN="#define NET_R_RETURN int"
1471 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T unsigned long int"
1472 NETENT_DATA="#undef NETENT_DATA"
1474 AC_TRY_COMPILE(
1476 #undef _REENTRANT
1477 #define _REENTRANT
1478 #define _OSF_SOURCE
1479 #undef __USE_MISC
1480 #define __USE_MISC
1481 #include <netdb.h>
1482 extern int getnetbyaddr_r(int, int, struct netent *, struct netent_data *);
1484 [return (0)],
1486 NET_R_ARGS="#define NET_R_ARGS struct netent_data *ndptr"
1487 NET_R_BAD="#define NET_R_BAD (-1)"
1488 NET_R_COPY="#define NET_R_COPY ndptr"
1489 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS struct netent_data *ndptr"
1490 NET_R_OK="#define NET_R_OK 0"
1491 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1492 NET_R_RETURN="#define NET_R_RETURN int"
1493 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T int"
1494 NETENT_DATA="#define NETENT_DATA 1"
1496 AC_TRY_COMPILE(
1497 #undef __USE_MISC
1498 #define __USE_MISC
1499 [#include <netdb.h>
1500 int getnetbyaddr_r (in_addr_t, int, struct netent *, struct netent_data *);
1502 [return (0)],
1504 NET_R_ARGS="#define NET_R_ARGS struct netent_data *ndptr"
1505 NET_R_BAD="#define NET_R_BAD (-1)"
1506 NET_R_COPY="#define NET_R_COPY ndptr"
1507 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS struct netent_data *ndptr"
1508 NET_R_OK="#define NET_R_OK 0"
1509 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1510 NET_R_RETURN="#define NET_R_RETURN int"
1511 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1512 NETENT_DATA="#define NETENT_DATA 1"
1514 AC_TRY_COMPILE(
1515 #undef __USE_MISC
1516 #define __USE_MISC
1517 [#include <netdb.h>
1518 int getnetbyaddr_r (long, int, struct netent *, struct netent_data *);
1520 [return (0)],
1522 NET_R_ARGS="#define NET_R_ARGS struct netent_data *ndptr"
1523 NET_R_BAD="#define NET_R_BAD (-1)"
1524 NET_R_COPY="#define NET_R_COPY ndptr"
1525 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS struct netent_data *ndptr"
1526 NET_R_OK="#define NET_R_OK 0"
1527 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1528 NET_R_RETURN="#define NET_R_RETURN int"
1529 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1530 NETENT_DATA="#define NETENT_DATA 1"
1532 AC_TRY_COMPILE(
1533 #undef __USE_MISC
1534 #define __USE_MISC
1535 [#include <netdb.h>
1536 int getnetbyaddr_r (uint32_t, int, struct netent *,
1537                     char *, size_t, struct netent **, int *);
1539 [return (0)],
1541 NET_R_ARGS="#define NET_R_ARGS char *buf, size_t buflen, struct netent **answerp, int *h_errnop"
1542 NET_R_BAD="#define NET_R_BAD ERANGE"
1543 NET_R_COPY="#define NET_R_COPY buf, buflen"
1544 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS char *buf, size_t buflen"
1545 NET_R_OK="#define NET_R_OK 0"
1546 NET_R_SETANSWER="#define NET_R_SETANSWER 1"
1547 NET_R_RETURN="#define NET_R_RETURN int"
1548 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T unsigned long int"
1549 NETENT_DATA="#undef NETENT_DATA"
1558 NET_R_ARGS="#define NET_R_ARGS char *buf, int buflen"
1559 NET_R_BAD="#define NET_R_BAD NULL"
1560 NET_R_COPY="#define NET_R_COPY buf, buflen"
1561 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS NET_R_ARGS"
1562 NET_R_OK="#define NET_R_OK nptr"
1563 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1564 NET_R_RETURN="#define NET_R_RETURN struct netent *"
1565 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1566 NETENT_DATA="#undef NETENT_DATA"
1568 esac
1570 case "$host" in
1571 *dec-osf*) GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T int" ;;
1572 esac
1573 AC_SUBST(NET_R_ARGS)
1574 AC_SUBST(NET_R_BAD)
1575 AC_SUBST(NET_R_COPY)
1576 AC_SUBST(NET_R_COPY_ARGS)
1577 AC_SUBST(NET_R_OK)
1578 AC_SUBST(NET_R_SETANSWER)
1579 AC_SUBST(NET_R_RETURN)
1580 AC_SUBST(GETNETBYADDR_ADDR_T)
1581 AC_SUBST(NETENT_DATA)
1583 AC_CHECK_FUNC(setnetent_r,
1584 AC_TRY_COMPILE(
1586 #undef __USE_MISC
1587 #define __USE_MISC
1588 #include <netdb.h>
1589 void  setnetent_r (int);
1590 ] ,[return (0);],[
1591 NET_R_ENT_ARGS="#undef NET_R_ENT_ARGS /*empty*/"
1592 NET_R_SET_RESULT="#undef NET_R_SET_RESULT /*empty*/"
1593 NET_R_SET_RETURN="#define NET_R_SET_RETURN void"
1595 AC_TRY_COMPILE(
1597 #define _REENTRANT
1598 #undef __USE_MISC
1599 #define __USE_MISC
1600 #include <netdb.h>
1601 extern int setnetent_r(int, struct netent_data *);
1602 ] ,[return (0);],[
1603 NET_R_ENT_ARGS="#define NET_R_ENT_ARGS struct netent_data *ndptr"
1604 NET_R_SET_RESULT="#define NET_R_SET_RESULT NET_R_OK"
1605 NET_R_SET_RETURN="#define NET_R_SET_RETURN int"
1610 NET_R_ENT_ARGS="#undef NET_R_ENT_ARGS /*empty*/"
1611 NET_R_SET_RESULT="#undef NET_R_SET_RESULT /*empty*/"
1612 NET_R_SET_RETURN="#define NET_R_SET_RETURN void"
1614 AC_SUBST(NET_R_ENT_ARGS)
1615 AC_SUBST(NET_R_SET_RESULT)
1616 AC_SUBST(NET_R_SET_RETURN)
1619 case $host in
1620 ia64-hp-hpux11.*)
1623 AC_CHECK_FUNC(endnetent_r,
1624 AC_TRY_COMPILE(
1626 #undef _REENTRANT
1627 #define _REENTRANT
1628 #undef __USE_MISC
1629 #define __USE_MISC
1630 #include <netdb.h>
1631 void  endnetent_r (void);
1632 ] ,[return (0);],[
1633 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1634 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1636 AC_TRY_COMPILE(
1638 #undef _REENTRANT
1639 #define _REENTRANT
1640 #undef __USE_MISC
1641 #define __USE_MISC
1642 #include <netdb.h>
1643 extern int endnetent_r(struct netent_data *);
1644 ] ,[return (0);],[
1645 NET_R_END_RESULT="#define NET_R_END_RESULT(x) return (x)"
1646 NET_R_END_RETURN="#define NET_R_END_RETURN int"
1648 AC_TRY_COMPILE(
1650 #undef _REENTRANT
1651 #define _REENTRANT
1652 #undef __USE_MISC
1653 #define __USE_MISC
1654 #include <netdb.h>
1655 extern void endnetent_r(struct netent_data *);
1656 ] ,[return (0);],[
1657 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1658 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1664 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1665 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1667 esac
1668 AC_SUBST(NET_R_END_RESULT)
1669 AC_SUBST(NET_R_END_RETURN)
1671 AC_CHECK_FUNC(getgrnam_r,,AC_DEFINE(NEED_GETGRNAM_R))
1672 AC_CHECK_FUNC(getgrgid_r,,AC_DEFINE(NEED_GETGRGID_R))
1674 AC_CHECK_FUNC(getgrent_r,
1675 AC_TRY_COMPILE(
1677 #include <grp.h>
1678 struct group *getgrent_r(struct group *grp, char *buffer,
1679            int buflen) {}
1680 ] ,[return (0);],[
1681 GROUP_R_ARGS="#define GROUP_R_ARGS char *buf, int buflen"
1682 GROUP_R_BAD="#define GROUP_R_BAD NULL"
1683 GROUP_R_OK="#define GROUP_R_OK gptr"
1684 GROUP_R_RETURN="#define GROUP_R_RETURN struct group *"
1688 GROUP_R_ARGS="#define GROUP_R_ARGS char *buf, int buflen"
1689 GROUP_R_BAD="#define GROUP_R_BAD NULL"
1690 GROUP_R_OK="#define GROUP_R_OK gptr"
1691 GROUP_R_RETURN="#define GROUP_R_RETURN struct group *"
1692 AC_DEFINE(NEED_GETGRENT_R)
1694 AC_SUBST(GROUP_R_ARGS)
1695 AC_SUBST(GROUP_R_BAD)
1696 AC_SUBST(GROUP_R_OK)
1697 AC_SUBST(GROUP_R_RETURN)
1699 AC_CHECK_FUNC(endgrent_r,
1701 GROUP_R_END_RESULT="#define GROUP_R_END_RESULT(x) /*empty*/"
1702 GROUP_R_END_RETURN="#define GROUP_R_END_RETURN void"
1703 GROUP_R_ENT_ARGS="#define GROUP_R_ENT_ARGS void"
1704 AC_DEFINE(NEED_ENDGRENT_R)
1706 AC_SUBST(GROUP_R_END_RESULT)
1707 AC_SUBST(GROUP_R_END_RETURN)
1708 AC_SUBST(GROUP_R_ENT_ARGS)
1710 AC_CHECK_FUNC(setgrent_r,
1712 GROUP_R_SET_RESULT="#undef GROUP_R_SET_RESULT /*empty*/"
1713 GROUP_R_SET_RETURN="#define GROUP_R_SET_RETURN void"
1714 AC_DEFINE(NEED_SETGRENT_R)
1716 AC_SUBST(GROUP_R_SET_RESULT)
1717 AC_SUBST(GROUP_R_SET_RETURN)
1720 case $host in
1721 ia64-hp-hpux11.*)
1724 AC_CHECK_FUNC(gethostbyname_r,
1725 AC_TRY_COMPILE(
1727 #undef __USE_MISC
1728 #define __USE_MISC
1729 #include <netdb.h>
1730 struct hostent  *gethostbyname_r
1731 (const char *name, struct hostent *hp, char *buf, int len, int *h_errnop) {}
1733 [return (0);],
1735 HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, int *h_errnop"
1736 HOST_R_BAD="#define HOST_R_BAD NULL"
1737 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1738 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1739 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1740 HOST_R_OK="#define HOST_R_OK hptr"
1741 HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
1742 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1743 HOSTENT_DATA="#undef HOSTENT_DATA"
1746 AC_TRY_COMPILE([
1747 #undef __USE_MISC
1748 #define __USE_MISC
1749 #include <netdb.h>
1750 int gethostbyname_r(const char *name,
1751                           struct hostent *result,
1752                           struct hostent_data *hdptr);
1753 ],,[
1754 HOST_R_ARGS="#define HOST_R_ARGS struct hostent_data *hdptr"
1755 HOST_R_BAD="#define HOST_R_BAD (-1)"
1756 HOST_R_COPY="#define HOST_R_COPY hdptr"
1757 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS HOST_R_ARGS"
1758 HOST_R_ERRNO="#undef HOST_R_ERRNO"
1759 HOST_R_OK="#define HOST_R_OK 0"
1760 HOST_R_RETURN="#define HOST_R_RETURN int"
1761 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1762 HOSTENT_DATA="#define HOSTENT_DATA 1"
1764 AC_TRY_COMPILE([
1765 #undef __USE_MISC
1766 #define __USE_MISC
1767 #include <netdb.h>
1768 extern int gethostbyname_r (const char *,
1769                                  struct hostent *,
1770                                  char *, size_t,
1771                                  struct hostent **,
1772                                  int *);
1773 ],,[
1774 HOST_R_ARGS="#define HOST_R_ARGS char *buf, size_t buflen, struct hostent **answerp, int *h_errnop"
1775 HOST_R_BAD="#define HOST_R_BAD ERANGE"
1776 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1777 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1778 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1779 HOST_R_OK="#define HOST_R_OK 0"
1780 HOST_R_RETURN="#define HOST_R_RETURN int"
1781 HOST_R_SETANSWER="#define HOST_R_SETANSWER 1"
1782 HOSTENT_DATA="#undef HOSTENT_DATA"
1786 HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, int *h_errnop"
1787 HOST_R_BAD="#define HOST_R_BAD NULL"
1788 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1789 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1790 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1791 HOST_R_OK="#define HOST_R_OK hptr"
1792 HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
1793 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1794 HOSTENT_DATA="#undef HOSTENT_DATA"
1796 esac
1797 AC_SUBST(HOST_R_ARGS)
1798 AC_SUBST(HOST_R_BAD)
1799 AC_SUBST(HOST_R_COPY)
1800 AC_SUBST(HOST_R_COPY_ARGS)
1801 AC_SUBST(HOST_R_ERRNO)
1802 AC_SUBST(HOST_R_OK)
1803 AC_SUBST(HOST_R_RETURN)
1804 AC_SUBST(HOST_R_SETANSWER)
1805 AC_SUBST(HOSTENT_DATA)
1807 case $host in
1808 ia64-hp-hpux11.*)
1811 AC_CHECK_FUNC(endhostent_r,
1812 AC_TRY_COMPILE([
1813 #undef _REENTRANT
1814 #define _REENTRANT
1815 #undef __USE_MISC
1816 #define __USE_MISC
1817 #include <netdb.h>
1818 int endhostent_r(struct hostent_data *buffer);
1819 ], ,
1820 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) return (x)"
1821 HOST_R_END_RETURN="#define HOST_R_END_RETURN int"
1822 HOST_R_ENT_ARGS="#define HOST_R_ENT_ARGS struct hostent_data *hdptr"
1824 AC_TRY_COMPILE([
1825 #undef _REENTRANT
1826 #define _REENTRANT
1827 #undef __USE_MISC
1828 #define __USE_MISC
1829 #include <netdb.h>
1830 extern void endhostent_r(struct hostent_data *ht_data);
1831 ],[],[
1832 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x)"
1833 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1834 HOST_R_ENT_ARGS="#define HOST_R_ENT_ARGS struct hostent_data *hdptr"
1836 AC_TRY_COMPILE([
1837 #undef _REENTRANT
1838 #define _REENTRANT
1839 #undef __USE_MISC
1840 #define __USE_MISC
1841 #include <netdb.h>
1842 extern void endhostent_r(void);
1843 ],[],[
1844 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) /*empty*/"
1845 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1846 HOST_R_ENT_ARGS="#undef HOST_R_ENT_ARGS /*empty*/"
1852 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) /*empty*/"
1853 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1854 HOST_R_ENT_ARGS="#undef HOST_R_ENT_ARGS /*empty*/"
1856 esac;
1857 AC_SUBST(HOST_R_END_RESULT)
1858 AC_SUBST(HOST_R_END_RETURN)
1859 AC_SUBST(HOST_R_ENT_ARGS)
1861 case $host in
1862 ia64-hp-hpux11.*)
1865 AC_CHECK_FUNC(sethostent_r,
1866 AC_TRY_COMPILE([
1867 #undef _REENTRANT
1868 #define _REENTRANT
1869 #undef __USE_MISC
1870 #define __USE_MISC
1871 #include <netdb.h>
1872 extern void sethostent_r(int flag, struct hostent_data *ht_data);],[],
1873 [HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT /*empty*/"
1874 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"],
1875 AC_TRY_COMPILE([
1876 #undef _REENTRANT
1877 #define _REENTRANT
1878 #undef __USE_MISC
1879 #define __USE_MISC
1880 #include <netdb.h>
1881 extern int sethostent_r(int flag, struct hostent_data *ht_data);],[],
1882 [HOST_R_SET_RESULT="#define HOST_R_SET_RESULT 0"
1883 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN int"],
1884 AC_TRY_COMPILE([
1885 #undef _REENTRANT
1886 #define _REENTRANT
1887 #undef __USE_MISC
1888 #define __USE_MISC
1889 #include <netdb.h>
1890 void            sethostent_r (int);],[],
1891 [HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT"
1892 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"],
1897 HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT"
1898 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"
1900 esac
1901 AC_SUBST(HOST_R_SET_RESULT)
1902 AC_SUBST(HOST_R_SET_RETURN)
1905 AC_MSG_CHECKING(struct passwd element pw_class)
1906 AC_TRY_COMPILE([
1907 #include <sys/types.h>
1908 #include <pwd.h>
1909 ],[struct passwd *pw; pw->pw_class = "";],
1910 AC_MSG_RESULT(yes)
1911 AC_DEFINE(HAS_PW_CLASS)
1913                 AC_MSG_RESULT(no)
1916 AC_TRY_COMPILE([
1917 #include <sys/types.h>
1918 #include <pwd.h>
1919 void
1920 setpwent(void) {}
1922 [return (0);],
1923 SETPWENT_VOID="#define SETPWENT_VOID 1"
1925 SETPWENT_VOID="#undef SETPWENT_VOID"
1927 AC_SUBST(SETPWENT_VOID)
1929 AC_TRY_COMPILE([
1930 #include <sys/types.h>
1931 #include <grp.h>
1932 void
1933 setgrent(void) {}
1935 [return (0);],
1936 SETGRENT_VOID="#define SETGRENT_VOID 1"
1938 SETGRENT_VOID="#undef SETGRENT_VOID"
1940 AC_SUBST(SETGRENT_VOID)
1942 case $host in
1943 ia64-hp-hpux11.*)
1944 NGR_R_CONST="#define NGR_R_CONST"
1946 *-hp-hpux11.*)
1948 # HPUX doesn't have a prototype for getnetgrent_r().
1950 NGR_R_CONST="#define NGR_R_CONST"
1951 NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen"
1952 NGR_R_BAD="#define NGR_R_BAD (0)"
1953 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
1954 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1955 NGR_R_OK="#define NGR_R_OK 1"
1956 NGR_R_RETURN="#define NGR_R_RETURN int"
1960 AC_CHECK_FUNC(getnetgrent_r,
1961 AC_TRY_COMPILE(
1963 #undef __USE_MISC
1964 #define __USE_MISC
1965 #undef _REEENTRANT
1966 #define _REEENTRANT
1967 #include <netdb.h>
1968 #include <unistd.h>
1969 int getnetgrent_r(char **m, char **u, char **d, char *b, int l) {}
1972 [return (0);],
1974 NGR_R_CONST="#define NGR_R_CONST"
1975 NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen"
1976 NGR_R_BAD="#define NGR_R_BAD (0)"
1977 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
1978 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1979 NGR_R_OK="#define NGR_R_OK 1"
1980 NGR_R_RETURN="#define NGR_R_RETURN int"
1983 AC_TRY_COMPILE(
1985 #undef __USE_MISC
1986 #define __USE_MISC
1987 #undef _REEENTRANT
1988 #define _REEENTRANT
1989 #include <netdb.h>
1990 #include <unistd.h>
1991 int getnetgrent_r(char **m, char **u, char **d, char *b, size_t l) {}
1994 [return (0);],
1996 NGR_R_CONST="#define NGR_R_CONST"
1997 NGR_R_ARGS="#define NGR_R_ARGS char *buf, size_t buflen"
1998 NGR_R_BAD="#define NGR_R_BAD (0)"
1999 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
2000 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
2001 NGR_R_OK="#define NGR_R_OK 1"
2002 NGR_R_RETURN="#define NGR_R_RETURN int"
2005 AC_TRY_COMPILE(
2007 #undef __USE_MISC
2008 #define __USE_MISC
2009 #undef _REEENTRANT
2010 #define _REEENTRANT
2011 #include <netdb.h>
2012 #include <unistd.h>
2013 extern int getnetgrent_r(char **, char **, char **, void **);
2016 [return (0);],
2018 NGR_R_CONST="#define NGR_R_CONST"
2019 NGR_R_ARGS="#define NGR_R_ARGS void **buf"
2020 NGR_R_BAD="#define NGR_R_BAD (0)"
2021 NGR_R_COPY="#define NGR_R_COPY buf"
2022 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
2023 NGR_R_OK="#define NGR_R_OK 1"
2024 NGR_R_RETURN="#define NGR_R_RETURN int"
2025 NGR_R_PRIVATE="#define NGR_R_PRIVATE 1"
2028 AC_TRY_COMPILE(
2030 #undef __USE_MISC
2031 #define __USE_MISC
2032 #undef _REEENTRANT
2033 #define _REEENTRANT
2034 #include <netdb.h>
2035 #include <unistd.h>
2036 extern int getnetgrent_r(const char **, const char **, const char **, void *);
2039 [return (0);],
2041 NGR_R_CONST="#define NGR_R_CONST const"
2042 NGR_R_ARGS="#define NGR_R_ARGS void *buf"
2043 NGR_R_BAD="#define NGR_R_BAD (0)"
2044 NGR_R_COPY="#define NGR_R_COPY buf"
2045 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
2046 NGR_R_OK="#define NGR_R_OK 1"
2047 NGR_R_RETURN="#define NGR_R_RETURN int"
2048 NGR_R_PRIVATE="#define NGR_R_PRIVATE 2"
2056 NGR_R_CONST="#define NGR_R_CONST"
2057 NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen"
2058 NGR_R_BAD="#define NGR_R_BAD (0)"
2059 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
2060 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
2061 NGR_R_OK="#define NGR_R_OK 1"
2062 NGR_R_RETURN="#define NGR_R_RETURN int"
2064 esac
2065 AC_SUBST(NGR_R_CONST)
2066 AC_SUBST(NGR_R_ARGS)
2067 AC_SUBST(NGR_R_BAD)
2068 AC_SUBST(NGR_R_COPY)
2069 AC_SUBST(NGR_R_COPY_ARGS)
2070 AC_SUBST(NGR_R_OK)
2071 AC_SUBST(NGR_R_RETURN)
2072 AC_SUBST(NGR_R_PRIVATE)
2074 AC_CHECK_FUNC(endnetgrent_r,
2075 AC_TRY_COMPILE(
2077 #undef __USE_MISC
2078 #define __USE_MISC
2079 #undef _REEENTRANT
2080 #define _REEENTRANT
2081 #include <netdb.h>
2082 #include <unistd.h>
2083 void endnetgrent_r(void **ptr);
2086 [return (0);]
2089 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  /* empty */"
2090 NGR_R_END_RETURN="#define NGR_R_END_RETURN void"
2091 NGR_R_END_ARGS="#define NGR_R_END_ARGS NGR_R_ARGS"
2094 AC_TRY_COMPILE(
2096 #undef __USE_MISC
2097 #define __USE_MISC
2098 #undef _REEENTRANT
2099 #define _REEENTRANT
2100 #include <netdb.h>
2101 #include <unistd.h>
2102 void endnetgrent_r(void *ptr);
2105 [return (0);]
2108 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  /* empty */"
2109 NGR_R_END_RETURN="#define NGR_R_END_RETURN void"
2110 NGR_R_END_ARGS="#define NGR_R_END_ARGS void *buf"
2114 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  return (x)"
2115 NGR_R_END_RETURN="#define NGR_R_END_RETURN int"
2116 NGR_R_END_ARGS="#define NGR_R_END_ARGS NGR_R_ARGS"
2121 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  /*empty*/"
2122 NGR_R_END_RETURN="#define NGR_R_END_RETURN void"
2123 NGR_R_END_ARGS="#undef NGR_R_END_ARGS /*empty*/"
2124 AC_DEFINE(NEED_ENDNETGRENT_R)
2126 AC_SUBST(NGR_R_END_RESULT)
2127 AC_SUBST(NGR_R_END_RETURN)
2128 AC_SUBST(NGR_R_END_ARGS)
2130 AC_CHECK_FUNC(setnetgrent_r,
2132 case "$host" in
2133 *bsdi*)
2134         #
2135         # No prototype
2136         #
2137         NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/"
2138         NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void"
2139         NGR_R_SET_ARGS="#define NGR_R_SET_ARGS NGR_R_ARGS"
2140         NGR_R_SET_CONST="#define NGR_R_SET_CONST"
2141         ;;
2142 *hpux*)
2143         #
2144         # No prototype
2145         #
2146         NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK"
2147         NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int"
2148         NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS /* empty */"
2149         NGR_R_SET_CONST="#define NGR_R_SET_CONST"
2150         ;;
2152 AC_TRY_COMPILE(
2154 #undef __USE_MISC
2155 #define __USE_MISC
2156 #undef _REEENTRANT
2157 #define _REEENTRANT
2158 #include <netdb.h>
2159 #include <unistd.h>
2160 void setnetgrent_r(void **ptr);
2163 [return (0);]
2166 NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /* empty */"
2167 NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void"
2168 NGR_R_SET_ARGS="#define NGR_R_SET_ARGS void **buf"
2169 NGR_R_SET_CONST="#define NGR_R_SET_CONST"
2172 AC_TRY_COMPILE(
2174 #undef __USE_MISC
2175 #define __USE_MISC
2176 #undef _REEENTRANT
2177 #define _REEENTRANT
2178 #include <netdb.h>
2179 #include <unistd.h>
2180 extern int setnetgrent_r(char *, void **);
2183 [return (0);]
2186 NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK"
2187 NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int"
2188 NGR_R_SET_ARGS="#define NGR_R_SET_ARGS void **buf"
2189 NGR_R_SET_CONST="#define NGR_R_SET_CONST"
2193 NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK"
2194 NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int"
2195 NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS"
2196 NGR_R_SET_CONST="#define NGR_R_SET_CONST const"
2200 esac
2203 NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/"
2204 NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void"
2205 NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS"
2206 NGR_R_SET_CONST="#define NGR_R_SET_CONST const"
2209 AC_SUBST(NGR_R_SET_RESULT)
2210 AC_SUBST(NGR_R_SET_RETURN)
2211 AC_SUBST(NGR_R_SET_ARGS)
2212 AC_SUBST(NGR_R_SET_CONST)
2214 AC_CHECK_FUNC(innetgr_r,,AC_DEFINE(NEED_INNETGR_R))
2216 case $host in
2217 ia64-hp-hpux11.*)
2220 AC_CHECK_FUNC(getprotoent_r,
2221 AC_TRY_COMPILE(
2223 #undef __USE_MISC
2224 #define __USE_MISC
2225 #include <netdb.h>
2226 struct protoent *getprotoent_r(struct protoent *result,
2227                  char *buffer, int buflen) {}
2230 [return (0);]
2233 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
2234 PROTO_R_BAD="#define PROTO_R_BAD NULL"
2235 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
2236 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
2237 PROTO_R_OK="#define PROTO_R_OK pptr"
2238 PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
2239 PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
2240 PROTOENT_DATA="#undef PROTOENT_DATA"
2243 AC_TRY_COMPILE(
2245 #undef __USE_MISC
2246 #define __USE_MISC
2247 #include <netdb.h>
2248 int getprotoent_r (struct protoent *, char *, size_t, struct protoent **);
2252 [return (0);]
2255 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, size_t buflen, struct protoent **answerp"
2256 PROTO_R_BAD="#define PROTO_R_BAD ERANGE"
2257 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
2258 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS char *buf, size_t buflen"
2259 PROTO_R_OK="#define PROTO_R_OK 0"
2260 PROTO_R_SETANSWER="#define PROTO_R_SETANSWER 1"
2261 PROTO_R_RETURN="#define PROTO_R_RETURN int"
2262 PROTOENT_DATA="#undef PROTOENT_DATA"
2265 AC_TRY_COMPILE(
2267 #undef __USE_MISC
2268 #define __USE_MISC
2269 #include <netdb.h>
2270 int getprotoent_r (struct protoent *, struct protoent_data *prot_data);
2274 [return (0);]
2277 PROTO_R_ARGS="#define PROTO_R_ARGS struct protoent_data *prot_data"
2278 PROTO_R_BAD="#define PROTO_R_BAD (-1)"
2279 PROTO_R_COPY="#define PROTO_R_COPY prot_data"
2280 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS struct protoent_data *pdptr"
2281 PROTO_R_OK="#define PROTO_R_OK 0"
2282 PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
2283 PROTO_R_RETURN="#define PROTO_R_RETURN int"
2284 PROTOENT_DATA="#define PROTOENT_DATA 1"
2291 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
2292 PROTO_R_BAD="#define PROTO_R_BAD NULL"
2293 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
2294 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
2295 PROTO_R_OK="#define PROTO_R_OK pptr"
2296 PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
2297 PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
2298 PROTOENT_DATA="#undef PROTOENT_DATA"
2301 esac
2302 AC_SUBST(PROTO_R_ARGS)
2303 AC_SUBST(PROTO_R_BAD)
2304 AC_SUBST(PROTO_R_COPY)
2305 AC_SUBST(PROTO_R_COPY_ARGS)
2306 AC_SUBST(PROTO_R_OK)
2307 AC_SUBST(PROTO_R_SETANSWER)
2308 AC_SUBST(PROTO_R_RETURN)
2309 AC_SUBST(PROTOENT_DATA)
2311 case $host in
2312 ia64-hp-hpux11.*)
2315 AC_CHECK_FUNC(endprotoent_r,
2316 AC_TRY_COMPILE(
2318 #undef _REENTRANT
2319 #define _REENTRANT
2320 #undef __USE_MISC
2321 #define __USE_MISC
2322 #include <netdb.h>
2323 void endprotoent_r(void);
2327 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) /*empty*/"
2328 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN void"
2329 PROTO_R_ENT_ARGS="#undef PROTO_R_ENT_ARGS"
2330 PROTO_R_ENT_UNUSED="#undef PROTO_R_ENT_UNUSED"
2333 AC_TRY_COMPILE(
2335 #undef _REENTRANT
2336 #define _REENTRANT
2337 #undef __USE_MISC
2338 #define __USE_MISC
2339 #include <netdb.h>
2340 void endprotoent_r(struct protoent_data *);
2344 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) /*empty*/"
2345 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN void"
2346 PROTO_R_ENT_ARGS="#define PROTO_R_ENT_ARGS struct protoent_data *proto_data"
2347 PROTO_R_ENT_UNUSED="#define PROTO_R_ENT_UNUSED UNUSED(proto_data)"
2350 AC_TRY_COMPILE(
2352 #undef _REENTRANT
2353 #define _REENTRANT
2354 #undef __USE_MISC
2355 #define __USE_MISC
2356 #include <netdb.h>
2357 int endprotoent_r(struct protoent_data *);
2361 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) return(0)"
2362 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN int"
2363 PROTO_R_ENT_ARGS="#define PROTO_R_ENT_ARGS struct protoent_data *proto_data"
2364 PROTO_R_ENT_UNUSED="#define PROTO_R_ENT_UNUSED UNUSED(proto_data)"
2371 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) /*empty*/"
2372 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN void"
2373 PROTO_R_ENT_ARGS="#undef PROTO_R_ENT_ARGS /*empty*/"
2374 PROTO_R_ENT_UNUSED="#undef PROTO_R_ENT_UNUSED"
2376 esac
2377 AC_SUBST(PROTO_R_END_RESULT)
2378 AC_SUBST(PROTO_R_END_RETURN)
2379 AC_SUBST(PROTO_R_ENT_ARGS)
2380 AC_SUBST(PROTO_R_ENT_UNUSED)
2382 case $host in
2383 ia64-hp-hpux11.*)
2386 AC_CHECK_FUNC(setprotoent_r,
2387 AC_TRY_COMPILE(
2389 #undef _REENTRANT
2390 #define _REENTRANT
2391 #undef __USE_MISC
2392 #define __USE_MISC
2393 #include <netdb.h>
2394 void               setprotoent_r __P((int));
2395 ],[],
2396 PROTO_R_SET_RESULT="#undef PROTO_R_SET_RESULT"
2397 PROTO_R_SET_RETURN="#define PROTO_R_SET_RETURN void"
2399 AC_TRY_COMPILE(
2401 #undef _REENTRANT
2402 #define _REENTRANT
2403 #undef __USE_MISC
2404 #define __USE_MISC
2405 #include <netdb.h>
2406 int setprotoent_r (int, struct protoent_data *);
2407 ],[],
2408 PROTO_R_SET_RESULT="#define PROTO_R_SET_RESULT (0)"
2409 PROTO_R_SET_RETURN="#define PROTO_R_SET_RETURN int"
2414 PROTO_R_SET_RESULT="#undef PROTO_R_SET_RESULT"
2415 PROTO_R_SET_RETURN="#define PROTO_R_SET_RETURN void"
2417 esac
2418 AC_SUBST(PROTO_R_SET_RESULT)
2419 AC_SUBST(PROTO_R_SET_RETURN)
2421 AC_CHECK_FUNC(getpwent_r,
2422 AC_TRY_COMPILE(
2424 #include <sys/types.h>
2425 #include <pwd.h>
2426 struct passwd *
2427 getpwent_r(struct passwd *pwptr, char *buf, int buflen) {}
2432 PASS_R_ARGS="#define PASS_R_ARGS char *buf, int buflen"
2433 PASS_R_BAD="#define PASS_R_BAD NULL"
2434 PASS_R_COPY="#define PASS_R_COPY buf, buflen"
2435 PASS_R_COPY_ARGS="#define PASS_R_COPY_ARGS PASS_R_ARGS"
2436 PASS_R_OK="#define PASS_R_OK pwptr"
2437 PASS_R_RETURN="#define PASS_R_RETURN struct passwd *"
2441 PASS_R_ARGS="#define PASS_R_ARGS char *buf, int buflen"
2442 PASS_R_BAD="#define PASS_R_BAD NULL"
2443 PASS_R_COPY="#define PASS_R_COPY buf, buflen"
2444 PASS_R_COPY_ARGS="#define PASS_R_COPY_ARGS PASS_R_ARGS"
2445 PASS_R_OK="#define PASS_R_OK pwptr"
2446 PASS_R_RETURN="#define PASS_R_RETURN struct passwd *"
2447 AC_DEFINE(NEED_GETPWENT_R)
2449 AC_SUBST(PASS_R_ARGS)
2450 AC_SUBST(PASS_R_BAD)
2451 AC_SUBST(PASS_R_COPY)
2452 AC_SUBST(PASS_R_COPY_ARGS)
2453 AC_SUBST(PASS_R_OK)
2454 AC_SUBST(PASS_R_RETURN)
2456 AC_CHECK_FUNC(endpwent_r,
2457 AC_TRY_COMPILE(
2459 #include <pwd.h>
2460 void endpwent_r(FILE **pwfp);
2461 ], ,
2462 PASS_R_END_RESULT="#define PASS_R_END_RESULT(x) /*empty*/"
2463 PASS_R_END_RETURN="#define PASS_R_END_RETURN void"
2464 PASS_R_ENT_ARGS="#define PASS_R_ENT_ARGS FILE **pwptr"
2468 PASS_R_END_RESULT="#define PASS_R_END_RESULT(x) /*empty*/"
2469 PASS_R_END_RETURN="#define PASS_R_END_RETURN void"
2470 PASS_R_ENT_ARGS="#undef PASS_R_ENT_ARGS"
2471 AC_DEFINE(NEED_ENDPWENT_R)
2473 AC_SUBST(PASS_R_END_RESULT)
2474 AC_SUBST(PASS_R_END_RETURN)
2475 AC_SUBST(PASS_R_ENT_ARGS)
2476 AC_CHECK_FUNC(setpassent_r,,AC_DEFINE(NEED_SETPASSENT_R))
2477 AC_CHECK_FUNC(setpassent,,AC_DEFINE(NEED_SETPASSENT))
2479 AC_CHECK_FUNC(setpwent_r,
2480 AC_TRY_COMPILE([
2481 #include <pwd.h>
2482 void setpwent_r(FILE **pwfp);
2483 ], ,
2484 PASS_R_SET_RESULT="#undef PASS_R_SET_RESULT /* empty */"
2485 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN int"
2487 AC_TRY_COMPILE([
2488 #include <pwd.h>
2489 int setpwent_r(FILE **pwfp);
2490 ], ,
2491 PASS_R_SET_RESULT="#define PASS_R_SET_RESULT 0"
2492 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN int"
2497 PASS_R_SET_RESULT="#undef PASS_R_SET_RESULT /*empty*/"
2498 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN void"
2499 AC_DEFINE(NEED_SETPWENT_R)
2501 AC_SUBST(PASS_R_SET_RESULT)
2502 AC_SUBST(PASS_R_SET_RETURN)
2504 AC_CHECK_FUNC(getpwnam_r,,AC_DEFINE(NEED_GETPWNAM_R))
2505 AC_CHECK_FUNC(getpwuid_r,,AC_DEFINE(NEED_GETPWUID_R))
2507 case $host in
2508 ia64-hp-hpux11.*)
2511 AC_CHECK_FUNC(getservent_r,
2512 AC_TRY_COMPILE([
2513 #undef __USE_MISC
2514 #define __USE_MISC
2515 #include <netdb.h>
2516 struct servent *
2517 getservent_r(struct servent *result, char *buffer, int buflen) {}
2518 ],[return (0);],
2520 SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen"
2521 SERV_R_BAD="#define SERV_R_BAD NULL"
2522 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2523 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS SERV_R_ARGS"
2524 SERV_R_OK="#define SERV_R_OK sptr"
2525 SERV_R_SETANSWER="#undef SERV_R_SETANSWER"
2526 SERV_R_RETURN="#define SERV_R_RETURN struct servent *"
2529 AC_TRY_COMPILE([
2530 #undef __USE_MISC
2531 #define __USE_MISC
2532 #include <netdb.h>
2534 getservent_r (struct servent *, char *, size_t, struct servent **);
2535 ],[return (0);],
2537 SERV_R_ARGS="#define SERV_R_ARGS char *buf, size_t buflen, struct servent **answerp"
2538 SERV_R_BAD="#define SERV_R_BAD ERANGE"
2539 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2540 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS char *buf, size_t buflen"
2541 SERV_R_OK="#define SERV_R_OK (0)"
2542 SERV_R_SETANSWER="#define SERV_R_SETANSWER 1"
2543 SERV_R_RETURN="#define SERV_R_RETURN int"
2546 AC_TRY_COMPILE([
2547 #undef __USE_MISC
2548 #define __USE_MISC
2549 #include <netdb.h>
2551 getservent_r (struct servent *, struct servent_data *serv_data);
2552 ],[return (0);],
2554 SERV_R_ARGS="#define SERV_R_ARGS struct servent_data *serv_data"
2555 SERV_R_BAD="#define SERV_R_BAD (-1)"
2556 SERV_R_COPY="#define SERV_R_COPY serv_data"
2557 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS struct servent_data *sdptr"
2558 SERV_R_OK="#define SERV_R_OK (0)"
2559 SERV_R_SETANSWER="#undef SERV_R_SETANSWER"
2560 SERV_R_RETURN="#define SERV_R_RETURN int"
2561 SERVENT_DATA="#define SERVENT_DATA 1"
2568 SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen"
2569 SERV_R_BAD="#define SERV_R_BAD NULL"
2570 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2571 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS SERV_R_ARGS"
2572 SERV_R_OK="#define SERV_R_OK sptr"
2573 SERV_R_SETANSWER="#undef SERV_R_SETANSWER"
2574 SERV_R_RETURN="#define SERV_R_RETURN struct servent *"
2576 esac
2577 AC_SUBST(SERV_R_ARGS)
2578 AC_SUBST(SERV_R_BAD)
2579 AC_SUBST(SERV_R_COPY)
2580 AC_SUBST(SERV_R_COPY_ARGS)
2581 AC_SUBST(SERV_R_OK)
2582 AC_SUBST(SERV_R_SETANSWER)
2583 AC_SUBST(SERV_R_RETURN)
2584 AC_SUBST(SERVENT_DATA)
2586 case $host in
2587 ia64-hp-hpux11.*)
2590 AC_CHECK_FUNC(endservent_r,
2591 AC_TRY_COMPILE(
2593 #undef _REENTRANT
2594 #define _REENTRANT
2595 #undef __USE_MISC
2596 #define __USE_MISC
2597 #include <netdb.h>
2598 void endservent_r(void);
2603 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) /*empty*/"
2604 SERV_R_END_RETURN="#define SERV_R_END_RETURN void "
2605 SERV_R_ENT_ARGS="#undef SERV_R_ENT_ARGS /*empty*/"
2606 SERV_R_ENT_UNUSED="#undef SERV_R_ENT_UNUSED /*empty*/"
2609 AC_TRY_COMPILE(
2611 #undef _REENTRANT
2612 #define _REENTRANT
2613 #undef __USE_MISC
2614 #define __USE_MISC
2615 #include <netdb.h>
2616 void endservent_r(struct servent_data *serv_data);
2621 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) /*empty*/"
2622 SERV_R_END_RETURN="#define SERV_R_END_RETURN void "
2623 SERV_R_ENT_ARGS="#define SERV_R_ENT_ARGS struct servent_data *serv_data"
2624 SERV_R_ENT_UNUSED="#define SERV_R_ENT_UNUSED UNUSED(serv_data)"
2627 AC_TRY_COMPILE(
2629 #undef _REENTRANT
2630 #define _REENTRANT
2631 #undef __USE_MISC
2632 #define __USE_MISC
2633 #include <netdb.h>
2634 int endservent_r(struct servent_data *serv_data);
2639 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) return(x)"
2640 SERV_R_END_RETURN="#define SERV_R_END_RETURN int "
2641 SERV_R_ENT_ARGS="#define SERV_R_ENT_ARGS struct servent_data *serv_data"
2642 SERV_R_ENT_UNUSED="#define SERV_R_ENT_UNUSED UNUSED(serv_data)"
2649 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) /*empty*/"
2650 SERV_R_END_RETURN="#define SERV_R_END_RETURN void "
2651 SERV_R_ENT_ARGS="#undef SERV_R_ENT_ARGS /*empty*/"
2652 SERV_R_ENT_UNUSED="#undef SERV_R_ENT_UNUSED /*empty*/"
2654 esac
2655 AC_SUBST(SERV_R_END_RESULT)
2656 AC_SUBST(SERV_R_END_RETURN)
2657 AC_SUBST(SERV_R_ENT_ARGS)
2658 AC_SUBST(SERV_R_ENT_UNUSED)
2660 case $host in
2661 ia64-hp-hpux11.*)
2664 AC_CHECK_FUNC(setservent_r,
2665 AC_TRY_COMPILE(
2667 #undef _REENTRANT
2668 #define _REENTRANT
2669 #undef __USE_MISC
2670 #define __USE_MISC
2671 #include <netdb.h>
2672 void setservent_r(int);
2676 SERV_R_SET_RESULT="#undef SERV_R_SET_RESULT"
2677 SERV_R_SET_RETURN="#define SERV_R_SET_RETURN void"
2680 AC_TRY_COMPILE(
2682 #undef _REENTRANT
2683 #define _REENTRANT
2684 #undef __USE_MISC
2685 #define __USE_MISC
2686 #include <netdb.h>
2687 int setservent_r(int, struct servent_data *);
2691 SERV_R_SET_RESULT="#define SERV_R_SET_RESULT (0)"
2692 SERV_R_SET_RETURN="#define SERV_R_SET_RETURN int"
2698 SERV_R_SET_RESULT="#undef SERV_R_SET_RESULT"
2699 SERV_R_SET_RETURN="#define SERV_R_SET_RETURN void"
2701 esac
2702 AC_SUBST(SERV_R_SET_RESULT)
2703 AC_SUBST(SERV_R_SET_RETURN)
2705 AC_TRY_COMPILE(
2707 #undef _REENTRANT
2708 #define _REENTRANT
2709 #undef __USE_MISC
2710 #define __USE_MISC
2711 #include <unistd.h>
2712 #include <netdb.h>
2713 int innetgr(const char *netgroup, const char *host, const char *user, const char *domain);
2717 INNETGR_ARGS="#undef INNETGR_ARGS"
2720 AC_TRY_COMPILE(
2722 #undef _REENTRANT
2723 #define _REENTRANT
2724 #undef __USE_MISC
2725 #define __USE_MISC
2726 #include <unistd.h>
2727 #include <netdb.h>
2728 int innetgr(char *netgroup, char *host, char *user, char *domain);
2732 INNETGR_ARGS="#define INNETGR_ARGS char *netgroup, char *host, char *user, char *domain"
2737 AC_TRY_COMPILE(
2739 #undef _REENTRANT
2740 #define _REENTRANT
2741 #undef __USE_MISC
2742 #define __USE_MISC
2743 #include <unistd.h>
2744 #include <netdb.h>
2745 void setnetgrent(const char *);
2749 SETNETGRENT_ARGS="#undef SETNETGRENT_ARGS"
2752 AC_TRY_COMPILE(
2754 #undef _REENTRANT
2755 #define _REENTRANT
2756 #undef __USE_MISC
2757 #define __USE_MISC
2758 #include <unistd.h>
2759 #include <netdb.h>
2760 void setnetgrent(char *);
2764 SETNETGRENT_ARGS="#define SETNETGRENT_ARGS char *netgroup"
2768 AC_SUBST(SETNETGRENT_ARGS)
2769 AC_SUBST(INNETGR_ARGS)
2772 # Random remaining OS-specific issues involving compiler warnings.
2773 # XXXDCL print messages to indicate some compensation is being done?
2775 BROKEN_IN6ADDR_INIT_MACROS="#undef BROKEN_IN6ADDR_INIT_MACROS"
2777 case "$host" in
2778         *-aix5.1.*)
2779                 hack_shutup_pthreadmutexinit=yes
2780                 hack_shutup_in6addr_init_macros=yes
2781                 ;;
2782         *-aix5.[[23]].*)
2783                 hack_shutup_in6addr_init_macros=yes
2784                 ;;
2785         *-bsdi3.1*)
2786                 hack_shutup_sputaux=yes
2787                 ;;
2788         *-bsdi4.0*)
2789                 hack_shutup_sigwait=yes
2790                 hack_shutup_sputaux=yes
2791                 hack_shutup_in6addr_init_macros=yes
2792                 ;;
2793         *-bsdi4.1*)
2794                 hack_shutup_stdargcast=yes
2795                 ;;
2796         *-hpux11.11)
2797                 hack_shutup_in6addr_init_macros=yes
2798                 ;;
2799         *-osf5.1|*-osf5.1b)
2800                 hack_shutup_in6addr_init_macros=yes
2801                 ;;
2802         *-solaris2.8)
2803                 hack_shutup_in6addr_init_macros=yes
2804                 ;;
2805         *-solaris2.9)
2806                 hack_shutup_in6addr_init_macros=yes
2807                 ;;
2808         *-solaris2.1[[0-9]])
2809                 hack_shutup_in6addr_init_macros=yes
2810                 ;;
2811 esac
2813 case "$hack_shutup_pthreadmutexinit" in
2814         yes)
2815                 #
2816                 # Shut up PTHREAD_MUTEX_INITIALIZER unbraced
2817                 # initializer warnings.
2818                 #
2819                 AC_DEFINE(SHUTUP_MUTEX_INITIALIZER)
2820                 ;;
2821 esac
2823 case "$hack_shutup_sigwait" in
2824         yes)
2825                 #
2826                 # Shut up a -Wmissing-prototypes warning for sigwait().
2827                 #
2828                 AC_DEFINE(SHUTUP_SIGWAIT)
2829                 ;;
2830 esac
2832 case "$hack_shutup_sputaux" in
2833         yes)
2834                 #
2835                 # Shut up a -Wmissing-prototypes warning from <stdio.h>.
2836                 #
2837                 AC_DEFINE(SHUTUP_SPUTAUX)
2838                 ;;
2839 esac
2841 case "$hack_shutup_stdargcast" in
2842         yes)
2843                 #
2844                 # Shut up a -Wcast-qual warning from va_start().
2845                 #
2846                 AC_DEFINE(SHUTUP_STDARG_CAST)
2847                 ;;
2848 esac
2850 case "$hack_shutup_in6addr_init_macros" in
2851         yes)
2852                 AC_DEFINE(BROKEN_IN6ADDR_INIT_MACROS, 1, [Defined if IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT need to be redefined.] )
2853                 ;;
2854 esac
2857 # Substitutions
2859 AC_SUBST(BIND9_TOP_BUILDDIR)
2860 BIND9_TOP_BUILDDIR=`pwd`
2862 AC_SUBST_FILE(BIND9_INCLUDES)
2863 BIND9_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2865 AC_SUBST_FILE(BIND9_MAKE_RULES)
2866 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2868 AC_SUBST_FILE(LIBBIND_API)
2869 LIBBIND_API=$srcdir/api
2871 AC_OUTPUT(
2872         make/rules
2873         make/mkdep
2874         make/includes
2875         Makefile
2876         bsd/Makefile
2877         doc/Makefile
2878         dst/Makefile
2879         include/Makefile
2880         inet/Makefile
2881         irs/Makefile
2882         isc/Makefile
2883         nameser/Makefile
2884         port_after.h
2885         port_before.h
2886         resolv/Makefile
2887         port/Makefile
2888         ${PORT_DIR}/Makefile
2889         ${PORT_INCLUDE}/Makefile
2890         include/isc/platform.h
2891         tests/Makefile
2894 # Tell Emacs to edit this file in shell mode.
2895 # Local Variables:
2896 # mode: sh
2897 # End: