configure.ac revision 282408
1280849Scydnl NTP top-level configure.ac				-*- Autoconf -*-
2280849Scydnl
3280849Scym4_include([sntp/m4/version.m4])
4280849ScyAC_PREREQ([2.61])
5280849ScyAC_INIT(
6280849Scy    [ntp],
7280849Scy    [VERSION_NUMBER],
8280849Scy    [http://bugs.ntp.org./],
9280849Scy    [],
10280849Scy    [http://www.ntp.org./]dnl
11280849Scy)
12280849ScyAC_CONFIG_MACRO_DIR([sntp/m4])
13280849ScyAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14280849Scy
15280849ScyAC_PRESERVE_HELP_ORDER
16280849Scy
17280849Scy# Bump ntp_configure_cache_version for each change to configure.ac or
18280849Scy# .m4 files which invalidates cached values from previous configure 
19280849Scy# runs.
20280849Scy#
21280849Scy# If the change affects cache variables used only by the main NTP
22280849Scy# configure.ac, then only its version number should be bumped, while
23280849Scy# the subdir configure.ac version numbers should be unchanged.  The
24280849Scy# same is true for a test/variable that is used only by one subdir
25280849Scy# being changed incompatibly; only that subdir's cache version needs
26280849Scy# bumping.
27280849Scy#
28280849Scy# If a change affects variables shared by all NTP configure scripts,
29280849Scy# please bump the version numbers of each.  If you are not sure, the
30280849Scy# safe choice is to bump all on any cache-invalidating change.
31280849Scy#
32280849Scy# In order to avoid the risk of version stamp collision between -stable
33280849Scy# and -dev branches, do not simply increment the version, instead use
34280849Scy# the date YYYYMMDD optionally with -HHMM if there is more than one
35280849Scy# bump in a day.
36280849Scy
37280849Scyntp_configure_cache_version=20120806
38280849Scy
39280849Scy# When the cache version of config.cache and configure do not
40280849Scy# match, NTP_CACHEVERSION will flush the cache.
41280849Scy
42280849ScyNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
43280849Scy
44280849ScyAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
45280849Scy
46280849Scydnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
47280849Scym4_ifdef(
48280849Scy    [AM_SILENT_RULES],
49280849Scy    [AM_SILENT_RULES([yes])]
50280849Scy)
51280849ScyAC_CANONICAL_BUILD
52181834SrobertoAC_CANONICAL_HOST
53181834Srobertodnl the 'build' machine is where we run configure and compile
54181834Srobertodnl the 'host' machine is where the resulting stuff runs.
55280849ScyAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
56280849Scy    [canonical system (cpu-vendor-os) of where we should run])
57280849ScyAC_CONFIG_HEADERS([config.h])
58181834Srobertodnl AC_ARG_PROGRAM
59181834Sroberto
60280849Scyntp_atom_ok=${ntp_atom_ok=no}
61280849Scyntp_oncore_ok=${ntp_oncore_ok=no}
62280849Scyntp_parse_ok=${ntp_parse_ok=no}
63280849Scyntp_ripe_ncc_ok=${ntp_parse_ok=no}
64280849Scyntp_jupiter_ok=${ntp_jupiter_ok=no}
65181834Sroberto
66280849ScyNTP_PROG_CC
67280849ScyAC_PROG_CPP
68280849ScyAC_PROG_CXX
69280849ScyAC_PROG_YACC
70280849ScyAC_PROG_CC_C_O
71282408ScyAX_C99_STRUCT_INIT
72181834Sroberto
73280849ScyNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
74181834Sroberto
75280849ScyNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
76280849Scy
77280849Scydnl AM_PROG_AR req. automake 1.12
78280849Scym4_ifdef(
79280849Scy    [AM_PROG_AR],
80280849Scy    [AM_PROG_AR]
81280849Scy)
82280849Scy
83200576Sroberto# So far, the only shared library we might use is libopts.
84200576Sroberto# It's a small library - we might as well use a static version of it.
85200576SrobertoAC_DISABLE_SHARED
86280849ScyAC_PROG_LIBTOOL
87280849ScyAC_SUBST([LIBTOOL_DEPS])
88200576Sroberto
89280849Scy# NTP has (so far) been relying on leading-edge autogen, which
90280849Scy# means we need the appropriate corresponding libopts as well.
91181834Sroberto# Therefore, by default:
92280849Scy# - use the version of libopts we ship with
93181834Sroberto# - do not install it
94181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
95181834Srobertocase "${enable_local_libopts+set}" in
96181834Sroberto set) ;;
97181834Sroberto *) enable_local_libopts=yes ;;
98181834Srobertoesac
99181834Srobertocase "${enable_libopts_install+set}" in
100181834Sroberto set) ;;
101181834Sroberto *) enable_libopts_install=no ;;
102181834Srobertoesac
103280849Scyenable_nls=no
104280849ScyLIBOPTS_CHECK_NOBUILD([sntp/libopts])
105181834Sroberto
106280849ScyNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
107181834Sroberto
108280849ScyNTP_LIBNTP
109181834Sroberto
110280849ScyAC_MSG_CHECKING([for deprecated --with-arlib])
111280849ScyAC_ARG_WITH([arlib],
112280849Scy	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
113181834Sroberto	[ans=$withval], [ans=no])
114200576SrobertoAC_MSG_RESULT([$ans])
115181834Sroberto
116181834Srobertocase "$ans" in
117181834Sroberto yes)
118280849Scy    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
119181834Sroberto    ;;
120181834Srobertoesac
121181834Sroberto
122181834Srobertodnl  we need to check for cross compile tools for vxWorks here
123181834SrobertoAC_PROG_AWK
124280849ScyAS_UNSET([ac_cv_prog_AWK])
125280849ScyAC_SUBST([AWK])				dnl scripts/ntpver.in
126181834SrobertoAC_PROG_MAKE_SET
127181834Sroberto
128280849ScyAC_SUBST([CFLAGS])
129280849ScyAC_SUBST([LDFLAGS])
130181834Sroberto
131280849ScyAC_PROG_LN_S
132280849ScyAC_ISC_POSIX
133181834Sroberto
134181834Sroberto
135280849ScyAC_PATH_PROG([PATH_PERL], [perl])
136280849Scydnl  Saving cached hardcoded paths rather than searching $PATH during a
137280849Scydnl  cached configure run is an optimization not worth the the cost of
138280849Scydnl  preventing newly-installed tools from being found.  Short-circuit
139280849Scydnl  the caching after the tests so preset overrides still work.
140280849ScyAS_UNSET([ac_cv_path_PATH_PERL])
141280849ScyAC_PATH_PROG([PATH_TEST], [test])
142280849ScyAS_UNSET([ac_cv_path_PATH_TEST])
143280849Scytest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
144280849ScyAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
145181834Sroberto
146280849ScyAC_ARG_WITH(
147280849Scy    [net-snmp-config],
148280849Scy    [AS_HELP_STRING(
149280849Scy	[--with-net-snmp-config],
150280849Scy	[+ =net-snmp-config]
151280849Scy    )],
152280849Scy    [ans=$withval],
153280849Scy    [ans=yes]
154280849Scy)
155280849Scycase "$ans" in
156280849Scy no)
157181834Sroberto    ;;
158280849Scy yes)
159280849Scy    ans=net-snmp-config
160181834Sroberto    ;;
161280849Scy /*)
162181834Sroberto    ;;
163280849Scy */*)
164280849Scy    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
165181834Sroberto    ;;
166280849Scy *)
167280849Scy    ;;
168181834Srobertoesac
169280849ScyPROG_NET_SNMP_CONFIG=$ans
170280849ScyAC_MSG_CHECKING([for net-snmp-config path])
171280849Scycase "$PROG_NET_SNMP_CONFIG" in
172280849Scy no) ;;
173280849Scy /*)
174280849Scy    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
175181834Sroberto    ;;
176280849Scy *)
177280849Scy    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
178280849Scy    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
179280849Scy;;
180181834Srobertoesac
181280849ScyAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
182181834Sroberto
183181834Srobertocase "$host" in
184181834Sroberto *-*-vxworks*)
185181834Sroberto    ac_link="$ac_link $VX_KERNEL"
186181834Sroberto    ;;
187181834Srobertoesac
188181834Sroberto
189280849Scy# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
190280849ScyAC_SEARCH_LIBS([openlog], [gen syslog])
191280849Scy# XXX library list will be in ac_cv_search_openlog
192181834Sroberto
193280849Scy# LIBSECCOMP is off by default -- needs testing with all the features
194280849Scy# Please send bug reports to loganaden@gmail.com
195280849ScyAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
196280849ScyAC_ARG_ENABLE(
197280849Scy    [libseccomp],
198280849Scy    [AS_HELP_STRING(
199280849Scy	[--enable-libseccomp],
200280849Scy	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
201280849Scy    )],
202280849Scy    [ntp_ok=$enableval],
203280849Scy    [ntp_ok=no]
204280849Scy)
205280849ScyAC_MSG_RESULT([$ntp_ok])
206280849Scycase "$ntp_ok" in
207280849Scy yes)
208280849Scy    AC_SEARCH_LIBS(
209280849Scy	[seccomp_init],
210280849Scy	[seccomp],
211280849Scy	[AC_DEFINE([LIBSECCOMP], [1],
212280849Scy	    [Define to any value to include libseccomp sandboxing.])]
213280849Scy    )
214280849Scy    AC_TRY_RUN([
215280849Scy	#include <stdio.h>
216280849Scy	#include <stdlib.h>
217280849Scy	#include <errno.h>
218280849Scy	#include <sys/prctl.h>
219280849Scy	#include <linux/seccomp.h>
220280849Scy
221280849Scy	int main(void)
222280849Scy	{
223280849Scy		int ret;
224280849Scy		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
225280849Scy		if (ret < 0) {
226280849Scy			switch (errno) {
227280849Scy			case ENOSYS:
228280849Scy				return 1;
229280849Scy			case EINVAL:
230280849Scy				return 1;
231280849Scy			default:
232280849Scy				return 1;
233280849Scy			}
234280849Scy		}
235280849Scy		ret = 
236280849Scy		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
237280849Scy		if (ret < 0) {
238280849Scy			switch (errno) {
239280849Scy			case EINVAL:
240280849Scy				return 1;
241280849Scy			case EFAULT:
242280849Scy				return 0;
243280849Scy			default:
244280849Scy				return 1;
245280849Scy		}
246280849Scy	}
247280849Scyreturn 1;
248280849Scy}
249280849Scy]
250280849Scy, AC_DEFINE([KERN_SECCOMP], 1, 
251280849Scy[Define to use libseccomp system call filtering.])   
252280849Scy, []
253280849Scy)
254181834Sroberto    ;;
255181834Srobertoesac
256181834Sroberto
257280849ScyNTP_FACILITYNAMES
258200576Sroberto
259181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
260181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
261181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
262181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
263181834Srobertodnl real-time library, so we don't want to use it.
264280849Scydnl
265280849Scydnl 081118 Harlan got tired of looking for a way to get the sched*()
266280849Scydnl functions to link OK with either cc or gcc.
267181834Sroberto
268181834Srobertocase "$host" in
269200576Sroberto *-*-*linux*) ;;
270280849Scy *-*-osf4*) ;;
271280849Scy *-*-osf5*) ;;
272181834Sroberto *)
273280849Scy    # HMS: Make sure we check for -lrt for clock_* before this...
274280849Scy    case "$ac_cv_search_clock_gettime" in
275280849Scy     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
276280849Scy    esac
277280849Scy    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
278181834Sroberto    ;;
279181834Srobertoesac
280181834Sroberto
281280849ScyAC_CHECK_HEADERS([bstring.h])
282280849ScyAC_CHECK_HEADER(
283280849Scy    [dns_sd.h],
284280849Scy    [AC_SEARCH_LIBS(
285280849Scy	[DNSServiceRegister],
286280849Scy	[dns_sd],
287280849Scy	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
288280849Scy	    [Use Rendezvous/DNS-SD registration])]
289280849Scy    )]
290280849Scy)
291280849ScyAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
292181834Sroberto
293280849ScyAC_CHECK_HEADERS([memory.h netdb.h poll.h])
294280849ScyAC_CHECK_HEADERS([sgtty.h stdlib.h string.h termio.h])
295280849ScyAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
296181834Sroberto
297181834Srobertocase "$host" in
298181834Sroberto *-*-aix*)
299280849Scy    AC_CHECK_HEADERS([utmpx.h])
300181834Sroberto    case "$ac_cv_header_utmpx_h" in
301280849Scy     yes)
302280849Scy	;;
303280849Scy     *)
304280849Scy	AC_CHECK_HEADERS([utmp.h])
305280849Scy	;;
306181834Sroberto    esac
307181834Sroberto    ;;
308280849Scy *)
309280849Scy    AC_CHECK_HEADERS([utmp.h utmpx.h])
310280849Scy    ;;
311181834Srobertoesac
312280849Scy
313280849Scy#
314280849Scy# On Suns only (so far) getpass() truncates the typed password to 8
315280849Scy# characters, but getpassphrase() allows up to 257.  Most systems'
316280849Scy# getpass() does not truncate, at least not so as to affect ntpq and
317280849Scy# ntpdc password prompts.
318280849Scy#
319280849Scy# So check for getpassphrase(), but only on Sun operating systems.
320280849Scy#
321280849Scycase "$host" in
322280849Scy *-*-sunos*|*-*-solaris*)
323280849Scy    AC_CHECK_FUNCS([getpassphrase])
324280849Scyesac
325280849Scy
326280849Scy
327280849ScyAC_CHECK_HEADERS([net/if6.h])
328280849ScyAC_CHECK_HEADERS([net/route.h], [], [], [
329280849Scy    #include <sys/types.h>
330280849Scy    #include <sys/socket.h>
331280849Scy    #include <net/if.h>
332181834Sroberto])
333200576Sroberto
334280849ScyAC_CHECK_HEADERS([netinfo/ni.h])
335280849Scycase "$ac_cv_header_netinfo_ni_h" in
336200576Sroberto yes)
337280849Scy    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
338200576Srobertoesac
339280849ScyAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
340181834Srobertocase "$host" in
341280849Scy *-*-sunos4*)
342181834Sroberto    ;;
343280849Scy *)
344280849Scy    AC_CHECK_HEADERS([sys/ioctl.h])
345280849Scy    ;;
346181834Srobertoesac
347280849ScyAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
348181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
349280849ScyAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
350181834Srobertocase "$ac_cv_header_sched_h" in
351280849Scy yes)
352181834Sroberto    ;;
353280849Scy *)
354280849Scy    AC_CHECK_HEADERS([sys/sched.h])
355280849Scy    ;;
356181834Srobertoesac
357181834Sroberto# HMS: Check sys/shm.h after some others
358280849ScyAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
359181834Sroberto# HMS: Checked sys/socket.h earlier
360181834Srobertocase "$host" in
361280849Scy *-*-netbsd*)
362181834Sroberto    ;;
363280849Scy *)
364280849Scy    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
365280849Scy    ;;
366181834Srobertoesac
367280849ScyAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
368280849ScyAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
369181834Srobertocase "$host" in
370181834Sroberto*-convex-*)
371280849Scy    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
372280849Scy    ;;
373181834Sroberto*-*-bsdi*)
374280849Scy    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
375280849Scy    ;;
376181834Srobertoesac
377181834Sroberto
378181834Srobertocase "$host" in
379280849Scy *-*-solaris2.6)
380280849Scy    # Broken...
381181834Sroberto    ;;
382181834Sroberto *)
383280849Scy    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
384181834Sroberto    ;;
385181834Srobertoesac
386181834Sroberto
387280849Scycase "$host" in
388280849Scy *-*-*linux*)
389280849Scy    case "$ac_cv_func_ntp_gettime" in
390280849Scy     yes)
391280849Scy	;;
392280849Scy     *)
393280849Scy	AC_CHECK_FUNCS([__ntp_gettime])
394280849Scy	case "$ac_cv_func___ntp_gettime" in
395280849Scy	 yes)
396280849Scy	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
397280849Scy		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
398280849Scy	esac
399280849Scy	;;
400280849Scy    esac
401280849Scy    AC_CHECK_FUNCS([adjtimex])
402280849Scy    case "$ac_cv_func_adjtimex" in
403280849Scy     yes)
404280849Scy	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
405280849Scy	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
406280849Scy	have_adjtimex=1
407280849Scy	;;
408280849Scy     *)
409280849Scy	AC_CHECK_FUNCS([__adjtimex])
410280849Scy	case "$ac_cv_func___adjtimex" in
411280849Scy	 yes)
412280849Scy	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
413280849Scy	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
414280849Scy	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
415280849Scy	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
416280849Scy	    have_adjtimex=1
417280849Scy	esac
418280849Scy	;;
419280849Scy    esac
420280849Scyesac
421280849Scycase "$have_adjtimex" in
422280849Scy '')
423280849Scy    # nlist stuff is only needed for tickadj.
424280849Scy    saved_LIBS="$LIBS"
425280849Scy    LIBS=
426280849Scy    AC_SEARCH_LIBS([nlist], [elf ld mld])
427280849Scy    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
428280849Scy    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
429280849Scy    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
430280849Scy    AC_CHECK_HEADERS([nlist.h sys/var.h])
431280849Scy    case "$ac_cv_header_nlist_h" in
432280849Scy     yes)
433280849Scy	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
434280849Scy	AC_CACHE_CHECK(
435280849Scy	    [for n_un in struct nlist],
436280849Scy	    [ntp_cv_struct_nlist_n_un],
437280849Scy	    [AC_COMPILE_IFELSE(
438280849Scy		[AC_LANG_PROGRAM(
439280849Scy		    [[
440280849Scy			#include <nlist.h>
441280849Scy		    ]],
442280849Scy		    [[
443280849Scy			struct nlist n;
444280849Scy			n.n_un.n_name = 0;
445280849Scy		    ]]
446280849Scy		)]
447280849Scy		[ntp_cv_struct_nlist_n_un=yes],
448280849Scy		[ntp_cv_struct_nlist_n_un=no]
449280849Scy	    )]
450280849Scy	)
451280849Scy	case "$ntp_cv_struct_nlist_n_un" in
452280849Scy	 yes)
453280849Scy	    AC_DEFINE([NLIST_NAME_UNION], [1],
454280849Scy		[does struct nlist use a name union?])
455280849Scy	esac
456280849Scy    esac
457280849Scy    AC_SUBST([LDADD_NLIST])
458280849Scy    LDADD_NLIST="$LIBS"
459280849Scy    LIBS="$saved_LIBS"
460280849Scy    AS_UNSET([saved_LIBS])
461280849Scyesac
462181834Sroberto
463280849ScyAC_CHECK_HEADERS([sys/proc.h], [], [], [
464280849Scy    #ifdef HAVE_SYS_TYPES_H
465280849Scy    # include <sys/types.h>
466280849Scy    #endif
467280849Scy    #ifdef HAVE_SYS_TIME_H
468280849Scy    # include <sys/time.h>
469280849Scy    #endif
470181834Sroberto])
471181834Sroberto
472280849ScyAC_CHECK_HEADERS([sys/resource.h], [], [], [
473280849Scy    #ifdef HAVE_SYS_TIME_H
474280849Scy    # include <sys/time.h>
475280849Scy    #endif
476181834Sroberto])
477181834Sroberto
478280849ScyAC_CHECK_HEADERS([sys/shm.h], [], [], [
479280849Scy    #ifdef HAVE_SYS_TYPES_H
480280849Scy    # include <sys/types.h>
481280849Scy    #endif
482280849Scy    #ifdef HAVE_SYS_IPC_H
483280849Scy    # include <sys/ipc.h>
484280849Scy    #endif
485181834Sroberto])
486181834Sroberto
487280849ScyAC_CHECK_HEADERS([sys/timex.h], [], [], [
488280849Scy    #ifdef HAVE_SYS_TIME_H
489280849Scy    # include <sys/time.h>
490280849Scy    #endif
491181834Sroberto])
492181834Sroberto
493181834SrobertoAC_TYPE_SIGNAL
494181834SrobertoAC_TYPE_OFF_T
495280849ScyAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
496181834Sroberto
497280849ScyAC_CACHE_CHECK(
498280849Scy    [for a fallback value for HZ],
499280849Scy    [ntp_cv_default_hz],
500280849Scy    [
501280849Scy	ntp_cv_default_hz=100
502280849Scy	case "$host" in
503280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
504280849Scy	    ntp_cv_default_hz=1024
505280849Scy	    ;;
506280849Scy	 mips-dec-ultrix4*)
507280849Scy	    ntp_cv_default_hz=256
508280849Scy	    ;;
509280849Scy	esac
510280849Scy    ]
511280849Scy)
512280849ScyAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
513280849Scy    [What is the fallback value for HZ?])
514181834Sroberto
515280849ScyAC_CACHE_CHECK(
516280849Scy    [if we need to override the system's value for HZ],
517280849Scy    [ntp_cv_override_hz],
518280849Scy    [
519280849Scy	ntp_cv_override_hz=no
520280849Scy	case "$host" in
521280849Scy	 alpha*-dec-osf4*|alpha*-dec-osf5*)
522280849Scy	    ntp_cv_override_hz=yes
523280849Scy	    ;;
524280849Scy	 mips-dec-ultrix4*)
525280849Scy	    ntp_cv_override_hz=yes
526280849Scy	    ;;
527280849Scy	 *-*-freebsd*)
528280849Scy	    ntp_cv_override_hz=yes
529280849Scy	    ;;
530280849Scy	 *-*-sunos4*)
531280849Scy	    ntp_cv_override_hz=yes
532280849Scy	    ;;
533280849Scy	 *-*-kfreebsd*)
534280849Scy	    ntp_cv_override_hz=yes
535280849Scy	    ;;
536280849Scy	esac
537280849Scy    ]
538280849Scy)
539280849Scycase "$ntp_cv_override_hz" in
540181834Sroberto yes)
541280849Scy    AC_DEFINE([OVERRIDE_HZ], [1],
542280849Scy	[Do we need to override the system's idea of HZ?])
543181834Srobertoesac
544181834Sroberto
545181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
546181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
547181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
548181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
549181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
550181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
551181834Srobertodnl fi
552181834Sroberto
553181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
554181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
555181834Srobertodnl [AC_EGREP_CPP(yes,
556181834Srobertodnl [#ifdef HAVE_UTMPX_H
557181834Srobertodnl #include <utmpx.h>
558181834Srobertodnl #else
559181834Srobertodnl #include <utmp.h>
560181834Srobertodnl #endif
561181834Srobertodnl #ifdef BOOT_TIME
562181834Srobertodnl yes
563181834Srobertodnl #endif
564181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
565181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
566181834Sroberto
567280849ScyAC_CACHE_CHECK(
568280849Scy    [for struct rt_msghdr],
569280849Scy    [ntp_cv_struct_rt_msghdr],
570280849Scy    [AC_COMPILE_IFELSE(
571280849Scy	[AC_LANG_PROGRAM(
572280849Scy	    [[
573280849Scy		#include <sys/types.h>
574280849Scy		#include <sys/socket.h>
575280849Scy		#include <net/if.h>
576280849Scy		#include <net/route.h>
577280849Scy	    ]],
578280849Scy	    [[
579280849Scy		struct rt_msghdr p;
580280849Scy	    ]]
581280849Scy	)],
582280849Scy	[ntp_cv_struct_rt_msghdr=yes],
583280849Scy	[ntp_cv_struct_rt_msghdr=no]
584280849Scy    )]
585280849Scy)
586200576Sroberto
587181834SrobertoAC_CACHE_CHECK(
588280849Scy    [for struct rtattr],
589280849Scy    [ntp_cv_rtattr],
590280849Scy    [AC_COMPILE_IFELSE(
591280849Scy	[AC_LANG_PROGRAM(
592280849Scy	    [[
593280849Scy		#include <stddef.h>
594280849Scy		#include <sys/socket.h>
595280849Scy		#include <linux/rtnetlink.h>
596280849Scy	    ]],
597280849Scy	    [[
598280849Scy		struct rtattr p;
599280849Scy	    ]]
600280849Scy	)],
601280849Scy	[ntp_cv_rtattr=yes],
602280849Scy	[ntp_cv_rtattr=no]
603280849Scy    )]
604181834Sroberto)
605181834Sroberto
606280849Scycase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
607280849Scy *yes*)
608280849Scy    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
609280849Scy	[Do we have a routing socket (rt_msghdr or rtattr)?])
610280849Scy    case "$ntp_cv_rtattr" in
611280849Scy     yes)
612280849Scy	AC_DEFINE([HAVE_RTNETLINK], [1],
613280849Scy	    [Do we have Linux routing socket?])
614181834Sroberto    esac
615280849Scyesac
616181834Sroberto
617280849ScyAC_CACHE_CHECK(
618280849Scy    [struct sigaction for sa_sigaction],
619280849Scy    [ntp_cv_struct_sigaction_has_sa_sigaction],
620280849Scy    [AC_COMPILE_IFELSE(
621280849Scy	[AC_LANG_PROGRAM(
622280849Scy	    [[
623280849Scy		#include <signal.h>
624280849Scy	    ]],
625280849Scy	    [[
626280849Scy		struct sigaction act;
627280849Scy		act.sa_sigaction = 0;
628280849Scy	    ]]
629280849Scy	)],
630280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
631280849Scy	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
632280849Scy    )]
633280849Scy)
634280849Scycase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
635280849Scy yes)
636280849Scy    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
637280849Scyesac
638181834Sroberto
639280849ScyAC_CACHE_CHECK(
640280849Scy    [for struct ppsclockev],
641280849Scy    [ntp_cv_struct_ppsclockev],
642280849Scy    [AC_COMPILE_IFELSE(
643280849Scy	[AC_LANG_PROGRAM(
644280849Scy	    [[
645280849Scy		#ifdef HAVE_SYS_TYPES_H
646280849Scy		# include <sys/types.h>
647280849Scy		#endif
648280849Scy		#ifdef HAVE_SYS_TERMIOS_H
649280849Scy		# include <sys/termios.h>
650280849Scy		#endif
651280849Scy		#ifdef HAVE_SYS_TIME_H
652280849Scy		# include <sys/time.h>
653280849Scy		#endif
654280849Scy		#ifdef HAVE_SYS_PPSCLOCK_H
655280849Scy		# include <sys/ppsclock.h>
656280849Scy		#endif
657280849Scy	    ]],
658280849Scy	    [[
659280849Scy		extern struct ppsclockev *pce;
660280849Scy		return pce->serial;
661280849Scy	    ]]
662280849Scy	)],
663280849Scy	[ntp_cv_struct_ppsclockev=yes],
664280849Scy	[ntp_cv_struct_ppsclockev=no]
665280849Scy    )]
666280849Scy)
667280849Scycase "$ntp_cv_struct_ppsclockev" in
668280849Scy yes)
669280849Scy    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
670280849Scy	[Does a system header define struct ppsclockev?])
671280849Scyesac
672181834Sroberto
673181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
674181834Sroberto  *yes*)
675280849Scy    AC_CACHE_CHECK(
676280849Scy	[for struct snd_size],
677280849Scy	[ntp_cv_struct_snd_size],
678280849Scy	[AC_COMPILE_IFELSE(
679280849Scy	    [AC_LANG_PROGRAM(
680280849Scy		[[
681280849Scy		    #ifdef HAVE_MACHINE_SOUNDCARD_H
682280849Scy		    # include <machine/soundcard.h>
683280849Scy		    #endif
684280849Scy		    #ifdef HAVE_SYS_SOUNDCARD_H
685280849Scy		    # include <sys/soundcard.h>
686280849Scy		    #endif
687280849Scy		]],
688280849Scy		[[
689280849Scy		    extern struct snd_size *ss;
690280849Scy		    return ss->rec_size;
691280849Scy		]]
692280849Scy	    )],
693280849Scy	    [ntp_cv_struct_snd_size=yes],
694280849Scy	    [ntp_cv_struct_snd_size=no]
695280849Scy        )]
696280849Scy    )
697280849Scy    case "$ntp_cv_struct_snd_size" in
698280849Scy     yes)
699280849Scy	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
700280849Scy	    [Do we have struct snd_size?])
701181834Sroberto    esac
702181834Srobertoesac
703181834Sroberto
704280849ScyAC_CACHE_CHECK(
705280849Scy    [struct clockinfo for hz],
706280849Scy    [ntp_cv_struct_clockinfo_has_hz],
707280849Scy    [AC_COMPILE_IFELSE(
708280849Scy	[AC_LANG_PROGRAM(
709280849Scy	    [[
710280849Scy		#include <sys/time.h>
711280849Scy	    ]],
712280849Scy	    [[
713280849Scy		extern struct clockinfo *pc;
714280849Scy		return pc->hz;
715280849Scy	    ]]
716280849Scy	)],
717280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
718280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
719280849Scy    )]
720280849Scy)
721280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
722280849Scy yes)
723280849Scy    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
724280849Scyesac
725181834Sroberto
726280849ScyAC_CACHE_CHECK(
727280849Scy    [struct clockinfo for tickadj],
728280849Scy    [ntp_cv_struct_clockinfo_has_hz],
729280849Scy    [AC_COMPILE_IFELSE(
730280849Scy	[AC_LANG_PROGRAM(
731280849Scy	    [[
732280849Scy		#include <sys/time.h>
733280849Scy	    ]],
734280849Scy	    [[
735280849Scy		extern struct clockinfo *pc;
736280849Scy		return pc->tickadj;
737280849Scy	    ]]
738280849Scy	)],
739280849Scy	[ntp_cv_struct_clockinfo_has_hz=yes],
740280849Scy	[ntp_cv_struct_clockinfo_has_hz=no]
741280849Scy    )]
742280849Scy)
743280849Scycase "$ntp_cv_struct_clockinfo_has_hz" in
744280849Scy yes)
745280849Scy    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
746280849Scyesac
747181834Sroberto
748280849Scycase "$ntp_cv_struct_ntptimeval" in
749280849Scy yes)
750280849Scy    AC_CHECK_MEMBERS(
751280849Scy	[struct ntptimeval.time.tv_nsec],
752280849Scy	[],
753280849Scy	[],
754280849Scy	[
755280849Scy	    #ifdef HAVE_SYS_TIME_H
756280849Scy	    # include <sys/time.h>
757280849Scy	    #else
758280849Scy	    # ifdef HAVE_TIME_H
759280849Scy	    #  include <time.h>
760280849Scy	    # endif
761280849Scy	    #endif
762280849Scy	    #ifdef HAVE_SYS_TIMEX_H
763280849Scy	    # include <sys/timex.h>
764280849Scy	    #else
765280849Scy	    # ifdef HAVE_TIMEX_H
766280849Scy	    #  include <timex.h>
767280849Scy	    # endif
768280849Scy	    #endif
769280849Scy	]
770280849Scy    )
771200576Srobertoesac
772200576Sroberto
773280849Scy#### 
774181834Sroberto
775280849ScyAC_CHECK_FUNCS([arc4random_buf])
776181834Sroberto
777280849Scy#### 
778181834Sroberto
779280849Scysaved_LIBS="$LIBS"
780280849ScyLIBS="$LIBS $LDADD_LIBNTP"
781280849ScyAC_CHECK_FUNCS([daemon])
782280849Scy# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
783280849ScyLIBS="$saved_LIBS"
784280849ScyAS_UNSET([saved_LIBS])
785181834Sroberto
786280849ScyAC_CHECK_FUNCS(
787280849Scy    [finite],
788280849Scy    [],
789280849Scy    [AC_CHECK_FUNCS(
790280849Scy	[isfinite],
791280849Scy	[],
792280849Scy	[
793280849Scy	    AC_MSG_CHECKING([for isfinite with <math.h>])
794280849Scy	    _libs=$LIBS
795280849Scy	    # XXX
796280849Scy	    LIBS="$LIBS -lm"
797280849Scy	    AC_LINK_IFELSE(
798280849Scy		[AC_LANG_PROGRAM(
799280849Scy		    [[
800280849Scy			#include <math.h>
801280849Scy		    ]],
802280849Scy		    [[
803280849Scy			float f = 0.0;
804280849Scy			isfinite(f);
805280849Scy		    ]]
806280849Scy		)],
807280849Scy		[ans=yes],
808280849Scy		[ans=no]
809280849Scy	    )
810280849Scy	    LIBS=$_libs
811280849Scy	    AC_MSG_RESULT([$ans])
812280849Scy	    case "$ans" in
813280849Scy	     yes)
814280849Scy		AC_DEFINE([HAVE_ISFINITE], [1])
815280849Scy	    esac
816280849Scy	]
817280849Scy    )]
818280849Scy)
819181834Sroberto
820280849ScyAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
821181834Sroberto
822280849Scy# kvm_open() is only used by tickadj.  Also see above.
823280849Scycase "$ac_cv_header_kvm_h" in
824280849Scy yes)
825280849Scy    AC_CHECK_FUNCS([kvm_open])
826181834Sroberto    ;;
827181834Srobertoesac
828181834Sroberto
829181834Srobertocase "$host" in
830181834Sroberto *-*-sco3.2v5.0.*)
831280849Scy    # Just stubs.  Sigh.
832181834Sroberto    ;;
833280849Scy *) AC_CHECK_FUNCS([mkstemp])
834181834Sroberto    ;;
835181834Srobertoesac
836280849ScyAC_CHECK_FUNCS([mktime])
837181834Srobertocase "$host" in
838280849Scy *-*-aix[[4-9]]*)
839280849Scy    # XXX only verified thru AIX6.
840280849Scy    # Just a stub.  Sigh.
841181834Sroberto    ;;
842181834Sroberto *-*-irix[[45]]*)
843280849Scy    # Just a stub in "old" Irix.  Sigh.
844181834Sroberto    ;;
845280849Scy# In the belief that the fix for bug 1223 fixes mlockall() under linux...
846280849Scy# *-*-*linux*)
847280849Scy#    # there, but more trouble than it is worth for now (resolver problems)
848280849Scy#    ;;
849181834Sroberto *-*-qnx*)
850280849Scy    # Apparently there but not working in QNX.  Sigh?
851181834Sroberto    ;;
852181834Sroberto *-*-sco3.2v5.0.*)
853280849Scy    # Just a stub.  Sigh.
854181834Sroberto    ;;
855181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
856181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
857181834Sroberto    # Not easy to test for - cheat.
858280849Scy    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
859280849Scy    AC_CHECK_FUNCS([mlockall])
860181834Sroberto    ;;
861280849Scy *) AC_CHECK_FUNCS([mlockall])
862181834Sroberto    ;;
863181834Srobertoesac
864280849ScyAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
865181834Srobertocase "$host" in
866280849Scy *-*-aix[[4-9]]*)
867280849Scy    # XXX only verified thru AIX6.
868280849Scy    # Just a stub in AIX 4.  Sigh.
869181834Sroberto    ;;
870181834Sroberto *-*-solaris2.5*)
871280849Scy    # Just stubs in solaris2.5.  Sigh.
872181834Sroberto    ;;
873280849Scy *) AC_CHECK_FUNCS([sched_setscheduler])
874181834Sroberto    ;;
875181834Srobertoesac
876280849ScyAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
877280849ScyAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
878181834Srobertocase "$host" in
879280849Scy *-*-aix[[4-9]]*)
880280849Scy    # XXX only verified thru AIX6.
881280849Scy    # Just stubs.  Sigh.
882181834Sroberto    ;;
883181834Sroberto *-*-netbsd1*)
884280849Scy    # Just stubs.  Sigh.
885181834Sroberto    ;;
886181834Sroberto *-*-netbsdelf1*)
887280849Scy    # Just stubs.  Sigh.
888181834Sroberto    ;;
889181834Sroberto *-*-openbsd*)
890280849Scy    # Just stubs.  Sigh.
891181834Sroberto    ;;
892280849Scy *)
893280849Scy    AC_CHECK_FUNCS([timer_create])
894181834Sroberto    ;;
895181834Srobertoesac
896181834Sroberto
897280849ScyNTP_RLIMIT_ITEMS
898181834Sroberto
899280849Scy# HMS: Only if we are doing the MLOCKALL stuff...
900280849ScyAC_MSG_CHECKING([for the default number of 4k stack pages])
901280849ScyAC_ARG_WITH(
902280849Scy    [stack-limit],
903280849Scy    [AS_HELP_STRING(
904280849Scy	[--with-stack-limit],
905280849Scy	[? =50 (200 for openbsd) 4k pages]
906280849Scy    )],
907280849Scy    [ans=$withval],
908280849Scy    [ans=yes]
909280849Scy)
910280849Scycase "$ans" in
911280849Scy yes | no)
912280849Scy    case "$host" in
913280849Scy     *-*-openbsd*)
914280849Scy	ans=200
915181834Sroberto	;;
916280849Scy     *) ans=50
917280849Scy        ;;
918181834Sroberto    esac
919181834Sroberto    ;;
920280849Scy [[1-9]][[0-9]]*)
921280849Scy    ;;
922280849Scy *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
923280849Scy    ;;
924181834Srobertoesac
925280849ScyAC_MSG_RESULT([$ans])
926280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
927280849Scy    [Default number of 4k pages for RLIMIT_STACK])
928181834Sroberto
929280849Scy# HMS: only if we have RLIMIT_MEMLOCK
930280849ScyAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
931280849ScyAC_ARG_WITH(
932280849Scy    [memlock],
933280849Scy    [AS_HELP_STRING(
934280849Scy	[--with-memlock],
935280849Scy	[? =32 (megabytes)]
936280849Scy    )],
937280849Scy    [ans=$withval],
938280849Scy    [ans=yes]
939280849Scy)
940280849Scycase "$ans" in
941280849Scy yes | no)
942280849Scy    ans=32
943181834Sroberto    ;;
944280849Scy [[1-9]][[0-9]]*) ;;
945280849Scy *) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
946280849Scy     ;;
947181834Srobertoesac
948280849ScyAC_MSG_RESULT([$ans])
949280849ScyAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
950280849Scy    [Default number of megabytes for RLIMIT_MEMLOCK])
951181834Sroberto
952181834Sroberto
953280849Scy# some OSes prefer _exit() in forked children to exit()
954280849ScyAC_CHECK_FUNCS([_exit])
955280849Scyntp_worker_child_exit=exit
956280849Scycase "$ac_cv_func__exit::$host_os" in
957280849Scy yes::netbsd*)
958280849Scy    ntp_worker_child_exit=_exit
959280849Scy    ;;
960280849Scy yes::openbsd*)
961280849Scy    ntp_worker_child_exit=_exit
962280849Scy    ;;
963280849Scyesac
964280849ScyAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
965280849Scy		   [routine worker child proc uses to exit.])
966181834Sroberto
967280849ScyAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
968181834Sroberto
969280849Scy###
970181834Sroberto
971280849Scy# http://bugs.ntp.org/737
972280849Scycase "$ac_cv_func_recvmsg" in
973280849Scy yes)
974280849Scy    AC_CACHE_CHECK(
975280849Scy	[if we need extra help to define struct iovec],
976280849Scy	[ntp_cv_struct_iovec_help],
977280849Scy	[
978280849Scy	    compiled=no
979280849Scy	    for ntp_cv_struct_iovec_help in '0' '1'; do
980280849Scy		AC_COMPILE_IFELSE(
981280849Scy		    [AC_LANG_PROGRAM(
982280849Scy			[[
983280849Scy			    #ifdef HAVE_SYS_TYPES_H
984280849Scy			    # include <sys/types.h>
985280849Scy			    #endif
986280849Scy			    #ifdef HAVE_SYS_SOCKET_H
987280849Scy			    # include <sys/socket.h>
988280849Scy			    #endif
989280849Scy			    #if $ntp_cv_struct_iovec_help
990280849Scy			    # include <sys/uio.h>
991280849Scy			    #endif
992280849Scy			]],
993280849Scy			[[
994280849Scy			    void foo(void) {
995280849Scy				ssize_t x;
996280849Scy				int s = 0;
997280849Scy				struct iovec iov;
998280849Scy				struct msghdr mh;
999280849Scy				int flags = 0;
1000181834Sroberto
1001280849Scy				mh.msg_iov = &iov;
1002280849Scy				x = recvmsg(s, &mh, flags);
1003280849Scy			    }
1004280849Scy			]]
1005280849Scy		    )],
1006280849Scy		    [compiled=yes ; break 1],
1007280849Scy		    []
1008280849Scy		)
1009280849Scy	    done
1010280849Scy	    case "$compiled" in
1011280849Scy	     no)
1012280849Scy		ntp_cv_struct_iovec_help=0
1013280849Scy	    esac
1014280849Scy	    AS_UNSET([compiled])
1015280849Scy	]
1016280849Scy    )
1017280849Scy    case "$ntp_cv_struct_iovec_help" in
1018280849Scy     1)
1019280849Scy	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1020280849Scy	    [Use sys/uio.h for struct iovec help])
1021280849Scy    esac
1022181834Srobertoesac
1023181834Sroberto
1024280849ScyAC_CACHE_CHECK(
1025280849Scy    [number of arguments taken by setpgrp()],
1026280849Scy    [ntp_cv_func_setpgrp_nargs],
1027280849Scy    [AC_COMPILE_IFELSE(
1028280849Scy	[AC_LANG_PROGRAM(
1029280849Scy	    [[
1030280849Scy		#ifdef HAVE_SYS_TYPES_H
1031280849Scy		# include <sys/types.h>
1032280849Scy		#endif
1033280849Scy		#ifdef HAVE_UNISTD_H
1034280849Scy		# include <unistd.h>
1035280849Scy		#endif
1036280849Scy	    ]],
1037280849Scy	    [[
1038280849Scy		setpgrp(0, 0);
1039280849Scy	    ]]
1040280849Scy	)],
1041280849Scy	[ntp_cv_func_setpgrp_nargs=2],
1042280849Scy	[ntp_cv_func_setpgrp_nargs=0]
1043280849Scy    )]
1044280849Scy)
1045280849Scycase "$ntp_cv_func_setpgrp_nargs" in
1046280849Scy 0)
1047280849Scy    AC_DEFINE([HAVE_SETPGRP_0], [1],
1048280849Scy	      [define if setpgrp takes 0 arguments])
1049280849Scyesac
1050181834Sroberto
1051280849ScyAC_CACHE_CHECK(
1052280849Scy    [if we need to declare 'errno'],
1053280849Scy    [ntp_cv_decl_errno],
1054280849Scy    [AC_COMPILE_IFELSE(
1055280849Scy	[AC_LANG_PROGRAM(
1056280849Scy	    [[
1057280849Scy		#ifdef HAVE_ERRNO_H
1058280849Scy		# include <errno.h>
1059280849Scy		#endif
1060280849Scy	    ]],
1061280849Scy	    [[
1062280849Scy		errno = 0;
1063280849Scy	    ]]
1064280849Scy	)],
1065280849Scy	[ntp_cv_decl_errno=no],
1066280849Scy	[ntp_cv_decl_errno=yes]
1067280849Scy    )]
1068280849Scy)
1069280849Scycase "$ntp_cv_decl_errno" in
1070280849Scy yes)
1071280849Scy    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1072181834Srobertoesac
1073181834Sroberto
1074181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1075181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1076181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1077181834Srobertodnl without breaking any other platforms.
1078181834Srobertodnl
1079280849ScyAC_CACHE_CHECK(
1080280849Scy    [if we may declare 'h_errno'],
1081280849Scy    [ntp_cv_decl_h_errno],
1082280849Scy    [AC_COMPILE_IFELSE(
1083280849Scy	[AC_LANG_PROGRAM(
1084280849Scy	    [[
1085280849Scy		#include <sys/types.h>
1086280849Scy		#ifdef HAVE_NETINET_IN_H
1087280849Scy		# include <netinet/in.h>
1088280849Scy		#endif
1089280849Scy		#ifdef HAVE_ARPA_NAMESER_H
1090280849Scy		# include <arpa/nameser.h>
1091280849Scy		#endif
1092280849Scy		#ifdef HAVE_NETDB_H
1093280849Scy		# include <netdb.h>
1094280849Scy		#endif
1095280849Scy		#ifdef HAVE_RESOLV_H
1096280849Scy		# include <resolv.h>
1097280849Scy		#endif
1098280849Scy	    ]],
1099280849Scy	    [[
1100280849Scy		extern int h_errno;
1101280849Scy	    ]]
1102280849Scy	)],
1103280849Scy	[ntp_cv_decl_h_errno=yes],
1104280849Scy	[ntp_cv_decl_h_errno=no]
1105280849Scy    )]
1106280849Scy)
1107280849Scycase "$ntp_cv_decl_h_errno" in
1108280849Scy yes)
1109280849Scy    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1110181834Srobertoesac
1111181834Sroberto
1112280849ScyAC_CACHE_CHECK(
1113280849Scy    [if declaring 'syscall()' is ok],
1114280849Scy    [ntp_cv_decl_syscall],
1115280849Scy    [AC_COMPILE_IFELSE(
1116280849Scy	[AC_LANG_PROGRAM(
1117280849Scy	    [[
1118280849Scy		#ifdef HAVE_SYS_TYPES_H
1119280849Scy		# include <sys/types.h>
1120280849Scy		#endif
1121280849Scy		#ifdef HAVE_UNISTD_H
1122280849Scy		# include <unistd.h>
1123280849Scy		#endif
1124280849Scy	    ]],
1125280849Scy	    [[
1126280849Scy		extern int syscall (int, ...);
1127280849Scy	    ]]
1128280849Scy	)]
1129280849Scy	[ntp_cv_decl_syscall=yes],
1130280849Scy	[ntp_cv_decl_syscall=no]
1131280849Scy    )]
1132280849Scy)
1133280849Scycase "$ntp_cv_decl_syscall" in
1134280849Scy yes)
1135280849Scy    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1136181834Srobertoesac
1137181834Sroberto
1138181834Srobertocase "$host" in
1139181834Sroberto *-*-aix4.3.*)
1140280849Scy    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1141181834Sroberto    ;;
1142181834Sroberto *-*-mpeix*)
1143280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1144280849Scy    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1145280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1146280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1147280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1148280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1149280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1150181834Sroberto    ;;
1151181834Sroberto *-*-osf[[45]]*)
1152280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1153280849Scy    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1154181834Sroberto    ;;
1155181834Sroberto *-*-qnx*)
1156280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1157181834Sroberto    ;;
1158181834Sroberto *-*-riscos4*)
1159280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1160280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1161280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1162280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1163280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1164280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1165280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1166280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1167280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1168280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1169280849Scy    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1170280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1171280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1172280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1173280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1174280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1175181834Sroberto    ;;
1176181834Sroberto *-*-solaris2*)
1177280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1178280849Scy    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1179181834Sroberto    case "$host" in
1180181834Sroberto     *-*-solaris2.4)
1181280849Scy        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1182181834Sroberto	;;
1183181834Sroberto    esac
1184181834Sroberto    ;;
1185181834Sroberto *-*-sunos4*)
1186280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1187280849Scy    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1188280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1189280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1190280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1191280849Scy    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1192280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1193280849Scy    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1194280849Scy    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1195280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1196280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1197280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1198280849Scy    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1199181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1200181834Sroberto     acc*) ;;
1201280849Scy     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1202181834Sroberto	;;
1203181834Sroberto    esac
1204280849Scy    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1205280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1206280849Scy    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1207280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1208280849Scy    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1209280849Scy    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1210280849Scy    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1211181834Sroberto    ;;
1212181834Sroberto *-*-ultrix4*)
1213280849Scy    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1214280849Scy    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1215280849Scy    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1216280849Scy    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1217280849Scy    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1218280849Scy    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1219280849Scy    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1220280849Scy    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1221280849Scy    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1222280849Scy    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1223280849Scy    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1224280849Scy    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1225280849Scy    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1226280849Scy    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1227181834Sroberto    ;;
1228181834Srobertoesac
1229181834Sroberto
1230181834Srobertocase "$host" in
1231181834Sroberto *-*-sco3.2*)
1232280849Scy    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1233280849Scy	[Do we need to #define _SVID3 when we #include <termios.h>?])
1234181834Sroberto    ;;
1235181834Srobertoesac
1236181834Sroberto
1237181834Srobertocase "$host" in
1238181834Sroberto *-*-hpux[[567]]*)
1239280849Scy    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1240280849Scy	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1241181834Srobertoesac
1242181834Sroberto
1243280849Scydnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1244280849ScyAC_CACHE_CHECK(
1245280849Scy    [if we will open the broadcast socket],
1246280849Scy    [ntp_cv_var_open_bcast_socket],
1247280849Scy    [
1248280849Scy	ans=yes
1249280849Scy	case "$host" in
1250280849Scy	 *-*-domainos)
1251280849Scy	    ans=no
1252280849Scy	esac
1253280849Scy	ntp_cv_var_open_bcast_socket=$ans
1254280849Scy    ]
1255280849Scy)
1256280849Scycase "$ntp_cv_var_open_bcast_socket" in
1257280849Scy yes)
1258280849Scy    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1259280849Scy	[Should we open the broadcast socket?])
1260181834Srobertoesac
1261181834Sroberto
1262181834Srobertocase "$host" in
1263181834Sroberto *-*-hpux*)
1264280849Scy    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1265280849Scy	[Do we want the HPUX FindConfig()?])
1266181834Srobertoesac
1267181834Sroberto
1268280849Scydnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1269280849ScyAC_CACHE_CHECK(
1270280849Scy    [if process groups are set with -pid],
1271280849Scy    [ntp_cv_arg_setpgrp_negpid],
1272280849Scy    [
1273280849Scy	case "$host" in
1274280849Scy	 *-*-hpux[[567]]*)
1275280849Scy	    ans=no
1276280849Scy	    ;;
1277280849Scy	 *-*-hpux*)
1278280849Scy	    ans=yes
1279280849Scy	    ;;
1280280849Scy	 *-*-*linux*)
1281280849Scy	    ans=yes
1282280849Scy	    ;;
1283280849Scy	 *-*-sunos3*)
1284280849Scy	    ans=yes
1285280849Scy	    ;;
1286280849Scy	 *-*-ultrix2*)
1287280849Scy	    ans=yes
1288280849Scy	    ;;
1289280849Scy	 *)
1290280849Scy	    ans=no
1291280849Scy	    ;;
1292280849Scy	esac
1293280849Scy	ntp_cv_arg_setpgrp_negpid=$ans
1294280849Scy    ]
1295280849Scy)
1296280849Scycase "$ntp_cv_arg_setpgrp_negpid" in
1297181834Sroberto yes)
1298280849Scy    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1299280849Scy	[Do we set process groups with -pid?])
1300181834Srobertoesac
1301181834Sroberto
1302280849ScyAC_CACHE_CHECK(
1303280849Scy    [if we need a ctty for F_SETOWN],
1304280849Scy    [ntp_cv_func_ctty_for_f_setown],
1305280849Scy    [
1306280849Scy	case "$host" in
1307280849Scy	 *-*-bsdi[[23]]*)
1308280849Scy	    ans=yes
1309280849Scy	    ;;
1310280849Scy	 *-*-freebsd*)
1311280849Scy	    ans=yes
1312280849Scy	    ;;
1313280849Scy	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1314280849Scy	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1315280849Scy	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1316280849Scy	# in $host may be followed by "aout", "ecoff", or "elf".
1317280849Scy	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1318280849Scy	    ans=yes
1319280849Scy	    ;;
1320280849Scy	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1321280849Scy	    ans=yes
1322280849Scy	    ;;
1323280849Scy	 *-*-openbsd*)
1324280849Scy	    ans=yes
1325280849Scy	    ;;
1326280849Scy	 *-*-osf*)
1327280849Scy	    ans=yes
1328280849Scy	    ;;
1329280849Scy	 *-*-darwin*)
1330280849Scy	    ans=yes
1331280849Scy	    ;;
1332280849Scy	 *)
1333280849Scy	    ans=no
1334280849Scy	    ;;
1335280849Scy	esac
1336280849Scy	ntp_cv_func_ctty_for_f_setown=$ans
1337280849Scy    ]
1338280849Scy)
1339280849Scycase "$ntp_cv_func_ctty_for_f_setown" in
1340181834Sroberto yes)
1341280849Scy    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1342181834Srobertoesac
1343181834Sroberto
1344280849ScyAC_CACHE_CHECK(
1345280849Scy    [if the OS clears cached routes when more specifics become available],
1346280849Scy    [ntp_cv_os_routeupdates],
1347280849Scy    [
1348280849Scy	case "$host" in
1349280849Scy	 *-*-netbsd*)
1350280849Scy	    ans=yes
1351280849Scy	    ;;
1352280849Scy	 *)
1353280849Scy	    ans=no
1354280849Scy	    ;;
1355280849Scy	esac
1356280849Scy	ntp_cv_os_routeupdates=$ans
1357280849Scy    ]
1358280849Scy)
1359280849Scycase "$ntp_cv_os_routeupdates" in
1360181834Sroberto yes)
1361280849Scy    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1362280849Scy	[need to recreate sockets on changed routing?])
1363181834Srobertoesac
1364181834Sroberto
1365280849ScyAC_CACHE_CHECK(
1366280849Scy    [if the wildcard socket needs REUSEADDR to bind other addresses],
1367280849Scy    [ntp_cv_os_wildcardreuse],
1368280849Scy    [
1369280849Scy	case "$host" in
1370280849Scy	 *-*-*linux*)
1371280849Scy	    ans=yes
1372280849Scy	    ;;
1373280849Scy	 *) ans=no
1374280849Scy	    ;;
1375280849Scy	esac
1376280849Scy	ntp_cv_os_wildcardreuse=$ans
1377280849Scy    ]
1378280849Scy)
1379280849Scycase "$ntp_cv_os_wildcardreuse" in
1380181834Sroberto yes)
1381280849Scy    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1382280849Scy	[wildcard socket needs REUSEADDR to bind interface addresses])
1383181834Srobertoesac
1384181834Sroberto
1385181834Srobertocase "$host" in
1386181834Sroberto *-*-aix*)
1387280849Scy    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1388280849Scy	[Might nlist() values require an extra level of indirection (AIX)?])
1389181834Srobertoesac
1390181834Sroberto
1391280849ScyAC_CACHE_CHECK(
1392280849Scy    [for a minimum recommended value of tickadj],
1393280849Scy    [ntp_cv_var_min_rec_tickadj],
1394280849Scy    [
1395280849Scy	ans=no
1396280849Scy	case "$host" in
1397280849Scy	 *-*-aix*)
1398280849Scy	    ans=40
1399280849Scy	    ;;
1400280849Scy	esac
1401280849Scy	ntp_cv_var_min_rec_tickadj=$ans
1402280849Scy    ]
1403280849Scy)
1404280849Scycase "$ntp_cv_var_min_rec_tickadj" in
1405280849Scy ''|no)
1406181834Sroberto    ;;
1407280849Scy *)
1408280849Scy    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1409280849Scy	[Should we recommend a minimum value for tickadj?])
1410181834Srobertoesac
1411280849Scy
1412280849ScyAC_CACHE_CHECK(
1413280849Scy    [if the TTY code permits PARENB and IGNPAR],
1414280849Scy    [ntp_cv_no_parenb_ignpar],
1415280849Scy    [
1416280849Scy	ans=no
1417280849Scy	case "$host" in
1418280849Scy	 i?86-*-*linux*)
1419280849Scy	    ans=yes
1420280849Scy	    ;;
1421280849Scy	 mips-sgi-irix*)
1422280849Scy	    ans=yes
1423280849Scy	    ;;
1424280849Scy	 i?86-*-freebsd[[123]].*)
1425280849Scy	    ;;
1426280849Scy	 i?86-*-freebsd*)
1427280849Scy	    ans=yes
1428280849Scy	    ;;
1429280849Scy	 *-*-unicosmp*)
1430280849Scy	    ans=yes
1431280849Scy	    ;;
1432280849Scy	esac
1433280849Scy	ntp_cv_no_parenb_ignpar=$ans
1434280849Scy    ]
1435280849Scy)
1436280849Scycase "$ntp_cv_no_parenb_ignpar" in
1437280849Scy yes)
1438280849Scy    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1439280849Scy	[Is there a problem using PARENB and IGNPAR?])
1440181834Srobertoesac
1441181834Sroberto
1442280849ScyAC_MSG_CHECKING([if we're including processing time debugging code])
1443280849ScyAC_ARG_ENABLE(
1444280849Scy    [debug-timing],
1445280849Scy    [AS_HELP_STRING(
1446280849Scy	[--enable-debug-timing],
1447280849Scy	[- include processing time debugging code (costs performance)]
1448280849Scy    )],
1449280849Scy    [ntp_ok=$enableval],
1450280849Scy    [ntp_ok=no]
1451280849Scy)
1452280849Scycase "$ntp_ok" in
1453280849Scy yes)
1454280849Scy    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1455181834Srobertoesac
1456280849ScyAC_MSG_RESULT([$ntp_ok])
1457181834Sroberto
1458280849ScyAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1459200576SrobertoAC_ARG_ENABLE(
1460280849Scy    [dst-minutes],
1461280849Scy    [AS_HELP_STRING(
1462200576Sroberto	[--enable-dst-minutes],
1463280849Scy	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1464280849Scy    ],
1465200576Sroberto    [ans=$enableval],
1466200576Sroberto    [ans=60]
1467200576Sroberto)
1468280849ScyAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1469280849Scy    [The number of minutes in a DST adjustment])
1470200576SrobertoAC_MSG_RESULT([$ans])
1471181834Sroberto
1472280849ScyAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1473200576SrobertoAC_ARG_ENABLE(
1474200576Sroberto    [ignore-dns-errors],
1475280849Scy    [AS_HELP_STRING(
1476280849Scy	[--enable-ignore-dns-errors],
1477200576Sroberto	[- retry DNS queries on any error]
1478280849Scy    )],
1479200576Sroberto    [ans=$enableval],
1480200576Sroberto    [ans=no]
1481200576Sroberto)
1482200576Srobertocase "$ans" in
1483200576Sroberto yes)
1484280849Scy    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1485280849Scy	[Retry queries on _any_ DNS error?])
1486200576Srobertoesac
1487200576SrobertoAC_MSG_RESULT([$ans])
1488200576Sroberto
1489280849ScyAC_CACHE_CHECK(
1490280849Scy    [availability of ntp_{adj,get}time()],
1491280849Scy    [ntp_cv_var_ntp_syscalls],
1492280849Scy    [
1493280849Scy	ntp_cv_var_ntp_syscalls=no
1494280849Scy	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1495280849Scy	 yesyes*)
1496280849Scy	    ntp_cv_var_ntp_syscalls=libc
1497181834Sroberto	    ;;
1498280849Scy	 *yes)
1499280849Scy	    ntp_cv_var_ntp_syscalls=inline
1500181834Sroberto	    ;;
1501280849Scy	 *)
1502280849Scy	    AC_PREPROC_IFELSE(
1503282408Scy		[AC_LANG_SOURCE(
1504282408Scy		    [
1505282408Scy			#include <sys/syscall.h>
1506282408Scy			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1507282408Scy			# error
1508282408Scy			#endif
1509282408Scy		    ])],
1510280849Scy		[ntp_cv_var_ntp_syscalls=kernel]
1511280849Scy	    )
1512181834Sroberto	    ;;
1513280849Scy	 esac
1514280849Scy    ]
1515280849Scy)
1516280849Scycase "$ntp_cv_var_ntp_syscalls" in
1517181834Sroberto libc)
1518280849Scy    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1519280849Scy	[Do we have ntp_{adj,get}time in libc?])
1520181834Sroberto    ;;
1521181834Sroberto kernel)
1522280849Scy    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1523280849Scy	[Do we have ntp_{adj,get}time in the kernel?])
1524181834Sroberto    ;;
1525181834Srobertoesac
1526181834Sroberto
1527280849ScyAC_CACHE_CHECK(
1528280849Scy    [if sys/timex.h has STA_FLL],
1529280849Scy    [ntp_cv_var_sta_fll],
1530280849Scy    [AC_PREPROC_IFELSE(
1531282408Scy	[AC_LANG_SOURCE(
1532282408Scy	    [
1533282408Scy		#include <sys/timex.h>
1534282408Scy		#ifndef STA_FLL
1535282408Scy		# error
1536282408Scy		#endif
1537282408Scy	    ])],
1538280849Scy	[ntp_cv_var_sta_fll=yes],
1539280849Scy	[ntp_cv_var_sta_fll=no]
1540280849Scy    )]
1541280849Scy)
1542181834Sroberto
1543280849ScyAC_CACHE_CHECK(
1544280849Scy    [if we have kernel PLL support],
1545280849Scy    [ntp_cv_var_kernel_pll],
1546280849Scy    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1547280849Scy	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1548280849Scy	 *no*)
1549280849Scy	    ntp_cv_var_kernel_pll=no
1550280849Scy	    ;;
1551280849Scy	 *) ntp_cv_var_kernel_pll=yes
1552280849Scy	    ;;
1553280849Scy	esac
1554280849Scy    ]
1555280849Scy)
1556280849Scycase "$ntp_cv_var_kernel_pll" in
1557181834Sroberto yes)
1558280849Scy    AC_DEFINE([KERNEL_PLL], [1],
1559280849Scy	[Does the kernel support precision time discipline?])
1560181834Srobertoesac
1561181834Sroberto
1562280849ScyAC_CACHE_CHECK(
1563280849Scy    [if SIOCGIFCONF returns buffer size in the buffer],
1564280849Scy    [ntp_cv_size_returned_in_buffer],
1565280849Scy    [
1566280849Scy	ans=no
1567280849Scy	case "$host" in
1568280849Scy	 *-fujitsu-uxp*)
1569280849Scy	    ans=yes
1570280849Scy	    ;;
1571280849Scy	 *-ncr-sysv4*)
1572280849Scy	    ans=yes
1573280849Scy	    ;;
1574280849Scy	 *-univel-sysv*)
1575280849Scy	    ans=yes
1576280849Scy	    ;;
1577280849Scy	esac
1578280849Scy	ntp_cv_size_returned_in_buffer=$ans
1579280849Scy    ]
1580280849Scy)
1581280849Scycase "$ntp_cv_size_returned_in_buffer" in
1582280849Scy yes)
1583280849Scy    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1584280849Scy	[Does SIOCGIFCONF return size in the buffer?])
1585181834Srobertoesac
1586181834Sroberto
1587181834Sroberto# Check for ioctls TIOCGPPSEV
1588280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1589280849Scycase "$ac_cv_header_termios_h" in
1590280849Scy yes)
1591280849Scy    AC_PREPROC_IFELSE(
1592282408Scy	[AC_LANG_SOURCE([
1593280849Scy	    #include <termios.h>
1594280849Scy	    #ifndef TIOCGPPSEV
1595280849Scy	    # error
1596280849Scy	    #endif
1597282408Scy	])],
1598280849Scy	[ntp_ok=yes],
1599280849Scy	[ntp_ok=no]
1600280849Scy    )
1601280849Scy    ;;
1602280849Scy *)
1603280849Scy    ntp_ok=no
1604280849Scy    ;;
1605280849Scyesac
1606280849Scycase "$ntp_ok" in
1607280849Scy yes)
1608280849Scy    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1609280849Scy	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1610280849Scyesac
1611280849ScyAC_MSG_RESULT([$ntp_ok])
1612181834Sroberto
1613181834Sroberto# Check for ioctls TIOCSPPS
1614280849ScyAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1615280849Scycase "$ac_cv_header_termios_h" in
1616280849Scy yes)
1617280849Scy    AC_PREPROC_IFELSE(
1618282408Scy	[AC_LANG_SOURCE([
1619280849Scy	    #include <termios.h>
1620280849Scy	    #ifndef TIOCSPPS
1621280849Scy	    # error
1622280849Scy	    #endif
1623282408Scy	 ])],
1624280849Scy	 [ntp_ok=yes],
1625280849Scy	 [ntp_ok=no]
1626280849Scy    )
1627280849Scy    ;;
1628280849Scy *)
1629181834Sroberto    ntp_ok=no
1630280849Scy    ;;
1631280849Scyesac
1632280849Scycase "$ntp_ok" in
1633280849Scy yes)
1634280849Scy    AC_DEFINE([HAVE_TIOCSPPS], [1],
1635280849Scy	[Do we have the TIOCSPPS ioctl (Solaris)?])
1636280849Scyesac
1637280849ScyAC_MSG_RESULT([$ntp_ok])
1638181834Sroberto
1639181834Sroberto# Check for ioctls CIOGETEV
1640280849ScyAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1641280849Scycase "$ac_cv_header_sys_ppsclock_h" in
1642280849Scy yes)
1643280849Scy    AC_PREPROC_IFELSE(
1644282408Scy	[AC_LANG_SOURCE([
1645280849Scy	    #include <sys/ppsclock.h>
1646280849Scy	    #ifndef CIOGETEV
1647280849Scy	    # error
1648280849Scy	    #endif
1649282408Scy	])],
1650280849Scy	[ntp_ok=yes],
1651280849Scy	[ntp_ok=no]
1652280849Scy    )
1653280849Scy    ;;
1654280849Scy *)
1655280849Scy    ntp_ok=no
1656280849Scy    ;;
1657280849Scyesac
1658280849Scycase "$ntp_ok" in
1659280849Scy yes)
1660280849Scy    AC_DEFINE([HAVE_CIOGETEV], [1],
1661280849Scy	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1662280849Scyesac
1663280849ScyAC_MSG_RESULT([$ntp_ok])
1664181834Sroberto
1665181834Sroberto# ATOM/PPSAPI stuff.
1666181834Sroberto
1667280849Scyntp_atom_ok=yes
1668181834Sroberto
1669181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1670181834Sroberto
1671181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1672181834Sroberto# The PPSAPI needs struct timespec.
1673181834Sroberto# The PPSAPI also needs a timepps header.
1674181834Sroberto
1675280849Scycase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1676181834Sroberto inlineyes)
1677181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1678181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1679181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1680280849Scy	ntp_jupiter_ok=yes
1681280849Scy	ntp_oncore_ok=yes
1682280849Scy	ntp_parse_ok=yes
1683280849Scy	ntp_ripe_ncc_ok=yes
1684181834Sroberto	;;
1685181834Sroberto    esac
1686181834Sroberto    ;;
1687181834Srobertoesac
1688181834Sroberto
1689181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1690280849ScyAC_CHECK_HEADER([linux/serial.h])
1691181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1692181834Sroberto  yesyes)
1693280849Scy    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1694280849Scy    AC_PREPROC_IFELSE(
1695282408Scy	[AC_LANG_SOURCE([
1696280849Scy	    #include <sys/time.h>
1697280849Scy	    typedef int u_int;
1698280849Scy	    #include <sys/ppsclock.h>
1699280849Scy	    #include <linux/serial.h>
1700181834Sroberto
1701280849Scy	    #ifndef TIOCGSERIAL
1702280849Scy	    # error
1703280849Scy	    #endif
1704280849Scy	    #ifndef TIOCSSERIAL
1705280849Scy	    # error
1706280849Scy	    #endif
1707280849Scy	    #ifndef ASYNC_PPS_CD_POS
1708280849Scy	    # error
1709280849Scy	    #endif
1710280849Scy	    #ifndef ASYNC_PPS_CD_NEG
1711280849Scy	    # error
1712280849Scy	    #endif
1713280849Scy	    #ifndef CIOGETEV
1714280849Scy	    # error
1715280849Scy	    #endif
1716282408Scy	])],
1717280849Scy	[ntp_ok=yes],
1718280849Scy	[ntp_ok=no]
1719280849Scy    )
1720280849Scy    AC_MSG_RESULT([$ntp_ok])
1721280849Scy    ;;
1722181834Sroberto  *)
1723280849Scy    ntp_ok=no
1724280849Scy    ;;
1725181834Srobertoesac
1726280849Scycase "$ntp_ok" in
1727280849Scy yes)
1728280849Scy    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1729280849Scy	[Do we have the TIO serial stuff?])
1730280849Scyesac
1731181834Sroberto
1732181834Sroberto# Check for SHMEM_STATUS support
1733200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1734181834Srobertocase "$ac_cv_header_sys_mman_h" in
1735280849Scy yes)
1736280849Scy    ntp_ok=yes
1737280849Scy    ;;
1738280849Scy *)
1739280849Scy    ntp_ok=no
1740280849Scy    ;;
1741181834Srobertoesac
1742280849Scycase "$ntp_ok" in
1743280849Scy yes)
1744280849Scy    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1745280849Scy	[Do we have support for SHMEM_STATUS?])
1746280849Scyesac
1747280849ScyAC_MSG_RESULT([$ntp_ok])
1748181834Sroberto
1749181834Srobertontp_refclock=no
1750181834Sroberto
1751181834Sroberto# HPUX only, and by explicit request
1752200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1753280849ScyAC_ARG_ENABLE(
1754280849Scy    [BANCOMM],
1755280849Scy    [AS_HELP_STRING(
1756280849Scy	[--enable-BANCOMM],
1757280849Scy	[- Datum/Bancomm bc635/VME interface]
1758280849Scy    )],
1759280849Scy    [ntp_ok=$enableval],
1760280849Scy    [ntp_ok=no]
1761280849Scy)
1762280849Scycase "$ntp_ok" in
1763280849Scy yes)
1764181834Sroberto    ntp_refclock=yes
1765280849Scy    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1766280849Scy    ;;
1767280849Scyesac
1768280849ScyAC_MSG_RESULT([$ntp_ok])
1769181834Srobertocase "$ntp_ok$host" in
1770181834Sroberto yes*-*-hpux*) ;;
1771200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1772181834Srobertoesac
1773181834Sroberto
1774181834Sroberto#HPUX only, and only by explicit request
1775200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1776280849ScyAC_ARG_ENABLE(
1777280849Scy    [GPSVME],
1778280849Scy    [AS_HELP_STRING(
1779280849Scy	[--enable-GPSVME],
1780280849Scy	[- TrueTime GPS receiver/VME interface]
1781280849Scy    )],
1782280849Scy    [ntp_ok=$enableval],
1783280849Scy    [ntp_ok=no]
1784280849Scy)
1785280849Scycase "$ntp_ok" in
1786280849Scy yes)
1787181834Sroberto    ntp_refclock=yes
1788280849Scy    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1789280849Scy    ;;
1790280849Scyesac
1791280849ScyAC_MSG_RESULT([$ntp_ok])
1792181834Srobertocase "$ntp_ok$host" in
1793181834Sroberto yes*-*-hpux*) ;;
1794200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1795181834Srobertoesac
1796181834Sroberto
1797200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1798181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1799181834Sroberto yesyesyes)
1800280849Scy    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1801181834Sroberto    ans=yes
1802181834Sroberto    ;;
1803181834Sroberto *)
1804181834Sroberto    ans=no
1805181834Sroberto    ;;
1806181834Srobertoesac
1807200576SrobertoAC_MSG_RESULT([$ans])
1808181834Sroberto
1809200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1810280849ScyAC_ARG_ENABLE(
1811280849Scy    [all-clocks],
1812280849Scy    [AS_HELP_STRING(
1813280849Scy	[--enable-all-clocks],
1814280849Scy	[+ include all suitable non-PARSE clocks:]
1815280849Scy    )],
1816280849Scy    [ntp_eac=$enableval],
1817280849Scy    [ntp_eac=yes]
1818280849Scy)
1819280849ScyAC_MSG_RESULT([$ntp_eac])
1820181834Sroberto
1821280849Scy# HMS: Should we also require ntp_parse_ok?
1822200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1823280849Scycase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1824181834Sroberto yes*yes*)
1825181834Sroberto    ntp_canparse=yes
1826181834Sroberto    ;;
1827181834Sroberto *) ntp_canparse=no
1828181834Sroberto    ;;
1829181834Srobertoesac
1830280849ScyAC_MSG_RESULT([$ntp_canparse])
1831181834Sroberto
1832181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1833181834Srobertocase "$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
1834181834Sroberto *yes*)
1835181834Sroberto    ntp_canaudio=yes
1836280849Scy    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1837181834Sroberto    ;;
1838181834Sroberto *) ntp_canaudio=no ;;
1839181834Srobertoesac
1840280849ScyAC_MSG_RESULT([$ntp_canaudio])
1841181834Sroberto
1842181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1843181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1844181834Sroberto yesyes)
1845181834Sroberto    ntp_canshm=yes
1846181834Sroberto    ;;
1847181834Sroberto *) ntp_canshm=no ;;
1848181834Srobertoesac
1849280849ScyAC_MSG_RESULT([$ntp_canshm])
1850181834Sroberto
1851280849Scy# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1852280849ScyAC_CACHE_CHECK(
1853280849Scy    [for termios modem control],
1854280849Scy    [ntp_cv_modem_control],
1855280849Scy    [AC_COMPILE_IFELSE(
1856280849Scy	[AC_LANG_PROGRAM(
1857280849Scy	    [[
1858280849Scy		#ifdef HAVE_UNISTD_H
1859280849Scy		# include <unistd.h>
1860280849Scy		#endif
1861280849Scy		#ifdef HAVE_TERMIOS_H
1862280849Scy		# include <termios.h>
1863280849Scy		#endif
1864280849Scy		#ifdef HAVE_SYS_IOCTL_H
1865280849Scy		# include <sys/ioctl.h>
1866280849Scy		#endif
1867280849Scy	    ]],
1868280849Scy	    [[
1869280849Scy		int	dtr = TIOCM_DTR;
1870280849Scy
1871280849Scy		ioctl(1, TIOCMBIS, (char *)&dtr);
1872280849Scy	    ]]
1873280849Scy	)],
1874280849Scy	[ntp_cv_modem_control=yes],
1875280849Scy	[ntp_cv_modem_control=no]
1876280849Scy    )]
1877280849Scy)
1878280849Scycase "$ntp_eac::$ntp_cv_modem_control" in
1879280849Scy yes::yes)
1880280849Scy    ntp_enable_all_modem_control_clocks=yes
1881280849Scy    ;;
1882280849Scy *)
1883280849Scy    ntp_enable_all_modem_control_clocks=no
1884280849Scy    ;;
1885280849Scyesac
1886280849Scy
1887181834Sroberto# Requires modem control
1888200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1889280849ScyAC_ARG_ENABLE(
1890280849Scy    [ACTS],
1891280849Scy    [AS_HELP_STRING(
1892280849Scy	[--enable-ACTS],
1893280849Scy	[s ACTS modem service]
1894280849Scy    )],
1895181834Sroberto    [ntp_ok=$enableval],
1896280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1897280849Scy)
1898280849Scycase "$ntp_ok" in
1899280849Scy yes)
1900181834Sroberto    ntp_refclock=yes
1901280849Scy    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1902280849Scy    ;;
1903280849Scyesac
1904280849ScyAC_MSG_RESULT([$ntp_ok])
1905181834Sroberto
1906200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1907280849ScyAC_ARG_ENABLE(
1908280849Scy    [ARBITER],
1909280849Scy    [AS_HELP_STRING(
1910280849Scy	[--enable-ARBITER],
1911280849Scy	[+ Arbiter 1088A/B GPS receiver]
1912280849Scy    )],
1913280849Scy    [ntp_ok=$enableval],
1914280849Scy    [ntp_ok=$ntp_eac]
1915280849Scy)
1916280849Scycase "$ntp_ok" in
1917280849Scy yes)
1918181834Sroberto    ntp_refclock=yes
1919280849Scy    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1920280849Scy    ;;
1921280849Scyesac
1922280849ScyAC_MSG_RESULT([$ntp_ok])
1923181834Sroberto
1924200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1925280849ScyAC_ARG_ENABLE(
1926280849Scy    [ARCRON_MSF],
1927280849Scy    [AS_HELP_STRING(
1928280849Scy	[--enable-ARCRON-MSF],
1929280849Scy	[+ Arcron MSF receiver]
1930280849Scy    )],
1931280849Scy    [ntp_ok=$enableval],
1932280849Scy    [ntp_ok=$ntp_eac]
1933280849Scy)
1934280849Scycase "$ntp_ok" in
1935280849Scy yes)
1936181834Sroberto    ntp_refclock=yes
1937280849Scy    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1938280849Scy    ;;
1939280849Scyesac
1940280849ScyAC_MSG_RESULT([$ntp_ok])
1941181834Sroberto
1942200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1943280849ScyAC_ARG_ENABLE(
1944280849Scy    [AS2201],
1945280849Scy    [AS_HELP_STRING(
1946280849Scy	[--enable-AS2201],
1947280849Scy	[+ Austron 2200A/2201A GPS receiver]
1948280849Scy    )],
1949280849Scy    [ntp_ok=$enableval],
1950280849Scy    [ntp_ok=$ntp_eac]
1951280849Scy)
1952280849Scycase "$ntp_ok" in
1953280849Scy yes)
1954181834Sroberto    ntp_refclock=yes
1955280849Scy    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1956280849Scy    ;;
1957280849Scyesac
1958280849ScyAC_MSG_RESULT([$ntp_ok])
1959181834Sroberto
1960200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1961280849ScyAC_ARG_ENABLE(
1962280849Scy    [ATOM],
1963280849Scy    [AS_HELP_STRING(
1964280849Scy	[--enable-ATOM],
1965280849Scy	[s ATOM PPS interface]
1966280849Scy    )],
1967280849Scy    [ntp_ok=$enableval],
1968280849Scy    [ntp_ok=$ntp_eac]
1969280849Scy)
1970280849Scycase "$ntp_atom_ok" in
1971181834Sroberto no) ntp_ok=no ;;
1972181834Srobertoesac
1973280849Scycase "$ntp_ok" in
1974280849Scy yes)
1975181834Sroberto    ntp_refclock=yes
1976280849Scy    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1977280849Scy    ;;
1978280849Scyesac
1979280849ScyAC_MSG_RESULT([$ntp_ok])
1980181834Sroberto
1981200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1982280849ScyAC_ARG_ENABLE(
1983280849Scy    [CHRONOLOG],
1984280849Scy    [AS_HELP_STRING(
1985280849Scy	[--enable-CHRONOLOG],
1986280849Scy	[+ Chrono-log K-series WWVB receiver]
1987280849Scy    )],
1988280849Scy    [ntp_ok=$enableval],
1989280849Scy    [ntp_ok=$ntp_eac]
1990280849Scy)
1991280849Scycase "$ntp_ok" in
1992280849Scy yes)
1993181834Sroberto    ntp_refclock=yes
1994280849Scy    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1995280849Scy    ;;
1996280849Scyesac
1997280849ScyAC_MSG_RESULT([$ntp_ok])
1998181834Sroberto
1999200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
2000280849ScyAC_ARG_ENABLE(
2001280849Scy    [CHU],
2002280849Scy    [AS_HELP_STRING(
2003280849Scy	[--enable-CHU],
2004280849Scy	[+ CHU modem/decoder]
2005280849Scy    )],
2006280849Scy    [ntp_ok=$enableval],
2007280849Scy    [ntp_ok=$ntp_eac]
2008280849Scy)
2009280849Scycase "$ntp_ok" in
2010280849Scy yes)
2011181834Sroberto    ntp_refclock=yes
2012280849Scy    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
2013280849Scy    ;;
2014280849Scyesac
2015280849ScyAC_MSG_RESULT([$ntp_ok])
2016280849Scyntp_refclock_chu=$ntp_ok
2017181834Sroberto
2018200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2019280849ScyAC_ARG_ENABLE(
2020280849Scy    [AUDIO-CHU],
2021280849Scy    [AS_HELP_STRING(
2022280849Scy	[--enable-AUDIO-CHU],
2023280849Scy	[s CHU audio/decoder]
2024280849Scy    )],
2025181834Sroberto    [ntp_ok=$enableval],
2026280849Scy    [
2027280849Scy	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2028280849Scy	 *no*)	ntp_ok=no  ;;
2029280849Scy	 *)	ntp_ok=yes ;;
2030280849Scy	esac
2031280849Scy    ]
2032280849Scy)
2033280849ScyAC_MSG_RESULT([$ntp_ok])
2034181834Sroberto# We used to check for sunos/solaris target...
2035280849Scycase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2036280849Scy yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2037181834Srobertoesac
2038181834Sroberto
2039181834Sroberto# Not under HP-UX
2040200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2041280849ScyAC_ARG_ENABLE(
2042280849Scy    [DATUM],
2043280849Scy    [AS_HELP_STRING(
2044280849Scy	[--enable-DATUM],
2045280849Scy	[s Datum Programmable Time System]
2046280849Scy    )],
2047181834Sroberto    [ntp_ok=$enableval],
2048280849Scy    [
2049280849Scy	case "$ac_cv_header_termios_h" in
2050280849Scy	 yes)
2051280849Scy	    ntp_ok=$ntp_eac
2052280849Scy	    ;;
2053280849Scy	 *) ntp_ok=no
2054280849Scy	    ;;
2055280849Scy	esac
2056280849Scy    ]
2057280849Scy)
2058280849Scycase "$ntp_ok" in
2059280849Scy yes)
2060181834Sroberto    ntp_refclock=yes
2061280849Scy    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2062280849Scy    ;;
2063280849Scyesac
2064280849ScyAC_MSG_RESULT([$ntp_ok])
2065181834Sroberto
2066200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2067280849ScyAC_ARG_ENABLE(
2068280849Scy    [DUMBCLOCK],
2069280849Scy    [AS_HELP_STRING(
2070280849Scy	[--enable-DUMBCLOCK],
2071280849Scy	[+ Dumb generic hh:mm:ss local clock]
2072280849Scy    )],
2073280849Scy    [ntp_ok=$enableval],
2074280849Scy    [ntp_ok=$ntp_eac]
2075280849Scy)
2076280849Scycase "$ntp_ok" in
2077280849Scy yes)
2078181834Sroberto    ntp_refclock=yes
2079280849Scy    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2080280849Scy    ;;
2081280849Scyesac
2082280849ScyAC_MSG_RESULT([$ntp_ok])
2083181834Sroberto
2084200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2085280849ScyAC_ARG_ENABLE(
2086280849Scy    [FG],
2087280849Scy    [AS_HELP_STRING(
2088280849Scy	[--enable-FG],
2089280849Scy	[+ Forum Graphic GPS]
2090280849Scy    )],
2091280849Scy    [ntp_ok=$enableval],
2092280849Scy    [ntp_ok=$ntp_eac]
2093280849Scy)
2094280849Scycase "$ntp_ok" in
2095280849Scy yes)
2096181834Sroberto    ntp_refclock=yes
2097280849Scy    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2098280849Scy    ;;
2099280849Scyesac
2100280849ScyAC_MSG_RESULT([$ntp_ok])
2101181834Sroberto
2102181834Sroberto# Requires modem control
2103200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2104280849ScyAC_ARG_ENABLE(
2105280849Scy    [HEATH],
2106280849Scy    [AS_HELP_STRING(
2107280849Scy	[--enable-HEATH],
2108280849Scy	[s Heath GC-1000 WWV/WWVH receiver]
2109280849Scy    )],
2110181834Sroberto    [ntp_ok=$enableval],
2111280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2112280849Scy)
2113280849Scycase "$ntp_ok" in
2114280849Scy yes)
2115181834Sroberto    ntp_refclock=yes
2116280849Scy    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2117280849Scy    ;;
2118280849Scyesac
2119280849ScyAC_MSG_RESULT([$ntp_ok])
2120181834Sroberto
2121200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2122280849ScyAC_ARG_ENABLE(
2123280849Scy    [HOPFSERIAL],
2124280849Scy    [AS_HELP_STRING(
2125280849Scy	[--enable-HOPFSERIAL],
2126280849Scy	[+ hopf serial clock device]
2127280849Scy    )],
2128280849Scy    [ntp_ok=$enableval],
2129280849Scy    [ntp_ok=$ntp_eac]
2130280849Scy)
2131280849Scycase "$ntp_ok" in
2132280849Scy yes)
2133181834Sroberto    ntp_refclock=yes
2134280849Scy    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2135280849Scy    ;;
2136280849Scyesac
2137280849ScyAC_MSG_RESULT([$ntp_ok])
2138181834Sroberto
2139200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2140280849ScyAC_ARG_ENABLE(
2141280849Scy    [HOPFPCI],
2142280849Scy    [AS_HELP_STRING(
2143280849Scy	[--enable-HOPFPCI],
2144280849Scy	[+ hopf 6039 PCI board]
2145280849Scy    )],
2146280849Scy    [ntp_ok=$enableval],
2147280849Scy    [ntp_ok=$ntp_eac]
2148280849Scy)
2149280849Scycase "$ntp_ok" in
2150280849Scy yes)
2151181834Sroberto    ntp_refclock=yes
2152280849Scy    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2153280849Scy    ;;
2154280849Scyesac
2155280849ScyAC_MSG_RESULT([$ntp_ok])
2156181834Sroberto
2157200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2158280849ScyAC_ARG_ENABLE(
2159280849Scy    [HPGPS],
2160280849Scy    [AS_HELP_STRING(
2161280849Scy	[--enable-HPGPS],
2162280849Scy	[+ HP 58503A GPS receiver]
2163280849Scy    )],
2164280849Scy    [ntp_ok=$enableval],
2165280849Scy    [ntp_ok=$ntp_eac]
2166280849Scy)
2167280849Scycase "$ntp_ok" in
2168280849Scy yes)
2169181834Sroberto    ntp_refclock=yes
2170280849Scy    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2171280849Scy    ;;
2172280849Scyesac
2173280849ScyAC_MSG_RESULT([$ntp_ok])
2174181834Sroberto
2175200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2176280849ScyAC_ARG_ENABLE(
2177280849Scy    [IRIG],
2178280849Scy    [AS_HELP_STRING(
2179280849Scy	[--enable-IRIG],
2180280849Scy	[s IRIG audio decoder]
2181280849Scy    )],
2182181834Sroberto    [ntp_ok=$enableval],
2183280849Scy    [
2184280849Scy	case "$ntp_eac$ntp_canaudio" in
2185280849Scy	 *no*)	ntp_ok=no  ;;
2186280849Scy	 *)	ntp_ok=yes ;;
2187280849Scy	esac
2188280849Scy    ]
2189280849Scy)
2190280849Scycase "$ntp_ok" in
2191280849Scy yes)
2192181834Sroberto    ntp_refclock=yes
2193280849Scy    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2194280849Scy    ;;
2195280849Scyesac
2196280849ScyAC_MSG_RESULT([$ntp_ok])
2197181834Srobertocase "$ntp_ok$ntp_canaudio" in
2198280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2199181834Srobertoesac
2200181834Sroberto
2201200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2202280849ScyAC_ARG_ENABLE(
2203280849Scy    [JJY],
2204280849Scy    [AS_HELP_STRING(
2205280849Scy	[--enable-JJY],
2206280849Scy	[+ JJY receiver]
2207280849Scy    )],
2208280849Scy    [ntp_ok=$enableval],
2209280849Scy    [ntp_ok=$ntp_eac]
2210280849Scy)
2211280849Scycase "$ntp_ok" in
2212280849Scy yes)
2213181834Sroberto    ntp_refclock=yes
2214280849Scy    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2215280849Scy    ;;
2216280849Scyesac
2217280849ScyAC_MSG_RESULT([$ntp_ok])
2218181834Sroberto
2219200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2220280849ScyAC_ARG_ENABLE(
2221280849Scy    [JUPITER],
2222280849Scy    [AS_HELP_STRING(
2223280849Scy	[--enable-JUPITER],
2224280849Scy	[s Rockwell Jupiter GPS receiver]
2225280849Scy    )],
2226181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2227280849Scycase "$ntp_jupiter_ok" in
2228181834Sroberto no) ntp_ok=no ;;
2229181834Srobertoesac
2230280849Scycase "$ntp_ok" in
2231280849Scy yes)
2232181834Sroberto    ntp_refclock=yes
2233280849Scy    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2234280849Scy    ;;
2235280849Scyesac
2236280849ScyAC_MSG_RESULT([$ntp_ok])
2237181834Sroberto
2238200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2239280849ScyAC_ARG_ENABLE(
2240280849Scy    [LEITCH],
2241280849Scy    [AS_HELP_STRING(
2242280849Scy	[--enable-LEITCH],
2243280849Scy	[+ Leitch CSD 5300 Master Clock System Driver]
2244280849Scy    )],
2245280849Scy    [ntp_ok=$enableval],
2246280849Scy    [ntp_ok=$ntp_eac]
2247280849Scy)
2248280849Scycase "$ntp_ok" in
2249280849Scy yes)
2250181834Sroberto    ntp_refclock=yes
2251280849Scy    AC_DEFINE([CLOCK_LEITCH], [1],
2252280849Scy	[Leitch CSD 5300 Master Clock System Driver?])
2253280849Scy    ;;
2254280849Scyesac
2255280849ScyAC_MSG_RESULT([$ntp_ok])
2256181834Sroberto
2257200576SrobertoAC_MSG_CHECKING([local clock reference])
2258280849ScyAC_ARG_ENABLE(
2259280849Scy    [LOCAL-CLOCK],
2260280849Scy    [AS_HELP_STRING(
2261280849Scy	[--enable-LOCAL-CLOCK],
2262280849Scy	[+ local clock reference]
2263280849Scy    )],
2264280849Scy    [ntp_ok=$enableval],
2265280849Scy    [ntp_ok=$ntp_eac]
2266280849Scy)
2267280849Scycase "$ntp_ok" in
2268280849Scy yes)
2269181834Sroberto    ntp_refclock=yes
2270280849Scy    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2271280849Scy    ;;
2272280849Scyesac
2273280849ScyAC_MSG_RESULT([$ntp_ok])
2274181834Sroberto
2275181834Srobertodnl Bug 340: longstanding unfixed bugs
2276280849Scydnl AC_MSG_CHECKING([EES M201 MSF receiver])
2277280849Scydnl AC_ARG_ENABLE([MSFEES],
2278280849Scydnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2279181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2280181834Srobertodnl if test "$ntp_ok" = "yes"; then
2281181834Srobertodnl     ntp_refclock=yes
2282280849Scydnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2283181834Srobertodnl fi
2284280849Scydnl AC_MSG_RESULT([$ntp_ok])
2285181834Sroberto
2286181834Sroberto# Not Ultrix
2287200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2288280849ScyAC_ARG_ENABLE(
2289280849Scy    [MX4200],
2290280849Scy    [AS_HELP_STRING(
2291280849Scy	[--enable-MX4200 ],
2292280849Scy	[s Magnavox MX4200 GPS receiver]
2293280849Scy    )],
2294181834Sroberto    [ntp_ok=$enableval],
2295280849Scy    [
2296280849Scy	case "$ac_cv_var_ppsclock" in
2297280849Scy	 yes)
2298280849Scy	    ntp_ok=$ntp_eac
2299280849Scy	    ;;
2300280849Scy	 *)
2301280849Scy	    ntp_ok=no
2302280849Scy	    ;;
2303280849Scy	esac
2304280849Scy    ]
2305280849Scy)
2306280849Scycase "$ntp_ok" in
2307280849Scy yes)
2308181834Sroberto    ntp_refclock=yes
2309280849Scy    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2310280849Scy    ;;
2311280849Scyesac
2312280849ScyAC_MSG_RESULT([$ntp_ok])
2313181834Srobertocase "$ntp_ok$host" in
2314280849Scy yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2315181834Srobertoesac
2316181834Sroberto
2317200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2318280849ScyAC_ARG_ENABLE(
2319280849Scy    [NEOCLOCK4X],
2320280849Scy    [AS_HELP_STRING(
2321280849Scy	[--enable-NEOCLOCK4X],
2322280849Scy	[+ NeoClock4X DCF77 / TDF receiver]
2323280849Scy    )],
2324280849Scy    [ntp_ok=$enableval],
2325280849Scy    [ntp_ok=$ntp_eac]
2326280849Scy)
2327280849Scycase "$ntp_ok" in
2328280849Scy yes)
2329181834Sroberto    ntp_refclock=yes
2330280849Scy    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2331280849Scy    ;;
2332280849Scyesac
2333280849ScyAC_MSG_RESULT([$ntp_ok])
2334181834Sroberto
2335200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2336280849ScyAC_ARG_ENABLE(
2337280849Scy    [NMEA],
2338280849Scy    [AS_HELP_STRING(
2339280849Scy	[--enable-NMEA],
2340280849Scy	[+ NMEA GPS receiver]
2341280849Scy    )],
2342280849Scy    [ntp_ok=$enableval],
2343280849Scy    [ntp_ok=$ntp_eac]
2344280849Scy)
2345280849Scycase "$ntp_ok" in
2346280849Scy yes)
2347181834Sroberto    ntp_refclock=yes
2348280849Scy    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2349280849Scy    ;;
2350280849Scyesac
2351280849ScyAC_MSG_RESULT([$ntp_ok])
2352181834Sroberto
2353280849ScyAC_CHECK_FUNCS([strtoll])
2354280849ScyAC_MSG_CHECKING([for GPSD JSON receiver])
2355280849ScyAC_ARG_ENABLE(
2356280849Scy    [GPSD],
2357280849Scy    [AS_HELP_STRING(
2358280849Scy	[--enable-GPSD],
2359280849Scy	[+ GPSD JSON receiver]
2360280849Scy    )],
2361280849Scy    [ntp_ok=$enableval],
2362280849Scy    [case "$ac_cv_func_strtoll" in
2363280849Scy     yes) ntp_ok=$ntp_eac ;;
2364280849Scy     *)   ntp_ok="no" ;;
2365280849Scy    esac]
2366280849Scy)
2367280849Scycase "$ntp_ok" in
2368280849Scy yes)
2369280849Scy    ntp_refclock=yes
2370280849Scy    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2371280849Scy    ;;
2372280849Scyesac
2373280849ScyAC_MSG_RESULT([$ntp_ok])
2374280849Scy
2375200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2376280849ScyAC_ARG_ENABLE(
2377280849Scy    [ONCORE],
2378280849Scy    [AS_HELP_STRING(
2379280849Scy	[--enable-ONCORE],
2380280849Scy	[s Motorola VP/UT Oncore GPS receiver]
2381280849Scy    )],
2382280849Scy    [ntp_ok=$enableval],
2383280849Scy    [ntp_ok=$ntp_eac]
2384280849Scy)
2385280849Scycase "$ntp_oncore_ok" in
2386181834Sroberto no) ntp_ok=no ;;
2387181834Srobertoesac
2388280849Scycase "$ntp_ok" in
2389280849Scy yes)
2390181834Sroberto    ntp_refclock=yes
2391280849Scy    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2392280849Scy    ;;
2393280849Scyesac
2394280849ScyAC_MSG_RESULT([$ntp_ok])
2395181834Sroberto
2396280849Scy# Requires modem control
2397200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2398280849ScyAC_ARG_ENABLE(
2399280849Scy    [PALISADE],
2400280849Scy    [AS_HELP_STRING(
2401280849Scy	[--enable-PALISADE],
2402280849Scy	[s Palisade clock]
2403280849Scy    )],
2404181834Sroberto    [ntp_ok=$enableval],
2405280849Scy    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2406280849Scy)
2407280849Scycase "$ntp_ok" in
2408280849Scy yes)
2409181834Sroberto    ntp_refclock=yes
2410280849Scy    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2411280849Scy    ;;
2412280849Scyesac
2413280849ScyAC_MSG_RESULT([$ntp_ok])
2414181834Sroberto
2415200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2416280849ScyAC_ARG_ENABLE(
2417280849Scy    [PCF],
2418280849Scy    [AS_HELP_STRING(
2419280849Scy	[--enable-PCF ],
2420280849Scy	[+ Conrad parallel port radio clock]
2421280849Scy    )],
2422280849Scy    [ntp_ok=$enableval],
2423280849Scy    [ntp_ok=$ntp_eac]
2424280849Scy)
2425280849Scycase "$ntp_ok" in
2426280849Scy yes)
2427181834Sroberto    ntp_refclock=yes
2428280849Scy    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2429280849Scy    ;;
2430280849Scyesac
2431280849ScyAC_MSG_RESULT([$ntp_ok])
2432181834Sroberto
2433200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2434280849ScyAC_ARG_ENABLE(
2435280849Scy    [PST],
2436280849Scy    [AS_HELP_STRING(
2437280849Scy	[--enable-PST],
2438280849Scy	[+ PST/Traconex 1020 WWV/WWVH receiver]
2439280849Scy    )],
2440280849Scy    [ntp_ok=$enableval],
2441280849Scy    [ntp_ok=$ntp_eac]
2442280849Scy)
2443280849Scycase "$ntp_ok" in
2444280849Scy yes)
2445181834Sroberto    ntp_refclock=yes
2446280849Scy    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2447280849Scy    ;;
2448280849Scyesac
2449280849ScyAC_MSG_RESULT([$ntp_ok])
2450181834Sroberto
2451200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2452280849ScyAC_ARG_ENABLE(
2453280849Scy    [RIPENCC],
2454280849Scy    [AS_HELP_STRING(
2455280849Scy	[--enable-RIPENCC],
2456280849Scy	[- RIPENCC specific Trimble driver]
2457280849Scy    )],
2458280849Scy    [ntp_ok=$enableval],
2459280849Scy    [ntp_ok=no]
2460280849Scy)
2461181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2462280849Scycase "$ntp_ripe_ncc_ok" in
2463181834Sroberto no) ntp_ok=no ;;
2464181834Srobertoesac
2465280849Scycase "$ntp_ok" in
2466280849Scy yes)
2467181834Sroberto    ntp_refclock=yes
2468280849Scy    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2469280849Scy    ;;
2470280849Scyesac
2471280849ScyAC_MSG_RESULT([$ntp_ok])
2472181834Sroberto
2473181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2474181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2475200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2476280849ScyAC_ARG_ENABLE(
2477280849Scy    [SHM],
2478280849Scy    [AS_HELP_STRING(
2479280849Scy	[--enable-SHM],
2480280849Scy	[s SHM clock attached thru shared memory]
2481280849Scy    )],
2482181834Sroberto    [ntp_ok=$enableval],
2483280849Scy    [
2484280849Scy	case "$ntp_eac$ntp_canshm" in
2485280849Scy	 *no*)	ntp_ok=no  ;;
2486280849Scy	 *)	ntp_ok=yes ;;
2487280849Scy	esac
2488280849Scy    ]
2489280849Scy)
2490280849Scycase "$ntp_ok" in
2491280849Scy yes)
2492181834Sroberto    ntp_refclock=yes
2493280849Scy    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2494280849Scy    ;;
2495280849Scyesac
2496280849ScyAC_MSG_RESULT([$ntp_ok])
2497181834Sroberto
2498200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2499280849ScyAC_ARG_ENABLE(
2500280849Scy    [SPECTRACOM],
2501280849Scy    [AS_HELP_STRING(
2502280849Scy	[--enable-SPECTRACOM],
2503280849Scy	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2504280849Scy    )],
2505280849Scy    [ntp_ok=$enableval],
2506280849Scy    [ntp_ok=$ntp_eac]
2507280849Scy)
2508280849Scycase "$ntp_ok" in
2509280849Scy yes)
2510181834Sroberto    ntp_refclock=yes
2511280849Scy    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2512280849Scy	[Spectracom 8170/Netclock/2 WWVB receiver])
2513280849Scy    ;;
2514280849Scyesac
2515280849ScyAC_MSG_RESULT([$ntp_ok])
2516181834Sroberto
2517200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2518280849ScyAC_ARG_ENABLE(
2519280849Scy    [TPRO],
2520280849Scy    [AS_HELP_STRING(
2521280849Scy	[--enable-TPRO],
2522280849Scy	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2523280849Scy    )],
2524181834Sroberto    [ntp_ok=$enableval],
2525280849Scy    [
2526280849Scy	case "$ac_cv_header_sys_tpro_h" in
2527280849Scy	 yes)
2528280849Scy	    ntp_ok=$ntp_eac
2529280849Scy	    ;;
2530280849Scy	 *)
2531280849Scy	    ntp_ok=no
2532280849Scy	    ;;
2533280849Scy	esac
2534280849Scy    ]
2535280849Scy)
2536280849Scycase "$ntp_ok" in
2537280849Scy yes)
2538181834Sroberto    ntp_refclock=yes
2539280849Scy    AC_DEFINE([CLOCK_TPRO], [1],
2540280849Scy	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2541280849Scy    ;;
2542280849Scyesac
2543280849ScyAC_MSG_RESULT([$ntp_ok])
2544181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2545280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2546181834Srobertoesac
2547181834Sroberto
2548181834Sroberto# Not on a vax-dec-bsd
2549200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2550280849ScyAC_ARG_ENABLE(
2551280849Scy    [TRUETIME],
2552280849Scy    [AS_HELP_STRING(
2553280849Scy	[--enable-TRUETIME],
2554280849Scy	[s Kinemetrics/TrueTime receivers]
2555280849Scy    )],
2556181834Sroberto    [ntp_ok=$enableval],
2557280849Scy    [
2558280849Scy	case "$host" in
2559280849Scy	 vax-dec-bsd)
2560280849Scy	    ntp_ok=no
2561280849Scy	    ;;
2562280849Scy	 *)
2563280849Scy	    ntp_ok=$ntp_eac
2564280849Scy	    ;;
2565280849Scy	esac
2566280849Scy    ]
2567280849Scy)    
2568280849Scycase "$ntp_ok" in
2569280849Scy yes)
2570181834Sroberto    ntp_refclock=yes
2571280849Scy    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2572280849Scy    ;;
2573280849Scyesac
2574280849ScyAC_MSG_RESULT([$ntp_ok])
2575181834Srobertocase "$ntp_ok$host" in
2576280849Scy yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2577181834Srobertoesac
2578181834Sroberto
2579200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2580280849ScyAC_ARG_ENABLE(
2581280849Scy    [TT560],
2582280849Scy    [AS_HELP_STRING(
2583280849Scy	[--enable-TT560],
2584280849Scy	[- TrueTime 560 IRIG-B decoder]
2585280849Scy    )],
2586280849Scy    [ntp_ok=$enableval],
2587280849Scy    [ntp_ok=no]
2588280849Scy)
2589280849Scycase "$ntp_ok" in
2590280849Scy yes)
2591181834Sroberto    ntp_refclock=yes
2592280849Scy    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2593280849Scy    ;;
2594280849Scyesac
2595280849ScyAC_MSG_RESULT([$ntp_ok])
2596181834Sroberto
2597200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2598280849ScyAC_ARG_ENABLE(
2599280849Scy    [ULINK],
2600280849Scy    [AS_HELP_STRING(
2601280849Scy	[--enable-ULINK],
2602280849Scy	[+ Ultralink WWVB receiver]
2603280849Scy    )],
2604280849Scy    [ntp_ok=$enableval],
2605280849Scy    [ntp_ok=$ntp_eac]
2606280849Scy)
2607280849Scycase "$ntp_ok" in
2608280849Scy yes)
2609181834Sroberto    ntp_refclock=yes
2610280849Scy    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2611280849Scy    ;;
2612280849Scyesac
2613280849ScyAC_MSG_RESULT([$ntp_ok])
2614181834Sroberto
2615280849ScyAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2616280849ScyAC_ARG_ENABLE(
2617280849Scy    [TSYNCPCI],
2618280849Scy    [AS_HELP_STRING(
2619280849Scy	[--enable-TSYNCPCI],
2620280849Scy	[s Spectracom TSYNC timing board]
2621280849Scy    )],
2622280849Scy    [ntp_ok=$enableval],
2623280849Scy    [
2624280849Scy	case "$host" in
2625280849Scy	 *-*-*linux*)
2626280849Scy	    ntp_ok=$ntp_eac
2627280849Scy	    ;;
2628280849Scy	 *)
2629280849Scy	    ntp_ok=no
2630280849Scy	esac
2631280849Scy    ]
2632280849Scy)
2633280849Scycase "$ntp_ok" in
2634280849Scy yes)
2635280849Scy    ntp_refclock=yes
2636280849Scy    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2637280849Scy    ;;
2638280849Scyesac
2639280849ScyAC_MSG_RESULT([$ntp_ok])
2640280849Scy
2641200576SrobertoAC_MSG_CHECKING([WWV receiver])
2642280849ScyAC_ARG_ENABLE(
2643280849Scy    [WWV],
2644280849Scy    [AS_HELP_STRING(
2645280849Scy	[--enable-WWV],
2646280849Scy	[s WWV Audio receiver]
2647280849Scy    )],
2648181834Sroberto    [ntp_ok=$enableval],
2649280849Scy    [
2650280849Scy	case "$ntp_eac$ntp_canaudio" in
2651280849Scy	 *no*)	ntp_ok=no  ;;
2652280849Scy	 *)	ntp_ok=yes ;;
2653280849Scy	esac
2654280849Scy    ]
2655280849Scy)
2656280849Scycase "$ntp_ok" in
2657280849Scy yes)
2658181834Sroberto    ntp_refclock=yes
2659280849Scy    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2660280849Scy    ;;
2661280849Scyesac
2662280849ScyAC_MSG_RESULT([$ntp_ok])
2663181834Srobertocase "$ntp_ok$ntp_canaudio" in
2664280849Scy yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2665181834Srobertoesac
2666181834Sroberto
2667200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2668280849ScyAC_ARG_ENABLE(
2669280849Scy    [ZYFER],
2670280849Scy    [AS_HELP_STRING(
2671280849Scy	[--enable-ZYFER],
2672280849Scy	[+ Zyfer GPStarplus receiver]
2673280849Scy    )],
2674280849Scy    [ntp_ok=$enableval],
2675280849Scy    [ntp_ok=$ntp_eac]
2676280849Scy)
2677280849Scycase "$ntp_ok" in
2678280849Scy yes)
2679181834Sroberto    ntp_refclock=yes
2680280849Scy    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2681280849Scy    ;;
2682280849Scyesac
2683280849ScyAC_MSG_RESULT([$ntp_ok])
2684181834Sroberto
2685200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2686280849ScyAC_ARG_ENABLE(
2687280849Scy    [parse-clocks],
2688280849Scy    [AS_HELP_STRING(
2689280849Scy	[--enable-parse-clocks],
2690280849Scy	[- include all suitable PARSE clocks:]
2691280849Scy    )],
2692181834Sroberto    [ntp_eapc=$enableval],
2693280849Scy    [
2694280849Scy	case "$ntp_eac" in
2695280849Scy	 yes)	ntp_eapc=$ntp_canparse ;;
2696280849Scy	 *)	ntp_eapc=no ;;
2697280849Scy	esac
2698280849Scy	# Delete the next line one of these days
2699280849Scy	ntp_eapc=no
2700280849Scy    ]
2701280849Scy)
2702181834SrobertoAC_MSG_RESULT($ntp_eapc)
2703181834Sroberto
2704181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2705181834Sroberto noyes*)
2706200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2707181834Sroberto    ;;
2708181834Sroberto yesyesno)
2709200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2710181834Sroberto    ;;
2711181834Srobertoesac
2712181834Sroberto
2713181834Srobertontp_libparse=no
2714181834Srobertontp_parseutil=no
2715181834Srobertontp_rawdcf=no
2716181834Sroberto
2717200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2718280849ScyAC_ARG_ENABLE(
2719280849Scy    [COMPUTIME],
2720280849Scy    [AS_HELP_STRING(
2721280849Scy	[--enable-COMPUTIME],
2722280849Scy	[s Diem Computime Radio Clock]
2723280849Scy    )],
2724280849Scy    [ntp_ok=$enableval],
2725280849Scy    [ntp_ok=$ntp_eapc]
2726280849Scy)
2727280849Scycase "$ntp_ok" in
2728280849Scy yes)
2729181834Sroberto    ntp_libparse=yes
2730181834Sroberto    ntp_refclock=yes
2731280849Scy    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2732280849Scy    ;;
2733280849Scyesac
2734280849ScyAC_MSG_RESULT([$ntp_ok])
2735181834Srobertocase "$ntp_ok$ntp_canparse" in
2736181834Sroberto yesno)
2737200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2738181834Srobertoesac
2739181834Sroberto
2740200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2741280849ScyAC_ARG_ENABLE(
2742280849Scy    [DCF7000],
2743280849Scy    [AS_HELP_STRING(
2744280849Scy	[--enable-DCF7000],
2745280849Scy	[s ELV/DCF7000 clock]
2746280849Scy    )],
2747280849Scy    [ntp_ok=$enableval],
2748280849Scy    [ntp_ok=$ntp_eapc]
2749280849Scy)
2750280849Scycase "$ntp_ok" in
2751280849Scy yes)
2752181834Sroberto    ntp_libparse=yes
2753181834Sroberto    ntp_refclock=yes
2754280849Scy    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2755280849Scy    ;;
2756280849Scyesac
2757280849ScyAC_MSG_RESULT([$ntp_ok])
2758181834Srobertocase "$ntp_ok$ntp_canparse" in
2759181834Sroberto yesno)
2760200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2761181834Srobertoesac
2762181834Sroberto
2763200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2764280849ScyAC_ARG_ENABLE(
2765280849Scy    [HOPF6021],
2766280849Scy    [AS_HELP_STRING(
2767280849Scy	[--enable-HOPF6021],
2768280849Scy	[s HOPF 6021 clock]
2769280849Scy    )],
2770280849Scy    [ntp_ok=$enableval],
2771280849Scy    [ntp_ok=$ntp_eapc]
2772280849Scy)
2773280849Scycase "$ntp_ok" in
2774280849Scy yes)
2775181834Sroberto    ntp_libparse=yes
2776181834Sroberto    ntp_refclock=yes
2777280849Scy    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2778280849Scy    ;;
2779280849Scyesac
2780280849ScyAC_MSG_RESULT([$ntp_ok])
2781181834Srobertocase "$ntp_ok$ntp_canparse" in
2782181834Sroberto yesno)
2783200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2784181834Srobertoesac
2785181834Sroberto
2786200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2787280849ScyAC_ARG_ENABLE(
2788280849Scy    [MEINBERG],
2789280849Scy    [AS_HELP_STRING(
2790280849Scy	[--enable-MEINBERG],
2791280849Scy	[s Meinberg clocks]
2792280849Scy    )],
2793280849Scy    [ntp_ok=$enableval],
2794280849Scy    [ntp_ok=$ntp_eapc]
2795280849Scy)
2796280849Scycase "$ntp_ok" in
2797280849Scy yes)
2798181834Sroberto    ntp_libparse=yes
2799181834Sroberto    ntp_refclock=yes
2800280849Scy    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2801280849Scy    ;;
2802280849Scyesac
2803280849ScyAC_MSG_RESULT([$ntp_ok])
2804181834Srobertocase "$ntp_ok$ntp_canparse" in
2805181834Sroberto yesno)
2806200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2807181834Srobertoesac
2808181834Sroberto
2809200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2810280849ScyAC_ARG_ENABLE(
2811280849Scy    [RAWDCF],
2812280849Scy    [AS_HELP_STRING(
2813280849Scy	[--enable-RAWDCF],
2814280849Scy	[s DCF77 raw time code]
2815280849Scy    )],
2816280849Scy    [ntp_ok=$enableval],
2817280849Scy    [ntp_ok=$ntp_eapc]
2818280849Scy)
2819280849Scycase "$ntp_ok" in
2820280849Scy yes)
2821181834Sroberto    ntp_libparse=yes
2822181834Sroberto    ntp_parseutil=yes
2823181834Sroberto    ntp_refclock=yes
2824181834Sroberto    ntp_rawdcf=yes
2825280849Scy    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2826280849Scy    ;;
2827280849Scyesac
2828280849ScyAC_MSG_RESULT([$ntp_ok])
2829181834Srobertocase "$ntp_ok$ntp_canparse" in
2830181834Sroberto yesno)
2831280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2832181834Srobertoesac
2833181834Sroberto
2834181834Srobertocase "$ntp_rawdcf" in
2835181834Sroberto yes)
2836200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2837280849Scy	[ntp_cv_rawdcf_parity],
2838280849Scy	[
2839280849Scy	    ans=no
2840280849Scy	    case "$host" in
2841280849Scy	     *-*-*linux*)
2842280849Scy		ans=yes
2843280849Scy		;;
2844280849Scy	    esac
2845280849Scy	    ntp_cv_rawdcf_parity=$ans
2846280849Scy	]
2847280849Scy    )
2848280849Scy    case "$ntp_cv_rawdcf_parity" in
2849280849Scy     yes)
2850280849Scy	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2851280849Scy	    [Should we not IGNPAR (Linux)?]) ;;
2852181834Sroberto    esac
2853181834Srobertoesac
2854181834Sroberto
2855200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2856280849ScyAC_ARG_ENABLE(
2857280849Scy    [RCC8000],
2858280849Scy    [AS_HELP_STRING(
2859280849Scy	[--enable-RCC8000],
2860280849Scy	[s RCC 8000 clock]
2861280849Scy    )],
2862280849Scy    [ntp_ok=$enableval],
2863280849Scy    [ntp_ok=$ntp_eapc]
2864280849Scy)
2865280849Scycase "$ntp_ok" in
2866280849Scy yes)
2867181834Sroberto    ntp_libparse=yes
2868181834Sroberto    ntp_refclock=yes
2869280849Scy    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2870280849Scy    ;;
2871280849Scyesac
2872280849ScyAC_MSG_RESULT([$ntp_ok])
2873181834Srobertocase "$ntp_ok$ntp_canparse" in
2874181834Sroberto yesno)
2875280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2876181834Srobertoesac
2877181834Sroberto
2878200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2879280849ScyAC_ARG_ENABLE(
2880280849Scy    [SCHMID],
2881280849Scy    [AS_HELP_STRING(
2882280849Scy	[--enable-SCHMID ],
2883280849Scy	[s Schmid DCF77 clock]
2884280849Scy    )],
2885280849Scy    [ntp_ok=$enableval],
2886280849Scy    [ntp_ok=$ntp_eapc]
2887280849Scy)
2888280849Scycase "$ntp_ok" in
2889280849Scy yes)
2890181834Sroberto    ntp_libparse=yes
2891181834Sroberto    ntp_refclock=yes
2892280849Scy    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2893280849Scy    ;;
2894280849Scyesac
2895280849ScyAC_MSG_RESULT([$ntp_ok])
2896181834Srobertocase "$ntp_ok$ntp_canparse" in
2897181834Sroberto yesno)
2898280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2899181834Srobertoesac
2900181834Sroberto
2901200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2902280849ScyAC_ARG_ENABLE(
2903280849Scy    [TRIMTAIP],
2904280849Scy    [AS_HELP_STRING(
2905280849Scy	[--enable-TRIMTAIP],
2906280849Scy	[s Trimble GPS receiver/TAIP protocol]
2907280849Scy    )],
2908280849Scy    [ntp_ok=$enableval],
2909280849Scy    [ntp_ok=$ntp_eapc]
2910280849Scy)
2911280849Scycase "$ntp_ok" in
2912280849Scy yes)
2913181834Sroberto    ntp_libparse=yes
2914181834Sroberto    ntp_refclock=yes
2915280849Scy    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2916280849Scy	[Trimble GPS receiver/TAIP protocol])
2917280849Scy    ;;
2918280849Scyesac
2919280849ScyAC_MSG_RESULT([$ntp_ok])
2920181834Srobertocase "$ntp_ok$ntp_canparse" in
2921181834Sroberto yesno)
2922280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2923181834Srobertoesac
2924181834Sroberto
2925200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2926280849ScyAC_ARG_ENABLE(
2927280849Scy    [TRIMTSIP],
2928280849Scy    [AS_HELP_STRING(
2929280849Scy	[--enable-TRIMTSIP],
2930280849Scy	[s Trimble GPS receiver/TSIP protocol]
2931280849Scy    )],
2932280849Scy    [ntp_ok=$enableval],
2933280849Scy    [ntp_ok=$ntp_eapc]
2934280849Scy)
2935280849Scycase "$ntp_ok" in
2936280849Scy yes)
2937181834Sroberto    ntp_libparse=yes
2938181834Sroberto    ntp_refclock=yes
2939280849Scy    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2940280849Scy	[Trimble GPS receiver/TSIP protocol])
2941280849Scy    ;;
2942280849Scyesac
2943280849ScyAC_MSG_RESULT([$ntp_ok])
2944181834Srobertocase "$ntp_ok$ntp_canparse" in
2945181834Sroberto yesno)
2946280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2947181834Srobertoesac
2948181834Sroberto
2949200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2950280849ScyAC_ARG_ENABLE(
2951280849Scy    [WHARTON],
2952280849Scy    [AS_HELP_STRING(
2953280849Scy	[--enable-WHARTON],
2954280849Scy	[s WHARTON 400A Series clock]
2955280849Scy    )],
2956280849Scy    [ntp_ok=$enableval],
2957280849Scy    [ntp_ok=$ntp_eapc]
2958280849Scy)
2959280849Scycase "$ntp_ok" in
2960280849Scy yes)
2961181834Sroberto    ntp_libparse=yes
2962181834Sroberto    ntp_refclock=yes
2963280849Scy    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2964280849Scy    ;;
2965280849Scyesac
2966280849ScyAC_MSG_RESULT([$ntp_ok])
2967181834Srobertocase "$ntp_ok$ntp_canparse" in
2968181834Sroberto yesno)
2969280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2970280849Scyesac
2971280849Scy
2972280849ScyAC_MSG_CHECKING([VARITEXT clock])
2973280849ScyAC_ARG_ENABLE(
2974280849Scy    [VARITEXT],
2975280849Scy    [AS_HELP_STRING(
2976280849Scy	[--enable-VARITEXT],
2977280849Scy	[s VARITEXT clock]
2978280849Scy    )],
2979280849Scy    [ntp_ok=$enableval],
2980280849Scy    [ntp_ok=$ntp_eapc]
2981280849Scy)
2982280849Scycase "$ntp_ok" in
2983280849Scy yes)
2984280849Scy    ntp_libparse=yes
2985280849Scy    ntp_refclock=yes
2986280849Scy    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2987181834Sroberto    ;;
2988181834Srobertoesac
2989280849ScyAC_MSG_RESULT([$ntp_ok])
2990280849Scycase "$ntp_ok$ntp_canparse" in
2991280849Scy yesno)
2992280849Scy    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2993280849Scyesac
2994181834Sroberto
2995280849ScyAC_MSG_CHECKING(SEL240X clock)
2996280849ScyAC_ARG_ENABLE(SEL240X,
2997280849Scy    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2998181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2999181834Srobertoif test "$ntp_ok" = "yes"; then
3000181834Sroberto    ntp_libparse=yes
3001181834Sroberto    ntp_refclock=yes
3002280849Scy    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
3003181834Srobertofi
3004181834SrobertoAC_MSG_RESULT($ntp_ok)
3005181834Srobertocase "$ntp_ok$ntp_canparse" in
3006181834Sroberto yesno)
3007280849Scy    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3008181834Sroberto    ;;
3009181834Srobertoesac
3010280849Scy
3011280849ScyAC_SUBST([LIBPARSE])
3012280849ScyAC_SUBST([MAKE_LIBPARSE])
3013280849ScyAC_SUBST([MAKE_LIBPARSE_KERNEL])
3014280849ScyAC_SUBST([MAKE_CHECK_Y2K])
3015280849Scy
3016200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3017181834Srobertoans=no
3018181834Srobertocase "$ntp_libparse" in
3019181834Sroberto yes)
3020181834Sroberto    ans=yes
3021280849Scy    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3022181834Sroberto    LIBPARSE=../libparse/libparse.a
3023181834Sroberto    MAKE_LIBPARSE=libparse.a
3024181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3025181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3026181834Srobertoesac
3027200576SrobertoAC_MSG_RESULT([$ans])
3028181834Sroberto
3029280849ScyNTP_OPENSSL
3030181834Sroberto
3031280849ScyNTP_CRYPTO_RAND
3032181834Sroberto
3033280849Scy# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3034280849ScyAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3035280849ScyAC_ARG_ENABLE(
3036280849Scy    [autokey],
3037280849Scy    AS_HELP_STRING(
3038280849Scy	[--enable-autokey],
3039280849Scy	[+ support NTP Autokey protocol]
3040280849Scy	),
3041280849Scy    [ntp_autokey=$enableval],
3042280849Scy    [ntp_autokey=$ntp_openssl]
3043280849Scy)
3044280849Scycase "$ntp_autokey" in
3045280849Scy no)
3046181834Sroberto    ;;
3047280849Scy *)
3048280849Scy    case "$ntp_openssl" in
3049181834Sroberto     no)
3050280849Scy	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3051280849Scy	ntp_autokey=no
3052181834Sroberto	;;
3053280849Scy     *)
3054280849Scy	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3055280849Scy	ntp_autokey=yes
3056181834Sroberto	;;
3057181834Sroberto    esac
3058181834Sroberto    ;;
3059181834Srobertoesac
3060280849ScyAC_MSG_RESULT([$ntp_autokey])
3061181834Sroberto
3062280849ScyAC_SUBST([MAKE_CHECK_LAYOUT])
3063200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3064181834Srobertocase "$cross_compiling$PATH_PERL" in
3065181834Sroberto no/*)
3066181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3067181834Sroberto    ans=yes
3068181834Sroberto    ;;
3069181834Sroberto *)
3070181834Sroberto    ans=no
3071181834Sroberto    ;;
3072181834Srobertoesac
3073200576SrobertoAC_MSG_RESULT([$ans])
3074181834Sroberto
3075280849ScyAC_SUBST([TESTDCF])
3076280849ScyAC_SUBST([DCFD])
3077200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3078181834Srobertoans=no
3079280849Scycase "$ntp_parseutil" in
3080280849Scy yes)
3081181834Sroberto    case "$host" in
3082200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3083181834Sroberto	ans="dcfd testdcf"
3084181834Sroberto	DCFD=dcfd
3085280849Scy	TESTDCF=testdcf
3086181834Sroberto    esac
3087280849Scy    ;;
3088280849Scyesac
3089200576SrobertoAC_MSG_RESULT([$ans])
3090181834Sroberto
3091280849ScyAC_SUBST([MAKE_PARSEKMODULE])
3092200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3093181834Srobertoans=no
3094181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3095181834Sroberto yesyes)
3096181834Sroberto    case "$host" in
3097181834Sroberto     sparc-*-sunos4*)
3098280849Scy        case "$ntp_cv_var_kernel_pll" in
3099181834Sroberto	yes)
3100280849Scy	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3101181834Sroberto	    ;;
3102181834Sroberto	esac
3103181834Sroberto	ans=parsestreams
3104181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3105181834Sroberto	;;
3106181834Sroberto     sparc-*-solaris2*)
3107181834Sroberto	ans=parsesolaris
3108181834Sroberto	MAKE_PARSEKMODULE=parse
3109280849Scy	AC_CHECK_HEADERS([strings.h])
3110181834Sroberto	;;
3111181834Sroberto    esac
3112181834Sroberto    ;;
3113181834Srobertoesac
3114200576SrobertoAC_MSG_RESULT([$ans])
3115181834Sroberto
3116200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3117280849Scycase "$ntp_refclock" in
3118280849Scy yes)
3119280849Scy    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3120280849Scy    ;;
3121280849Scyesac
3122181834SrobertoAC_MSG_RESULT($ntp_refclock)
3123181834Sroberto
3124280849Scydnl Things that can be made in clockstuff
3125280849ScyAC_SUBST([PROPDELAY], [propdelay])
3126280849ScyAC_SUBST([CHUTEST]) dnl needs work to compile
3127181834Sroberto
3128280849ScyAC_SUBST([MAKE_ADJTIMED])
3129280849ScyAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3130181834Srobertocase "$host" in
3131181834Sroberto *-*-hpux[[56789]]*)
3132181834Sroberto    ans=yes
3133181834Sroberto    ;;
3134181834Sroberto *) ans=no
3135181834Sroberto    ;;
3136181834Srobertoesac
3137280849Scycase "$ans" in
3138280849Scy yes)
3139181834Sroberto    MAKE_ADJTIMED=adjtimed
3140280849Scy    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3141280849Scy	[Do we need HPUX adjtime() library support?])
3142280849Scy    ;;
3143280849Scy *) ADJTIMED_DB=
3144280849Scy    ADJTIMED_DL=
3145280849Scy    ADJTIMED_DS=
3146280849Scy    ADJTIMED_MS=
3147280849Scy    ;;
3148280849Scyesac
3149200576SrobertoAC_MSG_RESULT([$ans])
3150181834Sroberto
3151200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3152181834Srobertocase "$host" in
3153181834Sroberto *-*-qnx*)
3154181834Sroberto    ans=yes
3155181834Sroberto    ;;
3156181834Sroberto *) ans=no
3157181834Sroberto    ;;
3158181834Srobertoesac
3159280849Scycase "$ans" in
3160280849Scy yes)
3161280849Scy    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3162280849Scy	[Do we need the qnx adjtime call?])
3163280849Scy    ;;
3164280849Scyesac
3165200576SrobertoAC_MSG_RESULT([$ans])
3166181834Sroberto
3167200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3168181834Sroberto
3169200576Sroberto#  the default is to enable it if the system has the capability
3170200576Sroberto
3171200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3172200576Sroberto *yes*)
3173200576Sroberto    ans=yes
3174200576Sroberto    ;;
3175200576Sroberto *) ans=no
3176280849Scy    ;;
3177181834Srobertoesac
3178181834Sroberto
3179200576Srobertocase "$host" in
3180200576Sroberto *-*-domainos)	# Won't be found...
3181200576Sroberto    ans=no
3182200576Sroberto    ;;
3183200576Sroberto *-*-hpux*)
3184200576Sroberto    #ans=no
3185200576Sroberto    ;;
3186200576Sroberto *-*-irix[[456]]*)
3187200576Sroberto    ans=no
3188200576Sroberto    ;;
3189200576Sroberto *-*-*linux*)
3190200576Sroberto    ans=no
3191200576Sroberto    ;;
3192200576Sroberto *-*-winnt3.5)
3193200576Sroberto    ans=no
3194200576Sroberto    ;;
3195200576Sroberto *-*-unicosmp*)
3196200576Sroberto    ans=no
3197200576Sroberto    ;;
3198200576Srobertoesac
3199200576Sroberto
3200200576Sroberto# --enable-kmem / --disable-kmem controls if present
3201200576SrobertoAC_ARG_ENABLE(
3202200576Sroberto    [kmem],
3203280849Scy    [AS_HELP_STRING(
3204200576Sroberto	[--enable-kmem],
3205200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3206280849Scy    )],
3207200576Sroberto    [ans=$enableval]
3208200576Sroberto)
3209200576Sroberto
3210200576SrobertoAC_MSG_RESULT([$ans])
3211200576Sroberto
3212200576Srobertocase "$ans" in
3213200576Sroberto yes)
3214200576Sroberto    can_kmem=yes
3215200576Sroberto    ;;
3216280849Scy *)
3217200576Sroberto    can_kmem=no
3218280849Scy    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3219200576Srobertoesac
3220200576Sroberto
3221200576Sroberto
3222200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3223200576Sroberto
3224200576Sroberto# target-dependent defaults
3225200576Sroberto
3226200576Srobertocase "$host" in
3227200576Sroberto i386-sequent-ptx*)
3228200576Sroberto    ans=no
3229200576Sroberto    ;;
3230200576Sroberto i386-unknown-osf1*)
3231200576Sroberto    ans=yes
3232200576Sroberto    ;;
3233200576Sroberto mips-sgi-irix[[456]]*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236200576Sroberto *-fujitsu-uxp*)
3237200576Sroberto    ans=yes
3238200576Sroberto    ;;
3239280849Scy *-ibm-aix[[4-9]]*)
3240280849Scy    # XXX only verified thru AIX6.
3241200576Sroberto    ans=yes
3242200576Sroberto    ;;
3243200576Sroberto *-*-*linux*)
3244200576Sroberto    ans=yes
3245200576Sroberto    ;;
3246200576Sroberto *-*-solaris2.[[01]])
3247200576Sroberto    ans=no
3248200576Sroberto    ;;
3249200576Sroberto *-*-solaris2*)
3250200576Sroberto    ans=yes
3251200576Sroberto    ;;
3252200576Sroberto *-*-unicosmp*)
3253200576Sroberto    ans=yes
3254200576Sroberto    ;;
3255200576Sroberto *) ans=no
3256280849Scy    ;;
3257200576Srobertoesac
3258200576Sroberto
3259200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3260200576Sroberto# override the default
3261280849ScyAC_ARG_ENABLE(
3262280849Scy    [accurate-adjtime],
3263280849Scy    [AS_HELP_STRING(
3264280849Scy	[--enable-accurate-adjtime],
3265280849Scy	[s the adjtime() call is accurate]
3266280849Scy    )],
3267280849Scy    [ans=$enableval]
3268200576Sroberto)
3269200576Sroberto
3270200576SrobertoAC_MSG_RESULT([$ans])
3271200576Sroberto
3272200576Srobertocase "$ans" in
3273280849Scy yes)
3274280849Scy    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3275200576Sroberto    adjtime_is_accurate=yes
3276200576Sroberto    ;;
3277200576Sroberto *)
3278200576Sroberto    adjtime_is_accurate=no
3279280849Scy    ;;
3280181834Srobertoesac
3281181834Sroberto
3282280849ScyAC_CACHE_CHECK(
3283280849Scy    [the name of 'tick' in the kernel],
3284280849Scy    [ntp_cv_nlist_tick],
3285280849Scy    [
3286280849Scy	ans=_tick
3287280849Scy	case "$host" in
3288280849Scy	 m68*-hp-hpux*) # HP9000/300?
3289280849Scy	    ans=_old_tick
3290280849Scy	    ;;
3291280849Scy	 *-apple-aux[[23]]*)
3292280849Scy	    ans=tick
3293280849Scy	    ;;
3294280849Scy	 *-hp-hpux*)
3295280849Scy	    ans=old_tick
3296280849Scy	    ;;
3297280849Scy	 *-ibm-aix[[3-9]]*)
3298280849Scy	    # XXX only verified thru AIX6.
3299280849Scy	    ans=no
3300280849Scy	    ;;
3301280849Scy	 *-*-mpeix*)
3302280849Scy	    ans=no
3303280849Scy	    ;;
3304280849Scy	 *-*-ptx*)
3305280849Scy	    ans=tick
3306280849Scy	    ;;
3307280849Scy	 *-*-sco3.2v[[45]]*)
3308280849Scy	    ans=no
3309280849Scy	    ;;
3310280849Scy	 *-*-solaris2*)
3311280849Scy	    ans=nsec_per_tick
3312280849Scy	    ;;
3313280849Scy	 *-*-sysv4*)
3314280849Scy	    ans=tick
3315280849Scy	    ;;
3316280849Scy	esac
3317280849Scy	ntp_cv_nlist_tick=$ans
3318280849Scy    ]
3319280849Scy)
3320280849Scycase "$ntp_cv_nlist_tick" in
3321280849Scy ''|no)
3322280849Scy    ;;	# HMS: I think we can only get 'no' here...
3323280849Scy *)
3324280849Scy    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3325280849Scy	[What is the name of TICK in the kernel?])
3326181834Srobertoesac
3327280849Scy
3328280849ScyAC_CACHE_CHECK(
3329280849Scy    [for the units of 'tick'],
3330280849Scy    [ntp_cv_tick_nano],
3331280849Scy    [
3332280849Scy	ans=usec
3333280849Scy	case "$host" in
3334280849Scy	 *-*-solaris2*)
3335280849Scy	    ans=nsec
3336280849Scy	    ;;
3337280849Scy	esac
3338280849Scy	ntp_cv_tick_nano=$ans
3339280849Scy    ]
3340280849Scy)
3341280849Scycase "$ntp_cv_tick_nano" in
3342181834Sroberto nsec)
3343280849Scy    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3344181834Srobertoesac
3345280849Scy
3346280849ScyAC_CACHE_CHECK(
3347280849Scy    [the name of 'tickadj' in the kernel],
3348280849Scy    [ntp_cv_nlist_tickadj],
3349280849Scy    [
3350280849Scy	ans=_tickadj
3351280849Scy	case "$host" in
3352280849Scy	 m68*-hp-hpux*) # HP9000/300?
3353280849Scy	    ans=_tickadj
3354280849Scy	    ;;
3355280849Scy	 *-apple-aux[[23]]*)
3356280849Scy	    ans=tickadj
3357280849Scy	    ;;
3358280849Scy	 *-hp-hpux10*)
3359280849Scy	    ans=no
3360280849Scy	    ;;
3361280849Scy	 *-hp-hpux9*)
3362280849Scy	    ans=no
3363280849Scy	    ;;
3364280849Scy	 *-hp-hpux*)
3365280849Scy	    ans=tickadj
3366280849Scy	    ;;
3367280849Scy	 *-*-aix*)
3368280849Scy	    ans=tickadj
3369280849Scy	    ;;
3370280849Scy	 *-*-mpeix*)
3371280849Scy	    ans=no
3372280849Scy	    ;;
3373280849Scy	 *-*-ptx*)
3374280849Scy	    ans=tickadj
3375280849Scy	    ;;
3376280849Scy	 *-*-sco3.2v4*)
3377280849Scy	    ans=no
3378280849Scy	    ;;
3379280849Scy	 *-*-sco3.2v5.0*)
3380280849Scy	    ans=clock_drift
3381280849Scy	    ;;
3382280849Scy	 *-*-solaris2*)
3383280849Scy	    ans=no	# hrestime_adj
3384280849Scy	    ;;
3385280849Scy	 *-*-sysv4*)
3386280849Scy	    ans=tickadj
3387280849Scy	    ;;
3388280849Scy	esac
3389280849Scy	ntp_cv_nlist_tickadj=$ans
3390280849Scy    ]
3391280849Scy)
3392280849Scycase "$ntp_cv_nlist_tickadj" in
3393280849Scy ''|no)
3394280849Scy    ;;	# HMS: I think we can only get 'no' here...
3395280849Scy *)
3396280849Scy    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3397280849Scy	[What is the name of TICKADJ in the kernel?])
3398181834Srobertoesac
3399280849Scy
3400280849ScyAC_CACHE_CHECK(
3401280849Scy    [for the units of 'tickadj'],
3402280849Scy    [ntp_cv_tickadj_nano],
3403280849Scy    [
3404280849Scy	ans=usec
3405280849Scy	case "$host" in
3406280849Scy	 *-*-solaris2*)
3407280849Scy	    ans=nsec
3408280849Scy	    ;;
3409280849Scy	esac
3410280849Scy	ntp_cv_tickadj_nano=$ans
3411280849Scy    ]
3412280849Scy)
3413280849Scycase "$ntp_cv_tickadj_nano" in
3414181834Sroberto nsec)
3415280849Scy    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3416181834Srobertoesac
3417280849Scy
3418280849ScyAC_CACHE_CHECK(
3419280849Scy    [half-heartedly for 'dosynctodr' in the kernel],
3420280849Scy    [ntp_cv_nlist_dosynctodr],
3421280849Scy    [
3422280849Scy	case "$host" in
3423280849Scy	 *-apple-aux[[23]]*)
3424280849Scy	    ans=no
3425280849Scy	    ;;
3426280849Scy	 *-sni-sysv*)
3427280849Scy	    ans=dosynctodr
3428280849Scy	    ;;
3429280849Scy	 *-*-aix*)
3430280849Scy	    ans=dosynctodr
3431280849Scy	    ;;
3432280849Scy	 *-*-hpux*)
3433280849Scy	    ans=no
3434280849Scy	    ;;
3435280849Scy	 *-*-mpeix*)
3436280849Scy	    ans=no
3437280849Scy	    ;;
3438280849Scy	 *-*-nextstep*)
3439280849Scy	    ans=_dosynctodr
3440280849Scy	    ;;
3441280849Scy	 *-*-ptx*)
3442280849Scy	    ans=doresettodr
3443280849Scy	    ;;
3444280849Scy	 *-*-sco3.2v4*)
3445280849Scy	    ans=no
3446280849Scy	    ;;
3447280849Scy	 *-*-sco3.2v5*)
3448280849Scy	    ans=track_rtc
3449280849Scy	    ;;
3450280849Scy	 *-*-solaris2*)
3451280849Scy	    ans=dosynctodr
3452280849Scy	    ;;
3453280849Scy	 *-*-sysv4*)
3454280849Scy	    ans=doresettodr
3455280849Scy	    ;;
3456280849Scy	 *)
3457280849Scy	    ans=_dosynctodr
3458280849Scy	    ;;
3459280849Scy	esac
3460280849Scy	ntp_cv_nlist_dosynctodr=$ans
3461280849Scy    ]
3462280849Scy)
3463280849Scycase "$ntp_cv_nlist_dosynctodr" in
3464280849Scy no)
3465181834Sroberto    ;;
3466181834Sroberto *)
3467280849Scy    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3468280849Scy	[What is (probably) the name of DOSYNCTODR in the kernel?])
3469181834Sroberto    ;;
3470181834Srobertoesac
3471280849Scy
3472280849ScyAC_CACHE_CHECK(
3473280849Scy    [half-heartedly for 'noprintf' in the kernel],
3474280849Scy    [ntp_cv_nlist_noprintf],
3475280849Scy    [
3476280849Scy	case "$host" in
3477280849Scy	 *-apple-aux[[23]]*)
3478280849Scy	    ans=no
3479280849Scy	    ;;
3480280849Scy	 *-sni-sysv*)
3481280849Scy	    ans=noprintf
3482280849Scy	    ;;
3483280849Scy	 *-*-aix*)
3484280849Scy	    ans=noprintf
3485280849Scy	    ;;
3486280849Scy	 *-*-hpux*)
3487280849Scy	    ans=no
3488280849Scy	    ;;
3489280849Scy	 *-*-mpeix*)
3490280849Scy	    ans=no
3491280849Scy	    ;;
3492280849Scy	 *-*-ptx*)
3493280849Scy	    ans=noprintf
3494280849Scy	    ;;
3495280849Scy	 *-*-nextstep*)
3496280849Scy	    ans=_noprintf
3497280849Scy	    ;;
3498280849Scy	 *-*-solaris2*)
3499280849Scy	    ans=noprintf
3500280849Scy	    ;;
3501280849Scy	 *-*-sysv4*)
3502280849Scy	    ans=noprintf
3503280849Scy	    ;;
3504280849Scy	 *)
3505280849Scy	    ans=_noprintf
3506280849Scy	    ;;
3507280849Scy	esac
3508280849Scy	ntp_cv_nlist_noprintf=$ans
3509280849Scy    ]
3510280849Scy)
3511280849Scycase "$ntp_cv_nlist_noprintf" in
3512280849Scy no)
3513181834Sroberto    ;;
3514181834Sroberto *)
3515280849Scy    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3516280849Scy	[What is (probably) the name of NOPRINTF in the kernel?])
3517181834Sroberto    ;;
3518181834Srobertoesac
3519181834Sroberto
3520181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3521181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3522181834Sroberto
3523280849Scydnl	tick		tickadj
3524181834Srobertodnl	10000		80	    Unixware
3525181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3526181834Srobertodnl	10000		150	    sgi IRIX
3527181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3528181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3529181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3530181834Srobertodnl	txc.tick	1	    Linux
3531181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3532181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3533181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3534181834Sroberto
3535181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3536181834Sroberto
3537200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3538200576Sroberto
3539200576Sroberto# target-dependent default for tick
3540200576Sroberto
3541200576Srobertocase "$host" in
3542200576Sroberto *-*-pc-cygwin*)
3543200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3544200576Sroberto    ;;
3545200576Sroberto *-univel-sysv*)
3546200576Sroberto    ans=10000
3547200576Sroberto    ;;
3548200576Sroberto *-*-irix*)
3549200576Sroberto    ans=10000
3550200576Sroberto    ;;
3551200576Sroberto *-*-*linux*)
3552200576Sroberto    ans=txc.tick
3553200576Sroberto    ;;
3554200576Sroberto *-*-mpeix*)
3555200576Sroberto    ans=no
3556200576Sroberto    ;;
3557200576Sroberto *-*-winnt3.5)
3558200576Sroberto    ans='(every / 10)'
3559200576Sroberto    ;;
3560200576Sroberto *-*-unicosmp*)
3561200576Sroberto    ans=10000
3562200576Sroberto    ;;
3563200576Sroberto *)
3564200576Sroberto    ans='1000000L/hz'
3565200576Sroberto    ;;
3566200576Srobertoesac
3567200576Sroberto
3568200576SrobertoAC_ARG_ENABLE(
3569200576Sroberto    [tick],
3570280849Scy    [AS_HELP_STRING(
3571200576Sroberto	[--enable-tick=VALUE],
3572200576Sroberto	[s force a value for 'tick']
3573280849Scy    )],
3574200576Sroberto    [ans=$enableval]
3575200576Sroberto)
3576200576Sroberto
3577200576SrobertoAC_MSG_RESULT([$ans])
3578200576Sroberto
3579200576Srobertocase "$ans" in
3580280849Scy ''|no)
3581280849Scy    ;;	# HMS: I think we can only get 'no' here...
3582280849Scy *)
3583280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3584280849Scy	[Preset a value for 'tick'?])
3585181834Srobertoesac
3586181834Sroberto
3587200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3588200576Sroberto
3589200576Sroberto# target-specific default
3590200576Srobertoans='500/hz'
3591200576Srobertocase "$host" in
3592200576Sroberto *-fujitsu-uxp*)
3593200576Sroberto    case "$adjtime_is_accurate" in
3594200576Sroberto     yes)
3595280849Scy	ans='tick/16'
3596200576Sroberto    esac
3597200576Sroberto    ;;
3598200576Sroberto *-univel-sysv*)
3599200576Sroberto    ans=80
3600200576Sroberto    ;;
3601200576Sroberto *-*-aix*)
3602200576Sroberto    case "$can_kmem" in
3603200576Sroberto     no)
3604200576Sroberto	ans=1000
3605280849Scy	;;
3606200576Sroberto    esac
3607200576Sroberto    ;;
3608200576Sroberto *-*-domainos)	# Skippy: won't be found...
3609200576Sroberto    case "$can_kmem" in
3610200576Sroberto     no)
3611200576Sroberto	ans=668
3612280849Scy	;;
3613200576Sroberto    esac
3614200576Sroberto    ;;
3615200576Sroberto *-*-hpux*)
3616200576Sroberto    case "$adjtime_is_accurate" in
3617200576Sroberto     yes)
3618200576Sroberto	ans='tick/16'
3619280849Scy	;;
3620200576Sroberto    esac
3621200576Sroberto    ;;
3622200576Sroberto *-*-irix*)
3623200576Sroberto    ans=150
3624200576Sroberto    ;;
3625200576Sroberto *-*-mpeix*)
3626200576Sroberto    ans=no
3627200576Sroberto    ;;
3628200576Sroberto *-*-sco3.2v5.0*)
3629200576Sroberto    ans=10000L/hz
3630200576Sroberto    ;;
3631200576Sroberto *-*-winnt3.5)
3632200576Sroberto    ans=50
3633200576Sroberto    ;;
3634200576Sroberto *-*-unicosmp*)
3635200576Sroberto    ans=150
3636280849Scy    ;;
3637200576Srobertoesac
3638200576Sroberto
3639200576SrobertoAC_ARG_ENABLE(
3640200576Sroberto    [tickadj],
3641280849Scy    [AS_HELP_STRING(
3642280849Scy	[--enable-tickadj=VALUE],
3643280849Scy	[s force a value for 'tickadj']
3644280849Scy    )],
3645200576Sroberto    [ans=$enableval]
3646200576Sroberto)
3647200576Sroberto
3648200576SrobertoAC_MSG_RESULT([$ans])
3649200576Sroberto
3650200576Srobertodefault_tickadj=$ans
3651200576Sroberto
3652200576Srobertocase "$default_tickadj" in
3653280849Scy ''|no)
3654280849Scy    ;;	# HMS: I think we can only get 'no' here...
3655280849Scy *)
3656280849Scy    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3657280849Scy	[Preset a value for 'tickadj'?]) ;;
3658181834Srobertoesac
3659181834Sroberto
3660181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3661181834Sroberto# 1/100s (system tick). Sigh ...
3662181834Sroberto# Unfortunately, there is no easy way to know if particular release
3663181834Sroberto# has this "feature" or any obvious way to test for it.
3664181834Srobertocase "$host" in
3665280849Scy mips-sni-sysv4*)
3666280849Scy    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3667280849Scy	[Do we want the ReliantUNIX clock hacks?])
3668181834Srobertoesac
3669181834Sroberto
3670181834Srobertocase "$host" in
3671280849Scy *-*-sco3.2v5*)
3672280849Scy    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3673181834Srobertoesac
3674181834Sroberto
3675280849Scyntp_cv_make_tickadj=yes
3676200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3677181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3678200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3679280849Scy    ntp_cv_make_tickadj=no
3680181834Sroberto    ;;
3681181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3682200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3683280849Scy    ntp_cv_make_tickadj=no
3684181834Sroberto    ;;
3685181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3686200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3687280849Scy    ntp_cv_make_tickadj=no
3688181834Sroberto    ;;
3689181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3690181834Sroberto    ;;
3691181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3692181834Sroberto    ;;
3693181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3694200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3695181834Sroberto    ;;
3696181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3697181834Sroberto    ;;
3698181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3699181834Sroberto    ;;
3700181834Sroberto *)		# Generally bogus.
3701200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3702181834Sroberto    ;;
3703181834Srobertoesac
3704181834Sroberto
3705181834SrobertoAC_SUBST(MAKE_NTPTIME)
3706200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3707181834Sroberto[case "$host" in
3708280849Scy *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3709181834Sroberto     yesyes)
3710181834Sroberto	ans=yes
3711181834Sroberto	;;
3712181834Sroberto     *)
3713181834Sroberto	ans=no
3714181834Sroberto	;;
3715181834Sroberto    esac
3716181834Sroberto    ;;
3717181834Srobertoesac
3718181834Srobertoac_cv_make_ntptime=$ans])
3719181834Srobertocase "$ac_cv_make_ntptime" in
3720181834Sroberto yes)
3721181834Sroberto    MAKE_NTPTIME=ntptime
3722181834Sroberto    ;;
3723280849Scy *)
3724280849Scy    NTPTIME_DB=
3725280849Scy    NTPTIME_DL=
3726280849Scy    NTPTIME_DS=
3727280849Scy    NTPTIME_MS=
3728280849Scy    ;;
3729181834Srobertoesac
3730181834Sroberto
3731280849ScyAC_SUBST([MAKE_TICKADJ])
3732181834Srobertocase "$host" in
3733181834Sroberto mips-sni-sysv4*)
3734181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3735181834Sroberto    # Do not bother
3736280849Scy    ntp_cv_make_tickadj=no
3737181834Sroberto    ;;
3738181834Sroberto *-*-irix*)
3739280849Scy    ntp_cv_make_tickadj=no
3740181834Sroberto    ;;
3741181834Sroberto *-*-solaris2*)
3742181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3743181834Sroberto    case "$host" in
3744181834Sroberto     *-*-solaris2.1[[0-9]]*)
3745280849Scy	ntp_cv_make_tickadj=no
3746181834Sroberto	;;
3747181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3748280849Scy     *) ntp_cv_make_tickadj=no ;;
3749181834Sroberto    esac
3750181834Sroberto    ;;
3751181834Sroberto *-*-unicosmp*)
3752280849Scy    ntp_cv_make_tickadj=no
3753181834Sroberto    ;;
3754181834Srobertoesac
3755200576Sroberto
3756200576Sroberto#
3757200576Sroberto# Despite all the above, we always make tickadj.  Setting
3758280849Scy# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3759200576Sroberto# report that the configuration variable was cached.  It may
3760200576Sroberto# be better to simply remove the hunk above, I did not want
3761200576Sroberto# to remove it if there is hope it will be used again.
3762200576Sroberto#
3763280849ScyAS_UNSET([ntp_cv_make_tickadj])
3764200576Sroberto
3765280849ScyAC_CACHE_CHECK(
3766280849Scy    [if we want and can make the tickadj utility],
3767280849Scy    [ntp_cv_make_tickadj],
3768280849Scy    [ntp_cv_make_tickadj=yes]
3769280849Scy)
3770280849Scycase "$ntp_cv_make_tickadj" in
3771181834Sroberto yes)
3772181834Sroberto    MAKE_TICKADJ=tickadj
3773181834Sroberto    ;;
3774280849Scy *)
3775280849Scy    CALC_TICKADJ_DB=
3776280849Scy    CALC_TICKADJ_DL=
3777280849Scy    CALC_TICKADJ_DS=
3778280849Scy    CALC_TICKADJ_MS=
3779280849Scy    TICKADJ_DB=
3780280849Scy    TICKADJ_DL=
3781280849Scy    TICKADJ_DS=
3782280849Scy    TICKADJ_MS=
3783280849Scy    ;;
3784181834Srobertoesac
3785181834Sroberto
3786280849ScyAC_SUBST([MAKE_TIMETRIM])
3787280849ScyAC_CACHE_CHECK(
3788280849Scy    [if we want and can make the timetrim utility],
3789280849Scy    [ntp_cv_make_timetrim],
3790280849Scy    [
3791280849Scy	case "$host" in
3792280849Scy	 *-*-irix*)
3793280849Scy	    ntp_cv_make_timetrim=yes
3794280849Scy	    ;;
3795280849Scy	 *-*-unicosmp*)
3796280849Scy	    ntp_cv_make_timetrim=yes
3797280849Scy	    ;;
3798280849Scy	 *)
3799280849Scy	    ntp_cv_make_timetrim=no
3800280849Scy	    ;;
3801280849Scy	esac
3802280849Scy    ]
3803280849Scy)
3804280849Scycase "$ntp_cv_make_timetrim" in
3805181834Sroberto yes)
3806181834Sroberto    MAKE_TIMETRIM=timetrim
3807181834Sroberto    ;;
3808280849Scy *) TIMETRIM_DB=
3809280849Scy    TIMETRIM_DL=
3810280849Scy    TIMETRIM_DS=
3811280849Scy    TIMETRIM_MS=
3812280849Scy    ;;
3813181834Srobertoesac
3814181834Sroberto
3815280849ScyAC_SUBST([MAKE_LIBNTPSIM])
3816280849ScyAC_SUBST([MAKE_NTPDSIM])
3817200576Sroberto
3818200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3819200576SrobertoAC_ARG_ENABLE(
3820200576Sroberto    [simulator],
3821280849Scy    [AS_HELP_STRING(
3822200576Sroberto	[--enable-simulator],
3823200576Sroberto	[- build/install the NTPD simulator?]
3824280849Scy    )],
3825280849Scy    [ans=$enableval],
3826200576Sroberto    [ans=no]
3827200576Sroberto)
3828200576SrobertoAC_MSG_RESULT([$ans])
3829200576Srobertocase "$ans" in
3830181834Sroberto yes)
3831181834Sroberto    MAKE_NTPDSIM=ntpdsim
3832181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3833181834Sroberto    ;;
3834280849Scy *)
3835280849Scy    NTPDSIM_DB=
3836280849Scy    NTPDSIM_DL=
3837280849Scy    NTPDSIM_DS=
3838280849Scy    NTPDSIM_MS=
3839280849Scy    ;;
3840181834Srobertoesac
3841181834Sroberto
3842181834Srobertocase "$build" in
3843181834Sroberto $host)
3844181834Sroberto    ;;
3845181834Sroberto *) case "$host" in
3846181834Sroberto     *-*-vxworks*)
3847200576Sroberto	LDFLAGS="$LDFLAGS -r"
3848200576Sroberto	;;
3849181834Sroberto    esac
3850181834Sroberto    ;;
3851181834Srobertoesac
3852181834Sroberto
3853280849ScyNTP_WITHSNTP
3854200576Sroberto
3855280849ScyAC_MSG_CHECKING([if we want to build ntpsnmpd])
3856280849ScyAC_ARG_WITH(
3857280849Scy    [ntpsnmpd],
3858280849Scy    [AS_HELP_STRING(
3859280849Scy	[--with-ntpsnmpd],
3860280849Scy	[s Build ntpsnmpd MIB agent?]
3861280849Scy    )],
3862280849Scy    [ans=$withval],
3863280849Scy    [
3864280849Scy	case "$PATH_NET_SNMP_CONFIG" in
3865280849Scy	 /*)	ans=yes ;;
3866280849Scy	 *)	ans=no  ;;
3867280849Scy	esac
3868280849Scy    ]
3869280849Scy)
3870280849ScyAC_MSG_RESULT([$ans])
3871280849Scycase "$ans" in
3872280849Scy yes)
3873280849Scy    case "$PATH_NET_SNMP_CONFIG" in
3874280849Scy     /*)
3875280849Scy	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3876280849Scy	AC_SUBST([SNMP_LIBS])
3877280849Scy	# HMS: we really want to separate CPPFLAGS and CFLAGS
3878280849Scy	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3879280849Scy	SNMP_CPPFLAGS=
3880280849Scy	SNMP_CFLAGS=
3881280849Scy	for i in $foo; do
3882280849Scy	    case "$i" in
3883280849Scy	     -D*|-U*|-I*)
3884280849Scy		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3885280849Scy		;;
3886280849Scy	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3887280849Scy		;;
3888280849Scy	    esac
3889280849Scy	done
3890280849Scy	AC_SUBST([SNMP_CPPFLAGS])
3891280849Scy	AC_SUBST([SNMP_CFLAGS])
3892280849Scy
3893280849Scy	save_CFLAGS=$CFLAGS
3894280849Scy	save_CPPFLAGS=$CPPFLAGS
3895280849Scy	save_LIBS=$LIBS
3896280849Scy	CFLAGS=$SNMP_CFLAGS
3897280849Scy	CPPFLAGS=$SNMP_CPPFLAGS
3898280849Scy
3899280849Scy	AC_CHECK_HEADER(
3900280849Scy	    [net-snmp/net-snmp-config.h],
3901280849Scy	    [MAKE_NTPSNMPD=ntpsnmpd],
3902280849Scy	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3903280849Scy	)
3904280849Scy
3905280849Scy	# Do this last, as we're messing up LIBS.
3906280849Scy	# check -lnetsnmp for netsnmp_daemonize
3907280849Scy	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3908280849Scy	AC_CHECK_LIB(
3909280849Scy	    [netsnmp],
3910280849Scy	    [netsnmp_daemonize],
3911280849Scy	    [ans=yes],
3912280849Scy	    [ans=no]
3913280849Scy	)
3914280849Scy	case "$ans" in
3915280849Scy	 no)
3916280849Scy	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3917280849Scy		[We need to provide netsnmp_daemonize()])
3918280849Scy	esac
3919280849Scy	
3920280849Scy	CFLAGS=$save_CFLAGS
3921280849Scy	AS_UNSET([save_CFLAGS])
3922280849Scy	CPPFLAGS=$save_CPPFLAGS
3923280849Scy	AS_UNSET([save_CPPFLAGS])
3924280849Scy	LIBS=$save_LIBS
3925280849Scy	AS_UNSET([save_LIBS])
3926280849Scy	;;
3927280849Scy     *) 
3928280849Scy	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3929280849Scy	;;
3930280849Scy    esac
3931280849Scy    ;;
3932280849Scyesac
3933280849ScyAC_SUBST([MAKE_NTPSNMPD])
3934280849Scy
3935280849Scycase "$MAKE_NTPSNMPD" in
3936280849Scy '')
3937280849Scy    NTPSNMPD_DB=
3938280849Scy    NTPSNMPD_DL=
3939280849Scy    NTPSNMPD_DS=
3940280849Scy    NTPSNMPD_MS=
3941280849Scy    ;;
3942280849Scyesac
3943280849Scy
3944200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3945200576Sroberto
3946200576Sroberto# target-specific defaults
3947200576Sroberto
3948200576Srobertocase "$host" in
3949200576Sroberto *-apple-aux[[23]]*)
3950200576Sroberto    ans=yes
3951200576Sroberto    ;;
3952200576Sroberto *-*-bsdi[[012]]*)
3953200576Sroberto    ans=no
3954200576Sroberto    ;;
3955200576Sroberto *-*-bsdi*)
3956200576Sroberto    ans=yes
3957200576Sroberto    ;;
3958200576Sroberto *-*-openvms*)	# HMS: won't be found
3959200576Sroberto    ans=yes
3960200576Sroberto    ;;
3961200576Sroberto *) ans=no
3962200576Sroberto    ;;
3963200576Srobertoesac
3964200576Sroberto
3965200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3966200576Sroberto
3967200576SrobertoAC_ARG_ENABLE(
3968200576Sroberto    [slew-always],
3969280849Scy    [AS_HELP_STRING(
3970200576Sroberto	[--enable-slew-always],
3971200576Sroberto	[s always slew the time]
3972280849Scy    )],
3973200576Sroberto    [ans=$enableval]
3974200576Sroberto)
3975200576Sroberto
3976200576SrobertoAC_MSG_RESULT([$ans])
3977200576Sroberto
3978200576Srobertocase "$ans" in
3979280849Scy yes)
3980280849Scy    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3981181834Srobertoesac
3982181834Sroberto
3983200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3984200576Sroberto
3985200576Srobertocase "$host" in
3986200576Sroberto *-sni-sysv*)
3987200576Sroberto    ans=yes
3988200576Sroberto    ;;
3989200576Sroberto *-univel-sysv*)
3990200576Sroberto    ans=no
3991200576Sroberto    ;;
3992200576Sroberto *-*-ptx*)
3993200576Sroberto    ans=yes
3994200576Sroberto    ;;
3995200576Sroberto *-*-solaris2.1[[0-9]]*)
3996200576Sroberto    ans=no
3997200576Sroberto    ;;
3998200576Sroberto *-*-solaris2.[[012]]*)
3999200576Sroberto    ans=yes
4000200576Sroberto    ;;
4001200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4002200576Sroberto    ans=yes
4003200576Sroberto    ;;
4004200576Sroberto *) ans=no
4005200576Sroberto    ;;
4006200576Srobertoesac
4007200576Sroberto
4008200576SrobertoAC_ARG_ENABLE(
4009200576Sroberto    [step-slew],
4010280849Scy    [AS_HELP_STRING(
4011200576Sroberto	[--enable-step-slew],
4012200576Sroberto	[s step and slew the time]
4013280849Scy    )],
4014200576Sroberto    [ans=$enableval]
4015200576Sroberto)
4016200576Sroberto
4017200576SrobertoAC_MSG_RESULT([$ans])
4018200576Sroberto
4019200576Srobertocase "$ans" in
4020280849Scy yes)
4021280849Scy    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4022181834Srobertoesac
4023181834Sroberto
4024200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4025200576Sroberto
4026200576Srobertocase "$host" in
4027200576Sroberto *-apple-aux[[23]]*)
4028200576Sroberto    ans=yes
4029200576Sroberto    ;;
4030200576Sroberto *) ans=no
4031280849Scy    ;;
4032200576Srobertoesac
4033200576Sroberto
4034200576SrobertoAC_ARG_ENABLE(
4035200576Sroberto    [ntpdate-step],
4036280849Scy    [AS_HELP_STRING(
4037200576Sroberto	[--enable-ntpdate-step],
4038200576Sroberto	[s if ntpdate should step the time]
4039280849Scy    )],
4040200576Sroberto    [ans=$enableval]
4041200576Sroberto)
4042200576Sroberto
4043200576SrobertoAC_MSG_RESULT([$ans])
4044200576Sroberto
4045200576Srobertocase "$ans" in
4046280849Scy yes)
4047280849Scy    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4048280849Scy	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4049181834Srobertoesac
4050181834Sroberto
4051200576Sroberto
4052200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4053200576Sroberto
4054200576Srobertocase "$host" in
4055200576Sroberto *-*-nextstep*)
4056200576Sroberto    ans=yes
4057200576Sroberto    ;;
4058200576Sroberto *-*-openvms*)	# HMS: won't be found
4059200576Sroberto    ans=yes
4060200576Sroberto    ;;
4061200576Sroberto *)
4062200576Sroberto    ans=no
4063280849Scy    ;;
4064200576Srobertoesac
4065200576Sroberto
4066200576SrobertoAC_ARG_ENABLE(
4067200576Sroberto    [hourly-todr-sync],
4068280849Scy    [AS_HELP_STRING(
4069200576Sroberto	[--enable-hourly-todr-sync],
4070200576Sroberto	[s if we should sync TODR hourly]
4071280849Scy    )],
4072200576Sroberto    [ans=$enableval]
4073200576Sroberto)
4074200576Sroberto
4075200576SrobertoAC_MSG_RESULT([$ans])
4076200576Sroberto
4077181834Srobertocase "$ac_cv_var_sync_todr" in
4078280849Scy yes)
4079280849Scy    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4080181834Srobertoesac
4081181834Sroberto
4082181834Sroberto
4083200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4084200576Sroberto
4085200576Srobertocase "$host" in
4086200576Sroberto *-*-solaris2.6)
4087200576Sroberto    unamev=`uname -v`
4088200576Sroberto    case "$unamev" in
4089200576Sroberto     Generic_105181-*)
4090200576Sroberto	old_IFS="$IFS"
4091200576Sroberto	IFS="-"
4092200576Sroberto	set $unamev
4093200576Sroberto	IFS="$old_IFS"
4094200576Sroberto	if test "$2" -ge 17
4095200576Sroberto	then
4096200576Sroberto	    # Generic_105181-17 and higher
4097200576Sroberto	    ans=no
4098200576Sroberto	else
4099200576Sroberto	    ans=yes
4100200576Sroberto	fi
4101200576Sroberto	;;
4102280849Scy     *)
4103181834Sroberto	ans=yes
4104280849Scy	;;
4105200576Sroberto    esac
4106200576Sroberto    ;;
4107200576Sroberto *-*-solaris2.7)
4108200576Sroberto    unamev=`uname -v`
4109200576Sroberto    case "$unamev" in
4110200576Sroberto     Generic_106541-*)
4111200576Sroberto	old_IFS="$IFS"
4112200576Sroberto	IFS="-"
4113200576Sroberto	set $unamev
4114200576Sroberto	IFS="$old_IFS"
4115200576Sroberto	if test "$2" -ge 07
4116200576Sroberto	then
4117200576Sroberto	    # Generic_106541-07 and higher
4118200576Sroberto	    ans=no
4119200576Sroberto	else
4120200576Sroberto	    ans=yes
4121200576Sroberto	fi
4122181834Sroberto	;;
4123200576Sroberto     *)
4124181834Sroberto	ans=yes
4125280849Scy	;;
4126181834Sroberto    esac
4127200576Sroberto    ;;
4128200576Sroberto *)
4129200576Sroberto    ans=no
4130280849Scy    ;;
4131200576Srobertoesac
4132200576Sroberto
4133200576SrobertoAC_ARG_ENABLE(
4134200576Sroberto    [kernel-fll-bug],
4135280849Scy    [AS_HELP_STRING(
4136200576Sroberto	[--enable-kernel-fll-bug],
4137200576Sroberto	[s if we should avoid a kernel FLL bug]
4138280849Scy    )],
4139200576Sroberto    [ans=$enableval]
4140200576Sroberto)
4141200576Sroberto
4142200576SrobertoAC_MSG_RESULT([$ans])
4143200576Sroberto
4144200576Srobertocase "$ans" in
4145280849Scy yes)
4146280849Scy    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4147200576Srobertoesac
4148200576Sroberto
4149200576Sroberto
4150280849ScyAC_MSG_CHECKING([if we want new session key behavior])
4151280849ScyAC_ARG_ENABLE(
4152280849Scy    [bug1243-fix],
4153280849Scy    [AS_HELP_STRING(
4154280849Scy	[--enable-bug1243-fix],
4155280849Scy	[+ use unmodified autokey session keys]
4156280849Scy    )],
4157280849Scy    [ans=$enableval],
4158280849Scy    [ans=yes]
4159280849Scy)
4160280849ScyAC_MSG_RESULT([$ans])
4161280849Scycase "$ans" in
4162280849Scy no)
4163280849Scy    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4164280849Scy	[use old autokey session key behavior?])
4165280849Scyesac
4166280849Scy
4167280849Scy
4168200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4169200576Sroberto
4170200576Srobertocase "$host" in
4171200576Sroberto *-*-solaris2.[[89]])
4172200576Sroberto    ans=yes
4173200576Sroberto    ;;
4174200576Sroberto *-*-solaris2.1[[0-9]]*)
4175200576Sroberto    ans=yes
4176200576Sroberto    ;;
4177200576Sroberto *) ans=no
4178280849Scy    ;;
4179200576Srobertoesac
4180200576Sroberto
4181200576SrobertoAC_ARG_ENABLE(
4182280849Scy    [irig-sawtooth],
4183280849Scy    [AS_HELP_STRING(
4184200576Sroberto	[--enable-irig-sawtooth],
4185200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4186280849Scy    )],
4187200576Sroberto    [ans=$enableval]
4188200576Sroberto)
4189200576Sroberto
4190200576SrobertoAC_MSG_RESULT([$ans])
4191200576Sroberto
4192200576Srobertocase "$ans" in
4193280849Scy yes)
4194280849Scy    AC_DEFINE([IRIG_SUCKS], [1],
4195280849Scy	[Should we use the IRIG sawtooth filter?])
4196181834Srobertoesac
4197181834Sroberto
4198200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4199200576SrobertoAC_ARG_ENABLE(
4200280849Scy	[nist],
4201280849Scy	[AS_HELP_STRING(
4202200576Sroberto	    [--enable-nist],
4203200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4204280849Scy	)],
4205200576Sroberto	[ans=$enableval],
4206200576Sroberto	[ans=no]
4207200576Sroberto)
4208200576Sroberto
4209200576SrobertoAC_MSG_RESULT([$ans])
4210200576Sroberto
4211200576Srobertocase "$ans" in
4212280849Scy yes)
4213280849Scy    AC_DEFINE([LOCKCLOCK], [1],
4214280849Scy	[Should we align with the NIST lockclock scheme?]) ;;
4215181834Srobertoesac
4216181834Sroberto
4217200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4218200576SrobertoAC_ARG_ENABLE(
4219200576Sroberto    [ntp-signd],
4220280849Scy    [AS_HELP_STRING(
4221280849Scy	[--enable-ntp-signd],
4222280849Scy	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4223280849Scy    )],
4224200576Sroberto    [ans=$enableval],
4225200576Sroberto    [ans=no]
4226200576Sroberto)
4227200576Sroberto
4228200576SrobertoAC_MSG_RESULT([$ans])
4229200576Sroberto
4230200576Srobertocase "$ans" in
4231200576Sroberto no)
4232200576Sroberto    ntp_signd_path=
4233200576Sroberto    ;;
4234200576Sroberto yes)
4235200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4236200576Sroberto    ;;
4237200576Sroberto *)
4238200576Sroberto    ntp_signd_path="$ans"
4239200576Srobertoesac
4240200576Sroberto
4241200576Srobertocase "$ntp_signd_path" in
4242200576Sroberto '')
4243200576Sroberto    ;;
4244200576Sroberto *)
4245280849Scy    AC_DEFINE([HAVE_NTP_SIGND], [1],
4246280849Scy	[Do we want support for Samba's signing daemon?])
4247280849Scy    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4248280849Scy	[Path to sign daemon rendezvous socket])
4249200576Sroberto    ;;
4250200576Srobertoesac
4251200576Sroberto
4252200576SrobertoAC_CHECK_HEADERS([libscf.h])
4253280849ScyLSCF=
4254200576Srobertocase "$ac_cv_header_libscf_h" in
4255200576Sroberto yes)
4256280849Scy    LSCF='-lscf'
4257200576Srobertoesac
4258280849ScyAC_SUBST([LSCF])
4259200576Sroberto
4260280849ScyNTP_IPV6
4261200576Sroberto
4262200576Sroberto
4263181834Sroberto#
4264181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4265181834Sroberto#
4266200576SrobertoAC_CACHE_CHECK(
4267200576Sroberto    [for interface list sysctl],
4268280849Scy    [ntp_cv_iflist_sysctl],
4269280849Scy    [AC_PREPROC_IFELSE(
4270282408Scy	[AC_LANG_SOURCE([
4271200576Sroberto	    #include <sys/param.h>
4272200576Sroberto	    #include <sys/sysctl.h>
4273200576Sroberto	    #include <sys/socket.h>
4274280849Scy	    #ifndef NET_RT_IFLIST
4275280849Scy	    # error
4276200576Sroberto	    #endif
4277282408Scy	])],
4278280849Scy	[ntp_cv_iflist_sysctl=yes],
4279280849Scy	[ntp_cv_iflist_sysctl=no]
4280280849Scy    )]
4281200576Sroberto)
4282280849Scycase "$ntp_cv_iflist_sysctl" in
4283280849Scy yes)
4284280849Scy    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4285280849Scyesac
4286181834Sroberto
4287280849Scy###
4288280849Scy
4289280849ScyAC_MSG_CHECKING([if we want the saveconfig mechanism])
4290280849ScyAC_ARG_ENABLE(
4291280849Scy    [saveconfig],
4292280849Scy    [AS_HELP_STRING(
4293280849Scy	[--enable-saveconfig],
4294280849Scy	[+ saveconfig mechanism]
4295280849Scy    )],
4296280849Scy    [ntp_ok=$enableval],
4297280849Scy    [ntp_ok=yes]
4298280849Scy)
4299280849Scyntp_saveconfig_enabled=0
4300280849Scycase "$ntp_ok" in
4301200576Sroberto yes)
4302280849Scy    ntp_saveconfig_enabled=1
4303280849Scy    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4304280849Scy    ;;
4305200576Srobertoesac
4306280849ScyAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4307280849ScyAC_MSG_RESULT([$ntp_ok])
4308200576Sroberto
4309280849Scydnl  gtest is needed for our tests subdirs. It would be nice if we could
4310280849Scydnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4311280849Scydnl  can't be conditionalized.
4312280849ScyNTP_GOOGLETEST
4313200576Sroberto
4314181834Sroberto###
4315181834Sroberto
4316280849ScyAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4317280849Scy    [Default location of crypto key info])
4318181834Sroberto
4319280849ScyAC_CONFIG_FILES([Makefile])
4320280849ScyAC_CONFIG_FILES([adjtimed/Makefile])
4321280849ScyAC_CONFIG_FILES([clockstuff/Makefile])
4322280849ScyAC_CONFIG_FILES([include/Makefile])
4323280849ScyAC_CONFIG_FILES([include/isc/Makefile])
4324280849ScyAC_CONFIG_FILES([kernel/Makefile])
4325280849ScyAC_CONFIG_FILES([kernel/sys/Makefile])
4326280849ScyAC_CONFIG_FILES([libntp/Makefile])
4327280849ScyAC_CONFIG_FILES([libparse/Makefile])
4328280849ScyAC_CONFIG_FILES([ntpd/Makefile])
4329280849ScyAC_CONFIG_FILES([ntpd/complete.conf],	[sed -e '/^rlimit$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf])
4330280849ScyAC_CONFIG_FILES([ntpdate/Makefile])
4331280849ScyAC_CONFIG_FILES([ntpdc/Makefile])
4332280849ScyAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4333280849ScyAC_CONFIG_FILES([ntpq/Makefile])
4334280849ScyAC_CONFIG_FILES([ntpsnmpd/Makefile])
4335280849ScyAC_CONFIG_FILES([parseutil/Makefile])
4336280849ScyAC_CONFIG_FILES([scripts/Makefile])
4337282408ScyAC_CONFIG_FILES([scripts/build/Makefile])
4338282408ScyAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4339282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4340282408ScyAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4341280849ScyAC_CONFIG_FILES([scripts/lib/Makefile])
4342282408ScyAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4343280849ScyAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4344282408ScyAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4345280849ScyAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4346282408ScyAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4347280849ScyAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4348280849ScyAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4349280849ScyAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4350280849ScyAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4351282408ScyAC_CONFIG_FILES([scripts/update-leap/Makefile])
4352280849ScyAC_CONFIG_FILES([tests/Makefile])
4353280849ScyAC_CONFIG_FILES([tests/libntp/Makefile])
4354280849ScyAC_CONFIG_FILES([tests/ntpd/Makefile])
4355280849ScyAC_CONFIG_FILES([util/Makefile])
4356181834Sroberto
4357280849Scyperllibdir="${datadir}/ntp/lib"
4358280849ScyAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4359181834Sroberto
4360280849Scycalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4361280849ScyAC_SUBST_FILE([calc_tickadj_opts])
4362280849Scyntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4363280849ScyAC_SUBST_FILE([ntp_wait_opts])
4364280849Scyntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4365280849ScyAC_SUBST_FILE([ntpsweep_opts])
4366280849Scyntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4367280849ScyAC_SUBST_FILE([ntptrace_opts])
4368280849Scysummary_opts="$srcdir/scripts/summary-opts"
4369280849ScyAC_SUBST_FILE([summary_opts])
4370280849Scyplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4371280849ScyAC_SUBST_FILE([plot_summary_opts])
4372280849Scy
4373280849ScyAC_CONFIG_SUBDIRS([sntp])
4374280849Scy
4375181834SrobertoAC_OUTPUT
4376