xref: /freebsd/contrib/ntp/configure.ac (revision 9a14aa017b21c292740c00ee098195cd46642730)
1dnl -*-fundamental-*-
2dnl Process this file with autoconf to produce a configure script.
3m4_include([version.m4])
4AC_INIT(ntp, VERSION_NUMBER)
5AM_INIT_AUTOMAKE
6AC_CANONICAL_HOST
7dnl the 'build' machine is where we run configure and compile
8dnl the 'host' machine is where the resulting stuff runs.
9AC_DEFINE_UNQUOTED(STR_SYSTEM, "$host", [canonical system (cpu-vendor-os) of where we should run])
10AM_CONFIG_HEADER([config.h])
11dnl AC_ARG_PROGRAM
12AC_PREREQ(2.53)
13
14ac_cv_var_atom_ok=no
15ac_cv_var_oncore_ok=no
16ac_cv_var_parse_ok=no
17ac_cv_var_ripe_ncc_ok=no
18ac_cv_var_jupiter_ok=no
19
20dnl Grab any initial CFLAGS so we can pick better defaults.
21iCFLAGS="$CFLAGS"
22
23dnl check these early to avoid autoconf warnings
24AC_AIX
25AC_MINIX
26
27# So far, the only shared library we might use is libopts.
28# It's a small library - we might as well use a static version of it.
29AC_DISABLE_SHARED
30
31dnl  we need to check for cross compile tools for vxWorks here
32AC_PROG_CC
33# Ralf Wildenhues: With per-target flags we need CC_C_O
34# AM_PROG_CC_C_O supersets AC_PROG_CC_C_O
35AM_PROG_CC_C_O
36AC_PROG_CC_STDC
37AC_PROG_CPP
38
39# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
40case "$host" in
41 *-*-amigaos)
42    CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA"
43    ;;
44 *-*-hpux10.*)	# at least for hppa2.0-hp-hpux10.20
45    case "$GCC" in
46     yes)
47	;;
48     *) CFLAGS="$CFLAGS -Wp,-H18816"
49	;;
50    esac
51    ;;
52 *-pc-cygwin*)
53    CFLAGS="$CFLAGS -DSYS_CYGWIN32"
54    ;;
55 i386-sequent-sysv4)
56    case "$CC" in
57     cc)
58	CFLAGS="$CFLAGS -Wc,+abi-socket"
59	;;
60    esac
61    ;;
62 *-*-mpeix*)
63    CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB"
64    LDFLAGS="$LDFLAGS -L/SYSLOG/PUB"
65    LIBS="$LIBS -lcurses"
66    ;;
67 *-*-solaris*)
68    # see "man standards".
69    # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
70    # -D_XOPEN_SOURCE=600 seems OK for c99
71    #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
72    CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
73    libxnet=-lxnet
74    ;;
75esac
76
77AMU_OS_CFLAGS
78
79# NTP has (so far) been relying on leading-edge autogen.
80# Therefore, by default:
81# - use the version we ship with
82# - do not install it
83# - build a static copy (AC_DISABLE_SHARED - done earlier)
84case "${enable_local_libopts+set}" in
85 set) ;;
86 *) enable_local_libopts=yes ;;
87esac
88case "${enable_libopts_install+set}" in
89 set) ;;
90 *) enable_libopts_install=no ;;
91esac
92LIBOPTS_CHECK(libopts)
93
94AC_CACHE_CHECK(
95    [if $CC can handle @%:@warning],
96    ac_cv_cpp_warning,
97    [
98	AC_COMPILE_IFELSE(
99	    AC_LANG_PROGRAM([], [#warning foo]),
100	    [ac_cv_cpp_warning=yes],
101	    [ac_cv_cpp_warning=no],
102	)
103    ]
104)
105
106case "$ac_cv_cpp_warning" in
107 no)
108    AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid @%:@warning on option name collisions?])
109esac
110
111case "$GCC" in
112 yes)
113    SAVED_CFLAGS_AC="$CFLAGS"
114    CFLAGS="$CFLAGS -Wstrict-overflow"
115    AC_CACHE_CHECK(
116	[if $CC can handle -Wstrict-overflow],
117	ac_cv_gcc_Wstrict_overflow,
118	[
119	    AC_COMPILE_IFELSE(
120		[AC_LANG_PROGRAM([], [])],
121		[ac_cv_gcc_Wstrict_overflow=yes],
122		[ac_cv_gcc_Wstrict_overflow=no]
123	    )
124	]
125    )
126    CFLAGS="$SAVED_CFLAGS_AC"
127    unset SAVED_CFLAGS_AC
128    #
129    # $ac_cv_gcc_Wstrict_overflow is tested later to add the
130    # flag to CFLAGS.
131    #
132esac
133
134
135case "$GCC" in
136 yes)
137    SAVED_CFLAGS_AC="$CFLAGS"
138    CFLAGS="$CFLAGS -Winit-self"
139    AC_CACHE_CHECK(
140	[if $CC can handle -Winit-self],
141	ac_cv_gcc_Winit_self,
142	[
143	    AC_COMPILE_IFELSE(
144		[AC_LANG_PROGRAM([], [])],
145		[ac_cv_gcc_Winit_self=yes],
146		[ac_cv_gcc_Winit_self=no]
147	    )
148	]
149    )
150    CFLAGS="$SAVED_CFLAGS_AC"
151    unset SAVED_CFLAGS_AC
152    #
153    # $ac_cv_gcc_Winit_self is tested later to add the
154    # flag to CFLAGS.
155    #
156esac
157
158
159
160AC_MSG_CHECKING([for bin subdirectory])
161AC_ARG_WITH(binsubdir,
162	AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
163	use_binsubdir="$withval", use_binsubdir="bin")
164
165case "$use_binsubdir" in
166 bin)
167    ;;
168 sbin)
169    ;;
170 *)
171    AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
172    ;;
173esac
174AC_MSG_RESULT($use_binsubdir)
175BINSUBDIR=$use_binsubdir
176AC_SUBST(BINSUBDIR)
177
178AC_MSG_CHECKING([if we want to use arlib])
179AC_ARG_WITH(arlib,
180	AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]),
181	[ans=$withval], [ans=no])
182AC_MSG_RESULT([$ans])
183
184if test -d $srcdir/arlib
185then
186    case "$ans" in
187     yes)
188	ARLIB_DIR=arlib
189	AC_CONFIG_SUBDIRS(arlib)
190	;;
191    esac
192fi
193AC_SUBST(ARLIB_DIR)
194
195AC_ARG_WITH(rpath,
196	AC_HELP_STRING([--without-rpath], [s Disable auto-added -R linker paths]),
197[ans=$withval], [ans=x])
198case "$ans" in
199 no)
200    need_dash_r=
201    ;;
202 yes)
203    need_dash_r=1
204    ;;
205esac
206# HMS: Why isn't this $build?
207# Well, that depends on if we need this for the build toolchain or
208# for info in the host executable...
209# I still have no idea which way this should go, but nobody has complained.
210case "$host" in
211 *-*-netbsd*)
212    case "$need_dash_r" in
213     no) ;;
214     *)  need_dash_r=1
215	 ;;
216    esac
217    ;;
218 *-*-solaris*)
219    case "$need_dash_r" in
220     no) ;;
221     *)  need_dash_r=1
222	 ;;
223    esac
224    ;;
225esac
226
227
228case "$build" in
229 $host)
230    ;;
231 *) case "$host" in
232     *-*-vxworks*)
233	# Quick and dirty sanity check
234	case "$VX_KERNEL" in
235	 '') AC_MSG_ERROR(Please follow the directions in html/build/hints/vxworks.html!)
236	    ;;
237	esac
238        CFLAGS="$CFLAGS -DSYS_VXWORKS"
239        ;;
240    esac
241    ;;
242esac
243
244dnl  we need to check for cross compile tools for vxWorks here
245AC_PROG_AWK
246AC_PROG_MAKE_SET
247
248rm -f conftest*
249
250case "$GCC" in
251 yes)
252    CFLAGS="$CFLAGS -Wall"
253    # CFLAGS="$CFLAGS -Wcast-align"
254    CFLAGS="$CFLAGS -Wcast-qual"
255    # CFLAGS="$CFLAGS -Wconversion"
256    # CFLAGS="$CFLAGS -Werror"
257    # CFLAGS="$CFLAGS -Wextra"
258    # CFLAGS="$CFLAGS -Wfloat-equal"
259    CFLAGS="$CFLAGS -Wmissing-prototypes"
260    CFLAGS="$CFLAGS -Wpointer-arith"
261    CFLAGS="$CFLAGS -Wshadow"
262    #
263    # OpenSSL has a number of callback prototypes
264    # inside other function prototypes which trigger
265    # warnings with -Wstrict-prototypes, such as:
266    #
267    # int i2d_RSA_NET(const RSA *a, unsigned char **pp,
268    #                 int (*cb)(), int sgckey);
269    #                 ^^^^^^^^^^^
270    #
271    CFLAGS="$CFLAGS -Wno-strict-prototypes"
272    # CFLAGS="$CFLAGS -Wtraditional"
273    # CFLAGS="$CFLAGS -Wwrite-strings"
274    case "$ac_cv_gcc_Winit_self" in
275     yes)
276	CFLAGS="$CFLAGS -Winit-self"
277    esac
278    case "$ac_cv_gcc_Wstrict_overflow" in
279     yes)
280        #not yet: CFLAGS="$CFLAGS -Wstrict-overflow"
281    esac
282    ;;
283esac
284
285case "$host" in
286 *-next-nextstep3)
287    CFLAGS="$CFLAGS -posix"
288    ;;
289dnl This is currently commented out by bor.
290dnl The new versions of ReliantUNIX round adjtime() interval down
291dnl to 1/100s (system tick). This makes tickadj actually useless.
292dnl So, I'd better not use additional flags.
293dnl I leave it here just in case anybody has better idea
294dnl  mips-sni-sysv4* )
295dnl     #
296dnl     # Add flags for 64 bit file access to enable tickadj to access /dev/kmem
297dnl     #
298dnl     if getconf _LFS_CFLAGS > /dev/null 2>&1 ; then
299dnl       CFLAGS="$CFLAGS `getconf _LFS_CFLAGS`"
300dnl     fi
301dnl     ;;
302esac
303
304ac_busted_vpath_in_make=no
305
306case "$build" in
307 *-*-irix6.1*)	# 64 bit only
308    # busted vpath?
309    ;;
310 *-*-irix6*)	# 6.2 (and later?)
311    ac_busted_vpath_in_make=yes
312    ;;
313 *-*-solaris2.5.1)
314    ac_busted_vpath_in_make=yes
315    ;;
316 *-*-unicosmp*)
317    ac_busted_vpath_in_make=yes
318    ;;
319esac
320
321case "$ac_busted_vpath_in_make$srcdir" in
322 no*) ;;
323 yes.) ;;
324 *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in
325     '')
326	AC_MSG_ERROR([building outside of the main directory requires GNU make])
327	;;
328     *) ;;
329    esac
330    ;;
331esac
332
333AC_SUBST(CFLAGS)dnl
334AC_SUBST(LDFLAGS)dnl
335
336m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
337m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
338
339AC_PROG_LIBTOOL
340
341AC_PROG_LN_S
342AC_PROG_GCC_TRADITIONAL
343AC_C_VOLATILE
344AC_ISC_POSIX
345AC_PATH_PROG(PATH_SH, sh)
346AC_PATH_PROG(PATH_PERL, perl)
347
348hs_ULONG_CONST		# remove for 4.2.5
349
350case "$host" in
351 *-*-vxworks*)
352    ac_link="$ac_link $VX_KERNEL"
353    ;;
354esac
355
356AC_PROG_INSTALL
357
358case "$host" in
359 *-pc-cygwin*)
360    AC_CHECK_LIB(advapi32, main)
361    ;;
362esac
363
364AC_CHECK_FUNC([gethostent], ,
365  AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket]))
366AC_CHECK_FUNC([openlog], ,
367  AC_SEARCH_LIBS([openlog], [gen], ,
368  AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])))
369AC_SEARCH_LIBS([MD5Init], [md5 md])
370AC_CHECK_FUNCS(MD5Init)
371
372# following block becomes on 4.2.5: NTP_LINEEDITLIBS
373dnl HMS: What a hack...
374AC_CHECK_HEADERS(readline/history.h readline/readline.h)
375case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
376 *no*) ;;
377 *) save_LIBS=$LIBS
378    LIBS=
379    # Ralf Wildenhues: either unset ... or cache READLINE_LIBS
380    unset ac_cv_lib_readline_readline
381    AC_CHECK_LIB(readline, readline, ,
382     AC_MSG_NOTICE([Trying again with -lcurses])
383     unset ac_cv_lib_readline_readline
384     AC_CHECK_LIB(readline, readline,
385      LIBS="-lreadline -lcurses $LIBS"
386      AC_DEFINE(HAVE_LIBREADLINE)
387      AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]),
388      AC_CHECK_LIB(edit, readline,
389       LIBS="-ledit -lcurses"
390       AC_DEFINE(HAVE_LIBEDIT, , [Do we have the edit library?])
391       AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?])
392       , , -lcurses)
393      , -lcurses))
394    READLINE_LIBS=$LIBS
395    AC_SUBST(READLINE_LIBS)
396    LIBS=$save_LIBS
397    ;;
398esac
399
400dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
401dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
402dnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
403dnl does Strange Things with extra processes using the Posix-compatibility
404dnl real-time library, so we don't want to use it.
405
406case "$host" in
407 *-*-*linux*) ;;
408 *)
409    AC_CHECK_LIB(rt, sched_setscheduler, ,
410	AC_CHECK_LIB(posix4, sched_setscheduler))
411    ;;
412esac
413
414AC_CHECK_FUNC(setsockopt, ,
415	[AC_SEARCH_LIBS([setsockopt], [socket xnet])])
416
417AC_HEADER_STDC
418AC_CHECK_HEADERS(bstring.h)
419AC_CHECK_HEADER(dns_sd.h,
420	[AC_CHECK_LIB(dns_sd,
421			DNSServiceRegister,
422			[AC_DEFINE(HAVE_DNSREGISTRATION, 1,
423				[Use Rendezvous/DNS-SD registration])])])
424case "$ac_cv_lib_dns_sd_DNSServiceRegister" in
425 yes) LIBS="-ldns_sd $LIBS" ;;
426esac
427AC_CHECK_HEADERS(errno.h fcntl.h ieeefp.h math.h)
428
429# HMS: Lame, but fast.
430if test -f /etc/redhat-release
431then
432    :
433else
434    AC_CHECK_HEADERS(md5.h, [], [],
435[#if HAVE_SYS_TYPES_H
436#include <sys/types.h>
437#endif
438])
439fi
440AC_CHECK_HEADERS(memory.h netdb.h poll.h)
441AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
442AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
443case "$host" in
444 *-*-aix*)
445    AC_CHECK_HEADERS(utmpx.h)
446    case "$ac_cv_header_utmpx_h" in
447     yes) ;;
448     *) AC_CHECK_HEADERS(utmp.h) ;;
449    esac
450    ;;
451 *) AC_CHECK_HEADERS(utmp.h utmpx.h) ;;
452esac
453AC_CHECK_HEADERS(arpa/nameser.h)
454AC_CHECK_HEADERS(sys/socket.h)
455AC_CHECK_HEADERS(net/if.h, [], [],
456[#if HAVE_SYS_SOCKET_H
457#include <sys/socket.h>
458#endif
459])
460AC_CHECK_HEADERS(net/if6.h)
461AC_CHECK_HEADERS(net/route.h, [], [], [
462#include <sys/types.h>
463#include <sys/socket.h>
464#include <net/if.h>
465])
466AC_CHECK_HEADERS(netinet/in_system.h netinet/in_systm.h)
467AC_CHECK_HEADERS(netinet/in.h)
468AC_CHECK_HEADERS(netinet/ip.h, [], [],
469[#if HAVE_SYS_TYPES_H
470#include <sys/types.h>
471#endif
472#if HAVE_NETINET_IN_H
473#include <netinet/in.h>
474#endif
475#if HAVE_NETINET_IN_SYSTM_H
476#include <netinet/in_systm.h>
477#endif
478])
479
480# Check for IPTOS_PREC
481AC_CACHE_CHECK(
482    [IPPROTO_IP IP_TOS IPTOS_LOWDELAY],
483    ac_cv_ip_tos,
484    [
485	AC_EGREP_CPP(
486	    [yes],
487	    [
488		#if HAVE_SYS_TYPES_H
489		#include <sys/types.h>
490		#endif
491		#if HAVE_NETINET_IP_H
492		#include <netinet/in.h>
493		#include <netinet/ip.h>
494		#endif
495		#if defined(IPPROTO_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
496		  yes
497		#endif
498	    ],
499	    [ac_cv_ip_tos=yes],
500	    [ac_cv_ip_tos=no]
501	)
502    ]
503)
504
505case "$ac_cv_ip_tos" in
506 yes)
507    AC_DEFINE(HAVE_IPTOS_SUPPORT, 1, [Do we have IPTOS support?])
508esac
509
510AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])])
511AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
512dnl AC_CHECK_HEADERS(sys/chudefs.h)
513AC_CHECK_HEADERS(sys/clkdefs.h sys/file.h)
514case "$host" in
515 *-*-sunos4*) ;;
516 *) AC_CHECK_HEADERS(sys/ioctl.h)
517    ;;
518esac
519AC_CHECK_HEADERS(sys/ipc.h)
520AC_CHECK_HEADERS(sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h)
521# HMS: Check sys/proc.h and sys/resource.h after some others
522AC_CHECK_HEADERS(sys/ppstime.h)
523case "$ac_cv_header_sched_h" in
524 yes) ;;
525 *) AC_CHECK_HEADERS(sys/sched.h) ;;
526esac
527case "$host" in
528 *-*-sco*)
529    AC_CHECK_HEADERS(sys/sio.h)
530    ;;
531esac
532# HMS: Check sys/shm.h after some others
533AC_CHECK_HEADERS(sys/select.h sys/signal.h sys/sockio.h)
534# HMS: Checked sys/socket.h earlier
535case "$host" in
536 *-*-netbsd*) ;;
537 *) AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h)
538    ;;
539esac
540AC_CHECK_HEADERS(sys/stat.h sys/stream.h)
541AC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/syssgi.h sys/systune.h)
542AC_CHECK_HEADERS(sys/termios.h sys/time.h sys/signal.h)
543AC_EGREP_CPP(yes,
544[#if HAVE_SYS_TIME_H
545# include <sys/time.h>
546#endif
547#if HAVE_ERRNO_H
548# include <errno.h>
549#endif
550#include <sys/timepps.h>
551#ifdef PPS_API_VERS_1
552yes
553#endif
554], [AC_CHECK_HEADERS(sys/timepps.h, [], [],
555[#if HAVE_SYS_TIME_H
556# include <sys/time.h>
557#endif
558#if HAVE_ERRNO_H
559# include <errno.h>
560#endif
561])
562])
563AC_CHECK_HEADERS(sys/timers.h sys/tpro.h sys/types.h sys/wait.h)
564AC_HEADER_TIME
565case "$host" in
566*-convex-*)
567  AC_CHECK_HEADERS(/sys/sync/queue.h /sys/sync/sema.h)
568  ;;
569*-*-bsdi*)
570  AC_CHECK_HEADERS(machine/inline.h sys/pcl720.h sys/i8253.h)
571  ;;
572esac
573
574case "$host" in
575 *-*-*linux*)
576    AC_CHECK_FUNCS(__adjtimex __ntp_gettime)
577    ;;
578esac
579case "$ac_cv_func___adjtimex" in
580 yes) ;;
581 *)
582    AC_CHECK_LIB(elf, nlist)	dnl Only needed for tickadj...
583    dnl AC_CHECK_LIB(kvm, main, , , -lelf)
584    AC_CHECK_LIB(kvm, main)		dnl We already know about -lelf here...
585    AC_CHECK_LIB(ld, nlist)
586    AC_CHECK_LIB(mld, nlist)
587    AC_CHECK_HEADER(nlist.h,
588    [AC_DEFINE(NLIST_STRUCT, 1, [nlist stuff])
589     AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
590      [AC_TRY_COMPILE([#include <nlist.h>],
591       [struct nlist n; n.n_un.n_name = 0;],
592       ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
593     if test $ac_cv_struct_nlist_n_un = yes; then
594       AC_DEFINE(NLIST_NAME_UNION, 1, [does struct nlist use a name union?])
595     fi
596    ])dnl
597    ;;
598esac
599
600dnl AC_CHECK_HEADERS(net/if.h, [], [],
601dnl [#if HAVE_SYS_TYPES_H
602dnl # include <sys/types.h>
603dnl #endif
604dnl #if HAVE_SYS_SOCKET_H
605dnl # include <sys/socket.h>
606dnl #endif
607dnl ])
608
609AC_CHECK_HEADERS(sys/proc.h, [], [],
610[#if HAVE_SYS_TYPES_H
611# include <sys/types.h>
612#endif
613#if HAVE_SYS_TIME_H
614# include <sys/time.h>
615#endif
616])
617
618AC_CHECK_HEADERS(sys/resource.h, [], [],
619[#if HAVE_SYS_TIME_H
620# include <sys/time.h>
621#endif
622])
623
624AC_CHECK_HEADERS(sys/shm.h, [], [],
625[#if HAVE_SYS_TYPES_H
626# include <sys/types.h>
627#endif
628#if HAVE_SYS_IPC_H
629# include <sys/ipc.h>
630#endif
631])
632
633AC_CHECK_HEADERS(sys/timex.h, [], [],
634[#if HAVE_SYS_TIME_H
635# include <sys/time.h>
636#endif
637])
638
639AC_CHECK_HEADERS(resolv.h, [], [],
640[#if HAVE_SYS_TYPES_H
641#include <sys/types.h>
642#endif
643#if HAVE_NETINET_IN_H
644#include <netinet/in.h>
645#endif
646#if HAVE_ARPA_NAMESER_H
647#include <arpa/nameser.h>
648#endif
649])
650
651AC_CACHE_CHECK([for basic volatile support], ac_cv_c_volatile,
652[AC_TRY_COMPILE([],[
653volatile int x;],
654	ac_cv_c_volatile=yes,
655	ac_cv_c_volatile=no)
656])
657case "$ac_cv_c_volatile" in
658 yes)
659    ;;
660 *) AC_DEFINE(volatile, , [Does the compiler like "volatile"?])
661    ;;
662esac
663
664#
665# following block goes away in 4.2.5
666#
667# AM_C_PROTOTYPES gives us ansi2knr
668case "$build" in
669 *-*-solaris2*)
670    # Assume that solaris2 is Ansi C...
671    ;;
672 *)
673    AM_C_PROTOTYPES
674    ;;
675esac
676AC_CACHE_CHECK(if C compiler permits function prototypes, ac_cv_have_prototypes,
677[AC_TRY_COMPILE([
678extern int foo (short);
679int foo(short i) { return i; }],[
680int i;], ac_cv_have_prototypes=yes, ac_cv_have_prototypes=no)
681])
682if test "$ac_cv_have_prototypes" = yes; then
683  AC_DEFINE(HAVE_PROTOTYPES, 1, [Are function prototypes OK?])
684fi
685#
686# end block
687#
688
689AC_C_CONST
690AC_C_BIGENDIAN
691AC_TYPE_SIGNAL
692AC_TYPE_OFF_T
693AC_TYPE_SIZE_T
694AC_CHECK_TYPE(time_t, long)
695AC_CHECK_SIZEOF(time_t)
696AC_CHECK_TYPES(uintptr_t)
697
698AH_VERBATIM([TYPEDEF_UINTPTR_T],
699[/* Provide a typedef for uintptr_t? */
700#ifndef HAVE_UINTPTR_T
701typedef unsigned int	uintptr_t;
702#define HAVE_UINTPTR_T	1
703#endif])
704
705AC_STRUCT_TM
706
707AC_CACHE_CHECK([for u_int8_t], ac_cv_type_u_int8_t,
708[AC_TRY_COMPILE([#include <sys/types.h>],
709	[u_int8_t len = 42; return 0;],
710	ac_cv_type_u_int8_t=yes,
711	ac_cv_type_u_int8_t=no)
712])
713if test $ac_cv_type_u_int8_t = yes; then
714	AC_DEFINE(HAVE_TYPE_U_INT8_T, 1, [Does u_int8_t exist?])
715fi
716
717AC_CACHE_CHECK([for u_int64_t], ac_cv_type_u_int64_t,
718[AC_TRY_COMPILE([#include <sys/types.h>],
719	[u_int64_t len = 42; return 0;],
720	ac_cv_type_u_int64_t=yes,
721	ac_cv_type_u_int64_t=no)
722])
723if test $ac_cv_type_u_int64_t = yes; then
724	AC_DEFINE(HAVE_TYPE_U_INT64_T, 1, [Does u_int64_t exist?])
725fi
726
727#
728# Look for in_port_t.
729#
730AC_MSG_CHECKING([for in_port_t])
731AC_TRY_COMPILE([
732#include <sys/types.h>
733#include <netinet/in.h>],
734[in_port_t port = 25; return (0);],
735	[AC_MSG_RESULT(yes)
736	],
737        [AC_MSG_RESULT(no)
738	AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Do we need our own in_port_t?])
739	])
740
741AC_CACHE_CHECK([for a fallback value for HZ], ac_cv_var_default_hz,
742[ac_cv_var_default_hz=100
743case "$host" in
744 alpha*-dec-osf4*|alpha*-dec-osf5*)
745    ac_cv_var_default_hz=1024
746    ;;
747 mips-dec-ultrix4*)
748    ac_cv_var_default_hz=256
749    ;;
750esac])
751AC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz, [What is the fallback value for HZ?])
752
753AC_CACHE_CHECK([if we need to override the system's value for HZ], ac_cv_var_override_hz,
754[ac_cv_var_override_hz=no
755case "$host" in
756 alpha*-dec-osf4*|alpha*-dec-osf5*)
757    ac_cv_var_override_hz=yes
758    ;;
759 mips-dec-ultrix4*)
760    ac_cv_var_override_hz=yes
761    ;;
762 *-*-freebsd*)
763    ac_cv_var_override_hz=yes
764    ;;
765 *-*-sunos4*)
766    ac_cv_var_override_hz=yes
767    ;;
768esac])
769case "$ac_cv_var_override_hz" in
770 yes)
771    AC_DEFINE(OVERRIDE_HZ, 1, [Do we need to override the system's idea of HZ?])
772    ;;
773esac
774
775dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
776dnl [AC_TRY_LINK([#include <sys/types.h>
777dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
778dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
779dnl if test $su_cv_func_ut_host_in_utmp = yes; then
780dnl   AC_DEFINE(HAVE_UT_HOST)
781dnl fi
782
783dnl AC_MSG_CHECKING(if we can get the system boot time)
784dnl AC_CACHE_VAL(su_cv_have_boot_time,
785dnl [AC_EGREP_CPP(yes,
786dnl [#ifdef HAVE_UTMPX_H
787dnl #include <utmpx.h>
788dnl #else
789dnl #include <utmp.h>
790dnl #endif
791dnl #ifdef BOOT_TIME
792dnl yes
793dnl #endif
794dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
795dnl AC_MSG_RESULT($su_cv_have_boot_time)
796
797AC_CACHE_CHECK([for struct rt_msghdr], ac_cv_struct_rt_msghdr,
798[AC_TRY_COMPILE([
799#include <sys/types.h>
800#include <sys/socket.h>
801#include <net/if.h>
802#include <net/route.h>],
803[struct rt_msghdr p;],
804	ac_cv_struct_rt_msghdr=yes,
805	ac_cv_struct_rt_msghdr=no)
806])
807
808if test $ac_cv_struct_rt_msghdr = yes; then
809    AC_DEFINE(HAS_ROUTING_SOCKET, 1, [Do we have a routing socket (struct rt_msghdr)?])
810fi
811
812AC_CACHE_CHECK(
813  [struct sigaction for sa_sigaction],
814  ac_cv_struct_sigaction_has_sa_sigaction,
815  [
816    AC_TRY_COMPILE(
817      [#include <signal.h>],
818      [struct sigaction act; act.sa_sigaction = 0;],
819      ac_cv_struct_sigaction_has_sa_sigaction=yes,
820      ac_cv_struct_sigaction_has_sa_sigaction=no
821    )
822  ]
823)
824if test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then
825  AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION, 1, [Obvious...])
826fi
827
828AC_CACHE_CHECK([for struct ppsclockev], ac_cv_struct_ppsclockev,
829[AC_TRY_COMPILE([
830#include <sys/types.h>
831#ifdef HAVE_SYS_TERMIOS_H
832# include <sys/termios.h>
833#endif
834#ifdef HAVE_SYS_TIME_H
835# include <sys/time.h>
836#endif
837#ifdef HAVE_SYS_PPSCLOCK_H
838# include <sys/ppsclock.h>
839#endif],[
840extern struct ppsclockev *pce;
841return pce->serial;],
842	ac_cv_struct_ppsclockev=yes,
843	ac_cv_struct_ppsclockev=no)
844])
845if test $ac_cv_struct_ppsclockev = yes; then
846    AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV, 1, [Does a system header define struct ppsclockev?])
847fi
848
849AC_CACHE_CHECK([struct sockaddr for sa_len], ac_cv_struct_sockaddr_has_sa_len,
850[AC_TRY_COMPILE([
851#include <sys/types.h>
852#include <sys/socket.h>],[
853extern struct sockaddr *ps;
854return ps->sa_len;],
855	ac_cv_struct_sockaddr_has_sa_len=yes,
856	ac_cv_struct_sockaddr_has_sa_len=no)
857])
858if test $ac_cv_struct_sockaddr_has_sa_len = yes; then
859    AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR, 1, [Should be obvious...])
860fi
861
862AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
863[AC_TRY_COMPILE([
864#include <sys/types.h>
865#include <sys/socket.h>
866#include <netinet/in.h>
867],[
868struct sockaddr_storage n;],
869	ac_cv_struct_sockaddr_storage=yes,
870	ac_cv_struct_sockaddr_storage=no)
871])
872if test $ac_cv_struct_sockaddr_storage = yes; then
873    AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Does a system header define struct sockaddr_storage?])
874fi
875
876AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
877		ac_cv_have_ss_family_in_struct_ss, [
878	AC_TRY_COMPILE(
879		[
880#include <sys/types.h>
881#include <sys/socket.h>
882		],
883		[ struct sockaddr_storage s; s.ss_family = 1; ],
884		[ ac_cv_have_ss_family_in_struct_ss="yes" ],
885		[ ac_cv_have_ss_family_in_struct_ss="no" ],
886	)
887])
888if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
889	AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
890else
891    # Hack around a problem...
892    # HMS: This is $host because we need the -D if we are building *for* it.
893    # HMS: 061029: Now that we separate the ss_* checks this is causing
894    # a problem - disable it until we get to the bottom of it.
895    case "$host" in
896     XXX*-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H"
897	;;
898    esac
899fi
900
901AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
902		ac_cv_have___ss_family_in_struct_ss, [
903	AC_TRY_COMPILE(
904		[
905#include <sys/types.h>
906#include <sys/socket.h>
907		],
908		[ struct sockaddr_storage s; s.__ss_family = 1; ],
909		[ ac_cv_have___ss_family_in_struct_ss="yes" ],
910		[ ac_cv_have___ss_family_in_struct_ss="no" ]
911	)
912])
913if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
914	AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
915fi
916
917AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
918[/* Handle ss_family */
919#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
920# define ss_family __ss_family
921#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
922
923AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
924		ac_cv_have_ss_len_in_struct_ss, [
925	AC_TRY_COMPILE(
926		[
927#include <sys/types.h>
928#include <sys/socket.h>
929		],
930		[ struct sockaddr_storage s; s.ss_len = 1; ],
931		[ ac_cv_have_ss_len_in_struct_ss="yes" ],
932		[ ac_cv_have_ss_len_in_struct_ss="no" ],
933	)
934])
935if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
936	AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len?])
937fi
938
939AC_CACHE_CHECK([for __ss_len field in struct sockaddr_storage],
940		ac_cv_have___ss_len_in_struct_ss, [
941	AC_TRY_COMPILE(
942		[
943#include <sys/types.h>
944#include <sys/socket.h>
945		],
946		[ struct sockaddr_storage s; s.__ss_len = 1; ],
947		[ ac_cv_have___ss_len_in_struct_ss="yes" ],
948		[ ac_cv_have___ss_len_in_struct_ss="no" ]
949	)
950])
951if test "x$ac_cv_have___ss_len_in_struct_ss" = "xyes" ; then
952	AC_DEFINE(HAVE___SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have __ss_len?])
953fi
954
955AH_VERBATIM([X_HAVE_SS_LEN_IN_SS],
956[/* Handle ss_len */
957#if !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE___SS_LEN_IN_SS)
958# define ss_len __ss_len
959#endif /* !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE_SA_LEN_IN_SS) */])
960
961case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
962  *yes*)
963    AC_CACHE_CHECK([for struct snd_size], ac_cv_struct_snd_size,
964[AC_TRY_COMPILE([
965#ifdef HAVE_MACHINE_SOUNDCARD_H
966# include <machine/soundcard.h>
967#endif
968#ifdef HAVE_SYS_SOUNDCARD_H
969# include <sys/soundcard.h>
970#endif],[
971extern struct snd_size *ss;
972return ss->rec_size;],
973    ac_cv_struct_snd_size=yes,
974    ac_cv_struct_snd_size=no)
975])
976    case "$ac_cv_struct_snd_size" in
977     yes) AC_DEFINE(HAVE_STRUCT_SND_SIZE, 1,[Do we have struct snd_size?]) ;;
978    esac
979    ;;
980esac
981
982AC_CACHE_CHECK([struct clockinfo for hz], ac_cv_struct_clockinfo_has_hz,
983[AC_TRY_COMPILE([
984#include <sys/time.h>],[
985extern struct clockinfo *pc;
986return pc->hz;],
987	ac_cv_struct_clockinfo_has_hz=yes,
988	ac_cv_struct_clockinfo_has_hz=no)
989])
990if test $ac_cv_struct_clockinfo_has_hz = yes; then
991    AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
992fi
993
994AC_CACHE_CHECK([struct clockinfo for tickadj], ac_cv_struct_clockinfo_has_tickadj,
995[AC_TRY_COMPILE([
996#include <sys/time.h>],[
997extern struct clockinfo *pc;
998return pc->tickadj;],
999	ac_cv_struct_clockinfo_has_tickadj=yes,
1000	ac_cv_struct_clockinfo_has_tickadj=no)
1001])
1002if test $ac_cv_struct_clockinfo_has_tickadj = yes; then
1003    AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
1004fi
1005
1006AC_CACHE_CHECK([for struct timespec], ac_cv_struct_timespec,
1007[AC_TRY_COMPILE([
1008#include <sys/time.h>
1009/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */
1010#ifdef HAVE_ERRNO_H
1011# include <errno.h>
1012#endif
1013#ifdef HAVE_SYS_TIMEPPS_H
1014# define FRAC 4294967296
1015# include <sys/timepps.h>
1016#endif],
1017[struct timespec n;],
1018ac_cv_struct_timespec=yes, ac_cv_struct_timespec=no)])
1019if test $ac_cv_struct_timespec = yes; then
1020  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Do we have struct timespec?])
1021fi
1022
1023AC_CACHE_CHECK([for struct ntptimeval], ac_cv_struct_ntptimeval,
1024[AC_TRY_COMPILE([
1025#include <sys/time.h>
1026#include <sys/timex.h>],
1027[struct ntptimeval n;],
1028ac_cv_struct_ntptimeval=yes, ac_cv_struct_ntptimeval=no)])
1029if test $ac_cv_struct_ntptimeval = yes; then
1030  AC_DEFINE(HAVE_STRUCT_NTPTIMEVAL, 1, [Do we have struct ntptimeval?])
1031fi
1032
1033AC_CHECK_MEMBERS([struct ntptimeval.time.tv_nsec], , ,
1034[#ifdef HAVE_SYS_TIME_H
1035#include <sys/time.h>
1036#else
1037# ifdef HAVE_TIME_H
1038# include <time.h>
1039# endif
1040#endif
1041#ifdef HAVE_SYS_TIMEX_H
1042#include <sys/timex.h>
1043#else
1044# ifdef HAVE_TIMEX_H
1045# include <timex.h>
1046# endif
1047#endif])
1048
1049AC_C_INLINE
1050
1051case "$ac_cv_c_inline" in
1052 '')
1053    ;;
1054 *)
1055    AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
1056    AC_SUBST(HAVE_INLINE)
1057esac
1058
1059AC_C_CHAR_UNSIGNED		dnl CROSS_COMPILE?
1060AC_CHECK_SIZEOF(signed char)
1061AC_CHECK_SIZEOF(int)
1062AC_CHECK_SIZEOF(long)
1063
1064AC_CHECK_TYPES([s_char])
1065case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
1066 *yes)
1067    # We have a typedef for s_char.  Might as well believe it...
1068    ;;
1069 no0no)
1070    # We have signed chars, can't say 'signed char', no s_char typedef.
1071    AC_DEFINE(NEED_S_CHAR_TYPEDEF, 1, [Do we need an s_char typedef?])
1072    ;;
1073 no1no)
1074    # We have signed chars, can say 'signed char', no s_char typedef.
1075    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1076    ;;
1077 yes0no)
1078    # We have unsigned chars, can't say 'signed char', no s_char typedef.
1079    AC_MSG_ERROR(No way to specify a signed character!)
1080    ;;
1081 yes1no)
1082    # We have unsigned chars, can say 'signed char', no s_char typedef.
1083    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1084    ;;
1085esac
1086AC_TYPE_UID_T
1087
1088case "$host" in
1089 *-*-aix[[456]]*)
1090	# (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
1091	# (returning ENOSYS).  I didn't check 4.2.  If, in the future,
1092	# IBM pulls its thumbs out long enough to implement clock_settime,
1093	# this conditional will need to change.  Maybe use AC_TRY_RUN
1094	# instead to try to set the time to itself and check errno.
1095    ;;
1096 *) AC_CHECK_FUNCS(clock_gettime clock_settime)
1097    ;;
1098esac
1099AC_CHECK_FUNCS(daemon)
1100AC_CHECK_FUNCS(finite, ,
1101  [AC_CHECK_FUNCS(isfinite, ,
1102    [AC_MSG_CHECKING([for isfinite with <math.h>])
1103    _libs=$LIBS
1104    LIBS="$LIBS -lm"
1105    AC_TRY_LINK([#include <math.h>], [float f = 0.0; isfinite(f)],
1106      [AC_MSG_RESULT(yes)
1107      AC_DEFINE(HAVE_ISFINITE)],
1108      AC_MSG_RESULT(no))
1109    LIBS=$_libs])])
1110AC_CHECK_FUNCS(getbootfile getclock getdtablesize)
1111
1112AC_ARG_ENABLE(getifaddrs,
1113    AC_HELP_STRING([--enable-getifaddrs],
1114	[s Enable the use of getifaddrs() [[yes|no|glibc]].
1115glibc: Use getifaddrs() in glibc if you know it supports IPv6.]),
1116    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1117
1118case $want_getifaddrs in
1119yes|glibc)
1120#
1121# Do we have getifaddrs() ?
1122#
1123case $host in
1124*-*linux*)
1125	# Some recent versions of glibc support getifaddrs() which does not
1126	# provide AF_INET6 addresses while the function provided by the USAGI
1127	# project handles the AF_INET6 case correctly.  We need to avoid
1128	# using the former but prefer the latter unless overridden by
1129	# --enable-getifaddrs=glibc.
1130	if test $want_getifaddrs = glibc
1131	then
1132		AC_CHECK_FUNCS(getifaddrs)
1133	else
1134		save_LIBS="$LIBS"
1135		LIBS="-L/usr/local/v6/lib $LIBS"
1136		AC_CHECK_LIB(inet6, getifaddrs,
1137			LIBS="$LIBS -linet6"
1138			AC_DEFINE(HAVE_GETIFADDRS),
1139			LIBS=${save_LIBS})
1140	fi
1141	;;
1142*)
1143	AC_CHECK_FUNCS(getifaddrs)
1144	;;
1145esac
1146;;
1147no)
1148;;
1149esac
1150
1151AC_MSG_CHECKING([type of socklen arg for getsockname()])
1152AC_CACHE_VAL(ac_cv_func_getsockname_arg2,dnl
1153[AC_CACHE_VAL(ac_cv_func_getsockname_socklen_type,dnl
1154 [for ac_cv_func_getsockname_arg2 in 'struct sockaddr *' 'void *'; do
1155  for ac_cv_func_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
1156   AC_TRY_COMPILE(dnl
1157[#ifdef HAVE_SYS_TYPES_H
1158#include <sys/types.h>
1159#endif
1160#ifdef HAVE_SYS_SOCKET_H
1161#include <sys/socket.h>
1162#endif
1163extern getsockname (int, $ac_cv_func_getsockname_arg2, $ac_cv_func_getsockname_socklen_type *);],,dnl
1164    [ac_not_found=no ; break 2], ac_not_found=yes)
1165   done
1166  done
1167 ])dnl AC_CACHE_VAL
1168])dnl AC_CACHE_VAL
1169if test "$ac_not_found" = yes; then
1170 ac_cv_func_getsockname_socklen_type='socklen_t'
1171fi
1172AC_MSG_RESULT([$ac_cv_func_getsockname_socklen_type])
1173AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
1174		   $ac_cv_func_getsockname_socklen_type,
1175		   [What is getsockname()'s socklen type?])
1176
1177AC_CHECK_FUNCS(getrusage)
1178AC_CHECK_FUNC(gettimeofday, ,[
1179case "$host" in
1180  *-*-mpeix*) ac_cv_func_gettimeofday=yes
1181    ;;
1182esac])
1183case "$host" in
1184 *-pc-cygwin*)
1185    ;;
1186 *) AC_CHECK_FUNCS(getuid)
1187    ;;
1188esac
1189AC_CHECK_FUNCS(hstrerror)
1190
1191#
1192# Check for if_nametoindex() for IPv6 scoped addresses support
1193#
1194AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
1195		ac_cv_have_if_nametoindex=no)
1196case $ac_cv_have_if_nametoindex in
1197 no)
1198	case "$host" in
1199  	*-hp-hpux*)
1200  		AC_CHECK_LIB(ipv6, if_nametoindex,
1201				ac_cv_have_if_nametoindex=yes
1202				LIBS="-lipv6 $LIBS",)
1203  	;;
1204	esac
1205esac
1206case $ac_cv_have_if_nametoindex in
1207 yes)
1208	AC_DEFINE(ISC_PLATFORM_HAVEIFNAMETOINDEX, 1, [ISC: do we have if_nametoindex()?])
1209	;;
1210esac
1211
1212AC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])])
1213AC_CHECK_FUNC(inet_pton, [], [AC_DEFINE(ISC_PLATFORM_NEEDPTON, 1, [ISC: provide inet_pton()])])
1214AC_CHECK_FUNC(inet_aton, [], [AC_DEFINE(ISC_PLATFORM_NEEDATON, 1, [ISC: provide inet_aton()])])
1215AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset)
1216case "$host" in
1217 *-*-sco3.2v5.0.*)
1218    # Just stubs.  Idiots.
1219    ;;
1220 *) AC_CHECK_FUNCS(mkstemp)
1221    ;;
1222esac
1223AC_CHECK_FUNCS(mktime)
1224case "$host" in
1225 *-*-aix[[456]]*)
1226    # Just a stub.  Idiots.
1227    ;;
1228 *-*-irix[[45]]*)
1229    # Just a stub in "old" Irix.  Idiots.
1230    ;;
1231 *-*-*linux*)
1232    # there, but more trouble than it is worth for now (resolver problems)
1233    ;;
1234 *-*-qnx*)
1235    # Apparently there but not working in QNX.  Idiots?
1236    ;;
1237 *-*-sco3.2v5.0.*)
1238    # Just a stub.  Idiots.
1239    ;;
1240 alpha*-dec-osf4*|alpha*-dec-osf5*)
1241    # mlockall is there, as a #define calling memlk via <sys/mman.h>
1242    # Not easy to test for - cheat.
1243    AC_CHECK_FUNCS(memlk, [ac_cv_func_mlockall='yes'])
1244    AC_CHECK_FUNCS(mlockall)
1245    ;;
1246 *) AC_CHECK_FUNCS(mlockall)
1247    ;;
1248esac
1249AC_CHECK_FUNCS(nice nlist)
1250case "$host" in
1251 *-*-solaris2.6)
1252    # Broken...
1253    ;;
1254 *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime)
1255    ;;
1256esac
1257AC_CHECK_FUNCS(plock pututline pututxline readlink recvmsg rtprio)
1258case "$host" in
1259 *-*-aix[[456]]*)
1260    # Just a stub in AIX 4.  Idiots.
1261    ;;
1262 *-*-solaris2.5*)
1263    # Just stubs in solaris2.5.  Idiots.
1264    ;;
1265 *) AC_CHECK_FUNCS(sched_setscheduler)
1266    ;;
1267esac
1268AC_CHECK_FUNCS(setlinebuf setpgid setpriority setsid)
1269AC_CHECK_FUNCS(setrlimit)
1270AC_CHECK_FUNCS(settimeofday, ,[
1271case "$host" in
1272  *-*-mpeix*) ac_cv_func_settimeofday=yes
1273    ;;
1274esac])
1275AC_CHECK_FUNCS(setvbuf sigaction)
1276AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
1277AC_CHECK_FUNCS(snprintf strdup strerror strstr)
1278AC_CHECK_FUNCS(timegm)
1279case "$host" in
1280 *-*-aix[[456]]*)
1281    # Just stubs.  Idiots.
1282    ;;
1283 *-*-netbsd1*)
1284    # Just stubs.  Idiots.
1285    ;;
1286 *-*-netbsdelf1*)
1287    # Just stubs.  Idiots.
1288    ;;
1289 *-*-openbsd*)
1290    # Just stubs.  Idiots.
1291    ;;
1292 *) AC_CHECK_FUNCS(timer_create timer_settime)
1293    ;;
1294esac
1295case "$host" in
1296 *-pc-cygwin*)
1297    # I have no idea...
1298    ;;
1299 *) AC_CHECK_FUNCS(umask)
1300    ;;
1301esac
1302AC_CHECK_FUNCS(uname updwtmp updwtmpx vsnprintf vsprintf)
1303
1304###
1305
1306# http://bugs.ntp.org/737
1307case "$ac_cv_func_recvmsg" in
1308 yes)
1309 AC_MSG_CHECKING([if we need extra help to define struct iovec])
1310 AC_CACHE_VAL(ac_cv_struct_iovec_help,dnl
1311 [for ac_cv_struct_iovec_help in '0' '1'; do
1312   AC_TRY_COMPILE(dnl
1313[#ifdef HAVE_SYS_TYPES_H
1314#include <sys/types.h>
1315#endif
1316#ifdef HAVE_SYS_SOCKET_H
1317#include <sys/socket.h>
1318#endif
1319#if $ac_cv_struct_iovec_help
1320#include <sys/uio.h>
1321#endif
1322
1323void foo();
1324void foo() {
1325	ssize_t x;
1326	int s = 0;
1327	struct iovec iov;
1328	struct msghdr mh;
1329	int flags = 0;
1330
1331	mh.msg_iov = &iov;
1332	x = recvmsg(s, &mh, flags);
1333}],,dnl
1334  [ac_worked=yes ; break 1], ac_worked=no)
1335  done
1336])dnl AC_CACHE_VAL
1337    case "$ac_worked$ac_cv_struct_iovec_help" in
1338     yes1)
1339	AC_DEFINE(HAVE_SYS_UIO_H, 1, [Use sys/uio.h for struct iovec help])
1340	ans=yes
1341	;;
1342     *) ans=no
1343    esac
1344    AC_MSG_RESULT([$ans])
1345    ;;
1346esac
1347
1348case "$host" in
1349 *-*-sunos4*)
1350    AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*])
1351    ;;
1352esac
1353
1354AC_CACHE_CHECK([number of arguments to gettimeofday()], ac_cv_func_Xettimeofday_nargs,
1355[AC_TRY_COMPILE([#include <sys/time.h>],[
1356gettimeofday((struct timeval*)0,(struct timezone*)0);
1357settimeofday((struct timeval*)0,(struct timezone*)0);
1358],
1359	ac_cv_func_Xettimeofday_nargs=2, ac_cv_func_Xettimeofday_nargs=1)
1360])
1361if test $ac_cv_func_Xettimeofday_nargs = 1; then
1362	AC_DEFINE(SYSV_TIMEOFDAY, 1, [Does Xettimeofday take 1 arg?])
1363fi
1364
1365AC_CACHE_CHECK([number of arguments taken by setpgrp()], ac_cv_func_setpgrp_nargs,
1366[AC_TRY_COMPILE([
1367#ifdef HAVE_SYS_TYPES_H
1368# include <sys/types.h>
1369#endif
1370#ifdef HAVE_UNISTD_H
1371# include <unistd.h>
1372#endif
1373],[setpgrp(0,0);],
1374        ac_cv_func_setpgrp_nargs=2, ac_cv_func_setpgrp_nargs=0)
1375])
1376if test $ac_cv_func_setpgrp_nargs = 0; then
1377        AC_DEFINE(HAVE_SETPGRP_0, 1, [define if setpgrp takes 0 arguments])
1378fi
1379
1380save_CFLAGS=$CFLAGS
1381CFLAGS="$CFLAGS -I$srcdir/include"
1382
1383AC_CACHE_CHECK([argument pointer type of qsort()'s compare function and base],
1384ac_cv_func_qsort_argtype,
1385[AC_TRY_COMPILE([
1386#include "l_stdlib.h"
1387
1388#ifdef HAVE_PROTOTYPES
1389#define P(x) x
1390#else
1391#define P(x) ()
1392#endif
1393
1394extern void *base;
1395extern sortfunc P((const void *, const void *));
1396int sortfunc(a, b)
1397  const void *a;
1398  const void *b; { return 0; }
1399],[
1400qsort(base, 2, sizeof(char *), sortfunc);
1401],
1402	ac_cv_func_qsort_argtype=void, ac_cv_func_qsort_argtype=char)
1403])
1404case "$ac_cv_func_qsort_argtype" in
1405 void)
1406    AC_DEFINE(QSORT_USES_VOID_P, 1, [Does qsort expect to work on "void *" stuff?])
1407    ;;
1408esac
1409
1410CFLAGS=$save_CFLAGS
1411
1412AC_CACHE_CHECK([if we need to declare 'errno'], ac_cv_decl_errno,
1413[AC_TRY_COMPILE([#ifdef HAVE_ERRNO_H
1414#include <errno.h>
1415#endif],
1416  [errno = 0;],
1417  ac_cv_decl_errno=no, ac_cv_decl_errno=yes)])
1418case "$ac_cv_decl_errno" in
1419 yes) AC_DEFINE(DECL_ERRNO, 1, [Declare errno?]) ;;
1420esac
1421
1422dnl FIXME: from ntpd/ntp_intres.c, but there's no info which header produces
1423dnl the clash.  <resolv.h> isn't currently used.
1424dnl
1425dnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1426dnl MT purposes.  This makes the line "extern int h_errno" choke
1427dnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1428dnl without breaking any other platforms.
1429dnl
1430AC_CACHE_CHECK([if we may declare 'h_errno'], ac_cv_decl_h_errno,
1431[AC_TRY_COMPILE([#include <sys/types.h>
1432#ifdef HAVE_NETINET_IN_H
1433#include <netinet/in.h>
1434#endif
1435#ifdef HAVE_ARPA_NAMESER_H
1436#include <arpa/nameser.h>
1437#endif
1438#ifdef HAVE_NETDB_H
1439#include <netdb.h>
1440#endif
1441#ifdef HAVE_RESOLV_H
1442#include <resolv.h>
1443#endif],
1444  [extern int h_errno;],
1445  ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)])
1446case "$ac_cv_decl_h_errno" in
1447 yes) AC_DEFINE(DECL_H_ERRNO, 1, [Declare h_errno?]) ;;
1448esac
1449
1450dnl See if char *sys_errlist[] is OK.
1451AC_CACHE_CHECK([[if declaring 'char *sys_errlist[]' is ok]], ac_cv_decl_sys_errlist,
1452[AC_TRY_COMPILE([#include <stdio.h>
1453#ifdef HAVE_ERRNO_H
1454#include <errno.h>
1455#endif],
1456  [extern char *sys_errlist[];
1457],
1458  ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])
1459case "$ac_cv_decl_sys_errlist" in
1460 yes) AC_DEFINE(CHAR_SYS_ERRLIST, 1, [Declare char *sys_errlist array]) ;;
1461esac
1462
1463AC_CACHE_CHECK([if declaring 'syscall()' is ok], ac_cv_decl_syscall,
1464[AC_TRY_COMPILE([
1465#ifdef HAVE_SYS_TYPES_H
1466# include <sys/types.h>
1467#endif
1468#ifdef HAVE_UNISTD_H
1469# include <unistd.h>
1470#endif
1471#ifdef HAVE_PROTOTYPES
1472#define P(x) x
1473#else
1474#define P(x) ()
1475#endif
1476],
1477  [extern int syscall P((int, ...));],
1478  ac_cv_decl_syscall=yes, ac_cv_decl_syscall=no)])
1479case "$ac_cv_decl_syscall" in
1480 yes) AC_DEFINE(DECL_SYSCALL, 1, [Declare syscall()?]) ;;
1481esac
1482
1483case "$host" in
1484 *-*-aix4.3.*)
1485    AC_DEFINE(DECL_HSTRERROR_0, 1, [Declaration style])		# Needed for XLC under AIX 4.3.2
1486    ;;
1487 *-*-mpeix*)
1488    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1489    AC_DEFINE(DECL_INET_NTOA_0, 1, [Declaration style])
1490    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1491    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1492    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1493    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1494    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1495    ;;
1496 *-*-osf[[45]]*)
1497    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1498    AC_DEFINE(DECL_STIME_1, 1, [Declaration style])
1499    ;;
1500 *-*-qnx*)
1501    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1502    ;;
1503 *-*-riscos4*)
1504    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1505    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1506    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1507    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1508    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1509    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1510    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1511    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1512    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1513    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1514    AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1515    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1516    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1517    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1518    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1519    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1520    ;;
1521 *-*-solaris2*)
1522    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1523    AC_DEFINE(DECL_SETPRIORITY_1, 1, [Declaration style])
1524    case "$host" in
1525     *-*-solaris2.4)
1526        AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1527	;;
1528    esac
1529    ;;
1530 *-*-sunos4*)
1531    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1532    AC_DEFINE(DECL_BCOPY_0, 1, [Declaration style])
1533    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1534    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1535    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1536    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1537    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1538    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1539    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1540    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1541    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1542    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1543    AC_DEFINE(DECL_SIGVEC_0, 1, [Declaration style])
1544    case "`basename $ac_cv_prog_CC`" in
1545     acc*) ;;
1546     *) AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1547	;;
1548    esac
1549    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1550    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1551    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1552    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1553    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1554    AC_DEFINE(DECL_TOUPPER_0, 1, [Declaration style])
1555    AC_DEFINE(DECL_STRERROR_0, 1, [Declaration style])
1556    ;;
1557 *-*-ultrix4*)
1558    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1559    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1560    AC_DEFINE(DECL_CFSETISPEED_0, 1, [Declaration style])
1561    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1562    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1563    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1564    AC_DEFINE(DECL_NLIST_0, 1, [Declaration style])
1565    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1566    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1567    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1568    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1569    AC_DEFINE(DECL_STIME_0, 1, [Declaration style])
1570    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1571    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1572    ;;
1573esac
1574
1575case "$host" in
1576 *-*-sco3.2*)
1577    AC_DEFINE(TERMIOS_NEEDS__SVID3, 1, [Do we need to #define _SVID3 when we #include <termios.h>?])
1578    ;;
1579esac
1580
1581AC_CACHE_CHECK([if we need extra room for SO_RCVBUF], ac_cv_var_rcvbuf_slop,
1582[ans=no
1583case "$host" in
1584 *-*-hpux[[567]]*)
1585    ans=yes
1586    ;;
1587esac
1588ac_cv_var_rcvbuf_slop=$ans])
1589case "$ac_cv_var_rcvbuf_slop" in
1590 yes) AC_DEFINE(NEED_RCVBUF_SLOP, 1, [Do we need extra room for SO_RCVBUF? (HPUX <8)]) ;;
1591esac
1592
1593AC_CACHE_CHECK([if we will open the broadcast socket], ac_cv_var_open_bcast_socket,
1594[ans=yes
1595case "$host" in
1596 *-*-domainos)
1597    ans=no
1598    ;;
1599esac
1600ac_cv_var_open_bcast_socket=$ans])
1601case "$ac_cv_var_open_bcast_socket" in
1602 yes) AC_DEFINE(OPEN_BCAST_SOCKET, 1, [Should we open the broadcast socket?]) ;;
1603esac
1604
1605AC_CACHE_CHECK([if we want the HPUX version of FindConfig()], ac_cv_var_hpux_findconfig,
1606[ans=no
1607case "$host" in
1608 *-*-hpux*)
1609    ans=yes
1610    ;;
1611esac
1612ac_cv_var_hpux_findconfig=$ans])
1613case "$ac_cv_var_hpux_findconfig" in
1614 yes) AC_DEFINE(NEED_HPUX_FINDCONFIG, 1, [Do we want the HPUX FindConfig()?]) ;;
1615esac
1616
1617AC_CACHE_CHECK([if process groups are set with -pid], ac_cv_arg_setpgrp_negpid,
1618[case "$host" in
1619 *-*-hpux[[567]]*)
1620    ans=no
1621    ;;
1622 *-*-hpux*)
1623    ans=yes
1624    ;;
1625 *-*-*linux*)
1626    ans=yes
1627    ;;
1628 *-*-sunos3*)
1629    ans=yes
1630    ;;
1631 *-*-ultrix2*)
1632    ans=yes
1633    ;;
1634 *)
1635    ans=no
1636    ;;
1637esac
1638ac_cv_arg_setpgrp_negpid=$ans])
1639case "$ac_cv_arg_setpgrp_negpid" in
1640 yes) AC_DEFINE(UDP_BACKWARDS_SETOWN, 1, [Do we set process groups with -pid?]) ;;
1641esac
1642
1643AC_CACHE_CHECK([if we need a ctty for F_SETOWN], ac_cv_func_ctty_for_f_setown,
1644[[case "$host" in
1645 *-*-bsdi[23]*)
1646    ans=yes
1647    ;;
1648 *-*-freebsd*)
1649    ans=yes
1650    ;;
1651 *-*-netbsd*3.[0-8]*|*-*-netbsd*[0-2].*|*-*-netbsd*3.99.[0-7])
1652    ans=yes
1653    ;;
1654 *-*-openbsd*)
1655    ans=yes
1656    ;;
1657 *-*-osf*)
1658    ans=yes
1659    ;;
1660 *-*-darwin*)
1661    ans=yes
1662    ;;
1663 *) ans=no
1664    ;;
1665esac
1666ac_cv_func_ctty_for_f_setown=$ans]])
1667case "$ac_cv_func_ctty_for_f_setown" in
1668 yes) AC_DEFINE(USE_FSETOWNCTTY, 1, [Must we have a CTTY for fsetown?]) ;;
1669esac
1670
1671AC_CACHE_CHECK([if the OS fails to clear cached routes when more specific routes become available], ac_cv_os_routeupdates,
1672[[case "$host" in
1673 *-*-netbsd*)
1674    ans=yes
1675    ;;
1676 *) ans=no
1677    ;;
1678esac
1679ac_cv_os_routeupdates=$ans]])
1680case "$ac_cv_os_routeupdates" in
1681 yes) AC_DEFINE(OS_MISSES_SPECIFIC_ROUTE_UPDATES, 1, [need to recreate sockets on changed routing?]) ;;
1682esac
1683
1684AC_CACHE_CHECK([if the OS needs the wildcard socket set to REUSEADDR for binding interface addresses], ac_cv_os_wildcardreuse,
1685[[case "$host" in
1686 *-*-*linux*)
1687    ans=yes
1688    ;;
1689 *) ans=no
1690    ;;
1691esac
1692ac_cv_os_wildcardreuse=$ans]])
1693case "$ac_cv_os_wildcardreuse" in
1694 yes) AC_DEFINE(OS_NEEDS_REUSEADDR_FOR_IFADDRBIND, 1, [wildcard socket needs to set REUSEADDR when binding to interface addresses]) ;;
1695esac
1696
1697ntp_warning='GRONK'
1698AC_MSG_CHECKING([if we'll use clock_settime or settimeofday or stime])
1699case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
1700 yes*)
1701    ntp_warning=''
1702    ans='clock_settime()'
1703    ;;
1704 noyes*)
1705    ntp_warning='But clock_settime() would be better (if we had it)'
1706    ans='settimeofday()'
1707    ;;
1708 nonoyes)
1709    ntp_warning='Which is the worst of the three'
1710    ans='stime()'
1711    ;;
1712 *)
1713    case "$build" in
1714     $host) ntp_warning='Which leaves us with nothing to use!'
1715    ans=none
1716    ;;
1717esac
1718esac
1719AC_MSG_RESULT([$ans])
1720case "$ntp_warning" in
1721 '') ;;
1722 *) AC_MSG_WARN([*** $ntp_warning ***])
1723    ;;
1724esac
1725
1726AC_CACHE_CHECK([if we have a losing syscall()], ac_cv_var_syscall_bug,
1727[case "$host" in
1728 *-*-solaris2.4*)
1729    ans=yes
1730    ;;
1731 *) ans=no
1732    ;;
1733esac
1734ac_cv_var_syscall_bug=$ans])
1735case "$ac_cv_var_syscall_bug" in
1736 yes) AC_DEFINE(SYSCALL_BUG, 1, [Buggy syscall() (Solaris2.4)?]) ;;
1737esac
1738
1739AC_CACHE_CHECK([for SIGIO], ac_cv_hdr_def_sigio,
1740 AC_EGREP_CPP(yes,
1741  [#include <signal.h>
1742#ifdef SIGIO
1743   yes
1744#endif
1745  ], ac_cv_hdr_def_sigio=yes, ac_cv_hdr_def_sigio=no))
1746
1747dnl Override those system that have a losing SIGIO
1748AC_CACHE_CHECK([if we want to use signalled IO], ac_cv_var_signalled_io,
1749[ans=no
1750case "$ac_cv_hdr_def_sigio" in
1751 yes)
1752    ans=yes
1753    case "$host" in
1754     alpha*-dec-osf4*|alpha*-dec-osf5*)
1755        ans=no
1756        ;;
1757     *-convex-*)
1758        ans=no
1759        ;;
1760     *-dec-*)
1761        ans=no
1762        ;;
1763     *-pc-cygwin*)
1764	ans=no
1765	;;
1766     *-sni-sysv*)
1767        ans=no
1768        ;;
1769     *-univel-sysv*)
1770        ans=no
1771	;;
1772     *-*-irix6*)
1773	ans=no
1774	;;
1775     *-*-freebsd*)
1776	ans=no
1777	;;
1778     *-*-*linux*)
1779	ans=no
1780	;;
1781     *-*-unicosmp*)
1782	ans=no
1783	;;
1784    esac
1785    ;;
1786esac
1787ac_cv_var_signalled_io=$ans])
1788case "$ac_cv_var_signalled_io" in
1789 yes) AC_DEFINE(HAVE_SIGNALED_IO, 1, [Can we use SIGIO for tcp and udp IO?]) ;;
1790esac
1791
1792AC_CACHE_CHECK([for SIGPOLL], ac_cv_hdr_def_sigpoll,
1793 AC_EGREP_CPP(yes,
1794 [#include <signal.h>
1795#ifdef SIGPOLL
1796  yes
1797#endif
1798 ], ac_cv_hdr_def_sigpoll=yes, ac_cv_hdr_def_sigpoll=no))
1799
1800AC_CACHE_CHECK([for SIGSYS], ac_cv_hdr_def_sigsys,
1801 AC_EGREP_CPP(yes,
1802 [#include <signal.h>
1803#ifdef SIGSYS
1804  yes
1805#endif
1806 ], ac_cv_hdr_def_sigsys=yes, ac_cv_hdr_def_sigsys=no))
1807
1808AC_CACHE_CHECK([if we can use SIGPOLL for UDP I/O], ac_cv_var_use_udp_sigpoll,
1809[ans=no
1810case "$ac_cv_hdr_def_sigpoll" in
1811 yes)
1812    case "$host" in
1813     mips-sgi-irix*)
1814	ans=no
1815	;;
1816     vax-dec-bsd)
1817        ans=no
1818        ;;
1819     *-pc-cygwin*)
1820	ans=no
1821	;;
1822     *-sni-sysv*)
1823        ans=no
1824        ;;
1825     *-*-aix[[456]]*)
1826        ans=no
1827        ;;
1828     *-*-hpux*)
1829        ans=no
1830        ;;
1831     *-*-*linux*)
1832	ans=no
1833	;;
1834     *-*-osf*)
1835        ans=no
1836        ;;
1837     *-*-qnx*)
1838        ans=no
1839        ;;
1840     *-*-sunos*)
1841	ans=no
1842	;;
1843     *-*-solaris*)
1844	ans=no
1845	;;
1846     *-*-ultrix*)
1847        ans=no
1848        ;;
1849     *-*-unicosmp*)
1850        ans=no
1851        ;;
1852     *) ans=yes
1853        ;;
1854    esac
1855    ;;
1856esac
1857ac_cv_var_use_udp_sigpoll=$ans])
1858case "$ac_cv_var_use_udp_sigpoll" in
1859 yes) AC_DEFINE(USE_UDP_SIGPOLL, 1, [Can we use SIGPOLL for UDP?]) ;;
1860esac
1861
1862AC_CACHE_CHECK([if we can use SIGPOLL for TTY I/O], ac_cv_var_use_tty_sigpoll,
1863[ans=no
1864case "$ac_cv_hdr_def_sigpoll" in
1865 yes)
1866    case "$host" in
1867     mips-sgi-irix*)
1868        ans=no
1869        ;;
1870     vax-dec-bsd)
1871        ans=no
1872        ;;
1873     *-pc-cygwin*)
1874	ans=no
1875	;;
1876     *-sni-sysv*)
1877        ans=no
1878        ;;
1879     *-*-aix[[456]]*)
1880	ans=no
1881	;;
1882     *-*-hpux*)
1883        ans=no
1884        ;;
1885     *-*-*linux*)
1886	ans=no
1887	;;
1888     *-*-osf*)
1889        ans=no
1890        ;;
1891     *-*-sunos*)
1892	ans=no
1893	;;
1894     *-*-ultrix*)
1895        ans=no
1896        ;;
1897     *-*-qnx*)
1898        ans=no
1899        ;;
1900     *-*-unicosmp*)
1901        ans=no
1902        ;;
1903     *) ans=yes
1904        ;;
1905    esac
1906    ;;
1907esac
1908ac_cv_var_use_tty_sigpoll=$ans])
1909case "$ac_cv_var_use_tty_sigpoll" in
1910 yes) AC_DEFINE(USE_TTY_SIGPOLL, 1, [Can we use SIGPOLL for tty IO?]) ;;
1911esac
1912
1913case "$ac_cv_header_sys_sio_h" in
1914 yes)
1915    AC_CACHE_CHECK([sys/sio.h for TIOCDCDTIMESTAMP], ac_cv_hdr_def_tiocdcdtimestamp,
1916     AC_EGREP_CPP(yes,
1917[#include <sys/sio.h>
1918#ifdef TIOCDCDTIMESTAMP
1919  yes
1920#endif
1921     ], ac_cv_hdr_def_tiocdcdtimestamp=yes, ac_cv_hdr_def_tiocdcdtimestamp=no))
1922    ;;
1923esac
1924
1925case "$ac_cv_hdr_def_tiocdcdtimestamp" in
1926 yes)
1927    ac_cv_var_oncore_ok=yes
1928    ;;
1929esac
1930
1931AC_CACHE_CHECK([if nlist() values might require extra indirection],
1932ac_cv_var_nlist_extra_indirection,
1933[ans=no
1934case "$host" in
1935 *-*-aix*)
1936    ans=yes
1937    ;;
1938esac
1939ac_cv_var_nlist_extra_indirection=$ans])
1940case "$ac_cv_var_nlist_extra_indirection" in
1941 yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION, 1, [Might nlist() values require an extra level of indirection (AIX)?]) ;;
1942esac
1943
1944AC_CACHE_CHECK([for a minimum recommended value of tickadj],
1945ac_cv_var_min_rec_tickadj,
1946[ans=no
1947case "$host" in
1948 *-*-aix*)
1949    ans=40
1950    ;;
1951esac
1952ac_cv_var_min_rec_tickadj=$ans])
1953case "$ac_cv_var_min_rec_tickadj" in
1954 ''|no) ;;
1955 *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj, [Should we recommend a minimum value for tickadj?]) ;;
1956esac
1957
1958AC_CACHE_CHECK([if the TTY code permits PARENB and IGNPAR],
1959ac_cv_var_no_parenb_ignpar,
1960[ans=no
1961case "$host" in
1962 i?86-*-*linux*)
1963    ans=yes
1964    ;;
1965 mips-sgi-irix*)
1966    ans=yes
1967    ;;
1968 i?86-*-freebsd[[123]].*)
1969    ;;
1970 i?86-*-freebsd*)
1971    ans=yes
1972    ;;
1973 *-*-unicosmp*)
1974    ans=yes
1975    ;;
1976esac
1977ac_cv_var_no_parenb_ignpar=$ans])
1978case "$ac_cv_var_no_parenb_ignpar" in
1979 yes) AC_DEFINE(NO_PARENB_IGNPAR, 1, [Is there a problem using PARENB and IGNPAR (IRIX)?]) ;;
1980esac
1981
1982AC_MSG_CHECKING([if we're including debugging code])
1983AC_ARG_ENABLE(debugging,
1984   AC_HELP_STRING([--enable-debugging], [+ include debugging code]),
1985    [ntp_ok=$enableval], [ntp_ok=yes])
1986if test "$ntp_ok" = "yes"; then
1987    AC_DEFINE(DEBUG, 1, [Enable debugging?])
1988fi
1989AC_MSG_RESULT($ntp_ok)
1990
1991AC_MSG_CHECKING([if we including processing time debugging code])
1992AC_ARG_ENABLE(debug-timing,
1993   AC_HELP_STRING([--enable-debug-timing], [- include processing time debugging code (costs performance)]),
1994    [ntp_ok=$enableval], [ntp_ok=no])
1995if test "$ntp_ok" = "yes"; then
1996    AC_DEFINE(DEBUG_TIMING, 1, [Enable processing time debugging?])
1997fi
1998AC_MSG_RESULT($ntp_ok)
1999
2000AC_MSG_CHECKING([[for a the number of minutes in a DST adjustment]])
2001AC_ARG_ENABLE(
2002    [dst_minutes],
2003    AS_HELP_STRING(
2004	[--enable-dst-minutes],
2005	[n minutes per DST adjustment @<:@60@:>@]	dnl @<:@ is [
2006    ),
2007    [ans=$enableval],
2008    [ans=60]
2009)
2010AC_DEFINE_UNQUOTED(DSTMINUTES, $ans, [The number of minutes in a DST adjustment])
2011AC_MSG_RESULT([$ans])
2012
2013AC_MSG_CHECKING([[if ntpd will retry on permanent DNS errors]])
2014AC_ARG_ENABLE(
2015    [ignore-dns-errors],
2016    AS_HELP_STRING(
2017	[--enable-ignore-dns-errors],
2018	[- retry DNS queries on any error]
2019    ),
2020    [ans=$enableval],
2021    [ans=no]
2022)
2023case "$ans" in
2024 yes)
2025    AC_DEFINE(IGNORE_DNS_ERRORS, 1, [[Retry queries on _any_ DNS error?]])
2026esac
2027AC_MSG_RESULT([$ans])
2028
2029AC_CACHE_CHECK([if we have the tty_clk line discipline/streams module],
2030 ac_cv_var_tty_clk,
2031 [case "$ac_cv_header_sys_clkdefs_h$ac_cv_hdr_def_tiocdcdtimestamp" in
2032  *yes*) ac_cv_var_tty_clk=yes ;;
2033  *)     ac_cv_var_tty_clk=no ;;
2034 esac])
2035case "$ac_cv_var_tty_clk" in
2036 yes) AC_DEFINE(TTYCLK, 1, [Do we have the tty_clk line discipline/streams module?]) ;;
2037esac
2038
2039AC_CACHE_CHECK([for the ppsclock streams module],
2040 ac_cv_var_ppsclock,
2041 ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev)
2042case "$ac_cv_var_ppsclock" in
2043 yes) AC_DEFINE(PPS, 1, [Do we have the ppsclock streams module?]) ;;
2044esac
2045
2046AC_CACHE_CHECK([for kernel multicast support], ac_cv_var_mcast,
2047  [ac_cv_var_mcast=no
2048  case "$host" in
2049   i386-sequent-sysv4) ;;
2050   *) AC_EGREP_CPP(yes,
2051  [#include <netinet/in.h>
2052#ifdef IP_ADD_MEMBERSHIP
2053   yes
2054#endif
2055  ], ac_cv_var_mcast=yes) ;;
2056  esac])
2057case "$ac_cv_var_mcast" in
2058 yes)
2059    AC_DEFINE(MCAST, 1, [Does the kernel support multicasting IP?])
2060    AC_CACHE_CHECK([[arg type needed for IP*_MULTICAST_LOOP for setsockopt()]],
2061	ac_cv_var_typeof_ip_multicast_loop,
2062	[case "$host" in
2063	 *-*-netbsd*|*-*-*linux*)
2064	    ac_cv_var_typeof_ip_multicast_loop=u_int
2065	    ;;
2066	 *-*-winnt*)
2067	    ac_cv_var_typeof_ip_multicast_loop=BOOL
2068	    ;;
2069	 *) ac_cv_var_typeof_ip_multicast_loop=u_char
2070	    ;;
2071	esac])
2072    AC_DEFINE_UNQUOTED(TYPEOF_IP_MULTICAST_LOOP,
2073		   $ac_cv_var_typeof_ip_multicast_loop,
2074		   [What type to use for setsockopt])
2075    ;;
2076esac
2077
2078AC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls,
2079 [ac_cv_var_ntp_syscalls=no
2080 case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
2081  yesyes*)
2082    ac_cv_var_ntp_syscalls=libc
2083    ;;
2084  *yes)
2085    ac_cv_var_ntp_syscalls=inline
2086    ;;
2087  *) AC_EGREP_CPP(yes,
2088         [#include <sys/syscall.h>
2089#if defined(SYS_ntp_gettime) && defined(SYS_ntp_adjtime)
2090           yes
2091#endif
2092          ], ac_cv_var_ntp_syscalls=kernel)
2093    ;;
2094 esac])
2095case "$ac_cv_var_ntp_syscalls" in
2096 libc)
2097    AC_DEFINE(NTP_SYSCALLS_LIBC, 1, [Do we have ntp_{adj,get}time in libc?])
2098    ;;
2099 kernel)
2100    AC_DEFINE(NTP_SYSCALLS_STD, 1, [Do we have ntp_{adj,get}time in the kernel?])
2101    ;;
2102 *)
2103    ;;
2104esac
2105
2106AC_CACHE_CHECK(if sys/timex.h has STA_FLL, ac_cv_var_sta_fll,
2107[AC_EGREP_CPP(yes,
2108    [#include <sys/timex.h>
2109#ifdef STA_FLL
2110    yes
2111#endif
2112    ], ac_cv_var_sta_fll=yes, ac_cv_var_sta_fll=no)])
2113
2114AC_CACHE_CHECK(if we have kernel PLL support, ac_cv_var_kernel_pll,
2115[dnl ac_cv_var_ntp_syscalls is {no,libc,kernel}
2116case "$ac_cv_header_sys_timex_h$ac_cv_struct_ntptimeval$ac_cv_var_sta_fll$ac_cv_var_ntp_syscalls" in
2117 *no*)
2118    ac_cv_var_kernel_pll=no
2119    ;;
2120 *) ac_cv_var_kernel_pll=yes
2121    ;;
2122esac])
2123case "$ac_cv_var_kernel_pll" in
2124 yes)
2125    AC_DEFINE(KERNEL_PLL, 1, [Does the kernel support precision time discipline?])
2126    ;;
2127esac
2128
2129AC_CACHE_CHECK(if SIOCGIFCONF returns buffer size in the buffer, ac_cv_var_size_returned_in_buffer,
2130  [ans=no
2131  case "$host" in
2132   *-fujitsu-uxp*)
2133      ans=yes
2134      ;;
2135   *-ncr-sysv4*)
2136      ans=yes
2137      ;;
2138   *-univel-sysv*)
2139      ans=yes
2140      ;;
2141  esac
2142  ac_cv_var_size_returned_in_buffer=$ans])
2143case "$ac_cv_var_size_returned_in_buffer" in
2144 yes) AC_DEFINE(SIZE_RETURNED_IN_BUFFER, 1, [Does SIOCGIFCONF return size in the buffer?]) ;;
2145esac
2146
2147dnl    vvvvv-- this is wrong, if you re-enable the switch do not cache the result
2148dnl AC_CACHE_CHECK(if we want GDT surveying code, ac_cv_var_gdt_surveying,
2149dnl [AC_ARG_ENABLE(gdt-surveying,	[  --enable-gdt-surveying   - include GDT survey code],
2150dnl     [ans=$enableval], [ans=no])
2151dnl ac_cv_var_gdt_surveying=$ans])
2152dnl case "$ac_cv_var_gdt_surveying" in
2153dnl  yes) AC_DEFINE(GDT_SURVEYING, 1, [Include the GDT Surveying code?]) ;;
2154dnl esac
2155
2156# Check for ioctls TIOCGPPSEV
2157AC_MSG_CHECKING(ioctl TIOCGPPSEV)
2158if test "$ac_cv_header_termios_h" = "yes"; then
2159    AC_EGREP_CPP(yes,
2160    [#include <termios.h>
2161#ifdef TIOCGPPSEV
2162         yes
2163#endif
2164	 ], ntp_ok=yes, ntp_ok=no)
2165else
2166ntp_ok=no
2167fi
2168if test "$ntp_ok" = "yes"; then
2169    AC_DEFINE(HAVE_TIOCGPPSEV, 1, [Do we have the TIOCGPPSEV ioctl (Solaris)?])
2170    ac_cv_var_oncore_ok=yes
2171fi
2172AC_MSG_RESULT($ntp_ok)
2173
2174# Check for ioctls TIOCSPPS
2175AC_MSG_CHECKING(ioctl TIOCSPPS)
2176if test "$ac_cv_header_termios_h" = "yes"; then
2177    AC_EGREP_CPP(yes,
2178    [#include <termios.h>
2179#ifdef TIOCSPPS
2180         yes
2181#endif
2182	 ], ntp_ok=yes, ntp_ok=no)
2183else
2184    ntp_ok=no
2185fi
2186
2187if test "$ntp_ok" = "yes"; then
2188    AC_DEFINE(HAVE_TIOCSPPS, 1, [Do we have the TIOCSPPS ioctl (Solaris)?])
2189fi
2190AC_MSG_RESULT($ntp_ok)
2191
2192# Check for ioctls CIOGETEV
2193AC_MSG_CHECKING([ioctl CIOGETEV])
2194if test "$ac_cv_header_sys_ppsclock_h" = "yes"; then
2195    AC_EGREP_CPP(yes,
2196    [#include <sys/ppsclock.h>
2197#ifdef CIOGETEV
2198         yes
2199#endif
2200	 ], ntp_ok=yes, ntp_ok=no)
2201else
2202ntp_ok=no
2203fi
2204if test "$ntp_ok" = "yes"; then
2205    ac_cv_var_oncore_ok=yes
2206    AC_DEFINE(HAVE_CIOGETEV, 1, [Do we have the CIOGETEV ioctl (SunOS, Linux)?])
2207fi
2208AC_MSG_RESULT($ntp_ok)
2209
2210
2211# ATOM/PPSAPI stuff.
2212
2213# ATOM used to require struct timespec, but that's been fixed now.
2214
2215# case "$ac_cv_struct_timespec" in
2216#  'yes')
2217#     ac_cv_var_atom_ok=yes
2218#     ;;
2219# esac
2220ac_cv_var_atom_ok=yes
2221
2222# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
2223
2224# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
2225
2226# The PPSAPI needs struct timespec.
2227
2228# The PPSAPI also needs a timepps header.
2229
2230case "$ac_cv_c_inline$ac_cv_struct_timespec" in
2231 inlineyes)
2232    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
2233     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
2234	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
2235	ac_cv_var_jupiter_ok=yes
2236	ac_cv_var_oncore_ok=yes
2237	ac_cv_var_parse_ok=yes
2238	ac_cv_var_ripe_ncc_ok=yes
2239	;;
2240    esac
2241    ;;
2242esac
2243
2244# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
2245AC_CHECK_HEADER(linux/serial.h)
2246AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
2247case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
2248  yesyes)
2249    AC_EGREP_CPP(yes,
2250    [#include <sys/time.h>
2251typedef int u_int;
2252
2253#include <sys/ppsclock.h>
2254#include <linux/serial.h>
2255
2256#ifdef TIOCGSERIAL
2257#ifdef TIOCSSERIAL
2258#ifdef ASYNC_PPS_CD_POS
2259#ifdef ASYNC_PPS_CD_NEG
2260#ifdef CIOGETEV
2261         yes
2262#endif
2263#endif
2264#endif
2265#endif
2266#endif
2267	 ], ntp_ok=yes)
2268	;;
2269  *)
2270	ntp_ok=no
2271	;;
2272esac
2273if test "$ntp_ok" = "yes"; then
2274    AC_DEFINE(HAVE_TIO_SERIAL_STUFF, 1, [Do we have the TIO serial stuff?])
2275fi
2276AC_MSG_RESULT($ntp_ok)
2277
2278# Check for SHMEM_STATUS support
2279AC_MSG_CHECKING([SHMEM_STATUS support])
2280case "$ac_cv_header_sys_mman_h" in
2281 yes) ntp_ok=yes ;;
2282 *)   ntp_ok=no  ;;
2283esac
2284if test "$ntp_ok" = "yes"; then
2285    AC_DEFINE(ONCORE_SHMEM_STATUS, 1, [Do we have support for SHMEM_STATUS?])
2286fi
2287AC_MSG_RESULT($ntp_ok)
2288
2289dnl dnl These are for OPT_PROGRAMS in authstuff/
2290dnl AC_SUBST(AUTHCERT)
2291dnl AC_SUBST(AUTHSPEED)
2292dnl AC_SUBST(MD5DRIVER)
2293dnl AC_SUBST(KEYPARITY)
2294dnl AC_SUBST(MAKEIPFP)
2295dnl AC_SUBST(MAKEPC1)
2296dnl AC_SUBST(MAKEPC2)
2297dnl AC_SUBST(MAKESP)
2298dnl AC_SUBST(MKRANDKEYS)
2299dnl AC_SUBST(OMAKEIPFP)
2300dnl AC_SUBST(UNIXCERT)
2301
2302ntp_refclock=no
2303
2304# HPUX only, and by explicit request
2305AC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
2306AC_ARG_ENABLE(BANCOMM,
2307    AC_HELP_STRING([--enable-BANCOMM], [- Datum/Bancomm bc635/VME interface]),
2308    [ntp_ok=$enableval], [ntp_ok=no])
2309if test "$ntp_ok" = "yes"; then
2310    ntp_refclock=yes
2311    AC_DEFINE(CLOCK_BANC, 1, [Datum/Bancomm bc635/VME interface?])
2312fi
2313AC_MSG_RESULT($ntp_ok)
2314case "$ntp_ok$host" in
2315 yes*-*-hpux*) ;;
2316 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2317esac
2318
2319#HPUX only, and only by explicit request
2320AC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
2321AC_ARG_ENABLE(GPSVME,
2322    AC_HELP_STRING([--enable-GPSVME], [- TrueTime GPS receiver/VME interface]),
2323    [ntp_ok=$enableval], [ntp_ok=no])
2324if test "$ntp_ok" = "yes"; then
2325    ntp_refclock=yes
2326    AC_DEFINE(CLOCK_GPSVME, 1, [TrueTime GPS receiver/VME interface?])
2327fi
2328AC_MSG_RESULT($ntp_ok)
2329case "$ntp_ok$host" in
2330 yes*-*-hpux*) ;;
2331 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2332esac
2333
2334AC_MSG_CHECKING([for PCL720 clock support])
2335case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
2336 yesyesyes)
2337    AC_DEFINE(CLOCK_PPS720, 1, [PCL 720 clock support])
2338    ans=yes
2339    ;;
2340 *)
2341    ans=no
2342    ;;
2343esac
2344AC_MSG_RESULT([$ans])
2345
2346AC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
2347AC_ARG_ENABLE(all-clocks,
2348    AC_HELP_STRING([--enable-all-clocks], [+ include all suitable non-PARSE clocks:]),
2349    [ntp_eac=$enableval], [ntp_eac=yes])
2350AC_MSG_RESULT($ntp_eac)
2351
2352# HMS: Should we also require ac_cv_var_parse_ok?
2353AC_MSG_CHECKING([if we have support for PARSE clocks])
2354case "$ac_cv_var_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
2355 yes*yes*)
2356    ntp_canparse=yes
2357    ;;
2358 *) ntp_canparse=no
2359    ;;
2360esac
2361AC_MSG_RESULT($ntp_canparse)
2362
2363AC_MSG_CHECKING([if we have support for audio clocks])
2364case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
2365 *yes*)
2366    ntp_canaudio=yes
2367    AC_DEFINE(HAVE_AUDIO, , [Do we have audio support?])
2368    ;;
2369 *) ntp_canaudio=no ;;
2370esac
2371AC_MSG_RESULT($ntp_canaudio)
2372
2373AC_MSG_CHECKING([if we have support for the SHM refclock interface])
2374case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
2375 yesyes)
2376    ntp_canshm=yes
2377    ;;
2378 *) ntp_canshm=no ;;
2379esac
2380AC_MSG_RESULT($ntp_canshm)
2381
2382# Requires modem control
2383AC_MSG_CHECKING([ACTS modem service])
2384AC_ARG_ENABLE(ACTS,
2385    AC_HELP_STRING([--enable-ACTS], [s ACTS modem service]),
2386    [ntp_ok=$enableval],
2387    [AC_EGREP_CPP(yes,
2388        [#include <termios.h>
2389#ifdef HAVE_SYS_IOCTL_H
2390#include <sys/ioctl.h>
2391#endif
2392#ifdef TIOCMBIS
2393         yes
2394#endif
2395         ], ntp_ok=$ntp_eac, ntp_ok=no)])
2396if test "$ntp_ok" = "yes"; then
2397    ntp_refclock=yes
2398    AC_DEFINE(CLOCK_ACTS, 1, [ACTS modem service])
2399fi
2400AC_MSG_RESULT($ntp_ok)
2401
2402AC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
2403AC_ARG_ENABLE(ARBITER,
2404    AC_HELP_STRING([--enable-ARBITER], [+ Arbiter 1088A/B GPS receiver]),
2405    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2406if test "$ntp_ok" = "yes"; then
2407    ntp_refclock=yes
2408    AC_DEFINE(CLOCK_ARBITER, 1, [Arbiter 1088A/B GPS receiver])
2409fi
2410AC_MSG_RESULT($ntp_ok)
2411
2412AC_MSG_CHECKING([Arcron MSF receiver])
2413AC_ARG_ENABLE(ARCRON_MSF,
2414    AC_HELP_STRING([--enable-ARCRON-MSF], [+ Arcron MSF receiver]),
2415    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2416if test "$ntp_ok" = "yes"; then
2417    ntp_refclock=yes
2418    AC_DEFINE(CLOCK_ARCRON_MSF, 1, [ARCRON support?])
2419fi
2420AC_MSG_RESULT($ntp_ok)
2421
2422AC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
2423AC_ARG_ENABLE(AS2201,
2424    AC_HELP_STRING([--enable-AS2201], [+ Austron 2200A/2201A GPS receiver]),
2425    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2426if test "$ntp_ok" = "yes"; then
2427    ntp_refclock=yes
2428    AC_DEFINE(CLOCK_AS2201, 1, [Austron 2200A/2201A GPS receiver?])
2429fi
2430AC_MSG_RESULT($ntp_ok)
2431
2432AC_MSG_CHECKING([ATOM PPS interface])
2433AC_ARG_ENABLE(ATOM,
2434    AC_HELP_STRING([--enable-ATOM], [s ATOM PPS interface]),
2435    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2436case "$ac_cv_var_atom_ok" in
2437 no) ntp_ok=no ;;
2438esac
2439if test "$ntp_ok" = "yes"; then
2440    ntp_refclock=yes
2441    AC_DEFINE(CLOCK_ATOM, 1, [PPS interface?])
2442fi
2443AC_MSG_RESULT($ntp_ok)
2444
2445AC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
2446AC_ARG_ENABLE(CHRONOLOG,
2447    AC_HELP_STRING([--enable-CHRONOLOG], [+ Chrono-log K-series WWVB receiver]),
2448    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2449if test "$ntp_ok" = "yes"; then
2450    ntp_refclock=yes
2451    AC_DEFINE(CLOCK_CHRONOLOG, 1, [Chronolog K-series WWVB receiver?])
2452fi
2453AC_MSG_RESULT($ntp_ok)
2454
2455AC_MSG_CHECKING([CHU modem/decoder])
2456AC_ARG_ENABLE(CHU,
2457    AC_HELP_STRING([--enable-CHU], [+ CHU modem/decoder]),
2458    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2459if test "$ntp_ok" = "yes"; then
2460    ntp_refclock=yes
2461    AC_DEFINE(CLOCK_CHU, 1, [CHU modem/decoder])
2462fi
2463AC_MSG_RESULT($ntp_ok)
2464ac_refclock_chu=$ntp_ok
2465
2466AC_MSG_CHECKING([CHU audio/decoder])
2467AC_ARG_ENABLE(AUDIO-CHU,
2468    AC_HELP_STRING([--enable-AUDIO-CHU], [s CHU audio/decoder]),
2469    [ntp_ok=$enableval],
2470    [case "$ntp_eac$ac_refclock_chu$ntp_canaudio" in
2471 *no*)	ntp_ok=no  ;;
2472 *)	ntp_ok=yes ;;
2473esac])
2474if test "$ntp_ok" = "yes"; then
2475    AC_DEFINE(AUDIO_CHU, 1, [CHU audio/decoder?])
2476fi
2477AC_MSG_RESULT($ntp_ok)
2478# We used to check for sunos/solaris target...
2479case "$ntp_ok$ac_refclock_chu$ntp_canaudio" in
2480 yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***]) ;;
2481esac
2482
2483# Not under HP-UX
2484AC_MSG_CHECKING([Datum Programmable Time System])
2485AC_ARG_ENABLE(DATUM,
2486    AC_HELP_STRING([--enable-DATUM], [s Datum Programmable Time System]),
2487    [ntp_ok=$enableval],
2488    [case "$ac_cv_header_termios_h" in
2489    yes)
2490        ntp_ok=$ntp_eac
2491        ;;
2492    *) ntp_ok=no
2493        ;;
2494    esac])
2495if test "$ntp_ok" = "yes"; then
2496    ntp_refclock=yes
2497    AC_DEFINE(CLOCK_DATUM, 1, [Datum Programmable Time System?])
2498fi
2499AC_MSG_RESULT($ntp_ok)
2500
2501AC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2502AC_ARG_ENABLE(DUMBCLOCK,
2503    AC_HELP_STRING([--enable-DUMBCLOCK], [+ Dumb generic hh:mm:ss local clock]),
2504    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2505if test "$ntp_ok" = "yes"; then
2506    ntp_refclock=yes
2507    AC_DEFINE(CLOCK_DUMBCLOCK, 1, [Dumb generic hh:mm:ss local clock?])
2508fi
2509AC_MSG_RESULT($ntp_ok)
2510
2511AC_MSG_CHECKING([Forum Graphic GPS])
2512AC_ARG_ENABLE(FG,
2513    AC_HELP_STRING([--enable-FG], [+ Forum Graphic GPS]),
2514    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2515if test "$ntp_ok" = "yes"; then
2516    ntp_refclock=yes
2517    AC_DEFINE(CLOCK_FG, 1, [Forum Graphic GPS datating station driver?])
2518fi
2519AC_MSG_RESULT($ntp_ok)
2520
2521# Requires modem control
2522AC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2523AC_ARG_ENABLE(HEATH,
2524    AC_HELP_STRING([--enable-HEATH], [s Heath GC-1000 WWV/WWVH receiver]),
2525    [ntp_ok=$enableval],
2526    [AC_EGREP_CPP(yes,
2527        [#include <termios.h>
2528#ifdef HAVE_SYS_IOCTL_H
2529#include <sys/ioctl.h>
2530#endif
2531#ifdef TIOCMBIS
2532         yes
2533#endif
2534         ], ntp_ok=$ntp_eac, ntp_ok=no)])
2535if test "$ntp_ok" = "yes"; then
2536    ntp_refclock=yes
2537    AC_DEFINE(CLOCK_HEATH, 1, [Heath GC-1000 WWV/WWVH receiver?])
2538fi
2539AC_MSG_RESULT($ntp_ok)
2540
2541AC_MSG_CHECKING([for hopf serial clock device])
2542AC_ARG_ENABLE(HOPFSERIAL,
2543    AC_HELP_STRING([--enable-HOPFSERIAL], [+ hopf serial clock device]),
2544    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2545if test "$ntp_ok" = "yes"; then
2546    ntp_refclock=yes
2547    AC_DEFINE(CLOCK_HOPF_SERIAL, 1, [HOPF serial clock device?])
2548fi
2549AC_MSG_RESULT($ntp_ok)
2550
2551AC_MSG_CHECKING([for hopf PCI clock 6039])
2552AC_ARG_ENABLE(HOPFPCI,
2553    AC_HELP_STRING([--enable-HOPFPCI], [+ hopf 6039 PCI board]),
2554    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2555if test "$ntp_ok" = "yes"; then
2556    ntp_refclock=yes
2557    AC_DEFINE(CLOCK_HOPF_PCI, 1, [HOPF PCI clock device?])
2558fi
2559AC_MSG_RESULT($ntp_ok)
2560
2561AC_MSG_CHECKING([HP 58503A GPS receiver])
2562AC_ARG_ENABLE(HPGPS,
2563    AC_HELP_STRING([--enable-HPGPS], [+ HP 58503A GPS receiver]),
2564    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2565if test "$ntp_ok" = "yes"; then
2566    ntp_refclock=yes
2567    AC_DEFINE(CLOCK_HPGPS, 1, [HP 58503A GPS receiver?])
2568fi
2569AC_MSG_RESULT($ntp_ok)
2570
2571AC_MSG_CHECKING([IRIG audio decoder])
2572AC_ARG_ENABLE(IRIG,
2573    AC_HELP_STRING([--enable-IRIG], [s IRIG audio decoder]),
2574    [ntp_ok=$enableval],
2575    [case "$ntp_eac$ntp_canaudio" in
2576     *no*)	ntp_ok=no  ;;
2577     *)		ntp_ok=yes ;;
2578    esac])
2579if test "$ntp_ok" = "yes"; then
2580    ntp_refclock=yes
2581    AC_DEFINE(CLOCK_IRIG, 1, [IRIG audio decoder?])
2582fi
2583AC_MSG_RESULT($ntp_ok)
2584case "$ntp_ok$ntp_canaudio" in
2585 yesno) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2586esac
2587
2588AC_MSG_CHECKING([for JJY receiver])
2589AC_ARG_ENABLE(JJY,
2590    AC_HELP_STRING([--enable-JJY], [+ JJY receiver]),
2591    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2592if test "$ntp_ok" = "yes"; then
2593    ntp_refclock=yes
2594    AC_DEFINE(CLOCK_JJY, 1, [JJY receiver?])
2595fi
2596AC_MSG_RESULT($ntp_ok)
2597
2598AC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2599AC_ARG_ENABLE(JUPITER,
2600    AC_HELP_STRING([--enable-JUPITER], [s Rockwell Jupiter GPS receiver]),
2601    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2602case "$ac_cv_var_jupiter_ok" in
2603 no) ntp_ok=no ;;
2604esac
2605if test "$ntp_ok" = "yes"; then
2606    ntp_refclock=yes
2607    AC_DEFINE(CLOCK_JUPITER, 1, [Rockwell Jupiter GPS clock?])
2608fi
2609AC_MSG_RESULT($ntp_ok)
2610
2611AC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2612AC_ARG_ENABLE(LEITCH,
2613    AC_HELP_STRING([--enable-LEITCH], [+ Leitch CSD 5300 Master Clock System Driver]),
2614    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2615if test "$ntp_ok" = "yes"; then
2616    ntp_refclock=yes
2617    AC_DEFINE(CLOCK_LEITCH, 1, [Leitch CSD 5300 Master Clock System Driver?])
2618fi
2619AC_MSG_RESULT($ntp_ok)
2620
2621AC_MSG_CHECKING([local clock reference])
2622AC_ARG_ENABLE(LOCAL-CLOCK,
2623    AC_HELP_STRING([--enable-LOCAL-CLOCK], [+ local clock reference]),
2624    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2625if test "$ntp_ok" = "yes"; then
2626    ntp_refclock=yes
2627    AC_DEFINE(CLOCK_LOCAL, 1, [local clock reference?])
2628fi
2629AC_MSG_RESULT($ntp_ok)
2630
2631dnl Bug 340: longstanding unfixed bugs
2632dnl AC_MSG_CHECKING(EES M201 MSF receiver)
2633dnl AC_ARG_ENABLE(MSFEES,
2634dnl     AC_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver]),
2635dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2636dnl if test "$ntp_ok" = "yes"; then
2637dnl     ntp_refclock=yes
2638dnl     AC_DEFINE(CLOCK_MSFEES, 1, [EES M201 MSF receiver])
2639dnl fi
2640dnl AC_MSG_RESULT($ntp_ok)
2641
2642# Not Ultrix
2643AC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2644AC_ARG_ENABLE(MX4200,
2645    AC_HELP_STRING([--enable-MX4200 ], [s Magnavox MX4200 GPS receiver]),
2646    [ntp_ok=$enableval],
2647    [case "$ac_cv_var_ppsclock" in
2648     yes) ntp_ok=$ntp_eac
2649        ;;
2650     *) ntp_ok=no
2651        ;;
2652    esac])
2653if test "$ntp_ok" = "yes"; then
2654    ntp_refclock=yes
2655    AC_DEFINE(CLOCK_MX4200, 1, [Magnavox MX4200 GPS receiver])
2656fi
2657AC_MSG_RESULT($ntp_ok)
2658case "$ntp_ok$host" in
2659 yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;;
2660esac
2661
2662AC_MSG_CHECKING([for NeoClock4X receiver])
2663AC_ARG_ENABLE(NEOCLOCK4X,
2664    AC_HELP_STRING([--enable-NEOCLOCK4X], [+ NeoClock4X DCF77 / TDF receiver]),
2665    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2666if test "$ntp_ok" = "yes"; then
2667    ntp_refclock=yes
2668    AC_DEFINE(CLOCK_NEOCLOCK4X, 1, [NeoClock4X])
2669fi
2670AC_MSG_RESULT($ntp_ok)
2671
2672AC_MSG_CHECKING([NMEA GPS receiver])
2673AC_ARG_ENABLE(NMEA,
2674    AC_HELP_STRING([--enable-NMEA], [+ NMEA GPS receiver]),
2675    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2676if test "$ntp_ok" = "yes"; then
2677    ntp_refclock=yes
2678    AC_DEFINE(CLOCK_NMEA, 1, [NMEA GPS receiver])
2679fi
2680AC_MSG_RESULT($ntp_ok)
2681
2682AC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2683AC_ARG_ENABLE(ONCORE,
2684    AC_HELP_STRING([--enable-ONCORE], [s Motorola VP/UT Oncore GPS receiver]),
2685    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2686case "$ac_cv_var_oncore_ok" in
2687 no) ntp_ok=no ;;
2688esac
2689if test "$ntp_ok" = "yes"; then
2690    ntp_refclock=yes
2691    AC_DEFINE(CLOCK_ONCORE, 1, [Motorola UT Oncore GPS])
2692fi
2693AC_MSG_RESULT($ntp_ok)
2694
2695AC_MSG_CHECKING([for Palisade clock])
2696AC_ARG_ENABLE(PALISADE,
2697    AC_HELP_STRING([--enable-PALISADE], [s Palisade clock]),
2698    [ntp_ok=$enableval],
2699    [case "$ac_cv_header_termios_h" in
2700    yes)
2701        ntp_ok=$ntp_eac
2702        ;;
2703    *) ntp_ok=no
2704        ;;
2705    esac])
2706
2707if test "$ntp_ok" = "yes"; then
2708    ntp_refclock=yes
2709    AC_DEFINE(CLOCK_PALISADE, 1, [Palisade clock])
2710fi
2711AC_MSG_RESULT($ntp_ok)
2712
2713AC_MSG_CHECKING([Conrad parallel port radio clock])
2714AC_ARG_ENABLE(PCF,
2715    AC_HELP_STRING([--enable-PCF ], [+ Conrad parallel port radio clock]),
2716    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2717if test "$ntp_ok" = "yes"; then
2718    ntp_refclock=yes
2719    AC_DEFINE(CLOCK_PCF, 1, [Conrad parallel port radio clock])
2720fi
2721AC_MSG_RESULT($ntp_ok)
2722
2723AC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2724AC_ARG_ENABLE(PST,
2725    AC_HELP_STRING([--enable-PST], [+ PST/Traconex 1020 WWV/WWVH receiver]),
2726    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2727if test "$ntp_ok" = "yes"; then
2728    ntp_refclock=yes
2729    AC_DEFINE(CLOCK_PST, 1, [PST/Traconex 1020 WWV/WWVH receiver])
2730fi
2731AC_MSG_RESULT($ntp_ok)
2732
2733AC_MSG_CHECKING([RIPENCC specific Trimble driver])
2734AC_ARG_ENABLE(RIPENCC,
2735    AC_HELP_STRING([--enable-RIPENCC], [- RIPENCC specific Trimble driver]),
2736    [ntp_ok=$enableval], [ntp_ok=no])
2737# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2738case "$ac_cv_var_ripe_ncc_ok" in
2739 no) ntp_ok=no ;;
2740esac
2741if test "$ntp_ok" = "yes"; then
2742    ntp_refclock=yes
2743    AC_DEFINE(CLOCK_RIPENCC, ,[RIPE NCC Trimble clock])
2744fi
2745AC_MSG_RESULT($ntp_ok)
2746
2747# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2748# For *IX, we need sys/ipc.h and sys/shm.h.
2749AC_MSG_CHECKING([for SHM clock attached thru shared memory])
2750AC_ARG_ENABLE(SHM,
2751    AC_HELP_STRING([--enable-SHM], [s SHM clock attached thru shared memory]),
2752    [ntp_ok=$enableval],
2753    [case "$ntp_eac$ntp_canshm" in
2754 *no*)	ntp_ok=no  ;;
2755 *)	ntp_ok=yes ;;
2756esac])
2757if test "$ntp_ok" = "yes"; then
2758    ntp_refclock=yes
2759    AC_DEFINE(CLOCK_SHM, 1, [clock thru shared memory])
2760fi
2761AC_MSG_RESULT($ntp_ok)
2762
2763AC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2764AC_ARG_ENABLE(SPECTRACOM,
2765    AC_HELP_STRING([--enable-SPECTRACOM], [+ Spectracom 8170/Netclock/2 WWVB receiver]),
2766    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2767if test "$ntp_ok" = "yes"; then
2768    ntp_refclock=yes
2769    AC_DEFINE(CLOCK_SPECTRACOM, 1, [Spectracom 8170/Netclock/2 WWVB receiver])
2770fi
2771AC_MSG_RESULT($ntp_ok)
2772
2773AC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2774AC_ARG_ENABLE(TPRO,
2775    AC_HELP_STRING([--enable-TPRO], [s KSI/Odetics TPRO/S GPS receiver/IRIG interface]),
2776    [ntp_ok=$enableval],
2777    [case "$ac_cv_header_sys_tpro_h" in
2778     yes)
2779	ntp_ok=$ntp_eac
2780	;;
2781     *)	ntp_ok=no
2782	;;
2783    esac])
2784if test "$ntp_ok" = "yes"; then
2785    ntp_refclock=yes
2786    AC_DEFINE(CLOCK_TPRO, 1, [KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2787fi
2788AC_MSG_RESULT($ntp_ok)
2789case "$ntp_ok$ac_cv_header_sys_tpro" in
2790 yesno) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2791esac
2792
2793dnl Bug 342: longstanding unfixed bugs
2794dnl AC_MSG_CHECKING(TRAK 8810 GPS receiver)
2795dnl AC_ARG_ENABLE(TRAK,
2796dnl     AC_HELP_STRING([--enable-TRAK], [+ TRAK 8810 GPS receiver]),
2797dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2798dnl if test "$ntp_ok" = "yes"; then
2799dnl     ntp_refclock=yes
2800dnl     AC_DEFINE(CLOCK_TRAK, 1, [TRAK 8810 GPS receiver])
2801dnl fi
2802dnl AC_MSG_RESULT($ntp_ok)
2803
2804# Not on a vax-dec-bsd
2805AC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2806AC_ARG_ENABLE(TRUETIME,
2807    AC_HELP_STRING([--enable-TRUETIME], [s Kinemetrics/TrueTime receivers]),
2808    [ntp_ok=$enableval],
2809    [case "$host" in
2810     vax-dec-bsd)
2811	ntp_ok=no
2812	;;
2813     *)
2814	ntp_ok=$ntp_eac
2815	;;
2816    esac])
2817
2818if test "$ntp_ok" = "yes"; then
2819    ntp_refclock=yes
2820    AC_DEFINE(CLOCK_TRUETIME, 1, [Kinemetrics/TrueTime receivers])
2821fi
2822AC_MSG_RESULT($ntp_ok)
2823case "$ntp_ok$host" in
2824 yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2825esac
2826
2827AC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2828AC_ARG_ENABLE(TT560,
2829    AC_HELP_STRING([--enable-TT560], [- TrueTime 560 IRIG-B decoder]),
2830    [ntp_ok=$enableval], [ntp_ok=no])
2831if test "$ntp_ok" = "yes"; then
2832    ntp_refclock=yes
2833    AC_DEFINE(CLOCK_TT560, , [TrueTime 560 IRIG-B decoder?])
2834fi
2835AC_MSG_RESULT($ntp_ok)
2836
2837AC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2838AC_ARG_ENABLE(ULINK,
2839    AC_HELP_STRING([--enable-ULINK], [+ Ultralink WWVB receiver]),
2840    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2841if test "$ntp_ok" = "yes"; then
2842    ntp_refclock=yes
2843    AC_DEFINE(CLOCK_ULINK, 1, [Ultralink M320 WWVB receiver?])
2844fi
2845AC_MSG_RESULT($ntp_ok)
2846
2847AC_MSG_CHECKING([WWV receiver])
2848AC_ARG_ENABLE(WWV,
2849    AC_HELP_STRING([--enable-WWV], [s WWV Audio receiver]),
2850    [ntp_ok=$enableval],
2851    [case "$ntp_eac$ntp_canaudio" in
2852     *no*)	ntp_ok=no  ;;
2853     *)		ntp_ok=yes ;;
2854    esac])
2855if test "$ntp_ok" = "yes"; then
2856    ntp_refclock=yes
2857    AC_DEFINE(CLOCK_WWV, 1, [WWV audio driver])
2858fi
2859AC_MSG_RESULT($ntp_ok)
2860case "$ntp_ok$ntp_canaudio" in
2861 yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;;
2862esac
2863
2864AC_MSG_CHECKING([for Zyfer receiver])
2865AC_ARG_ENABLE(ZYFER,
2866    AC_HELP_STRING([--enable-ZYFER], [+ Zyfer GPStarplus receiver]),
2867    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2868if test "$ntp_ok" = "yes"; then
2869    ntp_refclock=yes
2870    AC_DEFINE(CLOCK_ZYFER, 1, [Zyfer GPStarplus])
2871fi
2872AC_MSG_RESULT($ntp_ok)
2873
2874AC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2875AC_ARG_ENABLE(parse-clocks,
2876   AC_HELP_STRING([--enable-parse-clocks], [- include all suitable PARSE clocks:]),
2877    [ntp_eapc=$enableval],
2878    [case "$ntp_eac" in
2879     yes) ntp_eapc=$ntp_canparse ;;
2880     *) ntp_eapc=no ;;
2881    esac
2882    # Delete the next line one of these days
2883    ntp_eapc=no])
2884AC_MSG_RESULT($ntp_eapc)
2885
2886case "$ntp_eac$ntp_eapc$ntp_canparse" in
2887 noyes*)
2888    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2889    ;;
2890 yesyesno)
2891    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2892    ;;
2893 *) ;;
2894esac
2895
2896ntp_libparse=no
2897ntp_parseutil=no
2898ntp_rawdcf=no
2899
2900AC_MSG_CHECKING([Diem Computime Radio Clock])
2901AC_ARG_ENABLE(COMPUTIME,
2902    AC_HELP_STRING([--enable-COMPUTIME], [s Diem Computime Radio Clock]),
2903    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2904if test "$ntp_ok" = "yes"; then
2905    ntp_libparse=yes
2906    ntp_refclock=yes
2907    AC_DEFINE(CLOCK_COMPUTIME, 1, [Diems Computime Radio Clock?])
2908fi
2909AC_MSG_RESULT($ntp_ok)
2910case "$ntp_ok$ntp_canparse" in
2911 yesno)
2912    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2913    ;;
2914esac
2915
2916AC_MSG_CHECKING([ELV/DCF7000 clock])
2917AC_ARG_ENABLE(DCF7000,
2918    AC_HELP_STRING([--enable-DCF7000], [s ELV/DCF7000 clock]),
2919    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2920if test "$ntp_ok" = "yes"; then
2921    ntp_libparse=yes
2922    ntp_refclock=yes
2923    AC_DEFINE(CLOCK_DCF7000, 1, [ELV/DCF7000 clock?])
2924fi
2925AC_MSG_RESULT($ntp_ok)
2926case "$ntp_ok$ntp_canparse" in
2927 yesno)
2928    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2929    ;;
2930esac
2931
2932AC_MSG_CHECKING([HOPF 6021 clock])
2933AC_ARG_ENABLE(HOPF6021,
2934    AC_HELP_STRING([--enable-HOPF6021 ], [s HOPF 6021 clock]),
2935    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2936if test "$ntp_ok" = "yes"; then
2937    ntp_libparse=yes
2938    ntp_refclock=yes
2939    AC_DEFINE(CLOCK_HOPF6021, 1, [HOPF 6021 clock?])
2940fi
2941AC_MSG_RESULT($ntp_ok)
2942case "$ntp_ok$ntp_canparse" in
2943 yesno)
2944    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2945    ;;
2946esac
2947
2948AC_MSG_CHECKING([Meinberg clocks])
2949AC_ARG_ENABLE(MEINBERG,
2950    AC_HELP_STRING([--enable-MEINBERG], [s Meinberg clocks]),
2951    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2952if test "$ntp_ok" = "yes"; then
2953    ntp_libparse=yes
2954    ntp_refclock=yes
2955    AC_DEFINE(CLOCK_MEINBERG, 1, [Meinberg clocks])
2956fi
2957AC_MSG_RESULT($ntp_ok)
2958case "$ntp_ok$ntp_canparse" in
2959 yesno)
2960    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2961    ;;
2962esac
2963
2964AC_MSG_CHECKING([DCF77 raw time code])
2965AC_ARG_ENABLE(RAWDCF,
2966    AC_HELP_STRING([--enable-RAWDCF], [s DCF77 raw time code]),
2967    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2968if test "$ntp_ok" = "yes"; then
2969    ntp_libparse=yes
2970    ntp_parseutil=yes
2971    ntp_refclock=yes
2972    ntp_rawdcf=yes
2973    AC_DEFINE(CLOCK_RAWDCF, 1, [DCF77 raw time code])
2974fi
2975AC_MSG_RESULT($ntp_ok)
2976case "$ntp_ok$ntp_canparse" in
2977 yesno)
2978    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2979    ;;
2980esac
2981
2982case "$ntp_rawdcf" in
2983 yes)
2984    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2985    ac_cv_var_rawdcf_parity,
2986    [ans=no
2987    case "$host" in
2988     *-*-*linux*)
2989        ans=yes
2990        ;;
2991    esac
2992    ac_cv_var_rawdcf_parity=$ans])
2993    case "$ac_cv_var_rawdcf_parity" in
2994     yes) AC_DEFINE(RAWDCF_NO_IGNPAR, 1, [Should we not IGNPAR (Linux)?]) ;;
2995    esac
2996    ;;
2997
2998 *) # HMS: Is this a good idea?
2999    ac_cv_var_rawdcf_parity=no
3000    ;;
3001esac
3002
3003AC_MSG_CHECKING([RCC 8000 clock])
3004AC_ARG_ENABLE(RCC8000,
3005    AC_HELP_STRING([--enable-RCC8000], [s RCC 8000 clock]),
3006    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3007if test "$ntp_ok" = "yes"; then
3008    ntp_libparse=yes
3009    ntp_refclock=yes
3010    AC_DEFINE(CLOCK_RCC8000, 1, [RCC 8000 clock])
3011fi
3012AC_MSG_RESULT($ntp_ok)
3013case "$ntp_ok$ntp_canparse" in
3014 yesno)
3015    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3016    ;;
3017esac
3018
3019AC_MSG_CHECKING([Schmid DCF77 clock])
3020AC_ARG_ENABLE(SCHMID,
3021    AC_HELP_STRING([--enable-SCHMID ], [s Schmid DCF77 clock]),
3022    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3023if test "$ntp_ok" = "yes"; then
3024    ntp_libparse=yes
3025    ntp_refclock=yes
3026    AC_DEFINE(CLOCK_SCHMID, 1, [Schmid DCF77 clock])
3027fi
3028AC_MSG_RESULT($ntp_ok)
3029case "$ntp_ok$ntp_canparse" in
3030 yesno)
3031    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3032    ;;
3033esac
3034
3035AC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
3036AC_ARG_ENABLE(TRIMTAIP,
3037    AC_HELP_STRING([--enable-TRIMTAIP], [s Trimble GPS receiver/TAIP protocol]),
3038    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3039if test "$ntp_ok" = "yes"; then
3040    ntp_libparse=yes
3041    ntp_refclock=yes
3042    AC_DEFINE(CLOCK_TRIMTAIP, 1, [Trimble GPS receiver/TAIP protocol])
3043fi
3044AC_MSG_RESULT($ntp_ok)
3045case "$ntp_ok$ntp_canparse" in
3046 yesno)
3047    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3048    ;;
3049esac
3050
3051AC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
3052AC_ARG_ENABLE(TRIMTSIP,
3053    AC_HELP_STRING([--enable-TRIMTSIP], [s Trimble GPS receiver/TSIP protocol]),
3054    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3055if test "$ntp_ok" = "yes"; then
3056    ntp_libparse=yes
3057    ntp_refclock=yes
3058    AC_DEFINE(CLOCK_TRIMTSIP, 1, [Trimble GPS receiver/TSIP protocol])
3059fi
3060AC_MSG_RESULT($ntp_ok)
3061case "$ntp_ok$ntp_canparse" in
3062 yesno)
3063    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3064    ;;
3065esac
3066
3067AC_MSG_CHECKING([WHARTON 400A Series clock])
3068AC_ARG_ENABLE(WHARTON,
3069    AC_HELP_STRING([--enable-WHARTON], [s WHARTON 400A Series clock]),
3070    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3071if test "$ntp_ok" = "yes"; then
3072    ntp_libparse=yes
3073    ntp_refclock=yes
3074    AC_DEFINE(CLOCK_WHARTON_400A, 1, [WHARTON 400A Series protocol])
3075fi
3076AC_MSG_RESULT($ntp_ok)
3077case "$ntp_ok$ntp_canparse" in
3078 yesno)
3079    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3080    ;;
3081esac
3082
3083AC_MSG_CHECKING([VARITEXT clock])
3084AC_ARG_ENABLE(VARITEXT,
3085    AC_HELP_STRING([--enable-VARITEXT], [s VARITEXT clock]),
3086    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3087if test "$ntp_ok" = "yes"; then
3088    ntp_libparse=yes
3089    ntp_refclock=yes
3090    AC_DEFINE(CLOCK_VARITEXT, 1, [VARITEXT protocol])
3091fi
3092AC_MSG_RESULT($ntp_ok)
3093case "$ntp_ok$ntp_canparse" in
3094 yesno)
3095    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3096    ;;
3097esac
3098AC_SUBST(LIBPARSE)
3099AC_SUBST(MAKE_LIBPARSE)
3100AC_SUBST(MAKE_LIBPARSE_KERNEL)
3101AC_SUBST(MAKE_CHECK_Y2K)
3102AC_MSG_CHECKING([if we need to make and use the parse libraries])
3103ans=no
3104case "$ntp_libparse" in
3105 yes)
3106    ans=yes
3107    AC_DEFINE(CLOCK_PARSE, 1, [PARSE driver interface])
3108    LIBPARSE=../libparse/libparse.a
3109    MAKE_LIBPARSE=libparse.a
3110    # HMS: check_y2k trips the 34 year problem now...
3111    false && MAKE_CHECK_Y2K=check_y2k
3112    AC_DEFINE(PPS_SAMPLE, 1, [PPS auxiliary interface for ATOM?])
3113    AC_DEFINE(CLOCK_ATOM)
3114    ;;
3115esac
3116AC_MSG_RESULT([$ans])
3117
3118# AC_SUBST(RSAOBJS)
3119# AC_SUBST(RSASRCS)
3120# AC_SUBST(RSADIR)
3121# AC_SUBST(RSAREF)
3122# AC_SUBST(LIBRSAREF)
3123# AC_SUBST(MAKE_LIBRSAREF)
3124
3125AC_SUBST(OPENSSL)
3126AC_SUBST(OPENSSL_INC)
3127AC_SUBST(OPENSSL_LIB)
3128
3129AC_MSG_CHECKING([for openssl library directory])
3130AC_ARG_WITH(openssl-libdir,
3131	AC_HELP_STRING([--with-openssl-libdir], [+ =/something/reasonable]),
3132[ans=$withval],
3133[case "$build" in
3134 $host) ans=yes ;;
3135 *)     ans=no ;;
3136esac])
3137case "$ans" in
3138 no) ;;
3139 yes) # Look in:
3140    ans="/usr/lib /usr/lib/openssl /usr/sfw/lib /usr/local/lib /usr/local/ssl/lib"
3141    ;;
3142 *) # Look where they said
3143    ;;
3144esac
3145case "$ans" in
3146 no) ;;
3147 *) # Look for libcrypto.a and libssl.a:
3148    for i in $ans no
3149    do
3150	case "$host" in
3151	 *-*-darwin*)
3152	    test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
3153	    ;;
3154	 *)
3155	    test -f $i/libcrypto.so -a -f $i/libssl.so && break
3156	    test -f $i/libcrypto.a -a -f $i/libssl.a && break
3157	    ;;
3158	esac
3159    done
3160    case "$i" in
3161     no)
3162	ans=no
3163	OPENSSL_LIB=
3164	;;
3165     *) ans=$i
3166	OPENSSL_LIB=$ans
3167	;;
3168    esac
3169    ;;
3170esac
3171AC_MSG_RESULT([$ans])
3172
3173AC_MSG_CHECKING([for openssl include directory])
3174AC_ARG_WITH(openssl-incdir,
3175	AC_HELP_STRING([--with-openssl-incdir], [+ =/something/reasonable]),
3176[ans=$withval],
3177[case "$build" in
3178 $host) ans=yes ;;
3179 *)     ans=no ;;
3180esac])
3181case "$ans" in
3182 no) ;;
3183 yes) # look in:
3184    ans="/usr/include /usr/sfw/include /usr/local/include /usr/local/ssl/include"
3185    ;;
3186 *) # Look where they said
3187    ;;
3188esac
3189case "$ans" in
3190 no) ;;
3191 *) # look for openssl/opensslconf.h:
3192    for i in $ans no
3193    do
3194	test -f $i/openssl/opensslconf.h && break
3195    done
3196    case "$i" in
3197     no)
3198	ans=no
3199	OPENSSL_INC=
3200	;;
3201     *) ans=$i
3202	OPENSSL_INC=$ans
3203	;;
3204    esac
3205    ;;
3206esac
3207AC_MSG_RESULT([$ans])
3208
3209AC_ARG_WITH(crypto,
3210	AC_HELP_STRING([--with-crypto], [+ =openssl]),
3211[ans=$withval], [ans=yes])
3212case "$ans" in
3213 no) ;;
3214 yes|openssl)
3215    if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC"
3216    then
3217	ans=no
3218    else
3219	# We have OpenSSL inc/lib - use them.
3220	ans=openssl
3221	CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
3222	LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
3223	case "$need_dash_r" in
3224	 1) LDFLAGS="$LDFLAGS -R$OPENSSL_LIB"
3225	    ;;
3226	esac
3227	AC_SUBST(LCRYPTO, [-lcrypto])
3228	AC_DEFINE(OPENSSL, , [Use OpenSSL?])
3229	AC_CHECK_FUNCS(EVP_md2 EVP_mdc2)
3230    fi
3231    ;;
3232esac
3233AC_MSG_CHECKING(for the level of crypto support)
3234AC_MSG_RESULT([$ans])
3235
3236AC_MSG_CHECKING([if we want to compile with ElectricFence])
3237AC_ARG_WITH(electricfence,
3238	AC_HELP_STRING([--with-electricfence], [- compile with ElectricFence malloc debugger]),
3239[ans=$withval], [ans=no])
3240case "$ans" in
3241 no) ;;
3242 *)
3243    LIBS="$LIBS \${top_builddir}/ElectricFence/libefence.a"
3244    EF_PROGS="eftest tstheap"
3245    AC_SUBST(EF_PROGS)
3246    EF_LIBS=libefence.a
3247    AC_SUBST(EF_LIBS)
3248    ans=yes
3249    ;;
3250esac
3251AC_MSG_RESULT([$ans])
3252
3253AC_SUBST(MAKE_CHECK_LAYOUT)
3254AC_MSG_CHECKING([if we want to run check-layout])
3255case "$cross_compiling$PATH_PERL" in
3256 no/*)
3257    MAKE_CHECK_LAYOUT=check-layout
3258    ans=yes
3259    ;;
3260 *)
3261    ans=no
3262    ;;
3263esac
3264AC_MSG_RESULT([$ans])
3265
3266AC_SUBST(TESTDCF)
3267AC_SUBST(DCFD)
3268
3269AC_MSG_CHECKING([if we can make dcf parse utilities])
3270ans=no
3271if test "$ntp_parseutil" = "yes"; then
3272    case "$host" in
3273     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3274	ans="dcfd testdcf"
3275	DCFD=dcfd
3276        TESTDCF=testdcf
3277	;;
3278    esac
3279fi
3280AC_MSG_RESULT([$ans])
3281
3282AC_SUBST(MAKE_PARSEKMODULE)
3283AC_MSG_CHECKING([if we can build kernel streams modules for parse])
3284ans=no
3285case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3286 yesyes)
3287    case "$host" in
3288     sparc-*-sunos4*)
3289        case "$ac_cv_var_kernel_pll" in
3290	yes)
3291	    AC_DEFINE(PPS_SYNC, 1, [PARSE kernel PLL PPS support])
3292	    ;;
3293	esac
3294	ans=parsestreams
3295	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3296	;;
3297     sparc-*-solaris2*)
3298	ans=parsesolaris
3299	MAKE_PARSEKMODULE=parse
3300	;;
3301    esac
3302    ;;
3303esac
3304AC_MSG_RESULT([$ans])
3305
3306AC_MSG_CHECKING([if we need basic refclock support])
3307if test "$ntp_refclock" = "yes"; then
3308    AC_DEFINE(REFCLOCK, 1, [Basic refclock support?])
3309fi
3310AC_MSG_RESULT($ntp_refclock)
3311
3312dnl Things that can be made in clockstuff/
3313AC_SUBST(PROPDELAY)	dnl Set to "propdelay"
3314AC_SUBST(CHUTEST)	dnl Set to "chutest"
3315AC_SUBST(CLKTEST)	dnl Set to "clktest"
3316
3317AC_SUBST(MAKE_ADJTIMED)
3318AC_MSG_CHECKING(if we want HP-UX adjtimed support)
3319case "$host" in
3320 *-*-hpux[[56789]]*)
3321    ans=yes
3322    ;;
3323 *) ans=no
3324    ;;
3325esac
3326if test "$ans" = "yes"; then
3327    MAKE_ADJTIMED=adjtimed
3328    AC_DEFINE(NEED_HPUX_ADJTIME, 1, [Do we need HPUX adjtime() library support?])
3329fi
3330AC_MSG_RESULT([$ans])
3331
3332AC_MSG_CHECKING([if we want QNX adjtime support])
3333case "$host" in
3334 *-*-qnx*)
3335    ans=yes
3336    ;;
3337 *) ans=no
3338    ;;
3339esac
3340if test "$ans" = "yes"; then
3341    AC_DEFINE(NEED_QNX_ADJTIME, 1, [Do we need the qnx adjtime call?])
3342fi
3343AC_MSG_RESULT([$ans])
3344
3345AC_MSG_CHECKING([if we can read kmem])
3346
3347#  the default is to enable it if the system has the capability
3348
3349case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3350 *yes*)
3351    ans=yes
3352    ;;
3353 *) ans=no
3354esac
3355
3356case "$host" in
3357 *-*-domainos)	# Won't be found...
3358    ans=no
3359    ;;
3360 *-*-hpux*)
3361    #ans=no
3362    ;;
3363 *-*-irix[[456]]*)
3364    ans=no
3365    ;;
3366 *-*-*linux*)
3367    ans=no
3368    ;;
3369 *-*-winnt3.5)
3370    ans=no
3371    ;;
3372 *-*-unicosmp*)
3373    ans=no
3374    ;;
3375esac
3376
3377# --enable-kmem / --disable-kmem controls if present
3378AC_ARG_ENABLE(
3379    [kmem],
3380    AC_HELP_STRING(
3381	[--enable-kmem],
3382	[s read /dev/kmem for tick and/or tickadj]
3383    ),
3384    [ans=$enableval]
3385)
3386
3387AC_MSG_RESULT([$ans])
3388
3389case "$ans" in
3390 yes)
3391    can_kmem=yes
3392    ;;
3393 *)
3394    can_kmem=no
3395    AC_DEFINE(NOKMEM, 1, [Should we NOT read /dev/kmem?])
3396esac
3397
3398
3399AC_MSG_CHECKING([if adjtime is accurate])
3400
3401# target-dependent defaults
3402
3403case "$host" in
3404 i386-sequent-ptx*)
3405    ans=no
3406    ;;
3407 i386-unknown-osf1*)
3408    ans=yes
3409    ;;
3410 mips-sgi-irix[[456]]*)
3411    ans=yes
3412    ;;
3413 *-fujitsu-uxp*)
3414    ans=yes
3415    ;;
3416 *-ibm-aix[[456]]*)
3417    ans=yes
3418    ;;
3419 *-*-*linux*)
3420    ans=yes
3421    ;;
3422 *-*-solaris2.[[01]])
3423    ans=no
3424    ;;
3425 *-*-solaris2*)
3426    ans=yes
3427    ;;
3428 *-*-unicosmp*)
3429    ans=yes
3430    ;;
3431 *) ans=no
3432esac
3433
3434# --enable-accurate-adjtime / --disable-accurate-adjtime
3435# override the default
3436AC_ARG_ENABLE([accurate-adjtime],
3437    AC_HELP_STRING(
3438        [--enable-accurate-adjtime],
3439        [s the adjtime() call is accurate]
3440    ),
3441    [ans=$enableval],
3442)
3443
3444AC_MSG_RESULT([$ans])
3445
3446case "$ans" in
3447 yes)
3448    AC_DEFINE(ADJTIME_IS_ACCURATE, 1, [Is adjtime() accurate?])
3449    adjtime_is_accurate=yes
3450    ;;
3451 *)
3452    adjtime_is_accurate=no
3453esac
3454
3455AC_CACHE_CHECK([the name of 'tick' in the kernel],
3456ac_cv_var_nlist_tick,
3457[ans=_tick
3458case "$host" in
3459 m68*-hp-hpux*) # HP9000/300?
3460    ans=_old_tick
3461    ;;
3462 *-apple-aux[[23]]*)
3463    ans=tick
3464    ;;
3465 *-hp-hpux*)
3466    ans=old_tick
3467    ;;
3468 *-ibm-aix[[3456]]*)
3469    ans=no
3470    ;;
3471 *-*-mpeix*)
3472    ans=no
3473    ;;
3474 *-*-ptx*)
3475    ans=tick
3476    ;;
3477 *-*-sco3.2v[[45]]*)
3478    ans=no
3479    ;;
3480 *-*-solaris2*)
3481    ans=nsec_per_tick
3482    ;;
3483 *-*-sysv4*)
3484    ans=tick
3485    ;;
3486esac
3487ac_cv_var_nlist_tick=$ans])
3488case "$ac_cv_var_nlist_tick" in
3489 ''|no) ;;	# HMS: I think we can only get 'no' here...
3490 *) AC_DEFINE_UNQUOTED(K_TICK_NAME, "$ac_cv_var_nlist_tick", [What is the name of TICK in the kernel?]) ;;
3491esac
3492#
3493AC_CACHE_CHECK([for the units of 'tick'],
3494ac_cv_var_tick_nano,
3495[ans=usec
3496case "$host" in
3497 *-*-solaris2*)
3498    ans=nsec
3499    ;;
3500esac
3501ac_cv_var_tick_nano=$ans])
3502case "$ac_cv_var_tick_nano" in
3503 nsec)
3504    AC_DEFINE(TICK_NANO, 1, [Is K_TICK_NAME in nanoseconds?])
3505    ;;
3506esac
3507#
3508AC_CACHE_CHECK([the name of 'tickadj' in the kernel],
3509ac_cv_var_nlist_tickadj,
3510[ans=_tickadj
3511case "$host" in
3512 m68*-hp-hpux*) # HP9000/300?
3513    ans=_tickadj
3514    ;;
3515 *-apple-aux[[23]]*)
3516    ans=tickadj
3517    ;;
3518 *-hp-hpux10*)
3519    ans=no
3520    ;;
3521 *-hp-hpux9*)
3522    ans=no
3523    ;;
3524 *-hp-hpux*)
3525    ans=tickadj
3526    ;;
3527 *-*-aix*)
3528    ans=tickadj
3529    ;;
3530 *-*-mpeix*)
3531    ans=no
3532    ;;
3533 *-*-ptx*)
3534    ans=tickadj
3535    ;;
3536 *-*-sco3.2v4*)
3537    ans=no
3538    ;;
3539 *-*-sco3.2v5.0*)
3540    ans=clock_drift
3541    ;;
3542 *-*-solaris2*)
3543    ans=no	# hrestime_adj
3544    ;;
3545 *-*-sysv4*)
3546    ans=tickadj
3547    ;;
3548esac
3549ac_cv_var_nlist_tickadj=$ans])
3550case "$ac_cv_var_nlist_tickadj" in
3551 ''|no) ;;	# HMS: I think we can only get 'no' here...
3552 *) AC_DEFINE_UNQUOTED(K_TICKADJ_NAME, "$ac_cv_var_nlist_tickadj", [What is the name of TICKADJ in the kernel?]) ;;
3553esac
3554#
3555AC_CACHE_CHECK([for the units of 'tickadj'],
3556ac_cv_var_tickadj_nano,
3557[ans=usec
3558case "$host" in
3559 *-*-solaris2*)
3560    ans=nsec
3561    ;;
3562esac
3563ac_cv_var_tickadj_nano=$ans])
3564case "$ac_cv_var_tickadj_nano" in
3565 nsec)
3566    AC_DEFINE(TICKADJ_NANO, 1, [Is K_TICKADJ_NAME in nanoseconds?])
3567    ;;
3568esac
3569#
3570AC_CACHE_CHECK([half-heartedly for 'dosynctodr' in the kernel],
3571ac_cv_var_nlist_dosynctodr,
3572[case "$host" in
3573 *-apple-aux[[23]]*)
3574    ans=no
3575    ;;
3576 *-sni-sysv*)
3577    ans=dosynctodr
3578    ;;
3579 *-*-aix*)
3580    ans=dosynctodr
3581    ;;
3582 *-*-hpux*)
3583    ans=no
3584    ;;
3585 *-*-mpeix*)
3586    ans=no
3587    ;;
3588 *-*-nextstep*)
3589    ans=_dosynctodr
3590    ;;
3591 *-*-ptx*)
3592    ans=doresettodr
3593    ;;
3594 *-*-sco3.2v4*)
3595    ans=no
3596    ;;
3597 *-*-sco3.2v5*)
3598    ans=track_rtc
3599    ;;
3600 *-*-solaris2*)
3601    ans=dosynctodr
3602    ;;
3603 *-*-sysv4*)
3604    ans=doresettodr
3605    ;;
3606 *)
3607    ans=_dosynctodr
3608    ;;
3609esac
3610ac_cv_var_nlist_dosynctodr=$ans])
3611case "$ac_cv_var_nlist_dosynctodr" in
3612 no) ;;
3613 *)  AC_DEFINE_UNQUOTED(K_DOSYNCTODR_NAME, "$ac_cv_var_nlist_dosynctodr", [What is (probably) the name of DOSYNCTODR in the kernel?])
3614     ;;
3615esac
3616#
3617AC_CACHE_CHECK([half-heartedly for 'noprintf' in the kernel],
3618ac_cv_var_nlist_noprintf,
3619[case "$host" in
3620 *-apple-aux[[23]]*)
3621    ans=no
3622    ;;
3623 *-sni-sysv*)
3624    ans=noprintf
3625    ;;
3626 *-*-aix*)
3627    ans=noprintf
3628    ;;
3629 *-*-hpux*)
3630    ans=no
3631    ;;
3632 *-*-mpeix*)
3633    ans=no
3634    ;;
3635 *-*-ptx*)
3636    ans=noprintf
3637    ;;
3638 *-*-nextstep*)
3639    ans=_noprintf
3640    ;;
3641 *-*-solaris2*)
3642    ans=noprintf
3643    ;;
3644 *-*-sysv4*)
3645    ans=noprintf
3646    ;;
3647 *)
3648    ans=_noprintf
3649    ;;
3650esac
3651ac_cv_var_nlist_noprintf=$ans])
3652case "$ac_cv_var_nlist_noprintf" in
3653 no) ;;
3654 *)  AC_DEFINE_UNQUOTED(K_NOPRINTF_NAME, "$ac_cv_var_nlist_noprintf", [What is (probably) the name of NOPRINTF in the kernel?])
3655     ;;
3656esac
3657
3658dnl The tick/tickadj sections were written by Skippy, who never learned
3659dnl that it's impolite (horridly gross) to show your guts in public.
3660
3661dnl	tick		tickadj
3662dnl	10000		80	    Unixware
3663dnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3664dnl	10000		150	    sgi IRIX
3665dnl	1000000L/hz	1000	    RS6000 && NOKMEM
3666dnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3667dnl	1000000L/hz	500/HZ	    other && NOKMEM
3668dnl	txc.tick	1	    Linux
3669dnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3670dnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3671dnl				    (RS6000 && !NOKMEM), SINIX MIPS
3672
3673dnl But we'll only use these "values" if we can't find anything else.
3674
3675AC_MSG_CHECKING([for a default value for 'tick'])
3676
3677# target-dependent default for tick
3678
3679case "$host" in
3680 *-*-pc-cygwin*)
3681    AC_MSG_ERROR([tick needs work for cygwin])
3682    ;;
3683 *-univel-sysv*)
3684    ans=10000
3685    ;;
3686 *-*-irix*)
3687    ans=10000
3688    ;;
3689 *-*-*linux*)
3690    ans=txc.tick
3691    ;;
3692 *-*-mpeix*)
3693    ans=no
3694    ;;
3695 *-*-winnt3.5)
3696    ans='(every / 10)'
3697    ;;
3698 *-*-unicosmp*)
3699    ans=10000
3700    ;;
3701 *)
3702    ans='1000000L/hz'
3703    ;;
3704esac
3705
3706AC_ARG_ENABLE(
3707    [tick],
3708    AC_HELP_STRING(
3709	[--enable-tick=VALUE],
3710	[s force a value for 'tick']
3711    ),
3712    [ans=$enableval]
3713)
3714
3715AC_MSG_RESULT([$ans])
3716
3717case "$ans" in
3718 ''|no) ;;	# HMS: I think we can only get 'no' here...
3719 *) AC_DEFINE_UNQUOTED(PRESET_TICK, [$ans], [Preset a value for 'tick'?]) ;;
3720esac
3721
3722
3723AC_MSG_CHECKING([for a default value for 'tickadj'])
3724
3725# target-specific default
3726
3727ans='500/hz'
3728
3729case "$host" in
3730 *-fujitsu-uxp*)
3731    case "$adjtime_is_accurate" in
3732     yes)
3733         ans='tick/16'
3734    esac
3735    ;;
3736 XXX-*-pc-cygwin*)
3737    ans=no
3738    ;;
3739 *-univel-sysv*)
3740    ans=80
3741    ;;
3742 *-*-aix*)
3743    case "$can_kmem" in
3744     no)
3745	ans=1000
3746    esac
3747    ;;
3748 *-*-domainos)	# Skippy: won't be found...
3749    case "$can_kmem" in
3750     no)
3751	ans=668
3752    esac
3753    ;;
3754 *-*-hpux*)
3755    case "$adjtime_is_accurate" in
3756     yes)
3757	ans='tick/16'
3758    esac
3759    ;;
3760 *-*-irix*)
3761    ans=150
3762    ;;
3763 *-*-mpeix*)
3764    ans=no
3765    ;;
3766 *-*-sco3.2v5.0*)
3767    ans=10000L/hz
3768    ;;
3769 *-*-winnt3.5)
3770    ans=50
3771    ;;
3772 *-*-unicosmp*)
3773    ans=150
3774esac
3775
3776AC_ARG_ENABLE(
3777    [tickadj],
3778    AC_HELP_STRING(
3779        [--enable-tickadj=VALUE],
3780        [s force a value for 'tickadj']
3781    ),
3782    [ans=$enableval]
3783)
3784
3785AC_MSG_RESULT([$ans])
3786
3787default_tickadj=$ans
3788
3789case "$default_tickadj" in
3790 ''|no) ;;	# HMS: I think we can only get 'no' here...
3791 *) AC_DEFINE_UNQUOTED(PRESET_TICKADJ, $default_tickadj, [Preset a value for 'tickadj'?]) ;;
3792esac
3793
3794# Newer versions of ReliantUNIX round adjtime() values down to
3795# 1/100s (system tick). Sigh ...
3796# Unfortunately, there is no easy way to know if particular release
3797# has this "feature" or any obvious way to test for it.
3798case "$host" in
3799 mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX_CLOCK, 1, [Do we want the ReliantUNIX clock hacks?]) ;;
3800esac
3801
3802case "$host" in
3803 *-*-sco3.2v5*) AC_DEFINE(SCO5_CLOCK, 1, [Do we want the SCO clock hacks?]) ;;
3804esac
3805
3806ac_cv_make_tickadj=yes
3807case "$can_kmem$ac_cv_var_tick$default_tickadj" in
3808 nonono)	# Don't read KMEM, no presets.  Bogus.
3809    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3810    ac_cv_make_tickadj=no
3811    ;;
3812 nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3813    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3814    ac_cv_make_tickadj=no
3815    ;;
3816 no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3817    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3818    ac_cv_make_tickadj=no
3819    ;;
3820 no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3821    ;;
3822 yesnono)	# Read KMEM, no presets.  Cool.
3823    ;;
3824 yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3825    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3826    ;;
3827 yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3828    ;;
3829 yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3830    ;;
3831 *)		# Generally bogus.
3832    AC_MSG_ERROR([This shouldn't happen.])
3833    ;;
3834esac
3835
3836AC_SUBST(MAKE_NTPTIME)
3837AC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3838[case "$host" in
3839 *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in
3840     yesyes)
3841	ans=yes
3842	;;
3843     *)
3844	ans=no
3845	;;
3846    esac
3847    ;;
3848esac
3849ac_cv_make_ntptime=$ans])
3850case "$ac_cv_make_ntptime" in
3851 yes)
3852    MAKE_NTPTIME=ntptime
3853    ;;
3854esac
3855
3856AC_SUBST(MAKE_TICKADJ)
3857case "$host" in
3858 mips-sni-sysv4*)
3859    # tickadj is pretty useless on newer versions of ReliantUNIX
3860    # Do not bother
3861    ac_cv_make_tickadj=no
3862    ;;
3863 *-*-irix*)
3864    ac_cv_make_tickadj=no
3865    ;;
3866 *-*-solaris2*)
3867    # DLM says tickadj is a no-no starting with solaris2.5
3868    case "$host" in
3869     *-*-solaris2.1[[0-9]]*)
3870	ac_cv_make_tickadj=no
3871	;;
3872     *-*-solaris2.[[0-4]]*) ;;
3873     *) ac_cv_make_tickadj=no ;;
3874    esac
3875    ;;
3876 *-*-unicosmp*)
3877    ac_cv_make_tickadj=no
3878    ;;
3879esac
3880
3881#
3882# Despite all the above, we always make tickadj.  Setting
3883# ac_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3884# report that the configuration variable was cached.  It may
3885# be better to simply remove the hunk above, I did not want
3886# to remove it if there is hope it will be used again.
3887#
3888unset ac_cv_make_tickadj
3889
3890AC_CACHE_CHECK([if we want and can make the tickadj utility], ac_cv_make_tickadj,
3891ac_cv_make_tickadj=yes)
3892case "$ac_cv_make_tickadj" in
3893 yes)
3894    MAKE_TICKADJ=tickadj
3895    ;;
3896esac
3897
3898AC_SUBST(MAKE_TIMETRIM)
3899AC_CACHE_CHECK([if we want and can make the timetrim utility], ac_cv_make_timetrim,
3900[case "$host" in
3901 *-*-irix*)
3902    ac_cv_make_timetrim=yes
3903    ;;
3904 *-*-unicosmp*)
3905    ac_cv_make_timetrim=yes
3906    ;;
3907 *)
3908    ac_cv_make_timetrim=no
3909    ;;
3910esac])
3911case "$ac_cv_make_timetrim" in
3912 yes)
3913    MAKE_TIMETRIM=timetrim
3914    ;;
3915esac
3916
3917AC_SUBST(MAKE_LIBNTPSIM)
3918AC_SUBST(MAKE_NTPDSIM)
3919
3920AC_MSG_CHECKING([if we want to build the NTPD simulator])
3921
3922AC_ARG_ENABLE(
3923    [simulator],
3924    AC_HELP_STRING(
3925	[--enable-simulator],
3926	[- build/install the NTPD simulator?]
3927    ),
3928    [ans=$enableval],
3929    [ans=no]
3930)
3931
3932AC_MSG_RESULT([$ans])
3933
3934case "$ans" in
3935 yes)
3936    MAKE_NTPDSIM=ntpdsim
3937    MAKE_LIBNTPSIM=libntpsim.a
3938    ;;
3939esac
3940
3941case "$build" in
3942 $host)
3943    ;;
3944 *) case "$host" in
3945     *-*-vxworks*)
3946	LDFLAGS="$LDFLAGS -r"
3947	;;
3948    esac
3949    ;;
3950esac
3951
3952
3953AC_MSG_CHECKING([if we should always slew the time])
3954
3955# target-specific defaults
3956
3957case "$host" in
3958 *-apple-aux[[23]]*)
3959    ans=yes
3960    ;;
3961 *-*-bsdi[[012]]*)
3962    ans=no
3963    ;;
3964 *-*-bsdi*)
3965    ans=yes
3966    ;;
3967 *-*-openvms*)	# HMS: won't be found
3968    ans=yes
3969    ;;
3970 *) ans=no
3971    ;;
3972esac
3973
3974# --enable-slew-always / --disable-slew-always overrides default
3975
3976AC_ARG_ENABLE(
3977    [slew-always],
3978    AC_HELP_STRING(
3979	[--enable-slew-always],
3980	[s always slew the time]
3981    ),
3982    [ans=$enableval]
3983)
3984
3985AC_MSG_RESULT([$ans])
3986
3987case "$ans" in
3988 yes) AC_DEFINE(SLEWALWAYS, 1, [Slew always?]) ;;
3989esac
3990
3991AC_MSG_CHECKING([if we should step and slew the time])
3992
3993case "$host" in
3994 *-sni-sysv*)
3995    ans=yes
3996    ;;
3997 *-univel-sysv*)
3998    ans=no
3999    ;;
4000 *-*-ptx*)
4001    ans=yes
4002    ;;
4003 *-*-solaris2.1[[0-9]]*)
4004    ans=no
4005    ;;
4006 *-*-solaris2.[[012]]*)
4007    ans=yes
4008    ;;
4009 *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4010    ans=yes
4011    ;;
4012 *) ans=no
4013    ;;
4014esac
4015
4016
4017AC_ARG_ENABLE(
4018    [step-slew],
4019    AC_HELP_STRING(
4020	[--enable-step-slew],
4021	[s step and slew the time]
4022    ),
4023    [ans=$enableval]
4024)
4025
4026AC_MSG_RESULT([$ans])
4027
4028case "$ans" in
4029 yes) AC_DEFINE(STEP_SLEW, 1, [Step, then slew the clock?]) ;;
4030esac
4031
4032AC_MSG_CHECKING([if ntpdate should step the time])
4033
4034case "$host" in
4035 *-apple-aux[[23]]*)
4036    ans=yes
4037    ;;
4038 *) ans=no
4039esac
4040
4041AC_ARG_ENABLE(
4042    [ntpdate-step],
4043    AC_HELP_STRING(
4044	[--enable-ntpdate-step],
4045	[s if ntpdate should step the time]
4046    ),
4047    [ans=$enableval]
4048)
4049
4050AC_MSG_RESULT([$ans])
4051
4052case "$ans" in
4053 yes) AC_DEFINE(FORCE_NTPDATE_STEP, 1, [force ntpdate to step the clock if !defined(STEP_SLEW) ?]) ;;
4054esac
4055
4056
4057AC_MSG_CHECKING([if we should sync TODR clock every hour])
4058
4059case "$host" in
4060 *-*-nextstep*)
4061    ans=yes
4062    ;;
4063 *-*-openvms*)	# HMS: won't be found
4064    ans=yes
4065    ;;
4066 *)
4067    ans=no
4068esac
4069
4070AC_ARG_ENABLE(
4071    [hourly-todr-sync],
4072    AC_HELP_STRING(
4073	[--enable-hourly-todr-sync],
4074	[s if we should sync TODR hourly]
4075    ),
4076    [ans=$enableval]
4077)
4078
4079AC_MSG_RESULT([$ans])
4080
4081case "$ac_cv_var_sync_todr" in
4082 yes) AC_DEFINE(DOSYNCTODR, 1, [synch TODR hourly?]) ;;
4083esac
4084
4085
4086AC_MSG_CHECKING([if we should avoid kernel FLL bug])
4087
4088case "$host" in
4089 *-*-solaris2.6)
4090    unamev=`uname -v`
4091    case "$unamev" in
4092     Generic_105181-*)
4093	old_IFS="$IFS"
4094	IFS="-"
4095	set $unamev
4096	IFS="$old_IFS"
4097	if test "$2" -ge 17
4098	then
4099	    # Generic_105181-17 and higher
4100	    ans=no
4101	else
4102	    ans=yes
4103	fi
4104	;;
4105     *)
4106	ans=yes
4107    esac
4108    ;;
4109 *-*-solaris2.7)
4110    unamev=`uname -v`
4111    case "$unamev" in
4112     Generic_106541-*)
4113	old_IFS="$IFS"
4114	IFS="-"
4115	set $unamev
4116	IFS="$old_IFS"
4117	if test "$2" -ge 07
4118	then
4119	    # Generic_106541-07 and higher
4120	    ans=no
4121	else
4122	    ans=yes
4123	fi
4124	;;
4125     *)
4126	ans=yes
4127    esac
4128    ;;
4129 *)
4130    ans=no
4131esac
4132
4133AC_ARG_ENABLE(
4134    [kernel-fll-bug],
4135    AC_HELP_STRING(
4136	[--enable-kernel-fll-bug],
4137	[s if we should avoid a kernel FLL bug]
4138    ),
4139    [ans=$enableval]
4140)
4141
4142AC_MSG_RESULT([$ans])
4143
4144case "$ans" in
4145 yes) AC_DEFINE(KERNEL_FLL_BUG, 1, [Does the kernel have an FLL bug?]) ;;
4146esac
4147
4148
4149AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4150
4151case "$host" in
4152 *-*-solaris2.[[89]])
4153    ans=yes
4154    ;;
4155 *-*-solaris2.1[[0-9]]*)
4156    ans=yes
4157    ;;
4158 *) ans=no
4159esac
4160
4161AC_ARG_ENABLE(
4162    [irig-sawtooth],
4163    AC_HELP_STRING(
4164	[--enable-irig-sawtooth],
4165	[s if we should enable the IRIG sawtooth filter]
4166    ),
4167    [ans=$enableval]
4168)
4169
4170AC_MSG_RESULT([$ans])
4171
4172case "$ans" in
4173 yes) AC_DEFINE(IRIG_SUCKS, 1, [Should we use the IRIG sawtooth filter?]) ;;
4174esac
4175
4176
4177AC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4178
4179AC_ARG_ENABLE(
4180	[nist],
4181	AC_HELP_STRING(
4182	    [--enable-nist],
4183	    [- if we should enable the NIST lockclock scheme]
4184	),
4185	[ans=$enableval],
4186	[ans=no]
4187)
4188
4189AC_MSG_RESULT([$ans])
4190
4191case "$ans" in
4192 yes) AC_DEFINE(LOCKCLOCK, 1, [Should we align with the NIST lockclock scheme?]) ;;
4193esac
4194
4195
4196AC_MSG_CHECKING([if we want support for Samba's signing daemon])
4197
4198AC_ARG_ENABLE(
4199    [ntp-signd],
4200    AC_HELP_STRING(
4201        [--enable-ntp-signd],
4202        [- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4203    ),
4204    [ans=$enableval],
4205    [ans=no]
4206)
4207
4208AC_MSG_RESULT([$ans])
4209
4210case "$ans" in
4211 no)
4212    ntp_signd_path=
4213    ;;
4214 yes)
4215    ntp_signd_path=/var/run/ntp_signd
4216    ;;
4217 *)
4218    ntp_signd_path="$ans"
4219esac
4220
4221case "$ntp_signd_path" in
4222 '')
4223    wintime_default=no
4224    ;;
4225 *)
4226    wintime_default=yes
4227    AC_DEFINE(HAVE_NTP_SIGND, ,[Do we want support for Samba's signing daemon?])
4228    AC_DEFINE_UNQUOTED(NTP_SIGND_PATH, "$ntp_signd_path", [Path to sign daemon rendezvous socket])
4229esac
4230
4231
4232AC_MSG_CHECKING([if we want the windows symmetric client hack])
4233
4234# default is no, unless --enable-ntp-signd was given
4235ans=$wintime_default
4236unset wintime_default
4237
4238AC_ARG_ENABLE(
4239    [wintime],
4240    AC_HELP_STRING(
4241        [--enable-wintime],
4242        [- Provide the windows symmetric client hack]
4243    ),
4244    [ans=$enableval],
4245)
4246
4247AC_MSG_RESULT([$ans])
4248
4249case "$ans" in
4250 yes)
4251    AC_DEFINE(WINTIME, ,[Do we want the windows symmetric client hack?])
4252esac
4253
4254
4255AC_CHECK_HEADERS(sys/clockctl.h)
4256
4257case "$host" in
4258 *-*-netbsd*)
4259    ans=yes
4260    ;;
4261 *) ans=no
4262    ;;
4263esac
4264
4265AC_ARG_ENABLE(
4266    [clockctl],
4267    AC_HELP_STRING(
4268	[--enable-clockctl],
4269	[s Use /dev/clockctl for non-root clock control]
4270    ),
4271    [ntp_use_dev_clockctl=$enableval],
4272    [ntp_use_dev_clockctl=$ac_cv_header_sys_clockctl_h]
4273)
4274
4275AC_MSG_CHECKING([[if we should use /dev/clockctl]])
4276AC_MSG_RESULT([$ntp_use_dev_clockctl])
4277
4278
4279AC_CHECK_HEADERS([sys/capability.h])
4280AC_CHECK_HEADERS([sys/prctl.h])
4281
4282AC_MSG_CHECKING([[if we have linux capabilities (libcap)]])
4283
4284case "$ac_cv_header_sys_capability_h$ac_cv_header_sys_prctl_h" in
4285 yesyes)
4286    ntp_have_linuxcaps=yes
4287    ;;
4288 *)
4289    ntp_have_linuxcaps=no
4290esac
4291
4292AC_MSG_RESULT([$ntp_have_linuxcaps])
4293
4294
4295AC_ARG_ENABLE(
4296    [linuxcaps],
4297    AC_HELP_STRING(
4298	[--enable-linuxcaps],
4299	[+ Use Linux capabilities for non-root clock control]
4300    ),
4301    [ntp_have_linuxcaps=$enableval]
4302)
4303
4304
4305case "$ntp_have_linuxcaps" in
4306 yes)
4307    AC_DEFINE(HAVE_LINUX_CAPABILITIES, ,[[Do we have Linux capabilities?]])
4308    LIBS="$LIBS -lcap"
4309esac
4310
4311
4312case "$ntp_use_dev_clockctl$ntp_have_linuxcaps" in
4313 *yes*)
4314    AC_DEFINE(HAVE_DROPROOT, ,[[Can we drop root privileges?]])
4315esac
4316
4317
4318AC_CHECK_HEADERS([libscf.h])
4319
4320case "$ac_cv_header_libscf_h" in
4321 yes)
4322    AC_SUBST(LSCF, [-lscf])
4323esac
4324
4325AC_CHECK_FUNC(
4326    [setppriv],
4327    AC_DEFINE(HAVE_SOLARIS_PRIVS, ,[[Are Solaris privileges available?]])
4328)
4329
4330
4331#
4332# ISC stuff
4333#
4334
4335if test $ac_cv_struct_sockaddr_has_sa_len = yes; then
4336    AC_DEFINE(ISC_PLATFORM_HAVESALEN, ,[ISC: struct sockaddr as sa_len?])
4337fi
4338
4339AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--enable-ipv6], [s use IPv6?]))
4340
4341case "$enable_ipv6" in
4342 yes|''|autodetect)
4343    case "$host" in
4344     powerpc-ibm-aix4*) ;;
4345     *)
4346	AC_DEFINE(WANT_IPV6, ,[configure --enable-ipv6])
4347	;;
4348    esac
4349    ;;
4350 no)
4351    ;;
4352esac
4353
4354
4355AC_CACHE_CHECK(
4356    [for IPv6 structures],
4357    ac_cv_isc_found_ipv6,
4358    [
4359	AC_COMPILE_IFELSE(
4360	    [
4361		AC_LANG_PROGRAM(
4362		    [
4363			#include <sys/types.h>
4364			#include <sys/socket.h>
4365			#include <netinet/in.h>
4366		    ],
4367		    [
4368			struct sockaddr_in6 sin6;
4369		    ]
4370		)
4371	    ],
4372	    [ac_cv_isc_found_ipv6=yes],
4373	    [ac_cv_isc_found_ipv6=no]
4374	)
4375    ]
4376)
4377
4378#
4379# See whether IPv6 support is provided via a Kame add-on.
4380# This is done before other IPv6 linking tests so LIBS is properly set.
4381#
4382AC_MSG_CHECKING([for Kame IPv6 support])
4383AC_ARG_WITH(kame,
4384	[AC_HELP_STRING([--with-kame], [- =/usr/local/v6])],
4385	use_kame="$withval", use_kame="no")
4386
4387case "$use_kame" in
4388 no)
4389    ;;
4390 yes)
4391    kame_path=/usr/local/v6
4392    ;;
4393 *)
4394    kame_path="$use_kame"
4395    ;;
4396esac
4397
4398case "$use_kame" in
4399 no)
4400    AC_MSG_RESULT(no)
4401    ;;
4402 *)
4403    if test -f $kame_path/lib/libinet6.a; then
4404	AC_MSG_RESULT($kame_path/lib/libinet6.a)
4405	LIBS="-L$kame_path/lib -linet6 $LIBS"
4406    else
4407	AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
4408
4409Please choose the proper path with the following command:
4410
4411    configure --with-kame=PATH
4412])
4413    fi
4414    ;;
4415esac
4416
4417#
4418# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
4419# Including it on Kame-using platforms is very bad, though, because
4420# Kame uses #error against direct inclusion.   So include it on only
4421# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
4422# This is done before the in6_pktinfo check because that's what
4423# netinet6/in6.h is needed for.
4424#
4425case "$host" in
4426 *-bsdi4.[[01]]*)
4427    AC_DEFINE(ISC_PLATFORM_NEEDNETINET6IN6H, 1, [Do we need netinet6/in6.h?])
4428    isc_netinet6in6_hack="#include <netinet6/in6.h>"
4429    ;;
4430 *)
4431    isc_netinet6in6_hack=""
4432esac
4433
4434#
4435# This is similar to the netinet6/in6.h issue.
4436#
4437case "$host" in
4438 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
4439    AC_DEFINE(ISC_PLATFORM_FIXIN6ISADDR, 1,[Do we need to fix in6isaddr?])
4440    isc_netinetin6_hack="#include <netinet/in6.h>"
4441    ;;
4442 *)
4443    isc_netinetin6_hack=""
4444esac
4445
4446
4447case "$ac_cv_isc_found_ipv6" in
4448 yes)
4449    AC_DEFINE(ISC_PLATFORM_HAVEIPV6, ,[have IPv6?])
4450
4451    AC_CACHE_CHECK(
4452	[for in6_pktinfo],
4453	ac_cv_have_in6_pktinfo,
4454	[
4455	    AC_COMPILE_IFELSE(
4456		[
4457		    AC_LANG_PROGRAM(
4458			[
4459			    #include <sys/types.h>
4460			    #include <sys/socket.h>
4461			    #include <netinet/in.h>
4462			    $isc_netinetin6_hack
4463			    $isc_netinet6in6_hack
4464			],
4465			[
4466			    struct in6_pktinfo xyzzy;
4467			]
4468		    )
4469		],
4470		[ac_cv_have_in6_pktinfo=yes],
4471		[ac_cv_have_in6_pktinfo=no]
4472	    )
4473	]
4474    )
4475
4476    case "$ac_cv_have_in6_pktinfo" in
4477     yes)
4478	AC_DEFINE(ISC_PLATFORM_HAVEIN6PKTINFO, , [have struct in6_pktinfo?])
4479    esac
4480
4481
4482    # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
4483    AC_CACHE_CHECK(
4484	[for sockaddr_in6.sin6_scope_id],
4485	ac_cv_have_sin6_scope_id,
4486	[
4487	    AC_COMPILE_IFELSE(
4488		[
4489		    AC_LANG_PROGRAM(
4490			[
4491			    #include <sys/types.h>
4492			    #include <sys/socket.h>
4493			    #include <netinet/in.h>
4494			    $isc_netinetin6_hack
4495			    $isc_netinet6in6_hack
4496			],
4497			[
4498			    struct sockaddr_in6 xyzzy;
4499			    xyzzy.sin6_scope_id = 0;
4500			]
4501		    )
4502		],
4503		[ac_cv_have_sin6_scope_id=yes],
4504		[ac_cv_have_sin6_scope_id=no]
4505	    )
4506	]
4507    )
4508
4509    case "$ac_cv_have_sin6_scope_id" in
4510     yes)
4511	AC_DEFINE(ISC_PLATFORM_HAVESCOPEID, , [have sin6_scope_id?])
4512    esac
4513esac
4514
4515
4516# We need this check run even without ac_cv_isc_found_ipv6=yes
4517
4518AC_CACHE_CHECK(
4519    [for in6addr_any],
4520    ac_cv_have_in6addr_any,
4521    [
4522	AC_COMPILE_IFELSE(
4523	    [
4524		AC_LANG_PROGRAM(
4525		    [
4526			#include <sys/types.h>
4527			#include <sys/socket.h>
4528			#include <netinet/in.h>
4529			$isc_netinetin6_hack
4530			$isc_netinet6in6_hack
4531		    ],
4532		    [
4533			struct in6_addr in6;
4534			in6 = in6addr_any;
4535		    ]
4536		)
4537	    ],
4538	    [ac_cv_have_in6addr_any=yes],
4539	    [ac_cv_have_in6addr_any=no]
4540	)
4541    ]
4542)
4543
4544case "$ac_cv_have_in6addr_any" in
4545 no)
4546    AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, , [missing in6addr_any?])
4547esac
4548
4549
4550AC_CACHE_CHECK(
4551    [for struct if_laddrconf],
4552    ac_cv_isc_struct_if_laddrconf,
4553    [
4554        AC_COMPILE_IFELSE(
4555	    [
4556		AC_LANG_PROGRAM(
4557		    [
4558			#include <sys/types.h>
4559			#include <net/if6.h>
4560		    ],
4561		    [
4562			struct if_laddrconf a;
4563		    ]
4564		)
4565	    ],
4566	    [ac_cv_isc_struct_if_laddrconf=yes],
4567	    [ac_cv_isc_struct_if_laddrconf=no]
4568	)
4569    ]
4570)
4571
4572case "$ac_cv_isc_struct_if_laddrconf" in
4573 yes)
4574    AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRCONF, , [have struct if_laddrconf?])
4575esac
4576
4577AC_CACHE_CHECK(
4578    [for struct if_laddrreq],
4579    ac_cv_isc_struct_if_laddrreq,
4580    [
4581        AC_COMPILE_IFELSE(
4582	    [
4583		AC_LANG_PROGRAM(
4584		    [
4585			#include <sys/types.h>
4586			#include <net/if6.h>
4587		    ],
4588		    [
4589			struct if_laddrreq a;
4590		    ]
4591		)
4592	    ],
4593	    [ac_cv_isc_struct_if_laddrreq=yes],
4594	    [ac_cv_isc_struct_if_laddrreq=no]
4595	)
4596    ]
4597)
4598
4599case "$ac_cv_isc_struct_if_laddrreq" in
4600 yes)
4601    AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRREQ, , [have struct if_laddrreq?])
4602esac
4603
4604#
4605# Look for a sysctl call to get the list of network interfaces.
4606#
4607AC_CACHE_CHECK(
4608    [for interface list sysctl],
4609    ac_cv_iflist_sysctl,
4610    AC_EGREP_CPP(
4611	[found_rt_iflist],
4612	[
4613	    #include <sys/param.h>
4614	    #include <sys/sysctl.h>
4615	    #include <sys/socket.h>
4616	    #ifdef NET_RT_IFLIST
4617	    found_rt_iflist
4618	    #endif
4619	],
4620	[ac_cv_iflist_sysctl=yes],
4621	[ac_cv_iflist_sysctl=no]
4622    )
4623)
4624
4625case "$ac_cv_iflist_sysctl" in
4626 yes)
4627    AC_DEFINE(HAVE_IFLIST_SYSCTL,1,[have iflist_sysctl?])
4628esac
4629
4630
4631###
4632
4633AC_DEFINE_DIR(NTP_KEYSDIR, sysconfdir, [Default location of crypto key info])
4634
4635AC_CONFIG_FILES(Makefile)
4636AC_CONFIG_FILES(ElectricFence/Makefile)
4637AC_CONFIG_FILES(adjtimed/Makefile)
4638AC_CONFIG_FILES(clockstuff/Makefile)
4639AC_CONFIG_FILES(include/Makefile)
4640AC_CONFIG_FILES(include/isc/Makefile)
4641AC_CONFIG_FILES(kernel/Makefile)
4642AC_CONFIG_FILES(kernel/sys/Makefile)
4643AC_CONFIG_FILES(libntp/Makefile)
4644AC_CONFIG_FILES(libparse/Makefile)
4645AC_CONFIG_FILES(ntpd/Makefile)
4646AC_CONFIG_FILES(ntpdate/Makefile)
4647AC_CONFIG_FILES(ntpdc/Makefile)
4648AC_CONFIG_FILES(ntpdc/nl.pl,		[chmod +x ntpdc/nl.pl])
4649AC_CONFIG_FILES(ntpq/Makefile)
4650AC_CONFIG_FILES(parseutil/Makefile)
4651AC_CONFIG_FILES(scripts/Makefile)
4652AC_CONFIG_FILES(scripts/calc_tickadj,	[chmod +x scripts/calc_tickadj])
4653AC_CONFIG_FILES(scripts/checktime,	[chmod +x scripts/checktime])
4654AC_CONFIG_FILES(scripts/freq_adj,	[chmod +x scripts/freq_adj])
4655AC_CONFIG_FILES(scripts/html2man,	[chmod +x scripts/html2man])
4656AC_CONFIG_FILES(scripts/mkver,		[chmod +x scripts/mkver])
4657AC_CONFIG_FILES(scripts/ntp-wait,	[chmod +x scripts/ntp-wait])
4658AC_CONFIG_FILES(scripts/ntpsweep,	[chmod +x scripts/ntpsweep])
4659AC_CONFIG_FILES(scripts/ntptrace,	[chmod +x scripts/ntptrace])
4660AC_CONFIG_FILES(scripts/ntpver,		[chmod +x scripts/ntpver])
4661AC_CONFIG_FILES(scripts/plot_summary,	[chmod +x scripts/plot_summary])
4662AC_CONFIG_FILES(scripts/summary,	[chmod +x scripts/summary])
4663AC_CONFIG_FILES(util/Makefile)
4664
4665AC_CONFIG_SUBDIRS(sntp)
4666
4667AC_OUTPUT
4668