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