]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bind9/lib/bind/configure.in
This commit was generated by cvs2svn to compensate for changes in r161351,
[FreeBSD/FreeBSD.git] / contrib / bind9 / lib / bind / configure.in
1 # Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 2001  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
16 AC_REVISION($Revision: 1.83.2.5.2.22 $)
17
18 AC_INIT(resolv/herror.c)
19 AC_PREREQ(2.13)
20
21 AC_CONFIG_HEADER(config.h)
22
23 AC_CANONICAL_HOST
24
25 AC_PROG_MAKE_SET
26 AC_PROG_RANLIB
27 AC_PROG_INSTALL
28
29 AC_SUBST(STD_CINCLUDES)
30 AC_SUBST(STD_CDEFINES)
31 AC_SUBST(STD_CWARNINGS)
32 AC_SUBST(CCOPT)
33
34 AC_PATH_PROG(AR, ar)
35 ARFLAGS="cruv"
36 AC_SUBST(AR)
37 AC_SUBST(ARFLAGS)
38
39 # The POSIX ln(1) program.  Non-POSIX systems may substitute
40 # "copy" or something.
41 LN=ln
42 AC_SUBST(LN)
43
44 case "$AR" in
45         "")
46                 AC_MSG_ERROR([
47 ar program not found.  Please fix your PATH to include the directory in
48 which ar resides, or set AR in the environment with the full path to ar.
49 ])
50
51                 ;;
52 esac
53
54 #
55 # Etags.
56 #
57 AC_PATH_PROGS(ETAGS, etags emacs-etags)
58
59 #
60 # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
61 # GNU emacs etags, and it requires the -L flag.
62 #
63 if test "X$ETAGS" != "X"; then
64         AC_MSG_CHECKING(for Exuberant Ctags etags)
65         if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
66                 AC_MSG_RESULT(yes)
67                 ETAGS="$ETAGS -L"
68         else
69                 AC_MSG_RESULT(no)
70         fi
71 fi
72 AC_SUBST(ETAGS)
73
74 #
75 # Perl is optional; it is used only by some of the system test scripts.
76 #
77 AC_PATH_PROGS(PERL, perl5 perl)
78 AC_SUBST(PERL)
79
80 #
81 # isc/list.h and others clash with the rest of BIND 9
82 #
83 case "$includedir" in
84         '${prefix}/include')
85                 includedir='${prefix}/bind/include'
86                 ;;
87 esac
88 case "$libdir" in
89         '${prefix}/lib')
90                 libdir='${prefix}/bind/lib'
91                 ;;
92 esac
93
94 #
95 # Make sure INSTALL uses an absolute path, else it will be wrong in all
96 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
97 # configure based on the location of the file where it is substituted.
98 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
99 # subdirectory of install-sh, This relative path will be wrong for all
100 # directories more than one level down from install-sh.
101 #
102 case "$INSTALL" in
103         /*)
104                 ;;
105         *)
106                 #
107                 # Not all systems have dirname.
108                 #
109                 changequote({, })
110                 ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
111                 changequote([, ])
112
113                 ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
114                 test "$ac_dir" = "$ac_prog" && ac_dir=.
115                 test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
116                 INSTALL="$ac_dir/$ac_prog"
117                 ;;
118 esac
119
120 #
121 # On these hosts, we really want to use cc, not gcc, even if it is
122 # found.  The gcc that these systems have will not correctly handle
123 # pthreads.
124 #
125 # However, if the user sets $CC to be something, let that override
126 # our change.
127 #
128 if test "X$CC" = "X" ; then
129         case "$host" in
130                 *-dec-osf*)
131                         CC="cc"
132                         ;;
133                 *-solaris*)
134                         # Use Sun's cc if it is available, but watch
135                         # out for /usr/ucb/cc; it will never be the right
136                         # compiler to use.
137                         #
138                         # If setting CC here fails, the AC_PROG_CC done
139                         # below might still find gcc.
140                         IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
141                         for ac_dir in $PATH; do
142                                 test -z "$ac_dir" && ac_dir=.
143                                 case "$ac_dir" in
144                                 /usr/ucb)
145                                         # exclude
146                                         ;;
147                                 *)
148                                         if test -f "$ac_dir/cc"; then
149                                                 CC="$ac_dir/cc"
150                                                 break
151                                         fi
152                                         ;;
153                                 esac
154                         done
155                         IFS="$ac_save_ifs"
156                         ;;
157                 *-hp-hpux*)
158                         CC="cc"
159                         ;;
160                 mips-sgi-irix*)
161                         CC="cc"
162                         ;;
163         esac
164 fi
165
166
167 AC_PROG_CC
168
169 AC_HEADER_STDC
170
171
172 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)
173
174 AC_C_CONST
175 AC_C_INLINE
176 AC_TYPE_SIZE_T
177 AC_CHECK_TYPE(uintptr_t,unsigned long)
178 AC_HEADER_TIME
179 #
180 # check if we need to #include sys/select.h explicitly
181 #
182 case $ac_cv_header_unistd_h in
183 yes)
184 AC_MSG_CHECKING(if unistd.h defines fd_set)
185 AC_TRY_COMPILE([
186 #include <unistd.h>],
187 [fd_set read_set; return (0);],
188         [AC_MSG_RESULT(yes)
189          ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
190          ],
191         [AC_MSG_RESULT(no)
192         case ac_cv_header_sys_select_h in
193         yes)
194          ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
195                 ;;
196         no)
197                 AC_MSG_ERROR([need either working unistd.h or sys/select.h])
198                 ;;
199         esac
200         ])
201         ;;
202 no)
203         case ac_cv_header_sys_select_h in
204         yes)
205              ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
206                 ;;
207         no)
208                 AC_MSG_ERROR([need either unistd.h or sys/select.h])
209                 ;;
210         esac
211         ;;
212 esac
213 AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
214
215 #
216 # Find the machine's endian flavor.
217 #
218 AC_C_BIGENDIAN
219
220 AC_ARG_WITH(irs-gr,[ --with-irs-gr              Build ....],
221 want_irs_gr="$withval", want_irs_gr="no")
222 case "$want_irs_gr" in
223 yes) WANT_IRS_GR="#define WANT_IRS_GR 1"
224      WANT_IRS_GR_OBJS="\${WANT_IRS_GR_OBJS}"
225         ;;
226 *) WANT_IRS_GR="#undef WANT_IRS_GR" WANT_IRS_GR_OBJS="";;
227 esac
228 AC_SUBST(WANT_IRS_GR)
229 AC_SUBST(WANT_IRS_GR_OBJS)
230
231 AC_ARG_WITH(irs-pw,[ --with-irs-pw              Build ....],
232 want_irs_pw="$withval", want_irs_pw="no")
233 case "$want_irs_pw" in
234 yes) WANT_IRS_PW="#define WANT_IRS_PW 1"
235      WANT_IRS_PW_OBJS="\${WANT_IRS_PW_OBJS}";;
236 *) WANT_IRS_PW="#undef WANT_IRS_PW" WANT_IRS_PW_OBJS="";;
237 esac
238 AC_SUBST(WANT_IRS_PW)
239 AC_SUBST(WANT_IRS_PW_OBJS)
240
241 AC_ARG_WITH(irs-nis,[ --with-irs-nis            Build ....],
242 want_irs_nis="$withval", want_irs_nis="no")
243 case "$want_irs_nis" in
244 yes)
245         WANT_IRS_NIS="#define WANT_IRS_NIS 1"
246         WANT_IRS_NIS_OBJS="\${WANT_IRS_NIS_OBJS}"
247         case "$want_irs_gr" in
248         yes)
249                 WANT_IRS_NISGR_OBJS="\${WANT_IRS_NISGR_OBJS}";;
250         *)
251                 WANT_IRS_NISGR_OBJS="";;
252         esac
253         case "$want_irs_pw" in
254         yes)
255                 WANT_IRS_NISPW_OBJS="\${WANT_IRS_NISPW_OBJS}";;
256         *)
257                 WANT_IRS_NISPW_OBJS="";;
258         esac
259         ;;
260 *)
261         WANT_IRS_NIS="#undef WANT_IRS_NIS"
262         WANT_IRS_NIS_OBJS=""
263         WANT_IRS_NISGR_OBJS=""
264         WANT_IRS_NISPW_OBJS="";;
265 esac
266 AC_SUBST(WANT_IRS_NIS)
267 AC_SUBST(WANT_IRS_NIS_OBJS)
268 AC_SUBST(WANT_IRS_NISGR_OBJS)
269 AC_SUBST(WANT_IRS_NISPW_OBJS)
270 AC_TRY_RUN([
271 #ifdef HAVE_DB_H
272 int have_db_h = 1;
273 #else
274 int have_db_h = 0;
275 #endif
276 main() { return(!have_db_h); }
277 ],
278 WANT_IRS_DBPW_OBJS="\${WANT_IRS_DBPW_OBJS}"
279 ,
280 WANT_IRS_DBPW_OBJS=""
281 ,
282 WANT_IRS_DBPW_OBJS=""
283 )
284 AC_SUBST(WANT_IRS_DBPW_OBJS)
285
286 #
287 # was --with-randomdev specified?
288 #
289 AC_MSG_CHECKING(for random device)
290 AC_ARG_WITH(randomdev,
291 [  --with-randomdev=PATH Specify path for random device],
292     use_randomdev="$withval", use_randomdev="unspec")
293
294 case "$use_randomdev" in
295         unspec)
296                 case "$host" in
297                         *-openbsd*)
298                                 devrandom=/dev/srandom
299                                 ;;
300                         *)
301                                 devrandom=/dev/random
302                                 ;;
303                 esac
304                 AC_MSG_RESULT($devrandom)
305                 AC_CHECK_FILE($devrandom,
306                               AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
307                                                  "$devrandom"),)
308                 ;;
309         yes)
310                 AC_MSG_ERROR([--with-randomdev must specify a path])
311                 ;;
312         *)
313                 AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
314                 AC_MSG_RESULT(using "$use_randomdev")
315                 ;;
316 esac
317
318 sinclude(../../config.threads.in)dnl
319
320 if $use_threads
321 then
322         #
323         # We'd like to use sigwait() too
324         #
325         AC_CHECK_LIB(c, sigwait,
326                      AC_DEFINE(HAVE_SIGWAIT),
327                      AC_CHECK_LIB(pthread, sigwait,
328                                   AC_DEFINE(HAVE_SIGWAIT),
329                                   AC_CHECK_LIB(pthread, _Psigwait,
330                                                AC_DEFINE(HAVE_SIGWAIT),))
331         )
332
333         AC_CHECK_FUNC(pthread_attr_getstacksize,
334                       AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
335
336         #
337         # Additional OS-specific issues related to pthreads and sigwait.
338         #
339         case "$host" in
340                 #
341                 # One more place to look for sigwait.
342                 #
343                 *-freebsd*)
344                         AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
345                         ;;
346                 #
347                 # BSDI 3.0 through 4.0.1 needs pthread_init() to be
348                 # called before certain pthreads calls.  This is deprecated
349                 # in BSD/OS 4.1.
350                 #
351                 *-bsdi3.*|*-bsdi4.0*)
352                         AC_DEFINE(NEED_PTHREAD_INIT)
353                         ;;
354                 #
355                 # LinuxThreads requires some changes to the way we
356                 # deal with signals.
357                 #
358                 *-linux*)
359                         AC_DEFINE(HAVE_LINUXTHREADS)
360                         ;;
361                 #
362                 # Ensure the right sigwait() semantics on Solaris and make
363                 # sure we call pthread_setconcurrency.
364                 #
365                 *-solaris*)
366                         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
367                         AC_CHECK_FUNC(pthread_setconcurrency,
368                                       AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
369                         AC_DEFINE(POSIX_GETPWUID_R)
370                         AC_DEFINE(POSIX_GETPWNAM_R)
371                         AC_DEFINE(POSIX_GETGRGID_R)
372                         AC_DEFINE(POSIX_GETGRNAM_R)
373                         ;;
374                 *hpux11*)
375                         AC_DEFINE(NEED_ENDNETGRENT_R)
376                         AC_DEFINE(_PTHREADS_DRAFT4)
377                         ;;
378                 #
379                 # UnixWare does things its own way.
380                 #
381                 *-UnixWare*)
382                         AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
383                         ;;
384         esac
385
386         #
387         # Look for sysconf to allow detection of the number of processors.
388         #
389         AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
390
391         if test "X$GCC" = "Xyes"; then
392                 case "$host" in
393                 *-freebsd*)
394                         CC="$CC -pthread"
395                         CCOPT="$CCOPT -pthread"
396                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
397                         ;;
398                 *-openbsd*)
399                         CC="$CC -pthread"
400                         CCOPT="$CCOPT -pthread"
401                         ;;
402                 *-solaris*)
403                         LIBS="$LIBS -lthread"
404                         ;;
405                 *-ibm-aix*)
406                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
407                         ;;
408                 esac
409         else
410                 case $host in
411                 *-dec-osf*)
412                         CC="$CC -pthread"
413                         CCOPT="$CCOPT -pthread"
414                         ;;
415                 *-solaris*)
416                         CC="$CC -mt"
417                         CCOPT="$CCOPT -mt"
418                         ;;
419                 *-ibm-aix*)
420                         STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
421                         ;;
422                 *-UnixWare*)
423                         CC="$CC -Kthread"
424                         CCOPT="$CCOPT -Kthread"
425                         ;;
426                 esac
427         fi
428         AC_DEFINE(_REENTRANT)
429         ALWAYS_DEFINES="-D_REENTRANT"
430         DO_PTHREADS="#define DO_PTHREADS 1"
431         WANT_IRS_THREADSGR_OBJS="\${WANT_IRS_THREADSGR_OBJS}"
432         WANT_IRS_THREADSPW_OBJS="\${WANT_IRS_THREADSPW_OBJS}"
433         case $host in
434         ia64-hp-hpux11.*)
435                 WANT_IRS_THREADS_OBJS="";;
436         *)
437                 WANT_IRS_THREADS_OBJS="\${WANT_IRS_THREADS_OBJS}";;
438         esac
439         WANT_THREADS_OBJS="\${WANT_THREADS_OBJS}"
440         thread_dir=pthreads
441 else
442         ALWAYS_DEFINES=""
443         DO_PTHREADS="#undef DO_PTHREADS"
444         WANT_IRS_THREADSGR_OBJS=""
445         WANT_IRS_THREADSPW_OBJS=""
446         WANT_IRS_THREADS_OBJS=""
447         WANT_THREADS_OBJS=""
448         thread_dir=nothreads
449 fi
450
451 AC_SUBST(ALWAYS_DEFINES)
452 AC_SUBST(DO_PTHREADS)
453 AC_SUBST(WANT_IRS_THREADSGR_OBJS)
454 AC_SUBST(WANT_IRS_THREADSPW_OBJS)
455 AC_SUBST(WANT_IRS_THREADS_OBJS)
456 AC_SUBST(WANT_THREADS_OBJS)
457
458 AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT))
459
460 AC_CHECK_FUNC(if_nametoindex,
461         [USE_IFNAMELINKID="#define USE_IFNAMELINKID 1"],
462         [USE_IFNAMELINKID="#undef USE_IFNAMELINKID"])
463 AC_SUBST(USE_IFNAMELINKID)
464
465 ISC_THREAD_DIR=$thread_dir
466 AC_SUBST(ISC_THREAD_DIR)
467
468 AC_CHECK_FUNC(daemon,
469 [DAEMON_OBJS="" NEED_DAEMON="#undef NEED_DAEMON"]
470 ,
471 [DAEMON_OBJS="\${DAEMON_OBJS}" NEED_DAEMON="#define NEED_DAEMON 1"]
472 )
473 AC_SUBST(DAEMON_OBJS)
474 AC_SUBST(NEED_DAEMON)
475
476 AC_CHECK_FUNC(strsep,
477 [STRSEP_OBJS="" NEED_STRSEP="#undef NEED_STRSEP"]
478 ,
479 [STRSEP_OBJS="\${STRSEP_OBJS}" NEED_STRSEP="#define NEED_STRSEP 1"]
480 )
481 AC_SUBST(STRSEP_OBJS)
482 AC_SUBST(NEED_STRSEP)
483
484 AC_CHECK_FUNC(strerror, [NEED_STRERROR="#undef NEED_STRERROR"],
485 [NEED_STRERROR="#define NEED_STRERROR 1"])
486 AC_SUBST(NEED_STRERROR)
487
488 #
489 # flockfile is usually provided by pthreads, but we may want to use it
490 # even if compiled with --disable-threads.
491 #
492 AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
493
494
495 # Indicate what the final decision was regarding threads.
496 #
497 AC_MSG_CHECKING(whether to build with threads)
498 if $use_threads; then
499         AC_MSG_RESULT(yes)
500 else
501         AC_MSG_RESULT(no)
502 fi
503
504
505 # End of pthreads stuff.
506 #
507
508 #
509 # Additional compiler settings.
510 #
511 MKDEPCC="$CC"
512 MKDEPCFLAGS="-M"
513 IRIX_DNSSEC_WARNINGS_HACK=""
514
515 if test "X$GCC" = "Xyes"; then
516         STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings"
517 else
518         case $host in
519         *-dec-osf*)
520                 CC="$CC -std"
521                 CCOPT="$CCOPT -std"
522                 MKDEPCC="$CC"
523                 ;;
524         *-hp-hpux*)
525                 CC="$CC -Ae -z"
526                 # The version of the C compiler that constantly warns about
527                 # 'const' as well as alignment issues is unfortunately not
528                 # able to be discerned via the version of the operating
529                 # system, nor does cc have a version flag.
530                 case "`$CC +W 123 2>&1`" in
531                 *Unknown?option*)
532                         STD_CWARNINGS="+w1"
533                         ;;
534                 *)
535                         # Turn off the pointlessly noisy warnings.
536                         STD_CWARNINGS="+w1 +W 474,530,2193,2236"
537                         ;;
538                 esac
539                 CCOPT="$CCOPT -Ae -z"
540                 LIBS="-Wl,+vnocompatwarnings $LIBS"
541 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'
542                 MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
543                 ;;
544         *-sgi-irix*)
545                 STD_CWARNINGS="-fullwarn -woff 1209"
546                 #
547                 # Silence more than 250 instances of
548                 #   "prototyped function redeclared without prototype"
549                 # and 11 instances of
550                 #   "variable ... was set but never used"
551                 # from lib/dns/sec/openssl.
552                 #
553                 IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
554                 ;;
555         *-solaris*)
556                 MKDEPCFLAGS="-xM"
557                 ;;
558         *-UnixWare*)
559                 CC="$CC -w"
560                 ;;
561         esac
562 fi
563
564 #
565 # _GNU_SOURCE is needed to access the fd_bits field of struct fd_set, which
566 # is supposed to be opaque.
567 #
568 case $host in
569         *linux*)
570                 STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
571                 ;;
572 esac
573
574 AC_SUBST(MKDEPCC)
575 AC_SUBST(MKDEPCFLAGS)
576 AC_SUBST(MKDEPPROG)
577 AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
578
579 #
580 # NLS
581 #
582 AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
583
584 #
585 # -lxnet buys us one big porting headache...  standards, gotta love 'em.
586 #
587 # AC_CHECK_LIB(xnet, socket, ,
588 #    AC_CHECK_LIB(socket, socket)
589 #    AC_CHECK_LIB(nsl, inet_ntoa)
590 # )
591 #
592 # Use this for now, instead:
593 #
594 case "$host" in
595         mips-sgi-irix*)
596                 ;;
597         ia64-hp-hpux11.*)
598                 AC_CHECK_LIB(socket, socket)
599                 AC_CHECK_LIB(nsl, inet_ntoa)
600                 ;;
601         *)
602                 AC_CHECK_LIB(d4r, gethostbyname_r)
603                 AC_CHECK_LIB(socket, socket)
604                 AC_CHECK_LIB(nsl, inet_ntoa)
605                 ;;
606 esac
607
608 #
609 # Purify support
610 #
611 AC_MSG_CHECKING(whether to use purify)
612 AC_ARG_WITH(purify,
613         [  --with-purify[=PATH] use Rational purify],
614         use_purify="$withval", use_purify="no")
615
616 case "$use_purify" in
617         no)
618                 ;;
619         yes)
620                 AC_PATH_PROG(purify_path, purify, purify)
621                 ;;
622         *)
623                 purify_path="$use_purify"
624                 ;;
625 esac
626
627 case "$use_purify" in
628         no)
629                 AC_MSG_RESULT(no)
630                 PURIFY=""
631                 ;;
632         *)
633                 if test -f $purify_path || test $purify_path = purify; then
634                         AC_MSG_RESULT($purify_path)
635                         PURIFYFLAGS="`echo $PURIFYOPTIONS`"
636                         PURIFY="$purify_path $PURIFYFLAGS"
637                 else
638                         AC_MSG_ERROR([$purify_path not found.
639
640 Please choose the proper path with the following command:
641
642     configure --with-purify=PATH
643 ])
644                 fi
645                 ;;
646 esac
647
648 AC_SUBST(PURIFY)
649
650 #
651 # GNU libtool support
652 #
653 AC_ARG_WITH(libtool,
654             [  --with-libtool   use GNU libtool (following indented options supported)],
655             use_libtool="$withval", use_libtool="no")
656
657 case $use_libtool in
658         yes)
659                 AM_PROG_LIBTOOL
660                 O=lo
661                 A=la
662                 LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
663                 LIBTOOL_MODE_COMPILE='--mode=compile'
664                 LIBTOOL_MODE_INSTALL='--mode=install'
665                 LIBTOOL_MODE_LINK='--mode=link'
666                 ;;
667         *)
668                 O=o
669                 A=a
670                 LIBTOOL=
671                 AC_SUBST(LIBTOOL)
672                 LIBTOOL_MKDEP_SED=
673                 LIBTOOL_MODE_COMPILE=
674                 LIBTOOL_MODE_INSTALL=
675                 LIBTOOL_MODE_LINK=
676                 ;;
677 esac
678
679 #
680 # File name extension for static archive files, for those few places
681 # where they are treated differently from dynamic ones.
682 #
683 SA=a
684
685 AC_SUBST(O)
686 AC_SUBST(A)
687 AC_SUBST(SA)
688 AC_SUBST(LIBTOOL_MKDEP_SED)
689 AC_SUBST(LIBTOOL_MODE_COMPILE)
690 AC_SUBST(LIBTOOL_MODE_INSTALL)
691 AC_SUBST(LIBTOOL_MODE_LINK)
692
693 #
694 # Here begins a very long section to determine the system's networking
695 # capabilities.  The order of the tests is signficant.
696 #
697
698 #
699 # IPv6
700 #
701 AC_ARG_ENABLE(ipv6,
702         [  --enable-ipv6                use IPv6 [default=autodetect]])
703
704 case "$enable_ipv6" in
705         yes|''|autodetect)
706                 AC_DEFINE(WANT_IPV6)
707                 ;;
708         no)
709                 ;;
710 esac
711
712 #
713 # We do the IPv6 compilation checking after libtool so that we can put
714 # the right suffix on the files.
715 #
716 AC_MSG_CHECKING(for IPv6 structures)
717 AC_TRY_COMPILE([
718 #include <sys/types.h>
719 #include <sys/socket.h>
720 #include <netinet/in.h>],
721 [struct sockaddr_in6 sin6; return (0);],
722         [AC_MSG_RESULT(yes)
723          found_ipv6=yes],
724         [AC_MSG_RESULT(no)
725          found_ipv6=no])
726
727 #
728 # See whether IPv6 support is provided via a Kame add-on.
729 # This is done before other IPv6 linking tests to LIBS is properly set.
730 #
731 AC_MSG_CHECKING(for Kame IPv6 support)
732 AC_ARG_WITH(kame,
733         [  --with-kame[=PATH]   use Kame IPv6 [default path /usr/local/v6]],
734         use_kame="$withval", use_kame="no")
735
736 case "$use_kame" in
737         no)
738                 ;;
739         yes)
740                 kame_path=/usr/local/v6
741                 ;;
742         *)
743                 kame_path="$use_kame"
744                 ;;
745 esac
746
747 case "$use_kame" in
748         no)
749                 AC_MSG_RESULT(no)
750                 ;;
751         *)
752                 if test -f $kame_path/lib/libinet6.a; then
753                         AC_MSG_RESULT($kame_path/lib/libinet6.a)
754                         LIBS="-L$kame_path/lib -linet6 $LIBS"
755                 else
756                         AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
757
758 Please choose the proper path with the following command:
759
760     configure --with-kame=PATH
761 ])
762                 fi
763                 ;;
764 esac
765
766 #
767 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
768 # Including it on Kame-using platforms is very bad, though, because
769 # Kame uses #error against direct inclusion.   So include it on only
770 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
771 # This is done before the in6_pktinfo check because that's what
772 # netinet6/in6.h is needed for.
773 #
774 changequote({, })
775 case "$host" in
776 *-bsdi4.[01]*)
777         ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
778         isc_netinet6in6_hack="#include <netinet6/in6.h>"
779         ;;
780 *)
781         ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
782         isc_netinet6in6_hack=""
783         ;;
784 esac
785 changequote([, ])
786
787 #
788 # This is similar to the netinet6/in6.h issue.
789 #
790 case "$host" in
791 *-UnixWare*)
792         ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
793         ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
794         isc_netinetin6_hack="#include <netinet/in6.h>"
795         ;;
796 *)
797         ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
798         ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
799         isc_netinetin6_hack=""
800         ;;
801 esac
802
803 #
804 # Now delve deeper into the suitability of the IPv6 support.
805 #
806 case "$found_ipv6" in
807         yes)
808                 HAS_INET6_STRUCTS="#define HAS_INET6_STRUCTS 1"
809
810                 AC_MSG_CHECKING(for in6_addr)
811                 AC_TRY_COMPILE([
812 #include <sys/types.h>
813 #include <sys/socket.h>
814 #include <netinet/in.h>
815 $isc_netinetin6_hack
816 $isc_netinet6in6_hack
817 ],
818 [struct in6_addr in6; return (0);],
819                 [AC_MSG_RESULT(yes)
820                  HAS_IN_ADDR6="#undef HAS_IN_ADDR6"
821                  isc_in_addr6_hack=""],
822                 [AC_MSG_RESULT(no)
823                  HAS_IN_ADDR6="#define HAS_IN_ADDR6 1"
824                  isc_in_addr6_hack="#define in6_addr in_addr6"])
825
826                 AC_MSG_CHECKING(for in6addr_any)
827                 AC_TRY_LINK([
828 #include <sys/types.h>
829 #include <sys/socket.h>
830 #include <netinet/in.h>
831 $isc_netinetin6_hack
832 $isc_netinet6in6_hack
833 $isc_in_addr6_hack
834 ],
835                 [struct in6_addr in6; in6 = in6addr_any; return (0);],
836                         [AC_MSG_RESULT(yes)
837                          NEED_IN6ADDR_ANY="#undef NEED_IN6ADDR_ANY"],
838                         [AC_MSG_RESULT(no)
839                          NEED_IN6ADDR_ANY="#define NEED_IN6ADDR_ANY 1"])
840
841                 AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
842                 AC_TRY_COMPILE([
843 #include <sys/types.h>
844 #include <sys/socket.h>
845 #include <netinet/in.h>
846 $isc_netinetin6_hack
847 $isc_netinet6in6_hack
848 ],
849                 [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
850                         [AC_MSG_RESULT(yes)
851                          result="#define HAVE_SIN6_SCOPE_ID 1"],
852                         [AC_MSG_RESULT(no)
853                          result="#undef HAVE_SIN6_SCOPE_ID"])
854                 HAVE_SIN6_SCOPE_ID="$result"
855
856                 AC_MSG_CHECKING(for in6_pktinfo)
857                 AC_TRY_COMPILE([
858 #include <sys/types.h>
859 #include <sys/socket.h>
860 #include <netinet/in.h>
861 $isc_netinetin6_hack
862 $isc_netinet6in6_hack
863 ],
864                 [struct in6_pktinfo xyzzy; return (0);],
865                         [AC_MSG_RESULT(yes)
866                          ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
867                         [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
868                          ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
869
870                 AC_MSG_CHECKING(for sockaddr_storage)
871                 AC_TRY_COMPILE([
872 #include <sys/types.h>
873 #include <sys/socket.h>
874 #include <netinet/in.h>
875 $isc_netinetin6_hack
876 $isc_netinet6in6_hack
877 ],
878                 [struct sockaddr_storage xyzzy; return (0);],
879                         [AC_MSG_RESULT(yes)
880                          HAVE_SOCKADDR_STORAGE="#define HAVE_SOCKADDR_STORAGE 1"],
881                         [AC_MSG_RESULT(no)
882                          HAVE_SOCKADDR_STORAGE="#undef HAVE_SOCKADDR_STORAGE"])
883                 ;;
884         no)
885                 HAS_INET6_STRUCTS="#undef HAS_INET6_STRUCTS"
886                 NEED_IN6ADDR_ANY="#undef NEED_IN6ADDR_ANY"
887                 ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
888                 HAVE_SIN6_SCOPE_ID="#define HAVE_SIN6_SCOPE_ID 1"
889                 HAVE_SOCKADDR_STORAGE="#undef HAVE_SOCKADDR_STORAGE"
890                 ISC_IPV6_H="ipv6.h"
891                 ISC_IPV6_O="ipv6.$O"
892                 ISC_ISCIPV6_O="unix/ipv6.$O"
893                 ISC_IPV6_C="ipv6.c"
894                 ;;
895 esac
896
897 AC_SUBST(HAS_INET6_STRUCTS)
898 AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
899 AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
900 AC_SUBST(HAS_IN_ADDR6)
901 AC_SUBST(NEED_IN6ADDR_ANY)
902 AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
903 AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
904 AC_SUBST(ISC_IPV6_H)
905 AC_SUBST(ISC_IPV6_O)
906 AC_SUBST(ISC_ISCIPV6_O)
907 AC_SUBST(ISC_IPV6_C)
908 AC_SUBST(HAVE_SIN6_SCOPE_ID)
909 AC_SUBST(HAVE_SOCKADDR_STORAGE)
910
911 #
912 # Check for network functions that are often missing.  We do this
913 # after the libtool checking, so we can put the right suffix on
914 # the files.  It also needs to come after checking for a Kame add-on,
915 # which provides some (all?) of the desired functions.
916 #
917 AC_MSG_CHECKING([for inet_ntop])
918 AC_TRY_LINK([
919 #include <sys/types.h>
920 #include <netinet/in.h>
921 #include <arpa/inet.h>],
922         [inet_ntop(0, 0, 0, 0); return (0);],
923         [AC_MSG_RESULT(yes)
924         ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
925
926         [AC_MSG_RESULT(no)
927         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
928         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
929         ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"])
930 AC_MSG_CHECKING([for inet_pton])
931 AC_TRY_LINK([
932 #include <sys/types.h>
933 #include <netinet/in.h>
934 #include <arpa/inet.h>],
935         [inet_pton(0, 0, 0); return (0);],
936         [AC_MSG_RESULT(yes)
937         ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
938
939         [AC_MSG_RESULT(no)
940         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
941         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
942         ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"])
943 AC_MSG_CHECKING([for inet_aton])
944 AC_TRY_LINK([
945 #include <sys/types.h>
946 #include <netinet/in.h>
947 #include <arpa/inet.h>],
948         [struct in_addr in; inet_aton(0, &in); return (0);],
949         [AC_MSG_RESULT(yes)
950         ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
951
952         [AC_MSG_RESULT(no)
953         ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
954         ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
955         ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"])
956
957 AC_SUBST(ISC_PLATFORM_NEEDNTOP)
958 AC_SUBST(ISC_PLATFORM_NEEDPTON)
959 AC_SUBST(ISC_PLATFORM_NEEDATON)
960
961 #
962 # Look for a 4.4BSD-style sa_len member in struct sockaddr.
963 #
964 case "$host" in
965         *-dec-osf*)
966                 # Turn on 4.4BSD style sa_len support.
967                 AC_DEFINE(_SOCKADDR_LEN)
968                 ;;
969 esac
970
971 AC_MSG_CHECKING(for sa_len in struct sockaddr)
972 AC_TRY_COMPILE([
973 #include <sys/types.h>
974 #include <sys/socket.h>],
975 [struct sockaddr sa; sa.sa_len = 0; return (0);],
976         [AC_MSG_RESULT(yes)
977         HAVE_SA_LEN="#define HAVE_SA_LEN 1"],
978         [AC_MSG_RESULT(no)
979         HAVE_SA_LEN="#undef HAVE_SA_LEN"])
980 AC_SUBST(HAVE_SA_LEN)
981
982 # HAVE_MINIMUM_IFREQ
983
984 case "$host" in
985         *-bsdi[2345]*)  have_minimum_ifreq=yes;;
986         *-darwin*)      have_minimum_ifreq=yes;;
987         *-freebsd*)     have_minimum_ifreq=yes;;
988         *-lynxos*)      have_minimum_ifreq=yes;;
989         *-netbsd*)      have_minimum_ifreq=yes;;
990         *-next*)        have_minimum_ifreq=yes;;
991         *-openbsd*)     have_minimum_ifreq=yes;;
992         *-rhapsody*)    have_minimum_ifreq=yes;;
993 esac
994
995 case "$have_minimum_ifreq" in
996         yes)
997                 HAVE_MINIMUM_IFREQ="#define HAVE_MINIMUM_IFREQ 1";;
998         no)
999                 HAVE_MINIMUM_IFREQ="#undef HAVE_MINIMUM_IFREQ";;
1000         *)
1001                 HAVE_MINIMUM_IFREQ="#undef HAVE_MINIMUM_IFREQ";;
1002 esac
1003 AC_SUBST(HAVE_MINIMUM_IFREQ)
1004
1005 # PORT_DIR
1006 PORT_DIR=port/unknown
1007 SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES"
1008 BSD_COMP="#undef BSD_COMP"
1009 USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL"
1010 PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK"
1011 HAVE_MD5="#undef HAVE_MD5"
1012 USE_POLL="#undef HAVE_POLL"
1013 SOLARIS2="#undef SOLARIS2"
1014 case "$host" in
1015         *aix3.2*)       PORT_DIR="port/aix32";;
1016         *aix4*)         PORT_DIR="port/aix4";;
1017         *aix5*)         PORT_DIR="port/aix5";;
1018         *aux3*)         PORT_DIR="port/aux3";;
1019         *-bsdi2*)       PORT_DIR="port/bsdos2";;
1020         *-bsdi*)        PORT_DIR="port/bsdos";;
1021         *-cygwin*)
1022                         PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY"
1023                         PORT_DIR="port/cygwin";;
1024         *-darwin*)      PORT_DIR="port/darwin";;
1025         *-osf*)         PORT_DIR="port/decunix";;
1026         *-freebsd*)     PORT_DIR="port/freebsd";;
1027         *-hpux9*)       PORT_DIR="port/hpux9";;
1028         *-hpux10*)      PORT_DIR="port/hpux10";;
1029         *-hpux11*)      PORT_DIR="port/hpux";;
1030         *-irix*)        PORT_DIR="port/irix";;
1031         *-linux*)       PORT_DIR="port/linux";;
1032         *-lynxos*)      PORT_DIR="port/lynxos";;
1033         *-mpe*)         PORT_DIR="port/mpe";;
1034         *-netbsd*)      PORT_DIR="port/netbsd";;
1035         *-next*)        PORT_DIR="port/next";;
1036         *-openbsd*)     PORT_DIR="port/openbsd";;
1037         *-qnx*)         PORT_DIR="port/qnx";;
1038         *-rhapsody*)    PORT_DIR="port/rhapsody";;
1039         *-sunos4*)
1040                         PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY"
1041                         PORT_DIR="port/sunos";;
1042         *-solaris2.[[01234]])
1043                         BSD_COMP="#define BSD_COMP 1"
1044                         SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
1045                         USE_FIONBIO_IOCTL="#define USE_FIONBIO_IOCTL 1"
1046                         SOLARIS2="#define SOLARIS2 1"
1047                         PORT_DIR="port/solaris";;
1048         *-solaris2.5)
1049                         BSD_COMP="#define BSD_COMP 1"
1050                         SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
1051                         SOLARIS2="#define SOLARIS2 1"
1052                         PORT_DIR="port/solaris";;
1053         *-solaris2.[[67]])
1054                         BSD_COMP="#define BSD_COMP 1"
1055                         SOLARIS2="#define SOLARIS2 1"
1056                         PORT_DIR="port/solaris";;
1057         *-solaris2*)    BSD_COMP="#define BSD_COMP 1"
1058                         USE_POLL="#define USE_POLL 1"
1059                         HAVE_MD5="#define HAVE_MD5 1"
1060                         SOLARIS2="#define SOLARIS2 1"
1061                         PORT_DIR="port/solaris";;
1062         *-ultrix*)      PORT_DIR="port/ultrix";;
1063         *-sco-sysv*uw2.0*)      PORT_DIR="port/unixware20";;
1064         *-sco-sysv*uw2.1.2*)    PORT_DIR="port/unixware212";;
1065         *-sco-sysv*uw7*)        PORT_DIR="port/unixware7";;
1066 esac
1067
1068 AC_SUBST(BSD_COMP)
1069 AC_SUBST(SOLARIS_BITTYPES)
1070 AC_SUBST(USE_FIONBIO_IOCTL)
1071 AC_SUBST(PORT_NONBLOCK)
1072 AC_SUBST(PORT_DIR)
1073 AC_SUBST(USE_POLL)
1074 AC_SUBST(HAVE_MD5)
1075 AC_SUBST(SOLARIS2)
1076 PORT_INCLUDE=${PORT_DIR}/include
1077 AC_SUBST(PORT_INCLUDE)
1078
1079 #
1080 # Look for a 4.4BSD or 4.3BSD struct msghdr
1081 #
1082 AC_MSG_CHECKING(for struct msghdr flavor)
1083 AC_TRY_COMPILE([
1084 #include <sys/types.h>
1085 #include <sys/socket.h>],
1086 [struct msghdr msg; msg.msg_flags = 0; return (0);],
1087         [AC_MSG_RESULT(4.4BSD)
1088         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
1089         [AC_MSG_RESULT(4.3BSD)
1090         ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
1091 AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
1092
1093 #
1094 # Look for in_port_t.
1095 #
1096 AC_MSG_CHECKING(for type in_port_t)
1097 AC_TRY_COMPILE([
1098 #include <sys/types.h>
1099 #include <netinet/in.h>],
1100 [in_port_t port = 25; return (0);],
1101         [AC_MSG_RESULT(yes)
1102         ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
1103         [AC_MSG_RESULT(no)
1104         ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
1105 AC_SUBST(ISC_PLATFORM_NEEDPORTT)
1106
1107 #
1108 # Check for addrinfo
1109 #
1110 AC_MSG_CHECKING(for struct addrinfo)
1111 AC_TRY_COMPILE([
1112 #include <netdb.h>],
1113 [struct addrinfo a; return (0);],
1114         [AC_MSG_RESULT(yes)
1115         AC_DEFINE(HAVE_ADDRINFO)],
1116         [AC_MSG_RESULT(no)])
1117
1118 AC_MSG_CHECKING(for int sethostent)
1119 AC_TRY_COMPILE([
1120 #include <netdb.h>],
1121 [int i = sethostent(0); return(0);],
1122         [AC_MSG_RESULT(yes)],
1123         [AC_MSG_RESULT(no)])
1124
1125 AC_MSG_CHECKING(for int endhostent)
1126 AC_TRY_COMPILE([
1127 #include <netdb.h>],
1128 [int i = endhostent(); return(0);],
1129         [AC_MSG_RESULT(yes)
1130         ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
1131         [AC_MSG_RESULT(no)
1132         ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
1133 AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
1134
1135 AC_MSG_CHECKING(for int setnetent)
1136 AC_TRY_COMPILE([
1137 #include <netdb.h>],
1138 [int i = setnetent(0); return(0);],
1139         [AC_MSG_RESULT(yes)
1140         ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
1141         [AC_MSG_RESULT(no)
1142         ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
1143 AC_SUBST(ISC_LWRES_SETNETENTINT)
1144
1145 AC_MSG_CHECKING(for int endnetent)
1146 AC_TRY_COMPILE([
1147 #include <netdb.h>],
1148 [int i = endnetent(); return(0);],
1149         [AC_MSG_RESULT(yes)
1150         ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
1151         [AC_MSG_RESULT(no)
1152         ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
1153 AC_SUBST(ISC_LWRES_ENDNETENTINT)
1154
1155 AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
1156 AC_TRY_COMPILE([
1157 #include <netdb.h>
1158 struct hostent *gethostbyaddr(const void *, size_t, int);],
1159 [return(0);],
1160         [AC_MSG_RESULT(yes)
1161         ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
1162         [AC_MSG_RESULT(no)
1163         ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
1164 AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
1165
1166 AC_MSG_CHECKING(for h_errno in netdb.h)
1167 AC_TRY_COMPILE([
1168 #include <netdb.h>],
1169 [h_errno = 1; return(0);],
1170         [AC_MSG_RESULT(yes)
1171         ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
1172         [AC_MSG_RESULT(no)
1173         ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
1174 AC_SUBST(ISC_LWRES_NEEDHERRNO)
1175
1176 AC_CHECK_FUNC(getipnodebyname,
1177         [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
1178         [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
1179 AC_CHECK_FUNC(getnameinfo,
1180         [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
1181         [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
1182 AC_CHECK_FUNC(getaddrinfo,
1183         [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
1184         AC_DEFINE(HAVE_GETADDRINFO)],
1185         [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
1186 AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
1187 AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
1188 AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
1189 AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
1190 AC_CHECK_FUNC(pselect,
1191               [NEED_PSELECT="#undef NEED_PSELECT"],
1192               [NEED_PSELECT="#define NEED_PSELECT"])
1193 AC_SUBST(NEED_PSELECT)
1194 AC_CHECK_FUNC(gettimeofday,
1195               [NEED_GETTIMEOFDAY="#undef NEED_GETTIMEOFDAY"],
1196               [NEED_GETTIMEOFDAY="#define NEED_GETTIMEOFDAY 1"])
1197 AC_SUBST(NEED_GETTIMEOFDAY)
1198 AC_CHECK_FUNC(strndup,
1199               [HAVE_STRNDUP="#define HAVE_STRNDUP 1"],
1200               [HAVE_STRNDUP="#undef HAVE_STRNDUP"])
1201 AC_SUBST(HAVE_STRNDUP)
1202
1203 #
1204 # Look for a sysctl call to get the list of network interfaces.
1205 #
1206 AC_MSG_CHECKING(for interface list sysctl)
1207 AC_EGREP_CPP(found_rt_iflist, [
1208 #include <sys/param.h>
1209 #include <sys/sysctl.h>
1210 #include <sys/socket.h>
1211 #ifdef NET_RT_IFLIST
1212 found_rt_iflist
1213 #endif
1214 ],
1215         [AC_MSG_RESULT(yes)
1216          AC_DEFINE(HAVE_IFLIST_SYSCTL)],
1217         [AC_MSG_RESULT(no)])
1218
1219 #
1220 # Check for some other useful functions that are not ever-present.
1221 #
1222 AC_CHECK_FUNC(strsep,
1223         [ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
1224         [ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
1225 AC_CHECK_FUNC(vsnprintf,
1226         [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
1227         [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
1228          ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS print.c"
1229          ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
1230 AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
1231 AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
1232
1233 AC_SUBST(ISC_EXTRA_OBJS)
1234 AC_SUBST(ISC_EXTRA_SRCS)
1235 AC_CHECK_FUNC(strerror,
1236         [USE_SYSERROR_LIST="#undef USE_SYSERROR_LIST"],
1237         [USE_SYSERROR_LIST="#define USE_SYSERROR_LIST 1"])
1238 AC_SUBST(USE_SYSERROR_LIST)
1239
1240 #
1241 # Determine the printf format characters to use when printing
1242 # values of type isc_int64_t.  We make the assumption that platforms
1243 # where a "long long" is the same size as a "long" (e.g., Alpha/OSF1)
1244 # want "%ld" and everyone else can use "%lld".  Win32 uses "%I64d",
1245 # but that's defined elsewhere since we don't use configure on Win32.
1246 #
1247 AC_MSG_CHECKING(printf format modifier for 64-bit integers)
1248 AC_TRY_RUN([main() { exit(!(sizeof(long long int) == sizeof(long int))); }],
1249         [AC_MSG_RESULT(l)
1250         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'],
1251         [AC_MSG_RESULT(ll)
1252         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'],
1253         [AC_MSG_RESULT(default ll)
1254         ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'])
1255 AC_SUBST(ISC_PLATFORM_QUADFORMAT)
1256
1257 #
1258 # Security Stuff
1259 #
1260 AC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
1261
1262 #
1263 # for accept, recvfrom, getpeername etc.
1264 #
1265 AC_MSG_CHECKING(for socket length type)
1266 AC_TRY_COMPILE([
1267 #include <sys/types.h>
1268 #include <sys/socket.h>
1269 int accept(int, struct sockaddr *, socklen_t *);
1270 ],[],
1271 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T socklen_t"
1272 AC_MSG_RESULT(socklen_t)]
1273 ,
1274 AC_TRY_COMPILE([
1275 #include <sys/types.h>
1276 #include <sys/socket.h>
1277 int accept(int, struct sockaddr *, unsigned int *);
1278 ],[],
1279 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T unsigned int"
1280 AC_MSG_RESULT(unsigned int)]
1281 ,
1282 AC_TRY_COMPILE([
1283 #include <sys/types.h>
1284 #include <sys/socket.h>
1285 int accept(int, struct sockaddr *, unsigned long *);
1286 ],[],
1287 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T unsigned long"
1288 AC_MSG_RESULT(unsigned long)]
1289 ,
1290 AC_TRY_COMPILE([
1291 #include <sys/types.h>
1292 #include <sys/socket.h>
1293 int accept(int, struct sockaddr *, long *);
1294 ],[],
1295 [ISC_SOCKLEN_T="#define ISC_SOCKLEN_T long"
1296 AC_MSG_RESULT(long)]
1297 ,
1298 ISC_SOCKLEN_T="#define ISC_SOCKLEN_T int"
1299 AC_MSG_RESULT(int)
1300 ))))
1301 AC_SUBST(ISC_SOCKLEN_T)
1302
1303 AC_CHECK_FUNC(getgrouplist,
1304 AC_TRY_COMPILE(
1305 [#include <unistd.h>
1306 int
1307 getgrouplist(const char *name, int basegid, int *groups, int *ngroups) {
1308 }
1309 ],
1310 [return (0);],
1311 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, int basegid, int *groups, int *ngroups"
1312 ,
1313 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups"
1314 ),
1315 GETGROUPLIST_ARGS="#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups"
1316 AC_DEFINE(NEED_GETGROUPLIST)
1317 )
1318 AC_SUBST(GETGROUPLIST_ARGS)
1319
1320 AC_CHECK_FUNC(setgroupent,,AC_DEFINE(NEED_SETGROUPENT))
1321
1322 case $host in
1323 ia64-hp-hpux11.*)
1324 ;;
1325 *)
1326 AC_CHECK_FUNC(getnetbyaddr_r,
1327 AC_TRY_COMPILE(
1328 [
1329 #undef _REENTRANT
1330 #define _REENTRANT
1331 #define _OSF_SOURCE
1332 #undef __USE_MISC
1333 #define __USE_MISC
1334 #include <netdb.h>
1335 struct netent *
1336 getnetbyaddr_r(long net, int type, struct netent *result, char *buffer,
1337 int buflen) {}
1338 ],
1339 [return (0)],
1340 [
1341 NET_R_ARGS="#define NET_R_ARGS char *buf, int buflen"
1342 NET_R_BAD="#define NET_R_BAD NULL"
1343 NET_R_COPY="#define NET_R_COPY buf, buflen"
1344 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS NET_R_ARGS"
1345 NET_R_OK="#define NET_R_OK nptr"
1346 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1347 NET_R_RETURN="#define NET_R_RETURN struct netent *"
1348 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1349 NETENT_DATA="#undef NETENT_DATA"
1350 ],
1351 AC_TRY_COMPILE(
1352 [
1353 #undef _REENTRANT
1354 #define _REENTRANT
1355 #define _OSF_SOURCE
1356 #undef __USE_MISC
1357 #define __USE_MISC
1358 #include <netdb.h>
1359 int getnetbyaddr_r (unsigned long int, int, struct netent *,
1360                     char *, size_t, struct netent **, int *);
1361 ],
1362 [return (0)],
1363 [
1364 NET_R_ARGS="#define NET_R_ARGS char *buf, size_t buflen, struct netent **answerp, int *h_errnop"
1365 NET_R_BAD="#define NET_R_BAD ERANGE"
1366 NET_R_COPY="#define NET_R_COPY buf, buflen"
1367 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS char *buf, size_t buflen"
1368 NET_R_OK="#define NET_R_OK 0"
1369 NET_R_SETANSWER="#define NET_R_SETANSWER 1"
1370 NET_R_RETURN="#define NET_R_RETURN int"
1371 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T unsigned long int"
1372 NETENT_DATA="#undef NETENT_DATA"
1373 ],
1374 AC_TRY_COMPILE(
1375 [
1376 #undef _REENTRANT
1377 #define _REENTRANT
1378 #define _OSF_SOURCE
1379 #undef __USE_MISC
1380 #define __USE_MISC
1381 #include <netdb.h>
1382 extern int getnetbyaddr_r(int, int, struct netent *, struct netent_data *);
1383 ],
1384 [return (0)],
1385 [
1386 NET_R_ARGS="#define NET_R_ARGS struct netent_data *ndptr"
1387 NET_R_BAD="#define NET_R_BAD (-1)"
1388 NET_R_COPY="#define NET_R_COPY ndptr"
1389 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS struct netent_data *ndptr"
1390 NET_R_OK="#define NET_R_OK 0"
1391 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1392 NET_R_RETURN="#define NET_R_RETURN int"
1393 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T int"
1394 NETENT_DATA="#define NETENT_DATA 1"
1395 ],
1396 AC_TRY_COMPILE(
1397 #undef __USE_MISC
1398 #define __USE_MISC
1399 [#include <netdb.h>
1400 int getnetbyaddr_r (long, int, struct netent *, struct netent_data *);
1401 ],
1402 [return (0)],
1403 [
1404 NET_R_ARGS="#define NET_R_ARGS struct netent_data *ndptr"
1405 NET_R_BAD="#define NET_R_BAD (-1)"
1406 NET_R_COPY="#define NET_R_COPY ndptr"
1407 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS struct netent_data *ndptr"
1408 NET_R_OK="#define NET_R_OK 0"
1409 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1410 NET_R_RETURN="#define NET_R_RETURN int"
1411 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1412 NETENT_DATA="#define NETENT_DATA 1"
1413 ],
1414 AC_TRY_COMPILE(
1415 #undef __USE_MISC
1416 #define __USE_MISC
1417 [#include <netdb.h>
1418 int getnetbyaddr_r (uint32_t, int, struct netent *,
1419                     char *, size_t, struct netent **, int *);
1420 ],
1421 [return (0)],
1422 [
1423 NET_R_ARGS="#define NET_R_ARGS char *buf, size_t buflen, struct netent **answerp, int *h_errnop"
1424 NET_R_BAD="#define NET_R_BAD ERANGE"
1425 NET_R_COPY="#define NET_R_COPY buf, buflen"
1426 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS char *buf, size_t buflen"
1427 NET_R_OK="#define NET_R_OK 0"
1428 NET_R_SETANSWER="#define NET_R_SETANSWER 1"
1429 NET_R_RETURN="#define NET_R_RETURN int"
1430 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T unsigned long int"
1431 NETENT_DATA="#undef NETENT_DATA"
1432 ],
1433 )
1434 )
1435 )
1436 )
1437 )
1438 ,
1439 NET_R_ARGS="#define NET_R_ARGS char *buf, int buflen"
1440 NET_R_BAD="#define NET_R_BAD NULL"
1441 NET_R_COPY="#define NET_R_COPY buf, buflen"
1442 NET_R_COPY_ARGS="#define NET_R_COPY_ARGS NET_R_ARGS"
1443 NET_R_OK="#define NET_R_OK nptr"
1444 NET_R_SETANSWER="#undef NET_R_SETANSWER"
1445 NET_R_RETURN="#define NET_R_RETURN struct netent *"
1446 GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T long"
1447 NETENT_DATA="#undef NETENT_DATA"
1448 )
1449 esac
1450
1451 case "$host" in
1452 *dec-osf*) GETNETBYADDR_ADDR_T="#define GETNETBYADDR_ADDR_T int" ;;
1453 esac
1454 AC_SUBST(NET_R_ARGS)
1455 AC_SUBST(NET_R_BAD)
1456 AC_SUBST(NET_R_COPY)
1457 AC_SUBST(NET_R_COPY_ARGS)
1458 AC_SUBST(NET_R_OK)
1459 AC_SUBST(NET_R_SETANSWER)
1460 AC_SUBST(NET_R_RETURN)
1461 AC_SUBST(GETNETBYADDR_ADDR_T)
1462 AC_SUBST(NETENT_DATA)
1463
1464 AC_CHECK_FUNC(setnetent_r,
1465 AC_TRY_COMPILE(
1466 [
1467 #undef __USE_MISC
1468 #define __USE_MISC
1469 #include <netdb.h>
1470 void  setnetent_r (int);
1471 ] ,[return (0);],[
1472 NET_R_ENT_ARGS="#undef NET_R_ENT_ARGS /*empty*/"
1473 NET_R_SET_RESULT="#undef NET_R_SET_RESULT /*empty*/"
1474 NET_R_SET_RETURN="#define NET_R_SET_RETURN void"
1475 ],
1476 AC_TRY_COMPILE(
1477 [
1478 #define _REENTRANT
1479 #undef __USE_MISC
1480 #define __USE_MISC
1481 #include <netdb.h>
1482 extern int setnetent_r(int, struct netent_data *);
1483 ] ,[return (0);],[
1484 NET_R_ENT_ARGS="#define NET_R_ENT_ARGS struct netent_data *ndptr"
1485 NET_R_SET_RESULT="#define NET_R_SET_RESULT NET_R_OK"
1486 NET_R_SET_RETURN="#define NET_R_SET_RETURN int"
1487 ],
1488 )
1489 )
1490 ,
1491 NET_R_ENT_ARGS="#undef NET_R_ENT_ARGS /*empty*/"
1492 NET_R_SET_RESULT="#undef NET_R_SET_RESULT /*empty*/"
1493 NET_R_SET_RETURN="#define NET_R_SET_RETURN void"
1494 )
1495 AC_SUBST(NET_R_ENT_ARGS)
1496 AC_SUBST(NET_R_SET_RESULT)
1497 AC_SUBST(NET_R_SET_RETURN)
1498
1499
1500 case $host in
1501 ia64-hp-hpux11.*)
1502 ;;
1503 *)
1504 AC_CHECK_FUNC(endnetent_r,
1505 AC_TRY_COMPILE(
1506 [
1507 #undef _REENTRANT
1508 #define _REENTRANT
1509 #undef __USE_MISC
1510 #define __USE_MISC
1511 #include <netdb.h>
1512 void  endnetent_r (void);
1513 ] ,[return (0);],[
1514 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1515 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1516 ],
1517 AC_TRY_COMPILE(
1518 [
1519 #undef _REENTRANT
1520 #define _REENTRANT
1521 #undef __USE_MISC
1522 #define __USE_MISC
1523 #include <netdb.h>
1524 extern int endnetent_r(struct netent_data *);
1525 ] ,[return (0);],[
1526 NET_R_END_RESULT="#define NET_R_END_RESULT(x) return (x)"
1527 NET_R_END_RETURN="#define NET_R_END_RETURN int"
1528 ],
1529 AC_TRY_COMPILE(
1530 [
1531 #undef _REENTRANT
1532 #define _REENTRANT
1533 #undef __USE_MISC
1534 #define __USE_MISC
1535 #include <netdb.h>
1536 extern void endnetent_r(struct netent_data *);
1537 ] ,[return (0);],[
1538 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1539 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1540 ],
1541 )
1542 )
1543 )
1544 ,
1545 NET_R_END_RESULT="#define NET_R_END_RESULT(x) /*empty*/"
1546 NET_R_END_RETURN="#define NET_R_END_RETURN void"
1547 )
1548 esac
1549 AC_SUBST(NET_R_END_RESULT)
1550 AC_SUBST(NET_R_END_RETURN)
1551
1552 AC_CHECK_FUNC(getgrnam_r,,AC_DEFINE(NEED_GETGRNAM_R))
1553 AC_CHECK_FUNC(getgrgid_r,,AC_DEFINE(NEED_GETGRGID_R))
1554
1555 AC_CHECK_FUNC(getgrent_r,
1556 AC_TRY_COMPILE(
1557 [
1558 #include <grp.h>
1559 struct group *getgrent_r(struct group *grp, char *buffer,
1560            int buflen) {}
1561 ] ,[return (0);],[
1562 GROUP_R_ARGS="#define GROUP_R_ARGS char *buf, int buflen"
1563 GROUP_R_BAD="#define GROUP_R_BAD NULL"
1564 GROUP_R_OK="#define GROUP_R_OK gptr"
1565 GROUP_R_RETURN="#define GROUP_R_RETURN struct group *"
1566 ],
1567 )
1568 ,
1569 GROUP_R_ARGS="#define GROUP_R_ARGS char *buf, int buflen"
1570 GROUP_R_BAD="#define GROUP_R_BAD NULL"
1571 GROUP_R_OK="#define GROUP_R_OK gptr"
1572 GROUP_R_RETURN="#define GROUP_R_RETURN struct group *"
1573 AC_DEFINE(NEED_GETGRENT_R)
1574 )
1575 AC_SUBST(GROUP_R_ARGS)
1576 AC_SUBST(GROUP_R_BAD)
1577 AC_SUBST(GROUP_R_OK)
1578 AC_SUBST(GROUP_R_RETURN)
1579
1580 AC_CHECK_FUNC(endgrent_r,
1581 ,
1582 GROUP_R_END_RESULT="#define GROUP_R_END_RESULT(x) /*empty*/"
1583 GROUP_R_END_RETURN="#define GROUP_R_END_RETURN void"
1584 GROUP_R_ENT_ARGS="#define GROUP_R_ENT_ARGS void"
1585 AC_DEFINE(NEED_ENDGRENT_R)
1586 )
1587 AC_SUBST(GROUP_R_END_RESULT)
1588 AC_SUBST(GROUP_R_END_RETURN)
1589 AC_SUBST(GROUP_R_ENT_ARGS)
1590
1591 AC_CHECK_FUNC(setgrent_r,
1592 ,
1593 GROUP_R_SET_RESULT="#undef GROUP_R_SET_RESULT /*empty*/"
1594 GROUP_R_SET_RETURN="#define GROUP_R_SET_RETURN void"
1595 AC_DEFINE(NEED_SETGRENT_R)
1596 )
1597 AC_SUBST(GROUP_R_SET_RESULT)
1598 AC_SUBST(GROUP_R_SET_RETURN)
1599
1600
1601 case $host in
1602 ia64-hp-hpux11.*)
1603 ;;
1604 *)
1605 AC_CHECK_FUNC(gethostbyname_r,
1606 AC_TRY_COMPILE(
1607 [
1608 #undef __USE_MISC
1609 #define __USE_MISC
1610 #include <netdb.h>
1611 struct hostent  *gethostbyname_r
1612 (const char *name, struct hostent *hp, char *buf, int len, int *h_errnop) {}
1613 ],
1614 [return (0);],
1615 [
1616 HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, int *h_errnop"
1617 HOST_R_BAD="#define HOST_R_BAD NULL"
1618 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1619 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1620 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1621 HOST_R_OK="#define HOST_R_OK hptr"
1622 HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
1623 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1624 HOSTENT_DATA="#undef HOSTENT_DATA"
1625 ]
1626 ,
1627 AC_TRY_COMPILE([
1628 #undef __USE_MISC
1629 #define __USE_MISC
1630 #include <netdb.h>
1631 int gethostbyname_r(const char *name,
1632                           struct hostent *result,
1633                           struct hostent_data *hdptr);
1634 ],,[
1635 HOST_R_ARGS="#define HOST_R_ARGS struct hostent_data *hdptr"
1636 HOST_R_BAD="#define HOST_R_BAD (-1)"
1637 HOST_R_COPY="#define HOST_R_COPY hdptr"
1638 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS HOST_R_ARGS"
1639 HOST_R_ERRNO="#undef HOST_R_ERRNO"
1640 HOST_R_OK="#define HOST_R_OK 0"
1641 HOST_R_RETURN="#define HOST_R_RETURN int"
1642 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1643 HOSTENT_DATA="#define HOSTENT_DATA 1"
1644 ],
1645 AC_TRY_COMPILE([
1646 #undef __USE_MISC
1647 #define __USE_MISC
1648 #include <netdb.h>
1649 extern int gethostbyname_r (const char *,
1650                                  struct hostent *,
1651                                  char *, size_t,
1652                                  struct hostent **,
1653                                  int *);
1654 ],,[
1655 HOST_R_ARGS="#define HOST_R_ARGS char *buf, size_t buflen, struct hostent **answerp, int *h_errnop"
1656 HOST_R_BAD="#define HOST_R_BAD ERANGE"
1657 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1658 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1659 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1660 HOST_R_OK="#define HOST_R_OK 0"
1661 HOST_R_RETURN="#define HOST_R_RETURN int"
1662 HOST_R_SETANSWER="#define HOST_R_SETANSWER 1"
1663 HOSTENT_DATA="#undef HOSTENT_DATA"
1664 ],
1665 )))
1666 ,
1667 HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, int *h_errnop"
1668 HOST_R_BAD="#define HOST_R_BAD NULL"
1669 HOST_R_COPY="#define HOST_R_COPY buf, buflen"
1670 HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
1671 HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
1672 HOST_R_OK="#define HOST_R_OK hptr"
1673 HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
1674 HOST_R_SETANSWER="#undef HOST_R_SETANSWER"
1675 HOSTENT_DATA="#undef HOSTENT_DATA"
1676 )
1677 esac
1678 AC_SUBST(HOST_R_ARGS)
1679 AC_SUBST(HOST_R_BAD)
1680 AC_SUBST(HOST_R_COPY)
1681 AC_SUBST(HOST_R_COPY_ARGS)
1682 AC_SUBST(HOST_R_ERRNO)
1683 AC_SUBST(HOST_R_OK)
1684 AC_SUBST(HOST_R_RETURN)
1685 AC_SUBST(HOST_R_SETANSWER)
1686 AC_SUBST(HOSTENT_DATA)
1687
1688 case $host in
1689 ia64-hp-hpux11.*)
1690 ;;
1691 *)
1692 AC_CHECK_FUNC(endhostent_r,
1693 AC_TRY_COMPILE([
1694 #undef _REENTRANT
1695 #define _REENTRANT
1696 #undef __USE_MISC
1697 #define __USE_MISC
1698 #include <netdb.h>
1699 int endhostent_r(struct hostent_data *buffer);
1700 ], ,
1701 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) return (x)"
1702 HOST_R_END_RETURN="#define HOST_R_END_RETURN int"
1703 HOST_R_ENT_ARGS="#define HOST_R_ENT_ARGS struct hostent_data *hdptr"
1704 ,
1705 AC_TRY_COMPILE([
1706 #undef _REENTRANT
1707 #define _REENTRANT
1708 #undef __USE_MISC
1709 #define __USE_MISC
1710 #include <netdb.h>
1711 extern void endhostent_r(struct hostent_data *ht_data);
1712 ],[],[
1713 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x)"
1714 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1715 HOST_R_ENT_ARGS="#define HOST_R_ENT_ARGS struct hostent_data *hdptr"
1716 ],
1717 AC_TRY_COMPILE([
1718 #undef _REENTRANT
1719 #define _REENTRANT
1720 #undef __USE_MISC
1721 #define __USE_MISC
1722 #include <netdb.h>
1723 extern void endhostent_r(void);
1724 ],[],[
1725 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) /*empty*/"
1726 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1727 HOST_R_ENT_ARGS="#undef HOST_R_ENT_ARGS /*empty*/"
1728 ],
1729 )
1730 )
1731 )
1732 ,
1733 HOST_R_END_RESULT="#define HOST_R_END_RESULT(x) /*empty*/"
1734 HOST_R_END_RETURN="#define HOST_R_END_RETURN void"
1735 HOST_R_ENT_ARGS="#undef HOST_R_ENT_ARGS /*empty*/"
1736 )
1737 esac;
1738 AC_SUBST(HOST_R_END_RESULT)
1739 AC_SUBST(HOST_R_END_RETURN)
1740 AC_SUBST(HOST_R_ENT_ARGS)
1741
1742 case $host in
1743 ia64-hp-hpux11.*)
1744 ;;
1745 *)
1746 AC_CHECK_FUNC(sethostent_r,
1747 AC_TRY_COMPILE([
1748 #undef _REENTRANT
1749 #define _REENTRANT
1750 #undef __USE_MISC
1751 #define __USE_MISC
1752 #include <netdb.h>
1753 extern void sethostent_r(int flag, struct hostent_data *ht_data);],[],
1754 [HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT /*empty*/"
1755 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"],
1756 AC_TRY_COMPILE([
1757 #undef _REENTRANT
1758 #define _REENTRANT
1759 #undef __USE_MISC
1760 #define __USE_MISC
1761 #include <netdb.h>
1762 extern int sethostent_r(int flag, struct hostent_data *ht_data);],[],
1763 [HOST_R_SET_RESULT="#define HOST_R_SET_RESULT 0"
1764 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN int"],
1765 AC_TRY_COMPILE([
1766 #undef _REENTRANT
1767 #define _REENTRANT
1768 #undef __USE_MISC
1769 #define __USE_MISC
1770 #include <netdb.h>
1771 void            sethostent_r (int);],[],
1772 [HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT"
1773 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"],
1774 )
1775 )
1776 )
1777 ,
1778 HOST_R_SET_RESULT="#undef HOST_R_SET_RESULT"
1779 HOST_R_SET_RETURN="#define HOST_R_SET_RETURN void"
1780 )
1781 esac
1782 AC_SUBST(HOST_R_SET_RESULT)
1783 AC_SUBST(HOST_R_SET_RETURN)
1784
1785
1786 AC_MSG_CHECKING(struct passwd element pw_class)
1787 AC_TRY_COMPILE([
1788 #include <sys/types.h>
1789 #include <pwd.h>
1790 ],[struct passwd *pw; pw->pw_class = "";],
1791 AC_MSG_RESULT(yes)
1792 AC_DEFINE(HAS_PW_CLASS)
1793 ,
1794                 AC_MSG_RESULT(no)
1795 )
1796
1797 AC_TRY_COMPILE([
1798 #include <sys/types.h>
1799 #include <pwd.h>
1800 void
1801 setpwent(void) {}
1802 ],
1803 [return (0);],
1804 SETPWENT_VOID="#define SETPWENT_VOID 1"
1805 ,
1806 SETPWENT_VOID="#undef SETPWENT_VOID"
1807 )
1808 AC_SUBST(SETPWENT_VOID)
1809
1810 AC_TRY_COMPILE([
1811 #include <sys/types.h>
1812 #include <grp.h>
1813 void
1814 setgrent(void) {}
1815 ],
1816 [return (0);],
1817 SETGRENT_VOID="#define SETGRENT_VOID 1"
1818 ,
1819 SETGRENT_VOID="#undef SETGRENT_VOID"
1820 )
1821 AC_SUBST(SETGRENT_VOID)
1822
1823 case $host in
1824 ia64-hp-hpux11.*)
1825 ;;
1826 *)
1827 AC_CHECK_FUNC(getnetgrent_r,
1828 AC_TRY_COMPILE(
1829 [
1830 #undef __USE_MISC
1831 #define __USE_MISC
1832 #include <netdb.h>
1833 int getnetgrent_r(char **m, char **u, char **d, char *b, int l) {}
1834 ]
1835 ,
1836 [return (0);],
1837 [
1838 NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen"
1839 NGR_R_BAD="#define NGR_R_BAD (0)"
1840 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
1841 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1842 NGR_R_OK="#define NGR_R_OK 1"
1843 NGR_R_RETURN="#define NGR_R_RETURN int"
1844 ]
1845 ,
1846 AC_TRY_COMPILE(
1847 [
1848 #undef __USE_MISC
1849 #define __USE_MISC
1850 #include <netdb.h>
1851 int getnetgrent_r(char **m, char **u, char **d, char *b, size_t l) {}
1852 ]
1853 ,
1854 [return (0);],
1855 [
1856 NGR_R_ARGS="#define NGR_R_ARGS char *buf, size_t buflen"
1857 NGR_R_BAD="#define NGR_R_BAD (0)"
1858 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
1859 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1860 NGR_R_OK="#define NGR_R_OK 1"
1861 NGR_R_RETURN="#define NGR_R_RETURN int"
1862 ]
1863 ,
1864 AC_TRY_COMPILE(
1865 [
1866 #undef __USE_MISC
1867 #define __USE_MISC
1868 #include <netdb.h>
1869 extern int getnetgrent_r( char **, char **, char **, void **);
1870 ]
1871 ,
1872 [return (0);],
1873 [
1874 NGR_R_ARGS="#define NGR_R_ARGS void **buf"
1875 NGR_R_BAD="#define NGR_R_BAD (0)"
1876 NGR_R_COPY="#define NGR_R_COPY buf"
1877 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1878 NGR_R_OK="#define NGR_R_OK 1"
1879 NGR_R_RETURN="#define NGR_R_RETURN int"
1880 NGR_R_PRIVATE="#define NGR_R_PRIVATE 1"
1881 ]
1882 ,
1883 )
1884 )
1885 )
1886 ,
1887 NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen"
1888 NGR_R_BAD="#define NGR_R_BAD (0)"
1889 NGR_R_COPY="#define NGR_R_COPY buf, buflen"
1890 NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS"
1891 NGR_R_OK="#define NGR_R_OK 1"
1892 NGR_R_RETURN="#define NGR_R_RETURN int"
1893 )
1894 esac
1895 AC_SUBST(NGR_R_ARGS)
1896 AC_SUBST(NGR_R_BAD)
1897 AC_SUBST(NGR_R_COPY)
1898 AC_SUBST(NGR_R_COPY_ARGS)
1899 AC_SUBST(NGR_R_OK)
1900 AC_SUBST(NGR_R_RETURN)
1901 AC_SUBST(NGR_R_PRIVATE)
1902
1903 AC_CHECK_FUNC(endnetgrent_r,
1904 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  return (x)"
1905 NGR_R_END_RETURN="#define NGR_R_END_RETURN int"
1906 NGR_R_ENT_ARGS="#define NGR_R_ENT_ARGS NGR_R_ARGS"
1907 ,
1908 NGR_R_END_RESULT="#define NGR_R_END_RESULT(x)  /*empty*/"
1909 NGR_R_END_RETURN="#define NGR_R_END_RETURN void"
1910 NGR_R_ENT_ARGS="#undef NGR_R_ENT_ARGS /*empty*/"
1911 AC_DEFINE(NEED_ENDNETGRENT_R)
1912 )
1913 AC_SUBST(NGR_R_END_RESULT)
1914 AC_SUBST(NGR_R_END_RETURN)
1915 AC_SUBST(NGR_R_ENT_ARGS)
1916
1917 AC_CHECK_FUNC(setnetgrent_r,
1918 [
1919 case "$host" in
1920 *bsdi*)
1921         NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/"
1922         NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void"
1923         ;;
1924 *)
1925         NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK"
1926         NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int"
1927         ;;
1928 esac
1929 ]
1930 ,
1931 NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/"
1932 NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void"
1933 )
1934 AC_SUBST(NGR_R_SET_RESULT)
1935 AC_SUBST(NGR_R_SET_RETURN)
1936
1937 AC_CHECK_FUNC(innetgr_r,,AC_DEFINE(NEED_INNETGR_R))
1938
1939 case $host in
1940 ia64-hp-hpux11.*)
1941 ;;
1942 *)
1943 AC_CHECK_FUNC(getprotoent_r,
1944 AC_TRY_COMPILE(
1945 [
1946 #undef __USE_MISC
1947 #define __USE_MISC
1948 #include <netdb.h>
1949 struct protoent *getprotoent_r(struct protoent *result,
1950                  char *buffer, int buflen) {}
1951 ]
1952 ,
1953 [return (0);]
1954 ,
1955 [
1956 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
1957 PROTO_R_BAD="#define PROTO_R_BAD NULL"
1958 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
1959 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
1960 PROTO_R_OK="#define PROTO_R_OK pptr"
1961 PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
1962 PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
1963 ]
1964 ,
1965 AC_TRY_COMPILE(
1966 [
1967 #undef __USE_MISC
1968 #define __USE_MISC
1969 #include <netdb.h>
1970 int getprotoent_r (struct protoent *, char *, size_t, struct protoent **);
1971
1972 ]
1973 ,
1974 [return (0);]
1975 ,
1976 [
1977 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, size_t buflen, struct protoent **answerp"
1978 PROTO_R_BAD="#define PROTO_R_BAD ERANGE"
1979 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
1980 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS char *buf, size_t buflen"
1981 PROTO_R_OK="#define PROTO_R_OK 0"
1982 PROTO_R_SETANSWER="#define PROTO_R_SETANSWER 1"
1983 PROTO_R_RETURN="#define PROTO_R_RETURN int"
1984 ]
1985 ,
1986 )
1987 )
1988 ,
1989 PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
1990 PROTO_R_BAD="#define PROTO_R_BAD NULL"
1991 PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
1992 PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
1993 PROTO_R_OK="#define PROTO_R_OK pptr"
1994 PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
1995 PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
1996 )
1997 esac
1998 AC_SUBST(PROTO_R_ARGS)
1999 AC_SUBST(PROTO_R_BAD)
2000 AC_SUBST(PROTO_R_COPY)
2001 AC_SUBST(PROTO_R_COPY_ARGS)
2002 AC_SUBST(PROTO_R_OK)
2003 AC_SUBST(PROTO_R_SETANSWER)
2004 AC_SUBST(PROTO_R_RETURN)
2005
2006 case $host in
2007 ia64-hp-hpux11.*)
2008 ;;
2009 *)
2010 AC_CHECK_FUNC(endprotoent_r,
2011 AC_TRY_COMPILE(
2012 [
2013 #undef _REENTRANT
2014 #define _REENTRANT
2015 #undef __USE_MISC
2016 #define __USE_MISC
2017 #include <netdb.h>
2018 void endprotoent_r(void);
2019 ]
2020 ,,
2021 [
2022 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) /*empty*/"
2023 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN void"
2024 PROTO_R_ENT_ARGS="#undef PROTO_R_ENT_ARGS"
2025 ]
2026 ,
2027 )
2028 ,
2029 PROTO_R_END_RESULT="#define PROTO_R_END_RESULT(x) /*empty*/"
2030 PROTO_R_END_RETURN="#define PROTO_R_END_RETURN void"
2031 PROTO_R_ENT_ARGS="#undef PROTO_R_ENT_ARGS /*empty*/"
2032 )
2033 esac
2034 AC_SUBST(PROTO_R_END_RESULT)
2035 AC_SUBST(PROTO_R_END_RETURN)
2036 AC_SUBST(PROTO_R_ENT_ARGS)
2037
2038 case $host in
2039 ia64-hp-hpux11.*)
2040 ;;
2041 *)
2042 AC_CHECK_FUNC(setprotoent_r,
2043 AC_TRY_COMPILE(
2044 [
2045 #undef _REENTRANT
2046 #define _REENTRANT
2047 #undef __USE_MISC
2048 #define __USE_MISC
2049 #include <netdb.h>
2050 void               setprotoent_r __P((int));
2051 ],[],
2052 PROTO_R_SET_RESULT="#undef PROTO_R_SET_RESULT"
2053 PROTO_R_SET_RETURN="#define PROTO_R_SET_RETURN void"
2054 ,
2055 )
2056 ,
2057 PROTO_R_SET_RESULT="#undef PROTO_R_SET_RESULT"
2058 PROTO_R_SET_RETURN="#define PROTO_R_SET_RETURN void"
2059 )
2060 esac
2061 AC_SUBST(PROTO_R_SET_RESULT)
2062 AC_SUBST(PROTO_R_SET_RETURN)
2063
2064 AC_CHECK_FUNC(getpwent_r,
2065 AC_TRY_COMPILE(
2066 [
2067 #include <sys/types.h>
2068 #include <pwd.h>
2069 struct passwd *
2070 getpwent_r(struct passwd *pwptr, char *buf, int buflen) {}
2071 ]
2072 ,
2073 []
2074 ,
2075 PASS_R_ARGS="#define PASS_R_ARGS char *buf, int buflen"
2076 PASS_R_BAD="#define PASS_R_BAD NULL"
2077 PASS_R_COPY="#define PASS_R_COPY buf, buflen"
2078 PASS_R_COPY_ARGS="#define PASS_R_COPY_ARGS PASS_R_ARGS"
2079 PASS_R_OK="#define PASS_R_OK pwptr"
2080 PASS_R_RETURN="#define PASS_R_RETURN struct passwd *"
2081 ,
2082 )
2083 ,
2084 PASS_R_ARGS="#define PASS_R_ARGS char *buf, int buflen"
2085 PASS_R_BAD="#define PASS_R_BAD NULL"
2086 PASS_R_COPY="#define PASS_R_COPY buf, buflen"
2087 PASS_R_COPY_ARGS="#define PASS_R_COPY_ARGS PASS_R_ARGS"
2088 PASS_R_OK="#define PASS_R_OK pwptr"
2089 PASS_R_RETURN="#define PASS_R_RETURN struct passwd *"
2090 AC_DEFINE(NEED_GETPWENT_R)
2091 )
2092 AC_SUBST(PASS_R_ARGS)
2093 AC_SUBST(PASS_R_BAD)
2094 AC_SUBST(PASS_R_COPY)
2095 AC_SUBST(PASS_R_COPY_ARGS)
2096 AC_SUBST(PASS_R_OK)
2097 AC_SUBST(PASS_R_RETURN)
2098
2099 AC_CHECK_FUNC(endpwent_r,
2100 AC_TRY_COMPILE(
2101 [
2102 #include <pwd.h>
2103 void endpwent_r(FILE **pwfp);
2104 ], ,
2105 PASS_R_END_RESULT="#define PASS_R_END_RESULT(x) /*empty*/"
2106 PASS_R_END_RETURN="#define PASS_R_END_RETURN void"
2107 PASS_R_ENT_ARGS="#define PASS_R_ENT_ARGS FILE **pwptr"
2108 ,
2109 )
2110 ,
2111 PASS_R_END_RESULT="#define PASS_R_END_RESULT(x) /*empty*/"
2112 PASS_R_END_RETURN="#define PASS_R_END_RETURN void"
2113 PASS_R_ENT_ARGS="#undef PASS_R_ENT_ARGS"
2114 AC_DEFINE(NEED_ENDPWENT_R)
2115 )
2116 AC_SUBST(PASS_R_END_RESULT)
2117 AC_SUBST(PASS_R_END_RETURN)
2118 AC_SUBST(PASS_R_ENT_ARGS)
2119 AC_CHECK_FUNC(setpassent_r,,AC_DEFINE(NEED_SETPASSENT_R))
2120 AC_CHECK_FUNC(setpassent,,AC_DEFINE(NEED_SETPASSENT))
2121
2122 AC_CHECK_FUNC(setpwent_r,
2123 AC_TRY_COMPILE([
2124 #include <pwd.h>
2125 void setpwent_r(FILE **pwfp);
2126 ], ,
2127 PASS_R_SET_RESULT="#undef PASS_R_SET_RESULT /* empty */"
2128 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN int"
2129 ,
2130 AC_TRY_COMPILE([
2131 #include <pwd.h>
2132 int setpwent_r(FILE **pwfp);
2133 ], ,
2134 PASS_R_SET_RESULT="#define PASS_R_SET_RESULT 0"
2135 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN int"
2136 ,
2137 )
2138 )
2139 ,
2140 PASS_R_SET_RESULT="#undef PASS_R_SET_RESULT /*empty*/"
2141 PASS_R_SET_RETURN="#define PASS_R_SET_RETURN void"
2142 AC_DEFINE(NEED_SETPWENT_R)
2143 )
2144 AC_SUBST(PASS_R_SET_RESULT)
2145 AC_SUBST(PASS_R_SET_RETURN)
2146
2147 AC_CHECK_FUNC(getpwnam_r,,AC_DEFINE(NEED_GETPWNAM_R))
2148 AC_CHECK_FUNC(getpwuid_r,,AC_DEFINE(NEED_GETPWUID_R))
2149
2150 case $host in
2151 ia64-hp-hpux11.*)
2152 ;;
2153 *)
2154 AC_CHECK_FUNC(getservent_r,
2155 AC_TRY_COMPILE([
2156 #undef __USE_MISC
2157 #define __USE_MISC
2158 #include <netdb.h>
2159 struct servent *
2160 getservent_r(struct servent *result, char *buffer, int buflen) {}
2161 ],[return (0);],
2162 [
2163 SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen"
2164 SERV_R_BAD="#define SERV_R_BAD NULL"
2165 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2166 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS SERV_R_ARGS"
2167 SERV_R_OK="#define SERV_R_OK sptr"
2168 SERV_R_SETANSWER="#undef SERV_R_SETANSWER"
2169 SERV_R_RETURN="#define SERV_R_RETURN struct servent *"
2170 ]
2171 ,
2172 AC_TRY_COMPILE([
2173 #undef __USE_MISC
2174 #define __USE_MISC
2175 #include <netdb.h>
2176 int
2177 getservent_r (struct servent *, char *, size_t, struct servent **);
2178 ],[return (0);],
2179 [
2180 SERV_R_ARGS="#define SERV_R_ARGS char *buf, size_t buflen, struct servent **answerp"
2181 SERV_R_BAD="#define SERV_R_BAD ERANGE"
2182 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2183 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS char *buf, size_t buflen"
2184 SERV_R_OK="#define SERV_R_OK (0)"
2185 SERV_R_SETANSWER="#define SERV_R_SETANSWER 1"
2186 SERV_R_RETURN="#define SERV_R_RETURN int"
2187 ]
2188 ,
2189 )
2190 )
2191 ,
2192 SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen"
2193 SERV_R_BAD="#define SERV_R_BAD NULL"
2194 SERV_R_COPY="#define SERV_R_COPY buf, buflen"
2195 SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS SERV_R_ARGS"
2196 SERV_R_OK="#define SERV_R_OK sptr"
2197 SERV_R_SETANSWER="#undef SERV_R_SETANSWER"
2198 SERV_R_RETURN="#define SERV_R_RETURN struct servent *"
2199 )
2200 esac
2201 AC_SUBST(SERV_R_ARGS)
2202 AC_SUBST(SERV_R_BAD)
2203 AC_SUBST(SERV_R_COPY)
2204 AC_SUBST(SERV_R_COPY_ARGS)
2205 AC_SUBST(SERV_R_OK)
2206 AC_SUBST(SERV_R_SETANSWER)
2207 AC_SUBST(SERV_R_RETURN)
2208
2209 case $host in
2210 ia64-hp-hpux11.*)
2211 ;;
2212 *)
2213 AC_CHECK_FUNC(endservent_r,
2214 AC_TRY_COMPILE(
2215 [
2216 #undef _REENTRANT
2217 #define _REENTRANT
2218 #undef __USE_MISC
2219 #define __USE_MISC
2220 #include <netdb.h>
2221 void endservent_r(void);
2222 ]
2223 ,
2224 ,
2225 [
2226 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) /*empty*/"
2227 SERV_R_END_RETURN="#define SERV_R_END_RETURN void "
2228 SERV_R_ENT_ARGS="#undef SERV_R_ENT_ARGS /*empty*/"
2229 ]
2230 ,
2231 )
2232 ,
2233 SERV_R_END_RESULT="#define SERV_R_END_RESULT(x) /*empty*/"
2234 SERV_R_END_RETURN="#define SERV_R_END_RETURN void "
2235 SERV_R_ENT_ARGS="#undef SERV_R_ENT_ARGS /*empty*/"
2236 )
2237 esac
2238 AC_SUBST(SERV_R_END_RESULT)
2239 AC_SUBST(SERV_R_END_RETURN)
2240 AC_SUBST(SERV_R_ENT_ARGS)
2241
2242 case $host in
2243 ia64-hp-hpux11.*)
2244 ;;
2245 *)
2246 AC_CHECK_FUNC(setservent_r,
2247 AC_TRY_COMPILE(
2248 [
2249 #undef _REENTRANT
2250 #define _REENTRANT
2251 #undef __USE_MISC
2252 #define __USE_MISC
2253 #include <netdb.h>
2254 void            setservent_r(int);
2255 ]
2256 ,,
2257 [
2258 SERV_R_SET_RESULT="#undef SERV_R_SET_RESULT"
2259 SERV_R_SET_RETURN="#define SERV_R_SET_RETURN void"
2260 ]
2261 ,
2262 )
2263 ,
2264 SERV_R_SET_RESULT="#undef SERV_R_SET_RESULT"
2265 SERV_R_SET_RETURN="#define SERV_R_SET_RETURN void"
2266 )
2267 esac
2268 AC_SUBST(SERV_R_SET_RESULT)
2269 AC_SUBST(SERV_R_SET_RETURN)
2270
2271 AC_TRY_COMPILE(
2272 [
2273 #undef _REENTRANT
2274 #define _REENTRANT
2275 #undef __USE_MISC
2276 #define __USE_MISC
2277 #include <unistd.h>
2278 #include <netdb.h>
2279 int innetgr(const char *netgroup, const char *host, const char *user, const char *domain);
2280 ]
2281 ,,
2282 [
2283 INNETGR_ARGS="#undef INNETGR_ARGS"
2284 ]
2285 ,
2286 AC_TRY_COMPILE(
2287 [
2288 #undef _REENTRANT
2289 #define _REENTRANT
2290 #undef __USE_MISC
2291 #define __USE_MISC
2292 #include <unistd.h>
2293 #include <netdb.h>
2294 int innetgr(char *netgroup, char *host, char *user, char *domain);
2295 ]
2296 ,,
2297 [
2298 INNETGR_ARGS="#define INNETGR_ARGS char *netgroup, char *host, char *user, char *domain"
2299 ]
2300 ,
2301 ))
2302
2303 AC_TRY_COMPILE(
2304 [
2305 #undef _REENTRANT
2306 #define _REENTRANT
2307 #undef __USE_MISC
2308 #define __USE_MISC
2309 #include <unistd.h>
2310 #include <netdb.h>
2311 void setnetgrent(const char *);
2312 ]
2313 ,,
2314 [
2315 SETNETGRENT_ARGS="#undef SETNETGRENT_ARGS"
2316 ]
2317 ,
2318 AC_TRY_COMPILE(
2319 [
2320 #undef _REENTRANT
2321 #define _REENTRANT
2322 #undef __USE_MISC
2323 #define __USE_MISC
2324 #include <unistd.h>
2325 #include <netdb.h>
2326 void setnetgrent(char *);
2327 ]
2328 ,,
2329 [
2330 SETNETGRENT_ARGS="#define SETNETGRENT_ARGS char *netgroup"
2331 ]
2332 ,
2333 ))
2334 AC_SUBST(SETNETGRENT_ARGS)
2335 AC_SUBST(INNETGR_ARGS)
2336
2337 #
2338 # Random remaining OS-specific issues involving compiler warnings.
2339 # XXXDCL print messages to indicate some compensation is being done?
2340 #
2341 BROKEN_IN6ADDR_INIT_MACROS="#undef BROKEN_IN6ADDR_INIT_MACROS"
2342
2343 case "$host" in
2344         *-aix5.1.*)
2345                 hack_shutup_pthreadmutexinit=yes
2346                 hack_shutup_in6addr_init_macros=yes
2347                 ;;
2348         *-bsdi3.1*)
2349                 hack_shutup_sputaux=yes
2350                 ;;
2351         *-bsdi4.0*)
2352                 hack_shutup_sigwait=yes
2353                 hack_shutup_sputaux=yes
2354                 hack_shutup_in6addr_init_macros=yes
2355                 ;;
2356         *-bsdi4.1*)
2357                 hack_shutup_stdargcast=yes
2358                 ;;
2359         *-hpux11.11)
2360                 hack_shutup_in6addr_init_macros=yes
2361                 ;;
2362         *-osf5.1|*-osf5.1b)
2363                 hack_shutup_in6addr_init_macros=yes
2364                 ;;
2365         *-solaris2.8)
2366                 hack_shutup_in6addr_init_macros=yes
2367                 ;;
2368         *-solaris2.9)
2369                 hack_shutup_in6addr_init_macros=yes
2370                 ;;
2371 esac
2372
2373 case "$hack_shutup_pthreadmutexinit" in
2374         yes)
2375                 #
2376                 # Shut up PTHREAD_MUTEX_INITIALIZER unbraced
2377                 # initializer warnings.
2378                 #
2379                 AC_DEFINE(SHUTUP_MUTEX_INITIALIZER)
2380                 ;;
2381 esac
2382
2383 case "$hack_shutup_sigwait" in
2384         yes)
2385                 #
2386                 # Shut up a -Wmissing-prototypes warning for sigwait().
2387                 #
2388                 AC_DEFINE(SHUTUP_SIGWAIT)
2389                 ;;
2390 esac
2391
2392 case "$hack_shutup_sputaux" in
2393         yes)
2394                 #
2395                 # Shut up a -Wmissing-prototypes warning from <stdio.h>.
2396                 #
2397                 AC_DEFINE(SHUTUP_SPUTAUX)
2398                 ;;
2399 esac
2400
2401 case "$hack_shutup_stdargcast" in
2402         yes)
2403                 #
2404                 # Shut up a -Wcast-qual warning from va_start().
2405                 #
2406                 AC_DEFINE(SHUTUP_STDARG_CAST)
2407                 ;;
2408 esac
2409
2410 case "$hack_shutup_in6addr_init_macros" in
2411         yes)
2412                 AC_DEFINE(BROKEN_IN6ADDR_INIT_MACROS)
2413                 ;;
2414 esac
2415
2416 #
2417 # Substitutions
2418 #
2419 AC_SUBST(BIND9_TOP_BUILDDIR)
2420 BIND9_TOP_BUILDDIR=`pwd`
2421
2422 AC_SUBST_FILE(BIND9_INCLUDES)
2423 BIND9_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2424
2425 AC_SUBST_FILE(BIND9_MAKE_RULES)
2426 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2427
2428 . $srcdir/../../version
2429 BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
2430 AC_SUBST(BIND9_VERSION)
2431
2432 AC_SUBST_FILE(LIBBIND_API)
2433 LIBBIND_API=$srcdir/api
2434
2435 AC_OUTPUT(
2436         make/rules
2437         make/mkdep
2438         make/includes
2439         Makefile
2440         bsd/Makefile
2441         dst/Makefile
2442         include/Makefile
2443         inet/Makefile
2444         irs/Makefile
2445         isc/Makefile
2446         nameser/Makefile
2447         port_after.h
2448         port_before.h
2449         resolv/Makefile
2450         port/Makefile
2451         ${PORT_DIR}/Makefile
2452         ${PORT_INCLUDE}/Makefile
2453 )
2454
2455 # Tell Emacs to edit this file in shell mode.
2456 # Local Variables:
2457 # mode: sh
2458 # End: