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