1280849Scydnl NTP top-level configure.ac				-*- Autoconf -*-
2280849Scydnl
3280849Scym4_include([sntp/m4/version.m4])
4280849ScyAC_PREREQ([2.61])
5280849ScyAC_INIT(
6280849Scy    [ntp],
7280849Scy    [VERSION_NUMBER],
8280849Scy    [http://bugs.ntp.org./],
9280849Scy    [],
10280849Scy    [http://www.ntp.org./]dnl
11280849Scy)
12280849ScyAC_CONFIG_MACRO_DIR([sntp/m4])
13280849ScyAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14289764SglebiusAC_LANG([C])
15280849Scy
16280849ScyAC_PRESERVE_HELP_ORDER
17280849Scy
18280849Scy# Bump ntp_configure_cache_version for each change to configure.ac or
19280849Scy# .m4 files which invalidates cached values from previous configure 
20280849Scy# runs.
21280849Scy#
22280849Scy# If the change affects cache variables used only by the main NTP
23280849Scy# configure.ac, then only its version number should be bumped, while
24280849Scy# the subdir configure.ac version numbers should be unchanged.  The
25280849Scy# same is true for a test/variable that is used only by one subdir
26280849Scy# being changed incompatibly; only that subdir's cache version needs
27280849Scy# bumping.
28280849Scy#
29280849Scy# If a change affects variables shared by all NTP configure scripts,
30280849Scy# please bump the version numbers of each.  If you are not sure, the
31280849Scy# safe choice is to bump all on any cache-invalidating change.
32280849Scy#
33280849Scy# In order to avoid the risk of version stamp collision between -stable
34280849Scy# and -dev branches, do not simply increment the version, instead use
35280849Scy# the date YYYYMMDD optionally with -HHMM if there is more than one
36280849Scy# bump in a day.
37280849Scy
38280849Scyntp_configure_cache_version=20120806
39280849Scy
40280849Scy# When the cache version of config.cache and configure do not
41280849Scy# match, NTP_CACHEVERSION will flush the cache.
42280849Scy
43280849ScyNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44280849Scy
45280849ScyAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
46280849Scy
47280849Scydnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48280849Scym4_ifdef(
49280849Scy    [AM_SILENT_RULES],
50280849Scy    [AM_SILENT_RULES([yes])]
51280849Scy)
52280849ScyAC_CANONICAL_BUILD
53181834SrobertoAC_CANONICAL_HOST
54181834Srobertodnl the 'build' machine is where we run configure and compile
55181834Srobertodnl the 'host' machine is where the resulting stuff runs.
56280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57280849Scy    [canonical system (cpu-vendor-os) of where we should run])
58280849ScyAC_CONFIG_HEADERS([config.h])
59181834Srobertodnl AC_ARG_PROGRAM
60181834Sroberto
61280849Scyntp_atom_ok=${ntp_atom_ok=no}
62280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
63280849Scyntp_parse_ok=${ntp_parse_ok=no}
64280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
65280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
66181834Sroberto
67280849ScyNTP_PROG_CC
68316722SdelphijNTP_COMPILER
69316722Sdelphij
70316722Sdelphijdnl # Do we need CXX for anything besides google test?
71316722Sdelphijdnl AC_PROG_CXX
72280849ScyAC_PROG_YACC
73316722Sdelphijdnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
74282408ScyAX_C99_STRUCT_INIT
75181834Sroberto
76316722SdelphijNTP_HARDEN([sntp])
77316722Sdelphij
78280849ScyNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
79181834Sroberto
80280849ScyNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
81280849Scy
82280849Scydnl AM_PROG_AR req. automake 1.12
83280849Scym4_ifdef(
84280849Scy    [AM_PROG_AR],
85280849Scy    [AM_PROG_AR]
86280849Scy)
87280849Scy
88200576Sroberto# So far, the only shared library we might use is libopts.
89200576Sroberto# It's a small library - we might as well use a static version of it.
90200576SrobertoAC_DISABLE_SHARED
91280849ScyAC_PROG_LIBTOOL
92280849ScyAC_SUBST([LIBTOOL_DEPS])
93200576Sroberto
94280849Scy# NTP has (so far) been relying on leading-edge autogen, which
95280849Scy# means we need the appropriate corresponding libopts as well.
96181834Sroberto# Therefore, by default:
97280849Scy# - use the version of libopts we ship with
98181834Sroberto# - do not install it
99181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
100181834Srobertocase "${enable_local_libopts+set}" in
101181834Sroberto set) ;;
102181834Sroberto *) enable_local_libopts=yes ;;
103181834Srobertoesac
104181834Srobertocase "${enable_libopts_install+set}" in
105181834Sroberto set) ;;
106181834Sroberto *) enable_libopts_install=no ;;
107181834Srobertoesac
108280849Scyenable_nls=no
109280849ScyLIBOPTS_CHECK_NOBUILD([sntp/libopts])
110181834Sroberto
111280849ScyNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
112181834Sroberto
113280849ScyNTP_LIBNTP
114181834Sroberto
115280849ScyAC_MSG_CHECKING([for deprecated --with-arlib])
116280849ScyAC_ARG_WITH([arlib],
117280849Scy	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
118181834Sroberto	[ans=$withval], [ans=no])
119200576SrobertoAC_MSG_RESULT([$ans])
120181834Sroberto
121181834Srobertocase "$ans" in
122181834Sroberto yes)
123280849Scy    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
124181834Sroberto    ;;
125181834Srobertoesac
126181834Sroberto
127181834Srobertodnl  we need to check for cross compile tools for vxWorks here
128181834SrobertoAC_PROG_AWK
129280849ScyAS_UNSET([ac_cv_prog_AWK])
130280849ScyAC_SUBST([AWK])				dnl scripts/ntpver.in
131181834SrobertoAC_PROG_MAKE_SET
132181834Sroberto
133280849ScyAC_SUBST([CFLAGS])
134280849ScyAC_SUBST([LDFLAGS])
135181834Sroberto
136280849ScyAC_PROG_LN_S
137280849ScyAC_ISC_POSIX
138181834Sroberto
139181834Sroberto
140280849ScyAC_PATH_PROG([PATH_PERL], [perl])
141280849Scydnl  Saving cached hardcoded paths rather than searching $PATH during a
142280849Scydnl  cached configure run is an optimization not worth the the cost of
143280849Scydnl  preventing newly-installed tools from being found.  Short-circuit
144280849Scydnl  the caching after the tests so preset overrides still work.
145280849ScyAS_UNSET([ac_cv_path_PATH_PERL])
146280849ScyAC_PATH_PROG([PATH_TEST], [test])
147280849ScyAS_UNSET([ac_cv_path_PATH_TEST])
148280849Scytest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
149280849ScyAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
150181834Sroberto
151280849ScyAC_ARG_WITH(
152280849Scy    [net-snmp-config],
153280849Scy    [AS_HELP_STRING(
154280849Scy	[--with-net-snmp-config],
155280849Scy	[+ =net-snmp-config]
156280849Scy    )],
157280849Scy    [ans=$withval],
158280849Scy    [ans=yes]
159280849Scy)
160280849Scycase "$ans" in
161280849Scy no)
162181834Sroberto    ;;
163280849Scy yes)
164280849Scy    ans=net-snmp-config
165181834Sroberto    ;;
166280849Scy /*)
167181834Sroberto    ;;
168280849Scy */*)
169280849Scy    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
170181834Sroberto    ;;
171280849Scy *)
172280849Scy    ;;
173181834Srobertoesac
174280849ScyPROG_NET_SNMP_CONFIG=$ans
175280849Scycase "$PROG_NET_SNMP_CONFIG" in
176280849Scy no) ;;
177280849Scy /*)
178280849Scy    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
179181834Sroberto    ;;
180280849Scy *)
181280849Scy    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
182280849Scy    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
183280849Scy;;
184181834Srobertoesac
185316722SdelphijAC_MSG_CHECKING([for net-snmp-config path])
186280849ScyAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
187181834Sroberto
188285169Scycase "$PATH_NET_SNMP_CONFIG" in
189285169Scy /*)	AC_CACHE_CHECK(
190285169Scy	    [for net-snmp version],
191285169Scy	    [ntp_cv_net_snmp_version],
192285169Scy	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
193285169Scy	)
194285169Scy	;;
195285169Scyesac
196285169Scy
197181834Srobertocase "$host" in
198181834Sroberto *-*-vxworks*)
199181834Sroberto    ac_link="$ac_link $VX_KERNEL"
200181834Sroberto    ;;
201181834Srobertoesac
202181834Sroberto
203280849Scy# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
204280849ScyAC_SEARCH_LIBS([openlog], [gen syslog])
205280849Scy# XXX library list will be in ac_cv_search_openlog
206181834Sroberto
207280849Scy# LIBSECCOMP is off by default -- needs testing with all the features
208280849Scy# Please send bug reports to loganaden@gmail.com
209280849ScyAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
210280849ScyAC_ARG_ENABLE(
211280849Scy    [libseccomp],
212280849Scy    [AS_HELP_STRING(
213280849Scy	[--enable-libseccomp],
214280849Scy	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
215280849Scy    )],
216280849Scy    [ntp_ok=$enableval],
217280849Scy    [ntp_ok=no]
218280849Scy)
219280849ScyAC_MSG_RESULT([$ntp_ok])
220280849Scycase "$ntp_ok" in
221280849Scy yes)
222280849Scy    AC_SEARCH_LIBS(
223280849Scy	[seccomp_init],
224280849Scy	[seccomp],
225280849Scy	[AC_DEFINE([LIBSECCOMP], [1],
226280849Scy	    [Define to any value to include libseccomp sandboxing.])]
227280849Scy    )
228280849Scy    AC_TRY_RUN([
229280849Scy	#include <stdio.h>
230280849Scy	#include <stdlib.h>
231280849Scy	#include <errno.h>
232280849Scy	#include <sys/prctl.h>
233280849Scy	#include <linux/seccomp.h>
234280849Scy
235280849Scy	int main(void)
236280849Scy	{
237280849Scy		int ret;
238280849Scy		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
239280849Scy		if (ret < 0) {
240280849Scy			switch (errno) {
241280849Scy			case ENOSYS:
242280849Scy				return 1;
243280849Scy			case EINVAL:
244280849Scy				return 1;
245280849Scy			default:
246280849Scy				return 1;
247280849Scy			}
248280849Scy		}
249280849Scy		ret = 
250280849Scy		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
251280849Scy		if (ret < 0) {
252280849Scy			switch (errno) {
253280849Scy			case EINVAL:
254280849Scy				return 1;
255280849Scy			case EFAULT:
256280849Scy				return 0;
257280849Scy			default:
258280849Scy				return 1;
259280849Scy		}
260280849Scy	}
261280849Scyreturn 1;
262280849Scy}
263280849Scy]
264280849Scy, AC_DEFINE([KERN_SECCOMP], 1, 
265280849Scy[Define to use libseccomp system call filtering.])   
266280849Scy, []
267280849Scy)
268181834Sroberto    ;;
269181834Srobertoesac
270181834Sroberto
271280849ScyNTP_FACILITYNAMES
272200576Sroberto
273181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
274181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
275181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
276181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
277181834Srobertodnl real-time library, so we don't want to use it.
278280849Scydnl
279280849Scydnl 081118 Harlan got tired of looking for a way to get the sched*()
280280849Scydnl functions to link OK with either cc or gcc.
281181834Sroberto
282181834Srobertocase "$host" in
283200576Sroberto *-*-*linux*) ;;
284280849Scy *-*-osf4*) ;;
285280849Scy *-*-osf5*) ;;
286181834Sroberto *)
287280849Scy    # HMS: Make sure we check for -lrt for clock_* before this...
288280849Scy    case "$ac_cv_search_clock_gettime" in
289280849Scy     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
290280849Scy    esac
291280849Scy    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
292181834Sroberto    ;;
293181834Srobertoesac
294181834Sroberto
295280849ScyAC_CHECK_HEADERS([bstring.h])
296280849ScyAC_CHECK_HEADER(
297280849Scy    [dns_sd.h],
298280849Scy    [AC_SEARCH_LIBS(
299280849Scy	[DNSServiceRegister],
300280849Scy	[dns_sd],
301280849Scy	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
302280849Scy	    [Use Rendezvous/DNS-SD registration])]
303280849Scy    )]
304280849Scy)
305280849ScyAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
306181834Sroberto
307280849ScyAC_CHECK_HEADERS([memory.h netdb.h poll.h])
308298695SdelphijAC_CHECK_HEADERS([sgtty.h stdatomic.h])
309298695SdelphijAC_HEADER_STDBOOL
310298695SdelphijAC_CHECK_HEADERS([stdlib.h string.h termio.h])
311280849ScyAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
312181834Sroberto
313181834Srobertocase "$host" in
314181834Sroberto *-*-aix*)
315280849Scy    AC_CHECK_HEADERS([utmpx.h])
316181834Sroberto    case "$ac_cv_header_utmpx_h" in
317280849Scy     yes)
318280849Scy	;;
319280849Scy     *)
320280849Scy	AC_CHECK_HEADERS([utmp.h])
321280849Scy	;;
322181834Sroberto    esac
323181834Sroberto    ;;
324280849Scy *)
325280849Scy    AC_CHECK_HEADERS([utmp.h utmpx.h])
326280849Scy    ;;
327181834Srobertoesac
328280849Scy
329280849Scy#
330280849Scy# On Suns only (so far) getpass() truncates the typed password to 8
331280849Scy# characters, but getpassphrase() allows up to 257.  Most systems'
332280849Scy# getpass() does not truncate, at least not so as to affect ntpq and
333280849Scy# ntpdc password prompts.
334280849Scy#
335280849Scy# So check for getpassphrase(), but only on Sun operating systems.
336280849Scy#
337280849Scycase "$host" in
338280849Scy *-*-sunos*|*-*-solaris*)
339280849Scy    AC_CHECK_FUNCS([getpassphrase])
340280849Scyesac
341280849Scy
342280849Scy
343280849ScyAC_CHECK_HEADERS([net/if6.h])
344280849ScyAC_CHECK_HEADERS([net/route.h], [], [], [
345280849Scy    #include <sys/types.h>
346280849Scy    #include <sys/socket.h>
347280849Scy    #include <net/if.h>
348181834Sroberto])
349200576Sroberto
350280849ScyAC_CHECK_HEADERS([netinfo/ni.h])
351280849Scycase "$ac_cv_header_netinfo_ni_h" in
352200576Sroberto yes)
353280849Scy    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
354200576Srobertoesac
355280849ScyAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
356181834Srobertocase "$host" in
357280849Scy *-*-sunos4*)
358181834Sroberto    ;;
359280849Scy *)
360280849Scy    AC_CHECK_HEADERS([sys/ioctl.h])
361280849Scy    ;;
362181834Srobertoesac
363280849ScyAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
364181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
365280849ScyAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
366181834Srobertocase "$ac_cv_header_sched_h" in
367280849Scy yes)
368181834Sroberto    ;;
369280849Scy *)
370280849Scy    AC_CHECK_HEADERS([sys/sched.h])
371280849Scy    ;;
372181834Srobertoesac
373181834Sroberto# HMS: Check sys/shm.h after some others
374280849ScyAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
375181834Sroberto# HMS: Checked sys/socket.h earlier
376181834Srobertocase "$host" in
377280849Scy *-*-netbsd*)
378181834Sroberto    ;;
379280849Scy *)
380280849Scy    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
381280849Scy    ;;
382181834Srobertoesac
383280849ScyAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
384280849ScyAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
385181834Srobertocase "$host" in
386181834Sroberto*-convex-*)
387280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
388280849Scy    ;;
389181834Sroberto*-*-bsdi*)
390280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
391280849Scy    ;;
392181834Srobertoesac
393181834Sroberto
394285169Scycase "$ac_cv_header_stdatomic_h" in
395285169Scy yes)
396285169Scy	AC_CHECK_FUNCS([atomic_thread_fence])
397285169Scy	AC_CACHE_CHECK(
398285169Scy	    [for atomic_thread_fence()],
399285169Scy	    [ntp_cv_func_atomic_thread_fence],
400285169Scy	    [AC_COMPILE_IFELSE(
401285169Scy		[AC_LANG_PROGRAM(
402285169Scy		    [[
403285169Scy			#include <stdatomic.h>
404285169Scy		    ]],
405285169Scy		    [[
406285169Scy			atomic_thread_fence(memory_order_seq_cst);
407285169Scy		    ]]
408285169Scy		)]
409285169Scy		[ntp_cv_func_atomic_thread_fence=yes],
410285169Scy		[ntp_cv_func_atomic_thread_fence=no]
411285169Scy	    )]
412285169Scy	)
413285169Scy    ;;
414285169Scyesac
415285169Scy
416181834Srobertocase "$host" in
417280849Scy *-*-solaris2.6)
418280849Scy    # Broken...
419181834Sroberto    ;;
420181834Sroberto *)
421280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
422181834Sroberto    ;;
423181834Srobertoesac
424181834Sroberto
425280849Scycase "$host" in
426280849Scy *-*-*linux*)
427280849Scy    case "$ac_cv_func_ntp_gettime" in
428280849Scy     yes)
429280849Scy	;;
430280849Scy     *)
431280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
432280849Scy	case "$ac_cv_func___ntp_gettime" in
433280849Scy	 yes)
434280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
435280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
436280849Scy	esac
437280849Scy	;;
438280849Scy    esac
439280849Scy    AC_CHECK_FUNCS([adjtimex])
440280849Scy    case "$ac_cv_func_adjtimex" in
441280849Scy     yes)
442280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
443280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
444280849Scy	have_adjtimex=1
445280849Scy	;;
446280849Scy     *)
447280849Scy	AC_CHECK_FUNCS([__adjtimex])
448280849Scy	case "$ac_cv_func___adjtimex" in
449280849Scy	 yes)
450280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
451280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
452280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
453280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
454280849Scy	    have_adjtimex=1
455280849Scy	esac
456280849Scy	;;
457280849Scy    esac
458280849Scyesac
459280849Scycase "$have_adjtimex" in
460280849Scy '')
461280849Scy    # nlist stuff is only needed for tickadj.
462280849Scy    saved_LIBS="$LIBS"
463280849Scy    LIBS=
464280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
465280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
466280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
467280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
468280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
469280849Scy    case "$ac_cv_header_nlist_h" in
470280849Scy     yes)
471280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
472280849Scy	AC_CACHE_CHECK(
473280849Scy	    [for n_un in struct nlist],
474280849Scy	    [ntp_cv_struct_nlist_n_un],
475280849Scy	    [AC_COMPILE_IFELSE(
476280849Scy		[AC_LANG_PROGRAM(
477280849Scy		    [[
478280849Scy			#include <nlist.h>
479280849Scy		    ]],
480280849Scy		    [[
481280849Scy			struct nlist n;
482280849Scy			n.n_un.n_name = 0;
483280849Scy		    ]]
484280849Scy		)]
485280849Scy		[ntp_cv_struct_nlist_n_un=yes],
486280849Scy		[ntp_cv_struct_nlist_n_un=no]
487280849Scy	    )]
488280849Scy	)
489280849Scy	case "$ntp_cv_struct_nlist_n_un" in
490280849Scy	 yes)
491280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
492280849Scy		[does struct nlist use a name union?])
493280849Scy	esac
494280849Scy    esac
495280849Scy    AC_SUBST([LDADD_NLIST])
496280849Scy    LDADD_NLIST="$LIBS"
497280849Scy    LIBS="$saved_LIBS"
498280849Scy    AS_UNSET([saved_LIBS])
499280849Scyesac
500181834Sroberto
501280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
502280849Scy    #ifdef HAVE_SYS_TYPES_H
503280849Scy    # include <sys/types.h>
504280849Scy    #endif
505280849Scy    #ifdef HAVE_SYS_TIME_H
506280849Scy    # include <sys/time.h>
507280849Scy    #endif
508181834Sroberto])
509181834Sroberto
510280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
511280849Scy    #ifdef HAVE_SYS_TIME_H
512280849Scy    # include <sys/time.h>
513280849Scy    #endif
514181834Sroberto])
515181834Sroberto
516280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
517280849Scy    #ifdef HAVE_SYS_TYPES_H
518280849Scy    # include <sys/types.h>
519280849Scy    #endif
520280849Scy    #ifdef HAVE_SYS_IPC_H
521280849Scy    # include <sys/ipc.h>
522280849Scy    #endif
523181834Sroberto])
524181834Sroberto
525280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
526280849Scy    #ifdef HAVE_SYS_TIME_H
527280849Scy    # include <sys/time.h>
528280849Scy    #endif
529181834Sroberto])
530181834Sroberto
531181834SrobertoAC_TYPE_SIGNAL
532181834SrobertoAC_TYPE_OFF_T
533280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
534181834Sroberto
535280849ScyAC_CACHE_CHECK(
536280849Scy    [for a fallback value for HZ],
537280849Scy    [ntp_cv_default_hz],
538280849Scy    [
539280849Scy	ntp_cv_default_hz=100
540280849Scy	case "$host" in
541280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
542280849Scy	    ntp_cv_default_hz=1024
543280849Scy	    ;;
544280849Scy	 mips-dec-ultrix4*)
545280849Scy	    ntp_cv_default_hz=256
546280849Scy	    ;;
547280849Scy	esac
548280849Scy    ]
549280849Scy)
550280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
551280849Scy    [What is the fallback value for HZ?])
552181834Sroberto
553280849ScyAC_CACHE_CHECK(
554280849Scy    [if we need to override the system's value for HZ],
555280849Scy    [ntp_cv_override_hz],
556280849Scy    [
557280849Scy	ntp_cv_override_hz=no
558280849Scy	case "$host" in
559280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
560280849Scy	    ntp_cv_override_hz=yes
561280849Scy	    ;;
562280849Scy	 mips-dec-ultrix4*)
563280849Scy	    ntp_cv_override_hz=yes
564280849Scy	    ;;
565280849Scy	 *-*-freebsd*)
566280849Scy	    ntp_cv_override_hz=yes
567280849Scy	    ;;
568280849Scy	 *-*-sunos4*)
569280849Scy	    ntp_cv_override_hz=yes
570280849Scy	    ;;
571280849Scy	 *-*-kfreebsd*)
572280849Scy	    ntp_cv_override_hz=yes
573280849Scy	    ;;
574280849Scy	esac
575280849Scy    ]
576280849Scy)
577280849Scycase "$ntp_cv_override_hz" in
578181834Sroberto yes)
579280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
580280849Scy	[Do we need to override the system's idea of HZ?])
581181834Srobertoesac
582181834Sroberto
583181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
584181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
585181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
586181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
587181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
588181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
589181834Srobertodnl fi
590181834Sroberto
591181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
592181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
593181834Srobertodnl [AC_EGREP_CPP(yes,
594181834Srobertodnl [#ifdef HAVE_UTMPX_H
595181834Srobertodnl #include <utmpx.h>
596181834Srobertodnl #else
597181834Srobertodnl #include <utmp.h>
598181834Srobertodnl #endif
599181834Srobertodnl #ifdef BOOT_TIME
600181834Srobertodnl yes
601181834Srobertodnl #endif
602181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
603181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
604181834Sroberto
605280849ScyAC_CACHE_CHECK(
606280849Scy    [for struct rt_msghdr],
607280849Scy    [ntp_cv_struct_rt_msghdr],
608280849Scy    [AC_COMPILE_IFELSE(
609280849Scy	[AC_LANG_PROGRAM(
610280849Scy	    [[
611280849Scy		#include <sys/types.h>
612280849Scy		#include <sys/socket.h>
613280849Scy		#include <net/if.h>
614280849Scy		#include <net/route.h>
615280849Scy	    ]],
616280849Scy	    [[
617280849Scy		struct rt_msghdr p;
618280849Scy	    ]]
619280849Scy	)],
620280849Scy	[ntp_cv_struct_rt_msghdr=yes],
621280849Scy	[ntp_cv_struct_rt_msghdr=no]
622280849Scy    )]
623280849Scy)
624200576Sroberto
625181834SrobertoAC_CACHE_CHECK(
626280849Scy    [for struct rtattr],
627280849Scy    [ntp_cv_rtattr],
628280849Scy    [AC_COMPILE_IFELSE(
629280849Scy	[AC_LANG_PROGRAM(
630280849Scy	    [[
631280849Scy		#include <stddef.h>
632280849Scy		#include <sys/socket.h>
633280849Scy		#include <linux/rtnetlink.h>
634280849Scy	    ]],
635280849Scy	    [[
636280849Scy		struct rtattr p;
637280849Scy	    ]]
638280849Scy	)],
639280849Scy	[ntp_cv_rtattr=yes],
640280849Scy	[ntp_cv_rtattr=no]
641280849Scy    )]
642181834Sroberto)
643181834Sroberto
644280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
645280849Scy *yes*)
646280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
647280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
648280849Scy    case "$ntp_cv_rtattr" in
649280849Scy     yes)
650280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
651280849Scy	    [Do we have Linux routing socket?])
652181834Sroberto    esac
653280849Scyesac
654181834Sroberto
655280849ScyAC_CACHE_CHECK(
656280849Scy    [struct sigaction for sa_sigaction],
657280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
658280849Scy    [AC_COMPILE_IFELSE(
659280849Scy	[AC_LANG_PROGRAM(
660280849Scy	    [[
661280849Scy		#include <signal.h>
662280849Scy	    ]],
663280849Scy	    [[
664280849Scy		struct sigaction act;
665280849Scy		act.sa_sigaction = 0;
666280849Scy	    ]]
667280849Scy	)],
668280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
669280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
670280849Scy    )]
671280849Scy)
672280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
673280849Scy yes)
674280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
675280849Scyesac
676181834Sroberto
677280849ScyAC_CACHE_CHECK(
678280849Scy    [for struct ppsclockev],
679280849Scy    [ntp_cv_struct_ppsclockev],
680280849Scy    [AC_COMPILE_IFELSE(
681280849Scy	[AC_LANG_PROGRAM(
682280849Scy	    [[
683280849Scy		#ifdef HAVE_SYS_TYPES_H
684280849Scy		# include <sys/types.h>
685280849Scy		#endif
686280849Scy		#ifdef HAVE_SYS_TERMIOS_H
687280849Scy		# include <sys/termios.h>
688280849Scy		#endif
689280849Scy		#ifdef HAVE_SYS_TIME_H
690280849Scy		# include <sys/time.h>
691280849Scy		#endif
692280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
693280849Scy		# include <sys/ppsclock.h>
694280849Scy		#endif
695280849Scy	    ]],
696280849Scy	    [[
697280849Scy		extern struct ppsclockev *pce;
698280849Scy		return pce->serial;
699280849Scy	    ]]
700280849Scy	)],
701280849Scy	[ntp_cv_struct_ppsclockev=yes],
702280849Scy	[ntp_cv_struct_ppsclockev=no]
703280849Scy    )]
704280849Scy)
705280849Scycase "$ntp_cv_struct_ppsclockev" in
706280849Scy yes)
707280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
708280849Scy	[Does a system header define struct ppsclockev?])
709280849Scyesac
710181834Sroberto
711181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
712181834Sroberto  *yes*)
713280849Scy    AC_CACHE_CHECK(
714280849Scy	[for struct snd_size],
715280849Scy	[ntp_cv_struct_snd_size],
716280849Scy	[AC_COMPILE_IFELSE(
717280849Scy	    [AC_LANG_PROGRAM(
718280849Scy		[[
719280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
720280849Scy		    # include <machine/soundcard.h>
721280849Scy		    #endif
722280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
723280849Scy		    # include <sys/soundcard.h>
724280849Scy		    #endif
725280849Scy		]],
726280849Scy		[[
727280849Scy		    extern struct snd_size *ss;
728280849Scy		    return ss->rec_size;
729280849Scy		]]
730280849Scy	    )],
731280849Scy	    [ntp_cv_struct_snd_size=yes],
732280849Scy	    [ntp_cv_struct_snd_size=no]
733280849Scy        )]
734280849Scy    )
735280849Scy    case "$ntp_cv_struct_snd_size" in
736280849Scy     yes)
737280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
738280849Scy	    [Do we have struct snd_size?])
739181834Sroberto    esac
740181834Srobertoesac
741181834Sroberto
742280849ScyAC_CACHE_CHECK(
743280849Scy    [struct clockinfo for hz],
744280849Scy    [ntp_cv_struct_clockinfo_has_hz],
745280849Scy    [AC_COMPILE_IFELSE(
746280849Scy	[AC_LANG_PROGRAM(
747280849Scy	    [[
748280849Scy		#include <sys/time.h>
749280849Scy	    ]],
750280849Scy	    [[
751280849Scy		extern struct clockinfo *pc;
752280849Scy		return pc->hz;
753280849Scy	    ]]
754280849Scy	)],
755280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
756280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
757280849Scy    )]
758280849Scy)
759280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
760280849Scy yes)
761280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
762280849Scyesac
763181834Sroberto
764280849ScyAC_CACHE_CHECK(
765280849Scy    [struct clockinfo for tickadj],
766280849Scy    [ntp_cv_struct_clockinfo_has_hz],
767280849Scy    [AC_COMPILE_IFELSE(
768280849Scy	[AC_LANG_PROGRAM(
769280849Scy	    [[
770280849Scy		#include <sys/time.h>
771280849Scy	    ]],
772280849Scy	    [[
773280849Scy		extern struct clockinfo *pc;
774280849Scy		return pc->tickadj;
775280849Scy	    ]]
776280849Scy	)],
777280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
778280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
779280849Scy    )]
780280849Scy)
781280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
782280849Scy yes)
783280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
784280849Scyesac
785181834Sroberto
786280849Scycase "$ntp_cv_struct_ntptimeval" in
787280849Scy yes)
788280849Scy    AC_CHECK_MEMBERS(
789280849Scy	[struct ntptimeval.time.tv_nsec],
790280849Scy	[],
791280849Scy	[],
792280849Scy	[
793280849Scy	    #ifdef HAVE_SYS_TIME_H
794280849Scy	    # include <sys/time.h>
795280849Scy	    #else
796280849Scy	    # ifdef HAVE_TIME_H
797280849Scy	    #  include <time.h>
798280849Scy	    # endif
799280849Scy	    #endif
800280849Scy	    #ifdef HAVE_SYS_TIMEX_H
801280849Scy	    # include <sys/timex.h>
802280849Scy	    #else
803280849Scy	    # ifdef HAVE_TIMEX_H
804280849Scy	    #  include <timex.h>
805280849Scy	    # endif
806280849Scy	    #endif
807280849Scy	]
808280849Scy    )
809200576Srobertoesac
810200576Sroberto
811280849Scy#### 
812181834Sroberto
813280849ScyAC_CHECK_FUNCS([arc4random_buf])
814181834Sroberto
815280849Scy#### 
816181834Sroberto
817280849Scysaved_LIBS="$LIBS"
818280849ScyLIBS="$LIBS $LDADD_LIBNTP"
819280849ScyAC_CHECK_FUNCS([daemon])
820280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
821280849ScyLIBS="$saved_LIBS"
822280849ScyAS_UNSET([saved_LIBS])
823181834Sroberto
824280849ScyAC_CHECK_FUNCS(
825280849Scy    [finite],
826280849Scy    [],
827280849Scy    [AC_CHECK_FUNCS(
828280849Scy	[isfinite],
829280849Scy	[],
830280849Scy	[
831280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
832280849Scy	    _libs=$LIBS
833280849Scy	    # XXX
834280849Scy	    LIBS="$LIBS -lm"
835280849Scy	    AC_LINK_IFELSE(
836280849Scy		[AC_LANG_PROGRAM(
837280849Scy		    [[
838280849Scy			#include <math.h>
839280849Scy		    ]],
840280849Scy		    [[
841280849Scy			float f = 0.0;
842280849Scy			isfinite(f);
843280849Scy		    ]]
844280849Scy		)],
845280849Scy		[ans=yes],
846280849Scy		[ans=no]
847280849Scy	    )
848280849Scy	    LIBS=$_libs
849280849Scy	    AC_MSG_RESULT([$ans])
850280849Scy	    case "$ans" in
851280849Scy	     yes)
852280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
853280849Scy	    esac
854280849Scy	]
855280849Scy    )]
856280849Scy)
857181834Sroberto
858280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
859181834Sroberto
860280849Scy# kvm_open() is only used by tickadj.  Also see above.
861280849Scycase "$ac_cv_header_kvm_h" in
862280849Scy yes)
863280849Scy    AC_CHECK_FUNCS([kvm_open])
864181834Sroberto    ;;
865181834Srobertoesac
866181834Sroberto
867181834Srobertocase "$host" in
868181834Sroberto *-*-sco3.2v5.0.*)
869280849Scy    # Just stubs.  Sigh.
870181834Sroberto    ;;
871280849Scy *) AC_CHECK_FUNCS([mkstemp])
872181834Sroberto    ;;
873181834Srobertoesac
874280849ScyAC_CHECK_FUNCS([mktime])
875181834Srobertocase "$host" in
876280849Scy *-*-aix[[4-9]]*)
877280849Scy    # XXX only verified thru AIX6.
878280849Scy    # Just a stub.  Sigh.
879181834Sroberto    ;;
880181834Sroberto *-*-irix[[45]]*)
881280849Scy    # Just a stub in "old" Irix.  Sigh.
882181834Sroberto    ;;
883280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
884280849Scy# *-*-*linux*)
885280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
886280849Scy#    ;;
887181834Sroberto *-*-qnx*)
888280849Scy    # Apparently there but not working in QNX.  Sigh?
889181834Sroberto    ;;
890181834Sroberto *-*-sco3.2v5.0.*)
891280849Scy    # Just a stub.  Sigh.
892181834Sroberto    ;;
893181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
894181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
895181834Sroberto    # Not easy to test for - cheat.
896280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
897280849Scy    AC_CHECK_FUNCS([mlockall])
898181834Sroberto    ;;
899280849Scy *) AC_CHECK_FUNCS([mlockall])
900181834Sroberto    ;;
901181834Srobertoesac
902280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
903181834Srobertocase "$host" in
904280849Scy *-*-aix[[4-9]]*)
905280849Scy    # XXX only verified thru AIX6.
906280849Scy    # Just a stub in AIX 4.  Sigh.
907181834Sroberto    ;;
908181834Sroberto *-*-solaris2.5*)
909280849Scy    # Just stubs in solaris2.5.  Sigh.
910181834Sroberto    ;;
911280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
912181834Sroberto    ;;
913181834Srobertoesac
914280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
915280849ScyAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
916181834Srobertocase "$host" in
917280849Scy *-*-aix[[4-9]]*)
918280849Scy    # XXX only verified thru AIX6.
919280849Scy    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-netbsd1*)
922280849Scy    # Just stubs.  Sigh.
923181834Sroberto    ;;
924181834Sroberto *-*-netbsdelf1*)
925280849Scy    # Just stubs.  Sigh.
926181834Sroberto    ;;
927181834Sroberto *-*-openbsd*)
928280849Scy    # Just stubs.  Sigh.
929181834Sroberto    ;;
930280849Scy *)
931280849Scy    AC_CHECK_FUNCS([timer_create])
932181834Sroberto    ;;
933181834Srobertoesac
934181834Sroberto
935280849ScyNTP_RLIMIT_ITEMS
936181834Sroberto
937280849Scy# some OSes prefer _exit() in forked children to exit()
938280849ScyAC_CHECK_FUNCS([_exit])
939280849Scyntp_worker_child_exit=exit
940280849Scycase "$ac_cv_func__exit::$host_os" in
941280849Scy yes::netbsd*)
942280849Scy    ntp_worker_child_exit=_exit
943280849Scy    ;;
944280849Scy yes::openbsd*)
945280849Scy    ntp_worker_child_exit=_exit
946280849Scy    ;;
947280849Scyesac
948280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
949280849Scy		   [routine worker child proc uses to exit.])
950181834Sroberto
951280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
952181834Sroberto
953280849Scy###
954181834Sroberto
955280849Scy# http://bugs.ntp.org/737
956280849Scycase "$ac_cv_func_recvmsg" in
957280849Scy yes)
958280849Scy    AC_CACHE_CHECK(
959280849Scy	[if we need extra help to define struct iovec],
960280849Scy	[ntp_cv_struct_iovec_help],
961280849Scy	[
962280849Scy	    compiled=no
963280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
964280849Scy		AC_COMPILE_IFELSE(
965280849Scy		    [AC_LANG_PROGRAM(
966280849Scy			[[
967280849Scy			    #ifdef HAVE_SYS_TYPES_H
968280849Scy			    # include <sys/types.h>
969280849Scy			    #endif
970280849Scy			    #ifdef HAVE_SYS_SOCKET_H
971280849Scy			    # include <sys/socket.h>
972280849Scy			    #endif
973280849Scy			    #if $ntp_cv_struct_iovec_help
974280849Scy			    # include <sys/uio.h>
975280849Scy			    #endif
976280849Scy			]],
977280849Scy			[[
978280849Scy			    void foo(void) {
979280849Scy				ssize_t x;
980280849Scy				int s = 0;
981280849Scy				struct iovec iov;
982280849Scy				struct msghdr mh;
983280849Scy				int flags = 0;
984181834Sroberto
985280849Scy				mh.msg_iov = &iov;
986280849Scy				x = recvmsg(s, &mh, flags);
987280849Scy			    }
988280849Scy			]]
989280849Scy		    )],
990280849Scy		    [compiled=yes ; break 1],
991280849Scy		    []
992280849Scy		)
993280849Scy	    done
994280849Scy	    case "$compiled" in
995280849Scy	     no)
996280849Scy		ntp_cv_struct_iovec_help=0
997280849Scy	    esac
998280849Scy	    AS_UNSET([compiled])
999280849Scy	]
1000280849Scy    )
1001280849Scy    case "$ntp_cv_struct_iovec_help" in
1002280849Scy     1)
1003280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1004280849Scy	    [Use sys/uio.h for struct iovec help])
1005280849Scy    esac
1006181834Srobertoesac
1007181834Sroberto
1008280849ScyAC_CACHE_CHECK(
1009280849Scy    [number of arguments taken by setpgrp()],
1010280849Scy    [ntp_cv_func_setpgrp_nargs],
1011280849Scy    [AC_COMPILE_IFELSE(
1012280849Scy	[AC_LANG_PROGRAM(
1013280849Scy	    [[
1014280849Scy		#ifdef HAVE_SYS_TYPES_H
1015280849Scy		# include <sys/types.h>
1016280849Scy		#endif
1017280849Scy		#ifdef HAVE_UNISTD_H
1018280849Scy		# include <unistd.h>
1019280849Scy		#endif
1020280849Scy	    ]],
1021280849Scy	    [[
1022280849Scy		setpgrp(0, 0);
1023280849Scy	    ]]
1024280849Scy	)],
1025280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1026280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1027280849Scy    )]
1028280849Scy)
1029280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1030280849Scy 0)
1031280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1032280849Scy	      [define if setpgrp takes 0 arguments])
1033280849Scyesac
1034181834Sroberto
1035280849ScyAC_CACHE_CHECK(
1036280849Scy    [if we need to declare 'errno'],
1037280849Scy    [ntp_cv_decl_errno],
1038280849Scy    [AC_COMPILE_IFELSE(
1039280849Scy	[AC_LANG_PROGRAM(
1040280849Scy	    [[
1041280849Scy		#ifdef HAVE_ERRNO_H
1042280849Scy		# include <errno.h>
1043280849Scy		#endif
1044280849Scy	    ]],
1045280849Scy	    [[
1046280849Scy		errno = 0;
1047280849Scy	    ]]
1048280849Scy	)],
1049280849Scy	[ntp_cv_decl_errno=no],
1050280849Scy	[ntp_cv_decl_errno=yes]
1051280849Scy    )]
1052280849Scy)
1053280849Scycase "$ntp_cv_decl_errno" in
1054280849Scy yes)
1055280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1056181834Srobertoesac
1057181834Sroberto
1058181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1059181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1060181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1061181834Srobertodnl without breaking any other platforms.
1062181834Srobertodnl
1063280849ScyAC_CACHE_CHECK(
1064280849Scy    [if we may declare 'h_errno'],
1065280849Scy    [ntp_cv_decl_h_errno],
1066280849Scy    [AC_COMPILE_IFELSE(
1067280849Scy	[AC_LANG_PROGRAM(
1068280849Scy	    [[
1069280849Scy		#include <sys/types.h>
1070280849Scy		#ifdef HAVE_NETINET_IN_H
1071280849Scy		# include <netinet/in.h>
1072280849Scy		#endif
1073280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1074280849Scy		# include <arpa/nameser.h>
1075280849Scy		#endif
1076280849Scy		#ifdef HAVE_NETDB_H
1077280849Scy		# include <netdb.h>
1078280849Scy		#endif
1079280849Scy		#ifdef HAVE_RESOLV_H
1080280849Scy		# include <resolv.h>
1081280849Scy		#endif
1082280849Scy	    ]],
1083280849Scy	    [[
1084280849Scy		extern int h_errno;
1085280849Scy	    ]]
1086280849Scy	)],
1087280849Scy	[ntp_cv_decl_h_errno=yes],
1088280849Scy	[ntp_cv_decl_h_errno=no]
1089280849Scy    )]
1090280849Scy)
1091280849Scycase "$ntp_cv_decl_h_errno" in
1092280849Scy yes)
1093280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1094181834Srobertoesac
1095181834Sroberto
1096280849ScyAC_CACHE_CHECK(
1097280849Scy    [if declaring 'syscall()' is ok],
1098280849Scy    [ntp_cv_decl_syscall],
1099280849Scy    [AC_COMPILE_IFELSE(
1100280849Scy	[AC_LANG_PROGRAM(
1101280849Scy	    [[
1102280849Scy		#ifdef HAVE_SYS_TYPES_H
1103280849Scy		# include <sys/types.h>
1104280849Scy		#endif
1105280849Scy		#ifdef HAVE_UNISTD_H
1106280849Scy		# include <unistd.h>
1107280849Scy		#endif
1108280849Scy	    ]],
1109280849Scy	    [[
1110280849Scy		extern int syscall (int, ...);
1111280849Scy	    ]]
1112280849Scy	)]
1113280849Scy	[ntp_cv_decl_syscall=yes],
1114280849Scy	[ntp_cv_decl_syscall=no]
1115280849Scy    )]
1116280849Scy)
1117280849Scycase "$ntp_cv_decl_syscall" in
1118280849Scy yes)
1119280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1120181834Srobertoesac
1121181834Sroberto
1122181834Srobertocase "$host" in
1123181834Sroberto *-*-aix4.3.*)
1124280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1125181834Sroberto    ;;
1126181834Sroberto *-*-mpeix*)
1127280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1128280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1129280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1130280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1131280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1132280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1133280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1134181834Sroberto    ;;
1135181834Sroberto *-*-osf[[45]]*)
1136280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1137280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1138181834Sroberto    ;;
1139181834Sroberto *-*-qnx*)
1140280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141181834Sroberto    ;;
1142181834Sroberto *-*-riscos4*)
1143280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1144280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1145280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1146280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1147280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1148280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1149280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1150280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1151280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1152280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1153280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1154280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1155280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1156280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1157280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1158280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1159181834Sroberto    ;;
1160181834Sroberto *-*-solaris2*)
1161280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1162280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1163181834Sroberto    case "$host" in
1164181834Sroberto     *-*-solaris2.4)
1165280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1166181834Sroberto	;;
1167181834Sroberto    esac
1168181834Sroberto    ;;
1169181834Sroberto *-*-sunos4*)
1170280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1171280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1172280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1173280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1174280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1175280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1176280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1177280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1178280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1179280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1180280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1181280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1182280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1183181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1184181834Sroberto     acc*) ;;
1185280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1186181834Sroberto	;;
1187181834Sroberto    esac
1188280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1189280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1190280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1191280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1192280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1193280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1194280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1195181834Sroberto    ;;
1196181834Sroberto *-*-ultrix4*)
1197280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1198280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1199280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1200280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1201280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1202280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1203280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1204280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1207280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1208280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1209280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1210280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1211181834Sroberto    ;;
1212181834Srobertoesac
1213181834Sroberto
1214181834Srobertocase "$host" in
1215181834Sroberto *-*-sco3.2*)
1216280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1217280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1218181834Sroberto    ;;
1219181834Srobertoesac
1220181834Sroberto
1221181834Srobertocase "$host" in
1222181834Sroberto *-*-hpux[[567]]*)
1223280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1224280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1225181834Srobertoesac
1226181834Sroberto
1227280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1228280849ScyAC_CACHE_CHECK(
1229280849Scy    [if we will open the broadcast socket],
1230280849Scy    [ntp_cv_var_open_bcast_socket],
1231280849Scy    [
1232280849Scy	ans=yes
1233280849Scy	case "$host" in
1234280849Scy	 *-*-domainos)
1235280849Scy	    ans=no
1236280849Scy	esac
1237280849Scy	ntp_cv_var_open_bcast_socket=$ans
1238280849Scy    ]
1239280849Scy)
1240280849Scycase "$ntp_cv_var_open_bcast_socket" in
1241280849Scy yes)
1242280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1243280849Scy	[Should we open the broadcast socket?])
1244181834Srobertoesac
1245181834Sroberto
1246181834Srobertocase "$host" in
1247181834Sroberto *-*-hpux*)
1248280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1249280849Scy	[Do we want the HPUX FindConfig()?])
1250181834Srobertoesac
1251181834Sroberto
1252280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1253280849ScyAC_CACHE_CHECK(
1254280849Scy    [if process groups are set with -pid],
1255280849Scy    [ntp_cv_arg_setpgrp_negpid],
1256280849Scy    [
1257280849Scy	case "$host" in
1258280849Scy	 *-*-hpux[[567]]*)
1259280849Scy	    ans=no
1260280849Scy	    ;;
1261280849Scy	 *-*-hpux*)
1262280849Scy	    ans=yes
1263280849Scy	    ;;
1264280849Scy	 *-*-*linux*)
1265280849Scy	    ans=yes
1266280849Scy	    ;;
1267280849Scy	 *-*-sunos3*)
1268280849Scy	    ans=yes
1269280849Scy	    ;;
1270280849Scy	 *-*-ultrix2*)
1271280849Scy	    ans=yes
1272280849Scy	    ;;
1273280849Scy	 *)
1274280849Scy	    ans=no
1275280849Scy	    ;;
1276280849Scy	esac
1277280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1278280849Scy    ]
1279280849Scy)
1280280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1281181834Sroberto yes)
1282280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1283280849Scy	[Do we set process groups with -pid?])
1284181834Srobertoesac
1285181834Sroberto
1286280849ScyAC_CACHE_CHECK(
1287280849Scy    [if we need a ctty for F_SETOWN],
1288280849Scy    [ntp_cv_func_ctty_for_f_setown],
1289280849Scy    [
1290280849Scy	case "$host" in
1291280849Scy	 *-*-bsdi[[23]]*)
1292280849Scy	    ans=yes
1293280849Scy	    ;;
1294280849Scy	 *-*-freebsd*)
1295280849Scy	    ans=yes
1296280849Scy	    ;;
1297280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1298280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1299280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1300280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1301280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1302280849Scy	    ans=yes
1303280849Scy	    ;;
1304280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1305280849Scy	    ans=yes
1306280849Scy	    ;;
1307280849Scy	 *-*-openbsd*)
1308280849Scy	    ans=yes
1309280849Scy	    ;;
1310280849Scy	 *-*-osf*)
1311280849Scy	    ans=yes
1312280849Scy	    ;;
1313280849Scy	 *-*-darwin*)
1314280849Scy	    ans=yes
1315280849Scy	    ;;
1316280849Scy	 *)
1317280849Scy	    ans=no
1318280849Scy	    ;;
1319280849Scy	esac
1320280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1321280849Scy    ]
1322280849Scy)
1323280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1324181834Sroberto yes)
1325280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1326181834Srobertoesac
1327181834Sroberto
1328280849ScyAC_CACHE_CHECK(
1329280849Scy    [if the OS clears cached routes when more specifics become available],
1330280849Scy    [ntp_cv_os_routeupdates],
1331280849Scy    [
1332280849Scy	case "$host" in
1333280849Scy	 *-*-netbsd*)
1334280849Scy	    ans=yes
1335280849Scy	    ;;
1336280849Scy	 *)
1337280849Scy	    ans=no
1338280849Scy	    ;;
1339280849Scy	esac
1340280849Scy	ntp_cv_os_routeupdates=$ans
1341280849Scy    ]
1342280849Scy)
1343280849Scycase "$ntp_cv_os_routeupdates" in
1344181834Sroberto yes)
1345280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1346280849Scy	[need to recreate sockets on changed routing?])
1347181834Srobertoesac
1348181834Sroberto
1349280849ScyAC_CACHE_CHECK(
1350280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1351280849Scy    [ntp_cv_os_wildcardreuse],
1352280849Scy    [
1353280849Scy	case "$host" in
1354280849Scy	 *-*-*linux*)
1355280849Scy	    ans=yes
1356280849Scy	    ;;
1357280849Scy	 *) ans=no
1358280849Scy	    ;;
1359280849Scy	esac
1360280849Scy	ntp_cv_os_wildcardreuse=$ans
1361280849Scy    ]
1362280849Scy)
1363280849Scycase "$ntp_cv_os_wildcardreuse" in
1364181834Sroberto yes)
1365280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1366280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1367181834Srobertoesac
1368181834Sroberto
1369181834Srobertocase "$host" in
1370181834Sroberto *-*-aix*)
1371280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1372280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1373181834Srobertoesac
1374181834Sroberto
1375280849ScyAC_CACHE_CHECK(
1376280849Scy    [for a minimum recommended value of tickadj],
1377280849Scy    [ntp_cv_var_min_rec_tickadj],
1378280849Scy    [
1379280849Scy	ans=no
1380280849Scy	case "$host" in
1381280849Scy	 *-*-aix*)
1382280849Scy	    ans=40
1383280849Scy	    ;;
1384280849Scy	esac
1385280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1386280849Scy    ]
1387280849Scy)
1388280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1389280849Scy ''|no)
1390181834Sroberto    ;;
1391280849Scy *)
1392280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1393280849Scy	[Should we recommend a minimum value for tickadj?])
1394181834Srobertoesac
1395280849Scy
1396280849ScyAC_CACHE_CHECK(
1397280849Scy    [if the TTY code permits PARENB and IGNPAR],
1398280849Scy    [ntp_cv_no_parenb_ignpar],
1399280849Scy    [
1400280849Scy	ans=no
1401280849Scy	case "$host" in
1402280849Scy	 i?86-*-*linux*)
1403280849Scy	    ans=yes
1404280849Scy	    ;;
1405280849Scy	 mips-sgi-irix*)
1406280849Scy	    ans=yes
1407280849Scy	    ;;
1408280849Scy	 i?86-*-freebsd[[123]].*)
1409280849Scy	    ;;
1410280849Scy	 i?86-*-freebsd*)
1411280849Scy	    ans=yes
1412280849Scy	    ;;
1413280849Scy	 *-*-unicosmp*)
1414280849Scy	    ans=yes
1415280849Scy	    ;;
1416280849Scy	esac
1417280849Scy	ntp_cv_no_parenb_ignpar=$ans
1418280849Scy    ]
1419280849Scy)
1420280849Scycase "$ntp_cv_no_parenb_ignpar" in
1421280849Scy yes)
1422280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1423280849Scy	[Is there a problem using PARENB and IGNPAR?])
1424181834Srobertoesac
1425181834Sroberto
1426280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1427280849ScyAC_ARG_ENABLE(
1428280849Scy    [debug-timing],
1429280849Scy    [AS_HELP_STRING(
1430280849Scy	[--enable-debug-timing],
1431280849Scy	[- include processing time debugging code (costs performance)]
1432280849Scy    )],
1433280849Scy    [ntp_ok=$enableval],
1434280849Scy    [ntp_ok=no]
1435280849Scy)
1436280849Scycase "$ntp_ok" in
1437280849Scy yes)
1438280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1439181834Srobertoesac
1440280849ScyAC_MSG_RESULT([$ntp_ok])
1441181834Sroberto
1442280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1443200576SrobertoAC_ARG_ENABLE(
1444280849Scy    [dst-minutes],
1445280849Scy    [AS_HELP_STRING(
1446200576Sroberto	[--enable-dst-minutes],
1447280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1448280849Scy    ],
1449200576Sroberto    [ans=$enableval],
1450200576Sroberto    [ans=60]
1451200576Sroberto)
1452280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1453280849Scy    [The number of minutes in a DST adjustment])
1454200576SrobertoAC_MSG_RESULT([$ans])
1455181834Sroberto
1456280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1457200576SrobertoAC_ARG_ENABLE(
1458200576Sroberto    [ignore-dns-errors],
1459280849Scy    [AS_HELP_STRING(
1460280849Scy	[--enable-ignore-dns-errors],
1461200576Sroberto	[- retry DNS queries on any error]
1462280849Scy    )],
1463200576Sroberto    [ans=$enableval],
1464200576Sroberto    [ans=no]
1465200576Sroberto)
1466200576Srobertocase "$ans" in
1467200576Sroberto yes)
1468280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1469280849Scy	[Retry queries on _any_ DNS error?])
1470200576Srobertoesac
1471200576SrobertoAC_MSG_RESULT([$ans])
1472200576Sroberto
1473280849ScyAC_CACHE_CHECK(
1474280849Scy    [availability of ntp_{adj,get}time()],
1475280849Scy    [ntp_cv_var_ntp_syscalls],
1476280849Scy    [
1477280849Scy	ntp_cv_var_ntp_syscalls=no
1478280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1479280849Scy	 yesyes*)
1480280849Scy	    ntp_cv_var_ntp_syscalls=libc
1481181834Sroberto	    ;;
1482280849Scy	 *yes)
1483280849Scy	    ntp_cv_var_ntp_syscalls=inline
1484181834Sroberto	    ;;
1485280849Scy	 *)
1486280849Scy	    AC_PREPROC_IFELSE(
1487282408Scy		[AC_LANG_SOURCE(
1488282408Scy		    [
1489282408Scy			#include <sys/syscall.h>
1490282408Scy			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1491282408Scy			# error
1492282408Scy			#endif
1493282408Scy		    ])],
1494280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1495280849Scy	    )
1496181834Sroberto	    ;;
1497280849Scy	 esac
1498280849Scy    ]
1499280849Scy)
1500280849Scycase "$ntp_cv_var_ntp_syscalls" in
1501181834Sroberto libc)
1502280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1503280849Scy	[Do we have ntp_{adj,get}time in libc?])
1504181834Sroberto    ;;
1505181834Sroberto kernel)
1506280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1507280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1508181834Sroberto    ;;
1509181834Srobertoesac
1510181834Sroberto
1511280849ScyAC_CACHE_CHECK(
1512280849Scy    [if sys/timex.h has STA_FLL],
1513280849Scy    [ntp_cv_var_sta_fll],
1514280849Scy    [AC_PREPROC_IFELSE(
1515282408Scy	[AC_LANG_SOURCE(
1516282408Scy	    [
1517282408Scy		#include <sys/timex.h>
1518282408Scy		#ifndef STA_FLL
1519282408Scy		# error
1520282408Scy		#endif
1521282408Scy	    ])],
1522280849Scy	[ntp_cv_var_sta_fll=yes],
1523280849Scy	[ntp_cv_var_sta_fll=no]
1524280849Scy    )]
1525280849Scy)
1526181834Sroberto
1527280849ScyAC_CACHE_CHECK(
1528280849Scy    [if we have kernel PLL support],
1529280849Scy    [ntp_cv_var_kernel_pll],
1530280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1531280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1532280849Scy	 *no*)
1533280849Scy	    ntp_cv_var_kernel_pll=no
1534280849Scy	    ;;
1535280849Scy	 *) ntp_cv_var_kernel_pll=yes
1536280849Scy	    ;;
1537280849Scy	esac
1538280849Scy    ]
1539280849Scy)
1540280849Scycase "$ntp_cv_var_kernel_pll" in
1541181834Sroberto yes)
1542280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1543280849Scy	[Does the kernel support precision time discipline?])
1544181834Srobertoesac
1545181834Sroberto
1546280849ScyAC_CACHE_CHECK(
1547280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1548280849Scy    [ntp_cv_size_returned_in_buffer],
1549280849Scy    [
1550280849Scy	ans=no
1551280849Scy	case "$host" in
1552280849Scy	 *-fujitsu-uxp*)
1553280849Scy	    ans=yes
1554280849Scy	    ;;
1555280849Scy	 *-ncr-sysv4*)
1556280849Scy	    ans=yes
1557280849Scy	    ;;
1558280849Scy	 *-univel-sysv*)
1559280849Scy	    ans=yes
1560280849Scy	    ;;
1561280849Scy	esac
1562280849Scy	ntp_cv_size_returned_in_buffer=$ans
1563280849Scy    ]
1564280849Scy)
1565280849Scycase "$ntp_cv_size_returned_in_buffer" in
1566280849Scy yes)
1567280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1568280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1569181834Srobertoesac
1570181834Sroberto
1571181834Sroberto# Check for ioctls TIOCGPPSEV
1572280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1573280849Scycase "$ac_cv_header_termios_h" in
1574280849Scy yes)
1575280849Scy    AC_PREPROC_IFELSE(
1576282408Scy	[AC_LANG_SOURCE([
1577280849Scy	    #include <termios.h>
1578280849Scy	    #ifndef TIOCGPPSEV
1579280849Scy	    # error
1580280849Scy	    #endif
1581282408Scy	])],
1582280849Scy	[ntp_ok=yes],
1583280849Scy	[ntp_ok=no]
1584280849Scy    )
1585280849Scy    ;;
1586280849Scy *)
1587280849Scy    ntp_ok=no
1588280849Scy    ;;
1589280849Scyesac
1590280849Scycase "$ntp_ok" in
1591280849Scy yes)
1592280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1593280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1594280849Scyesac
1595280849ScyAC_MSG_RESULT([$ntp_ok])
1596181834Sroberto
1597181834Sroberto# Check for ioctls TIOCSPPS
1598280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1599280849Scycase "$ac_cv_header_termios_h" in
1600280849Scy yes)
1601280849Scy    AC_PREPROC_IFELSE(
1602282408Scy	[AC_LANG_SOURCE([
1603280849Scy	    #include <termios.h>
1604280849Scy	    #ifndef TIOCSPPS
1605280849Scy	    # error
1606280849Scy	    #endif
1607282408Scy	 ])],
1608280849Scy	 [ntp_ok=yes],
1609280849Scy	 [ntp_ok=no]
1610280849Scy    )
1611280849Scy    ;;
1612280849Scy *)
1613181834Sroberto    ntp_ok=no
1614280849Scy    ;;
1615280849Scyesac
1616280849Scycase "$ntp_ok" in
1617280849Scy yes)
1618280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1619280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1620280849Scyesac
1621280849ScyAC_MSG_RESULT([$ntp_ok])
1622181834Sroberto
1623181834Sroberto# Check for ioctls CIOGETEV
1624280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1625280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1626280849Scy yes)
1627280849Scy    AC_PREPROC_IFELSE(
1628282408Scy	[AC_LANG_SOURCE([
1629280849Scy	    #include <sys/ppsclock.h>
1630280849Scy	    #ifndef CIOGETEV
1631280849Scy	    # error
1632280849Scy	    #endif
1633282408Scy	])],
1634280849Scy	[ntp_ok=yes],
1635280849Scy	[ntp_ok=no]
1636280849Scy    )
1637280849Scy    ;;
1638280849Scy *)
1639280849Scy    ntp_ok=no
1640280849Scy    ;;
1641280849Scyesac
1642280849Scycase "$ntp_ok" in
1643280849Scy yes)
1644280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1645280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1646280849Scyesac
1647280849ScyAC_MSG_RESULT([$ntp_ok])
1648181834Sroberto
1649181834Sroberto# ATOM/PPSAPI stuff.
1650181834Sroberto
1651280849Scyntp_atom_ok=yes
1652181834Sroberto
1653181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1654181834Sroberto
1655181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1656181834Sroberto# The PPSAPI needs struct timespec.
1657181834Sroberto# The PPSAPI also needs a timepps header.
1658181834Sroberto
1659280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1660181834Sroberto inlineyes)
1661181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1662181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1663181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1664280849Scy	ntp_jupiter_ok=yes
1665280849Scy	ntp_oncore_ok=yes
1666280849Scy	ntp_parse_ok=yes
1667280849Scy	ntp_ripe_ncc_ok=yes
1668181834Sroberto	;;
1669181834Sroberto    esac
1670181834Sroberto    ;;
1671181834Srobertoesac
1672181834Sroberto
1673181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1674280849ScyAC_CHECK_HEADER([linux/serial.h])
1675181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1676181834Sroberto  yesyes)
1677280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1678280849Scy    AC_PREPROC_IFELSE(
1679282408Scy	[AC_LANG_SOURCE([
1680280849Scy	    #include <sys/time.h>
1681280849Scy	    typedef int u_int;
1682280849Scy	    #include <sys/ppsclock.h>
1683280849Scy	    #include <linux/serial.h>
1684181834Sroberto
1685280849Scy	    #ifndef TIOCGSERIAL
1686280849Scy	    # error
1687280849Scy	    #endif
1688280849Scy	    #ifndef TIOCSSERIAL
1689280849Scy	    # error
1690280849Scy	    #endif
1691280849Scy	    #ifndef ASYNC_PPS_CD_POS
1692280849Scy	    # error
1693280849Scy	    #endif
1694280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1695280849Scy	    # error
1696280849Scy	    #endif
1697280849Scy	    #ifndef CIOGETEV
1698280849Scy	    # error
1699280849Scy	    #endif
1700282408Scy	])],
1701280849Scy	[ntp_ok=yes],
1702280849Scy	[ntp_ok=no]
1703280849Scy    )
1704280849Scy    AC_MSG_RESULT([$ntp_ok])
1705280849Scy    ;;
1706181834Sroberto  *)
1707280849Scy    ntp_ok=no
1708280849Scy    ;;
1709181834Srobertoesac
1710280849Scycase "$ntp_ok" in
1711280849Scy yes)
1712280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1713280849Scy	[Do we have the TIO serial stuff?])
1714280849Scyesac
1715181834Sroberto
1716181834Sroberto# Check for SHMEM_STATUS support
1717200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1718181834Srobertocase "$ac_cv_header_sys_mman_h" in
1719280849Scy yes)
1720280849Scy    ntp_ok=yes
1721280849Scy    ;;
1722280849Scy *)
1723280849Scy    ntp_ok=no
1724280849Scy    ;;
1725181834Srobertoesac
1726280849Scycase "$ntp_ok" in
1727280849Scy yes)
1728280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1729280849Scy	[Do we have support for SHMEM_STATUS?])
1730280849Scyesac
1731280849ScyAC_MSG_RESULT([$ntp_ok])
1732181834Sroberto
1733181834Srobertontp_refclock=no
1734181834Sroberto
1735181834Sroberto# HPUX only, and by explicit request
1736200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1737280849ScyAC_ARG_ENABLE(
1738280849Scy    [BANCOMM],
1739280849Scy    [AS_HELP_STRING(
1740280849Scy	[--enable-BANCOMM],
1741280849Scy	[- Datum/Bancomm bc635/VME interface]
1742280849Scy    )],
1743280849Scy    [ntp_ok=$enableval],
1744280849Scy    [ntp_ok=no]
1745280849Scy)
1746280849Scycase "$ntp_ok" in
1747280849Scy yes)
1748181834Sroberto    ntp_refclock=yes
1749280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1750280849Scy    ;;
1751280849Scyesac
1752280849ScyAC_MSG_RESULT([$ntp_ok])
1753181834Srobertocase "$ntp_ok$host" in
1754181834Sroberto yes*-*-hpux*) ;;
1755200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1756181834Srobertoesac
1757181834Sroberto
1758181834Sroberto#HPUX only, and only by explicit request
1759200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1760280849ScyAC_ARG_ENABLE(
1761280849Scy    [GPSVME],
1762280849Scy    [AS_HELP_STRING(
1763280849Scy	[--enable-GPSVME],
1764280849Scy	[- TrueTime GPS receiver/VME interface]
1765280849Scy    )],
1766280849Scy    [ntp_ok=$enableval],
1767280849Scy    [ntp_ok=no]
1768280849Scy)
1769280849Scycase "$ntp_ok" in
1770280849Scy yes)
1771181834Sroberto    ntp_refclock=yes
1772280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1773280849Scy    ;;
1774280849Scyesac
1775280849ScyAC_MSG_RESULT([$ntp_ok])
1776181834Srobertocase "$ntp_ok$host" in
1777181834Sroberto yes*-*-hpux*) ;;
1778200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1779181834Srobertoesac
1780181834Sroberto
1781200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1782181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1783181834Sroberto yesyesyes)
1784280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1785181834Sroberto    ans=yes
1786181834Sroberto    ;;
1787181834Sroberto *)
1788181834Sroberto    ans=no
1789181834Sroberto    ;;
1790181834Srobertoesac
1791200576SrobertoAC_MSG_RESULT([$ans])
1792181834Sroberto
1793200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1794280849ScyAC_ARG_ENABLE(
1795280849Scy    [all-clocks],
1796280849Scy    [AS_HELP_STRING(
1797280849Scy	[--enable-all-clocks],
1798280849Scy	[+ include all suitable non-PARSE clocks:]
1799280849Scy    )],
1800280849Scy    [ntp_eac=$enableval],
1801280849Scy    [ntp_eac=yes]
1802280849Scy)
1803280849ScyAC_MSG_RESULT([$ntp_eac])
1804181834Sroberto
1805280849Scy# HMS: Should we also require ntp_parse_ok?
1806200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1807280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1808181834Sroberto yes*yes*)
1809181834Sroberto    ntp_canparse=yes
1810181834Sroberto    ;;
1811181834Sroberto *) ntp_canparse=no
1812181834Sroberto    ;;
1813181834Srobertoesac
1814280849ScyAC_MSG_RESULT([$ntp_canparse])
1815181834Sroberto
1816181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1817181834Srobertocase "$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
1818181834Sroberto *yes*)
1819181834Sroberto    ntp_canaudio=yes
1820280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1821181834Sroberto    ;;
1822181834Sroberto *) ntp_canaudio=no ;;
1823181834Srobertoesac
1824280849ScyAC_MSG_RESULT([$ntp_canaudio])
1825181834Sroberto
1826181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1827181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1828181834Sroberto yesyes)
1829181834Sroberto    ntp_canshm=yes
1830181834Sroberto    ;;
1831181834Sroberto *) ntp_canshm=no ;;
1832181834Srobertoesac
1833280849ScyAC_MSG_RESULT([$ntp_canshm])
1834181834Sroberto
1835280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1836280849ScyAC_CACHE_CHECK(
1837280849Scy    [for termios modem control],
1838280849Scy    [ntp_cv_modem_control],
1839280849Scy    [AC_COMPILE_IFELSE(
1840280849Scy	[AC_LANG_PROGRAM(
1841280849Scy	    [[
1842280849Scy		#ifdef HAVE_UNISTD_H
1843280849Scy		# include <unistd.h>
1844280849Scy		#endif
1845280849Scy		#ifdef HAVE_TERMIOS_H
1846280849Scy		# include <termios.h>
1847280849Scy		#endif
1848280849Scy		#ifdef HAVE_SYS_IOCTL_H
1849280849Scy		# include <sys/ioctl.h>
1850280849Scy		#endif
1851280849Scy	    ]],
1852280849Scy	    [[
1853280849Scy		int	dtr = TIOCM_DTR;
1854280849Scy
1855280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1856280849Scy	    ]]
1857280849Scy	)],
1858280849Scy	[ntp_cv_modem_control=yes],
1859280849Scy	[ntp_cv_modem_control=no]
1860280849Scy    )]
1861280849Scy)
1862280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1863280849Scy yes::yes)
1864280849Scy    ntp_enable_all_modem_control_clocks=yes
1865280849Scy    ;;
1866280849Scy *)
1867280849Scy    ntp_enable_all_modem_control_clocks=no
1868280849Scy    ;;
1869280849Scyesac
1870280849Scy
1871181834Sroberto# Requires modem control
1872200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1873280849ScyAC_ARG_ENABLE(
1874280849Scy    [ACTS],
1875280849Scy    [AS_HELP_STRING(
1876280849Scy	[--enable-ACTS],
1877280849Scy	[s ACTS modem service]
1878280849Scy    )],
1879181834Sroberto    [ntp_ok=$enableval],
1880280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1881280849Scy)
1882280849Scycase "$ntp_ok" in
1883280849Scy yes)
1884181834Sroberto    ntp_refclock=yes
1885280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1886280849Scy    ;;
1887280849Scyesac
1888280849ScyAC_MSG_RESULT([$ntp_ok])
1889181834Sroberto
1890200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1891280849ScyAC_ARG_ENABLE(
1892280849Scy    [ARBITER],
1893280849Scy    [AS_HELP_STRING(
1894280849Scy	[--enable-ARBITER],
1895280849Scy	[+ Arbiter 1088A/B GPS receiver]
1896280849Scy    )],
1897280849Scy    [ntp_ok=$enableval],
1898280849Scy    [ntp_ok=$ntp_eac]
1899280849Scy)
1900280849Scycase "$ntp_ok" in
1901280849Scy yes)
1902181834Sroberto    ntp_refclock=yes
1903280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1904280849Scy    ;;
1905280849Scyesac
1906280849ScyAC_MSG_RESULT([$ntp_ok])
1907181834Sroberto
1908200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1909280849ScyAC_ARG_ENABLE(
1910280849Scy    [ARCRON_MSF],
1911280849Scy    [AS_HELP_STRING(
1912280849Scy	[--enable-ARCRON-MSF],
1913280849Scy	[+ Arcron MSF receiver]
1914280849Scy    )],
1915280849Scy    [ntp_ok=$enableval],
1916280849Scy    [ntp_ok=$ntp_eac]
1917280849Scy)
1918280849Scycase "$ntp_ok" in
1919280849Scy yes)
1920181834Sroberto    ntp_refclock=yes
1921280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1922280849Scy    ;;
1923280849Scyesac
1924280849ScyAC_MSG_RESULT([$ntp_ok])
1925181834Sroberto
1926200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1927280849ScyAC_ARG_ENABLE(
1928280849Scy    [AS2201],
1929280849Scy    [AS_HELP_STRING(
1930280849Scy	[--enable-AS2201],
1931280849Scy	[+ Austron 2200A/2201A GPS receiver]
1932280849Scy    )],
1933280849Scy    [ntp_ok=$enableval],
1934280849Scy    [ntp_ok=$ntp_eac]
1935280849Scy)
1936280849Scycase "$ntp_ok" in
1937280849Scy yes)
1938181834Sroberto    ntp_refclock=yes
1939280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1940280849Scy    ;;
1941280849Scyesac
1942280849ScyAC_MSG_RESULT([$ntp_ok])
1943181834Sroberto
1944200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1945280849ScyAC_ARG_ENABLE(
1946280849Scy    [ATOM],
1947280849Scy    [AS_HELP_STRING(
1948280849Scy	[--enable-ATOM],
1949280849Scy	[s ATOM PPS interface]
1950280849Scy    )],
1951280849Scy    [ntp_ok=$enableval],
1952280849Scy    [ntp_ok=$ntp_eac]
1953280849Scy)
1954280849Scycase "$ntp_atom_ok" in
1955181834Sroberto no) ntp_ok=no ;;
1956181834Srobertoesac
1957280849Scycase "$ntp_ok" in
1958280849Scy yes)
1959181834Sroberto    ntp_refclock=yes
1960280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1961280849Scy    ;;
1962280849Scyesac
1963280849ScyAC_MSG_RESULT([$ntp_ok])
1964181834Sroberto
1965200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1966280849ScyAC_ARG_ENABLE(
1967280849Scy    [CHRONOLOG],
1968280849Scy    [AS_HELP_STRING(
1969280849Scy	[--enable-CHRONOLOG],
1970280849Scy	[+ Chrono-log K-series WWVB receiver]
1971280849Scy    )],
1972280849Scy    [ntp_ok=$enableval],
1973280849Scy    [ntp_ok=$ntp_eac]
1974280849Scy)
1975280849Scycase "$ntp_ok" in
1976280849Scy yes)
1977181834Sroberto    ntp_refclock=yes
1978280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1979280849Scy    ;;
1980280849Scyesac
1981280849ScyAC_MSG_RESULT([$ntp_ok])
1982181834Sroberto
1983200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1984280849ScyAC_ARG_ENABLE(
1985280849Scy    [CHU],
1986280849Scy    [AS_HELP_STRING(
1987280849Scy	[--enable-CHU],
1988280849Scy	[+ CHU modem/decoder]
1989280849Scy    )],
1990280849Scy    [ntp_ok=$enableval],
1991280849Scy    [ntp_ok=$ntp_eac]
1992280849Scy)
1993280849Scycase "$ntp_ok" in
1994280849Scy yes)
1995181834Sroberto    ntp_refclock=yes
1996280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1997280849Scy    ;;
1998280849Scyesac
1999280849ScyAC_MSG_RESULT([$ntp_ok])
2000280849Scyntp_refclock_chu=$ntp_ok
2001181834Sroberto
2002200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2003280849ScyAC_ARG_ENABLE(
2004280849Scy    [AUDIO-CHU],
2005280849Scy    [AS_HELP_STRING(
2006280849Scy	[--enable-AUDIO-CHU],
2007280849Scy	[s CHU audio/decoder]
2008280849Scy    )],
2009181834Sroberto    [ntp_ok=$enableval],
2010280849Scy    [
2011280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2012280849Scy	 *no*)	ntp_ok=no  ;;
2013280849Scy	 *)	ntp_ok=yes ;;
2014280849Scy	esac
2015280849Scy    ]
2016280849Scy)
2017280849ScyAC_MSG_RESULT([$ntp_ok])
2018181834Sroberto# We used to check for sunos/solaris target...
2019280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2020280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2021181834Srobertoesac
2022181834Sroberto
2023181834Sroberto# Not under HP-UX
2024200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2025280849ScyAC_ARG_ENABLE(
2026280849Scy    [DATUM],
2027280849Scy    [AS_HELP_STRING(
2028280849Scy	[--enable-DATUM],
2029280849Scy	[s Datum Programmable Time System]
2030280849Scy    )],
2031181834Sroberto    [ntp_ok=$enableval],
2032280849Scy    [
2033280849Scy	case "$ac_cv_header_termios_h" in
2034280849Scy	 yes)
2035280849Scy	    ntp_ok=$ntp_eac
2036280849Scy	    ;;
2037280849Scy	 *) ntp_ok=no
2038280849Scy	    ;;
2039280849Scy	esac
2040280849Scy    ]
2041280849Scy)
2042280849Scycase "$ntp_ok" in
2043280849Scy yes)
2044181834Sroberto    ntp_refclock=yes
2045280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2046280849Scy    ;;
2047280849Scyesac
2048280849ScyAC_MSG_RESULT([$ntp_ok])
2049181834Sroberto
2050200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2051280849ScyAC_ARG_ENABLE(
2052280849Scy    [DUMBCLOCK],
2053280849Scy    [AS_HELP_STRING(
2054280849Scy	[--enable-DUMBCLOCK],
2055280849Scy	[+ Dumb generic hh:mm:ss local clock]
2056280849Scy    )],
2057280849Scy    [ntp_ok=$enableval],
2058280849Scy    [ntp_ok=$ntp_eac]
2059280849Scy)
2060280849Scycase "$ntp_ok" in
2061280849Scy yes)
2062181834Sroberto    ntp_refclock=yes
2063280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2064280849Scy    ;;
2065280849Scyesac
2066280849ScyAC_MSG_RESULT([$ntp_ok])
2067181834Sroberto
2068200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2069280849ScyAC_ARG_ENABLE(
2070280849Scy    [FG],
2071280849Scy    [AS_HELP_STRING(
2072280849Scy	[--enable-FG],
2073280849Scy	[+ Forum Graphic GPS]
2074280849Scy    )],
2075280849Scy    [ntp_ok=$enableval],
2076280849Scy    [ntp_ok=$ntp_eac]
2077280849Scy)
2078280849Scycase "$ntp_ok" in
2079280849Scy yes)
2080181834Sroberto    ntp_refclock=yes
2081280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2082280849Scy    ;;
2083280849Scyesac
2084280849ScyAC_MSG_RESULT([$ntp_ok])
2085181834Sroberto
2086181834Sroberto# Requires modem control
2087200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2088280849ScyAC_ARG_ENABLE(
2089280849Scy    [HEATH],
2090280849Scy    [AS_HELP_STRING(
2091280849Scy	[--enable-HEATH],
2092280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2093280849Scy    )],
2094181834Sroberto    [ntp_ok=$enableval],
2095280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2096280849Scy)
2097280849Scycase "$ntp_ok" in
2098280849Scy yes)
2099181834Sroberto    ntp_refclock=yes
2100280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2101280849Scy    ;;
2102280849Scyesac
2103280849ScyAC_MSG_RESULT([$ntp_ok])
2104181834Sroberto
2105200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2106280849ScyAC_ARG_ENABLE(
2107280849Scy    [HOPFSERIAL],
2108280849Scy    [AS_HELP_STRING(
2109280849Scy	[--enable-HOPFSERIAL],
2110280849Scy	[+ hopf serial clock device]
2111280849Scy    )],
2112280849Scy    [ntp_ok=$enableval],
2113280849Scy    [ntp_ok=$ntp_eac]
2114280849Scy)
2115280849Scycase "$ntp_ok" in
2116280849Scy yes)
2117181834Sroberto    ntp_refclock=yes
2118280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2119280849Scy    ;;
2120280849Scyesac
2121280849ScyAC_MSG_RESULT([$ntp_ok])
2122181834Sroberto
2123200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2124280849ScyAC_ARG_ENABLE(
2125280849Scy    [HOPFPCI],
2126280849Scy    [AS_HELP_STRING(
2127280849Scy	[--enable-HOPFPCI],
2128280849Scy	[+ hopf 6039 PCI board]
2129280849Scy    )],
2130280849Scy    [ntp_ok=$enableval],
2131280849Scy    [ntp_ok=$ntp_eac]
2132280849Scy)
2133280849Scycase "$ntp_ok" in
2134280849Scy yes)
2135181834Sroberto    ntp_refclock=yes
2136280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2137280849Scy    ;;
2138280849Scyesac
2139280849ScyAC_MSG_RESULT([$ntp_ok])
2140181834Sroberto
2141200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2142280849ScyAC_ARG_ENABLE(
2143280849Scy    [HPGPS],
2144280849Scy    [AS_HELP_STRING(
2145280849Scy	[--enable-HPGPS],
2146280849Scy	[+ HP 58503A GPS receiver]
2147280849Scy    )],
2148280849Scy    [ntp_ok=$enableval],
2149280849Scy    [ntp_ok=$ntp_eac]
2150280849Scy)
2151280849Scycase "$ntp_ok" in
2152280849Scy yes)
2153181834Sroberto    ntp_refclock=yes
2154280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2155280849Scy    ;;
2156280849Scyesac
2157280849ScyAC_MSG_RESULT([$ntp_ok])
2158181834Sroberto
2159200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2160280849ScyAC_ARG_ENABLE(
2161280849Scy    [IRIG],
2162280849Scy    [AS_HELP_STRING(
2163280849Scy	[--enable-IRIG],
2164280849Scy	[s IRIG audio decoder]
2165280849Scy    )],
2166181834Sroberto    [ntp_ok=$enableval],
2167280849Scy    [
2168280849Scy	case "$ntp_eac$ntp_canaudio" in
2169280849Scy	 *no*)	ntp_ok=no  ;;
2170280849Scy	 *)	ntp_ok=yes ;;
2171280849Scy	esac
2172280849Scy    ]
2173280849Scy)
2174280849Scycase "$ntp_ok" in
2175280849Scy yes)
2176181834Sroberto    ntp_refclock=yes
2177280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2178280849Scy    ;;
2179280849Scyesac
2180280849ScyAC_MSG_RESULT([$ntp_ok])
2181181834Srobertocase "$ntp_ok$ntp_canaudio" in
2182280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2183181834Srobertoesac
2184181834Sroberto
2185200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2186280849ScyAC_ARG_ENABLE(
2187280849Scy    [JJY],
2188280849Scy    [AS_HELP_STRING(
2189280849Scy	[--enable-JJY],
2190280849Scy	[+ JJY receiver]
2191280849Scy    )],
2192280849Scy    [ntp_ok=$enableval],
2193280849Scy    [ntp_ok=$ntp_eac]
2194280849Scy)
2195280849Scycase "$ntp_ok" in
2196280849Scy yes)
2197181834Sroberto    ntp_refclock=yes
2198280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2199280849Scy    ;;
2200280849Scyesac
2201280849ScyAC_MSG_RESULT([$ntp_ok])
2202181834Sroberto
2203200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2204280849ScyAC_ARG_ENABLE(
2205280849Scy    [JUPITER],
2206280849Scy    [AS_HELP_STRING(
2207280849Scy	[--enable-JUPITER],
2208280849Scy	[s Rockwell Jupiter GPS receiver]
2209280849Scy    )],
2210181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2211280849Scycase "$ntp_jupiter_ok" in
2212181834Sroberto no) ntp_ok=no ;;
2213181834Srobertoesac
2214280849Scycase "$ntp_ok" in
2215280849Scy yes)
2216181834Sroberto    ntp_refclock=yes
2217280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2218280849Scy    ;;
2219280849Scyesac
2220280849ScyAC_MSG_RESULT([$ntp_ok])
2221181834Sroberto
2222200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2223280849ScyAC_ARG_ENABLE(
2224280849Scy    [LEITCH],
2225280849Scy    [AS_HELP_STRING(
2226280849Scy	[--enable-LEITCH],
2227280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2228280849Scy    )],
2229280849Scy    [ntp_ok=$enableval],
2230280849Scy    [ntp_ok=$ntp_eac]
2231280849Scy)
2232280849Scycase "$ntp_ok" in
2233280849Scy yes)
2234181834Sroberto    ntp_refclock=yes
2235280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2236280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2237280849Scy    ;;
2238280849Scyesac
2239280849ScyAC_MSG_RESULT([$ntp_ok])
2240181834Sroberto
2241200576SrobertoAC_MSG_CHECKING([local clock reference])
2242280849ScyAC_ARG_ENABLE(
2243280849Scy    [LOCAL-CLOCK],
2244280849Scy    [AS_HELP_STRING(
2245280849Scy	[--enable-LOCAL-CLOCK],
2246280849Scy	[+ local clock reference]
2247280849Scy    )],
2248280849Scy    [ntp_ok=$enableval],
2249280849Scy    [ntp_ok=$ntp_eac]
2250280849Scy)
2251280849Scycase "$ntp_ok" in
2252280849Scy yes)
2253181834Sroberto    ntp_refclock=yes
2254280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2255280849Scy    ;;
2256280849Scyesac
2257280849ScyAC_MSG_RESULT([$ntp_ok])
2258181834Sroberto
2259181834Srobertodnl Bug 340: longstanding unfixed bugs
2260280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2261280849Scydnl AC_ARG_ENABLE([MSFEES],
2262280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2263181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2264181834Srobertodnl if test "$ntp_ok" = "yes"; then
2265181834Srobertodnl     ntp_refclock=yes
2266280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2267181834Srobertodnl fi
2268280849Scydnl AC_MSG_RESULT([$ntp_ok])
2269181834Sroberto
2270181834Sroberto# Not Ultrix
2271200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2272280849ScyAC_ARG_ENABLE(
2273280849Scy    [MX4200],
2274280849Scy    [AS_HELP_STRING(
2275280849Scy	[--enable-MX4200 ],
2276280849Scy	[s Magnavox MX4200 GPS receiver]
2277280849Scy    )],
2278181834Sroberto    [ntp_ok=$enableval],
2279280849Scy    [
2280280849Scy	case "$ac_cv_var_ppsclock" in
2281280849Scy	 yes)
2282280849Scy	    ntp_ok=$ntp_eac
2283280849Scy	    ;;
2284280849Scy	 *)
2285280849Scy	    ntp_ok=no
2286280849Scy	    ;;
2287280849Scy	esac
2288280849Scy    ]
2289280849Scy)
2290280849Scycase "$ntp_ok" in
2291280849Scy yes)
2292181834Sroberto    ntp_refclock=yes
2293280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2294280849Scy    ;;
2295280849Scyesac
2296280849ScyAC_MSG_RESULT([$ntp_ok])
2297181834Srobertocase "$ntp_ok$host" in
2298280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2299181834Srobertoesac
2300181834Sroberto
2301200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2302280849ScyAC_ARG_ENABLE(
2303280849Scy    [NEOCLOCK4X],
2304280849Scy    [AS_HELP_STRING(
2305280849Scy	[--enable-NEOCLOCK4X],
2306280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2307280849Scy    )],
2308280849Scy    [ntp_ok=$enableval],
2309280849Scy    [ntp_ok=$ntp_eac]
2310280849Scy)
2311280849Scycase "$ntp_ok" in
2312280849Scy yes)
2313181834Sroberto    ntp_refclock=yes
2314280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2315280849Scy    ;;
2316280849Scyesac
2317280849ScyAC_MSG_RESULT([$ntp_ok])
2318181834Sroberto
2319200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2320280849ScyAC_ARG_ENABLE(
2321280849Scy    [NMEA],
2322280849Scy    [AS_HELP_STRING(
2323280849Scy	[--enable-NMEA],
2324280849Scy	[+ NMEA GPS receiver]
2325280849Scy    )],
2326280849Scy    [ntp_ok=$enableval],
2327280849Scy    [ntp_ok=$ntp_eac]
2328280849Scy)
2329280849Scycase "$ntp_ok" in
2330280849Scy yes)
2331181834Sroberto    ntp_refclock=yes
2332280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2333280849Scy    ;;
2334280849Scyesac
2335280849ScyAC_MSG_RESULT([$ntp_ok])
2336181834Sroberto
2337280849ScyAC_CHECK_FUNCS([strtoll])
2338280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2339280849ScyAC_ARG_ENABLE(
2340280849Scy    [GPSD],
2341280849Scy    [AS_HELP_STRING(
2342280849Scy	[--enable-GPSD],
2343280849Scy	[+ GPSD JSON receiver]
2344280849Scy    )],
2345280849Scy    [ntp_ok=$enableval],
2346280849Scy    [case "$ac_cv_func_strtoll" in
2347280849Scy     yes) ntp_ok=$ntp_eac ;;
2348280849Scy     *)   ntp_ok="no" ;;
2349280849Scy    esac]
2350280849Scy)
2351280849Scycase "$ntp_ok" in
2352280849Scy yes)
2353280849Scy    ntp_refclock=yes
2354280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2355280849Scy    ;;
2356280849Scyesac
2357280849ScyAC_MSG_RESULT([$ntp_ok])
2358280849Scy
2359200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2360280849ScyAC_ARG_ENABLE(
2361280849Scy    [ONCORE],
2362280849Scy    [AS_HELP_STRING(
2363280849Scy	[--enable-ONCORE],
2364280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2365280849Scy    )],
2366280849Scy    [ntp_ok=$enableval],
2367280849Scy    [ntp_ok=$ntp_eac]
2368280849Scy)
2369280849Scycase "$ntp_oncore_ok" in
2370181834Sroberto no) ntp_ok=no ;;
2371181834Srobertoesac
2372280849Scycase "$ntp_ok" in
2373280849Scy yes)
2374181834Sroberto    ntp_refclock=yes
2375280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2376280849Scy    ;;
2377280849Scyesac
2378280849ScyAC_MSG_RESULT([$ntp_ok])
2379181834Sroberto
2380280849Scy# Requires modem control
2381200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2382280849ScyAC_ARG_ENABLE(
2383280849Scy    [PALISADE],
2384280849Scy    [AS_HELP_STRING(
2385280849Scy	[--enable-PALISADE],
2386280849Scy	[s Palisade clock]
2387280849Scy    )],
2388181834Sroberto    [ntp_ok=$enableval],
2389280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2390280849Scy)
2391280849Scycase "$ntp_ok" in
2392280849Scy yes)
2393181834Sroberto    ntp_refclock=yes
2394280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2395280849Scy    ;;
2396280849Scyesac
2397280849ScyAC_MSG_RESULT([$ntp_ok])
2398181834Sroberto
2399200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2400280849ScyAC_ARG_ENABLE(
2401280849Scy    [PCF],
2402280849Scy    [AS_HELP_STRING(
2403280849Scy	[--enable-PCF ],
2404280849Scy	[+ Conrad parallel port radio clock]
2405280849Scy    )],
2406280849Scy    [ntp_ok=$enableval],
2407280849Scy    [ntp_ok=$ntp_eac]
2408280849Scy)
2409280849Scycase "$ntp_ok" in
2410280849Scy yes)
2411181834Sroberto    ntp_refclock=yes
2412280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2413280849Scy    ;;
2414280849Scyesac
2415280849ScyAC_MSG_RESULT([$ntp_ok])
2416181834Sroberto
2417200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2418280849ScyAC_ARG_ENABLE(
2419280849Scy    [PST],
2420280849Scy    [AS_HELP_STRING(
2421280849Scy	[--enable-PST],
2422280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2423280849Scy    )],
2424280849Scy    [ntp_ok=$enableval],
2425280849Scy    [ntp_ok=$ntp_eac]
2426280849Scy)
2427280849Scycase "$ntp_ok" in
2428280849Scy yes)
2429181834Sroberto    ntp_refclock=yes
2430280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2431280849Scy    ;;
2432280849Scyesac
2433280849ScyAC_MSG_RESULT([$ntp_ok])
2434181834Sroberto
2435200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2436280849ScyAC_ARG_ENABLE(
2437280849Scy    [RIPENCC],
2438280849Scy    [AS_HELP_STRING(
2439280849Scy	[--enable-RIPENCC],
2440280849Scy	[- RIPENCC specific Trimble driver]
2441280849Scy    )],
2442280849Scy    [ntp_ok=$enableval],
2443280849Scy    [ntp_ok=no]
2444280849Scy)
2445181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2446280849Scycase "$ntp_ripe_ncc_ok" in
2447181834Sroberto no) ntp_ok=no ;;
2448181834Srobertoesac
2449280849Scycase "$ntp_ok" in
2450280849Scy yes)
2451181834Sroberto    ntp_refclock=yes
2452280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2453280849Scy    ;;
2454280849Scyesac
2455280849ScyAC_MSG_RESULT([$ntp_ok])
2456181834Sroberto
2457181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2458181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2459200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2460280849ScyAC_ARG_ENABLE(
2461280849Scy    [SHM],
2462280849Scy    [AS_HELP_STRING(
2463280849Scy	[--enable-SHM],
2464280849Scy	[s SHM clock attached thru shared memory]
2465280849Scy    )],
2466181834Sroberto    [ntp_ok=$enableval],
2467280849Scy    [
2468280849Scy	case "$ntp_eac$ntp_canshm" in
2469280849Scy	 *no*)	ntp_ok=no  ;;
2470280849Scy	 *)	ntp_ok=yes ;;
2471280849Scy	esac
2472280849Scy    ]
2473280849Scy)
2474280849Scycase "$ntp_ok" in
2475280849Scy yes)
2476181834Sroberto    ntp_refclock=yes
2477280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2478280849Scy    ;;
2479280849Scyesac
2480280849ScyAC_MSG_RESULT([$ntp_ok])
2481181834Sroberto
2482200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2483280849ScyAC_ARG_ENABLE(
2484280849Scy    [SPECTRACOM],
2485280849Scy    [AS_HELP_STRING(
2486280849Scy	[--enable-SPECTRACOM],
2487280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2488280849Scy    )],
2489280849Scy    [ntp_ok=$enableval],
2490280849Scy    [ntp_ok=$ntp_eac]
2491280849Scy)
2492280849Scycase "$ntp_ok" in
2493280849Scy yes)
2494181834Sroberto    ntp_refclock=yes
2495280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2496280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2497280849Scy    ;;
2498280849Scyesac
2499280849ScyAC_MSG_RESULT([$ntp_ok])
2500181834Sroberto
2501200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2502280849ScyAC_ARG_ENABLE(
2503280849Scy    [TPRO],
2504280849Scy    [AS_HELP_STRING(
2505280849Scy	[--enable-TPRO],
2506280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2507280849Scy    )],
2508181834Sroberto    [ntp_ok=$enableval],
2509280849Scy    [
2510280849Scy	case "$ac_cv_header_sys_tpro_h" in
2511280849Scy	 yes)
2512280849Scy	    ntp_ok=$ntp_eac
2513280849Scy	    ;;
2514280849Scy	 *)
2515280849Scy	    ntp_ok=no
2516280849Scy	    ;;
2517280849Scy	esac
2518280849Scy    ]
2519280849Scy)
2520280849Scycase "$ntp_ok" in
2521280849Scy yes)
2522181834Sroberto    ntp_refclock=yes
2523280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2524280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2525280849Scy    ;;
2526280849Scyesac
2527280849ScyAC_MSG_RESULT([$ntp_ok])
2528181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2529280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2530181834Srobertoesac
2531181834Sroberto
2532181834Sroberto# Not on a vax-dec-bsd
2533200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2534280849ScyAC_ARG_ENABLE(
2535280849Scy    [TRUETIME],
2536280849Scy    [AS_HELP_STRING(
2537280849Scy	[--enable-TRUETIME],
2538280849Scy	[s Kinemetrics/TrueTime receivers]
2539280849Scy    )],
2540181834Sroberto    [ntp_ok=$enableval],
2541280849Scy    [
2542280849Scy	case "$host" in
2543280849Scy	 vax-dec-bsd)
2544280849Scy	    ntp_ok=no
2545280849Scy	    ;;
2546280849Scy	 *)
2547280849Scy	    ntp_ok=$ntp_eac
2548280849Scy	    ;;
2549280849Scy	esac
2550280849Scy    ]
2551280849Scy)    
2552280849Scycase "$ntp_ok" in
2553280849Scy yes)
2554181834Sroberto    ntp_refclock=yes
2555280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2556280849Scy    ;;
2557280849Scyesac
2558280849ScyAC_MSG_RESULT([$ntp_ok])
2559181834Srobertocase "$ntp_ok$host" in
2560280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2561181834Srobertoesac
2562181834Sroberto
2563200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2564280849ScyAC_ARG_ENABLE(
2565280849Scy    [TT560],
2566280849Scy    [AS_HELP_STRING(
2567280849Scy	[--enable-TT560],
2568280849Scy	[- TrueTime 560 IRIG-B decoder]
2569280849Scy    )],
2570280849Scy    [ntp_ok=$enableval],
2571280849Scy    [ntp_ok=no]
2572280849Scy)
2573280849Scycase "$ntp_ok" in
2574280849Scy yes)
2575181834Sroberto    ntp_refclock=yes
2576280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2577280849Scy    ;;
2578280849Scyesac
2579280849ScyAC_MSG_RESULT([$ntp_ok])
2580181834Sroberto
2581200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2582280849ScyAC_ARG_ENABLE(
2583280849Scy    [ULINK],
2584280849Scy    [AS_HELP_STRING(
2585280849Scy	[--enable-ULINK],
2586280849Scy	[+ Ultralink WWVB receiver]
2587280849Scy    )],
2588280849Scy    [ntp_ok=$enableval],
2589280849Scy    [ntp_ok=$ntp_eac]
2590280849Scy)
2591280849Scycase "$ntp_ok" in
2592280849Scy yes)
2593181834Sroberto    ntp_refclock=yes
2594280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2595280849Scy    ;;
2596280849Scyesac
2597280849ScyAC_MSG_RESULT([$ntp_ok])
2598181834Sroberto
2599280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2600280849ScyAC_ARG_ENABLE(
2601280849Scy    [TSYNCPCI],
2602280849Scy    [AS_HELP_STRING(
2603280849Scy	[--enable-TSYNCPCI],
2604280849Scy	[s Spectracom TSYNC timing board]
2605280849Scy    )],
2606280849Scy    [ntp_ok=$enableval],
2607280849Scy    [
2608280849Scy	case "$host" in
2609280849Scy	 *-*-*linux*)
2610280849Scy	    ntp_ok=$ntp_eac
2611280849Scy	    ;;
2612280849Scy	 *)
2613280849Scy	    ntp_ok=no
2614280849Scy	esac
2615280849Scy    ]
2616280849Scy)
2617280849Scycase "$ntp_ok" in
2618280849Scy yes)
2619280849Scy    ntp_refclock=yes
2620280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2621280849Scy    ;;
2622280849Scyesac
2623280849ScyAC_MSG_RESULT([$ntp_ok])
2624280849Scy
2625200576SrobertoAC_MSG_CHECKING([WWV receiver])
2626280849ScyAC_ARG_ENABLE(
2627280849Scy    [WWV],
2628280849Scy    [AS_HELP_STRING(
2629280849Scy	[--enable-WWV],
2630280849Scy	[s WWV Audio receiver]
2631280849Scy    )],
2632181834Sroberto    [ntp_ok=$enableval],
2633280849Scy    [
2634280849Scy	case "$ntp_eac$ntp_canaudio" in
2635280849Scy	 *no*)	ntp_ok=no  ;;
2636280849Scy	 *)	ntp_ok=yes ;;
2637280849Scy	esac
2638280849Scy    ]
2639280849Scy)
2640280849Scycase "$ntp_ok" in
2641280849Scy yes)
2642181834Sroberto    ntp_refclock=yes
2643280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2644280849Scy    ;;
2645280849Scyesac
2646280849ScyAC_MSG_RESULT([$ntp_ok])
2647181834Srobertocase "$ntp_ok$ntp_canaudio" in
2648280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2649181834Srobertoesac
2650181834Sroberto
2651200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2652280849ScyAC_ARG_ENABLE(
2653280849Scy    [ZYFER],
2654280849Scy    [AS_HELP_STRING(
2655280849Scy	[--enable-ZYFER],
2656280849Scy	[+ Zyfer GPStarplus receiver]
2657280849Scy    )],
2658280849Scy    [ntp_ok=$enableval],
2659280849Scy    [ntp_ok=$ntp_eac]
2660280849Scy)
2661280849Scycase "$ntp_ok" in
2662280849Scy yes)
2663181834Sroberto    ntp_refclock=yes
2664280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2665280849Scy    ;;
2666280849Scyesac
2667280849ScyAC_MSG_RESULT([$ntp_ok])
2668181834Sroberto
2669200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2670280849ScyAC_ARG_ENABLE(
2671280849Scy    [parse-clocks],
2672280849Scy    [AS_HELP_STRING(
2673280849Scy	[--enable-parse-clocks],
2674280849Scy	[- include all suitable PARSE clocks:]
2675280849Scy    )],
2676181834Sroberto    [ntp_eapc=$enableval],
2677280849Scy    [
2678280849Scy	case "$ntp_eac" in
2679280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2680280849Scy	 *)	ntp_eapc=no ;;
2681280849Scy	esac
2682280849Scy	# Delete the next line one of these days
2683280849Scy	ntp_eapc=no
2684280849Scy    ]
2685280849Scy)
2686181834SrobertoAC_MSG_RESULT($ntp_eapc)
2687181834Sroberto
2688181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2689181834Sroberto noyes*)
2690200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2691181834Sroberto    ;;
2692181834Sroberto yesyesno)
2693200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2694181834Sroberto    ;;
2695181834Srobertoesac
2696181834Sroberto
2697181834Srobertontp_libparse=no
2698181834Srobertontp_parseutil=no
2699181834Srobertontp_rawdcf=no
2700181834Sroberto
2701200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2702280849ScyAC_ARG_ENABLE(
2703280849Scy    [COMPUTIME],
2704280849Scy    [AS_HELP_STRING(
2705280849Scy	[--enable-COMPUTIME],
2706280849Scy	[s Diem Computime Radio Clock]
2707280849Scy    )],
2708280849Scy    [ntp_ok=$enableval],
2709280849Scy    [ntp_ok=$ntp_eapc]
2710280849Scy)
2711280849Scycase "$ntp_ok" in
2712280849Scy yes)
2713181834Sroberto    ntp_libparse=yes
2714181834Sroberto    ntp_refclock=yes
2715280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2716280849Scy    ;;
2717280849Scyesac
2718280849ScyAC_MSG_RESULT([$ntp_ok])
2719181834Srobertocase "$ntp_ok$ntp_canparse" in
2720181834Sroberto yesno)
2721200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2722181834Srobertoesac
2723181834Sroberto
2724200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2725280849ScyAC_ARG_ENABLE(
2726280849Scy    [DCF7000],
2727280849Scy    [AS_HELP_STRING(
2728280849Scy	[--enable-DCF7000],
2729280849Scy	[s ELV/DCF7000 clock]
2730280849Scy    )],
2731280849Scy    [ntp_ok=$enableval],
2732280849Scy    [ntp_ok=$ntp_eapc]
2733280849Scy)
2734280849Scycase "$ntp_ok" in
2735280849Scy yes)
2736181834Sroberto    ntp_libparse=yes
2737181834Sroberto    ntp_refclock=yes
2738280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2739280849Scy    ;;
2740280849Scyesac
2741280849ScyAC_MSG_RESULT([$ntp_ok])
2742181834Srobertocase "$ntp_ok$ntp_canparse" in
2743181834Sroberto yesno)
2744200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2745181834Srobertoesac
2746181834Sroberto
2747200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2748280849ScyAC_ARG_ENABLE(
2749280849Scy    [HOPF6021],
2750280849Scy    [AS_HELP_STRING(
2751280849Scy	[--enable-HOPF6021],
2752280849Scy	[s HOPF 6021 clock]
2753280849Scy    )],
2754280849Scy    [ntp_ok=$enableval],
2755280849Scy    [ntp_ok=$ntp_eapc]
2756280849Scy)
2757280849Scycase "$ntp_ok" in
2758280849Scy yes)
2759181834Sroberto    ntp_libparse=yes
2760181834Sroberto    ntp_refclock=yes
2761280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2762280849Scy    ;;
2763280849Scyesac
2764280849ScyAC_MSG_RESULT([$ntp_ok])
2765181834Srobertocase "$ntp_ok$ntp_canparse" in
2766181834Sroberto yesno)
2767200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2768181834Srobertoesac
2769181834Sroberto
2770200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2771280849ScyAC_ARG_ENABLE(
2772280849Scy    [MEINBERG],
2773280849Scy    [AS_HELP_STRING(
2774280849Scy	[--enable-MEINBERG],
2775280849Scy	[s Meinberg clocks]
2776280849Scy    )],
2777280849Scy    [ntp_ok=$enableval],
2778280849Scy    [ntp_ok=$ntp_eapc]
2779280849Scy)
2780280849Scycase "$ntp_ok" in
2781280849Scy yes)
2782181834Sroberto    ntp_libparse=yes
2783181834Sroberto    ntp_refclock=yes
2784280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2785280849Scy    ;;
2786280849Scyesac
2787280849ScyAC_MSG_RESULT([$ntp_ok])
2788181834Srobertocase "$ntp_ok$ntp_canparse" in
2789181834Sroberto yesno)
2790200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2791181834Srobertoesac
2792181834Sroberto
2793200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2794280849ScyAC_ARG_ENABLE(
2795280849Scy    [RAWDCF],
2796280849Scy    [AS_HELP_STRING(
2797280849Scy	[--enable-RAWDCF],
2798280849Scy	[s DCF77 raw time code]
2799280849Scy    )],
2800280849Scy    [ntp_ok=$enableval],
2801280849Scy    [ntp_ok=$ntp_eapc]
2802280849Scy)
2803280849Scycase "$ntp_ok" in
2804280849Scy yes)
2805181834Sroberto    ntp_libparse=yes
2806181834Sroberto    ntp_parseutil=yes
2807181834Sroberto    ntp_refclock=yes
2808181834Sroberto    ntp_rawdcf=yes
2809280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2810280849Scy    ;;
2811280849Scyesac
2812280849ScyAC_MSG_RESULT([$ntp_ok])
2813181834Srobertocase "$ntp_ok$ntp_canparse" in
2814181834Sroberto yesno)
2815280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2816181834Srobertoesac
2817181834Sroberto
2818181834Srobertocase "$ntp_rawdcf" in
2819181834Sroberto yes)
2820200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2821280849Scy	[ntp_cv_rawdcf_parity],
2822280849Scy	[
2823280849Scy	    ans=no
2824280849Scy	    case "$host" in
2825280849Scy	     *-*-*linux*)
2826280849Scy		ans=yes
2827280849Scy		;;
2828280849Scy	    esac
2829280849Scy	    ntp_cv_rawdcf_parity=$ans
2830280849Scy	]
2831280849Scy    )
2832280849Scy    case "$ntp_cv_rawdcf_parity" in
2833280849Scy     yes)
2834280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2835280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2836181834Sroberto    esac
2837181834Srobertoesac
2838181834Sroberto
2839200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2840280849ScyAC_ARG_ENABLE(
2841280849Scy    [RCC8000],
2842280849Scy    [AS_HELP_STRING(
2843280849Scy	[--enable-RCC8000],
2844280849Scy	[s RCC 8000 clock]
2845280849Scy    )],
2846280849Scy    [ntp_ok=$enableval],
2847280849Scy    [ntp_ok=$ntp_eapc]
2848280849Scy)
2849280849Scycase "$ntp_ok" in
2850280849Scy yes)
2851181834Sroberto    ntp_libparse=yes
2852181834Sroberto    ntp_refclock=yes
2853280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2854280849Scy    ;;
2855280849Scyesac
2856280849ScyAC_MSG_RESULT([$ntp_ok])
2857181834Srobertocase "$ntp_ok$ntp_canparse" in
2858181834Sroberto yesno)
2859280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2860181834Srobertoesac
2861181834Sroberto
2862200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2863280849ScyAC_ARG_ENABLE(
2864280849Scy    [SCHMID],
2865280849Scy    [AS_HELP_STRING(
2866280849Scy	[--enable-SCHMID ],
2867280849Scy	[s Schmid DCF77 clock]
2868280849Scy    )],
2869280849Scy    [ntp_ok=$enableval],
2870280849Scy    [ntp_ok=$ntp_eapc]
2871280849Scy)
2872280849Scycase "$ntp_ok" in
2873280849Scy yes)
2874181834Sroberto    ntp_libparse=yes
2875181834Sroberto    ntp_refclock=yes
2876280849Scy    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2877280849Scy    ;;
2878280849Scyesac
2879280849ScyAC_MSG_RESULT([$ntp_ok])
2880181834Srobertocase "$ntp_ok$ntp_canparse" in
2881181834Sroberto yesno)
2882280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2883181834Srobertoesac
2884181834Sroberto
2885200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2886280849ScyAC_ARG_ENABLE(
2887280849Scy    [TRIMTAIP],
2888280849Scy    [AS_HELP_STRING(
2889280849Scy	[--enable-TRIMTAIP],
2890280849Scy	[s Trimble GPS receiver/TAIP protocol]
2891280849Scy    )],
2892280849Scy    [ntp_ok=$enableval],
2893280849Scy    [ntp_ok=$ntp_eapc]
2894280849Scy)
2895280849Scycase "$ntp_ok" in
2896280849Scy yes)
2897181834Sroberto    ntp_libparse=yes
2898181834Sroberto    ntp_refclock=yes
2899280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2900280849Scy	[Trimble GPS receiver/TAIP protocol])
2901280849Scy    ;;
2902280849Scyesac
2903280849ScyAC_MSG_RESULT([$ntp_ok])
2904181834Srobertocase "$ntp_ok$ntp_canparse" in
2905181834Sroberto yesno)
2906280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2907181834Srobertoesac
2908181834Sroberto
2909200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2910280849ScyAC_ARG_ENABLE(
2911280849Scy    [TRIMTSIP],
2912280849Scy    [AS_HELP_STRING(
2913280849Scy	[--enable-TRIMTSIP],
2914280849Scy	[s Trimble GPS receiver/TSIP protocol]
2915280849Scy    )],
2916280849Scy    [ntp_ok=$enableval],
2917280849Scy    [ntp_ok=$ntp_eapc]
2918280849Scy)
2919280849Scycase "$ntp_ok" in
2920280849Scy yes)
2921181834Sroberto    ntp_libparse=yes
2922181834Sroberto    ntp_refclock=yes
2923280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2924280849Scy	[Trimble GPS receiver/TSIP protocol])
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([WHARTON 400A Series clock])
2934280849ScyAC_ARG_ENABLE(
2935280849Scy    [WHARTON],
2936280849Scy    [AS_HELP_STRING(
2937280849Scy	[--enable-WHARTON],
2938280849Scy	[s WHARTON 400A Series clock]
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_WHARTON_400A], [1], [WHARTON 400A Series clock])
2948280849Scy    ;;
2949280849Scyesac
2950280849ScyAC_MSG_RESULT([$ntp_ok])
2951181834Srobertocase "$ntp_ok$ntp_canparse" in
2952181834Sroberto yesno)
2953280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2954280849Scyesac
2955280849Scy
2956280849ScyAC_MSG_CHECKING([VARITEXT clock])
2957280849ScyAC_ARG_ENABLE(
2958280849Scy    [VARITEXT],
2959280849Scy    [AS_HELP_STRING(
2960280849Scy	[--enable-VARITEXT],
2961280849Scy	[s VARITEXT clock]
2962280849Scy    )],
2963280849Scy    [ntp_ok=$enableval],
2964280849Scy    [ntp_ok=$ntp_eapc]
2965280849Scy)
2966280849Scycase "$ntp_ok" in
2967280849Scy yes)
2968280849Scy    ntp_libparse=yes
2969280849Scy    ntp_refclock=yes
2970280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2971181834Sroberto    ;;
2972181834Srobertoesac
2973280849ScyAC_MSG_RESULT([$ntp_ok])
2974280849Scycase "$ntp_ok$ntp_canparse" in
2975280849Scy yesno)
2976280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2977280849Scyesac
2978181834Sroberto
2979280849ScyAC_MSG_CHECKING(SEL240X clock)
2980280849ScyAC_ARG_ENABLE(SEL240X,
2981280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2982181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2983181834Srobertoif test "$ntp_ok" = "yes"; then
2984181834Sroberto    ntp_libparse=yes
2985181834Sroberto    ntp_refclock=yes
2986280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2987181834Srobertofi
2988181834SrobertoAC_MSG_RESULT($ntp_ok)
2989181834Srobertocase "$ntp_ok$ntp_canparse" in
2990181834Sroberto yesno)
2991280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2992181834Sroberto    ;;
2993181834Srobertoesac
2994280849Scy
2995280849ScyAC_SUBST([LIBPARSE])
2996280849ScyAC_SUBST([MAKE_LIBPARSE])
2997280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
2998280849ScyAC_SUBST([MAKE_CHECK_Y2K])
2999280849Scy
3000200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3001181834Srobertoans=no
3002181834Srobertocase "$ntp_libparse" in
3003181834Sroberto yes)
3004181834Sroberto    ans=yes
3005280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3006181834Sroberto    LIBPARSE=../libparse/libparse.a
3007181834Sroberto    MAKE_LIBPARSE=libparse.a
3008181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3009181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3010181834Srobertoesac
3011200576SrobertoAC_MSG_RESULT([$ans])
3012181834Sroberto
3013280849ScyNTP_OPENSSL
3014181834Sroberto
3015280849ScyNTP_CRYPTO_RAND
3016181834Sroberto
3017280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3018280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3019280849ScyAC_ARG_ENABLE(
3020280849Scy    [autokey],
3021280849Scy    AS_HELP_STRING(
3022280849Scy	[--enable-autokey],
3023280849Scy	[+ support NTP Autokey protocol]
3024280849Scy	),
3025280849Scy    [ntp_autokey=$enableval],
3026280849Scy    [ntp_autokey=$ntp_openssl]
3027280849Scy)
3028280849Scycase "$ntp_autokey" in
3029280849Scy no)
3030181834Sroberto    ;;
3031280849Scy *)
3032280849Scy    case "$ntp_openssl" in
3033181834Sroberto     no)
3034280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3035280849Scy	ntp_autokey=no
3036181834Sroberto	;;
3037280849Scy     *)
3038280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3039280849Scy	ntp_autokey=yes
3040181834Sroberto	;;
3041181834Sroberto    esac
3042181834Sroberto    ;;
3043181834Srobertoesac
3044280849ScyAC_MSG_RESULT([$ntp_autokey])
3045181834Sroberto
3046280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3047200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3048181834Srobertocase "$cross_compiling$PATH_PERL" in
3049181834Sroberto no/*)
3050181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3051181834Sroberto    ans=yes
3052181834Sroberto    ;;
3053181834Sroberto *)
3054181834Sroberto    ans=no
3055181834Sroberto    ;;
3056181834Srobertoesac
3057200576SrobertoAC_MSG_RESULT([$ans])
3058181834Sroberto
3059280849ScyAC_SUBST([TESTDCF])
3060280849ScyAC_SUBST([DCFD])
3061200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3062181834Srobertoans=no
3063280849Scycase "$ntp_parseutil" in
3064280849Scy yes)
3065181834Sroberto    case "$host" in
3066200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3067181834Sroberto	ans="dcfd testdcf"
3068181834Sroberto	DCFD=dcfd
3069280849Scy	TESTDCF=testdcf
3070181834Sroberto    esac
3071280849Scy    ;;
3072280849Scyesac
3073200576SrobertoAC_MSG_RESULT([$ans])
3074181834Sroberto
3075280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3076200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3077181834Srobertoans=no
3078181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3079181834Sroberto yesyes)
3080181834Sroberto    case "$host" in
3081181834Sroberto     sparc-*-sunos4*)
3082280849Scy        case "$ntp_cv_var_kernel_pll" in
3083181834Sroberto	yes)
3084280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3085181834Sroberto	    ;;
3086181834Sroberto	esac
3087181834Sroberto	ans=parsestreams
3088181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3089181834Sroberto	;;
3090181834Sroberto     sparc-*-solaris2*)
3091181834Sroberto	ans=parsesolaris
3092181834Sroberto	MAKE_PARSEKMODULE=parse
3093280849Scy	AC_CHECK_HEADERS([strings.h])
3094181834Sroberto	;;
3095181834Sroberto    esac
3096181834Sroberto    ;;
3097181834Srobertoesac
3098200576SrobertoAC_MSG_RESULT([$ans])
3099181834Sroberto
3100200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3101280849Scycase "$ntp_refclock" in
3102280849Scy yes)
3103280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3104280849Scy    ;;
3105280849Scyesac
3106181834SrobertoAC_MSG_RESULT($ntp_refclock)
3107181834Sroberto
3108280849Scydnl Things that can be made in clockstuff
3109280849ScyAC_SUBST([PROPDELAY], [propdelay])
3110280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3111181834Sroberto
3112280849ScyAC_SUBST([MAKE_ADJTIMED])
3113280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3114181834Srobertocase "$host" in
3115181834Sroberto *-*-hpux[[56789]]*)
3116181834Sroberto    ans=yes
3117181834Sroberto    ;;
3118181834Sroberto *) ans=no
3119181834Sroberto    ;;
3120181834Srobertoesac
3121280849Scycase "$ans" in
3122280849Scy yes)
3123181834Sroberto    MAKE_ADJTIMED=adjtimed
3124280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3125280849Scy	[Do we need HPUX adjtime() library support?])
3126280849Scy    ;;
3127280849Scy *) ADJTIMED_DB=
3128280849Scy    ADJTIMED_DL=
3129280849Scy    ADJTIMED_DS=
3130280849Scy    ADJTIMED_MS=
3131280849Scy    ;;
3132280849Scyesac
3133200576SrobertoAC_MSG_RESULT([$ans])
3134181834Sroberto
3135200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3136181834Srobertocase "$host" in
3137181834Sroberto *-*-qnx*)
3138181834Sroberto    ans=yes
3139181834Sroberto    ;;
3140181834Sroberto *) ans=no
3141181834Sroberto    ;;
3142181834Srobertoesac
3143280849Scycase "$ans" in
3144280849Scy yes)
3145280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3146280849Scy	[Do we need the qnx adjtime call?])
3147280849Scy    ;;
3148280849Scyesac
3149200576SrobertoAC_MSG_RESULT([$ans])
3150181834Sroberto
3151200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3152181834Sroberto
3153200576Sroberto#  the default is to enable it if the system has the capability
3154200576Sroberto
3155200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3156200576Sroberto *yes*)
3157200576Sroberto    ans=yes
3158200576Sroberto    ;;
3159200576Sroberto *) ans=no
3160280849Scy    ;;
3161181834Srobertoesac
3162181834Sroberto
3163200576Srobertocase "$host" in
3164200576Sroberto *-*-domainos)	# Won't be found...
3165200576Sroberto    ans=no
3166200576Sroberto    ;;
3167200576Sroberto *-*-hpux*)
3168200576Sroberto    #ans=no
3169200576Sroberto    ;;
3170200576Sroberto *-*-irix[[456]]*)
3171200576Sroberto    ans=no
3172200576Sroberto    ;;
3173200576Sroberto *-*-*linux*)
3174200576Sroberto    ans=no
3175200576Sroberto    ;;
3176200576Sroberto *-*-winnt3.5)
3177200576Sroberto    ans=no
3178200576Sroberto    ;;
3179200576Sroberto *-*-unicosmp*)
3180200576Sroberto    ans=no
3181200576Sroberto    ;;
3182200576Srobertoesac
3183200576Sroberto
3184200576Sroberto# --enable-kmem / --disable-kmem controls if present
3185200576SrobertoAC_ARG_ENABLE(
3186200576Sroberto    [kmem],
3187280849Scy    [AS_HELP_STRING(
3188200576Sroberto	[--enable-kmem],
3189200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3190280849Scy    )],
3191200576Sroberto    [ans=$enableval]
3192200576Sroberto)
3193200576Sroberto
3194200576SrobertoAC_MSG_RESULT([$ans])
3195200576Sroberto
3196200576Srobertocase "$ans" in
3197200576Sroberto yes)
3198200576Sroberto    can_kmem=yes
3199200576Sroberto    ;;
3200280849Scy *)
3201200576Sroberto    can_kmem=no
3202280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3203200576Srobertoesac
3204200576Sroberto
3205200576Sroberto
3206200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3207200576Sroberto
3208200576Sroberto# target-dependent defaults
3209200576Sroberto
3210200576Srobertocase "$host" in
3211200576Sroberto i386-sequent-ptx*)
3212200576Sroberto    ans=no
3213200576Sroberto    ;;
3214200576Sroberto i386-unknown-osf1*)
3215200576Sroberto    ans=yes
3216200576Sroberto    ;;
3217200576Sroberto mips-sgi-irix[[456]]*)
3218200576Sroberto    ans=yes
3219200576Sroberto    ;;
3220200576Sroberto *-fujitsu-uxp*)
3221200576Sroberto    ans=yes
3222200576Sroberto    ;;
3223280849Scy *-ibm-aix[[4-9]]*)
3224280849Scy    # XXX only verified thru AIX6.
3225200576Sroberto    ans=yes
3226200576Sroberto    ;;
3227200576Sroberto *-*-*linux*)
3228200576Sroberto    ans=yes
3229200576Sroberto    ;;
3230200576Sroberto *-*-solaris2.[[01]])
3231200576Sroberto    ans=no
3232200576Sroberto    ;;
3233200576Sroberto *-*-solaris2*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236200576Sroberto *-*-unicosmp*)
3237200576Sroberto    ans=yes
3238200576Sroberto    ;;
3239200576Sroberto *) ans=no
3240280849Scy    ;;
3241200576Srobertoesac
3242200576Sroberto
3243200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3244200576Sroberto# override the default
3245280849ScyAC_ARG_ENABLE(
3246280849Scy    [accurate-adjtime],
3247280849Scy    [AS_HELP_STRING(
3248280849Scy	[--enable-accurate-adjtime],
3249280849Scy	[s the adjtime() call is accurate]
3250280849Scy    )],
3251280849Scy    [ans=$enableval]
3252200576Sroberto)
3253200576Sroberto
3254200576SrobertoAC_MSG_RESULT([$ans])
3255200576Sroberto
3256200576Srobertocase "$ans" in
3257280849Scy yes)
3258280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3259200576Sroberto    adjtime_is_accurate=yes
3260200576Sroberto    ;;
3261200576Sroberto *)
3262200576Sroberto    adjtime_is_accurate=no
3263280849Scy    ;;
3264181834Srobertoesac
3265181834Sroberto
3266280849ScyAC_CACHE_CHECK(
3267280849Scy    [the name of 'tick' in the kernel],
3268280849Scy    [ntp_cv_nlist_tick],
3269280849Scy    [
3270280849Scy	ans=_tick
3271280849Scy	case "$host" in
3272280849Scy	 m68*-hp-hpux*) # HP9000/300?
3273280849Scy	    ans=_old_tick
3274280849Scy	    ;;
3275280849Scy	 *-apple-aux[[23]]*)
3276280849Scy	    ans=tick
3277280849Scy	    ;;
3278280849Scy	 *-hp-hpux*)
3279280849Scy	    ans=old_tick
3280280849Scy	    ;;
3281280849Scy	 *-ibm-aix[[3-9]]*)
3282280849Scy	    # XXX only verified thru AIX6.
3283280849Scy	    ans=no
3284280849Scy	    ;;
3285280849Scy	 *-*-mpeix*)
3286280849Scy	    ans=no
3287280849Scy	    ;;
3288280849Scy	 *-*-ptx*)
3289280849Scy	    ans=tick
3290280849Scy	    ;;
3291280849Scy	 *-*-sco3.2v[[45]]*)
3292280849Scy	    ans=no
3293280849Scy	    ;;
3294280849Scy	 *-*-solaris2*)
3295280849Scy	    ans=nsec_per_tick
3296280849Scy	    ;;
3297280849Scy	 *-*-sysv4*)
3298280849Scy	    ans=tick
3299280849Scy	    ;;
3300280849Scy	esac
3301280849Scy	ntp_cv_nlist_tick=$ans
3302280849Scy    ]
3303280849Scy)
3304280849Scycase "$ntp_cv_nlist_tick" in
3305280849Scy ''|no)
3306280849Scy    ;;	# HMS: I think we can only get 'no' here...
3307280849Scy *)
3308280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3309280849Scy	[What is the name of TICK in the kernel?])
3310181834Srobertoesac
3311280849Scy
3312280849ScyAC_CACHE_CHECK(
3313280849Scy    [for the units of 'tick'],
3314280849Scy    [ntp_cv_tick_nano],
3315280849Scy    [
3316280849Scy	ans=usec
3317280849Scy	case "$host" in
3318280849Scy	 *-*-solaris2*)
3319280849Scy	    ans=nsec
3320280849Scy	    ;;
3321280849Scy	esac
3322280849Scy	ntp_cv_tick_nano=$ans
3323280849Scy    ]
3324280849Scy)
3325280849Scycase "$ntp_cv_tick_nano" in
3326181834Sroberto nsec)
3327280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3328181834Srobertoesac
3329280849Scy
3330280849ScyAC_CACHE_CHECK(
3331280849Scy    [the name of 'tickadj' in the kernel],
3332280849Scy    [ntp_cv_nlist_tickadj],
3333280849Scy    [
3334280849Scy	ans=_tickadj
3335280849Scy	case "$host" in
3336280849Scy	 m68*-hp-hpux*) # HP9000/300?
3337280849Scy	    ans=_tickadj
3338280849Scy	    ;;
3339280849Scy	 *-apple-aux[[23]]*)
3340280849Scy	    ans=tickadj
3341280849Scy	    ;;
3342280849Scy	 *-hp-hpux10*)
3343280849Scy	    ans=no
3344280849Scy	    ;;
3345280849Scy	 *-hp-hpux9*)
3346280849Scy	    ans=no
3347280849Scy	    ;;
3348280849Scy	 *-hp-hpux*)
3349280849Scy	    ans=tickadj
3350280849Scy	    ;;
3351280849Scy	 *-*-aix*)
3352280849Scy	    ans=tickadj
3353280849Scy	    ;;
3354280849Scy	 *-*-mpeix*)
3355280849Scy	    ans=no
3356280849Scy	    ;;
3357280849Scy	 *-*-ptx*)
3358280849Scy	    ans=tickadj
3359280849Scy	    ;;
3360280849Scy	 *-*-sco3.2v4*)
3361280849Scy	    ans=no
3362280849Scy	    ;;
3363280849Scy	 *-*-sco3.2v5.0*)
3364280849Scy	    ans=clock_drift
3365280849Scy	    ;;
3366280849Scy	 *-*-solaris2*)
3367280849Scy	    ans=no	# hrestime_adj
3368280849Scy	    ;;
3369280849Scy	 *-*-sysv4*)
3370280849Scy	    ans=tickadj
3371280849Scy	    ;;
3372280849Scy	esac
3373280849Scy	ntp_cv_nlist_tickadj=$ans
3374280849Scy    ]
3375280849Scy)
3376280849Scycase "$ntp_cv_nlist_tickadj" in
3377280849Scy ''|no)
3378280849Scy    ;;	# HMS: I think we can only get 'no' here...
3379280849Scy *)
3380280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3381280849Scy	[What is the name of TICKADJ in the kernel?])
3382181834Srobertoesac
3383280849Scy
3384280849ScyAC_CACHE_CHECK(
3385280849Scy    [for the units of 'tickadj'],
3386280849Scy    [ntp_cv_tickadj_nano],
3387280849Scy    [
3388280849Scy	ans=usec
3389280849Scy	case "$host" in
3390280849Scy	 *-*-solaris2*)
3391280849Scy	    ans=nsec
3392280849Scy	    ;;
3393280849Scy	esac
3394280849Scy	ntp_cv_tickadj_nano=$ans
3395280849Scy    ]
3396280849Scy)
3397280849Scycase "$ntp_cv_tickadj_nano" in
3398181834Sroberto nsec)
3399280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3400181834Srobertoesac
3401280849Scy
3402280849ScyAC_CACHE_CHECK(
3403280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3404280849Scy    [ntp_cv_nlist_dosynctodr],
3405280849Scy    [
3406280849Scy	case "$host" in
3407280849Scy	 *-apple-aux[[23]]*)
3408280849Scy	    ans=no
3409280849Scy	    ;;
3410280849Scy	 *-sni-sysv*)
3411280849Scy	    ans=dosynctodr
3412280849Scy	    ;;
3413285169Scy	 *-stratus-vos)
3414285169Scy	    ans=no
3415285169Scy	    ;;
3416280849Scy	 *-*-aix*)
3417280849Scy	    ans=dosynctodr
3418280849Scy	    ;;
3419280849Scy	 *-*-hpux*)
3420280849Scy	    ans=no
3421280849Scy	    ;;
3422280849Scy	 *-*-mpeix*)
3423280849Scy	    ans=no
3424280849Scy	    ;;
3425280849Scy	 *-*-nextstep*)
3426280849Scy	    ans=_dosynctodr
3427280849Scy	    ;;
3428280849Scy	 *-*-ptx*)
3429280849Scy	    ans=doresettodr
3430280849Scy	    ;;
3431280849Scy	 *-*-sco3.2v4*)
3432280849Scy	    ans=no
3433280849Scy	    ;;
3434280849Scy	 *-*-sco3.2v5*)
3435280849Scy	    ans=track_rtc
3436280849Scy	    ;;
3437280849Scy	 *-*-solaris2*)
3438280849Scy	    ans=dosynctodr
3439280849Scy	    ;;
3440280849Scy	 *-*-sysv4*)
3441280849Scy	    ans=doresettodr
3442280849Scy	    ;;
3443280849Scy	 *)
3444280849Scy	    ans=_dosynctodr
3445280849Scy	    ;;
3446280849Scy	esac
3447280849Scy	ntp_cv_nlist_dosynctodr=$ans
3448280849Scy    ]
3449280849Scy)
3450280849Scycase "$ntp_cv_nlist_dosynctodr" in
3451280849Scy no)
3452181834Sroberto    ;;
3453181834Sroberto *)
3454280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3455280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3456181834Sroberto    ;;
3457181834Srobertoesac
3458280849Scy
3459280849ScyAC_CACHE_CHECK(
3460280849Scy    [half-heartedly for 'noprintf' in the kernel],
3461280849Scy    [ntp_cv_nlist_noprintf],
3462280849Scy    [
3463280849Scy	case "$host" in
3464280849Scy	 *-apple-aux[[23]]*)
3465280849Scy	    ans=no
3466280849Scy	    ;;
3467280849Scy	 *-sni-sysv*)
3468280849Scy	    ans=noprintf
3469280849Scy	    ;;
3470285169Scy	 *-stratus-vos)
3471285169Scy	    ans=no
3472285169Scy	    ;;
3473280849Scy	 *-*-aix*)
3474280849Scy	    ans=noprintf
3475280849Scy	    ;;
3476280849Scy	 *-*-hpux*)
3477280849Scy	    ans=no
3478280849Scy	    ;;
3479280849Scy	 *-*-mpeix*)
3480280849Scy	    ans=no
3481280849Scy	    ;;
3482280849Scy	 *-*-ptx*)
3483280849Scy	    ans=noprintf
3484280849Scy	    ;;
3485280849Scy	 *-*-nextstep*)
3486280849Scy	    ans=_noprintf
3487280849Scy	    ;;
3488280849Scy	 *-*-solaris2*)
3489280849Scy	    ans=noprintf
3490280849Scy	    ;;
3491280849Scy	 *-*-sysv4*)
3492280849Scy	    ans=noprintf
3493280849Scy	    ;;
3494280849Scy	 *)
3495280849Scy	    ans=_noprintf
3496280849Scy	    ;;
3497280849Scy	esac
3498280849Scy	ntp_cv_nlist_noprintf=$ans
3499280849Scy    ]
3500280849Scy)
3501280849Scycase "$ntp_cv_nlist_noprintf" in
3502280849Scy no)
3503181834Sroberto    ;;
3504181834Sroberto *)
3505280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3506280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3507181834Sroberto    ;;
3508181834Srobertoesac
3509181834Sroberto
3510181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3511181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3512181834Sroberto
3513280849Scydnl	tick		tickadj
3514181834Srobertodnl	10000		80	    Unixware
3515181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3516181834Srobertodnl	10000		150	    sgi IRIX
3517181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3518181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3519181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3520181834Srobertodnl	txc.tick	1	    Linux
3521181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3522181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3523181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3524181834Sroberto
3525181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3526181834Sroberto
3527200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3528200576Sroberto
3529200576Sroberto# target-dependent default for tick
3530200576Sroberto
3531200576Srobertocase "$host" in
3532200576Sroberto *-*-pc-cygwin*)
3533200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3534200576Sroberto    ;;
3535200576Sroberto *-univel-sysv*)
3536200576Sroberto    ans=10000
3537200576Sroberto    ;;
3538200576Sroberto *-*-irix*)
3539200576Sroberto    ans=10000
3540200576Sroberto    ;;
3541200576Sroberto *-*-*linux*)
3542200576Sroberto    ans=txc.tick
3543200576Sroberto    ;;
3544200576Sroberto *-*-mpeix*)
3545200576Sroberto    ans=no
3546200576Sroberto    ;;
3547200576Sroberto *-*-winnt3.5)
3548200576Sroberto    ans='(every / 10)'
3549200576Sroberto    ;;
3550200576Sroberto *-*-unicosmp*)
3551200576Sroberto    ans=10000
3552200576Sroberto    ;;
3553200576Sroberto *)
3554200576Sroberto    ans='1000000L/hz'
3555200576Sroberto    ;;
3556200576Srobertoesac
3557200576Sroberto
3558200576SrobertoAC_ARG_ENABLE(
3559200576Sroberto    [tick],
3560280849Scy    [AS_HELP_STRING(
3561200576Sroberto	[--enable-tick=VALUE],
3562200576Sroberto	[s force a value for 'tick']
3563280849Scy    )],
3564200576Sroberto    [ans=$enableval]
3565200576Sroberto)
3566200576Sroberto
3567200576SrobertoAC_MSG_RESULT([$ans])
3568200576Sroberto
3569200576Srobertocase "$ans" in
3570280849Scy ''|no)
3571280849Scy    ;;	# HMS: I think we can only get 'no' here...
3572280849Scy *)
3573280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3574280849Scy	[Preset a value for 'tick'?])
3575181834Srobertoesac
3576181834Sroberto
3577200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3578200576Sroberto
3579200576Sroberto# target-specific default
3580200576Srobertoans='500/hz'
3581200576Srobertocase "$host" in
3582200576Sroberto *-fujitsu-uxp*)
3583200576Sroberto    case "$adjtime_is_accurate" in
3584200576Sroberto     yes)
3585280849Scy	ans='tick/16'
3586200576Sroberto    esac
3587200576Sroberto    ;;
3588200576Sroberto *-univel-sysv*)
3589200576Sroberto    ans=80
3590200576Sroberto    ;;
3591200576Sroberto *-*-aix*)
3592200576Sroberto    case "$can_kmem" in
3593200576Sroberto     no)
3594200576Sroberto	ans=1000
3595280849Scy	;;
3596200576Sroberto    esac
3597200576Sroberto    ;;
3598200576Sroberto *-*-domainos)	# Skippy: won't be found...
3599200576Sroberto    case "$can_kmem" in
3600200576Sroberto     no)
3601200576Sroberto	ans=668
3602280849Scy	;;
3603200576Sroberto    esac
3604200576Sroberto    ;;
3605200576Sroberto *-*-hpux*)
3606200576Sroberto    case "$adjtime_is_accurate" in
3607200576Sroberto     yes)
3608200576Sroberto	ans='tick/16'
3609280849Scy	;;
3610200576Sroberto    esac
3611200576Sroberto    ;;
3612200576Sroberto *-*-irix*)
3613200576Sroberto    ans=150
3614200576Sroberto    ;;
3615200576Sroberto *-*-mpeix*)
3616200576Sroberto    ans=no
3617200576Sroberto    ;;
3618200576Sroberto *-*-sco3.2v5.0*)
3619200576Sroberto    ans=10000L/hz
3620200576Sroberto    ;;
3621200576Sroberto *-*-winnt3.5)
3622200576Sroberto    ans=50
3623200576Sroberto    ;;
3624200576Sroberto *-*-unicosmp*)
3625200576Sroberto    ans=150
3626280849Scy    ;;
3627200576Srobertoesac
3628200576Sroberto
3629200576SrobertoAC_ARG_ENABLE(
3630200576Sroberto    [tickadj],
3631280849Scy    [AS_HELP_STRING(
3632280849Scy	[--enable-tickadj=VALUE],
3633280849Scy	[s force a value for 'tickadj']
3634280849Scy    )],
3635200576Sroberto    [ans=$enableval]
3636200576Sroberto)
3637200576Sroberto
3638200576SrobertoAC_MSG_RESULT([$ans])
3639200576Sroberto
3640200576Srobertodefault_tickadj=$ans
3641200576Sroberto
3642200576Srobertocase "$default_tickadj" in
3643280849Scy ''|no)
3644280849Scy    ;;	# HMS: I think we can only get 'no' here...
3645280849Scy *)
3646280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3647280849Scy	[Preset a value for 'tickadj'?]) ;;
3648181834Srobertoesac
3649181834Sroberto
3650181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3651181834Sroberto# 1/100s (system tick). Sigh ...
3652181834Sroberto# Unfortunately, there is no easy way to know if particular release
3653181834Sroberto# has this "feature" or any obvious way to test for it.
3654181834Srobertocase "$host" in
3655280849Scy mips-sni-sysv4*)
3656280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3657280849Scy	[Do we want the ReliantUNIX clock hacks?])
3658181834Srobertoesac
3659181834Sroberto
3660181834Srobertocase "$host" in
3661280849Scy *-*-sco3.2v5*)
3662280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3663181834Srobertoesac
3664181834Sroberto
3665280849Scyntp_cv_make_tickadj=yes
3666200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3667181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3668200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3669280849Scy    ntp_cv_make_tickadj=no
3670181834Sroberto    ;;
3671181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3672200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3673280849Scy    ntp_cv_make_tickadj=no
3674181834Sroberto    ;;
3675181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3676200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3677280849Scy    ntp_cv_make_tickadj=no
3678181834Sroberto    ;;
3679181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3680181834Sroberto    ;;
3681181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3682181834Sroberto    ;;
3683181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3684200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3685181834Sroberto    ;;
3686181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3687181834Sroberto    ;;
3688181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3689181834Sroberto    ;;
3690181834Sroberto *)		# Generally bogus.
3691200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3692181834Sroberto    ;;
3693181834Srobertoesac
3694181834Sroberto
3695181834SrobertoAC_SUBST(MAKE_NTPTIME)
3696200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3697181834Sroberto[case "$host" in
3698280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3699181834Sroberto     yesyes)
3700181834Sroberto	ans=yes
3701181834Sroberto	;;
3702181834Sroberto     *)
3703181834Sroberto	ans=no
3704181834Sroberto	;;
3705181834Sroberto    esac
3706181834Sroberto    ;;
3707181834Srobertoesac
3708181834Srobertoac_cv_make_ntptime=$ans])
3709181834Srobertocase "$ac_cv_make_ntptime" in
3710181834Sroberto yes)
3711181834Sroberto    MAKE_NTPTIME=ntptime
3712181834Sroberto    ;;
3713280849Scy *)
3714280849Scy    NTPTIME_DB=
3715280849Scy    NTPTIME_DL=
3716280849Scy    NTPTIME_DS=
3717280849Scy    NTPTIME_MS=
3718280849Scy    ;;
3719181834Srobertoesac
3720181834Sroberto
3721280849ScyAC_SUBST([MAKE_TICKADJ])
3722181834Srobertocase "$host" in
3723181834Sroberto mips-sni-sysv4*)
3724181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3725181834Sroberto    # Do not bother
3726280849Scy    ntp_cv_make_tickadj=no
3727181834Sroberto    ;;
3728181834Sroberto *-*-irix*)
3729280849Scy    ntp_cv_make_tickadj=no
3730181834Sroberto    ;;
3731181834Sroberto *-*-solaris2*)
3732181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3733181834Sroberto    case "$host" in
3734181834Sroberto     *-*-solaris2.1[[0-9]]*)
3735280849Scy	ntp_cv_make_tickadj=no
3736181834Sroberto	;;
3737181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3738280849Scy     *) ntp_cv_make_tickadj=no ;;
3739181834Sroberto    esac
3740181834Sroberto    ;;
3741181834Sroberto *-*-unicosmp*)
3742280849Scy    ntp_cv_make_tickadj=no
3743181834Sroberto    ;;
3744181834Srobertoesac
3745200576Sroberto
3746200576Sroberto#
3747200576Sroberto# Despite all the above, we always make tickadj.  Setting
3748280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3749200576Sroberto# report that the configuration variable was cached.  It may
3750200576Sroberto# be better to simply remove the hunk above, I did not want
3751200576Sroberto# to remove it if there is hope it will be used again.
3752200576Sroberto#
3753280849ScyAS_UNSET([ntp_cv_make_tickadj])
3754200576Sroberto
3755280849ScyAC_CACHE_CHECK(
3756280849Scy    [if we want and can make the tickadj utility],
3757280849Scy    [ntp_cv_make_tickadj],
3758280849Scy    [ntp_cv_make_tickadj=yes]
3759280849Scy)
3760280849Scycase "$ntp_cv_make_tickadj" in
3761181834Sroberto yes)
3762181834Sroberto    MAKE_TICKADJ=tickadj
3763181834Sroberto    ;;
3764280849Scy *)
3765280849Scy    CALC_TICKADJ_DB=
3766280849Scy    CALC_TICKADJ_DL=
3767280849Scy    CALC_TICKADJ_DS=
3768280849Scy    CALC_TICKADJ_MS=
3769280849Scy    TICKADJ_DB=
3770280849Scy    TICKADJ_DL=
3771280849Scy    TICKADJ_DS=
3772280849Scy    TICKADJ_MS=
3773280849Scy    ;;
3774181834Srobertoesac
3775181834Sroberto
3776280849ScyAC_SUBST([MAKE_TIMETRIM])
3777280849ScyAC_CACHE_CHECK(
3778280849Scy    [if we want and can make the timetrim utility],
3779280849Scy    [ntp_cv_make_timetrim],
3780280849Scy    [
3781280849Scy	case "$host" in
3782280849Scy	 *-*-irix*)
3783280849Scy	    ntp_cv_make_timetrim=yes
3784280849Scy	    ;;
3785280849Scy	 *-*-unicosmp*)
3786280849Scy	    ntp_cv_make_timetrim=yes
3787280849Scy	    ;;
3788280849Scy	 *)
3789280849Scy	    ntp_cv_make_timetrim=no
3790280849Scy	    ;;
3791280849Scy	esac
3792280849Scy    ]
3793280849Scy)
3794280849Scycase "$ntp_cv_make_timetrim" in
3795181834Sroberto yes)
3796181834Sroberto    MAKE_TIMETRIM=timetrim
3797181834Sroberto    ;;
3798280849Scy *) TIMETRIM_DB=
3799280849Scy    TIMETRIM_DL=
3800280849Scy    TIMETRIM_DS=
3801280849Scy    TIMETRIM_MS=
3802280849Scy    ;;
3803181834Srobertoesac
3804181834Sroberto
3805280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3806280849ScyAC_SUBST([MAKE_NTPDSIM])
3807200576Sroberto
3808200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3809200576SrobertoAC_ARG_ENABLE(
3810200576Sroberto    [simulator],
3811280849Scy    [AS_HELP_STRING(
3812200576Sroberto	[--enable-simulator],
3813200576Sroberto	[- build/install the NTPD simulator?]
3814280849Scy    )],
3815280849Scy    [ans=$enableval],
3816200576Sroberto    [ans=no]
3817200576Sroberto)
3818200576SrobertoAC_MSG_RESULT([$ans])
3819200576Srobertocase "$ans" in
3820181834Sroberto yes)
3821181834Sroberto    MAKE_NTPDSIM=ntpdsim
3822181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3823181834Sroberto    ;;
3824280849Scy *)
3825280849Scy    NTPDSIM_DB=
3826280849Scy    NTPDSIM_DL=
3827280849Scy    NTPDSIM_DS=
3828280849Scy    NTPDSIM_MS=
3829280849Scy    ;;
3830181834Srobertoesac
3831181834Sroberto
3832181834Srobertocase "$build" in
3833181834Sroberto $host)
3834181834Sroberto    ;;
3835181834Sroberto *) case "$host" in
3836181834Sroberto     *-*-vxworks*)
3837200576Sroberto	LDFLAGS="$LDFLAGS -r"
3838200576Sroberto	;;
3839181834Sroberto    esac
3840181834Sroberto    ;;
3841181834Srobertoesac
3842181834Sroberto
3843280849ScyNTP_WITHSNTP
3844200576Sroberto
3845280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3846280849ScyAC_ARG_WITH(
3847280849Scy    [ntpsnmpd],
3848280849Scy    [AS_HELP_STRING(
3849280849Scy	[--with-ntpsnmpd],
3850280849Scy	[s Build ntpsnmpd MIB agent?]
3851280849Scy    )],
3852280849Scy    [ans=$withval],
3853280849Scy    [
3854280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3855280849Scy	 /*)	ans=yes ;;
3856280849Scy	 *)	ans=no  ;;
3857280849Scy	esac
3858280849Scy    ]
3859280849Scy)
3860280849ScyAC_MSG_RESULT([$ans])
3861280849Scycase "$ans" in
3862280849Scy yes)
3863280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3864280849Scy     /*)
3865280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3866285169Scy	# Bug 2815.  This is a bit of a hack, but it works...
3867285169Scy	case "$ntp_cv_net_snmp_version" in
3868285169Scy	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3869285169Scy		;;
3870285169Scy	esac
3871280849Scy	AC_SUBST([SNMP_LIBS])
3872280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3873280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3874280849Scy	SNMP_CPPFLAGS=
3875280849Scy	SNMP_CFLAGS=
3876280849Scy	for i in $foo; do
3877280849Scy	    case "$i" in
3878280849Scy	     -D*|-U*|-I*)
3879280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3880280849Scy		;;
3881280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3882280849Scy		;;
3883280849Scy	    esac
3884280849Scy	done
3885280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3886280849Scy	AC_SUBST([SNMP_CFLAGS])
3887280849Scy
3888280849Scy	save_CFLAGS=$CFLAGS
3889280849Scy	save_CPPFLAGS=$CPPFLAGS
3890280849Scy	save_LIBS=$LIBS
3891280849Scy	CFLAGS=$SNMP_CFLAGS
3892280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3893280849Scy
3894280849Scy	AC_CHECK_HEADER(
3895280849Scy	    [net-snmp/net-snmp-config.h],
3896280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3897280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3898280849Scy	)
3899280849Scy
3900280849Scy	# Do this last, as we're messing up LIBS.
3901280849Scy	# check -lnetsnmp for netsnmp_daemonize
3902280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3903280849Scy	AC_CHECK_LIB(
3904280849Scy	    [netsnmp],
3905280849Scy	    [netsnmp_daemonize],
3906280849Scy	    [ans=yes],
3907280849Scy	    [ans=no]
3908280849Scy	)
3909280849Scy	case "$ans" in
3910280849Scy	 no)
3911280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3912280849Scy		[We need to provide netsnmp_daemonize()])
3913280849Scy	esac
3914280849Scy	
3915280849Scy	CFLAGS=$save_CFLAGS
3916280849Scy	AS_UNSET([save_CFLAGS])
3917280849Scy	CPPFLAGS=$save_CPPFLAGS
3918280849Scy	AS_UNSET([save_CPPFLAGS])
3919280849Scy	LIBS=$save_LIBS
3920280849Scy	AS_UNSET([save_LIBS])
3921280849Scy	;;
3922280849Scy     *) 
3923280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3924280849Scy	;;
3925280849Scy    esac
3926280849Scy    ;;
3927280849Scyesac
3928280849ScyAC_SUBST([MAKE_NTPSNMPD])
3929280849Scy
3930280849Scycase "$MAKE_NTPSNMPD" in
3931280849Scy '')
3932280849Scy    NTPSNMPD_DB=
3933280849Scy    NTPSNMPD_DL=
3934280849Scy    NTPSNMPD_DS=
3935280849Scy    NTPSNMPD_MS=
3936280849Scy    ;;
3937280849Scyesac
3938280849Scy
3939200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3940200576Sroberto
3941200576Sroberto# target-specific defaults
3942200576Sroberto
3943200576Srobertocase "$host" in
3944200576Sroberto *-apple-aux[[23]]*)
3945200576Sroberto    ans=yes
3946200576Sroberto    ;;
3947200576Sroberto *-*-bsdi[[012]]*)
3948200576Sroberto    ans=no
3949200576Sroberto    ;;
3950200576Sroberto *-*-bsdi*)
3951200576Sroberto    ans=yes
3952200576Sroberto    ;;
3953200576Sroberto *-*-openvms*)	# HMS: won't be found
3954200576Sroberto    ans=yes
3955200576Sroberto    ;;
3956200576Sroberto *) ans=no
3957200576Sroberto    ;;
3958200576Srobertoesac
3959200576Sroberto
3960200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3961200576Sroberto
3962200576SrobertoAC_ARG_ENABLE(
3963200576Sroberto    [slew-always],
3964280849Scy    [AS_HELP_STRING(
3965200576Sroberto	[--enable-slew-always],
3966200576Sroberto	[s always slew the time]
3967280849Scy    )],
3968200576Sroberto    [ans=$enableval]
3969200576Sroberto)
3970200576Sroberto
3971200576SrobertoAC_MSG_RESULT([$ans])
3972200576Sroberto
3973200576Srobertocase "$ans" in
3974280849Scy yes)
3975280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3976181834Srobertoesac
3977181834Sroberto
3978200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3979200576Sroberto
3980200576Srobertocase "$host" in
3981200576Sroberto *-sni-sysv*)
3982200576Sroberto    ans=yes
3983200576Sroberto    ;;
3984285169Scy *-stratus-vos)
3985285169Scy    ans=no
3986285169Scy    ;;
3987200576Sroberto *-univel-sysv*)
3988200576Sroberto    ans=no
3989200576Sroberto    ;;
3990200576Sroberto *-*-ptx*)
3991200576Sroberto    ans=yes
3992200576Sroberto    ;;
3993200576Sroberto *-*-solaris2.1[[0-9]]*)
3994200576Sroberto    ans=no
3995200576Sroberto    ;;
3996200576Sroberto *-*-solaris2.[[012]]*)
3997200576Sroberto    ans=yes
3998200576Sroberto    ;;
3999200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4000200576Sroberto    ans=yes
4001200576Sroberto    ;;
4002200576Sroberto *) ans=no
4003200576Sroberto    ;;
4004200576Srobertoesac
4005200576Sroberto
4006200576SrobertoAC_ARG_ENABLE(
4007200576Sroberto    [step-slew],
4008280849Scy    [AS_HELP_STRING(
4009200576Sroberto	[--enable-step-slew],
4010200576Sroberto	[s step and slew the time]
4011280849Scy    )],
4012200576Sroberto    [ans=$enableval]
4013200576Sroberto)
4014200576Sroberto
4015200576SrobertoAC_MSG_RESULT([$ans])
4016200576Sroberto
4017200576Srobertocase "$ans" in
4018280849Scy yes)
4019280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4020181834Srobertoesac
4021181834Sroberto
4022200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4023200576Sroberto
4024200576Srobertocase "$host" in
4025200576Sroberto *-apple-aux[[23]]*)
4026200576Sroberto    ans=yes
4027200576Sroberto    ;;
4028200576Sroberto *) ans=no
4029280849Scy    ;;
4030200576Srobertoesac
4031200576Sroberto
4032200576SrobertoAC_ARG_ENABLE(
4033200576Sroberto    [ntpdate-step],
4034280849Scy    [AS_HELP_STRING(
4035200576Sroberto	[--enable-ntpdate-step],
4036200576Sroberto	[s if ntpdate should step the time]
4037280849Scy    )],
4038200576Sroberto    [ans=$enableval]
4039200576Sroberto)
4040200576Sroberto
4041200576SrobertoAC_MSG_RESULT([$ans])
4042200576Sroberto
4043200576Srobertocase "$ans" in
4044280849Scy yes)
4045280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4046280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4047181834Srobertoesac
4048181834Sroberto
4049200576Sroberto
4050200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4051200576Sroberto
4052200576Srobertocase "$host" in
4053200576Sroberto *-*-nextstep*)
4054200576Sroberto    ans=yes
4055200576Sroberto    ;;
4056200576Sroberto *-*-openvms*)	# HMS: won't be found
4057200576Sroberto    ans=yes
4058200576Sroberto    ;;
4059200576Sroberto *)
4060200576Sroberto    ans=no
4061280849Scy    ;;
4062200576Srobertoesac
4063200576Sroberto
4064200576SrobertoAC_ARG_ENABLE(
4065200576Sroberto    [hourly-todr-sync],
4066280849Scy    [AS_HELP_STRING(
4067200576Sroberto	[--enable-hourly-todr-sync],
4068200576Sroberto	[s if we should sync TODR hourly]
4069280849Scy    )],
4070200576Sroberto    [ans=$enableval]
4071200576Sroberto)
4072200576Sroberto
4073200576SrobertoAC_MSG_RESULT([$ans])
4074200576Sroberto
4075181834Srobertocase "$ac_cv_var_sync_todr" in
4076280849Scy yes)
4077280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4078181834Srobertoesac
4079181834Sroberto
4080181834Sroberto
4081200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4082200576Sroberto
4083200576Srobertocase "$host" in
4084200576Sroberto *-*-solaris2.6)
4085200576Sroberto    unamev=`uname -v`
4086200576Sroberto    case "$unamev" in
4087200576Sroberto     Generic_105181-*)
4088200576Sroberto	old_IFS="$IFS"
4089200576Sroberto	IFS="-"
4090200576Sroberto	set $unamev
4091200576Sroberto	IFS="$old_IFS"
4092200576Sroberto	if test "$2" -ge 17
4093200576Sroberto	then
4094200576Sroberto	    # Generic_105181-17 and higher
4095200576Sroberto	    ans=no
4096200576Sroberto	else
4097200576Sroberto	    ans=yes
4098200576Sroberto	fi
4099200576Sroberto	;;
4100280849Scy     *)
4101181834Sroberto	ans=yes
4102280849Scy	;;
4103200576Sroberto    esac
4104200576Sroberto    ;;
4105200576Sroberto *-*-solaris2.7)
4106200576Sroberto    unamev=`uname -v`
4107200576Sroberto    case "$unamev" in
4108200576Sroberto     Generic_106541-*)
4109200576Sroberto	old_IFS="$IFS"
4110200576Sroberto	IFS="-"
4111200576Sroberto	set $unamev
4112200576Sroberto	IFS="$old_IFS"
4113200576Sroberto	if test "$2" -ge 07
4114200576Sroberto	then
4115200576Sroberto	    # Generic_106541-07 and higher
4116200576Sroberto	    ans=no
4117200576Sroberto	else
4118200576Sroberto	    ans=yes
4119200576Sroberto	fi
4120181834Sroberto	;;
4121200576Sroberto     *)
4122181834Sroberto	ans=yes
4123280849Scy	;;
4124181834Sroberto    esac
4125200576Sroberto    ;;
4126200576Sroberto *)
4127200576Sroberto    ans=no
4128280849Scy    ;;
4129200576Srobertoesac
4130200576Sroberto
4131200576SrobertoAC_ARG_ENABLE(
4132200576Sroberto    [kernel-fll-bug],
4133280849Scy    [AS_HELP_STRING(
4134200576Sroberto	[--enable-kernel-fll-bug],
4135200576Sroberto	[s if we should avoid a kernel FLL bug]
4136280849Scy    )],
4137200576Sroberto    [ans=$enableval]
4138200576Sroberto)
4139200576Sroberto
4140200576SrobertoAC_MSG_RESULT([$ans])
4141200576Sroberto
4142200576Srobertocase "$ans" in
4143280849Scy yes)
4144280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4145200576Srobertoesac
4146200576Sroberto
4147200576Sroberto
4148280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4149280849ScyAC_ARG_ENABLE(
4150280849Scy    [bug1243-fix],
4151280849Scy    [AS_HELP_STRING(
4152280849Scy	[--enable-bug1243-fix],
4153280849Scy	[+ use unmodified autokey session keys]
4154280849Scy    )],
4155280849Scy    [ans=$enableval],
4156280849Scy    [ans=yes]
4157280849Scy)
4158280849ScyAC_MSG_RESULT([$ans])
4159280849Scycase "$ans" in
4160280849Scy no)
4161280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4162280849Scy	[use old autokey session key behavior?])
4163280849Scyesac
4164280849Scy
4165280849Scy
4166298695SdelphijAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4167298695SdelphijAC_ARG_ENABLE(
4168298695Sdelphij    [bug3020-fix],
4169298695Sdelphij    [AS_HELP_STRING(
4170298695Sdelphij	[--enable-bug3020-fix],
4171298695Sdelphij	[+ Provide the explicit 127.0.0.0/8 martian filter]
4172298695Sdelphij    )],
4173298695Sdelphij    [ans=$enableval],
4174298695Sdelphij    [ans=yes]
4175298695Sdelphij)
4176298695SdelphijAC_MSG_RESULT([$ans])
4177298695Sdelphijcase "$ans" in
4178298695Sdelphij yes)
4179298695Sdelphij    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4180298695Sdelphij	[Provide the explicit 127.0.0.0/8 martian filter?])
4181298695Sdelphijesac
4182298695Sdelphij
4183298695Sdelphij
4184200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4185200576Sroberto
4186200576Srobertocase "$host" in
4187200576Sroberto *-*-solaris2.[[89]])
4188200576Sroberto    ans=yes
4189200576Sroberto    ;;
4190200576Sroberto *-*-solaris2.1[[0-9]]*)
4191200576Sroberto    ans=yes
4192200576Sroberto    ;;
4193200576Sroberto *) ans=no
4194280849Scy    ;;
4195200576Srobertoesac
4196200576Sroberto
4197200576SrobertoAC_ARG_ENABLE(
4198280849Scy    [irig-sawtooth],
4199280849Scy    [AS_HELP_STRING(
4200200576Sroberto	[--enable-irig-sawtooth],
4201200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4202280849Scy    )],
4203200576Sroberto    [ans=$enableval]
4204200576Sroberto)
4205200576Sroberto
4206200576SrobertoAC_MSG_RESULT([$ans])
4207200576Sroberto
4208200576Srobertocase "$ans" in
4209280849Scy yes)
4210280849Scy    AC_DEFINE([IRIG_SUCKS], [1],
4211280849Scy	[Should we use the IRIG sawtooth filter?])
4212181834Srobertoesac
4213181834Sroberto
4214200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4215200576SrobertoAC_ARG_ENABLE(
4216280849Scy	[nist],
4217280849Scy	[AS_HELP_STRING(
4218200576Sroberto	    [--enable-nist],
4219200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4220280849Scy	)],
4221200576Sroberto	[ans=$enableval],
4222200576Sroberto	[ans=no]
4223200576Sroberto)
4224200576Sroberto
4225200576SrobertoAC_MSG_RESULT([$ans])
4226200576Sroberto
4227200576Srobertocase "$ans" in
4228280849Scy yes)
4229280849Scy    AC_DEFINE([LOCKCLOCK], [1],
4230280849Scy	[Should we align with the NIST lockclock scheme?]) ;;
4231181834Srobertoesac
4232181834Sroberto
4233200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4234200576SrobertoAC_ARG_ENABLE(
4235200576Sroberto    [ntp-signd],
4236280849Scy    [AS_HELP_STRING(
4237280849Scy	[--enable-ntp-signd],
4238280849Scy	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4239280849Scy    )],
4240200576Sroberto    [ans=$enableval],
4241200576Sroberto    [ans=no]
4242200576Sroberto)
4243200576Sroberto
4244200576SrobertoAC_MSG_RESULT([$ans])
4245200576Sroberto
4246200576Srobertocase "$ans" in
4247200576Sroberto no)
4248200576Sroberto    ntp_signd_path=
4249200576Sroberto    ;;
4250200576Sroberto yes)
4251200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4252200576Sroberto    ;;
4253200576Sroberto *)
4254200576Sroberto    ntp_signd_path="$ans"
4255200576Srobertoesac
4256200576Sroberto
4257200576Srobertocase "$ntp_signd_path" in
4258200576Sroberto '')
4259200576Sroberto    ;;
4260200576Sroberto *)
4261280849Scy    AC_DEFINE([HAVE_NTP_SIGND], [1],
4262280849Scy	[Do we want support for Samba's signing daemon?])
4263280849Scy    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4264280849Scy	[Path to sign daemon rendezvous socket])
4265200576Sroberto    ;;
4266200576Srobertoesac
4267200576Sroberto
4268200576SrobertoAC_CHECK_HEADERS([libscf.h])
4269280849ScyLSCF=
4270200576Srobertocase "$ac_cv_header_libscf_h" in
4271200576Sroberto yes)
4272280849Scy    LSCF='-lscf'
4273200576Srobertoesac
4274280849ScyAC_SUBST([LSCF])
4275200576Sroberto
4276280849ScyNTP_IPV6
4277200576Sroberto
4278200576Sroberto
4279181834Sroberto#
4280181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4281181834Sroberto#
4282200576SrobertoAC_CACHE_CHECK(
4283200576Sroberto    [for interface list sysctl],
4284280849Scy    [ntp_cv_iflist_sysctl],
4285280849Scy    [AC_PREPROC_IFELSE(
4286282408Scy	[AC_LANG_SOURCE([
4287200576Sroberto	    #include <sys/param.h>
4288200576Sroberto	    #include <sys/sysctl.h>
4289200576Sroberto	    #include <sys/socket.h>
4290280849Scy	    #ifndef NET_RT_IFLIST
4291280849Scy	    # error
4292200576Sroberto	    #endif
4293282408Scy	])],
4294280849Scy	[ntp_cv_iflist_sysctl=yes],
4295280849Scy	[ntp_cv_iflist_sysctl=no]
4296280849Scy    )]
4297200576Sroberto)
4298280849Scycase "$ntp_cv_iflist_sysctl" in
4299280849Scy yes)
4300280849Scy    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4301280849Scyesac
4302181834Sroberto
4303280849Scy###
4304280849Scy
4305280849ScyAC_MSG_CHECKING([if we want the saveconfig mechanism])
4306280849ScyAC_ARG_ENABLE(
4307280849Scy    [saveconfig],
4308280849Scy    [AS_HELP_STRING(
4309280849Scy	[--enable-saveconfig],
4310280849Scy	[+ saveconfig mechanism]
4311280849Scy    )],
4312280849Scy    [ntp_ok=$enableval],
4313280849Scy    [ntp_ok=yes]
4314280849Scy)
4315280849Scyntp_saveconfig_enabled=0
4316280849Scycase "$ntp_ok" in
4317200576Sroberto yes)
4318280849Scy    ntp_saveconfig_enabled=1
4319280849Scy    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4320280849Scy    ;;
4321200576Srobertoesac
4322280849ScyAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4323280849ScyAC_MSG_RESULT([$ntp_ok])
4324200576Sroberto
4325285169Scy###
4326285169Scy
4327285169ScyAC_MSG_CHECKING([if we want the experimental leap smear code])
4328285169ScyAC_ARG_ENABLE(
4329285169Scy    [leap-smear],
4330285169Scy    [AS_HELP_STRING(
4331285169Scy	[--enable-leap-smear],
4332285169Scy	[- experimental leap smear code]
4333285169Scy    )],
4334285169Scy    [ntp_ok=$enableval],
4335285169Scy    [ntp_ok=no]
4336285169Scy)
4337285169Scyntp_leap_smear_enabled=0
4338285169Scycase "$ntp_ok" in
4339285169Scy yes)
4340285169Scy    ntp_leap_smear_enabled=1
4341285169Scy    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4342285169Scy    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4343285169Scy    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4344285169Scy    ;;
4345285169Scyesac
4346285169ScyAC_MSG_RESULT([$ntp_ok])
4347285169Scy
4348298695Sdelphij###
4349298695Sdelphij
4350298695SdelphijAC_MSG_CHECKING([if we want dynamic interleave support])
4351298695SdelphijAC_ARG_ENABLE(
4352298695Sdelphij    [dynamic-interleave],
4353298695Sdelphij    [AS_HELP_STRING(
4354298695Sdelphij	[--enable-dynamic-interleave],
4355298695Sdelphij	[- dynamic interleave support]
4356298695Sdelphij    )],
4357298695Sdelphij    [ntp_ok=$enableval],
4358298695Sdelphij    [ntp_ok=no]
4359298695Sdelphij)
4360298695Sdelphijntp_dynamic_interleave=0
4361298695Sdelphijcase "$ntp_ok" in
4362298695Sdelphij yes)
4363298695Sdelphij    ntp_dynamic_interleave=1
4364298695Sdelphij    ;;
4365298695Sdelphijesac
4366298695SdelphijAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4367298695Sdelphij    [support dynamic interleave?])
4368298695SdelphijAC_MSG_RESULT([$ntp_ok])
4369298695Sdelphij
4370285169ScyNTP_UNITYBUILD
4371285169Scy
4372280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4373280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4374280849Scydnl  can't be conditionalized.
4375280849ScyNTP_GOOGLETEST
4376200576Sroberto
4377289764SglebiusNTP_PROBLEM_TESTS
4378289764Sglebius
4379181834Sroberto###
4380181834Sroberto
4381280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4382280849Scy    [Default location of crypto key info])
4383181834Sroberto
4384280849ScyAC_CONFIG_FILES([Makefile])
4385280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4386280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4387280849ScyAC_CONFIG_FILES([include/Makefile])
4388280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4389280849ScyAC_CONFIG_FILES([kernel/Makefile])
4390280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4391280849ScyAC_CONFIG_FILES([libntp/Makefile])
4392280849ScyAC_CONFIG_FILES([libparse/Makefile])
4393280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4394285169ScyAC_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])
4395280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4396280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4397280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4398280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4399280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4400280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4401280849ScyAC_CONFIG_FILES([scripts/Makefile])
4402282408ScyAC_CONFIG_FILES([scripts/build/Makefile])
4403301247SdelphijAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4404282408ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4405282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4406282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4407280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4408282408ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4409280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4410282408ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4411280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4412282408ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4413280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4414280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4415280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4416280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4417282408ScyAC_CONFIG_FILES([scripts/update-leap/Makefile])
4418285169ScyAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4419280849ScyAC_CONFIG_FILES([tests/Makefile])
4420285169ScyAC_CONFIG_FILES([tests/bug-2803/Makefile])
4421280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4422280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4423289764SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4424285169ScyAC_CONFIG_FILES([tests/sandbox/Makefile])
4425285169ScyAC_CONFIG_FILES([tests/sec-2853/Makefile])
4426280849ScyAC_CONFIG_FILES([util/Makefile])
4427181834Sroberto
4428280849Scyperllibdir="${datadir}/ntp/lib"
4429280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4430181834Sroberto
4431280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4432280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4433280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4434280849ScyAC_SUBST_FILE([ntp_wait_opts])
4435280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4436280849ScyAC_SUBST_FILE([ntpsweep_opts])
4437280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4438280849ScyAC_SUBST_FILE([ntptrace_opts])
4439280849Scysummary_opts="$srcdir/scripts/summary-opts"
4440280849ScyAC_SUBST_FILE([summary_opts])
4441280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4442280849ScyAC_SUBST_FILE([plot_summary_opts])
4443280849Scy
4444280849ScyAC_CONFIG_SUBDIRS([sntp])
4445280849Scy
4446181834SrobertoAC_OUTPUT
4447