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