configure.ac revision 298695
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])
14289764SglebiusAC_LANG([C])
15280849Scy
16280849ScyAC_PRESERVE_HELP_ORDER
17280849Scy
18280849Scy# Bump ntp_configure_cache_version for each change to configure.ac or
19280849Scy# .m4 files which invalidates cached values from previous configure 
20280849Scy# runs.
21280849Scy#
22280849Scy# If the change affects cache variables used only by the main NTP
23280849Scy# configure.ac, then only its version number should be bumped, while
24280849Scy# the subdir configure.ac version numbers should be unchanged.  The
25280849Scy# same is true for a test/variable that is used only by one subdir
26280849Scy# being changed incompatibly; only that subdir's cache version needs
27280849Scy# bumping.
28280849Scy#
29280849Scy# If a change affects variables shared by all NTP configure scripts,
30280849Scy# please bump the version numbers of each.  If you are not sure, the
31280849Scy# safe choice is to bump all on any cache-invalidating change.
32280849Scy#
33280849Scy# In order to avoid the risk of version stamp collision between -stable
34280849Scy# and -dev branches, do not simply increment the version, instead use
35280849Scy# the date YYYYMMDD optionally with -HHMM if there is more than one
36280849Scy# bump in a day.
37280849Scy
38280849Scyntp_configure_cache_version=20120806
39280849Scy
40280849Scy# When the cache version of config.cache and configure do not
41280849Scy# match, NTP_CACHEVERSION will flush the cache.
42280849Scy
43280849ScyNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44280849Scy
45280849ScyAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
46280849Scy
47280849Scydnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48280849Scym4_ifdef(
49280849Scy    [AM_SILENT_RULES],
50280849Scy    [AM_SILENT_RULES([yes])]
51280849Scy)
52280849ScyAC_CANONICAL_BUILD
53181834SrobertoAC_CANONICAL_HOST
54181834Srobertodnl the 'build' machine is where we run configure and compile
55181834Srobertodnl the 'host' machine is where the resulting stuff runs.
56280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57280849Scy    [canonical system (cpu-vendor-os) of where we should run])
58280849ScyAC_CONFIG_HEADERS([config.h])
59181834Srobertodnl AC_ARG_PROGRAM
60181834Sroberto
61280849Scyntp_atom_ok=${ntp_atom_ok=no}
62280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
63280849Scyntp_parse_ok=${ntp_parse_ok=no}
64280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
65280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
66181834Sroberto
67280849ScyNTP_PROG_CC
68280849ScyAC_PROG_CPP
69285169Scy# Do we need CXX for anything besides google test?
70280849ScyAC_PROG_CXX
71280849ScyAC_PROG_YACC
72280849ScyAC_PROG_CC_C_O
73282408ScyAX_C99_STRUCT_INIT
74181834Sroberto
75280849ScyNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
76181834Sroberto
77280849ScyNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
78280849Scy
79280849Scydnl AM_PROG_AR req. automake 1.12
80280849Scym4_ifdef(
81280849Scy    [AM_PROG_AR],
82280849Scy    [AM_PROG_AR]
83280849Scy)
84280849Scy
85200576Sroberto# So far, the only shared library we might use is libopts.
86200576Sroberto# It's a small library - we might as well use a static version of it.
87200576SrobertoAC_DISABLE_SHARED
88280849ScyAC_PROG_LIBTOOL
89280849ScyAC_SUBST([LIBTOOL_DEPS])
90200576Sroberto
91280849Scy# NTP has (so far) been relying on leading-edge autogen, which
92280849Scy# means we need the appropriate corresponding libopts as well.
93181834Sroberto# Therefore, by default:
94280849Scy# - use the version of libopts we ship with
95181834Sroberto# - do not install it
96181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
97181834Srobertocase "${enable_local_libopts+set}" in
98181834Sroberto set) ;;
99181834Sroberto *) enable_local_libopts=yes ;;
100181834Srobertoesac
101181834Srobertocase "${enable_libopts_install+set}" in
102181834Sroberto set) ;;
103181834Sroberto *) enable_libopts_install=no ;;
104181834Srobertoesac
105280849Scyenable_nls=no
106280849ScyLIBOPTS_CHECK_NOBUILD([sntp/libopts])
107181834Sroberto
108280849ScyNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
109181834Sroberto
110280849ScyNTP_LIBNTP
111181834Sroberto
112280849ScyAC_MSG_CHECKING([for deprecated --with-arlib])
113280849ScyAC_ARG_WITH([arlib],
114280849Scy	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
115181834Sroberto	[ans=$withval], [ans=no])
116200576SrobertoAC_MSG_RESULT([$ans])
117181834Sroberto
118181834Srobertocase "$ans" in
119181834Sroberto yes)
120280849Scy    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
121181834Sroberto    ;;
122181834Srobertoesac
123181834Sroberto
124181834Srobertodnl  we need to check for cross compile tools for vxWorks here
125181834SrobertoAC_PROG_AWK
126280849ScyAS_UNSET([ac_cv_prog_AWK])
127280849ScyAC_SUBST([AWK])				dnl scripts/ntpver.in
128181834SrobertoAC_PROG_MAKE_SET
129181834Sroberto
130280849ScyAC_SUBST([CFLAGS])
131280849ScyAC_SUBST([LDFLAGS])
132181834Sroberto
133280849ScyAC_PROG_LN_S
134280849ScyAC_ISC_POSIX
135181834Sroberto
136181834Sroberto
137280849ScyAC_PATH_PROG([PATH_PERL], [perl])
138280849Scydnl  Saving cached hardcoded paths rather than searching $PATH during a
139280849Scydnl  cached configure run is an optimization not worth the the cost of
140280849Scydnl  preventing newly-installed tools from being found.  Short-circuit
141280849Scydnl  the caching after the tests so preset overrides still work.
142280849ScyAS_UNSET([ac_cv_path_PATH_PERL])
143280849ScyAC_PATH_PROG([PATH_TEST], [test])
144280849ScyAS_UNSET([ac_cv_path_PATH_TEST])
145280849Scytest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
146280849ScyAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
147181834Sroberto
148280849ScyAC_ARG_WITH(
149280849Scy    [net-snmp-config],
150280849Scy    [AS_HELP_STRING(
151280849Scy	[--with-net-snmp-config],
152280849Scy	[+ =net-snmp-config]
153280849Scy    )],
154280849Scy    [ans=$withval],
155280849Scy    [ans=yes]
156280849Scy)
157280849Scycase "$ans" in
158280849Scy no)
159181834Sroberto    ;;
160280849Scy yes)
161280849Scy    ans=net-snmp-config
162181834Sroberto    ;;
163280849Scy /*)
164181834Sroberto    ;;
165280849Scy */*)
166280849Scy    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
167181834Sroberto    ;;
168280849Scy *)
169280849Scy    ;;
170181834Srobertoesac
171280849ScyPROG_NET_SNMP_CONFIG=$ans
172280849ScyAC_MSG_CHECKING([for net-snmp-config path])
173280849Scycase "$PROG_NET_SNMP_CONFIG" in
174280849Scy no) ;;
175280849Scy /*)
176280849Scy    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
177181834Sroberto    ;;
178280849Scy *)
179280849Scy    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
180280849Scy    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
181280849Scy;;
182181834Srobertoesac
183280849ScyAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
184181834Sroberto
185285169Scycase "$PATH_NET_SNMP_CONFIG" in
186285169Scy /*)	AC_CACHE_CHECK(
187285169Scy	    [for net-snmp version],
188285169Scy	    [ntp_cv_net_snmp_version],
189285169Scy	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
190285169Scy	)
191285169Scy	;;
192285169Scyesac
193285169Scy
194181834Srobertocase "$host" in
195181834Sroberto *-*-vxworks*)
196181834Sroberto    ac_link="$ac_link $VX_KERNEL"
197181834Sroberto    ;;
198181834Srobertoesac
199181834Sroberto
200280849Scy# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
201280849ScyAC_SEARCH_LIBS([openlog], [gen syslog])
202280849Scy# XXX library list will be in ac_cv_search_openlog
203181834Sroberto
204280849Scy# LIBSECCOMP is off by default -- needs testing with all the features
205280849Scy# Please send bug reports to loganaden@gmail.com
206280849ScyAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
207280849ScyAC_ARG_ENABLE(
208280849Scy    [libseccomp],
209280849Scy    [AS_HELP_STRING(
210280849Scy	[--enable-libseccomp],
211280849Scy	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
212280849Scy    )],
213280849Scy    [ntp_ok=$enableval],
214280849Scy    [ntp_ok=no]
215280849Scy)
216280849ScyAC_MSG_RESULT([$ntp_ok])
217280849Scycase "$ntp_ok" in
218280849Scy yes)
219280849Scy    AC_SEARCH_LIBS(
220280849Scy	[seccomp_init],
221280849Scy	[seccomp],
222280849Scy	[AC_DEFINE([LIBSECCOMP], [1],
223280849Scy	    [Define to any value to include libseccomp sandboxing.])]
224280849Scy    )
225280849Scy    AC_TRY_RUN([
226280849Scy	#include <stdio.h>
227280849Scy	#include <stdlib.h>
228280849Scy	#include <errno.h>
229280849Scy	#include <sys/prctl.h>
230280849Scy	#include <linux/seccomp.h>
231280849Scy
232280849Scy	int main(void)
233280849Scy	{
234280849Scy		int ret;
235280849Scy		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
236280849Scy		if (ret < 0) {
237280849Scy			switch (errno) {
238280849Scy			case ENOSYS:
239280849Scy				return 1;
240280849Scy			case EINVAL:
241280849Scy				return 1;
242280849Scy			default:
243280849Scy				return 1;
244280849Scy			}
245280849Scy		}
246280849Scy		ret = 
247280849Scy		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
248280849Scy		if (ret < 0) {
249280849Scy			switch (errno) {
250280849Scy			case EINVAL:
251280849Scy				return 1;
252280849Scy			case EFAULT:
253280849Scy				return 0;
254280849Scy			default:
255280849Scy				return 1;
256280849Scy		}
257280849Scy	}
258280849Scyreturn 1;
259280849Scy}
260280849Scy]
261280849Scy, AC_DEFINE([KERN_SECCOMP], 1, 
262280849Scy[Define to use libseccomp system call filtering.])   
263280849Scy, []
264280849Scy)
265181834Sroberto    ;;
266181834Srobertoesac
267181834Sroberto
268280849ScyNTP_FACILITYNAMES
269200576Sroberto
270181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
271181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
272181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
273181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
274181834Srobertodnl real-time library, so we don't want to use it.
275280849Scydnl
276280849Scydnl 081118 Harlan got tired of looking for a way to get the sched*()
277280849Scydnl functions to link OK with either cc or gcc.
278181834Sroberto
279181834Srobertocase "$host" in
280200576Sroberto *-*-*linux*) ;;
281280849Scy *-*-osf4*) ;;
282280849Scy *-*-osf5*) ;;
283181834Sroberto *)
284280849Scy    # HMS: Make sure we check for -lrt for clock_* before this...
285280849Scy    case "$ac_cv_search_clock_gettime" in
286280849Scy     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
287280849Scy    esac
288280849Scy    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
289181834Sroberto    ;;
290181834Srobertoesac
291181834Sroberto
292280849ScyAC_CHECK_HEADERS([bstring.h])
293280849ScyAC_CHECK_HEADER(
294280849Scy    [dns_sd.h],
295280849Scy    [AC_SEARCH_LIBS(
296280849Scy	[DNSServiceRegister],
297280849Scy	[dns_sd],
298280849Scy	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
299280849Scy	    [Use Rendezvous/DNS-SD registration])]
300280849Scy    )]
301280849Scy)
302280849ScyAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
303181834Sroberto
304280849ScyAC_CHECK_HEADERS([memory.h netdb.h poll.h])
305298695SdelphijAC_CHECK_HEADERS([sgtty.h stdatomic.h])
306298695SdelphijAC_HEADER_STDBOOL
307298695SdelphijAC_CHECK_HEADERS([stdlib.h string.h termio.h])
308280849ScyAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
309181834Sroberto
310181834Srobertocase "$host" in
311181834Sroberto *-*-aix*)
312280849Scy    AC_CHECK_HEADERS([utmpx.h])
313181834Sroberto    case "$ac_cv_header_utmpx_h" in
314280849Scy     yes)
315280849Scy	;;
316280849Scy     *)
317280849Scy	AC_CHECK_HEADERS([utmp.h])
318280849Scy	;;
319181834Sroberto    esac
320181834Sroberto    ;;
321280849Scy *)
322280849Scy    AC_CHECK_HEADERS([utmp.h utmpx.h])
323280849Scy    ;;
324181834Srobertoesac
325280849Scy
326280849Scy#
327280849Scy# On Suns only (so far) getpass() truncates the typed password to 8
328280849Scy# characters, but getpassphrase() allows up to 257.  Most systems'
329280849Scy# getpass() does not truncate, at least not so as to affect ntpq and
330280849Scy# ntpdc password prompts.
331280849Scy#
332280849Scy# So check for getpassphrase(), but only on Sun operating systems.
333280849Scy#
334280849Scycase "$host" in
335280849Scy *-*-sunos*|*-*-solaris*)
336280849Scy    AC_CHECK_FUNCS([getpassphrase])
337280849Scyesac
338280849Scy
339280849Scy
340280849ScyAC_CHECK_HEADERS([net/if6.h])
341280849ScyAC_CHECK_HEADERS([net/route.h], [], [], [
342280849Scy    #include <sys/types.h>
343280849Scy    #include <sys/socket.h>
344280849Scy    #include <net/if.h>
345181834Sroberto])
346200576Sroberto
347280849ScyAC_CHECK_HEADERS([netinfo/ni.h])
348280849Scycase "$ac_cv_header_netinfo_ni_h" in
349200576Sroberto yes)
350280849Scy    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
351200576Srobertoesac
352280849ScyAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
353181834Srobertocase "$host" in
354280849Scy *-*-sunos4*)
355181834Sroberto    ;;
356280849Scy *)
357280849Scy    AC_CHECK_HEADERS([sys/ioctl.h])
358280849Scy    ;;
359181834Srobertoesac
360280849ScyAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
361181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
362280849ScyAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
363181834Srobertocase "$ac_cv_header_sched_h" in
364280849Scy yes)
365181834Sroberto    ;;
366280849Scy *)
367280849Scy    AC_CHECK_HEADERS([sys/sched.h])
368280849Scy    ;;
369181834Srobertoesac
370181834Sroberto# HMS: Check sys/shm.h after some others
371280849ScyAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
372181834Sroberto# HMS: Checked sys/socket.h earlier
373181834Srobertocase "$host" in
374280849Scy *-*-netbsd*)
375181834Sroberto    ;;
376280849Scy *)
377280849Scy    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
378280849Scy    ;;
379181834Srobertoesac
380280849ScyAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
381280849ScyAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
382181834Srobertocase "$host" in
383181834Sroberto*-convex-*)
384280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
385280849Scy    ;;
386181834Sroberto*-*-bsdi*)
387280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
388280849Scy    ;;
389181834Srobertoesac
390181834Sroberto
391285169Scycase "$ac_cv_header_stdatomic_h" in
392285169Scy yes)
393285169Scy	AC_CHECK_FUNCS([atomic_thread_fence])
394285169Scy	AC_CACHE_CHECK(
395285169Scy	    [for atomic_thread_fence()],
396285169Scy	    [ntp_cv_func_atomic_thread_fence],
397285169Scy	    [AC_COMPILE_IFELSE(
398285169Scy		[AC_LANG_PROGRAM(
399285169Scy		    [[
400285169Scy			#include <stdatomic.h>
401285169Scy		    ]],
402285169Scy		    [[
403285169Scy			atomic_thread_fence(memory_order_seq_cst);
404285169Scy		    ]]
405285169Scy		)]
406285169Scy		[ntp_cv_func_atomic_thread_fence=yes],
407285169Scy		[ntp_cv_func_atomic_thread_fence=no]
408285169Scy	    )]
409285169Scy	)
410285169Scy    ;;
411285169Scyesac
412285169Scy
413181834Srobertocase "$host" in
414280849Scy *-*-solaris2.6)
415280849Scy    # Broken...
416181834Sroberto    ;;
417181834Sroberto *)
418280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
419181834Sroberto    ;;
420181834Srobertoesac
421181834Sroberto
422280849Scycase "$host" in
423280849Scy *-*-*linux*)
424280849Scy    case "$ac_cv_func_ntp_gettime" in
425280849Scy     yes)
426280849Scy	;;
427280849Scy     *)
428280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
429280849Scy	case "$ac_cv_func___ntp_gettime" in
430280849Scy	 yes)
431280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
432280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
433280849Scy	esac
434280849Scy	;;
435280849Scy    esac
436280849Scy    AC_CHECK_FUNCS([adjtimex])
437280849Scy    case "$ac_cv_func_adjtimex" in
438280849Scy     yes)
439280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
440280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
441280849Scy	have_adjtimex=1
442280849Scy	;;
443280849Scy     *)
444280849Scy	AC_CHECK_FUNCS([__adjtimex])
445280849Scy	case "$ac_cv_func___adjtimex" in
446280849Scy	 yes)
447280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
448280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
449280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
450280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
451280849Scy	    have_adjtimex=1
452280849Scy	esac
453280849Scy	;;
454280849Scy    esac
455280849Scyesac
456280849Scycase "$have_adjtimex" in
457280849Scy '')
458280849Scy    # nlist stuff is only needed for tickadj.
459280849Scy    saved_LIBS="$LIBS"
460280849Scy    LIBS=
461280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
462280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
463280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
464280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
465280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
466280849Scy    case "$ac_cv_header_nlist_h" in
467280849Scy     yes)
468280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
469280849Scy	AC_CACHE_CHECK(
470280849Scy	    [for n_un in struct nlist],
471280849Scy	    [ntp_cv_struct_nlist_n_un],
472280849Scy	    [AC_COMPILE_IFELSE(
473280849Scy		[AC_LANG_PROGRAM(
474280849Scy		    [[
475280849Scy			#include <nlist.h>
476280849Scy		    ]],
477280849Scy		    [[
478280849Scy			struct nlist n;
479280849Scy			n.n_un.n_name = 0;
480280849Scy		    ]]
481280849Scy		)]
482280849Scy		[ntp_cv_struct_nlist_n_un=yes],
483280849Scy		[ntp_cv_struct_nlist_n_un=no]
484280849Scy	    )]
485280849Scy	)
486280849Scy	case "$ntp_cv_struct_nlist_n_un" in
487280849Scy	 yes)
488280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
489280849Scy		[does struct nlist use a name union?])
490280849Scy	esac
491280849Scy    esac
492280849Scy    AC_SUBST([LDADD_NLIST])
493280849Scy    LDADD_NLIST="$LIBS"
494280849Scy    LIBS="$saved_LIBS"
495280849Scy    AS_UNSET([saved_LIBS])
496280849Scyesac
497181834Sroberto
498280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
499280849Scy    #ifdef HAVE_SYS_TYPES_H
500280849Scy    # include <sys/types.h>
501280849Scy    #endif
502280849Scy    #ifdef HAVE_SYS_TIME_H
503280849Scy    # include <sys/time.h>
504280849Scy    #endif
505181834Sroberto])
506181834Sroberto
507280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
508280849Scy    #ifdef HAVE_SYS_TIME_H
509280849Scy    # include <sys/time.h>
510280849Scy    #endif
511181834Sroberto])
512181834Sroberto
513280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
514280849Scy    #ifdef HAVE_SYS_TYPES_H
515280849Scy    # include <sys/types.h>
516280849Scy    #endif
517280849Scy    #ifdef HAVE_SYS_IPC_H
518280849Scy    # include <sys/ipc.h>
519280849Scy    #endif
520181834Sroberto])
521181834Sroberto
522280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
523280849Scy    #ifdef HAVE_SYS_TIME_H
524280849Scy    # include <sys/time.h>
525280849Scy    #endif
526181834Sroberto])
527181834Sroberto
528181834SrobertoAC_TYPE_SIGNAL
529181834SrobertoAC_TYPE_OFF_T
530280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
531181834Sroberto
532280849ScyAC_CACHE_CHECK(
533280849Scy    [for a fallback value for HZ],
534280849Scy    [ntp_cv_default_hz],
535280849Scy    [
536280849Scy	ntp_cv_default_hz=100
537280849Scy	case "$host" in
538280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
539280849Scy	    ntp_cv_default_hz=1024
540280849Scy	    ;;
541280849Scy	 mips-dec-ultrix4*)
542280849Scy	    ntp_cv_default_hz=256
543280849Scy	    ;;
544280849Scy	esac
545280849Scy    ]
546280849Scy)
547280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
548280849Scy    [What is the fallback value for HZ?])
549181834Sroberto
550280849ScyAC_CACHE_CHECK(
551280849Scy    [if we need to override the system's value for HZ],
552280849Scy    [ntp_cv_override_hz],
553280849Scy    [
554280849Scy	ntp_cv_override_hz=no
555280849Scy	case "$host" in
556280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
557280849Scy	    ntp_cv_override_hz=yes
558280849Scy	    ;;
559280849Scy	 mips-dec-ultrix4*)
560280849Scy	    ntp_cv_override_hz=yes
561280849Scy	    ;;
562280849Scy	 *-*-freebsd*)
563280849Scy	    ntp_cv_override_hz=yes
564280849Scy	    ;;
565280849Scy	 *-*-sunos4*)
566280849Scy	    ntp_cv_override_hz=yes
567280849Scy	    ;;
568280849Scy	 *-*-kfreebsd*)
569280849Scy	    ntp_cv_override_hz=yes
570280849Scy	    ;;
571280849Scy	esac
572280849Scy    ]
573280849Scy)
574280849Scycase "$ntp_cv_override_hz" in
575181834Sroberto yes)
576280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
577280849Scy	[Do we need to override the system's idea of HZ?])
578181834Srobertoesac
579181834Sroberto
580181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
581181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
582181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
583181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
584181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
585181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
586181834Srobertodnl fi
587181834Sroberto
588181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
589181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
590181834Srobertodnl [AC_EGREP_CPP(yes,
591181834Srobertodnl [#ifdef HAVE_UTMPX_H
592181834Srobertodnl #include <utmpx.h>
593181834Srobertodnl #else
594181834Srobertodnl #include <utmp.h>
595181834Srobertodnl #endif
596181834Srobertodnl #ifdef BOOT_TIME
597181834Srobertodnl yes
598181834Srobertodnl #endif
599181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
600181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
601181834Sroberto
602280849ScyAC_CACHE_CHECK(
603280849Scy    [for struct rt_msghdr],
604280849Scy    [ntp_cv_struct_rt_msghdr],
605280849Scy    [AC_COMPILE_IFELSE(
606280849Scy	[AC_LANG_PROGRAM(
607280849Scy	    [[
608280849Scy		#include <sys/types.h>
609280849Scy		#include <sys/socket.h>
610280849Scy		#include <net/if.h>
611280849Scy		#include <net/route.h>
612280849Scy	    ]],
613280849Scy	    [[
614280849Scy		struct rt_msghdr p;
615280849Scy	    ]]
616280849Scy	)],
617280849Scy	[ntp_cv_struct_rt_msghdr=yes],
618280849Scy	[ntp_cv_struct_rt_msghdr=no]
619280849Scy    )]
620280849Scy)
621200576Sroberto
622181834SrobertoAC_CACHE_CHECK(
623280849Scy    [for struct rtattr],
624280849Scy    [ntp_cv_rtattr],
625280849Scy    [AC_COMPILE_IFELSE(
626280849Scy	[AC_LANG_PROGRAM(
627280849Scy	    [[
628280849Scy		#include <stddef.h>
629280849Scy		#include <sys/socket.h>
630280849Scy		#include <linux/rtnetlink.h>
631280849Scy	    ]],
632280849Scy	    [[
633280849Scy		struct rtattr p;
634280849Scy	    ]]
635280849Scy	)],
636280849Scy	[ntp_cv_rtattr=yes],
637280849Scy	[ntp_cv_rtattr=no]
638280849Scy    )]
639181834Sroberto)
640181834Sroberto
641280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
642280849Scy *yes*)
643280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
644280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
645280849Scy    case "$ntp_cv_rtattr" in
646280849Scy     yes)
647280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
648280849Scy	    [Do we have Linux routing socket?])
649181834Sroberto    esac
650280849Scyesac
651181834Sroberto
652280849ScyAC_CACHE_CHECK(
653280849Scy    [struct sigaction for sa_sigaction],
654280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
655280849Scy    [AC_COMPILE_IFELSE(
656280849Scy	[AC_LANG_PROGRAM(
657280849Scy	    [[
658280849Scy		#include <signal.h>
659280849Scy	    ]],
660280849Scy	    [[
661280849Scy		struct sigaction act;
662280849Scy		act.sa_sigaction = 0;
663280849Scy	    ]]
664280849Scy	)],
665280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
666280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
667280849Scy    )]
668280849Scy)
669280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
670280849Scy yes)
671280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
672280849Scyesac
673181834Sroberto
674280849ScyAC_CACHE_CHECK(
675280849Scy    [for struct ppsclockev],
676280849Scy    [ntp_cv_struct_ppsclockev],
677280849Scy    [AC_COMPILE_IFELSE(
678280849Scy	[AC_LANG_PROGRAM(
679280849Scy	    [[
680280849Scy		#ifdef HAVE_SYS_TYPES_H
681280849Scy		# include <sys/types.h>
682280849Scy		#endif
683280849Scy		#ifdef HAVE_SYS_TERMIOS_H
684280849Scy		# include <sys/termios.h>
685280849Scy		#endif
686280849Scy		#ifdef HAVE_SYS_TIME_H
687280849Scy		# include <sys/time.h>
688280849Scy		#endif
689280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
690280849Scy		# include <sys/ppsclock.h>
691280849Scy		#endif
692280849Scy	    ]],
693280849Scy	    [[
694280849Scy		extern struct ppsclockev *pce;
695280849Scy		return pce->serial;
696280849Scy	    ]]
697280849Scy	)],
698280849Scy	[ntp_cv_struct_ppsclockev=yes],
699280849Scy	[ntp_cv_struct_ppsclockev=no]
700280849Scy    )]
701280849Scy)
702280849Scycase "$ntp_cv_struct_ppsclockev" in
703280849Scy yes)
704280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
705280849Scy	[Does a system header define struct ppsclockev?])
706280849Scyesac
707181834Sroberto
708181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
709181834Sroberto  *yes*)
710280849Scy    AC_CACHE_CHECK(
711280849Scy	[for struct snd_size],
712280849Scy	[ntp_cv_struct_snd_size],
713280849Scy	[AC_COMPILE_IFELSE(
714280849Scy	    [AC_LANG_PROGRAM(
715280849Scy		[[
716280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
717280849Scy		    # include <machine/soundcard.h>
718280849Scy		    #endif
719280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
720280849Scy		    # include <sys/soundcard.h>
721280849Scy		    #endif
722280849Scy		]],
723280849Scy		[[
724280849Scy		    extern struct snd_size *ss;
725280849Scy		    return ss->rec_size;
726280849Scy		]]
727280849Scy	    )],
728280849Scy	    [ntp_cv_struct_snd_size=yes],
729280849Scy	    [ntp_cv_struct_snd_size=no]
730280849Scy        )]
731280849Scy    )
732280849Scy    case "$ntp_cv_struct_snd_size" in
733280849Scy     yes)
734280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
735280849Scy	    [Do we have struct snd_size?])
736181834Sroberto    esac
737181834Srobertoesac
738181834Sroberto
739280849ScyAC_CACHE_CHECK(
740280849Scy    [struct clockinfo for hz],
741280849Scy    [ntp_cv_struct_clockinfo_has_hz],
742280849Scy    [AC_COMPILE_IFELSE(
743280849Scy	[AC_LANG_PROGRAM(
744280849Scy	    [[
745280849Scy		#include <sys/time.h>
746280849Scy	    ]],
747280849Scy	    [[
748280849Scy		extern struct clockinfo *pc;
749280849Scy		return pc->hz;
750280849Scy	    ]]
751280849Scy	)],
752280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
753280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
754280849Scy    )]
755280849Scy)
756280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
757280849Scy yes)
758280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
759280849Scyesac
760181834Sroberto
761280849ScyAC_CACHE_CHECK(
762280849Scy    [struct clockinfo for tickadj],
763280849Scy    [ntp_cv_struct_clockinfo_has_hz],
764280849Scy    [AC_COMPILE_IFELSE(
765280849Scy	[AC_LANG_PROGRAM(
766280849Scy	    [[
767280849Scy		#include <sys/time.h>
768280849Scy	    ]],
769280849Scy	    [[
770280849Scy		extern struct clockinfo *pc;
771280849Scy		return pc->tickadj;
772280849Scy	    ]]
773280849Scy	)],
774280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
775280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
776280849Scy    )]
777280849Scy)
778280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
779280849Scy yes)
780280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
781280849Scyesac
782181834Sroberto
783280849Scycase "$ntp_cv_struct_ntptimeval" in
784280849Scy yes)
785280849Scy    AC_CHECK_MEMBERS(
786280849Scy	[struct ntptimeval.time.tv_nsec],
787280849Scy	[],
788280849Scy	[],
789280849Scy	[
790280849Scy	    #ifdef HAVE_SYS_TIME_H
791280849Scy	    # include <sys/time.h>
792280849Scy	    #else
793280849Scy	    # ifdef HAVE_TIME_H
794280849Scy	    #  include <time.h>
795280849Scy	    # endif
796280849Scy	    #endif
797280849Scy	    #ifdef HAVE_SYS_TIMEX_H
798280849Scy	    # include <sys/timex.h>
799280849Scy	    #else
800280849Scy	    # ifdef HAVE_TIMEX_H
801280849Scy	    #  include <timex.h>
802280849Scy	    # endif
803280849Scy	    #endif
804280849Scy	]
805280849Scy    )
806200576Srobertoesac
807200576Sroberto
808280849Scy#### 
809181834Sroberto
810280849ScyAC_CHECK_FUNCS([arc4random_buf])
811181834Sroberto
812280849Scy#### 
813181834Sroberto
814280849Scysaved_LIBS="$LIBS"
815280849ScyLIBS="$LIBS $LDADD_LIBNTP"
816280849ScyAC_CHECK_FUNCS([daemon])
817280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
818280849ScyLIBS="$saved_LIBS"
819280849ScyAS_UNSET([saved_LIBS])
820181834Sroberto
821280849ScyAC_CHECK_FUNCS(
822280849Scy    [finite],
823280849Scy    [],
824280849Scy    [AC_CHECK_FUNCS(
825280849Scy	[isfinite],
826280849Scy	[],
827280849Scy	[
828280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
829280849Scy	    _libs=$LIBS
830280849Scy	    # XXX
831280849Scy	    LIBS="$LIBS -lm"
832280849Scy	    AC_LINK_IFELSE(
833280849Scy		[AC_LANG_PROGRAM(
834280849Scy		    [[
835280849Scy			#include <math.h>
836280849Scy		    ]],
837280849Scy		    [[
838280849Scy			float f = 0.0;
839280849Scy			isfinite(f);
840280849Scy		    ]]
841280849Scy		)],
842280849Scy		[ans=yes],
843280849Scy		[ans=no]
844280849Scy	    )
845280849Scy	    LIBS=$_libs
846280849Scy	    AC_MSG_RESULT([$ans])
847280849Scy	    case "$ans" in
848280849Scy	     yes)
849280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
850280849Scy	    esac
851280849Scy	]
852280849Scy    )]
853280849Scy)
854181834Sroberto
855280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
856181834Sroberto
857280849Scy# kvm_open() is only used by tickadj.  Also see above.
858280849Scycase "$ac_cv_header_kvm_h" in
859280849Scy yes)
860280849Scy    AC_CHECK_FUNCS([kvm_open])
861181834Sroberto    ;;
862181834Srobertoesac
863181834Sroberto
864181834Srobertocase "$host" in
865181834Sroberto *-*-sco3.2v5.0.*)
866280849Scy    # Just stubs.  Sigh.
867181834Sroberto    ;;
868280849Scy *) AC_CHECK_FUNCS([mkstemp])
869181834Sroberto    ;;
870181834Srobertoesac
871280849ScyAC_CHECK_FUNCS([mktime])
872181834Srobertocase "$host" in
873280849Scy *-*-aix[[4-9]]*)
874280849Scy    # XXX only verified thru AIX6.
875280849Scy    # Just a stub.  Sigh.
876181834Sroberto    ;;
877181834Sroberto *-*-irix[[45]]*)
878280849Scy    # Just a stub in "old" Irix.  Sigh.
879181834Sroberto    ;;
880280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
881280849Scy# *-*-*linux*)
882280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
883280849Scy#    ;;
884181834Sroberto *-*-qnx*)
885280849Scy    # Apparently there but not working in QNX.  Sigh?
886181834Sroberto    ;;
887181834Sroberto *-*-sco3.2v5.0.*)
888280849Scy    # Just a stub.  Sigh.
889181834Sroberto    ;;
890181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
891181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
892181834Sroberto    # Not easy to test for - cheat.
893280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
894280849Scy    AC_CHECK_FUNCS([mlockall])
895181834Sroberto    ;;
896280849Scy *) AC_CHECK_FUNCS([mlockall])
897181834Sroberto    ;;
898181834Srobertoesac
899280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
900181834Srobertocase "$host" in
901280849Scy *-*-aix[[4-9]]*)
902280849Scy    # XXX only verified thru AIX6.
903280849Scy    # Just a stub in AIX 4.  Sigh.
904181834Sroberto    ;;
905181834Sroberto *-*-solaris2.5*)
906280849Scy    # Just stubs in solaris2.5.  Sigh.
907181834Sroberto    ;;
908280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
909181834Sroberto    ;;
910181834Srobertoesac
911280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
912280849ScyAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
913181834Srobertocase "$host" in
914280849Scy *-*-aix[[4-9]]*)
915280849Scy    # XXX only verified thru AIX6.
916280849Scy    # Just stubs.  Sigh.
917181834Sroberto    ;;
918181834Sroberto *-*-netbsd1*)
919280849Scy    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-netbsdelf1*)
922280849Scy    # Just stubs.  Sigh.
923181834Sroberto    ;;
924181834Sroberto *-*-openbsd*)
925280849Scy    # Just stubs.  Sigh.
926181834Sroberto    ;;
927280849Scy *)
928280849Scy    AC_CHECK_FUNCS([timer_create])
929181834Sroberto    ;;
930181834Srobertoesac
931181834Sroberto
932280849ScyNTP_RLIMIT_ITEMS
933181834Sroberto
934280849Scy# some OSes prefer _exit() in forked children to exit()
935280849ScyAC_CHECK_FUNCS([_exit])
936280849Scyntp_worker_child_exit=exit
937280849Scycase "$ac_cv_func__exit::$host_os" in
938280849Scy yes::netbsd*)
939280849Scy    ntp_worker_child_exit=_exit
940280849Scy    ;;
941280849Scy yes::openbsd*)
942280849Scy    ntp_worker_child_exit=_exit
943280849Scy    ;;
944280849Scyesac
945280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
946280849Scy		   [routine worker child proc uses to exit.])
947181834Sroberto
948280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
949181834Sroberto
950280849Scy###
951181834Sroberto
952280849Scy# http://bugs.ntp.org/737
953280849Scycase "$ac_cv_func_recvmsg" in
954280849Scy yes)
955280849Scy    AC_CACHE_CHECK(
956280849Scy	[if we need extra help to define struct iovec],
957280849Scy	[ntp_cv_struct_iovec_help],
958280849Scy	[
959280849Scy	    compiled=no
960280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
961280849Scy		AC_COMPILE_IFELSE(
962280849Scy		    [AC_LANG_PROGRAM(
963280849Scy			[[
964280849Scy			    #ifdef HAVE_SYS_TYPES_H
965280849Scy			    # include <sys/types.h>
966280849Scy			    #endif
967280849Scy			    #ifdef HAVE_SYS_SOCKET_H
968280849Scy			    # include <sys/socket.h>
969280849Scy			    #endif
970280849Scy			    #if $ntp_cv_struct_iovec_help
971280849Scy			    # include <sys/uio.h>
972280849Scy			    #endif
973280849Scy			]],
974280849Scy			[[
975280849Scy			    void foo(void) {
976280849Scy				ssize_t x;
977280849Scy				int s = 0;
978280849Scy				struct iovec iov;
979280849Scy				struct msghdr mh;
980280849Scy				int flags = 0;
981181834Sroberto
982280849Scy				mh.msg_iov = &iov;
983280849Scy				x = recvmsg(s, &mh, flags);
984280849Scy			    }
985280849Scy			]]
986280849Scy		    )],
987280849Scy		    [compiled=yes ; break 1],
988280849Scy		    []
989280849Scy		)
990280849Scy	    done
991280849Scy	    case "$compiled" in
992280849Scy	     no)
993280849Scy		ntp_cv_struct_iovec_help=0
994280849Scy	    esac
995280849Scy	    AS_UNSET([compiled])
996280849Scy	]
997280849Scy    )
998280849Scy    case "$ntp_cv_struct_iovec_help" in
999280849Scy     1)
1000280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1001280849Scy	    [Use sys/uio.h for struct iovec help])
1002280849Scy    esac
1003181834Srobertoesac
1004181834Sroberto
1005280849ScyAC_CACHE_CHECK(
1006280849Scy    [number of arguments taken by setpgrp()],
1007280849Scy    [ntp_cv_func_setpgrp_nargs],
1008280849Scy    [AC_COMPILE_IFELSE(
1009280849Scy	[AC_LANG_PROGRAM(
1010280849Scy	    [[
1011280849Scy		#ifdef HAVE_SYS_TYPES_H
1012280849Scy		# include <sys/types.h>
1013280849Scy		#endif
1014280849Scy		#ifdef HAVE_UNISTD_H
1015280849Scy		# include <unistd.h>
1016280849Scy		#endif
1017280849Scy	    ]],
1018280849Scy	    [[
1019280849Scy		setpgrp(0, 0);
1020280849Scy	    ]]
1021280849Scy	)],
1022280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1023280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1024280849Scy    )]
1025280849Scy)
1026280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1027280849Scy 0)
1028280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1029280849Scy	      [define if setpgrp takes 0 arguments])
1030280849Scyesac
1031181834Sroberto
1032280849ScyAC_CACHE_CHECK(
1033280849Scy    [if we need to declare 'errno'],
1034280849Scy    [ntp_cv_decl_errno],
1035280849Scy    [AC_COMPILE_IFELSE(
1036280849Scy	[AC_LANG_PROGRAM(
1037280849Scy	    [[
1038280849Scy		#ifdef HAVE_ERRNO_H
1039280849Scy		# include <errno.h>
1040280849Scy		#endif
1041280849Scy	    ]],
1042280849Scy	    [[
1043280849Scy		errno = 0;
1044280849Scy	    ]]
1045280849Scy	)],
1046280849Scy	[ntp_cv_decl_errno=no],
1047280849Scy	[ntp_cv_decl_errno=yes]
1048280849Scy    )]
1049280849Scy)
1050280849Scycase "$ntp_cv_decl_errno" in
1051280849Scy yes)
1052280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1053181834Srobertoesac
1054181834Sroberto
1055181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1056181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1057181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1058181834Srobertodnl without breaking any other platforms.
1059181834Srobertodnl
1060280849ScyAC_CACHE_CHECK(
1061280849Scy    [if we may declare 'h_errno'],
1062280849Scy    [ntp_cv_decl_h_errno],
1063280849Scy    [AC_COMPILE_IFELSE(
1064280849Scy	[AC_LANG_PROGRAM(
1065280849Scy	    [[
1066280849Scy		#include <sys/types.h>
1067280849Scy		#ifdef HAVE_NETINET_IN_H
1068280849Scy		# include <netinet/in.h>
1069280849Scy		#endif
1070280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1071280849Scy		# include <arpa/nameser.h>
1072280849Scy		#endif
1073280849Scy		#ifdef HAVE_NETDB_H
1074280849Scy		# include <netdb.h>
1075280849Scy		#endif
1076280849Scy		#ifdef HAVE_RESOLV_H
1077280849Scy		# include <resolv.h>
1078280849Scy		#endif
1079280849Scy	    ]],
1080280849Scy	    [[
1081280849Scy		extern int h_errno;
1082280849Scy	    ]]
1083280849Scy	)],
1084280849Scy	[ntp_cv_decl_h_errno=yes],
1085280849Scy	[ntp_cv_decl_h_errno=no]
1086280849Scy    )]
1087280849Scy)
1088280849Scycase "$ntp_cv_decl_h_errno" in
1089280849Scy yes)
1090280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1091181834Srobertoesac
1092181834Sroberto
1093280849ScyAC_CACHE_CHECK(
1094280849Scy    [if declaring 'syscall()' is ok],
1095280849Scy    [ntp_cv_decl_syscall],
1096280849Scy    [AC_COMPILE_IFELSE(
1097280849Scy	[AC_LANG_PROGRAM(
1098280849Scy	    [[
1099280849Scy		#ifdef HAVE_SYS_TYPES_H
1100280849Scy		# include <sys/types.h>
1101280849Scy		#endif
1102280849Scy		#ifdef HAVE_UNISTD_H
1103280849Scy		# include <unistd.h>
1104280849Scy		#endif
1105280849Scy	    ]],
1106280849Scy	    [[
1107280849Scy		extern int syscall (int, ...);
1108280849Scy	    ]]
1109280849Scy	)]
1110280849Scy	[ntp_cv_decl_syscall=yes],
1111280849Scy	[ntp_cv_decl_syscall=no]
1112280849Scy    )]
1113280849Scy)
1114280849Scycase "$ntp_cv_decl_syscall" in
1115280849Scy yes)
1116280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1117181834Srobertoesac
1118181834Sroberto
1119181834Srobertocase "$host" in
1120181834Sroberto *-*-aix4.3.*)
1121280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1122181834Sroberto    ;;
1123181834Sroberto *-*-mpeix*)
1124280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1125280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1126280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1127280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1128280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1129280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1130280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1131181834Sroberto    ;;
1132181834Sroberto *-*-osf[[45]]*)
1133280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1134280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1135181834Sroberto    ;;
1136181834Sroberto *-*-qnx*)
1137280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1138181834Sroberto    ;;
1139181834Sroberto *-*-riscos4*)
1140280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1142280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1143280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1144280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1145280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1146280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1147280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1148280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1149280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1150280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1151280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1152280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1153280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1154280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1155280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1156181834Sroberto    ;;
1157181834Sroberto *-*-solaris2*)
1158280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1159280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1160181834Sroberto    case "$host" in
1161181834Sroberto     *-*-solaris2.4)
1162280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1163181834Sroberto	;;
1164181834Sroberto    esac
1165181834Sroberto    ;;
1166181834Sroberto *-*-sunos4*)
1167280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1168280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1169280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1170280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1171280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1172280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1173280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1174280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1175280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1176280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1177280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1178280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1179280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1180181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1181181834Sroberto     acc*) ;;
1182280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1183181834Sroberto	;;
1184181834Sroberto    esac
1185280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1186280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1187280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1188280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1189280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1190280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1191280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1192181834Sroberto    ;;
1193181834Sroberto *-*-ultrix4*)
1194280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1195280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1196280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1197280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1198280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1199280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1200280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1201280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1202280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1203280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1204280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1207280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1208181834Sroberto    ;;
1209181834Srobertoesac
1210181834Sroberto
1211181834Srobertocase "$host" in
1212181834Sroberto *-*-sco3.2*)
1213280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1214280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1215181834Sroberto    ;;
1216181834Srobertoesac
1217181834Sroberto
1218181834Srobertocase "$host" in
1219181834Sroberto *-*-hpux[[567]]*)
1220280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1221280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1222181834Srobertoesac
1223181834Sroberto
1224280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1225280849ScyAC_CACHE_CHECK(
1226280849Scy    [if we will open the broadcast socket],
1227280849Scy    [ntp_cv_var_open_bcast_socket],
1228280849Scy    [
1229280849Scy	ans=yes
1230280849Scy	case "$host" in
1231280849Scy	 *-*-domainos)
1232280849Scy	    ans=no
1233280849Scy	esac
1234280849Scy	ntp_cv_var_open_bcast_socket=$ans
1235280849Scy    ]
1236280849Scy)
1237280849Scycase "$ntp_cv_var_open_bcast_socket" in
1238280849Scy yes)
1239280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1240280849Scy	[Should we open the broadcast socket?])
1241181834Srobertoesac
1242181834Sroberto
1243181834Srobertocase "$host" in
1244181834Sroberto *-*-hpux*)
1245280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1246280849Scy	[Do we want the HPUX FindConfig()?])
1247181834Srobertoesac
1248181834Sroberto
1249280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1250280849ScyAC_CACHE_CHECK(
1251280849Scy    [if process groups are set with -pid],
1252280849Scy    [ntp_cv_arg_setpgrp_negpid],
1253280849Scy    [
1254280849Scy	case "$host" in
1255280849Scy	 *-*-hpux[[567]]*)
1256280849Scy	    ans=no
1257280849Scy	    ;;
1258280849Scy	 *-*-hpux*)
1259280849Scy	    ans=yes
1260280849Scy	    ;;
1261280849Scy	 *-*-*linux*)
1262280849Scy	    ans=yes
1263280849Scy	    ;;
1264280849Scy	 *-*-sunos3*)
1265280849Scy	    ans=yes
1266280849Scy	    ;;
1267280849Scy	 *-*-ultrix2*)
1268280849Scy	    ans=yes
1269280849Scy	    ;;
1270280849Scy	 *)
1271280849Scy	    ans=no
1272280849Scy	    ;;
1273280849Scy	esac
1274280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1275280849Scy    ]
1276280849Scy)
1277280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1278181834Sroberto yes)
1279280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1280280849Scy	[Do we set process groups with -pid?])
1281181834Srobertoesac
1282181834Sroberto
1283280849ScyAC_CACHE_CHECK(
1284280849Scy    [if we need a ctty for F_SETOWN],
1285280849Scy    [ntp_cv_func_ctty_for_f_setown],
1286280849Scy    [
1287280849Scy	case "$host" in
1288280849Scy	 *-*-bsdi[[23]]*)
1289280849Scy	    ans=yes
1290280849Scy	    ;;
1291280849Scy	 *-*-freebsd*)
1292280849Scy	    ans=yes
1293280849Scy	    ;;
1294280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1295280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1296280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1297280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1298280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1299280849Scy	    ans=yes
1300280849Scy	    ;;
1301280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1302280849Scy	    ans=yes
1303280849Scy	    ;;
1304280849Scy	 *-*-openbsd*)
1305280849Scy	    ans=yes
1306280849Scy	    ;;
1307280849Scy	 *-*-osf*)
1308280849Scy	    ans=yes
1309280849Scy	    ;;
1310280849Scy	 *-*-darwin*)
1311280849Scy	    ans=yes
1312280849Scy	    ;;
1313280849Scy	 *)
1314280849Scy	    ans=no
1315280849Scy	    ;;
1316280849Scy	esac
1317280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1318280849Scy    ]
1319280849Scy)
1320280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1321181834Sroberto yes)
1322280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1323181834Srobertoesac
1324181834Sroberto
1325280849ScyAC_CACHE_CHECK(
1326280849Scy    [if the OS clears cached routes when more specifics become available],
1327280849Scy    [ntp_cv_os_routeupdates],
1328280849Scy    [
1329280849Scy	case "$host" in
1330280849Scy	 *-*-netbsd*)
1331280849Scy	    ans=yes
1332280849Scy	    ;;
1333280849Scy	 *)
1334280849Scy	    ans=no
1335280849Scy	    ;;
1336280849Scy	esac
1337280849Scy	ntp_cv_os_routeupdates=$ans
1338280849Scy    ]
1339280849Scy)
1340280849Scycase "$ntp_cv_os_routeupdates" in
1341181834Sroberto yes)
1342280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1343280849Scy	[need to recreate sockets on changed routing?])
1344181834Srobertoesac
1345181834Sroberto
1346280849ScyAC_CACHE_CHECK(
1347280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1348280849Scy    [ntp_cv_os_wildcardreuse],
1349280849Scy    [
1350280849Scy	case "$host" in
1351280849Scy	 *-*-*linux*)
1352280849Scy	    ans=yes
1353280849Scy	    ;;
1354280849Scy	 *) ans=no
1355280849Scy	    ;;
1356280849Scy	esac
1357280849Scy	ntp_cv_os_wildcardreuse=$ans
1358280849Scy    ]
1359280849Scy)
1360280849Scycase "$ntp_cv_os_wildcardreuse" in
1361181834Sroberto yes)
1362280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1363280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1364181834Srobertoesac
1365181834Sroberto
1366181834Srobertocase "$host" in
1367181834Sroberto *-*-aix*)
1368280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1369280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1370181834Srobertoesac
1371181834Sroberto
1372280849ScyAC_CACHE_CHECK(
1373280849Scy    [for a minimum recommended value of tickadj],
1374280849Scy    [ntp_cv_var_min_rec_tickadj],
1375280849Scy    [
1376280849Scy	ans=no
1377280849Scy	case "$host" in
1378280849Scy	 *-*-aix*)
1379280849Scy	    ans=40
1380280849Scy	    ;;
1381280849Scy	esac
1382280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1383280849Scy    ]
1384280849Scy)
1385280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1386280849Scy ''|no)
1387181834Sroberto    ;;
1388280849Scy *)
1389280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1390280849Scy	[Should we recommend a minimum value for tickadj?])
1391181834Srobertoesac
1392280849Scy
1393280849ScyAC_CACHE_CHECK(
1394280849Scy    [if the TTY code permits PARENB and IGNPAR],
1395280849Scy    [ntp_cv_no_parenb_ignpar],
1396280849Scy    [
1397280849Scy	ans=no
1398280849Scy	case "$host" in
1399280849Scy	 i?86-*-*linux*)
1400280849Scy	    ans=yes
1401280849Scy	    ;;
1402280849Scy	 mips-sgi-irix*)
1403280849Scy	    ans=yes
1404280849Scy	    ;;
1405280849Scy	 i?86-*-freebsd[[123]].*)
1406280849Scy	    ;;
1407280849Scy	 i?86-*-freebsd*)
1408280849Scy	    ans=yes
1409280849Scy	    ;;
1410280849Scy	 *-*-unicosmp*)
1411280849Scy	    ans=yes
1412280849Scy	    ;;
1413280849Scy	esac
1414280849Scy	ntp_cv_no_parenb_ignpar=$ans
1415280849Scy    ]
1416280849Scy)
1417280849Scycase "$ntp_cv_no_parenb_ignpar" in
1418280849Scy yes)
1419280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1420280849Scy	[Is there a problem using PARENB and IGNPAR?])
1421181834Srobertoesac
1422181834Sroberto
1423280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1424280849ScyAC_ARG_ENABLE(
1425280849Scy    [debug-timing],
1426280849Scy    [AS_HELP_STRING(
1427280849Scy	[--enable-debug-timing],
1428280849Scy	[- include processing time debugging code (costs performance)]
1429280849Scy    )],
1430280849Scy    [ntp_ok=$enableval],
1431280849Scy    [ntp_ok=no]
1432280849Scy)
1433280849Scycase "$ntp_ok" in
1434280849Scy yes)
1435280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1436181834Srobertoesac
1437280849ScyAC_MSG_RESULT([$ntp_ok])
1438181834Sroberto
1439280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1440200576SrobertoAC_ARG_ENABLE(
1441280849Scy    [dst-minutes],
1442280849Scy    [AS_HELP_STRING(
1443200576Sroberto	[--enable-dst-minutes],
1444280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1445280849Scy    ],
1446200576Sroberto    [ans=$enableval],
1447200576Sroberto    [ans=60]
1448200576Sroberto)
1449280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1450280849Scy    [The number of minutes in a DST adjustment])
1451200576SrobertoAC_MSG_RESULT([$ans])
1452181834Sroberto
1453280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1454200576SrobertoAC_ARG_ENABLE(
1455200576Sroberto    [ignore-dns-errors],
1456280849Scy    [AS_HELP_STRING(
1457280849Scy	[--enable-ignore-dns-errors],
1458200576Sroberto	[- retry DNS queries on any error]
1459280849Scy    )],
1460200576Sroberto    [ans=$enableval],
1461200576Sroberto    [ans=no]
1462200576Sroberto)
1463200576Srobertocase "$ans" in
1464200576Sroberto yes)
1465280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1466280849Scy	[Retry queries on _any_ DNS error?])
1467200576Srobertoesac
1468200576SrobertoAC_MSG_RESULT([$ans])
1469200576Sroberto
1470280849ScyAC_CACHE_CHECK(
1471280849Scy    [availability of ntp_{adj,get}time()],
1472280849Scy    [ntp_cv_var_ntp_syscalls],
1473280849Scy    [
1474280849Scy	ntp_cv_var_ntp_syscalls=no
1475280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1476280849Scy	 yesyes*)
1477280849Scy	    ntp_cv_var_ntp_syscalls=libc
1478181834Sroberto	    ;;
1479280849Scy	 *yes)
1480280849Scy	    ntp_cv_var_ntp_syscalls=inline
1481181834Sroberto	    ;;
1482280849Scy	 *)
1483280849Scy	    AC_PREPROC_IFELSE(
1484282408Scy		[AC_LANG_SOURCE(
1485282408Scy		    [
1486282408Scy			#include <sys/syscall.h>
1487282408Scy			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1488282408Scy			# error
1489282408Scy			#endif
1490282408Scy		    ])],
1491280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1492280849Scy	    )
1493181834Sroberto	    ;;
1494280849Scy	 esac
1495280849Scy    ]
1496280849Scy)
1497280849Scycase "$ntp_cv_var_ntp_syscalls" in
1498181834Sroberto libc)
1499280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1500280849Scy	[Do we have ntp_{adj,get}time in libc?])
1501181834Sroberto    ;;
1502181834Sroberto kernel)
1503280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1504280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1505181834Sroberto    ;;
1506181834Srobertoesac
1507181834Sroberto
1508280849ScyAC_CACHE_CHECK(
1509280849Scy    [if sys/timex.h has STA_FLL],
1510280849Scy    [ntp_cv_var_sta_fll],
1511280849Scy    [AC_PREPROC_IFELSE(
1512282408Scy	[AC_LANG_SOURCE(
1513282408Scy	    [
1514282408Scy		#include <sys/timex.h>
1515282408Scy		#ifndef STA_FLL
1516282408Scy		# error
1517282408Scy		#endif
1518282408Scy	    ])],
1519280849Scy	[ntp_cv_var_sta_fll=yes],
1520280849Scy	[ntp_cv_var_sta_fll=no]
1521280849Scy    )]
1522280849Scy)
1523181834Sroberto
1524280849ScyAC_CACHE_CHECK(
1525280849Scy    [if we have kernel PLL support],
1526280849Scy    [ntp_cv_var_kernel_pll],
1527280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1528280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1529280849Scy	 *no*)
1530280849Scy	    ntp_cv_var_kernel_pll=no
1531280849Scy	    ;;
1532280849Scy	 *) ntp_cv_var_kernel_pll=yes
1533280849Scy	    ;;
1534280849Scy	esac
1535280849Scy    ]
1536280849Scy)
1537280849Scycase "$ntp_cv_var_kernel_pll" in
1538181834Sroberto yes)
1539280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1540280849Scy	[Does the kernel support precision time discipline?])
1541181834Srobertoesac
1542181834Sroberto
1543280849ScyAC_CACHE_CHECK(
1544280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1545280849Scy    [ntp_cv_size_returned_in_buffer],
1546280849Scy    [
1547280849Scy	ans=no
1548280849Scy	case "$host" in
1549280849Scy	 *-fujitsu-uxp*)
1550280849Scy	    ans=yes
1551280849Scy	    ;;
1552280849Scy	 *-ncr-sysv4*)
1553280849Scy	    ans=yes
1554280849Scy	    ;;
1555280849Scy	 *-univel-sysv*)
1556280849Scy	    ans=yes
1557280849Scy	    ;;
1558280849Scy	esac
1559280849Scy	ntp_cv_size_returned_in_buffer=$ans
1560280849Scy    ]
1561280849Scy)
1562280849Scycase "$ntp_cv_size_returned_in_buffer" in
1563280849Scy yes)
1564280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1565280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1566181834Srobertoesac
1567181834Sroberto
1568181834Sroberto# Check for ioctls TIOCGPPSEV
1569280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1570280849Scycase "$ac_cv_header_termios_h" in
1571280849Scy yes)
1572280849Scy    AC_PREPROC_IFELSE(
1573282408Scy	[AC_LANG_SOURCE([
1574280849Scy	    #include <termios.h>
1575280849Scy	    #ifndef TIOCGPPSEV
1576280849Scy	    # error
1577280849Scy	    #endif
1578282408Scy	])],
1579280849Scy	[ntp_ok=yes],
1580280849Scy	[ntp_ok=no]
1581280849Scy    )
1582280849Scy    ;;
1583280849Scy *)
1584280849Scy    ntp_ok=no
1585280849Scy    ;;
1586280849Scyesac
1587280849Scycase "$ntp_ok" in
1588280849Scy yes)
1589280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1590280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1591280849Scyesac
1592280849ScyAC_MSG_RESULT([$ntp_ok])
1593181834Sroberto
1594181834Sroberto# Check for ioctls TIOCSPPS
1595280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1596280849Scycase "$ac_cv_header_termios_h" in
1597280849Scy yes)
1598280849Scy    AC_PREPROC_IFELSE(
1599282408Scy	[AC_LANG_SOURCE([
1600280849Scy	    #include <termios.h>
1601280849Scy	    #ifndef TIOCSPPS
1602280849Scy	    # error
1603280849Scy	    #endif
1604282408Scy	 ])],
1605280849Scy	 [ntp_ok=yes],
1606280849Scy	 [ntp_ok=no]
1607280849Scy    )
1608280849Scy    ;;
1609280849Scy *)
1610181834Sroberto    ntp_ok=no
1611280849Scy    ;;
1612280849Scyesac
1613280849Scycase "$ntp_ok" in
1614280849Scy yes)
1615280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1616280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1617280849Scyesac
1618280849ScyAC_MSG_RESULT([$ntp_ok])
1619181834Sroberto
1620181834Sroberto# Check for ioctls CIOGETEV
1621280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1622280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1623280849Scy yes)
1624280849Scy    AC_PREPROC_IFELSE(
1625282408Scy	[AC_LANG_SOURCE([
1626280849Scy	    #include <sys/ppsclock.h>
1627280849Scy	    #ifndef CIOGETEV
1628280849Scy	    # error
1629280849Scy	    #endif
1630282408Scy	])],
1631280849Scy	[ntp_ok=yes],
1632280849Scy	[ntp_ok=no]
1633280849Scy    )
1634280849Scy    ;;
1635280849Scy *)
1636280849Scy    ntp_ok=no
1637280849Scy    ;;
1638280849Scyesac
1639280849Scycase "$ntp_ok" in
1640280849Scy yes)
1641280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1642280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1643280849Scyesac
1644280849ScyAC_MSG_RESULT([$ntp_ok])
1645181834Sroberto
1646181834Sroberto# ATOM/PPSAPI stuff.
1647181834Sroberto
1648280849Scyntp_atom_ok=yes
1649181834Sroberto
1650181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1651181834Sroberto
1652181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1653181834Sroberto# The PPSAPI needs struct timespec.
1654181834Sroberto# The PPSAPI also needs a timepps header.
1655181834Sroberto
1656280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1657181834Sroberto inlineyes)
1658181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1659181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1660181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1661280849Scy	ntp_jupiter_ok=yes
1662280849Scy	ntp_oncore_ok=yes
1663280849Scy	ntp_parse_ok=yes
1664280849Scy	ntp_ripe_ncc_ok=yes
1665181834Sroberto	;;
1666181834Sroberto    esac
1667181834Sroberto    ;;
1668181834Srobertoesac
1669181834Sroberto
1670181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1671280849ScyAC_CHECK_HEADER([linux/serial.h])
1672181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1673181834Sroberto  yesyes)
1674280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1675280849Scy    AC_PREPROC_IFELSE(
1676282408Scy	[AC_LANG_SOURCE([
1677280849Scy	    #include <sys/time.h>
1678280849Scy	    typedef int u_int;
1679280849Scy	    #include <sys/ppsclock.h>
1680280849Scy	    #include <linux/serial.h>
1681181834Sroberto
1682280849Scy	    #ifndef TIOCGSERIAL
1683280849Scy	    # error
1684280849Scy	    #endif
1685280849Scy	    #ifndef TIOCSSERIAL
1686280849Scy	    # error
1687280849Scy	    #endif
1688280849Scy	    #ifndef ASYNC_PPS_CD_POS
1689280849Scy	    # error
1690280849Scy	    #endif
1691280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1692280849Scy	    # error
1693280849Scy	    #endif
1694280849Scy	    #ifndef CIOGETEV
1695280849Scy	    # error
1696280849Scy	    #endif
1697282408Scy	])],
1698280849Scy	[ntp_ok=yes],
1699280849Scy	[ntp_ok=no]
1700280849Scy    )
1701280849Scy    AC_MSG_RESULT([$ntp_ok])
1702280849Scy    ;;
1703181834Sroberto  *)
1704280849Scy    ntp_ok=no
1705280849Scy    ;;
1706181834Srobertoesac
1707280849Scycase "$ntp_ok" in
1708280849Scy yes)
1709280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1710280849Scy	[Do we have the TIO serial stuff?])
1711280849Scyesac
1712181834Sroberto
1713181834Sroberto# Check for SHMEM_STATUS support
1714200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1715181834Srobertocase "$ac_cv_header_sys_mman_h" in
1716280849Scy yes)
1717280849Scy    ntp_ok=yes
1718280849Scy    ;;
1719280849Scy *)
1720280849Scy    ntp_ok=no
1721280849Scy    ;;
1722181834Srobertoesac
1723280849Scycase "$ntp_ok" in
1724280849Scy yes)
1725280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1726280849Scy	[Do we have support for SHMEM_STATUS?])
1727280849Scyesac
1728280849ScyAC_MSG_RESULT([$ntp_ok])
1729181834Sroberto
1730181834Srobertontp_refclock=no
1731181834Sroberto
1732181834Sroberto# HPUX only, and by explicit request
1733200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1734280849ScyAC_ARG_ENABLE(
1735280849Scy    [BANCOMM],
1736280849Scy    [AS_HELP_STRING(
1737280849Scy	[--enable-BANCOMM],
1738280849Scy	[- Datum/Bancomm bc635/VME interface]
1739280849Scy    )],
1740280849Scy    [ntp_ok=$enableval],
1741280849Scy    [ntp_ok=no]
1742280849Scy)
1743280849Scycase "$ntp_ok" in
1744280849Scy yes)
1745181834Sroberto    ntp_refclock=yes
1746280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1747280849Scy    ;;
1748280849Scyesac
1749280849ScyAC_MSG_RESULT([$ntp_ok])
1750181834Srobertocase "$ntp_ok$host" in
1751181834Sroberto yes*-*-hpux*) ;;
1752200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1753181834Srobertoesac
1754181834Sroberto
1755181834Sroberto#HPUX only, and only by explicit request
1756200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1757280849ScyAC_ARG_ENABLE(
1758280849Scy    [GPSVME],
1759280849Scy    [AS_HELP_STRING(
1760280849Scy	[--enable-GPSVME],
1761280849Scy	[- TrueTime GPS receiver/VME interface]
1762280849Scy    )],
1763280849Scy    [ntp_ok=$enableval],
1764280849Scy    [ntp_ok=no]
1765280849Scy)
1766280849Scycase "$ntp_ok" in
1767280849Scy yes)
1768181834Sroberto    ntp_refclock=yes
1769280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1770280849Scy    ;;
1771280849Scyesac
1772280849ScyAC_MSG_RESULT([$ntp_ok])
1773181834Srobertocase "$ntp_ok$host" in
1774181834Sroberto yes*-*-hpux*) ;;
1775200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1776181834Srobertoesac
1777181834Sroberto
1778200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1779181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1780181834Sroberto yesyesyes)
1781280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1782181834Sroberto    ans=yes
1783181834Sroberto    ;;
1784181834Sroberto *)
1785181834Sroberto    ans=no
1786181834Sroberto    ;;
1787181834Srobertoesac
1788200576SrobertoAC_MSG_RESULT([$ans])
1789181834Sroberto
1790200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1791280849ScyAC_ARG_ENABLE(
1792280849Scy    [all-clocks],
1793280849Scy    [AS_HELP_STRING(
1794280849Scy	[--enable-all-clocks],
1795280849Scy	[+ include all suitable non-PARSE clocks:]
1796280849Scy    )],
1797280849Scy    [ntp_eac=$enableval],
1798280849Scy    [ntp_eac=yes]
1799280849Scy)
1800280849ScyAC_MSG_RESULT([$ntp_eac])
1801181834Sroberto
1802280849Scy# HMS: Should we also require ntp_parse_ok?
1803200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1804280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1805181834Sroberto yes*yes*)
1806181834Sroberto    ntp_canparse=yes
1807181834Sroberto    ;;
1808181834Sroberto *) ntp_canparse=no
1809181834Sroberto    ;;
1810181834Srobertoesac
1811280849ScyAC_MSG_RESULT([$ntp_canparse])
1812181834Sroberto
1813181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1814181834Srobertocase "$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
1815181834Sroberto *yes*)
1816181834Sroberto    ntp_canaudio=yes
1817280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1818181834Sroberto    ;;
1819181834Sroberto *) ntp_canaudio=no ;;
1820181834Srobertoesac
1821280849ScyAC_MSG_RESULT([$ntp_canaudio])
1822181834Sroberto
1823181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1824181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1825181834Sroberto yesyes)
1826181834Sroberto    ntp_canshm=yes
1827181834Sroberto    ;;
1828181834Sroberto *) ntp_canshm=no ;;
1829181834Srobertoesac
1830280849ScyAC_MSG_RESULT([$ntp_canshm])
1831181834Sroberto
1832280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1833280849ScyAC_CACHE_CHECK(
1834280849Scy    [for termios modem control],
1835280849Scy    [ntp_cv_modem_control],
1836280849Scy    [AC_COMPILE_IFELSE(
1837280849Scy	[AC_LANG_PROGRAM(
1838280849Scy	    [[
1839280849Scy		#ifdef HAVE_UNISTD_H
1840280849Scy		# include <unistd.h>
1841280849Scy		#endif
1842280849Scy		#ifdef HAVE_TERMIOS_H
1843280849Scy		# include <termios.h>
1844280849Scy		#endif
1845280849Scy		#ifdef HAVE_SYS_IOCTL_H
1846280849Scy		# include <sys/ioctl.h>
1847280849Scy		#endif
1848280849Scy	    ]],
1849280849Scy	    [[
1850280849Scy		int	dtr = TIOCM_DTR;
1851280849Scy
1852280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1853280849Scy	    ]]
1854280849Scy	)],
1855280849Scy	[ntp_cv_modem_control=yes],
1856280849Scy	[ntp_cv_modem_control=no]
1857280849Scy    )]
1858280849Scy)
1859280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1860280849Scy yes::yes)
1861280849Scy    ntp_enable_all_modem_control_clocks=yes
1862280849Scy    ;;
1863280849Scy *)
1864280849Scy    ntp_enable_all_modem_control_clocks=no
1865280849Scy    ;;
1866280849Scyesac
1867280849Scy
1868181834Sroberto# Requires modem control
1869200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1870280849ScyAC_ARG_ENABLE(
1871280849Scy    [ACTS],
1872280849Scy    [AS_HELP_STRING(
1873280849Scy	[--enable-ACTS],
1874280849Scy	[s ACTS modem service]
1875280849Scy    )],
1876181834Sroberto    [ntp_ok=$enableval],
1877280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1878280849Scy)
1879280849Scycase "$ntp_ok" in
1880280849Scy yes)
1881181834Sroberto    ntp_refclock=yes
1882280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1883280849Scy    ;;
1884280849Scyesac
1885280849ScyAC_MSG_RESULT([$ntp_ok])
1886181834Sroberto
1887200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1888280849ScyAC_ARG_ENABLE(
1889280849Scy    [ARBITER],
1890280849Scy    [AS_HELP_STRING(
1891280849Scy	[--enable-ARBITER],
1892280849Scy	[+ Arbiter 1088A/B GPS receiver]
1893280849Scy    )],
1894280849Scy    [ntp_ok=$enableval],
1895280849Scy    [ntp_ok=$ntp_eac]
1896280849Scy)
1897280849Scycase "$ntp_ok" in
1898280849Scy yes)
1899181834Sroberto    ntp_refclock=yes
1900280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1901280849Scy    ;;
1902280849Scyesac
1903280849ScyAC_MSG_RESULT([$ntp_ok])
1904181834Sroberto
1905200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1906280849ScyAC_ARG_ENABLE(
1907280849Scy    [ARCRON_MSF],
1908280849Scy    [AS_HELP_STRING(
1909280849Scy	[--enable-ARCRON-MSF],
1910280849Scy	[+ Arcron MSF receiver]
1911280849Scy    )],
1912280849Scy    [ntp_ok=$enableval],
1913280849Scy    [ntp_ok=$ntp_eac]
1914280849Scy)
1915280849Scycase "$ntp_ok" in
1916280849Scy yes)
1917181834Sroberto    ntp_refclock=yes
1918280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1919280849Scy    ;;
1920280849Scyesac
1921280849ScyAC_MSG_RESULT([$ntp_ok])
1922181834Sroberto
1923200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1924280849ScyAC_ARG_ENABLE(
1925280849Scy    [AS2201],
1926280849Scy    [AS_HELP_STRING(
1927280849Scy	[--enable-AS2201],
1928280849Scy	[+ Austron 2200A/2201A GPS receiver]
1929280849Scy    )],
1930280849Scy    [ntp_ok=$enableval],
1931280849Scy    [ntp_ok=$ntp_eac]
1932280849Scy)
1933280849Scycase "$ntp_ok" in
1934280849Scy yes)
1935181834Sroberto    ntp_refclock=yes
1936280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1937280849Scy    ;;
1938280849Scyesac
1939280849ScyAC_MSG_RESULT([$ntp_ok])
1940181834Sroberto
1941200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1942280849ScyAC_ARG_ENABLE(
1943280849Scy    [ATOM],
1944280849Scy    [AS_HELP_STRING(
1945280849Scy	[--enable-ATOM],
1946280849Scy	[s ATOM PPS interface]
1947280849Scy    )],
1948280849Scy    [ntp_ok=$enableval],
1949280849Scy    [ntp_ok=$ntp_eac]
1950280849Scy)
1951280849Scycase "$ntp_atom_ok" in
1952181834Sroberto no) ntp_ok=no ;;
1953181834Srobertoesac
1954280849Scycase "$ntp_ok" in
1955280849Scy yes)
1956181834Sroberto    ntp_refclock=yes
1957280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1958280849Scy    ;;
1959280849Scyesac
1960280849ScyAC_MSG_RESULT([$ntp_ok])
1961181834Sroberto
1962200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1963280849ScyAC_ARG_ENABLE(
1964280849Scy    [CHRONOLOG],
1965280849Scy    [AS_HELP_STRING(
1966280849Scy	[--enable-CHRONOLOG],
1967280849Scy	[+ Chrono-log K-series WWVB receiver]
1968280849Scy    )],
1969280849Scy    [ntp_ok=$enableval],
1970280849Scy    [ntp_ok=$ntp_eac]
1971280849Scy)
1972280849Scycase "$ntp_ok" in
1973280849Scy yes)
1974181834Sroberto    ntp_refclock=yes
1975280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1976280849Scy    ;;
1977280849Scyesac
1978280849ScyAC_MSG_RESULT([$ntp_ok])
1979181834Sroberto
1980200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1981280849ScyAC_ARG_ENABLE(
1982280849Scy    [CHU],
1983280849Scy    [AS_HELP_STRING(
1984280849Scy	[--enable-CHU],
1985280849Scy	[+ CHU modem/decoder]
1986280849Scy    )],
1987280849Scy    [ntp_ok=$enableval],
1988280849Scy    [ntp_ok=$ntp_eac]
1989280849Scy)
1990280849Scycase "$ntp_ok" in
1991280849Scy yes)
1992181834Sroberto    ntp_refclock=yes
1993280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1994280849Scy    ;;
1995280849Scyesac
1996280849ScyAC_MSG_RESULT([$ntp_ok])
1997280849Scyntp_refclock_chu=$ntp_ok
1998181834Sroberto
1999200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2000280849ScyAC_ARG_ENABLE(
2001280849Scy    [AUDIO-CHU],
2002280849Scy    [AS_HELP_STRING(
2003280849Scy	[--enable-AUDIO-CHU],
2004280849Scy	[s CHU audio/decoder]
2005280849Scy    )],
2006181834Sroberto    [ntp_ok=$enableval],
2007280849Scy    [
2008280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2009280849Scy	 *no*)	ntp_ok=no  ;;
2010280849Scy	 *)	ntp_ok=yes ;;
2011280849Scy	esac
2012280849Scy    ]
2013280849Scy)
2014280849ScyAC_MSG_RESULT([$ntp_ok])
2015181834Sroberto# We used to check for sunos/solaris target...
2016280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2017280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2018181834Srobertoesac
2019181834Sroberto
2020181834Sroberto# Not under HP-UX
2021200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2022280849ScyAC_ARG_ENABLE(
2023280849Scy    [DATUM],
2024280849Scy    [AS_HELP_STRING(
2025280849Scy	[--enable-DATUM],
2026280849Scy	[s Datum Programmable Time System]
2027280849Scy    )],
2028181834Sroberto    [ntp_ok=$enableval],
2029280849Scy    [
2030280849Scy	case "$ac_cv_header_termios_h" in
2031280849Scy	 yes)
2032280849Scy	    ntp_ok=$ntp_eac
2033280849Scy	    ;;
2034280849Scy	 *) ntp_ok=no
2035280849Scy	    ;;
2036280849Scy	esac
2037280849Scy    ]
2038280849Scy)
2039280849Scycase "$ntp_ok" in
2040280849Scy yes)
2041181834Sroberto    ntp_refclock=yes
2042280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2043280849Scy    ;;
2044280849Scyesac
2045280849ScyAC_MSG_RESULT([$ntp_ok])
2046181834Sroberto
2047200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2048280849ScyAC_ARG_ENABLE(
2049280849Scy    [DUMBCLOCK],
2050280849Scy    [AS_HELP_STRING(
2051280849Scy	[--enable-DUMBCLOCK],
2052280849Scy	[+ Dumb generic hh:mm:ss local clock]
2053280849Scy    )],
2054280849Scy    [ntp_ok=$enableval],
2055280849Scy    [ntp_ok=$ntp_eac]
2056280849Scy)
2057280849Scycase "$ntp_ok" in
2058280849Scy yes)
2059181834Sroberto    ntp_refclock=yes
2060280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2061280849Scy    ;;
2062280849Scyesac
2063280849ScyAC_MSG_RESULT([$ntp_ok])
2064181834Sroberto
2065200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2066280849ScyAC_ARG_ENABLE(
2067280849Scy    [FG],
2068280849Scy    [AS_HELP_STRING(
2069280849Scy	[--enable-FG],
2070280849Scy	[+ Forum Graphic GPS]
2071280849Scy    )],
2072280849Scy    [ntp_ok=$enableval],
2073280849Scy    [ntp_ok=$ntp_eac]
2074280849Scy)
2075280849Scycase "$ntp_ok" in
2076280849Scy yes)
2077181834Sroberto    ntp_refclock=yes
2078280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2079280849Scy    ;;
2080280849Scyesac
2081280849ScyAC_MSG_RESULT([$ntp_ok])
2082181834Sroberto
2083181834Sroberto# Requires modem control
2084200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2085280849ScyAC_ARG_ENABLE(
2086280849Scy    [HEATH],
2087280849Scy    [AS_HELP_STRING(
2088280849Scy	[--enable-HEATH],
2089280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2090280849Scy    )],
2091181834Sroberto    [ntp_ok=$enableval],
2092280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2093280849Scy)
2094280849Scycase "$ntp_ok" in
2095280849Scy yes)
2096181834Sroberto    ntp_refclock=yes
2097280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2098280849Scy    ;;
2099280849Scyesac
2100280849ScyAC_MSG_RESULT([$ntp_ok])
2101181834Sroberto
2102200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2103280849ScyAC_ARG_ENABLE(
2104280849Scy    [HOPFSERIAL],
2105280849Scy    [AS_HELP_STRING(
2106280849Scy	[--enable-HOPFSERIAL],
2107280849Scy	[+ hopf serial clock device]
2108280849Scy    )],
2109280849Scy    [ntp_ok=$enableval],
2110280849Scy    [ntp_ok=$ntp_eac]
2111280849Scy)
2112280849Scycase "$ntp_ok" in
2113280849Scy yes)
2114181834Sroberto    ntp_refclock=yes
2115280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2116280849Scy    ;;
2117280849Scyesac
2118280849ScyAC_MSG_RESULT([$ntp_ok])
2119181834Sroberto
2120200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2121280849ScyAC_ARG_ENABLE(
2122280849Scy    [HOPFPCI],
2123280849Scy    [AS_HELP_STRING(
2124280849Scy	[--enable-HOPFPCI],
2125280849Scy	[+ hopf 6039 PCI board]
2126280849Scy    )],
2127280849Scy    [ntp_ok=$enableval],
2128280849Scy    [ntp_ok=$ntp_eac]
2129280849Scy)
2130280849Scycase "$ntp_ok" in
2131280849Scy yes)
2132181834Sroberto    ntp_refclock=yes
2133280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2134280849Scy    ;;
2135280849Scyesac
2136280849ScyAC_MSG_RESULT([$ntp_ok])
2137181834Sroberto
2138200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2139280849ScyAC_ARG_ENABLE(
2140280849Scy    [HPGPS],
2141280849Scy    [AS_HELP_STRING(
2142280849Scy	[--enable-HPGPS],
2143280849Scy	[+ HP 58503A GPS receiver]
2144280849Scy    )],
2145280849Scy    [ntp_ok=$enableval],
2146280849Scy    [ntp_ok=$ntp_eac]
2147280849Scy)
2148280849Scycase "$ntp_ok" in
2149280849Scy yes)
2150181834Sroberto    ntp_refclock=yes
2151280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2152280849Scy    ;;
2153280849Scyesac
2154280849ScyAC_MSG_RESULT([$ntp_ok])
2155181834Sroberto
2156200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2157280849ScyAC_ARG_ENABLE(
2158280849Scy    [IRIG],
2159280849Scy    [AS_HELP_STRING(
2160280849Scy	[--enable-IRIG],
2161280849Scy	[s IRIG audio decoder]
2162280849Scy    )],
2163181834Sroberto    [ntp_ok=$enableval],
2164280849Scy    [
2165280849Scy	case "$ntp_eac$ntp_canaudio" in
2166280849Scy	 *no*)	ntp_ok=no  ;;
2167280849Scy	 *)	ntp_ok=yes ;;
2168280849Scy	esac
2169280849Scy    ]
2170280849Scy)
2171280849Scycase "$ntp_ok" in
2172280849Scy yes)
2173181834Sroberto    ntp_refclock=yes
2174280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2175280849Scy    ;;
2176280849Scyesac
2177280849ScyAC_MSG_RESULT([$ntp_ok])
2178181834Srobertocase "$ntp_ok$ntp_canaudio" in
2179280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2180181834Srobertoesac
2181181834Sroberto
2182200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2183280849ScyAC_ARG_ENABLE(
2184280849Scy    [JJY],
2185280849Scy    [AS_HELP_STRING(
2186280849Scy	[--enable-JJY],
2187280849Scy	[+ JJY receiver]
2188280849Scy    )],
2189280849Scy    [ntp_ok=$enableval],
2190280849Scy    [ntp_ok=$ntp_eac]
2191280849Scy)
2192280849Scycase "$ntp_ok" in
2193280849Scy yes)
2194181834Sroberto    ntp_refclock=yes
2195280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2196280849Scy    ;;
2197280849Scyesac
2198280849ScyAC_MSG_RESULT([$ntp_ok])
2199181834Sroberto
2200200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2201280849ScyAC_ARG_ENABLE(
2202280849Scy    [JUPITER],
2203280849Scy    [AS_HELP_STRING(
2204280849Scy	[--enable-JUPITER],
2205280849Scy	[s Rockwell Jupiter GPS receiver]
2206280849Scy    )],
2207181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2208280849Scycase "$ntp_jupiter_ok" in
2209181834Sroberto no) ntp_ok=no ;;
2210181834Srobertoesac
2211280849Scycase "$ntp_ok" in
2212280849Scy yes)
2213181834Sroberto    ntp_refclock=yes
2214280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2215280849Scy    ;;
2216280849Scyesac
2217280849ScyAC_MSG_RESULT([$ntp_ok])
2218181834Sroberto
2219200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2220280849ScyAC_ARG_ENABLE(
2221280849Scy    [LEITCH],
2222280849Scy    [AS_HELP_STRING(
2223280849Scy	[--enable-LEITCH],
2224280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2225280849Scy    )],
2226280849Scy    [ntp_ok=$enableval],
2227280849Scy    [ntp_ok=$ntp_eac]
2228280849Scy)
2229280849Scycase "$ntp_ok" in
2230280849Scy yes)
2231181834Sroberto    ntp_refclock=yes
2232280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2233280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2234280849Scy    ;;
2235280849Scyesac
2236280849ScyAC_MSG_RESULT([$ntp_ok])
2237181834Sroberto
2238200576SrobertoAC_MSG_CHECKING([local clock reference])
2239280849ScyAC_ARG_ENABLE(
2240280849Scy    [LOCAL-CLOCK],
2241280849Scy    [AS_HELP_STRING(
2242280849Scy	[--enable-LOCAL-CLOCK],
2243280849Scy	[+ local clock reference]
2244280849Scy    )],
2245280849Scy    [ntp_ok=$enableval],
2246280849Scy    [ntp_ok=$ntp_eac]
2247280849Scy)
2248280849Scycase "$ntp_ok" in
2249280849Scy yes)
2250181834Sroberto    ntp_refclock=yes
2251280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2252280849Scy    ;;
2253280849Scyesac
2254280849ScyAC_MSG_RESULT([$ntp_ok])
2255181834Sroberto
2256181834Srobertodnl Bug 340: longstanding unfixed bugs
2257280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2258280849Scydnl AC_ARG_ENABLE([MSFEES],
2259280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2260181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2261181834Srobertodnl if test "$ntp_ok" = "yes"; then
2262181834Srobertodnl     ntp_refclock=yes
2263280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2264181834Srobertodnl fi
2265280849Scydnl AC_MSG_RESULT([$ntp_ok])
2266181834Sroberto
2267181834Sroberto# Not Ultrix
2268200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2269280849ScyAC_ARG_ENABLE(
2270280849Scy    [MX4200],
2271280849Scy    [AS_HELP_STRING(
2272280849Scy	[--enable-MX4200 ],
2273280849Scy	[s Magnavox MX4200 GPS receiver]
2274280849Scy    )],
2275181834Sroberto    [ntp_ok=$enableval],
2276280849Scy    [
2277280849Scy	case "$ac_cv_var_ppsclock" in
2278280849Scy	 yes)
2279280849Scy	    ntp_ok=$ntp_eac
2280280849Scy	    ;;
2281280849Scy	 *)
2282280849Scy	    ntp_ok=no
2283280849Scy	    ;;
2284280849Scy	esac
2285280849Scy    ]
2286280849Scy)
2287280849Scycase "$ntp_ok" in
2288280849Scy yes)
2289181834Sroberto    ntp_refclock=yes
2290280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2291280849Scy    ;;
2292280849Scyesac
2293280849ScyAC_MSG_RESULT([$ntp_ok])
2294181834Srobertocase "$ntp_ok$host" in
2295280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2296181834Srobertoesac
2297181834Sroberto
2298200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2299280849ScyAC_ARG_ENABLE(
2300280849Scy    [NEOCLOCK4X],
2301280849Scy    [AS_HELP_STRING(
2302280849Scy	[--enable-NEOCLOCK4X],
2303280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2304280849Scy    )],
2305280849Scy    [ntp_ok=$enableval],
2306280849Scy    [ntp_ok=$ntp_eac]
2307280849Scy)
2308280849Scycase "$ntp_ok" in
2309280849Scy yes)
2310181834Sroberto    ntp_refclock=yes
2311280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2312280849Scy    ;;
2313280849Scyesac
2314280849ScyAC_MSG_RESULT([$ntp_ok])
2315181834Sroberto
2316200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2317280849ScyAC_ARG_ENABLE(
2318280849Scy    [NMEA],
2319280849Scy    [AS_HELP_STRING(
2320280849Scy	[--enable-NMEA],
2321280849Scy	[+ NMEA GPS receiver]
2322280849Scy    )],
2323280849Scy    [ntp_ok=$enableval],
2324280849Scy    [ntp_ok=$ntp_eac]
2325280849Scy)
2326280849Scycase "$ntp_ok" in
2327280849Scy yes)
2328181834Sroberto    ntp_refclock=yes
2329280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2330280849Scy    ;;
2331280849Scyesac
2332280849ScyAC_MSG_RESULT([$ntp_ok])
2333181834Sroberto
2334280849ScyAC_CHECK_FUNCS([strtoll])
2335280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2336280849ScyAC_ARG_ENABLE(
2337280849Scy    [GPSD],
2338280849Scy    [AS_HELP_STRING(
2339280849Scy	[--enable-GPSD],
2340280849Scy	[+ GPSD JSON receiver]
2341280849Scy    )],
2342280849Scy    [ntp_ok=$enableval],
2343280849Scy    [case "$ac_cv_func_strtoll" in
2344280849Scy     yes) ntp_ok=$ntp_eac ;;
2345280849Scy     *)   ntp_ok="no" ;;
2346280849Scy    esac]
2347280849Scy)
2348280849Scycase "$ntp_ok" in
2349280849Scy yes)
2350280849Scy    ntp_refclock=yes
2351280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2352280849Scy    ;;
2353280849Scyesac
2354280849ScyAC_MSG_RESULT([$ntp_ok])
2355280849Scy
2356200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2357280849ScyAC_ARG_ENABLE(
2358280849Scy    [ONCORE],
2359280849Scy    [AS_HELP_STRING(
2360280849Scy	[--enable-ONCORE],
2361280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2362280849Scy    )],
2363280849Scy    [ntp_ok=$enableval],
2364280849Scy    [ntp_ok=$ntp_eac]
2365280849Scy)
2366280849Scycase "$ntp_oncore_ok" in
2367181834Sroberto no) ntp_ok=no ;;
2368181834Srobertoesac
2369280849Scycase "$ntp_ok" in
2370280849Scy yes)
2371181834Sroberto    ntp_refclock=yes
2372280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2373280849Scy    ;;
2374280849Scyesac
2375280849ScyAC_MSG_RESULT([$ntp_ok])
2376181834Sroberto
2377280849Scy# Requires modem control
2378200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2379280849ScyAC_ARG_ENABLE(
2380280849Scy    [PALISADE],
2381280849Scy    [AS_HELP_STRING(
2382280849Scy	[--enable-PALISADE],
2383280849Scy	[s Palisade clock]
2384280849Scy    )],
2385181834Sroberto    [ntp_ok=$enableval],
2386280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2387280849Scy)
2388280849Scycase "$ntp_ok" in
2389280849Scy yes)
2390181834Sroberto    ntp_refclock=yes
2391280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2392280849Scy    ;;
2393280849Scyesac
2394280849ScyAC_MSG_RESULT([$ntp_ok])
2395181834Sroberto
2396200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2397280849ScyAC_ARG_ENABLE(
2398280849Scy    [PCF],
2399280849Scy    [AS_HELP_STRING(
2400280849Scy	[--enable-PCF ],
2401280849Scy	[+ Conrad parallel port radio clock]
2402280849Scy    )],
2403280849Scy    [ntp_ok=$enableval],
2404280849Scy    [ntp_ok=$ntp_eac]
2405280849Scy)
2406280849Scycase "$ntp_ok" in
2407280849Scy yes)
2408181834Sroberto    ntp_refclock=yes
2409280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2410280849Scy    ;;
2411280849Scyesac
2412280849ScyAC_MSG_RESULT([$ntp_ok])
2413181834Sroberto
2414200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2415280849ScyAC_ARG_ENABLE(
2416280849Scy    [PST],
2417280849Scy    [AS_HELP_STRING(
2418280849Scy	[--enable-PST],
2419280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2420280849Scy    )],
2421280849Scy    [ntp_ok=$enableval],
2422280849Scy    [ntp_ok=$ntp_eac]
2423280849Scy)
2424280849Scycase "$ntp_ok" in
2425280849Scy yes)
2426181834Sroberto    ntp_refclock=yes
2427280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2428280849Scy    ;;
2429280849Scyesac
2430280849ScyAC_MSG_RESULT([$ntp_ok])
2431181834Sroberto
2432200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2433280849ScyAC_ARG_ENABLE(
2434280849Scy    [RIPENCC],
2435280849Scy    [AS_HELP_STRING(
2436280849Scy	[--enable-RIPENCC],
2437280849Scy	[- RIPENCC specific Trimble driver]
2438280849Scy    )],
2439280849Scy    [ntp_ok=$enableval],
2440280849Scy    [ntp_ok=no]
2441280849Scy)
2442181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2443280849Scycase "$ntp_ripe_ncc_ok" in
2444181834Sroberto no) ntp_ok=no ;;
2445181834Srobertoesac
2446280849Scycase "$ntp_ok" in
2447280849Scy yes)
2448181834Sroberto    ntp_refclock=yes
2449280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2450280849Scy    ;;
2451280849Scyesac
2452280849ScyAC_MSG_RESULT([$ntp_ok])
2453181834Sroberto
2454181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2455181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2456200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2457280849ScyAC_ARG_ENABLE(
2458280849Scy    [SHM],
2459280849Scy    [AS_HELP_STRING(
2460280849Scy	[--enable-SHM],
2461280849Scy	[s SHM clock attached thru shared memory]
2462280849Scy    )],
2463181834Sroberto    [ntp_ok=$enableval],
2464280849Scy    [
2465280849Scy	case "$ntp_eac$ntp_canshm" in
2466280849Scy	 *no*)	ntp_ok=no  ;;
2467280849Scy	 *)	ntp_ok=yes ;;
2468280849Scy	esac
2469280849Scy    ]
2470280849Scy)
2471280849Scycase "$ntp_ok" in
2472280849Scy yes)
2473181834Sroberto    ntp_refclock=yes
2474280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2475280849Scy    ;;
2476280849Scyesac
2477280849ScyAC_MSG_RESULT([$ntp_ok])
2478181834Sroberto
2479200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2480280849ScyAC_ARG_ENABLE(
2481280849Scy    [SPECTRACOM],
2482280849Scy    [AS_HELP_STRING(
2483280849Scy	[--enable-SPECTRACOM],
2484280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2485280849Scy    )],
2486280849Scy    [ntp_ok=$enableval],
2487280849Scy    [ntp_ok=$ntp_eac]
2488280849Scy)
2489280849Scycase "$ntp_ok" in
2490280849Scy yes)
2491181834Sroberto    ntp_refclock=yes
2492280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2493280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2494280849Scy    ;;
2495280849Scyesac
2496280849ScyAC_MSG_RESULT([$ntp_ok])
2497181834Sroberto
2498200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2499280849ScyAC_ARG_ENABLE(
2500280849Scy    [TPRO],
2501280849Scy    [AS_HELP_STRING(
2502280849Scy	[--enable-TPRO],
2503280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2504280849Scy    )],
2505181834Sroberto    [ntp_ok=$enableval],
2506280849Scy    [
2507280849Scy	case "$ac_cv_header_sys_tpro_h" in
2508280849Scy	 yes)
2509280849Scy	    ntp_ok=$ntp_eac
2510280849Scy	    ;;
2511280849Scy	 *)
2512280849Scy	    ntp_ok=no
2513280849Scy	    ;;
2514280849Scy	esac
2515280849Scy    ]
2516280849Scy)
2517280849Scycase "$ntp_ok" in
2518280849Scy yes)
2519181834Sroberto    ntp_refclock=yes
2520280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2521280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2522280849Scy    ;;
2523280849Scyesac
2524280849ScyAC_MSG_RESULT([$ntp_ok])
2525181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2526280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2527181834Srobertoesac
2528181834Sroberto
2529181834Sroberto# Not on a vax-dec-bsd
2530200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2531280849ScyAC_ARG_ENABLE(
2532280849Scy    [TRUETIME],
2533280849Scy    [AS_HELP_STRING(
2534280849Scy	[--enable-TRUETIME],
2535280849Scy	[s Kinemetrics/TrueTime receivers]
2536280849Scy    )],
2537181834Sroberto    [ntp_ok=$enableval],
2538280849Scy    [
2539280849Scy	case "$host" in
2540280849Scy	 vax-dec-bsd)
2541280849Scy	    ntp_ok=no
2542280849Scy	    ;;
2543280849Scy	 *)
2544280849Scy	    ntp_ok=$ntp_eac
2545280849Scy	    ;;
2546280849Scy	esac
2547280849Scy    ]
2548280849Scy)    
2549280849Scycase "$ntp_ok" in
2550280849Scy yes)
2551181834Sroberto    ntp_refclock=yes
2552280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2553280849Scy    ;;
2554280849Scyesac
2555280849ScyAC_MSG_RESULT([$ntp_ok])
2556181834Srobertocase "$ntp_ok$host" in
2557280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2558181834Srobertoesac
2559181834Sroberto
2560200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2561280849ScyAC_ARG_ENABLE(
2562280849Scy    [TT560],
2563280849Scy    [AS_HELP_STRING(
2564280849Scy	[--enable-TT560],
2565280849Scy	[- TrueTime 560 IRIG-B decoder]
2566280849Scy    )],
2567280849Scy    [ntp_ok=$enableval],
2568280849Scy    [ntp_ok=no]
2569280849Scy)
2570280849Scycase "$ntp_ok" in
2571280849Scy yes)
2572181834Sroberto    ntp_refclock=yes
2573280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2574280849Scy    ;;
2575280849Scyesac
2576280849ScyAC_MSG_RESULT([$ntp_ok])
2577181834Sroberto
2578200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2579280849ScyAC_ARG_ENABLE(
2580280849Scy    [ULINK],
2581280849Scy    [AS_HELP_STRING(
2582280849Scy	[--enable-ULINK],
2583280849Scy	[+ Ultralink WWVB receiver]
2584280849Scy    )],
2585280849Scy    [ntp_ok=$enableval],
2586280849Scy    [ntp_ok=$ntp_eac]
2587280849Scy)
2588280849Scycase "$ntp_ok" in
2589280849Scy yes)
2590181834Sroberto    ntp_refclock=yes
2591280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2592280849Scy    ;;
2593280849Scyesac
2594280849ScyAC_MSG_RESULT([$ntp_ok])
2595181834Sroberto
2596280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2597280849ScyAC_ARG_ENABLE(
2598280849Scy    [TSYNCPCI],
2599280849Scy    [AS_HELP_STRING(
2600280849Scy	[--enable-TSYNCPCI],
2601280849Scy	[s Spectracom TSYNC timing board]
2602280849Scy    )],
2603280849Scy    [ntp_ok=$enableval],
2604280849Scy    [
2605280849Scy	case "$host" in
2606280849Scy	 *-*-*linux*)
2607280849Scy	    ntp_ok=$ntp_eac
2608280849Scy	    ;;
2609280849Scy	 *)
2610280849Scy	    ntp_ok=no
2611280849Scy	esac
2612280849Scy    ]
2613280849Scy)
2614280849Scycase "$ntp_ok" in
2615280849Scy yes)
2616280849Scy    ntp_refclock=yes
2617280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2618280849Scy    ;;
2619280849Scyesac
2620280849ScyAC_MSG_RESULT([$ntp_ok])
2621280849Scy
2622200576SrobertoAC_MSG_CHECKING([WWV receiver])
2623280849ScyAC_ARG_ENABLE(
2624280849Scy    [WWV],
2625280849Scy    [AS_HELP_STRING(
2626280849Scy	[--enable-WWV],
2627280849Scy	[s WWV Audio receiver]
2628280849Scy    )],
2629181834Sroberto    [ntp_ok=$enableval],
2630280849Scy    [
2631280849Scy	case "$ntp_eac$ntp_canaudio" in
2632280849Scy	 *no*)	ntp_ok=no  ;;
2633280849Scy	 *)	ntp_ok=yes ;;
2634280849Scy	esac
2635280849Scy    ]
2636280849Scy)
2637280849Scycase "$ntp_ok" in
2638280849Scy yes)
2639181834Sroberto    ntp_refclock=yes
2640280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2641280849Scy    ;;
2642280849Scyesac
2643280849ScyAC_MSG_RESULT([$ntp_ok])
2644181834Srobertocase "$ntp_ok$ntp_canaudio" in
2645280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2646181834Srobertoesac
2647181834Sroberto
2648200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2649280849ScyAC_ARG_ENABLE(
2650280849Scy    [ZYFER],
2651280849Scy    [AS_HELP_STRING(
2652280849Scy	[--enable-ZYFER],
2653280849Scy	[+ Zyfer GPStarplus receiver]
2654280849Scy    )],
2655280849Scy    [ntp_ok=$enableval],
2656280849Scy    [ntp_ok=$ntp_eac]
2657280849Scy)
2658280849Scycase "$ntp_ok" in
2659280849Scy yes)
2660181834Sroberto    ntp_refclock=yes
2661280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2662280849Scy    ;;
2663280849Scyesac
2664280849ScyAC_MSG_RESULT([$ntp_ok])
2665181834Sroberto
2666200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2667280849ScyAC_ARG_ENABLE(
2668280849Scy    [parse-clocks],
2669280849Scy    [AS_HELP_STRING(
2670280849Scy	[--enable-parse-clocks],
2671280849Scy	[- include all suitable PARSE clocks:]
2672280849Scy    )],
2673181834Sroberto    [ntp_eapc=$enableval],
2674280849Scy    [
2675280849Scy	case "$ntp_eac" in
2676280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2677280849Scy	 *)	ntp_eapc=no ;;
2678280849Scy	esac
2679280849Scy	# Delete the next line one of these days
2680280849Scy	ntp_eapc=no
2681280849Scy    ]
2682280849Scy)
2683181834SrobertoAC_MSG_RESULT($ntp_eapc)
2684181834Sroberto
2685181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2686181834Sroberto noyes*)
2687200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2688181834Sroberto    ;;
2689181834Sroberto yesyesno)
2690200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2691181834Sroberto    ;;
2692181834Srobertoesac
2693181834Sroberto
2694181834Srobertontp_libparse=no
2695181834Srobertontp_parseutil=no
2696181834Srobertontp_rawdcf=no
2697181834Sroberto
2698200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2699280849ScyAC_ARG_ENABLE(
2700280849Scy    [COMPUTIME],
2701280849Scy    [AS_HELP_STRING(
2702280849Scy	[--enable-COMPUTIME],
2703280849Scy	[s Diem Computime Radio Clock]
2704280849Scy    )],
2705280849Scy    [ntp_ok=$enableval],
2706280849Scy    [ntp_ok=$ntp_eapc]
2707280849Scy)
2708280849Scycase "$ntp_ok" in
2709280849Scy yes)
2710181834Sroberto    ntp_libparse=yes
2711181834Sroberto    ntp_refclock=yes
2712280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2713280849Scy    ;;
2714280849Scyesac
2715280849ScyAC_MSG_RESULT([$ntp_ok])
2716181834Srobertocase "$ntp_ok$ntp_canparse" in
2717181834Sroberto yesno)
2718200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2719181834Srobertoesac
2720181834Sroberto
2721200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2722280849ScyAC_ARG_ENABLE(
2723280849Scy    [DCF7000],
2724280849Scy    [AS_HELP_STRING(
2725280849Scy	[--enable-DCF7000],
2726280849Scy	[s ELV/DCF7000 clock]
2727280849Scy    )],
2728280849Scy    [ntp_ok=$enableval],
2729280849Scy    [ntp_ok=$ntp_eapc]
2730280849Scy)
2731280849Scycase "$ntp_ok" in
2732280849Scy yes)
2733181834Sroberto    ntp_libparse=yes
2734181834Sroberto    ntp_refclock=yes
2735280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2736280849Scy    ;;
2737280849Scyesac
2738280849ScyAC_MSG_RESULT([$ntp_ok])
2739181834Srobertocase "$ntp_ok$ntp_canparse" in
2740181834Sroberto yesno)
2741200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2742181834Srobertoesac
2743181834Sroberto
2744200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2745280849ScyAC_ARG_ENABLE(
2746280849Scy    [HOPF6021],
2747280849Scy    [AS_HELP_STRING(
2748280849Scy	[--enable-HOPF6021],
2749280849Scy	[s HOPF 6021 clock]
2750280849Scy    )],
2751280849Scy    [ntp_ok=$enableval],
2752280849Scy    [ntp_ok=$ntp_eapc]
2753280849Scy)
2754280849Scycase "$ntp_ok" in
2755280849Scy yes)
2756181834Sroberto    ntp_libparse=yes
2757181834Sroberto    ntp_refclock=yes
2758280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2759280849Scy    ;;
2760280849Scyesac
2761280849ScyAC_MSG_RESULT([$ntp_ok])
2762181834Srobertocase "$ntp_ok$ntp_canparse" in
2763181834Sroberto yesno)
2764200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2765181834Srobertoesac
2766181834Sroberto
2767200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2768280849ScyAC_ARG_ENABLE(
2769280849Scy    [MEINBERG],
2770280849Scy    [AS_HELP_STRING(
2771280849Scy	[--enable-MEINBERG],
2772280849Scy	[s Meinberg clocks]
2773280849Scy    )],
2774280849Scy    [ntp_ok=$enableval],
2775280849Scy    [ntp_ok=$ntp_eapc]
2776280849Scy)
2777280849Scycase "$ntp_ok" in
2778280849Scy yes)
2779181834Sroberto    ntp_libparse=yes
2780181834Sroberto    ntp_refclock=yes
2781280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2782280849Scy    ;;
2783280849Scyesac
2784280849ScyAC_MSG_RESULT([$ntp_ok])
2785181834Srobertocase "$ntp_ok$ntp_canparse" in
2786181834Sroberto yesno)
2787200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2788181834Srobertoesac
2789181834Sroberto
2790200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2791280849ScyAC_ARG_ENABLE(
2792280849Scy    [RAWDCF],
2793280849Scy    [AS_HELP_STRING(
2794280849Scy	[--enable-RAWDCF],
2795280849Scy	[s DCF77 raw time code]
2796280849Scy    )],
2797280849Scy    [ntp_ok=$enableval],
2798280849Scy    [ntp_ok=$ntp_eapc]
2799280849Scy)
2800280849Scycase "$ntp_ok" in
2801280849Scy yes)
2802181834Sroberto    ntp_libparse=yes
2803181834Sroberto    ntp_parseutil=yes
2804181834Sroberto    ntp_refclock=yes
2805181834Sroberto    ntp_rawdcf=yes
2806280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2807280849Scy    ;;
2808280849Scyesac
2809280849ScyAC_MSG_RESULT([$ntp_ok])
2810181834Srobertocase "$ntp_ok$ntp_canparse" in
2811181834Sroberto yesno)
2812280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2813181834Srobertoesac
2814181834Sroberto
2815181834Srobertocase "$ntp_rawdcf" in
2816181834Sroberto yes)
2817200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2818280849Scy	[ntp_cv_rawdcf_parity],
2819280849Scy	[
2820280849Scy	    ans=no
2821280849Scy	    case "$host" in
2822280849Scy	     *-*-*linux*)
2823280849Scy		ans=yes
2824280849Scy		;;
2825280849Scy	    esac
2826280849Scy	    ntp_cv_rawdcf_parity=$ans
2827280849Scy	]
2828280849Scy    )
2829280849Scy    case "$ntp_cv_rawdcf_parity" in
2830280849Scy     yes)
2831280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2832280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2833181834Sroberto    esac
2834181834Srobertoesac
2835181834Sroberto
2836200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2837280849ScyAC_ARG_ENABLE(
2838280849Scy    [RCC8000],
2839280849Scy    [AS_HELP_STRING(
2840280849Scy	[--enable-RCC8000],
2841280849Scy	[s RCC 8000 clock]
2842280849Scy    )],
2843280849Scy    [ntp_ok=$enableval],
2844280849Scy    [ntp_ok=$ntp_eapc]
2845280849Scy)
2846280849Scycase "$ntp_ok" in
2847280849Scy yes)
2848181834Sroberto    ntp_libparse=yes
2849181834Sroberto    ntp_refclock=yes
2850280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2851280849Scy    ;;
2852280849Scyesac
2853280849ScyAC_MSG_RESULT([$ntp_ok])
2854181834Srobertocase "$ntp_ok$ntp_canparse" in
2855181834Sroberto yesno)
2856280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2857181834Srobertoesac
2858181834Sroberto
2859200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2860280849ScyAC_ARG_ENABLE(
2861280849Scy    [SCHMID],
2862280849Scy    [AS_HELP_STRING(
2863280849Scy	[--enable-SCHMID ],
2864280849Scy	[s Schmid DCF77 clock]
2865280849Scy    )],
2866280849Scy    [ntp_ok=$enableval],
2867280849Scy    [ntp_ok=$ntp_eapc]
2868280849Scy)
2869280849Scycase "$ntp_ok" in
2870280849Scy yes)
2871181834Sroberto    ntp_libparse=yes
2872181834Sroberto    ntp_refclock=yes
2873280849Scy    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2874280849Scy    ;;
2875280849Scyesac
2876280849ScyAC_MSG_RESULT([$ntp_ok])
2877181834Srobertocase "$ntp_ok$ntp_canparse" in
2878181834Sroberto yesno)
2879280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2880181834Srobertoesac
2881181834Sroberto
2882200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2883280849ScyAC_ARG_ENABLE(
2884280849Scy    [TRIMTAIP],
2885280849Scy    [AS_HELP_STRING(
2886280849Scy	[--enable-TRIMTAIP],
2887280849Scy	[s Trimble GPS receiver/TAIP protocol]
2888280849Scy    )],
2889280849Scy    [ntp_ok=$enableval],
2890280849Scy    [ntp_ok=$ntp_eapc]
2891280849Scy)
2892280849Scycase "$ntp_ok" in
2893280849Scy yes)
2894181834Sroberto    ntp_libparse=yes
2895181834Sroberto    ntp_refclock=yes
2896280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2897280849Scy	[Trimble GPS receiver/TAIP protocol])
2898280849Scy    ;;
2899280849Scyesac
2900280849ScyAC_MSG_RESULT([$ntp_ok])
2901181834Srobertocase "$ntp_ok$ntp_canparse" in
2902181834Sroberto yesno)
2903280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2904181834Srobertoesac
2905181834Sroberto
2906200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2907280849ScyAC_ARG_ENABLE(
2908280849Scy    [TRIMTSIP],
2909280849Scy    [AS_HELP_STRING(
2910280849Scy	[--enable-TRIMTSIP],
2911280849Scy	[s Trimble GPS receiver/TSIP protocol]
2912280849Scy    )],
2913280849Scy    [ntp_ok=$enableval],
2914280849Scy    [ntp_ok=$ntp_eapc]
2915280849Scy)
2916280849Scycase "$ntp_ok" in
2917280849Scy yes)
2918181834Sroberto    ntp_libparse=yes
2919181834Sroberto    ntp_refclock=yes
2920280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2921280849Scy	[Trimble GPS receiver/TSIP protocol])
2922280849Scy    ;;
2923280849Scyesac
2924280849ScyAC_MSG_RESULT([$ntp_ok])
2925181834Srobertocase "$ntp_ok$ntp_canparse" in
2926181834Sroberto yesno)
2927280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2928181834Srobertoesac
2929181834Sroberto
2930200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2931280849ScyAC_ARG_ENABLE(
2932280849Scy    [WHARTON],
2933280849Scy    [AS_HELP_STRING(
2934280849Scy	[--enable-WHARTON],
2935280849Scy	[s WHARTON 400A Series clock]
2936280849Scy    )],
2937280849Scy    [ntp_ok=$enableval],
2938280849Scy    [ntp_ok=$ntp_eapc]
2939280849Scy)
2940280849Scycase "$ntp_ok" in
2941280849Scy yes)
2942181834Sroberto    ntp_libparse=yes
2943181834Sroberto    ntp_refclock=yes
2944280849Scy    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2945280849Scy    ;;
2946280849Scyesac
2947280849ScyAC_MSG_RESULT([$ntp_ok])
2948181834Srobertocase "$ntp_ok$ntp_canparse" in
2949181834Sroberto yesno)
2950280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2951280849Scyesac
2952280849Scy
2953280849ScyAC_MSG_CHECKING([VARITEXT clock])
2954280849ScyAC_ARG_ENABLE(
2955280849Scy    [VARITEXT],
2956280849Scy    [AS_HELP_STRING(
2957280849Scy	[--enable-VARITEXT],
2958280849Scy	[s VARITEXT clock]
2959280849Scy    )],
2960280849Scy    [ntp_ok=$enableval],
2961280849Scy    [ntp_ok=$ntp_eapc]
2962280849Scy)
2963280849Scycase "$ntp_ok" in
2964280849Scy yes)
2965280849Scy    ntp_libparse=yes
2966280849Scy    ntp_refclock=yes
2967280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2968181834Sroberto    ;;
2969181834Srobertoesac
2970280849ScyAC_MSG_RESULT([$ntp_ok])
2971280849Scycase "$ntp_ok$ntp_canparse" in
2972280849Scy yesno)
2973280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2974280849Scyesac
2975181834Sroberto
2976280849ScyAC_MSG_CHECKING(SEL240X clock)
2977280849ScyAC_ARG_ENABLE(SEL240X,
2978280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2979181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2980181834Srobertoif test "$ntp_ok" = "yes"; then
2981181834Sroberto    ntp_libparse=yes
2982181834Sroberto    ntp_refclock=yes
2983280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2984181834Srobertofi
2985181834SrobertoAC_MSG_RESULT($ntp_ok)
2986181834Srobertocase "$ntp_ok$ntp_canparse" in
2987181834Sroberto yesno)
2988280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2989181834Sroberto    ;;
2990181834Srobertoesac
2991280849Scy
2992280849ScyAC_SUBST([LIBPARSE])
2993280849ScyAC_SUBST([MAKE_LIBPARSE])
2994280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
2995280849ScyAC_SUBST([MAKE_CHECK_Y2K])
2996280849Scy
2997200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
2998181834Srobertoans=no
2999181834Srobertocase "$ntp_libparse" in
3000181834Sroberto yes)
3001181834Sroberto    ans=yes
3002280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3003181834Sroberto    LIBPARSE=../libparse/libparse.a
3004181834Sroberto    MAKE_LIBPARSE=libparse.a
3005181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3006181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3007181834Srobertoesac
3008200576SrobertoAC_MSG_RESULT([$ans])
3009181834Sroberto
3010280849ScyNTP_OPENSSL
3011181834Sroberto
3012280849ScyNTP_CRYPTO_RAND
3013181834Sroberto
3014280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3015280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3016280849ScyAC_ARG_ENABLE(
3017280849Scy    [autokey],
3018280849Scy    AS_HELP_STRING(
3019280849Scy	[--enable-autokey],
3020280849Scy	[+ support NTP Autokey protocol]
3021280849Scy	),
3022280849Scy    [ntp_autokey=$enableval],
3023280849Scy    [ntp_autokey=$ntp_openssl]
3024280849Scy)
3025280849Scycase "$ntp_autokey" in
3026280849Scy no)
3027181834Sroberto    ;;
3028280849Scy *)
3029280849Scy    case "$ntp_openssl" in
3030181834Sroberto     no)
3031280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3032280849Scy	ntp_autokey=no
3033181834Sroberto	;;
3034280849Scy     *)
3035280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3036280849Scy	ntp_autokey=yes
3037181834Sroberto	;;
3038181834Sroberto    esac
3039181834Sroberto    ;;
3040181834Srobertoesac
3041280849ScyAC_MSG_RESULT([$ntp_autokey])
3042181834Sroberto
3043280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3044200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3045181834Srobertocase "$cross_compiling$PATH_PERL" in
3046181834Sroberto no/*)
3047181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3048181834Sroberto    ans=yes
3049181834Sroberto    ;;
3050181834Sroberto *)
3051181834Sroberto    ans=no
3052181834Sroberto    ;;
3053181834Srobertoesac
3054200576SrobertoAC_MSG_RESULT([$ans])
3055181834Sroberto
3056280849ScyAC_SUBST([TESTDCF])
3057280849ScyAC_SUBST([DCFD])
3058200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3059181834Srobertoans=no
3060280849Scycase "$ntp_parseutil" in
3061280849Scy yes)
3062181834Sroberto    case "$host" in
3063200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3064181834Sroberto	ans="dcfd testdcf"
3065181834Sroberto	DCFD=dcfd
3066280849Scy	TESTDCF=testdcf
3067181834Sroberto    esac
3068280849Scy    ;;
3069280849Scyesac
3070200576SrobertoAC_MSG_RESULT([$ans])
3071181834Sroberto
3072280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3073200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3074181834Srobertoans=no
3075181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3076181834Sroberto yesyes)
3077181834Sroberto    case "$host" in
3078181834Sroberto     sparc-*-sunos4*)
3079280849Scy        case "$ntp_cv_var_kernel_pll" in
3080181834Sroberto	yes)
3081280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3082181834Sroberto	    ;;
3083181834Sroberto	esac
3084181834Sroberto	ans=parsestreams
3085181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3086181834Sroberto	;;
3087181834Sroberto     sparc-*-solaris2*)
3088181834Sroberto	ans=parsesolaris
3089181834Sroberto	MAKE_PARSEKMODULE=parse
3090280849Scy	AC_CHECK_HEADERS([strings.h])
3091181834Sroberto	;;
3092181834Sroberto    esac
3093181834Sroberto    ;;
3094181834Srobertoesac
3095200576SrobertoAC_MSG_RESULT([$ans])
3096181834Sroberto
3097200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3098280849Scycase "$ntp_refclock" in
3099280849Scy yes)
3100280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3101280849Scy    ;;
3102280849Scyesac
3103181834SrobertoAC_MSG_RESULT($ntp_refclock)
3104181834Sroberto
3105280849Scydnl Things that can be made in clockstuff
3106280849ScyAC_SUBST([PROPDELAY], [propdelay])
3107280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3108181834Sroberto
3109280849ScyAC_SUBST([MAKE_ADJTIMED])
3110280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3111181834Srobertocase "$host" in
3112181834Sroberto *-*-hpux[[56789]]*)
3113181834Sroberto    ans=yes
3114181834Sroberto    ;;
3115181834Sroberto *) ans=no
3116181834Sroberto    ;;
3117181834Srobertoesac
3118280849Scycase "$ans" in
3119280849Scy yes)
3120181834Sroberto    MAKE_ADJTIMED=adjtimed
3121280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3122280849Scy	[Do we need HPUX adjtime() library support?])
3123280849Scy    ;;
3124280849Scy *) ADJTIMED_DB=
3125280849Scy    ADJTIMED_DL=
3126280849Scy    ADJTIMED_DS=
3127280849Scy    ADJTIMED_MS=
3128280849Scy    ;;
3129280849Scyesac
3130200576SrobertoAC_MSG_RESULT([$ans])
3131181834Sroberto
3132200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3133181834Srobertocase "$host" in
3134181834Sroberto *-*-qnx*)
3135181834Sroberto    ans=yes
3136181834Sroberto    ;;
3137181834Sroberto *) ans=no
3138181834Sroberto    ;;
3139181834Srobertoesac
3140280849Scycase "$ans" in
3141280849Scy yes)
3142280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3143280849Scy	[Do we need the qnx adjtime call?])
3144280849Scy    ;;
3145280849Scyesac
3146200576SrobertoAC_MSG_RESULT([$ans])
3147181834Sroberto
3148200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3149181834Sroberto
3150200576Sroberto#  the default is to enable it if the system has the capability
3151200576Sroberto
3152200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3153200576Sroberto *yes*)
3154200576Sroberto    ans=yes
3155200576Sroberto    ;;
3156200576Sroberto *) ans=no
3157280849Scy    ;;
3158181834Srobertoesac
3159181834Sroberto
3160200576Srobertocase "$host" in
3161200576Sroberto *-*-domainos)	# Won't be found...
3162200576Sroberto    ans=no
3163200576Sroberto    ;;
3164200576Sroberto *-*-hpux*)
3165200576Sroberto    #ans=no
3166200576Sroberto    ;;
3167200576Sroberto *-*-irix[[456]]*)
3168200576Sroberto    ans=no
3169200576Sroberto    ;;
3170200576Sroberto *-*-*linux*)
3171200576Sroberto    ans=no
3172200576Sroberto    ;;
3173200576Sroberto *-*-winnt3.5)
3174200576Sroberto    ans=no
3175200576Sroberto    ;;
3176200576Sroberto *-*-unicosmp*)
3177200576Sroberto    ans=no
3178200576Sroberto    ;;
3179200576Srobertoesac
3180200576Sroberto
3181200576Sroberto# --enable-kmem / --disable-kmem controls if present
3182200576SrobertoAC_ARG_ENABLE(
3183200576Sroberto    [kmem],
3184280849Scy    [AS_HELP_STRING(
3185200576Sroberto	[--enable-kmem],
3186200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3187280849Scy    )],
3188200576Sroberto    [ans=$enableval]
3189200576Sroberto)
3190200576Sroberto
3191200576SrobertoAC_MSG_RESULT([$ans])
3192200576Sroberto
3193200576Srobertocase "$ans" in
3194200576Sroberto yes)
3195200576Sroberto    can_kmem=yes
3196200576Sroberto    ;;
3197280849Scy *)
3198200576Sroberto    can_kmem=no
3199280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3200200576Srobertoesac
3201200576Sroberto
3202200576Sroberto
3203200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3204200576Sroberto
3205200576Sroberto# target-dependent defaults
3206200576Sroberto
3207200576Srobertocase "$host" in
3208200576Sroberto i386-sequent-ptx*)
3209200576Sroberto    ans=no
3210200576Sroberto    ;;
3211200576Sroberto i386-unknown-osf1*)
3212200576Sroberto    ans=yes
3213200576Sroberto    ;;
3214200576Sroberto mips-sgi-irix[[456]]*)
3215200576Sroberto    ans=yes
3216200576Sroberto    ;;
3217200576Sroberto *-fujitsu-uxp*)
3218200576Sroberto    ans=yes
3219200576Sroberto    ;;
3220280849Scy *-ibm-aix[[4-9]]*)
3221280849Scy    # XXX only verified thru AIX6.
3222200576Sroberto    ans=yes
3223200576Sroberto    ;;
3224200576Sroberto *-*-*linux*)
3225200576Sroberto    ans=yes
3226200576Sroberto    ;;
3227200576Sroberto *-*-solaris2.[[01]])
3228200576Sroberto    ans=no
3229200576Sroberto    ;;
3230200576Sroberto *-*-solaris2*)
3231200576Sroberto    ans=yes
3232200576Sroberto    ;;
3233200576Sroberto *-*-unicosmp*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236200576Sroberto *) ans=no
3237280849Scy    ;;
3238200576Srobertoesac
3239200576Sroberto
3240200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3241200576Sroberto# override the default
3242280849ScyAC_ARG_ENABLE(
3243280849Scy    [accurate-adjtime],
3244280849Scy    [AS_HELP_STRING(
3245280849Scy	[--enable-accurate-adjtime],
3246280849Scy	[s the adjtime() call is accurate]
3247280849Scy    )],
3248280849Scy    [ans=$enableval]
3249200576Sroberto)
3250200576Sroberto
3251200576SrobertoAC_MSG_RESULT([$ans])
3252200576Sroberto
3253200576Srobertocase "$ans" in
3254280849Scy yes)
3255280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3256200576Sroberto    adjtime_is_accurate=yes
3257200576Sroberto    ;;
3258200576Sroberto *)
3259200576Sroberto    adjtime_is_accurate=no
3260280849Scy    ;;
3261181834Srobertoesac
3262181834Sroberto
3263280849ScyAC_CACHE_CHECK(
3264280849Scy    [the name of 'tick' in the kernel],
3265280849Scy    [ntp_cv_nlist_tick],
3266280849Scy    [
3267280849Scy	ans=_tick
3268280849Scy	case "$host" in
3269280849Scy	 m68*-hp-hpux*) # HP9000/300?
3270280849Scy	    ans=_old_tick
3271280849Scy	    ;;
3272280849Scy	 *-apple-aux[[23]]*)
3273280849Scy	    ans=tick
3274280849Scy	    ;;
3275280849Scy	 *-hp-hpux*)
3276280849Scy	    ans=old_tick
3277280849Scy	    ;;
3278280849Scy	 *-ibm-aix[[3-9]]*)
3279280849Scy	    # XXX only verified thru AIX6.
3280280849Scy	    ans=no
3281280849Scy	    ;;
3282280849Scy	 *-*-mpeix*)
3283280849Scy	    ans=no
3284280849Scy	    ;;
3285280849Scy	 *-*-ptx*)
3286280849Scy	    ans=tick
3287280849Scy	    ;;
3288280849Scy	 *-*-sco3.2v[[45]]*)
3289280849Scy	    ans=no
3290280849Scy	    ;;
3291280849Scy	 *-*-solaris2*)
3292280849Scy	    ans=nsec_per_tick
3293280849Scy	    ;;
3294280849Scy	 *-*-sysv4*)
3295280849Scy	    ans=tick
3296280849Scy	    ;;
3297280849Scy	esac
3298280849Scy	ntp_cv_nlist_tick=$ans
3299280849Scy    ]
3300280849Scy)
3301280849Scycase "$ntp_cv_nlist_tick" in
3302280849Scy ''|no)
3303280849Scy    ;;	# HMS: I think we can only get 'no' here...
3304280849Scy *)
3305280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3306280849Scy	[What is the name of TICK in the kernel?])
3307181834Srobertoesac
3308280849Scy
3309280849ScyAC_CACHE_CHECK(
3310280849Scy    [for the units of 'tick'],
3311280849Scy    [ntp_cv_tick_nano],
3312280849Scy    [
3313280849Scy	ans=usec
3314280849Scy	case "$host" in
3315280849Scy	 *-*-solaris2*)
3316280849Scy	    ans=nsec
3317280849Scy	    ;;
3318280849Scy	esac
3319280849Scy	ntp_cv_tick_nano=$ans
3320280849Scy    ]
3321280849Scy)
3322280849Scycase "$ntp_cv_tick_nano" in
3323181834Sroberto nsec)
3324280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3325181834Srobertoesac
3326280849Scy
3327280849ScyAC_CACHE_CHECK(
3328280849Scy    [the name of 'tickadj' in the kernel],
3329280849Scy    [ntp_cv_nlist_tickadj],
3330280849Scy    [
3331280849Scy	ans=_tickadj
3332280849Scy	case "$host" in
3333280849Scy	 m68*-hp-hpux*) # HP9000/300?
3334280849Scy	    ans=_tickadj
3335280849Scy	    ;;
3336280849Scy	 *-apple-aux[[23]]*)
3337280849Scy	    ans=tickadj
3338280849Scy	    ;;
3339280849Scy	 *-hp-hpux10*)
3340280849Scy	    ans=no
3341280849Scy	    ;;
3342280849Scy	 *-hp-hpux9*)
3343280849Scy	    ans=no
3344280849Scy	    ;;
3345280849Scy	 *-hp-hpux*)
3346280849Scy	    ans=tickadj
3347280849Scy	    ;;
3348280849Scy	 *-*-aix*)
3349280849Scy	    ans=tickadj
3350280849Scy	    ;;
3351280849Scy	 *-*-mpeix*)
3352280849Scy	    ans=no
3353280849Scy	    ;;
3354280849Scy	 *-*-ptx*)
3355280849Scy	    ans=tickadj
3356280849Scy	    ;;
3357280849Scy	 *-*-sco3.2v4*)
3358280849Scy	    ans=no
3359280849Scy	    ;;
3360280849Scy	 *-*-sco3.2v5.0*)
3361280849Scy	    ans=clock_drift
3362280849Scy	    ;;
3363280849Scy	 *-*-solaris2*)
3364280849Scy	    ans=no	# hrestime_adj
3365280849Scy	    ;;
3366280849Scy	 *-*-sysv4*)
3367280849Scy	    ans=tickadj
3368280849Scy	    ;;
3369280849Scy	esac
3370280849Scy	ntp_cv_nlist_tickadj=$ans
3371280849Scy    ]
3372280849Scy)
3373280849Scycase "$ntp_cv_nlist_tickadj" in
3374280849Scy ''|no)
3375280849Scy    ;;	# HMS: I think we can only get 'no' here...
3376280849Scy *)
3377280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3378280849Scy	[What is the name of TICKADJ in the kernel?])
3379181834Srobertoesac
3380280849Scy
3381280849ScyAC_CACHE_CHECK(
3382280849Scy    [for the units of 'tickadj'],
3383280849Scy    [ntp_cv_tickadj_nano],
3384280849Scy    [
3385280849Scy	ans=usec
3386280849Scy	case "$host" in
3387280849Scy	 *-*-solaris2*)
3388280849Scy	    ans=nsec
3389280849Scy	    ;;
3390280849Scy	esac
3391280849Scy	ntp_cv_tickadj_nano=$ans
3392280849Scy    ]
3393280849Scy)
3394280849Scycase "$ntp_cv_tickadj_nano" in
3395181834Sroberto nsec)
3396280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3397181834Srobertoesac
3398280849Scy
3399280849ScyAC_CACHE_CHECK(
3400280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3401280849Scy    [ntp_cv_nlist_dosynctodr],
3402280849Scy    [
3403280849Scy	case "$host" in
3404280849Scy	 *-apple-aux[[23]]*)
3405280849Scy	    ans=no
3406280849Scy	    ;;
3407280849Scy	 *-sni-sysv*)
3408280849Scy	    ans=dosynctodr
3409280849Scy	    ;;
3410285169Scy	 *-stratus-vos)
3411285169Scy	    ans=no
3412285169Scy	    ;;
3413280849Scy	 *-*-aix*)
3414280849Scy	    ans=dosynctodr
3415280849Scy	    ;;
3416280849Scy	 *-*-hpux*)
3417280849Scy	    ans=no
3418280849Scy	    ;;
3419280849Scy	 *-*-mpeix*)
3420280849Scy	    ans=no
3421280849Scy	    ;;
3422280849Scy	 *-*-nextstep*)
3423280849Scy	    ans=_dosynctodr
3424280849Scy	    ;;
3425280849Scy	 *-*-ptx*)
3426280849Scy	    ans=doresettodr
3427280849Scy	    ;;
3428280849Scy	 *-*-sco3.2v4*)
3429280849Scy	    ans=no
3430280849Scy	    ;;
3431280849Scy	 *-*-sco3.2v5*)
3432280849Scy	    ans=track_rtc
3433280849Scy	    ;;
3434280849Scy	 *-*-solaris2*)
3435280849Scy	    ans=dosynctodr
3436280849Scy	    ;;
3437280849Scy	 *-*-sysv4*)
3438280849Scy	    ans=doresettodr
3439280849Scy	    ;;
3440280849Scy	 *)
3441280849Scy	    ans=_dosynctodr
3442280849Scy	    ;;
3443280849Scy	esac
3444280849Scy	ntp_cv_nlist_dosynctodr=$ans
3445280849Scy    ]
3446280849Scy)
3447280849Scycase "$ntp_cv_nlist_dosynctodr" in
3448280849Scy no)
3449181834Sroberto    ;;
3450181834Sroberto *)
3451280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3452280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3453181834Sroberto    ;;
3454181834Srobertoesac
3455280849Scy
3456280849ScyAC_CACHE_CHECK(
3457280849Scy    [half-heartedly for 'noprintf' in the kernel],
3458280849Scy    [ntp_cv_nlist_noprintf],
3459280849Scy    [
3460280849Scy	case "$host" in
3461280849Scy	 *-apple-aux[[23]]*)
3462280849Scy	    ans=no
3463280849Scy	    ;;
3464280849Scy	 *-sni-sysv*)
3465280849Scy	    ans=noprintf
3466280849Scy	    ;;
3467285169Scy	 *-stratus-vos)
3468285169Scy	    ans=no
3469285169Scy	    ;;
3470280849Scy	 *-*-aix*)
3471280849Scy	    ans=noprintf
3472280849Scy	    ;;
3473280849Scy	 *-*-hpux*)
3474280849Scy	    ans=no
3475280849Scy	    ;;
3476280849Scy	 *-*-mpeix*)
3477280849Scy	    ans=no
3478280849Scy	    ;;
3479280849Scy	 *-*-ptx*)
3480280849Scy	    ans=noprintf
3481280849Scy	    ;;
3482280849Scy	 *-*-nextstep*)
3483280849Scy	    ans=_noprintf
3484280849Scy	    ;;
3485280849Scy	 *-*-solaris2*)
3486280849Scy	    ans=noprintf
3487280849Scy	    ;;
3488280849Scy	 *-*-sysv4*)
3489280849Scy	    ans=noprintf
3490280849Scy	    ;;
3491280849Scy	 *)
3492280849Scy	    ans=_noprintf
3493280849Scy	    ;;
3494280849Scy	esac
3495280849Scy	ntp_cv_nlist_noprintf=$ans
3496280849Scy    ]
3497280849Scy)
3498280849Scycase "$ntp_cv_nlist_noprintf" in
3499280849Scy no)
3500181834Sroberto    ;;
3501181834Sroberto *)
3502280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3503280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3504181834Sroberto    ;;
3505181834Srobertoesac
3506181834Sroberto
3507181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3508181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3509181834Sroberto
3510280849Scydnl	tick		tickadj
3511181834Srobertodnl	10000		80	    Unixware
3512181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3513181834Srobertodnl	10000		150	    sgi IRIX
3514181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3515181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3516181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3517181834Srobertodnl	txc.tick	1	    Linux
3518181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3519181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3520181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3521181834Sroberto
3522181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3523181834Sroberto
3524200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3525200576Sroberto
3526200576Sroberto# target-dependent default for tick
3527200576Sroberto
3528200576Srobertocase "$host" in
3529200576Sroberto *-*-pc-cygwin*)
3530200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3531200576Sroberto    ;;
3532200576Sroberto *-univel-sysv*)
3533200576Sroberto    ans=10000
3534200576Sroberto    ;;
3535200576Sroberto *-*-irix*)
3536200576Sroberto    ans=10000
3537200576Sroberto    ;;
3538200576Sroberto *-*-*linux*)
3539200576Sroberto    ans=txc.tick
3540200576Sroberto    ;;
3541200576Sroberto *-*-mpeix*)
3542200576Sroberto    ans=no
3543200576Sroberto    ;;
3544200576Sroberto *-*-winnt3.5)
3545200576Sroberto    ans='(every / 10)'
3546200576Sroberto    ;;
3547200576Sroberto *-*-unicosmp*)
3548200576Sroberto    ans=10000
3549200576Sroberto    ;;
3550200576Sroberto *)
3551200576Sroberto    ans='1000000L/hz'
3552200576Sroberto    ;;
3553200576Srobertoesac
3554200576Sroberto
3555200576SrobertoAC_ARG_ENABLE(
3556200576Sroberto    [tick],
3557280849Scy    [AS_HELP_STRING(
3558200576Sroberto	[--enable-tick=VALUE],
3559200576Sroberto	[s force a value for 'tick']
3560280849Scy    )],
3561200576Sroberto    [ans=$enableval]
3562200576Sroberto)
3563200576Sroberto
3564200576SrobertoAC_MSG_RESULT([$ans])
3565200576Sroberto
3566200576Srobertocase "$ans" in
3567280849Scy ''|no)
3568280849Scy    ;;	# HMS: I think we can only get 'no' here...
3569280849Scy *)
3570280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3571280849Scy	[Preset a value for 'tick'?])
3572181834Srobertoesac
3573181834Sroberto
3574200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3575200576Sroberto
3576200576Sroberto# target-specific default
3577200576Srobertoans='500/hz'
3578200576Srobertocase "$host" in
3579200576Sroberto *-fujitsu-uxp*)
3580200576Sroberto    case "$adjtime_is_accurate" in
3581200576Sroberto     yes)
3582280849Scy	ans='tick/16'
3583200576Sroberto    esac
3584200576Sroberto    ;;
3585200576Sroberto *-univel-sysv*)
3586200576Sroberto    ans=80
3587200576Sroberto    ;;
3588200576Sroberto *-*-aix*)
3589200576Sroberto    case "$can_kmem" in
3590200576Sroberto     no)
3591200576Sroberto	ans=1000
3592280849Scy	;;
3593200576Sroberto    esac
3594200576Sroberto    ;;
3595200576Sroberto *-*-domainos)	# Skippy: won't be found...
3596200576Sroberto    case "$can_kmem" in
3597200576Sroberto     no)
3598200576Sroberto	ans=668
3599280849Scy	;;
3600200576Sroberto    esac
3601200576Sroberto    ;;
3602200576Sroberto *-*-hpux*)
3603200576Sroberto    case "$adjtime_is_accurate" in
3604200576Sroberto     yes)
3605200576Sroberto	ans='tick/16'
3606280849Scy	;;
3607200576Sroberto    esac
3608200576Sroberto    ;;
3609200576Sroberto *-*-irix*)
3610200576Sroberto    ans=150
3611200576Sroberto    ;;
3612200576Sroberto *-*-mpeix*)
3613200576Sroberto    ans=no
3614200576Sroberto    ;;
3615200576Sroberto *-*-sco3.2v5.0*)
3616200576Sroberto    ans=10000L/hz
3617200576Sroberto    ;;
3618200576Sroberto *-*-winnt3.5)
3619200576Sroberto    ans=50
3620200576Sroberto    ;;
3621200576Sroberto *-*-unicosmp*)
3622200576Sroberto    ans=150
3623280849Scy    ;;
3624200576Srobertoesac
3625200576Sroberto
3626200576SrobertoAC_ARG_ENABLE(
3627200576Sroberto    [tickadj],
3628280849Scy    [AS_HELP_STRING(
3629280849Scy	[--enable-tickadj=VALUE],
3630280849Scy	[s force a value for 'tickadj']
3631280849Scy    )],
3632200576Sroberto    [ans=$enableval]
3633200576Sroberto)
3634200576Sroberto
3635200576SrobertoAC_MSG_RESULT([$ans])
3636200576Sroberto
3637200576Srobertodefault_tickadj=$ans
3638200576Sroberto
3639200576Srobertocase "$default_tickadj" in
3640280849Scy ''|no)
3641280849Scy    ;;	# HMS: I think we can only get 'no' here...
3642280849Scy *)
3643280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3644280849Scy	[Preset a value for 'tickadj'?]) ;;
3645181834Srobertoesac
3646181834Sroberto
3647181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3648181834Sroberto# 1/100s (system tick). Sigh ...
3649181834Sroberto# Unfortunately, there is no easy way to know if particular release
3650181834Sroberto# has this "feature" or any obvious way to test for it.
3651181834Srobertocase "$host" in
3652280849Scy mips-sni-sysv4*)
3653280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3654280849Scy	[Do we want the ReliantUNIX clock hacks?])
3655181834Srobertoesac
3656181834Sroberto
3657181834Srobertocase "$host" in
3658280849Scy *-*-sco3.2v5*)
3659280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3660181834Srobertoesac
3661181834Sroberto
3662280849Scyntp_cv_make_tickadj=yes
3663200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3664181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3665200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3666280849Scy    ntp_cv_make_tickadj=no
3667181834Sroberto    ;;
3668181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3669200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3670280849Scy    ntp_cv_make_tickadj=no
3671181834Sroberto    ;;
3672181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3673200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3674280849Scy    ntp_cv_make_tickadj=no
3675181834Sroberto    ;;
3676181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3677181834Sroberto    ;;
3678181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3679181834Sroberto    ;;
3680181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3681200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3682181834Sroberto    ;;
3683181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3684181834Sroberto    ;;
3685181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3686181834Sroberto    ;;
3687181834Sroberto *)		# Generally bogus.
3688200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3689181834Sroberto    ;;
3690181834Srobertoesac
3691181834Sroberto
3692181834SrobertoAC_SUBST(MAKE_NTPTIME)
3693200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3694181834Sroberto[case "$host" in
3695280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3696181834Sroberto     yesyes)
3697181834Sroberto	ans=yes
3698181834Sroberto	;;
3699181834Sroberto     *)
3700181834Sroberto	ans=no
3701181834Sroberto	;;
3702181834Sroberto    esac
3703181834Sroberto    ;;
3704181834Srobertoesac
3705181834Srobertoac_cv_make_ntptime=$ans])
3706181834Srobertocase "$ac_cv_make_ntptime" in
3707181834Sroberto yes)
3708181834Sroberto    MAKE_NTPTIME=ntptime
3709181834Sroberto    ;;
3710280849Scy *)
3711280849Scy    NTPTIME_DB=
3712280849Scy    NTPTIME_DL=
3713280849Scy    NTPTIME_DS=
3714280849Scy    NTPTIME_MS=
3715280849Scy    ;;
3716181834Srobertoesac
3717181834Sroberto
3718280849ScyAC_SUBST([MAKE_TICKADJ])
3719181834Srobertocase "$host" in
3720181834Sroberto mips-sni-sysv4*)
3721181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3722181834Sroberto    # Do not bother
3723280849Scy    ntp_cv_make_tickadj=no
3724181834Sroberto    ;;
3725181834Sroberto *-*-irix*)
3726280849Scy    ntp_cv_make_tickadj=no
3727181834Sroberto    ;;
3728181834Sroberto *-*-solaris2*)
3729181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3730181834Sroberto    case "$host" in
3731181834Sroberto     *-*-solaris2.1[[0-9]]*)
3732280849Scy	ntp_cv_make_tickadj=no
3733181834Sroberto	;;
3734181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3735280849Scy     *) ntp_cv_make_tickadj=no ;;
3736181834Sroberto    esac
3737181834Sroberto    ;;
3738181834Sroberto *-*-unicosmp*)
3739280849Scy    ntp_cv_make_tickadj=no
3740181834Sroberto    ;;
3741181834Srobertoesac
3742200576Sroberto
3743200576Sroberto#
3744200576Sroberto# Despite all the above, we always make tickadj.  Setting
3745280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3746200576Sroberto# report that the configuration variable was cached.  It may
3747200576Sroberto# be better to simply remove the hunk above, I did not want
3748200576Sroberto# to remove it if there is hope it will be used again.
3749200576Sroberto#
3750280849ScyAS_UNSET([ntp_cv_make_tickadj])
3751200576Sroberto
3752280849ScyAC_CACHE_CHECK(
3753280849Scy    [if we want and can make the tickadj utility],
3754280849Scy    [ntp_cv_make_tickadj],
3755280849Scy    [ntp_cv_make_tickadj=yes]
3756280849Scy)
3757280849Scycase "$ntp_cv_make_tickadj" in
3758181834Sroberto yes)
3759181834Sroberto    MAKE_TICKADJ=tickadj
3760181834Sroberto    ;;
3761280849Scy *)
3762280849Scy    CALC_TICKADJ_DB=
3763280849Scy    CALC_TICKADJ_DL=
3764280849Scy    CALC_TICKADJ_DS=
3765280849Scy    CALC_TICKADJ_MS=
3766280849Scy    TICKADJ_DB=
3767280849Scy    TICKADJ_DL=
3768280849Scy    TICKADJ_DS=
3769280849Scy    TICKADJ_MS=
3770280849Scy    ;;
3771181834Srobertoesac
3772181834Sroberto
3773280849ScyAC_SUBST([MAKE_TIMETRIM])
3774280849ScyAC_CACHE_CHECK(
3775280849Scy    [if we want and can make the timetrim utility],
3776280849Scy    [ntp_cv_make_timetrim],
3777280849Scy    [
3778280849Scy	case "$host" in
3779280849Scy	 *-*-irix*)
3780280849Scy	    ntp_cv_make_timetrim=yes
3781280849Scy	    ;;
3782280849Scy	 *-*-unicosmp*)
3783280849Scy	    ntp_cv_make_timetrim=yes
3784280849Scy	    ;;
3785280849Scy	 *)
3786280849Scy	    ntp_cv_make_timetrim=no
3787280849Scy	    ;;
3788280849Scy	esac
3789280849Scy    ]
3790280849Scy)
3791280849Scycase "$ntp_cv_make_timetrim" in
3792181834Sroberto yes)
3793181834Sroberto    MAKE_TIMETRIM=timetrim
3794181834Sroberto    ;;
3795280849Scy *) TIMETRIM_DB=
3796280849Scy    TIMETRIM_DL=
3797280849Scy    TIMETRIM_DS=
3798280849Scy    TIMETRIM_MS=
3799280849Scy    ;;
3800181834Srobertoesac
3801181834Sroberto
3802280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3803280849ScyAC_SUBST([MAKE_NTPDSIM])
3804200576Sroberto
3805200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3806200576SrobertoAC_ARG_ENABLE(
3807200576Sroberto    [simulator],
3808280849Scy    [AS_HELP_STRING(
3809200576Sroberto	[--enable-simulator],
3810200576Sroberto	[- build/install the NTPD simulator?]
3811280849Scy    )],
3812280849Scy    [ans=$enableval],
3813200576Sroberto    [ans=no]
3814200576Sroberto)
3815200576SrobertoAC_MSG_RESULT([$ans])
3816200576Srobertocase "$ans" in
3817181834Sroberto yes)
3818181834Sroberto    MAKE_NTPDSIM=ntpdsim
3819181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3820181834Sroberto    ;;
3821280849Scy *)
3822280849Scy    NTPDSIM_DB=
3823280849Scy    NTPDSIM_DL=
3824280849Scy    NTPDSIM_DS=
3825280849Scy    NTPDSIM_MS=
3826280849Scy    ;;
3827181834Srobertoesac
3828181834Sroberto
3829181834Srobertocase "$build" in
3830181834Sroberto $host)
3831181834Sroberto    ;;
3832181834Sroberto *) case "$host" in
3833181834Sroberto     *-*-vxworks*)
3834200576Sroberto	LDFLAGS="$LDFLAGS -r"
3835200576Sroberto	;;
3836181834Sroberto    esac
3837181834Sroberto    ;;
3838181834Srobertoesac
3839181834Sroberto
3840280849ScyNTP_WITHSNTP
3841200576Sroberto
3842280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3843280849ScyAC_ARG_WITH(
3844280849Scy    [ntpsnmpd],
3845280849Scy    [AS_HELP_STRING(
3846280849Scy	[--with-ntpsnmpd],
3847280849Scy	[s Build ntpsnmpd MIB agent?]
3848280849Scy    )],
3849280849Scy    [ans=$withval],
3850280849Scy    [
3851280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3852280849Scy	 /*)	ans=yes ;;
3853280849Scy	 *)	ans=no  ;;
3854280849Scy	esac
3855280849Scy    ]
3856280849Scy)
3857280849ScyAC_MSG_RESULT([$ans])
3858280849Scycase "$ans" in
3859280849Scy yes)
3860280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3861280849Scy     /*)
3862280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3863285169Scy	# Bug 2815.  This is a bit of a hack, but it works...
3864285169Scy	case "$ntp_cv_net_snmp_version" in
3865285169Scy	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3866285169Scy		;;
3867285169Scy	esac
3868280849Scy	AC_SUBST([SNMP_LIBS])
3869280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3870280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3871280849Scy	SNMP_CPPFLAGS=
3872280849Scy	SNMP_CFLAGS=
3873280849Scy	for i in $foo; do
3874280849Scy	    case "$i" in
3875280849Scy	     -D*|-U*|-I*)
3876280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3877280849Scy		;;
3878280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3879280849Scy		;;
3880280849Scy	    esac
3881280849Scy	done
3882280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3883280849Scy	AC_SUBST([SNMP_CFLAGS])
3884280849Scy
3885280849Scy	save_CFLAGS=$CFLAGS
3886280849Scy	save_CPPFLAGS=$CPPFLAGS
3887280849Scy	save_LIBS=$LIBS
3888280849Scy	CFLAGS=$SNMP_CFLAGS
3889280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3890280849Scy
3891280849Scy	AC_CHECK_HEADER(
3892280849Scy	    [net-snmp/net-snmp-config.h],
3893280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3894280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3895280849Scy	)
3896280849Scy
3897280849Scy	# Do this last, as we're messing up LIBS.
3898280849Scy	# check -lnetsnmp for netsnmp_daemonize
3899280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3900280849Scy	AC_CHECK_LIB(
3901280849Scy	    [netsnmp],
3902280849Scy	    [netsnmp_daemonize],
3903280849Scy	    [ans=yes],
3904280849Scy	    [ans=no]
3905280849Scy	)
3906280849Scy	case "$ans" in
3907280849Scy	 no)
3908280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3909280849Scy		[We need to provide netsnmp_daemonize()])
3910280849Scy	esac
3911280849Scy	
3912280849Scy	CFLAGS=$save_CFLAGS
3913280849Scy	AS_UNSET([save_CFLAGS])
3914280849Scy	CPPFLAGS=$save_CPPFLAGS
3915280849Scy	AS_UNSET([save_CPPFLAGS])
3916280849Scy	LIBS=$save_LIBS
3917280849Scy	AS_UNSET([save_LIBS])
3918280849Scy	;;
3919280849Scy     *) 
3920280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3921280849Scy	;;
3922280849Scy    esac
3923280849Scy    ;;
3924280849Scyesac
3925280849ScyAC_SUBST([MAKE_NTPSNMPD])
3926280849Scy
3927280849Scycase "$MAKE_NTPSNMPD" in
3928280849Scy '')
3929280849Scy    NTPSNMPD_DB=
3930280849Scy    NTPSNMPD_DL=
3931280849Scy    NTPSNMPD_DS=
3932280849Scy    NTPSNMPD_MS=
3933280849Scy    ;;
3934280849Scyesac
3935280849Scy
3936200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3937200576Sroberto
3938200576Sroberto# target-specific defaults
3939200576Sroberto
3940200576Srobertocase "$host" in
3941200576Sroberto *-apple-aux[[23]]*)
3942200576Sroberto    ans=yes
3943200576Sroberto    ;;
3944200576Sroberto *-*-bsdi[[012]]*)
3945200576Sroberto    ans=no
3946200576Sroberto    ;;
3947200576Sroberto *-*-bsdi*)
3948200576Sroberto    ans=yes
3949200576Sroberto    ;;
3950200576Sroberto *-*-openvms*)	# HMS: won't be found
3951200576Sroberto    ans=yes
3952200576Sroberto    ;;
3953200576Sroberto *) ans=no
3954200576Sroberto    ;;
3955200576Srobertoesac
3956200576Sroberto
3957200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3958200576Sroberto
3959200576SrobertoAC_ARG_ENABLE(
3960200576Sroberto    [slew-always],
3961280849Scy    [AS_HELP_STRING(
3962200576Sroberto	[--enable-slew-always],
3963200576Sroberto	[s always slew the time]
3964280849Scy    )],
3965200576Sroberto    [ans=$enableval]
3966200576Sroberto)
3967200576Sroberto
3968200576SrobertoAC_MSG_RESULT([$ans])
3969200576Sroberto
3970200576Srobertocase "$ans" in
3971280849Scy yes)
3972280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3973181834Srobertoesac
3974181834Sroberto
3975200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3976200576Sroberto
3977200576Srobertocase "$host" in
3978200576Sroberto *-sni-sysv*)
3979200576Sroberto    ans=yes
3980200576Sroberto    ;;
3981285169Scy *-stratus-vos)
3982285169Scy    ans=no
3983285169Scy    ;;
3984200576Sroberto *-univel-sysv*)
3985200576Sroberto    ans=no
3986200576Sroberto    ;;
3987200576Sroberto *-*-ptx*)
3988200576Sroberto    ans=yes
3989200576Sroberto    ;;
3990200576Sroberto *-*-solaris2.1[[0-9]]*)
3991200576Sroberto    ans=no
3992200576Sroberto    ;;
3993200576Sroberto *-*-solaris2.[[012]]*)
3994200576Sroberto    ans=yes
3995200576Sroberto    ;;
3996200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
3997200576Sroberto    ans=yes
3998200576Sroberto    ;;
3999200576Sroberto *) ans=no
4000200576Sroberto    ;;
4001200576Srobertoesac
4002200576Sroberto
4003200576SrobertoAC_ARG_ENABLE(
4004200576Sroberto    [step-slew],
4005280849Scy    [AS_HELP_STRING(
4006200576Sroberto	[--enable-step-slew],
4007200576Sroberto	[s step and slew the time]
4008280849Scy    )],
4009200576Sroberto    [ans=$enableval]
4010200576Sroberto)
4011200576Sroberto
4012200576SrobertoAC_MSG_RESULT([$ans])
4013200576Sroberto
4014200576Srobertocase "$ans" in
4015280849Scy yes)
4016280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4017181834Srobertoesac
4018181834Sroberto
4019200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4020200576Sroberto
4021200576Srobertocase "$host" in
4022200576Sroberto *-apple-aux[[23]]*)
4023200576Sroberto    ans=yes
4024200576Sroberto    ;;
4025200576Sroberto *) ans=no
4026280849Scy    ;;
4027200576Srobertoesac
4028200576Sroberto
4029200576SrobertoAC_ARG_ENABLE(
4030200576Sroberto    [ntpdate-step],
4031280849Scy    [AS_HELP_STRING(
4032200576Sroberto	[--enable-ntpdate-step],
4033200576Sroberto	[s if ntpdate should step the time]
4034280849Scy    )],
4035200576Sroberto    [ans=$enableval]
4036200576Sroberto)
4037200576Sroberto
4038200576SrobertoAC_MSG_RESULT([$ans])
4039200576Sroberto
4040200576Srobertocase "$ans" in
4041280849Scy yes)
4042280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4043280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4044181834Srobertoesac
4045181834Sroberto
4046200576Sroberto
4047200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4048200576Sroberto
4049200576Srobertocase "$host" in
4050200576Sroberto *-*-nextstep*)
4051200576Sroberto    ans=yes
4052200576Sroberto    ;;
4053200576Sroberto *-*-openvms*)	# HMS: won't be found
4054200576Sroberto    ans=yes
4055200576Sroberto    ;;
4056200576Sroberto *)
4057200576Sroberto    ans=no
4058280849Scy    ;;
4059200576Srobertoesac
4060200576Sroberto
4061200576SrobertoAC_ARG_ENABLE(
4062200576Sroberto    [hourly-todr-sync],
4063280849Scy    [AS_HELP_STRING(
4064200576Sroberto	[--enable-hourly-todr-sync],
4065200576Sroberto	[s if we should sync TODR hourly]
4066280849Scy    )],
4067200576Sroberto    [ans=$enableval]
4068200576Sroberto)
4069200576Sroberto
4070200576SrobertoAC_MSG_RESULT([$ans])
4071200576Sroberto
4072181834Srobertocase "$ac_cv_var_sync_todr" in
4073280849Scy yes)
4074280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4075181834Srobertoesac
4076181834Sroberto
4077181834Sroberto
4078200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4079200576Sroberto
4080200576Srobertocase "$host" in
4081200576Sroberto *-*-solaris2.6)
4082200576Sroberto    unamev=`uname -v`
4083200576Sroberto    case "$unamev" in
4084200576Sroberto     Generic_105181-*)
4085200576Sroberto	old_IFS="$IFS"
4086200576Sroberto	IFS="-"
4087200576Sroberto	set $unamev
4088200576Sroberto	IFS="$old_IFS"
4089200576Sroberto	if test "$2" -ge 17
4090200576Sroberto	then
4091200576Sroberto	    # Generic_105181-17 and higher
4092200576Sroberto	    ans=no
4093200576Sroberto	else
4094200576Sroberto	    ans=yes
4095200576Sroberto	fi
4096200576Sroberto	;;
4097280849Scy     *)
4098181834Sroberto	ans=yes
4099280849Scy	;;
4100200576Sroberto    esac
4101200576Sroberto    ;;
4102200576Sroberto *-*-solaris2.7)
4103200576Sroberto    unamev=`uname -v`
4104200576Sroberto    case "$unamev" in
4105200576Sroberto     Generic_106541-*)
4106200576Sroberto	old_IFS="$IFS"
4107200576Sroberto	IFS="-"
4108200576Sroberto	set $unamev
4109200576Sroberto	IFS="$old_IFS"
4110200576Sroberto	if test "$2" -ge 07
4111200576Sroberto	then
4112200576Sroberto	    # Generic_106541-07 and higher
4113200576Sroberto	    ans=no
4114200576Sroberto	else
4115200576Sroberto	    ans=yes
4116200576Sroberto	fi
4117181834Sroberto	;;
4118200576Sroberto     *)
4119181834Sroberto	ans=yes
4120280849Scy	;;
4121181834Sroberto    esac
4122200576Sroberto    ;;
4123200576Sroberto *)
4124200576Sroberto    ans=no
4125280849Scy    ;;
4126200576Srobertoesac
4127200576Sroberto
4128200576SrobertoAC_ARG_ENABLE(
4129200576Sroberto    [kernel-fll-bug],
4130280849Scy    [AS_HELP_STRING(
4131200576Sroberto	[--enable-kernel-fll-bug],
4132200576Sroberto	[s if we should avoid a kernel FLL bug]
4133280849Scy    )],
4134200576Sroberto    [ans=$enableval]
4135200576Sroberto)
4136200576Sroberto
4137200576SrobertoAC_MSG_RESULT([$ans])
4138200576Sroberto
4139200576Srobertocase "$ans" in
4140280849Scy yes)
4141280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4142200576Srobertoesac
4143200576Sroberto
4144200576Sroberto
4145280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4146280849ScyAC_ARG_ENABLE(
4147280849Scy    [bug1243-fix],
4148280849Scy    [AS_HELP_STRING(
4149280849Scy	[--enable-bug1243-fix],
4150280849Scy	[+ use unmodified autokey session keys]
4151280849Scy    )],
4152280849Scy    [ans=$enableval],
4153280849Scy    [ans=yes]
4154280849Scy)
4155280849ScyAC_MSG_RESULT([$ans])
4156280849Scycase "$ans" in
4157280849Scy no)
4158280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4159280849Scy	[use old autokey session key behavior?])
4160280849Scyesac
4161280849Scy
4162280849Scy
4163298695SdelphijAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4164298695SdelphijAC_ARG_ENABLE(
4165298695Sdelphij    [bug3020-fix],
4166298695Sdelphij    [AS_HELP_STRING(
4167298695Sdelphij	[--enable-bug3020-fix],
4168298695Sdelphij	[+ Provide the explicit 127.0.0.0/8 martian filter]
4169298695Sdelphij    )],
4170298695Sdelphij    [ans=$enableval],
4171298695Sdelphij    [ans=yes]
4172298695Sdelphij)
4173298695SdelphijAC_MSG_RESULT([$ans])
4174298695Sdelphijcase "$ans" in
4175298695Sdelphij yes)
4176298695Sdelphij    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4177298695Sdelphij	[Provide the explicit 127.0.0.0/8 martian filter?])
4178298695Sdelphijesac
4179298695Sdelphij
4180298695Sdelphij
4181200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4182200576Sroberto
4183200576Srobertocase "$host" in
4184200576Sroberto *-*-solaris2.[[89]])
4185200576Sroberto    ans=yes
4186200576Sroberto    ;;
4187200576Sroberto *-*-solaris2.1[[0-9]]*)
4188200576Sroberto    ans=yes
4189200576Sroberto    ;;
4190200576Sroberto *) ans=no
4191280849Scy    ;;
4192200576Srobertoesac
4193200576Sroberto
4194200576SrobertoAC_ARG_ENABLE(
4195280849Scy    [irig-sawtooth],
4196280849Scy    [AS_HELP_STRING(
4197200576Sroberto	[--enable-irig-sawtooth],
4198200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4199280849Scy    )],
4200200576Sroberto    [ans=$enableval]
4201200576Sroberto)
4202200576Sroberto
4203200576SrobertoAC_MSG_RESULT([$ans])
4204200576Sroberto
4205200576Srobertocase "$ans" in
4206280849Scy yes)
4207280849Scy    AC_DEFINE([IRIG_SUCKS], [1],
4208280849Scy	[Should we use the IRIG sawtooth filter?])
4209181834Srobertoesac
4210181834Sroberto
4211200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4212200576SrobertoAC_ARG_ENABLE(
4213280849Scy	[nist],
4214280849Scy	[AS_HELP_STRING(
4215200576Sroberto	    [--enable-nist],
4216200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4217280849Scy	)],
4218200576Sroberto	[ans=$enableval],
4219200576Sroberto	[ans=no]
4220200576Sroberto)
4221200576Sroberto
4222200576SrobertoAC_MSG_RESULT([$ans])
4223200576Sroberto
4224200576Srobertocase "$ans" in
4225280849Scy yes)
4226280849Scy    AC_DEFINE([LOCKCLOCK], [1],
4227280849Scy	[Should we align with the NIST lockclock scheme?]) ;;
4228181834Srobertoesac
4229181834Sroberto
4230200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4231200576SrobertoAC_ARG_ENABLE(
4232200576Sroberto    [ntp-signd],
4233280849Scy    [AS_HELP_STRING(
4234280849Scy	[--enable-ntp-signd],
4235280849Scy	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4236280849Scy    )],
4237200576Sroberto    [ans=$enableval],
4238200576Sroberto    [ans=no]
4239200576Sroberto)
4240200576Sroberto
4241200576SrobertoAC_MSG_RESULT([$ans])
4242200576Sroberto
4243200576Srobertocase "$ans" in
4244200576Sroberto no)
4245200576Sroberto    ntp_signd_path=
4246200576Sroberto    ;;
4247200576Sroberto yes)
4248200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4249200576Sroberto    ;;
4250200576Sroberto *)
4251200576Sroberto    ntp_signd_path="$ans"
4252200576Srobertoesac
4253200576Sroberto
4254200576Srobertocase "$ntp_signd_path" in
4255200576Sroberto '')
4256200576Sroberto    ;;
4257200576Sroberto *)
4258280849Scy    AC_DEFINE([HAVE_NTP_SIGND], [1],
4259280849Scy	[Do we want support for Samba's signing daemon?])
4260280849Scy    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4261280849Scy	[Path to sign daemon rendezvous socket])
4262200576Sroberto    ;;
4263200576Srobertoesac
4264200576Sroberto
4265200576SrobertoAC_CHECK_HEADERS([libscf.h])
4266280849ScyLSCF=
4267200576Srobertocase "$ac_cv_header_libscf_h" in
4268200576Sroberto yes)
4269280849Scy    LSCF='-lscf'
4270200576Srobertoesac
4271280849ScyAC_SUBST([LSCF])
4272200576Sroberto
4273280849ScyNTP_IPV6
4274200576Sroberto
4275200576Sroberto
4276181834Sroberto#
4277181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4278181834Sroberto#
4279200576SrobertoAC_CACHE_CHECK(
4280200576Sroberto    [for interface list sysctl],
4281280849Scy    [ntp_cv_iflist_sysctl],
4282280849Scy    [AC_PREPROC_IFELSE(
4283282408Scy	[AC_LANG_SOURCE([
4284200576Sroberto	    #include <sys/param.h>
4285200576Sroberto	    #include <sys/sysctl.h>
4286200576Sroberto	    #include <sys/socket.h>
4287280849Scy	    #ifndef NET_RT_IFLIST
4288280849Scy	    # error
4289200576Sroberto	    #endif
4290282408Scy	])],
4291280849Scy	[ntp_cv_iflist_sysctl=yes],
4292280849Scy	[ntp_cv_iflist_sysctl=no]
4293280849Scy    )]
4294200576Sroberto)
4295280849Scycase "$ntp_cv_iflist_sysctl" in
4296280849Scy yes)
4297280849Scy    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4298280849Scyesac
4299181834Sroberto
4300280849Scy###
4301280849Scy
4302280849ScyAC_MSG_CHECKING([if we want the saveconfig mechanism])
4303280849ScyAC_ARG_ENABLE(
4304280849Scy    [saveconfig],
4305280849Scy    [AS_HELP_STRING(
4306280849Scy	[--enable-saveconfig],
4307280849Scy	[+ saveconfig mechanism]
4308280849Scy    )],
4309280849Scy    [ntp_ok=$enableval],
4310280849Scy    [ntp_ok=yes]
4311280849Scy)
4312280849Scyntp_saveconfig_enabled=0
4313280849Scycase "$ntp_ok" in
4314200576Sroberto yes)
4315280849Scy    ntp_saveconfig_enabled=1
4316280849Scy    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4317280849Scy    ;;
4318200576Srobertoesac
4319280849ScyAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4320280849ScyAC_MSG_RESULT([$ntp_ok])
4321200576Sroberto
4322285169Scy###
4323285169Scy
4324285169ScyAC_MSG_CHECKING([if we want the experimental leap smear code])
4325285169ScyAC_ARG_ENABLE(
4326285169Scy    [leap-smear],
4327285169Scy    [AS_HELP_STRING(
4328285169Scy	[--enable-leap-smear],
4329285169Scy	[- experimental leap smear code]
4330285169Scy    )],
4331285169Scy    [ntp_ok=$enableval],
4332285169Scy    [ntp_ok=no]
4333285169Scy)
4334285169Scyntp_leap_smear_enabled=0
4335285169Scycase "$ntp_ok" in
4336285169Scy yes)
4337285169Scy    ntp_leap_smear_enabled=1
4338285169Scy    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4339285169Scy    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4340285169Scy    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4341285169Scy    ;;
4342285169Scyesac
4343285169ScyAC_MSG_RESULT([$ntp_ok])
4344285169Scy
4345298695Sdelphij###
4346298695Sdelphij
4347298695SdelphijAC_MSG_CHECKING([if we want dynamic interleave support])
4348298695SdelphijAC_ARG_ENABLE(
4349298695Sdelphij    [dynamic-interleave],
4350298695Sdelphij    [AS_HELP_STRING(
4351298695Sdelphij	[--enable-dynamic-interleave],
4352298695Sdelphij	[- dynamic interleave support]
4353298695Sdelphij    )],
4354298695Sdelphij    [ntp_ok=$enableval],
4355298695Sdelphij    [ntp_ok=no]
4356298695Sdelphij)
4357298695Sdelphijntp_dynamic_interleave=0
4358298695Sdelphijcase "$ntp_ok" in
4359298695Sdelphij yes)
4360298695Sdelphij    ntp_dynamic_interleave=1
4361298695Sdelphij    ;;
4362298695Sdelphijesac
4363298695SdelphijAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4364298695Sdelphij    [support dynamic interleave?])
4365298695SdelphijAC_MSG_RESULT([$ntp_ok])
4366298695Sdelphij
4367285169ScyNTP_UNITYBUILD
4368285169Scy
4369280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4370280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4371280849Scydnl  can't be conditionalized.
4372280849ScyNTP_GOOGLETEST
4373200576Sroberto
4374289764SglebiusNTP_PROBLEM_TESTS
4375289764Sglebius
4376181834Sroberto###
4377181834Sroberto
4378280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4379280849Scy    [Default location of crypto key info])
4380181834Sroberto
4381280849ScyAC_CONFIG_FILES([Makefile])
4382280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4383280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4384280849ScyAC_CONFIG_FILES([include/Makefile])
4385280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4386280849ScyAC_CONFIG_FILES([kernel/Makefile])
4387280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4388280849ScyAC_CONFIG_FILES([libntp/Makefile])
4389280849ScyAC_CONFIG_FILES([libparse/Makefile])
4390280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4391285169ScyAC_CONFIG_FILES([ntpd/complete.conf],	[sed -e '/^rlimit$/d' -e '/^$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf])
4392280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4393280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4394280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4395280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4396280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4397280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4398280849ScyAC_CONFIG_FILES([scripts/Makefile])
4399282408ScyAC_CONFIG_FILES([scripts/build/Makefile])
4400282408ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4401282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4402282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4403280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4404282408ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4405280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4406282408ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4407280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4408282408ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4409280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4410280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4411280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4412280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4413282408ScyAC_CONFIG_FILES([scripts/update-leap/Makefile])
4414285169ScyAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4415280849ScyAC_CONFIG_FILES([tests/Makefile])
4416285169ScyAC_CONFIG_FILES([tests/bug-2803/Makefile])
4417280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4418280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4419289764SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4420285169ScyAC_CONFIG_FILES([tests/sandbox/Makefile])
4421285169ScyAC_CONFIG_FILES([tests/sec-2853/Makefile])
4422280849ScyAC_CONFIG_FILES([util/Makefile])
4423181834Sroberto
4424280849Scyperllibdir="${datadir}/ntp/lib"
4425280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4426181834Sroberto
4427280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4428280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4429280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4430280849ScyAC_SUBST_FILE([ntp_wait_opts])
4431280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4432280849ScyAC_SUBST_FILE([ntpsweep_opts])
4433280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4434280849ScyAC_SUBST_FILE([ntptrace_opts])
4435280849Scysummary_opts="$srcdir/scripts/summary-opts"
4436280849ScyAC_SUBST_FILE([summary_opts])
4437280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4438280849ScyAC_SUBST_FILE([plot_summary_opts])
4439280849Scy
4440280849ScyAC_CONFIG_SUBDIRS([sntp])
4441280849Scy
4442181834SrobertoAC_OUTPUT
4443