1280849Scydnl NTP top-level configure.ac				-*- Autoconf -*-
2280849Scydnl
3280849Scym4_include([sntp/m4/version.m4])
4358659ScyAC_PREREQ([2.68])
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
45358659ScyAM_INIT_AUTOMAKE([1.15 foreign -Wall -Wno-gnu])
46280849Scy
47358659ScyAM_SILENT_RULES([yes])
48358659Scy
49280849ScyAC_CANONICAL_BUILD
50181834SrobertoAC_CANONICAL_HOST
51181834Srobertodnl the 'build' machine is where we run configure and compile
52181834Srobertodnl the 'host' machine is where the resulting stuff runs.
53280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
54280849Scy    [canonical system (cpu-vendor-os) of where we should run])
55280849ScyAC_CONFIG_HEADERS([config.h])
56181834Srobertodnl AC_ARG_PROGRAM
57181834Sroberto
58280849Scyntp_atom_ok=${ntp_atom_ok=no}
59280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
60280849Scyntp_parse_ok=${ntp_parse_ok=no}
61280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
62280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
63181834Sroberto
64280849ScyNTP_PROG_CC
65316068SdelphijNTP_COMPILER
66316068Sdelphij
67316068Sdelphijdnl # Do we need CXX for anything besides google test?
68316068Sdelphijdnl AC_PROG_CXX
69280849ScyAC_PROG_YACC
70316068Sdelphijdnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
71282408ScyAX_C99_STRUCT_INIT
72181834Sroberto
73316068SdelphijNTP_HARDEN([sntp])
74316068Sdelphij
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
172280849Scycase "$PROG_NET_SNMP_CONFIG" in
173280849Scy no) ;;
174280849Scy /*)
175280849Scy    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
176181834Sroberto    ;;
177280849Scy *)
178280849Scy    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
179280849Scy    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
180280849Scy;;
181181834Srobertoesac
182316068SdelphijAC_MSG_CHECKING([for net-snmp-config path])
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])
382358659ScyAC_CHECK_FUNCS([waitpid])
383181834Srobertocase "$host" in
384181834Sroberto*-convex-*)
385280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
386280849Scy    ;;
387181834Sroberto*-*-bsdi*)
388280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
389280849Scy    ;;
390181834Srobertoesac
391181834Sroberto
392285169Scycase "$ac_cv_header_stdatomic_h" in
393285169Scy yes)
394285169Scy	AC_CHECK_FUNCS([atomic_thread_fence])
395285169Scy	AC_CACHE_CHECK(
396285169Scy	    [for atomic_thread_fence()],
397285169Scy	    [ntp_cv_func_atomic_thread_fence],
398285169Scy	    [AC_COMPILE_IFELSE(
399285169Scy		[AC_LANG_PROGRAM(
400285169Scy		    [[
401285169Scy			#include <stdatomic.h>
402285169Scy		    ]],
403285169Scy		    [[
404285169Scy			atomic_thread_fence(memory_order_seq_cst);
405285169Scy		    ]]
406285169Scy		)]
407285169Scy		[ntp_cv_func_atomic_thread_fence=yes],
408285169Scy		[ntp_cv_func_atomic_thread_fence=no]
409285169Scy	    )]
410285169Scy	)
411285169Scy    ;;
412285169Scyesac
413285169Scy
414181834Srobertocase "$host" in
415280849Scy *-*-solaris2.6)
416280849Scy    # Broken...
417181834Sroberto    ;;
418181834Sroberto *)
419280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
420181834Sroberto    ;;
421181834Srobertoesac
422181834Sroberto
423280849Scycase "$host" in
424280849Scy *-*-*linux*)
425280849Scy    case "$ac_cv_func_ntp_gettime" in
426280849Scy     yes)
427280849Scy	;;
428280849Scy     *)
429280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
430280849Scy	case "$ac_cv_func___ntp_gettime" in
431280849Scy	 yes)
432280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
433280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
434280849Scy	esac
435280849Scy	;;
436280849Scy    esac
437280849Scy    AC_CHECK_FUNCS([adjtimex])
438280849Scy    case "$ac_cv_func_adjtimex" in
439280849Scy     yes)
440280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
441280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
442280849Scy	have_adjtimex=1
443280849Scy	;;
444280849Scy     *)
445280849Scy	AC_CHECK_FUNCS([__adjtimex])
446280849Scy	case "$ac_cv_func___adjtimex" in
447280849Scy	 yes)
448280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
449280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
450280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
451280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
452280849Scy	    have_adjtimex=1
453280849Scy	esac
454280849Scy	;;
455280849Scy    esac
456280849Scyesac
457280849Scycase "$have_adjtimex" in
458280849Scy '')
459280849Scy    # nlist stuff is only needed for tickadj.
460280849Scy    saved_LIBS="$LIBS"
461280849Scy    LIBS=
462280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
463280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
464280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
465280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
466280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
467280849Scy    case "$ac_cv_header_nlist_h" in
468280849Scy     yes)
469280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
470280849Scy	AC_CACHE_CHECK(
471280849Scy	    [for n_un in struct nlist],
472280849Scy	    [ntp_cv_struct_nlist_n_un],
473280849Scy	    [AC_COMPILE_IFELSE(
474280849Scy		[AC_LANG_PROGRAM(
475280849Scy		    [[
476280849Scy			#include <nlist.h>
477280849Scy		    ]],
478280849Scy		    [[
479280849Scy			struct nlist n;
480280849Scy			n.n_un.n_name = 0;
481280849Scy		    ]]
482280849Scy		)]
483280849Scy		[ntp_cv_struct_nlist_n_un=yes],
484280849Scy		[ntp_cv_struct_nlist_n_un=no]
485280849Scy	    )]
486280849Scy	)
487280849Scy	case "$ntp_cv_struct_nlist_n_un" in
488280849Scy	 yes)
489280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
490280849Scy		[does struct nlist use a name union?])
491280849Scy	esac
492280849Scy    esac
493280849Scy    AC_SUBST([LDADD_NLIST])
494280849Scy    LDADD_NLIST="$LIBS"
495280849Scy    LIBS="$saved_LIBS"
496280849Scy    AS_UNSET([saved_LIBS])
497280849Scyesac
498181834Sroberto
499280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
500280849Scy    #ifdef HAVE_SYS_TYPES_H
501280849Scy    # include <sys/types.h>
502280849Scy    #endif
503280849Scy    #ifdef HAVE_SYS_TIME_H
504280849Scy    # include <sys/time.h>
505280849Scy    #endif
506181834Sroberto])
507181834Sroberto
508280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
509280849Scy    #ifdef HAVE_SYS_TIME_H
510280849Scy    # include <sys/time.h>
511280849Scy    #endif
512181834Sroberto])
513181834Sroberto
514280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
515280849Scy    #ifdef HAVE_SYS_TYPES_H
516280849Scy    # include <sys/types.h>
517280849Scy    #endif
518280849Scy    #ifdef HAVE_SYS_IPC_H
519280849Scy    # include <sys/ipc.h>
520280849Scy    #endif
521181834Sroberto])
522181834Sroberto
523280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
524280849Scy    #ifdef HAVE_SYS_TIME_H
525280849Scy    # include <sys/time.h>
526280849Scy    #endif
527181834Sroberto])
528181834Sroberto
529330106SdelphijNTP_AF_UNSPEC
530330106Sdelphij
531181834SrobertoAC_TYPE_SIGNAL
532181834SrobertoAC_TYPE_OFF_T
533280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
534181834Sroberto
535280849ScyAC_CACHE_CHECK(
536280849Scy    [for a fallback value for HZ],
537280849Scy    [ntp_cv_default_hz],
538280849Scy    [
539280849Scy	ntp_cv_default_hz=100
540280849Scy	case "$host" in
541280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
542280849Scy	    ntp_cv_default_hz=1024
543280849Scy	    ;;
544280849Scy	 mips-dec-ultrix4*)
545280849Scy	    ntp_cv_default_hz=256
546280849Scy	    ;;
547280849Scy	esac
548280849Scy    ]
549280849Scy)
550280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
551280849Scy    [What is the fallback value for HZ?])
552181834Sroberto
553280849ScyAC_CACHE_CHECK(
554280849Scy    [if we need to override the system's value for HZ],
555280849Scy    [ntp_cv_override_hz],
556280849Scy    [
557280849Scy	ntp_cv_override_hz=no
558280849Scy	case "$host" in
559280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
560280849Scy	    ntp_cv_override_hz=yes
561280849Scy	    ;;
562280849Scy	 mips-dec-ultrix4*)
563280849Scy	    ntp_cv_override_hz=yes
564280849Scy	    ;;
565280849Scy	 *-*-freebsd*)
566280849Scy	    ntp_cv_override_hz=yes
567280849Scy	    ;;
568280849Scy	 *-*-sunos4*)
569280849Scy	    ntp_cv_override_hz=yes
570280849Scy	    ;;
571280849Scy	 *-*-kfreebsd*)
572280849Scy	    ntp_cv_override_hz=yes
573280849Scy	    ;;
574280849Scy	esac
575280849Scy    ]
576280849Scy)
577280849Scycase "$ntp_cv_override_hz" in
578181834Sroberto yes)
579280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
580280849Scy	[Do we need to override the system's idea of HZ?])
581181834Srobertoesac
582181834Sroberto
583181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
584181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
585181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
586181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
587181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
588181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
589181834Srobertodnl fi
590181834Sroberto
591181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
592181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
593181834Srobertodnl [AC_EGREP_CPP(yes,
594181834Srobertodnl [#ifdef HAVE_UTMPX_H
595181834Srobertodnl #include <utmpx.h>
596181834Srobertodnl #else
597181834Srobertodnl #include <utmp.h>
598181834Srobertodnl #endif
599181834Srobertodnl #ifdef BOOT_TIME
600181834Srobertodnl yes
601181834Srobertodnl #endif
602181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
603181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
604181834Sroberto
605280849ScyAC_CACHE_CHECK(
606280849Scy    [for struct rt_msghdr],
607280849Scy    [ntp_cv_struct_rt_msghdr],
608280849Scy    [AC_COMPILE_IFELSE(
609280849Scy	[AC_LANG_PROGRAM(
610280849Scy	    [[
611280849Scy		#include <sys/types.h>
612280849Scy		#include <sys/socket.h>
613280849Scy		#include <net/if.h>
614280849Scy		#include <net/route.h>
615280849Scy	    ]],
616280849Scy	    [[
617280849Scy		struct rt_msghdr p;
618280849Scy	    ]]
619280849Scy	)],
620280849Scy	[ntp_cv_struct_rt_msghdr=yes],
621280849Scy	[ntp_cv_struct_rt_msghdr=no]
622280849Scy    )]
623280849Scy)
624200576Sroberto
625181834SrobertoAC_CACHE_CHECK(
626280849Scy    [for struct rtattr],
627280849Scy    [ntp_cv_rtattr],
628280849Scy    [AC_COMPILE_IFELSE(
629280849Scy	[AC_LANG_PROGRAM(
630280849Scy	    [[
631280849Scy		#include <stddef.h>
632280849Scy		#include <sys/socket.h>
633280849Scy		#include <linux/rtnetlink.h>
634280849Scy	    ]],
635280849Scy	    [[
636280849Scy		struct rtattr p;
637280849Scy	    ]]
638280849Scy	)],
639280849Scy	[ntp_cv_rtattr=yes],
640280849Scy	[ntp_cv_rtattr=no]
641280849Scy    )]
642181834Sroberto)
643181834Sroberto
644280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
645280849Scy *yes*)
646280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
647280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
648280849Scy    case "$ntp_cv_rtattr" in
649280849Scy     yes)
650280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
651280849Scy	    [Do we have Linux routing socket?])
652181834Sroberto    esac
653280849Scyesac
654181834Sroberto
655280849ScyAC_CACHE_CHECK(
656280849Scy    [struct sigaction for sa_sigaction],
657280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
658280849Scy    [AC_COMPILE_IFELSE(
659280849Scy	[AC_LANG_PROGRAM(
660280849Scy	    [[
661280849Scy		#include <signal.h>
662280849Scy	    ]],
663280849Scy	    [[
664280849Scy		struct sigaction act;
665280849Scy		act.sa_sigaction = 0;
666280849Scy	    ]]
667280849Scy	)],
668280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
669280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
670280849Scy    )]
671280849Scy)
672280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
673280849Scy yes)
674280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
675280849Scyesac
676181834Sroberto
677280849ScyAC_CACHE_CHECK(
678280849Scy    [for struct ppsclockev],
679280849Scy    [ntp_cv_struct_ppsclockev],
680280849Scy    [AC_COMPILE_IFELSE(
681280849Scy	[AC_LANG_PROGRAM(
682280849Scy	    [[
683280849Scy		#ifdef HAVE_SYS_TYPES_H
684280849Scy		# include <sys/types.h>
685280849Scy		#endif
686280849Scy		#ifdef HAVE_SYS_TERMIOS_H
687280849Scy		# include <sys/termios.h>
688280849Scy		#endif
689280849Scy		#ifdef HAVE_SYS_TIME_H
690280849Scy		# include <sys/time.h>
691280849Scy		#endif
692280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
693280849Scy		# include <sys/ppsclock.h>
694280849Scy		#endif
695280849Scy	    ]],
696280849Scy	    [[
697280849Scy		extern struct ppsclockev *pce;
698280849Scy		return pce->serial;
699280849Scy	    ]]
700280849Scy	)],
701280849Scy	[ntp_cv_struct_ppsclockev=yes],
702280849Scy	[ntp_cv_struct_ppsclockev=no]
703280849Scy    )]
704280849Scy)
705280849Scycase "$ntp_cv_struct_ppsclockev" in
706280849Scy yes)
707280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
708280849Scy	[Does a system header define struct ppsclockev?])
709280849Scyesac
710181834Sroberto
711181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
712181834Sroberto  *yes*)
713280849Scy    AC_CACHE_CHECK(
714280849Scy	[for struct snd_size],
715280849Scy	[ntp_cv_struct_snd_size],
716280849Scy	[AC_COMPILE_IFELSE(
717280849Scy	    [AC_LANG_PROGRAM(
718280849Scy		[[
719280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
720280849Scy		    # include <machine/soundcard.h>
721280849Scy		    #endif
722280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
723280849Scy		    # include <sys/soundcard.h>
724280849Scy		    #endif
725280849Scy		]],
726280849Scy		[[
727280849Scy		    extern struct snd_size *ss;
728280849Scy		    return ss->rec_size;
729280849Scy		]]
730280849Scy	    )],
731280849Scy	    [ntp_cv_struct_snd_size=yes],
732280849Scy	    [ntp_cv_struct_snd_size=no]
733280849Scy        )]
734280849Scy    )
735280849Scy    case "$ntp_cv_struct_snd_size" in
736280849Scy     yes)
737280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
738280849Scy	    [Do we have struct snd_size?])
739181834Sroberto    esac
740181834Srobertoesac
741181834Sroberto
742280849ScyAC_CACHE_CHECK(
743280849Scy    [struct clockinfo for hz],
744280849Scy    [ntp_cv_struct_clockinfo_has_hz],
745280849Scy    [AC_COMPILE_IFELSE(
746280849Scy	[AC_LANG_PROGRAM(
747280849Scy	    [[
748280849Scy		#include <sys/time.h>
749280849Scy	    ]],
750280849Scy	    [[
751280849Scy		extern struct clockinfo *pc;
752280849Scy		return pc->hz;
753280849Scy	    ]]
754280849Scy	)],
755280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
756280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
757280849Scy    )]
758280849Scy)
759280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
760280849Scy yes)
761280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
762280849Scyesac
763181834Sroberto
764280849ScyAC_CACHE_CHECK(
765280849Scy    [struct clockinfo for tickadj],
766280849Scy    [ntp_cv_struct_clockinfo_has_hz],
767280849Scy    [AC_COMPILE_IFELSE(
768280849Scy	[AC_LANG_PROGRAM(
769280849Scy	    [[
770280849Scy		#include <sys/time.h>
771280849Scy	    ]],
772280849Scy	    [[
773280849Scy		extern struct clockinfo *pc;
774280849Scy		return pc->tickadj;
775280849Scy	    ]]
776280849Scy	)],
777280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
778280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
779280849Scy    )]
780280849Scy)
781280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
782280849Scy yes)
783280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
784280849Scyesac
785181834Sroberto
786280849Scycase "$ntp_cv_struct_ntptimeval" in
787280849Scy yes)
788280849Scy    AC_CHECK_MEMBERS(
789280849Scy	[struct ntptimeval.time.tv_nsec],
790280849Scy	[],
791280849Scy	[],
792280849Scy	[
793280849Scy	    #ifdef HAVE_SYS_TIME_H
794280849Scy	    # include <sys/time.h>
795280849Scy	    #else
796280849Scy	    # ifdef HAVE_TIME_H
797280849Scy	    #  include <time.h>
798280849Scy	    # endif
799280849Scy	    #endif
800280849Scy	    #ifdef HAVE_SYS_TIMEX_H
801280849Scy	    # include <sys/timex.h>
802280849Scy	    #else
803280849Scy	    # ifdef HAVE_TIMEX_H
804280849Scy	    #  include <timex.h>
805280849Scy	    # endif
806280849Scy	    #endif
807280849Scy	]
808280849Scy    )
809200576Srobertoesac
810200576Sroberto
811280849Scy#### 
812181834Sroberto
813280849ScyAC_CHECK_FUNCS([arc4random_buf])
814181834Sroberto
815280849Scy#### 
816181834Sroberto
817280849Scysaved_LIBS="$LIBS"
818280849ScyLIBS="$LIBS $LDADD_LIBNTP"
819280849ScyAC_CHECK_FUNCS([daemon])
820280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
821280849ScyLIBS="$saved_LIBS"
822280849ScyAS_UNSET([saved_LIBS])
823181834Sroberto
824280849ScyAC_CHECK_FUNCS(
825280849Scy    [finite],
826280849Scy    [],
827280849Scy    [AC_CHECK_FUNCS(
828280849Scy	[isfinite],
829280849Scy	[],
830280849Scy	[
831280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
832280849Scy	    _libs=$LIBS
833280849Scy	    # XXX
834280849Scy	    LIBS="$LIBS -lm"
835280849Scy	    AC_LINK_IFELSE(
836280849Scy		[AC_LANG_PROGRAM(
837280849Scy		    [[
838280849Scy			#include <math.h>
839280849Scy		    ]],
840280849Scy		    [[
841280849Scy			float f = 0.0;
842280849Scy			isfinite(f);
843280849Scy		    ]]
844280849Scy		)],
845280849Scy		[ans=yes],
846280849Scy		[ans=no]
847280849Scy	    )
848280849Scy	    LIBS=$_libs
849280849Scy	    AC_MSG_RESULT([$ans])
850280849Scy	    case "$ans" in
851280849Scy	     yes)
852280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
853280849Scy	    esac
854280849Scy	]
855280849Scy    )]
856280849Scy)
857181834Sroberto
858280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
859181834Sroberto
860280849Scy# kvm_open() is only used by tickadj.  Also see above.
861280849Scycase "$ac_cv_header_kvm_h" in
862280849Scy yes)
863280849Scy    AC_CHECK_FUNCS([kvm_open])
864181834Sroberto    ;;
865181834Srobertoesac
866181834Sroberto
867181834Srobertocase "$host" in
868181834Sroberto *-*-sco3.2v5.0.*)
869280849Scy    # Just stubs.  Sigh.
870181834Sroberto    ;;
871280849Scy *) AC_CHECK_FUNCS([mkstemp])
872181834Sroberto    ;;
873181834Srobertoesac
874280849ScyAC_CHECK_FUNCS([mktime])
875181834Srobertocase "$host" in
876280849Scy *-*-aix[[4-9]]*)
877280849Scy    # XXX only verified thru AIX6.
878280849Scy    # Just a stub.  Sigh.
879181834Sroberto    ;;
880181834Sroberto *-*-irix[[45]]*)
881280849Scy    # Just a stub in "old" Irix.  Sigh.
882181834Sroberto    ;;
883280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
884280849Scy# *-*-*linux*)
885280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
886280849Scy#    ;;
887181834Sroberto *-*-qnx*)
888280849Scy    # Apparently there but not working in QNX.  Sigh?
889181834Sroberto    ;;
890181834Sroberto *-*-sco3.2v5.0.*)
891280849Scy    # Just a stub.  Sigh.
892181834Sroberto    ;;
893181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
894181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
895181834Sroberto    # Not easy to test for - cheat.
896280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
897280849Scy    AC_CHECK_FUNCS([mlockall])
898181834Sroberto    ;;
899280849Scy *) AC_CHECK_FUNCS([mlockall])
900181834Sroberto    ;;
901181834Srobertoesac
902280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
903181834Srobertocase "$host" in
904280849Scy *-*-aix[[4-9]]*)
905280849Scy    # XXX only verified thru AIX6.
906280849Scy    # Just a stub in AIX 4.  Sigh.
907181834Sroberto    ;;
908181834Sroberto *-*-solaris2.5*)
909280849Scy    # Just stubs in solaris2.5.  Sigh.
910181834Sroberto    ;;
911280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
912181834Sroberto    ;;
913181834Srobertoesac
914280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
915362716ScyAC_CHECK_FUNCS([strdup strnlen memchr strerror setrlimit strchr])
916181834Srobertocase "$host" in
917280849Scy *-*-aix[[4-9]]*)
918280849Scy    # XXX only verified thru AIX6.
919280849Scy    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-netbsd1*)
922280849Scy    # Just stubs.  Sigh.
923181834Sroberto    ;;
924181834Sroberto *-*-netbsdelf1*)
925280849Scy    # Just stubs.  Sigh.
926181834Sroberto    ;;
927181834Sroberto *-*-openbsd*)
928280849Scy    # Just stubs.  Sigh.
929181834Sroberto    ;;
930280849Scy *)
931280849Scy    AC_CHECK_FUNCS([timer_create])
932181834Sroberto    ;;
933181834Srobertoesac
934181834Sroberto
935280849ScyNTP_RLIMIT_ITEMS
936181834Sroberto
937280849Scy# some OSes prefer _exit() in forked children to exit()
938280849ScyAC_CHECK_FUNCS([_exit])
939280849Scyntp_worker_child_exit=exit
940280849Scycase "$ac_cv_func__exit::$host_os" in
941280849Scy yes::netbsd*)
942280849Scy    ntp_worker_child_exit=_exit
943280849Scy    ;;
944280849Scy yes::openbsd*)
945280849Scy    ntp_worker_child_exit=_exit
946280849Scy    ;;
947280849Scyesac
948280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
949280849Scy		   [routine worker child proc uses to exit.])
950181834Sroberto
951280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
952181834Sroberto
953280849Scy###
954181834Sroberto
955280849Scy# http://bugs.ntp.org/737
956280849Scycase "$ac_cv_func_recvmsg" in
957280849Scy yes)
958280849Scy    AC_CACHE_CHECK(
959280849Scy	[if we need extra help to define struct iovec],
960280849Scy	[ntp_cv_struct_iovec_help],
961280849Scy	[
962280849Scy	    compiled=no
963280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
964280849Scy		AC_COMPILE_IFELSE(
965280849Scy		    [AC_LANG_PROGRAM(
966280849Scy			[[
967280849Scy			    #ifdef HAVE_SYS_TYPES_H
968280849Scy			    # include <sys/types.h>
969280849Scy			    #endif
970280849Scy			    #ifdef HAVE_SYS_SOCKET_H
971280849Scy			    # include <sys/socket.h>
972280849Scy			    #endif
973280849Scy			    #if $ntp_cv_struct_iovec_help
974280849Scy			    # include <sys/uio.h>
975280849Scy			    #endif
976280849Scy			]],
977280849Scy			[[
978280849Scy			    void foo(void) {
979280849Scy				ssize_t x;
980280849Scy				int s = 0;
981280849Scy				struct iovec iov;
982280849Scy				struct msghdr mh;
983280849Scy				int flags = 0;
984181834Sroberto
985280849Scy				mh.msg_iov = &iov;
986280849Scy				x = recvmsg(s, &mh, flags);
987280849Scy			    }
988280849Scy			]]
989280849Scy		    )],
990280849Scy		    [compiled=yes ; break 1],
991280849Scy		    []
992280849Scy		)
993280849Scy	    done
994280849Scy	    case "$compiled" in
995280849Scy	     no)
996280849Scy		ntp_cv_struct_iovec_help=0
997280849Scy	    esac
998280849Scy	    AS_UNSET([compiled])
999280849Scy	]
1000280849Scy    )
1001280849Scy    case "$ntp_cv_struct_iovec_help" in
1002280849Scy     1)
1003280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1004280849Scy	    [Use sys/uio.h for struct iovec help])
1005280849Scy    esac
1006181834Srobertoesac
1007181834Sroberto
1008280849ScyAC_CACHE_CHECK(
1009280849Scy    [number of arguments taken by setpgrp()],
1010280849Scy    [ntp_cv_func_setpgrp_nargs],
1011280849Scy    [AC_COMPILE_IFELSE(
1012280849Scy	[AC_LANG_PROGRAM(
1013280849Scy	    [[
1014280849Scy		#ifdef HAVE_SYS_TYPES_H
1015280849Scy		# include <sys/types.h>
1016280849Scy		#endif
1017280849Scy		#ifdef HAVE_UNISTD_H
1018280849Scy		# include <unistd.h>
1019280849Scy		#endif
1020280849Scy	    ]],
1021280849Scy	    [[
1022280849Scy		setpgrp(0, 0);
1023280849Scy	    ]]
1024280849Scy	)],
1025280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1026280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1027280849Scy    )]
1028280849Scy)
1029280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1030280849Scy 0)
1031280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1032280849Scy	      [define if setpgrp takes 0 arguments])
1033280849Scyesac
1034181834Sroberto
1035280849ScyAC_CACHE_CHECK(
1036280849Scy    [if we need to declare 'errno'],
1037280849Scy    [ntp_cv_decl_errno],
1038280849Scy    [AC_COMPILE_IFELSE(
1039280849Scy	[AC_LANG_PROGRAM(
1040280849Scy	    [[
1041280849Scy		#ifdef HAVE_ERRNO_H
1042280849Scy		# include <errno.h>
1043280849Scy		#endif
1044280849Scy	    ]],
1045280849Scy	    [[
1046280849Scy		errno = 0;
1047280849Scy	    ]]
1048280849Scy	)],
1049280849Scy	[ntp_cv_decl_errno=no],
1050280849Scy	[ntp_cv_decl_errno=yes]
1051280849Scy    )]
1052280849Scy)
1053280849Scycase "$ntp_cv_decl_errno" in
1054280849Scy yes)
1055280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1056181834Srobertoesac
1057181834Sroberto
1058181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1059181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1060181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1061181834Srobertodnl without breaking any other platforms.
1062181834Srobertodnl
1063280849ScyAC_CACHE_CHECK(
1064280849Scy    [if we may declare 'h_errno'],
1065280849Scy    [ntp_cv_decl_h_errno],
1066280849Scy    [AC_COMPILE_IFELSE(
1067280849Scy	[AC_LANG_PROGRAM(
1068280849Scy	    [[
1069280849Scy		#include <sys/types.h>
1070280849Scy		#ifdef HAVE_NETINET_IN_H
1071280849Scy		# include <netinet/in.h>
1072280849Scy		#endif
1073280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1074280849Scy		# include <arpa/nameser.h>
1075280849Scy		#endif
1076280849Scy		#ifdef HAVE_NETDB_H
1077280849Scy		# include <netdb.h>
1078280849Scy		#endif
1079280849Scy		#ifdef HAVE_RESOLV_H
1080280849Scy		# include <resolv.h>
1081280849Scy		#endif
1082280849Scy	    ]],
1083280849Scy	    [[
1084280849Scy		extern int h_errno;
1085280849Scy	    ]]
1086280849Scy	)],
1087280849Scy	[ntp_cv_decl_h_errno=yes],
1088280849Scy	[ntp_cv_decl_h_errno=no]
1089280849Scy    )]
1090280849Scy)
1091280849Scycase "$ntp_cv_decl_h_errno" in
1092280849Scy yes)
1093280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1094181834Srobertoesac
1095181834Sroberto
1096280849ScyAC_CACHE_CHECK(
1097280849Scy    [if declaring 'syscall()' is ok],
1098280849Scy    [ntp_cv_decl_syscall],
1099280849Scy    [AC_COMPILE_IFELSE(
1100280849Scy	[AC_LANG_PROGRAM(
1101280849Scy	    [[
1102280849Scy		#ifdef HAVE_SYS_TYPES_H
1103280849Scy		# include <sys/types.h>
1104280849Scy		#endif
1105280849Scy		#ifdef HAVE_UNISTD_H
1106280849Scy		# include <unistd.h>
1107280849Scy		#endif
1108280849Scy	    ]],
1109280849Scy	    [[
1110280849Scy		extern int syscall (int, ...);
1111280849Scy	    ]]
1112280849Scy	)]
1113280849Scy	[ntp_cv_decl_syscall=yes],
1114280849Scy	[ntp_cv_decl_syscall=no]
1115280849Scy    )]
1116280849Scy)
1117280849Scycase "$ntp_cv_decl_syscall" in
1118280849Scy yes)
1119280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1120181834Srobertoesac
1121181834Sroberto
1122181834Srobertocase "$host" in
1123181834Sroberto *-*-aix4.3.*)
1124280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1125181834Sroberto    ;;
1126181834Sroberto *-*-mpeix*)
1127280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1128280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1129280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1130280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1131280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1132280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1133280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1134181834Sroberto    ;;
1135181834Sroberto *-*-osf[[45]]*)
1136280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1137280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1138181834Sroberto    ;;
1139181834Sroberto *-*-qnx*)
1140280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141181834Sroberto    ;;
1142181834Sroberto *-*-riscos4*)
1143280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1144280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1145280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1146280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1147280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1148280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1149280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1150280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1151280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1152280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1153280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1154280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1155280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1156280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1157280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1158280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1159181834Sroberto    ;;
1160181834Sroberto *-*-solaris2*)
1161280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1162280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1163181834Sroberto    case "$host" in
1164181834Sroberto     *-*-solaris2.4)
1165280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1166181834Sroberto	;;
1167181834Sroberto    esac
1168181834Sroberto    ;;
1169181834Sroberto *-*-sunos4*)
1170280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1171280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1172280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1173280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1174280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1175280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1176280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1177280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1178280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1179280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1180280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1181280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1182280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1183181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1184181834Sroberto     acc*) ;;
1185280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1186181834Sroberto	;;
1187181834Sroberto    esac
1188280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1189280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1190280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1191280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1192280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1193280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1194280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1195181834Sroberto    ;;
1196181834Sroberto *-*-ultrix4*)
1197280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1198280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1199280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1200280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1201280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1202280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1203280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1204280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1207280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1208280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1209280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1210280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1211181834Sroberto    ;;
1212181834Srobertoesac
1213181834Sroberto
1214181834Srobertocase "$host" in
1215181834Sroberto *-*-sco3.2*)
1216280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1217280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1218181834Sroberto    ;;
1219181834Srobertoesac
1220181834Sroberto
1221181834Srobertocase "$host" in
1222181834Sroberto *-*-hpux[[567]]*)
1223280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1224280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1225181834Srobertoesac
1226181834Sroberto
1227280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1228280849ScyAC_CACHE_CHECK(
1229280849Scy    [if we will open the broadcast socket],
1230280849Scy    [ntp_cv_var_open_bcast_socket],
1231280849Scy    [
1232280849Scy	ans=yes
1233280849Scy	case "$host" in
1234280849Scy	 *-*-domainos)
1235280849Scy	    ans=no
1236280849Scy	esac
1237280849Scy	ntp_cv_var_open_bcast_socket=$ans
1238280849Scy    ]
1239280849Scy)
1240280849Scycase "$ntp_cv_var_open_bcast_socket" in
1241280849Scy yes)
1242280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1243280849Scy	[Should we open the broadcast socket?])
1244181834Srobertoesac
1245181834Sroberto
1246181834Srobertocase "$host" in
1247181834Sroberto *-*-hpux*)
1248280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1249280849Scy	[Do we want the HPUX FindConfig()?])
1250181834Srobertoesac
1251181834Sroberto
1252280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1253280849ScyAC_CACHE_CHECK(
1254280849Scy    [if process groups are set with -pid],
1255280849Scy    [ntp_cv_arg_setpgrp_negpid],
1256280849Scy    [
1257280849Scy	case "$host" in
1258280849Scy	 *-*-hpux[[567]]*)
1259280849Scy	    ans=no
1260280849Scy	    ;;
1261280849Scy	 *-*-hpux*)
1262280849Scy	    ans=yes
1263280849Scy	    ;;
1264280849Scy	 *-*-*linux*)
1265280849Scy	    ans=yes
1266280849Scy	    ;;
1267280849Scy	 *-*-sunos3*)
1268280849Scy	    ans=yes
1269280849Scy	    ;;
1270280849Scy	 *-*-ultrix2*)
1271280849Scy	    ans=yes
1272280849Scy	    ;;
1273280849Scy	 *)
1274280849Scy	    ans=no
1275280849Scy	    ;;
1276280849Scy	esac
1277280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1278280849Scy    ]
1279280849Scy)
1280280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1281181834Sroberto yes)
1282280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1283280849Scy	[Do we set process groups with -pid?])
1284181834Srobertoesac
1285181834Sroberto
1286280849ScyAC_CACHE_CHECK(
1287280849Scy    [if we need a ctty for F_SETOWN],
1288280849Scy    [ntp_cv_func_ctty_for_f_setown],
1289280849Scy    [
1290280849Scy	case "$host" in
1291280849Scy	 *-*-bsdi[[23]]*)
1292280849Scy	    ans=yes
1293280849Scy	    ;;
1294280849Scy	 *-*-freebsd*)
1295280849Scy	    ans=yes
1296280849Scy	    ;;
1297280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1298280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1299280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1300280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1301280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1302280849Scy	    ans=yes
1303280849Scy	    ;;
1304280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1305280849Scy	    ans=yes
1306280849Scy	    ;;
1307280849Scy	 *-*-openbsd*)
1308280849Scy	    ans=yes
1309280849Scy	    ;;
1310280849Scy	 *-*-osf*)
1311280849Scy	    ans=yes
1312280849Scy	    ;;
1313280849Scy	 *-*-darwin*)
1314280849Scy	    ans=yes
1315280849Scy	    ;;
1316280849Scy	 *)
1317280849Scy	    ans=no
1318280849Scy	    ;;
1319280849Scy	esac
1320280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1321280849Scy    ]
1322280849Scy)
1323280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1324181834Sroberto yes)
1325280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1326181834Srobertoesac
1327181834Sroberto
1328280849ScyAC_CACHE_CHECK(
1329280849Scy    [if the OS clears cached routes when more specifics become available],
1330280849Scy    [ntp_cv_os_routeupdates],
1331280849Scy    [
1332280849Scy	case "$host" in
1333280849Scy	 *-*-netbsd*)
1334280849Scy	    ans=yes
1335280849Scy	    ;;
1336280849Scy	 *)
1337280849Scy	    ans=no
1338280849Scy	    ;;
1339280849Scy	esac
1340280849Scy	ntp_cv_os_routeupdates=$ans
1341280849Scy    ]
1342280849Scy)
1343280849Scycase "$ntp_cv_os_routeupdates" in
1344181834Sroberto yes)
1345280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1346280849Scy	[need to recreate sockets on changed routing?])
1347181834Srobertoesac
1348181834Sroberto
1349280849ScyAC_CACHE_CHECK(
1350280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1351280849Scy    [ntp_cv_os_wildcardreuse],
1352280849Scy    [
1353280849Scy	case "$host" in
1354280849Scy	 *-*-*linux*)
1355280849Scy	    ans=yes
1356280849Scy	    ;;
1357280849Scy	 *) ans=no
1358280849Scy	    ;;
1359280849Scy	esac
1360280849Scy	ntp_cv_os_wildcardreuse=$ans
1361280849Scy    ]
1362280849Scy)
1363280849Scycase "$ntp_cv_os_wildcardreuse" in
1364181834Sroberto yes)
1365280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1366280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1367181834Srobertoesac
1368181834Sroberto
1369181834Srobertocase "$host" in
1370181834Sroberto *-*-aix*)
1371280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1372280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1373181834Srobertoesac
1374181834Sroberto
1375280849ScyAC_CACHE_CHECK(
1376280849Scy    [for a minimum recommended value of tickadj],
1377280849Scy    [ntp_cv_var_min_rec_tickadj],
1378280849Scy    [
1379280849Scy	ans=no
1380280849Scy	case "$host" in
1381280849Scy	 *-*-aix*)
1382280849Scy	    ans=40
1383280849Scy	    ;;
1384280849Scy	esac
1385280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1386280849Scy    ]
1387280849Scy)
1388280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1389280849Scy ''|no)
1390181834Sroberto    ;;
1391280849Scy *)
1392280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1393280849Scy	[Should we recommend a minimum value for tickadj?])
1394181834Srobertoesac
1395280849Scy
1396280849ScyAC_CACHE_CHECK(
1397280849Scy    [if the TTY code permits PARENB and IGNPAR],
1398280849Scy    [ntp_cv_no_parenb_ignpar],
1399280849Scy    [
1400280849Scy	ans=no
1401280849Scy	case "$host" in
1402280849Scy	 i?86-*-*linux*)
1403280849Scy	    ans=yes
1404280849Scy	    ;;
1405280849Scy	 mips-sgi-irix*)
1406280849Scy	    ans=yes
1407280849Scy	    ;;
1408280849Scy	 i?86-*-freebsd[[123]].*)
1409280849Scy	    ;;
1410280849Scy	 i?86-*-freebsd*)
1411280849Scy	    ans=yes
1412280849Scy	    ;;
1413280849Scy	 *-*-unicosmp*)
1414280849Scy	    ans=yes
1415280849Scy	    ;;
1416280849Scy	esac
1417280849Scy	ntp_cv_no_parenb_ignpar=$ans
1418280849Scy    ]
1419280849Scy)
1420280849Scycase "$ntp_cv_no_parenb_ignpar" in
1421280849Scy yes)
1422280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1423280849Scy	[Is there a problem using PARENB and IGNPAR?])
1424181834Srobertoesac
1425181834Sroberto
1426280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1427280849ScyAC_ARG_ENABLE(
1428280849Scy    [debug-timing],
1429280849Scy    [AS_HELP_STRING(
1430280849Scy	[--enable-debug-timing],
1431280849Scy	[- include processing time debugging code (costs performance)]
1432280849Scy    )],
1433280849Scy    [ntp_ok=$enableval],
1434280849Scy    [ntp_ok=no]
1435280849Scy)
1436280849Scycase "$ntp_ok" in
1437280849Scy yes)
1438280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1439181834Srobertoesac
1440280849ScyAC_MSG_RESULT([$ntp_ok])
1441181834Sroberto
1442280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1443200576SrobertoAC_ARG_ENABLE(
1444280849Scy    [dst-minutes],
1445280849Scy    [AS_HELP_STRING(
1446200576Sroberto	[--enable-dst-minutes],
1447280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1448280849Scy    ],
1449200576Sroberto    [ans=$enableval],
1450200576Sroberto    [ans=60]
1451200576Sroberto)
1452280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1453280849Scy    [The number of minutes in a DST adjustment])
1454200576SrobertoAC_MSG_RESULT([$ans])
1455181834Sroberto
1456280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1457200576SrobertoAC_ARG_ENABLE(
1458200576Sroberto    [ignore-dns-errors],
1459280849Scy    [AS_HELP_STRING(
1460280849Scy	[--enable-ignore-dns-errors],
1461200576Sroberto	[- retry DNS queries on any error]
1462280849Scy    )],
1463200576Sroberto    [ans=$enableval],
1464200576Sroberto    [ans=no]
1465200576Sroberto)
1466200576Srobertocase "$ans" in
1467200576Sroberto yes)
1468280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1469280849Scy	[Retry queries on _any_ DNS error?])
1470200576Srobertoesac
1471200576SrobertoAC_MSG_RESULT([$ans])
1472200576Sroberto
1473280849ScyAC_CACHE_CHECK(
1474280849Scy    [availability of ntp_{adj,get}time()],
1475280849Scy    [ntp_cv_var_ntp_syscalls],
1476280849Scy    [
1477280849Scy	ntp_cv_var_ntp_syscalls=no
1478280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1479280849Scy	 yesyes*)
1480280849Scy	    ntp_cv_var_ntp_syscalls=libc
1481181834Sroberto	    ;;
1482280849Scy	 *yes)
1483280849Scy	    ntp_cv_var_ntp_syscalls=inline
1484181834Sroberto	    ;;
1485280849Scy	 *)
1486280849Scy	    AC_PREPROC_IFELSE(
1487282408Scy		[AC_LANG_SOURCE(
1488282408Scy		    [
1489282408Scy			#include <sys/syscall.h>
1490282408Scy			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1491282408Scy			# error
1492282408Scy			#endif
1493282408Scy		    ])],
1494280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1495280849Scy	    )
1496181834Sroberto	    ;;
1497280849Scy	 esac
1498280849Scy    ]
1499280849Scy)
1500280849Scycase "$ntp_cv_var_ntp_syscalls" in
1501181834Sroberto libc)
1502280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1503280849Scy	[Do we have ntp_{adj,get}time in libc?])
1504181834Sroberto    ;;
1505181834Sroberto kernel)
1506280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1507280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1508181834Sroberto    ;;
1509181834Srobertoesac
1510181834Sroberto
1511280849ScyAC_CACHE_CHECK(
1512280849Scy    [if sys/timex.h has STA_FLL],
1513280849Scy    [ntp_cv_var_sta_fll],
1514280849Scy    [AC_PREPROC_IFELSE(
1515282408Scy	[AC_LANG_SOURCE(
1516282408Scy	    [
1517282408Scy		#include <sys/timex.h>
1518282408Scy		#ifndef STA_FLL
1519282408Scy		# error
1520282408Scy		#endif
1521282408Scy	    ])],
1522280849Scy	[ntp_cv_var_sta_fll=yes],
1523280849Scy	[ntp_cv_var_sta_fll=no]
1524280849Scy    )]
1525280849Scy)
1526181834Sroberto
1527280849ScyAC_CACHE_CHECK(
1528280849Scy    [if we have kernel PLL support],
1529280849Scy    [ntp_cv_var_kernel_pll],
1530280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1531280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1532280849Scy	 *no*)
1533280849Scy	    ntp_cv_var_kernel_pll=no
1534280849Scy	    ;;
1535280849Scy	 *) ntp_cv_var_kernel_pll=yes
1536280849Scy	    ;;
1537280849Scy	esac
1538280849Scy    ]
1539280849Scy)
1540280849Scycase "$ntp_cv_var_kernel_pll" in
1541181834Sroberto yes)
1542280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1543280849Scy	[Does the kernel support precision time discipline?])
1544181834Srobertoesac
1545181834Sroberto
1546280849ScyAC_CACHE_CHECK(
1547280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1548280849Scy    [ntp_cv_size_returned_in_buffer],
1549280849Scy    [
1550280849Scy	ans=no
1551280849Scy	case "$host" in
1552280849Scy	 *-fujitsu-uxp*)
1553280849Scy	    ans=yes
1554280849Scy	    ;;
1555280849Scy	 *-ncr-sysv4*)
1556280849Scy	    ans=yes
1557280849Scy	    ;;
1558280849Scy	 *-univel-sysv*)
1559280849Scy	    ans=yes
1560280849Scy	    ;;
1561280849Scy	esac
1562280849Scy	ntp_cv_size_returned_in_buffer=$ans
1563280849Scy    ]
1564280849Scy)
1565280849Scycase "$ntp_cv_size_returned_in_buffer" in
1566280849Scy yes)
1567280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1568280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1569181834Srobertoesac
1570181834Sroberto
1571181834Sroberto# Check for ioctls TIOCGPPSEV
1572280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1573280849Scycase "$ac_cv_header_termios_h" in
1574280849Scy yes)
1575280849Scy    AC_PREPROC_IFELSE(
1576282408Scy	[AC_LANG_SOURCE([
1577280849Scy	    #include <termios.h>
1578280849Scy	    #ifndef TIOCGPPSEV
1579280849Scy	    # error
1580280849Scy	    #endif
1581282408Scy	])],
1582280849Scy	[ntp_ok=yes],
1583280849Scy	[ntp_ok=no]
1584280849Scy    )
1585280849Scy    ;;
1586280849Scy *)
1587280849Scy    ntp_ok=no
1588280849Scy    ;;
1589280849Scyesac
1590280849Scycase "$ntp_ok" in
1591280849Scy yes)
1592280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1593280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1594280849Scyesac
1595280849ScyAC_MSG_RESULT([$ntp_ok])
1596181834Sroberto
1597181834Sroberto# Check for ioctls TIOCSPPS
1598280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1599280849Scycase "$ac_cv_header_termios_h" in
1600280849Scy yes)
1601280849Scy    AC_PREPROC_IFELSE(
1602282408Scy	[AC_LANG_SOURCE([
1603280849Scy	    #include <termios.h>
1604280849Scy	    #ifndef TIOCSPPS
1605280849Scy	    # error
1606280849Scy	    #endif
1607282408Scy	 ])],
1608280849Scy	 [ntp_ok=yes],
1609280849Scy	 [ntp_ok=no]
1610280849Scy    )
1611280849Scy    ;;
1612280849Scy *)
1613181834Sroberto    ntp_ok=no
1614280849Scy    ;;
1615280849Scyesac
1616280849Scycase "$ntp_ok" in
1617280849Scy yes)
1618280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1619280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1620280849Scyesac
1621280849ScyAC_MSG_RESULT([$ntp_ok])
1622181834Sroberto
1623181834Sroberto# Check for ioctls CIOGETEV
1624280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1625280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1626280849Scy yes)
1627280849Scy    AC_PREPROC_IFELSE(
1628282408Scy	[AC_LANG_SOURCE([
1629280849Scy	    #include <sys/ppsclock.h>
1630280849Scy	    #ifndef CIOGETEV
1631280849Scy	    # error
1632280849Scy	    #endif
1633282408Scy	])],
1634280849Scy	[ntp_ok=yes],
1635280849Scy	[ntp_ok=no]
1636280849Scy    )
1637280849Scy    ;;
1638280849Scy *)
1639280849Scy    ntp_ok=no
1640280849Scy    ;;
1641280849Scyesac
1642280849Scycase "$ntp_ok" in
1643280849Scy yes)
1644280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1645280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1646280849Scyesac
1647280849ScyAC_MSG_RESULT([$ntp_ok])
1648181834Sroberto
1649181834Sroberto# ATOM/PPSAPI stuff.
1650181834Sroberto
1651280849Scyntp_atom_ok=yes
1652181834Sroberto
1653181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1654181834Sroberto
1655181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1656181834Sroberto# The PPSAPI needs struct timespec.
1657181834Sroberto# The PPSAPI also needs a timepps header.
1658181834Sroberto
1659280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1660181834Sroberto inlineyes)
1661181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1662181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1663181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1664280849Scy	ntp_jupiter_ok=yes
1665280849Scy	ntp_oncore_ok=yes
1666280849Scy	ntp_parse_ok=yes
1667280849Scy	ntp_ripe_ncc_ok=yes
1668181834Sroberto	;;
1669181834Sroberto    esac
1670181834Sroberto    ;;
1671181834Srobertoesac
1672181834Sroberto
1673181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1674280849ScyAC_CHECK_HEADER([linux/serial.h])
1675181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1676181834Sroberto  yesyes)
1677280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1678280849Scy    AC_PREPROC_IFELSE(
1679282408Scy	[AC_LANG_SOURCE([
1680280849Scy	    #include <sys/time.h>
1681280849Scy	    typedef int u_int;
1682280849Scy	    #include <sys/ppsclock.h>
1683280849Scy	    #include <linux/serial.h>
1684181834Sroberto
1685280849Scy	    #ifndef TIOCGSERIAL
1686280849Scy	    # error
1687280849Scy	    #endif
1688280849Scy	    #ifndef TIOCSSERIAL
1689280849Scy	    # error
1690280849Scy	    #endif
1691280849Scy	    #ifndef ASYNC_PPS_CD_POS
1692280849Scy	    # error
1693280849Scy	    #endif
1694280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1695280849Scy	    # error
1696280849Scy	    #endif
1697280849Scy	    #ifndef CIOGETEV
1698280849Scy	    # error
1699280849Scy	    #endif
1700282408Scy	])],
1701280849Scy	[ntp_ok=yes],
1702280849Scy	[ntp_ok=no]
1703280849Scy    )
1704280849Scy    AC_MSG_RESULT([$ntp_ok])
1705280849Scy    ;;
1706181834Sroberto  *)
1707280849Scy    ntp_ok=no
1708280849Scy    ;;
1709181834Srobertoesac
1710280849Scycase "$ntp_ok" in
1711280849Scy yes)
1712280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1713280849Scy	[Do we have the TIO serial stuff?])
1714280849Scyesac
1715181834Sroberto
1716181834Sroberto# Check for SHMEM_STATUS support
1717200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1718181834Srobertocase "$ac_cv_header_sys_mman_h" in
1719280849Scy yes)
1720280849Scy    ntp_ok=yes
1721280849Scy    ;;
1722280849Scy *)
1723280849Scy    ntp_ok=no
1724280849Scy    ;;
1725181834Srobertoesac
1726280849Scycase "$ntp_ok" in
1727280849Scy yes)
1728280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1729280849Scy	[Do we have support for SHMEM_STATUS?])
1730280849Scyesac
1731280849ScyAC_MSG_RESULT([$ntp_ok])
1732181834Sroberto
1733181834Srobertontp_refclock=no
1734181834Sroberto
1735181834Sroberto# HPUX only, and by explicit request
1736200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1737280849ScyAC_ARG_ENABLE(
1738280849Scy    [BANCOMM],
1739280849Scy    [AS_HELP_STRING(
1740280849Scy	[--enable-BANCOMM],
1741280849Scy	[- Datum/Bancomm bc635/VME interface]
1742280849Scy    )],
1743280849Scy    [ntp_ok=$enableval],
1744280849Scy    [ntp_ok=no]
1745280849Scy)
1746280849Scycase "$ntp_ok" in
1747280849Scy yes)
1748181834Sroberto    ntp_refclock=yes
1749280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1750344884Scy    AC_SEARCH_LIBS([bcStartPci], [bcsdk], , , [])
1751280849Scy    ;;
1752280849Scyesac
1753280849ScyAC_MSG_RESULT([$ntp_ok])
1754181834Srobertocase "$ntp_ok$host" in
1755181834Sroberto yes*-*-hpux*) ;;
1756200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1757181834Srobertoesac
1758181834Sroberto
1759181834Sroberto#HPUX only, and only by explicit request
1760200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1761280849ScyAC_ARG_ENABLE(
1762280849Scy    [GPSVME],
1763280849Scy    [AS_HELP_STRING(
1764280849Scy	[--enable-GPSVME],
1765280849Scy	[- TrueTime GPS receiver/VME interface]
1766280849Scy    )],
1767280849Scy    [ntp_ok=$enableval],
1768280849Scy    [ntp_ok=no]
1769280849Scy)
1770280849Scycase "$ntp_ok" in
1771280849Scy yes)
1772181834Sroberto    ntp_refclock=yes
1773280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1774280849Scy    ;;
1775280849Scyesac
1776280849ScyAC_MSG_RESULT([$ntp_ok])
1777181834Srobertocase "$ntp_ok$host" in
1778181834Sroberto yes*-*-hpux*) ;;
1779200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1780181834Srobertoesac
1781181834Sroberto
1782200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1783181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1784181834Sroberto yesyesyes)
1785280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1786181834Sroberto    ans=yes
1787181834Sroberto    ;;
1788181834Sroberto *)
1789181834Sroberto    ans=no
1790181834Sroberto    ;;
1791181834Srobertoesac
1792200576SrobertoAC_MSG_RESULT([$ans])
1793181834Sroberto
1794200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1795280849ScyAC_ARG_ENABLE(
1796280849Scy    [all-clocks],
1797280849Scy    [AS_HELP_STRING(
1798280849Scy	[--enable-all-clocks],
1799280849Scy	[+ include all suitable non-PARSE clocks:]
1800280849Scy    )],
1801280849Scy    [ntp_eac=$enableval],
1802280849Scy    [ntp_eac=yes]
1803280849Scy)
1804280849ScyAC_MSG_RESULT([$ntp_eac])
1805181834Sroberto
1806280849Scy# HMS: Should we also require ntp_parse_ok?
1807200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1808280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1809181834Sroberto yes*yes*)
1810181834Sroberto    ntp_canparse=yes
1811181834Sroberto    ;;
1812181834Sroberto *) ntp_canparse=no
1813181834Sroberto    ;;
1814181834Srobertoesac
1815280849ScyAC_MSG_RESULT([$ntp_canparse])
1816181834Sroberto
1817181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1818181834Srobertocase "$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
1819181834Sroberto *yes*)
1820181834Sroberto    ntp_canaudio=yes
1821280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1822181834Sroberto    ;;
1823181834Sroberto *) ntp_canaudio=no ;;
1824181834Srobertoesac
1825280849ScyAC_MSG_RESULT([$ntp_canaudio])
1826181834Sroberto
1827181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1828181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1829181834Sroberto yesyes)
1830181834Sroberto    ntp_canshm=yes
1831181834Sroberto    ;;
1832181834Sroberto *) ntp_canshm=no ;;
1833181834Srobertoesac
1834280849ScyAC_MSG_RESULT([$ntp_canshm])
1835181834Sroberto
1836280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1837280849ScyAC_CACHE_CHECK(
1838280849Scy    [for termios modem control],
1839280849Scy    [ntp_cv_modem_control],
1840280849Scy    [AC_COMPILE_IFELSE(
1841280849Scy	[AC_LANG_PROGRAM(
1842280849Scy	    [[
1843280849Scy		#ifdef HAVE_UNISTD_H
1844280849Scy		# include <unistd.h>
1845280849Scy		#endif
1846280849Scy		#ifdef HAVE_TERMIOS_H
1847280849Scy		# include <termios.h>
1848280849Scy		#endif
1849280849Scy		#ifdef HAVE_SYS_IOCTL_H
1850280849Scy		# include <sys/ioctl.h>
1851280849Scy		#endif
1852280849Scy	    ]],
1853280849Scy	    [[
1854280849Scy		int	dtr = TIOCM_DTR;
1855280849Scy
1856280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1857280849Scy	    ]]
1858280849Scy	)],
1859280849Scy	[ntp_cv_modem_control=yes],
1860280849Scy	[ntp_cv_modem_control=no]
1861280849Scy    )]
1862280849Scy)
1863280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1864280849Scy yes::yes)
1865280849Scy    ntp_enable_all_modem_control_clocks=yes
1866280849Scy    ;;
1867280849Scy *)
1868280849Scy    ntp_enable_all_modem_control_clocks=no
1869280849Scy    ;;
1870280849Scyesac
1871280849Scy
1872181834Sroberto# Requires modem control
1873200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1874280849ScyAC_ARG_ENABLE(
1875280849Scy    [ACTS],
1876280849Scy    [AS_HELP_STRING(
1877280849Scy	[--enable-ACTS],
1878280849Scy	[s ACTS modem service]
1879280849Scy    )],
1880181834Sroberto    [ntp_ok=$enableval],
1881280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1882280849Scy)
1883280849Scycase "$ntp_ok" in
1884280849Scy yes)
1885181834Sroberto    ntp_refclock=yes
1886280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1887280849Scy    ;;
1888280849Scyesac
1889280849ScyAC_MSG_RESULT([$ntp_ok])
1890181834Sroberto
1891200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1892280849ScyAC_ARG_ENABLE(
1893280849Scy    [ARBITER],
1894280849Scy    [AS_HELP_STRING(
1895280849Scy	[--enable-ARBITER],
1896280849Scy	[+ Arbiter 1088A/B GPS receiver]
1897280849Scy    )],
1898280849Scy    [ntp_ok=$enableval],
1899280849Scy    [ntp_ok=$ntp_eac]
1900280849Scy)
1901280849Scycase "$ntp_ok" in
1902280849Scy yes)
1903181834Sroberto    ntp_refclock=yes
1904280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1905280849Scy    ;;
1906280849Scyesac
1907280849ScyAC_MSG_RESULT([$ntp_ok])
1908181834Sroberto
1909200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1910280849ScyAC_ARG_ENABLE(
1911280849Scy    [ARCRON_MSF],
1912280849Scy    [AS_HELP_STRING(
1913280849Scy	[--enable-ARCRON-MSF],
1914280849Scy	[+ Arcron MSF receiver]
1915280849Scy    )],
1916280849Scy    [ntp_ok=$enableval],
1917280849Scy    [ntp_ok=$ntp_eac]
1918280849Scy)
1919280849Scycase "$ntp_ok" in
1920280849Scy yes)
1921181834Sroberto    ntp_refclock=yes
1922280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1923280849Scy    ;;
1924280849Scyesac
1925280849ScyAC_MSG_RESULT([$ntp_ok])
1926181834Sroberto
1927200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1928280849ScyAC_ARG_ENABLE(
1929280849Scy    [AS2201],
1930280849Scy    [AS_HELP_STRING(
1931280849Scy	[--enable-AS2201],
1932280849Scy	[+ Austron 2200A/2201A GPS receiver]
1933280849Scy    )],
1934280849Scy    [ntp_ok=$enableval],
1935280849Scy    [ntp_ok=$ntp_eac]
1936280849Scy)
1937280849Scycase "$ntp_ok" in
1938280849Scy yes)
1939181834Sroberto    ntp_refclock=yes
1940280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1941280849Scy    ;;
1942280849Scyesac
1943280849ScyAC_MSG_RESULT([$ntp_ok])
1944181834Sroberto
1945200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1946280849ScyAC_ARG_ENABLE(
1947280849Scy    [ATOM],
1948280849Scy    [AS_HELP_STRING(
1949280849Scy	[--enable-ATOM],
1950280849Scy	[s ATOM PPS interface]
1951280849Scy    )],
1952280849Scy    [ntp_ok=$enableval],
1953280849Scy    [ntp_ok=$ntp_eac]
1954280849Scy)
1955280849Scycase "$ntp_atom_ok" in
1956181834Sroberto no) ntp_ok=no ;;
1957181834Srobertoesac
1958280849Scycase "$ntp_ok" in
1959280849Scy yes)
1960181834Sroberto    ntp_refclock=yes
1961280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1962280849Scy    ;;
1963280849Scyesac
1964280849ScyAC_MSG_RESULT([$ntp_ok])
1965181834Sroberto
1966200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1967280849ScyAC_ARG_ENABLE(
1968280849Scy    [CHRONOLOG],
1969280849Scy    [AS_HELP_STRING(
1970280849Scy	[--enable-CHRONOLOG],
1971280849Scy	[+ Chrono-log K-series WWVB receiver]
1972280849Scy    )],
1973280849Scy    [ntp_ok=$enableval],
1974280849Scy    [ntp_ok=$ntp_eac]
1975280849Scy)
1976280849Scycase "$ntp_ok" in
1977280849Scy yes)
1978181834Sroberto    ntp_refclock=yes
1979280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1980280849Scy    ;;
1981280849Scyesac
1982280849ScyAC_MSG_RESULT([$ntp_ok])
1983181834Sroberto
1984200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1985280849ScyAC_ARG_ENABLE(
1986280849Scy    [CHU],
1987280849Scy    [AS_HELP_STRING(
1988280849Scy	[--enable-CHU],
1989280849Scy	[+ CHU modem/decoder]
1990280849Scy    )],
1991280849Scy    [ntp_ok=$enableval],
1992280849Scy    [ntp_ok=$ntp_eac]
1993280849Scy)
1994280849Scycase "$ntp_ok" in
1995280849Scy yes)
1996181834Sroberto    ntp_refclock=yes
1997280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1998280849Scy    ;;
1999280849Scyesac
2000280849ScyAC_MSG_RESULT([$ntp_ok])
2001280849Scyntp_refclock_chu=$ntp_ok
2002181834Sroberto
2003200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2004280849ScyAC_ARG_ENABLE(
2005280849Scy    [AUDIO-CHU],
2006280849Scy    [AS_HELP_STRING(
2007280849Scy	[--enable-AUDIO-CHU],
2008280849Scy	[s CHU audio/decoder]
2009280849Scy    )],
2010181834Sroberto    [ntp_ok=$enableval],
2011280849Scy    [
2012280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2013280849Scy	 *no*)	ntp_ok=no  ;;
2014280849Scy	 *)	ntp_ok=yes ;;
2015280849Scy	esac
2016280849Scy    ]
2017280849Scy)
2018280849ScyAC_MSG_RESULT([$ntp_ok])
2019181834Sroberto# We used to check for sunos/solaris target...
2020280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2021280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2022181834Srobertoesac
2023181834Sroberto
2024181834Sroberto# Not under HP-UX
2025200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2026280849ScyAC_ARG_ENABLE(
2027280849Scy    [DATUM],
2028280849Scy    [AS_HELP_STRING(
2029280849Scy	[--enable-DATUM],
2030280849Scy	[s Datum Programmable Time System]
2031280849Scy    )],
2032181834Sroberto    [ntp_ok=$enableval],
2033280849Scy    [
2034280849Scy	case "$ac_cv_header_termios_h" in
2035280849Scy	 yes)
2036280849Scy	    ntp_ok=$ntp_eac
2037280849Scy	    ;;
2038280849Scy	 *) ntp_ok=no
2039280849Scy	    ;;
2040280849Scy	esac
2041280849Scy    ]
2042280849Scy)
2043280849Scycase "$ntp_ok" in
2044280849Scy yes)
2045181834Sroberto    ntp_refclock=yes
2046280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2047280849Scy    ;;
2048280849Scyesac
2049280849ScyAC_MSG_RESULT([$ntp_ok])
2050181834Sroberto
2051200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2052280849ScyAC_ARG_ENABLE(
2053280849Scy    [DUMBCLOCK],
2054280849Scy    [AS_HELP_STRING(
2055280849Scy	[--enable-DUMBCLOCK],
2056280849Scy	[+ Dumb generic hh:mm:ss local clock]
2057280849Scy    )],
2058280849Scy    [ntp_ok=$enableval],
2059280849Scy    [ntp_ok=$ntp_eac]
2060280849Scy)
2061280849Scycase "$ntp_ok" in
2062280849Scy yes)
2063181834Sroberto    ntp_refclock=yes
2064280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2065280849Scy    ;;
2066280849Scyesac
2067280849ScyAC_MSG_RESULT([$ntp_ok])
2068181834Sroberto
2069200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2070280849ScyAC_ARG_ENABLE(
2071280849Scy    [FG],
2072280849Scy    [AS_HELP_STRING(
2073280849Scy	[--enable-FG],
2074280849Scy	[+ Forum Graphic GPS]
2075280849Scy    )],
2076280849Scy    [ntp_ok=$enableval],
2077280849Scy    [ntp_ok=$ntp_eac]
2078280849Scy)
2079280849Scycase "$ntp_ok" in
2080280849Scy yes)
2081181834Sroberto    ntp_refclock=yes
2082280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2083280849Scy    ;;
2084280849Scyesac
2085280849ScyAC_MSG_RESULT([$ntp_ok])
2086181834Sroberto
2087181834Sroberto# Requires modem control
2088200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2089280849ScyAC_ARG_ENABLE(
2090280849Scy    [HEATH],
2091280849Scy    [AS_HELP_STRING(
2092280849Scy	[--enable-HEATH],
2093280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2094280849Scy    )],
2095181834Sroberto    [ntp_ok=$enableval],
2096280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2097280849Scy)
2098280849Scycase "$ntp_ok" in
2099280849Scy yes)
2100181834Sroberto    ntp_refclock=yes
2101280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2102280849Scy    ;;
2103280849Scyesac
2104280849ScyAC_MSG_RESULT([$ntp_ok])
2105181834Sroberto
2106200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2107280849ScyAC_ARG_ENABLE(
2108280849Scy    [HOPFSERIAL],
2109280849Scy    [AS_HELP_STRING(
2110280849Scy	[--enable-HOPFSERIAL],
2111280849Scy	[+ hopf serial clock device]
2112280849Scy    )],
2113280849Scy    [ntp_ok=$enableval],
2114280849Scy    [ntp_ok=$ntp_eac]
2115280849Scy)
2116280849Scycase "$ntp_ok" in
2117280849Scy yes)
2118181834Sroberto    ntp_refclock=yes
2119280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2120280849Scy    ;;
2121280849Scyesac
2122280849ScyAC_MSG_RESULT([$ntp_ok])
2123181834Sroberto
2124200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2125280849ScyAC_ARG_ENABLE(
2126280849Scy    [HOPFPCI],
2127280849Scy    [AS_HELP_STRING(
2128280849Scy	[--enable-HOPFPCI],
2129280849Scy	[+ hopf 6039 PCI board]
2130280849Scy    )],
2131280849Scy    [ntp_ok=$enableval],
2132280849Scy    [ntp_ok=$ntp_eac]
2133280849Scy)
2134280849Scycase "$ntp_ok" in
2135280849Scy yes)
2136181834Sroberto    ntp_refclock=yes
2137280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2138280849Scy    ;;
2139280849Scyesac
2140280849ScyAC_MSG_RESULT([$ntp_ok])
2141181834Sroberto
2142200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2143280849ScyAC_ARG_ENABLE(
2144280849Scy    [HPGPS],
2145280849Scy    [AS_HELP_STRING(
2146280849Scy	[--enable-HPGPS],
2147280849Scy	[+ HP 58503A GPS receiver]
2148280849Scy    )],
2149280849Scy    [ntp_ok=$enableval],
2150280849Scy    [ntp_ok=$ntp_eac]
2151280849Scy)
2152280849Scycase "$ntp_ok" in
2153280849Scy yes)
2154181834Sroberto    ntp_refclock=yes
2155280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2156280849Scy    ;;
2157280849Scyesac
2158280849ScyAC_MSG_RESULT([$ntp_ok])
2159181834Sroberto
2160200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2161280849ScyAC_ARG_ENABLE(
2162280849Scy    [IRIG],
2163280849Scy    [AS_HELP_STRING(
2164280849Scy	[--enable-IRIG],
2165280849Scy	[s IRIG audio decoder]
2166280849Scy    )],
2167181834Sroberto    [ntp_ok=$enableval],
2168280849Scy    [
2169280849Scy	case "$ntp_eac$ntp_canaudio" in
2170280849Scy	 *no*)	ntp_ok=no  ;;
2171280849Scy	 *)	ntp_ok=yes ;;
2172280849Scy	esac
2173280849Scy    ]
2174280849Scy)
2175280849Scycase "$ntp_ok" in
2176280849Scy yes)
2177181834Sroberto    ntp_refclock=yes
2178280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2179280849Scy    ;;
2180280849Scyesac
2181280849ScyAC_MSG_RESULT([$ntp_ok])
2182181834Srobertocase "$ntp_ok$ntp_canaudio" in
2183280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2184181834Srobertoesac
2185181834Sroberto
2186200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2187280849ScyAC_ARG_ENABLE(
2188280849Scy    [JJY],
2189280849Scy    [AS_HELP_STRING(
2190280849Scy	[--enable-JJY],
2191280849Scy	[+ JJY receiver]
2192280849Scy    )],
2193280849Scy    [ntp_ok=$enableval],
2194280849Scy    [ntp_ok=$ntp_eac]
2195280849Scy)
2196280849Scycase "$ntp_ok" in
2197280849Scy yes)
2198181834Sroberto    ntp_refclock=yes
2199280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2200280849Scy    ;;
2201280849Scyesac
2202280849ScyAC_MSG_RESULT([$ntp_ok])
2203181834Sroberto
2204200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2205280849ScyAC_ARG_ENABLE(
2206280849Scy    [JUPITER],
2207280849Scy    [AS_HELP_STRING(
2208280849Scy	[--enable-JUPITER],
2209280849Scy	[s Rockwell Jupiter GPS receiver]
2210280849Scy    )],
2211181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2212280849Scycase "$ntp_jupiter_ok" in
2213181834Sroberto no) ntp_ok=no ;;
2214181834Srobertoesac
2215280849Scycase "$ntp_ok" in
2216280849Scy yes)
2217181834Sroberto    ntp_refclock=yes
2218280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2219280849Scy    ;;
2220280849Scyesac
2221280849ScyAC_MSG_RESULT([$ntp_ok])
2222181834Sroberto
2223200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2224280849ScyAC_ARG_ENABLE(
2225280849Scy    [LEITCH],
2226280849Scy    [AS_HELP_STRING(
2227280849Scy	[--enable-LEITCH],
2228280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2229280849Scy    )],
2230280849Scy    [ntp_ok=$enableval],
2231280849Scy    [ntp_ok=$ntp_eac]
2232280849Scy)
2233280849Scycase "$ntp_ok" in
2234280849Scy yes)
2235181834Sroberto    ntp_refclock=yes
2236280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2237280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2238280849Scy    ;;
2239280849Scyesac
2240280849ScyAC_MSG_RESULT([$ntp_ok])
2241181834Sroberto
2242200576SrobertoAC_MSG_CHECKING([local clock reference])
2243280849ScyAC_ARG_ENABLE(
2244280849Scy    [LOCAL-CLOCK],
2245280849Scy    [AS_HELP_STRING(
2246280849Scy	[--enable-LOCAL-CLOCK],
2247280849Scy	[+ local clock reference]
2248280849Scy    )],
2249280849Scy    [ntp_ok=$enableval],
2250280849Scy    [ntp_ok=$ntp_eac]
2251280849Scy)
2252280849Scycase "$ntp_ok" in
2253280849Scy yes)
2254181834Sroberto    ntp_refclock=yes
2255280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2256280849Scy    ;;
2257280849Scyesac
2258280849ScyAC_MSG_RESULT([$ntp_ok])
2259181834Sroberto
2260181834Srobertodnl Bug 340: longstanding unfixed bugs
2261280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2262280849Scydnl AC_ARG_ENABLE([MSFEES],
2263280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2264181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2265181834Srobertodnl if test "$ntp_ok" = "yes"; then
2266181834Srobertodnl     ntp_refclock=yes
2267280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2268181834Srobertodnl fi
2269280849Scydnl AC_MSG_RESULT([$ntp_ok])
2270181834Sroberto
2271181834Sroberto# Not Ultrix
2272200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2273280849ScyAC_ARG_ENABLE(
2274280849Scy    [MX4200],
2275280849Scy    [AS_HELP_STRING(
2276280849Scy	[--enable-MX4200 ],
2277280849Scy	[s Magnavox MX4200 GPS receiver]
2278280849Scy    )],
2279181834Sroberto    [ntp_ok=$enableval],
2280280849Scy    [
2281280849Scy	case "$ac_cv_var_ppsclock" in
2282280849Scy	 yes)
2283280849Scy	    ntp_ok=$ntp_eac
2284280849Scy	    ;;
2285280849Scy	 *)
2286280849Scy	    ntp_ok=no
2287280849Scy	    ;;
2288280849Scy	esac
2289280849Scy    ]
2290280849Scy)
2291280849Scycase "$ntp_ok" in
2292280849Scy yes)
2293181834Sroberto    ntp_refclock=yes
2294280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2295280849Scy    ;;
2296280849Scyesac
2297280849ScyAC_MSG_RESULT([$ntp_ok])
2298181834Srobertocase "$ntp_ok$host" in
2299280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2300181834Srobertoesac
2301181834Sroberto
2302200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2303280849ScyAC_ARG_ENABLE(
2304280849Scy    [NEOCLOCK4X],
2305280849Scy    [AS_HELP_STRING(
2306280849Scy	[--enable-NEOCLOCK4X],
2307280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2308280849Scy    )],
2309280849Scy    [ntp_ok=$enableval],
2310280849Scy    [ntp_ok=$ntp_eac]
2311280849Scy)
2312280849Scycase "$ntp_ok" in
2313280849Scy yes)
2314181834Sroberto    ntp_refclock=yes
2315280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2316280849Scy    ;;
2317280849Scyesac
2318280849ScyAC_MSG_RESULT([$ntp_ok])
2319181834Sroberto
2320200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2321280849ScyAC_ARG_ENABLE(
2322280849Scy    [NMEA],
2323280849Scy    [AS_HELP_STRING(
2324280849Scy	[--enable-NMEA],
2325280849Scy	[+ NMEA GPS receiver]
2326280849Scy    )],
2327280849Scy    [ntp_ok=$enableval],
2328280849Scy    [ntp_ok=$ntp_eac]
2329280849Scy)
2330280849Scycase "$ntp_ok" in
2331280849Scy yes)
2332181834Sroberto    ntp_refclock=yes
2333280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2334280849Scy    ;;
2335280849Scyesac
2336280849ScyAC_MSG_RESULT([$ntp_ok])
2337181834Sroberto
2338280849ScyAC_CHECK_FUNCS([strtoll])
2339280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2340280849ScyAC_ARG_ENABLE(
2341280849Scy    [GPSD],
2342280849Scy    [AS_HELP_STRING(
2343280849Scy	[--enable-GPSD],
2344280849Scy	[+ GPSD JSON receiver]
2345280849Scy    )],
2346280849Scy    [ntp_ok=$enableval],
2347280849Scy    [case "$ac_cv_func_strtoll" in
2348280849Scy     yes) ntp_ok=$ntp_eac ;;
2349280849Scy     *)   ntp_ok="no" ;;
2350280849Scy    esac]
2351280849Scy)
2352280849Scycase "$ntp_ok" in
2353280849Scy yes)
2354280849Scy    ntp_refclock=yes
2355280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2356280849Scy    ;;
2357280849Scyesac
2358280849ScyAC_MSG_RESULT([$ntp_ok])
2359280849Scy
2360200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2361280849ScyAC_ARG_ENABLE(
2362280849Scy    [ONCORE],
2363280849Scy    [AS_HELP_STRING(
2364280849Scy	[--enable-ONCORE],
2365280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2366280849Scy    )],
2367280849Scy    [ntp_ok=$enableval],
2368280849Scy    [ntp_ok=$ntp_eac]
2369280849Scy)
2370280849Scycase "$ntp_oncore_ok" in
2371181834Sroberto no) ntp_ok=no ;;
2372181834Srobertoesac
2373280849Scycase "$ntp_ok" in
2374280849Scy yes)
2375181834Sroberto    ntp_refclock=yes
2376280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2377280849Scy    ;;
2378280849Scyesac
2379280849ScyAC_MSG_RESULT([$ntp_ok])
2380181834Sroberto
2381280849Scy# Requires modem control
2382200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2383280849ScyAC_ARG_ENABLE(
2384280849Scy    [PALISADE],
2385280849Scy    [AS_HELP_STRING(
2386280849Scy	[--enable-PALISADE],
2387280849Scy	[s Palisade clock]
2388280849Scy    )],
2389181834Sroberto    [ntp_ok=$enableval],
2390280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2391280849Scy)
2392280849Scycase "$ntp_ok" in
2393280849Scy yes)
2394181834Sroberto    ntp_refclock=yes
2395280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2396280849Scy    ;;
2397280849Scyesac
2398280849ScyAC_MSG_RESULT([$ntp_ok])
2399181834Sroberto
2400200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2401280849ScyAC_ARG_ENABLE(
2402280849Scy    [PCF],
2403280849Scy    [AS_HELP_STRING(
2404280849Scy	[--enable-PCF ],
2405280849Scy	[+ Conrad parallel port radio clock]
2406280849Scy    )],
2407280849Scy    [ntp_ok=$enableval],
2408280849Scy    [ntp_ok=$ntp_eac]
2409280849Scy)
2410280849Scycase "$ntp_ok" in
2411280849Scy yes)
2412181834Sroberto    ntp_refclock=yes
2413280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2414280849Scy    ;;
2415280849Scyesac
2416280849ScyAC_MSG_RESULT([$ntp_ok])
2417181834Sroberto
2418200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2419280849ScyAC_ARG_ENABLE(
2420280849Scy    [PST],
2421280849Scy    [AS_HELP_STRING(
2422280849Scy	[--enable-PST],
2423280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2424280849Scy    )],
2425280849Scy    [ntp_ok=$enableval],
2426280849Scy    [ntp_ok=$ntp_eac]
2427280849Scy)
2428280849Scycase "$ntp_ok" in
2429280849Scy yes)
2430181834Sroberto    ntp_refclock=yes
2431280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2432280849Scy    ;;
2433280849Scyesac
2434280849ScyAC_MSG_RESULT([$ntp_ok])
2435181834Sroberto
2436200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2437280849ScyAC_ARG_ENABLE(
2438280849Scy    [RIPENCC],
2439280849Scy    [AS_HELP_STRING(
2440280849Scy	[--enable-RIPENCC],
2441280849Scy	[- RIPENCC specific Trimble driver]
2442280849Scy    )],
2443280849Scy    [ntp_ok=$enableval],
2444280849Scy    [ntp_ok=no]
2445280849Scy)
2446181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2447280849Scycase "$ntp_ripe_ncc_ok" in
2448181834Sroberto no) ntp_ok=no ;;
2449181834Srobertoesac
2450280849Scycase "$ntp_ok" in
2451280849Scy yes)
2452181834Sroberto    ntp_refclock=yes
2453280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2454280849Scy    ;;
2455280849Scyesac
2456280849ScyAC_MSG_RESULT([$ntp_ok])
2457181834Sroberto
2458181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2459181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2460200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2461280849ScyAC_ARG_ENABLE(
2462280849Scy    [SHM],
2463280849Scy    [AS_HELP_STRING(
2464280849Scy	[--enable-SHM],
2465280849Scy	[s SHM clock attached thru shared memory]
2466280849Scy    )],
2467181834Sroberto    [ntp_ok=$enableval],
2468280849Scy    [
2469280849Scy	case "$ntp_eac$ntp_canshm" in
2470280849Scy	 *no*)	ntp_ok=no  ;;
2471280849Scy	 *)	ntp_ok=yes ;;
2472280849Scy	esac
2473280849Scy    ]
2474280849Scy)
2475280849Scycase "$ntp_ok" in
2476280849Scy yes)
2477181834Sroberto    ntp_refclock=yes
2478280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2479280849Scy    ;;
2480280849Scyesac
2481280849ScyAC_MSG_RESULT([$ntp_ok])
2482181834Sroberto
2483200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2484280849ScyAC_ARG_ENABLE(
2485280849Scy    [SPECTRACOM],
2486280849Scy    [AS_HELP_STRING(
2487280849Scy	[--enable-SPECTRACOM],
2488280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2489280849Scy    )],
2490280849Scy    [ntp_ok=$enableval],
2491280849Scy    [ntp_ok=$ntp_eac]
2492280849Scy)
2493280849Scycase "$ntp_ok" in
2494280849Scy yes)
2495181834Sroberto    ntp_refclock=yes
2496280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2497280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2498280849Scy    ;;
2499280849Scyesac
2500280849ScyAC_MSG_RESULT([$ntp_ok])
2501181834Sroberto
2502200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2503280849ScyAC_ARG_ENABLE(
2504280849Scy    [TPRO],
2505280849Scy    [AS_HELP_STRING(
2506280849Scy	[--enable-TPRO],
2507280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2508280849Scy    )],
2509181834Sroberto    [ntp_ok=$enableval],
2510280849Scy    [
2511280849Scy	case "$ac_cv_header_sys_tpro_h" in
2512280849Scy	 yes)
2513280849Scy	    ntp_ok=$ntp_eac
2514280849Scy	    ;;
2515280849Scy	 *)
2516280849Scy	    ntp_ok=no
2517280849Scy	    ;;
2518280849Scy	esac
2519280849Scy    ]
2520280849Scy)
2521280849Scycase "$ntp_ok" in
2522280849Scy yes)
2523181834Sroberto    ntp_refclock=yes
2524280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2525280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2526280849Scy    ;;
2527280849Scyesac
2528280849ScyAC_MSG_RESULT([$ntp_ok])
2529181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2530280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2531181834Srobertoesac
2532181834Sroberto
2533181834Sroberto# Not on a vax-dec-bsd
2534200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2535280849ScyAC_ARG_ENABLE(
2536280849Scy    [TRUETIME],
2537280849Scy    [AS_HELP_STRING(
2538280849Scy	[--enable-TRUETIME],
2539280849Scy	[s Kinemetrics/TrueTime receivers]
2540280849Scy    )],
2541181834Sroberto    [ntp_ok=$enableval],
2542280849Scy    [
2543280849Scy	case "$host" in
2544280849Scy	 vax-dec-bsd)
2545280849Scy	    ntp_ok=no
2546280849Scy	    ;;
2547280849Scy	 *)
2548280849Scy	    ntp_ok=$ntp_eac
2549280849Scy	    ;;
2550280849Scy	esac
2551280849Scy    ]
2552280849Scy)    
2553280849Scycase "$ntp_ok" in
2554280849Scy yes)
2555181834Sroberto    ntp_refclock=yes
2556280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2557280849Scy    ;;
2558280849Scyesac
2559280849ScyAC_MSG_RESULT([$ntp_ok])
2560181834Srobertocase "$ntp_ok$host" in
2561280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2562181834Srobertoesac
2563181834Sroberto
2564200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2565280849ScyAC_ARG_ENABLE(
2566280849Scy    [TT560],
2567280849Scy    [AS_HELP_STRING(
2568280849Scy	[--enable-TT560],
2569280849Scy	[- TrueTime 560 IRIG-B decoder]
2570280849Scy    )],
2571280849Scy    [ntp_ok=$enableval],
2572280849Scy    [ntp_ok=no]
2573280849Scy)
2574280849Scycase "$ntp_ok" in
2575280849Scy yes)
2576181834Sroberto    ntp_refclock=yes
2577280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2578280849Scy    ;;
2579280849Scyesac
2580280849ScyAC_MSG_RESULT([$ntp_ok])
2581181834Sroberto
2582200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2583280849ScyAC_ARG_ENABLE(
2584280849Scy    [ULINK],
2585280849Scy    [AS_HELP_STRING(
2586280849Scy	[--enable-ULINK],
2587280849Scy	[+ Ultralink WWVB receiver]
2588280849Scy    )],
2589280849Scy    [ntp_ok=$enableval],
2590280849Scy    [ntp_ok=$ntp_eac]
2591280849Scy)
2592280849Scycase "$ntp_ok" in
2593280849Scy yes)
2594181834Sroberto    ntp_refclock=yes
2595280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2596280849Scy    ;;
2597280849Scyesac
2598280849ScyAC_MSG_RESULT([$ntp_ok])
2599181834Sroberto
2600280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2601280849ScyAC_ARG_ENABLE(
2602280849Scy    [TSYNCPCI],
2603280849Scy    [AS_HELP_STRING(
2604280849Scy	[--enable-TSYNCPCI],
2605280849Scy	[s Spectracom TSYNC timing board]
2606280849Scy    )],
2607280849Scy    [ntp_ok=$enableval],
2608280849Scy    [
2609280849Scy	case "$host" in
2610280849Scy	 *-*-*linux*)
2611280849Scy	    ntp_ok=$ntp_eac
2612280849Scy	    ;;
2613280849Scy	 *)
2614280849Scy	    ntp_ok=no
2615280849Scy	esac
2616280849Scy    ]
2617280849Scy)
2618280849Scycase "$ntp_ok" in
2619280849Scy yes)
2620280849Scy    ntp_refclock=yes
2621280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2622280849Scy    ;;
2623280849Scyesac
2624280849ScyAC_MSG_RESULT([$ntp_ok])
2625280849Scy
2626200576SrobertoAC_MSG_CHECKING([WWV receiver])
2627280849ScyAC_ARG_ENABLE(
2628280849Scy    [WWV],
2629280849Scy    [AS_HELP_STRING(
2630280849Scy	[--enable-WWV],
2631280849Scy	[s WWV Audio receiver]
2632280849Scy    )],
2633181834Sroberto    [ntp_ok=$enableval],
2634280849Scy    [
2635280849Scy	case "$ntp_eac$ntp_canaudio" in
2636280849Scy	 *no*)	ntp_ok=no  ;;
2637280849Scy	 *)	ntp_ok=yes ;;
2638280849Scy	esac
2639280849Scy    ]
2640280849Scy)
2641280849Scycase "$ntp_ok" in
2642280849Scy yes)
2643181834Sroberto    ntp_refclock=yes
2644280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2645280849Scy    ;;
2646280849Scyesac
2647280849ScyAC_MSG_RESULT([$ntp_ok])
2648181834Srobertocase "$ntp_ok$ntp_canaudio" in
2649280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2650181834Srobertoesac
2651181834Sroberto
2652200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2653280849ScyAC_ARG_ENABLE(
2654280849Scy    [ZYFER],
2655280849Scy    [AS_HELP_STRING(
2656280849Scy	[--enable-ZYFER],
2657280849Scy	[+ Zyfer GPStarplus receiver]
2658280849Scy    )],
2659280849Scy    [ntp_ok=$enableval],
2660280849Scy    [ntp_ok=$ntp_eac]
2661280849Scy)
2662280849Scycase "$ntp_ok" in
2663280849Scy yes)
2664181834Sroberto    ntp_refclock=yes
2665280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2666280849Scy    ;;
2667280849Scyesac
2668280849ScyAC_MSG_RESULT([$ntp_ok])
2669181834Sroberto
2670200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2671280849ScyAC_ARG_ENABLE(
2672280849Scy    [parse-clocks],
2673280849Scy    [AS_HELP_STRING(
2674280849Scy	[--enable-parse-clocks],
2675280849Scy	[- include all suitable PARSE clocks:]
2676280849Scy    )],
2677181834Sroberto    [ntp_eapc=$enableval],
2678280849Scy    [
2679280849Scy	case "$ntp_eac" in
2680280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2681280849Scy	 *)	ntp_eapc=no ;;
2682280849Scy	esac
2683280849Scy	# Delete the next line one of these days
2684280849Scy	ntp_eapc=no
2685280849Scy    ]
2686280849Scy)
2687181834SrobertoAC_MSG_RESULT($ntp_eapc)
2688181834Sroberto
2689181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2690181834Sroberto noyes*)
2691200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2692181834Sroberto    ;;
2693181834Sroberto yesyesno)
2694200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2695181834Sroberto    ;;
2696181834Srobertoesac
2697181834Sroberto
2698181834Srobertontp_libparse=no
2699181834Srobertontp_parseutil=no
2700181834Srobertontp_rawdcf=no
2701181834Sroberto
2702200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2703280849ScyAC_ARG_ENABLE(
2704280849Scy    [COMPUTIME],
2705280849Scy    [AS_HELP_STRING(
2706280849Scy	[--enable-COMPUTIME],
2707280849Scy	[s Diem Computime Radio Clock]
2708280849Scy    )],
2709280849Scy    [ntp_ok=$enableval],
2710280849Scy    [ntp_ok=$ntp_eapc]
2711280849Scy)
2712280849Scycase "$ntp_ok" in
2713280849Scy yes)
2714181834Sroberto    ntp_libparse=yes
2715181834Sroberto    ntp_refclock=yes
2716280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2717280849Scy    ;;
2718280849Scyesac
2719280849ScyAC_MSG_RESULT([$ntp_ok])
2720181834Srobertocase "$ntp_ok$ntp_canparse" in
2721181834Sroberto yesno)
2722200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2723181834Srobertoesac
2724181834Sroberto
2725200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2726280849ScyAC_ARG_ENABLE(
2727280849Scy    [DCF7000],
2728280849Scy    [AS_HELP_STRING(
2729280849Scy	[--enable-DCF7000],
2730280849Scy	[s ELV/DCF7000 clock]
2731280849Scy    )],
2732280849Scy    [ntp_ok=$enableval],
2733280849Scy    [ntp_ok=$ntp_eapc]
2734280849Scy)
2735280849Scycase "$ntp_ok" in
2736280849Scy yes)
2737181834Sroberto    ntp_libparse=yes
2738181834Sroberto    ntp_refclock=yes
2739280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2740280849Scy    ;;
2741280849Scyesac
2742280849ScyAC_MSG_RESULT([$ntp_ok])
2743181834Srobertocase "$ntp_ok$ntp_canparse" in
2744181834Sroberto yesno)
2745200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2746181834Srobertoesac
2747181834Sroberto
2748200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2749280849ScyAC_ARG_ENABLE(
2750280849Scy    [HOPF6021],
2751280849Scy    [AS_HELP_STRING(
2752280849Scy	[--enable-HOPF6021],
2753280849Scy	[s HOPF 6021 clock]
2754280849Scy    )],
2755280849Scy    [ntp_ok=$enableval],
2756280849Scy    [ntp_ok=$ntp_eapc]
2757280849Scy)
2758280849Scycase "$ntp_ok" in
2759280849Scy yes)
2760181834Sroberto    ntp_libparse=yes
2761181834Sroberto    ntp_refclock=yes
2762280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2763280849Scy    ;;
2764280849Scyesac
2765280849ScyAC_MSG_RESULT([$ntp_ok])
2766181834Srobertocase "$ntp_ok$ntp_canparse" in
2767181834Sroberto yesno)
2768200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2769181834Srobertoesac
2770181834Sroberto
2771200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2772280849ScyAC_ARG_ENABLE(
2773280849Scy    [MEINBERG],
2774280849Scy    [AS_HELP_STRING(
2775280849Scy	[--enable-MEINBERG],
2776280849Scy	[s Meinberg clocks]
2777280849Scy    )],
2778280849Scy    [ntp_ok=$enableval],
2779280849Scy    [ntp_ok=$ntp_eapc]
2780280849Scy)
2781280849Scycase "$ntp_ok" in
2782280849Scy yes)
2783181834Sroberto    ntp_libparse=yes
2784181834Sroberto    ntp_refclock=yes
2785280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2786280849Scy    ;;
2787280849Scyesac
2788280849ScyAC_MSG_RESULT([$ntp_ok])
2789181834Srobertocase "$ntp_ok$ntp_canparse" in
2790181834Sroberto yesno)
2791200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2792181834Srobertoesac
2793181834Sroberto
2794200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2795280849ScyAC_ARG_ENABLE(
2796280849Scy    [RAWDCF],
2797280849Scy    [AS_HELP_STRING(
2798280849Scy	[--enable-RAWDCF],
2799280849Scy	[s DCF77 raw time code]
2800280849Scy    )],
2801280849Scy    [ntp_ok=$enableval],
2802280849Scy    [ntp_ok=$ntp_eapc]
2803280849Scy)
2804280849Scycase "$ntp_ok" in
2805280849Scy yes)
2806181834Sroberto    ntp_libparse=yes
2807181834Sroberto    ntp_parseutil=yes
2808181834Sroberto    ntp_refclock=yes
2809181834Sroberto    ntp_rawdcf=yes
2810280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2811280849Scy    ;;
2812280849Scyesac
2813280849ScyAC_MSG_RESULT([$ntp_ok])
2814181834Srobertocase "$ntp_ok$ntp_canparse" in
2815181834Sroberto yesno)
2816280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2817181834Srobertoesac
2818181834Sroberto
2819181834Srobertocase "$ntp_rawdcf" in
2820181834Sroberto yes)
2821200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2822280849Scy	[ntp_cv_rawdcf_parity],
2823280849Scy	[
2824280849Scy	    ans=no
2825280849Scy	    case "$host" in
2826280849Scy	     *-*-*linux*)
2827280849Scy		ans=yes
2828280849Scy		;;
2829280849Scy	    esac
2830280849Scy	    ntp_cv_rawdcf_parity=$ans
2831280849Scy	]
2832280849Scy    )
2833280849Scy    case "$ntp_cv_rawdcf_parity" in
2834280849Scy     yes)
2835280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2836280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2837181834Sroberto    esac
2838181834Srobertoesac
2839181834Sroberto
2840200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2841280849ScyAC_ARG_ENABLE(
2842280849Scy    [RCC8000],
2843280849Scy    [AS_HELP_STRING(
2844280849Scy	[--enable-RCC8000],
2845280849Scy	[s RCC 8000 clock]
2846280849Scy    )],
2847280849Scy    [ntp_ok=$enableval],
2848280849Scy    [ntp_ok=$ntp_eapc]
2849280849Scy)
2850280849Scycase "$ntp_ok" in
2851280849Scy yes)
2852181834Sroberto    ntp_libparse=yes
2853181834Sroberto    ntp_refclock=yes
2854280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2855280849Scy    ;;
2856280849Scyesac
2857280849ScyAC_MSG_RESULT([$ntp_ok])
2858181834Srobertocase "$ntp_ok$ntp_canparse" in
2859181834Sroberto yesno)
2860280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2861181834Srobertoesac
2862181834Sroberto
2863200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2864280849ScyAC_ARG_ENABLE(
2865280849Scy    [SCHMID],
2866280849Scy    [AS_HELP_STRING(
2867280849Scy	[--enable-SCHMID ],
2868280849Scy	[s Schmid DCF77 clock]
2869280849Scy    )],
2870280849Scy    [ntp_ok=$enableval],
2871280849Scy    [ntp_ok=$ntp_eapc]
2872280849Scy)
2873280849Scycase "$ntp_ok" in
2874280849Scy yes)
2875181834Sroberto    ntp_libparse=yes
2876181834Sroberto    ntp_refclock=yes
2877280849Scy    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2878280849Scy    ;;
2879280849Scyesac
2880280849ScyAC_MSG_RESULT([$ntp_ok])
2881181834Srobertocase "$ntp_ok$ntp_canparse" in
2882181834Sroberto yesno)
2883280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2884181834Srobertoesac
2885181834Sroberto
2886200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2887280849ScyAC_ARG_ENABLE(
2888280849Scy    [TRIMTAIP],
2889280849Scy    [AS_HELP_STRING(
2890280849Scy	[--enable-TRIMTAIP],
2891280849Scy	[s Trimble GPS receiver/TAIP protocol]
2892280849Scy    )],
2893280849Scy    [ntp_ok=$enableval],
2894280849Scy    [ntp_ok=$ntp_eapc]
2895280849Scy)
2896280849Scycase "$ntp_ok" in
2897280849Scy yes)
2898181834Sroberto    ntp_libparse=yes
2899181834Sroberto    ntp_refclock=yes
2900280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2901280849Scy	[Trimble GPS receiver/TAIP protocol])
2902280849Scy    ;;
2903280849Scyesac
2904280849ScyAC_MSG_RESULT([$ntp_ok])
2905181834Srobertocase "$ntp_ok$ntp_canparse" in
2906181834Sroberto yesno)
2907280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2908181834Srobertoesac
2909181834Sroberto
2910200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2911280849ScyAC_ARG_ENABLE(
2912280849Scy    [TRIMTSIP],
2913280849Scy    [AS_HELP_STRING(
2914280849Scy	[--enable-TRIMTSIP],
2915280849Scy	[s Trimble GPS receiver/TSIP protocol]
2916280849Scy    )],
2917280849Scy    [ntp_ok=$enableval],
2918280849Scy    [ntp_ok=$ntp_eapc]
2919280849Scy)
2920280849Scycase "$ntp_ok" in
2921280849Scy yes)
2922181834Sroberto    ntp_libparse=yes
2923181834Sroberto    ntp_refclock=yes
2924280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2925280849Scy	[Trimble GPS receiver/TSIP protocol])
2926280849Scy    ;;
2927280849Scyesac
2928280849ScyAC_MSG_RESULT([$ntp_ok])
2929181834Srobertocase "$ntp_ok$ntp_canparse" in
2930181834Sroberto yesno)
2931280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2932181834Srobertoesac
2933181834Sroberto
2934200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2935280849ScyAC_ARG_ENABLE(
2936280849Scy    [WHARTON],
2937280849Scy    [AS_HELP_STRING(
2938280849Scy	[--enable-WHARTON],
2939280849Scy	[s WHARTON 400A Series clock]
2940280849Scy    )],
2941280849Scy    [ntp_ok=$enableval],
2942280849Scy    [ntp_ok=$ntp_eapc]
2943280849Scy)
2944280849Scycase "$ntp_ok" in
2945280849Scy yes)
2946181834Sroberto    ntp_libparse=yes
2947181834Sroberto    ntp_refclock=yes
2948280849Scy    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2949280849Scy    ;;
2950280849Scyesac
2951280849ScyAC_MSG_RESULT([$ntp_ok])
2952181834Srobertocase "$ntp_ok$ntp_canparse" in
2953181834Sroberto yesno)
2954280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2955280849Scyesac
2956280849Scy
2957280849ScyAC_MSG_CHECKING([VARITEXT clock])
2958280849ScyAC_ARG_ENABLE(
2959280849Scy    [VARITEXT],
2960280849Scy    [AS_HELP_STRING(
2961280849Scy	[--enable-VARITEXT],
2962280849Scy	[s VARITEXT clock]
2963280849Scy    )],
2964280849Scy    [ntp_ok=$enableval],
2965280849Scy    [ntp_ok=$ntp_eapc]
2966280849Scy)
2967280849Scycase "$ntp_ok" in
2968280849Scy yes)
2969280849Scy    ntp_libparse=yes
2970280849Scy    ntp_refclock=yes
2971280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2972181834Sroberto    ;;
2973181834Srobertoesac
2974280849ScyAC_MSG_RESULT([$ntp_ok])
2975280849Scycase "$ntp_ok$ntp_canparse" in
2976280849Scy yesno)
2977280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2978280849Scyesac
2979181834Sroberto
2980280849ScyAC_MSG_CHECKING(SEL240X clock)
2981280849ScyAC_ARG_ENABLE(SEL240X,
2982280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2983181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2984181834Srobertoif test "$ntp_ok" = "yes"; then
2985181834Sroberto    ntp_libparse=yes
2986181834Sroberto    ntp_refclock=yes
2987280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2988181834Srobertofi
2989181834SrobertoAC_MSG_RESULT($ntp_ok)
2990181834Srobertocase "$ntp_ok$ntp_canparse" in
2991181834Sroberto yesno)
2992280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2993181834Sroberto    ;;
2994181834Srobertoesac
2995280849Scy
2996280849ScyAC_SUBST([LIBPARSE])
2997280849ScyAC_SUBST([MAKE_LIBPARSE])
2998280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
2999280849ScyAC_SUBST([MAKE_CHECK_Y2K])
3000280849Scy
3001200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3002181834Srobertoans=no
3003181834Srobertocase "$ntp_libparse" in
3004181834Sroberto yes)
3005181834Sroberto    ans=yes
3006280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3007181834Sroberto    LIBPARSE=../libparse/libparse.a
3008181834Sroberto    MAKE_LIBPARSE=libparse.a
3009181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3010181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3011181834Srobertoesac
3012200576SrobertoAC_MSG_RESULT([$ans])
3013181834Sroberto
3014280849ScyNTP_OPENSSL
3015181834Sroberto
3016338530SdelphijAC_MSG_CHECKING([if we want to enable CMAC support])
3017338530Sdelphijcase "$ac_cv_header_openssl_cmac_h" in
3018338530Sdelphij yes)
3019338530Sdelphij    AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?])
3020338530Sdelphij    ans="yes"
3021338530Sdelphij    ;;
3022338530Sdelphij *) ans="no"
3023338530Sdelphij    ;;
3024338530Sdelphijesac
3025338530SdelphijAC_MSG_RESULT([$ans])
3026338530Sdelphij
3027280849ScyNTP_CRYPTO_RAND
3028181834Sroberto
3029280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3030280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3031280849ScyAC_ARG_ENABLE(
3032280849Scy    [autokey],
3033280849Scy    AS_HELP_STRING(
3034280849Scy	[--enable-autokey],
3035280849Scy	[+ support NTP Autokey protocol]
3036280849Scy	),
3037280849Scy    [ntp_autokey=$enableval],
3038280849Scy    [ntp_autokey=$ntp_openssl]
3039280849Scy)
3040280849Scycase "$ntp_autokey" in
3041280849Scy no)
3042181834Sroberto    ;;
3043280849Scy *)
3044280849Scy    case "$ntp_openssl" in
3045181834Sroberto     no)
3046280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3047280849Scy	ntp_autokey=no
3048181834Sroberto	;;
3049280849Scy     *)
3050280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3051280849Scy	ntp_autokey=yes
3052181834Sroberto	;;
3053181834Sroberto    esac
3054181834Sroberto    ;;
3055181834Srobertoesac
3056280849ScyAC_MSG_RESULT([$ntp_autokey])
3057181834Sroberto
3058280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3059200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3060181834Srobertocase "$cross_compiling$PATH_PERL" in
3061181834Sroberto no/*)
3062181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3063181834Sroberto    ans=yes
3064181834Sroberto    ;;
3065181834Sroberto *)
3066181834Sroberto    ans=no
3067181834Sroberto    ;;
3068181834Srobertoesac
3069200576SrobertoAC_MSG_RESULT([$ans])
3070181834Sroberto
3071280849ScyAC_SUBST([TESTDCF])
3072280849ScyAC_SUBST([DCFD])
3073200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3074181834Srobertoans=no
3075280849Scycase "$ntp_parseutil" in
3076280849Scy yes)
3077181834Sroberto    case "$host" in
3078200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3079181834Sroberto	ans="dcfd testdcf"
3080181834Sroberto	DCFD=dcfd
3081280849Scy	TESTDCF=testdcf
3082181834Sroberto    esac
3083280849Scy    ;;
3084280849Scyesac
3085200576SrobertoAC_MSG_RESULT([$ans])
3086181834Sroberto
3087280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3088200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3089181834Srobertoans=no
3090181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3091181834Sroberto yesyes)
3092181834Sroberto    case "$host" in
3093181834Sroberto     sparc-*-sunos4*)
3094280849Scy        case "$ntp_cv_var_kernel_pll" in
3095181834Sroberto	yes)
3096280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3097181834Sroberto	    ;;
3098181834Sroberto	esac
3099181834Sroberto	ans=parsestreams
3100181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3101181834Sroberto	;;
3102181834Sroberto     sparc-*-solaris2*)
3103181834Sroberto	ans=parsesolaris
3104181834Sroberto	MAKE_PARSEKMODULE=parse
3105280849Scy	AC_CHECK_HEADERS([strings.h])
3106181834Sroberto	;;
3107181834Sroberto    esac
3108181834Sroberto    ;;
3109181834Srobertoesac
3110200576SrobertoAC_MSG_RESULT([$ans])
3111181834Sroberto
3112200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3113280849Scycase "$ntp_refclock" in
3114280849Scy yes)
3115280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3116280849Scy    ;;
3117280849Scyesac
3118181834SrobertoAC_MSG_RESULT($ntp_refclock)
3119181834Sroberto
3120280849Scydnl Things that can be made in clockstuff
3121280849ScyAC_SUBST([PROPDELAY], [propdelay])
3122280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3123181834Sroberto
3124280849ScyAC_SUBST([MAKE_ADJTIMED])
3125280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3126181834Srobertocase "$host" in
3127181834Sroberto *-*-hpux[[56789]]*)
3128181834Sroberto    ans=yes
3129181834Sroberto    ;;
3130181834Sroberto *) ans=no
3131181834Sroberto    ;;
3132181834Srobertoesac
3133280849Scycase "$ans" in
3134280849Scy yes)
3135181834Sroberto    MAKE_ADJTIMED=adjtimed
3136280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3137280849Scy	[Do we need HPUX adjtime() library support?])
3138280849Scy    ;;
3139280849Scy *) ADJTIMED_DB=
3140280849Scy    ADJTIMED_DL=
3141280849Scy    ADJTIMED_DS=
3142280849Scy    ADJTIMED_MS=
3143280849Scy    ;;
3144280849Scyesac
3145200576SrobertoAC_MSG_RESULT([$ans])
3146181834Sroberto
3147200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3148181834Srobertocase "$host" in
3149181834Sroberto *-*-qnx*)
3150181834Sroberto    ans=yes
3151181834Sroberto    ;;
3152181834Sroberto *) ans=no
3153181834Sroberto    ;;
3154181834Srobertoesac
3155280849Scycase "$ans" in
3156280849Scy yes)
3157280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3158280849Scy	[Do we need the qnx adjtime call?])
3159280849Scy    ;;
3160280849Scyesac
3161200576SrobertoAC_MSG_RESULT([$ans])
3162181834Sroberto
3163200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3164181834Sroberto
3165200576Sroberto#  the default is to enable it if the system has the capability
3166200576Sroberto
3167200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3168200576Sroberto *yes*)
3169200576Sroberto    ans=yes
3170200576Sroberto    ;;
3171200576Sroberto *) ans=no
3172280849Scy    ;;
3173181834Srobertoesac
3174181834Sroberto
3175200576Srobertocase "$host" in
3176200576Sroberto *-*-domainos)	# Won't be found...
3177200576Sroberto    ans=no
3178200576Sroberto    ;;
3179200576Sroberto *-*-hpux*)
3180200576Sroberto    #ans=no
3181200576Sroberto    ;;
3182200576Sroberto *-*-irix[[456]]*)
3183200576Sroberto    ans=no
3184200576Sroberto    ;;
3185200576Sroberto *-*-*linux*)
3186200576Sroberto    ans=no
3187200576Sroberto    ;;
3188200576Sroberto *-*-winnt3.5)
3189200576Sroberto    ans=no
3190200576Sroberto    ;;
3191200576Sroberto *-*-unicosmp*)
3192200576Sroberto    ans=no
3193200576Sroberto    ;;
3194200576Srobertoesac
3195200576Sroberto
3196200576Sroberto# --enable-kmem / --disable-kmem controls if present
3197200576SrobertoAC_ARG_ENABLE(
3198200576Sroberto    [kmem],
3199280849Scy    [AS_HELP_STRING(
3200200576Sroberto	[--enable-kmem],
3201200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3202280849Scy    )],
3203200576Sroberto    [ans=$enableval]
3204200576Sroberto)
3205200576Sroberto
3206200576SrobertoAC_MSG_RESULT([$ans])
3207200576Sroberto
3208200576Srobertocase "$ans" in
3209200576Sroberto yes)
3210200576Sroberto    can_kmem=yes
3211200576Sroberto    ;;
3212280849Scy *)
3213200576Sroberto    can_kmem=no
3214280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3215200576Srobertoesac
3216200576Sroberto
3217200576Sroberto
3218200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3219200576Sroberto
3220200576Sroberto# target-dependent defaults
3221200576Sroberto
3222200576Srobertocase "$host" in
3223200576Sroberto i386-sequent-ptx*)
3224200576Sroberto    ans=no
3225200576Sroberto    ;;
3226200576Sroberto i386-unknown-osf1*)
3227200576Sroberto    ans=yes
3228200576Sroberto    ;;
3229200576Sroberto mips-sgi-irix[[456]]*)
3230200576Sroberto    ans=yes
3231200576Sroberto    ;;
3232200576Sroberto *-fujitsu-uxp*)
3233200576Sroberto    ans=yes
3234200576Sroberto    ;;
3235280849Scy *-ibm-aix[[4-9]]*)
3236280849Scy    # XXX only verified thru AIX6.
3237200576Sroberto    ans=yes
3238200576Sroberto    ;;
3239200576Sroberto *-*-*linux*)
3240200576Sroberto    ans=yes
3241200576Sroberto    ;;
3242200576Sroberto *-*-solaris2.[[01]])
3243200576Sroberto    ans=no
3244200576Sroberto    ;;
3245200576Sroberto *-*-solaris2*)
3246200576Sroberto    ans=yes
3247200576Sroberto    ;;
3248200576Sroberto *-*-unicosmp*)
3249200576Sroberto    ans=yes
3250200576Sroberto    ;;
3251200576Sroberto *) ans=no
3252280849Scy    ;;
3253200576Srobertoesac
3254200576Sroberto
3255200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3256200576Sroberto# override the default
3257280849ScyAC_ARG_ENABLE(
3258280849Scy    [accurate-adjtime],
3259280849Scy    [AS_HELP_STRING(
3260280849Scy	[--enable-accurate-adjtime],
3261280849Scy	[s the adjtime() call is accurate]
3262280849Scy    )],
3263280849Scy    [ans=$enableval]
3264200576Sroberto)
3265200576Sroberto
3266200576SrobertoAC_MSG_RESULT([$ans])
3267200576Sroberto
3268200576Srobertocase "$ans" in
3269280849Scy yes)
3270280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3271200576Sroberto    adjtime_is_accurate=yes
3272200576Sroberto    ;;
3273200576Sroberto *)
3274200576Sroberto    adjtime_is_accurate=no
3275280849Scy    ;;
3276181834Srobertoesac
3277181834Sroberto
3278280849ScyAC_CACHE_CHECK(
3279280849Scy    [the name of 'tick' in the kernel],
3280280849Scy    [ntp_cv_nlist_tick],
3281280849Scy    [
3282280849Scy	ans=_tick
3283280849Scy	case "$host" in
3284280849Scy	 m68*-hp-hpux*) # HP9000/300?
3285280849Scy	    ans=_old_tick
3286280849Scy	    ;;
3287280849Scy	 *-apple-aux[[23]]*)
3288280849Scy	    ans=tick
3289280849Scy	    ;;
3290280849Scy	 *-hp-hpux*)
3291280849Scy	    ans=old_tick
3292280849Scy	    ;;
3293280849Scy	 *-ibm-aix[[3-9]]*)
3294280849Scy	    # XXX only verified thru AIX6.
3295280849Scy	    ans=no
3296280849Scy	    ;;
3297280849Scy	 *-*-mpeix*)
3298280849Scy	    ans=no
3299280849Scy	    ;;
3300280849Scy	 *-*-ptx*)
3301280849Scy	    ans=tick
3302280849Scy	    ;;
3303280849Scy	 *-*-sco3.2v[[45]]*)
3304280849Scy	    ans=no
3305280849Scy	    ;;
3306280849Scy	 *-*-solaris2*)
3307280849Scy	    ans=nsec_per_tick
3308280849Scy	    ;;
3309280849Scy	 *-*-sysv4*)
3310280849Scy	    ans=tick
3311280849Scy	    ;;
3312280849Scy	esac
3313280849Scy	ntp_cv_nlist_tick=$ans
3314280849Scy    ]
3315280849Scy)
3316280849Scycase "$ntp_cv_nlist_tick" in
3317280849Scy ''|no)
3318280849Scy    ;;	# HMS: I think we can only get 'no' here...
3319280849Scy *)
3320280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3321280849Scy	[What is the name of TICK in the kernel?])
3322181834Srobertoesac
3323280849Scy
3324280849ScyAC_CACHE_CHECK(
3325280849Scy    [for the units of 'tick'],
3326280849Scy    [ntp_cv_tick_nano],
3327280849Scy    [
3328280849Scy	ans=usec
3329280849Scy	case "$host" in
3330280849Scy	 *-*-solaris2*)
3331280849Scy	    ans=nsec
3332280849Scy	    ;;
3333280849Scy	esac
3334280849Scy	ntp_cv_tick_nano=$ans
3335280849Scy    ]
3336280849Scy)
3337280849Scycase "$ntp_cv_tick_nano" in
3338181834Sroberto nsec)
3339280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3340181834Srobertoesac
3341280849Scy
3342280849ScyAC_CACHE_CHECK(
3343280849Scy    [the name of 'tickadj' in the kernel],
3344280849Scy    [ntp_cv_nlist_tickadj],
3345280849Scy    [
3346280849Scy	ans=_tickadj
3347280849Scy	case "$host" in
3348280849Scy	 m68*-hp-hpux*) # HP9000/300?
3349280849Scy	    ans=_tickadj
3350280849Scy	    ;;
3351280849Scy	 *-apple-aux[[23]]*)
3352280849Scy	    ans=tickadj
3353280849Scy	    ;;
3354280849Scy	 *-hp-hpux10*)
3355280849Scy	    ans=no
3356280849Scy	    ;;
3357280849Scy	 *-hp-hpux9*)
3358280849Scy	    ans=no
3359280849Scy	    ;;
3360280849Scy	 *-hp-hpux*)
3361280849Scy	    ans=tickadj
3362280849Scy	    ;;
3363280849Scy	 *-*-aix*)
3364280849Scy	    ans=tickadj
3365280849Scy	    ;;
3366280849Scy	 *-*-mpeix*)
3367280849Scy	    ans=no
3368280849Scy	    ;;
3369280849Scy	 *-*-ptx*)
3370280849Scy	    ans=tickadj
3371280849Scy	    ;;
3372280849Scy	 *-*-sco3.2v4*)
3373280849Scy	    ans=no
3374280849Scy	    ;;
3375280849Scy	 *-*-sco3.2v5.0*)
3376280849Scy	    ans=clock_drift
3377280849Scy	    ;;
3378280849Scy	 *-*-solaris2*)
3379280849Scy	    ans=no	# hrestime_adj
3380280849Scy	    ;;
3381280849Scy	 *-*-sysv4*)
3382280849Scy	    ans=tickadj
3383280849Scy	    ;;
3384280849Scy	esac
3385280849Scy	ntp_cv_nlist_tickadj=$ans
3386280849Scy    ]
3387280849Scy)
3388280849Scycase "$ntp_cv_nlist_tickadj" in
3389280849Scy ''|no)
3390280849Scy    ;;	# HMS: I think we can only get 'no' here...
3391280849Scy *)
3392280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3393280849Scy	[What is the name of TICKADJ in the kernel?])
3394181834Srobertoesac
3395280849Scy
3396280849ScyAC_CACHE_CHECK(
3397280849Scy    [for the units of 'tickadj'],
3398280849Scy    [ntp_cv_tickadj_nano],
3399280849Scy    [
3400280849Scy	ans=usec
3401280849Scy	case "$host" in
3402280849Scy	 *-*-solaris2*)
3403280849Scy	    ans=nsec
3404280849Scy	    ;;
3405280849Scy	esac
3406280849Scy	ntp_cv_tickadj_nano=$ans
3407280849Scy    ]
3408280849Scy)
3409280849Scycase "$ntp_cv_tickadj_nano" in
3410181834Sroberto nsec)
3411280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3412181834Srobertoesac
3413280849Scy
3414280849ScyAC_CACHE_CHECK(
3415280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3416280849Scy    [ntp_cv_nlist_dosynctodr],
3417280849Scy    [
3418280849Scy	case "$host" in
3419280849Scy	 *-apple-aux[[23]]*)
3420280849Scy	    ans=no
3421280849Scy	    ;;
3422280849Scy	 *-sni-sysv*)
3423280849Scy	    ans=dosynctodr
3424280849Scy	    ;;
3425285169Scy	 *-stratus-vos)
3426285169Scy	    ans=no
3427285169Scy	    ;;
3428280849Scy	 *-*-aix*)
3429280849Scy	    ans=dosynctodr
3430280849Scy	    ;;
3431280849Scy	 *-*-hpux*)
3432280849Scy	    ans=no
3433280849Scy	    ;;
3434280849Scy	 *-*-mpeix*)
3435280849Scy	    ans=no
3436280849Scy	    ;;
3437280849Scy	 *-*-nextstep*)
3438280849Scy	    ans=_dosynctodr
3439280849Scy	    ;;
3440280849Scy	 *-*-ptx*)
3441280849Scy	    ans=doresettodr
3442280849Scy	    ;;
3443280849Scy	 *-*-sco3.2v4*)
3444280849Scy	    ans=no
3445280849Scy	    ;;
3446280849Scy	 *-*-sco3.2v5*)
3447280849Scy	    ans=track_rtc
3448280849Scy	    ;;
3449280849Scy	 *-*-solaris2*)
3450280849Scy	    ans=dosynctodr
3451280849Scy	    ;;
3452280849Scy	 *-*-sysv4*)
3453280849Scy	    ans=doresettodr
3454280849Scy	    ;;
3455280849Scy	 *)
3456280849Scy	    ans=_dosynctodr
3457280849Scy	    ;;
3458280849Scy	esac
3459280849Scy	ntp_cv_nlist_dosynctodr=$ans
3460280849Scy    ]
3461280849Scy)
3462280849Scycase "$ntp_cv_nlist_dosynctodr" in
3463280849Scy no)
3464181834Sroberto    ;;
3465181834Sroberto *)
3466280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3467280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3468181834Sroberto    ;;
3469181834Srobertoesac
3470280849Scy
3471280849ScyAC_CACHE_CHECK(
3472280849Scy    [half-heartedly for 'noprintf' in the kernel],
3473280849Scy    [ntp_cv_nlist_noprintf],
3474280849Scy    [
3475280849Scy	case "$host" in
3476280849Scy	 *-apple-aux[[23]]*)
3477280849Scy	    ans=no
3478280849Scy	    ;;
3479280849Scy	 *-sni-sysv*)
3480280849Scy	    ans=noprintf
3481280849Scy	    ;;
3482285169Scy	 *-stratus-vos)
3483285169Scy	    ans=no
3484285169Scy	    ;;
3485280849Scy	 *-*-aix*)
3486280849Scy	    ans=noprintf
3487280849Scy	    ;;
3488280849Scy	 *-*-hpux*)
3489280849Scy	    ans=no
3490280849Scy	    ;;
3491280849Scy	 *-*-mpeix*)
3492280849Scy	    ans=no
3493280849Scy	    ;;
3494280849Scy	 *-*-ptx*)
3495280849Scy	    ans=noprintf
3496280849Scy	    ;;
3497280849Scy	 *-*-nextstep*)
3498280849Scy	    ans=_noprintf
3499280849Scy	    ;;
3500280849Scy	 *-*-solaris2*)
3501280849Scy	    ans=noprintf
3502280849Scy	    ;;
3503280849Scy	 *-*-sysv4*)
3504280849Scy	    ans=noprintf
3505280849Scy	    ;;
3506280849Scy	 *)
3507280849Scy	    ans=_noprintf
3508280849Scy	    ;;
3509280849Scy	esac
3510280849Scy	ntp_cv_nlist_noprintf=$ans
3511280849Scy    ]
3512280849Scy)
3513280849Scycase "$ntp_cv_nlist_noprintf" in
3514280849Scy no)
3515181834Sroberto    ;;
3516181834Sroberto *)
3517280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3518280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3519181834Sroberto    ;;
3520181834Srobertoesac
3521181834Sroberto
3522181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3523181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3524181834Sroberto
3525280849Scydnl	tick		tickadj
3526181834Srobertodnl	10000		80	    Unixware
3527181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3528181834Srobertodnl	10000		150	    sgi IRIX
3529181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3530181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3531181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3532181834Srobertodnl	txc.tick	1	    Linux
3533181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3534181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3535181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3536181834Sroberto
3537181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3538181834Sroberto
3539200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3540200576Sroberto
3541200576Sroberto# target-dependent default for tick
3542200576Sroberto
3543200576Srobertocase "$host" in
3544200576Sroberto *-*-pc-cygwin*)
3545200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3546200576Sroberto    ;;
3547200576Sroberto *-univel-sysv*)
3548200576Sroberto    ans=10000
3549200576Sroberto    ;;
3550200576Sroberto *-*-irix*)
3551200576Sroberto    ans=10000
3552200576Sroberto    ;;
3553200576Sroberto *-*-*linux*)
3554200576Sroberto    ans=txc.tick
3555200576Sroberto    ;;
3556200576Sroberto *-*-mpeix*)
3557200576Sroberto    ans=no
3558200576Sroberto    ;;
3559200576Sroberto *-*-winnt3.5)
3560200576Sroberto    ans='(every / 10)'
3561200576Sroberto    ;;
3562200576Sroberto *-*-unicosmp*)
3563200576Sroberto    ans=10000
3564200576Sroberto    ;;
3565200576Sroberto *)
3566200576Sroberto    ans='1000000L/hz'
3567200576Sroberto    ;;
3568200576Srobertoesac
3569200576Sroberto
3570200576SrobertoAC_ARG_ENABLE(
3571200576Sroberto    [tick],
3572280849Scy    [AS_HELP_STRING(
3573200576Sroberto	[--enable-tick=VALUE],
3574200576Sroberto	[s force a value for 'tick']
3575280849Scy    )],
3576200576Sroberto    [ans=$enableval]
3577200576Sroberto)
3578200576Sroberto
3579200576SrobertoAC_MSG_RESULT([$ans])
3580200576Sroberto
3581200576Srobertocase "$ans" in
3582280849Scy ''|no)
3583280849Scy    ;;	# HMS: I think we can only get 'no' here...
3584280849Scy *)
3585280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3586280849Scy	[Preset a value for 'tick'?])
3587181834Srobertoesac
3588181834Sroberto
3589200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3590200576Sroberto
3591200576Sroberto# target-specific default
3592200576Srobertoans='500/hz'
3593200576Srobertocase "$host" in
3594200576Sroberto *-fujitsu-uxp*)
3595200576Sroberto    case "$adjtime_is_accurate" in
3596200576Sroberto     yes)
3597280849Scy	ans='tick/16'
3598200576Sroberto    esac
3599200576Sroberto    ;;
3600200576Sroberto *-univel-sysv*)
3601200576Sroberto    ans=80
3602200576Sroberto    ;;
3603200576Sroberto *-*-aix*)
3604200576Sroberto    case "$can_kmem" in
3605200576Sroberto     no)
3606200576Sroberto	ans=1000
3607280849Scy	;;
3608200576Sroberto    esac
3609200576Sroberto    ;;
3610200576Sroberto *-*-domainos)	# Skippy: won't be found...
3611200576Sroberto    case "$can_kmem" in
3612200576Sroberto     no)
3613200576Sroberto	ans=668
3614280849Scy	;;
3615200576Sroberto    esac
3616200576Sroberto    ;;
3617200576Sroberto *-*-hpux*)
3618200576Sroberto    case "$adjtime_is_accurate" in
3619200576Sroberto     yes)
3620200576Sroberto	ans='tick/16'
3621280849Scy	;;
3622200576Sroberto    esac
3623200576Sroberto    ;;
3624200576Sroberto *-*-irix*)
3625200576Sroberto    ans=150
3626200576Sroberto    ;;
3627200576Sroberto *-*-mpeix*)
3628200576Sroberto    ans=no
3629200576Sroberto    ;;
3630200576Sroberto *-*-sco3.2v5.0*)
3631200576Sroberto    ans=10000L/hz
3632200576Sroberto    ;;
3633200576Sroberto *-*-winnt3.5)
3634200576Sroberto    ans=50
3635200576Sroberto    ;;
3636200576Sroberto *-*-unicosmp*)
3637200576Sroberto    ans=150
3638280849Scy    ;;
3639200576Srobertoesac
3640200576Sroberto
3641200576SrobertoAC_ARG_ENABLE(
3642200576Sroberto    [tickadj],
3643280849Scy    [AS_HELP_STRING(
3644280849Scy	[--enable-tickadj=VALUE],
3645280849Scy	[s force a value for 'tickadj']
3646280849Scy    )],
3647200576Sroberto    [ans=$enableval]
3648200576Sroberto)
3649200576Sroberto
3650200576SrobertoAC_MSG_RESULT([$ans])
3651200576Sroberto
3652200576Srobertodefault_tickadj=$ans
3653200576Sroberto
3654200576Srobertocase "$default_tickadj" in
3655280849Scy ''|no)
3656280849Scy    ;;	# HMS: I think we can only get 'no' here...
3657280849Scy *)
3658280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3659280849Scy	[Preset a value for 'tickadj'?]) ;;
3660181834Srobertoesac
3661181834Sroberto
3662181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3663181834Sroberto# 1/100s (system tick). Sigh ...
3664181834Sroberto# Unfortunately, there is no easy way to know if particular release
3665181834Sroberto# has this "feature" or any obvious way to test for it.
3666181834Srobertocase "$host" in
3667280849Scy mips-sni-sysv4*)
3668280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3669280849Scy	[Do we want the ReliantUNIX clock hacks?])
3670181834Srobertoesac
3671181834Sroberto
3672181834Srobertocase "$host" in
3673280849Scy *-*-sco3.2v5*)
3674280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3675181834Srobertoesac
3676181834Sroberto
3677280849Scyntp_cv_make_tickadj=yes
3678200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3679181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3680200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3681280849Scy    ntp_cv_make_tickadj=no
3682181834Sroberto    ;;
3683181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3684200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3685280849Scy    ntp_cv_make_tickadj=no
3686181834Sroberto    ;;
3687181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3688200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3689280849Scy    ntp_cv_make_tickadj=no
3690181834Sroberto    ;;
3691181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3692181834Sroberto    ;;
3693181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3694181834Sroberto    ;;
3695181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3696200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3697181834Sroberto    ;;
3698181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3699181834Sroberto    ;;
3700181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3701181834Sroberto    ;;
3702181834Sroberto *)		# Generally bogus.
3703200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3704181834Sroberto    ;;
3705181834Srobertoesac
3706181834Sroberto
3707181834SrobertoAC_SUBST(MAKE_NTPTIME)
3708200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3709181834Sroberto[case "$host" in
3710280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3711181834Sroberto     yesyes)
3712181834Sroberto	ans=yes
3713181834Sroberto	;;
3714181834Sroberto     *)
3715181834Sroberto	ans=no
3716181834Sroberto	;;
3717181834Sroberto    esac
3718181834Sroberto    ;;
3719181834Srobertoesac
3720181834Srobertoac_cv_make_ntptime=$ans])
3721181834Srobertocase "$ac_cv_make_ntptime" in
3722181834Sroberto yes)
3723181834Sroberto    MAKE_NTPTIME=ntptime
3724181834Sroberto    ;;
3725280849Scy *)
3726280849Scy    NTPTIME_DB=
3727280849Scy    NTPTIME_DL=
3728280849Scy    NTPTIME_DS=
3729280849Scy    NTPTIME_MS=
3730280849Scy    ;;
3731181834Srobertoesac
3732181834Sroberto
3733280849ScyAC_SUBST([MAKE_TICKADJ])
3734181834Srobertocase "$host" in
3735181834Sroberto mips-sni-sysv4*)
3736181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3737181834Sroberto    # Do not bother
3738280849Scy    ntp_cv_make_tickadj=no
3739181834Sroberto    ;;
3740181834Sroberto *-*-irix*)
3741280849Scy    ntp_cv_make_tickadj=no
3742181834Sroberto    ;;
3743181834Sroberto *-*-solaris2*)
3744181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3745181834Sroberto    case "$host" in
3746181834Sroberto     *-*-solaris2.1[[0-9]]*)
3747280849Scy	ntp_cv_make_tickadj=no
3748181834Sroberto	;;
3749181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3750280849Scy     *) ntp_cv_make_tickadj=no ;;
3751181834Sroberto    esac
3752181834Sroberto    ;;
3753181834Sroberto *-*-unicosmp*)
3754280849Scy    ntp_cv_make_tickadj=no
3755181834Sroberto    ;;
3756181834Srobertoesac
3757200576Sroberto
3758200576Sroberto#
3759200576Sroberto# Despite all the above, we always make tickadj.  Setting
3760280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3761200576Sroberto# report that the configuration variable was cached.  It may
3762200576Sroberto# be better to simply remove the hunk above, I did not want
3763200576Sroberto# to remove it if there is hope it will be used again.
3764200576Sroberto#
3765280849ScyAS_UNSET([ntp_cv_make_tickadj])
3766200576Sroberto
3767280849ScyAC_CACHE_CHECK(
3768280849Scy    [if we want and can make the tickadj utility],
3769280849Scy    [ntp_cv_make_tickadj],
3770280849Scy    [ntp_cv_make_tickadj=yes]
3771280849Scy)
3772280849Scycase "$ntp_cv_make_tickadj" in
3773181834Sroberto yes)
3774181834Sroberto    MAKE_TICKADJ=tickadj
3775181834Sroberto    ;;
3776280849Scy *)
3777280849Scy    CALC_TICKADJ_DB=
3778280849Scy    CALC_TICKADJ_DL=
3779280849Scy    CALC_TICKADJ_DS=
3780280849Scy    CALC_TICKADJ_MS=
3781280849Scy    TICKADJ_DB=
3782280849Scy    TICKADJ_DL=
3783280849Scy    TICKADJ_DS=
3784280849Scy    TICKADJ_MS=
3785280849Scy    ;;
3786181834Srobertoesac
3787181834Sroberto
3788280849ScyAC_SUBST([MAKE_TIMETRIM])
3789280849ScyAC_CACHE_CHECK(
3790280849Scy    [if we want and can make the timetrim utility],
3791280849Scy    [ntp_cv_make_timetrim],
3792280849Scy    [
3793280849Scy	case "$host" in
3794280849Scy	 *-*-irix*)
3795280849Scy	    ntp_cv_make_timetrim=yes
3796280849Scy	    ;;
3797280849Scy	 *-*-unicosmp*)
3798280849Scy	    ntp_cv_make_timetrim=yes
3799280849Scy	    ;;
3800280849Scy	 *)
3801280849Scy	    ntp_cv_make_timetrim=no
3802280849Scy	    ;;
3803280849Scy	esac
3804280849Scy    ]
3805280849Scy)
3806280849Scycase "$ntp_cv_make_timetrim" in
3807181834Sroberto yes)
3808181834Sroberto    MAKE_TIMETRIM=timetrim
3809181834Sroberto    ;;
3810280849Scy *) TIMETRIM_DB=
3811280849Scy    TIMETRIM_DL=
3812280849Scy    TIMETRIM_DS=
3813280849Scy    TIMETRIM_MS=
3814280849Scy    ;;
3815181834Srobertoesac
3816181834Sroberto
3817280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3818280849ScyAC_SUBST([MAKE_NTPDSIM])
3819200576Sroberto
3820200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3821200576SrobertoAC_ARG_ENABLE(
3822200576Sroberto    [simulator],
3823280849Scy    [AS_HELP_STRING(
3824200576Sroberto	[--enable-simulator],
3825200576Sroberto	[- build/install the NTPD simulator?]
3826280849Scy    )],
3827280849Scy    [ans=$enableval],
3828200576Sroberto    [ans=no]
3829200576Sroberto)
3830200576SrobertoAC_MSG_RESULT([$ans])
3831200576Srobertocase "$ans" in
3832181834Sroberto yes)
3833181834Sroberto    MAKE_NTPDSIM=ntpdsim
3834181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3835181834Sroberto    ;;
3836280849Scy *)
3837280849Scy    NTPDSIM_DB=
3838280849Scy    NTPDSIM_DL=
3839280849Scy    NTPDSIM_DS=
3840280849Scy    NTPDSIM_MS=
3841280849Scy    ;;
3842181834Srobertoesac
3843181834Sroberto
3844181834Srobertocase "$build" in
3845181834Sroberto $host)
3846181834Sroberto    ;;
3847181834Sroberto *) case "$host" in
3848181834Sroberto     *-*-vxworks*)
3849200576Sroberto	LDFLAGS="$LDFLAGS -r"
3850200576Sroberto	;;
3851181834Sroberto    esac
3852181834Sroberto    ;;
3853181834Srobertoesac
3854181834Sroberto
3855280849ScyNTP_WITHSNTP
3856200576Sroberto
3857280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3858280849ScyAC_ARG_WITH(
3859280849Scy    [ntpsnmpd],
3860280849Scy    [AS_HELP_STRING(
3861280849Scy	[--with-ntpsnmpd],
3862280849Scy	[s Build ntpsnmpd MIB agent?]
3863280849Scy    )],
3864280849Scy    [ans=$withval],
3865280849Scy    [
3866280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3867280849Scy	 /*)	ans=yes ;;
3868280849Scy	 *)	ans=no  ;;
3869280849Scy	esac
3870280849Scy    ]
3871280849Scy)
3872280849ScyAC_MSG_RESULT([$ans])
3873280849Scycase "$ans" in
3874280849Scy yes)
3875280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3876280849Scy     /*)
3877280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3878285169Scy	# Bug 2815.  This is a bit of a hack, but it works...
3879285169Scy	case "$ntp_cv_net_snmp_version" in
3880285169Scy	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3881285169Scy		;;
3882285169Scy	esac
3883280849Scy	AC_SUBST([SNMP_LIBS])
3884280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3885280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3886280849Scy	SNMP_CPPFLAGS=
3887280849Scy	SNMP_CFLAGS=
3888280849Scy	for i in $foo; do
3889280849Scy	    case "$i" in
3890280849Scy	     -D*|-U*|-I*)
3891280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3892280849Scy		;;
3893280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3894280849Scy		;;
3895280849Scy	    esac
3896280849Scy	done
3897280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3898280849Scy	AC_SUBST([SNMP_CFLAGS])
3899280849Scy
3900280849Scy	save_CFLAGS=$CFLAGS
3901280849Scy	save_CPPFLAGS=$CPPFLAGS
3902280849Scy	save_LIBS=$LIBS
3903280849Scy	CFLAGS=$SNMP_CFLAGS
3904280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3905280849Scy
3906280849Scy	AC_CHECK_HEADER(
3907280849Scy	    [net-snmp/net-snmp-config.h],
3908280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3909280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3910280849Scy	)
3911280849Scy
3912280849Scy	# Do this last, as we're messing up LIBS.
3913280849Scy	# check -lnetsnmp for netsnmp_daemonize
3914280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3915280849Scy	AC_CHECK_LIB(
3916280849Scy	    [netsnmp],
3917280849Scy	    [netsnmp_daemonize],
3918280849Scy	    [ans=yes],
3919280849Scy	    [ans=no]
3920280849Scy	)
3921280849Scy	case "$ans" in
3922280849Scy	 no)
3923280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3924280849Scy		[We need to provide netsnmp_daemonize()])
3925280849Scy	esac
3926280849Scy	
3927280849Scy	CFLAGS=$save_CFLAGS
3928280849Scy	AS_UNSET([save_CFLAGS])
3929280849Scy	CPPFLAGS=$save_CPPFLAGS
3930280849Scy	AS_UNSET([save_CPPFLAGS])
3931280849Scy	LIBS=$save_LIBS
3932280849Scy	AS_UNSET([save_LIBS])
3933280849Scy	;;
3934280849Scy     *) 
3935280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3936280849Scy	;;
3937280849Scy    esac
3938280849Scy    ;;
3939280849Scyesac
3940280849ScyAC_SUBST([MAKE_NTPSNMPD])
3941280849Scy
3942280849Scycase "$MAKE_NTPSNMPD" in
3943280849Scy '')
3944280849Scy    NTPSNMPD_DB=
3945280849Scy    NTPSNMPD_DL=
3946280849Scy    NTPSNMPD_DS=
3947280849Scy    NTPSNMPD_MS=
3948280849Scy    ;;
3949280849Scyesac
3950280849Scy
3951200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3952200576Sroberto
3953200576Sroberto# target-specific defaults
3954200576Sroberto
3955200576Srobertocase "$host" in
3956200576Sroberto *-apple-aux[[23]]*)
3957200576Sroberto    ans=yes
3958200576Sroberto    ;;
3959200576Sroberto *-*-bsdi[[012]]*)
3960200576Sroberto    ans=no
3961200576Sroberto    ;;
3962200576Sroberto *-*-bsdi*)
3963200576Sroberto    ans=yes
3964200576Sroberto    ;;
3965200576Sroberto *-*-openvms*)	# HMS: won't be found
3966200576Sroberto    ans=yes
3967200576Sroberto    ;;
3968200576Sroberto *) ans=no
3969200576Sroberto    ;;
3970200576Srobertoesac
3971200576Sroberto
3972200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3973200576Sroberto
3974200576SrobertoAC_ARG_ENABLE(
3975200576Sroberto    [slew-always],
3976280849Scy    [AS_HELP_STRING(
3977200576Sroberto	[--enable-slew-always],
3978200576Sroberto	[s always slew the time]
3979280849Scy    )],
3980200576Sroberto    [ans=$enableval]
3981200576Sroberto)
3982200576Sroberto
3983200576SrobertoAC_MSG_RESULT([$ans])
3984200576Sroberto
3985200576Srobertocase "$ans" in
3986280849Scy yes)
3987280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3988181834Srobertoesac
3989181834Sroberto
3990200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3991200576Sroberto
3992200576Srobertocase "$host" in
3993200576Sroberto *-sni-sysv*)
3994200576Sroberto    ans=yes
3995200576Sroberto    ;;
3996285169Scy *-stratus-vos)
3997285169Scy    ans=no
3998285169Scy    ;;
3999200576Sroberto *-univel-sysv*)
4000200576Sroberto    ans=no
4001200576Sroberto    ;;
4002200576Sroberto *-*-ptx*)
4003200576Sroberto    ans=yes
4004200576Sroberto    ;;
4005200576Sroberto *-*-solaris2.1[[0-9]]*)
4006200576Sroberto    ans=no
4007200576Sroberto    ;;
4008200576Sroberto *-*-solaris2.[[012]]*)
4009200576Sroberto    ans=yes
4010200576Sroberto    ;;
4011200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4012200576Sroberto    ans=yes
4013200576Sroberto    ;;
4014200576Sroberto *) ans=no
4015200576Sroberto    ;;
4016200576Srobertoesac
4017200576Sroberto
4018200576SrobertoAC_ARG_ENABLE(
4019200576Sroberto    [step-slew],
4020280849Scy    [AS_HELP_STRING(
4021200576Sroberto	[--enable-step-slew],
4022200576Sroberto	[s step and slew the time]
4023280849Scy    )],
4024200576Sroberto    [ans=$enableval]
4025200576Sroberto)
4026200576Sroberto
4027200576SrobertoAC_MSG_RESULT([$ans])
4028200576Sroberto
4029200576Srobertocase "$ans" in
4030280849Scy yes)
4031280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4032181834Srobertoesac
4033181834Sroberto
4034200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4035200576Sroberto
4036200576Srobertocase "$host" in
4037200576Sroberto *-apple-aux[[23]]*)
4038200576Sroberto    ans=yes
4039200576Sroberto    ;;
4040200576Sroberto *) ans=no
4041280849Scy    ;;
4042200576Srobertoesac
4043200576Sroberto
4044200576SrobertoAC_ARG_ENABLE(
4045200576Sroberto    [ntpdate-step],
4046280849Scy    [AS_HELP_STRING(
4047200576Sroberto	[--enable-ntpdate-step],
4048200576Sroberto	[s if ntpdate should step the time]
4049280849Scy    )],
4050200576Sroberto    [ans=$enableval]
4051200576Sroberto)
4052200576Sroberto
4053200576SrobertoAC_MSG_RESULT([$ans])
4054200576Sroberto
4055200576Srobertocase "$ans" in
4056280849Scy yes)
4057280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4058280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4059181834Srobertoesac
4060181834Sroberto
4061200576Sroberto
4062200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4063200576Sroberto
4064200576Srobertocase "$host" in
4065200576Sroberto *-*-nextstep*)
4066200576Sroberto    ans=yes
4067200576Sroberto    ;;
4068200576Sroberto *-*-openvms*)	# HMS: won't be found
4069200576Sroberto    ans=yes
4070200576Sroberto    ;;
4071200576Sroberto *)
4072200576Sroberto    ans=no
4073280849Scy    ;;
4074200576Srobertoesac
4075200576Sroberto
4076200576SrobertoAC_ARG_ENABLE(
4077200576Sroberto    [hourly-todr-sync],
4078280849Scy    [AS_HELP_STRING(
4079200576Sroberto	[--enable-hourly-todr-sync],
4080200576Sroberto	[s if we should sync TODR hourly]
4081280849Scy    )],
4082200576Sroberto    [ans=$enableval]
4083200576Sroberto)
4084200576Sroberto
4085200576SrobertoAC_MSG_RESULT([$ans])
4086200576Sroberto
4087181834Srobertocase "$ac_cv_var_sync_todr" in
4088280849Scy yes)
4089280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4090181834Srobertoesac
4091181834Sroberto
4092181834Sroberto
4093200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4094200576Sroberto
4095200576Srobertocase "$host" in
4096200576Sroberto *-*-solaris2.6)
4097200576Sroberto    unamev=`uname -v`
4098200576Sroberto    case "$unamev" in
4099200576Sroberto     Generic_105181-*)
4100200576Sroberto	old_IFS="$IFS"
4101200576Sroberto	IFS="-"
4102200576Sroberto	set $unamev
4103200576Sroberto	IFS="$old_IFS"
4104200576Sroberto	if test "$2" -ge 17
4105200576Sroberto	then
4106200576Sroberto	    # Generic_105181-17 and higher
4107200576Sroberto	    ans=no
4108200576Sroberto	else
4109200576Sroberto	    ans=yes
4110200576Sroberto	fi
4111200576Sroberto	;;
4112280849Scy     *)
4113181834Sroberto	ans=yes
4114280849Scy	;;
4115200576Sroberto    esac
4116200576Sroberto    ;;
4117200576Sroberto *-*-solaris2.7)
4118200576Sroberto    unamev=`uname -v`
4119200576Sroberto    case "$unamev" in
4120200576Sroberto     Generic_106541-*)
4121200576Sroberto	old_IFS="$IFS"
4122200576Sroberto	IFS="-"
4123200576Sroberto	set $unamev
4124200576Sroberto	IFS="$old_IFS"
4125200576Sroberto	if test "$2" -ge 07
4126200576Sroberto	then
4127200576Sroberto	    # Generic_106541-07 and higher
4128200576Sroberto	    ans=no
4129200576Sroberto	else
4130200576Sroberto	    ans=yes
4131200576Sroberto	fi
4132181834Sroberto	;;
4133200576Sroberto     *)
4134181834Sroberto	ans=yes
4135280849Scy	;;
4136181834Sroberto    esac
4137200576Sroberto    ;;
4138200576Sroberto *)
4139200576Sroberto    ans=no
4140280849Scy    ;;
4141200576Srobertoesac
4142200576Sroberto
4143200576SrobertoAC_ARG_ENABLE(
4144200576Sroberto    [kernel-fll-bug],
4145280849Scy    [AS_HELP_STRING(
4146200576Sroberto	[--enable-kernel-fll-bug],
4147200576Sroberto	[s if we should avoid a kernel FLL bug]
4148280849Scy    )],
4149200576Sroberto    [ans=$enableval]
4150200576Sroberto)
4151200576Sroberto
4152200576SrobertoAC_MSG_RESULT([$ans])
4153200576Sroberto
4154200576Srobertocase "$ans" in
4155280849Scy yes)
4156280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4157200576Srobertoesac
4158200576Sroberto
4159200576Sroberto
4160280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4161280849ScyAC_ARG_ENABLE(
4162280849Scy    [bug1243-fix],
4163280849Scy    [AS_HELP_STRING(
4164280849Scy	[--enable-bug1243-fix],
4165280849Scy	[+ use unmodified autokey session keys]
4166280849Scy    )],
4167280849Scy    [ans=$enableval],
4168280849Scy    [ans=yes]
4169280849Scy)
4170280849ScyAC_MSG_RESULT([$ans])
4171280849Scycase "$ans" in
4172280849Scy no)
4173280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4174280849Scy	[use old autokey session key behavior?])
4175280849Scyesac
4176280849Scy
4177280849Scy
4178298695SdelphijAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4179298695SdelphijAC_ARG_ENABLE(
4180298695Sdelphij    [bug3020-fix],
4181298695Sdelphij    [AS_HELP_STRING(
4182298695Sdelphij	[--enable-bug3020-fix],
4183298695Sdelphij	[+ Provide the explicit 127.0.0.0/8 martian filter]
4184298695Sdelphij    )],
4185298695Sdelphij    [ans=$enableval],
4186298695Sdelphij    [ans=yes]
4187298695Sdelphij)
4188298695SdelphijAC_MSG_RESULT([$ans])
4189298695Sdelphijcase "$ans" in
4190298695Sdelphij yes)
4191298695Sdelphij    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4192298695Sdelphij	[Provide the explicit 127.0.0.0/8 martian filter?])
4193298695Sdelphijesac
4194298695Sdelphij
4195298695Sdelphij
4196344884ScyAC_MSG_CHECKING([if we want correct mode7 fudgetime2 behavior])
4197344884ScyAC_ARG_ENABLE(
4198344884Scy    [bug3527-fix],
4199344884Scy    [AS_HELP_STRING(
4200344884Scy	[--enable-bug3527-fix],
4201344884Scy	[+ provide correct mode7 fudgetime2 behavior]
4202344884Scy    )],
4203344884Scy    [ans=$enableval],
4204344884Scy    [ans=yes]
4205344884Scy)
4206344884ScyAC_MSG_RESULT([$ans])
4207344884Scycase "$ans" in
4208344884Scy no)
4209344884Scy    AC_DEFINE([DISABLE_BUG3527_FIX], [1],
4210344884Scy	[use old autokey session key behavior?])
4211344884Scyesac
4212344884Scy
4213344884Scy
4214200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4215200576Sroberto
4216200576Srobertocase "$host" in
4217200576Sroberto *-*-solaris2.[[89]])
4218200576Sroberto    ans=yes
4219200576Sroberto    ;;
4220200576Sroberto *-*-solaris2.1[[0-9]]*)
4221200576Sroberto    ans=yes
4222200576Sroberto    ;;
4223200576Sroberto *) ans=no
4224280849Scy    ;;
4225200576Srobertoesac
4226200576Sroberto
4227200576SrobertoAC_ARG_ENABLE(
4228280849Scy    [irig-sawtooth],
4229280849Scy    [AS_HELP_STRING(
4230200576Sroberto	[--enable-irig-sawtooth],
4231200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4232280849Scy    )],
4233200576Sroberto    [ans=$enableval]
4234200576Sroberto)
4235200576Sroberto
4236200576SrobertoAC_MSG_RESULT([$ans])
4237200576Sroberto
4238200576Srobertocase "$ans" in
4239280849Scy yes)
4240280849Scy    AC_DEFINE([IRIG_SUCKS], [1],
4241280849Scy	[Should we use the IRIG sawtooth filter?])
4242181834Srobertoesac
4243181834Sroberto
4244200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4245200576SrobertoAC_ARG_ENABLE(
4246280849Scy	[nist],
4247280849Scy	[AS_HELP_STRING(
4248200576Sroberto	    [--enable-nist],
4249200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4250280849Scy	)],
4251200576Sroberto	[ans=$enableval],
4252200576Sroberto	[ans=no]
4253200576Sroberto)
4254200576Sroberto
4255200576SrobertoAC_MSG_RESULT([$ans])
4256200576Sroberto
4257200576Srobertocase "$ans" in
4258280849Scy yes)
4259280849Scy    AC_DEFINE([LOCKCLOCK], [1],
4260280849Scy	[Should we align with the NIST lockclock scheme?]) ;;
4261181834Srobertoesac
4262181834Sroberto
4263200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4264200576SrobertoAC_ARG_ENABLE(
4265200576Sroberto    [ntp-signd],
4266280849Scy    [AS_HELP_STRING(
4267280849Scy	[--enable-ntp-signd],
4268280849Scy	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4269280849Scy    )],
4270200576Sroberto    [ans=$enableval],
4271200576Sroberto    [ans=no]
4272200576Sroberto)
4273200576Sroberto
4274200576SrobertoAC_MSG_RESULT([$ans])
4275200576Sroberto
4276200576Srobertocase "$ans" in
4277200576Sroberto no)
4278200576Sroberto    ntp_signd_path=
4279200576Sroberto    ;;
4280200576Sroberto yes)
4281200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4282200576Sroberto    ;;
4283200576Sroberto *)
4284200576Sroberto    ntp_signd_path="$ans"
4285200576Srobertoesac
4286200576Sroberto
4287200576Srobertocase "$ntp_signd_path" in
4288200576Sroberto '')
4289200576Sroberto    ;;
4290200576Sroberto *)
4291280849Scy    AC_DEFINE([HAVE_NTP_SIGND], [1],
4292280849Scy	[Do we want support for Samba's signing daemon?])
4293280849Scy    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4294280849Scy	[Path to sign daemon rendezvous socket])
4295200576Sroberto    ;;
4296200576Srobertoesac
4297200576Sroberto
4298200576SrobertoAC_CHECK_HEADERS([libscf.h])
4299280849ScyLSCF=
4300200576Srobertocase "$ac_cv_header_libscf_h" in
4301200576Sroberto yes)
4302280849Scy    LSCF='-lscf'
4303200576Srobertoesac
4304280849ScyAC_SUBST([LSCF])
4305200576Sroberto
4306280849ScyNTP_IPV6
4307200576Sroberto
4308200576Sroberto
4309181834Sroberto#
4310181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4311181834Sroberto#
4312200576SrobertoAC_CACHE_CHECK(
4313200576Sroberto    [for interface list sysctl],
4314280849Scy    [ntp_cv_iflist_sysctl],
4315280849Scy    [AC_PREPROC_IFELSE(
4316282408Scy	[AC_LANG_SOURCE([
4317200576Sroberto	    #include <sys/param.h>
4318200576Sroberto	    #include <sys/sysctl.h>
4319200576Sroberto	    #include <sys/socket.h>
4320280849Scy	    #ifndef NET_RT_IFLIST
4321280849Scy	    # error
4322200576Sroberto	    #endif
4323282408Scy	])],
4324280849Scy	[ntp_cv_iflist_sysctl=yes],
4325280849Scy	[ntp_cv_iflist_sysctl=no]
4326280849Scy    )]
4327200576Sroberto)
4328280849Scycase "$ntp_cv_iflist_sysctl" in
4329280849Scy yes)
4330280849Scy    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4331280849Scyesac
4332181834Sroberto
4333280849Scy###
4334280849Scy
4335280849ScyAC_MSG_CHECKING([if we want the saveconfig mechanism])
4336280849ScyAC_ARG_ENABLE(
4337280849Scy    [saveconfig],
4338280849Scy    [AS_HELP_STRING(
4339280849Scy	[--enable-saveconfig],
4340280849Scy	[+ saveconfig mechanism]
4341280849Scy    )],
4342280849Scy    [ntp_ok=$enableval],
4343280849Scy    [ntp_ok=yes]
4344280849Scy)
4345280849Scyntp_saveconfig_enabled=0
4346280849Scycase "$ntp_ok" in
4347200576Sroberto yes)
4348280849Scy    ntp_saveconfig_enabled=1
4349280849Scy    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4350280849Scy    ;;
4351200576Srobertoesac
4352280849ScyAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4353280849ScyAC_MSG_RESULT([$ntp_ok])
4354200576Sroberto
4355285169Scy###
4356285169Scy
4357285169ScyAC_MSG_CHECKING([if we want the experimental leap smear code])
4358285169ScyAC_ARG_ENABLE(
4359285169Scy    [leap-smear],
4360285169Scy    [AS_HELP_STRING(
4361285169Scy	[--enable-leap-smear],
4362285169Scy	[- experimental leap smear code]
4363285169Scy    )],
4364285169Scy    [ntp_ok=$enableval],
4365285169Scy    [ntp_ok=no]
4366285169Scy)
4367285169Scyntp_leap_smear_enabled=0
4368285169Scycase "$ntp_ok" in
4369285169Scy yes)
4370285169Scy    ntp_leap_smear_enabled=1
4371285169Scy    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4372285169Scy    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4373285169Scy    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4374285169Scy    ;;
4375285169Scyesac
4376285169ScyAC_MSG_RESULT([$ntp_ok])
4377285169Scy
4378298695Sdelphij###
4379298695Sdelphij
4380298695SdelphijAC_MSG_CHECKING([if we want dynamic interleave support])
4381298695SdelphijAC_ARG_ENABLE(
4382298695Sdelphij    [dynamic-interleave],
4383298695Sdelphij    [AS_HELP_STRING(
4384298695Sdelphij	[--enable-dynamic-interleave],
4385298695Sdelphij	[- dynamic interleave support]
4386298695Sdelphij    )],
4387298695Sdelphij    [ntp_ok=$enableval],
4388298695Sdelphij    [ntp_ok=no]
4389298695Sdelphij)
4390298695Sdelphijntp_dynamic_interleave=0
4391298695Sdelphijcase "$ntp_ok" in
4392298695Sdelphij yes)
4393298695Sdelphij    ntp_dynamic_interleave=1
4394298695Sdelphij    ;;
4395298695Sdelphijesac
4396298695SdelphijAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4397298695Sdelphij    [support dynamic interleave?])
4398298695SdelphijAC_MSG_RESULT([$ntp_ok])
4399298695Sdelphij
4400285169ScyNTP_UNITYBUILD
4401285169Scy
4402280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4403280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4404280849Scydnl  can't be conditionalized.
4405280849ScyNTP_GOOGLETEST
4406200576Sroberto
4407289764SglebiusNTP_PROBLEM_TESTS
4408289764Sglebius
4409181834Sroberto###
4410181834Sroberto
4411338530SdelphijAC_CHECK_DECLS([sigsetjmp,siglongjmp], [], [], [[#include <setjmp.h>]])
4412338530Sdelphij
4413338530Sdelphij###
4414338530Sdelphij
4415280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4416280849Scy    [Default location of crypto key info])
4417181834Sroberto
4418280849ScyAC_CONFIG_FILES([Makefile])
4419280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4420280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4421280849ScyAC_CONFIG_FILES([include/Makefile])
4422280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4423280849ScyAC_CONFIG_FILES([kernel/Makefile])
4424280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4425280849ScyAC_CONFIG_FILES([libntp/Makefile])
4426280849ScyAC_CONFIG_FILES([libparse/Makefile])
4427280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4428285169ScyAC_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])
4429280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4430280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4431280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4432280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4433280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4434280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4435280849ScyAC_CONFIG_FILES([scripts/Makefile])
4436282408ScyAC_CONFIG_FILES([scripts/build/Makefile])
4437301247SdelphijAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4438282408ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4439282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4440282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4441280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4442282408ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4443280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4444282408ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4445280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4446282408ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4447280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4448280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4449280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4450280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4451282408ScyAC_CONFIG_FILES([scripts/update-leap/Makefile])
4452285169ScyAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4453280849ScyAC_CONFIG_FILES([tests/Makefile])
4454285169ScyAC_CONFIG_FILES([tests/bug-2803/Makefile])
4455280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4456280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4457289764SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4458285169ScyAC_CONFIG_FILES([tests/sandbox/Makefile])
4459285169ScyAC_CONFIG_FILES([tests/sec-2853/Makefile])
4460280849ScyAC_CONFIG_FILES([util/Makefile])
4461181834Sroberto
4462280849Scyperllibdir="${datadir}/ntp/lib"
4463280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4464181834Sroberto
4465280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4466280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4467280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4468280849ScyAC_SUBST_FILE([ntp_wait_opts])
4469280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4470280849ScyAC_SUBST_FILE([ntpsweep_opts])
4471280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4472280849ScyAC_SUBST_FILE([ntptrace_opts])
4473280849Scysummary_opts="$srcdir/scripts/summary-opts"
4474280849ScyAC_SUBST_FILE([summary_opts])
4475280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4476280849ScyAC_SUBST_FILE([plot_summary_opts])
4477280849Scy
4478280849ScyAC_CONFIG_SUBDIRS([sntp])
4479280849Scy
4480181834SrobertoAC_OUTPUT
4481