configure.ac revision 280849
1280849Scydnl NTP top-level configure.ac				-*- Autoconf -*-
2280849Scydnl
3280849Scym4_include([sntp/m4/version.m4])
4280849ScyAC_PREREQ([2.61])
5280849ScyAC_INIT(
6280849Scy    [ntp],
7280849Scy    [VERSION_NUMBER],
8280849Scy    [http://bugs.ntp.org./],
9280849Scy    [],
10280849Scy    [http://www.ntp.org./]dnl
11280849Scy)
12280849ScyAC_CONFIG_MACRO_DIR([sntp/m4])
13280849ScyAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14280849Scy
15280849ScyAC_PRESERVE_HELP_ORDER
16280849Scy
17280849Scy# Bump ntp_configure_cache_version for each change to configure.ac or
18280849Scy# .m4 files which invalidates cached values from previous configure 
19280849Scy# runs.
20280849Scy#
21280849Scy# If the change affects cache variables used only by the main NTP
22280849Scy# configure.ac, then only its version number should be bumped, while
23280849Scy# the subdir configure.ac version numbers should be unchanged.  The
24280849Scy# same is true for a test/variable that is used only by one subdir
25280849Scy# being changed incompatibly; only that subdir's cache version needs
26280849Scy# bumping.
27280849Scy#
28280849Scy# If a change affects variables shared by all NTP configure scripts,
29280849Scy# please bump the version numbers of each.  If you are not sure, the
30280849Scy# safe choice is to bump all on any cache-invalidating change.
31280849Scy#
32280849Scy# In order to avoid the risk of version stamp collision between -stable
33280849Scy# and -dev branches, do not simply increment the version, instead use
34280849Scy# the date YYYYMMDD optionally with -HHMM if there is more than one
35280849Scy# bump in a day.
36280849Scy
37280849Scyntp_configure_cache_version=20120806
38280849Scy
39280849Scy# When the cache version of config.cache and configure do not
40280849Scy# match, NTP_CACHEVERSION will flush the cache.
41280849Scy
42280849ScyNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
43280849Scy
44280849ScyAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
45280849Scy
46280849Scydnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
47280849Scym4_ifdef(
48280849Scy    [AM_SILENT_RULES],
49280849Scy    [AM_SILENT_RULES([yes])]
50280849Scy)
51280849ScyAC_CANONICAL_BUILD
52181834SrobertoAC_CANONICAL_HOST
53181834Srobertodnl the 'build' machine is where we run configure and compile
54181834Srobertodnl the 'host' machine is where the resulting stuff runs.
55280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
56280849Scy    [canonical system (cpu-vendor-os) of where we should run])
57280849ScyAC_CONFIG_HEADERS([config.h])
58181834Srobertodnl AC_ARG_PROGRAM
59181834Sroberto
60280849Scyntp_atom_ok=${ntp_atom_ok=no}
61280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
62280849Scyntp_parse_ok=${ntp_parse_ok=no}
63280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
64280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
65181834Sroberto
66280849ScyNTP_PROG_CC
67280849ScyAC_PROG_CPP
68280849ScyAC_PROG_CXX
69280849ScyAC_PROG_YACC
70280849ScyAC_PROG_CC_C_O
71181834Sroberto
72280849ScyNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
73181834Sroberto
74280849ScyNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
75280849Scy
76280849Scydnl AM_PROG_AR req. automake 1.12
77280849Scym4_ifdef(
78280849Scy    [AM_PROG_AR],
79280849Scy    [AM_PROG_AR]
80280849Scy)
81280849Scy
82200576Sroberto# So far, the only shared library we might use is libopts.
83200576Sroberto# It's a small library - we might as well use a static version of it.
84200576SrobertoAC_DISABLE_SHARED
85280849ScyAC_PROG_LIBTOOL
86280849ScyAC_SUBST([LIBTOOL_DEPS])
87200576Sroberto
88280849Scy# NTP has (so far) been relying on leading-edge autogen, which
89280849Scy# means we need the appropriate corresponding libopts as well.
90181834Sroberto# Therefore, by default:
91280849Scy# - use the version of libopts we ship with
92181834Sroberto# - do not install it
93181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
94181834Srobertocase "${enable_local_libopts+set}" in
95181834Sroberto set) ;;
96181834Sroberto *) enable_local_libopts=yes ;;
97181834Srobertoesac
98181834Srobertocase "${enable_libopts_install+set}" in
99181834Sroberto set) ;;
100181834Sroberto *) enable_libopts_install=no ;;
101181834Srobertoesac
102280849Scyenable_nls=no
103280849ScyLIBOPTS_CHECK_NOBUILD([sntp/libopts])
104181834Sroberto
105280849ScyNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
106181834Sroberto
107280849ScyNTP_LIBNTP
108181834Sroberto
109280849ScyAC_MSG_CHECKING([for deprecated --with-arlib])
110280849ScyAC_ARG_WITH([arlib],
111280849Scy	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
112181834Sroberto	[ans=$withval], [ans=no])
113200576SrobertoAC_MSG_RESULT([$ans])
114181834Sroberto
115181834Srobertocase "$ans" in
116181834Sroberto yes)
117280849Scy    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
118181834Sroberto    ;;
119181834Srobertoesac
120181834Sroberto
121181834Srobertodnl  we need to check for cross compile tools for vxWorks here
122181834SrobertoAC_PROG_AWK
123280849ScyAS_UNSET([ac_cv_prog_AWK])
124280849ScyAC_SUBST([AWK])				dnl scripts/ntpver.in
125181834SrobertoAC_PROG_MAKE_SET
126181834Sroberto
127280849ScyAC_SUBST([CFLAGS])
128280849ScyAC_SUBST([LDFLAGS])
129181834Sroberto
130280849ScyAC_PROG_LN_S
131280849ScyAC_ISC_POSIX
132181834Sroberto
133181834Sroberto
134280849ScyAC_PATH_PROG([PATH_PERL], [perl])
135280849Scydnl  Saving cached hardcoded paths rather than searching $PATH during a
136280849Scydnl  cached configure run is an optimization not worth the the cost of
137280849Scydnl  preventing newly-installed tools from being found.  Short-circuit
138280849Scydnl  the caching after the tests so preset overrides still work.
139280849ScyAS_UNSET([ac_cv_path_PATH_PERL])
140280849ScyAC_PATH_PROG([PATH_TEST], [test])
141280849ScyAS_UNSET([ac_cv_path_PATH_TEST])
142280849Scytest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
143280849ScyAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
144181834Sroberto
145280849ScyAC_ARG_WITH(
146280849Scy    [net-snmp-config],
147280849Scy    [AS_HELP_STRING(
148280849Scy	[--with-net-snmp-config],
149280849Scy	[+ =net-snmp-config]
150280849Scy    )],
151280849Scy    [ans=$withval],
152280849Scy    [ans=yes]
153280849Scy)
154280849Scycase "$ans" in
155280849Scy no)
156181834Sroberto    ;;
157280849Scy yes)
158280849Scy    ans=net-snmp-config
159181834Sroberto    ;;
160280849Scy /*)
161181834Sroberto    ;;
162280849Scy */*)
163280849Scy    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
164181834Sroberto    ;;
165280849Scy *)
166280849Scy    ;;
167181834Srobertoesac
168280849ScyPROG_NET_SNMP_CONFIG=$ans
169280849ScyAC_MSG_CHECKING([for net-snmp-config path])
170280849Scycase "$PROG_NET_SNMP_CONFIG" in
171280849Scy no) ;;
172280849Scy /*)
173280849Scy    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
174181834Sroberto    ;;
175280849Scy *)
176280849Scy    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
177280849Scy    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
178280849Scy;;
179181834Srobertoesac
180280849ScyAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
181181834Sroberto
182181834Srobertocase "$host" in
183181834Sroberto *-*-vxworks*)
184181834Sroberto    ac_link="$ac_link $VX_KERNEL"
185181834Sroberto    ;;
186181834Srobertoesac
187181834Sroberto
188280849Scy# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
189280849ScyAC_SEARCH_LIBS([openlog], [gen syslog])
190280849Scy# XXX library list will be in ac_cv_search_openlog
191181834Sroberto
192280849Scy# LIBSECCOMP is off by default -- needs testing with all the features
193280849Scy# Please send bug reports to loganaden@gmail.com
194280849ScyAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
195280849ScyAC_ARG_ENABLE(
196280849Scy    [libseccomp],
197280849Scy    [AS_HELP_STRING(
198280849Scy	[--enable-libseccomp],
199280849Scy	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
200280849Scy    )],
201280849Scy    [ntp_ok=$enableval],
202280849Scy    [ntp_ok=no]
203280849Scy)
204280849ScyAC_MSG_RESULT([$ntp_ok])
205280849Scycase "$ntp_ok" in
206280849Scy yes)
207280849Scy    AC_SEARCH_LIBS(
208280849Scy	[seccomp_init],
209280849Scy	[seccomp],
210280849Scy	[AC_DEFINE([LIBSECCOMP], [1],
211280849Scy	    [Define to any value to include libseccomp sandboxing.])]
212280849Scy    )
213280849Scy    AC_TRY_RUN([
214280849Scy	#include <stdio.h>
215280849Scy	#include <stdlib.h>
216280849Scy	#include <errno.h>
217280849Scy	#include <sys/prctl.h>
218280849Scy	#include <linux/seccomp.h>
219280849Scy
220280849Scy	int main(void)
221280849Scy	{
222280849Scy		int ret;
223280849Scy		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
224280849Scy		if (ret < 0) {
225280849Scy			switch (errno) {
226280849Scy			case ENOSYS:
227280849Scy				return 1;
228280849Scy			case EINVAL:
229280849Scy				return 1;
230280849Scy			default:
231280849Scy				return 1;
232280849Scy			}
233280849Scy		}
234280849Scy		ret = 
235280849Scy		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
236280849Scy		if (ret < 0) {
237280849Scy			switch (errno) {
238280849Scy			case EINVAL:
239280849Scy				return 1;
240280849Scy			case EFAULT:
241280849Scy				return 0;
242280849Scy			default:
243280849Scy				return 1;
244280849Scy		}
245280849Scy	}
246280849Scyreturn 1;
247280849Scy}
248280849Scy]
249280849Scy, AC_DEFINE([KERN_SECCOMP], 1, 
250280849Scy[Define to use libseccomp system call filtering.])   
251280849Scy, []
252280849Scy)
253181834Sroberto    ;;
254181834Srobertoesac
255181834Sroberto
256280849ScyNTP_FACILITYNAMES
257200576Sroberto
258181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
259181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
260181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
261181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
262181834Srobertodnl real-time library, so we don't want to use it.
263280849Scydnl
264280849Scydnl 081118 Harlan got tired of looking for a way to get the sched*()
265280849Scydnl functions to link OK with either cc or gcc.
266181834Sroberto
267181834Srobertocase "$host" in
268200576Sroberto *-*-*linux*) ;;
269280849Scy *-*-osf4*) ;;
270280849Scy *-*-osf5*) ;;
271181834Sroberto *)
272280849Scy    # HMS: Make sure we check for -lrt for clock_* before this...
273280849Scy    case "$ac_cv_search_clock_gettime" in
274280849Scy     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
275280849Scy    esac
276280849Scy    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
277181834Sroberto    ;;
278181834Srobertoesac
279181834Sroberto
280280849ScyAC_CHECK_HEADERS([bstring.h])
281280849ScyAC_CHECK_HEADER(
282280849Scy    [dns_sd.h],
283280849Scy    [AC_SEARCH_LIBS(
284280849Scy	[DNSServiceRegister],
285280849Scy	[dns_sd],
286280849Scy	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
287280849Scy	    [Use Rendezvous/DNS-SD registration])]
288280849Scy    )]
289280849Scy)
290280849ScyAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
291181834Sroberto
292280849ScyAC_CHECK_HEADERS([memory.h netdb.h poll.h])
293280849ScyAC_CHECK_HEADERS([sgtty.h stdlib.h string.h termio.h])
294280849ScyAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
295181834Sroberto
296181834Srobertocase "$host" in
297181834Sroberto *-*-aix*)
298280849Scy    AC_CHECK_HEADERS([utmpx.h])
299181834Sroberto    case "$ac_cv_header_utmpx_h" in
300280849Scy     yes)
301280849Scy	;;
302280849Scy     *)
303280849Scy	AC_CHECK_HEADERS([utmp.h])
304280849Scy	;;
305181834Sroberto    esac
306181834Sroberto    ;;
307280849Scy *)
308280849Scy    AC_CHECK_HEADERS([utmp.h utmpx.h])
309280849Scy    ;;
310181834Srobertoesac
311280849Scy
312280849Scy#
313280849Scy# On Suns only (so far) getpass() truncates the typed password to 8
314280849Scy# characters, but getpassphrase() allows up to 257.  Most systems'
315280849Scy# getpass() does not truncate, at least not so as to affect ntpq and
316280849Scy# ntpdc password prompts.
317280849Scy#
318280849Scy# So check for getpassphrase(), but only on Sun operating systems.
319280849Scy#
320280849Scycase "$host" in
321280849Scy *-*-sunos*|*-*-solaris*)
322280849Scy    AC_CHECK_FUNCS([getpassphrase])
323280849Scyesac
324280849Scy
325280849Scy
326280849ScyAC_CHECK_HEADERS([net/if6.h])
327280849ScyAC_CHECK_HEADERS([net/route.h], [], [], [
328280849Scy    #include <sys/types.h>
329280849Scy    #include <sys/socket.h>
330280849Scy    #include <net/if.h>
331181834Sroberto])
332200576Sroberto
333280849ScyAC_CHECK_HEADERS([netinfo/ni.h])
334280849Scycase "$ac_cv_header_netinfo_ni_h" in
335200576Sroberto yes)
336280849Scy    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
337200576Srobertoesac
338280849ScyAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
339181834Srobertocase "$host" in
340280849Scy *-*-sunos4*)
341181834Sroberto    ;;
342280849Scy *)
343280849Scy    AC_CHECK_HEADERS([sys/ioctl.h])
344280849Scy    ;;
345181834Srobertoesac
346280849ScyAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
347181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
348280849ScyAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
349181834Srobertocase "$ac_cv_header_sched_h" in
350280849Scy yes)
351181834Sroberto    ;;
352280849Scy *)
353280849Scy    AC_CHECK_HEADERS([sys/sched.h])
354280849Scy    ;;
355181834Srobertoesac
356181834Sroberto# HMS: Check sys/shm.h after some others
357280849ScyAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
358181834Sroberto# HMS: Checked sys/socket.h earlier
359181834Srobertocase "$host" in
360280849Scy *-*-netbsd*)
361181834Sroberto    ;;
362280849Scy *)
363280849Scy    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
364280849Scy    ;;
365181834Srobertoesac
366280849ScyAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
367280849ScyAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
368181834Srobertocase "$host" in
369181834Sroberto*-convex-*)
370280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
371280849Scy    ;;
372181834Sroberto*-*-bsdi*)
373280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
374280849Scy    ;;
375181834Srobertoesac
376181834Sroberto
377181834Srobertocase "$host" in
378280849Scy *-*-solaris2.6)
379280849Scy    # Broken...
380181834Sroberto    ;;
381181834Sroberto *)
382280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
383181834Sroberto    ;;
384181834Srobertoesac
385181834Sroberto
386280849Scycase "$host" in
387280849Scy *-*-*linux*)
388280849Scy    case "$ac_cv_func_ntp_gettime" in
389280849Scy     yes)
390280849Scy	;;
391280849Scy     *)
392280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
393280849Scy	case "$ac_cv_func___ntp_gettime" in
394280849Scy	 yes)
395280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
396280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
397280849Scy	esac
398280849Scy	;;
399280849Scy    esac
400280849Scy    AC_CHECK_FUNCS([adjtimex])
401280849Scy    case "$ac_cv_func_adjtimex" in
402280849Scy     yes)
403280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
404280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
405280849Scy	have_adjtimex=1
406280849Scy	;;
407280849Scy     *)
408280849Scy	AC_CHECK_FUNCS([__adjtimex])
409280849Scy	case "$ac_cv_func___adjtimex" in
410280849Scy	 yes)
411280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
412280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
413280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
414280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
415280849Scy	    have_adjtimex=1
416280849Scy	esac
417280849Scy	;;
418280849Scy    esac
419280849Scyesac
420280849Scycase "$have_adjtimex" in
421280849Scy '')
422280849Scy    # nlist stuff is only needed for tickadj.
423280849Scy    saved_LIBS="$LIBS"
424280849Scy    LIBS=
425280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
426280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
427280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
428280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
429280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
430280849Scy    case "$ac_cv_header_nlist_h" in
431280849Scy     yes)
432280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
433280849Scy	AC_CACHE_CHECK(
434280849Scy	    [for n_un in struct nlist],
435280849Scy	    [ntp_cv_struct_nlist_n_un],
436280849Scy	    [AC_COMPILE_IFELSE(
437280849Scy		[AC_LANG_PROGRAM(
438280849Scy		    [[
439280849Scy			#include <nlist.h>
440280849Scy		    ]],
441280849Scy		    [[
442280849Scy			struct nlist n;
443280849Scy			n.n_un.n_name = 0;
444280849Scy		    ]]
445280849Scy		)]
446280849Scy		[ntp_cv_struct_nlist_n_un=yes],
447280849Scy		[ntp_cv_struct_nlist_n_un=no]
448280849Scy	    )]
449280849Scy	)
450280849Scy	case "$ntp_cv_struct_nlist_n_un" in
451280849Scy	 yes)
452280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
453280849Scy		[does struct nlist use a name union?])
454280849Scy	esac
455280849Scy    esac
456280849Scy    AC_SUBST([LDADD_NLIST])
457280849Scy    LDADD_NLIST="$LIBS"
458280849Scy    LIBS="$saved_LIBS"
459280849Scy    AS_UNSET([saved_LIBS])
460280849Scyesac
461181834Sroberto
462280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
463280849Scy    #ifdef HAVE_SYS_TYPES_H
464280849Scy    # include <sys/types.h>
465280849Scy    #endif
466280849Scy    #ifdef HAVE_SYS_TIME_H
467280849Scy    # include <sys/time.h>
468280849Scy    #endif
469181834Sroberto])
470181834Sroberto
471280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
472280849Scy    #ifdef HAVE_SYS_TIME_H
473280849Scy    # include <sys/time.h>
474280849Scy    #endif
475181834Sroberto])
476181834Sroberto
477280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
478280849Scy    #ifdef HAVE_SYS_TYPES_H
479280849Scy    # include <sys/types.h>
480280849Scy    #endif
481280849Scy    #ifdef HAVE_SYS_IPC_H
482280849Scy    # include <sys/ipc.h>
483280849Scy    #endif
484181834Sroberto])
485181834Sroberto
486280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
487280849Scy    #ifdef HAVE_SYS_TIME_H
488280849Scy    # include <sys/time.h>
489280849Scy    #endif
490181834Sroberto])
491181834Sroberto
492181834SrobertoAC_TYPE_SIGNAL
493181834SrobertoAC_TYPE_OFF_T
494280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
495181834Sroberto
496280849ScyAC_CACHE_CHECK(
497280849Scy    [for a fallback value for HZ],
498280849Scy    [ntp_cv_default_hz],
499280849Scy    [
500280849Scy	ntp_cv_default_hz=100
501280849Scy	case "$host" in
502280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
503280849Scy	    ntp_cv_default_hz=1024
504280849Scy	    ;;
505280849Scy	 mips-dec-ultrix4*)
506280849Scy	    ntp_cv_default_hz=256
507280849Scy	    ;;
508280849Scy	esac
509280849Scy    ]
510280849Scy)
511280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
512280849Scy    [What is the fallback value for HZ?])
513181834Sroberto
514280849ScyAC_CACHE_CHECK(
515280849Scy    [if we need to override the system's value for HZ],
516280849Scy    [ntp_cv_override_hz],
517280849Scy    [
518280849Scy	ntp_cv_override_hz=no
519280849Scy	case "$host" in
520280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
521280849Scy	    ntp_cv_override_hz=yes
522280849Scy	    ;;
523280849Scy	 mips-dec-ultrix4*)
524280849Scy	    ntp_cv_override_hz=yes
525280849Scy	    ;;
526280849Scy	 *-*-freebsd*)
527280849Scy	    ntp_cv_override_hz=yes
528280849Scy	    ;;
529280849Scy	 *-*-sunos4*)
530280849Scy	    ntp_cv_override_hz=yes
531280849Scy	    ;;
532280849Scy	 *-*-kfreebsd*)
533280849Scy	    ntp_cv_override_hz=yes
534280849Scy	    ;;
535280849Scy	esac
536280849Scy    ]
537280849Scy)
538280849Scycase "$ntp_cv_override_hz" in
539181834Sroberto yes)
540280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
541280849Scy	[Do we need to override the system's idea of HZ?])
542181834Srobertoesac
543181834Sroberto
544181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
545181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
546181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
547181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
548181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
549181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
550181834Srobertodnl fi
551181834Sroberto
552181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
553181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
554181834Srobertodnl [AC_EGREP_CPP(yes,
555181834Srobertodnl [#ifdef HAVE_UTMPX_H
556181834Srobertodnl #include <utmpx.h>
557181834Srobertodnl #else
558181834Srobertodnl #include <utmp.h>
559181834Srobertodnl #endif
560181834Srobertodnl #ifdef BOOT_TIME
561181834Srobertodnl yes
562181834Srobertodnl #endif
563181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
564181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
565181834Sroberto
566280849ScyAC_CACHE_CHECK(
567280849Scy    [for struct rt_msghdr],
568280849Scy    [ntp_cv_struct_rt_msghdr],
569280849Scy    [AC_COMPILE_IFELSE(
570280849Scy	[AC_LANG_PROGRAM(
571280849Scy	    [[
572280849Scy		#include <sys/types.h>
573280849Scy		#include <sys/socket.h>
574280849Scy		#include <net/if.h>
575280849Scy		#include <net/route.h>
576280849Scy	    ]],
577280849Scy	    [[
578280849Scy		struct rt_msghdr p;
579280849Scy	    ]]
580280849Scy	)],
581280849Scy	[ntp_cv_struct_rt_msghdr=yes],
582280849Scy	[ntp_cv_struct_rt_msghdr=no]
583280849Scy    )]
584280849Scy)
585200576Sroberto
586181834SrobertoAC_CACHE_CHECK(
587280849Scy    [for struct rtattr],
588280849Scy    [ntp_cv_rtattr],
589280849Scy    [AC_COMPILE_IFELSE(
590280849Scy	[AC_LANG_PROGRAM(
591280849Scy	    [[
592280849Scy		#include <stddef.h>
593280849Scy		#include <sys/socket.h>
594280849Scy		#include <linux/rtnetlink.h>
595280849Scy	    ]],
596280849Scy	    [[
597280849Scy		struct rtattr p;
598280849Scy	    ]]
599280849Scy	)],
600280849Scy	[ntp_cv_rtattr=yes],
601280849Scy	[ntp_cv_rtattr=no]
602280849Scy    )]
603181834Sroberto)
604181834Sroberto
605280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
606280849Scy *yes*)
607280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
608280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
609280849Scy    case "$ntp_cv_rtattr" in
610280849Scy     yes)
611280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
612280849Scy	    [Do we have Linux routing socket?])
613181834Sroberto    esac
614280849Scyesac
615181834Sroberto
616280849ScyAC_CACHE_CHECK(
617280849Scy    [struct sigaction for sa_sigaction],
618280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
619280849Scy    [AC_COMPILE_IFELSE(
620280849Scy	[AC_LANG_PROGRAM(
621280849Scy	    [[
622280849Scy		#include <signal.h>
623280849Scy	    ]],
624280849Scy	    [[
625280849Scy		struct sigaction act;
626280849Scy		act.sa_sigaction = 0;
627280849Scy	    ]]
628280849Scy	)],
629280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
630280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
631280849Scy    )]
632280849Scy)
633280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
634280849Scy yes)
635280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
636280849Scyesac
637181834Sroberto
638280849ScyAC_CACHE_CHECK(
639280849Scy    [for struct ppsclockev],
640280849Scy    [ntp_cv_struct_ppsclockev],
641280849Scy    [AC_COMPILE_IFELSE(
642280849Scy	[AC_LANG_PROGRAM(
643280849Scy	    [[
644280849Scy		#ifdef HAVE_SYS_TYPES_H
645280849Scy		# include <sys/types.h>
646280849Scy		#endif
647280849Scy		#ifdef HAVE_SYS_TERMIOS_H
648280849Scy		# include <sys/termios.h>
649280849Scy		#endif
650280849Scy		#ifdef HAVE_SYS_TIME_H
651280849Scy		# include <sys/time.h>
652280849Scy		#endif
653280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
654280849Scy		# include <sys/ppsclock.h>
655280849Scy		#endif
656280849Scy	    ]],
657280849Scy	    [[
658280849Scy		extern struct ppsclockev *pce;
659280849Scy		return pce->serial;
660280849Scy	    ]]
661280849Scy	)],
662280849Scy	[ntp_cv_struct_ppsclockev=yes],
663280849Scy	[ntp_cv_struct_ppsclockev=no]
664280849Scy    )]
665280849Scy)
666280849Scycase "$ntp_cv_struct_ppsclockev" in
667280849Scy yes)
668280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
669280849Scy	[Does a system header define struct ppsclockev?])
670280849Scyesac
671181834Sroberto
672181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
673181834Sroberto  *yes*)
674280849Scy    AC_CACHE_CHECK(
675280849Scy	[for struct snd_size],
676280849Scy	[ntp_cv_struct_snd_size],
677280849Scy	[AC_COMPILE_IFELSE(
678280849Scy	    [AC_LANG_PROGRAM(
679280849Scy		[[
680280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
681280849Scy		    # include <machine/soundcard.h>
682280849Scy		    #endif
683280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
684280849Scy		    # include <sys/soundcard.h>
685280849Scy		    #endif
686280849Scy		]],
687280849Scy		[[
688280849Scy		    extern struct snd_size *ss;
689280849Scy		    return ss->rec_size;
690280849Scy		]]
691280849Scy	    )],
692280849Scy	    [ntp_cv_struct_snd_size=yes],
693280849Scy	    [ntp_cv_struct_snd_size=no]
694280849Scy        )]
695280849Scy    )
696280849Scy    case "$ntp_cv_struct_snd_size" in
697280849Scy     yes)
698280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
699280849Scy	    [Do we have struct snd_size?])
700181834Sroberto    esac
701181834Srobertoesac
702181834Sroberto
703280849ScyAC_CACHE_CHECK(
704280849Scy    [struct clockinfo for hz],
705280849Scy    [ntp_cv_struct_clockinfo_has_hz],
706280849Scy    [AC_COMPILE_IFELSE(
707280849Scy	[AC_LANG_PROGRAM(
708280849Scy	    [[
709280849Scy		#include <sys/time.h>
710280849Scy	    ]],
711280849Scy	    [[
712280849Scy		extern struct clockinfo *pc;
713280849Scy		return pc->hz;
714280849Scy	    ]]
715280849Scy	)],
716280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
717280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
718280849Scy    )]
719280849Scy)
720280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
721280849Scy yes)
722280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
723280849Scyesac
724181834Sroberto
725280849ScyAC_CACHE_CHECK(
726280849Scy    [struct clockinfo for tickadj],
727280849Scy    [ntp_cv_struct_clockinfo_has_hz],
728280849Scy    [AC_COMPILE_IFELSE(
729280849Scy	[AC_LANG_PROGRAM(
730280849Scy	    [[
731280849Scy		#include <sys/time.h>
732280849Scy	    ]],
733280849Scy	    [[
734280849Scy		extern struct clockinfo *pc;
735280849Scy		return pc->tickadj;
736280849Scy	    ]]
737280849Scy	)],
738280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
739280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
740280849Scy    )]
741280849Scy)
742280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
743280849Scy yes)
744280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
745280849Scyesac
746181834Sroberto
747280849Scycase "$ntp_cv_struct_ntptimeval" in
748280849Scy yes)
749280849Scy    AC_CHECK_MEMBERS(
750280849Scy	[struct ntptimeval.time.tv_nsec],
751280849Scy	[],
752280849Scy	[],
753280849Scy	[
754280849Scy	    #ifdef HAVE_SYS_TIME_H
755280849Scy	    # include <sys/time.h>
756280849Scy	    #else
757280849Scy	    # ifdef HAVE_TIME_H
758280849Scy	    #  include <time.h>
759280849Scy	    # endif
760280849Scy	    #endif
761280849Scy	    #ifdef HAVE_SYS_TIMEX_H
762280849Scy	    # include <sys/timex.h>
763280849Scy	    #else
764280849Scy	    # ifdef HAVE_TIMEX_H
765280849Scy	    #  include <timex.h>
766280849Scy	    # endif
767280849Scy	    #endif
768280849Scy	]
769280849Scy    )
770200576Srobertoesac
771200576Sroberto
772280849Scy#### 
773181834Sroberto
774280849ScyAC_CHECK_FUNCS([arc4random_buf])
775181834Sroberto
776280849Scy#### 
777181834Sroberto
778280849Scysaved_LIBS="$LIBS"
779280849ScyLIBS="$LIBS $LDADD_LIBNTP"
780280849ScyAC_CHECK_FUNCS([daemon])
781280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
782280849ScyLIBS="$saved_LIBS"
783280849ScyAS_UNSET([saved_LIBS])
784181834Sroberto
785280849ScyAC_CHECK_FUNCS(
786280849Scy    [finite],
787280849Scy    [],
788280849Scy    [AC_CHECK_FUNCS(
789280849Scy	[isfinite],
790280849Scy	[],
791280849Scy	[
792280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
793280849Scy	    _libs=$LIBS
794280849Scy	    # XXX
795280849Scy	    LIBS="$LIBS -lm"
796280849Scy	    AC_LINK_IFELSE(
797280849Scy		[AC_LANG_PROGRAM(
798280849Scy		    [[
799280849Scy			#include <math.h>
800280849Scy		    ]],
801280849Scy		    [[
802280849Scy			float f = 0.0;
803280849Scy			isfinite(f);
804280849Scy		    ]]
805280849Scy		)],
806280849Scy		[ans=yes],
807280849Scy		[ans=no]
808280849Scy	    )
809280849Scy	    LIBS=$_libs
810280849Scy	    AC_MSG_RESULT([$ans])
811280849Scy	    case "$ans" in
812280849Scy	     yes)
813280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
814280849Scy	    esac
815280849Scy	]
816280849Scy    )]
817280849Scy)
818181834Sroberto
819280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
820181834Sroberto
821280849Scy# kvm_open() is only used by tickadj.  Also see above.
822280849Scycase "$ac_cv_header_kvm_h" in
823280849Scy yes)
824280849Scy    AC_CHECK_FUNCS([kvm_open])
825181834Sroberto    ;;
826181834Srobertoesac
827181834Sroberto
828181834Srobertocase "$host" in
829181834Sroberto *-*-sco3.2v5.0.*)
830280849Scy    # Just stubs.  Sigh.
831181834Sroberto    ;;
832280849Scy *) AC_CHECK_FUNCS([mkstemp])
833181834Sroberto    ;;
834181834Srobertoesac
835280849ScyAC_CHECK_FUNCS([mktime])
836181834Srobertocase "$host" in
837280849Scy *-*-aix[[4-9]]*)
838280849Scy    # XXX only verified thru AIX6.
839280849Scy    # Just a stub.  Sigh.
840181834Sroberto    ;;
841181834Sroberto *-*-irix[[45]]*)
842280849Scy    # Just a stub in "old" Irix.  Sigh.
843181834Sroberto    ;;
844280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
845280849Scy# *-*-*linux*)
846280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
847280849Scy#    ;;
848181834Sroberto *-*-qnx*)
849280849Scy    # Apparently there but not working in QNX.  Sigh?
850181834Sroberto    ;;
851181834Sroberto *-*-sco3.2v5.0.*)
852280849Scy    # Just a stub.  Sigh.
853181834Sroberto    ;;
854181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
855181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
856181834Sroberto    # Not easy to test for - cheat.
857280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
858280849Scy    AC_CHECK_FUNCS([mlockall])
859181834Sroberto    ;;
860280849Scy *) AC_CHECK_FUNCS([mlockall])
861181834Sroberto    ;;
862181834Srobertoesac
863280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
864181834Srobertocase "$host" in
865280849Scy *-*-aix[[4-9]]*)
866280849Scy    # XXX only verified thru AIX6.
867280849Scy    # Just a stub in AIX 4.  Sigh.
868181834Sroberto    ;;
869181834Sroberto *-*-solaris2.5*)
870280849Scy    # Just stubs in solaris2.5.  Sigh.
871181834Sroberto    ;;
872280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
873181834Sroberto    ;;
874181834Srobertoesac
875280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
876280849ScyAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
877181834Srobertocase "$host" in
878280849Scy *-*-aix[[4-9]]*)
879280849Scy    # XXX only verified thru AIX6.
880280849Scy    # Just stubs.  Sigh.
881181834Sroberto    ;;
882181834Sroberto *-*-netbsd1*)
883280849Scy    # Just stubs.  Sigh.
884181834Sroberto    ;;
885181834Sroberto *-*-netbsdelf1*)
886280849Scy    # Just stubs.  Sigh.
887181834Sroberto    ;;
888181834Sroberto *-*-openbsd*)
889280849Scy    # Just stubs.  Sigh.
890181834Sroberto    ;;
891280849Scy *)
892280849Scy    AC_CHECK_FUNCS([timer_create])
893181834Sroberto    ;;
894181834Srobertoesac
895181834Sroberto
896280849ScyNTP_RLIMIT_ITEMS
897181834Sroberto
898280849Scy# HMS: Only if we are doing the MLOCKALL stuff...
899280849ScyAC_MSG_CHECKING([for the default number of 4k stack pages])
900280849ScyAC_ARG_WITH(
901280849Scy    [stack-limit],
902280849Scy    [AS_HELP_STRING(
903280849Scy	[--with-stack-limit],
904280849Scy	[? =50 (200 for openbsd) 4k pages]
905280849Scy    )],
906280849Scy    [ans=$withval],
907280849Scy    [ans=yes]
908280849Scy)
909280849Scycase "$ans" in
910280849Scy yes | no)
911280849Scy    case "$host" in
912280849Scy     *-*-openbsd*)
913280849Scy	ans=200
914181834Sroberto	;;
915280849Scy     *) ans=50
916280849Scy        ;;
917181834Sroberto    esac
918181834Sroberto    ;;
919280849Scy [[1-9]][[0-9]]*)
920280849Scy    ;;
921280849Scy *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
922280849Scy    ;;
923181834Srobertoesac
924280849ScyAC_MSG_RESULT([$ans])
925280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
926280849Scy    [Default number of 4k pages for RLIMIT_STACK])
927181834Sroberto
928280849Scy# HMS: only if we have RLIMIT_MEMLOCK
929280849ScyAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
930280849ScyAC_ARG_WITH(
931280849Scy    [memlock],
932280849Scy    [AS_HELP_STRING(
933280849Scy	[--with-memlock],
934280849Scy	[? =32 (megabytes)]
935280849Scy    )],
936280849Scy    [ans=$withval],
937280849Scy    [ans=yes]
938280849Scy)
939280849Scycase "$ans" in
940280849Scy yes | no)
941280849Scy    ans=32
942181834Sroberto    ;;
943280849Scy [[1-9]][[0-9]]*) ;;
944280849Scy *) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
945280849Scy     ;;
946181834Srobertoesac
947280849ScyAC_MSG_RESULT([$ans])
948280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
949280849Scy    [Default number of megabytes for RLIMIT_MEMLOCK])
950181834Sroberto
951181834Sroberto
952280849Scy# some OSes prefer _exit() in forked children to exit()
953280849ScyAC_CHECK_FUNCS([_exit])
954280849Scyntp_worker_child_exit=exit
955280849Scycase "$ac_cv_func__exit::$host_os" in
956280849Scy yes::netbsd*)
957280849Scy    ntp_worker_child_exit=_exit
958280849Scy    ;;
959280849Scy yes::openbsd*)
960280849Scy    ntp_worker_child_exit=_exit
961280849Scy    ;;
962280849Scyesac
963280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
964280849Scy		   [routine worker child proc uses to exit.])
965181834Sroberto
966280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
967181834Sroberto
968280849Scy###
969181834Sroberto
970280849Scy# http://bugs.ntp.org/737
971280849Scycase "$ac_cv_func_recvmsg" in
972280849Scy yes)
973280849Scy    AC_CACHE_CHECK(
974280849Scy	[if we need extra help to define struct iovec],
975280849Scy	[ntp_cv_struct_iovec_help],
976280849Scy	[
977280849Scy	    compiled=no
978280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
979280849Scy		AC_COMPILE_IFELSE(
980280849Scy		    [AC_LANG_PROGRAM(
981280849Scy			[[
982280849Scy			    #ifdef HAVE_SYS_TYPES_H
983280849Scy			    # include <sys/types.h>
984280849Scy			    #endif
985280849Scy			    #ifdef HAVE_SYS_SOCKET_H
986280849Scy			    # include <sys/socket.h>
987280849Scy			    #endif
988280849Scy			    #if $ntp_cv_struct_iovec_help
989280849Scy			    # include <sys/uio.h>
990280849Scy			    #endif
991280849Scy			]],
992280849Scy			[[
993280849Scy			    void foo(void) {
994280849Scy				ssize_t x;
995280849Scy				int s = 0;
996280849Scy				struct iovec iov;
997280849Scy				struct msghdr mh;
998280849Scy				int flags = 0;
999181834Sroberto
1000280849Scy				mh.msg_iov = &iov;
1001280849Scy				x = recvmsg(s, &mh, flags);
1002280849Scy			    }
1003280849Scy			]]
1004280849Scy		    )],
1005280849Scy		    [compiled=yes ; break 1],
1006280849Scy		    []
1007280849Scy		)
1008280849Scy	    done
1009280849Scy	    case "$compiled" in
1010280849Scy	     no)
1011280849Scy		ntp_cv_struct_iovec_help=0
1012280849Scy	    esac
1013280849Scy	    AS_UNSET([compiled])
1014280849Scy	]
1015280849Scy    )
1016280849Scy    case "$ntp_cv_struct_iovec_help" in
1017280849Scy     1)
1018280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1019280849Scy	    [Use sys/uio.h for struct iovec help])
1020280849Scy    esac
1021181834Srobertoesac
1022181834Sroberto
1023280849ScyAC_CACHE_CHECK(
1024280849Scy    [number of arguments taken by setpgrp()],
1025280849Scy    [ntp_cv_func_setpgrp_nargs],
1026280849Scy    [AC_COMPILE_IFELSE(
1027280849Scy	[AC_LANG_PROGRAM(
1028280849Scy	    [[
1029280849Scy		#ifdef HAVE_SYS_TYPES_H
1030280849Scy		# include <sys/types.h>
1031280849Scy		#endif
1032280849Scy		#ifdef HAVE_UNISTD_H
1033280849Scy		# include <unistd.h>
1034280849Scy		#endif
1035280849Scy	    ]],
1036280849Scy	    [[
1037280849Scy		setpgrp(0, 0);
1038280849Scy	    ]]
1039280849Scy	)],
1040280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1041280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1042280849Scy    )]
1043280849Scy)
1044280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1045280849Scy 0)
1046280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1047280849Scy	      [define if setpgrp takes 0 arguments])
1048280849Scyesac
1049181834Sroberto
1050280849ScyAC_CACHE_CHECK(
1051280849Scy    [if we need to declare 'errno'],
1052280849Scy    [ntp_cv_decl_errno],
1053280849Scy    [AC_COMPILE_IFELSE(
1054280849Scy	[AC_LANG_PROGRAM(
1055280849Scy	    [[
1056280849Scy		#ifdef HAVE_ERRNO_H
1057280849Scy		# include <errno.h>
1058280849Scy		#endif
1059280849Scy	    ]],
1060280849Scy	    [[
1061280849Scy		errno = 0;
1062280849Scy	    ]]
1063280849Scy	)],
1064280849Scy	[ntp_cv_decl_errno=no],
1065280849Scy	[ntp_cv_decl_errno=yes]
1066280849Scy    )]
1067280849Scy)
1068280849Scycase "$ntp_cv_decl_errno" in
1069280849Scy yes)
1070280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1071181834Srobertoesac
1072181834Sroberto
1073181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1074181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1075181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1076181834Srobertodnl without breaking any other platforms.
1077181834Srobertodnl
1078280849ScyAC_CACHE_CHECK(
1079280849Scy    [if we may declare 'h_errno'],
1080280849Scy    [ntp_cv_decl_h_errno],
1081280849Scy    [AC_COMPILE_IFELSE(
1082280849Scy	[AC_LANG_PROGRAM(
1083280849Scy	    [[
1084280849Scy		#include <sys/types.h>
1085280849Scy		#ifdef HAVE_NETINET_IN_H
1086280849Scy		# include <netinet/in.h>
1087280849Scy		#endif
1088280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1089280849Scy		# include <arpa/nameser.h>
1090280849Scy		#endif
1091280849Scy		#ifdef HAVE_NETDB_H
1092280849Scy		# include <netdb.h>
1093280849Scy		#endif
1094280849Scy		#ifdef HAVE_RESOLV_H
1095280849Scy		# include <resolv.h>
1096280849Scy		#endif
1097280849Scy	    ]],
1098280849Scy	    [[
1099280849Scy		extern int h_errno;
1100280849Scy	    ]]
1101280849Scy	)],
1102280849Scy	[ntp_cv_decl_h_errno=yes],
1103280849Scy	[ntp_cv_decl_h_errno=no]
1104280849Scy    )]
1105280849Scy)
1106280849Scycase "$ntp_cv_decl_h_errno" in
1107280849Scy yes)
1108280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1109181834Srobertoesac
1110181834Sroberto
1111280849ScyAC_CACHE_CHECK(
1112280849Scy    [if declaring 'syscall()' is ok],
1113280849Scy    [ntp_cv_decl_syscall],
1114280849Scy    [AC_COMPILE_IFELSE(
1115280849Scy	[AC_LANG_PROGRAM(
1116280849Scy	    [[
1117280849Scy		#ifdef HAVE_SYS_TYPES_H
1118280849Scy		# include <sys/types.h>
1119280849Scy		#endif
1120280849Scy		#ifdef HAVE_UNISTD_H
1121280849Scy		# include <unistd.h>
1122280849Scy		#endif
1123280849Scy	    ]],
1124280849Scy	    [[
1125280849Scy		extern int syscall (int, ...);
1126280849Scy	    ]]
1127280849Scy	)]
1128280849Scy	[ntp_cv_decl_syscall=yes],
1129280849Scy	[ntp_cv_decl_syscall=no]
1130280849Scy    )]
1131280849Scy)
1132280849Scycase "$ntp_cv_decl_syscall" in
1133280849Scy yes)
1134280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1135181834Srobertoesac
1136181834Sroberto
1137181834Srobertocase "$host" in
1138181834Sroberto *-*-aix4.3.*)
1139280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1140181834Sroberto    ;;
1141181834Sroberto *-*-mpeix*)
1142280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1143280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1144280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1145280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1146280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1147280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1148280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1149181834Sroberto    ;;
1150181834Sroberto *-*-osf[[45]]*)
1151280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1152280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1153181834Sroberto    ;;
1154181834Sroberto *-*-qnx*)
1155280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1156181834Sroberto    ;;
1157181834Sroberto *-*-riscos4*)
1158280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1159280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1160280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1161280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1162280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1163280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1164280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1165280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1166280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1167280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1168280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1169280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1170280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1171280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1172280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1173280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1174181834Sroberto    ;;
1175181834Sroberto *-*-solaris2*)
1176280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1177280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1178181834Sroberto    case "$host" in
1179181834Sroberto     *-*-solaris2.4)
1180280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1181181834Sroberto	;;
1182181834Sroberto    esac
1183181834Sroberto    ;;
1184181834Sroberto *-*-sunos4*)
1185280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1186280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1187280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1188280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1189280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1190280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1191280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1192280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1193280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1194280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1195280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1196280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1197280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1198181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1199181834Sroberto     acc*) ;;
1200280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1201181834Sroberto	;;
1202181834Sroberto    esac
1203280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1204280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1207280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1208280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1209280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1210181834Sroberto    ;;
1211181834Sroberto *-*-ultrix4*)
1212280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1213280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1214280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1215280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1216280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1217280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1218280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1219280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1220280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1221280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1222280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1223280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1224280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1225280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1226181834Sroberto    ;;
1227181834Srobertoesac
1228181834Sroberto
1229181834Srobertocase "$host" in
1230181834Sroberto *-*-sco3.2*)
1231280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1232280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1233181834Sroberto    ;;
1234181834Srobertoesac
1235181834Sroberto
1236181834Srobertocase "$host" in
1237181834Sroberto *-*-hpux[[567]]*)
1238280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1239280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1240181834Srobertoesac
1241181834Sroberto
1242280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1243280849ScyAC_CACHE_CHECK(
1244280849Scy    [if we will open the broadcast socket],
1245280849Scy    [ntp_cv_var_open_bcast_socket],
1246280849Scy    [
1247280849Scy	ans=yes
1248280849Scy	case "$host" in
1249280849Scy	 *-*-domainos)
1250280849Scy	    ans=no
1251280849Scy	esac
1252280849Scy	ntp_cv_var_open_bcast_socket=$ans
1253280849Scy    ]
1254280849Scy)
1255280849Scycase "$ntp_cv_var_open_bcast_socket" in
1256280849Scy yes)
1257280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1258280849Scy	[Should we open the broadcast socket?])
1259181834Srobertoesac
1260181834Sroberto
1261181834Srobertocase "$host" in
1262181834Sroberto *-*-hpux*)
1263280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1264280849Scy	[Do we want the HPUX FindConfig()?])
1265181834Srobertoesac
1266181834Sroberto
1267280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1268280849ScyAC_CACHE_CHECK(
1269280849Scy    [if process groups are set with -pid],
1270280849Scy    [ntp_cv_arg_setpgrp_negpid],
1271280849Scy    [
1272280849Scy	case "$host" in
1273280849Scy	 *-*-hpux[[567]]*)
1274280849Scy	    ans=no
1275280849Scy	    ;;
1276280849Scy	 *-*-hpux*)
1277280849Scy	    ans=yes
1278280849Scy	    ;;
1279280849Scy	 *-*-*linux*)
1280280849Scy	    ans=yes
1281280849Scy	    ;;
1282280849Scy	 *-*-sunos3*)
1283280849Scy	    ans=yes
1284280849Scy	    ;;
1285280849Scy	 *-*-ultrix2*)
1286280849Scy	    ans=yes
1287280849Scy	    ;;
1288280849Scy	 *)
1289280849Scy	    ans=no
1290280849Scy	    ;;
1291280849Scy	esac
1292280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1293280849Scy    ]
1294280849Scy)
1295280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1296181834Sroberto yes)
1297280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1298280849Scy	[Do we set process groups with -pid?])
1299181834Srobertoesac
1300181834Sroberto
1301280849ScyAC_CACHE_CHECK(
1302280849Scy    [if we need a ctty for F_SETOWN],
1303280849Scy    [ntp_cv_func_ctty_for_f_setown],
1304280849Scy    [
1305280849Scy	case "$host" in
1306280849Scy	 *-*-bsdi[[23]]*)
1307280849Scy	    ans=yes
1308280849Scy	    ;;
1309280849Scy	 *-*-freebsd*)
1310280849Scy	    ans=yes
1311280849Scy	    ;;
1312280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1313280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1314280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1315280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1316280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1317280849Scy	    ans=yes
1318280849Scy	    ;;
1319280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1320280849Scy	    ans=yes
1321280849Scy	    ;;
1322280849Scy	 *-*-openbsd*)
1323280849Scy	    ans=yes
1324280849Scy	    ;;
1325280849Scy	 *-*-osf*)
1326280849Scy	    ans=yes
1327280849Scy	    ;;
1328280849Scy	 *-*-darwin*)
1329280849Scy	    ans=yes
1330280849Scy	    ;;
1331280849Scy	 *)
1332280849Scy	    ans=no
1333280849Scy	    ;;
1334280849Scy	esac
1335280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1336280849Scy    ]
1337280849Scy)
1338280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1339181834Sroberto yes)
1340280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1341181834Srobertoesac
1342181834Sroberto
1343280849ScyAC_CACHE_CHECK(
1344280849Scy    [if the OS clears cached routes when more specifics become available],
1345280849Scy    [ntp_cv_os_routeupdates],
1346280849Scy    [
1347280849Scy	case "$host" in
1348280849Scy	 *-*-netbsd*)
1349280849Scy	    ans=yes
1350280849Scy	    ;;
1351280849Scy	 *)
1352280849Scy	    ans=no
1353280849Scy	    ;;
1354280849Scy	esac
1355280849Scy	ntp_cv_os_routeupdates=$ans
1356280849Scy    ]
1357280849Scy)
1358280849Scycase "$ntp_cv_os_routeupdates" in
1359181834Sroberto yes)
1360280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1361280849Scy	[need to recreate sockets on changed routing?])
1362181834Srobertoesac
1363181834Sroberto
1364280849ScyAC_CACHE_CHECK(
1365280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1366280849Scy    [ntp_cv_os_wildcardreuse],
1367280849Scy    [
1368280849Scy	case "$host" in
1369280849Scy	 *-*-*linux*)
1370280849Scy	    ans=yes
1371280849Scy	    ;;
1372280849Scy	 *) ans=no
1373280849Scy	    ;;
1374280849Scy	esac
1375280849Scy	ntp_cv_os_wildcardreuse=$ans
1376280849Scy    ]
1377280849Scy)
1378280849Scycase "$ntp_cv_os_wildcardreuse" in
1379181834Sroberto yes)
1380280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1381280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1382181834Srobertoesac
1383181834Sroberto
1384181834Srobertocase "$host" in
1385181834Sroberto *-*-aix*)
1386280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1387280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1388181834Srobertoesac
1389181834Sroberto
1390280849ScyAC_CACHE_CHECK(
1391280849Scy    [for a minimum recommended value of tickadj],
1392280849Scy    [ntp_cv_var_min_rec_tickadj],
1393280849Scy    [
1394280849Scy	ans=no
1395280849Scy	case "$host" in
1396280849Scy	 *-*-aix*)
1397280849Scy	    ans=40
1398280849Scy	    ;;
1399280849Scy	esac
1400280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1401280849Scy    ]
1402280849Scy)
1403280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1404280849Scy ''|no)
1405181834Sroberto    ;;
1406280849Scy *)
1407280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1408280849Scy	[Should we recommend a minimum value for tickadj?])
1409181834Srobertoesac
1410280849Scy
1411280849ScyAC_CACHE_CHECK(
1412280849Scy    [if the TTY code permits PARENB and IGNPAR],
1413280849Scy    [ntp_cv_no_parenb_ignpar],
1414280849Scy    [
1415280849Scy	ans=no
1416280849Scy	case "$host" in
1417280849Scy	 i?86-*-*linux*)
1418280849Scy	    ans=yes
1419280849Scy	    ;;
1420280849Scy	 mips-sgi-irix*)
1421280849Scy	    ans=yes
1422280849Scy	    ;;
1423280849Scy	 i?86-*-freebsd[[123]].*)
1424280849Scy	    ;;
1425280849Scy	 i?86-*-freebsd*)
1426280849Scy	    ans=yes
1427280849Scy	    ;;
1428280849Scy	 *-*-unicosmp*)
1429280849Scy	    ans=yes
1430280849Scy	    ;;
1431280849Scy	esac
1432280849Scy	ntp_cv_no_parenb_ignpar=$ans
1433280849Scy    ]
1434280849Scy)
1435280849Scycase "$ntp_cv_no_parenb_ignpar" in
1436280849Scy yes)
1437280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1438280849Scy	[Is there a problem using PARENB and IGNPAR?])
1439181834Srobertoesac
1440181834Sroberto
1441280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1442280849ScyAC_ARG_ENABLE(
1443280849Scy    [debug-timing],
1444280849Scy    [AS_HELP_STRING(
1445280849Scy	[--enable-debug-timing],
1446280849Scy	[- include processing time debugging code (costs performance)]
1447280849Scy    )],
1448280849Scy    [ntp_ok=$enableval],
1449280849Scy    [ntp_ok=no]
1450280849Scy)
1451280849Scycase "$ntp_ok" in
1452280849Scy yes)
1453280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1454181834Srobertoesac
1455280849ScyAC_MSG_RESULT([$ntp_ok])
1456181834Sroberto
1457280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1458200576SrobertoAC_ARG_ENABLE(
1459280849Scy    [dst-minutes],
1460280849Scy    [AS_HELP_STRING(
1461200576Sroberto	[--enable-dst-minutes],
1462280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1463280849Scy    ],
1464200576Sroberto    [ans=$enableval],
1465200576Sroberto    [ans=60]
1466200576Sroberto)
1467280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1468280849Scy    [The number of minutes in a DST adjustment])
1469200576SrobertoAC_MSG_RESULT([$ans])
1470181834Sroberto
1471280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1472200576SrobertoAC_ARG_ENABLE(
1473200576Sroberto    [ignore-dns-errors],
1474280849Scy    [AS_HELP_STRING(
1475280849Scy	[--enable-ignore-dns-errors],
1476200576Sroberto	[- retry DNS queries on any error]
1477280849Scy    )],
1478200576Sroberto    [ans=$enableval],
1479200576Sroberto    [ans=no]
1480200576Sroberto)
1481200576Srobertocase "$ans" in
1482200576Sroberto yes)
1483280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1484280849Scy	[Retry queries on _any_ DNS error?])
1485200576Srobertoesac
1486200576SrobertoAC_MSG_RESULT([$ans])
1487200576Sroberto
1488280849ScyAC_CACHE_CHECK(
1489280849Scy    [availability of ntp_{adj,get}time()],
1490280849Scy    [ntp_cv_var_ntp_syscalls],
1491280849Scy    [
1492280849Scy	ntp_cv_var_ntp_syscalls=no
1493280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1494280849Scy	 yesyes*)
1495280849Scy	    ntp_cv_var_ntp_syscalls=libc
1496181834Sroberto	    ;;
1497280849Scy	 *yes)
1498280849Scy	    ntp_cv_var_ntp_syscalls=inline
1499181834Sroberto	    ;;
1500280849Scy	 *)
1501280849Scy	    AC_PREPROC_IFELSE(
1502280849Scy		[
1503280849Scy		    #include <sys/syscall.h>
1504280849Scy		    #if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1505280849Scy		    # error
1506280849Scy		    #endif
1507280849Scy		],
1508280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1509280849Scy	    )
1510181834Sroberto	    ;;
1511280849Scy	 esac
1512280849Scy    ]
1513280849Scy)
1514280849Scycase "$ntp_cv_var_ntp_syscalls" in
1515181834Sroberto libc)
1516280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1517280849Scy	[Do we have ntp_{adj,get}time in libc?])
1518181834Sroberto    ;;
1519181834Sroberto kernel)
1520280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1521280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1522181834Sroberto    ;;
1523181834Srobertoesac
1524181834Sroberto
1525280849ScyAC_CACHE_CHECK(
1526280849Scy    [if sys/timex.h has STA_FLL],
1527280849Scy    [ntp_cv_var_sta_fll],
1528280849Scy    [AC_PREPROC_IFELSE(
1529280849Scy	[
1530280849Scy	    #include <sys/timex.h>
1531280849Scy	    #ifndef STA_FLL
1532280849Scy	    # error
1533280849Scy	    #endif
1534280849Scy	],
1535280849Scy	[ntp_cv_var_sta_fll=yes],
1536280849Scy	[ntp_cv_var_sta_fll=no]
1537280849Scy    )]
1538280849Scy)
1539181834Sroberto
1540280849ScyAC_CACHE_CHECK(
1541280849Scy    [if we have kernel PLL support],
1542280849Scy    [ntp_cv_var_kernel_pll],
1543280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1544280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1545280849Scy	 *no*)
1546280849Scy	    ntp_cv_var_kernel_pll=no
1547280849Scy	    ;;
1548280849Scy	 *) ntp_cv_var_kernel_pll=yes
1549280849Scy	    ;;
1550280849Scy	esac
1551280849Scy    ]
1552280849Scy)
1553280849Scycase "$ntp_cv_var_kernel_pll" in
1554181834Sroberto yes)
1555280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1556280849Scy	[Does the kernel support precision time discipline?])
1557181834Srobertoesac
1558181834Sroberto
1559280849ScyAC_CACHE_CHECK(
1560280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1561280849Scy    [ntp_cv_size_returned_in_buffer],
1562280849Scy    [
1563280849Scy	ans=no
1564280849Scy	case "$host" in
1565280849Scy	 *-fujitsu-uxp*)
1566280849Scy	    ans=yes
1567280849Scy	    ;;
1568280849Scy	 *-ncr-sysv4*)
1569280849Scy	    ans=yes
1570280849Scy	    ;;
1571280849Scy	 *-univel-sysv*)
1572280849Scy	    ans=yes
1573280849Scy	    ;;
1574280849Scy	esac
1575280849Scy	ntp_cv_size_returned_in_buffer=$ans
1576280849Scy    ]
1577280849Scy)
1578280849Scycase "$ntp_cv_size_returned_in_buffer" in
1579280849Scy yes)
1580280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1581280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1582181834Srobertoesac
1583181834Sroberto
1584181834Sroberto# Check for ioctls TIOCGPPSEV
1585280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1586280849Scycase "$ac_cv_header_termios_h" in
1587280849Scy yes)
1588280849Scy    AC_PREPROC_IFELSE(
1589280849Scy	[
1590280849Scy	    #include <termios.h>
1591280849Scy	    #ifndef TIOCGPPSEV
1592280849Scy	    # error
1593280849Scy	    #endif
1594280849Scy	],
1595280849Scy	[ntp_ok=yes],
1596280849Scy	[ntp_ok=no]
1597280849Scy    )
1598280849Scy    ;;
1599280849Scy *)
1600280849Scy    ntp_ok=no
1601280849Scy    ;;
1602280849Scyesac
1603280849Scycase "$ntp_ok" in
1604280849Scy yes)
1605280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1606280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1607280849Scyesac
1608280849ScyAC_MSG_RESULT([$ntp_ok])
1609181834Sroberto
1610181834Sroberto# Check for ioctls TIOCSPPS
1611280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1612280849Scycase "$ac_cv_header_termios_h" in
1613280849Scy yes)
1614280849Scy    AC_PREPROC_IFELSE(
1615280849Scy	[
1616280849Scy	    #include <termios.h>
1617280849Scy	    #ifndef TIOCSPPS
1618280849Scy	    # error
1619280849Scy	    #endif
1620280849Scy	 ],
1621280849Scy	 [ntp_ok=yes],
1622280849Scy	 [ntp_ok=no]
1623280849Scy    )
1624280849Scy    ;;
1625280849Scy *)
1626181834Sroberto    ntp_ok=no
1627280849Scy    ;;
1628280849Scyesac
1629280849Scycase "$ntp_ok" in
1630280849Scy yes)
1631280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1632280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1633280849Scyesac
1634280849ScyAC_MSG_RESULT([$ntp_ok])
1635181834Sroberto
1636181834Sroberto# Check for ioctls CIOGETEV
1637280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1638280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1639280849Scy yes)
1640280849Scy    AC_PREPROC_IFELSE(
1641280849Scy	[
1642280849Scy	    #include <sys/ppsclock.h>
1643280849Scy	    #ifndef CIOGETEV
1644280849Scy	    # error
1645280849Scy	    #endif
1646280849Scy	],
1647280849Scy	[ntp_ok=yes],
1648280849Scy	[ntp_ok=no]
1649280849Scy    )
1650280849Scy    ;;
1651280849Scy *)
1652280849Scy    ntp_ok=no
1653280849Scy    ;;
1654280849Scyesac
1655280849Scycase "$ntp_ok" in
1656280849Scy yes)
1657280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1658280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1659280849Scyesac
1660280849ScyAC_MSG_RESULT([$ntp_ok])
1661181834Sroberto
1662181834Sroberto# ATOM/PPSAPI stuff.
1663181834Sroberto
1664280849Scyntp_atom_ok=yes
1665181834Sroberto
1666181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1667181834Sroberto
1668181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1669181834Sroberto# The PPSAPI needs struct timespec.
1670181834Sroberto# The PPSAPI also needs a timepps header.
1671181834Sroberto
1672280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1673181834Sroberto inlineyes)
1674181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1675181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1676181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1677280849Scy	ntp_jupiter_ok=yes
1678280849Scy	ntp_oncore_ok=yes
1679280849Scy	ntp_parse_ok=yes
1680280849Scy	ntp_ripe_ncc_ok=yes
1681181834Sroberto	;;
1682181834Sroberto    esac
1683181834Sroberto    ;;
1684181834Srobertoesac
1685181834Sroberto
1686181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1687280849ScyAC_CHECK_HEADER([linux/serial.h])
1688181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1689181834Sroberto  yesyes)
1690280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1691280849Scy    AC_PREPROC_IFELSE(
1692280849Scy	[
1693280849Scy	    #include <sys/time.h>
1694280849Scy	    typedef int u_int;
1695280849Scy	    #include <sys/ppsclock.h>
1696280849Scy	    #include <linux/serial.h>
1697181834Sroberto
1698280849Scy	    #ifndef TIOCGSERIAL
1699280849Scy	    # error
1700280849Scy	    #endif
1701280849Scy	    #ifndef TIOCSSERIAL
1702280849Scy	    # error
1703280849Scy	    #endif
1704280849Scy	    #ifndef ASYNC_PPS_CD_POS
1705280849Scy	    # error
1706280849Scy	    #endif
1707280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1708280849Scy	    # error
1709280849Scy	    #endif
1710280849Scy	    #ifndef CIOGETEV
1711280849Scy	    # error
1712280849Scy	    #endif
1713280849Scy	],
1714280849Scy	[ntp_ok=yes],
1715280849Scy	[ntp_ok=no]
1716280849Scy    )
1717280849Scy    AC_MSG_RESULT([$ntp_ok])
1718280849Scy    ;;
1719181834Sroberto  *)
1720280849Scy    ntp_ok=no
1721280849Scy    ;;
1722181834Srobertoesac
1723280849Scycase "$ntp_ok" in
1724280849Scy yes)
1725280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1726280849Scy	[Do we have the TIO serial stuff?])
1727280849Scyesac
1728181834Sroberto
1729181834Sroberto# Check for SHMEM_STATUS support
1730200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1731181834Srobertocase "$ac_cv_header_sys_mman_h" in
1732280849Scy yes)
1733280849Scy    ntp_ok=yes
1734280849Scy    ;;
1735280849Scy *)
1736280849Scy    ntp_ok=no
1737280849Scy    ;;
1738181834Srobertoesac
1739280849Scycase "$ntp_ok" in
1740280849Scy yes)
1741280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1742280849Scy	[Do we have support for SHMEM_STATUS?])
1743280849Scyesac
1744280849ScyAC_MSG_RESULT([$ntp_ok])
1745181834Sroberto
1746181834Srobertontp_refclock=no
1747181834Sroberto
1748181834Sroberto# HPUX only, and by explicit request
1749200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1750280849ScyAC_ARG_ENABLE(
1751280849Scy    [BANCOMM],
1752280849Scy    [AS_HELP_STRING(
1753280849Scy	[--enable-BANCOMM],
1754280849Scy	[- Datum/Bancomm bc635/VME interface]
1755280849Scy    )],
1756280849Scy    [ntp_ok=$enableval],
1757280849Scy    [ntp_ok=no]
1758280849Scy)
1759280849Scycase "$ntp_ok" in
1760280849Scy yes)
1761181834Sroberto    ntp_refclock=yes
1762280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1763280849Scy    ;;
1764280849Scyesac
1765280849ScyAC_MSG_RESULT([$ntp_ok])
1766181834Srobertocase "$ntp_ok$host" in
1767181834Sroberto yes*-*-hpux*) ;;
1768200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1769181834Srobertoesac
1770181834Sroberto
1771181834Sroberto#HPUX only, and only by explicit request
1772200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1773280849ScyAC_ARG_ENABLE(
1774280849Scy    [GPSVME],
1775280849Scy    [AS_HELP_STRING(
1776280849Scy	[--enable-GPSVME],
1777280849Scy	[- TrueTime GPS receiver/VME interface]
1778280849Scy    )],
1779280849Scy    [ntp_ok=$enableval],
1780280849Scy    [ntp_ok=no]
1781280849Scy)
1782280849Scycase "$ntp_ok" in
1783280849Scy yes)
1784181834Sroberto    ntp_refclock=yes
1785280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1786280849Scy    ;;
1787280849Scyesac
1788280849ScyAC_MSG_RESULT([$ntp_ok])
1789181834Srobertocase "$ntp_ok$host" in
1790181834Sroberto yes*-*-hpux*) ;;
1791200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1792181834Srobertoesac
1793181834Sroberto
1794200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1795181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1796181834Sroberto yesyesyes)
1797280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1798181834Sroberto    ans=yes
1799181834Sroberto    ;;
1800181834Sroberto *)
1801181834Sroberto    ans=no
1802181834Sroberto    ;;
1803181834Srobertoesac
1804200576SrobertoAC_MSG_RESULT([$ans])
1805181834Sroberto
1806200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1807280849ScyAC_ARG_ENABLE(
1808280849Scy    [all-clocks],
1809280849Scy    [AS_HELP_STRING(
1810280849Scy	[--enable-all-clocks],
1811280849Scy	[+ include all suitable non-PARSE clocks:]
1812280849Scy    )],
1813280849Scy    [ntp_eac=$enableval],
1814280849Scy    [ntp_eac=yes]
1815280849Scy)
1816280849ScyAC_MSG_RESULT([$ntp_eac])
1817181834Sroberto
1818280849Scy# HMS: Should we also require ntp_parse_ok?
1819200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1820280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1821181834Sroberto yes*yes*)
1822181834Sroberto    ntp_canparse=yes
1823181834Sroberto    ;;
1824181834Sroberto *) ntp_canparse=no
1825181834Sroberto    ;;
1826181834Srobertoesac
1827280849ScyAC_MSG_RESULT([$ntp_canparse])
1828181834Sroberto
1829181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1830181834Srobertocase "$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
1831181834Sroberto *yes*)
1832181834Sroberto    ntp_canaudio=yes
1833280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1834181834Sroberto    ;;
1835181834Sroberto *) ntp_canaudio=no ;;
1836181834Srobertoesac
1837280849ScyAC_MSG_RESULT([$ntp_canaudio])
1838181834Sroberto
1839181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1840181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1841181834Sroberto yesyes)
1842181834Sroberto    ntp_canshm=yes
1843181834Sroberto    ;;
1844181834Sroberto *) ntp_canshm=no ;;
1845181834Srobertoesac
1846280849ScyAC_MSG_RESULT([$ntp_canshm])
1847181834Sroberto
1848280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1849280849ScyAC_CACHE_CHECK(
1850280849Scy    [for termios modem control],
1851280849Scy    [ntp_cv_modem_control],
1852280849Scy    [AC_COMPILE_IFELSE(
1853280849Scy	[AC_LANG_PROGRAM(
1854280849Scy	    [[
1855280849Scy		#ifdef HAVE_UNISTD_H
1856280849Scy		# include <unistd.h>
1857280849Scy		#endif
1858280849Scy		#ifdef HAVE_TERMIOS_H
1859280849Scy		# include <termios.h>
1860280849Scy		#endif
1861280849Scy		#ifdef HAVE_SYS_IOCTL_H
1862280849Scy		# include <sys/ioctl.h>
1863280849Scy		#endif
1864280849Scy	    ]],
1865280849Scy	    [[
1866280849Scy		int	dtr = TIOCM_DTR;
1867280849Scy
1868280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1869280849Scy	    ]]
1870280849Scy	)],
1871280849Scy	[ntp_cv_modem_control=yes],
1872280849Scy	[ntp_cv_modem_control=no]
1873280849Scy    )]
1874280849Scy)
1875280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1876280849Scy yes::yes)
1877280849Scy    ntp_enable_all_modem_control_clocks=yes
1878280849Scy    ;;
1879280849Scy *)
1880280849Scy    ntp_enable_all_modem_control_clocks=no
1881280849Scy    ;;
1882280849Scyesac
1883280849Scy
1884181834Sroberto# Requires modem control
1885200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1886280849ScyAC_ARG_ENABLE(
1887280849Scy    [ACTS],
1888280849Scy    [AS_HELP_STRING(
1889280849Scy	[--enable-ACTS],
1890280849Scy	[s ACTS modem service]
1891280849Scy    )],
1892181834Sroberto    [ntp_ok=$enableval],
1893280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1894280849Scy)
1895280849Scycase "$ntp_ok" in
1896280849Scy yes)
1897181834Sroberto    ntp_refclock=yes
1898280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1899280849Scy    ;;
1900280849Scyesac
1901280849ScyAC_MSG_RESULT([$ntp_ok])
1902181834Sroberto
1903200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1904280849ScyAC_ARG_ENABLE(
1905280849Scy    [ARBITER],
1906280849Scy    [AS_HELP_STRING(
1907280849Scy	[--enable-ARBITER],
1908280849Scy	[+ Arbiter 1088A/B GPS receiver]
1909280849Scy    )],
1910280849Scy    [ntp_ok=$enableval],
1911280849Scy    [ntp_ok=$ntp_eac]
1912280849Scy)
1913280849Scycase "$ntp_ok" in
1914280849Scy yes)
1915181834Sroberto    ntp_refclock=yes
1916280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1917280849Scy    ;;
1918280849Scyesac
1919280849ScyAC_MSG_RESULT([$ntp_ok])
1920181834Sroberto
1921200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1922280849ScyAC_ARG_ENABLE(
1923280849Scy    [ARCRON_MSF],
1924280849Scy    [AS_HELP_STRING(
1925280849Scy	[--enable-ARCRON-MSF],
1926280849Scy	[+ Arcron MSF receiver]
1927280849Scy    )],
1928280849Scy    [ntp_ok=$enableval],
1929280849Scy    [ntp_ok=$ntp_eac]
1930280849Scy)
1931280849Scycase "$ntp_ok" in
1932280849Scy yes)
1933181834Sroberto    ntp_refclock=yes
1934280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1935280849Scy    ;;
1936280849Scyesac
1937280849ScyAC_MSG_RESULT([$ntp_ok])
1938181834Sroberto
1939200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1940280849ScyAC_ARG_ENABLE(
1941280849Scy    [AS2201],
1942280849Scy    [AS_HELP_STRING(
1943280849Scy	[--enable-AS2201],
1944280849Scy	[+ Austron 2200A/2201A GPS receiver]
1945280849Scy    )],
1946280849Scy    [ntp_ok=$enableval],
1947280849Scy    [ntp_ok=$ntp_eac]
1948280849Scy)
1949280849Scycase "$ntp_ok" in
1950280849Scy yes)
1951181834Sroberto    ntp_refclock=yes
1952280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1953280849Scy    ;;
1954280849Scyesac
1955280849ScyAC_MSG_RESULT([$ntp_ok])
1956181834Sroberto
1957200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1958280849ScyAC_ARG_ENABLE(
1959280849Scy    [ATOM],
1960280849Scy    [AS_HELP_STRING(
1961280849Scy	[--enable-ATOM],
1962280849Scy	[s ATOM PPS interface]
1963280849Scy    )],
1964280849Scy    [ntp_ok=$enableval],
1965280849Scy    [ntp_ok=$ntp_eac]
1966280849Scy)
1967280849Scycase "$ntp_atom_ok" in
1968181834Sroberto no) ntp_ok=no ;;
1969181834Srobertoesac
1970280849Scycase "$ntp_ok" in
1971280849Scy yes)
1972181834Sroberto    ntp_refclock=yes
1973280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1974280849Scy    ;;
1975280849Scyesac
1976280849ScyAC_MSG_RESULT([$ntp_ok])
1977181834Sroberto
1978200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1979280849ScyAC_ARG_ENABLE(
1980280849Scy    [CHRONOLOG],
1981280849Scy    [AS_HELP_STRING(
1982280849Scy	[--enable-CHRONOLOG],
1983280849Scy	[+ Chrono-log K-series WWVB receiver]
1984280849Scy    )],
1985280849Scy    [ntp_ok=$enableval],
1986280849Scy    [ntp_ok=$ntp_eac]
1987280849Scy)
1988280849Scycase "$ntp_ok" in
1989280849Scy yes)
1990181834Sroberto    ntp_refclock=yes
1991280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1992280849Scy    ;;
1993280849Scyesac
1994280849ScyAC_MSG_RESULT([$ntp_ok])
1995181834Sroberto
1996200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1997280849ScyAC_ARG_ENABLE(
1998280849Scy    [CHU],
1999280849Scy    [AS_HELP_STRING(
2000280849Scy	[--enable-CHU],
2001280849Scy	[+ CHU modem/decoder]
2002280849Scy    )],
2003280849Scy    [ntp_ok=$enableval],
2004280849Scy    [ntp_ok=$ntp_eac]
2005280849Scy)
2006280849Scycase "$ntp_ok" in
2007280849Scy yes)
2008181834Sroberto    ntp_refclock=yes
2009280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
2010280849Scy    ;;
2011280849Scyesac
2012280849ScyAC_MSG_RESULT([$ntp_ok])
2013280849Scyntp_refclock_chu=$ntp_ok
2014181834Sroberto
2015200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2016280849ScyAC_ARG_ENABLE(
2017280849Scy    [AUDIO-CHU],
2018280849Scy    [AS_HELP_STRING(
2019280849Scy	[--enable-AUDIO-CHU],
2020280849Scy	[s CHU audio/decoder]
2021280849Scy    )],
2022181834Sroberto    [ntp_ok=$enableval],
2023280849Scy    [
2024280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2025280849Scy	 *no*)	ntp_ok=no  ;;
2026280849Scy	 *)	ntp_ok=yes ;;
2027280849Scy	esac
2028280849Scy    ]
2029280849Scy)
2030280849ScyAC_MSG_RESULT([$ntp_ok])
2031181834Sroberto# We used to check for sunos/solaris target...
2032280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2033280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2034181834Srobertoesac
2035181834Sroberto
2036181834Sroberto# Not under HP-UX
2037200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2038280849ScyAC_ARG_ENABLE(
2039280849Scy    [DATUM],
2040280849Scy    [AS_HELP_STRING(
2041280849Scy	[--enable-DATUM],
2042280849Scy	[s Datum Programmable Time System]
2043280849Scy    )],
2044181834Sroberto    [ntp_ok=$enableval],
2045280849Scy    [
2046280849Scy	case "$ac_cv_header_termios_h" in
2047280849Scy	 yes)
2048280849Scy	    ntp_ok=$ntp_eac
2049280849Scy	    ;;
2050280849Scy	 *) ntp_ok=no
2051280849Scy	    ;;
2052280849Scy	esac
2053280849Scy    ]
2054280849Scy)
2055280849Scycase "$ntp_ok" in
2056280849Scy yes)
2057181834Sroberto    ntp_refclock=yes
2058280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2059280849Scy    ;;
2060280849Scyesac
2061280849ScyAC_MSG_RESULT([$ntp_ok])
2062181834Sroberto
2063200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2064280849ScyAC_ARG_ENABLE(
2065280849Scy    [DUMBCLOCK],
2066280849Scy    [AS_HELP_STRING(
2067280849Scy	[--enable-DUMBCLOCK],
2068280849Scy	[+ Dumb generic hh:mm:ss local clock]
2069280849Scy    )],
2070280849Scy    [ntp_ok=$enableval],
2071280849Scy    [ntp_ok=$ntp_eac]
2072280849Scy)
2073280849Scycase "$ntp_ok" in
2074280849Scy yes)
2075181834Sroberto    ntp_refclock=yes
2076280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2077280849Scy    ;;
2078280849Scyesac
2079280849ScyAC_MSG_RESULT([$ntp_ok])
2080181834Sroberto
2081200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2082280849ScyAC_ARG_ENABLE(
2083280849Scy    [FG],
2084280849Scy    [AS_HELP_STRING(
2085280849Scy	[--enable-FG],
2086280849Scy	[+ Forum Graphic GPS]
2087280849Scy    )],
2088280849Scy    [ntp_ok=$enableval],
2089280849Scy    [ntp_ok=$ntp_eac]
2090280849Scy)
2091280849Scycase "$ntp_ok" in
2092280849Scy yes)
2093181834Sroberto    ntp_refclock=yes
2094280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2095280849Scy    ;;
2096280849Scyesac
2097280849ScyAC_MSG_RESULT([$ntp_ok])
2098181834Sroberto
2099181834Sroberto# Requires modem control
2100200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2101280849ScyAC_ARG_ENABLE(
2102280849Scy    [HEATH],
2103280849Scy    [AS_HELP_STRING(
2104280849Scy	[--enable-HEATH],
2105280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2106280849Scy    )],
2107181834Sroberto    [ntp_ok=$enableval],
2108280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2109280849Scy)
2110280849Scycase "$ntp_ok" in
2111280849Scy yes)
2112181834Sroberto    ntp_refclock=yes
2113280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2114280849Scy    ;;
2115280849Scyesac
2116280849ScyAC_MSG_RESULT([$ntp_ok])
2117181834Sroberto
2118200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2119280849ScyAC_ARG_ENABLE(
2120280849Scy    [HOPFSERIAL],
2121280849Scy    [AS_HELP_STRING(
2122280849Scy	[--enable-HOPFSERIAL],
2123280849Scy	[+ hopf serial clock device]
2124280849Scy    )],
2125280849Scy    [ntp_ok=$enableval],
2126280849Scy    [ntp_ok=$ntp_eac]
2127280849Scy)
2128280849Scycase "$ntp_ok" in
2129280849Scy yes)
2130181834Sroberto    ntp_refclock=yes
2131280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2132280849Scy    ;;
2133280849Scyesac
2134280849ScyAC_MSG_RESULT([$ntp_ok])
2135181834Sroberto
2136200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2137280849ScyAC_ARG_ENABLE(
2138280849Scy    [HOPFPCI],
2139280849Scy    [AS_HELP_STRING(
2140280849Scy	[--enable-HOPFPCI],
2141280849Scy	[+ hopf 6039 PCI board]
2142280849Scy    )],
2143280849Scy    [ntp_ok=$enableval],
2144280849Scy    [ntp_ok=$ntp_eac]
2145280849Scy)
2146280849Scycase "$ntp_ok" in
2147280849Scy yes)
2148181834Sroberto    ntp_refclock=yes
2149280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2150280849Scy    ;;
2151280849Scyesac
2152280849ScyAC_MSG_RESULT([$ntp_ok])
2153181834Sroberto
2154200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2155280849ScyAC_ARG_ENABLE(
2156280849Scy    [HPGPS],
2157280849Scy    [AS_HELP_STRING(
2158280849Scy	[--enable-HPGPS],
2159280849Scy	[+ HP 58503A GPS receiver]
2160280849Scy    )],
2161280849Scy    [ntp_ok=$enableval],
2162280849Scy    [ntp_ok=$ntp_eac]
2163280849Scy)
2164280849Scycase "$ntp_ok" in
2165280849Scy yes)
2166181834Sroberto    ntp_refclock=yes
2167280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2168280849Scy    ;;
2169280849Scyesac
2170280849ScyAC_MSG_RESULT([$ntp_ok])
2171181834Sroberto
2172200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2173280849ScyAC_ARG_ENABLE(
2174280849Scy    [IRIG],
2175280849Scy    [AS_HELP_STRING(
2176280849Scy	[--enable-IRIG],
2177280849Scy	[s IRIG audio decoder]
2178280849Scy    )],
2179181834Sroberto    [ntp_ok=$enableval],
2180280849Scy    [
2181280849Scy	case "$ntp_eac$ntp_canaudio" in
2182280849Scy	 *no*)	ntp_ok=no  ;;
2183280849Scy	 *)	ntp_ok=yes ;;
2184280849Scy	esac
2185280849Scy    ]
2186280849Scy)
2187280849Scycase "$ntp_ok" in
2188280849Scy yes)
2189181834Sroberto    ntp_refclock=yes
2190280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2191280849Scy    ;;
2192280849Scyesac
2193280849ScyAC_MSG_RESULT([$ntp_ok])
2194181834Srobertocase "$ntp_ok$ntp_canaudio" in
2195280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2196181834Srobertoesac
2197181834Sroberto
2198200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2199280849ScyAC_ARG_ENABLE(
2200280849Scy    [JJY],
2201280849Scy    [AS_HELP_STRING(
2202280849Scy	[--enable-JJY],
2203280849Scy	[+ JJY receiver]
2204280849Scy    )],
2205280849Scy    [ntp_ok=$enableval],
2206280849Scy    [ntp_ok=$ntp_eac]
2207280849Scy)
2208280849Scycase "$ntp_ok" in
2209280849Scy yes)
2210181834Sroberto    ntp_refclock=yes
2211280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2212280849Scy    ;;
2213280849Scyesac
2214280849ScyAC_MSG_RESULT([$ntp_ok])
2215181834Sroberto
2216200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2217280849ScyAC_ARG_ENABLE(
2218280849Scy    [JUPITER],
2219280849Scy    [AS_HELP_STRING(
2220280849Scy	[--enable-JUPITER],
2221280849Scy	[s Rockwell Jupiter GPS receiver]
2222280849Scy    )],
2223181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2224280849Scycase "$ntp_jupiter_ok" in
2225181834Sroberto no) ntp_ok=no ;;
2226181834Srobertoesac
2227280849Scycase "$ntp_ok" in
2228280849Scy yes)
2229181834Sroberto    ntp_refclock=yes
2230280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2231280849Scy    ;;
2232280849Scyesac
2233280849ScyAC_MSG_RESULT([$ntp_ok])
2234181834Sroberto
2235200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2236280849ScyAC_ARG_ENABLE(
2237280849Scy    [LEITCH],
2238280849Scy    [AS_HELP_STRING(
2239280849Scy	[--enable-LEITCH],
2240280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2241280849Scy    )],
2242280849Scy    [ntp_ok=$enableval],
2243280849Scy    [ntp_ok=$ntp_eac]
2244280849Scy)
2245280849Scycase "$ntp_ok" in
2246280849Scy yes)
2247181834Sroberto    ntp_refclock=yes
2248280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2249280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2250280849Scy    ;;
2251280849Scyesac
2252280849ScyAC_MSG_RESULT([$ntp_ok])
2253181834Sroberto
2254200576SrobertoAC_MSG_CHECKING([local clock reference])
2255280849ScyAC_ARG_ENABLE(
2256280849Scy    [LOCAL-CLOCK],
2257280849Scy    [AS_HELP_STRING(
2258280849Scy	[--enable-LOCAL-CLOCK],
2259280849Scy	[+ local clock reference]
2260280849Scy    )],
2261280849Scy    [ntp_ok=$enableval],
2262280849Scy    [ntp_ok=$ntp_eac]
2263280849Scy)
2264280849Scycase "$ntp_ok" in
2265280849Scy yes)
2266181834Sroberto    ntp_refclock=yes
2267280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2268280849Scy    ;;
2269280849Scyesac
2270280849ScyAC_MSG_RESULT([$ntp_ok])
2271181834Sroberto
2272181834Srobertodnl Bug 340: longstanding unfixed bugs
2273280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2274280849Scydnl AC_ARG_ENABLE([MSFEES],
2275280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2276181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2277181834Srobertodnl if test "$ntp_ok" = "yes"; then
2278181834Srobertodnl     ntp_refclock=yes
2279280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2280181834Srobertodnl fi
2281280849Scydnl AC_MSG_RESULT([$ntp_ok])
2282181834Sroberto
2283181834Sroberto# Not Ultrix
2284200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2285280849ScyAC_ARG_ENABLE(
2286280849Scy    [MX4200],
2287280849Scy    [AS_HELP_STRING(
2288280849Scy	[--enable-MX4200 ],
2289280849Scy	[s Magnavox MX4200 GPS receiver]
2290280849Scy    )],
2291181834Sroberto    [ntp_ok=$enableval],
2292280849Scy    [
2293280849Scy	case "$ac_cv_var_ppsclock" in
2294280849Scy	 yes)
2295280849Scy	    ntp_ok=$ntp_eac
2296280849Scy	    ;;
2297280849Scy	 *)
2298280849Scy	    ntp_ok=no
2299280849Scy	    ;;
2300280849Scy	esac
2301280849Scy    ]
2302280849Scy)
2303280849Scycase "$ntp_ok" in
2304280849Scy yes)
2305181834Sroberto    ntp_refclock=yes
2306280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2307280849Scy    ;;
2308280849Scyesac
2309280849ScyAC_MSG_RESULT([$ntp_ok])
2310181834Srobertocase "$ntp_ok$host" in
2311280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2312181834Srobertoesac
2313181834Sroberto
2314200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2315280849ScyAC_ARG_ENABLE(
2316280849Scy    [NEOCLOCK4X],
2317280849Scy    [AS_HELP_STRING(
2318280849Scy	[--enable-NEOCLOCK4X],
2319280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2320280849Scy    )],
2321280849Scy    [ntp_ok=$enableval],
2322280849Scy    [ntp_ok=$ntp_eac]
2323280849Scy)
2324280849Scycase "$ntp_ok" in
2325280849Scy yes)
2326181834Sroberto    ntp_refclock=yes
2327280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2328280849Scy    ;;
2329280849Scyesac
2330280849ScyAC_MSG_RESULT([$ntp_ok])
2331181834Sroberto
2332200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2333280849ScyAC_ARG_ENABLE(
2334280849Scy    [NMEA],
2335280849Scy    [AS_HELP_STRING(
2336280849Scy	[--enable-NMEA],
2337280849Scy	[+ NMEA GPS receiver]
2338280849Scy    )],
2339280849Scy    [ntp_ok=$enableval],
2340280849Scy    [ntp_ok=$ntp_eac]
2341280849Scy)
2342280849Scycase "$ntp_ok" in
2343280849Scy yes)
2344181834Sroberto    ntp_refclock=yes
2345280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2346280849Scy    ;;
2347280849Scyesac
2348280849ScyAC_MSG_RESULT([$ntp_ok])
2349181834Sroberto
2350280849ScyAC_CHECK_FUNCS([strtoll])
2351280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2352280849ScyAC_ARG_ENABLE(
2353280849Scy    [GPSD],
2354280849Scy    [AS_HELP_STRING(
2355280849Scy	[--enable-GPSD],
2356280849Scy	[+ GPSD JSON receiver]
2357280849Scy    )],
2358280849Scy    [ntp_ok=$enableval],
2359280849Scy    [case "$ac_cv_func_strtoll" in
2360280849Scy     yes) ntp_ok=$ntp_eac ;;
2361280849Scy     *)   ntp_ok="no" ;;
2362280849Scy    esac]
2363280849Scy)
2364280849Scycase "$ntp_ok" in
2365280849Scy yes)
2366280849Scy    ntp_refclock=yes
2367280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2368280849Scy    ;;
2369280849Scyesac
2370280849ScyAC_MSG_RESULT([$ntp_ok])
2371280849Scy
2372200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2373280849ScyAC_ARG_ENABLE(
2374280849Scy    [ONCORE],
2375280849Scy    [AS_HELP_STRING(
2376280849Scy	[--enable-ONCORE],
2377280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2378280849Scy    )],
2379280849Scy    [ntp_ok=$enableval],
2380280849Scy    [ntp_ok=$ntp_eac]
2381280849Scy)
2382280849Scycase "$ntp_oncore_ok" in
2383181834Sroberto no) ntp_ok=no ;;
2384181834Srobertoesac
2385280849Scycase "$ntp_ok" in
2386280849Scy yes)
2387181834Sroberto    ntp_refclock=yes
2388280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2389280849Scy    ;;
2390280849Scyesac
2391280849ScyAC_MSG_RESULT([$ntp_ok])
2392181834Sroberto
2393280849Scy# Requires modem control
2394200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2395280849ScyAC_ARG_ENABLE(
2396280849Scy    [PALISADE],
2397280849Scy    [AS_HELP_STRING(
2398280849Scy	[--enable-PALISADE],
2399280849Scy	[s Palisade clock]
2400280849Scy    )],
2401181834Sroberto    [ntp_ok=$enableval],
2402280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2403280849Scy)
2404280849Scycase "$ntp_ok" in
2405280849Scy yes)
2406181834Sroberto    ntp_refclock=yes
2407280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2408280849Scy    ;;
2409280849Scyesac
2410280849ScyAC_MSG_RESULT([$ntp_ok])
2411181834Sroberto
2412200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2413280849ScyAC_ARG_ENABLE(
2414280849Scy    [PCF],
2415280849Scy    [AS_HELP_STRING(
2416280849Scy	[--enable-PCF ],
2417280849Scy	[+ Conrad parallel port radio clock]
2418280849Scy    )],
2419280849Scy    [ntp_ok=$enableval],
2420280849Scy    [ntp_ok=$ntp_eac]
2421280849Scy)
2422280849Scycase "$ntp_ok" in
2423280849Scy yes)
2424181834Sroberto    ntp_refclock=yes
2425280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2426280849Scy    ;;
2427280849Scyesac
2428280849ScyAC_MSG_RESULT([$ntp_ok])
2429181834Sroberto
2430200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2431280849ScyAC_ARG_ENABLE(
2432280849Scy    [PST],
2433280849Scy    [AS_HELP_STRING(
2434280849Scy	[--enable-PST],
2435280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2436280849Scy    )],
2437280849Scy    [ntp_ok=$enableval],
2438280849Scy    [ntp_ok=$ntp_eac]
2439280849Scy)
2440280849Scycase "$ntp_ok" in
2441280849Scy yes)
2442181834Sroberto    ntp_refclock=yes
2443280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2444280849Scy    ;;
2445280849Scyesac
2446280849ScyAC_MSG_RESULT([$ntp_ok])
2447181834Sroberto
2448200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2449280849ScyAC_ARG_ENABLE(
2450280849Scy    [RIPENCC],
2451280849Scy    [AS_HELP_STRING(
2452280849Scy	[--enable-RIPENCC],
2453280849Scy	[- RIPENCC specific Trimble driver]
2454280849Scy    )],
2455280849Scy    [ntp_ok=$enableval],
2456280849Scy    [ntp_ok=no]
2457280849Scy)
2458181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2459280849Scycase "$ntp_ripe_ncc_ok" in
2460181834Sroberto no) ntp_ok=no ;;
2461181834Srobertoesac
2462280849Scycase "$ntp_ok" in
2463280849Scy yes)
2464181834Sroberto    ntp_refclock=yes
2465280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2466280849Scy    ;;
2467280849Scyesac
2468280849ScyAC_MSG_RESULT([$ntp_ok])
2469181834Sroberto
2470181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2471181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2472200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2473280849ScyAC_ARG_ENABLE(
2474280849Scy    [SHM],
2475280849Scy    [AS_HELP_STRING(
2476280849Scy	[--enable-SHM],
2477280849Scy	[s SHM clock attached thru shared memory]
2478280849Scy    )],
2479181834Sroberto    [ntp_ok=$enableval],
2480280849Scy    [
2481280849Scy	case "$ntp_eac$ntp_canshm" in
2482280849Scy	 *no*)	ntp_ok=no  ;;
2483280849Scy	 *)	ntp_ok=yes ;;
2484280849Scy	esac
2485280849Scy    ]
2486280849Scy)
2487280849Scycase "$ntp_ok" in
2488280849Scy yes)
2489181834Sroberto    ntp_refclock=yes
2490280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2491280849Scy    ;;
2492280849Scyesac
2493280849ScyAC_MSG_RESULT([$ntp_ok])
2494181834Sroberto
2495200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2496280849ScyAC_ARG_ENABLE(
2497280849Scy    [SPECTRACOM],
2498280849Scy    [AS_HELP_STRING(
2499280849Scy	[--enable-SPECTRACOM],
2500280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2501280849Scy    )],
2502280849Scy    [ntp_ok=$enableval],
2503280849Scy    [ntp_ok=$ntp_eac]
2504280849Scy)
2505280849Scycase "$ntp_ok" in
2506280849Scy yes)
2507181834Sroberto    ntp_refclock=yes
2508280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2509280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2510280849Scy    ;;
2511280849Scyesac
2512280849ScyAC_MSG_RESULT([$ntp_ok])
2513181834Sroberto
2514200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2515280849ScyAC_ARG_ENABLE(
2516280849Scy    [TPRO],
2517280849Scy    [AS_HELP_STRING(
2518280849Scy	[--enable-TPRO],
2519280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2520280849Scy    )],
2521181834Sroberto    [ntp_ok=$enableval],
2522280849Scy    [
2523280849Scy	case "$ac_cv_header_sys_tpro_h" in
2524280849Scy	 yes)
2525280849Scy	    ntp_ok=$ntp_eac
2526280849Scy	    ;;
2527280849Scy	 *)
2528280849Scy	    ntp_ok=no
2529280849Scy	    ;;
2530280849Scy	esac
2531280849Scy    ]
2532280849Scy)
2533280849Scycase "$ntp_ok" in
2534280849Scy yes)
2535181834Sroberto    ntp_refclock=yes
2536280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2537280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2538280849Scy    ;;
2539280849Scyesac
2540280849ScyAC_MSG_RESULT([$ntp_ok])
2541181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2542280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2543181834Srobertoesac
2544181834Sroberto
2545181834Sroberto# Not on a vax-dec-bsd
2546200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2547280849ScyAC_ARG_ENABLE(
2548280849Scy    [TRUETIME],
2549280849Scy    [AS_HELP_STRING(
2550280849Scy	[--enable-TRUETIME],
2551280849Scy	[s Kinemetrics/TrueTime receivers]
2552280849Scy    )],
2553181834Sroberto    [ntp_ok=$enableval],
2554280849Scy    [
2555280849Scy	case "$host" in
2556280849Scy	 vax-dec-bsd)
2557280849Scy	    ntp_ok=no
2558280849Scy	    ;;
2559280849Scy	 *)
2560280849Scy	    ntp_ok=$ntp_eac
2561280849Scy	    ;;
2562280849Scy	esac
2563280849Scy    ]
2564280849Scy)    
2565280849Scycase "$ntp_ok" in
2566280849Scy yes)
2567181834Sroberto    ntp_refclock=yes
2568280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2569280849Scy    ;;
2570280849Scyesac
2571280849ScyAC_MSG_RESULT([$ntp_ok])
2572181834Srobertocase "$ntp_ok$host" in
2573280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2574181834Srobertoesac
2575181834Sroberto
2576200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2577280849ScyAC_ARG_ENABLE(
2578280849Scy    [TT560],
2579280849Scy    [AS_HELP_STRING(
2580280849Scy	[--enable-TT560],
2581280849Scy	[- TrueTime 560 IRIG-B decoder]
2582280849Scy    )],
2583280849Scy    [ntp_ok=$enableval],
2584280849Scy    [ntp_ok=no]
2585280849Scy)
2586280849Scycase "$ntp_ok" in
2587280849Scy yes)
2588181834Sroberto    ntp_refclock=yes
2589280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2590280849Scy    ;;
2591280849Scyesac
2592280849ScyAC_MSG_RESULT([$ntp_ok])
2593181834Sroberto
2594200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2595280849ScyAC_ARG_ENABLE(
2596280849Scy    [ULINK],
2597280849Scy    [AS_HELP_STRING(
2598280849Scy	[--enable-ULINK],
2599280849Scy	[+ Ultralink WWVB receiver]
2600280849Scy    )],
2601280849Scy    [ntp_ok=$enableval],
2602280849Scy    [ntp_ok=$ntp_eac]
2603280849Scy)
2604280849Scycase "$ntp_ok" in
2605280849Scy yes)
2606181834Sroberto    ntp_refclock=yes
2607280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2608280849Scy    ;;
2609280849Scyesac
2610280849ScyAC_MSG_RESULT([$ntp_ok])
2611181834Sroberto
2612280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2613280849ScyAC_ARG_ENABLE(
2614280849Scy    [TSYNCPCI],
2615280849Scy    [AS_HELP_STRING(
2616280849Scy	[--enable-TSYNCPCI],
2617280849Scy	[s Spectracom TSYNC timing board]
2618280849Scy    )],
2619280849Scy    [ntp_ok=$enableval],
2620280849Scy    [
2621280849Scy	case "$host" in
2622280849Scy	 *-*-*linux*)
2623280849Scy	    ntp_ok=$ntp_eac
2624280849Scy	    ;;
2625280849Scy	 *)
2626280849Scy	    ntp_ok=no
2627280849Scy	esac
2628280849Scy    ]
2629280849Scy)
2630280849Scycase "$ntp_ok" in
2631280849Scy yes)
2632280849Scy    ntp_refclock=yes
2633280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2634280849Scy    ;;
2635280849Scyesac
2636280849ScyAC_MSG_RESULT([$ntp_ok])
2637280849Scy
2638200576SrobertoAC_MSG_CHECKING([WWV receiver])
2639280849ScyAC_ARG_ENABLE(
2640280849Scy    [WWV],
2641280849Scy    [AS_HELP_STRING(
2642280849Scy	[--enable-WWV],
2643280849Scy	[s WWV Audio receiver]
2644280849Scy    )],
2645181834Sroberto    [ntp_ok=$enableval],
2646280849Scy    [
2647280849Scy	case "$ntp_eac$ntp_canaudio" in
2648280849Scy	 *no*)	ntp_ok=no  ;;
2649280849Scy	 *)	ntp_ok=yes ;;
2650280849Scy	esac
2651280849Scy    ]
2652280849Scy)
2653280849Scycase "$ntp_ok" in
2654280849Scy yes)
2655181834Sroberto    ntp_refclock=yes
2656280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2657280849Scy    ;;
2658280849Scyesac
2659280849ScyAC_MSG_RESULT([$ntp_ok])
2660181834Srobertocase "$ntp_ok$ntp_canaudio" in
2661280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2662181834Srobertoesac
2663181834Sroberto
2664200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2665280849ScyAC_ARG_ENABLE(
2666280849Scy    [ZYFER],
2667280849Scy    [AS_HELP_STRING(
2668280849Scy	[--enable-ZYFER],
2669280849Scy	[+ Zyfer GPStarplus receiver]
2670280849Scy    )],
2671280849Scy    [ntp_ok=$enableval],
2672280849Scy    [ntp_ok=$ntp_eac]
2673280849Scy)
2674280849Scycase "$ntp_ok" in
2675280849Scy yes)
2676181834Sroberto    ntp_refclock=yes
2677280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2678280849Scy    ;;
2679280849Scyesac
2680280849ScyAC_MSG_RESULT([$ntp_ok])
2681181834Sroberto
2682200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2683280849ScyAC_ARG_ENABLE(
2684280849Scy    [parse-clocks],
2685280849Scy    [AS_HELP_STRING(
2686280849Scy	[--enable-parse-clocks],
2687280849Scy	[- include all suitable PARSE clocks:]
2688280849Scy    )],
2689181834Sroberto    [ntp_eapc=$enableval],
2690280849Scy    [
2691280849Scy	case "$ntp_eac" in
2692280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2693280849Scy	 *)	ntp_eapc=no ;;
2694280849Scy	esac
2695280849Scy	# Delete the next line one of these days
2696280849Scy	ntp_eapc=no
2697280849Scy    ]
2698280849Scy)
2699181834SrobertoAC_MSG_RESULT($ntp_eapc)
2700181834Sroberto
2701181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2702181834Sroberto noyes*)
2703200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2704181834Sroberto    ;;
2705181834Sroberto yesyesno)
2706200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2707181834Sroberto    ;;
2708181834Srobertoesac
2709181834Sroberto
2710181834Srobertontp_libparse=no
2711181834Srobertontp_parseutil=no
2712181834Srobertontp_rawdcf=no
2713181834Sroberto
2714200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2715280849ScyAC_ARG_ENABLE(
2716280849Scy    [COMPUTIME],
2717280849Scy    [AS_HELP_STRING(
2718280849Scy	[--enable-COMPUTIME],
2719280849Scy	[s Diem Computime Radio Clock]
2720280849Scy    )],
2721280849Scy    [ntp_ok=$enableval],
2722280849Scy    [ntp_ok=$ntp_eapc]
2723280849Scy)
2724280849Scycase "$ntp_ok" in
2725280849Scy yes)
2726181834Sroberto    ntp_libparse=yes
2727181834Sroberto    ntp_refclock=yes
2728280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2729280849Scy    ;;
2730280849Scyesac
2731280849ScyAC_MSG_RESULT([$ntp_ok])
2732181834Srobertocase "$ntp_ok$ntp_canparse" in
2733181834Sroberto yesno)
2734200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2735181834Srobertoesac
2736181834Sroberto
2737200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2738280849ScyAC_ARG_ENABLE(
2739280849Scy    [DCF7000],
2740280849Scy    [AS_HELP_STRING(
2741280849Scy	[--enable-DCF7000],
2742280849Scy	[s ELV/DCF7000 clock]
2743280849Scy    )],
2744280849Scy    [ntp_ok=$enableval],
2745280849Scy    [ntp_ok=$ntp_eapc]
2746280849Scy)
2747280849Scycase "$ntp_ok" in
2748280849Scy yes)
2749181834Sroberto    ntp_libparse=yes
2750181834Sroberto    ntp_refclock=yes
2751280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2752280849Scy    ;;
2753280849Scyesac
2754280849ScyAC_MSG_RESULT([$ntp_ok])
2755181834Srobertocase "$ntp_ok$ntp_canparse" in
2756181834Sroberto yesno)
2757200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2758181834Srobertoesac
2759181834Sroberto
2760200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2761280849ScyAC_ARG_ENABLE(
2762280849Scy    [HOPF6021],
2763280849Scy    [AS_HELP_STRING(
2764280849Scy	[--enable-HOPF6021],
2765280849Scy	[s HOPF 6021 clock]
2766280849Scy    )],
2767280849Scy    [ntp_ok=$enableval],
2768280849Scy    [ntp_ok=$ntp_eapc]
2769280849Scy)
2770280849Scycase "$ntp_ok" in
2771280849Scy yes)
2772181834Sroberto    ntp_libparse=yes
2773181834Sroberto    ntp_refclock=yes
2774280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2775280849Scy    ;;
2776280849Scyesac
2777280849ScyAC_MSG_RESULT([$ntp_ok])
2778181834Srobertocase "$ntp_ok$ntp_canparse" in
2779181834Sroberto yesno)
2780200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2781181834Srobertoesac
2782181834Sroberto
2783200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2784280849ScyAC_ARG_ENABLE(
2785280849Scy    [MEINBERG],
2786280849Scy    [AS_HELP_STRING(
2787280849Scy	[--enable-MEINBERG],
2788280849Scy	[s Meinberg clocks]
2789280849Scy    )],
2790280849Scy    [ntp_ok=$enableval],
2791280849Scy    [ntp_ok=$ntp_eapc]
2792280849Scy)
2793280849Scycase "$ntp_ok" in
2794280849Scy yes)
2795181834Sroberto    ntp_libparse=yes
2796181834Sroberto    ntp_refclock=yes
2797280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2798280849Scy    ;;
2799280849Scyesac
2800280849ScyAC_MSG_RESULT([$ntp_ok])
2801181834Srobertocase "$ntp_ok$ntp_canparse" in
2802181834Sroberto yesno)
2803200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2804181834Srobertoesac
2805181834Sroberto
2806200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2807280849ScyAC_ARG_ENABLE(
2808280849Scy    [RAWDCF],
2809280849Scy    [AS_HELP_STRING(
2810280849Scy	[--enable-RAWDCF],
2811280849Scy	[s DCF77 raw time code]
2812280849Scy    )],
2813280849Scy    [ntp_ok=$enableval],
2814280849Scy    [ntp_ok=$ntp_eapc]
2815280849Scy)
2816280849Scycase "$ntp_ok" in
2817280849Scy yes)
2818181834Sroberto    ntp_libparse=yes
2819181834Sroberto    ntp_parseutil=yes
2820181834Sroberto    ntp_refclock=yes
2821181834Sroberto    ntp_rawdcf=yes
2822280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2823280849Scy    ;;
2824280849Scyesac
2825280849ScyAC_MSG_RESULT([$ntp_ok])
2826181834Srobertocase "$ntp_ok$ntp_canparse" in
2827181834Sroberto yesno)
2828280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2829181834Srobertoesac
2830181834Sroberto
2831181834Srobertocase "$ntp_rawdcf" in
2832181834Sroberto yes)
2833200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2834280849Scy	[ntp_cv_rawdcf_parity],
2835280849Scy	[
2836280849Scy	    ans=no
2837280849Scy	    case "$host" in
2838280849Scy	     *-*-*linux*)
2839280849Scy		ans=yes
2840280849Scy		;;
2841280849Scy	    esac
2842280849Scy	    ntp_cv_rawdcf_parity=$ans
2843280849Scy	]
2844280849Scy    )
2845280849Scy    case "$ntp_cv_rawdcf_parity" in
2846280849Scy     yes)
2847280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2848280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2849181834Sroberto    esac
2850181834Srobertoesac
2851181834Sroberto
2852200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2853280849ScyAC_ARG_ENABLE(
2854280849Scy    [RCC8000],
2855280849Scy    [AS_HELP_STRING(
2856280849Scy	[--enable-RCC8000],
2857280849Scy	[s RCC 8000 clock]
2858280849Scy    )],
2859280849Scy    [ntp_ok=$enableval],
2860280849Scy    [ntp_ok=$ntp_eapc]
2861280849Scy)
2862280849Scycase "$ntp_ok" in
2863280849Scy yes)
2864181834Sroberto    ntp_libparse=yes
2865181834Sroberto    ntp_refclock=yes
2866280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2867280849Scy    ;;
2868280849Scyesac
2869280849ScyAC_MSG_RESULT([$ntp_ok])
2870181834Srobertocase "$ntp_ok$ntp_canparse" in
2871181834Sroberto yesno)
2872280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2873181834Srobertoesac
2874181834Sroberto
2875200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2876280849ScyAC_ARG_ENABLE(
2877280849Scy    [SCHMID],
2878280849Scy    [AS_HELP_STRING(
2879280849Scy	[--enable-SCHMID ],
2880280849Scy	[s Schmid DCF77 clock]
2881280849Scy    )],
2882280849Scy    [ntp_ok=$enableval],
2883280849Scy    [ntp_ok=$ntp_eapc]
2884280849Scy)
2885280849Scycase "$ntp_ok" in
2886280849Scy yes)
2887181834Sroberto    ntp_libparse=yes
2888181834Sroberto    ntp_refclock=yes
2889280849Scy    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2890280849Scy    ;;
2891280849Scyesac
2892280849ScyAC_MSG_RESULT([$ntp_ok])
2893181834Srobertocase "$ntp_ok$ntp_canparse" in
2894181834Sroberto yesno)
2895280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2896181834Srobertoesac
2897181834Sroberto
2898200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2899280849ScyAC_ARG_ENABLE(
2900280849Scy    [TRIMTAIP],
2901280849Scy    [AS_HELP_STRING(
2902280849Scy	[--enable-TRIMTAIP],
2903280849Scy	[s Trimble GPS receiver/TAIP protocol]
2904280849Scy    )],
2905280849Scy    [ntp_ok=$enableval],
2906280849Scy    [ntp_ok=$ntp_eapc]
2907280849Scy)
2908280849Scycase "$ntp_ok" in
2909280849Scy yes)
2910181834Sroberto    ntp_libparse=yes
2911181834Sroberto    ntp_refclock=yes
2912280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2913280849Scy	[Trimble GPS receiver/TAIP protocol])
2914280849Scy    ;;
2915280849Scyesac
2916280849ScyAC_MSG_RESULT([$ntp_ok])
2917181834Srobertocase "$ntp_ok$ntp_canparse" in
2918181834Sroberto yesno)
2919280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2920181834Srobertoesac
2921181834Sroberto
2922200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2923280849ScyAC_ARG_ENABLE(
2924280849Scy    [TRIMTSIP],
2925280849Scy    [AS_HELP_STRING(
2926280849Scy	[--enable-TRIMTSIP],
2927280849Scy	[s Trimble GPS receiver/TSIP protocol]
2928280849Scy    )],
2929280849Scy    [ntp_ok=$enableval],
2930280849Scy    [ntp_ok=$ntp_eapc]
2931280849Scy)
2932280849Scycase "$ntp_ok" in
2933280849Scy yes)
2934181834Sroberto    ntp_libparse=yes
2935181834Sroberto    ntp_refclock=yes
2936280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2937280849Scy	[Trimble GPS receiver/TSIP protocol])
2938280849Scy    ;;
2939280849Scyesac
2940280849ScyAC_MSG_RESULT([$ntp_ok])
2941181834Srobertocase "$ntp_ok$ntp_canparse" in
2942181834Sroberto yesno)
2943280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2944181834Srobertoesac
2945181834Sroberto
2946200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2947280849ScyAC_ARG_ENABLE(
2948280849Scy    [WHARTON],
2949280849Scy    [AS_HELP_STRING(
2950280849Scy	[--enable-WHARTON],
2951280849Scy	[s WHARTON 400A Series clock]
2952280849Scy    )],
2953280849Scy    [ntp_ok=$enableval],
2954280849Scy    [ntp_ok=$ntp_eapc]
2955280849Scy)
2956280849Scycase "$ntp_ok" in
2957280849Scy yes)
2958181834Sroberto    ntp_libparse=yes
2959181834Sroberto    ntp_refclock=yes
2960280849Scy    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2961280849Scy    ;;
2962280849Scyesac
2963280849ScyAC_MSG_RESULT([$ntp_ok])
2964181834Srobertocase "$ntp_ok$ntp_canparse" in
2965181834Sroberto yesno)
2966280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2967280849Scyesac
2968280849Scy
2969280849ScyAC_MSG_CHECKING([VARITEXT clock])
2970280849ScyAC_ARG_ENABLE(
2971280849Scy    [VARITEXT],
2972280849Scy    [AS_HELP_STRING(
2973280849Scy	[--enable-VARITEXT],
2974280849Scy	[s VARITEXT clock]
2975280849Scy    )],
2976280849Scy    [ntp_ok=$enableval],
2977280849Scy    [ntp_ok=$ntp_eapc]
2978280849Scy)
2979280849Scycase "$ntp_ok" in
2980280849Scy yes)
2981280849Scy    ntp_libparse=yes
2982280849Scy    ntp_refclock=yes
2983280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2984181834Sroberto    ;;
2985181834Srobertoesac
2986280849ScyAC_MSG_RESULT([$ntp_ok])
2987280849Scycase "$ntp_ok$ntp_canparse" in
2988280849Scy yesno)
2989280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2990280849Scyesac
2991181834Sroberto
2992280849ScyAC_MSG_CHECKING(SEL240X clock)
2993280849ScyAC_ARG_ENABLE(SEL240X,
2994280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2995181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2996181834Srobertoif test "$ntp_ok" = "yes"; then
2997181834Sroberto    ntp_libparse=yes
2998181834Sroberto    ntp_refclock=yes
2999280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
3000181834Srobertofi
3001181834SrobertoAC_MSG_RESULT($ntp_ok)
3002181834Srobertocase "$ntp_ok$ntp_canparse" in
3003181834Sroberto yesno)
3004280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3005181834Sroberto    ;;
3006181834Srobertoesac
3007280849Scy
3008280849ScyAC_SUBST([LIBPARSE])
3009280849ScyAC_SUBST([MAKE_LIBPARSE])
3010280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
3011280849ScyAC_SUBST([MAKE_CHECK_Y2K])
3012280849Scy
3013200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3014181834Srobertoans=no
3015181834Srobertocase "$ntp_libparse" in
3016181834Sroberto yes)
3017181834Sroberto    ans=yes
3018280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3019181834Sroberto    LIBPARSE=../libparse/libparse.a
3020181834Sroberto    MAKE_LIBPARSE=libparse.a
3021181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3022181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3023181834Srobertoesac
3024200576SrobertoAC_MSG_RESULT([$ans])
3025181834Sroberto
3026280849ScyNTP_OPENSSL
3027181834Sroberto
3028280849ScyNTP_CRYPTO_RAND
3029181834Sroberto
3030280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3031280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3032280849ScyAC_ARG_ENABLE(
3033280849Scy    [autokey],
3034280849Scy    AS_HELP_STRING(
3035280849Scy	[--enable-autokey],
3036280849Scy	[+ support NTP Autokey protocol]
3037280849Scy	),
3038280849Scy    [ntp_autokey=$enableval],
3039280849Scy    [ntp_autokey=$ntp_openssl]
3040280849Scy)
3041280849Scycase "$ntp_autokey" in
3042280849Scy no)
3043181834Sroberto    ;;
3044280849Scy *)
3045280849Scy    case "$ntp_openssl" in
3046181834Sroberto     no)
3047280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3048280849Scy	ntp_autokey=no
3049181834Sroberto	;;
3050280849Scy     *)
3051280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3052280849Scy	ntp_autokey=yes
3053181834Sroberto	;;
3054181834Sroberto    esac
3055181834Sroberto    ;;
3056181834Srobertoesac
3057280849ScyAC_MSG_RESULT([$ntp_autokey])
3058181834Sroberto
3059280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3060200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3061181834Srobertocase "$cross_compiling$PATH_PERL" in
3062181834Sroberto no/*)
3063181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3064181834Sroberto    ans=yes
3065181834Sroberto    ;;
3066181834Sroberto *)
3067181834Sroberto    ans=no
3068181834Sroberto    ;;
3069181834Srobertoesac
3070200576SrobertoAC_MSG_RESULT([$ans])
3071181834Sroberto
3072280849ScyAC_SUBST([TESTDCF])
3073280849ScyAC_SUBST([DCFD])
3074200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3075181834Srobertoans=no
3076280849Scycase "$ntp_parseutil" in
3077280849Scy yes)
3078181834Sroberto    case "$host" in
3079200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3080181834Sroberto	ans="dcfd testdcf"
3081181834Sroberto	DCFD=dcfd
3082280849Scy	TESTDCF=testdcf
3083181834Sroberto    esac
3084280849Scy    ;;
3085280849Scyesac
3086200576SrobertoAC_MSG_RESULT([$ans])
3087181834Sroberto
3088280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3089200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3090181834Srobertoans=no
3091181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3092181834Sroberto yesyes)
3093181834Sroberto    case "$host" in
3094181834Sroberto     sparc-*-sunos4*)
3095280849Scy        case "$ntp_cv_var_kernel_pll" in
3096181834Sroberto	yes)
3097280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3098181834Sroberto	    ;;
3099181834Sroberto	esac
3100181834Sroberto	ans=parsestreams
3101181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3102181834Sroberto	;;
3103181834Sroberto     sparc-*-solaris2*)
3104181834Sroberto	ans=parsesolaris
3105181834Sroberto	MAKE_PARSEKMODULE=parse
3106280849Scy	AC_CHECK_HEADERS([strings.h])
3107181834Sroberto	;;
3108181834Sroberto    esac
3109181834Sroberto    ;;
3110181834Srobertoesac
3111200576SrobertoAC_MSG_RESULT([$ans])
3112181834Sroberto
3113200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3114280849Scycase "$ntp_refclock" in
3115280849Scy yes)
3116280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3117280849Scy    ;;
3118280849Scyesac
3119181834SrobertoAC_MSG_RESULT($ntp_refclock)
3120181834Sroberto
3121280849Scydnl Things that can be made in clockstuff
3122280849ScyAC_SUBST([PROPDELAY], [propdelay])
3123280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3124181834Sroberto
3125280849ScyAC_SUBST([MAKE_ADJTIMED])
3126280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3127181834Srobertocase "$host" in
3128181834Sroberto *-*-hpux[[56789]]*)
3129181834Sroberto    ans=yes
3130181834Sroberto    ;;
3131181834Sroberto *) ans=no
3132181834Sroberto    ;;
3133181834Srobertoesac
3134280849Scycase "$ans" in
3135280849Scy yes)
3136181834Sroberto    MAKE_ADJTIMED=adjtimed
3137280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3138280849Scy	[Do we need HPUX adjtime() library support?])
3139280849Scy    ;;
3140280849Scy *) ADJTIMED_DB=
3141280849Scy    ADJTIMED_DL=
3142280849Scy    ADJTIMED_DS=
3143280849Scy    ADJTIMED_MS=
3144280849Scy    ;;
3145280849Scyesac
3146200576SrobertoAC_MSG_RESULT([$ans])
3147181834Sroberto
3148200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3149181834Srobertocase "$host" in
3150181834Sroberto *-*-qnx*)
3151181834Sroberto    ans=yes
3152181834Sroberto    ;;
3153181834Sroberto *) ans=no
3154181834Sroberto    ;;
3155181834Srobertoesac
3156280849Scycase "$ans" in
3157280849Scy yes)
3158280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3159280849Scy	[Do we need the qnx adjtime call?])
3160280849Scy    ;;
3161280849Scyesac
3162200576SrobertoAC_MSG_RESULT([$ans])
3163181834Sroberto
3164200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3165181834Sroberto
3166200576Sroberto#  the default is to enable it if the system has the capability
3167200576Sroberto
3168200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3169200576Sroberto *yes*)
3170200576Sroberto    ans=yes
3171200576Sroberto    ;;
3172200576Sroberto *) ans=no
3173280849Scy    ;;
3174181834Srobertoesac
3175181834Sroberto
3176200576Srobertocase "$host" in
3177200576Sroberto *-*-domainos)	# Won't be found...
3178200576Sroberto    ans=no
3179200576Sroberto    ;;
3180200576Sroberto *-*-hpux*)
3181200576Sroberto    #ans=no
3182200576Sroberto    ;;
3183200576Sroberto *-*-irix[[456]]*)
3184200576Sroberto    ans=no
3185200576Sroberto    ;;
3186200576Sroberto *-*-*linux*)
3187200576Sroberto    ans=no
3188200576Sroberto    ;;
3189200576Sroberto *-*-winnt3.5)
3190200576Sroberto    ans=no
3191200576Sroberto    ;;
3192200576Sroberto *-*-unicosmp*)
3193200576Sroberto    ans=no
3194200576Sroberto    ;;
3195200576Srobertoesac
3196200576Sroberto
3197200576Sroberto# --enable-kmem / --disable-kmem controls if present
3198200576SrobertoAC_ARG_ENABLE(
3199200576Sroberto    [kmem],
3200280849Scy    [AS_HELP_STRING(
3201200576Sroberto	[--enable-kmem],
3202200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3203280849Scy    )],
3204200576Sroberto    [ans=$enableval]
3205200576Sroberto)
3206200576Sroberto
3207200576SrobertoAC_MSG_RESULT([$ans])
3208200576Sroberto
3209200576Srobertocase "$ans" in
3210200576Sroberto yes)
3211200576Sroberto    can_kmem=yes
3212200576Sroberto    ;;
3213280849Scy *)
3214200576Sroberto    can_kmem=no
3215280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3216200576Srobertoesac
3217200576Sroberto
3218200576Sroberto
3219200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3220200576Sroberto
3221200576Sroberto# target-dependent defaults
3222200576Sroberto
3223200576Srobertocase "$host" in
3224200576Sroberto i386-sequent-ptx*)
3225200576Sroberto    ans=no
3226200576Sroberto    ;;
3227200576Sroberto i386-unknown-osf1*)
3228200576Sroberto    ans=yes
3229200576Sroberto    ;;
3230200576Sroberto mips-sgi-irix[[456]]*)
3231200576Sroberto    ans=yes
3232200576Sroberto    ;;
3233200576Sroberto *-fujitsu-uxp*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236280849Scy *-ibm-aix[[4-9]]*)
3237280849Scy    # XXX only verified thru AIX6.
3238200576Sroberto    ans=yes
3239200576Sroberto    ;;
3240200576Sroberto *-*-*linux*)
3241200576Sroberto    ans=yes
3242200576Sroberto    ;;
3243200576Sroberto *-*-solaris2.[[01]])
3244200576Sroberto    ans=no
3245200576Sroberto    ;;
3246200576Sroberto *-*-solaris2*)
3247200576Sroberto    ans=yes
3248200576Sroberto    ;;
3249200576Sroberto *-*-unicosmp*)
3250200576Sroberto    ans=yes
3251200576Sroberto    ;;
3252200576Sroberto *) ans=no
3253280849Scy    ;;
3254200576Srobertoesac
3255200576Sroberto
3256200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3257200576Sroberto# override the default
3258280849ScyAC_ARG_ENABLE(
3259280849Scy    [accurate-adjtime],
3260280849Scy    [AS_HELP_STRING(
3261280849Scy	[--enable-accurate-adjtime],
3262280849Scy	[s the adjtime() call is accurate]
3263280849Scy    )],
3264280849Scy    [ans=$enableval]
3265200576Sroberto)
3266200576Sroberto
3267200576SrobertoAC_MSG_RESULT([$ans])
3268200576Sroberto
3269200576Srobertocase "$ans" in
3270280849Scy yes)
3271280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3272200576Sroberto    adjtime_is_accurate=yes
3273200576Sroberto    ;;
3274200576Sroberto *)
3275200576Sroberto    adjtime_is_accurate=no
3276280849Scy    ;;
3277181834Srobertoesac
3278181834Sroberto
3279280849ScyAC_CACHE_CHECK(
3280280849Scy    [the name of 'tick' in the kernel],
3281280849Scy    [ntp_cv_nlist_tick],
3282280849Scy    [
3283280849Scy	ans=_tick
3284280849Scy	case "$host" in
3285280849Scy	 m68*-hp-hpux*) # HP9000/300?
3286280849Scy	    ans=_old_tick
3287280849Scy	    ;;
3288280849Scy	 *-apple-aux[[23]]*)
3289280849Scy	    ans=tick
3290280849Scy	    ;;
3291280849Scy	 *-hp-hpux*)
3292280849Scy	    ans=old_tick
3293280849Scy	    ;;
3294280849Scy	 *-ibm-aix[[3-9]]*)
3295280849Scy	    # XXX only verified thru AIX6.
3296280849Scy	    ans=no
3297280849Scy	    ;;
3298280849Scy	 *-*-mpeix*)
3299280849Scy	    ans=no
3300280849Scy	    ;;
3301280849Scy	 *-*-ptx*)
3302280849Scy	    ans=tick
3303280849Scy	    ;;
3304280849Scy	 *-*-sco3.2v[[45]]*)
3305280849Scy	    ans=no
3306280849Scy	    ;;
3307280849Scy	 *-*-solaris2*)
3308280849Scy	    ans=nsec_per_tick
3309280849Scy	    ;;
3310280849Scy	 *-*-sysv4*)
3311280849Scy	    ans=tick
3312280849Scy	    ;;
3313280849Scy	esac
3314280849Scy	ntp_cv_nlist_tick=$ans
3315280849Scy    ]
3316280849Scy)
3317280849Scycase "$ntp_cv_nlist_tick" in
3318280849Scy ''|no)
3319280849Scy    ;;	# HMS: I think we can only get 'no' here...
3320280849Scy *)
3321280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3322280849Scy	[What is the name of TICK in the kernel?])
3323181834Srobertoesac
3324280849Scy
3325280849ScyAC_CACHE_CHECK(
3326280849Scy    [for the units of 'tick'],
3327280849Scy    [ntp_cv_tick_nano],
3328280849Scy    [
3329280849Scy	ans=usec
3330280849Scy	case "$host" in
3331280849Scy	 *-*-solaris2*)
3332280849Scy	    ans=nsec
3333280849Scy	    ;;
3334280849Scy	esac
3335280849Scy	ntp_cv_tick_nano=$ans
3336280849Scy    ]
3337280849Scy)
3338280849Scycase "$ntp_cv_tick_nano" in
3339181834Sroberto nsec)
3340280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3341181834Srobertoesac
3342280849Scy
3343280849ScyAC_CACHE_CHECK(
3344280849Scy    [the name of 'tickadj' in the kernel],
3345280849Scy    [ntp_cv_nlist_tickadj],
3346280849Scy    [
3347280849Scy	ans=_tickadj
3348280849Scy	case "$host" in
3349280849Scy	 m68*-hp-hpux*) # HP9000/300?
3350280849Scy	    ans=_tickadj
3351280849Scy	    ;;
3352280849Scy	 *-apple-aux[[23]]*)
3353280849Scy	    ans=tickadj
3354280849Scy	    ;;
3355280849Scy	 *-hp-hpux10*)
3356280849Scy	    ans=no
3357280849Scy	    ;;
3358280849Scy	 *-hp-hpux9*)
3359280849Scy	    ans=no
3360280849Scy	    ;;
3361280849Scy	 *-hp-hpux*)
3362280849Scy	    ans=tickadj
3363280849Scy	    ;;
3364280849Scy	 *-*-aix*)
3365280849Scy	    ans=tickadj
3366280849Scy	    ;;
3367280849Scy	 *-*-mpeix*)
3368280849Scy	    ans=no
3369280849Scy	    ;;
3370280849Scy	 *-*-ptx*)
3371280849Scy	    ans=tickadj
3372280849Scy	    ;;
3373280849Scy	 *-*-sco3.2v4*)
3374280849Scy	    ans=no
3375280849Scy	    ;;
3376280849Scy	 *-*-sco3.2v5.0*)
3377280849Scy	    ans=clock_drift
3378280849Scy	    ;;
3379280849Scy	 *-*-solaris2*)
3380280849Scy	    ans=no	# hrestime_adj
3381280849Scy	    ;;
3382280849Scy	 *-*-sysv4*)
3383280849Scy	    ans=tickadj
3384280849Scy	    ;;
3385280849Scy	esac
3386280849Scy	ntp_cv_nlist_tickadj=$ans
3387280849Scy    ]
3388280849Scy)
3389280849Scycase "$ntp_cv_nlist_tickadj" in
3390280849Scy ''|no)
3391280849Scy    ;;	# HMS: I think we can only get 'no' here...
3392280849Scy *)
3393280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3394280849Scy	[What is the name of TICKADJ in the kernel?])
3395181834Srobertoesac
3396280849Scy
3397280849ScyAC_CACHE_CHECK(
3398280849Scy    [for the units of 'tickadj'],
3399280849Scy    [ntp_cv_tickadj_nano],
3400280849Scy    [
3401280849Scy	ans=usec
3402280849Scy	case "$host" in
3403280849Scy	 *-*-solaris2*)
3404280849Scy	    ans=nsec
3405280849Scy	    ;;
3406280849Scy	esac
3407280849Scy	ntp_cv_tickadj_nano=$ans
3408280849Scy    ]
3409280849Scy)
3410280849Scycase "$ntp_cv_tickadj_nano" in
3411181834Sroberto nsec)
3412280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3413181834Srobertoesac
3414280849Scy
3415280849ScyAC_CACHE_CHECK(
3416280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3417280849Scy    [ntp_cv_nlist_dosynctodr],
3418280849Scy    [
3419280849Scy	case "$host" in
3420280849Scy	 *-apple-aux[[23]]*)
3421280849Scy	    ans=no
3422280849Scy	    ;;
3423280849Scy	 *-sni-sysv*)
3424280849Scy	    ans=dosynctodr
3425280849Scy	    ;;
3426280849Scy	 *-*-aix*)
3427280849Scy	    ans=dosynctodr
3428280849Scy	    ;;
3429280849Scy	 *-*-hpux*)
3430280849Scy	    ans=no
3431280849Scy	    ;;
3432280849Scy	 *-*-mpeix*)
3433280849Scy	    ans=no
3434280849Scy	    ;;
3435280849Scy	 *-*-nextstep*)
3436280849Scy	    ans=_dosynctodr
3437280849Scy	    ;;
3438280849Scy	 *-*-ptx*)
3439280849Scy	    ans=doresettodr
3440280849Scy	    ;;
3441280849Scy	 *-*-sco3.2v4*)
3442280849Scy	    ans=no
3443280849Scy	    ;;
3444280849Scy	 *-*-sco3.2v5*)
3445280849Scy	    ans=track_rtc
3446280849Scy	    ;;
3447280849Scy	 *-*-solaris2*)
3448280849Scy	    ans=dosynctodr
3449280849Scy	    ;;
3450280849Scy	 *-*-sysv4*)
3451280849Scy	    ans=doresettodr
3452280849Scy	    ;;
3453280849Scy	 *)
3454280849Scy	    ans=_dosynctodr
3455280849Scy	    ;;
3456280849Scy	esac
3457280849Scy	ntp_cv_nlist_dosynctodr=$ans
3458280849Scy    ]
3459280849Scy)
3460280849Scycase "$ntp_cv_nlist_dosynctodr" in
3461280849Scy no)
3462181834Sroberto    ;;
3463181834Sroberto *)
3464280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3465280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3466181834Sroberto    ;;
3467181834Srobertoesac
3468280849Scy
3469280849ScyAC_CACHE_CHECK(
3470280849Scy    [half-heartedly for 'noprintf' in the kernel],
3471280849Scy    [ntp_cv_nlist_noprintf],
3472280849Scy    [
3473280849Scy	case "$host" in
3474280849Scy	 *-apple-aux[[23]]*)
3475280849Scy	    ans=no
3476280849Scy	    ;;
3477280849Scy	 *-sni-sysv*)
3478280849Scy	    ans=noprintf
3479280849Scy	    ;;
3480280849Scy	 *-*-aix*)
3481280849Scy	    ans=noprintf
3482280849Scy	    ;;
3483280849Scy	 *-*-hpux*)
3484280849Scy	    ans=no
3485280849Scy	    ;;
3486280849Scy	 *-*-mpeix*)
3487280849Scy	    ans=no
3488280849Scy	    ;;
3489280849Scy	 *-*-ptx*)
3490280849Scy	    ans=noprintf
3491280849Scy	    ;;
3492280849Scy	 *-*-nextstep*)
3493280849Scy	    ans=_noprintf
3494280849Scy	    ;;
3495280849Scy	 *-*-solaris2*)
3496280849Scy	    ans=noprintf
3497280849Scy	    ;;
3498280849Scy	 *-*-sysv4*)
3499280849Scy	    ans=noprintf
3500280849Scy	    ;;
3501280849Scy	 *)
3502280849Scy	    ans=_noprintf
3503280849Scy	    ;;
3504280849Scy	esac
3505280849Scy	ntp_cv_nlist_noprintf=$ans
3506280849Scy    ]
3507280849Scy)
3508280849Scycase "$ntp_cv_nlist_noprintf" in
3509280849Scy no)
3510181834Sroberto    ;;
3511181834Sroberto *)
3512280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3513280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3514181834Sroberto    ;;
3515181834Srobertoesac
3516181834Sroberto
3517181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3518181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3519181834Sroberto
3520280849Scydnl	tick		tickadj
3521181834Srobertodnl	10000		80	    Unixware
3522181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3523181834Srobertodnl	10000		150	    sgi IRIX
3524181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3525181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3526181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3527181834Srobertodnl	txc.tick	1	    Linux
3528181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3529181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3530181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3531181834Sroberto
3532181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3533181834Sroberto
3534200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3535200576Sroberto
3536200576Sroberto# target-dependent default for tick
3537200576Sroberto
3538200576Srobertocase "$host" in
3539200576Sroberto *-*-pc-cygwin*)
3540200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3541200576Sroberto    ;;
3542200576Sroberto *-univel-sysv*)
3543200576Sroberto    ans=10000
3544200576Sroberto    ;;
3545200576Sroberto *-*-irix*)
3546200576Sroberto    ans=10000
3547200576Sroberto    ;;
3548200576Sroberto *-*-*linux*)
3549200576Sroberto    ans=txc.tick
3550200576Sroberto    ;;
3551200576Sroberto *-*-mpeix*)
3552200576Sroberto    ans=no
3553200576Sroberto    ;;
3554200576Sroberto *-*-winnt3.5)
3555200576Sroberto    ans='(every / 10)'
3556200576Sroberto    ;;
3557200576Sroberto *-*-unicosmp*)
3558200576Sroberto    ans=10000
3559200576Sroberto    ;;
3560200576Sroberto *)
3561200576Sroberto    ans='1000000L/hz'
3562200576Sroberto    ;;
3563200576Srobertoesac
3564200576Sroberto
3565200576SrobertoAC_ARG_ENABLE(
3566200576Sroberto    [tick],
3567280849Scy    [AS_HELP_STRING(
3568200576Sroberto	[--enable-tick=VALUE],
3569200576Sroberto	[s force a value for 'tick']
3570280849Scy    )],
3571200576Sroberto    [ans=$enableval]
3572200576Sroberto)
3573200576Sroberto
3574200576SrobertoAC_MSG_RESULT([$ans])
3575200576Sroberto
3576200576Srobertocase "$ans" in
3577280849Scy ''|no)
3578280849Scy    ;;	# HMS: I think we can only get 'no' here...
3579280849Scy *)
3580280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3581280849Scy	[Preset a value for 'tick'?])
3582181834Srobertoesac
3583181834Sroberto
3584200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3585200576Sroberto
3586200576Sroberto# target-specific default
3587200576Srobertoans='500/hz'
3588200576Srobertocase "$host" in
3589200576Sroberto *-fujitsu-uxp*)
3590200576Sroberto    case "$adjtime_is_accurate" in
3591200576Sroberto     yes)
3592280849Scy	ans='tick/16'
3593200576Sroberto    esac
3594200576Sroberto    ;;
3595200576Sroberto *-univel-sysv*)
3596200576Sroberto    ans=80
3597200576Sroberto    ;;
3598200576Sroberto *-*-aix*)
3599200576Sroberto    case "$can_kmem" in
3600200576Sroberto     no)
3601200576Sroberto	ans=1000
3602280849Scy	;;
3603200576Sroberto    esac
3604200576Sroberto    ;;
3605200576Sroberto *-*-domainos)	# Skippy: won't be found...
3606200576Sroberto    case "$can_kmem" in
3607200576Sroberto     no)
3608200576Sroberto	ans=668
3609280849Scy	;;
3610200576Sroberto    esac
3611200576Sroberto    ;;
3612200576Sroberto *-*-hpux*)
3613200576Sroberto    case "$adjtime_is_accurate" in
3614200576Sroberto     yes)
3615200576Sroberto	ans='tick/16'
3616280849Scy	;;
3617200576Sroberto    esac
3618200576Sroberto    ;;
3619200576Sroberto *-*-irix*)
3620200576Sroberto    ans=150
3621200576Sroberto    ;;
3622200576Sroberto *-*-mpeix*)
3623200576Sroberto    ans=no
3624200576Sroberto    ;;
3625200576Sroberto *-*-sco3.2v5.0*)
3626200576Sroberto    ans=10000L/hz
3627200576Sroberto    ;;
3628200576Sroberto *-*-winnt3.5)
3629200576Sroberto    ans=50
3630200576Sroberto    ;;
3631200576Sroberto *-*-unicosmp*)
3632200576Sroberto    ans=150
3633280849Scy    ;;
3634200576Srobertoesac
3635200576Sroberto
3636200576SrobertoAC_ARG_ENABLE(
3637200576Sroberto    [tickadj],
3638280849Scy    [AS_HELP_STRING(
3639280849Scy	[--enable-tickadj=VALUE],
3640280849Scy	[s force a value for 'tickadj']
3641280849Scy    )],
3642200576Sroberto    [ans=$enableval]
3643200576Sroberto)
3644200576Sroberto
3645200576SrobertoAC_MSG_RESULT([$ans])
3646200576Sroberto
3647200576Srobertodefault_tickadj=$ans
3648200576Sroberto
3649200576Srobertocase "$default_tickadj" in
3650280849Scy ''|no)
3651280849Scy    ;;	# HMS: I think we can only get 'no' here...
3652280849Scy *)
3653280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3654280849Scy	[Preset a value for 'tickadj'?]) ;;
3655181834Srobertoesac
3656181834Sroberto
3657181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3658181834Sroberto# 1/100s (system tick). Sigh ...
3659181834Sroberto# Unfortunately, there is no easy way to know if particular release
3660181834Sroberto# has this "feature" or any obvious way to test for it.
3661181834Srobertocase "$host" in
3662280849Scy mips-sni-sysv4*)
3663280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3664280849Scy	[Do we want the ReliantUNIX clock hacks?])
3665181834Srobertoesac
3666181834Sroberto
3667181834Srobertocase "$host" in
3668280849Scy *-*-sco3.2v5*)
3669280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3670181834Srobertoesac
3671181834Sroberto
3672280849Scyntp_cv_make_tickadj=yes
3673200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3674181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3675200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3676280849Scy    ntp_cv_make_tickadj=no
3677181834Sroberto    ;;
3678181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3679200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3680280849Scy    ntp_cv_make_tickadj=no
3681181834Sroberto    ;;
3682181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3683200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3684280849Scy    ntp_cv_make_tickadj=no
3685181834Sroberto    ;;
3686181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3687181834Sroberto    ;;
3688181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3689181834Sroberto    ;;
3690181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3691200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3692181834Sroberto    ;;
3693181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3694181834Sroberto    ;;
3695181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3696181834Sroberto    ;;
3697181834Sroberto *)		# Generally bogus.
3698200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3699181834Sroberto    ;;
3700181834Srobertoesac
3701181834Sroberto
3702181834SrobertoAC_SUBST(MAKE_NTPTIME)
3703200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3704181834Sroberto[case "$host" in
3705280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3706181834Sroberto     yesyes)
3707181834Sroberto	ans=yes
3708181834Sroberto	;;
3709181834Sroberto     *)
3710181834Sroberto	ans=no
3711181834Sroberto	;;
3712181834Sroberto    esac
3713181834Sroberto    ;;
3714181834Srobertoesac
3715181834Srobertoac_cv_make_ntptime=$ans])
3716181834Srobertocase "$ac_cv_make_ntptime" in
3717181834Sroberto yes)
3718181834Sroberto    MAKE_NTPTIME=ntptime
3719181834Sroberto    ;;
3720280849Scy *)
3721280849Scy    NTPTIME_DB=
3722280849Scy    NTPTIME_DL=
3723280849Scy    NTPTIME_DS=
3724280849Scy    NTPTIME_MS=
3725280849Scy    ;;
3726181834Srobertoesac
3727181834Sroberto
3728280849ScyAC_SUBST([MAKE_TICKADJ])
3729181834Srobertocase "$host" in
3730181834Sroberto mips-sni-sysv4*)
3731181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3732181834Sroberto    # Do not bother
3733280849Scy    ntp_cv_make_tickadj=no
3734181834Sroberto    ;;
3735181834Sroberto *-*-irix*)
3736280849Scy    ntp_cv_make_tickadj=no
3737181834Sroberto    ;;
3738181834Sroberto *-*-solaris2*)
3739181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3740181834Sroberto    case "$host" in
3741181834Sroberto     *-*-solaris2.1[[0-9]]*)
3742280849Scy	ntp_cv_make_tickadj=no
3743181834Sroberto	;;
3744181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3745280849Scy     *) ntp_cv_make_tickadj=no ;;
3746181834Sroberto    esac
3747181834Sroberto    ;;
3748181834Sroberto *-*-unicosmp*)
3749280849Scy    ntp_cv_make_tickadj=no
3750181834Sroberto    ;;
3751181834Srobertoesac
3752200576Sroberto
3753200576Sroberto#
3754200576Sroberto# Despite all the above, we always make tickadj.  Setting
3755280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3756200576Sroberto# report that the configuration variable was cached.  It may
3757200576Sroberto# be better to simply remove the hunk above, I did not want
3758200576Sroberto# to remove it if there is hope it will be used again.
3759200576Sroberto#
3760280849ScyAS_UNSET([ntp_cv_make_tickadj])
3761200576Sroberto
3762280849ScyAC_CACHE_CHECK(
3763280849Scy    [if we want and can make the tickadj utility],
3764280849Scy    [ntp_cv_make_tickadj],
3765280849Scy    [ntp_cv_make_tickadj=yes]
3766280849Scy)
3767280849Scycase "$ntp_cv_make_tickadj" in
3768181834Sroberto yes)
3769181834Sroberto    MAKE_TICKADJ=tickadj
3770181834Sroberto    ;;
3771280849Scy *)
3772280849Scy    CALC_TICKADJ_DB=
3773280849Scy    CALC_TICKADJ_DL=
3774280849Scy    CALC_TICKADJ_DS=
3775280849Scy    CALC_TICKADJ_MS=
3776280849Scy    TICKADJ_DB=
3777280849Scy    TICKADJ_DL=
3778280849Scy    TICKADJ_DS=
3779280849Scy    TICKADJ_MS=
3780280849Scy    ;;
3781181834Srobertoesac
3782181834Sroberto
3783280849ScyAC_SUBST([MAKE_TIMETRIM])
3784280849ScyAC_CACHE_CHECK(
3785280849Scy    [if we want and can make the timetrim utility],
3786280849Scy    [ntp_cv_make_timetrim],
3787280849Scy    [
3788280849Scy	case "$host" in
3789280849Scy	 *-*-irix*)
3790280849Scy	    ntp_cv_make_timetrim=yes
3791280849Scy	    ;;
3792280849Scy	 *-*-unicosmp*)
3793280849Scy	    ntp_cv_make_timetrim=yes
3794280849Scy	    ;;
3795280849Scy	 *)
3796280849Scy	    ntp_cv_make_timetrim=no
3797280849Scy	    ;;
3798280849Scy	esac
3799280849Scy    ]
3800280849Scy)
3801280849Scycase "$ntp_cv_make_timetrim" in
3802181834Sroberto yes)
3803181834Sroberto    MAKE_TIMETRIM=timetrim
3804181834Sroberto    ;;
3805280849Scy *) TIMETRIM_DB=
3806280849Scy    TIMETRIM_DL=
3807280849Scy    TIMETRIM_DS=
3808280849Scy    TIMETRIM_MS=
3809280849Scy    ;;
3810181834Srobertoesac
3811181834Sroberto
3812280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3813280849ScyAC_SUBST([MAKE_NTPDSIM])
3814200576Sroberto
3815200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3816200576SrobertoAC_ARG_ENABLE(
3817200576Sroberto    [simulator],
3818280849Scy    [AS_HELP_STRING(
3819200576Sroberto	[--enable-simulator],
3820200576Sroberto	[- build/install the NTPD simulator?]
3821280849Scy    )],
3822280849Scy    [ans=$enableval],
3823200576Sroberto    [ans=no]
3824200576Sroberto)
3825200576SrobertoAC_MSG_RESULT([$ans])
3826200576Srobertocase "$ans" in
3827181834Sroberto yes)
3828181834Sroberto    MAKE_NTPDSIM=ntpdsim
3829181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3830181834Sroberto    ;;
3831280849Scy *)
3832280849Scy    NTPDSIM_DB=
3833280849Scy    NTPDSIM_DL=
3834280849Scy    NTPDSIM_DS=
3835280849Scy    NTPDSIM_MS=
3836280849Scy    ;;
3837181834Srobertoesac
3838181834Sroberto
3839181834Srobertocase "$build" in
3840181834Sroberto $host)
3841181834Sroberto    ;;
3842181834Sroberto *) case "$host" in
3843181834Sroberto     *-*-vxworks*)
3844200576Sroberto	LDFLAGS="$LDFLAGS -r"
3845200576Sroberto	;;
3846181834Sroberto    esac
3847181834Sroberto    ;;
3848181834Srobertoesac
3849181834Sroberto
3850280849ScyNTP_WITHSNTP
3851200576Sroberto
3852280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3853280849ScyAC_ARG_WITH(
3854280849Scy    [ntpsnmpd],
3855280849Scy    [AS_HELP_STRING(
3856280849Scy	[--with-ntpsnmpd],
3857280849Scy	[s Build ntpsnmpd MIB agent?]
3858280849Scy    )],
3859280849Scy    [ans=$withval],
3860280849Scy    [
3861280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3862280849Scy	 /*)	ans=yes ;;
3863280849Scy	 *)	ans=no  ;;
3864280849Scy	esac
3865280849Scy    ]
3866280849Scy)
3867280849ScyAC_MSG_RESULT([$ans])
3868280849Scycase "$ans" in
3869280849Scy yes)
3870280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3871280849Scy     /*)
3872280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3873280849Scy	AC_SUBST([SNMP_LIBS])
3874280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3875280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3876280849Scy	SNMP_CPPFLAGS=
3877280849Scy	SNMP_CFLAGS=
3878280849Scy	for i in $foo; do
3879280849Scy	    case "$i" in
3880280849Scy	     -D*|-U*|-I*)
3881280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3882280849Scy		;;
3883280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3884280849Scy		;;
3885280849Scy	    esac
3886280849Scy	done
3887280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3888280849Scy	AC_SUBST([SNMP_CFLAGS])
3889280849Scy
3890280849Scy	save_CFLAGS=$CFLAGS
3891280849Scy	save_CPPFLAGS=$CPPFLAGS
3892280849Scy	save_LIBS=$LIBS
3893280849Scy	CFLAGS=$SNMP_CFLAGS
3894280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3895280849Scy
3896280849Scy	AC_CHECK_HEADER(
3897280849Scy	    [net-snmp/net-snmp-config.h],
3898280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3899280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3900280849Scy	)
3901280849Scy
3902280849Scy	# Do this last, as we're messing up LIBS.
3903280849Scy	# check -lnetsnmp for netsnmp_daemonize
3904280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3905280849Scy	AC_CHECK_LIB(
3906280849Scy	    [netsnmp],
3907280849Scy	    [netsnmp_daemonize],
3908280849Scy	    [ans=yes],
3909280849Scy	    [ans=no]
3910280849Scy	)
3911280849Scy	case "$ans" in
3912280849Scy	 no)
3913280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3914280849Scy		[We need to provide netsnmp_daemonize()])
3915280849Scy	esac
3916280849Scy	
3917280849Scy	CFLAGS=$save_CFLAGS
3918280849Scy	AS_UNSET([save_CFLAGS])
3919280849Scy	CPPFLAGS=$save_CPPFLAGS
3920280849Scy	AS_UNSET([save_CPPFLAGS])
3921280849Scy	LIBS=$save_LIBS
3922280849Scy	AS_UNSET([save_LIBS])
3923280849Scy	;;
3924280849Scy     *) 
3925280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3926280849Scy	;;
3927280849Scy    esac
3928280849Scy    ;;
3929280849Scyesac
3930280849ScyAC_SUBST([MAKE_NTPSNMPD])
3931280849Scy
3932280849Scycase "$MAKE_NTPSNMPD" in
3933280849Scy '')
3934280849Scy    NTPSNMPD_DB=
3935280849Scy    NTPSNMPD_DL=
3936280849Scy    NTPSNMPD_DS=
3937280849Scy    NTPSNMPD_MS=
3938280849Scy    ;;
3939280849Scyesac
3940280849Scy
3941200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3942200576Sroberto
3943200576Sroberto# target-specific defaults
3944200576Sroberto
3945200576Srobertocase "$host" in
3946200576Sroberto *-apple-aux[[23]]*)
3947200576Sroberto    ans=yes
3948200576Sroberto    ;;
3949200576Sroberto *-*-bsdi[[012]]*)
3950200576Sroberto    ans=no
3951200576Sroberto    ;;
3952200576Sroberto *-*-bsdi*)
3953200576Sroberto    ans=yes
3954200576Sroberto    ;;
3955200576Sroberto *-*-openvms*)	# HMS: won't be found
3956200576Sroberto    ans=yes
3957200576Sroberto    ;;
3958200576Sroberto *) ans=no
3959200576Sroberto    ;;
3960200576Srobertoesac
3961200576Sroberto
3962200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3963200576Sroberto
3964200576SrobertoAC_ARG_ENABLE(
3965200576Sroberto    [slew-always],
3966280849Scy    [AS_HELP_STRING(
3967200576Sroberto	[--enable-slew-always],
3968200576Sroberto	[s always slew the time]
3969280849Scy    )],
3970200576Sroberto    [ans=$enableval]
3971200576Sroberto)
3972200576Sroberto
3973200576SrobertoAC_MSG_RESULT([$ans])
3974200576Sroberto
3975200576Srobertocase "$ans" in
3976280849Scy yes)
3977280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3978181834Srobertoesac
3979181834Sroberto
3980200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3981200576Sroberto
3982200576Srobertocase "$host" in
3983200576Sroberto *-sni-sysv*)
3984200576Sroberto    ans=yes
3985200576Sroberto    ;;
3986200576Sroberto *-univel-sysv*)
3987200576Sroberto    ans=no
3988200576Sroberto    ;;
3989200576Sroberto *-*-ptx*)
3990200576Sroberto    ans=yes
3991200576Sroberto    ;;
3992200576Sroberto *-*-solaris2.1[[0-9]]*)
3993200576Sroberto    ans=no
3994200576Sroberto    ;;
3995200576Sroberto *-*-solaris2.[[012]]*)
3996200576Sroberto    ans=yes
3997200576Sroberto    ;;
3998200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
3999200576Sroberto    ans=yes
4000200576Sroberto    ;;
4001200576Sroberto *) ans=no
4002200576Sroberto    ;;
4003200576Srobertoesac
4004200576Sroberto
4005200576SrobertoAC_ARG_ENABLE(
4006200576Sroberto    [step-slew],
4007280849Scy    [AS_HELP_STRING(
4008200576Sroberto	[--enable-step-slew],
4009200576Sroberto	[s step and slew the time]
4010280849Scy    )],
4011200576Sroberto    [ans=$enableval]
4012200576Sroberto)
4013200576Sroberto
4014200576SrobertoAC_MSG_RESULT([$ans])
4015200576Sroberto
4016200576Srobertocase "$ans" in
4017280849Scy yes)
4018280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4019181834Srobertoesac
4020181834Sroberto
4021200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4022200576Sroberto
4023200576Srobertocase "$host" in
4024200576Sroberto *-apple-aux[[23]]*)
4025200576Sroberto    ans=yes
4026200576Sroberto    ;;
4027200576Sroberto *) ans=no
4028280849Scy    ;;
4029200576Srobertoesac
4030200576Sroberto
4031200576SrobertoAC_ARG_ENABLE(
4032200576Sroberto    [ntpdate-step],
4033280849Scy    [AS_HELP_STRING(
4034200576Sroberto	[--enable-ntpdate-step],
4035200576Sroberto	[s if ntpdate should step the time]
4036280849Scy    )],
4037200576Sroberto    [ans=$enableval]
4038200576Sroberto)
4039200576Sroberto
4040200576SrobertoAC_MSG_RESULT([$ans])
4041200576Sroberto
4042200576Srobertocase "$ans" in
4043280849Scy yes)
4044280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4045280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4046181834Srobertoesac
4047181834Sroberto
4048200576Sroberto
4049200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4050200576Sroberto
4051200576Srobertocase "$host" in
4052200576Sroberto *-*-nextstep*)
4053200576Sroberto    ans=yes
4054200576Sroberto    ;;
4055200576Sroberto *-*-openvms*)	# HMS: won't be found
4056200576Sroberto    ans=yes
4057200576Sroberto    ;;
4058200576Sroberto *)
4059200576Sroberto    ans=no
4060280849Scy    ;;
4061200576Srobertoesac
4062200576Sroberto
4063200576SrobertoAC_ARG_ENABLE(
4064200576Sroberto    [hourly-todr-sync],
4065280849Scy    [AS_HELP_STRING(
4066200576Sroberto	[--enable-hourly-todr-sync],
4067200576Sroberto	[s if we should sync TODR hourly]
4068280849Scy    )],
4069200576Sroberto    [ans=$enableval]
4070200576Sroberto)
4071200576Sroberto
4072200576SrobertoAC_MSG_RESULT([$ans])
4073200576Sroberto
4074181834Srobertocase "$ac_cv_var_sync_todr" in
4075280849Scy yes)
4076280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4077181834Srobertoesac
4078181834Sroberto
4079181834Sroberto
4080200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4081200576Sroberto
4082200576Srobertocase "$host" in
4083200576Sroberto *-*-solaris2.6)
4084200576Sroberto    unamev=`uname -v`
4085200576Sroberto    case "$unamev" in
4086200576Sroberto     Generic_105181-*)
4087200576Sroberto	old_IFS="$IFS"
4088200576Sroberto	IFS="-"
4089200576Sroberto	set $unamev
4090200576Sroberto	IFS="$old_IFS"
4091200576Sroberto	if test "$2" -ge 17
4092200576Sroberto	then
4093200576Sroberto	    # Generic_105181-17 and higher
4094200576Sroberto	    ans=no
4095200576Sroberto	else
4096200576Sroberto	    ans=yes
4097200576Sroberto	fi
4098200576Sroberto	;;
4099280849Scy     *)
4100181834Sroberto	ans=yes
4101280849Scy	;;
4102200576Sroberto    esac
4103200576Sroberto    ;;
4104200576Sroberto *-*-solaris2.7)
4105200576Sroberto    unamev=`uname -v`
4106200576Sroberto    case "$unamev" in
4107200576Sroberto     Generic_106541-*)
4108200576Sroberto	old_IFS="$IFS"
4109200576Sroberto	IFS="-"
4110200576Sroberto	set $unamev
4111200576Sroberto	IFS="$old_IFS"
4112200576Sroberto	if test "$2" -ge 07
4113200576Sroberto	then
4114200576Sroberto	    # Generic_106541-07 and higher
4115200576Sroberto	    ans=no
4116200576Sroberto	else
4117200576Sroberto	    ans=yes
4118200576Sroberto	fi
4119181834Sroberto	;;
4120200576Sroberto     *)
4121181834Sroberto	ans=yes
4122280849Scy	;;
4123181834Sroberto    esac
4124200576Sroberto    ;;
4125200576Sroberto *)
4126200576Sroberto    ans=no
4127280849Scy    ;;
4128200576Srobertoesac
4129200576Sroberto
4130200576SrobertoAC_ARG_ENABLE(
4131200576Sroberto    [kernel-fll-bug],
4132280849Scy    [AS_HELP_STRING(
4133200576Sroberto	[--enable-kernel-fll-bug],
4134200576Sroberto	[s if we should avoid a kernel FLL bug]
4135280849Scy    )],
4136200576Sroberto    [ans=$enableval]
4137200576Sroberto)
4138200576Sroberto
4139200576SrobertoAC_MSG_RESULT([$ans])
4140200576Sroberto
4141200576Srobertocase "$ans" in
4142280849Scy yes)
4143280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4144200576Srobertoesac
4145200576Sroberto
4146200576Sroberto
4147280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4148280849ScyAC_ARG_ENABLE(
4149280849Scy    [bug1243-fix],
4150280849Scy    [AS_HELP_STRING(
4151280849Scy	[--enable-bug1243-fix],
4152280849Scy	[+ use unmodified autokey session keys]
4153280849Scy    )],
4154280849Scy    [ans=$enableval],
4155280849Scy    [ans=yes]
4156280849Scy)
4157280849ScyAC_MSG_RESULT([$ans])
4158280849Scycase "$ans" in
4159280849Scy no)
4160280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4161280849Scy	[use old autokey session key behavior?])
4162280849Scyesac
4163280849Scy
4164280849Scy
4165200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4166200576Sroberto
4167200576Srobertocase "$host" in
4168200576Sroberto *-*-solaris2.[[89]])
4169200576Sroberto    ans=yes
4170200576Sroberto    ;;
4171200576Sroberto *-*-solaris2.1[[0-9]]*)
4172200576Sroberto    ans=yes
4173200576Sroberto    ;;
4174200576Sroberto *) ans=no
4175280849Scy    ;;
4176200576Srobertoesac
4177200576Sroberto
4178200576SrobertoAC_ARG_ENABLE(
4179280849Scy    [irig-sawtooth],
4180280849Scy    [AS_HELP_STRING(
4181200576Sroberto	[--enable-irig-sawtooth],
4182200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4183280849Scy    )],
4184200576Sroberto    [ans=$enableval]
4185200576Sroberto)
4186200576Sroberto
4187200576SrobertoAC_MSG_RESULT([$ans])
4188200576Sroberto
4189200576Srobertocase "$ans" in
4190280849Scy yes)
4191280849Scy    AC_DEFINE([IRIG_SUCKS], [1],
4192280849Scy	[Should we use the IRIG sawtooth filter?])
4193181834Srobertoesac
4194181834Sroberto
4195200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4196200576Sroberto
4197200576SrobertoAC_ARG_ENABLE(
4198280849Scy	[nist],
4199280849Scy	[AS_HELP_STRING(
4200200576Sroberto	    [--enable-nist],
4201200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4202280849Scy	)],
4203200576Sroberto	[ans=$enableval],
4204200576Sroberto	[ans=no]
4205200576Sroberto)
4206200576Sroberto
4207200576SrobertoAC_MSG_RESULT([$ans])
4208200576Sroberto
4209200576Srobertocase "$ans" in
4210280849Scy yes)
4211280849Scy    AC_DEFINE([LOCKCLOCK], [1],
4212280849Scy	[Should we align with the NIST lockclock scheme?]) ;;
4213181834Srobertoesac
4214181834Sroberto
4215200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4216200576Sroberto
4217200576SrobertoAC_ARG_ENABLE(
4218200576Sroberto    [ntp-signd],
4219280849Scy    [AS_HELP_STRING(
4220280849Scy	[--enable-ntp-signd],
4221280849Scy	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4222280849Scy    )],
4223200576Sroberto    [ans=$enableval],
4224200576Sroberto    [ans=no]
4225200576Sroberto)
4226200576Sroberto
4227200576SrobertoAC_MSG_RESULT([$ans])
4228200576Sroberto
4229200576Srobertocase "$ans" in
4230200576Sroberto no)
4231200576Sroberto    ntp_signd_path=
4232200576Sroberto    ;;
4233200576Sroberto yes)
4234200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4235200576Sroberto    ;;
4236200576Sroberto *)
4237200576Sroberto    ntp_signd_path="$ans"
4238200576Srobertoesac
4239200576Sroberto
4240200576Srobertocase "$ntp_signd_path" in
4241200576Sroberto '')
4242200576Sroberto    ;;
4243200576Sroberto *)
4244280849Scy    AC_DEFINE([HAVE_NTP_SIGND], [1],
4245280849Scy	[Do we want support for Samba's signing daemon?])
4246280849Scy    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4247280849Scy	[Path to sign daemon rendezvous socket])
4248200576Sroberto    ;;
4249200576Srobertoesac
4250200576Sroberto
4251200576SrobertoAC_CHECK_HEADERS([libscf.h])
4252280849ScyLSCF=
4253200576Srobertocase "$ac_cv_header_libscf_h" in
4254200576Sroberto yes)
4255280849Scy    LSCF='-lscf'
4256200576Srobertoesac
4257280849ScyAC_SUBST([LSCF])
4258200576Sroberto
4259280849ScyNTP_IPV6
4260200576Sroberto
4261200576Sroberto
4262181834Sroberto#
4263181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4264181834Sroberto#
4265200576SrobertoAC_CACHE_CHECK(
4266200576Sroberto    [for interface list sysctl],
4267280849Scy    [ntp_cv_iflist_sysctl],
4268280849Scy    [AC_PREPROC_IFELSE(
4269200576Sroberto	[
4270200576Sroberto	    #include <sys/param.h>
4271200576Sroberto	    #include <sys/sysctl.h>
4272200576Sroberto	    #include <sys/socket.h>
4273280849Scy	    #ifndef NET_RT_IFLIST
4274280849Scy	    # error
4275200576Sroberto	    #endif
4276200576Sroberto	],
4277280849Scy	[ntp_cv_iflist_sysctl=yes],
4278280849Scy	[ntp_cv_iflist_sysctl=no]
4279280849Scy    )]
4280200576Sroberto)
4281280849Scycase "$ntp_cv_iflist_sysctl" in
4282280849Scy yes)
4283280849Scy    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4284280849Scyesac
4285181834Sroberto
4286280849Scy###
4287280849Scy
4288280849ScyAC_MSG_CHECKING([if we want the saveconfig mechanism])
4289280849ScyAC_ARG_ENABLE(
4290280849Scy    [saveconfig],
4291280849Scy    [AS_HELP_STRING(
4292280849Scy	[--enable-saveconfig],
4293280849Scy	[+ saveconfig mechanism]
4294280849Scy    )],
4295280849Scy    [ntp_ok=$enableval],
4296280849Scy    [ntp_ok=yes]
4297280849Scy)
4298280849Scyntp_saveconfig_enabled=0
4299280849Scycase "$ntp_ok" in
4300200576Sroberto yes)
4301280849Scy    ntp_saveconfig_enabled=1
4302280849Scy    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4303280849Scy    ;;
4304200576Srobertoesac
4305280849ScyAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4306280849ScyAC_MSG_RESULT([$ntp_ok])
4307200576Sroberto
4308280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4309280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4310280849Scydnl  can't be conditionalized.
4311280849ScyNTP_GOOGLETEST
4312200576Sroberto
4313181834Sroberto###
4314181834Sroberto
4315280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4316280849Scy    [Default location of crypto key info])
4317181834Sroberto
4318280849ScyAC_CONFIG_FILES([Makefile])
4319280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4320280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4321280849ScyAC_CONFIG_FILES([include/Makefile])
4322280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4323280849ScyAC_CONFIG_FILES([kernel/Makefile])
4324280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4325280849ScyAC_CONFIG_FILES([libntp/Makefile])
4326280849ScyAC_CONFIG_FILES([libparse/Makefile])
4327280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4328280849ScyAC_CONFIG_FILES([ntpd/complete.conf],	[sed -e '/^rlimit$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf])
4329280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4330280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4331280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4332280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4333280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4334280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4335280849ScyAC_CONFIG_FILES([scripts/Makefile])
4336280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4337280849ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4338280849ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4339280849ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4340280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4341280849ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4342280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4343280849ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4344280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4345280849ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4346280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4347280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4348280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4349280849ScyAC_CONFIG_FILES([scripts/build/Makefile])
4350280849ScyAC_CONFIG_FILES([tests/Makefile])
4351280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4352280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4353280849ScyAC_CONFIG_FILES([util/Makefile])
4354181834Sroberto
4355280849Scyperllibdir="${datadir}/ntp/lib"
4356280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4357181834Sroberto
4358280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4359280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4360280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4361280849ScyAC_SUBST_FILE([ntp_wait_opts])
4362280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4363280849ScyAC_SUBST_FILE([ntpsweep_opts])
4364280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4365280849ScyAC_SUBST_FILE([ntptrace_opts])
4366280849Scysummary_opts="$srcdir/scripts/summary-opts"
4367280849ScyAC_SUBST_FILE([summary_opts])
4368280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4369280849ScyAC_SUBST_FILE([plot_summary_opts])
4370280849Scy
4371280849ScyAC_CONFIG_SUBDIRS([sntp])
4372280849Scy
4373181834SrobertoAC_OUTPUT
4374