configure.ac revision 285169
1280849Scydnl NTP top-level configure.ac				-*- Autoconf -*-
2280849Scydnl
3280849Scym4_include([sntp/m4/version.m4])
4280849ScyAC_PREREQ([2.61])
5280849ScyAC_INIT(
6280849Scy    [ntp],
7280849Scy    [VERSION_NUMBER],
8280849Scy    [http://bugs.ntp.org./],
9280849Scy    [],
10280849Scy    [http://www.ntp.org./]dnl
11280849Scy)
12280849ScyAC_CONFIG_MACRO_DIR([sntp/m4])
13280849ScyAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14280849Scy
15280849ScyAC_PRESERVE_HELP_ORDER
16280849Scy
17280849Scy# Bump ntp_configure_cache_version for each change to configure.ac or
18280849Scy# .m4 files which invalidates cached values from previous configure 
19280849Scy# runs.
20280849Scy#
21280849Scy# If the change affects cache variables used only by the main NTP
22280849Scy# configure.ac, then only its version number should be bumped, while
23280849Scy# the subdir configure.ac version numbers should be unchanged.  The
24280849Scy# same is true for a test/variable that is used only by one subdir
25280849Scy# being changed incompatibly; only that subdir's cache version needs
26280849Scy# bumping.
27280849Scy#
28280849Scy# If a change affects variables shared by all NTP configure scripts,
29280849Scy# please bump the version numbers of each.  If you are not sure, the
30280849Scy# safe choice is to bump all on any cache-invalidating change.
31280849Scy#
32280849Scy# In order to avoid the risk of version stamp collision between -stable
33280849Scy# and -dev branches, do not simply increment the version, instead use
34280849Scy# the date YYYYMMDD optionally with -HHMM if there is more than one
35280849Scy# bump in a day.
36280849Scy
37280849Scyntp_configure_cache_version=20120806
38280849Scy
39280849Scy# When the cache version of config.cache and configure do not
40280849Scy# match, NTP_CACHEVERSION will flush the cache.
41280849Scy
42280849ScyNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
43280849Scy
44280849ScyAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
45280849Scy
46280849Scydnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
47280849Scym4_ifdef(
48280849Scy    [AM_SILENT_RULES],
49280849Scy    [AM_SILENT_RULES([yes])]
50280849Scy)
51280849ScyAC_CANONICAL_BUILD
52181834SrobertoAC_CANONICAL_HOST
53181834Srobertodnl the 'build' machine is where we run configure and compile
54181834Srobertodnl the 'host' machine is where the resulting stuff runs.
55280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
56280849Scy    [canonical system (cpu-vendor-os) of where we should run])
57280849ScyAC_CONFIG_HEADERS([config.h])
58181834Srobertodnl AC_ARG_PROGRAM
59181834Sroberto
60280849Scyntp_atom_ok=${ntp_atom_ok=no}
61280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
62280849Scyntp_parse_ok=${ntp_parse_ok=no}
63280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
64280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
65181834Sroberto
66280849ScyNTP_PROG_CC
67280849ScyAC_PROG_CPP
68285169Scy# Do we need CXX for anything besides google test?
69280849ScyAC_PROG_CXX
70280849ScyAC_PROG_YACC
71280849ScyAC_PROG_CC_C_O
72282408ScyAX_C99_STRUCT_INIT
73181834Sroberto
74280849ScyNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
75181834Sroberto
76280849ScyNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
77280849Scy
78280849Scydnl AM_PROG_AR req. automake 1.12
79280849Scym4_ifdef(
80280849Scy    [AM_PROG_AR],
81280849Scy    [AM_PROG_AR]
82280849Scy)
83280849Scy
84200576Sroberto# So far, the only shared library we might use is libopts.
85200576Sroberto# It's a small library - we might as well use a static version of it.
86200576SrobertoAC_DISABLE_SHARED
87280849ScyAC_PROG_LIBTOOL
88280849ScyAC_SUBST([LIBTOOL_DEPS])
89200576Sroberto
90280849Scy# NTP has (so far) been relying on leading-edge autogen, which
91280849Scy# means we need the appropriate corresponding libopts as well.
92181834Sroberto# Therefore, by default:
93280849Scy# - use the version of libopts we ship with
94181834Sroberto# - do not install it
95181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
96181834Srobertocase "${enable_local_libopts+set}" in
97181834Sroberto set) ;;
98181834Sroberto *) enable_local_libopts=yes ;;
99181834Srobertoesac
100181834Srobertocase "${enable_libopts_install+set}" in
101181834Sroberto set) ;;
102181834Sroberto *) enable_libopts_install=no ;;
103181834Srobertoesac
104280849Scyenable_nls=no
105280849ScyLIBOPTS_CHECK_NOBUILD([sntp/libopts])
106181834Sroberto
107280849ScyNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
108181834Sroberto
109280849ScyNTP_LIBNTP
110181834Sroberto
111280849ScyAC_MSG_CHECKING([for deprecated --with-arlib])
112280849ScyAC_ARG_WITH([arlib],
113280849Scy	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
114181834Sroberto	[ans=$withval], [ans=no])
115200576SrobertoAC_MSG_RESULT([$ans])
116181834Sroberto
117181834Srobertocase "$ans" in
118181834Sroberto yes)
119280849Scy    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
120181834Sroberto    ;;
121181834Srobertoesac
122181834Sroberto
123181834Srobertodnl  we need to check for cross compile tools for vxWorks here
124181834SrobertoAC_PROG_AWK
125280849ScyAS_UNSET([ac_cv_prog_AWK])
126280849ScyAC_SUBST([AWK])				dnl scripts/ntpver.in
127181834SrobertoAC_PROG_MAKE_SET
128181834Sroberto
129280849ScyAC_SUBST([CFLAGS])
130280849ScyAC_SUBST([LDFLAGS])
131181834Sroberto
132280849ScyAC_PROG_LN_S
133280849ScyAC_ISC_POSIX
134181834Sroberto
135181834Sroberto
136280849ScyAC_PATH_PROG([PATH_PERL], [perl])
137280849Scydnl  Saving cached hardcoded paths rather than searching $PATH during a
138280849Scydnl  cached configure run is an optimization not worth the the cost of
139280849Scydnl  preventing newly-installed tools from being found.  Short-circuit
140280849Scydnl  the caching after the tests so preset overrides still work.
141280849ScyAS_UNSET([ac_cv_path_PATH_PERL])
142280849ScyAC_PATH_PROG([PATH_TEST], [test])
143280849ScyAS_UNSET([ac_cv_path_PATH_TEST])
144280849Scytest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
145280849ScyAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
146181834Sroberto
147280849ScyAC_ARG_WITH(
148280849Scy    [net-snmp-config],
149280849Scy    [AS_HELP_STRING(
150280849Scy	[--with-net-snmp-config],
151280849Scy	[+ =net-snmp-config]
152280849Scy    )],
153280849Scy    [ans=$withval],
154280849Scy    [ans=yes]
155280849Scy)
156280849Scycase "$ans" in
157280849Scy no)
158181834Sroberto    ;;
159280849Scy yes)
160280849Scy    ans=net-snmp-config
161181834Sroberto    ;;
162280849Scy /*)
163181834Sroberto    ;;
164280849Scy */*)
165280849Scy    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
166181834Sroberto    ;;
167280849Scy *)
168280849Scy    ;;
169181834Srobertoesac
170280849ScyPROG_NET_SNMP_CONFIG=$ans
171280849ScyAC_MSG_CHECKING([for net-snmp-config path])
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
182280849ScyAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
183181834Sroberto
184285169Scycase "$PATH_NET_SNMP_CONFIG" in
185285169Scy /*)	AC_CACHE_CHECK(
186285169Scy	    [for net-snmp version],
187285169Scy	    [ntp_cv_net_snmp_version],
188285169Scy	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
189285169Scy	)
190285169Scy	;;
191285169Scyesac
192285169Scy
193181834Srobertocase "$host" in
194181834Sroberto *-*-vxworks*)
195181834Sroberto    ac_link="$ac_link $VX_KERNEL"
196181834Sroberto    ;;
197181834Srobertoesac
198181834Sroberto
199280849Scy# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
200280849ScyAC_SEARCH_LIBS([openlog], [gen syslog])
201280849Scy# XXX library list will be in ac_cv_search_openlog
202181834Sroberto
203280849Scy# LIBSECCOMP is off by default -- needs testing with all the features
204280849Scy# Please send bug reports to loganaden@gmail.com
205280849ScyAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
206280849ScyAC_ARG_ENABLE(
207280849Scy    [libseccomp],
208280849Scy    [AS_HELP_STRING(
209280849Scy	[--enable-libseccomp],
210280849Scy	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
211280849Scy    )],
212280849Scy    [ntp_ok=$enableval],
213280849Scy    [ntp_ok=no]
214280849Scy)
215280849ScyAC_MSG_RESULT([$ntp_ok])
216280849Scycase "$ntp_ok" in
217280849Scy yes)
218280849Scy    AC_SEARCH_LIBS(
219280849Scy	[seccomp_init],
220280849Scy	[seccomp],
221280849Scy	[AC_DEFINE([LIBSECCOMP], [1],
222280849Scy	    [Define to any value to include libseccomp sandboxing.])]
223280849Scy    )
224280849Scy    AC_TRY_RUN([
225280849Scy	#include <stdio.h>
226280849Scy	#include <stdlib.h>
227280849Scy	#include <errno.h>
228280849Scy	#include <sys/prctl.h>
229280849Scy	#include <linux/seccomp.h>
230280849Scy
231280849Scy	int main(void)
232280849Scy	{
233280849Scy		int ret;
234280849Scy		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
235280849Scy		if (ret < 0) {
236280849Scy			switch (errno) {
237280849Scy			case ENOSYS:
238280849Scy				return 1;
239280849Scy			case EINVAL:
240280849Scy				return 1;
241280849Scy			default:
242280849Scy				return 1;
243280849Scy			}
244280849Scy		}
245280849Scy		ret = 
246280849Scy		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
247280849Scy		if (ret < 0) {
248280849Scy			switch (errno) {
249280849Scy			case EINVAL:
250280849Scy				return 1;
251280849Scy			case EFAULT:
252280849Scy				return 0;
253280849Scy			default:
254280849Scy				return 1;
255280849Scy		}
256280849Scy	}
257280849Scyreturn 1;
258280849Scy}
259280849Scy]
260280849Scy, AC_DEFINE([KERN_SECCOMP], 1, 
261280849Scy[Define to use libseccomp system call filtering.])   
262280849Scy, []
263280849Scy)
264181834Sroberto    ;;
265181834Srobertoesac
266181834Sroberto
267280849ScyNTP_FACILITYNAMES
268200576Sroberto
269181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
270181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
271181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
272181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
273181834Srobertodnl real-time library, so we don't want to use it.
274280849Scydnl
275280849Scydnl 081118 Harlan got tired of looking for a way to get the sched*()
276280849Scydnl functions to link OK with either cc or gcc.
277181834Sroberto
278181834Srobertocase "$host" in
279200576Sroberto *-*-*linux*) ;;
280280849Scy *-*-osf4*) ;;
281280849Scy *-*-osf5*) ;;
282181834Sroberto *)
283280849Scy    # HMS: Make sure we check for -lrt for clock_* before this...
284280849Scy    case "$ac_cv_search_clock_gettime" in
285280849Scy     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
286280849Scy    esac
287280849Scy    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
288181834Sroberto    ;;
289181834Srobertoesac
290181834Sroberto
291280849ScyAC_CHECK_HEADERS([bstring.h])
292280849ScyAC_CHECK_HEADER(
293280849Scy    [dns_sd.h],
294280849Scy    [AC_SEARCH_LIBS(
295280849Scy	[DNSServiceRegister],
296280849Scy	[dns_sd],
297280849Scy	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
298280849Scy	    [Use Rendezvous/DNS-SD registration])]
299280849Scy    )]
300280849Scy)
301280849ScyAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
302181834Sroberto
303280849ScyAC_CHECK_HEADERS([memory.h netdb.h poll.h])
304285169ScyAC_CHECK_HEADERS([sgtty.h stdatomic.h stdlib.h string.h termio.h])
305280849ScyAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
306181834Sroberto
307181834Srobertocase "$host" in
308181834Sroberto *-*-aix*)
309280849Scy    AC_CHECK_HEADERS([utmpx.h])
310181834Sroberto    case "$ac_cv_header_utmpx_h" in
311280849Scy     yes)
312280849Scy	;;
313280849Scy     *)
314280849Scy	AC_CHECK_HEADERS([utmp.h])
315280849Scy	;;
316181834Sroberto    esac
317181834Sroberto    ;;
318280849Scy *)
319280849Scy    AC_CHECK_HEADERS([utmp.h utmpx.h])
320280849Scy    ;;
321181834Srobertoesac
322280849Scy
323280849Scy#
324280849Scy# On Suns only (so far) getpass() truncates the typed password to 8
325280849Scy# characters, but getpassphrase() allows up to 257.  Most systems'
326280849Scy# getpass() does not truncate, at least not so as to affect ntpq and
327280849Scy# ntpdc password prompts.
328280849Scy#
329280849Scy# So check for getpassphrase(), but only on Sun operating systems.
330280849Scy#
331280849Scycase "$host" in
332280849Scy *-*-sunos*|*-*-solaris*)
333280849Scy    AC_CHECK_FUNCS([getpassphrase])
334280849Scyesac
335280849Scy
336280849Scy
337280849ScyAC_CHECK_HEADERS([net/if6.h])
338280849ScyAC_CHECK_HEADERS([net/route.h], [], [], [
339280849Scy    #include <sys/types.h>
340280849Scy    #include <sys/socket.h>
341280849Scy    #include <net/if.h>
342181834Sroberto])
343200576Sroberto
344280849ScyAC_CHECK_HEADERS([netinfo/ni.h])
345280849Scycase "$ac_cv_header_netinfo_ni_h" in
346200576Sroberto yes)
347280849Scy    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
348200576Srobertoesac
349280849ScyAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
350181834Srobertocase "$host" in
351280849Scy *-*-sunos4*)
352181834Sroberto    ;;
353280849Scy *)
354280849Scy    AC_CHECK_HEADERS([sys/ioctl.h])
355280849Scy    ;;
356181834Srobertoesac
357280849ScyAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
358181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
359280849ScyAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
360181834Srobertocase "$ac_cv_header_sched_h" in
361280849Scy yes)
362181834Sroberto    ;;
363280849Scy *)
364280849Scy    AC_CHECK_HEADERS([sys/sched.h])
365280849Scy    ;;
366181834Srobertoesac
367181834Sroberto# HMS: Check sys/shm.h after some others
368280849ScyAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
369181834Sroberto# HMS: Checked sys/socket.h earlier
370181834Srobertocase "$host" in
371280849Scy *-*-netbsd*)
372181834Sroberto    ;;
373280849Scy *)
374280849Scy    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
375280849Scy    ;;
376181834Srobertoesac
377280849ScyAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
378280849ScyAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
379181834Srobertocase "$host" in
380181834Sroberto*-convex-*)
381280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
382280849Scy    ;;
383181834Sroberto*-*-bsdi*)
384280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
385280849Scy    ;;
386181834Srobertoesac
387181834Sroberto
388285169Scycase "$ac_cv_header_stdatomic_h" in
389285169Scy yes)
390285169Scy	AC_CHECK_FUNCS([atomic_thread_fence])
391285169Scy	AC_CACHE_CHECK(
392285169Scy	    [for atomic_thread_fence()],
393285169Scy	    [ntp_cv_func_atomic_thread_fence],
394285169Scy	    [AC_COMPILE_IFELSE(
395285169Scy		[AC_LANG_PROGRAM(
396285169Scy		    [[
397285169Scy			#include <stdatomic.h>
398285169Scy		    ]],
399285169Scy		    [[
400285169Scy			atomic_thread_fence(memory_order_seq_cst);
401285169Scy		    ]]
402285169Scy		)]
403285169Scy		[ntp_cv_func_atomic_thread_fence=yes],
404285169Scy		[ntp_cv_func_atomic_thread_fence=no]
405285169Scy	    )]
406285169Scy	)
407285169Scy    ;;
408285169Scyesac
409285169Scy
410181834Srobertocase "$host" in
411280849Scy *-*-solaris2.6)
412280849Scy    # Broken...
413181834Sroberto    ;;
414181834Sroberto *)
415280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
416181834Sroberto    ;;
417181834Srobertoesac
418181834Sroberto
419280849Scycase "$host" in
420280849Scy *-*-*linux*)
421280849Scy    case "$ac_cv_func_ntp_gettime" in
422280849Scy     yes)
423280849Scy	;;
424280849Scy     *)
425280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
426280849Scy	case "$ac_cv_func___ntp_gettime" in
427280849Scy	 yes)
428280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
429280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
430280849Scy	esac
431280849Scy	;;
432280849Scy    esac
433280849Scy    AC_CHECK_FUNCS([adjtimex])
434280849Scy    case "$ac_cv_func_adjtimex" in
435280849Scy     yes)
436280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
437280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
438280849Scy	have_adjtimex=1
439280849Scy	;;
440280849Scy     *)
441280849Scy	AC_CHECK_FUNCS([__adjtimex])
442280849Scy	case "$ac_cv_func___adjtimex" in
443280849Scy	 yes)
444280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
445280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
446280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
447280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
448280849Scy	    have_adjtimex=1
449280849Scy	esac
450280849Scy	;;
451280849Scy    esac
452280849Scyesac
453280849Scycase "$have_adjtimex" in
454280849Scy '')
455280849Scy    # nlist stuff is only needed for tickadj.
456280849Scy    saved_LIBS="$LIBS"
457280849Scy    LIBS=
458280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
459280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
460280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
461280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
462280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
463280849Scy    case "$ac_cv_header_nlist_h" in
464280849Scy     yes)
465280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
466280849Scy	AC_CACHE_CHECK(
467280849Scy	    [for n_un in struct nlist],
468280849Scy	    [ntp_cv_struct_nlist_n_un],
469280849Scy	    [AC_COMPILE_IFELSE(
470280849Scy		[AC_LANG_PROGRAM(
471280849Scy		    [[
472280849Scy			#include <nlist.h>
473280849Scy		    ]],
474280849Scy		    [[
475280849Scy			struct nlist n;
476280849Scy			n.n_un.n_name = 0;
477280849Scy		    ]]
478280849Scy		)]
479280849Scy		[ntp_cv_struct_nlist_n_un=yes],
480280849Scy		[ntp_cv_struct_nlist_n_un=no]
481280849Scy	    )]
482280849Scy	)
483280849Scy	case "$ntp_cv_struct_nlist_n_un" in
484280849Scy	 yes)
485280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
486280849Scy		[does struct nlist use a name union?])
487280849Scy	esac
488280849Scy    esac
489280849Scy    AC_SUBST([LDADD_NLIST])
490280849Scy    LDADD_NLIST="$LIBS"
491280849Scy    LIBS="$saved_LIBS"
492280849Scy    AS_UNSET([saved_LIBS])
493280849Scyesac
494181834Sroberto
495280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
496280849Scy    #ifdef HAVE_SYS_TYPES_H
497280849Scy    # include <sys/types.h>
498280849Scy    #endif
499280849Scy    #ifdef HAVE_SYS_TIME_H
500280849Scy    # include <sys/time.h>
501280849Scy    #endif
502181834Sroberto])
503181834Sroberto
504280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
505280849Scy    #ifdef HAVE_SYS_TIME_H
506280849Scy    # include <sys/time.h>
507280849Scy    #endif
508181834Sroberto])
509181834Sroberto
510280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
511280849Scy    #ifdef HAVE_SYS_TYPES_H
512280849Scy    # include <sys/types.h>
513280849Scy    #endif
514280849Scy    #ifdef HAVE_SYS_IPC_H
515280849Scy    # include <sys/ipc.h>
516280849Scy    #endif
517181834Sroberto])
518181834Sroberto
519280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
520280849Scy    #ifdef HAVE_SYS_TIME_H
521280849Scy    # include <sys/time.h>
522280849Scy    #endif
523181834Sroberto])
524181834Sroberto
525181834SrobertoAC_TYPE_SIGNAL
526181834SrobertoAC_TYPE_OFF_T
527280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
528181834Sroberto
529280849ScyAC_CACHE_CHECK(
530280849Scy    [for a fallback value for HZ],
531280849Scy    [ntp_cv_default_hz],
532280849Scy    [
533280849Scy	ntp_cv_default_hz=100
534280849Scy	case "$host" in
535280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
536280849Scy	    ntp_cv_default_hz=1024
537280849Scy	    ;;
538280849Scy	 mips-dec-ultrix4*)
539280849Scy	    ntp_cv_default_hz=256
540280849Scy	    ;;
541280849Scy	esac
542280849Scy    ]
543280849Scy)
544280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
545280849Scy    [What is the fallback value for HZ?])
546181834Sroberto
547280849ScyAC_CACHE_CHECK(
548280849Scy    [if we need to override the system's value for HZ],
549280849Scy    [ntp_cv_override_hz],
550280849Scy    [
551280849Scy	ntp_cv_override_hz=no
552280849Scy	case "$host" in
553280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
554280849Scy	    ntp_cv_override_hz=yes
555280849Scy	    ;;
556280849Scy	 mips-dec-ultrix4*)
557280849Scy	    ntp_cv_override_hz=yes
558280849Scy	    ;;
559280849Scy	 *-*-freebsd*)
560280849Scy	    ntp_cv_override_hz=yes
561280849Scy	    ;;
562280849Scy	 *-*-sunos4*)
563280849Scy	    ntp_cv_override_hz=yes
564280849Scy	    ;;
565280849Scy	 *-*-kfreebsd*)
566280849Scy	    ntp_cv_override_hz=yes
567280849Scy	    ;;
568280849Scy	esac
569280849Scy    ]
570280849Scy)
571280849Scycase "$ntp_cv_override_hz" in
572181834Sroberto yes)
573280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
574280849Scy	[Do we need to override the system's idea of HZ?])
575181834Srobertoesac
576181834Sroberto
577181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
578181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
579181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
580181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
581181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
582181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
583181834Srobertodnl fi
584181834Sroberto
585181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
586181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
587181834Srobertodnl [AC_EGREP_CPP(yes,
588181834Srobertodnl [#ifdef HAVE_UTMPX_H
589181834Srobertodnl #include <utmpx.h>
590181834Srobertodnl #else
591181834Srobertodnl #include <utmp.h>
592181834Srobertodnl #endif
593181834Srobertodnl #ifdef BOOT_TIME
594181834Srobertodnl yes
595181834Srobertodnl #endif
596181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
597181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
598181834Sroberto
599280849ScyAC_CACHE_CHECK(
600280849Scy    [for struct rt_msghdr],
601280849Scy    [ntp_cv_struct_rt_msghdr],
602280849Scy    [AC_COMPILE_IFELSE(
603280849Scy	[AC_LANG_PROGRAM(
604280849Scy	    [[
605280849Scy		#include <sys/types.h>
606280849Scy		#include <sys/socket.h>
607280849Scy		#include <net/if.h>
608280849Scy		#include <net/route.h>
609280849Scy	    ]],
610280849Scy	    [[
611280849Scy		struct rt_msghdr p;
612280849Scy	    ]]
613280849Scy	)],
614280849Scy	[ntp_cv_struct_rt_msghdr=yes],
615280849Scy	[ntp_cv_struct_rt_msghdr=no]
616280849Scy    )]
617280849Scy)
618200576Sroberto
619181834SrobertoAC_CACHE_CHECK(
620280849Scy    [for struct rtattr],
621280849Scy    [ntp_cv_rtattr],
622280849Scy    [AC_COMPILE_IFELSE(
623280849Scy	[AC_LANG_PROGRAM(
624280849Scy	    [[
625280849Scy		#include <stddef.h>
626280849Scy		#include <sys/socket.h>
627280849Scy		#include <linux/rtnetlink.h>
628280849Scy	    ]],
629280849Scy	    [[
630280849Scy		struct rtattr p;
631280849Scy	    ]]
632280849Scy	)],
633280849Scy	[ntp_cv_rtattr=yes],
634280849Scy	[ntp_cv_rtattr=no]
635280849Scy    )]
636181834Sroberto)
637181834Sroberto
638280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
639280849Scy *yes*)
640280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
641280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
642280849Scy    case "$ntp_cv_rtattr" in
643280849Scy     yes)
644280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
645280849Scy	    [Do we have Linux routing socket?])
646181834Sroberto    esac
647280849Scyesac
648181834Sroberto
649280849ScyAC_CACHE_CHECK(
650280849Scy    [struct sigaction for sa_sigaction],
651280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
652280849Scy    [AC_COMPILE_IFELSE(
653280849Scy	[AC_LANG_PROGRAM(
654280849Scy	    [[
655280849Scy		#include <signal.h>
656280849Scy	    ]],
657280849Scy	    [[
658280849Scy		struct sigaction act;
659280849Scy		act.sa_sigaction = 0;
660280849Scy	    ]]
661280849Scy	)],
662280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
663280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
664280849Scy    )]
665280849Scy)
666280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
667280849Scy yes)
668280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
669280849Scyesac
670181834Sroberto
671280849ScyAC_CACHE_CHECK(
672280849Scy    [for struct ppsclockev],
673280849Scy    [ntp_cv_struct_ppsclockev],
674280849Scy    [AC_COMPILE_IFELSE(
675280849Scy	[AC_LANG_PROGRAM(
676280849Scy	    [[
677280849Scy		#ifdef HAVE_SYS_TYPES_H
678280849Scy		# include <sys/types.h>
679280849Scy		#endif
680280849Scy		#ifdef HAVE_SYS_TERMIOS_H
681280849Scy		# include <sys/termios.h>
682280849Scy		#endif
683280849Scy		#ifdef HAVE_SYS_TIME_H
684280849Scy		# include <sys/time.h>
685280849Scy		#endif
686280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
687280849Scy		# include <sys/ppsclock.h>
688280849Scy		#endif
689280849Scy	    ]],
690280849Scy	    [[
691280849Scy		extern struct ppsclockev *pce;
692280849Scy		return pce->serial;
693280849Scy	    ]]
694280849Scy	)],
695280849Scy	[ntp_cv_struct_ppsclockev=yes],
696280849Scy	[ntp_cv_struct_ppsclockev=no]
697280849Scy    )]
698280849Scy)
699280849Scycase "$ntp_cv_struct_ppsclockev" in
700280849Scy yes)
701280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
702280849Scy	[Does a system header define struct ppsclockev?])
703280849Scyesac
704181834Sroberto
705181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
706181834Sroberto  *yes*)
707280849Scy    AC_CACHE_CHECK(
708280849Scy	[for struct snd_size],
709280849Scy	[ntp_cv_struct_snd_size],
710280849Scy	[AC_COMPILE_IFELSE(
711280849Scy	    [AC_LANG_PROGRAM(
712280849Scy		[[
713280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
714280849Scy		    # include <machine/soundcard.h>
715280849Scy		    #endif
716280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
717280849Scy		    # include <sys/soundcard.h>
718280849Scy		    #endif
719280849Scy		]],
720280849Scy		[[
721280849Scy		    extern struct snd_size *ss;
722280849Scy		    return ss->rec_size;
723280849Scy		]]
724280849Scy	    )],
725280849Scy	    [ntp_cv_struct_snd_size=yes],
726280849Scy	    [ntp_cv_struct_snd_size=no]
727280849Scy        )]
728280849Scy    )
729280849Scy    case "$ntp_cv_struct_snd_size" in
730280849Scy     yes)
731280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
732280849Scy	    [Do we have struct snd_size?])
733181834Sroberto    esac
734181834Srobertoesac
735181834Sroberto
736280849ScyAC_CACHE_CHECK(
737280849Scy    [struct clockinfo for hz],
738280849Scy    [ntp_cv_struct_clockinfo_has_hz],
739280849Scy    [AC_COMPILE_IFELSE(
740280849Scy	[AC_LANG_PROGRAM(
741280849Scy	    [[
742280849Scy		#include <sys/time.h>
743280849Scy	    ]],
744280849Scy	    [[
745280849Scy		extern struct clockinfo *pc;
746280849Scy		return pc->hz;
747280849Scy	    ]]
748280849Scy	)],
749280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
750280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
751280849Scy    )]
752280849Scy)
753280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
754280849Scy yes)
755280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
756280849Scyesac
757181834Sroberto
758280849ScyAC_CACHE_CHECK(
759280849Scy    [struct clockinfo for tickadj],
760280849Scy    [ntp_cv_struct_clockinfo_has_hz],
761280849Scy    [AC_COMPILE_IFELSE(
762280849Scy	[AC_LANG_PROGRAM(
763280849Scy	    [[
764280849Scy		#include <sys/time.h>
765280849Scy	    ]],
766280849Scy	    [[
767280849Scy		extern struct clockinfo *pc;
768280849Scy		return pc->tickadj;
769280849Scy	    ]]
770280849Scy	)],
771280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
772280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
773280849Scy    )]
774280849Scy)
775280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
776280849Scy yes)
777280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
778280849Scyesac
779181834Sroberto
780280849Scycase "$ntp_cv_struct_ntptimeval" in
781280849Scy yes)
782280849Scy    AC_CHECK_MEMBERS(
783280849Scy	[struct ntptimeval.time.tv_nsec],
784280849Scy	[],
785280849Scy	[],
786280849Scy	[
787280849Scy	    #ifdef HAVE_SYS_TIME_H
788280849Scy	    # include <sys/time.h>
789280849Scy	    #else
790280849Scy	    # ifdef HAVE_TIME_H
791280849Scy	    #  include <time.h>
792280849Scy	    # endif
793280849Scy	    #endif
794280849Scy	    #ifdef HAVE_SYS_TIMEX_H
795280849Scy	    # include <sys/timex.h>
796280849Scy	    #else
797280849Scy	    # ifdef HAVE_TIMEX_H
798280849Scy	    #  include <timex.h>
799280849Scy	    # endif
800280849Scy	    #endif
801280849Scy	]
802280849Scy    )
803200576Srobertoesac
804200576Sroberto
805280849Scy#### 
806181834Sroberto
807280849ScyAC_CHECK_FUNCS([arc4random_buf])
808181834Sroberto
809280849Scy#### 
810181834Sroberto
811280849Scysaved_LIBS="$LIBS"
812280849ScyLIBS="$LIBS $LDADD_LIBNTP"
813280849ScyAC_CHECK_FUNCS([daemon])
814280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
815280849ScyLIBS="$saved_LIBS"
816280849ScyAS_UNSET([saved_LIBS])
817181834Sroberto
818280849ScyAC_CHECK_FUNCS(
819280849Scy    [finite],
820280849Scy    [],
821280849Scy    [AC_CHECK_FUNCS(
822280849Scy	[isfinite],
823280849Scy	[],
824280849Scy	[
825280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
826280849Scy	    _libs=$LIBS
827280849Scy	    # XXX
828280849Scy	    LIBS="$LIBS -lm"
829280849Scy	    AC_LINK_IFELSE(
830280849Scy		[AC_LANG_PROGRAM(
831280849Scy		    [[
832280849Scy			#include <math.h>
833280849Scy		    ]],
834280849Scy		    [[
835280849Scy			float f = 0.0;
836280849Scy			isfinite(f);
837280849Scy		    ]]
838280849Scy		)],
839280849Scy		[ans=yes],
840280849Scy		[ans=no]
841280849Scy	    )
842280849Scy	    LIBS=$_libs
843280849Scy	    AC_MSG_RESULT([$ans])
844280849Scy	    case "$ans" in
845280849Scy	     yes)
846280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
847280849Scy	    esac
848280849Scy	]
849280849Scy    )]
850280849Scy)
851181834Sroberto
852280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
853181834Sroberto
854280849Scy# kvm_open() is only used by tickadj.  Also see above.
855280849Scycase "$ac_cv_header_kvm_h" in
856280849Scy yes)
857280849Scy    AC_CHECK_FUNCS([kvm_open])
858181834Sroberto    ;;
859181834Srobertoesac
860181834Sroberto
861181834Srobertocase "$host" in
862181834Sroberto *-*-sco3.2v5.0.*)
863280849Scy    # Just stubs.  Sigh.
864181834Sroberto    ;;
865280849Scy *) AC_CHECK_FUNCS([mkstemp])
866181834Sroberto    ;;
867181834Srobertoesac
868280849ScyAC_CHECK_FUNCS([mktime])
869181834Srobertocase "$host" in
870280849Scy *-*-aix[[4-9]]*)
871280849Scy    # XXX only verified thru AIX6.
872280849Scy    # Just a stub.  Sigh.
873181834Sroberto    ;;
874181834Sroberto *-*-irix[[45]]*)
875280849Scy    # Just a stub in "old" Irix.  Sigh.
876181834Sroberto    ;;
877280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
878280849Scy# *-*-*linux*)
879280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
880280849Scy#    ;;
881181834Sroberto *-*-qnx*)
882280849Scy    # Apparently there but not working in QNX.  Sigh?
883181834Sroberto    ;;
884181834Sroberto *-*-sco3.2v5.0.*)
885280849Scy    # Just a stub.  Sigh.
886181834Sroberto    ;;
887181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
888181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
889181834Sroberto    # Not easy to test for - cheat.
890280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
891280849Scy    AC_CHECK_FUNCS([mlockall])
892181834Sroberto    ;;
893280849Scy *) AC_CHECK_FUNCS([mlockall])
894181834Sroberto    ;;
895181834Srobertoesac
896280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
897181834Srobertocase "$host" in
898280849Scy *-*-aix[[4-9]]*)
899280849Scy    # XXX only verified thru AIX6.
900280849Scy    # Just a stub in AIX 4.  Sigh.
901181834Sroberto    ;;
902181834Sroberto *-*-solaris2.5*)
903280849Scy    # Just stubs in solaris2.5.  Sigh.
904181834Sroberto    ;;
905280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
906181834Sroberto    ;;
907181834Srobertoesac
908280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
909280849ScyAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
910181834Srobertocase "$host" in
911280849Scy *-*-aix[[4-9]]*)
912280849Scy    # XXX only verified thru AIX6.
913280849Scy    # Just stubs.  Sigh.
914181834Sroberto    ;;
915181834Sroberto *-*-netbsd1*)
916280849Scy    # Just stubs.  Sigh.
917181834Sroberto    ;;
918181834Sroberto *-*-netbsdelf1*)
919280849Scy    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-openbsd*)
922280849Scy    # Just stubs.  Sigh.
923181834Sroberto    ;;
924280849Scy *)
925280849Scy    AC_CHECK_FUNCS([timer_create])
926181834Sroberto    ;;
927181834Srobertoesac
928181834Sroberto
929280849ScyNTP_RLIMIT_ITEMS
930181834Sroberto
931280849Scy# HMS: Only if we are doing the MLOCKALL stuff...
932280849ScyAC_MSG_CHECKING([for the default number of 4k stack pages])
933280849ScyAC_ARG_WITH(
934280849Scy    [stack-limit],
935280849Scy    [AS_HELP_STRING(
936280849Scy	[--with-stack-limit],
937280849Scy	[? =50 (200 for openbsd) 4k pages]
938280849Scy    )],
939280849Scy    [ans=$withval],
940280849Scy    [ans=yes]
941280849Scy)
942280849Scycase "$ans" in
943280849Scy yes | no)
944280849Scy    case "$host" in
945280849Scy     *-*-openbsd*)
946280849Scy	ans=200
947181834Sroberto	;;
948280849Scy     *) ans=50
949280849Scy        ;;
950181834Sroberto    esac
951181834Sroberto    ;;
952280849Scy [[1-9]][[0-9]]*)
953280849Scy    ;;
954280849Scy *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
955280849Scy    ;;
956181834Srobertoesac
957280849ScyAC_MSG_RESULT([$ans])
958280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
959280849Scy    [Default number of 4k pages for RLIMIT_STACK])
960181834Sroberto
961280849Scy# HMS: only if we have RLIMIT_MEMLOCK
962280849ScyAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
963280849ScyAC_ARG_WITH(
964280849Scy    [memlock],
965280849Scy    [AS_HELP_STRING(
966280849Scy	[--with-memlock],
967280849Scy	[? =32 (megabytes)]
968280849Scy    )],
969280849Scy    [ans=$withval],
970280849Scy    [ans=yes]
971280849Scy)
972280849Scycase "$ans" in
973280849Scy yes | no)
974280849Scy    ans=32
975181834Sroberto    ;;
976280849Scy [[1-9]][[0-9]]*) ;;
977280849Scy *) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
978280849Scy     ;;
979181834Srobertoesac
980280849ScyAC_MSG_RESULT([$ans])
981280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
982280849Scy    [Default number of megabytes for RLIMIT_MEMLOCK])
983181834Sroberto
984181834Sroberto
985280849Scy# some OSes prefer _exit() in forked children to exit()
986280849ScyAC_CHECK_FUNCS([_exit])
987280849Scyntp_worker_child_exit=exit
988280849Scycase "$ac_cv_func__exit::$host_os" in
989280849Scy yes::netbsd*)
990280849Scy    ntp_worker_child_exit=_exit
991280849Scy    ;;
992280849Scy yes::openbsd*)
993280849Scy    ntp_worker_child_exit=_exit
994280849Scy    ;;
995280849Scyesac
996280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
997280849Scy		   [routine worker child proc uses to exit.])
998181834Sroberto
999280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
1000181834Sroberto
1001280849Scy###
1002181834Sroberto
1003280849Scy# http://bugs.ntp.org/737
1004280849Scycase "$ac_cv_func_recvmsg" in
1005280849Scy yes)
1006280849Scy    AC_CACHE_CHECK(
1007280849Scy	[if we need extra help to define struct iovec],
1008280849Scy	[ntp_cv_struct_iovec_help],
1009280849Scy	[
1010280849Scy	    compiled=no
1011280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
1012280849Scy		AC_COMPILE_IFELSE(
1013280849Scy		    [AC_LANG_PROGRAM(
1014280849Scy			[[
1015280849Scy			    #ifdef HAVE_SYS_TYPES_H
1016280849Scy			    # include <sys/types.h>
1017280849Scy			    #endif
1018280849Scy			    #ifdef HAVE_SYS_SOCKET_H
1019280849Scy			    # include <sys/socket.h>
1020280849Scy			    #endif
1021280849Scy			    #if $ntp_cv_struct_iovec_help
1022280849Scy			    # include <sys/uio.h>
1023280849Scy			    #endif
1024280849Scy			]],
1025280849Scy			[[
1026280849Scy			    void foo(void) {
1027280849Scy				ssize_t x;
1028280849Scy				int s = 0;
1029280849Scy				struct iovec iov;
1030280849Scy				struct msghdr mh;
1031280849Scy				int flags = 0;
1032181834Sroberto
1033280849Scy				mh.msg_iov = &iov;
1034280849Scy				x = recvmsg(s, &mh, flags);
1035280849Scy			    }
1036280849Scy			]]
1037280849Scy		    )],
1038280849Scy		    [compiled=yes ; break 1],
1039280849Scy		    []
1040280849Scy		)
1041280849Scy	    done
1042280849Scy	    case "$compiled" in
1043280849Scy	     no)
1044280849Scy		ntp_cv_struct_iovec_help=0
1045280849Scy	    esac
1046280849Scy	    AS_UNSET([compiled])
1047280849Scy	]
1048280849Scy    )
1049280849Scy    case "$ntp_cv_struct_iovec_help" in
1050280849Scy     1)
1051280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1052280849Scy	    [Use sys/uio.h for struct iovec help])
1053280849Scy    esac
1054181834Srobertoesac
1055181834Sroberto
1056280849ScyAC_CACHE_CHECK(
1057280849Scy    [number of arguments taken by setpgrp()],
1058280849Scy    [ntp_cv_func_setpgrp_nargs],
1059280849Scy    [AC_COMPILE_IFELSE(
1060280849Scy	[AC_LANG_PROGRAM(
1061280849Scy	    [[
1062280849Scy		#ifdef HAVE_SYS_TYPES_H
1063280849Scy		# include <sys/types.h>
1064280849Scy		#endif
1065280849Scy		#ifdef HAVE_UNISTD_H
1066280849Scy		# include <unistd.h>
1067280849Scy		#endif
1068280849Scy	    ]],
1069280849Scy	    [[
1070280849Scy		setpgrp(0, 0);
1071280849Scy	    ]]
1072280849Scy	)],
1073280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1074280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1075280849Scy    )]
1076280849Scy)
1077280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1078280849Scy 0)
1079280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1080280849Scy	      [define if setpgrp takes 0 arguments])
1081280849Scyesac
1082181834Sroberto
1083280849ScyAC_CACHE_CHECK(
1084280849Scy    [if we need to declare 'errno'],
1085280849Scy    [ntp_cv_decl_errno],
1086280849Scy    [AC_COMPILE_IFELSE(
1087280849Scy	[AC_LANG_PROGRAM(
1088280849Scy	    [[
1089280849Scy		#ifdef HAVE_ERRNO_H
1090280849Scy		# include <errno.h>
1091280849Scy		#endif
1092280849Scy	    ]],
1093280849Scy	    [[
1094280849Scy		errno = 0;
1095280849Scy	    ]]
1096280849Scy	)],
1097280849Scy	[ntp_cv_decl_errno=no],
1098280849Scy	[ntp_cv_decl_errno=yes]
1099280849Scy    )]
1100280849Scy)
1101280849Scycase "$ntp_cv_decl_errno" in
1102280849Scy yes)
1103280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1104181834Srobertoesac
1105181834Sroberto
1106181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1107181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1108181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1109181834Srobertodnl without breaking any other platforms.
1110181834Srobertodnl
1111280849ScyAC_CACHE_CHECK(
1112280849Scy    [if we may declare 'h_errno'],
1113280849Scy    [ntp_cv_decl_h_errno],
1114280849Scy    [AC_COMPILE_IFELSE(
1115280849Scy	[AC_LANG_PROGRAM(
1116280849Scy	    [[
1117280849Scy		#include <sys/types.h>
1118280849Scy		#ifdef HAVE_NETINET_IN_H
1119280849Scy		# include <netinet/in.h>
1120280849Scy		#endif
1121280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1122280849Scy		# include <arpa/nameser.h>
1123280849Scy		#endif
1124280849Scy		#ifdef HAVE_NETDB_H
1125280849Scy		# include <netdb.h>
1126280849Scy		#endif
1127280849Scy		#ifdef HAVE_RESOLV_H
1128280849Scy		# include <resolv.h>
1129280849Scy		#endif
1130280849Scy	    ]],
1131280849Scy	    [[
1132280849Scy		extern int h_errno;
1133280849Scy	    ]]
1134280849Scy	)],
1135280849Scy	[ntp_cv_decl_h_errno=yes],
1136280849Scy	[ntp_cv_decl_h_errno=no]
1137280849Scy    )]
1138280849Scy)
1139280849Scycase "$ntp_cv_decl_h_errno" in
1140280849Scy yes)
1141280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1142181834Srobertoesac
1143181834Sroberto
1144280849ScyAC_CACHE_CHECK(
1145280849Scy    [if declaring 'syscall()' is ok],
1146280849Scy    [ntp_cv_decl_syscall],
1147280849Scy    [AC_COMPILE_IFELSE(
1148280849Scy	[AC_LANG_PROGRAM(
1149280849Scy	    [[
1150280849Scy		#ifdef HAVE_SYS_TYPES_H
1151280849Scy		# include <sys/types.h>
1152280849Scy		#endif
1153280849Scy		#ifdef HAVE_UNISTD_H
1154280849Scy		# include <unistd.h>
1155280849Scy		#endif
1156280849Scy	    ]],
1157280849Scy	    [[
1158280849Scy		extern int syscall (int, ...);
1159280849Scy	    ]]
1160280849Scy	)]
1161280849Scy	[ntp_cv_decl_syscall=yes],
1162280849Scy	[ntp_cv_decl_syscall=no]
1163280849Scy    )]
1164280849Scy)
1165280849Scycase "$ntp_cv_decl_syscall" in
1166280849Scy yes)
1167280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1168181834Srobertoesac
1169181834Sroberto
1170181834Srobertocase "$host" in
1171181834Sroberto *-*-aix4.3.*)
1172280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1173181834Sroberto    ;;
1174181834Sroberto *-*-mpeix*)
1175280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1176280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1177280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1178280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1179280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1180280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1181280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1182181834Sroberto    ;;
1183181834Sroberto *-*-osf[[45]]*)
1184280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1185280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1186181834Sroberto    ;;
1187181834Sroberto *-*-qnx*)
1188280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1189181834Sroberto    ;;
1190181834Sroberto *-*-riscos4*)
1191280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1192280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1193280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1194280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1195280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1196280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1197280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1198280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1199280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1200280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1201280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1202280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1203280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1204280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1207181834Sroberto    ;;
1208181834Sroberto *-*-solaris2*)
1209280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1210280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1211181834Sroberto    case "$host" in
1212181834Sroberto     *-*-solaris2.4)
1213280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1214181834Sroberto	;;
1215181834Sroberto    esac
1216181834Sroberto    ;;
1217181834Sroberto *-*-sunos4*)
1218280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1219280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1220280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1221280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1222280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1223280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1224280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1225280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1226280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1227280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1228280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1229280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1230280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1231181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1232181834Sroberto     acc*) ;;
1233280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1234181834Sroberto	;;
1235181834Sroberto    esac
1236280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1237280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1238280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1239280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1240280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1241280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1242280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1243181834Sroberto    ;;
1244181834Sroberto *-*-ultrix4*)
1245280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1246280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1247280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1248280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1249280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1250280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1251280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1252280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1253280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1254280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1255280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1256280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1257280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1258280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1259181834Sroberto    ;;
1260181834Srobertoesac
1261181834Sroberto
1262181834Srobertocase "$host" in
1263181834Sroberto *-*-sco3.2*)
1264280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1265280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1266181834Sroberto    ;;
1267181834Srobertoesac
1268181834Sroberto
1269181834Srobertocase "$host" in
1270181834Sroberto *-*-hpux[[567]]*)
1271280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1272280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1273181834Srobertoesac
1274181834Sroberto
1275280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1276280849ScyAC_CACHE_CHECK(
1277280849Scy    [if we will open the broadcast socket],
1278280849Scy    [ntp_cv_var_open_bcast_socket],
1279280849Scy    [
1280280849Scy	ans=yes
1281280849Scy	case "$host" in
1282280849Scy	 *-*-domainos)
1283280849Scy	    ans=no
1284280849Scy	esac
1285280849Scy	ntp_cv_var_open_bcast_socket=$ans
1286280849Scy    ]
1287280849Scy)
1288280849Scycase "$ntp_cv_var_open_bcast_socket" in
1289280849Scy yes)
1290280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1291280849Scy	[Should we open the broadcast socket?])
1292181834Srobertoesac
1293181834Sroberto
1294181834Srobertocase "$host" in
1295181834Sroberto *-*-hpux*)
1296280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1297280849Scy	[Do we want the HPUX FindConfig()?])
1298181834Srobertoesac
1299181834Sroberto
1300280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1301280849ScyAC_CACHE_CHECK(
1302280849Scy    [if process groups are set with -pid],
1303280849Scy    [ntp_cv_arg_setpgrp_negpid],
1304280849Scy    [
1305280849Scy	case "$host" in
1306280849Scy	 *-*-hpux[[567]]*)
1307280849Scy	    ans=no
1308280849Scy	    ;;
1309280849Scy	 *-*-hpux*)
1310280849Scy	    ans=yes
1311280849Scy	    ;;
1312280849Scy	 *-*-*linux*)
1313280849Scy	    ans=yes
1314280849Scy	    ;;
1315280849Scy	 *-*-sunos3*)
1316280849Scy	    ans=yes
1317280849Scy	    ;;
1318280849Scy	 *-*-ultrix2*)
1319280849Scy	    ans=yes
1320280849Scy	    ;;
1321280849Scy	 *)
1322280849Scy	    ans=no
1323280849Scy	    ;;
1324280849Scy	esac
1325280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1326280849Scy    ]
1327280849Scy)
1328280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1329181834Sroberto yes)
1330280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1331280849Scy	[Do we set process groups with -pid?])
1332181834Srobertoesac
1333181834Sroberto
1334280849ScyAC_CACHE_CHECK(
1335280849Scy    [if we need a ctty for F_SETOWN],
1336280849Scy    [ntp_cv_func_ctty_for_f_setown],
1337280849Scy    [
1338280849Scy	case "$host" in
1339280849Scy	 *-*-bsdi[[23]]*)
1340280849Scy	    ans=yes
1341280849Scy	    ;;
1342280849Scy	 *-*-freebsd*)
1343280849Scy	    ans=yes
1344280849Scy	    ;;
1345280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1346280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1347280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1348280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1349280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1350280849Scy	    ans=yes
1351280849Scy	    ;;
1352280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1353280849Scy	    ans=yes
1354280849Scy	    ;;
1355280849Scy	 *-*-openbsd*)
1356280849Scy	    ans=yes
1357280849Scy	    ;;
1358280849Scy	 *-*-osf*)
1359280849Scy	    ans=yes
1360280849Scy	    ;;
1361280849Scy	 *-*-darwin*)
1362280849Scy	    ans=yes
1363280849Scy	    ;;
1364280849Scy	 *)
1365280849Scy	    ans=no
1366280849Scy	    ;;
1367280849Scy	esac
1368280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1369280849Scy    ]
1370280849Scy)
1371280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1372181834Sroberto yes)
1373280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1374181834Srobertoesac
1375181834Sroberto
1376280849ScyAC_CACHE_CHECK(
1377280849Scy    [if the OS clears cached routes when more specifics become available],
1378280849Scy    [ntp_cv_os_routeupdates],
1379280849Scy    [
1380280849Scy	case "$host" in
1381280849Scy	 *-*-netbsd*)
1382280849Scy	    ans=yes
1383280849Scy	    ;;
1384280849Scy	 *)
1385280849Scy	    ans=no
1386280849Scy	    ;;
1387280849Scy	esac
1388280849Scy	ntp_cv_os_routeupdates=$ans
1389280849Scy    ]
1390280849Scy)
1391280849Scycase "$ntp_cv_os_routeupdates" in
1392181834Sroberto yes)
1393280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1394280849Scy	[need to recreate sockets on changed routing?])
1395181834Srobertoesac
1396181834Sroberto
1397280849ScyAC_CACHE_CHECK(
1398280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1399280849Scy    [ntp_cv_os_wildcardreuse],
1400280849Scy    [
1401280849Scy	case "$host" in
1402280849Scy	 *-*-*linux*)
1403280849Scy	    ans=yes
1404280849Scy	    ;;
1405280849Scy	 *) ans=no
1406280849Scy	    ;;
1407280849Scy	esac
1408280849Scy	ntp_cv_os_wildcardreuse=$ans
1409280849Scy    ]
1410280849Scy)
1411280849Scycase "$ntp_cv_os_wildcardreuse" in
1412181834Sroberto yes)
1413280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1414280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1415181834Srobertoesac
1416181834Sroberto
1417181834Srobertocase "$host" in
1418181834Sroberto *-*-aix*)
1419280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1420280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1421181834Srobertoesac
1422181834Sroberto
1423280849ScyAC_CACHE_CHECK(
1424280849Scy    [for a minimum recommended value of tickadj],
1425280849Scy    [ntp_cv_var_min_rec_tickadj],
1426280849Scy    [
1427280849Scy	ans=no
1428280849Scy	case "$host" in
1429280849Scy	 *-*-aix*)
1430280849Scy	    ans=40
1431280849Scy	    ;;
1432280849Scy	esac
1433280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1434280849Scy    ]
1435280849Scy)
1436280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1437280849Scy ''|no)
1438181834Sroberto    ;;
1439280849Scy *)
1440280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1441280849Scy	[Should we recommend a minimum value for tickadj?])
1442181834Srobertoesac
1443280849Scy
1444280849ScyAC_CACHE_CHECK(
1445280849Scy    [if the TTY code permits PARENB and IGNPAR],
1446280849Scy    [ntp_cv_no_parenb_ignpar],
1447280849Scy    [
1448280849Scy	ans=no
1449280849Scy	case "$host" in
1450280849Scy	 i?86-*-*linux*)
1451280849Scy	    ans=yes
1452280849Scy	    ;;
1453280849Scy	 mips-sgi-irix*)
1454280849Scy	    ans=yes
1455280849Scy	    ;;
1456280849Scy	 i?86-*-freebsd[[123]].*)
1457280849Scy	    ;;
1458280849Scy	 i?86-*-freebsd*)
1459280849Scy	    ans=yes
1460280849Scy	    ;;
1461280849Scy	 *-*-unicosmp*)
1462280849Scy	    ans=yes
1463280849Scy	    ;;
1464280849Scy	esac
1465280849Scy	ntp_cv_no_parenb_ignpar=$ans
1466280849Scy    ]
1467280849Scy)
1468280849Scycase "$ntp_cv_no_parenb_ignpar" in
1469280849Scy yes)
1470280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1471280849Scy	[Is there a problem using PARENB and IGNPAR?])
1472181834Srobertoesac
1473181834Sroberto
1474280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1475280849ScyAC_ARG_ENABLE(
1476280849Scy    [debug-timing],
1477280849Scy    [AS_HELP_STRING(
1478280849Scy	[--enable-debug-timing],
1479280849Scy	[- include processing time debugging code (costs performance)]
1480280849Scy    )],
1481280849Scy    [ntp_ok=$enableval],
1482280849Scy    [ntp_ok=no]
1483280849Scy)
1484280849Scycase "$ntp_ok" in
1485280849Scy yes)
1486280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1487181834Srobertoesac
1488280849ScyAC_MSG_RESULT([$ntp_ok])
1489181834Sroberto
1490280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1491200576SrobertoAC_ARG_ENABLE(
1492280849Scy    [dst-minutes],
1493280849Scy    [AS_HELP_STRING(
1494200576Sroberto	[--enable-dst-minutes],
1495280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1496280849Scy    ],
1497200576Sroberto    [ans=$enableval],
1498200576Sroberto    [ans=60]
1499200576Sroberto)
1500280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1501280849Scy    [The number of minutes in a DST adjustment])
1502200576SrobertoAC_MSG_RESULT([$ans])
1503181834Sroberto
1504280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1505200576SrobertoAC_ARG_ENABLE(
1506200576Sroberto    [ignore-dns-errors],
1507280849Scy    [AS_HELP_STRING(
1508280849Scy	[--enable-ignore-dns-errors],
1509200576Sroberto	[- retry DNS queries on any error]
1510280849Scy    )],
1511200576Sroberto    [ans=$enableval],
1512200576Sroberto    [ans=no]
1513200576Sroberto)
1514200576Srobertocase "$ans" in
1515200576Sroberto yes)
1516280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1517280849Scy	[Retry queries on _any_ DNS error?])
1518200576Srobertoesac
1519200576SrobertoAC_MSG_RESULT([$ans])
1520200576Sroberto
1521280849ScyAC_CACHE_CHECK(
1522280849Scy    [availability of ntp_{adj,get}time()],
1523280849Scy    [ntp_cv_var_ntp_syscalls],
1524280849Scy    [
1525280849Scy	ntp_cv_var_ntp_syscalls=no
1526280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1527280849Scy	 yesyes*)
1528280849Scy	    ntp_cv_var_ntp_syscalls=libc
1529181834Sroberto	    ;;
1530280849Scy	 *yes)
1531280849Scy	    ntp_cv_var_ntp_syscalls=inline
1532181834Sroberto	    ;;
1533280849Scy	 *)
1534280849Scy	    AC_PREPROC_IFELSE(
1535282408Scy		[AC_LANG_SOURCE(
1536282408Scy		    [
1537282408Scy			#include <sys/syscall.h>
1538282408Scy			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1539282408Scy			# error
1540282408Scy			#endif
1541282408Scy		    ])],
1542280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1543280849Scy	    )
1544181834Sroberto	    ;;
1545280849Scy	 esac
1546280849Scy    ]
1547280849Scy)
1548280849Scycase "$ntp_cv_var_ntp_syscalls" in
1549181834Sroberto libc)
1550280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1551280849Scy	[Do we have ntp_{adj,get}time in libc?])
1552181834Sroberto    ;;
1553181834Sroberto kernel)
1554280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1555280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1556181834Sroberto    ;;
1557181834Srobertoesac
1558181834Sroberto
1559280849ScyAC_CACHE_CHECK(
1560280849Scy    [if sys/timex.h has STA_FLL],
1561280849Scy    [ntp_cv_var_sta_fll],
1562280849Scy    [AC_PREPROC_IFELSE(
1563282408Scy	[AC_LANG_SOURCE(
1564282408Scy	    [
1565282408Scy		#include <sys/timex.h>
1566282408Scy		#ifndef STA_FLL
1567282408Scy		# error
1568282408Scy		#endif
1569282408Scy	    ])],
1570280849Scy	[ntp_cv_var_sta_fll=yes],
1571280849Scy	[ntp_cv_var_sta_fll=no]
1572280849Scy    )]
1573280849Scy)
1574181834Sroberto
1575280849ScyAC_CACHE_CHECK(
1576280849Scy    [if we have kernel PLL support],
1577280849Scy    [ntp_cv_var_kernel_pll],
1578280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1579280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1580280849Scy	 *no*)
1581280849Scy	    ntp_cv_var_kernel_pll=no
1582280849Scy	    ;;
1583280849Scy	 *) ntp_cv_var_kernel_pll=yes
1584280849Scy	    ;;
1585280849Scy	esac
1586280849Scy    ]
1587280849Scy)
1588280849Scycase "$ntp_cv_var_kernel_pll" in
1589181834Sroberto yes)
1590280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1591280849Scy	[Does the kernel support precision time discipline?])
1592181834Srobertoesac
1593181834Sroberto
1594280849ScyAC_CACHE_CHECK(
1595280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1596280849Scy    [ntp_cv_size_returned_in_buffer],
1597280849Scy    [
1598280849Scy	ans=no
1599280849Scy	case "$host" in
1600280849Scy	 *-fujitsu-uxp*)
1601280849Scy	    ans=yes
1602280849Scy	    ;;
1603280849Scy	 *-ncr-sysv4*)
1604280849Scy	    ans=yes
1605280849Scy	    ;;
1606280849Scy	 *-univel-sysv*)
1607280849Scy	    ans=yes
1608280849Scy	    ;;
1609280849Scy	esac
1610280849Scy	ntp_cv_size_returned_in_buffer=$ans
1611280849Scy    ]
1612280849Scy)
1613280849Scycase "$ntp_cv_size_returned_in_buffer" in
1614280849Scy yes)
1615280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1616280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1617181834Srobertoesac
1618181834Sroberto
1619181834Sroberto# Check for ioctls TIOCGPPSEV
1620280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1621280849Scycase "$ac_cv_header_termios_h" in
1622280849Scy yes)
1623280849Scy    AC_PREPROC_IFELSE(
1624282408Scy	[AC_LANG_SOURCE([
1625280849Scy	    #include <termios.h>
1626280849Scy	    #ifndef TIOCGPPSEV
1627280849Scy	    # error
1628280849Scy	    #endif
1629282408Scy	])],
1630280849Scy	[ntp_ok=yes],
1631280849Scy	[ntp_ok=no]
1632280849Scy    )
1633280849Scy    ;;
1634280849Scy *)
1635280849Scy    ntp_ok=no
1636280849Scy    ;;
1637280849Scyesac
1638280849Scycase "$ntp_ok" in
1639280849Scy yes)
1640280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1641280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1642280849Scyesac
1643280849ScyAC_MSG_RESULT([$ntp_ok])
1644181834Sroberto
1645181834Sroberto# Check for ioctls TIOCSPPS
1646280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1647280849Scycase "$ac_cv_header_termios_h" in
1648280849Scy yes)
1649280849Scy    AC_PREPROC_IFELSE(
1650282408Scy	[AC_LANG_SOURCE([
1651280849Scy	    #include <termios.h>
1652280849Scy	    #ifndef TIOCSPPS
1653280849Scy	    # error
1654280849Scy	    #endif
1655282408Scy	 ])],
1656280849Scy	 [ntp_ok=yes],
1657280849Scy	 [ntp_ok=no]
1658280849Scy    )
1659280849Scy    ;;
1660280849Scy *)
1661181834Sroberto    ntp_ok=no
1662280849Scy    ;;
1663280849Scyesac
1664280849Scycase "$ntp_ok" in
1665280849Scy yes)
1666280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1667280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1668280849Scyesac
1669280849ScyAC_MSG_RESULT([$ntp_ok])
1670181834Sroberto
1671181834Sroberto# Check for ioctls CIOGETEV
1672280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1673280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1674280849Scy yes)
1675280849Scy    AC_PREPROC_IFELSE(
1676282408Scy	[AC_LANG_SOURCE([
1677280849Scy	    #include <sys/ppsclock.h>
1678280849Scy	    #ifndef CIOGETEV
1679280849Scy	    # error
1680280849Scy	    #endif
1681282408Scy	])],
1682280849Scy	[ntp_ok=yes],
1683280849Scy	[ntp_ok=no]
1684280849Scy    )
1685280849Scy    ;;
1686280849Scy *)
1687280849Scy    ntp_ok=no
1688280849Scy    ;;
1689280849Scyesac
1690280849Scycase "$ntp_ok" in
1691280849Scy yes)
1692280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1693280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1694280849Scyesac
1695280849ScyAC_MSG_RESULT([$ntp_ok])
1696181834Sroberto
1697181834Sroberto# ATOM/PPSAPI stuff.
1698181834Sroberto
1699280849Scyntp_atom_ok=yes
1700181834Sroberto
1701181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1702181834Sroberto
1703181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1704181834Sroberto# The PPSAPI needs struct timespec.
1705181834Sroberto# The PPSAPI also needs a timepps header.
1706181834Sroberto
1707280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1708181834Sroberto inlineyes)
1709181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1710181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1711181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1712280849Scy	ntp_jupiter_ok=yes
1713280849Scy	ntp_oncore_ok=yes
1714280849Scy	ntp_parse_ok=yes
1715280849Scy	ntp_ripe_ncc_ok=yes
1716181834Sroberto	;;
1717181834Sroberto    esac
1718181834Sroberto    ;;
1719181834Srobertoesac
1720181834Sroberto
1721181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1722280849ScyAC_CHECK_HEADER([linux/serial.h])
1723181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1724181834Sroberto  yesyes)
1725280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1726280849Scy    AC_PREPROC_IFELSE(
1727282408Scy	[AC_LANG_SOURCE([
1728280849Scy	    #include <sys/time.h>
1729280849Scy	    typedef int u_int;
1730280849Scy	    #include <sys/ppsclock.h>
1731280849Scy	    #include <linux/serial.h>
1732181834Sroberto
1733280849Scy	    #ifndef TIOCGSERIAL
1734280849Scy	    # error
1735280849Scy	    #endif
1736280849Scy	    #ifndef TIOCSSERIAL
1737280849Scy	    # error
1738280849Scy	    #endif
1739280849Scy	    #ifndef ASYNC_PPS_CD_POS
1740280849Scy	    # error
1741280849Scy	    #endif
1742280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1743280849Scy	    # error
1744280849Scy	    #endif
1745280849Scy	    #ifndef CIOGETEV
1746280849Scy	    # error
1747280849Scy	    #endif
1748282408Scy	])],
1749280849Scy	[ntp_ok=yes],
1750280849Scy	[ntp_ok=no]
1751280849Scy    )
1752280849Scy    AC_MSG_RESULT([$ntp_ok])
1753280849Scy    ;;
1754181834Sroberto  *)
1755280849Scy    ntp_ok=no
1756280849Scy    ;;
1757181834Srobertoesac
1758280849Scycase "$ntp_ok" in
1759280849Scy yes)
1760280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1761280849Scy	[Do we have the TIO serial stuff?])
1762280849Scyesac
1763181834Sroberto
1764181834Sroberto# Check for SHMEM_STATUS support
1765200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1766181834Srobertocase "$ac_cv_header_sys_mman_h" in
1767280849Scy yes)
1768280849Scy    ntp_ok=yes
1769280849Scy    ;;
1770280849Scy *)
1771280849Scy    ntp_ok=no
1772280849Scy    ;;
1773181834Srobertoesac
1774280849Scycase "$ntp_ok" in
1775280849Scy yes)
1776280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1777280849Scy	[Do we have support for SHMEM_STATUS?])
1778280849Scyesac
1779280849ScyAC_MSG_RESULT([$ntp_ok])
1780181834Sroberto
1781181834Srobertontp_refclock=no
1782181834Sroberto
1783181834Sroberto# HPUX only, and by explicit request
1784200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1785280849ScyAC_ARG_ENABLE(
1786280849Scy    [BANCOMM],
1787280849Scy    [AS_HELP_STRING(
1788280849Scy	[--enable-BANCOMM],
1789280849Scy	[- Datum/Bancomm bc635/VME interface]
1790280849Scy    )],
1791280849Scy    [ntp_ok=$enableval],
1792280849Scy    [ntp_ok=no]
1793280849Scy)
1794280849Scycase "$ntp_ok" in
1795280849Scy yes)
1796181834Sroberto    ntp_refclock=yes
1797280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1798280849Scy    ;;
1799280849Scyesac
1800280849ScyAC_MSG_RESULT([$ntp_ok])
1801181834Srobertocase "$ntp_ok$host" in
1802181834Sroberto yes*-*-hpux*) ;;
1803200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1804181834Srobertoesac
1805181834Sroberto
1806181834Sroberto#HPUX only, and only by explicit request
1807200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1808280849ScyAC_ARG_ENABLE(
1809280849Scy    [GPSVME],
1810280849Scy    [AS_HELP_STRING(
1811280849Scy	[--enable-GPSVME],
1812280849Scy	[- TrueTime GPS receiver/VME interface]
1813280849Scy    )],
1814280849Scy    [ntp_ok=$enableval],
1815280849Scy    [ntp_ok=no]
1816280849Scy)
1817280849Scycase "$ntp_ok" in
1818280849Scy yes)
1819181834Sroberto    ntp_refclock=yes
1820280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1821280849Scy    ;;
1822280849Scyesac
1823280849ScyAC_MSG_RESULT([$ntp_ok])
1824181834Srobertocase "$ntp_ok$host" in
1825181834Sroberto yes*-*-hpux*) ;;
1826200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1827181834Srobertoesac
1828181834Sroberto
1829200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1830181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1831181834Sroberto yesyesyes)
1832280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1833181834Sroberto    ans=yes
1834181834Sroberto    ;;
1835181834Sroberto *)
1836181834Sroberto    ans=no
1837181834Sroberto    ;;
1838181834Srobertoesac
1839200576SrobertoAC_MSG_RESULT([$ans])
1840181834Sroberto
1841200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1842280849ScyAC_ARG_ENABLE(
1843280849Scy    [all-clocks],
1844280849Scy    [AS_HELP_STRING(
1845280849Scy	[--enable-all-clocks],
1846280849Scy	[+ include all suitable non-PARSE clocks:]
1847280849Scy    )],
1848280849Scy    [ntp_eac=$enableval],
1849280849Scy    [ntp_eac=yes]
1850280849Scy)
1851280849ScyAC_MSG_RESULT([$ntp_eac])
1852181834Sroberto
1853280849Scy# HMS: Should we also require ntp_parse_ok?
1854200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1855280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1856181834Sroberto yes*yes*)
1857181834Sroberto    ntp_canparse=yes
1858181834Sroberto    ;;
1859181834Sroberto *) ntp_canparse=no
1860181834Sroberto    ;;
1861181834Srobertoesac
1862280849ScyAC_MSG_RESULT([$ntp_canparse])
1863181834Sroberto
1864181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1865181834Srobertocase "$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
1866181834Sroberto *yes*)
1867181834Sroberto    ntp_canaudio=yes
1868280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1869181834Sroberto    ;;
1870181834Sroberto *) ntp_canaudio=no ;;
1871181834Srobertoesac
1872280849ScyAC_MSG_RESULT([$ntp_canaudio])
1873181834Sroberto
1874181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1875181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1876181834Sroberto yesyes)
1877181834Sroberto    ntp_canshm=yes
1878181834Sroberto    ;;
1879181834Sroberto *) ntp_canshm=no ;;
1880181834Srobertoesac
1881280849ScyAC_MSG_RESULT([$ntp_canshm])
1882181834Sroberto
1883280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1884280849ScyAC_CACHE_CHECK(
1885280849Scy    [for termios modem control],
1886280849Scy    [ntp_cv_modem_control],
1887280849Scy    [AC_COMPILE_IFELSE(
1888280849Scy	[AC_LANG_PROGRAM(
1889280849Scy	    [[
1890280849Scy		#ifdef HAVE_UNISTD_H
1891280849Scy		# include <unistd.h>
1892280849Scy		#endif
1893280849Scy		#ifdef HAVE_TERMIOS_H
1894280849Scy		# include <termios.h>
1895280849Scy		#endif
1896280849Scy		#ifdef HAVE_SYS_IOCTL_H
1897280849Scy		# include <sys/ioctl.h>
1898280849Scy		#endif
1899280849Scy	    ]],
1900280849Scy	    [[
1901280849Scy		int	dtr = TIOCM_DTR;
1902280849Scy
1903280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1904280849Scy	    ]]
1905280849Scy	)],
1906280849Scy	[ntp_cv_modem_control=yes],
1907280849Scy	[ntp_cv_modem_control=no]
1908280849Scy    )]
1909280849Scy)
1910280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1911280849Scy yes::yes)
1912280849Scy    ntp_enable_all_modem_control_clocks=yes
1913280849Scy    ;;
1914280849Scy *)
1915280849Scy    ntp_enable_all_modem_control_clocks=no
1916280849Scy    ;;
1917280849Scyesac
1918280849Scy
1919181834Sroberto# Requires modem control
1920200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1921280849ScyAC_ARG_ENABLE(
1922280849Scy    [ACTS],
1923280849Scy    [AS_HELP_STRING(
1924280849Scy	[--enable-ACTS],
1925280849Scy	[s ACTS modem service]
1926280849Scy    )],
1927181834Sroberto    [ntp_ok=$enableval],
1928280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1929280849Scy)
1930280849Scycase "$ntp_ok" in
1931280849Scy yes)
1932181834Sroberto    ntp_refclock=yes
1933280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1934280849Scy    ;;
1935280849Scyesac
1936280849ScyAC_MSG_RESULT([$ntp_ok])
1937181834Sroberto
1938200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1939280849ScyAC_ARG_ENABLE(
1940280849Scy    [ARBITER],
1941280849Scy    [AS_HELP_STRING(
1942280849Scy	[--enable-ARBITER],
1943280849Scy	[+ Arbiter 1088A/B GPS receiver]
1944280849Scy    )],
1945280849Scy    [ntp_ok=$enableval],
1946280849Scy    [ntp_ok=$ntp_eac]
1947280849Scy)
1948280849Scycase "$ntp_ok" in
1949280849Scy yes)
1950181834Sroberto    ntp_refclock=yes
1951280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1952280849Scy    ;;
1953280849Scyesac
1954280849ScyAC_MSG_RESULT([$ntp_ok])
1955181834Sroberto
1956200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1957280849ScyAC_ARG_ENABLE(
1958280849Scy    [ARCRON_MSF],
1959280849Scy    [AS_HELP_STRING(
1960280849Scy	[--enable-ARCRON-MSF],
1961280849Scy	[+ Arcron MSF receiver]
1962280849Scy    )],
1963280849Scy    [ntp_ok=$enableval],
1964280849Scy    [ntp_ok=$ntp_eac]
1965280849Scy)
1966280849Scycase "$ntp_ok" in
1967280849Scy yes)
1968181834Sroberto    ntp_refclock=yes
1969280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1970280849Scy    ;;
1971280849Scyesac
1972280849ScyAC_MSG_RESULT([$ntp_ok])
1973181834Sroberto
1974200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1975280849ScyAC_ARG_ENABLE(
1976280849Scy    [AS2201],
1977280849Scy    [AS_HELP_STRING(
1978280849Scy	[--enable-AS2201],
1979280849Scy	[+ Austron 2200A/2201A GPS receiver]
1980280849Scy    )],
1981280849Scy    [ntp_ok=$enableval],
1982280849Scy    [ntp_ok=$ntp_eac]
1983280849Scy)
1984280849Scycase "$ntp_ok" in
1985280849Scy yes)
1986181834Sroberto    ntp_refclock=yes
1987280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1988280849Scy    ;;
1989280849Scyesac
1990280849ScyAC_MSG_RESULT([$ntp_ok])
1991181834Sroberto
1992200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1993280849ScyAC_ARG_ENABLE(
1994280849Scy    [ATOM],
1995280849Scy    [AS_HELP_STRING(
1996280849Scy	[--enable-ATOM],
1997280849Scy	[s ATOM PPS interface]
1998280849Scy    )],
1999280849Scy    [ntp_ok=$enableval],
2000280849Scy    [ntp_ok=$ntp_eac]
2001280849Scy)
2002280849Scycase "$ntp_atom_ok" in
2003181834Sroberto no) ntp_ok=no ;;
2004181834Srobertoesac
2005280849Scycase "$ntp_ok" in
2006280849Scy yes)
2007181834Sroberto    ntp_refclock=yes
2008280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
2009280849Scy    ;;
2010280849Scyesac
2011280849ScyAC_MSG_RESULT([$ntp_ok])
2012181834Sroberto
2013200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
2014280849ScyAC_ARG_ENABLE(
2015280849Scy    [CHRONOLOG],
2016280849Scy    [AS_HELP_STRING(
2017280849Scy	[--enable-CHRONOLOG],
2018280849Scy	[+ Chrono-log K-series WWVB receiver]
2019280849Scy    )],
2020280849Scy    [ntp_ok=$enableval],
2021280849Scy    [ntp_ok=$ntp_eac]
2022280849Scy)
2023280849Scycase "$ntp_ok" in
2024280849Scy yes)
2025181834Sroberto    ntp_refclock=yes
2026280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
2027280849Scy    ;;
2028280849Scyesac
2029280849ScyAC_MSG_RESULT([$ntp_ok])
2030181834Sroberto
2031200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
2032280849ScyAC_ARG_ENABLE(
2033280849Scy    [CHU],
2034280849Scy    [AS_HELP_STRING(
2035280849Scy	[--enable-CHU],
2036280849Scy	[+ CHU modem/decoder]
2037280849Scy    )],
2038280849Scy    [ntp_ok=$enableval],
2039280849Scy    [ntp_ok=$ntp_eac]
2040280849Scy)
2041280849Scycase "$ntp_ok" in
2042280849Scy yes)
2043181834Sroberto    ntp_refclock=yes
2044280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
2045280849Scy    ;;
2046280849Scyesac
2047280849ScyAC_MSG_RESULT([$ntp_ok])
2048280849Scyntp_refclock_chu=$ntp_ok
2049181834Sroberto
2050200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2051280849ScyAC_ARG_ENABLE(
2052280849Scy    [AUDIO-CHU],
2053280849Scy    [AS_HELP_STRING(
2054280849Scy	[--enable-AUDIO-CHU],
2055280849Scy	[s CHU audio/decoder]
2056280849Scy    )],
2057181834Sroberto    [ntp_ok=$enableval],
2058280849Scy    [
2059280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2060280849Scy	 *no*)	ntp_ok=no  ;;
2061280849Scy	 *)	ntp_ok=yes ;;
2062280849Scy	esac
2063280849Scy    ]
2064280849Scy)
2065280849ScyAC_MSG_RESULT([$ntp_ok])
2066181834Sroberto# We used to check for sunos/solaris target...
2067280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2068280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2069181834Srobertoesac
2070181834Sroberto
2071181834Sroberto# Not under HP-UX
2072200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2073280849ScyAC_ARG_ENABLE(
2074280849Scy    [DATUM],
2075280849Scy    [AS_HELP_STRING(
2076280849Scy	[--enable-DATUM],
2077280849Scy	[s Datum Programmable Time System]
2078280849Scy    )],
2079181834Sroberto    [ntp_ok=$enableval],
2080280849Scy    [
2081280849Scy	case "$ac_cv_header_termios_h" in
2082280849Scy	 yes)
2083280849Scy	    ntp_ok=$ntp_eac
2084280849Scy	    ;;
2085280849Scy	 *) ntp_ok=no
2086280849Scy	    ;;
2087280849Scy	esac
2088280849Scy    ]
2089280849Scy)
2090280849Scycase "$ntp_ok" in
2091280849Scy yes)
2092181834Sroberto    ntp_refclock=yes
2093280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2094280849Scy    ;;
2095280849Scyesac
2096280849ScyAC_MSG_RESULT([$ntp_ok])
2097181834Sroberto
2098200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2099280849ScyAC_ARG_ENABLE(
2100280849Scy    [DUMBCLOCK],
2101280849Scy    [AS_HELP_STRING(
2102280849Scy	[--enable-DUMBCLOCK],
2103280849Scy	[+ Dumb generic hh:mm:ss local clock]
2104280849Scy    )],
2105280849Scy    [ntp_ok=$enableval],
2106280849Scy    [ntp_ok=$ntp_eac]
2107280849Scy)
2108280849Scycase "$ntp_ok" in
2109280849Scy yes)
2110181834Sroberto    ntp_refclock=yes
2111280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2112280849Scy    ;;
2113280849Scyesac
2114280849ScyAC_MSG_RESULT([$ntp_ok])
2115181834Sroberto
2116200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2117280849ScyAC_ARG_ENABLE(
2118280849Scy    [FG],
2119280849Scy    [AS_HELP_STRING(
2120280849Scy	[--enable-FG],
2121280849Scy	[+ Forum Graphic GPS]
2122280849Scy    )],
2123280849Scy    [ntp_ok=$enableval],
2124280849Scy    [ntp_ok=$ntp_eac]
2125280849Scy)
2126280849Scycase "$ntp_ok" in
2127280849Scy yes)
2128181834Sroberto    ntp_refclock=yes
2129280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2130280849Scy    ;;
2131280849Scyesac
2132280849ScyAC_MSG_RESULT([$ntp_ok])
2133181834Sroberto
2134181834Sroberto# Requires modem control
2135200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2136280849ScyAC_ARG_ENABLE(
2137280849Scy    [HEATH],
2138280849Scy    [AS_HELP_STRING(
2139280849Scy	[--enable-HEATH],
2140280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2141280849Scy    )],
2142181834Sroberto    [ntp_ok=$enableval],
2143280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2144280849Scy)
2145280849Scycase "$ntp_ok" in
2146280849Scy yes)
2147181834Sroberto    ntp_refclock=yes
2148280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2149280849Scy    ;;
2150280849Scyesac
2151280849ScyAC_MSG_RESULT([$ntp_ok])
2152181834Sroberto
2153200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2154280849ScyAC_ARG_ENABLE(
2155280849Scy    [HOPFSERIAL],
2156280849Scy    [AS_HELP_STRING(
2157280849Scy	[--enable-HOPFSERIAL],
2158280849Scy	[+ hopf serial clock device]
2159280849Scy    )],
2160280849Scy    [ntp_ok=$enableval],
2161280849Scy    [ntp_ok=$ntp_eac]
2162280849Scy)
2163280849Scycase "$ntp_ok" in
2164280849Scy yes)
2165181834Sroberto    ntp_refclock=yes
2166280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2167280849Scy    ;;
2168280849Scyesac
2169280849ScyAC_MSG_RESULT([$ntp_ok])
2170181834Sroberto
2171200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2172280849ScyAC_ARG_ENABLE(
2173280849Scy    [HOPFPCI],
2174280849Scy    [AS_HELP_STRING(
2175280849Scy	[--enable-HOPFPCI],
2176280849Scy	[+ hopf 6039 PCI board]
2177280849Scy    )],
2178280849Scy    [ntp_ok=$enableval],
2179280849Scy    [ntp_ok=$ntp_eac]
2180280849Scy)
2181280849Scycase "$ntp_ok" in
2182280849Scy yes)
2183181834Sroberto    ntp_refclock=yes
2184280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2185280849Scy    ;;
2186280849Scyesac
2187280849ScyAC_MSG_RESULT([$ntp_ok])
2188181834Sroberto
2189200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2190280849ScyAC_ARG_ENABLE(
2191280849Scy    [HPGPS],
2192280849Scy    [AS_HELP_STRING(
2193280849Scy	[--enable-HPGPS],
2194280849Scy	[+ HP 58503A GPS receiver]
2195280849Scy    )],
2196280849Scy    [ntp_ok=$enableval],
2197280849Scy    [ntp_ok=$ntp_eac]
2198280849Scy)
2199280849Scycase "$ntp_ok" in
2200280849Scy yes)
2201181834Sroberto    ntp_refclock=yes
2202280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2203280849Scy    ;;
2204280849Scyesac
2205280849ScyAC_MSG_RESULT([$ntp_ok])
2206181834Sroberto
2207200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2208280849ScyAC_ARG_ENABLE(
2209280849Scy    [IRIG],
2210280849Scy    [AS_HELP_STRING(
2211280849Scy	[--enable-IRIG],
2212280849Scy	[s IRIG audio decoder]
2213280849Scy    )],
2214181834Sroberto    [ntp_ok=$enableval],
2215280849Scy    [
2216280849Scy	case "$ntp_eac$ntp_canaudio" in
2217280849Scy	 *no*)	ntp_ok=no  ;;
2218280849Scy	 *)	ntp_ok=yes ;;
2219280849Scy	esac
2220280849Scy    ]
2221280849Scy)
2222280849Scycase "$ntp_ok" in
2223280849Scy yes)
2224181834Sroberto    ntp_refclock=yes
2225280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2226280849Scy    ;;
2227280849Scyesac
2228280849ScyAC_MSG_RESULT([$ntp_ok])
2229181834Srobertocase "$ntp_ok$ntp_canaudio" in
2230280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2231181834Srobertoesac
2232181834Sroberto
2233200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2234280849ScyAC_ARG_ENABLE(
2235280849Scy    [JJY],
2236280849Scy    [AS_HELP_STRING(
2237280849Scy	[--enable-JJY],
2238280849Scy	[+ JJY receiver]
2239280849Scy    )],
2240280849Scy    [ntp_ok=$enableval],
2241280849Scy    [ntp_ok=$ntp_eac]
2242280849Scy)
2243280849Scycase "$ntp_ok" in
2244280849Scy yes)
2245181834Sroberto    ntp_refclock=yes
2246280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2247280849Scy    ;;
2248280849Scyesac
2249280849ScyAC_MSG_RESULT([$ntp_ok])
2250181834Sroberto
2251200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2252280849ScyAC_ARG_ENABLE(
2253280849Scy    [JUPITER],
2254280849Scy    [AS_HELP_STRING(
2255280849Scy	[--enable-JUPITER],
2256280849Scy	[s Rockwell Jupiter GPS receiver]
2257280849Scy    )],
2258181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2259280849Scycase "$ntp_jupiter_ok" in
2260181834Sroberto no) ntp_ok=no ;;
2261181834Srobertoesac
2262280849Scycase "$ntp_ok" in
2263280849Scy yes)
2264181834Sroberto    ntp_refclock=yes
2265280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2266280849Scy    ;;
2267280849Scyesac
2268280849ScyAC_MSG_RESULT([$ntp_ok])
2269181834Sroberto
2270200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2271280849ScyAC_ARG_ENABLE(
2272280849Scy    [LEITCH],
2273280849Scy    [AS_HELP_STRING(
2274280849Scy	[--enable-LEITCH],
2275280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2276280849Scy    )],
2277280849Scy    [ntp_ok=$enableval],
2278280849Scy    [ntp_ok=$ntp_eac]
2279280849Scy)
2280280849Scycase "$ntp_ok" in
2281280849Scy yes)
2282181834Sroberto    ntp_refclock=yes
2283280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2284280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2285280849Scy    ;;
2286280849Scyesac
2287280849ScyAC_MSG_RESULT([$ntp_ok])
2288181834Sroberto
2289200576SrobertoAC_MSG_CHECKING([local clock reference])
2290280849ScyAC_ARG_ENABLE(
2291280849Scy    [LOCAL-CLOCK],
2292280849Scy    [AS_HELP_STRING(
2293280849Scy	[--enable-LOCAL-CLOCK],
2294280849Scy	[+ local clock reference]
2295280849Scy    )],
2296280849Scy    [ntp_ok=$enableval],
2297280849Scy    [ntp_ok=$ntp_eac]
2298280849Scy)
2299280849Scycase "$ntp_ok" in
2300280849Scy yes)
2301181834Sroberto    ntp_refclock=yes
2302280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2303280849Scy    ;;
2304280849Scyesac
2305280849ScyAC_MSG_RESULT([$ntp_ok])
2306181834Sroberto
2307181834Srobertodnl Bug 340: longstanding unfixed bugs
2308280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2309280849Scydnl AC_ARG_ENABLE([MSFEES],
2310280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2311181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2312181834Srobertodnl if test "$ntp_ok" = "yes"; then
2313181834Srobertodnl     ntp_refclock=yes
2314280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2315181834Srobertodnl fi
2316280849Scydnl AC_MSG_RESULT([$ntp_ok])
2317181834Sroberto
2318181834Sroberto# Not Ultrix
2319200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2320280849ScyAC_ARG_ENABLE(
2321280849Scy    [MX4200],
2322280849Scy    [AS_HELP_STRING(
2323280849Scy	[--enable-MX4200 ],
2324280849Scy	[s Magnavox MX4200 GPS receiver]
2325280849Scy    )],
2326181834Sroberto    [ntp_ok=$enableval],
2327280849Scy    [
2328280849Scy	case "$ac_cv_var_ppsclock" in
2329280849Scy	 yes)
2330280849Scy	    ntp_ok=$ntp_eac
2331280849Scy	    ;;
2332280849Scy	 *)
2333280849Scy	    ntp_ok=no
2334280849Scy	    ;;
2335280849Scy	esac
2336280849Scy    ]
2337280849Scy)
2338280849Scycase "$ntp_ok" in
2339280849Scy yes)
2340181834Sroberto    ntp_refclock=yes
2341280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2342280849Scy    ;;
2343280849Scyesac
2344280849ScyAC_MSG_RESULT([$ntp_ok])
2345181834Srobertocase "$ntp_ok$host" in
2346280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2347181834Srobertoesac
2348181834Sroberto
2349200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2350280849ScyAC_ARG_ENABLE(
2351280849Scy    [NEOCLOCK4X],
2352280849Scy    [AS_HELP_STRING(
2353280849Scy	[--enable-NEOCLOCK4X],
2354280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2355280849Scy    )],
2356280849Scy    [ntp_ok=$enableval],
2357280849Scy    [ntp_ok=$ntp_eac]
2358280849Scy)
2359280849Scycase "$ntp_ok" in
2360280849Scy yes)
2361181834Sroberto    ntp_refclock=yes
2362280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2363280849Scy    ;;
2364280849Scyesac
2365280849ScyAC_MSG_RESULT([$ntp_ok])
2366181834Sroberto
2367200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2368280849ScyAC_ARG_ENABLE(
2369280849Scy    [NMEA],
2370280849Scy    [AS_HELP_STRING(
2371280849Scy	[--enable-NMEA],
2372280849Scy	[+ NMEA GPS receiver]
2373280849Scy    )],
2374280849Scy    [ntp_ok=$enableval],
2375280849Scy    [ntp_ok=$ntp_eac]
2376280849Scy)
2377280849Scycase "$ntp_ok" in
2378280849Scy yes)
2379181834Sroberto    ntp_refclock=yes
2380280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2381280849Scy    ;;
2382280849Scyesac
2383280849ScyAC_MSG_RESULT([$ntp_ok])
2384181834Sroberto
2385280849ScyAC_CHECK_FUNCS([strtoll])
2386280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2387280849ScyAC_ARG_ENABLE(
2388280849Scy    [GPSD],
2389280849Scy    [AS_HELP_STRING(
2390280849Scy	[--enable-GPSD],
2391280849Scy	[+ GPSD JSON receiver]
2392280849Scy    )],
2393280849Scy    [ntp_ok=$enableval],
2394280849Scy    [case "$ac_cv_func_strtoll" in
2395280849Scy     yes) ntp_ok=$ntp_eac ;;
2396280849Scy     *)   ntp_ok="no" ;;
2397280849Scy    esac]
2398280849Scy)
2399280849Scycase "$ntp_ok" in
2400280849Scy yes)
2401280849Scy    ntp_refclock=yes
2402280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2403280849Scy    ;;
2404280849Scyesac
2405280849ScyAC_MSG_RESULT([$ntp_ok])
2406280849Scy
2407200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2408280849ScyAC_ARG_ENABLE(
2409280849Scy    [ONCORE],
2410280849Scy    [AS_HELP_STRING(
2411280849Scy	[--enable-ONCORE],
2412280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2413280849Scy    )],
2414280849Scy    [ntp_ok=$enableval],
2415280849Scy    [ntp_ok=$ntp_eac]
2416280849Scy)
2417280849Scycase "$ntp_oncore_ok" in
2418181834Sroberto no) ntp_ok=no ;;
2419181834Srobertoesac
2420280849Scycase "$ntp_ok" in
2421280849Scy yes)
2422181834Sroberto    ntp_refclock=yes
2423280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2424280849Scy    ;;
2425280849Scyesac
2426280849ScyAC_MSG_RESULT([$ntp_ok])
2427181834Sroberto
2428280849Scy# Requires modem control
2429200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2430280849ScyAC_ARG_ENABLE(
2431280849Scy    [PALISADE],
2432280849Scy    [AS_HELP_STRING(
2433280849Scy	[--enable-PALISADE],
2434280849Scy	[s Palisade clock]
2435280849Scy    )],
2436181834Sroberto    [ntp_ok=$enableval],
2437280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2438280849Scy)
2439280849Scycase "$ntp_ok" in
2440280849Scy yes)
2441181834Sroberto    ntp_refclock=yes
2442280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2443280849Scy    ;;
2444280849Scyesac
2445280849ScyAC_MSG_RESULT([$ntp_ok])
2446181834Sroberto
2447200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2448280849ScyAC_ARG_ENABLE(
2449280849Scy    [PCF],
2450280849Scy    [AS_HELP_STRING(
2451280849Scy	[--enable-PCF ],
2452280849Scy	[+ Conrad parallel port radio clock]
2453280849Scy    )],
2454280849Scy    [ntp_ok=$enableval],
2455280849Scy    [ntp_ok=$ntp_eac]
2456280849Scy)
2457280849Scycase "$ntp_ok" in
2458280849Scy yes)
2459181834Sroberto    ntp_refclock=yes
2460280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2461280849Scy    ;;
2462280849Scyesac
2463280849ScyAC_MSG_RESULT([$ntp_ok])
2464181834Sroberto
2465200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2466280849ScyAC_ARG_ENABLE(
2467280849Scy    [PST],
2468280849Scy    [AS_HELP_STRING(
2469280849Scy	[--enable-PST],
2470280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2471280849Scy    )],
2472280849Scy    [ntp_ok=$enableval],
2473280849Scy    [ntp_ok=$ntp_eac]
2474280849Scy)
2475280849Scycase "$ntp_ok" in
2476280849Scy yes)
2477181834Sroberto    ntp_refclock=yes
2478280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2479280849Scy    ;;
2480280849Scyesac
2481280849ScyAC_MSG_RESULT([$ntp_ok])
2482181834Sroberto
2483200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2484280849ScyAC_ARG_ENABLE(
2485280849Scy    [RIPENCC],
2486280849Scy    [AS_HELP_STRING(
2487280849Scy	[--enable-RIPENCC],
2488280849Scy	[- RIPENCC specific Trimble driver]
2489280849Scy    )],
2490280849Scy    [ntp_ok=$enableval],
2491280849Scy    [ntp_ok=no]
2492280849Scy)
2493181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2494280849Scycase "$ntp_ripe_ncc_ok" in
2495181834Sroberto no) ntp_ok=no ;;
2496181834Srobertoesac
2497280849Scycase "$ntp_ok" in
2498280849Scy yes)
2499181834Sroberto    ntp_refclock=yes
2500280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2501280849Scy    ;;
2502280849Scyesac
2503280849ScyAC_MSG_RESULT([$ntp_ok])
2504181834Sroberto
2505181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2506181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2507200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2508280849ScyAC_ARG_ENABLE(
2509280849Scy    [SHM],
2510280849Scy    [AS_HELP_STRING(
2511280849Scy	[--enable-SHM],
2512280849Scy	[s SHM clock attached thru shared memory]
2513280849Scy    )],
2514181834Sroberto    [ntp_ok=$enableval],
2515280849Scy    [
2516280849Scy	case "$ntp_eac$ntp_canshm" in
2517280849Scy	 *no*)	ntp_ok=no  ;;
2518280849Scy	 *)	ntp_ok=yes ;;
2519280849Scy	esac
2520280849Scy    ]
2521280849Scy)
2522280849Scycase "$ntp_ok" in
2523280849Scy yes)
2524181834Sroberto    ntp_refclock=yes
2525280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2526280849Scy    ;;
2527280849Scyesac
2528280849ScyAC_MSG_RESULT([$ntp_ok])
2529181834Sroberto
2530200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2531280849ScyAC_ARG_ENABLE(
2532280849Scy    [SPECTRACOM],
2533280849Scy    [AS_HELP_STRING(
2534280849Scy	[--enable-SPECTRACOM],
2535280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2536280849Scy    )],
2537280849Scy    [ntp_ok=$enableval],
2538280849Scy    [ntp_ok=$ntp_eac]
2539280849Scy)
2540280849Scycase "$ntp_ok" in
2541280849Scy yes)
2542181834Sroberto    ntp_refclock=yes
2543280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2544280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2545280849Scy    ;;
2546280849Scyesac
2547280849ScyAC_MSG_RESULT([$ntp_ok])
2548181834Sroberto
2549200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2550280849ScyAC_ARG_ENABLE(
2551280849Scy    [TPRO],
2552280849Scy    [AS_HELP_STRING(
2553280849Scy	[--enable-TPRO],
2554280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2555280849Scy    )],
2556181834Sroberto    [ntp_ok=$enableval],
2557280849Scy    [
2558280849Scy	case "$ac_cv_header_sys_tpro_h" in
2559280849Scy	 yes)
2560280849Scy	    ntp_ok=$ntp_eac
2561280849Scy	    ;;
2562280849Scy	 *)
2563280849Scy	    ntp_ok=no
2564280849Scy	    ;;
2565280849Scy	esac
2566280849Scy    ]
2567280849Scy)
2568280849Scycase "$ntp_ok" in
2569280849Scy yes)
2570181834Sroberto    ntp_refclock=yes
2571280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2572280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2573280849Scy    ;;
2574280849Scyesac
2575280849ScyAC_MSG_RESULT([$ntp_ok])
2576181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2577280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2578181834Srobertoesac
2579181834Sroberto
2580181834Sroberto# Not on a vax-dec-bsd
2581200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2582280849ScyAC_ARG_ENABLE(
2583280849Scy    [TRUETIME],
2584280849Scy    [AS_HELP_STRING(
2585280849Scy	[--enable-TRUETIME],
2586280849Scy	[s Kinemetrics/TrueTime receivers]
2587280849Scy    )],
2588181834Sroberto    [ntp_ok=$enableval],
2589280849Scy    [
2590280849Scy	case "$host" in
2591280849Scy	 vax-dec-bsd)
2592280849Scy	    ntp_ok=no
2593280849Scy	    ;;
2594280849Scy	 *)
2595280849Scy	    ntp_ok=$ntp_eac
2596280849Scy	    ;;
2597280849Scy	esac
2598280849Scy    ]
2599280849Scy)    
2600280849Scycase "$ntp_ok" in
2601280849Scy yes)
2602181834Sroberto    ntp_refclock=yes
2603280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2604280849Scy    ;;
2605280849Scyesac
2606280849ScyAC_MSG_RESULT([$ntp_ok])
2607181834Srobertocase "$ntp_ok$host" in
2608280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2609181834Srobertoesac
2610181834Sroberto
2611200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2612280849ScyAC_ARG_ENABLE(
2613280849Scy    [TT560],
2614280849Scy    [AS_HELP_STRING(
2615280849Scy	[--enable-TT560],
2616280849Scy	[- TrueTime 560 IRIG-B decoder]
2617280849Scy    )],
2618280849Scy    [ntp_ok=$enableval],
2619280849Scy    [ntp_ok=no]
2620280849Scy)
2621280849Scycase "$ntp_ok" in
2622280849Scy yes)
2623181834Sroberto    ntp_refclock=yes
2624280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2625280849Scy    ;;
2626280849Scyesac
2627280849ScyAC_MSG_RESULT([$ntp_ok])
2628181834Sroberto
2629200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2630280849ScyAC_ARG_ENABLE(
2631280849Scy    [ULINK],
2632280849Scy    [AS_HELP_STRING(
2633280849Scy	[--enable-ULINK],
2634280849Scy	[+ Ultralink WWVB receiver]
2635280849Scy    )],
2636280849Scy    [ntp_ok=$enableval],
2637280849Scy    [ntp_ok=$ntp_eac]
2638280849Scy)
2639280849Scycase "$ntp_ok" in
2640280849Scy yes)
2641181834Sroberto    ntp_refclock=yes
2642280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2643280849Scy    ;;
2644280849Scyesac
2645280849ScyAC_MSG_RESULT([$ntp_ok])
2646181834Sroberto
2647280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2648280849ScyAC_ARG_ENABLE(
2649280849Scy    [TSYNCPCI],
2650280849Scy    [AS_HELP_STRING(
2651280849Scy	[--enable-TSYNCPCI],
2652280849Scy	[s Spectracom TSYNC timing board]
2653280849Scy    )],
2654280849Scy    [ntp_ok=$enableval],
2655280849Scy    [
2656280849Scy	case "$host" in
2657280849Scy	 *-*-*linux*)
2658280849Scy	    ntp_ok=$ntp_eac
2659280849Scy	    ;;
2660280849Scy	 *)
2661280849Scy	    ntp_ok=no
2662280849Scy	esac
2663280849Scy    ]
2664280849Scy)
2665280849Scycase "$ntp_ok" in
2666280849Scy yes)
2667280849Scy    ntp_refclock=yes
2668280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2669280849Scy    ;;
2670280849Scyesac
2671280849ScyAC_MSG_RESULT([$ntp_ok])
2672280849Scy
2673200576SrobertoAC_MSG_CHECKING([WWV receiver])
2674280849ScyAC_ARG_ENABLE(
2675280849Scy    [WWV],
2676280849Scy    [AS_HELP_STRING(
2677280849Scy	[--enable-WWV],
2678280849Scy	[s WWV Audio receiver]
2679280849Scy    )],
2680181834Sroberto    [ntp_ok=$enableval],
2681280849Scy    [
2682280849Scy	case "$ntp_eac$ntp_canaudio" in
2683280849Scy	 *no*)	ntp_ok=no  ;;
2684280849Scy	 *)	ntp_ok=yes ;;
2685280849Scy	esac
2686280849Scy    ]
2687280849Scy)
2688280849Scycase "$ntp_ok" in
2689280849Scy yes)
2690181834Sroberto    ntp_refclock=yes
2691280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2692280849Scy    ;;
2693280849Scyesac
2694280849ScyAC_MSG_RESULT([$ntp_ok])
2695181834Srobertocase "$ntp_ok$ntp_canaudio" in
2696280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2697181834Srobertoesac
2698181834Sroberto
2699200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2700280849ScyAC_ARG_ENABLE(
2701280849Scy    [ZYFER],
2702280849Scy    [AS_HELP_STRING(
2703280849Scy	[--enable-ZYFER],
2704280849Scy	[+ Zyfer GPStarplus receiver]
2705280849Scy    )],
2706280849Scy    [ntp_ok=$enableval],
2707280849Scy    [ntp_ok=$ntp_eac]
2708280849Scy)
2709280849Scycase "$ntp_ok" in
2710280849Scy yes)
2711181834Sroberto    ntp_refclock=yes
2712280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2713280849Scy    ;;
2714280849Scyesac
2715280849ScyAC_MSG_RESULT([$ntp_ok])
2716181834Sroberto
2717200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2718280849ScyAC_ARG_ENABLE(
2719280849Scy    [parse-clocks],
2720280849Scy    [AS_HELP_STRING(
2721280849Scy	[--enable-parse-clocks],
2722280849Scy	[- include all suitable PARSE clocks:]
2723280849Scy    )],
2724181834Sroberto    [ntp_eapc=$enableval],
2725280849Scy    [
2726280849Scy	case "$ntp_eac" in
2727280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2728280849Scy	 *)	ntp_eapc=no ;;
2729280849Scy	esac
2730280849Scy	# Delete the next line one of these days
2731280849Scy	ntp_eapc=no
2732280849Scy    ]
2733280849Scy)
2734181834SrobertoAC_MSG_RESULT($ntp_eapc)
2735181834Sroberto
2736181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2737181834Sroberto noyes*)
2738200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2739181834Sroberto    ;;
2740181834Sroberto yesyesno)
2741200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2742181834Sroberto    ;;
2743181834Srobertoesac
2744181834Sroberto
2745181834Srobertontp_libparse=no
2746181834Srobertontp_parseutil=no
2747181834Srobertontp_rawdcf=no
2748181834Sroberto
2749200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2750280849ScyAC_ARG_ENABLE(
2751280849Scy    [COMPUTIME],
2752280849Scy    [AS_HELP_STRING(
2753280849Scy	[--enable-COMPUTIME],
2754280849Scy	[s Diem Computime Radio Clock]
2755280849Scy    )],
2756280849Scy    [ntp_ok=$enableval],
2757280849Scy    [ntp_ok=$ntp_eapc]
2758280849Scy)
2759280849Scycase "$ntp_ok" in
2760280849Scy yes)
2761181834Sroberto    ntp_libparse=yes
2762181834Sroberto    ntp_refclock=yes
2763280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2764280849Scy    ;;
2765280849Scyesac
2766280849ScyAC_MSG_RESULT([$ntp_ok])
2767181834Srobertocase "$ntp_ok$ntp_canparse" in
2768181834Sroberto yesno)
2769200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2770181834Srobertoesac
2771181834Sroberto
2772200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2773280849ScyAC_ARG_ENABLE(
2774280849Scy    [DCF7000],
2775280849Scy    [AS_HELP_STRING(
2776280849Scy	[--enable-DCF7000],
2777280849Scy	[s ELV/DCF7000 clock]
2778280849Scy    )],
2779280849Scy    [ntp_ok=$enableval],
2780280849Scy    [ntp_ok=$ntp_eapc]
2781280849Scy)
2782280849Scycase "$ntp_ok" in
2783280849Scy yes)
2784181834Sroberto    ntp_libparse=yes
2785181834Sroberto    ntp_refclock=yes
2786280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2787280849Scy    ;;
2788280849Scyesac
2789280849ScyAC_MSG_RESULT([$ntp_ok])
2790181834Srobertocase "$ntp_ok$ntp_canparse" in
2791181834Sroberto yesno)
2792200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2793181834Srobertoesac
2794181834Sroberto
2795200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2796280849ScyAC_ARG_ENABLE(
2797280849Scy    [HOPF6021],
2798280849Scy    [AS_HELP_STRING(
2799280849Scy	[--enable-HOPF6021],
2800280849Scy	[s HOPF 6021 clock]
2801280849Scy    )],
2802280849Scy    [ntp_ok=$enableval],
2803280849Scy    [ntp_ok=$ntp_eapc]
2804280849Scy)
2805280849Scycase "$ntp_ok" in
2806280849Scy yes)
2807181834Sroberto    ntp_libparse=yes
2808181834Sroberto    ntp_refclock=yes
2809280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2810280849Scy    ;;
2811280849Scyesac
2812280849ScyAC_MSG_RESULT([$ntp_ok])
2813181834Srobertocase "$ntp_ok$ntp_canparse" in
2814181834Sroberto yesno)
2815200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2816181834Srobertoesac
2817181834Sroberto
2818200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2819280849ScyAC_ARG_ENABLE(
2820280849Scy    [MEINBERG],
2821280849Scy    [AS_HELP_STRING(
2822280849Scy	[--enable-MEINBERG],
2823280849Scy	[s Meinberg clocks]
2824280849Scy    )],
2825280849Scy    [ntp_ok=$enableval],
2826280849Scy    [ntp_ok=$ntp_eapc]
2827280849Scy)
2828280849Scycase "$ntp_ok" in
2829280849Scy yes)
2830181834Sroberto    ntp_libparse=yes
2831181834Sroberto    ntp_refclock=yes
2832280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2833280849Scy    ;;
2834280849Scyesac
2835280849ScyAC_MSG_RESULT([$ntp_ok])
2836181834Srobertocase "$ntp_ok$ntp_canparse" in
2837181834Sroberto yesno)
2838200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2839181834Srobertoesac
2840181834Sroberto
2841200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2842280849ScyAC_ARG_ENABLE(
2843280849Scy    [RAWDCF],
2844280849Scy    [AS_HELP_STRING(
2845280849Scy	[--enable-RAWDCF],
2846280849Scy	[s DCF77 raw time code]
2847280849Scy    )],
2848280849Scy    [ntp_ok=$enableval],
2849280849Scy    [ntp_ok=$ntp_eapc]
2850280849Scy)
2851280849Scycase "$ntp_ok" in
2852280849Scy yes)
2853181834Sroberto    ntp_libparse=yes
2854181834Sroberto    ntp_parseutil=yes
2855181834Sroberto    ntp_refclock=yes
2856181834Sroberto    ntp_rawdcf=yes
2857280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2858280849Scy    ;;
2859280849Scyesac
2860280849ScyAC_MSG_RESULT([$ntp_ok])
2861181834Srobertocase "$ntp_ok$ntp_canparse" in
2862181834Sroberto yesno)
2863280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2864181834Srobertoesac
2865181834Sroberto
2866181834Srobertocase "$ntp_rawdcf" in
2867181834Sroberto yes)
2868200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2869280849Scy	[ntp_cv_rawdcf_parity],
2870280849Scy	[
2871280849Scy	    ans=no
2872280849Scy	    case "$host" in
2873280849Scy	     *-*-*linux*)
2874280849Scy		ans=yes
2875280849Scy		;;
2876280849Scy	    esac
2877280849Scy	    ntp_cv_rawdcf_parity=$ans
2878280849Scy	]
2879280849Scy    )
2880280849Scy    case "$ntp_cv_rawdcf_parity" in
2881280849Scy     yes)
2882280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2883280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2884181834Sroberto    esac
2885181834Srobertoesac
2886181834Sroberto
2887200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2888280849ScyAC_ARG_ENABLE(
2889280849Scy    [RCC8000],
2890280849Scy    [AS_HELP_STRING(
2891280849Scy	[--enable-RCC8000],
2892280849Scy	[s RCC 8000 clock]
2893280849Scy    )],
2894280849Scy    [ntp_ok=$enableval],
2895280849Scy    [ntp_ok=$ntp_eapc]
2896280849Scy)
2897280849Scycase "$ntp_ok" in
2898280849Scy yes)
2899181834Sroberto    ntp_libparse=yes
2900181834Sroberto    ntp_refclock=yes
2901280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
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([Schmid DCF77 clock])
2911280849ScyAC_ARG_ENABLE(
2912280849Scy    [SCHMID],
2913280849Scy    [AS_HELP_STRING(
2914280849Scy	[--enable-SCHMID ],
2915280849Scy	[s Schmid DCF77 clock]
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_SCHMID], [1], [Schmid DCF77 clock])
2925280849Scy    ;;
2926280849Scyesac
2927280849ScyAC_MSG_RESULT([$ntp_ok])
2928181834Srobertocase "$ntp_ok$ntp_canparse" in
2929181834Sroberto yesno)
2930280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2931181834Srobertoesac
2932181834Sroberto
2933200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2934280849ScyAC_ARG_ENABLE(
2935280849Scy    [TRIMTAIP],
2936280849Scy    [AS_HELP_STRING(
2937280849Scy	[--enable-TRIMTAIP],
2938280849Scy	[s Trimble GPS receiver/TAIP protocol]
2939280849Scy    )],
2940280849Scy    [ntp_ok=$enableval],
2941280849Scy    [ntp_ok=$ntp_eapc]
2942280849Scy)
2943280849Scycase "$ntp_ok" in
2944280849Scy yes)
2945181834Sroberto    ntp_libparse=yes
2946181834Sroberto    ntp_refclock=yes
2947280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2948280849Scy	[Trimble GPS receiver/TAIP protocol])
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!])
2955181834Srobertoesac
2956181834Sroberto
2957200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2958280849ScyAC_ARG_ENABLE(
2959280849Scy    [TRIMTSIP],
2960280849Scy    [AS_HELP_STRING(
2961280849Scy	[--enable-TRIMTSIP],
2962280849Scy	[s Trimble GPS receiver/TSIP protocol]
2963280849Scy    )],
2964280849Scy    [ntp_ok=$enableval],
2965280849Scy    [ntp_ok=$ntp_eapc]
2966280849Scy)
2967280849Scycase "$ntp_ok" in
2968280849Scy yes)
2969181834Sroberto    ntp_libparse=yes
2970181834Sroberto    ntp_refclock=yes
2971280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2972280849Scy	[Trimble GPS receiver/TSIP protocol])
2973280849Scy    ;;
2974280849Scyesac
2975280849ScyAC_MSG_RESULT([$ntp_ok])
2976181834Srobertocase "$ntp_ok$ntp_canparse" in
2977181834Sroberto yesno)
2978280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2979181834Srobertoesac
2980181834Sroberto
2981200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2982280849ScyAC_ARG_ENABLE(
2983280849Scy    [WHARTON],
2984280849Scy    [AS_HELP_STRING(
2985280849Scy	[--enable-WHARTON],
2986280849Scy	[s WHARTON 400A Series clock]
2987280849Scy    )],
2988280849Scy    [ntp_ok=$enableval],
2989280849Scy    [ntp_ok=$ntp_eapc]
2990280849Scy)
2991280849Scycase "$ntp_ok" in
2992280849Scy yes)
2993181834Sroberto    ntp_libparse=yes
2994181834Sroberto    ntp_refclock=yes
2995280849Scy    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2996280849Scy    ;;
2997280849Scyesac
2998280849ScyAC_MSG_RESULT([$ntp_ok])
2999181834Srobertocase "$ntp_ok$ntp_canparse" in
3000181834Sroberto yesno)
3001280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3002280849Scyesac
3003280849Scy
3004280849ScyAC_MSG_CHECKING([VARITEXT clock])
3005280849ScyAC_ARG_ENABLE(
3006280849Scy    [VARITEXT],
3007280849Scy    [AS_HELP_STRING(
3008280849Scy	[--enable-VARITEXT],
3009280849Scy	[s VARITEXT clock]
3010280849Scy    )],
3011280849Scy    [ntp_ok=$enableval],
3012280849Scy    [ntp_ok=$ntp_eapc]
3013280849Scy)
3014280849Scycase "$ntp_ok" in
3015280849Scy yes)
3016280849Scy    ntp_libparse=yes
3017280849Scy    ntp_refclock=yes
3018280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
3019181834Sroberto    ;;
3020181834Srobertoesac
3021280849ScyAC_MSG_RESULT([$ntp_ok])
3022280849Scycase "$ntp_ok$ntp_canparse" in
3023280849Scy yesno)
3024280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3025280849Scyesac
3026181834Sroberto
3027280849ScyAC_MSG_CHECKING(SEL240X clock)
3028280849ScyAC_ARG_ENABLE(SEL240X,
3029280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
3030181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3031181834Srobertoif test "$ntp_ok" = "yes"; then
3032181834Sroberto    ntp_libparse=yes
3033181834Sroberto    ntp_refclock=yes
3034280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
3035181834Srobertofi
3036181834SrobertoAC_MSG_RESULT($ntp_ok)
3037181834Srobertocase "$ntp_ok$ntp_canparse" in
3038181834Sroberto yesno)
3039280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3040181834Sroberto    ;;
3041181834Srobertoesac
3042280849Scy
3043280849ScyAC_SUBST([LIBPARSE])
3044280849ScyAC_SUBST([MAKE_LIBPARSE])
3045280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
3046280849ScyAC_SUBST([MAKE_CHECK_Y2K])
3047280849Scy
3048200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3049181834Srobertoans=no
3050181834Srobertocase "$ntp_libparse" in
3051181834Sroberto yes)
3052181834Sroberto    ans=yes
3053280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3054181834Sroberto    LIBPARSE=../libparse/libparse.a
3055181834Sroberto    MAKE_LIBPARSE=libparse.a
3056181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3057181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3058181834Srobertoesac
3059200576SrobertoAC_MSG_RESULT([$ans])
3060181834Sroberto
3061280849ScyNTP_OPENSSL
3062181834Sroberto
3063280849ScyNTP_CRYPTO_RAND
3064181834Sroberto
3065280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3066280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3067280849ScyAC_ARG_ENABLE(
3068280849Scy    [autokey],
3069280849Scy    AS_HELP_STRING(
3070280849Scy	[--enable-autokey],
3071280849Scy	[+ support NTP Autokey protocol]
3072280849Scy	),
3073280849Scy    [ntp_autokey=$enableval],
3074280849Scy    [ntp_autokey=$ntp_openssl]
3075280849Scy)
3076280849Scycase "$ntp_autokey" in
3077280849Scy no)
3078181834Sroberto    ;;
3079280849Scy *)
3080280849Scy    case "$ntp_openssl" in
3081181834Sroberto     no)
3082280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3083280849Scy	ntp_autokey=no
3084181834Sroberto	;;
3085280849Scy     *)
3086280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3087280849Scy	ntp_autokey=yes
3088181834Sroberto	;;
3089181834Sroberto    esac
3090181834Sroberto    ;;
3091181834Srobertoesac
3092280849ScyAC_MSG_RESULT([$ntp_autokey])
3093181834Sroberto
3094280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3095200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3096181834Srobertocase "$cross_compiling$PATH_PERL" in
3097181834Sroberto no/*)
3098181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3099181834Sroberto    ans=yes
3100181834Sroberto    ;;
3101181834Sroberto *)
3102181834Sroberto    ans=no
3103181834Sroberto    ;;
3104181834Srobertoesac
3105200576SrobertoAC_MSG_RESULT([$ans])
3106181834Sroberto
3107280849ScyAC_SUBST([TESTDCF])
3108280849ScyAC_SUBST([DCFD])
3109200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3110181834Srobertoans=no
3111280849Scycase "$ntp_parseutil" in
3112280849Scy yes)
3113181834Sroberto    case "$host" in
3114200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3115181834Sroberto	ans="dcfd testdcf"
3116181834Sroberto	DCFD=dcfd
3117280849Scy	TESTDCF=testdcf
3118181834Sroberto    esac
3119280849Scy    ;;
3120280849Scyesac
3121200576SrobertoAC_MSG_RESULT([$ans])
3122181834Sroberto
3123280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3124200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3125181834Srobertoans=no
3126181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3127181834Sroberto yesyes)
3128181834Sroberto    case "$host" in
3129181834Sroberto     sparc-*-sunos4*)
3130280849Scy        case "$ntp_cv_var_kernel_pll" in
3131181834Sroberto	yes)
3132280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3133181834Sroberto	    ;;
3134181834Sroberto	esac
3135181834Sroberto	ans=parsestreams
3136181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3137181834Sroberto	;;
3138181834Sroberto     sparc-*-solaris2*)
3139181834Sroberto	ans=parsesolaris
3140181834Sroberto	MAKE_PARSEKMODULE=parse
3141280849Scy	AC_CHECK_HEADERS([strings.h])
3142181834Sroberto	;;
3143181834Sroberto    esac
3144181834Sroberto    ;;
3145181834Srobertoesac
3146200576SrobertoAC_MSG_RESULT([$ans])
3147181834Sroberto
3148200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3149280849Scycase "$ntp_refclock" in
3150280849Scy yes)
3151280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3152280849Scy    ;;
3153280849Scyesac
3154181834SrobertoAC_MSG_RESULT($ntp_refclock)
3155181834Sroberto
3156280849Scydnl Things that can be made in clockstuff
3157280849ScyAC_SUBST([PROPDELAY], [propdelay])
3158280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3159181834Sroberto
3160280849ScyAC_SUBST([MAKE_ADJTIMED])
3161280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3162181834Srobertocase "$host" in
3163181834Sroberto *-*-hpux[[56789]]*)
3164181834Sroberto    ans=yes
3165181834Sroberto    ;;
3166181834Sroberto *) ans=no
3167181834Sroberto    ;;
3168181834Srobertoesac
3169280849Scycase "$ans" in
3170280849Scy yes)
3171181834Sroberto    MAKE_ADJTIMED=adjtimed
3172280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3173280849Scy	[Do we need HPUX adjtime() library support?])
3174280849Scy    ;;
3175280849Scy *) ADJTIMED_DB=
3176280849Scy    ADJTIMED_DL=
3177280849Scy    ADJTIMED_DS=
3178280849Scy    ADJTIMED_MS=
3179280849Scy    ;;
3180280849Scyesac
3181200576SrobertoAC_MSG_RESULT([$ans])
3182181834Sroberto
3183200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3184181834Srobertocase "$host" in
3185181834Sroberto *-*-qnx*)
3186181834Sroberto    ans=yes
3187181834Sroberto    ;;
3188181834Sroberto *) ans=no
3189181834Sroberto    ;;
3190181834Srobertoesac
3191280849Scycase "$ans" in
3192280849Scy yes)
3193280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3194280849Scy	[Do we need the qnx adjtime call?])
3195280849Scy    ;;
3196280849Scyesac
3197200576SrobertoAC_MSG_RESULT([$ans])
3198181834Sroberto
3199200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3200181834Sroberto
3201200576Sroberto#  the default is to enable it if the system has the capability
3202200576Sroberto
3203200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3204200576Sroberto *yes*)
3205200576Sroberto    ans=yes
3206200576Sroberto    ;;
3207200576Sroberto *) ans=no
3208280849Scy    ;;
3209181834Srobertoesac
3210181834Sroberto
3211200576Srobertocase "$host" in
3212200576Sroberto *-*-domainos)	# Won't be found...
3213200576Sroberto    ans=no
3214200576Sroberto    ;;
3215200576Sroberto *-*-hpux*)
3216200576Sroberto    #ans=no
3217200576Sroberto    ;;
3218200576Sroberto *-*-irix[[456]]*)
3219200576Sroberto    ans=no
3220200576Sroberto    ;;
3221200576Sroberto *-*-*linux*)
3222200576Sroberto    ans=no
3223200576Sroberto    ;;
3224200576Sroberto *-*-winnt3.5)
3225200576Sroberto    ans=no
3226200576Sroberto    ;;
3227200576Sroberto *-*-unicosmp*)
3228200576Sroberto    ans=no
3229200576Sroberto    ;;
3230200576Srobertoesac
3231200576Sroberto
3232200576Sroberto# --enable-kmem / --disable-kmem controls if present
3233200576SrobertoAC_ARG_ENABLE(
3234200576Sroberto    [kmem],
3235280849Scy    [AS_HELP_STRING(
3236200576Sroberto	[--enable-kmem],
3237200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3238280849Scy    )],
3239200576Sroberto    [ans=$enableval]
3240200576Sroberto)
3241200576Sroberto
3242200576SrobertoAC_MSG_RESULT([$ans])
3243200576Sroberto
3244200576Srobertocase "$ans" in
3245200576Sroberto yes)
3246200576Sroberto    can_kmem=yes
3247200576Sroberto    ;;
3248280849Scy *)
3249200576Sroberto    can_kmem=no
3250280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3251200576Srobertoesac
3252200576Sroberto
3253200576Sroberto
3254200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3255200576Sroberto
3256200576Sroberto# target-dependent defaults
3257200576Sroberto
3258200576Srobertocase "$host" in
3259200576Sroberto i386-sequent-ptx*)
3260200576Sroberto    ans=no
3261200576Sroberto    ;;
3262200576Sroberto i386-unknown-osf1*)
3263200576Sroberto    ans=yes
3264200576Sroberto    ;;
3265200576Sroberto mips-sgi-irix[[456]]*)
3266200576Sroberto    ans=yes
3267200576Sroberto    ;;
3268200576Sroberto *-fujitsu-uxp*)
3269200576Sroberto    ans=yes
3270200576Sroberto    ;;
3271280849Scy *-ibm-aix[[4-9]]*)
3272280849Scy    # XXX only verified thru AIX6.
3273200576Sroberto    ans=yes
3274200576Sroberto    ;;
3275200576Sroberto *-*-*linux*)
3276200576Sroberto    ans=yes
3277200576Sroberto    ;;
3278200576Sroberto *-*-solaris2.[[01]])
3279200576Sroberto    ans=no
3280200576Sroberto    ;;
3281200576Sroberto *-*-solaris2*)
3282200576Sroberto    ans=yes
3283200576Sroberto    ;;
3284200576Sroberto *-*-unicosmp*)
3285200576Sroberto    ans=yes
3286200576Sroberto    ;;
3287200576Sroberto *) ans=no
3288280849Scy    ;;
3289200576Srobertoesac
3290200576Sroberto
3291200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3292200576Sroberto# override the default
3293280849ScyAC_ARG_ENABLE(
3294280849Scy    [accurate-adjtime],
3295280849Scy    [AS_HELP_STRING(
3296280849Scy	[--enable-accurate-adjtime],
3297280849Scy	[s the adjtime() call is accurate]
3298280849Scy    )],
3299280849Scy    [ans=$enableval]
3300200576Sroberto)
3301200576Sroberto
3302200576SrobertoAC_MSG_RESULT([$ans])
3303200576Sroberto
3304200576Srobertocase "$ans" in
3305280849Scy yes)
3306280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3307200576Sroberto    adjtime_is_accurate=yes
3308200576Sroberto    ;;
3309200576Sroberto *)
3310200576Sroberto    adjtime_is_accurate=no
3311280849Scy    ;;
3312181834Srobertoesac
3313181834Sroberto
3314280849ScyAC_CACHE_CHECK(
3315280849Scy    [the name of 'tick' in the kernel],
3316280849Scy    [ntp_cv_nlist_tick],
3317280849Scy    [
3318280849Scy	ans=_tick
3319280849Scy	case "$host" in
3320280849Scy	 m68*-hp-hpux*) # HP9000/300?
3321280849Scy	    ans=_old_tick
3322280849Scy	    ;;
3323280849Scy	 *-apple-aux[[23]]*)
3324280849Scy	    ans=tick
3325280849Scy	    ;;
3326280849Scy	 *-hp-hpux*)
3327280849Scy	    ans=old_tick
3328280849Scy	    ;;
3329280849Scy	 *-ibm-aix[[3-9]]*)
3330280849Scy	    # XXX only verified thru AIX6.
3331280849Scy	    ans=no
3332280849Scy	    ;;
3333280849Scy	 *-*-mpeix*)
3334280849Scy	    ans=no
3335280849Scy	    ;;
3336280849Scy	 *-*-ptx*)
3337280849Scy	    ans=tick
3338280849Scy	    ;;
3339280849Scy	 *-*-sco3.2v[[45]]*)
3340280849Scy	    ans=no
3341280849Scy	    ;;
3342280849Scy	 *-*-solaris2*)
3343280849Scy	    ans=nsec_per_tick
3344280849Scy	    ;;
3345280849Scy	 *-*-sysv4*)
3346280849Scy	    ans=tick
3347280849Scy	    ;;
3348280849Scy	esac
3349280849Scy	ntp_cv_nlist_tick=$ans
3350280849Scy    ]
3351280849Scy)
3352280849Scycase "$ntp_cv_nlist_tick" in
3353280849Scy ''|no)
3354280849Scy    ;;	# HMS: I think we can only get 'no' here...
3355280849Scy *)
3356280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3357280849Scy	[What is the name of TICK in the kernel?])
3358181834Srobertoesac
3359280849Scy
3360280849ScyAC_CACHE_CHECK(
3361280849Scy    [for the units of 'tick'],
3362280849Scy    [ntp_cv_tick_nano],
3363280849Scy    [
3364280849Scy	ans=usec
3365280849Scy	case "$host" in
3366280849Scy	 *-*-solaris2*)
3367280849Scy	    ans=nsec
3368280849Scy	    ;;
3369280849Scy	esac
3370280849Scy	ntp_cv_tick_nano=$ans
3371280849Scy    ]
3372280849Scy)
3373280849Scycase "$ntp_cv_tick_nano" in
3374181834Sroberto nsec)
3375280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3376181834Srobertoesac
3377280849Scy
3378280849ScyAC_CACHE_CHECK(
3379280849Scy    [the name of 'tickadj' in the kernel],
3380280849Scy    [ntp_cv_nlist_tickadj],
3381280849Scy    [
3382280849Scy	ans=_tickadj
3383280849Scy	case "$host" in
3384280849Scy	 m68*-hp-hpux*) # HP9000/300?
3385280849Scy	    ans=_tickadj
3386280849Scy	    ;;
3387280849Scy	 *-apple-aux[[23]]*)
3388280849Scy	    ans=tickadj
3389280849Scy	    ;;
3390280849Scy	 *-hp-hpux10*)
3391280849Scy	    ans=no
3392280849Scy	    ;;
3393280849Scy	 *-hp-hpux9*)
3394280849Scy	    ans=no
3395280849Scy	    ;;
3396280849Scy	 *-hp-hpux*)
3397280849Scy	    ans=tickadj
3398280849Scy	    ;;
3399280849Scy	 *-*-aix*)
3400280849Scy	    ans=tickadj
3401280849Scy	    ;;
3402280849Scy	 *-*-mpeix*)
3403280849Scy	    ans=no
3404280849Scy	    ;;
3405280849Scy	 *-*-ptx*)
3406280849Scy	    ans=tickadj
3407280849Scy	    ;;
3408280849Scy	 *-*-sco3.2v4*)
3409280849Scy	    ans=no
3410280849Scy	    ;;
3411280849Scy	 *-*-sco3.2v5.0*)
3412280849Scy	    ans=clock_drift
3413280849Scy	    ;;
3414280849Scy	 *-*-solaris2*)
3415280849Scy	    ans=no	# hrestime_adj
3416280849Scy	    ;;
3417280849Scy	 *-*-sysv4*)
3418280849Scy	    ans=tickadj
3419280849Scy	    ;;
3420280849Scy	esac
3421280849Scy	ntp_cv_nlist_tickadj=$ans
3422280849Scy    ]
3423280849Scy)
3424280849Scycase "$ntp_cv_nlist_tickadj" in
3425280849Scy ''|no)
3426280849Scy    ;;	# HMS: I think we can only get 'no' here...
3427280849Scy *)
3428280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3429280849Scy	[What is the name of TICKADJ in the kernel?])
3430181834Srobertoesac
3431280849Scy
3432280849ScyAC_CACHE_CHECK(
3433280849Scy    [for the units of 'tickadj'],
3434280849Scy    [ntp_cv_tickadj_nano],
3435280849Scy    [
3436280849Scy	ans=usec
3437280849Scy	case "$host" in
3438280849Scy	 *-*-solaris2*)
3439280849Scy	    ans=nsec
3440280849Scy	    ;;
3441280849Scy	esac
3442280849Scy	ntp_cv_tickadj_nano=$ans
3443280849Scy    ]
3444280849Scy)
3445280849Scycase "$ntp_cv_tickadj_nano" in
3446181834Sroberto nsec)
3447280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3448181834Srobertoesac
3449280849Scy
3450280849ScyAC_CACHE_CHECK(
3451280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3452280849Scy    [ntp_cv_nlist_dosynctodr],
3453280849Scy    [
3454280849Scy	case "$host" in
3455280849Scy	 *-apple-aux[[23]]*)
3456280849Scy	    ans=no
3457280849Scy	    ;;
3458280849Scy	 *-sni-sysv*)
3459280849Scy	    ans=dosynctodr
3460280849Scy	    ;;
3461285169Scy	 *-stratus-vos)
3462285169Scy	    ans=no
3463285169Scy	    ;;
3464280849Scy	 *-*-aix*)
3465280849Scy	    ans=dosynctodr
3466280849Scy	    ;;
3467280849Scy	 *-*-hpux*)
3468280849Scy	    ans=no
3469280849Scy	    ;;
3470280849Scy	 *-*-mpeix*)
3471280849Scy	    ans=no
3472280849Scy	    ;;
3473280849Scy	 *-*-nextstep*)
3474280849Scy	    ans=_dosynctodr
3475280849Scy	    ;;
3476280849Scy	 *-*-ptx*)
3477280849Scy	    ans=doresettodr
3478280849Scy	    ;;
3479280849Scy	 *-*-sco3.2v4*)
3480280849Scy	    ans=no
3481280849Scy	    ;;
3482280849Scy	 *-*-sco3.2v5*)
3483280849Scy	    ans=track_rtc
3484280849Scy	    ;;
3485280849Scy	 *-*-solaris2*)
3486280849Scy	    ans=dosynctodr
3487280849Scy	    ;;
3488280849Scy	 *-*-sysv4*)
3489280849Scy	    ans=doresettodr
3490280849Scy	    ;;
3491280849Scy	 *)
3492280849Scy	    ans=_dosynctodr
3493280849Scy	    ;;
3494280849Scy	esac
3495280849Scy	ntp_cv_nlist_dosynctodr=$ans
3496280849Scy    ]
3497280849Scy)
3498280849Scycase "$ntp_cv_nlist_dosynctodr" in
3499280849Scy no)
3500181834Sroberto    ;;
3501181834Sroberto *)
3502280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3503280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3504181834Sroberto    ;;
3505181834Srobertoesac
3506280849Scy
3507280849ScyAC_CACHE_CHECK(
3508280849Scy    [half-heartedly for 'noprintf' in the kernel],
3509280849Scy    [ntp_cv_nlist_noprintf],
3510280849Scy    [
3511280849Scy	case "$host" in
3512280849Scy	 *-apple-aux[[23]]*)
3513280849Scy	    ans=no
3514280849Scy	    ;;
3515280849Scy	 *-sni-sysv*)
3516280849Scy	    ans=noprintf
3517280849Scy	    ;;
3518285169Scy	 *-stratus-vos)
3519285169Scy	    ans=no
3520285169Scy	    ;;
3521280849Scy	 *-*-aix*)
3522280849Scy	    ans=noprintf
3523280849Scy	    ;;
3524280849Scy	 *-*-hpux*)
3525280849Scy	    ans=no
3526280849Scy	    ;;
3527280849Scy	 *-*-mpeix*)
3528280849Scy	    ans=no
3529280849Scy	    ;;
3530280849Scy	 *-*-ptx*)
3531280849Scy	    ans=noprintf
3532280849Scy	    ;;
3533280849Scy	 *-*-nextstep*)
3534280849Scy	    ans=_noprintf
3535280849Scy	    ;;
3536280849Scy	 *-*-solaris2*)
3537280849Scy	    ans=noprintf
3538280849Scy	    ;;
3539280849Scy	 *-*-sysv4*)
3540280849Scy	    ans=noprintf
3541280849Scy	    ;;
3542280849Scy	 *)
3543280849Scy	    ans=_noprintf
3544280849Scy	    ;;
3545280849Scy	esac
3546280849Scy	ntp_cv_nlist_noprintf=$ans
3547280849Scy    ]
3548280849Scy)
3549280849Scycase "$ntp_cv_nlist_noprintf" in
3550280849Scy no)
3551181834Sroberto    ;;
3552181834Sroberto *)
3553280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3554280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3555181834Sroberto    ;;
3556181834Srobertoesac
3557181834Sroberto
3558181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3559181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3560181834Sroberto
3561280849Scydnl	tick		tickadj
3562181834Srobertodnl	10000		80	    Unixware
3563181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3564181834Srobertodnl	10000		150	    sgi IRIX
3565181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3566181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3567181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3568181834Srobertodnl	txc.tick	1	    Linux
3569181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3570181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3571181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3572181834Sroberto
3573181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3574181834Sroberto
3575200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3576200576Sroberto
3577200576Sroberto# target-dependent default for tick
3578200576Sroberto
3579200576Srobertocase "$host" in
3580200576Sroberto *-*-pc-cygwin*)
3581200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3582200576Sroberto    ;;
3583200576Sroberto *-univel-sysv*)
3584200576Sroberto    ans=10000
3585200576Sroberto    ;;
3586200576Sroberto *-*-irix*)
3587200576Sroberto    ans=10000
3588200576Sroberto    ;;
3589200576Sroberto *-*-*linux*)
3590200576Sroberto    ans=txc.tick
3591200576Sroberto    ;;
3592200576Sroberto *-*-mpeix*)
3593200576Sroberto    ans=no
3594200576Sroberto    ;;
3595200576Sroberto *-*-winnt3.5)
3596200576Sroberto    ans='(every / 10)'
3597200576Sroberto    ;;
3598200576Sroberto *-*-unicosmp*)
3599200576Sroberto    ans=10000
3600200576Sroberto    ;;
3601200576Sroberto *)
3602200576Sroberto    ans='1000000L/hz'
3603200576Sroberto    ;;
3604200576Srobertoesac
3605200576Sroberto
3606200576SrobertoAC_ARG_ENABLE(
3607200576Sroberto    [tick],
3608280849Scy    [AS_HELP_STRING(
3609200576Sroberto	[--enable-tick=VALUE],
3610200576Sroberto	[s force a value for 'tick']
3611280849Scy    )],
3612200576Sroberto    [ans=$enableval]
3613200576Sroberto)
3614200576Sroberto
3615200576SrobertoAC_MSG_RESULT([$ans])
3616200576Sroberto
3617200576Srobertocase "$ans" in
3618280849Scy ''|no)
3619280849Scy    ;;	# HMS: I think we can only get 'no' here...
3620280849Scy *)
3621280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3622280849Scy	[Preset a value for 'tick'?])
3623181834Srobertoesac
3624181834Sroberto
3625200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3626200576Sroberto
3627200576Sroberto# target-specific default
3628200576Srobertoans='500/hz'
3629200576Srobertocase "$host" in
3630200576Sroberto *-fujitsu-uxp*)
3631200576Sroberto    case "$adjtime_is_accurate" in
3632200576Sroberto     yes)
3633280849Scy	ans='tick/16'
3634200576Sroberto    esac
3635200576Sroberto    ;;
3636200576Sroberto *-univel-sysv*)
3637200576Sroberto    ans=80
3638200576Sroberto    ;;
3639200576Sroberto *-*-aix*)
3640200576Sroberto    case "$can_kmem" in
3641200576Sroberto     no)
3642200576Sroberto	ans=1000
3643280849Scy	;;
3644200576Sroberto    esac
3645200576Sroberto    ;;
3646200576Sroberto *-*-domainos)	# Skippy: won't be found...
3647200576Sroberto    case "$can_kmem" in
3648200576Sroberto     no)
3649200576Sroberto	ans=668
3650280849Scy	;;
3651200576Sroberto    esac
3652200576Sroberto    ;;
3653200576Sroberto *-*-hpux*)
3654200576Sroberto    case "$adjtime_is_accurate" in
3655200576Sroberto     yes)
3656200576Sroberto	ans='tick/16'
3657280849Scy	;;
3658200576Sroberto    esac
3659200576Sroberto    ;;
3660200576Sroberto *-*-irix*)
3661200576Sroberto    ans=150
3662200576Sroberto    ;;
3663200576Sroberto *-*-mpeix*)
3664200576Sroberto    ans=no
3665200576Sroberto    ;;
3666200576Sroberto *-*-sco3.2v5.0*)
3667200576Sroberto    ans=10000L/hz
3668200576Sroberto    ;;
3669200576Sroberto *-*-winnt3.5)
3670200576Sroberto    ans=50
3671200576Sroberto    ;;
3672200576Sroberto *-*-unicosmp*)
3673200576Sroberto    ans=150
3674280849Scy    ;;
3675200576Srobertoesac
3676200576Sroberto
3677200576SrobertoAC_ARG_ENABLE(
3678200576Sroberto    [tickadj],
3679280849Scy    [AS_HELP_STRING(
3680280849Scy	[--enable-tickadj=VALUE],
3681280849Scy	[s force a value for 'tickadj']
3682280849Scy    )],
3683200576Sroberto    [ans=$enableval]
3684200576Sroberto)
3685200576Sroberto
3686200576SrobertoAC_MSG_RESULT([$ans])
3687200576Sroberto
3688200576Srobertodefault_tickadj=$ans
3689200576Sroberto
3690200576Srobertocase "$default_tickadj" in
3691280849Scy ''|no)
3692280849Scy    ;;	# HMS: I think we can only get 'no' here...
3693280849Scy *)
3694280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3695280849Scy	[Preset a value for 'tickadj'?]) ;;
3696181834Srobertoesac
3697181834Sroberto
3698181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3699181834Sroberto# 1/100s (system tick). Sigh ...
3700181834Sroberto# Unfortunately, there is no easy way to know if particular release
3701181834Sroberto# has this "feature" or any obvious way to test for it.
3702181834Srobertocase "$host" in
3703280849Scy mips-sni-sysv4*)
3704280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3705280849Scy	[Do we want the ReliantUNIX clock hacks?])
3706181834Srobertoesac
3707181834Sroberto
3708181834Srobertocase "$host" in
3709280849Scy *-*-sco3.2v5*)
3710280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3711181834Srobertoesac
3712181834Sroberto
3713280849Scyntp_cv_make_tickadj=yes
3714200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3715181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3716200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3717280849Scy    ntp_cv_make_tickadj=no
3718181834Sroberto    ;;
3719181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3720200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3721280849Scy    ntp_cv_make_tickadj=no
3722181834Sroberto    ;;
3723181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3724200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3725280849Scy    ntp_cv_make_tickadj=no
3726181834Sroberto    ;;
3727181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3728181834Sroberto    ;;
3729181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3730181834Sroberto    ;;
3731181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3732200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3733181834Sroberto    ;;
3734181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3735181834Sroberto    ;;
3736181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3737181834Sroberto    ;;
3738181834Sroberto *)		# Generally bogus.
3739200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3740181834Sroberto    ;;
3741181834Srobertoesac
3742181834Sroberto
3743181834SrobertoAC_SUBST(MAKE_NTPTIME)
3744200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3745181834Sroberto[case "$host" in
3746280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3747181834Sroberto     yesyes)
3748181834Sroberto	ans=yes
3749181834Sroberto	;;
3750181834Sroberto     *)
3751181834Sroberto	ans=no
3752181834Sroberto	;;
3753181834Sroberto    esac
3754181834Sroberto    ;;
3755181834Srobertoesac
3756181834Srobertoac_cv_make_ntptime=$ans])
3757181834Srobertocase "$ac_cv_make_ntptime" in
3758181834Sroberto yes)
3759181834Sroberto    MAKE_NTPTIME=ntptime
3760181834Sroberto    ;;
3761280849Scy *)
3762280849Scy    NTPTIME_DB=
3763280849Scy    NTPTIME_DL=
3764280849Scy    NTPTIME_DS=
3765280849Scy    NTPTIME_MS=
3766280849Scy    ;;
3767181834Srobertoesac
3768181834Sroberto
3769280849ScyAC_SUBST([MAKE_TICKADJ])
3770181834Srobertocase "$host" in
3771181834Sroberto mips-sni-sysv4*)
3772181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3773181834Sroberto    # Do not bother
3774280849Scy    ntp_cv_make_tickadj=no
3775181834Sroberto    ;;
3776181834Sroberto *-*-irix*)
3777280849Scy    ntp_cv_make_tickadj=no
3778181834Sroberto    ;;
3779181834Sroberto *-*-solaris2*)
3780181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3781181834Sroberto    case "$host" in
3782181834Sroberto     *-*-solaris2.1[[0-9]]*)
3783280849Scy	ntp_cv_make_tickadj=no
3784181834Sroberto	;;
3785181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3786280849Scy     *) ntp_cv_make_tickadj=no ;;
3787181834Sroberto    esac
3788181834Sroberto    ;;
3789181834Sroberto *-*-unicosmp*)
3790280849Scy    ntp_cv_make_tickadj=no
3791181834Sroberto    ;;
3792181834Srobertoesac
3793200576Sroberto
3794200576Sroberto#
3795200576Sroberto# Despite all the above, we always make tickadj.  Setting
3796280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3797200576Sroberto# report that the configuration variable was cached.  It may
3798200576Sroberto# be better to simply remove the hunk above, I did not want
3799200576Sroberto# to remove it if there is hope it will be used again.
3800200576Sroberto#
3801280849ScyAS_UNSET([ntp_cv_make_tickadj])
3802200576Sroberto
3803280849ScyAC_CACHE_CHECK(
3804280849Scy    [if we want and can make the tickadj utility],
3805280849Scy    [ntp_cv_make_tickadj],
3806280849Scy    [ntp_cv_make_tickadj=yes]
3807280849Scy)
3808280849Scycase "$ntp_cv_make_tickadj" in
3809181834Sroberto yes)
3810181834Sroberto    MAKE_TICKADJ=tickadj
3811181834Sroberto    ;;
3812280849Scy *)
3813280849Scy    CALC_TICKADJ_DB=
3814280849Scy    CALC_TICKADJ_DL=
3815280849Scy    CALC_TICKADJ_DS=
3816280849Scy    CALC_TICKADJ_MS=
3817280849Scy    TICKADJ_DB=
3818280849Scy    TICKADJ_DL=
3819280849Scy    TICKADJ_DS=
3820280849Scy    TICKADJ_MS=
3821280849Scy    ;;
3822181834Srobertoesac
3823181834Sroberto
3824280849ScyAC_SUBST([MAKE_TIMETRIM])
3825280849ScyAC_CACHE_CHECK(
3826280849Scy    [if we want and can make the timetrim utility],
3827280849Scy    [ntp_cv_make_timetrim],
3828280849Scy    [
3829280849Scy	case "$host" in
3830280849Scy	 *-*-irix*)
3831280849Scy	    ntp_cv_make_timetrim=yes
3832280849Scy	    ;;
3833280849Scy	 *-*-unicosmp*)
3834280849Scy	    ntp_cv_make_timetrim=yes
3835280849Scy	    ;;
3836280849Scy	 *)
3837280849Scy	    ntp_cv_make_timetrim=no
3838280849Scy	    ;;
3839280849Scy	esac
3840280849Scy    ]
3841280849Scy)
3842280849Scycase "$ntp_cv_make_timetrim" in
3843181834Sroberto yes)
3844181834Sroberto    MAKE_TIMETRIM=timetrim
3845181834Sroberto    ;;
3846280849Scy *) TIMETRIM_DB=
3847280849Scy    TIMETRIM_DL=
3848280849Scy    TIMETRIM_DS=
3849280849Scy    TIMETRIM_MS=
3850280849Scy    ;;
3851181834Srobertoesac
3852181834Sroberto
3853280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3854280849ScyAC_SUBST([MAKE_NTPDSIM])
3855200576Sroberto
3856200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3857200576SrobertoAC_ARG_ENABLE(
3858200576Sroberto    [simulator],
3859280849Scy    [AS_HELP_STRING(
3860200576Sroberto	[--enable-simulator],
3861200576Sroberto	[- build/install the NTPD simulator?]
3862280849Scy    )],
3863280849Scy    [ans=$enableval],
3864200576Sroberto    [ans=no]
3865200576Sroberto)
3866200576SrobertoAC_MSG_RESULT([$ans])
3867200576Srobertocase "$ans" in
3868181834Sroberto yes)
3869181834Sroberto    MAKE_NTPDSIM=ntpdsim
3870181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3871181834Sroberto    ;;
3872280849Scy *)
3873280849Scy    NTPDSIM_DB=
3874280849Scy    NTPDSIM_DL=
3875280849Scy    NTPDSIM_DS=
3876280849Scy    NTPDSIM_MS=
3877280849Scy    ;;
3878181834Srobertoesac
3879181834Sroberto
3880181834Srobertocase "$build" in
3881181834Sroberto $host)
3882181834Sroberto    ;;
3883181834Sroberto *) case "$host" in
3884181834Sroberto     *-*-vxworks*)
3885200576Sroberto	LDFLAGS="$LDFLAGS -r"
3886200576Sroberto	;;
3887181834Sroberto    esac
3888181834Sroberto    ;;
3889181834Srobertoesac
3890181834Sroberto
3891280849ScyNTP_WITHSNTP
3892200576Sroberto
3893280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3894280849ScyAC_ARG_WITH(
3895280849Scy    [ntpsnmpd],
3896280849Scy    [AS_HELP_STRING(
3897280849Scy	[--with-ntpsnmpd],
3898280849Scy	[s Build ntpsnmpd MIB agent?]
3899280849Scy    )],
3900280849Scy    [ans=$withval],
3901280849Scy    [
3902280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3903280849Scy	 /*)	ans=yes ;;
3904280849Scy	 *)	ans=no  ;;
3905280849Scy	esac
3906280849Scy    ]
3907280849Scy)
3908280849ScyAC_MSG_RESULT([$ans])
3909280849Scycase "$ans" in
3910280849Scy yes)
3911280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3912280849Scy     /*)
3913280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3914285169Scy	# Bug 2815.  This is a bit of a hack, but it works...
3915285169Scy	case "$ntp_cv_net_snmp_version" in
3916285169Scy	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3917285169Scy		;;
3918285169Scy	esac
3919280849Scy	AC_SUBST([SNMP_LIBS])
3920280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3921280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3922280849Scy	SNMP_CPPFLAGS=
3923280849Scy	SNMP_CFLAGS=
3924280849Scy	for i in $foo; do
3925280849Scy	    case "$i" in
3926280849Scy	     -D*|-U*|-I*)
3927280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3928280849Scy		;;
3929280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3930280849Scy		;;
3931280849Scy	    esac
3932280849Scy	done
3933280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3934280849Scy	AC_SUBST([SNMP_CFLAGS])
3935280849Scy
3936280849Scy	save_CFLAGS=$CFLAGS
3937280849Scy	save_CPPFLAGS=$CPPFLAGS
3938280849Scy	save_LIBS=$LIBS
3939280849Scy	CFLAGS=$SNMP_CFLAGS
3940280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3941280849Scy
3942280849Scy	AC_CHECK_HEADER(
3943280849Scy	    [net-snmp/net-snmp-config.h],
3944280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3945280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3946280849Scy	)
3947280849Scy
3948280849Scy	# Do this last, as we're messing up LIBS.
3949280849Scy	# check -lnetsnmp for netsnmp_daemonize
3950280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3951280849Scy	AC_CHECK_LIB(
3952280849Scy	    [netsnmp],
3953280849Scy	    [netsnmp_daemonize],
3954280849Scy	    [ans=yes],
3955280849Scy	    [ans=no]
3956280849Scy	)
3957280849Scy	case "$ans" in
3958280849Scy	 no)
3959280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3960280849Scy		[We need to provide netsnmp_daemonize()])
3961280849Scy	esac
3962280849Scy	
3963280849Scy	CFLAGS=$save_CFLAGS
3964280849Scy	AS_UNSET([save_CFLAGS])
3965280849Scy	CPPFLAGS=$save_CPPFLAGS
3966280849Scy	AS_UNSET([save_CPPFLAGS])
3967280849Scy	LIBS=$save_LIBS
3968280849Scy	AS_UNSET([save_LIBS])
3969280849Scy	;;
3970280849Scy     *) 
3971280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3972280849Scy	;;
3973280849Scy    esac
3974280849Scy    ;;
3975280849Scyesac
3976280849ScyAC_SUBST([MAKE_NTPSNMPD])
3977280849Scy
3978280849Scycase "$MAKE_NTPSNMPD" in
3979280849Scy '')
3980280849Scy    NTPSNMPD_DB=
3981280849Scy    NTPSNMPD_DL=
3982280849Scy    NTPSNMPD_DS=
3983280849Scy    NTPSNMPD_MS=
3984280849Scy    ;;
3985280849Scyesac
3986280849Scy
3987200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3988200576Sroberto
3989200576Sroberto# target-specific defaults
3990200576Sroberto
3991200576Srobertocase "$host" in
3992200576Sroberto *-apple-aux[[23]]*)
3993200576Sroberto    ans=yes
3994200576Sroberto    ;;
3995200576Sroberto *-*-bsdi[[012]]*)
3996200576Sroberto    ans=no
3997200576Sroberto    ;;
3998200576Sroberto *-*-bsdi*)
3999200576Sroberto    ans=yes
4000200576Sroberto    ;;
4001200576Sroberto *-*-openvms*)	# HMS: won't be found
4002200576Sroberto    ans=yes
4003200576Sroberto    ;;
4004200576Sroberto *) ans=no
4005200576Sroberto    ;;
4006200576Srobertoesac
4007200576Sroberto
4008200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
4009200576Sroberto
4010200576SrobertoAC_ARG_ENABLE(
4011200576Sroberto    [slew-always],
4012280849Scy    [AS_HELP_STRING(
4013200576Sroberto	[--enable-slew-always],
4014200576Sroberto	[s always slew the time]
4015280849Scy    )],
4016200576Sroberto    [ans=$enableval]
4017200576Sroberto)
4018200576Sroberto
4019200576SrobertoAC_MSG_RESULT([$ans])
4020200576Sroberto
4021200576Srobertocase "$ans" in
4022280849Scy yes)
4023280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
4024181834Srobertoesac
4025181834Sroberto
4026200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
4027200576Sroberto
4028200576Srobertocase "$host" in
4029200576Sroberto *-sni-sysv*)
4030200576Sroberto    ans=yes
4031200576Sroberto    ;;
4032285169Scy *-stratus-vos)
4033285169Scy    ans=no
4034285169Scy    ;;
4035200576Sroberto *-univel-sysv*)
4036200576Sroberto    ans=no
4037200576Sroberto    ;;
4038200576Sroberto *-*-ptx*)
4039200576Sroberto    ans=yes
4040200576Sroberto    ;;
4041200576Sroberto *-*-solaris2.1[[0-9]]*)
4042200576Sroberto    ans=no
4043200576Sroberto    ;;
4044200576Sroberto *-*-solaris2.[[012]]*)
4045200576Sroberto    ans=yes
4046200576Sroberto    ;;
4047200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4048200576Sroberto    ans=yes
4049200576Sroberto    ;;
4050200576Sroberto *) ans=no
4051200576Sroberto    ;;
4052200576Srobertoesac
4053200576Sroberto
4054200576SrobertoAC_ARG_ENABLE(
4055200576Sroberto    [step-slew],
4056280849Scy    [AS_HELP_STRING(
4057200576Sroberto	[--enable-step-slew],
4058200576Sroberto	[s step and slew the time]
4059280849Scy    )],
4060200576Sroberto    [ans=$enableval]
4061200576Sroberto)
4062200576Sroberto
4063200576SrobertoAC_MSG_RESULT([$ans])
4064200576Sroberto
4065200576Srobertocase "$ans" in
4066280849Scy yes)
4067280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4068181834Srobertoesac
4069181834Sroberto
4070200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4071200576Sroberto
4072200576Srobertocase "$host" in
4073200576Sroberto *-apple-aux[[23]]*)
4074200576Sroberto    ans=yes
4075200576Sroberto    ;;
4076200576Sroberto *) ans=no
4077280849Scy    ;;
4078200576Srobertoesac
4079200576Sroberto
4080200576SrobertoAC_ARG_ENABLE(
4081200576Sroberto    [ntpdate-step],
4082280849Scy    [AS_HELP_STRING(
4083200576Sroberto	[--enable-ntpdate-step],
4084200576Sroberto	[s if ntpdate should step the time]
4085280849Scy    )],
4086200576Sroberto    [ans=$enableval]
4087200576Sroberto)
4088200576Sroberto
4089200576SrobertoAC_MSG_RESULT([$ans])
4090200576Sroberto
4091200576Srobertocase "$ans" in
4092280849Scy yes)
4093280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4094280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4095181834Srobertoesac
4096181834Sroberto
4097200576Sroberto
4098200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4099200576Sroberto
4100200576Srobertocase "$host" in
4101200576Sroberto *-*-nextstep*)
4102200576Sroberto    ans=yes
4103200576Sroberto    ;;
4104200576Sroberto *-*-openvms*)	# HMS: won't be found
4105200576Sroberto    ans=yes
4106200576Sroberto    ;;
4107200576Sroberto *)
4108200576Sroberto    ans=no
4109280849Scy    ;;
4110200576Srobertoesac
4111200576Sroberto
4112200576SrobertoAC_ARG_ENABLE(
4113200576Sroberto    [hourly-todr-sync],
4114280849Scy    [AS_HELP_STRING(
4115200576Sroberto	[--enable-hourly-todr-sync],
4116200576Sroberto	[s if we should sync TODR hourly]
4117280849Scy    )],
4118200576Sroberto    [ans=$enableval]
4119200576Sroberto)
4120200576Sroberto
4121200576SrobertoAC_MSG_RESULT([$ans])
4122200576Sroberto
4123181834Srobertocase "$ac_cv_var_sync_todr" in
4124280849Scy yes)
4125280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4126181834Srobertoesac
4127181834Sroberto
4128181834Sroberto
4129200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4130200576Sroberto
4131200576Srobertocase "$host" in
4132200576Sroberto *-*-solaris2.6)
4133200576Sroberto    unamev=`uname -v`
4134200576Sroberto    case "$unamev" in
4135200576Sroberto     Generic_105181-*)
4136200576Sroberto	old_IFS="$IFS"
4137200576Sroberto	IFS="-"
4138200576Sroberto	set $unamev
4139200576Sroberto	IFS="$old_IFS"
4140200576Sroberto	if test "$2" -ge 17
4141200576Sroberto	then
4142200576Sroberto	    # Generic_105181-17 and higher
4143200576Sroberto	    ans=no
4144200576Sroberto	else
4145200576Sroberto	    ans=yes
4146200576Sroberto	fi
4147200576Sroberto	;;
4148280849Scy     *)
4149181834Sroberto	ans=yes
4150280849Scy	;;
4151200576Sroberto    esac
4152200576Sroberto    ;;
4153200576Sroberto *-*-solaris2.7)
4154200576Sroberto    unamev=`uname -v`
4155200576Sroberto    case "$unamev" in
4156200576Sroberto     Generic_106541-*)
4157200576Sroberto	old_IFS="$IFS"
4158200576Sroberto	IFS="-"
4159200576Sroberto	set $unamev
4160200576Sroberto	IFS="$old_IFS"
4161200576Sroberto	if test "$2" -ge 07
4162200576Sroberto	then
4163200576Sroberto	    # Generic_106541-07 and higher
4164200576Sroberto	    ans=no
4165200576Sroberto	else
4166200576Sroberto	    ans=yes
4167200576Sroberto	fi
4168181834Sroberto	;;
4169200576Sroberto     *)
4170181834Sroberto	ans=yes
4171280849Scy	;;
4172181834Sroberto    esac
4173200576Sroberto    ;;
4174200576Sroberto *)
4175200576Sroberto    ans=no
4176280849Scy    ;;
4177200576Srobertoesac
4178200576Sroberto
4179200576SrobertoAC_ARG_ENABLE(
4180200576Sroberto    [kernel-fll-bug],
4181280849Scy    [AS_HELP_STRING(
4182200576Sroberto	[--enable-kernel-fll-bug],
4183200576Sroberto	[s if we should avoid a kernel FLL bug]
4184280849Scy    )],
4185200576Sroberto    [ans=$enableval]
4186200576Sroberto)
4187200576Sroberto
4188200576SrobertoAC_MSG_RESULT([$ans])
4189200576Sroberto
4190200576Srobertocase "$ans" in
4191280849Scy yes)
4192280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4193200576Srobertoesac
4194200576Sroberto
4195200576Sroberto
4196280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4197280849ScyAC_ARG_ENABLE(
4198280849Scy    [bug1243-fix],
4199280849Scy    [AS_HELP_STRING(
4200280849Scy	[--enable-bug1243-fix],
4201280849Scy	[+ use unmodified autokey session keys]
4202280849Scy    )],
4203280849Scy    [ans=$enableval],
4204280849Scy    [ans=yes]
4205280849Scy)
4206280849ScyAC_MSG_RESULT([$ans])
4207280849Scycase "$ans" in
4208280849Scy no)
4209280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4210280849Scy	[use old autokey session key behavior?])
4211280849Scyesac
4212280849Scy
4213280849Scy
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
4378285169ScyNTP_UNITYBUILD
4379285169Scy
4380280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4381280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4382280849Scydnl  can't be conditionalized.
4383280849ScyNTP_GOOGLETEST
4384200576Sroberto
4385181834Sroberto###
4386181834Sroberto
4387280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4388280849Scy    [Default location of crypto key info])
4389181834Sroberto
4390280849ScyAC_CONFIG_FILES([Makefile])
4391280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4392280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4393280849ScyAC_CONFIG_FILES([include/Makefile])
4394280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4395280849ScyAC_CONFIG_FILES([kernel/Makefile])
4396280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4397280849ScyAC_CONFIG_FILES([libntp/Makefile])
4398280849ScyAC_CONFIG_FILES([libparse/Makefile])
4399280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4400285169ScyAC_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])
4401280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4402280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4403280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4404280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4405280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4406280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4407280849ScyAC_CONFIG_FILES([scripts/Makefile])
4408282408ScyAC_CONFIG_FILES([scripts/build/Makefile])
4409282408ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4410282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4411282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4412280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4413282408ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4414280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4415282408ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4416280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4417282408ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4418280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4419280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4420280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4421280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4422282408ScyAC_CONFIG_FILES([scripts/update-leap/Makefile])
4423285169ScyAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4424280849ScyAC_CONFIG_FILES([tests/Makefile])
4425285169ScyAC_CONFIG_FILES([tests/bug-2803/Makefile])
4426280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4427280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4428285169ScyAC_CONFIG_FILES([tests/sandbox/Makefile])
4429285169ScyAC_CONFIG_FILES([tests/sec-2853/Makefile])
4430280849ScyAC_CONFIG_FILES([util/Makefile])
4431181834Sroberto
4432280849Scyperllibdir="${datadir}/ntp/lib"
4433280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4434181834Sroberto
4435280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4436280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4437280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4438280849ScyAC_SUBST_FILE([ntp_wait_opts])
4439280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4440280849ScyAC_SUBST_FILE([ntpsweep_opts])
4441280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4442280849ScyAC_SUBST_FILE([ntptrace_opts])
4443280849Scysummary_opts="$srcdir/scripts/summary-opts"
4444280849ScyAC_SUBST_FILE([summary_opts])
4445280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4446280849ScyAC_SUBST_FILE([plot_summary_opts])
4447280849Scy
4448280849ScyAC_CONFIG_SUBDIRS([sntp])
4449280849Scy
4450181834SrobertoAC_OUTPUT
4451