1290000Sglebiusdnl NTP top-level configure.ac				-*- Autoconf -*-
2290000Sglebiusdnl
3290000Sglebiusm4_include([sntp/m4/version.m4])
4290000SglebiusAC_PREREQ([2.61])
5290000SglebiusAC_INIT(
6290000Sglebius    [ntp],
7290000Sglebius    [VERSION_NUMBER],
8290000Sglebius    [http://bugs.ntp.org./],
9290000Sglebius    [],
10290000Sglebius    [http://www.ntp.org./]dnl
11290000Sglebius)
12290000SglebiusAC_CONFIG_MACRO_DIR([sntp/m4])
13290000SglebiusAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14290000SglebiusAC_LANG([C])
15290000Sglebius
16290000SglebiusAC_PRESERVE_HELP_ORDER
17290000Sglebius
18290000Sglebius# Bump ntp_configure_cache_version for each change to configure.ac or
19290000Sglebius# .m4 files which invalidates cached values from previous configure 
20290000Sglebius# runs.
21290000Sglebius#
22290000Sglebius# If the change affects cache variables used only by the main NTP
23290000Sglebius# configure.ac, then only its version number should be bumped, while
24290000Sglebius# the subdir configure.ac version numbers should be unchanged.  The
25290000Sglebius# same is true for a test/variable that is used only by one subdir
26290000Sglebius# being changed incompatibly; only that subdir's cache version needs
27290000Sglebius# bumping.
28290000Sglebius#
29290000Sglebius# If a change affects variables shared by all NTP configure scripts,
30290000Sglebius# please bump the version numbers of each.  If you are not sure, the
31290000Sglebius# safe choice is to bump all on any cache-invalidating change.
32290000Sglebius#
33290000Sglebius# In order to avoid the risk of version stamp collision between -stable
34290000Sglebius# and -dev branches, do not simply increment the version, instead use
35290000Sglebius# the date YYYYMMDD optionally with -HHMM if there is more than one
36290000Sglebius# bump in a day.
37290000Sglebius
38290000Sglebiusntp_configure_cache_version=20120806
39290000Sglebius
40290000Sglebius# When the cache version of config.cache and configure do not
41290000Sglebius# match, NTP_CACHEVERSION will flush the cache.
42290000Sglebius
43290000SglebiusNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44290000Sglebius
45290000SglebiusAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
46290000Sglebius
47290000Sglebiusdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48290000Sglebiusm4_ifdef(
49290000Sglebius    [AM_SILENT_RULES],
50290000Sglebius    [AM_SILENT_RULES([yes])]
51290000Sglebius)
52290000SglebiusAC_CANONICAL_BUILD
53181834SrobertoAC_CANONICAL_HOST
54181834Srobertodnl the 'build' machine is where we run configure and compile
55181834Srobertodnl the 'host' machine is where the resulting stuff runs.
56290000SglebiusAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57290000Sglebius    [canonical system (cpu-vendor-os) of where we should run])
58290000SglebiusAC_CONFIG_HEADERS([config.h])
59181834Srobertodnl AC_ARG_PROGRAM
60181834Sroberto
61290000Sglebiusntp_atom_ok=${ntp_atom_ok=no}
62290000Sglebiusntp_oncore_ok=${ntp_oncore_ok=no}
63290000Sglebiusntp_parse_ok=${ntp_parse_ok=no}
64290000Sglebiusntp_ripe_ncc_ok=${ntp_parse_ok=no}
65290000Sglebiusntp_jupiter_ok=${ntp_jupiter_ok=no}
66181834Sroberto
67290000SglebiusNTP_PROG_CC
68290000SglebiusAC_PROG_CPP
69290000Sglebius# Do we need CXX for anything besides google test?
70290000SglebiusAC_PROG_CXX
71290000SglebiusAC_PROG_YACC
72290000SglebiusAC_PROG_CC_C_O
73290000SglebiusAX_C99_STRUCT_INIT
74181834Sroberto
75290000SglebiusNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
76181834Sroberto
77290000SglebiusNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
78290000Sglebius
79290000Sglebiusdnl AM_PROG_AR req. automake 1.12
80290000Sglebiusm4_ifdef(
81290000Sglebius    [AM_PROG_AR],
82290000Sglebius    [AM_PROG_AR]
83290000Sglebius)
84290000Sglebius
85200576Sroberto# So far, the only shared library we might use is libopts.
86200576Sroberto# It's a small library - we might as well use a static version of it.
87200576SrobertoAC_DISABLE_SHARED
88290000SglebiusAC_PROG_LIBTOOL
89290000SglebiusAC_SUBST([LIBTOOL_DEPS])
90200576Sroberto
91290000Sglebius# NTP has (so far) been relying on leading-edge autogen, which
92290000Sglebius# means we need the appropriate corresponding libopts as well.
93181834Sroberto# Therefore, by default:
94290000Sglebius# - use the version of libopts we ship with
95181834Sroberto# - do not install it
96181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
97181834Srobertocase "${enable_local_libopts+set}" in
98181834Sroberto set) ;;
99181834Sroberto *) enable_local_libopts=yes ;;
100181834Srobertoesac
101181834Srobertocase "${enable_libopts_install+set}" in
102181834Sroberto set) ;;
103181834Sroberto *) enable_libopts_install=no ;;
104181834Srobertoesac
105290000Sglebiusenable_nls=no
106290000SglebiusLIBOPTS_CHECK_NOBUILD([sntp/libopts])
107181834Sroberto
108290000SglebiusNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
109181834Sroberto
110290000SglebiusNTP_LIBNTP
111181834Sroberto
112290000SglebiusAC_MSG_CHECKING([for deprecated --with-arlib])
113290000SglebiusAC_ARG_WITH([arlib],
114290000Sglebius	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
115181834Sroberto	[ans=$withval], [ans=no])
116200576SrobertoAC_MSG_RESULT([$ans])
117181834Sroberto
118181834Srobertocase "$ans" in
119181834Sroberto yes)
120290000Sglebius    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
121181834Sroberto    ;;
122181834Srobertoesac
123181834Sroberto
124181834Srobertodnl  we need to check for cross compile tools for vxWorks here
125181834SrobertoAC_PROG_AWK
126290000SglebiusAS_UNSET([ac_cv_prog_AWK])
127290000SglebiusAC_SUBST([AWK])				dnl scripts/ntpver.in
128181834SrobertoAC_PROG_MAKE_SET
129181834Sroberto
130290000SglebiusAC_SUBST([CFLAGS])
131290000SglebiusAC_SUBST([LDFLAGS])
132181834Sroberto
133290000SglebiusAC_PROG_LN_S
134290000SglebiusAC_ISC_POSIX
135181834Sroberto
136181834Sroberto
137290000SglebiusAC_PATH_PROG([PATH_PERL], [perl])
138290000Sglebiusdnl  Saving cached hardcoded paths rather than searching $PATH during a
139290000Sglebiusdnl  cached configure run is an optimization not worth the the cost of
140290000Sglebiusdnl  preventing newly-installed tools from being found.  Short-circuit
141290000Sglebiusdnl  the caching after the tests so preset overrides still work.
142290000SglebiusAS_UNSET([ac_cv_path_PATH_PERL])
143290000SglebiusAC_PATH_PROG([PATH_TEST], [test])
144290000SglebiusAS_UNSET([ac_cv_path_PATH_TEST])
145290000Sglebiustest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
146290000SglebiusAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
147181834Sroberto
148290000SglebiusAC_ARG_WITH(
149290000Sglebius    [net-snmp-config],
150290000Sglebius    [AS_HELP_STRING(
151290000Sglebius	[--with-net-snmp-config],
152290000Sglebius	[+ =net-snmp-config]
153290000Sglebius    )],
154290000Sglebius    [ans=$withval],
155290000Sglebius    [ans=yes]
156290000Sglebius)
157290000Sglebiuscase "$ans" in
158290000Sglebius no)
159181834Sroberto    ;;
160290000Sglebius yes)
161290000Sglebius    ans=net-snmp-config
162181834Sroberto    ;;
163290000Sglebius /*)
164181834Sroberto    ;;
165290000Sglebius */*)
166290000Sglebius    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
167181834Sroberto    ;;
168290000Sglebius *)
169290000Sglebius    ;;
170181834Srobertoesac
171290000SglebiusPROG_NET_SNMP_CONFIG=$ans
172290000SglebiusAC_MSG_CHECKING([for net-snmp-config path])
173290000Sglebiuscase "$PROG_NET_SNMP_CONFIG" in
174290000Sglebius no) ;;
175290000Sglebius /*)
176290000Sglebius    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
177290000Sglebius    ;;
178290000Sglebius *)
179290000Sglebius    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
180290000Sglebius    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
181290000Sglebius;;
182290000Sglebiusesac
183290000SglebiusAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
184181834Sroberto
185290000Sglebiuscase "$PATH_NET_SNMP_CONFIG" in
186290000Sglebius /*)	AC_CACHE_CHECK(
187290000Sglebius	    [for net-snmp version],
188290000Sglebius	    [ntp_cv_net_snmp_version],
189290000Sglebius	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
190290000Sglebius	)
191181834Sroberto	;;
192181834Srobertoesac
193181834Sroberto
194181834Srobertocase "$host" in
195181834Sroberto *-*-vxworks*)
196181834Sroberto    ac_link="$ac_link $VX_KERNEL"
197181834Sroberto    ;;
198181834Srobertoesac
199181834Sroberto
200290000Sglebius# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
201290000SglebiusAC_SEARCH_LIBS([openlog], [gen syslog])
202290000Sglebius# XXX library list will be in ac_cv_search_openlog
203181834Sroberto
204290000Sglebius# LIBSECCOMP is off by default -- needs testing with all the features
205290000Sglebius# Please send bug reports to loganaden@gmail.com
206290000SglebiusAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
207290000SglebiusAC_ARG_ENABLE(
208290000Sglebius    [libseccomp],
209290000Sglebius    [AS_HELP_STRING(
210290000Sglebius	[--enable-libseccomp],
211290000Sglebius	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
212290000Sglebius    )],
213290000Sglebius    [ntp_ok=$enableval],
214290000Sglebius    [ntp_ok=no]
215290000Sglebius)
216290000SglebiusAC_MSG_RESULT([$ntp_ok])
217290000Sglebiuscase "$ntp_ok" in
218290000Sglebius yes)
219290000Sglebius    AC_SEARCH_LIBS(
220290000Sglebius	[seccomp_init],
221290000Sglebius	[seccomp],
222290000Sglebius	[AC_DEFINE([LIBSECCOMP], [1],
223290000Sglebius	    [Define to any value to include libseccomp sandboxing.])]
224290000Sglebius    )
225290000Sglebius    AC_TRY_RUN([
226290000Sglebius	#include <stdio.h>
227290000Sglebius	#include <stdlib.h>
228290000Sglebius	#include <errno.h>
229290000Sglebius	#include <sys/prctl.h>
230290000Sglebius	#include <linux/seccomp.h>
231290000Sglebius
232290000Sglebius	int main(void)
233290000Sglebius	{
234290000Sglebius		int ret;
235290000Sglebius		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
236290000Sglebius		if (ret < 0) {
237290000Sglebius			switch (errno) {
238290000Sglebius			case ENOSYS:
239290000Sglebius				return 1;
240290000Sglebius			case EINVAL:
241290000Sglebius				return 1;
242290000Sglebius			default:
243290000Sglebius				return 1;
244290000Sglebius			}
245290000Sglebius		}
246290000Sglebius		ret = 
247290000Sglebius		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
248290000Sglebius		if (ret < 0) {
249290000Sglebius			switch (errno) {
250290000Sglebius			case EINVAL:
251290000Sglebius				return 1;
252290000Sglebius			case EFAULT:
253290000Sglebius				return 0;
254290000Sglebius			default:
255290000Sglebius				return 1;
256290000Sglebius		}
257290000Sglebius	}
258290000Sglebiusreturn 1;
259290000Sglebius}
260290000Sglebius]
261290000Sglebius, AC_DEFINE([KERN_SECCOMP], 1, 
262290000Sglebius[Define to use libseccomp system call filtering.])   
263290000Sglebius, []
264290000Sglebius)
265181834Sroberto    ;;
266181834Srobertoesac
267181834Sroberto
268290000SglebiusNTP_FACILITYNAMES
269200576Sroberto
270181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
271181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
272181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
273181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
274181834Srobertodnl real-time library, so we don't want to use it.
275290000Sglebiusdnl
276290000Sglebiusdnl 081118 Harlan got tired of looking for a way to get the sched*()
277290000Sglebiusdnl functions to link OK with either cc or gcc.
278181834Sroberto
279181834Srobertocase "$host" in
280200576Sroberto *-*-*linux*) ;;
281290000Sglebius *-*-osf4*) ;;
282290000Sglebius *-*-osf5*) ;;
283181834Sroberto *)
284290000Sglebius    # HMS: Make sure we check for -lrt for clock_* before this...
285290000Sglebius    case "$ac_cv_search_clock_gettime" in
286290000Sglebius     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
287290000Sglebius    esac
288290000Sglebius    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
289181834Sroberto    ;;
290181834Srobertoesac
291181834Sroberto
292290000SglebiusAC_CHECK_HEADERS([bstring.h])
293290000SglebiusAC_CHECK_HEADER(
294290000Sglebius    [dns_sd.h],
295290000Sglebius    [AC_SEARCH_LIBS(
296290000Sglebius	[DNSServiceRegister],
297290000Sglebius	[dns_sd],
298290000Sglebius	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
299290000Sglebius	    [Use Rendezvous/DNS-SD registration])]
300290000Sglebius    )]
301290000Sglebius)
302290000SglebiusAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
303181834Sroberto
304290000SglebiusAC_CHECK_HEADERS([memory.h netdb.h poll.h])
305298770SdelphijAC_CHECK_HEADERS([sgtty.h stdatomic.h])
306298770SdelphijAC_HEADER_STDBOOL
307298770SdelphijAC_CHECK_HEADERS([stdlib.h string.h termio.h])
308290000SglebiusAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
309181834Sroberto
310181834Srobertocase "$host" in
311181834Sroberto *-*-aix*)
312290000Sglebius    AC_CHECK_HEADERS([utmpx.h])
313181834Sroberto    case "$ac_cv_header_utmpx_h" in
314290000Sglebius     yes)
315290000Sglebius	;;
316290000Sglebius     *)
317290000Sglebius	AC_CHECK_HEADERS([utmp.h])
318290000Sglebius	;;
319181834Sroberto    esac
320181834Sroberto    ;;
321290000Sglebius *)
322290000Sglebius    AC_CHECK_HEADERS([utmp.h utmpx.h])
323290000Sglebius    ;;
324181834Srobertoesac
325290000Sglebius
326290000Sglebius#
327290000Sglebius# On Suns only (so far) getpass() truncates the typed password to 8
328290000Sglebius# characters, but getpassphrase() allows up to 257.  Most systems'
329290000Sglebius# getpass() does not truncate, at least not so as to affect ntpq and
330290000Sglebius# ntpdc password prompts.
331290000Sglebius#
332290000Sglebius# So check for getpassphrase(), but only on Sun operating systems.
333290000Sglebius#
334290000Sglebiuscase "$host" in
335290000Sglebius *-*-sunos*|*-*-solaris*)
336290000Sglebius    AC_CHECK_FUNCS([getpassphrase])
337290000Sglebiusesac
338290000Sglebius
339290000Sglebius
340290000SglebiusAC_CHECK_HEADERS([net/if6.h])
341290000SglebiusAC_CHECK_HEADERS([net/route.h], [], [], [
342290000Sglebius    #include <sys/types.h>
343290000Sglebius    #include <sys/socket.h>
344290000Sglebius    #include <net/if.h>
345181834Sroberto])
346200576Sroberto
347290000SglebiusAC_CHECK_HEADERS([netinfo/ni.h])
348290000Sglebiuscase "$ac_cv_header_netinfo_ni_h" in
349200576Sroberto yes)
350290000Sglebius    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
351200576Srobertoesac
352290000SglebiusAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
353181834Srobertocase "$host" in
354290000Sglebius *-*-sunos4*)
355181834Sroberto    ;;
356290000Sglebius *)
357290000Sglebius    AC_CHECK_HEADERS([sys/ioctl.h])
358290000Sglebius    ;;
359181834Srobertoesac
360290000SglebiusAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
361181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
362290000SglebiusAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
363181834Srobertocase "$ac_cv_header_sched_h" in
364290000Sglebius yes)
365181834Sroberto    ;;
366290000Sglebius *)
367290000Sglebius    AC_CHECK_HEADERS([sys/sched.h])
368290000Sglebius    ;;
369181834Srobertoesac
370181834Sroberto# HMS: Check sys/shm.h after some others
371290000SglebiusAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
372181834Sroberto# HMS: Checked sys/socket.h earlier
373181834Srobertocase "$host" in
374290000Sglebius *-*-netbsd*)
375181834Sroberto    ;;
376290000Sglebius *)
377290000Sglebius    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
378290000Sglebius    ;;
379181834Srobertoesac
380290000SglebiusAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
381290000SglebiusAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
382181834Srobertocase "$host" in
383181834Sroberto*-convex-*)
384290000Sglebius    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
385290000Sglebius    ;;
386181834Sroberto*-*-bsdi*)
387290000Sglebius    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
388290000Sglebius    ;;
389181834Srobertoesac
390181834Sroberto
391290000Sglebiuscase "$ac_cv_header_stdatomic_h" in
392290000Sglebius yes)
393290000Sglebius	AC_CHECK_FUNCS([atomic_thread_fence])
394290000Sglebius	AC_CACHE_CHECK(
395290000Sglebius	    [for atomic_thread_fence()],
396290000Sglebius	    [ntp_cv_func_atomic_thread_fence],
397290000Sglebius	    [AC_COMPILE_IFELSE(
398290000Sglebius		[AC_LANG_PROGRAM(
399290000Sglebius		    [[
400290000Sglebius			#include <stdatomic.h>
401290000Sglebius		    ]],
402290000Sglebius		    [[
403290000Sglebius			atomic_thread_fence(memory_order_seq_cst);
404290000Sglebius		    ]]
405290000Sglebius		)]
406290000Sglebius		[ntp_cv_func_atomic_thread_fence=yes],
407290000Sglebius		[ntp_cv_func_atomic_thread_fence=no]
408290000Sglebius	    )]
409290000Sglebius	)
410290000Sglebius    ;;
411290000Sglebiusesac
412290000Sglebius
413181834Srobertocase "$host" in
414290000Sglebius *-*-solaris2.6)
415290000Sglebius    # Broken...
416181834Sroberto    ;;
417181834Sroberto *)
418290000Sglebius    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
419181834Sroberto    ;;
420181834Srobertoesac
421181834Sroberto
422290000Sglebiuscase "$host" in
423290000Sglebius *-*-*linux*)
424290000Sglebius    case "$ac_cv_func_ntp_gettime" in
425290000Sglebius     yes)
426290000Sglebius	;;
427290000Sglebius     *)
428290000Sglebius	AC_CHECK_FUNCS([__ntp_gettime])
429290000Sglebius	case "$ac_cv_func___ntp_gettime" in
430290000Sglebius	 yes)
431290000Sglebius	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
432290000Sglebius		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
433290000Sglebius	esac
434290000Sglebius	;;
435290000Sglebius    esac
436290000Sglebius    AC_CHECK_FUNCS([adjtimex])
437290000Sglebius    case "$ac_cv_func_adjtimex" in
438290000Sglebius     yes)
439290000Sglebius	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
440290000Sglebius	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
441290000Sglebius	have_adjtimex=1
442290000Sglebius	;;
443290000Sglebius     *)
444290000Sglebius	AC_CHECK_FUNCS([__adjtimex])
445290000Sglebius	case "$ac_cv_func___adjtimex" in
446290000Sglebius	 yes)
447290000Sglebius	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
448290000Sglebius	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
449290000Sglebius	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
450290000Sglebius	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
451290000Sglebius	    have_adjtimex=1
452290000Sglebius	esac
453290000Sglebius	;;
454290000Sglebius    esac
455290000Sglebiusesac
456290000Sglebiuscase "$have_adjtimex" in
457290000Sglebius '')
458290000Sglebius    # nlist stuff is only needed for tickadj.
459290000Sglebius    saved_LIBS="$LIBS"
460290000Sglebius    LIBS=
461290000Sglebius    AC_SEARCH_LIBS([nlist], [elf ld mld])
462290000Sglebius    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
463290000Sglebius    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
464290000Sglebius    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
465290000Sglebius    AC_CHECK_HEADERS([nlist.h sys/var.h])
466290000Sglebius    case "$ac_cv_header_nlist_h" in
467290000Sglebius     yes)
468290000Sglebius	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
469290000Sglebius	AC_CACHE_CHECK(
470290000Sglebius	    [for n_un in struct nlist],
471290000Sglebius	    [ntp_cv_struct_nlist_n_un],
472290000Sglebius	    [AC_COMPILE_IFELSE(
473290000Sglebius		[AC_LANG_PROGRAM(
474290000Sglebius		    [[
475290000Sglebius			#include <nlist.h>
476290000Sglebius		    ]],
477290000Sglebius		    [[
478290000Sglebius			struct nlist n;
479290000Sglebius			n.n_un.n_name = 0;
480290000Sglebius		    ]]
481290000Sglebius		)]
482290000Sglebius		[ntp_cv_struct_nlist_n_un=yes],
483290000Sglebius		[ntp_cv_struct_nlist_n_un=no]
484290000Sglebius	    )]
485290000Sglebius	)
486290000Sglebius	case "$ntp_cv_struct_nlist_n_un" in
487290000Sglebius	 yes)
488290000Sglebius	    AC_DEFINE([NLIST_NAME_UNION], [1],
489290000Sglebius		[does struct nlist use a name union?])
490290000Sglebius	esac
491290000Sglebius    esac
492290000Sglebius    AC_SUBST([LDADD_NLIST])
493290000Sglebius    LDADD_NLIST="$LIBS"
494290000Sglebius    LIBS="$saved_LIBS"
495290000Sglebius    AS_UNSET([saved_LIBS])
496290000Sglebiusesac
497181834Sroberto
498290000SglebiusAC_CHECK_HEADERS([sys/proc.h], [], [], [
499290000Sglebius    #ifdef HAVE_SYS_TYPES_H
500290000Sglebius    # include <sys/types.h>
501290000Sglebius    #endif
502290000Sglebius    #ifdef HAVE_SYS_TIME_H
503290000Sglebius    # include <sys/time.h>
504290000Sglebius    #endif
505181834Sroberto])
506181834Sroberto
507290000SglebiusAC_CHECK_HEADERS([sys/resource.h], [], [], [
508290000Sglebius    #ifdef HAVE_SYS_TIME_H
509290000Sglebius    # include <sys/time.h>
510290000Sglebius    #endif
511181834Sroberto])
512181834Sroberto
513290000SglebiusAC_CHECK_HEADERS([sys/shm.h], [], [], [
514290000Sglebius    #ifdef HAVE_SYS_TYPES_H
515290000Sglebius    # include <sys/types.h>
516290000Sglebius    #endif
517290000Sglebius    #ifdef HAVE_SYS_IPC_H
518290000Sglebius    # include <sys/ipc.h>
519290000Sglebius    #endif
520181834Sroberto])
521181834Sroberto
522290000SglebiusAC_CHECK_HEADERS([sys/timex.h], [], [], [
523290000Sglebius    #ifdef HAVE_SYS_TIME_H
524290000Sglebius    # include <sys/time.h>
525290000Sglebius    #endif
526181834Sroberto])
527181834Sroberto
528181834SrobertoAC_TYPE_SIGNAL
529181834SrobertoAC_TYPE_OFF_T
530290000SglebiusAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
531181834Sroberto
532290000SglebiusAC_CACHE_CHECK(
533290000Sglebius    [for a fallback value for HZ],
534290000Sglebius    [ntp_cv_default_hz],
535290000Sglebius    [
536290000Sglebius	ntp_cv_default_hz=100
537290000Sglebius	case "$host" in
538290000Sglebius	 alpha*-dec-osf4*|alpha*-dec-osf5*)
539290000Sglebius	    ntp_cv_default_hz=1024
540290000Sglebius	    ;;
541290000Sglebius	 mips-dec-ultrix4*)
542290000Sglebius	    ntp_cv_default_hz=256
543290000Sglebius	    ;;
544290000Sglebius	esac
545290000Sglebius    ]
546290000Sglebius)
547290000SglebiusAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
548290000Sglebius    [What is the fallback value for HZ?])
549181834Sroberto
550290000SglebiusAC_CACHE_CHECK(
551290000Sglebius    [if we need to override the system's value for HZ],
552290000Sglebius    [ntp_cv_override_hz],
553290000Sglebius    [
554290000Sglebius	ntp_cv_override_hz=no
555290000Sglebius	case "$host" in
556290000Sglebius	 alpha*-dec-osf4*|alpha*-dec-osf5*)
557290000Sglebius	    ntp_cv_override_hz=yes
558290000Sglebius	    ;;
559290000Sglebius	 mips-dec-ultrix4*)
560290000Sglebius	    ntp_cv_override_hz=yes
561290000Sglebius	    ;;
562290000Sglebius	 *-*-freebsd*)
563290000Sglebius	    ntp_cv_override_hz=yes
564290000Sglebius	    ;;
565290000Sglebius	 *-*-sunos4*)
566290000Sglebius	    ntp_cv_override_hz=yes
567290000Sglebius	    ;;
568290000Sglebius	 *-*-kfreebsd*)
569290000Sglebius	    ntp_cv_override_hz=yes
570290000Sglebius	    ;;
571290000Sglebius	esac
572290000Sglebius    ]
573290000Sglebius)
574290000Sglebiuscase "$ntp_cv_override_hz" in
575181834Sroberto yes)
576290000Sglebius    AC_DEFINE([OVERRIDE_HZ], [1],
577290000Sglebius	[Do we need to override the system's idea of HZ?])
578181834Srobertoesac
579181834Sroberto
580181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
581181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
582181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
583181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
584181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
585181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
586181834Srobertodnl fi
587181834Sroberto
588181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
589181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
590181834Srobertodnl [AC_EGREP_CPP(yes,
591181834Srobertodnl [#ifdef HAVE_UTMPX_H
592181834Srobertodnl #include <utmpx.h>
593181834Srobertodnl #else
594181834Srobertodnl #include <utmp.h>
595181834Srobertodnl #endif
596181834Srobertodnl #ifdef BOOT_TIME
597181834Srobertodnl yes
598181834Srobertodnl #endif
599181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
600181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
601181834Sroberto
602290000SglebiusAC_CACHE_CHECK(
603290000Sglebius    [for struct rt_msghdr],
604290000Sglebius    [ntp_cv_struct_rt_msghdr],
605290000Sglebius    [AC_COMPILE_IFELSE(
606290000Sglebius	[AC_LANG_PROGRAM(
607290000Sglebius	    [[
608290000Sglebius		#include <sys/types.h>
609290000Sglebius		#include <sys/socket.h>
610290000Sglebius		#include <net/if.h>
611290000Sglebius		#include <net/route.h>
612290000Sglebius	    ]],
613290000Sglebius	    [[
614290000Sglebius		struct rt_msghdr p;
615290000Sglebius	    ]]
616290000Sglebius	)],
617290000Sglebius	[ntp_cv_struct_rt_msghdr=yes],
618290000Sglebius	[ntp_cv_struct_rt_msghdr=no]
619290000Sglebius    )]
620290000Sglebius)
621200576Sroberto
622181834SrobertoAC_CACHE_CHECK(
623290000Sglebius    [for struct rtattr],
624290000Sglebius    [ntp_cv_rtattr],
625290000Sglebius    [AC_COMPILE_IFELSE(
626290000Sglebius	[AC_LANG_PROGRAM(
627290000Sglebius	    [[
628290000Sglebius		#include <stddef.h>
629290000Sglebius		#include <sys/socket.h>
630290000Sglebius		#include <linux/rtnetlink.h>
631290000Sglebius	    ]],
632290000Sglebius	    [[
633290000Sglebius		struct rtattr p;
634290000Sglebius	    ]]
635290000Sglebius	)],
636290000Sglebius	[ntp_cv_rtattr=yes],
637290000Sglebius	[ntp_cv_rtattr=no]
638290000Sglebius    )]
639181834Sroberto)
640181834Sroberto
641290000Sglebiuscase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
642290000Sglebius *yes*)
643290000Sglebius    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
644290000Sglebius	[Do we have a routing socket (rt_msghdr or rtattr)?])
645290000Sglebius    case "$ntp_cv_rtattr" in
646290000Sglebius     yes)
647290000Sglebius	AC_DEFINE([HAVE_RTNETLINK], [1],
648290000Sglebius	    [Do we have Linux routing socket?])
649181834Sroberto    esac
650290000Sglebiusesac
651181834Sroberto
652290000SglebiusAC_CACHE_CHECK(
653290000Sglebius    [struct sigaction for sa_sigaction],
654290000Sglebius    [ntp_cv_struct_sigaction_has_sa_sigaction],
655290000Sglebius    [AC_COMPILE_IFELSE(
656290000Sglebius	[AC_LANG_PROGRAM(
657290000Sglebius	    [[
658290000Sglebius		#include <signal.h>
659290000Sglebius	    ]],
660290000Sglebius	    [[
661290000Sglebius		struct sigaction act;
662290000Sglebius		act.sa_sigaction = 0;
663290000Sglebius	    ]]
664290000Sglebius	)],
665290000Sglebius	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
666290000Sglebius	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
667290000Sglebius    )]
668290000Sglebius)
669290000Sglebiuscase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
670290000Sglebius yes)
671290000Sglebius    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
672290000Sglebiusesac
673181834Sroberto
674290000SglebiusAC_CACHE_CHECK(
675290000Sglebius    [for struct ppsclockev],
676290000Sglebius    [ntp_cv_struct_ppsclockev],
677290000Sglebius    [AC_COMPILE_IFELSE(
678290000Sglebius	[AC_LANG_PROGRAM(
679290000Sglebius	    [[
680290000Sglebius		#ifdef HAVE_SYS_TYPES_H
681290000Sglebius		# include <sys/types.h>
682290000Sglebius		#endif
683290000Sglebius		#ifdef HAVE_SYS_TERMIOS_H
684290000Sglebius		# include <sys/termios.h>
685290000Sglebius		#endif
686290000Sglebius		#ifdef HAVE_SYS_TIME_H
687290000Sglebius		# include <sys/time.h>
688290000Sglebius		#endif
689290000Sglebius		#ifdef HAVE_SYS_PPSCLOCK_H
690290000Sglebius		# include <sys/ppsclock.h>
691290000Sglebius		#endif
692290000Sglebius	    ]],
693290000Sglebius	    [[
694290000Sglebius		extern struct ppsclockev *pce;
695290000Sglebius		return pce->serial;
696290000Sglebius	    ]]
697290000Sglebius	)],
698290000Sglebius	[ntp_cv_struct_ppsclockev=yes],
699290000Sglebius	[ntp_cv_struct_ppsclockev=no]
700290000Sglebius    )]
701290000Sglebius)
702290000Sglebiuscase "$ntp_cv_struct_ppsclockev" in
703290000Sglebius yes)
704290000Sglebius    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
705290000Sglebius	[Does a system header define struct ppsclockev?])
706290000Sglebiusesac
707181834Sroberto
708181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
709181834Sroberto  *yes*)
710290000Sglebius    AC_CACHE_CHECK(
711290000Sglebius	[for struct snd_size],
712290000Sglebius	[ntp_cv_struct_snd_size],
713290000Sglebius	[AC_COMPILE_IFELSE(
714290000Sglebius	    [AC_LANG_PROGRAM(
715290000Sglebius		[[
716290000Sglebius		    #ifdef HAVE_MACHINE_SOUNDCARD_H
717290000Sglebius		    # include <machine/soundcard.h>
718290000Sglebius		    #endif
719290000Sglebius		    #ifdef HAVE_SYS_SOUNDCARD_H
720290000Sglebius		    # include <sys/soundcard.h>
721290000Sglebius		    #endif
722290000Sglebius		]],
723290000Sglebius		[[
724290000Sglebius		    extern struct snd_size *ss;
725290000Sglebius		    return ss->rec_size;
726290000Sglebius		]]
727290000Sglebius	    )],
728290000Sglebius	    [ntp_cv_struct_snd_size=yes],
729290000Sglebius	    [ntp_cv_struct_snd_size=no]
730290000Sglebius        )]
731290000Sglebius    )
732290000Sglebius    case "$ntp_cv_struct_snd_size" in
733290000Sglebius     yes)
734290000Sglebius	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
735290000Sglebius	    [Do we have struct snd_size?])
736181834Sroberto    esac
737181834Srobertoesac
738181834Sroberto
739290000SglebiusAC_CACHE_CHECK(
740290000Sglebius    [struct clockinfo for hz],
741290000Sglebius    [ntp_cv_struct_clockinfo_has_hz],
742290000Sglebius    [AC_COMPILE_IFELSE(
743290000Sglebius	[AC_LANG_PROGRAM(
744290000Sglebius	    [[
745290000Sglebius		#include <sys/time.h>
746290000Sglebius	    ]],
747290000Sglebius	    [[
748290000Sglebius		extern struct clockinfo *pc;
749290000Sglebius		return pc->hz;
750290000Sglebius	    ]]
751290000Sglebius	)],
752290000Sglebius	[ntp_cv_struct_clockinfo_has_hz=yes],
753290000Sglebius	[ntp_cv_struct_clockinfo_has_hz=no]
754290000Sglebius    )]
755290000Sglebius)
756290000Sglebiuscase "$ntp_cv_struct_clockinfo_has_hz" in
757290000Sglebius yes)
758290000Sglebius    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
759290000Sglebiusesac
760181834Sroberto
761290000SglebiusAC_CACHE_CHECK(
762290000Sglebius    [struct clockinfo for tickadj],
763290000Sglebius    [ntp_cv_struct_clockinfo_has_hz],
764290000Sglebius    [AC_COMPILE_IFELSE(
765290000Sglebius	[AC_LANG_PROGRAM(
766290000Sglebius	    [[
767290000Sglebius		#include <sys/time.h>
768290000Sglebius	    ]],
769290000Sglebius	    [[
770290000Sglebius		extern struct clockinfo *pc;
771290000Sglebius		return pc->tickadj;
772290000Sglebius	    ]]
773290000Sglebius	)],
774290000Sglebius	[ntp_cv_struct_clockinfo_has_hz=yes],
775290000Sglebius	[ntp_cv_struct_clockinfo_has_hz=no]
776290000Sglebius    )]
777290000Sglebius)
778290000Sglebiuscase "$ntp_cv_struct_clockinfo_has_hz" in
779290000Sglebius yes)
780290000Sglebius    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
781290000Sglebiusesac
782181834Sroberto
783290000Sglebiuscase "$ntp_cv_struct_ntptimeval" in
784290000Sglebius yes)
785290000Sglebius    AC_CHECK_MEMBERS(
786290000Sglebius	[struct ntptimeval.time.tv_nsec],
787290000Sglebius	[],
788290000Sglebius	[],
789290000Sglebius	[
790290000Sglebius	    #ifdef HAVE_SYS_TIME_H
791290000Sglebius	    # include <sys/time.h>
792290000Sglebius	    #else
793290000Sglebius	    # ifdef HAVE_TIME_H
794290000Sglebius	    #  include <time.h>
795290000Sglebius	    # endif
796290000Sglebius	    #endif
797290000Sglebius	    #ifdef HAVE_SYS_TIMEX_H
798290000Sglebius	    # include <sys/timex.h>
799290000Sglebius	    #else
800290000Sglebius	    # ifdef HAVE_TIMEX_H
801290000Sglebius	    #  include <timex.h>
802290000Sglebius	    # endif
803290000Sglebius	    #endif
804290000Sglebius	]
805290000Sglebius    )
806200576Srobertoesac
807200576Sroberto
808290000Sglebius#### 
809181834Sroberto
810290000SglebiusAC_CHECK_FUNCS([arc4random_buf])
811181834Sroberto
812290000Sglebius#### 
813181834Sroberto
814290000Sglebiussaved_LIBS="$LIBS"
815290000SglebiusLIBS="$LIBS $LDADD_LIBNTP"
816290000SglebiusAC_CHECK_FUNCS([daemon])
817290000Sglebius# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
818290000SglebiusLIBS="$saved_LIBS"
819290000SglebiusAS_UNSET([saved_LIBS])
820181834Sroberto
821290000SglebiusAC_CHECK_FUNCS(
822290000Sglebius    [finite],
823290000Sglebius    [],
824290000Sglebius    [AC_CHECK_FUNCS(
825290000Sglebius	[isfinite],
826290000Sglebius	[],
827290000Sglebius	[
828290000Sglebius	    AC_MSG_CHECKING([for isfinite with <math.h>])
829290000Sglebius	    _libs=$LIBS
830290000Sglebius	    # XXX
831290000Sglebius	    LIBS="$LIBS -lm"
832290000Sglebius	    AC_LINK_IFELSE(
833290000Sglebius		[AC_LANG_PROGRAM(
834290000Sglebius		    [[
835290000Sglebius			#include <math.h>
836290000Sglebius		    ]],
837290000Sglebius		    [[
838290000Sglebius			float f = 0.0;
839290000Sglebius			isfinite(f);
840290000Sglebius		    ]]
841290000Sglebius		)],
842290000Sglebius		[ans=yes],
843290000Sglebius		[ans=no]
844290000Sglebius	    )
845290000Sglebius	    LIBS=$_libs
846290000Sglebius	    AC_MSG_RESULT([$ans])
847290000Sglebius	    case "$ans" in
848290000Sglebius	     yes)
849290000Sglebius		AC_DEFINE([HAVE_ISFINITE], [1])
850290000Sglebius	    esac
851290000Sglebius	]
852290000Sglebius    )]
853290000Sglebius)
854181834Sroberto
855290000SglebiusAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
856181834Sroberto
857290000Sglebius# kvm_open() is only used by tickadj.  Also see above.
858290000Sglebiuscase "$ac_cv_header_kvm_h" in
859290000Sglebius yes)
860290000Sglebius    AC_CHECK_FUNCS([kvm_open])
861181834Sroberto    ;;
862181834Srobertoesac
863181834Sroberto
864181834Srobertocase "$host" in
865181834Sroberto *-*-sco3.2v5.0.*)
866290000Sglebius    # Just stubs.  Sigh.
867181834Sroberto    ;;
868290000Sglebius *) AC_CHECK_FUNCS([mkstemp])
869181834Sroberto    ;;
870181834Srobertoesac
871290000SglebiusAC_CHECK_FUNCS([mktime])
872181834Srobertocase "$host" in
873290000Sglebius *-*-aix[[4-9]]*)
874290000Sglebius    # XXX only verified thru AIX6.
875290000Sglebius    # Just a stub.  Sigh.
876181834Sroberto    ;;
877181834Sroberto *-*-irix[[45]]*)
878290000Sglebius    # Just a stub in "old" Irix.  Sigh.
879181834Sroberto    ;;
880290000Sglebius# In the belief that the fix for bug 1223 fixes mlockall() under linux...
881290000Sglebius# *-*-*linux*)
882290000Sglebius#    # there, but more trouble than it is worth for now (resolver problems)
883290000Sglebius#    ;;
884181834Sroberto *-*-qnx*)
885290000Sglebius    # Apparently there but not working in QNX.  Sigh?
886181834Sroberto    ;;
887181834Sroberto *-*-sco3.2v5.0.*)
888290000Sglebius    # Just a stub.  Sigh.
889181834Sroberto    ;;
890181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
891181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
892181834Sroberto    # Not easy to test for - cheat.
893290000Sglebius    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
894290000Sglebius    AC_CHECK_FUNCS([mlockall])
895181834Sroberto    ;;
896290000Sglebius *) AC_CHECK_FUNCS([mlockall])
897181834Sroberto    ;;
898181834Srobertoesac
899290000SglebiusAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
900181834Srobertocase "$host" in
901290000Sglebius *-*-aix[[4-9]]*)
902290000Sglebius    # XXX only verified thru AIX6.
903290000Sglebius    # Just a stub in AIX 4.  Sigh.
904181834Sroberto    ;;
905181834Sroberto *-*-solaris2.5*)
906290000Sglebius    # Just stubs in solaris2.5.  Sigh.
907181834Sroberto    ;;
908290000Sglebius *) AC_CHECK_FUNCS([sched_setscheduler])
909181834Sroberto    ;;
910181834Srobertoesac
911290000SglebiusAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
912290000SglebiusAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
913181834Srobertocase "$host" in
914290000Sglebius *-*-aix[[4-9]]*)
915290000Sglebius    # XXX only verified thru AIX6.
916290000Sglebius    # Just stubs.  Sigh.
917181834Sroberto    ;;
918181834Sroberto *-*-netbsd1*)
919290000Sglebius    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-netbsdelf1*)
922290000Sglebius    # Just stubs.  Sigh.
923181834Sroberto    ;;
924181834Sroberto *-*-openbsd*)
925290000Sglebius    # Just stubs.  Sigh.
926181834Sroberto    ;;
927290000Sglebius *)
928290000Sglebius    AC_CHECK_FUNCS([timer_create])
929181834Sroberto    ;;
930181834Srobertoesac
931290000Sglebius
932290000SglebiusNTP_RLIMIT_ITEMS
933290000Sglebius
934290000Sglebius# some OSes prefer _exit() in forked children to exit()
935290000SglebiusAC_CHECK_FUNCS([_exit])
936290000Sglebiusntp_worker_child_exit=exit
937290000Sglebiuscase "$ac_cv_func__exit::$host_os" in
938290000Sglebius yes::netbsd*)
939290000Sglebius    ntp_worker_child_exit=_exit
940181834Sroberto    ;;
941290000Sglebius yes::openbsd*)
942290000Sglebius    ntp_worker_child_exit=_exit
943181834Sroberto    ;;
944181834Srobertoesac
945290000SglebiusAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
946290000Sglebius		   [routine worker child proc uses to exit.])
947181834Sroberto
948290000SglebiusAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
949290000Sglebius
950181834Sroberto###
951181834Sroberto
952200576Sroberto# http://bugs.ntp.org/737
953181834Srobertocase "$ac_cv_func_recvmsg" in
954181834Sroberto yes)
955290000Sglebius    AC_CACHE_CHECK(
956290000Sglebius	[if we need extra help to define struct iovec],
957290000Sglebius	[ntp_cv_struct_iovec_help],
958290000Sglebius	[
959290000Sglebius	    compiled=no
960290000Sglebius	    for ntp_cv_struct_iovec_help in '0' '1'; do
961290000Sglebius		AC_COMPILE_IFELSE(
962290000Sglebius		    [AC_LANG_PROGRAM(
963290000Sglebius			[[
964290000Sglebius			    #ifdef HAVE_SYS_TYPES_H
965290000Sglebius			    # include <sys/types.h>
966290000Sglebius			    #endif
967290000Sglebius			    #ifdef HAVE_SYS_SOCKET_H
968290000Sglebius			    # include <sys/socket.h>
969290000Sglebius			    #endif
970290000Sglebius			    #if $ntp_cv_struct_iovec_help
971290000Sglebius			    # include <sys/uio.h>
972290000Sglebius			    #endif
973290000Sglebius			]],
974290000Sglebius			[[
975290000Sglebius			    void foo(void) {
976290000Sglebius				ssize_t x;
977290000Sglebius				int s = 0;
978290000Sglebius				struct iovec iov;
979290000Sglebius				struct msghdr mh;
980290000Sglebius				int flags = 0;
981181834Sroberto
982290000Sglebius				mh.msg_iov = &iov;
983290000Sglebius				x = recvmsg(s, &mh, flags);
984290000Sglebius			    }
985290000Sglebius			]]
986290000Sglebius		    )],
987290000Sglebius		    [compiled=yes ; break 1],
988290000Sglebius		    []
989290000Sglebius		)
990290000Sglebius	    done
991290000Sglebius	    case "$compiled" in
992290000Sglebius	     no)
993290000Sglebius		ntp_cv_struct_iovec_help=0
994290000Sglebius	    esac
995290000Sglebius	    AS_UNSET([compiled])
996290000Sglebius	]
997290000Sglebius    )
998290000Sglebius    case "$ntp_cv_struct_iovec_help" in
999290000Sglebius     1)
1000290000Sglebius	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1001290000Sglebius	    [Use sys/uio.h for struct iovec help])
1002181834Sroberto    esac
1003181834Srobertoesac
1004181834Sroberto
1005290000SglebiusAC_CACHE_CHECK(
1006290000Sglebius    [number of arguments taken by setpgrp()],
1007290000Sglebius    [ntp_cv_func_setpgrp_nargs],
1008290000Sglebius    [AC_COMPILE_IFELSE(
1009290000Sglebius	[AC_LANG_PROGRAM(
1010290000Sglebius	    [[
1011290000Sglebius		#ifdef HAVE_SYS_TYPES_H
1012290000Sglebius		# include <sys/types.h>
1013290000Sglebius		#endif
1014290000Sglebius		#ifdef HAVE_UNISTD_H
1015290000Sglebius		# include <unistd.h>
1016290000Sglebius		#endif
1017290000Sglebius	    ]],
1018290000Sglebius	    [[
1019290000Sglebius		setpgrp(0, 0);
1020290000Sglebius	    ]]
1021290000Sglebius	)],
1022290000Sglebius	[ntp_cv_func_setpgrp_nargs=2],
1023290000Sglebius	[ntp_cv_func_setpgrp_nargs=0]
1024290000Sglebius    )]
1025290000Sglebius)
1026290000Sglebiuscase "$ntp_cv_func_setpgrp_nargs" in
1027290000Sglebius 0)
1028290000Sglebius    AC_DEFINE([HAVE_SETPGRP_0], [1],
1029290000Sglebius	      [define if setpgrp takes 0 arguments])
1030181834Srobertoesac
1031181834Sroberto
1032290000SglebiusAC_CACHE_CHECK(
1033290000Sglebius    [if we need to declare 'errno'],
1034290000Sglebius    [ntp_cv_decl_errno],
1035290000Sglebius    [AC_COMPILE_IFELSE(
1036290000Sglebius	[AC_LANG_PROGRAM(
1037290000Sglebius	    [[
1038290000Sglebius		#ifdef HAVE_ERRNO_H
1039290000Sglebius		# include <errno.h>
1040290000Sglebius		#endif
1041290000Sglebius	    ]],
1042290000Sglebius	    [[
1043290000Sglebius		errno = 0;
1044290000Sglebius	    ]]
1045290000Sglebius	)],
1046290000Sglebius	[ntp_cv_decl_errno=no],
1047290000Sglebius	[ntp_cv_decl_errno=yes]
1048290000Sglebius    )]
1049290000Sglebius)
1050290000Sglebiuscase "$ntp_cv_decl_errno" in
1051290000Sglebius yes)
1052290000Sglebius    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1053181834Srobertoesac
1054181834Sroberto
1055181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1056181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1057181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1058181834Srobertodnl without breaking any other platforms.
1059181834Srobertodnl
1060290000SglebiusAC_CACHE_CHECK(
1061290000Sglebius    [if we may declare 'h_errno'],
1062290000Sglebius    [ntp_cv_decl_h_errno],
1063290000Sglebius    [AC_COMPILE_IFELSE(
1064290000Sglebius	[AC_LANG_PROGRAM(
1065290000Sglebius	    [[
1066290000Sglebius		#include <sys/types.h>
1067290000Sglebius		#ifdef HAVE_NETINET_IN_H
1068290000Sglebius		# include <netinet/in.h>
1069290000Sglebius		#endif
1070290000Sglebius		#ifdef HAVE_ARPA_NAMESER_H
1071290000Sglebius		# include <arpa/nameser.h>
1072290000Sglebius		#endif
1073290000Sglebius		#ifdef HAVE_NETDB_H
1074290000Sglebius		# include <netdb.h>
1075290000Sglebius		#endif
1076290000Sglebius		#ifdef HAVE_RESOLV_H
1077290000Sglebius		# include <resolv.h>
1078290000Sglebius		#endif
1079290000Sglebius	    ]],
1080290000Sglebius	    [[
1081290000Sglebius		extern int h_errno;
1082290000Sglebius	    ]]
1083290000Sglebius	)],
1084290000Sglebius	[ntp_cv_decl_h_errno=yes],
1085290000Sglebius	[ntp_cv_decl_h_errno=no]
1086290000Sglebius    )]
1087290000Sglebius)
1088290000Sglebiuscase "$ntp_cv_decl_h_errno" in
1089290000Sglebius yes)
1090290000Sglebius    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1091181834Srobertoesac
1092181834Sroberto
1093290000SglebiusAC_CACHE_CHECK(
1094290000Sglebius    [if declaring 'syscall()' is ok],
1095290000Sglebius    [ntp_cv_decl_syscall],
1096290000Sglebius    [AC_COMPILE_IFELSE(
1097290000Sglebius	[AC_LANG_PROGRAM(
1098290000Sglebius	    [[
1099290000Sglebius		#ifdef HAVE_SYS_TYPES_H
1100290000Sglebius		# include <sys/types.h>
1101290000Sglebius		#endif
1102290000Sglebius		#ifdef HAVE_UNISTD_H
1103290000Sglebius		# include <unistd.h>
1104290000Sglebius		#endif
1105290000Sglebius	    ]],
1106290000Sglebius	    [[
1107290000Sglebius		extern int syscall (int, ...);
1108290000Sglebius	    ]]
1109290000Sglebius	)]
1110290000Sglebius	[ntp_cv_decl_syscall=yes],
1111290000Sglebius	[ntp_cv_decl_syscall=no]
1112290000Sglebius    )]
1113290000Sglebius)
1114290000Sglebiuscase "$ntp_cv_decl_syscall" in
1115290000Sglebius yes)
1116290000Sglebius    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1117181834Srobertoesac
1118181834Sroberto
1119181834Srobertocase "$host" in
1120181834Sroberto *-*-aix4.3.*)
1121290000Sglebius    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1122181834Sroberto    ;;
1123181834Sroberto *-*-mpeix*)
1124290000Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1125290000Sglebius    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1126290000Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1127290000Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1128290000Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1129290000Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1130290000Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1131181834Sroberto    ;;
1132181834Sroberto *-*-osf[[45]]*)
1133290000Sglebius    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1134290000Sglebius    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1135181834Sroberto    ;;
1136181834Sroberto *-*-qnx*)
1137290000Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1138181834Sroberto    ;;
1139181834Sroberto *-*-riscos4*)
1140290000Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141290000Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1142290000Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1143290000Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1144290000Sglebius    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1145290000Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1146290000Sglebius    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1147290000Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1148290000Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1149290000Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1150290000Sglebius    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1151290000Sglebius    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1152290000Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1153290000Sglebius    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1154290000Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1155290000Sglebius    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1156181834Sroberto    ;;
1157181834Sroberto *-*-solaris2*)
1158290000Sglebius    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1159290000Sglebius    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1160181834Sroberto    case "$host" in
1161181834Sroberto     *-*-solaris2.4)
1162290000Sglebius        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1163181834Sroberto	;;
1164181834Sroberto    esac
1165181834Sroberto    ;;
1166181834Sroberto *-*-sunos4*)
1167290000Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1168290000Sglebius    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1169290000Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1170290000Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1171290000Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1172290000Sglebius    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1173290000Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1174290000Sglebius    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1175290000Sglebius    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1176290000Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1177290000Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1178290000Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1179290000Sglebius    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1180181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1181181834Sroberto     acc*) ;;
1182290000Sglebius     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1183181834Sroberto	;;
1184181834Sroberto    esac
1185290000Sglebius    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1186290000Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1187290000Sglebius    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1188290000Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1189290000Sglebius    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1190290000Sglebius    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1191290000Sglebius    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1192181834Sroberto    ;;
1193181834Sroberto *-*-ultrix4*)
1194290000Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1195290000Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1196290000Sglebius    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1197290000Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1198290000Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1199290000Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1200290000Sglebius    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1201290000Sglebius    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1202290000Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1203290000Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1204290000Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1205290000Sglebius    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1206290000Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1207290000Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1208181834Sroberto    ;;
1209181834Srobertoesac
1210181834Sroberto
1211181834Srobertocase "$host" in
1212181834Sroberto *-*-sco3.2*)
1213290000Sglebius    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1214290000Sglebius	[Do we need to #define _SVID3 when we #include <termios.h>?])
1215181834Sroberto    ;;
1216181834Srobertoesac
1217181834Sroberto
1218181834Srobertocase "$host" in
1219181834Sroberto *-*-hpux[[567]]*)
1220290000Sglebius    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1221290000Sglebius	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1222181834Srobertoesac
1223181834Sroberto
1224290000Sglebiusdnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1225290000SglebiusAC_CACHE_CHECK(
1226290000Sglebius    [if we will open the broadcast socket],
1227290000Sglebius    [ntp_cv_var_open_bcast_socket],
1228290000Sglebius    [
1229290000Sglebius	ans=yes
1230290000Sglebius	case "$host" in
1231290000Sglebius	 *-*-domainos)
1232290000Sglebius	    ans=no
1233290000Sglebius	esac
1234290000Sglebius	ntp_cv_var_open_bcast_socket=$ans
1235290000Sglebius    ]
1236290000Sglebius)
1237290000Sglebiuscase "$ntp_cv_var_open_bcast_socket" in
1238290000Sglebius yes)
1239290000Sglebius    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1240290000Sglebius	[Should we open the broadcast socket?])
1241181834Srobertoesac
1242181834Sroberto
1243181834Srobertocase "$host" in
1244181834Sroberto *-*-hpux*)
1245290000Sglebius    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1246290000Sglebius	[Do we want the HPUX FindConfig()?])
1247181834Srobertoesac
1248181834Sroberto
1249290000Sglebiusdnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1250290000SglebiusAC_CACHE_CHECK(
1251290000Sglebius    [if process groups are set with -pid],
1252290000Sglebius    [ntp_cv_arg_setpgrp_negpid],
1253290000Sglebius    [
1254290000Sglebius	case "$host" in
1255290000Sglebius	 *-*-hpux[[567]]*)
1256290000Sglebius	    ans=no
1257290000Sglebius	    ;;
1258290000Sglebius	 *-*-hpux*)
1259290000Sglebius	    ans=yes
1260290000Sglebius	    ;;
1261290000Sglebius	 *-*-*linux*)
1262290000Sglebius	    ans=yes
1263290000Sglebius	    ;;
1264290000Sglebius	 *-*-sunos3*)
1265290000Sglebius	    ans=yes
1266290000Sglebius	    ;;
1267290000Sglebius	 *-*-ultrix2*)
1268290000Sglebius	    ans=yes
1269290000Sglebius	    ;;
1270290000Sglebius	 *)
1271290000Sglebius	    ans=no
1272290000Sglebius	    ;;
1273290000Sglebius	esac
1274290000Sglebius	ntp_cv_arg_setpgrp_negpid=$ans
1275290000Sglebius    ]
1276290000Sglebius)
1277290000Sglebiuscase "$ntp_cv_arg_setpgrp_negpid" in
1278181834Sroberto yes)
1279290000Sglebius    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1280290000Sglebius	[Do we set process groups with -pid?])
1281181834Srobertoesac
1282181834Sroberto
1283290000SglebiusAC_CACHE_CHECK(
1284290000Sglebius    [if we need a ctty for F_SETOWN],
1285290000Sglebius    [ntp_cv_func_ctty_for_f_setown],
1286290000Sglebius    [
1287290000Sglebius	case "$host" in
1288290000Sglebius	 *-*-bsdi[[23]]*)
1289290000Sglebius	    ans=yes
1290290000Sglebius	    ;;
1291290000Sglebius	 *-*-freebsd*)
1292290000Sglebius	    ans=yes
1293290000Sglebius	    ;;
1294290000Sglebius	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1295290000Sglebius	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1296290000Sglebius	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1297290000Sglebius	# in $host may be followed by "aout", "ecoff", or "elf".
1298290000Sglebius	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1299290000Sglebius	    ans=yes
1300290000Sglebius	    ;;
1301290000Sglebius	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1302290000Sglebius	    ans=yes
1303290000Sglebius	    ;;
1304290000Sglebius	 *-*-openbsd*)
1305290000Sglebius	    ans=yes
1306290000Sglebius	    ;;
1307290000Sglebius	 *-*-osf*)
1308290000Sglebius	    ans=yes
1309290000Sglebius	    ;;
1310290000Sglebius	 *-*-darwin*)
1311290000Sglebius	    ans=yes
1312290000Sglebius	    ;;
1313290000Sglebius	 *)
1314290000Sglebius	    ans=no
1315290000Sglebius	    ;;
1316290000Sglebius	esac
1317290000Sglebius	ntp_cv_func_ctty_for_f_setown=$ans
1318290000Sglebius    ]
1319290000Sglebius)
1320290000Sglebiuscase "$ntp_cv_func_ctty_for_f_setown" in
1321181834Sroberto yes)
1322290000Sglebius    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1323181834Srobertoesac
1324181834Sroberto
1325290000SglebiusAC_CACHE_CHECK(
1326290000Sglebius    [if the OS clears cached routes when more specifics become available],
1327290000Sglebius    [ntp_cv_os_routeupdates],
1328290000Sglebius    [
1329290000Sglebius	case "$host" in
1330290000Sglebius	 *-*-netbsd*)
1331290000Sglebius	    ans=yes
1332290000Sglebius	    ;;
1333290000Sglebius	 *)
1334290000Sglebius	    ans=no
1335290000Sglebius	    ;;
1336290000Sglebius	esac
1337290000Sglebius	ntp_cv_os_routeupdates=$ans
1338290000Sglebius    ]
1339290000Sglebius)
1340290000Sglebiuscase "$ntp_cv_os_routeupdates" in
1341181834Sroberto yes)
1342290000Sglebius    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1343290000Sglebius	[need to recreate sockets on changed routing?])
1344181834Srobertoesac
1345181834Sroberto
1346290000SglebiusAC_CACHE_CHECK(
1347290000Sglebius    [if the wildcard socket needs REUSEADDR to bind other addresses],
1348290000Sglebius    [ntp_cv_os_wildcardreuse],
1349290000Sglebius    [
1350290000Sglebius	case "$host" in
1351290000Sglebius	 *-*-*linux*)
1352290000Sglebius	    ans=yes
1353290000Sglebius	    ;;
1354290000Sglebius	 *) ans=no
1355290000Sglebius	    ;;
1356290000Sglebius	esac
1357290000Sglebius	ntp_cv_os_wildcardreuse=$ans
1358290000Sglebius    ]
1359290000Sglebius)
1360290000Sglebiuscase "$ntp_cv_os_wildcardreuse" in
1361181834Sroberto yes)
1362290000Sglebius    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1363290000Sglebius	[wildcard socket needs REUSEADDR to bind interface addresses])
1364181834Srobertoesac
1365181834Sroberto
1366181834Srobertocase "$host" in
1367181834Sroberto *-*-aix*)
1368290000Sglebius    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1369290000Sglebius	[Might nlist() values require an extra level of indirection (AIX)?])
1370181834Srobertoesac
1371181834Sroberto
1372290000SglebiusAC_CACHE_CHECK(
1373290000Sglebius    [for a minimum recommended value of tickadj],
1374290000Sglebius    [ntp_cv_var_min_rec_tickadj],
1375290000Sglebius    [
1376290000Sglebius	ans=no
1377290000Sglebius	case "$host" in
1378290000Sglebius	 *-*-aix*)
1379290000Sglebius	    ans=40
1380290000Sglebius	    ;;
1381290000Sglebius	esac
1382290000Sglebius	ntp_cv_var_min_rec_tickadj=$ans
1383290000Sglebius    ]
1384290000Sglebius)
1385290000Sglebiuscase "$ntp_cv_var_min_rec_tickadj" in
1386290000Sglebius ''|no)
1387181834Sroberto    ;;
1388290000Sglebius *)
1389290000Sglebius    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1390290000Sglebius	[Should we recommend a minimum value for tickadj?])
1391181834Srobertoesac
1392290000Sglebius
1393290000SglebiusAC_CACHE_CHECK(
1394290000Sglebius    [if the TTY code permits PARENB and IGNPAR],
1395290000Sglebius    [ntp_cv_no_parenb_ignpar],
1396290000Sglebius    [
1397290000Sglebius	ans=no
1398290000Sglebius	case "$host" in
1399290000Sglebius	 i?86-*-*linux*)
1400290000Sglebius	    ans=yes
1401290000Sglebius	    ;;
1402290000Sglebius	 mips-sgi-irix*)
1403290000Sglebius	    ans=yes
1404290000Sglebius	    ;;
1405290000Sglebius	 i?86-*-freebsd[[123]].*)
1406290000Sglebius	    ;;
1407290000Sglebius	 i?86-*-freebsd*)
1408290000Sglebius	    ans=yes
1409290000Sglebius	    ;;
1410290000Sglebius	 *-*-unicosmp*)
1411290000Sglebius	    ans=yes
1412290000Sglebius	    ;;
1413290000Sglebius	esac
1414290000Sglebius	ntp_cv_no_parenb_ignpar=$ans
1415290000Sglebius    ]
1416290000Sglebius)
1417290000Sglebiuscase "$ntp_cv_no_parenb_ignpar" in
1418290000Sglebius yes)
1419290000Sglebius    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1420290000Sglebius	[Is there a problem using PARENB and IGNPAR?])
1421181834Srobertoesac
1422181834Sroberto
1423290000SglebiusAC_MSG_CHECKING([if we're including processing time debugging code])
1424290000SglebiusAC_ARG_ENABLE(
1425290000Sglebius    [debug-timing],
1426290000Sglebius    [AS_HELP_STRING(
1427290000Sglebius	[--enable-debug-timing],
1428290000Sglebius	[- include processing time debugging code (costs performance)]
1429290000Sglebius    )],
1430290000Sglebius    [ntp_ok=$enableval],
1431290000Sglebius    [ntp_ok=no]
1432290000Sglebius)
1433290000Sglebiuscase "$ntp_ok" in
1434290000Sglebius yes)
1435290000Sglebius    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1436181834Srobertoesac
1437290000SglebiusAC_MSG_RESULT([$ntp_ok])
1438181834Sroberto
1439290000SglebiusAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1440200576SrobertoAC_ARG_ENABLE(
1441290000Sglebius    [dst-minutes],
1442290000Sglebius    [AS_HELP_STRING(
1443200576Sroberto	[--enable-dst-minutes],
1444290000Sglebius	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1445290000Sglebius    ],
1446200576Sroberto    [ans=$enableval],
1447200576Sroberto    [ans=60]
1448200576Sroberto)
1449290000SglebiusAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1450290000Sglebius    [The number of minutes in a DST adjustment])
1451200576SrobertoAC_MSG_RESULT([$ans])
1452181834Sroberto
1453290000SglebiusAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1454200576SrobertoAC_ARG_ENABLE(
1455200576Sroberto    [ignore-dns-errors],
1456290000Sglebius    [AS_HELP_STRING(
1457290000Sglebius	[--enable-ignore-dns-errors],
1458200576Sroberto	[- retry DNS queries on any error]
1459290000Sglebius    )],
1460200576Sroberto    [ans=$enableval],
1461200576Sroberto    [ans=no]
1462200576Sroberto)
1463200576Srobertocase "$ans" in
1464200576Sroberto yes)
1465290000Sglebius    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1466290000Sglebius	[Retry queries on _any_ DNS error?])
1467200576Srobertoesac
1468200576SrobertoAC_MSG_RESULT([$ans])
1469200576Sroberto
1470290000SglebiusAC_CACHE_CHECK(
1471290000Sglebius    [availability of ntp_{adj,get}time()],
1472290000Sglebius    [ntp_cv_var_ntp_syscalls],
1473290000Sglebius    [
1474290000Sglebius	ntp_cv_var_ntp_syscalls=no
1475290000Sglebius	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1476290000Sglebius	 yesyes*)
1477290000Sglebius	    ntp_cv_var_ntp_syscalls=libc
1478181834Sroberto	    ;;
1479290000Sglebius	 *yes)
1480290000Sglebius	    ntp_cv_var_ntp_syscalls=inline
1481181834Sroberto	    ;;
1482290000Sglebius	 *)
1483290000Sglebius	    AC_PREPROC_IFELSE(
1484290000Sglebius		[AC_LANG_SOURCE(
1485290000Sglebius		    [
1486290000Sglebius			#include <sys/syscall.h>
1487290000Sglebius			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1488290000Sglebius			# error
1489290000Sglebius			#endif
1490290000Sglebius		    ])],
1491290000Sglebius		[ntp_cv_var_ntp_syscalls=kernel]
1492290000Sglebius	    )
1493181834Sroberto	    ;;
1494290000Sglebius	 esac
1495290000Sglebius    ]
1496290000Sglebius)
1497290000Sglebiuscase "$ntp_cv_var_ntp_syscalls" in
1498181834Sroberto libc)
1499290000Sglebius    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1500290000Sglebius	[Do we have ntp_{adj,get}time in libc?])
1501181834Sroberto    ;;
1502181834Sroberto kernel)
1503290000Sglebius    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1504290000Sglebius	[Do we have ntp_{adj,get}time in the kernel?])
1505181834Sroberto    ;;
1506181834Srobertoesac
1507181834Sroberto
1508290000SglebiusAC_CACHE_CHECK(
1509290000Sglebius    [if sys/timex.h has STA_FLL],
1510290000Sglebius    [ntp_cv_var_sta_fll],
1511290000Sglebius    [AC_PREPROC_IFELSE(
1512290000Sglebius	[AC_LANG_SOURCE(
1513290000Sglebius	    [
1514290000Sglebius		#include <sys/timex.h>
1515290000Sglebius		#ifndef STA_FLL
1516290000Sglebius		# error
1517290000Sglebius		#endif
1518290000Sglebius	    ])],
1519290000Sglebius	[ntp_cv_var_sta_fll=yes],
1520290000Sglebius	[ntp_cv_var_sta_fll=no]
1521290000Sglebius    )]
1522290000Sglebius)
1523181834Sroberto
1524290000SglebiusAC_CACHE_CHECK(
1525290000Sglebius    [if we have kernel PLL support],
1526290000Sglebius    [ntp_cv_var_kernel_pll],
1527290000Sglebius    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1528290000Sglebius	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1529290000Sglebius	 *no*)
1530290000Sglebius	    ntp_cv_var_kernel_pll=no
1531290000Sglebius	    ;;
1532290000Sglebius	 *) ntp_cv_var_kernel_pll=yes
1533290000Sglebius	    ;;
1534290000Sglebius	esac
1535290000Sglebius    ]
1536290000Sglebius)
1537290000Sglebiuscase "$ntp_cv_var_kernel_pll" in
1538181834Sroberto yes)
1539290000Sglebius    AC_DEFINE([KERNEL_PLL], [1],
1540290000Sglebius	[Does the kernel support precision time discipline?])
1541181834Srobertoesac
1542181834Sroberto
1543290000SglebiusAC_CACHE_CHECK(
1544290000Sglebius    [if SIOCGIFCONF returns buffer size in the buffer],
1545290000Sglebius    [ntp_cv_size_returned_in_buffer],
1546290000Sglebius    [
1547290000Sglebius	ans=no
1548290000Sglebius	case "$host" in
1549290000Sglebius	 *-fujitsu-uxp*)
1550290000Sglebius	    ans=yes
1551290000Sglebius	    ;;
1552290000Sglebius	 *-ncr-sysv4*)
1553290000Sglebius	    ans=yes
1554290000Sglebius	    ;;
1555290000Sglebius	 *-univel-sysv*)
1556290000Sglebius	    ans=yes
1557290000Sglebius	    ;;
1558290000Sglebius	esac
1559290000Sglebius	ntp_cv_size_returned_in_buffer=$ans
1560290000Sglebius    ]
1561290000Sglebius)
1562290000Sglebiuscase "$ntp_cv_size_returned_in_buffer" in
1563290000Sglebius yes)
1564290000Sglebius    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1565290000Sglebius	[Does SIOCGIFCONF return size in the buffer?])
1566181834Srobertoesac
1567181834Sroberto
1568181834Sroberto# Check for ioctls TIOCGPPSEV
1569290000SglebiusAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1570290000Sglebiuscase "$ac_cv_header_termios_h" in
1571290000Sglebius yes)
1572290000Sglebius    AC_PREPROC_IFELSE(
1573290000Sglebius	[AC_LANG_SOURCE([
1574290000Sglebius	    #include <termios.h>
1575290000Sglebius	    #ifndef TIOCGPPSEV
1576290000Sglebius	    # error
1577290000Sglebius	    #endif
1578290000Sglebius	])],
1579290000Sglebius	[ntp_ok=yes],
1580290000Sglebius	[ntp_ok=no]
1581290000Sglebius    )
1582290000Sglebius    ;;
1583290000Sglebius *)
1584290000Sglebius    ntp_ok=no
1585290000Sglebius    ;;
1586290000Sglebiusesac
1587290000Sglebiuscase "$ntp_ok" in
1588290000Sglebius yes)
1589290000Sglebius    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1590290000Sglebius	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1591290000Sglebiusesac
1592290000SglebiusAC_MSG_RESULT([$ntp_ok])
1593181834Sroberto
1594181834Sroberto# Check for ioctls TIOCSPPS
1595290000SglebiusAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1596290000Sglebiuscase "$ac_cv_header_termios_h" in
1597290000Sglebius yes)
1598290000Sglebius    AC_PREPROC_IFELSE(
1599290000Sglebius	[AC_LANG_SOURCE([
1600290000Sglebius	    #include <termios.h>
1601290000Sglebius	    #ifndef TIOCSPPS
1602290000Sglebius	    # error
1603290000Sglebius	    #endif
1604290000Sglebius	 ])],
1605290000Sglebius	 [ntp_ok=yes],
1606290000Sglebius	 [ntp_ok=no]
1607290000Sglebius    )
1608290000Sglebius    ;;
1609290000Sglebius *)
1610181834Sroberto    ntp_ok=no
1611290000Sglebius    ;;
1612290000Sglebiusesac
1613290000Sglebiuscase "$ntp_ok" in
1614290000Sglebius yes)
1615290000Sglebius    AC_DEFINE([HAVE_TIOCSPPS], [1],
1616290000Sglebius	[Do we have the TIOCSPPS ioctl (Solaris)?])
1617290000Sglebiusesac
1618290000SglebiusAC_MSG_RESULT([$ntp_ok])
1619181834Sroberto
1620181834Sroberto# Check for ioctls CIOGETEV
1621290000SglebiusAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1622290000Sglebiuscase "$ac_cv_header_sys_ppsclock_h" in
1623290000Sglebius yes)
1624290000Sglebius    AC_PREPROC_IFELSE(
1625290000Sglebius	[AC_LANG_SOURCE([
1626290000Sglebius	    #include <sys/ppsclock.h>
1627290000Sglebius	    #ifndef CIOGETEV
1628290000Sglebius	    # error
1629290000Sglebius	    #endif
1630290000Sglebius	])],
1631290000Sglebius	[ntp_ok=yes],
1632290000Sglebius	[ntp_ok=no]
1633290000Sglebius    )
1634290000Sglebius    ;;
1635290000Sglebius *)
1636290000Sglebius    ntp_ok=no
1637290000Sglebius    ;;
1638290000Sglebiusesac
1639290000Sglebiuscase "$ntp_ok" in
1640290000Sglebius yes)
1641290000Sglebius    AC_DEFINE([HAVE_CIOGETEV], [1],
1642290000Sglebius	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1643290000Sglebiusesac
1644290000SglebiusAC_MSG_RESULT([$ntp_ok])
1645181834Sroberto
1646181834Sroberto# ATOM/PPSAPI stuff.
1647181834Sroberto
1648290000Sglebiusntp_atom_ok=yes
1649181834Sroberto
1650181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1651181834Sroberto
1652181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1653181834Sroberto# The PPSAPI needs struct timespec.
1654181834Sroberto# The PPSAPI also needs a timepps header.
1655181834Sroberto
1656290000Sglebiuscase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1657181834Sroberto inlineyes)
1658181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1659181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1660181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1661290000Sglebius	ntp_jupiter_ok=yes
1662290000Sglebius	ntp_oncore_ok=yes
1663290000Sglebius	ntp_parse_ok=yes
1664290000Sglebius	ntp_ripe_ncc_ok=yes
1665181834Sroberto	;;
1666181834Sroberto    esac
1667181834Sroberto    ;;
1668181834Srobertoesac
1669181834Sroberto
1670181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1671290000SglebiusAC_CHECK_HEADER([linux/serial.h])
1672181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1673181834Sroberto  yesyes)
1674290000Sglebius    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1675290000Sglebius    AC_PREPROC_IFELSE(
1676290000Sglebius	[AC_LANG_SOURCE([
1677290000Sglebius	    #include <sys/time.h>
1678290000Sglebius	    typedef int u_int;
1679290000Sglebius	    #include <sys/ppsclock.h>
1680290000Sglebius	    #include <linux/serial.h>
1681181834Sroberto
1682290000Sglebius	    #ifndef TIOCGSERIAL
1683290000Sglebius	    # error
1684290000Sglebius	    #endif
1685290000Sglebius	    #ifndef TIOCSSERIAL
1686290000Sglebius	    # error
1687290000Sglebius	    #endif
1688290000Sglebius	    #ifndef ASYNC_PPS_CD_POS
1689290000Sglebius	    # error
1690290000Sglebius	    #endif
1691290000Sglebius	    #ifndef ASYNC_PPS_CD_NEG
1692290000Sglebius	    # error
1693290000Sglebius	    #endif
1694290000Sglebius	    #ifndef CIOGETEV
1695290000Sglebius	    # error
1696290000Sglebius	    #endif
1697290000Sglebius	])],
1698290000Sglebius	[ntp_ok=yes],
1699290000Sglebius	[ntp_ok=no]
1700290000Sglebius    )
1701290000Sglebius    AC_MSG_RESULT([$ntp_ok])
1702290000Sglebius    ;;
1703181834Sroberto  *)
1704290000Sglebius    ntp_ok=no
1705290000Sglebius    ;;
1706181834Srobertoesac
1707290000Sglebiuscase "$ntp_ok" in
1708290000Sglebius yes)
1709290000Sglebius    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1710290000Sglebius	[Do we have the TIO serial stuff?])
1711290000Sglebiusesac
1712181834Sroberto
1713181834Sroberto# Check for SHMEM_STATUS support
1714200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1715181834Srobertocase "$ac_cv_header_sys_mman_h" in
1716290000Sglebius yes)
1717290000Sglebius    ntp_ok=yes
1718290000Sglebius    ;;
1719290000Sglebius *)
1720290000Sglebius    ntp_ok=no
1721290000Sglebius    ;;
1722181834Srobertoesac
1723290000Sglebiuscase "$ntp_ok" in
1724290000Sglebius yes)
1725290000Sglebius    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1726290000Sglebius	[Do we have support for SHMEM_STATUS?])
1727290000Sglebiusesac
1728290000SglebiusAC_MSG_RESULT([$ntp_ok])
1729181834Sroberto
1730181834Srobertontp_refclock=no
1731181834Sroberto
1732181834Sroberto# HPUX only, and by explicit request
1733200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1734290000SglebiusAC_ARG_ENABLE(
1735290000Sglebius    [BANCOMM],
1736290000Sglebius    [AS_HELP_STRING(
1737290000Sglebius	[--enable-BANCOMM],
1738290000Sglebius	[- Datum/Bancomm bc635/VME interface]
1739290000Sglebius    )],
1740290000Sglebius    [ntp_ok=$enableval],
1741290000Sglebius    [ntp_ok=no]
1742290000Sglebius)
1743290000Sglebiuscase "$ntp_ok" in
1744290000Sglebius yes)
1745181834Sroberto    ntp_refclock=yes
1746290000Sglebius    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1747290000Sglebius    ;;
1748290000Sglebiusesac
1749290000SglebiusAC_MSG_RESULT([$ntp_ok])
1750181834Srobertocase "$ntp_ok$host" in
1751181834Sroberto yes*-*-hpux*) ;;
1752200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1753181834Srobertoesac
1754181834Sroberto
1755181834Sroberto#HPUX only, and only by explicit request
1756200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1757290000SglebiusAC_ARG_ENABLE(
1758290000Sglebius    [GPSVME],
1759290000Sglebius    [AS_HELP_STRING(
1760290000Sglebius	[--enable-GPSVME],
1761290000Sglebius	[- TrueTime GPS receiver/VME interface]
1762290000Sglebius    )],
1763290000Sglebius    [ntp_ok=$enableval],
1764290000Sglebius    [ntp_ok=no]
1765290000Sglebius)
1766290000Sglebiuscase "$ntp_ok" in
1767290000Sglebius yes)
1768181834Sroberto    ntp_refclock=yes
1769290000Sglebius    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1770290000Sglebius    ;;
1771290000Sglebiusesac
1772290000SglebiusAC_MSG_RESULT([$ntp_ok])
1773181834Srobertocase "$ntp_ok$host" in
1774181834Sroberto yes*-*-hpux*) ;;
1775200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1776181834Srobertoesac
1777181834Sroberto
1778200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1779181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1780181834Sroberto yesyesyes)
1781290000Sglebius    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1782181834Sroberto    ans=yes
1783181834Sroberto    ;;
1784181834Sroberto *)
1785181834Sroberto    ans=no
1786181834Sroberto    ;;
1787181834Srobertoesac
1788200576SrobertoAC_MSG_RESULT([$ans])
1789181834Sroberto
1790200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1791290000SglebiusAC_ARG_ENABLE(
1792290000Sglebius    [all-clocks],
1793290000Sglebius    [AS_HELP_STRING(
1794290000Sglebius	[--enable-all-clocks],
1795290000Sglebius	[+ include all suitable non-PARSE clocks:]
1796290000Sglebius    )],
1797290000Sglebius    [ntp_eac=$enableval],
1798290000Sglebius    [ntp_eac=yes]
1799290000Sglebius)
1800290000SglebiusAC_MSG_RESULT([$ntp_eac])
1801181834Sroberto
1802290000Sglebius# HMS: Should we also require ntp_parse_ok?
1803200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1804290000Sglebiuscase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1805181834Sroberto yes*yes*)
1806181834Sroberto    ntp_canparse=yes
1807181834Sroberto    ;;
1808181834Sroberto *) ntp_canparse=no
1809181834Sroberto    ;;
1810181834Srobertoesac
1811290000SglebiusAC_MSG_RESULT([$ntp_canparse])
1812181834Sroberto
1813181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1814181834Srobertocase "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
1815181834Sroberto *yes*)
1816181834Sroberto    ntp_canaudio=yes
1817290000Sglebius    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1818181834Sroberto    ;;
1819181834Sroberto *) ntp_canaudio=no ;;
1820181834Srobertoesac
1821290000SglebiusAC_MSG_RESULT([$ntp_canaudio])
1822181834Sroberto
1823181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1824181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1825181834Sroberto yesyes)
1826181834Sroberto    ntp_canshm=yes
1827181834Sroberto    ;;
1828181834Sroberto *) ntp_canshm=no ;;
1829181834Srobertoesac
1830290000SglebiusAC_MSG_RESULT([$ntp_canshm])
1831181834Sroberto
1832290000Sglebius# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1833290000SglebiusAC_CACHE_CHECK(
1834290000Sglebius    [for termios modem control],
1835290000Sglebius    [ntp_cv_modem_control],
1836290000Sglebius    [AC_COMPILE_IFELSE(
1837290000Sglebius	[AC_LANG_PROGRAM(
1838290000Sglebius	    [[
1839290000Sglebius		#ifdef HAVE_UNISTD_H
1840290000Sglebius		# include <unistd.h>
1841290000Sglebius		#endif
1842290000Sglebius		#ifdef HAVE_TERMIOS_H
1843290000Sglebius		# include <termios.h>
1844290000Sglebius		#endif
1845290000Sglebius		#ifdef HAVE_SYS_IOCTL_H
1846290000Sglebius		# include <sys/ioctl.h>
1847290000Sglebius		#endif
1848290000Sglebius	    ]],
1849290000Sglebius	    [[
1850290000Sglebius		int	dtr = TIOCM_DTR;
1851290000Sglebius
1852290000Sglebius		ioctl(1, TIOCMBIS, (char *)&dtr);
1853290000Sglebius	    ]]
1854290000Sglebius	)],
1855290000Sglebius	[ntp_cv_modem_control=yes],
1856290000Sglebius	[ntp_cv_modem_control=no]
1857290000Sglebius    )]
1858290000Sglebius)
1859290000Sglebiuscase "$ntp_eac::$ntp_cv_modem_control" in
1860290000Sglebius yes::yes)
1861290000Sglebius    ntp_enable_all_modem_control_clocks=yes
1862290000Sglebius    ;;
1863290000Sglebius *)
1864290000Sglebius    ntp_enable_all_modem_control_clocks=no
1865290000Sglebius    ;;
1866290000Sglebiusesac
1867290000Sglebius
1868181834Sroberto# Requires modem control
1869200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1870290000SglebiusAC_ARG_ENABLE(
1871290000Sglebius    [ACTS],
1872290000Sglebius    [AS_HELP_STRING(
1873290000Sglebius	[--enable-ACTS],
1874290000Sglebius	[s ACTS modem service]
1875290000Sglebius    )],
1876181834Sroberto    [ntp_ok=$enableval],
1877290000Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1878290000Sglebius)
1879290000Sglebiuscase "$ntp_ok" in
1880290000Sglebius yes)
1881181834Sroberto    ntp_refclock=yes
1882290000Sglebius    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1883290000Sglebius    ;;
1884290000Sglebiusesac
1885290000SglebiusAC_MSG_RESULT([$ntp_ok])
1886181834Sroberto
1887200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1888290000SglebiusAC_ARG_ENABLE(
1889290000Sglebius    [ARBITER],
1890290000Sglebius    [AS_HELP_STRING(
1891290000Sglebius	[--enable-ARBITER],
1892290000Sglebius	[+ Arbiter 1088A/B GPS receiver]
1893290000Sglebius    )],
1894290000Sglebius    [ntp_ok=$enableval],
1895290000Sglebius    [ntp_ok=$ntp_eac]
1896290000Sglebius)
1897290000Sglebiuscase "$ntp_ok" in
1898290000Sglebius yes)
1899181834Sroberto    ntp_refclock=yes
1900290000Sglebius    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1901290000Sglebius    ;;
1902290000Sglebiusesac
1903290000SglebiusAC_MSG_RESULT([$ntp_ok])
1904181834Sroberto
1905200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1906290000SglebiusAC_ARG_ENABLE(
1907290000Sglebius    [ARCRON_MSF],
1908290000Sglebius    [AS_HELP_STRING(
1909290000Sglebius	[--enable-ARCRON-MSF],
1910290000Sglebius	[+ Arcron MSF receiver]
1911290000Sglebius    )],
1912290000Sglebius    [ntp_ok=$enableval],
1913290000Sglebius    [ntp_ok=$ntp_eac]
1914290000Sglebius)
1915290000Sglebiuscase "$ntp_ok" in
1916290000Sglebius yes)
1917181834Sroberto    ntp_refclock=yes
1918290000Sglebius    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1919290000Sglebius    ;;
1920290000Sglebiusesac
1921290000SglebiusAC_MSG_RESULT([$ntp_ok])
1922181834Sroberto
1923200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1924290000SglebiusAC_ARG_ENABLE(
1925290000Sglebius    [AS2201],
1926290000Sglebius    [AS_HELP_STRING(
1927290000Sglebius	[--enable-AS2201],
1928290000Sglebius	[+ Austron 2200A/2201A GPS receiver]
1929290000Sglebius    )],
1930290000Sglebius    [ntp_ok=$enableval],
1931290000Sglebius    [ntp_ok=$ntp_eac]
1932290000Sglebius)
1933290000Sglebiuscase "$ntp_ok" in
1934290000Sglebius yes)
1935181834Sroberto    ntp_refclock=yes
1936290000Sglebius    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1937290000Sglebius    ;;
1938290000Sglebiusesac
1939290000SglebiusAC_MSG_RESULT([$ntp_ok])
1940181834Sroberto
1941200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1942290000SglebiusAC_ARG_ENABLE(
1943290000Sglebius    [ATOM],
1944290000Sglebius    [AS_HELP_STRING(
1945290000Sglebius	[--enable-ATOM],
1946290000Sglebius	[s ATOM PPS interface]
1947290000Sglebius    )],
1948290000Sglebius    [ntp_ok=$enableval],
1949290000Sglebius    [ntp_ok=$ntp_eac]
1950290000Sglebius)
1951290000Sglebiuscase "$ntp_atom_ok" in
1952181834Sroberto no) ntp_ok=no ;;
1953181834Srobertoesac
1954290000Sglebiuscase "$ntp_ok" in
1955290000Sglebius yes)
1956181834Sroberto    ntp_refclock=yes
1957290000Sglebius    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1958290000Sglebius    ;;
1959290000Sglebiusesac
1960290000SglebiusAC_MSG_RESULT([$ntp_ok])
1961181834Sroberto
1962200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1963290000SglebiusAC_ARG_ENABLE(
1964290000Sglebius    [CHRONOLOG],
1965290000Sglebius    [AS_HELP_STRING(
1966290000Sglebius	[--enable-CHRONOLOG],
1967290000Sglebius	[+ Chrono-log K-series WWVB receiver]
1968290000Sglebius    )],
1969290000Sglebius    [ntp_ok=$enableval],
1970290000Sglebius    [ntp_ok=$ntp_eac]
1971290000Sglebius)
1972290000Sglebiuscase "$ntp_ok" in
1973290000Sglebius yes)
1974181834Sroberto    ntp_refclock=yes
1975290000Sglebius    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1976290000Sglebius    ;;
1977290000Sglebiusesac
1978290000SglebiusAC_MSG_RESULT([$ntp_ok])
1979181834Sroberto
1980200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1981290000SglebiusAC_ARG_ENABLE(
1982290000Sglebius    [CHU],
1983290000Sglebius    [AS_HELP_STRING(
1984290000Sglebius	[--enable-CHU],
1985290000Sglebius	[+ CHU modem/decoder]
1986290000Sglebius    )],
1987290000Sglebius    [ntp_ok=$enableval],
1988290000Sglebius    [ntp_ok=$ntp_eac]
1989290000Sglebius)
1990290000Sglebiuscase "$ntp_ok" in
1991290000Sglebius yes)
1992181834Sroberto    ntp_refclock=yes
1993290000Sglebius    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1994290000Sglebius    ;;
1995290000Sglebiusesac
1996290000SglebiusAC_MSG_RESULT([$ntp_ok])
1997290000Sglebiusntp_refclock_chu=$ntp_ok
1998181834Sroberto
1999200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2000290000SglebiusAC_ARG_ENABLE(
2001290000Sglebius    [AUDIO-CHU],
2002290000Sglebius    [AS_HELP_STRING(
2003290000Sglebius	[--enable-AUDIO-CHU],
2004290000Sglebius	[s CHU audio/decoder]
2005290000Sglebius    )],
2006181834Sroberto    [ntp_ok=$enableval],
2007290000Sglebius    [
2008290000Sglebius	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2009290000Sglebius	 *no*)	ntp_ok=no  ;;
2010290000Sglebius	 *)	ntp_ok=yes ;;
2011290000Sglebius	esac
2012290000Sglebius    ]
2013290000Sglebius)
2014290000SglebiusAC_MSG_RESULT([$ntp_ok])
2015181834Sroberto# We used to check for sunos/solaris target...
2016290000Sglebiuscase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2017290000Sglebius yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2018181834Srobertoesac
2019181834Sroberto
2020181834Sroberto# Not under HP-UX
2021200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2022290000SglebiusAC_ARG_ENABLE(
2023290000Sglebius    [DATUM],
2024290000Sglebius    [AS_HELP_STRING(
2025290000Sglebius	[--enable-DATUM],
2026290000Sglebius	[s Datum Programmable Time System]
2027290000Sglebius    )],
2028181834Sroberto    [ntp_ok=$enableval],
2029290000Sglebius    [
2030290000Sglebius	case "$ac_cv_header_termios_h" in
2031290000Sglebius	 yes)
2032290000Sglebius	    ntp_ok=$ntp_eac
2033290000Sglebius	    ;;
2034290000Sglebius	 *) ntp_ok=no
2035290000Sglebius	    ;;
2036290000Sglebius	esac
2037290000Sglebius    ]
2038290000Sglebius)
2039290000Sglebiuscase "$ntp_ok" in
2040290000Sglebius yes)
2041181834Sroberto    ntp_refclock=yes
2042290000Sglebius    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2043290000Sglebius    ;;
2044290000Sglebiusesac
2045290000SglebiusAC_MSG_RESULT([$ntp_ok])
2046181834Sroberto
2047200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2048290000SglebiusAC_ARG_ENABLE(
2049290000Sglebius    [DUMBCLOCK],
2050290000Sglebius    [AS_HELP_STRING(
2051290000Sglebius	[--enable-DUMBCLOCK],
2052290000Sglebius	[+ Dumb generic hh:mm:ss local clock]
2053290000Sglebius    )],
2054290000Sglebius    [ntp_ok=$enableval],
2055290000Sglebius    [ntp_ok=$ntp_eac]
2056290000Sglebius)
2057290000Sglebiuscase "$ntp_ok" in
2058290000Sglebius yes)
2059181834Sroberto    ntp_refclock=yes
2060290000Sglebius    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2061290000Sglebius    ;;
2062290000Sglebiusesac
2063290000SglebiusAC_MSG_RESULT([$ntp_ok])
2064181834Sroberto
2065200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2066290000SglebiusAC_ARG_ENABLE(
2067290000Sglebius    [FG],
2068290000Sglebius    [AS_HELP_STRING(
2069290000Sglebius	[--enable-FG],
2070290000Sglebius	[+ Forum Graphic GPS]
2071290000Sglebius    )],
2072290000Sglebius    [ntp_ok=$enableval],
2073290000Sglebius    [ntp_ok=$ntp_eac]
2074290000Sglebius)
2075290000Sglebiuscase "$ntp_ok" in
2076290000Sglebius yes)
2077181834Sroberto    ntp_refclock=yes
2078290000Sglebius    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2079290000Sglebius    ;;
2080290000Sglebiusesac
2081290000SglebiusAC_MSG_RESULT([$ntp_ok])
2082181834Sroberto
2083181834Sroberto# Requires modem control
2084200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2085290000SglebiusAC_ARG_ENABLE(
2086290000Sglebius    [HEATH],
2087290000Sglebius    [AS_HELP_STRING(
2088290000Sglebius	[--enable-HEATH],
2089290000Sglebius	[s Heath GC-1000 WWV/WWVH receiver]
2090290000Sglebius    )],
2091181834Sroberto    [ntp_ok=$enableval],
2092290000Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2093290000Sglebius)
2094290000Sglebiuscase "$ntp_ok" in
2095290000Sglebius yes)
2096181834Sroberto    ntp_refclock=yes
2097290000Sglebius    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2098290000Sglebius    ;;
2099290000Sglebiusesac
2100290000SglebiusAC_MSG_RESULT([$ntp_ok])
2101181834Sroberto
2102200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2103290000SglebiusAC_ARG_ENABLE(
2104290000Sglebius    [HOPFSERIAL],
2105290000Sglebius    [AS_HELP_STRING(
2106290000Sglebius	[--enable-HOPFSERIAL],
2107290000Sglebius	[+ hopf serial clock device]
2108290000Sglebius    )],
2109290000Sglebius    [ntp_ok=$enableval],
2110290000Sglebius    [ntp_ok=$ntp_eac]
2111290000Sglebius)
2112290000Sglebiuscase "$ntp_ok" in
2113290000Sglebius yes)
2114181834Sroberto    ntp_refclock=yes
2115290000Sglebius    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2116290000Sglebius    ;;
2117290000Sglebiusesac
2118290000SglebiusAC_MSG_RESULT([$ntp_ok])
2119181834Sroberto
2120200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2121290000SglebiusAC_ARG_ENABLE(
2122290000Sglebius    [HOPFPCI],
2123290000Sglebius    [AS_HELP_STRING(
2124290000Sglebius	[--enable-HOPFPCI],
2125290000Sglebius	[+ hopf 6039 PCI board]
2126290000Sglebius    )],
2127290000Sglebius    [ntp_ok=$enableval],
2128290000Sglebius    [ntp_ok=$ntp_eac]
2129290000Sglebius)
2130290000Sglebiuscase "$ntp_ok" in
2131290000Sglebius yes)
2132181834Sroberto    ntp_refclock=yes
2133290000Sglebius    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2134290000Sglebius    ;;
2135290000Sglebiusesac
2136290000SglebiusAC_MSG_RESULT([$ntp_ok])
2137181834Sroberto
2138200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2139290000SglebiusAC_ARG_ENABLE(
2140290000Sglebius    [HPGPS],
2141290000Sglebius    [AS_HELP_STRING(
2142290000Sglebius	[--enable-HPGPS],
2143290000Sglebius	[+ HP 58503A GPS receiver]
2144290000Sglebius    )],
2145290000Sglebius    [ntp_ok=$enableval],
2146290000Sglebius    [ntp_ok=$ntp_eac]
2147290000Sglebius)
2148290000Sglebiuscase "$ntp_ok" in
2149290000Sglebius yes)
2150181834Sroberto    ntp_refclock=yes
2151290000Sglebius    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2152290000Sglebius    ;;
2153290000Sglebiusesac
2154290000SglebiusAC_MSG_RESULT([$ntp_ok])
2155181834Sroberto
2156200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2157290000SglebiusAC_ARG_ENABLE(
2158290000Sglebius    [IRIG],
2159290000Sglebius    [AS_HELP_STRING(
2160290000Sglebius	[--enable-IRIG],
2161290000Sglebius	[s IRIG audio decoder]
2162290000Sglebius    )],
2163181834Sroberto    [ntp_ok=$enableval],
2164290000Sglebius    [
2165290000Sglebius	case "$ntp_eac$ntp_canaudio" in
2166290000Sglebius	 *no*)	ntp_ok=no  ;;
2167290000Sglebius	 *)	ntp_ok=yes ;;
2168290000Sglebius	esac
2169290000Sglebius    ]
2170290000Sglebius)
2171290000Sglebiuscase "$ntp_ok" in
2172290000Sglebius yes)
2173181834Sroberto    ntp_refclock=yes
2174290000Sglebius    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2175290000Sglebius    ;;
2176290000Sglebiusesac
2177290000SglebiusAC_MSG_RESULT([$ntp_ok])
2178181834Srobertocase "$ntp_ok$ntp_canaudio" in
2179290000Sglebius yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2180181834Srobertoesac
2181181834Sroberto
2182200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2183290000SglebiusAC_ARG_ENABLE(
2184290000Sglebius    [JJY],
2185290000Sglebius    [AS_HELP_STRING(
2186290000Sglebius	[--enable-JJY],
2187290000Sglebius	[+ JJY receiver]
2188290000Sglebius    )],
2189290000Sglebius    [ntp_ok=$enableval],
2190290000Sglebius    [ntp_ok=$ntp_eac]
2191290000Sglebius)
2192290000Sglebiuscase "$ntp_ok" in
2193290000Sglebius yes)
2194181834Sroberto    ntp_refclock=yes
2195290000Sglebius    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2196290000Sglebius    ;;
2197290000Sglebiusesac
2198290000SglebiusAC_MSG_RESULT([$ntp_ok])
2199181834Sroberto
2200200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2201290000SglebiusAC_ARG_ENABLE(
2202290000Sglebius    [JUPITER],
2203290000Sglebius    [AS_HELP_STRING(
2204290000Sglebius	[--enable-JUPITER],
2205290000Sglebius	[s Rockwell Jupiter GPS receiver]
2206290000Sglebius    )],
2207181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2208290000Sglebiuscase "$ntp_jupiter_ok" in
2209181834Sroberto no) ntp_ok=no ;;
2210181834Srobertoesac
2211290000Sglebiuscase "$ntp_ok" in
2212290000Sglebius yes)
2213181834Sroberto    ntp_refclock=yes
2214290000Sglebius    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2215290000Sglebius    ;;
2216290000Sglebiusesac
2217290000SglebiusAC_MSG_RESULT([$ntp_ok])
2218181834Sroberto
2219200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2220290000SglebiusAC_ARG_ENABLE(
2221290000Sglebius    [LEITCH],
2222290000Sglebius    [AS_HELP_STRING(
2223290000Sglebius	[--enable-LEITCH],
2224290000Sglebius	[+ Leitch CSD 5300 Master Clock System Driver]
2225290000Sglebius    )],
2226290000Sglebius    [ntp_ok=$enableval],
2227290000Sglebius    [ntp_ok=$ntp_eac]
2228290000Sglebius)
2229290000Sglebiuscase "$ntp_ok" in
2230290000Sglebius yes)
2231181834Sroberto    ntp_refclock=yes
2232290000Sglebius    AC_DEFINE([CLOCK_LEITCH], [1],
2233290000Sglebius	[Leitch CSD 5300 Master Clock System Driver?])
2234290000Sglebius    ;;
2235290000Sglebiusesac
2236290000SglebiusAC_MSG_RESULT([$ntp_ok])
2237181834Sroberto
2238200576SrobertoAC_MSG_CHECKING([local clock reference])
2239290000SglebiusAC_ARG_ENABLE(
2240290000Sglebius    [LOCAL-CLOCK],
2241290000Sglebius    [AS_HELP_STRING(
2242290000Sglebius	[--enable-LOCAL-CLOCK],
2243290000Sglebius	[+ local clock reference]
2244290000Sglebius    )],
2245290000Sglebius    [ntp_ok=$enableval],
2246290000Sglebius    [ntp_ok=$ntp_eac]
2247290000Sglebius)
2248290000Sglebiuscase "$ntp_ok" in
2249290000Sglebius yes)
2250181834Sroberto    ntp_refclock=yes
2251290000Sglebius    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2252290000Sglebius    ;;
2253290000Sglebiusesac
2254290000SglebiusAC_MSG_RESULT([$ntp_ok])
2255181834Sroberto
2256181834Srobertodnl Bug 340: longstanding unfixed bugs
2257290000Sglebiusdnl AC_MSG_CHECKING([EES M201 MSF receiver])
2258290000Sglebiusdnl AC_ARG_ENABLE([MSFEES],
2259290000Sglebiusdnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2260181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2261181834Srobertodnl if test "$ntp_ok" = "yes"; then
2262181834Srobertodnl     ntp_refclock=yes
2263290000Sglebiusdnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2264181834Srobertodnl fi
2265290000Sglebiusdnl AC_MSG_RESULT([$ntp_ok])
2266181834Sroberto
2267181834Sroberto# Not Ultrix
2268200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2269290000SglebiusAC_ARG_ENABLE(
2270290000Sglebius    [MX4200],
2271290000Sglebius    [AS_HELP_STRING(
2272290000Sglebius	[--enable-MX4200 ],
2273290000Sglebius	[s Magnavox MX4200 GPS receiver]
2274290000Sglebius    )],
2275181834Sroberto    [ntp_ok=$enableval],
2276290000Sglebius    [
2277290000Sglebius	case "$ac_cv_var_ppsclock" in
2278290000Sglebius	 yes)
2279290000Sglebius	    ntp_ok=$ntp_eac
2280290000Sglebius	    ;;
2281290000Sglebius	 *)
2282290000Sglebius	    ntp_ok=no
2283290000Sglebius	    ;;
2284290000Sglebius	esac
2285290000Sglebius    ]
2286290000Sglebius)
2287290000Sglebiuscase "$ntp_ok" in
2288290000Sglebius yes)
2289181834Sroberto    ntp_refclock=yes
2290290000Sglebius    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2291290000Sglebius    ;;
2292290000Sglebiusesac
2293290000SglebiusAC_MSG_RESULT([$ntp_ok])
2294181834Srobertocase "$ntp_ok$host" in
2295290000Sglebius yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2296181834Srobertoesac
2297181834Sroberto
2298200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2299290000SglebiusAC_ARG_ENABLE(
2300290000Sglebius    [NEOCLOCK4X],
2301290000Sglebius    [AS_HELP_STRING(
2302290000Sglebius	[--enable-NEOCLOCK4X],
2303290000Sglebius	[+ NeoClock4X DCF77 / TDF receiver]
2304290000Sglebius    )],
2305290000Sglebius    [ntp_ok=$enableval],
2306290000Sglebius    [ntp_ok=$ntp_eac]
2307290000Sglebius)
2308290000Sglebiuscase "$ntp_ok" in
2309290000Sglebius yes)
2310181834Sroberto    ntp_refclock=yes
2311290000Sglebius    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2312290000Sglebius    ;;
2313290000Sglebiusesac
2314290000SglebiusAC_MSG_RESULT([$ntp_ok])
2315181834Sroberto
2316200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2317290000SglebiusAC_ARG_ENABLE(
2318290000Sglebius    [NMEA],
2319290000Sglebius    [AS_HELP_STRING(
2320290000Sglebius	[--enable-NMEA],
2321290000Sglebius	[+ NMEA GPS receiver]
2322290000Sglebius    )],
2323290000Sglebius    [ntp_ok=$enableval],
2324290000Sglebius    [ntp_ok=$ntp_eac]
2325290000Sglebius)
2326290000Sglebiuscase "$ntp_ok" in
2327290000Sglebius yes)
2328181834Sroberto    ntp_refclock=yes
2329290000Sglebius    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2330290000Sglebius    ;;
2331290000Sglebiusesac
2332290000SglebiusAC_MSG_RESULT([$ntp_ok])
2333181834Sroberto
2334290000SglebiusAC_CHECK_FUNCS([strtoll])
2335290000SglebiusAC_MSG_CHECKING([for GPSD JSON receiver])
2336290000SglebiusAC_ARG_ENABLE(
2337290000Sglebius    [GPSD],
2338290000Sglebius    [AS_HELP_STRING(
2339290000Sglebius	[--enable-GPSD],
2340290000Sglebius	[+ GPSD JSON receiver]
2341290000Sglebius    )],
2342290000Sglebius    [ntp_ok=$enableval],
2343290000Sglebius    [case "$ac_cv_func_strtoll" in
2344290000Sglebius     yes) ntp_ok=$ntp_eac ;;
2345290000Sglebius     *)   ntp_ok="no" ;;
2346290000Sglebius    esac]
2347290000Sglebius)
2348290000Sglebiuscase "$ntp_ok" in
2349290000Sglebius yes)
2350290000Sglebius    ntp_refclock=yes
2351290000Sglebius    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2352290000Sglebius    ;;
2353290000Sglebiusesac
2354290000SglebiusAC_MSG_RESULT([$ntp_ok])
2355290000Sglebius
2356200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2357290000SglebiusAC_ARG_ENABLE(
2358290000Sglebius    [ONCORE],
2359290000Sglebius    [AS_HELP_STRING(
2360290000Sglebius	[--enable-ONCORE],
2361290000Sglebius	[s Motorola VP/UT Oncore GPS receiver]
2362290000Sglebius    )],
2363290000Sglebius    [ntp_ok=$enableval],
2364290000Sglebius    [ntp_ok=$ntp_eac]
2365290000Sglebius)
2366290000Sglebiuscase "$ntp_oncore_ok" in
2367181834Sroberto no) ntp_ok=no ;;
2368181834Srobertoesac
2369290000Sglebiuscase "$ntp_ok" in
2370290000Sglebius yes)
2371181834Sroberto    ntp_refclock=yes
2372290000Sglebius    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2373290000Sglebius    ;;
2374290000Sglebiusesac
2375290000SglebiusAC_MSG_RESULT([$ntp_ok])
2376181834Sroberto
2377290000Sglebius# Requires modem control
2378200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2379290000SglebiusAC_ARG_ENABLE(
2380290000Sglebius    [PALISADE],
2381290000Sglebius    [AS_HELP_STRING(
2382290000Sglebius	[--enable-PALISADE],
2383290000Sglebius	[s Palisade clock]
2384290000Sglebius    )],
2385181834Sroberto    [ntp_ok=$enableval],
2386290000Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2387290000Sglebius)
2388290000Sglebiuscase "$ntp_ok" in
2389290000Sglebius yes)
2390181834Sroberto    ntp_refclock=yes
2391290000Sglebius    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2392290000Sglebius    ;;
2393290000Sglebiusesac
2394290000SglebiusAC_MSG_RESULT([$ntp_ok])
2395181834Sroberto
2396200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2397290000SglebiusAC_ARG_ENABLE(
2398290000Sglebius    [PCF],
2399290000Sglebius    [AS_HELP_STRING(
2400290000Sglebius	[--enable-PCF ],
2401290000Sglebius	[+ Conrad parallel port radio clock]
2402290000Sglebius    )],
2403290000Sglebius    [ntp_ok=$enableval],
2404290000Sglebius    [ntp_ok=$ntp_eac]
2405290000Sglebius)
2406290000Sglebiuscase "$ntp_ok" in
2407290000Sglebius yes)
2408181834Sroberto    ntp_refclock=yes
2409290000Sglebius    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2410290000Sglebius    ;;
2411290000Sglebiusesac
2412290000SglebiusAC_MSG_RESULT([$ntp_ok])
2413181834Sroberto
2414200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2415290000SglebiusAC_ARG_ENABLE(
2416290000Sglebius    [PST],
2417290000Sglebius    [AS_HELP_STRING(
2418290000Sglebius	[--enable-PST],
2419290000Sglebius	[+ PST/Traconex 1020 WWV/WWVH receiver]
2420290000Sglebius    )],
2421290000Sglebius    [ntp_ok=$enableval],
2422290000Sglebius    [ntp_ok=$ntp_eac]
2423290000Sglebius)
2424290000Sglebiuscase "$ntp_ok" in
2425290000Sglebius yes)
2426181834Sroberto    ntp_refclock=yes
2427290000Sglebius    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2428290000Sglebius    ;;
2429290000Sglebiusesac
2430290000SglebiusAC_MSG_RESULT([$ntp_ok])
2431181834Sroberto
2432200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2433290000SglebiusAC_ARG_ENABLE(
2434290000Sglebius    [RIPENCC],
2435290000Sglebius    [AS_HELP_STRING(
2436290000Sglebius	[--enable-RIPENCC],
2437290000Sglebius	[- RIPENCC specific Trimble driver]
2438290000Sglebius    )],
2439290000Sglebius    [ntp_ok=$enableval],
2440290000Sglebius    [ntp_ok=no]
2441290000Sglebius)
2442181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2443290000Sglebiuscase "$ntp_ripe_ncc_ok" in
2444181834Sroberto no) ntp_ok=no ;;
2445181834Srobertoesac
2446290000Sglebiuscase "$ntp_ok" in
2447290000Sglebius yes)
2448181834Sroberto    ntp_refclock=yes
2449290000Sglebius    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2450290000Sglebius    ;;
2451290000Sglebiusesac
2452290000SglebiusAC_MSG_RESULT([$ntp_ok])
2453181834Sroberto
2454181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2455181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2456200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2457290000SglebiusAC_ARG_ENABLE(
2458290000Sglebius    [SHM],
2459290000Sglebius    [AS_HELP_STRING(
2460290000Sglebius	[--enable-SHM],
2461290000Sglebius	[s SHM clock attached thru shared memory]
2462290000Sglebius    )],
2463181834Sroberto    [ntp_ok=$enableval],
2464290000Sglebius    [
2465290000Sglebius	case "$ntp_eac$ntp_canshm" in
2466290000Sglebius	 *no*)	ntp_ok=no  ;;
2467290000Sglebius	 *)	ntp_ok=yes ;;
2468290000Sglebius	esac
2469290000Sglebius    ]
2470290000Sglebius)
2471290000Sglebiuscase "$ntp_ok" in
2472290000Sglebius yes)
2473181834Sroberto    ntp_refclock=yes
2474290000Sglebius    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2475290000Sglebius    ;;
2476290000Sglebiusesac
2477290000SglebiusAC_MSG_RESULT([$ntp_ok])
2478181834Sroberto
2479200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2480290000SglebiusAC_ARG_ENABLE(
2481290000Sglebius    [SPECTRACOM],
2482290000Sglebius    [AS_HELP_STRING(
2483290000Sglebius	[--enable-SPECTRACOM],
2484290000Sglebius	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2485290000Sglebius    )],
2486290000Sglebius    [ntp_ok=$enableval],
2487290000Sglebius    [ntp_ok=$ntp_eac]
2488290000Sglebius)
2489290000Sglebiuscase "$ntp_ok" in
2490290000Sglebius yes)
2491181834Sroberto    ntp_refclock=yes
2492290000Sglebius    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2493290000Sglebius	[Spectracom 8170/Netclock/2 WWVB receiver])
2494290000Sglebius    ;;
2495290000Sglebiusesac
2496290000SglebiusAC_MSG_RESULT([$ntp_ok])
2497181834Sroberto
2498200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2499290000SglebiusAC_ARG_ENABLE(
2500290000Sglebius    [TPRO],
2501290000Sglebius    [AS_HELP_STRING(
2502290000Sglebius	[--enable-TPRO],
2503290000Sglebius	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2504290000Sglebius    )],
2505181834Sroberto    [ntp_ok=$enableval],
2506290000Sglebius    [
2507290000Sglebius	case "$ac_cv_header_sys_tpro_h" in
2508290000Sglebius	 yes)
2509290000Sglebius	    ntp_ok=$ntp_eac
2510290000Sglebius	    ;;
2511290000Sglebius	 *)
2512290000Sglebius	    ntp_ok=no
2513290000Sglebius	    ;;
2514290000Sglebius	esac
2515290000Sglebius    ]
2516290000Sglebius)
2517290000Sglebiuscase "$ntp_ok" in
2518290000Sglebius yes)
2519181834Sroberto    ntp_refclock=yes
2520290000Sglebius    AC_DEFINE([CLOCK_TPRO], [1],
2521290000Sglebius	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2522290000Sglebius    ;;
2523290000Sglebiusesac
2524290000SglebiusAC_MSG_RESULT([$ntp_ok])
2525181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2526290000Sglebius yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2527181834Srobertoesac
2528181834Sroberto
2529181834Sroberto# Not on a vax-dec-bsd
2530200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2531290000SglebiusAC_ARG_ENABLE(
2532290000Sglebius    [TRUETIME],
2533290000Sglebius    [AS_HELP_STRING(
2534290000Sglebius	[--enable-TRUETIME],
2535290000Sglebius	[s Kinemetrics/TrueTime receivers]
2536290000Sglebius    )],
2537181834Sroberto    [ntp_ok=$enableval],
2538290000Sglebius    [
2539290000Sglebius	case "$host" in
2540290000Sglebius	 vax-dec-bsd)
2541290000Sglebius	    ntp_ok=no
2542290000Sglebius	    ;;
2543290000Sglebius	 *)
2544290000Sglebius	    ntp_ok=$ntp_eac
2545290000Sglebius	    ;;
2546290000Sglebius	esac
2547290000Sglebius    ]
2548290000Sglebius)    
2549290000Sglebiuscase "$ntp_ok" in
2550290000Sglebius yes)
2551181834Sroberto    ntp_refclock=yes
2552290000Sglebius    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2553290000Sglebius    ;;
2554290000Sglebiusesac
2555290000SglebiusAC_MSG_RESULT([$ntp_ok])
2556181834Srobertocase "$ntp_ok$host" in
2557290000Sglebius yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2558181834Srobertoesac
2559181834Sroberto
2560200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2561290000SglebiusAC_ARG_ENABLE(
2562290000Sglebius    [TT560],
2563290000Sglebius    [AS_HELP_STRING(
2564290000Sglebius	[--enable-TT560],
2565290000Sglebius	[- TrueTime 560 IRIG-B decoder]
2566290000Sglebius    )],
2567290000Sglebius    [ntp_ok=$enableval],
2568290000Sglebius    [ntp_ok=no]
2569290000Sglebius)
2570290000Sglebiuscase "$ntp_ok" in
2571290000Sglebius yes)
2572181834Sroberto    ntp_refclock=yes
2573290000Sglebius    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2574290000Sglebius    ;;
2575290000Sglebiusesac
2576290000SglebiusAC_MSG_RESULT([$ntp_ok])
2577181834Sroberto
2578200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2579290000SglebiusAC_ARG_ENABLE(
2580290000Sglebius    [ULINK],
2581290000Sglebius    [AS_HELP_STRING(
2582290000Sglebius	[--enable-ULINK],
2583290000Sglebius	[+ Ultralink WWVB receiver]
2584290000Sglebius    )],
2585290000Sglebius    [ntp_ok=$enableval],
2586290000Sglebius    [ntp_ok=$ntp_eac]
2587290000Sglebius)
2588290000Sglebiuscase "$ntp_ok" in
2589290000Sglebius yes)
2590181834Sroberto    ntp_refclock=yes
2591290000Sglebius    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2592290000Sglebius    ;;
2593290000Sglebiusesac
2594290000SglebiusAC_MSG_RESULT([$ntp_ok])
2595181834Sroberto
2596290000SglebiusAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2597290000SglebiusAC_ARG_ENABLE(
2598290000Sglebius    [TSYNCPCI],
2599290000Sglebius    [AS_HELP_STRING(
2600290000Sglebius	[--enable-TSYNCPCI],
2601290000Sglebius	[s Spectracom TSYNC timing board]
2602290000Sglebius    )],
2603290000Sglebius    [ntp_ok=$enableval],
2604290000Sglebius    [
2605290000Sglebius	case "$host" in
2606290000Sglebius	 *-*-*linux*)
2607290000Sglebius	    ntp_ok=$ntp_eac
2608290000Sglebius	    ;;
2609290000Sglebius	 *)
2610290000Sglebius	    ntp_ok=no
2611290000Sglebius	esac
2612290000Sglebius    ]
2613290000Sglebius)
2614290000Sglebiuscase "$ntp_ok" in
2615290000Sglebius yes)
2616290000Sglebius    ntp_refclock=yes
2617290000Sglebius    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2618290000Sglebius    ;;
2619290000Sglebiusesac
2620290000SglebiusAC_MSG_RESULT([$ntp_ok])
2621290000Sglebius
2622200576SrobertoAC_MSG_CHECKING([WWV receiver])
2623290000SglebiusAC_ARG_ENABLE(
2624290000Sglebius    [WWV],
2625290000Sglebius    [AS_HELP_STRING(
2626290000Sglebius	[--enable-WWV],
2627290000Sglebius	[s WWV Audio receiver]
2628290000Sglebius    )],
2629181834Sroberto    [ntp_ok=$enableval],
2630290000Sglebius    [
2631290000Sglebius	case "$ntp_eac$ntp_canaudio" in
2632290000Sglebius	 *no*)	ntp_ok=no  ;;
2633290000Sglebius	 *)	ntp_ok=yes ;;
2634290000Sglebius	esac
2635290000Sglebius    ]
2636290000Sglebius)
2637290000Sglebiuscase "$ntp_ok" in
2638290000Sglebius yes)
2639181834Sroberto    ntp_refclock=yes
2640290000Sglebius    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2641290000Sglebius    ;;
2642290000Sglebiusesac
2643290000SglebiusAC_MSG_RESULT([$ntp_ok])
2644181834Srobertocase "$ntp_ok$ntp_canaudio" in
2645290000Sglebius yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2646181834Srobertoesac
2647181834Sroberto
2648200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2649290000SglebiusAC_ARG_ENABLE(
2650290000Sglebius    [ZYFER],
2651290000Sglebius    [AS_HELP_STRING(
2652290000Sglebius	[--enable-ZYFER],
2653290000Sglebius	[+ Zyfer GPStarplus receiver]
2654290000Sglebius    )],
2655290000Sglebius    [ntp_ok=$enableval],
2656290000Sglebius    [ntp_ok=$ntp_eac]
2657290000Sglebius)
2658290000Sglebiuscase "$ntp_ok" in
2659290000Sglebius yes)
2660181834Sroberto    ntp_refclock=yes
2661290000Sglebius    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2662290000Sglebius    ;;
2663290000Sglebiusesac
2664290000SglebiusAC_MSG_RESULT([$ntp_ok])
2665181834Sroberto
2666200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2667290000SglebiusAC_ARG_ENABLE(
2668290000Sglebius    [parse-clocks],
2669290000Sglebius    [AS_HELP_STRING(
2670290000Sglebius	[--enable-parse-clocks],
2671290000Sglebius	[- include all suitable PARSE clocks:]
2672290000Sglebius    )],
2673181834Sroberto    [ntp_eapc=$enableval],
2674290000Sglebius    [
2675290000Sglebius	case "$ntp_eac" in
2676290000Sglebius	 yes)	ntp_eapc=$ntp_canparse ;;
2677290000Sglebius	 *)	ntp_eapc=no ;;
2678290000Sglebius	esac
2679290000Sglebius	# Delete the next line one of these days
2680290000Sglebius	ntp_eapc=no
2681290000Sglebius    ]
2682290000Sglebius)
2683181834SrobertoAC_MSG_RESULT($ntp_eapc)
2684181834Sroberto
2685181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2686181834Sroberto noyes*)
2687200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2688181834Sroberto    ;;
2689181834Sroberto yesyesno)
2690200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2691181834Sroberto    ;;
2692181834Srobertoesac
2693181834Sroberto
2694181834Srobertontp_libparse=no
2695181834Srobertontp_parseutil=no
2696181834Srobertontp_rawdcf=no
2697181834Sroberto
2698200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2699290000SglebiusAC_ARG_ENABLE(
2700290000Sglebius    [COMPUTIME],
2701290000Sglebius    [AS_HELP_STRING(
2702290000Sglebius	[--enable-COMPUTIME],
2703290000Sglebius	[s Diem Computime Radio Clock]
2704290000Sglebius    )],
2705290000Sglebius    [ntp_ok=$enableval],
2706290000Sglebius    [ntp_ok=$ntp_eapc]
2707290000Sglebius)
2708290000Sglebiuscase "$ntp_ok" in
2709290000Sglebius yes)
2710181834Sroberto    ntp_libparse=yes
2711181834Sroberto    ntp_refclock=yes
2712290000Sglebius    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2713290000Sglebius    ;;
2714290000Sglebiusesac
2715290000SglebiusAC_MSG_RESULT([$ntp_ok])
2716181834Srobertocase "$ntp_ok$ntp_canparse" in
2717181834Sroberto yesno)
2718200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2719181834Srobertoesac
2720181834Sroberto
2721200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2722290000SglebiusAC_ARG_ENABLE(
2723290000Sglebius    [DCF7000],
2724290000Sglebius    [AS_HELP_STRING(
2725290000Sglebius	[--enable-DCF7000],
2726290000Sglebius	[s ELV/DCF7000 clock]
2727290000Sglebius    )],
2728290000Sglebius    [ntp_ok=$enableval],
2729290000Sglebius    [ntp_ok=$ntp_eapc]
2730290000Sglebius)
2731290000Sglebiuscase "$ntp_ok" in
2732290000Sglebius yes)
2733181834Sroberto    ntp_libparse=yes
2734181834Sroberto    ntp_refclock=yes
2735290000Sglebius    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2736290000Sglebius    ;;
2737290000Sglebiusesac
2738290000SglebiusAC_MSG_RESULT([$ntp_ok])
2739181834Srobertocase "$ntp_ok$ntp_canparse" in
2740181834Sroberto yesno)
2741200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2742181834Srobertoesac
2743181834Sroberto
2744200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2745290000SglebiusAC_ARG_ENABLE(
2746290000Sglebius    [HOPF6021],
2747290000Sglebius    [AS_HELP_STRING(
2748290000Sglebius	[--enable-HOPF6021],
2749290000Sglebius	[s HOPF 6021 clock]
2750290000Sglebius    )],
2751290000Sglebius    [ntp_ok=$enableval],
2752290000Sglebius    [ntp_ok=$ntp_eapc]
2753290000Sglebius)
2754290000Sglebiuscase "$ntp_ok" in
2755290000Sglebius yes)
2756181834Sroberto    ntp_libparse=yes
2757181834Sroberto    ntp_refclock=yes
2758290000Sglebius    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2759290000Sglebius    ;;
2760290000Sglebiusesac
2761290000SglebiusAC_MSG_RESULT([$ntp_ok])
2762181834Srobertocase "$ntp_ok$ntp_canparse" in
2763181834Sroberto yesno)
2764200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2765181834Srobertoesac
2766181834Sroberto
2767200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2768290000SglebiusAC_ARG_ENABLE(
2769290000Sglebius    [MEINBERG],
2770290000Sglebius    [AS_HELP_STRING(
2771290000Sglebius	[--enable-MEINBERG],
2772290000Sglebius	[s Meinberg clocks]
2773290000Sglebius    )],
2774290000Sglebius    [ntp_ok=$enableval],
2775290000Sglebius    [ntp_ok=$ntp_eapc]
2776290000Sglebius)
2777290000Sglebiuscase "$ntp_ok" in
2778290000Sglebius yes)
2779181834Sroberto    ntp_libparse=yes
2780181834Sroberto    ntp_refclock=yes
2781290000Sglebius    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2782290000Sglebius    ;;
2783290000Sglebiusesac
2784290000SglebiusAC_MSG_RESULT([$ntp_ok])
2785181834Srobertocase "$ntp_ok$ntp_canparse" in
2786181834Sroberto yesno)
2787200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2788181834Srobertoesac
2789181834Sroberto
2790200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2791290000SglebiusAC_ARG_ENABLE(
2792290000Sglebius    [RAWDCF],
2793290000Sglebius    [AS_HELP_STRING(
2794290000Sglebius	[--enable-RAWDCF],
2795290000Sglebius	[s DCF77 raw time code]
2796290000Sglebius    )],
2797290000Sglebius    [ntp_ok=$enableval],
2798290000Sglebius    [ntp_ok=$ntp_eapc]
2799290000Sglebius)
2800290000Sglebiuscase "$ntp_ok" in
2801290000Sglebius yes)
2802181834Sroberto    ntp_libparse=yes
2803181834Sroberto    ntp_parseutil=yes
2804181834Sroberto    ntp_refclock=yes
2805181834Sroberto    ntp_rawdcf=yes
2806290000Sglebius    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2807290000Sglebius    ;;
2808290000Sglebiusesac
2809290000SglebiusAC_MSG_RESULT([$ntp_ok])
2810181834Srobertocase "$ntp_ok$ntp_canparse" in
2811181834Sroberto yesno)
2812290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2813181834Srobertoesac
2814181834Sroberto
2815181834Srobertocase "$ntp_rawdcf" in
2816181834Sroberto yes)
2817200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2818290000Sglebius	[ntp_cv_rawdcf_parity],
2819290000Sglebius	[
2820290000Sglebius	    ans=no
2821290000Sglebius	    case "$host" in
2822290000Sglebius	     *-*-*linux*)
2823290000Sglebius		ans=yes
2824290000Sglebius		;;
2825290000Sglebius	    esac
2826290000Sglebius	    ntp_cv_rawdcf_parity=$ans
2827290000Sglebius	]
2828290000Sglebius    )
2829290000Sglebius    case "$ntp_cv_rawdcf_parity" in
2830290000Sglebius     yes)
2831290000Sglebius	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2832290000Sglebius	    [Should we not IGNPAR (Linux)?]) ;;
2833181834Sroberto    esac
2834181834Srobertoesac
2835181834Sroberto
2836200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2837290000SglebiusAC_ARG_ENABLE(
2838290000Sglebius    [RCC8000],
2839290000Sglebius    [AS_HELP_STRING(
2840290000Sglebius	[--enable-RCC8000],
2841290000Sglebius	[s RCC 8000 clock]
2842290000Sglebius    )],
2843290000Sglebius    [ntp_ok=$enableval],
2844290000Sglebius    [ntp_ok=$ntp_eapc]
2845290000Sglebius)
2846290000Sglebiuscase "$ntp_ok" in
2847290000Sglebius yes)
2848181834Sroberto    ntp_libparse=yes
2849181834Sroberto    ntp_refclock=yes
2850290000Sglebius    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2851290000Sglebius    ;;
2852290000Sglebiusesac
2853290000SglebiusAC_MSG_RESULT([$ntp_ok])
2854181834Srobertocase "$ntp_ok$ntp_canparse" in
2855181834Sroberto yesno)
2856290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2857181834Srobertoesac
2858181834Sroberto
2859200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2860290000SglebiusAC_ARG_ENABLE(
2861290000Sglebius    [SCHMID],
2862290000Sglebius    [AS_HELP_STRING(
2863290000Sglebius	[--enable-SCHMID ],
2864290000Sglebius	[s Schmid DCF77 clock]
2865290000Sglebius    )],
2866290000Sglebius    [ntp_ok=$enableval],
2867290000Sglebius    [ntp_ok=$ntp_eapc]
2868290000Sglebius)
2869290000Sglebiuscase "$ntp_ok" in
2870290000Sglebius yes)
2871181834Sroberto    ntp_libparse=yes
2872181834Sroberto    ntp_refclock=yes
2873290000Sglebius    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2874290000Sglebius    ;;
2875290000Sglebiusesac
2876290000SglebiusAC_MSG_RESULT([$ntp_ok])
2877181834Srobertocase "$ntp_ok$ntp_canparse" in
2878181834Sroberto yesno)
2879290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2880181834Srobertoesac
2881181834Sroberto
2882200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2883290000SglebiusAC_ARG_ENABLE(
2884290000Sglebius    [TRIMTAIP],
2885290000Sglebius    [AS_HELP_STRING(
2886290000Sglebius	[--enable-TRIMTAIP],
2887290000Sglebius	[s Trimble GPS receiver/TAIP protocol]
2888290000Sglebius    )],
2889290000Sglebius    [ntp_ok=$enableval],
2890290000Sglebius    [ntp_ok=$ntp_eapc]
2891290000Sglebius)
2892290000Sglebiuscase "$ntp_ok" in
2893290000Sglebius yes)
2894181834Sroberto    ntp_libparse=yes
2895181834Sroberto    ntp_refclock=yes
2896290000Sglebius    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2897290000Sglebius	[Trimble GPS receiver/TAIP protocol])
2898290000Sglebius    ;;
2899290000Sglebiusesac
2900290000SglebiusAC_MSG_RESULT([$ntp_ok])
2901181834Srobertocase "$ntp_ok$ntp_canparse" in
2902181834Sroberto yesno)
2903290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2904181834Srobertoesac
2905181834Sroberto
2906200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2907290000SglebiusAC_ARG_ENABLE(
2908290000Sglebius    [TRIMTSIP],
2909290000Sglebius    [AS_HELP_STRING(
2910290000Sglebius	[--enable-TRIMTSIP],
2911290000Sglebius	[s Trimble GPS receiver/TSIP protocol]
2912290000Sglebius    )],
2913290000Sglebius    [ntp_ok=$enableval],
2914290000Sglebius    [ntp_ok=$ntp_eapc]
2915290000Sglebius)
2916290000Sglebiuscase "$ntp_ok" in
2917290000Sglebius yes)
2918181834Sroberto    ntp_libparse=yes
2919181834Sroberto    ntp_refclock=yes
2920290000Sglebius    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2921290000Sglebius	[Trimble GPS receiver/TSIP protocol])
2922290000Sglebius    ;;
2923290000Sglebiusesac
2924290000SglebiusAC_MSG_RESULT([$ntp_ok])
2925181834Srobertocase "$ntp_ok$ntp_canparse" in
2926181834Sroberto yesno)
2927290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2928181834Srobertoesac
2929181834Sroberto
2930200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2931290000SglebiusAC_ARG_ENABLE(
2932290000Sglebius    [WHARTON],
2933290000Sglebius    [AS_HELP_STRING(
2934290000Sglebius	[--enable-WHARTON],
2935290000Sglebius	[s WHARTON 400A Series clock]
2936290000Sglebius    )],
2937290000Sglebius    [ntp_ok=$enableval],
2938290000Sglebius    [ntp_ok=$ntp_eapc]
2939290000Sglebius)
2940290000Sglebiuscase "$ntp_ok" in
2941290000Sglebius yes)
2942181834Sroberto    ntp_libparse=yes
2943181834Sroberto    ntp_refclock=yes
2944290000Sglebius    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2945290000Sglebius    ;;
2946290000Sglebiusesac
2947290000SglebiusAC_MSG_RESULT([$ntp_ok])
2948181834Srobertocase "$ntp_ok$ntp_canparse" in
2949181834Sroberto yesno)
2950290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2951290000Sglebiusesac
2952290000Sglebius
2953290000SglebiusAC_MSG_CHECKING([VARITEXT clock])
2954290000SglebiusAC_ARG_ENABLE(
2955290000Sglebius    [VARITEXT],
2956290000Sglebius    [AS_HELP_STRING(
2957290000Sglebius	[--enable-VARITEXT],
2958290000Sglebius	[s VARITEXT clock]
2959290000Sglebius    )],
2960290000Sglebius    [ntp_ok=$enableval],
2961290000Sglebius    [ntp_ok=$ntp_eapc]
2962290000Sglebius)
2963290000Sglebiuscase "$ntp_ok" in
2964290000Sglebius yes)
2965290000Sglebius    ntp_libparse=yes
2966290000Sglebius    ntp_refclock=yes
2967290000Sglebius    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2968181834Sroberto    ;;
2969181834Srobertoesac
2970290000SglebiusAC_MSG_RESULT([$ntp_ok])
2971290000Sglebiuscase "$ntp_ok$ntp_canparse" in
2972290000Sglebius yesno)
2973290000Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2974290000Sglebiusesac
2975181834Sroberto
2976290000SglebiusAC_MSG_CHECKING(SEL240X clock)
2977290000SglebiusAC_ARG_ENABLE(SEL240X,
2978290000Sglebius    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2979181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2980181834Srobertoif test "$ntp_ok" = "yes"; then
2981181834Sroberto    ntp_libparse=yes
2982181834Sroberto    ntp_refclock=yes
2983290000Sglebius    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2984181834Srobertofi
2985181834SrobertoAC_MSG_RESULT($ntp_ok)
2986181834Srobertocase "$ntp_ok$ntp_canparse" in
2987181834Sroberto yesno)
2988290000Sglebius    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2989181834Sroberto    ;;
2990181834Srobertoesac
2991290000Sglebius
2992290000SglebiusAC_SUBST([LIBPARSE])
2993290000SglebiusAC_SUBST([MAKE_LIBPARSE])
2994290000SglebiusAC_SUBST([MAKE_LIBPARSE_KERNEL])
2995290000SglebiusAC_SUBST([MAKE_CHECK_Y2K])
2996290000Sglebius
2997200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
2998181834Srobertoans=no
2999181834Srobertocase "$ntp_libparse" in
3000181834Sroberto yes)
3001181834Sroberto    ans=yes
3002290000Sglebius    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3003181834Sroberto    LIBPARSE=../libparse/libparse.a
3004181834Sroberto    MAKE_LIBPARSE=libparse.a
3005181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3006181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3007181834Srobertoesac
3008200576SrobertoAC_MSG_RESULT([$ans])
3009181834Sroberto
3010290000SglebiusNTP_OPENSSL
3011181834Sroberto
3012290000SglebiusNTP_CRYPTO_RAND
3013181834Sroberto
3014290000Sglebius# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3015290000SglebiusAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3016290000SglebiusAC_ARG_ENABLE(
3017290000Sglebius    [autokey],
3018290000Sglebius    AS_HELP_STRING(
3019290000Sglebius	[--enable-autokey],
3020290000Sglebius	[+ support NTP Autokey protocol]
3021290000Sglebius	),
3022290000Sglebius    [ntp_autokey=$enableval],
3023290000Sglebius    [ntp_autokey=$ntp_openssl]
3024290000Sglebius)
3025290000Sglebiuscase "$ntp_autokey" in
3026290000Sglebius no)
3027181834Sroberto    ;;
3028290000Sglebius *)
3029290000Sglebius    case "$ntp_openssl" in
3030181834Sroberto     no)
3031290000Sglebius	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3032290000Sglebius	ntp_autokey=no
3033181834Sroberto	;;
3034290000Sglebius     *)
3035290000Sglebius	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3036290000Sglebius	ntp_autokey=yes
3037181834Sroberto	;;
3038181834Sroberto    esac
3039181834Sroberto    ;;
3040181834Srobertoesac
3041290000SglebiusAC_MSG_RESULT([$ntp_autokey])
3042181834Sroberto
3043290000SglebiusAC_SUBST([MAKE_CHECK_LAYOUT])
3044200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3045181834Srobertocase "$cross_compiling$PATH_PERL" in
3046181834Sroberto no/*)
3047181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3048181834Sroberto    ans=yes
3049181834Sroberto    ;;
3050181834Sroberto *)
3051181834Sroberto    ans=no
3052181834Sroberto    ;;
3053181834Srobertoesac
3054200576SrobertoAC_MSG_RESULT([$ans])
3055181834Sroberto
3056290000SglebiusAC_SUBST([TESTDCF])
3057290000SglebiusAC_SUBST([DCFD])
3058200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3059181834Srobertoans=no
3060290000Sglebiuscase "$ntp_parseutil" in
3061290000Sglebius yes)
3062181834Sroberto    case "$host" in
3063200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3064181834Sroberto	ans="dcfd testdcf"
3065181834Sroberto	DCFD=dcfd
3066290000Sglebius	TESTDCF=testdcf
3067181834Sroberto    esac
3068290000Sglebius    ;;
3069290000Sglebiusesac
3070200576SrobertoAC_MSG_RESULT([$ans])
3071181834Sroberto
3072290000SglebiusAC_SUBST([MAKE_PARSEKMODULE])
3073200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3074181834Srobertoans=no
3075181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3076181834Sroberto yesyes)
3077181834Sroberto    case "$host" in
3078181834Sroberto     sparc-*-sunos4*)
3079290000Sglebius        case "$ntp_cv_var_kernel_pll" in
3080181834Sroberto	yes)
3081290000Sglebius	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3082181834Sroberto	    ;;
3083181834Sroberto	esac
3084181834Sroberto	ans=parsestreams
3085181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3086181834Sroberto	;;
3087181834Sroberto     sparc-*-solaris2*)
3088181834Sroberto	ans=parsesolaris
3089181834Sroberto	MAKE_PARSEKMODULE=parse
3090290000Sglebius	AC_CHECK_HEADERS([strings.h])
3091181834Sroberto	;;
3092181834Sroberto    esac
3093181834Sroberto    ;;
3094181834Srobertoesac
3095200576SrobertoAC_MSG_RESULT([$ans])
3096181834Sroberto
3097200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3098290000Sglebiuscase "$ntp_refclock" in
3099290000Sglebius yes)
3100290000Sglebius    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3101290000Sglebius    ;;
3102290000Sglebiusesac
3103181834SrobertoAC_MSG_RESULT($ntp_refclock)
3104181834Sroberto
3105290000Sglebiusdnl Things that can be made in clockstuff
3106290000SglebiusAC_SUBST([PROPDELAY], [propdelay])
3107290000SglebiusAC_SUBST([CHUTEST]) dnl needs work to compile
3108181834Sroberto
3109290000SglebiusAC_SUBST([MAKE_ADJTIMED])
3110290000SglebiusAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3111181834Srobertocase "$host" in
3112181834Sroberto *-*-hpux[[56789]]*)
3113181834Sroberto    ans=yes
3114181834Sroberto    ;;
3115181834Sroberto *) ans=no
3116181834Sroberto    ;;
3117181834Srobertoesac
3118290000Sglebiuscase "$ans" in
3119290000Sglebius yes)
3120181834Sroberto    MAKE_ADJTIMED=adjtimed
3121290000Sglebius    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3122290000Sglebius	[Do we need HPUX adjtime() library support?])
3123290000Sglebius    ;;
3124290000Sglebius *) ADJTIMED_DB=
3125290000Sglebius    ADJTIMED_DL=
3126290000Sglebius    ADJTIMED_DS=
3127290000Sglebius    ADJTIMED_MS=
3128290000Sglebius    ;;
3129290000Sglebiusesac
3130200576SrobertoAC_MSG_RESULT([$ans])
3131181834Sroberto
3132200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3133181834Srobertocase "$host" in
3134181834Sroberto *-*-qnx*)
3135181834Sroberto    ans=yes
3136181834Sroberto    ;;
3137181834Sroberto *) ans=no
3138181834Sroberto    ;;
3139181834Srobertoesac
3140290000Sglebiuscase "$ans" in
3141290000Sglebius yes)
3142290000Sglebius    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3143290000Sglebius	[Do we need the qnx adjtime call?])
3144290000Sglebius    ;;
3145290000Sglebiusesac
3146200576SrobertoAC_MSG_RESULT([$ans])
3147181834Sroberto
3148200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3149181834Sroberto
3150200576Sroberto#  the default is to enable it if the system has the capability
3151200576Sroberto
3152200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3153200576Sroberto *yes*)
3154200576Sroberto    ans=yes
3155200576Sroberto    ;;
3156200576Sroberto *) ans=no
3157290000Sglebius    ;;
3158181834Srobertoesac
3159181834Sroberto
3160200576Srobertocase "$host" in
3161200576Sroberto *-*-domainos)	# Won't be found...
3162200576Sroberto    ans=no
3163200576Sroberto    ;;
3164200576Sroberto *-*-hpux*)
3165200576Sroberto    #ans=no
3166200576Sroberto    ;;
3167200576Sroberto *-*-irix[[456]]*)
3168200576Sroberto    ans=no
3169200576Sroberto    ;;
3170200576Sroberto *-*-*linux*)
3171200576Sroberto    ans=no
3172200576Sroberto    ;;
3173200576Sroberto *-*-winnt3.5)
3174200576Sroberto    ans=no
3175200576Sroberto    ;;
3176200576Sroberto *-*-unicosmp*)
3177200576Sroberto    ans=no
3178200576Sroberto    ;;
3179200576Srobertoesac
3180200576Sroberto
3181200576Sroberto# --enable-kmem / --disable-kmem controls if present
3182200576SrobertoAC_ARG_ENABLE(
3183200576Sroberto    [kmem],
3184290000Sglebius    [AS_HELP_STRING(
3185200576Sroberto	[--enable-kmem],
3186200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3187290000Sglebius    )],
3188200576Sroberto    [ans=$enableval]
3189200576Sroberto)
3190200576Sroberto
3191200576SrobertoAC_MSG_RESULT([$ans])
3192200576Sroberto
3193200576Srobertocase "$ans" in
3194200576Sroberto yes)
3195200576Sroberto    can_kmem=yes
3196200576Sroberto    ;;
3197290000Sglebius *)
3198200576Sroberto    can_kmem=no
3199290000Sglebius    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3200200576Srobertoesac
3201200576Sroberto
3202200576Sroberto
3203200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3204200576Sroberto
3205200576Sroberto# target-dependent defaults
3206200576Sroberto
3207200576Srobertocase "$host" in
3208200576Sroberto i386-sequent-ptx*)
3209200576Sroberto    ans=no
3210200576Sroberto    ;;
3211200576Sroberto i386-unknown-osf1*)
3212200576Sroberto    ans=yes
3213200576Sroberto    ;;
3214200576Sroberto mips-sgi-irix[[456]]*)
3215200576Sroberto    ans=yes
3216200576Sroberto    ;;
3217200576Sroberto *-fujitsu-uxp*)
3218200576Sroberto    ans=yes
3219200576Sroberto    ;;
3220290000Sglebius *-ibm-aix[[4-9]]*)
3221290000Sglebius    # XXX only verified thru AIX6.
3222200576Sroberto    ans=yes
3223200576Sroberto    ;;
3224200576Sroberto *-*-*linux*)
3225200576Sroberto    ans=yes
3226200576Sroberto    ;;
3227200576Sroberto *-*-solaris2.[[01]])
3228200576Sroberto    ans=no
3229200576Sroberto    ;;
3230200576Sroberto *-*-solaris2*)
3231200576Sroberto    ans=yes
3232200576Sroberto    ;;
3233200576Sroberto *-*-unicosmp*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236200576Sroberto *) ans=no
3237290000Sglebius    ;;
3238200576Srobertoesac
3239200576Sroberto
3240200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3241200576Sroberto# override the default
3242290000SglebiusAC_ARG_ENABLE(
3243290000Sglebius    [accurate-adjtime],
3244290000Sglebius    [AS_HELP_STRING(
3245290000Sglebius	[--enable-accurate-adjtime],
3246290000Sglebius	[s the adjtime() call is accurate]
3247290000Sglebius    )],
3248290000Sglebius    [ans=$enableval]
3249200576Sroberto)
3250200576Sroberto
3251200576SrobertoAC_MSG_RESULT([$ans])
3252200576Sroberto
3253200576Srobertocase "$ans" in
3254290000Sglebius yes)
3255290000Sglebius    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3256200576Sroberto    adjtime_is_accurate=yes
3257200576Sroberto    ;;
3258200576Sroberto *)
3259200576Sroberto    adjtime_is_accurate=no
3260290000Sglebius    ;;
3261181834Srobertoesac
3262181834Sroberto
3263290000SglebiusAC_CACHE_CHECK(
3264290000Sglebius    [the name of 'tick' in the kernel],
3265290000Sglebius    [ntp_cv_nlist_tick],
3266290000Sglebius    [
3267290000Sglebius	ans=_tick
3268290000Sglebius	case "$host" in
3269290000Sglebius	 m68*-hp-hpux*) # HP9000/300?
3270290000Sglebius	    ans=_old_tick
3271290000Sglebius	    ;;
3272290000Sglebius	 *-apple-aux[[23]]*)
3273290000Sglebius	    ans=tick
3274290000Sglebius	    ;;
3275290000Sglebius	 *-hp-hpux*)
3276290000Sglebius	    ans=old_tick
3277290000Sglebius	    ;;
3278290000Sglebius	 *-ibm-aix[[3-9]]*)
3279290000Sglebius	    # XXX only verified thru AIX6.
3280290000Sglebius	    ans=no
3281290000Sglebius	    ;;
3282290000Sglebius	 *-*-mpeix*)
3283290000Sglebius	    ans=no
3284290000Sglebius	    ;;
3285290000Sglebius	 *-*-ptx*)
3286290000Sglebius	    ans=tick
3287290000Sglebius	    ;;
3288290000Sglebius	 *-*-sco3.2v[[45]]*)
3289290000Sglebius	    ans=no
3290290000Sglebius	    ;;
3291290000Sglebius	 *-*-solaris2*)
3292290000Sglebius	    ans=nsec_per_tick
3293290000Sglebius	    ;;
3294290000Sglebius	 *-*-sysv4*)
3295290000Sglebius	    ans=tick
3296290000Sglebius	    ;;
3297290000Sglebius	esac
3298290000Sglebius	ntp_cv_nlist_tick=$ans
3299290000Sglebius    ]
3300290000Sglebius)
3301290000Sglebiuscase "$ntp_cv_nlist_tick" in
3302290000Sglebius ''|no)
3303290000Sglebius    ;;	# HMS: I think we can only get 'no' here...
3304290000Sglebius *)
3305290000Sglebius    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3306290000Sglebius	[What is the name of TICK in the kernel?])
3307181834Srobertoesac
3308290000Sglebius
3309290000SglebiusAC_CACHE_CHECK(
3310290000Sglebius    [for the units of 'tick'],
3311290000Sglebius    [ntp_cv_tick_nano],
3312290000Sglebius    [
3313290000Sglebius	ans=usec
3314290000Sglebius	case "$host" in
3315290000Sglebius	 *-*-solaris2*)
3316290000Sglebius	    ans=nsec
3317290000Sglebius	    ;;
3318290000Sglebius	esac
3319290000Sglebius	ntp_cv_tick_nano=$ans
3320290000Sglebius    ]
3321290000Sglebius)
3322290000Sglebiuscase "$ntp_cv_tick_nano" in
3323181834Sroberto nsec)
3324290000Sglebius    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3325181834Srobertoesac
3326290000Sglebius
3327290000SglebiusAC_CACHE_CHECK(
3328290000Sglebius    [the name of 'tickadj' in the kernel],
3329290000Sglebius    [ntp_cv_nlist_tickadj],
3330290000Sglebius    [
3331290000Sglebius	ans=_tickadj
3332290000Sglebius	case "$host" in
3333290000Sglebius	 m68*-hp-hpux*) # HP9000/300?
3334290000Sglebius	    ans=_tickadj
3335290000Sglebius	    ;;
3336290000Sglebius	 *-apple-aux[[23]]*)
3337290000Sglebius	    ans=tickadj
3338290000Sglebius	    ;;
3339290000Sglebius	 *-hp-hpux10*)
3340290000Sglebius	    ans=no
3341290000Sglebius	    ;;
3342290000Sglebius	 *-hp-hpux9*)
3343290000Sglebius	    ans=no
3344290000Sglebius	    ;;
3345290000Sglebius	 *-hp-hpux*)
3346290000Sglebius	    ans=tickadj
3347290000Sglebius	    ;;
3348290000Sglebius	 *-*-aix*)
3349290000Sglebius	    ans=tickadj
3350290000Sglebius	    ;;
3351290000Sglebius	 *-*-mpeix*)
3352290000Sglebius	    ans=no
3353290000Sglebius	    ;;
3354290000Sglebius	 *-*-ptx*)
3355290000Sglebius	    ans=tickadj
3356290000Sglebius	    ;;
3357290000Sglebius	 *-*-sco3.2v4*)
3358290000Sglebius	    ans=no
3359290000Sglebius	    ;;
3360290000Sglebius	 *-*-sco3.2v5.0*)
3361290000Sglebius	    ans=clock_drift
3362290000Sglebius	    ;;
3363290000Sglebius	 *-*-solaris2*)
3364290000Sglebius	    ans=no	# hrestime_adj
3365290000Sglebius	    ;;
3366290000Sglebius	 *-*-sysv4*)
3367290000Sglebius	    ans=tickadj
3368290000Sglebius	    ;;
3369290000Sglebius	esac
3370290000Sglebius	ntp_cv_nlist_tickadj=$ans
3371290000Sglebius    ]
3372290000Sglebius)
3373290000Sglebiuscase "$ntp_cv_nlist_tickadj" in
3374290000Sglebius ''|no)
3375290000Sglebius    ;;	# HMS: I think we can only get 'no' here...
3376290000Sglebius *)
3377290000Sglebius    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3378290000Sglebius	[What is the name of TICKADJ in the kernel?])
3379181834Srobertoesac
3380290000Sglebius
3381290000SglebiusAC_CACHE_CHECK(
3382290000Sglebius    [for the units of 'tickadj'],
3383290000Sglebius    [ntp_cv_tickadj_nano],
3384290000Sglebius    [
3385290000Sglebius	ans=usec
3386290000Sglebius	case "$host" in
3387290000Sglebius	 *-*-solaris2*)
3388290000Sglebius	    ans=nsec
3389290000Sglebius	    ;;
3390290000Sglebius	esac
3391290000Sglebius	ntp_cv_tickadj_nano=$ans
3392290000Sglebius    ]
3393290000Sglebius)
3394290000Sglebiuscase "$ntp_cv_tickadj_nano" in
3395181834Sroberto nsec)
3396290000Sglebius    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3397181834Srobertoesac
3398290000Sglebius
3399290000SglebiusAC_CACHE_CHECK(
3400290000Sglebius    [half-heartedly for 'dosynctodr' in the kernel],
3401290000Sglebius    [ntp_cv_nlist_dosynctodr],
3402290000Sglebius    [
3403290000Sglebius	case "$host" in
3404290000Sglebius	 *-apple-aux[[23]]*)
3405290000Sglebius	    ans=no
3406290000Sglebius	    ;;
3407290000Sglebius	 *-sni-sysv*)
3408290000Sglebius	    ans=dosynctodr
3409290000Sglebius	    ;;
3410290000Sglebius	 *-stratus-vos)
3411290000Sglebius	    ans=no
3412290000Sglebius	    ;;
3413290000Sglebius	 *-*-aix*)
3414290000Sglebius	    ans=dosynctodr
3415290000Sglebius	    ;;
3416290000Sglebius	 *-*-hpux*)
3417290000Sglebius	    ans=no
3418290000Sglebius	    ;;
3419290000Sglebius	 *-*-mpeix*)
3420290000Sglebius	    ans=no
3421290000Sglebius	    ;;
3422290000Sglebius	 *-*-nextstep*)
3423290000Sglebius	    ans=_dosynctodr
3424290000Sglebius	    ;;
3425290000Sglebius	 *-*-ptx*)
3426290000Sglebius	    ans=doresettodr
3427290000Sglebius	    ;;
3428290000Sglebius	 *-*-sco3.2v4*)
3429290000Sglebius	    ans=no
3430290000Sglebius	    ;;
3431290000Sglebius	 *-*-sco3.2v5*)
3432290000Sglebius	    ans=track_rtc
3433290000Sglebius	    ;;
3434290000Sglebius	 *-*-solaris2*)
3435290000Sglebius	    ans=dosynctodr
3436290000Sglebius	    ;;
3437290000Sglebius	 *-*-sysv4*)
3438290000Sglebius	    ans=doresettodr
3439290000Sglebius	    ;;
3440290000Sglebius	 *)
3441290000Sglebius	    ans=_dosynctodr
3442290000Sglebius	    ;;
3443290000Sglebius	esac
3444290000Sglebius	ntp_cv_nlist_dosynctodr=$ans
3445290000Sglebius    ]
3446290000Sglebius)
3447290000Sglebiuscase "$ntp_cv_nlist_dosynctodr" in
3448290000Sglebius no)
3449181834Sroberto    ;;
3450181834Sroberto *)
3451290000Sglebius    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3452290000Sglebius	[What is (probably) the name of DOSYNCTODR in the kernel?])
3453181834Sroberto    ;;
3454181834Srobertoesac
3455290000Sglebius
3456290000SglebiusAC_CACHE_CHECK(
3457290000Sglebius    [half-heartedly for 'noprintf' in the kernel],
3458290000Sglebius    [ntp_cv_nlist_noprintf],
3459290000Sglebius    [
3460290000Sglebius	case "$host" in
3461290000Sglebius	 *-apple-aux[[23]]*)
3462290000Sglebius	    ans=no
3463290000Sglebius	    ;;
3464290000Sglebius	 *-sni-sysv*)
3465290000Sglebius	    ans=noprintf
3466290000Sglebius	    ;;
3467290000Sglebius	 *-stratus-vos)
3468290000Sglebius	    ans=no
3469290000Sglebius	    ;;
3470290000Sglebius	 *-*-aix*)
3471290000Sglebius	    ans=noprintf
3472290000Sglebius	    ;;
3473290000Sglebius	 *-*-hpux*)
3474290000Sglebius	    ans=no
3475290000Sglebius	    ;;
3476290000Sglebius	 *-*-mpeix*)
3477290000Sglebius	    ans=no
3478290000Sglebius	    ;;
3479290000Sglebius	 *-*-ptx*)
3480290000Sglebius	    ans=noprintf
3481290000Sglebius	    ;;
3482290000Sglebius	 *-*-nextstep*)
3483290000Sglebius	    ans=_noprintf
3484290000Sglebius	    ;;
3485290000Sglebius	 *-*-solaris2*)
3486290000Sglebius	    ans=noprintf
3487290000Sglebius	    ;;
3488290000Sglebius	 *-*-sysv4*)
3489290000Sglebius	    ans=noprintf
3490290000Sglebius	    ;;
3491290000Sglebius	 *)
3492290000Sglebius	    ans=_noprintf
3493290000Sglebius	    ;;
3494290000Sglebius	esac
3495290000Sglebius	ntp_cv_nlist_noprintf=$ans
3496290000Sglebius    ]
3497290000Sglebius)
3498290000Sglebiuscase "$ntp_cv_nlist_noprintf" in
3499290000Sglebius no)
3500181834Sroberto    ;;
3501181834Sroberto *)
3502290000Sglebius    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3503290000Sglebius	[What is (probably) the name of NOPRINTF in the kernel?])
3504181834Sroberto    ;;
3505181834Srobertoesac
3506181834Sroberto
3507181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3508181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3509181834Sroberto
3510290000Sglebiusdnl	tick		tickadj
3511181834Srobertodnl	10000		80	    Unixware
3512181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3513181834Srobertodnl	10000		150	    sgi IRIX
3514181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3515181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3516181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3517181834Srobertodnl	txc.tick	1	    Linux
3518181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3519181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3520181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3521181834Sroberto
3522181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3523181834Sroberto
3524200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3525200576Sroberto
3526200576Sroberto# target-dependent default for tick
3527200576Sroberto
3528200576Srobertocase "$host" in
3529200576Sroberto *-*-pc-cygwin*)
3530200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3531200576Sroberto    ;;
3532200576Sroberto *-univel-sysv*)
3533200576Sroberto    ans=10000
3534200576Sroberto    ;;
3535200576Sroberto *-*-irix*)
3536200576Sroberto    ans=10000
3537200576Sroberto    ;;
3538200576Sroberto *-*-*linux*)
3539200576Sroberto    ans=txc.tick
3540200576Sroberto    ;;
3541200576Sroberto *-*-mpeix*)
3542200576Sroberto    ans=no
3543200576Sroberto    ;;
3544200576Sroberto *-*-winnt3.5)
3545200576Sroberto    ans='(every / 10)'
3546200576Sroberto    ;;
3547200576Sroberto *-*-unicosmp*)
3548200576Sroberto    ans=10000
3549200576Sroberto    ;;
3550200576Sroberto *)
3551200576Sroberto    ans='1000000L/hz'
3552200576Sroberto    ;;
3553200576Srobertoesac
3554200576Sroberto
3555200576SrobertoAC_ARG_ENABLE(
3556200576Sroberto    [tick],
3557290000Sglebius    [AS_HELP_STRING(
3558200576Sroberto	[--enable-tick=VALUE],
3559200576Sroberto	[s force a value for 'tick']
3560290000Sglebius    )],
3561200576Sroberto    [ans=$enableval]
3562200576Sroberto)
3563200576Sroberto
3564200576SrobertoAC_MSG_RESULT([$ans])
3565200576Sroberto
3566200576Srobertocase "$ans" in
3567290000Sglebius ''|no)
3568290000Sglebius    ;;	# HMS: I think we can only get 'no' here...
3569290000Sglebius *)
3570290000Sglebius    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3571290000Sglebius	[Preset a value for 'tick'?])
3572181834Srobertoesac
3573181834Sroberto
3574200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3575200576Sroberto
3576200576Sroberto# target-specific default
3577200576Srobertoans='500/hz'
3578200576Srobertocase "$host" in
3579200576Sroberto *-fujitsu-uxp*)
3580200576Sroberto    case "$adjtime_is_accurate" in
3581200576Sroberto     yes)
3582290000Sglebius	ans='tick/16'
3583200576Sroberto    esac
3584200576Sroberto    ;;
3585200576Sroberto *-univel-sysv*)
3586200576Sroberto    ans=80
3587200576Sroberto    ;;
3588200576Sroberto *-*-aix*)
3589200576Sroberto    case "$can_kmem" in
3590200576Sroberto     no)
3591200576Sroberto	ans=1000
3592290000Sglebius	;;
3593200576Sroberto    esac
3594200576Sroberto    ;;
3595200576Sroberto *-*-domainos)	# Skippy: won't be found...
3596200576Sroberto    case "$can_kmem" in
3597200576Sroberto     no)
3598200576Sroberto	ans=668
3599290000Sglebius	;;
3600200576Sroberto    esac
3601200576Sroberto    ;;
3602200576Sroberto *-*-hpux*)
3603200576Sroberto    case "$adjtime_is_accurate" in
3604200576Sroberto     yes)
3605200576Sroberto	ans='tick/16'
3606290000Sglebius	;;
3607200576Sroberto    esac
3608200576Sroberto    ;;
3609200576Sroberto *-*-irix*)
3610200576Sroberto    ans=150
3611200576Sroberto    ;;
3612200576Sroberto *-*-mpeix*)
3613200576Sroberto    ans=no
3614200576Sroberto    ;;
3615200576Sroberto *-*-sco3.2v5.0*)
3616200576Sroberto    ans=10000L/hz
3617200576Sroberto    ;;
3618200576Sroberto *-*-winnt3.5)
3619200576Sroberto    ans=50
3620200576Sroberto    ;;
3621200576Sroberto *-*-unicosmp*)
3622200576Sroberto    ans=150
3623290000Sglebius    ;;
3624200576Srobertoesac
3625200576Sroberto
3626200576SrobertoAC_ARG_ENABLE(
3627200576Sroberto    [tickadj],
3628290000Sglebius    [AS_HELP_STRING(
3629290000Sglebius	[--enable-tickadj=VALUE],
3630290000Sglebius	[s force a value for 'tickadj']
3631290000Sglebius    )],
3632200576Sroberto    [ans=$enableval]
3633200576Sroberto)
3634200576Sroberto
3635200576SrobertoAC_MSG_RESULT([$ans])
3636200576Sroberto
3637200576Srobertodefault_tickadj=$ans
3638200576Sroberto
3639200576Srobertocase "$default_tickadj" in
3640290000Sglebius ''|no)
3641290000Sglebius    ;;	# HMS: I think we can only get 'no' here...
3642290000Sglebius *)
3643290000Sglebius    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3644290000Sglebius	[Preset a value for 'tickadj'?]) ;;
3645181834Srobertoesac
3646181834Sroberto
3647181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3648181834Sroberto# 1/100s (system tick). Sigh ...
3649181834Sroberto# Unfortunately, there is no easy way to know if particular release
3650181834Sroberto# has this "feature" or any obvious way to test for it.
3651181834Srobertocase "$host" in
3652290000Sglebius mips-sni-sysv4*)
3653290000Sglebius    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3654290000Sglebius	[Do we want the ReliantUNIX clock hacks?])
3655181834Srobertoesac
3656181834Sroberto
3657181834Srobertocase "$host" in
3658290000Sglebius *-*-sco3.2v5*)
3659290000Sglebius    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3660181834Srobertoesac
3661181834Sroberto
3662290000Sglebiusntp_cv_make_tickadj=yes
3663200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3664181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3665200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3666290000Sglebius    ntp_cv_make_tickadj=no
3667181834Sroberto    ;;
3668181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3669200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3670290000Sglebius    ntp_cv_make_tickadj=no
3671181834Sroberto    ;;
3672181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3673200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3674290000Sglebius    ntp_cv_make_tickadj=no
3675181834Sroberto    ;;
3676181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3677181834Sroberto    ;;
3678181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3679181834Sroberto    ;;
3680181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3681200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3682181834Sroberto    ;;
3683181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3684181834Sroberto    ;;
3685181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3686181834Sroberto    ;;
3687181834Sroberto *)		# Generally bogus.
3688200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3689181834Sroberto    ;;
3690181834Srobertoesac
3691181834Sroberto
3692181834SrobertoAC_SUBST(MAKE_NTPTIME)
3693200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3694181834Sroberto[case "$host" in
3695290000Sglebius *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3696181834Sroberto     yesyes)
3697181834Sroberto	ans=yes
3698181834Sroberto	;;
3699181834Sroberto     *)
3700181834Sroberto	ans=no
3701181834Sroberto	;;
3702181834Sroberto    esac
3703181834Sroberto    ;;
3704181834Srobertoesac
3705181834Srobertoac_cv_make_ntptime=$ans])
3706181834Srobertocase "$ac_cv_make_ntptime" in
3707181834Sroberto yes)
3708181834Sroberto    MAKE_NTPTIME=ntptime
3709181834Sroberto    ;;
3710290000Sglebius *)
3711290000Sglebius    NTPTIME_DB=
3712290000Sglebius    NTPTIME_DL=
3713290000Sglebius    NTPTIME_DS=
3714290000Sglebius    NTPTIME_MS=
3715290000Sglebius    ;;
3716181834Srobertoesac
3717181834Sroberto
3718290000SglebiusAC_SUBST([MAKE_TICKADJ])
3719181834Srobertocase "$host" in
3720181834Sroberto mips-sni-sysv4*)
3721181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3722181834Sroberto    # Do not bother
3723290000Sglebius    ntp_cv_make_tickadj=no
3724181834Sroberto    ;;
3725181834Sroberto *-*-irix*)
3726290000Sglebius    ntp_cv_make_tickadj=no
3727181834Sroberto    ;;
3728181834Sroberto *-*-solaris2*)
3729181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3730181834Sroberto    case "$host" in
3731181834Sroberto     *-*-solaris2.1[[0-9]]*)
3732290000Sglebius	ntp_cv_make_tickadj=no
3733181834Sroberto	;;
3734181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3735290000Sglebius     *) ntp_cv_make_tickadj=no ;;
3736181834Sroberto    esac
3737181834Sroberto    ;;
3738181834Sroberto *-*-unicosmp*)
3739290000Sglebius    ntp_cv_make_tickadj=no
3740181834Sroberto    ;;
3741181834Srobertoesac
3742200576Sroberto
3743200576Sroberto#
3744200576Sroberto# Despite all the above, we always make tickadj.  Setting
3745290000Sglebius# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3746200576Sroberto# report that the configuration variable was cached.  It may
3747200576Sroberto# be better to simply remove the hunk above, I did not want
3748200576Sroberto# to remove it if there is hope it will be used again.
3749200576Sroberto#
3750290000SglebiusAS_UNSET([ntp_cv_make_tickadj])
3751200576Sroberto
3752290000SglebiusAC_CACHE_CHECK(
3753290000Sglebius    [if we want and can make the tickadj utility],
3754290000Sglebius    [ntp_cv_make_tickadj],
3755290000Sglebius    [ntp_cv_make_tickadj=yes]
3756290000Sglebius)
3757290000Sglebiuscase "$ntp_cv_make_tickadj" in
3758181834Sroberto yes)
3759181834Sroberto    MAKE_TICKADJ=tickadj
3760181834Sroberto    ;;
3761290000Sglebius *)
3762290000Sglebius    CALC_TICKADJ_DB=
3763290000Sglebius    CALC_TICKADJ_DL=
3764290000Sglebius    CALC_TICKADJ_DS=
3765290000Sglebius    CALC_TICKADJ_MS=
3766290000Sglebius    TICKADJ_DB=
3767290000Sglebius    TICKADJ_DL=
3768290000Sglebius    TICKADJ_DS=
3769290000Sglebius    TICKADJ_MS=
3770290000Sglebius    ;;
3771181834Srobertoesac
3772181834Sroberto
3773290000SglebiusAC_SUBST([MAKE_TIMETRIM])
3774290000SglebiusAC_CACHE_CHECK(
3775290000Sglebius    [if we want and can make the timetrim utility],
3776290000Sglebius    [ntp_cv_make_timetrim],
3777290000Sglebius    [
3778290000Sglebius	case "$host" in
3779290000Sglebius	 *-*-irix*)
3780290000Sglebius	    ntp_cv_make_timetrim=yes
3781290000Sglebius	    ;;
3782290000Sglebius	 *-*-unicosmp*)
3783290000Sglebius	    ntp_cv_make_timetrim=yes
3784290000Sglebius	    ;;
3785290000Sglebius	 *)
3786290000Sglebius	    ntp_cv_make_timetrim=no
3787290000Sglebius	    ;;
3788290000Sglebius	esac
3789290000Sglebius    ]
3790290000Sglebius)
3791290000Sglebiuscase "$ntp_cv_make_timetrim" in
3792181834Sroberto yes)
3793181834Sroberto    MAKE_TIMETRIM=timetrim
3794181834Sroberto    ;;
3795290000Sglebius *) TIMETRIM_DB=
3796290000Sglebius    TIMETRIM_DL=
3797290000Sglebius    TIMETRIM_DS=
3798290000Sglebius    TIMETRIM_MS=
3799290000Sglebius    ;;
3800181834Srobertoesac
3801181834Sroberto
3802290000SglebiusAC_SUBST([MAKE_LIBNTPSIM])
3803290000SglebiusAC_SUBST([MAKE_NTPDSIM])
3804200576Sroberto
3805200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3806200576SrobertoAC_ARG_ENABLE(
3807200576Sroberto    [simulator],
3808290000Sglebius    [AS_HELP_STRING(
3809200576Sroberto	[--enable-simulator],
3810200576Sroberto	[- build/install the NTPD simulator?]
3811290000Sglebius    )],
3812290000Sglebius    [ans=$enableval],
3813200576Sroberto    [ans=no]
3814200576Sroberto)
3815200576SrobertoAC_MSG_RESULT([$ans])
3816200576Srobertocase "$ans" in
3817181834Sroberto yes)
3818181834Sroberto    MAKE_NTPDSIM=ntpdsim
3819181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3820181834Sroberto    ;;
3821290000Sglebius *)
3822290000Sglebius    NTPDSIM_DB=
3823290000Sglebius    NTPDSIM_DL=
3824290000Sglebius    NTPDSIM_DS=
3825290000Sglebius    NTPDSIM_MS=
3826290000Sglebius    ;;
3827181834Srobertoesac
3828181834Sroberto
3829181834Srobertocase "$build" in
3830181834Sroberto $host)
3831181834Sroberto    ;;
3832181834Sroberto *) case "$host" in
3833181834Sroberto     *-*-vxworks*)
3834200576Sroberto	LDFLAGS="$LDFLAGS -r"
3835200576Sroberto	;;
3836181834Sroberto    esac
3837181834Sroberto    ;;
3838181834Srobertoesac
3839181834Sroberto
3840290000SglebiusNTP_WITHSNTP
3841200576Sroberto
3842290000SglebiusAC_MSG_CHECKING([if we want to build ntpsnmpd])
3843290000SglebiusAC_ARG_WITH(
3844290000Sglebius    [ntpsnmpd],
3845290000Sglebius    [AS_HELP_STRING(
3846290000Sglebius	[--with-ntpsnmpd],
3847290000Sglebius	[s Build ntpsnmpd MIB agent?]
3848290000Sglebius    )],
3849290000Sglebius    [ans=$withval],
3850290000Sglebius    [
3851290000Sglebius	case "$PATH_NET_SNMP_CONFIG" in
3852290000Sglebius	 /*)	ans=yes ;;
3853290000Sglebius	 *)	ans=no  ;;
3854290000Sglebius	esac
3855290000Sglebius    ]
3856290000Sglebius)
3857290000SglebiusAC_MSG_RESULT([$ans])
3858290000Sglebiuscase "$ans" in
3859290000Sglebius yes)
3860290000Sglebius    case "$PATH_NET_SNMP_CONFIG" in
3861290000Sglebius     /*)
3862290000Sglebius	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3863290000Sglebius	# Bug 2815.  This is a bit of a hack, but it works...
3864290000Sglebius	case "$ntp_cv_net_snmp_version" in
3865290000Sglebius	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3866290000Sglebius		;;
3867290000Sglebius	esac
3868290000Sglebius	AC_SUBST([SNMP_LIBS])
3869290000Sglebius	# HMS: we really want to separate CPPFLAGS and CFLAGS
3870290000Sglebius	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3871290000Sglebius	SNMP_CPPFLAGS=
3872290000Sglebius	SNMP_CFLAGS=
3873290000Sglebius	for i in $foo; do
3874290000Sglebius	    case "$i" in
3875290000Sglebius	     -D*|-U*|-I*)
3876290000Sglebius		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3877290000Sglebius		;;
3878290000Sglebius	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3879290000Sglebius		;;
3880290000Sglebius	    esac
3881290000Sglebius	done
3882290000Sglebius	AC_SUBST([SNMP_CPPFLAGS])
3883290000Sglebius	AC_SUBST([SNMP_CFLAGS])
3884290000Sglebius
3885290000Sglebius	save_CFLAGS=$CFLAGS
3886290000Sglebius	save_CPPFLAGS=$CPPFLAGS
3887290000Sglebius	save_LIBS=$LIBS
3888290000Sglebius	CFLAGS=$SNMP_CFLAGS
3889290000Sglebius	CPPFLAGS=$SNMP_CPPFLAGS
3890290000Sglebius
3891290000Sglebius	AC_CHECK_HEADER(
3892290000Sglebius	    [net-snmp/net-snmp-config.h],
3893290000Sglebius	    [MAKE_NTPSNMPD=ntpsnmpd],
3894290000Sglebius	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3895290000Sglebius	)
3896290000Sglebius
3897290000Sglebius	# Do this last, as we're messing up LIBS.
3898290000Sglebius	# check -lnetsnmp for netsnmp_daemonize
3899290000Sglebius	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3900290000Sglebius	AC_CHECK_LIB(
3901290000Sglebius	    [netsnmp],
3902290000Sglebius	    [netsnmp_daemonize],
3903290000Sglebius	    [ans=yes],
3904290000Sglebius	    [ans=no]
3905290000Sglebius	)
3906290000Sglebius	case "$ans" in
3907290000Sglebius	 no)
3908290000Sglebius	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3909290000Sglebius		[We need to provide netsnmp_daemonize()])
3910290000Sglebius	esac
3911290000Sglebius	
3912290000Sglebius	CFLAGS=$save_CFLAGS
3913290000Sglebius	AS_UNSET([save_CFLAGS])
3914290000Sglebius	CPPFLAGS=$save_CPPFLAGS
3915290000Sglebius	AS_UNSET([save_CPPFLAGS])
3916290000Sglebius	LIBS=$save_LIBS
3917290000Sglebius	AS_UNSET([save_LIBS])
3918290000Sglebius	;;
3919290000Sglebius     *) 
3920290000Sglebius	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3921290000Sglebius	;;
3922290000Sglebius    esac
3923290000Sglebius    ;;
3924290000Sglebiusesac
3925290000SglebiusAC_SUBST([MAKE_NTPSNMPD])
3926290000Sglebius
3927290000Sglebiuscase "$MAKE_NTPSNMPD" in
3928290000Sglebius '')
3929290000Sglebius    NTPSNMPD_DB=
3930290000Sglebius    NTPSNMPD_DL=
3931290000Sglebius    NTPSNMPD_DS=
3932290000Sglebius    NTPSNMPD_MS=
3933290000Sglebius    ;;
3934290000Sglebiusesac
3935290000Sglebius
3936200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3937200576Sroberto
3938200576Sroberto# target-specific defaults
3939200576Sroberto
3940200576Srobertocase "$host" in
3941200576Sroberto *-apple-aux[[23]]*)
3942200576Sroberto    ans=yes
3943200576Sroberto    ;;
3944200576Sroberto *-*-bsdi[[012]]*)
3945200576Sroberto    ans=no
3946200576Sroberto    ;;
3947200576Sroberto *-*-bsdi*)
3948200576Sroberto    ans=yes
3949200576Sroberto    ;;
3950200576Sroberto *-*-openvms*)	# HMS: won't be found
3951200576Sroberto    ans=yes
3952200576Sroberto    ;;
3953200576Sroberto *) ans=no
3954200576Sroberto    ;;
3955200576Srobertoesac
3956200576Sroberto
3957200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3958200576Sroberto
3959200576SrobertoAC_ARG_ENABLE(
3960200576Sroberto    [slew-always],
3961290000Sglebius    [AS_HELP_STRING(
3962200576Sroberto	[--enable-slew-always],
3963200576Sroberto	[s always slew the time]
3964290000Sglebius    )],
3965200576Sroberto    [ans=$enableval]
3966200576Sroberto)
3967200576Sroberto
3968200576SrobertoAC_MSG_RESULT([$ans])
3969200576Sroberto
3970200576Srobertocase "$ans" in
3971290000Sglebius yes)
3972290000Sglebius    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3973181834Srobertoesac
3974181834Sroberto
3975200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3976200576Sroberto
3977200576Srobertocase "$host" in
3978200576Sroberto *-sni-sysv*)
3979200576Sroberto    ans=yes
3980200576Sroberto    ;;
3981290000Sglebius *-stratus-vos)
3982290000Sglebius    ans=no
3983290000Sglebius    ;;
3984200576Sroberto *-univel-sysv*)
3985200576Sroberto    ans=no
3986200576Sroberto    ;;
3987200576Sroberto *-*-ptx*)
3988200576Sroberto    ans=yes
3989200576Sroberto    ;;
3990200576Sroberto *-*-solaris2.1[[0-9]]*)
3991200576Sroberto    ans=no
3992200576Sroberto    ;;
3993200576Sroberto *-*-solaris2.[[012]]*)
3994200576Sroberto    ans=yes
3995200576Sroberto    ;;
3996200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
3997200576Sroberto    ans=yes
3998200576Sroberto    ;;
3999200576Sroberto *) ans=no
4000200576Sroberto    ;;
4001200576Srobertoesac
4002200576Sroberto
4003200576SrobertoAC_ARG_ENABLE(
4004200576Sroberto    [step-slew],
4005290000Sglebius    [AS_HELP_STRING(
4006200576Sroberto	[--enable-step-slew],
4007200576Sroberto	[s step and slew the time]
4008290000Sglebius    )],
4009200576Sroberto    [ans=$enableval]
4010200576Sroberto)
4011200576Sroberto
4012200576SrobertoAC_MSG_RESULT([$ans])
4013200576Sroberto
4014200576Srobertocase "$ans" in
4015290000Sglebius yes)
4016290000Sglebius    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4017181834Srobertoesac
4018181834Sroberto
4019200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4020200576Sroberto
4021200576Srobertocase "$host" in
4022200576Sroberto *-apple-aux[[23]]*)
4023200576Sroberto    ans=yes
4024200576Sroberto    ;;
4025200576Sroberto *) ans=no
4026290000Sglebius    ;;
4027200576Srobertoesac
4028200576Sroberto
4029200576SrobertoAC_ARG_ENABLE(
4030200576Sroberto    [ntpdate-step],
4031290000Sglebius    [AS_HELP_STRING(
4032200576Sroberto	[--enable-ntpdate-step],
4033200576Sroberto	[s if ntpdate should step the time]
4034290000Sglebius    )],
4035200576Sroberto    [ans=$enableval]
4036200576Sroberto)
4037200576Sroberto
4038200576SrobertoAC_MSG_RESULT([$ans])
4039200576Sroberto
4040200576Srobertocase "$ans" in
4041290000Sglebius yes)
4042290000Sglebius    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4043290000Sglebius	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4044181834Srobertoesac
4045181834Sroberto
4046200576Sroberto
4047200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4048200576Sroberto
4049200576Srobertocase "$host" in
4050200576Sroberto *-*-nextstep*)
4051200576Sroberto    ans=yes
4052200576Sroberto    ;;
4053200576Sroberto *-*-openvms*)	# HMS: won't be found
4054200576Sroberto    ans=yes
4055200576Sroberto    ;;
4056200576Sroberto *)
4057200576Sroberto    ans=no
4058290000Sglebius    ;;
4059200576Srobertoesac
4060200576Sroberto
4061200576SrobertoAC_ARG_ENABLE(
4062200576Sroberto    [hourly-todr-sync],
4063290000Sglebius    [AS_HELP_STRING(
4064200576Sroberto	[--enable-hourly-todr-sync],
4065200576Sroberto	[s if we should sync TODR hourly]
4066290000Sglebius    )],
4067200576Sroberto    [ans=$enableval]
4068200576Sroberto)
4069200576Sroberto
4070200576SrobertoAC_MSG_RESULT([$ans])
4071200576Sroberto
4072181834Srobertocase "$ac_cv_var_sync_todr" in
4073290000Sglebius yes)
4074290000Sglebius    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4075181834Srobertoesac
4076181834Sroberto
4077181834Sroberto
4078200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4079200576Sroberto
4080200576Srobertocase "$host" in
4081200576Sroberto *-*-solaris2.6)
4082200576Sroberto    unamev=`uname -v`
4083200576Sroberto    case "$unamev" in
4084200576Sroberto     Generic_105181-*)
4085200576Sroberto	old_IFS="$IFS"
4086200576Sroberto	IFS="-"
4087200576Sroberto	set $unamev
4088200576Sroberto	IFS="$old_IFS"
4089200576Sroberto	if test "$2" -ge 17
4090200576Sroberto	then
4091200576Sroberto	    # Generic_105181-17 and higher
4092200576Sroberto	    ans=no
4093200576Sroberto	else
4094200576Sroberto	    ans=yes
4095200576Sroberto	fi
4096200576Sroberto	;;
4097290000Sglebius     *)
4098181834Sroberto	ans=yes
4099290000Sglebius	;;
4100200576Sroberto    esac
4101200576Sroberto    ;;
4102200576Sroberto *-*-solaris2.7)
4103200576Sroberto    unamev=`uname -v`
4104200576Sroberto    case "$unamev" in
4105200576Sroberto     Generic_106541-*)
4106200576Sroberto	old_IFS="$IFS"
4107200576Sroberto	IFS="-"
4108200576Sroberto	set $unamev
4109200576Sroberto	IFS="$old_IFS"
4110200576Sroberto	if test "$2" -ge 07
4111200576Sroberto	then
4112200576Sroberto	    # Generic_106541-07 and higher
4113200576Sroberto	    ans=no
4114200576Sroberto	else
4115200576Sroberto	    ans=yes
4116200576Sroberto	fi
4117181834Sroberto	;;
4118200576Sroberto     *)
4119181834Sroberto	ans=yes
4120290000Sglebius	;;
4121181834Sroberto    esac
4122200576Sroberto    ;;
4123200576Sroberto *)
4124200576Sroberto    ans=no
4125290000Sglebius    ;;
4126200576Srobertoesac
4127200576Sroberto
4128200576SrobertoAC_ARG_ENABLE(
4129200576Sroberto    [kernel-fll-bug],
4130290000Sglebius    [AS_HELP_STRING(
4131200576Sroberto	[--enable-kernel-fll-bug],
4132200576Sroberto	[s if we should avoid a kernel FLL bug]
4133290000Sglebius    )],
4134200576Sroberto    [ans=$enableval]
4135200576Sroberto)
4136200576Sroberto
4137200576SrobertoAC_MSG_RESULT([$ans])
4138200576Sroberto
4139200576Srobertocase "$ans" in
4140290000Sglebius yes)
4141290000Sglebius    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4142200576Srobertoesac
4143200576Sroberto
4144200576Sroberto
4145290000SglebiusAC_MSG_CHECKING([if we want new session key behavior])
4146290000SglebiusAC_ARG_ENABLE(
4147290000Sglebius    [bug1243-fix],
4148290000Sglebius    [AS_HELP_STRING(
4149290000Sglebius	[--enable-bug1243-fix],
4150290000Sglebius	[+ use unmodified autokey session keys]
4151290000Sglebius    )],
4152290000Sglebius    [ans=$enableval],
4153290000Sglebius    [ans=yes]
4154290000Sglebius)
4155290000SglebiusAC_MSG_RESULT([$ans])
4156290000Sglebiuscase "$ans" in
4157290000Sglebius no)
4158290000Sglebius    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4159290000Sglebius	[use old autokey session key behavior?])
4160290000Sglebiusesac
4161290000Sglebius
4162290000Sglebius
4163298770SdelphijAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4164298770SdelphijAC_ARG_ENABLE(
4165298770Sdelphij    [bug3020-fix],
4166298770Sdelphij    [AS_HELP_STRING(
4167298770Sdelphij	[--enable-bug3020-fix],
4168298770Sdelphij	[+ Provide the explicit 127.0.0.0/8 martian filter]
4169298770Sdelphij    )],
4170298770Sdelphij    [ans=$enableval],
4171298770Sdelphij    [ans=yes]
4172298770Sdelphij)
4173298770SdelphijAC_MSG_RESULT([$ans])
4174298770Sdelphijcase "$ans" in
4175298770Sdelphij yes)
4176298770Sdelphij    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4177298770Sdelphij	[Provide the explicit 127.0.0.0/8 martian filter?])
4178298770Sdelphijesac
4179298770Sdelphij
4180298770Sdelphij
4181200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4182200576Sroberto
4183200576Srobertocase "$host" in
4184200576Sroberto *-*-solaris2.[[89]])
4185200576Sroberto    ans=yes
4186200576Sroberto    ;;
4187200576Sroberto *-*-solaris2.1[[0-9]]*)
4188200576Sroberto    ans=yes
4189200576Sroberto    ;;
4190200576Sroberto *) ans=no
4191290000Sglebius    ;;
4192200576Srobertoesac
4193200576Sroberto
4194200576SrobertoAC_ARG_ENABLE(
4195290000Sglebius    [irig-sawtooth],
4196290000Sglebius    [AS_HELP_STRING(
4197200576Sroberto	[--enable-irig-sawtooth],
4198200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4199290000Sglebius    )],
4200200576Sroberto    [ans=$enableval]
4201200576Sroberto)
4202200576Sroberto
4203200576SrobertoAC_MSG_RESULT([$ans])
4204200576Sroberto
4205200576Srobertocase "$ans" in
4206290000Sglebius yes)
4207290000Sglebius    AC_DEFINE([IRIG_SUCKS], [1],
4208290000Sglebius	[Should we use the IRIG sawtooth filter?])
4209181834Srobertoesac
4210181834Sroberto
4211200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4212200576SrobertoAC_ARG_ENABLE(
4213290000Sglebius	[nist],
4214290000Sglebius	[AS_HELP_STRING(
4215200576Sroberto	    [--enable-nist],
4216200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4217290000Sglebius	)],
4218200576Sroberto	[ans=$enableval],
4219200576Sroberto	[ans=no]
4220200576Sroberto)
4221200576Sroberto
4222200576SrobertoAC_MSG_RESULT([$ans])
4223200576Sroberto
4224200576Srobertocase "$ans" in
4225290000Sglebius yes)
4226290000Sglebius    AC_DEFINE([LOCKCLOCK], [1],
4227290000Sglebius	[Should we align with the NIST lockclock scheme?]) ;;
4228181834Srobertoesac
4229181834Sroberto
4230200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4231200576SrobertoAC_ARG_ENABLE(
4232200576Sroberto    [ntp-signd],
4233290000Sglebius    [AS_HELP_STRING(
4234290000Sglebius	[--enable-ntp-signd],
4235290000Sglebius	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4236290000Sglebius    )],
4237200576Sroberto    [ans=$enableval],
4238200576Sroberto    [ans=no]
4239200576Sroberto)
4240200576Sroberto
4241200576SrobertoAC_MSG_RESULT([$ans])
4242200576Sroberto
4243200576Srobertocase "$ans" in
4244200576Sroberto no)
4245200576Sroberto    ntp_signd_path=
4246200576Sroberto    ;;
4247200576Sroberto yes)
4248200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4249200576Sroberto    ;;
4250200576Sroberto *)
4251200576Sroberto    ntp_signd_path="$ans"
4252200576Srobertoesac
4253200576Sroberto
4254200576Srobertocase "$ntp_signd_path" in
4255200576Sroberto '')
4256200576Sroberto    ;;
4257200576Sroberto *)
4258290000Sglebius    AC_DEFINE([HAVE_NTP_SIGND], [1],
4259290000Sglebius	[Do we want support for Samba's signing daemon?])
4260290000Sglebius    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4261290000Sglebius	[Path to sign daemon rendezvous socket])
4262200576Sroberto    ;;
4263200576Srobertoesac
4264200576Sroberto
4265200576SrobertoAC_CHECK_HEADERS([libscf.h])
4266290000SglebiusLSCF=
4267200576Srobertocase "$ac_cv_header_libscf_h" in
4268200576Sroberto yes)
4269290000Sglebius    LSCF='-lscf'
4270200576Srobertoesac
4271290000SglebiusAC_SUBST([LSCF])
4272200576Sroberto
4273290000SglebiusNTP_IPV6
4274200576Sroberto
4275200576Sroberto
4276181834Sroberto#
4277290000Sglebius# Look for a sysctl call to get the list of network interfaces.
4278181834Sroberto#
4279200576SrobertoAC_CACHE_CHECK(
4280290000Sglebius    [for interface list sysctl],
4281290000Sglebius    [ntp_cv_iflist_sysctl],
4282290000Sglebius    [AC_PREPROC_IFELSE(
4283290000Sglebius	[AC_LANG_SOURCE([
4284290000Sglebius	    #include <sys/param.h>
4285290000Sglebius	    #include <sys/sysctl.h>
4286290000Sglebius	    #include <sys/socket.h>
4287290000Sglebius	    #ifndef NET_RT_IFLIST
4288290000Sglebius	    # error
4289290000Sglebius	    #endif
4290290000Sglebius	])],
4291290000Sglebius	[ntp_cv_iflist_sysctl=yes],
4292290000Sglebius	[ntp_cv_iflist_sysctl=no]
4293290000Sglebius    )]
4294200576Sroberto)
4295290000Sglebiuscase "$ntp_cv_iflist_sysctl" in
4296200576Sroberto yes)
4297290000Sglebius    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4298181834Srobertoesac
4299181834Sroberto
4300290000Sglebius###
4301181834Sroberto
4302290000SglebiusAC_MSG_CHECKING([if we want the saveconfig mechanism])
4303290000SglebiusAC_ARG_ENABLE(
4304290000Sglebius    [saveconfig],
4305290000Sglebius    [AS_HELP_STRING(
4306290000Sglebius	[--enable-saveconfig],
4307290000Sglebius	[+ saveconfig mechanism]
4308290000Sglebius    )],
4309290000Sglebius    [ntp_ok=$enableval],
4310290000Sglebius    [ntp_ok=yes]
4311290000Sglebius)
4312290000Sglebiusntp_saveconfig_enabled=0
4313290000Sglebiuscase "$ntp_ok" in
4314290000Sglebius yes)
4315290000Sglebius    ntp_saveconfig_enabled=1
4316290000Sglebius    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4317200576Sroberto    ;;
4318181834Srobertoesac
4319290000SglebiusAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4320290000SglebiusAC_MSG_RESULT([$ntp_ok])
4321181834Sroberto
4322290000Sglebius###
4323181834Sroberto
4324290000SglebiusAC_MSG_CHECKING([if we want the experimental leap smear code])
4325290000SglebiusAC_ARG_ENABLE(
4326290000Sglebius    [leap-smear],
4327290000Sglebius    [AS_HELP_STRING(
4328290000Sglebius	[--enable-leap-smear],
4329290000Sglebius	[- experimental leap smear code]
4330290000Sglebius    )],
4331290000Sglebius    [ntp_ok=$enableval],
4332290000Sglebius    [ntp_ok=no]
4333181834Sroberto)
4334290000Sglebiusntp_leap_smear_enabled=0
4335290000Sglebiuscase "$ntp_ok" in
4336200576Sroberto yes)
4337290000Sglebius    ntp_leap_smear_enabled=1
4338290000Sglebius    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4339290000Sglebius    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4340290000Sglebius    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4341290000Sglebius    ;;
4342200576Srobertoesac
4343290000SglebiusAC_MSG_RESULT([$ntp_ok])
4344200576Sroberto
4345298770Sdelphij###
4346298770Sdelphij
4347298770SdelphijAC_MSG_CHECKING([if we want dynamic interleave support])
4348298770SdelphijAC_ARG_ENABLE(
4349298770Sdelphij    [dynamic-interleave],
4350298770Sdelphij    [AS_HELP_STRING(
4351298770Sdelphij	[--enable-dynamic-interleave],
4352298770Sdelphij	[- dynamic interleave support]
4353298770Sdelphij    )],
4354298770Sdelphij    [ntp_ok=$enableval],
4355298770Sdelphij    [ntp_ok=no]
4356298770Sdelphij)
4357298770Sdelphijntp_dynamic_interleave=0
4358298770Sdelphijcase "$ntp_ok" in
4359298770Sdelphij yes)
4360298770Sdelphij    ntp_dynamic_interleave=1
4361298770Sdelphij    ;;
4362298770Sdelphijesac
4363298770SdelphijAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4364298770Sdelphij    [support dynamic interleave?])
4365298770SdelphijAC_MSG_RESULT([$ntp_ok])
4366298770Sdelphij
4367290000SglebiusNTP_UNITYBUILD
4368200576Sroberto
4369290000Sglebiusdnl  gtest is needed for our tests subdirs. It would be nice if we could
4370290000Sglebiusdnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4371290000Sglebiusdnl  can't be conditionalized.
4372290000SglebiusNTP_GOOGLETEST
4373200576Sroberto
4374290000SglebiusNTP_PROBLEM_TESTS
4375181834Sroberto
4376290000Sglebius###
4377200576Sroberto
4378290000SglebiusAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4379290000Sglebius    [Default location of crypto key info])
4380200576Sroberto
4381290000SglebiusAC_CONFIG_FILES([Makefile])
4382290000SglebiusAC_CONFIG_FILES([adjtimed/Makefile])
4383290000SglebiusAC_CONFIG_FILES([clockstuff/Makefile])
4384290000SglebiusAC_CONFIG_FILES([include/Makefile])
4385290000SglebiusAC_CONFIG_FILES([include/isc/Makefile])
4386290000SglebiusAC_CONFIG_FILES([kernel/Makefile])
4387290000SglebiusAC_CONFIG_FILES([kernel/sys/Makefile])
4388290000SglebiusAC_CONFIG_FILES([libntp/Makefile])
4389290000SglebiusAC_CONFIG_FILES([libparse/Makefile])
4390290000SglebiusAC_CONFIG_FILES([ntpd/Makefile])
4391290000SglebiusAC_CONFIG_FILES([ntpd/complete.conf],	[sed -e '/^rlimit$/d' -e '/^$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf])
4392290000SglebiusAC_CONFIG_FILES([ntpdate/Makefile])
4393290000SglebiusAC_CONFIG_FILES([ntpdc/Makefile])
4394290000SglebiusAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4395290000SglebiusAC_CONFIG_FILES([ntpq/Makefile])
4396290000SglebiusAC_CONFIG_FILES([ntpsnmpd/Makefile])
4397290000SglebiusAC_CONFIG_FILES([parseutil/Makefile])
4398290000SglebiusAC_CONFIG_FILES([scripts/Makefile])
4399290000SglebiusAC_CONFIG_FILES([scripts/build/Makefile])
4400301301SdelphijAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4401290000SglebiusAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4402290000SglebiusAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4403290000SglebiusAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4404290000SglebiusAC_CONFIG_FILES([scripts/lib/Makefile])
4405290000SglebiusAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4406290000SglebiusAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4407290000SglebiusAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4408290000SglebiusAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4409290000SglebiusAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4410290000SglebiusAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4411290000SglebiusAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4412290000SglebiusAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4413290000SglebiusAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4414290000SglebiusAC_CONFIG_FILES([scripts/update-leap/Makefile])
4415290000SglebiusAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4416290000SglebiusAC_CONFIG_FILES([tests/Makefile])
4417290000SglebiusAC_CONFIG_FILES([tests/bug-2803/Makefile])
4418290000SglebiusAC_CONFIG_FILES([tests/libntp/Makefile])
4419290000SglebiusAC_CONFIG_FILES([tests/ntpd/Makefile])
4420290000SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4421290000SglebiusAC_CONFIG_FILES([tests/sandbox/Makefile])
4422290000SglebiusAC_CONFIG_FILES([tests/sec-2853/Makefile])
4423290000SglebiusAC_CONFIG_FILES([util/Makefile])
4424181834Sroberto
4425290000Sglebiusperllibdir="${datadir}/ntp/lib"
4426290000SglebiusAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4427181834Sroberto
4428290000Sglebiuscalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4429290000SglebiusAC_SUBST_FILE([calc_tickadj_opts])
4430290000Sglebiusntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4431290000SglebiusAC_SUBST_FILE([ntp_wait_opts])
4432290000Sglebiusntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4433290000SglebiusAC_SUBST_FILE([ntpsweep_opts])
4434290000Sglebiusntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4435290000SglebiusAC_SUBST_FILE([ntptrace_opts])
4436290000Sglebiussummary_opts="$srcdir/scripts/summary-opts"
4437290000SglebiusAC_SUBST_FILE([summary_opts])
4438290000Sglebiusplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4439290000SglebiusAC_SUBST_FILE([plot_summary_opts])
4440181834Sroberto
4441290000SglebiusAC_CONFIG_SUBDIRS([sntp])
4442181834Sroberto
4443181834SrobertoAC_OUTPUT
4444