1290001Sglebiusdnl NTP top-level configure.ac				-*- Autoconf -*-
2290001Sglebiusdnl
3290001Sglebiusm4_include([sntp/m4/version.m4])
4290001SglebiusAC_PREREQ([2.61])
5290001SglebiusAC_INIT(
6290001Sglebius    [ntp],
7290001Sglebius    [VERSION_NUMBER],
8290001Sglebius    [http://bugs.ntp.org./],
9290001Sglebius    [],
10290001Sglebius    [http://www.ntp.org./]dnl
11290001Sglebius)
12290001SglebiusAC_CONFIG_MACRO_DIR([sntp/m4])
13290001SglebiusAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14290001SglebiusAC_LANG([C])
15290001Sglebius
16290001SglebiusAC_PRESERVE_HELP_ORDER
17290001Sglebius
18290001Sglebius# Bump ntp_configure_cache_version for each change to configure.ac or
19290001Sglebius# .m4 files which invalidates cached values from previous configure 
20290001Sglebius# runs.
21290001Sglebius#
22290001Sglebius# If the change affects cache variables used only by the main NTP
23290001Sglebius# configure.ac, then only its version number should be bumped, while
24290001Sglebius# the subdir configure.ac version numbers should be unchanged.  The
25290001Sglebius# same is true for a test/variable that is used only by one subdir
26290001Sglebius# being changed incompatibly; only that subdir's cache version needs
27290001Sglebius# bumping.
28290001Sglebius#
29290001Sglebius# If a change affects variables shared by all NTP configure scripts,
30290001Sglebius# please bump the version numbers of each.  If you are not sure, the
31290001Sglebius# safe choice is to bump all on any cache-invalidating change.
32290001Sglebius#
33290001Sglebius# In order to avoid the risk of version stamp collision between -stable
34290001Sglebius# and -dev branches, do not simply increment the version, instead use
35290001Sglebius# the date YYYYMMDD optionally with -HHMM if there is more than one
36290001Sglebius# bump in a day.
37290001Sglebius
38290001Sglebiusntp_configure_cache_version=20120806
39290001Sglebius
40290001Sglebius# When the cache version of config.cache and configure do not
41290001Sglebius# match, NTP_CACHEVERSION will flush the cache.
42290001Sglebius
43290001SglebiusNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44290001Sglebius
45290001SglebiusAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
46290001Sglebius
47290001Sglebiusdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48290001Sglebiusm4_ifdef(
49290001Sglebius    [AM_SILENT_RULES],
50290001Sglebius    [AM_SILENT_RULES([yes])]
51290001Sglebius)
52290001SglebiusAC_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.
56290001SglebiusAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57290001Sglebius    [canonical system (cpu-vendor-os) of where we should run])
58290001SglebiusAC_CONFIG_HEADERS([config.h])
59181834Srobertodnl AC_ARG_PROGRAM
60181834Sroberto
61290001Sglebiusntp_atom_ok=${ntp_atom_ok=no}
62290001Sglebiusntp_oncore_ok=${ntp_oncore_ok=no}
63290001Sglebiusntp_parse_ok=${ntp_parse_ok=no}
64290001Sglebiusntp_ripe_ncc_ok=${ntp_parse_ok=no}
65290001Sglebiusntp_jupiter_ok=${ntp_jupiter_ok=no}
66181834Sroberto
67290001SglebiusNTP_PROG_CC
68290001SglebiusAC_PROG_CPP
69290001Sglebius# Do we need CXX for anything besides google test?
70290001SglebiusAC_PROG_CXX
71290001SglebiusAC_PROG_YACC
72290001SglebiusAC_PROG_CC_C_O
73290001SglebiusAX_C99_STRUCT_INIT
74181834Sroberto
75290001SglebiusNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
76181834Sroberto
77290001SglebiusNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
78290001Sglebius
79290001Sglebiusdnl AM_PROG_AR req. automake 1.12
80290001Sglebiusm4_ifdef(
81290001Sglebius    [AM_PROG_AR],
82290001Sglebius    [AM_PROG_AR]
83290001Sglebius)
84290001Sglebius
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
88290001SglebiusAC_PROG_LIBTOOL
89290001SglebiusAC_SUBST([LIBTOOL_DEPS])
90200576Sroberto
91290001Sglebius# NTP has (so far) been relying on leading-edge autogen, which
92290001Sglebius# means we need the appropriate corresponding libopts as well.
93181834Sroberto# Therefore, by default:
94290001Sglebius# - 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
105290001Sglebiusenable_nls=no
106290001SglebiusLIBOPTS_CHECK_NOBUILD([sntp/libopts])
107181834Sroberto
108290001SglebiusNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
109181834Sroberto
110290001SglebiusNTP_LIBNTP
111181834Sroberto
112290001SglebiusAC_MSG_CHECKING([for deprecated --with-arlib])
113290001SglebiusAC_ARG_WITH([arlib],
114290001Sglebius	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
115181834Sroberto	[ans=$withval], [ans=no])
116200576SrobertoAC_MSG_RESULT([$ans])
117181834Sroberto
118181834Srobertocase "$ans" in
119181834Sroberto yes)
120290001Sglebius    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
126290001SglebiusAS_UNSET([ac_cv_prog_AWK])
127290001SglebiusAC_SUBST([AWK])				dnl scripts/ntpver.in
128181834SrobertoAC_PROG_MAKE_SET
129181834Sroberto
130290001SglebiusAC_SUBST([CFLAGS])
131290001SglebiusAC_SUBST([LDFLAGS])
132181834Sroberto
133290001SglebiusAC_PROG_LN_S
134290001SglebiusAC_ISC_POSIX
135181834Sroberto
136181834Sroberto
137290001SglebiusAC_PATH_PROG([PATH_PERL], [perl])
138290001Sglebiusdnl  Saving cached hardcoded paths rather than searching $PATH during a
139290001Sglebiusdnl  cached configure run is an optimization not worth the the cost of
140290001Sglebiusdnl  preventing newly-installed tools from being found.  Short-circuit
141290001Sglebiusdnl  the caching after the tests so preset overrides still work.
142290001SglebiusAS_UNSET([ac_cv_path_PATH_PERL])
143290001SglebiusAC_PATH_PROG([PATH_TEST], [test])
144290001SglebiusAS_UNSET([ac_cv_path_PATH_TEST])
145290001Sglebiustest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
146290001SglebiusAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
147181834Sroberto
148290001SglebiusAC_ARG_WITH(
149290001Sglebius    [net-snmp-config],
150290001Sglebius    [AS_HELP_STRING(
151290001Sglebius	[--with-net-snmp-config],
152290001Sglebius	[+ =net-snmp-config]
153290001Sglebius    )],
154290001Sglebius    [ans=$withval],
155290001Sglebius    [ans=yes]
156290001Sglebius)
157290001Sglebiuscase "$ans" in
158290001Sglebius no)
159181834Sroberto    ;;
160290001Sglebius yes)
161290001Sglebius    ans=net-snmp-config
162181834Sroberto    ;;
163290001Sglebius /*)
164181834Sroberto    ;;
165290001Sglebius */*)
166290001Sglebius    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
167181834Sroberto    ;;
168290001Sglebius *)
169290001Sglebius    ;;
170181834Srobertoesac
171290001SglebiusPROG_NET_SNMP_CONFIG=$ans
172290001SglebiusAC_MSG_CHECKING([for net-snmp-config path])
173290001Sglebiuscase "$PROG_NET_SNMP_CONFIG" in
174290001Sglebius no) ;;
175290001Sglebius /*)
176290001Sglebius    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
177290001Sglebius    ;;
178290001Sglebius *)
179290001Sglebius    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
180290001Sglebius    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
181290001Sglebius;;
182290001Sglebiusesac
183290001SglebiusAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
184181834Sroberto
185290001Sglebiuscase "$PATH_NET_SNMP_CONFIG" in
186290001Sglebius /*)	AC_CACHE_CHECK(
187290001Sglebius	    [for net-snmp version],
188290001Sglebius	    [ntp_cv_net_snmp_version],
189290001Sglebius	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
190290001Sglebius	)
191181834Sroberto	;;
192181834Srobertoesac
193181834Sroberto
194181834Srobertocase "$host" in
195181834Sroberto *-*-vxworks*)
196181834Sroberto    ac_link="$ac_link $VX_KERNEL"
197181834Sroberto    ;;
198181834Srobertoesac
199181834Sroberto
200290001Sglebius# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
201290001SglebiusAC_SEARCH_LIBS([openlog], [gen syslog])
202290001Sglebius# XXX library list will be in ac_cv_search_openlog
203181834Sroberto
204290001Sglebius# LIBSECCOMP is off by default -- needs testing with all the features
205290001Sglebius# Please send bug reports to loganaden@gmail.com
206290001SglebiusAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
207290001SglebiusAC_ARG_ENABLE(
208290001Sglebius    [libseccomp],
209290001Sglebius    [AS_HELP_STRING(
210290001Sglebius	[--enable-libseccomp],
211290001Sglebius	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
212290001Sglebius    )],
213290001Sglebius    [ntp_ok=$enableval],
214290001Sglebius    [ntp_ok=no]
215290001Sglebius)
216290001SglebiusAC_MSG_RESULT([$ntp_ok])
217290001Sglebiuscase "$ntp_ok" in
218290001Sglebius yes)
219290001Sglebius    AC_SEARCH_LIBS(
220290001Sglebius	[seccomp_init],
221290001Sglebius	[seccomp],
222290001Sglebius	[AC_DEFINE([LIBSECCOMP], [1],
223290001Sglebius	    [Define to any value to include libseccomp sandboxing.])]
224290001Sglebius    )
225290001Sglebius    AC_TRY_RUN([
226290001Sglebius	#include <stdio.h>
227290001Sglebius	#include <stdlib.h>
228290001Sglebius	#include <errno.h>
229290001Sglebius	#include <sys/prctl.h>
230290001Sglebius	#include <linux/seccomp.h>
231290001Sglebius
232290001Sglebius	int main(void)
233290001Sglebius	{
234290001Sglebius		int ret;
235290001Sglebius		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
236290001Sglebius		if (ret < 0) {
237290001Sglebius			switch (errno) {
238290001Sglebius			case ENOSYS:
239290001Sglebius				return 1;
240290001Sglebius			case EINVAL:
241290001Sglebius				return 1;
242290001Sglebius			default:
243290001Sglebius				return 1;
244290001Sglebius			}
245290001Sglebius		}
246290001Sglebius		ret = 
247290001Sglebius		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
248290001Sglebius		if (ret < 0) {
249290001Sglebius			switch (errno) {
250290001Sglebius			case EINVAL:
251290001Sglebius				return 1;
252290001Sglebius			case EFAULT:
253290001Sglebius				return 0;
254290001Sglebius			default:
255290001Sglebius				return 1;
256290001Sglebius		}
257290001Sglebius	}
258290001Sglebiusreturn 1;
259290001Sglebius}
260290001Sglebius]
261290001Sglebius, AC_DEFINE([KERN_SECCOMP], 1, 
262290001Sglebius[Define to use libseccomp system call filtering.])   
263290001Sglebius, []
264290001Sglebius)
265181834Sroberto    ;;
266181834Srobertoesac
267181834Sroberto
268290001SglebiusNTP_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.
275290001Sglebiusdnl
276290001Sglebiusdnl 081118 Harlan got tired of looking for a way to get the sched*()
277290001Sglebiusdnl functions to link OK with either cc or gcc.
278181834Sroberto
279181834Srobertocase "$host" in
280200576Sroberto *-*-*linux*) ;;
281290001Sglebius *-*-osf4*) ;;
282290001Sglebius *-*-osf5*) ;;
283181834Sroberto *)
284290001Sglebius    # HMS: Make sure we check for -lrt for clock_* before this...
285290001Sglebius    case "$ac_cv_search_clock_gettime" in
286290001Sglebius     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
287290001Sglebius    esac
288290001Sglebius    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
289181834Sroberto    ;;
290181834Srobertoesac
291181834Sroberto
292290001SglebiusAC_CHECK_HEADERS([bstring.h])
293290001SglebiusAC_CHECK_HEADER(
294290001Sglebius    [dns_sd.h],
295290001Sglebius    [AC_SEARCH_LIBS(
296290001Sglebius	[DNSServiceRegister],
297290001Sglebius	[dns_sd],
298290001Sglebius	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
299290001Sglebius	    [Use Rendezvous/DNS-SD registration])]
300290001Sglebius    )]
301290001Sglebius)
302290001SglebiusAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
303181834Sroberto
304290001SglebiusAC_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])
308290001SglebiusAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
309181834Sroberto
310181834Srobertocase "$host" in
311181834Sroberto *-*-aix*)
312290001Sglebius    AC_CHECK_HEADERS([utmpx.h])
313181834Sroberto    case "$ac_cv_header_utmpx_h" in
314290001Sglebius     yes)
315290001Sglebius	;;
316290001Sglebius     *)
317290001Sglebius	AC_CHECK_HEADERS([utmp.h])
318290001Sglebius	;;
319181834Sroberto    esac
320181834Sroberto    ;;
321290001Sglebius *)
322290001Sglebius    AC_CHECK_HEADERS([utmp.h utmpx.h])
323290001Sglebius    ;;
324181834Srobertoesac
325290001Sglebius
326290001Sglebius#
327290001Sglebius# On Suns only (so far) getpass() truncates the typed password to 8
328290001Sglebius# characters, but getpassphrase() allows up to 257.  Most systems'
329290001Sglebius# getpass() does not truncate, at least not so as to affect ntpq and
330290001Sglebius# ntpdc password prompts.
331290001Sglebius#
332290001Sglebius# So check for getpassphrase(), but only on Sun operating systems.
333290001Sglebius#
334290001Sglebiuscase "$host" in
335290001Sglebius *-*-sunos*|*-*-solaris*)
336290001Sglebius    AC_CHECK_FUNCS([getpassphrase])
337290001Sglebiusesac
338290001Sglebius
339290001Sglebius
340290001SglebiusAC_CHECK_HEADERS([net/if6.h])
341290001SglebiusAC_CHECK_HEADERS([net/route.h], [], [], [
342290001Sglebius    #include <sys/types.h>
343290001Sglebius    #include <sys/socket.h>
344290001Sglebius    #include <net/if.h>
345181834Sroberto])
346200576Sroberto
347290001SglebiusAC_CHECK_HEADERS([netinfo/ni.h])
348290001Sglebiuscase "$ac_cv_header_netinfo_ni_h" in
349200576Sroberto yes)
350290001Sglebius    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
351200576Srobertoesac
352290001SglebiusAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
353181834Srobertocase "$host" in
354290001Sglebius *-*-sunos4*)
355181834Sroberto    ;;
356290001Sglebius *)
357290001Sglebius    AC_CHECK_HEADERS([sys/ioctl.h])
358290001Sglebius    ;;
359181834Srobertoesac
360290001SglebiusAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
361181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
362290001SglebiusAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
363181834Srobertocase "$ac_cv_header_sched_h" in
364290001Sglebius yes)
365181834Sroberto    ;;
366290001Sglebius *)
367290001Sglebius    AC_CHECK_HEADERS([sys/sched.h])
368290001Sglebius    ;;
369181834Srobertoesac
370181834Sroberto# HMS: Check sys/shm.h after some others
371290001SglebiusAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
372181834Sroberto# HMS: Checked sys/socket.h earlier
373181834Srobertocase "$host" in
374290001Sglebius *-*-netbsd*)
375181834Sroberto    ;;
376290001Sglebius *)
377290001Sglebius    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
378290001Sglebius    ;;
379181834Srobertoesac
380290001SglebiusAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
381290001SglebiusAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
382181834Srobertocase "$host" in
383181834Sroberto*-convex-*)
384290001Sglebius    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
385290001Sglebius    ;;
386181834Sroberto*-*-bsdi*)
387290001Sglebius    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
388290001Sglebius    ;;
389181834Srobertoesac
390181834Sroberto
391290001Sglebiuscase "$ac_cv_header_stdatomic_h" in
392290001Sglebius yes)
393290001Sglebius	AC_CHECK_FUNCS([atomic_thread_fence])
394290001Sglebius	AC_CACHE_CHECK(
395290001Sglebius	    [for atomic_thread_fence()],
396290001Sglebius	    [ntp_cv_func_atomic_thread_fence],
397290001Sglebius	    [AC_COMPILE_IFELSE(
398290001Sglebius		[AC_LANG_PROGRAM(
399290001Sglebius		    [[
400290001Sglebius			#include <stdatomic.h>
401290001Sglebius		    ]],
402290001Sglebius		    [[
403290001Sglebius			atomic_thread_fence(memory_order_seq_cst);
404290001Sglebius		    ]]
405290001Sglebius		)]
406290001Sglebius		[ntp_cv_func_atomic_thread_fence=yes],
407290001Sglebius		[ntp_cv_func_atomic_thread_fence=no]
408290001Sglebius	    )]
409290001Sglebius	)
410290001Sglebius    ;;
411290001Sglebiusesac
412290001Sglebius
413181834Srobertocase "$host" in
414290001Sglebius *-*-solaris2.6)
415290001Sglebius    # Broken...
416181834Sroberto    ;;
417181834Sroberto *)
418290001Sglebius    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
419181834Sroberto    ;;
420181834Srobertoesac
421181834Sroberto
422290001Sglebiuscase "$host" in
423290001Sglebius *-*-*linux*)
424290001Sglebius    case "$ac_cv_func_ntp_gettime" in
425290001Sglebius     yes)
426290001Sglebius	;;
427290001Sglebius     *)
428290001Sglebius	AC_CHECK_FUNCS([__ntp_gettime])
429290001Sglebius	case "$ac_cv_func___ntp_gettime" in
430290001Sglebius	 yes)
431290001Sglebius	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
432290001Sglebius		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
433290001Sglebius	esac
434290001Sglebius	;;
435290001Sglebius    esac
436290001Sglebius    AC_CHECK_FUNCS([adjtimex])
437290001Sglebius    case "$ac_cv_func_adjtimex" in
438290001Sglebius     yes)
439290001Sglebius	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
440290001Sglebius	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
441290001Sglebius	have_adjtimex=1
442290001Sglebius	;;
443290001Sglebius     *)
444290001Sglebius	AC_CHECK_FUNCS([__adjtimex])
445290001Sglebius	case "$ac_cv_func___adjtimex" in
446290001Sglebius	 yes)
447290001Sglebius	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
448290001Sglebius	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
449290001Sglebius	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
450290001Sglebius	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
451290001Sglebius	    have_adjtimex=1
452290001Sglebius	esac
453290001Sglebius	;;
454290001Sglebius    esac
455290001Sglebiusesac
456290001Sglebiuscase "$have_adjtimex" in
457290001Sglebius '')
458290001Sglebius    # nlist stuff is only needed for tickadj.
459290001Sglebius    saved_LIBS="$LIBS"
460290001Sglebius    LIBS=
461290001Sglebius    AC_SEARCH_LIBS([nlist], [elf ld mld])
462290001Sglebius    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
463290001Sglebius    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
464290001Sglebius    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
465290001Sglebius    AC_CHECK_HEADERS([nlist.h sys/var.h])
466290001Sglebius    case "$ac_cv_header_nlist_h" in
467290001Sglebius     yes)
468290001Sglebius	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
469290001Sglebius	AC_CACHE_CHECK(
470290001Sglebius	    [for n_un in struct nlist],
471290001Sglebius	    [ntp_cv_struct_nlist_n_un],
472290001Sglebius	    [AC_COMPILE_IFELSE(
473290001Sglebius		[AC_LANG_PROGRAM(
474290001Sglebius		    [[
475290001Sglebius			#include <nlist.h>
476290001Sglebius		    ]],
477290001Sglebius		    [[
478290001Sglebius			struct nlist n;
479290001Sglebius			n.n_un.n_name = 0;
480290001Sglebius		    ]]
481290001Sglebius		)]
482290001Sglebius		[ntp_cv_struct_nlist_n_un=yes],
483290001Sglebius		[ntp_cv_struct_nlist_n_un=no]
484290001Sglebius	    )]
485290001Sglebius	)
486290001Sglebius	case "$ntp_cv_struct_nlist_n_un" in
487290001Sglebius	 yes)
488290001Sglebius	    AC_DEFINE([NLIST_NAME_UNION], [1],
489290001Sglebius		[does struct nlist use a name union?])
490290001Sglebius	esac
491290001Sglebius    esac
492290001Sglebius    AC_SUBST([LDADD_NLIST])
493290001Sglebius    LDADD_NLIST="$LIBS"
494290001Sglebius    LIBS="$saved_LIBS"
495290001Sglebius    AS_UNSET([saved_LIBS])
496290001Sglebiusesac
497181834Sroberto
498290001SglebiusAC_CHECK_HEADERS([sys/proc.h], [], [], [
499290001Sglebius    #ifdef HAVE_SYS_TYPES_H
500290001Sglebius    # include <sys/types.h>
501290001Sglebius    #endif
502290001Sglebius    #ifdef HAVE_SYS_TIME_H
503290001Sglebius    # include <sys/time.h>
504290001Sglebius    #endif
505181834Sroberto])
506181834Sroberto
507290001SglebiusAC_CHECK_HEADERS([sys/resource.h], [], [], [
508290001Sglebius    #ifdef HAVE_SYS_TIME_H
509290001Sglebius    # include <sys/time.h>
510290001Sglebius    #endif
511181834Sroberto])
512181834Sroberto
513290001SglebiusAC_CHECK_HEADERS([sys/shm.h], [], [], [
514290001Sglebius    #ifdef HAVE_SYS_TYPES_H
515290001Sglebius    # include <sys/types.h>
516290001Sglebius    #endif
517290001Sglebius    #ifdef HAVE_SYS_IPC_H
518290001Sglebius    # include <sys/ipc.h>
519290001Sglebius    #endif
520181834Sroberto])
521181834Sroberto
522290001SglebiusAC_CHECK_HEADERS([sys/timex.h], [], [], [
523290001Sglebius    #ifdef HAVE_SYS_TIME_H
524290001Sglebius    # include <sys/time.h>
525290001Sglebius    #endif
526181834Sroberto])
527181834Sroberto
528181834SrobertoAC_TYPE_SIGNAL
529181834SrobertoAC_TYPE_OFF_T
530290001SglebiusAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
531181834Sroberto
532290001SglebiusAC_CACHE_CHECK(
533290001Sglebius    [for a fallback value for HZ],
534290001Sglebius    [ntp_cv_default_hz],
535290001Sglebius    [
536290001Sglebius	ntp_cv_default_hz=100
537290001Sglebius	case "$host" in
538290001Sglebius	 alpha*-dec-osf4*|alpha*-dec-osf5*)
539290001Sglebius	    ntp_cv_default_hz=1024
540290001Sglebius	    ;;
541290001Sglebius	 mips-dec-ultrix4*)
542290001Sglebius	    ntp_cv_default_hz=256
543290001Sglebius	    ;;
544290001Sglebius	esac
545290001Sglebius    ]
546290001Sglebius)
547290001SglebiusAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
548290001Sglebius    [What is the fallback value for HZ?])
549181834Sroberto
550290001SglebiusAC_CACHE_CHECK(
551290001Sglebius    [if we need to override the system's value for HZ],
552290001Sglebius    [ntp_cv_override_hz],
553290001Sglebius    [
554290001Sglebius	ntp_cv_override_hz=no
555290001Sglebius	case "$host" in
556290001Sglebius	 alpha*-dec-osf4*|alpha*-dec-osf5*)
557290001Sglebius	    ntp_cv_override_hz=yes
558290001Sglebius	    ;;
559290001Sglebius	 mips-dec-ultrix4*)
560290001Sglebius	    ntp_cv_override_hz=yes
561290001Sglebius	    ;;
562290001Sglebius	 *-*-freebsd*)
563290001Sglebius	    ntp_cv_override_hz=yes
564290001Sglebius	    ;;
565290001Sglebius	 *-*-sunos4*)
566290001Sglebius	    ntp_cv_override_hz=yes
567290001Sglebius	    ;;
568290001Sglebius	 *-*-kfreebsd*)
569290001Sglebius	    ntp_cv_override_hz=yes
570290001Sglebius	    ;;
571290001Sglebius	esac
572290001Sglebius    ]
573290001Sglebius)
574290001Sglebiuscase "$ntp_cv_override_hz" in
575181834Sroberto yes)
576290001Sglebius    AC_DEFINE([OVERRIDE_HZ], [1],
577290001Sglebius	[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
602290001SglebiusAC_CACHE_CHECK(
603290001Sglebius    [for struct rt_msghdr],
604290001Sglebius    [ntp_cv_struct_rt_msghdr],
605290001Sglebius    [AC_COMPILE_IFELSE(
606290001Sglebius	[AC_LANG_PROGRAM(
607290001Sglebius	    [[
608290001Sglebius		#include <sys/types.h>
609290001Sglebius		#include <sys/socket.h>
610290001Sglebius		#include <net/if.h>
611290001Sglebius		#include <net/route.h>
612290001Sglebius	    ]],
613290001Sglebius	    [[
614290001Sglebius		struct rt_msghdr p;
615290001Sglebius	    ]]
616290001Sglebius	)],
617290001Sglebius	[ntp_cv_struct_rt_msghdr=yes],
618290001Sglebius	[ntp_cv_struct_rt_msghdr=no]
619290001Sglebius    )]
620290001Sglebius)
621200576Sroberto
622181834SrobertoAC_CACHE_CHECK(
623290001Sglebius    [for struct rtattr],
624290001Sglebius    [ntp_cv_rtattr],
625290001Sglebius    [AC_COMPILE_IFELSE(
626290001Sglebius	[AC_LANG_PROGRAM(
627290001Sglebius	    [[
628290001Sglebius		#include <stddef.h>
629290001Sglebius		#include <sys/socket.h>
630290001Sglebius		#include <linux/rtnetlink.h>
631290001Sglebius	    ]],
632290001Sglebius	    [[
633290001Sglebius		struct rtattr p;
634290001Sglebius	    ]]
635290001Sglebius	)],
636290001Sglebius	[ntp_cv_rtattr=yes],
637290001Sglebius	[ntp_cv_rtattr=no]
638290001Sglebius    )]
639181834Sroberto)
640181834Sroberto
641290001Sglebiuscase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
642290001Sglebius *yes*)
643290001Sglebius    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
644290001Sglebius	[Do we have a routing socket (rt_msghdr or rtattr)?])
645290001Sglebius    case "$ntp_cv_rtattr" in
646290001Sglebius     yes)
647290001Sglebius	AC_DEFINE([HAVE_RTNETLINK], [1],
648290001Sglebius	    [Do we have Linux routing socket?])
649181834Sroberto    esac
650290001Sglebiusesac
651181834Sroberto
652290001SglebiusAC_CACHE_CHECK(
653290001Sglebius    [struct sigaction for sa_sigaction],
654290001Sglebius    [ntp_cv_struct_sigaction_has_sa_sigaction],
655290001Sglebius    [AC_COMPILE_IFELSE(
656290001Sglebius	[AC_LANG_PROGRAM(
657290001Sglebius	    [[
658290001Sglebius		#include <signal.h>
659290001Sglebius	    ]],
660290001Sglebius	    [[
661290001Sglebius		struct sigaction act;
662290001Sglebius		act.sa_sigaction = 0;
663290001Sglebius	    ]]
664290001Sglebius	)],
665290001Sglebius	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
666290001Sglebius	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
667290001Sglebius    )]
668290001Sglebius)
669290001Sglebiuscase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
670290001Sglebius yes)
671290001Sglebius    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
672290001Sglebiusesac
673181834Sroberto
674290001SglebiusAC_CACHE_CHECK(
675290001Sglebius    [for struct ppsclockev],
676290001Sglebius    [ntp_cv_struct_ppsclockev],
677290001Sglebius    [AC_COMPILE_IFELSE(
678290001Sglebius	[AC_LANG_PROGRAM(
679290001Sglebius	    [[
680290001Sglebius		#ifdef HAVE_SYS_TYPES_H
681290001Sglebius		# include <sys/types.h>
682290001Sglebius		#endif
683290001Sglebius		#ifdef HAVE_SYS_TERMIOS_H
684290001Sglebius		# include <sys/termios.h>
685290001Sglebius		#endif
686290001Sglebius		#ifdef HAVE_SYS_TIME_H
687290001Sglebius		# include <sys/time.h>
688290001Sglebius		#endif
689290001Sglebius		#ifdef HAVE_SYS_PPSCLOCK_H
690290001Sglebius		# include <sys/ppsclock.h>
691290001Sglebius		#endif
692290001Sglebius	    ]],
693290001Sglebius	    [[
694290001Sglebius		extern struct ppsclockev *pce;
695290001Sglebius		return pce->serial;
696290001Sglebius	    ]]
697290001Sglebius	)],
698290001Sglebius	[ntp_cv_struct_ppsclockev=yes],
699290001Sglebius	[ntp_cv_struct_ppsclockev=no]
700290001Sglebius    )]
701290001Sglebius)
702290001Sglebiuscase "$ntp_cv_struct_ppsclockev" in
703290001Sglebius yes)
704290001Sglebius    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
705290001Sglebius	[Does a system header define struct ppsclockev?])
706290001Sglebiusesac
707181834Sroberto
708181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
709181834Sroberto  *yes*)
710290001Sglebius    AC_CACHE_CHECK(
711290001Sglebius	[for struct snd_size],
712290001Sglebius	[ntp_cv_struct_snd_size],
713290001Sglebius	[AC_COMPILE_IFELSE(
714290001Sglebius	    [AC_LANG_PROGRAM(
715290001Sglebius		[[
716290001Sglebius		    #ifdef HAVE_MACHINE_SOUNDCARD_H
717290001Sglebius		    # include <machine/soundcard.h>
718290001Sglebius		    #endif
719290001Sglebius		    #ifdef HAVE_SYS_SOUNDCARD_H
720290001Sglebius		    # include <sys/soundcard.h>
721290001Sglebius		    #endif
722290001Sglebius		]],
723290001Sglebius		[[
724290001Sglebius		    extern struct snd_size *ss;
725290001Sglebius		    return ss->rec_size;
726290001Sglebius		]]
727290001Sglebius	    )],
728290001Sglebius	    [ntp_cv_struct_snd_size=yes],
729290001Sglebius	    [ntp_cv_struct_snd_size=no]
730290001Sglebius        )]
731290001Sglebius    )
732290001Sglebius    case "$ntp_cv_struct_snd_size" in
733290001Sglebius     yes)
734290001Sglebius	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
735290001Sglebius	    [Do we have struct snd_size?])
736181834Sroberto    esac
737181834Srobertoesac
738181834Sroberto
739290001SglebiusAC_CACHE_CHECK(
740290001Sglebius    [struct clockinfo for hz],
741290001Sglebius    [ntp_cv_struct_clockinfo_has_hz],
742290001Sglebius    [AC_COMPILE_IFELSE(
743290001Sglebius	[AC_LANG_PROGRAM(
744290001Sglebius	    [[
745290001Sglebius		#include <sys/time.h>
746290001Sglebius	    ]],
747290001Sglebius	    [[
748290001Sglebius		extern struct clockinfo *pc;
749290001Sglebius		return pc->hz;
750290001Sglebius	    ]]
751290001Sglebius	)],
752290001Sglebius	[ntp_cv_struct_clockinfo_has_hz=yes],
753290001Sglebius	[ntp_cv_struct_clockinfo_has_hz=no]
754290001Sglebius    )]
755290001Sglebius)
756290001Sglebiuscase "$ntp_cv_struct_clockinfo_has_hz" in
757290001Sglebius yes)
758290001Sglebius    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
759290001Sglebiusesac
760181834Sroberto
761290001SglebiusAC_CACHE_CHECK(
762290001Sglebius    [struct clockinfo for tickadj],
763290001Sglebius    [ntp_cv_struct_clockinfo_has_hz],
764290001Sglebius    [AC_COMPILE_IFELSE(
765290001Sglebius	[AC_LANG_PROGRAM(
766290001Sglebius	    [[
767290001Sglebius		#include <sys/time.h>
768290001Sglebius	    ]],
769290001Sglebius	    [[
770290001Sglebius		extern struct clockinfo *pc;
771290001Sglebius		return pc->tickadj;
772290001Sglebius	    ]]
773290001Sglebius	)],
774290001Sglebius	[ntp_cv_struct_clockinfo_has_hz=yes],
775290001Sglebius	[ntp_cv_struct_clockinfo_has_hz=no]
776290001Sglebius    )]
777290001Sglebius)
778290001Sglebiuscase "$ntp_cv_struct_clockinfo_has_hz" in
779290001Sglebius yes)
780290001Sglebius    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
781290001Sglebiusesac
782181834Sroberto
783290001Sglebiuscase "$ntp_cv_struct_ntptimeval" in
784290001Sglebius yes)
785290001Sglebius    AC_CHECK_MEMBERS(
786290001Sglebius	[struct ntptimeval.time.tv_nsec],
787290001Sglebius	[],
788290001Sglebius	[],
789290001Sglebius	[
790290001Sglebius	    #ifdef HAVE_SYS_TIME_H
791290001Sglebius	    # include <sys/time.h>
792290001Sglebius	    #else
793290001Sglebius	    # ifdef HAVE_TIME_H
794290001Sglebius	    #  include <time.h>
795290001Sglebius	    # endif
796290001Sglebius	    #endif
797290001Sglebius	    #ifdef HAVE_SYS_TIMEX_H
798290001Sglebius	    # include <sys/timex.h>
799290001Sglebius	    #else
800290001Sglebius	    # ifdef HAVE_TIMEX_H
801290001Sglebius	    #  include <timex.h>
802290001Sglebius	    # endif
803290001Sglebius	    #endif
804290001Sglebius	]
805290001Sglebius    )
806200576Srobertoesac
807200576Sroberto
808290001Sglebius#### 
809181834Sroberto
810290001SglebiusAC_CHECK_FUNCS([arc4random_buf])
811181834Sroberto
812290001Sglebius#### 
813181834Sroberto
814290001Sglebiussaved_LIBS="$LIBS"
815290001SglebiusLIBS="$LIBS $LDADD_LIBNTP"
816290001SglebiusAC_CHECK_FUNCS([daemon])
817290001Sglebius# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
818290001SglebiusLIBS="$saved_LIBS"
819290001SglebiusAS_UNSET([saved_LIBS])
820181834Sroberto
821290001SglebiusAC_CHECK_FUNCS(
822290001Sglebius    [finite],
823290001Sglebius    [],
824290001Sglebius    [AC_CHECK_FUNCS(
825290001Sglebius	[isfinite],
826290001Sglebius	[],
827290001Sglebius	[
828290001Sglebius	    AC_MSG_CHECKING([for isfinite with <math.h>])
829290001Sglebius	    _libs=$LIBS
830290001Sglebius	    # XXX
831290001Sglebius	    LIBS="$LIBS -lm"
832290001Sglebius	    AC_LINK_IFELSE(
833290001Sglebius		[AC_LANG_PROGRAM(
834290001Sglebius		    [[
835290001Sglebius			#include <math.h>
836290001Sglebius		    ]],
837290001Sglebius		    [[
838290001Sglebius			float f = 0.0;
839290001Sglebius			isfinite(f);
840290001Sglebius		    ]]
841290001Sglebius		)],
842290001Sglebius		[ans=yes],
843290001Sglebius		[ans=no]
844290001Sglebius	    )
845290001Sglebius	    LIBS=$_libs
846290001Sglebius	    AC_MSG_RESULT([$ans])
847290001Sglebius	    case "$ans" in
848290001Sglebius	     yes)
849290001Sglebius		AC_DEFINE([HAVE_ISFINITE], [1])
850290001Sglebius	    esac
851290001Sglebius	]
852290001Sglebius    )]
853290001Sglebius)
854181834Sroberto
855290001SglebiusAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
856181834Sroberto
857290001Sglebius# kvm_open() is only used by tickadj.  Also see above.
858290001Sglebiuscase "$ac_cv_header_kvm_h" in
859290001Sglebius yes)
860290001Sglebius    AC_CHECK_FUNCS([kvm_open])
861181834Sroberto    ;;
862181834Srobertoesac
863181834Sroberto
864181834Srobertocase "$host" in
865181834Sroberto *-*-sco3.2v5.0.*)
866290001Sglebius    # Just stubs.  Sigh.
867181834Sroberto    ;;
868290001Sglebius *) AC_CHECK_FUNCS([mkstemp])
869181834Sroberto    ;;
870181834Srobertoesac
871290001SglebiusAC_CHECK_FUNCS([mktime])
872181834Srobertocase "$host" in
873290001Sglebius *-*-aix[[4-9]]*)
874290001Sglebius    # XXX only verified thru AIX6.
875290001Sglebius    # Just a stub.  Sigh.
876181834Sroberto    ;;
877181834Sroberto *-*-irix[[45]]*)
878290001Sglebius    # Just a stub in "old" Irix.  Sigh.
879181834Sroberto    ;;
880290001Sglebius# In the belief that the fix for bug 1223 fixes mlockall() under linux...
881290001Sglebius# *-*-*linux*)
882290001Sglebius#    # there, but more trouble than it is worth for now (resolver problems)
883290001Sglebius#    ;;
884181834Sroberto *-*-qnx*)
885290001Sglebius    # Apparently there but not working in QNX.  Sigh?
886181834Sroberto    ;;
887181834Sroberto *-*-sco3.2v5.0.*)
888290001Sglebius    # 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.
893290001Sglebius    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
894290001Sglebius    AC_CHECK_FUNCS([mlockall])
895181834Sroberto    ;;
896290001Sglebius *) AC_CHECK_FUNCS([mlockall])
897181834Sroberto    ;;
898181834Srobertoesac
899290001SglebiusAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
900181834Srobertocase "$host" in
901290001Sglebius *-*-aix[[4-9]]*)
902290001Sglebius    # XXX only verified thru AIX6.
903290001Sglebius    # Just a stub in AIX 4.  Sigh.
904181834Sroberto    ;;
905181834Sroberto *-*-solaris2.5*)
906290001Sglebius    # Just stubs in solaris2.5.  Sigh.
907181834Sroberto    ;;
908290001Sglebius *) AC_CHECK_FUNCS([sched_setscheduler])
909181834Sroberto    ;;
910181834Srobertoesac
911290001SglebiusAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
912290001SglebiusAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
913181834Srobertocase "$host" in
914290001Sglebius *-*-aix[[4-9]]*)
915290001Sglebius    # XXX only verified thru AIX6.
916290001Sglebius    # Just stubs.  Sigh.
917181834Sroberto    ;;
918181834Sroberto *-*-netbsd1*)
919290001Sglebius    # Just stubs.  Sigh.
920181834Sroberto    ;;
921181834Sroberto *-*-netbsdelf1*)
922290001Sglebius    # Just stubs.  Sigh.
923181834Sroberto    ;;
924181834Sroberto *-*-openbsd*)
925290001Sglebius    # Just stubs.  Sigh.
926181834Sroberto    ;;
927290001Sglebius *)
928290001Sglebius    AC_CHECK_FUNCS([timer_create])
929181834Sroberto    ;;
930181834Srobertoesac
931290001Sglebius
932290001SglebiusNTP_RLIMIT_ITEMS
933290001Sglebius
934290001Sglebius# some OSes prefer _exit() in forked children to exit()
935290001SglebiusAC_CHECK_FUNCS([_exit])
936290001Sglebiusntp_worker_child_exit=exit
937290001Sglebiuscase "$ac_cv_func__exit::$host_os" in
938290001Sglebius yes::netbsd*)
939290001Sglebius    ntp_worker_child_exit=_exit
940181834Sroberto    ;;
941290001Sglebius yes::openbsd*)
942290001Sglebius    ntp_worker_child_exit=_exit
943181834Sroberto    ;;
944181834Srobertoesac
945290001SglebiusAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
946290001Sglebius		   [routine worker child proc uses to exit.])
947181834Sroberto
948290001SglebiusAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
949290001Sglebius
950181834Sroberto###
951181834Sroberto
952200576Sroberto# http://bugs.ntp.org/737
953181834Srobertocase "$ac_cv_func_recvmsg" in
954181834Sroberto yes)
955290001Sglebius    AC_CACHE_CHECK(
956290001Sglebius	[if we need extra help to define struct iovec],
957290001Sglebius	[ntp_cv_struct_iovec_help],
958290001Sglebius	[
959290001Sglebius	    compiled=no
960290001Sglebius	    for ntp_cv_struct_iovec_help in '0' '1'; do
961290001Sglebius		AC_COMPILE_IFELSE(
962290001Sglebius		    [AC_LANG_PROGRAM(
963290001Sglebius			[[
964290001Sglebius			    #ifdef HAVE_SYS_TYPES_H
965290001Sglebius			    # include <sys/types.h>
966290001Sglebius			    #endif
967290001Sglebius			    #ifdef HAVE_SYS_SOCKET_H
968290001Sglebius			    # include <sys/socket.h>
969290001Sglebius			    #endif
970290001Sglebius			    #if $ntp_cv_struct_iovec_help
971290001Sglebius			    # include <sys/uio.h>
972290001Sglebius			    #endif
973290001Sglebius			]],
974290001Sglebius			[[
975290001Sglebius			    void foo(void) {
976290001Sglebius				ssize_t x;
977290001Sglebius				int s = 0;
978290001Sglebius				struct iovec iov;
979290001Sglebius				struct msghdr mh;
980290001Sglebius				int flags = 0;
981181834Sroberto
982290001Sglebius				mh.msg_iov = &iov;
983290001Sglebius				x = recvmsg(s, &mh, flags);
984290001Sglebius			    }
985290001Sglebius			]]
986290001Sglebius		    )],
987290001Sglebius		    [compiled=yes ; break 1],
988290001Sglebius		    []
989290001Sglebius		)
990290001Sglebius	    done
991290001Sglebius	    case "$compiled" in
992290001Sglebius	     no)
993290001Sglebius		ntp_cv_struct_iovec_help=0
994290001Sglebius	    esac
995290001Sglebius	    AS_UNSET([compiled])
996290001Sglebius	]
997290001Sglebius    )
998290001Sglebius    case "$ntp_cv_struct_iovec_help" in
999290001Sglebius     1)
1000290001Sglebius	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1001290001Sglebius	    [Use sys/uio.h for struct iovec help])
1002181834Sroberto    esac
1003181834Srobertoesac
1004181834Sroberto
1005290001SglebiusAC_CACHE_CHECK(
1006290001Sglebius    [number of arguments taken by setpgrp()],
1007290001Sglebius    [ntp_cv_func_setpgrp_nargs],
1008290001Sglebius    [AC_COMPILE_IFELSE(
1009290001Sglebius	[AC_LANG_PROGRAM(
1010290001Sglebius	    [[
1011290001Sglebius		#ifdef HAVE_SYS_TYPES_H
1012290001Sglebius		# include <sys/types.h>
1013290001Sglebius		#endif
1014290001Sglebius		#ifdef HAVE_UNISTD_H
1015290001Sglebius		# include <unistd.h>
1016290001Sglebius		#endif
1017290001Sglebius	    ]],
1018290001Sglebius	    [[
1019290001Sglebius		setpgrp(0, 0);
1020290001Sglebius	    ]]
1021290001Sglebius	)],
1022290001Sglebius	[ntp_cv_func_setpgrp_nargs=2],
1023290001Sglebius	[ntp_cv_func_setpgrp_nargs=0]
1024290001Sglebius    )]
1025290001Sglebius)
1026290001Sglebiuscase "$ntp_cv_func_setpgrp_nargs" in
1027290001Sglebius 0)
1028290001Sglebius    AC_DEFINE([HAVE_SETPGRP_0], [1],
1029290001Sglebius	      [define if setpgrp takes 0 arguments])
1030181834Srobertoesac
1031181834Sroberto
1032290001SglebiusAC_CACHE_CHECK(
1033290001Sglebius    [if we need to declare 'errno'],
1034290001Sglebius    [ntp_cv_decl_errno],
1035290001Sglebius    [AC_COMPILE_IFELSE(
1036290001Sglebius	[AC_LANG_PROGRAM(
1037290001Sglebius	    [[
1038290001Sglebius		#ifdef HAVE_ERRNO_H
1039290001Sglebius		# include <errno.h>
1040290001Sglebius		#endif
1041290001Sglebius	    ]],
1042290001Sglebius	    [[
1043290001Sglebius		errno = 0;
1044290001Sglebius	    ]]
1045290001Sglebius	)],
1046290001Sglebius	[ntp_cv_decl_errno=no],
1047290001Sglebius	[ntp_cv_decl_errno=yes]
1048290001Sglebius    )]
1049290001Sglebius)
1050290001Sglebiuscase "$ntp_cv_decl_errno" in
1051290001Sglebius yes)
1052290001Sglebius    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
1060290001SglebiusAC_CACHE_CHECK(
1061290001Sglebius    [if we may declare 'h_errno'],
1062290001Sglebius    [ntp_cv_decl_h_errno],
1063290001Sglebius    [AC_COMPILE_IFELSE(
1064290001Sglebius	[AC_LANG_PROGRAM(
1065290001Sglebius	    [[
1066290001Sglebius		#include <sys/types.h>
1067290001Sglebius		#ifdef HAVE_NETINET_IN_H
1068290001Sglebius		# include <netinet/in.h>
1069290001Sglebius		#endif
1070290001Sglebius		#ifdef HAVE_ARPA_NAMESER_H
1071290001Sglebius		# include <arpa/nameser.h>
1072290001Sglebius		#endif
1073290001Sglebius		#ifdef HAVE_NETDB_H
1074290001Sglebius		# include <netdb.h>
1075290001Sglebius		#endif
1076290001Sglebius		#ifdef HAVE_RESOLV_H
1077290001Sglebius		# include <resolv.h>
1078290001Sglebius		#endif
1079290001Sglebius	    ]],
1080290001Sglebius	    [[
1081290001Sglebius		extern int h_errno;
1082290001Sglebius	    ]]
1083290001Sglebius	)],
1084290001Sglebius	[ntp_cv_decl_h_errno=yes],
1085290001Sglebius	[ntp_cv_decl_h_errno=no]
1086290001Sglebius    )]
1087290001Sglebius)
1088290001Sglebiuscase "$ntp_cv_decl_h_errno" in
1089290001Sglebius yes)
1090290001Sglebius    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1091181834Srobertoesac
1092181834Sroberto
1093290001SglebiusAC_CACHE_CHECK(
1094290001Sglebius    [if declaring 'syscall()' is ok],
1095290001Sglebius    [ntp_cv_decl_syscall],
1096290001Sglebius    [AC_COMPILE_IFELSE(
1097290001Sglebius	[AC_LANG_PROGRAM(
1098290001Sglebius	    [[
1099290001Sglebius		#ifdef HAVE_SYS_TYPES_H
1100290001Sglebius		# include <sys/types.h>
1101290001Sglebius		#endif
1102290001Sglebius		#ifdef HAVE_UNISTD_H
1103290001Sglebius		# include <unistd.h>
1104290001Sglebius		#endif
1105290001Sglebius	    ]],
1106290001Sglebius	    [[
1107290001Sglebius		extern int syscall (int, ...);
1108290001Sglebius	    ]]
1109290001Sglebius	)]
1110290001Sglebius	[ntp_cv_decl_syscall=yes],
1111290001Sglebius	[ntp_cv_decl_syscall=no]
1112290001Sglebius    )]
1113290001Sglebius)
1114290001Sglebiuscase "$ntp_cv_decl_syscall" in
1115290001Sglebius yes)
1116290001Sglebius    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1117181834Srobertoesac
1118181834Sroberto
1119181834Srobertocase "$host" in
1120181834Sroberto *-*-aix4.3.*)
1121290001Sglebius    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1122181834Sroberto    ;;
1123181834Sroberto *-*-mpeix*)
1124290001Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1125290001Sglebius    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1126290001Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1127290001Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1128290001Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1129290001Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1130290001Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1131181834Sroberto    ;;
1132181834Sroberto *-*-osf[[45]]*)
1133290001Sglebius    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1134290001Sglebius    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1135181834Sroberto    ;;
1136181834Sroberto *-*-qnx*)
1137290001Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1138181834Sroberto    ;;
1139181834Sroberto *-*-riscos4*)
1140290001Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141290001Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1142290001Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1143290001Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1144290001Sglebius    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1145290001Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1146290001Sglebius    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1147290001Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1148290001Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1149290001Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1150290001Sglebius    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1151290001Sglebius    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1152290001Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1153290001Sglebius    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1154290001Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1155290001Sglebius    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1156181834Sroberto    ;;
1157181834Sroberto *-*-solaris2*)
1158290001Sglebius    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1159290001Sglebius    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1160181834Sroberto    case "$host" in
1161181834Sroberto     *-*-solaris2.4)
1162290001Sglebius        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1163181834Sroberto	;;
1164181834Sroberto    esac
1165181834Sroberto    ;;
1166181834Sroberto *-*-sunos4*)
1167290001Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1168290001Sglebius    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1169290001Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1170290001Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1171290001Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1172290001Sglebius    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1173290001Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1174290001Sglebius    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1175290001Sglebius    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1176290001Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1177290001Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1178290001Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1179290001Sglebius    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1180181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1181181834Sroberto     acc*) ;;
1182290001Sglebius     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1183181834Sroberto	;;
1184181834Sroberto    esac
1185290001Sglebius    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1186290001Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1187290001Sglebius    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1188290001Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1189290001Sglebius    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1190290001Sglebius    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1191290001Sglebius    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1192181834Sroberto    ;;
1193181834Sroberto *-*-ultrix4*)
1194290001Sglebius    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1195290001Sglebius    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1196290001Sglebius    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1197290001Sglebius    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1198290001Sglebius    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1199290001Sglebius    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1200290001Sglebius    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1201290001Sglebius    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1202290001Sglebius    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1203290001Sglebius    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1204290001Sglebius    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1205290001Sglebius    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1206290001Sglebius    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1207290001Sglebius    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1208181834Sroberto    ;;
1209181834Srobertoesac
1210181834Sroberto
1211181834Srobertocase "$host" in
1212181834Sroberto *-*-sco3.2*)
1213290001Sglebius    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1214290001Sglebius	[Do we need to #define _SVID3 when we #include <termios.h>?])
1215181834Sroberto    ;;
1216181834Srobertoesac
1217181834Sroberto
1218181834Srobertocase "$host" in
1219181834Sroberto *-*-hpux[[567]]*)
1220290001Sglebius    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1221290001Sglebius	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1222181834Srobertoesac
1223181834Sroberto
1224290001Sglebiusdnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1225290001SglebiusAC_CACHE_CHECK(
1226290001Sglebius    [if we will open the broadcast socket],
1227290001Sglebius    [ntp_cv_var_open_bcast_socket],
1228290001Sglebius    [
1229290001Sglebius	ans=yes
1230290001Sglebius	case "$host" in
1231290001Sglebius	 *-*-domainos)
1232290001Sglebius	    ans=no
1233290001Sglebius	esac
1234290001Sglebius	ntp_cv_var_open_bcast_socket=$ans
1235290001Sglebius    ]
1236290001Sglebius)
1237290001Sglebiuscase "$ntp_cv_var_open_bcast_socket" in
1238290001Sglebius yes)
1239290001Sglebius    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1240290001Sglebius	[Should we open the broadcast socket?])
1241181834Srobertoesac
1242181834Sroberto
1243181834Srobertocase "$host" in
1244181834Sroberto *-*-hpux*)
1245290001Sglebius    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1246290001Sglebius	[Do we want the HPUX FindConfig()?])
1247181834Srobertoesac
1248181834Sroberto
1249290001Sglebiusdnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1250290001SglebiusAC_CACHE_CHECK(
1251290001Sglebius    [if process groups are set with -pid],
1252290001Sglebius    [ntp_cv_arg_setpgrp_negpid],
1253290001Sglebius    [
1254290001Sglebius	case "$host" in
1255290001Sglebius	 *-*-hpux[[567]]*)
1256290001Sglebius	    ans=no
1257290001Sglebius	    ;;
1258290001Sglebius	 *-*-hpux*)
1259290001Sglebius	    ans=yes
1260290001Sglebius	    ;;
1261290001Sglebius	 *-*-*linux*)
1262290001Sglebius	    ans=yes
1263290001Sglebius	    ;;
1264290001Sglebius	 *-*-sunos3*)
1265290001Sglebius	    ans=yes
1266290001Sglebius	    ;;
1267290001Sglebius	 *-*-ultrix2*)
1268290001Sglebius	    ans=yes
1269290001Sglebius	    ;;
1270290001Sglebius	 *)
1271290001Sglebius	    ans=no
1272290001Sglebius	    ;;
1273290001Sglebius	esac
1274290001Sglebius	ntp_cv_arg_setpgrp_negpid=$ans
1275290001Sglebius    ]
1276290001Sglebius)
1277290001Sglebiuscase "$ntp_cv_arg_setpgrp_negpid" in
1278181834Sroberto yes)
1279290001Sglebius    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1280290001Sglebius	[Do we set process groups with -pid?])
1281181834Srobertoesac
1282181834Sroberto
1283290001SglebiusAC_CACHE_CHECK(
1284290001Sglebius    [if we need a ctty for F_SETOWN],
1285290001Sglebius    [ntp_cv_func_ctty_for_f_setown],
1286290001Sglebius    [
1287290001Sglebius	case "$host" in
1288290001Sglebius	 *-*-bsdi[[23]]*)
1289290001Sglebius	    ans=yes
1290290001Sglebius	    ;;
1291290001Sglebius	 *-*-freebsd*)
1292290001Sglebius	    ans=yes
1293290001Sglebius	    ;;
1294290001Sglebius	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1295290001Sglebius	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1296290001Sglebius	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1297290001Sglebius	# in $host may be followed by "aout", "ecoff", or "elf".
1298290001Sglebius	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1299290001Sglebius	    ans=yes
1300290001Sglebius	    ;;
1301290001Sglebius	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1302290001Sglebius	    ans=yes
1303290001Sglebius	    ;;
1304290001Sglebius	 *-*-openbsd*)
1305290001Sglebius	    ans=yes
1306290001Sglebius	    ;;
1307290001Sglebius	 *-*-osf*)
1308290001Sglebius	    ans=yes
1309290001Sglebius	    ;;
1310290001Sglebius	 *-*-darwin*)
1311290001Sglebius	    ans=yes
1312290001Sglebius	    ;;
1313290001Sglebius	 *)
1314290001Sglebius	    ans=no
1315290001Sglebius	    ;;
1316290001Sglebius	esac
1317290001Sglebius	ntp_cv_func_ctty_for_f_setown=$ans
1318290001Sglebius    ]
1319290001Sglebius)
1320290001Sglebiuscase "$ntp_cv_func_ctty_for_f_setown" in
1321181834Sroberto yes)
1322290001Sglebius    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1323181834Srobertoesac
1324181834Sroberto
1325290001SglebiusAC_CACHE_CHECK(
1326290001Sglebius    [if the OS clears cached routes when more specifics become available],
1327290001Sglebius    [ntp_cv_os_routeupdates],
1328290001Sglebius    [
1329290001Sglebius	case "$host" in
1330290001Sglebius	 *-*-netbsd*)
1331290001Sglebius	    ans=yes
1332290001Sglebius	    ;;
1333290001Sglebius	 *)
1334290001Sglebius	    ans=no
1335290001Sglebius	    ;;
1336290001Sglebius	esac
1337290001Sglebius	ntp_cv_os_routeupdates=$ans
1338290001Sglebius    ]
1339290001Sglebius)
1340290001Sglebiuscase "$ntp_cv_os_routeupdates" in
1341181834Sroberto yes)
1342290001Sglebius    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1343290001Sglebius	[need to recreate sockets on changed routing?])
1344181834Srobertoesac
1345181834Sroberto
1346290001SglebiusAC_CACHE_CHECK(
1347290001Sglebius    [if the wildcard socket needs REUSEADDR to bind other addresses],
1348290001Sglebius    [ntp_cv_os_wildcardreuse],
1349290001Sglebius    [
1350290001Sglebius	case "$host" in
1351290001Sglebius	 *-*-*linux*)
1352290001Sglebius	    ans=yes
1353290001Sglebius	    ;;
1354290001Sglebius	 *) ans=no
1355290001Sglebius	    ;;
1356290001Sglebius	esac
1357290001Sglebius	ntp_cv_os_wildcardreuse=$ans
1358290001Sglebius    ]
1359290001Sglebius)
1360290001Sglebiuscase "$ntp_cv_os_wildcardreuse" in
1361181834Sroberto yes)
1362290001Sglebius    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1363290001Sglebius	[wildcard socket needs REUSEADDR to bind interface addresses])
1364181834Srobertoesac
1365181834Sroberto
1366181834Srobertocase "$host" in
1367181834Sroberto *-*-aix*)
1368290001Sglebius    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1369290001Sglebius	[Might nlist() values require an extra level of indirection (AIX)?])
1370181834Srobertoesac
1371181834Sroberto
1372290001SglebiusAC_CACHE_CHECK(
1373290001Sglebius    [for a minimum recommended value of tickadj],
1374290001Sglebius    [ntp_cv_var_min_rec_tickadj],
1375290001Sglebius    [
1376290001Sglebius	ans=no
1377290001Sglebius	case "$host" in
1378290001Sglebius	 *-*-aix*)
1379290001Sglebius	    ans=40
1380290001Sglebius	    ;;
1381290001Sglebius	esac
1382290001Sglebius	ntp_cv_var_min_rec_tickadj=$ans
1383290001Sglebius    ]
1384290001Sglebius)
1385290001Sglebiuscase "$ntp_cv_var_min_rec_tickadj" in
1386290001Sglebius ''|no)
1387181834Sroberto    ;;
1388290001Sglebius *)
1389290001Sglebius    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1390290001Sglebius	[Should we recommend a minimum value for tickadj?])
1391181834Srobertoesac
1392290001Sglebius
1393290001SglebiusAC_CACHE_CHECK(
1394290001Sglebius    [if the TTY code permits PARENB and IGNPAR],
1395290001Sglebius    [ntp_cv_no_parenb_ignpar],
1396290001Sglebius    [
1397290001Sglebius	ans=no
1398290001Sglebius	case "$host" in
1399290001Sglebius	 i?86-*-*linux*)
1400290001Sglebius	    ans=yes
1401290001Sglebius	    ;;
1402290001Sglebius	 mips-sgi-irix*)
1403290001Sglebius	    ans=yes
1404290001Sglebius	    ;;
1405290001Sglebius	 i?86-*-freebsd[[123]].*)
1406290001Sglebius	    ;;
1407290001Sglebius	 i?86-*-freebsd*)
1408290001Sglebius	    ans=yes
1409290001Sglebius	    ;;
1410290001Sglebius	 *-*-unicosmp*)
1411290001Sglebius	    ans=yes
1412290001Sglebius	    ;;
1413290001Sglebius	esac
1414290001Sglebius	ntp_cv_no_parenb_ignpar=$ans
1415290001Sglebius    ]
1416290001Sglebius)
1417290001Sglebiuscase "$ntp_cv_no_parenb_ignpar" in
1418290001Sglebius yes)
1419290001Sglebius    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1420290001Sglebius	[Is there a problem using PARENB and IGNPAR?])
1421181834Srobertoesac
1422181834Sroberto
1423290001SglebiusAC_MSG_CHECKING([if we're including processing time debugging code])
1424290001SglebiusAC_ARG_ENABLE(
1425290001Sglebius    [debug-timing],
1426290001Sglebius    [AS_HELP_STRING(
1427290001Sglebius	[--enable-debug-timing],
1428290001Sglebius	[- include processing time debugging code (costs performance)]
1429290001Sglebius    )],
1430290001Sglebius    [ntp_ok=$enableval],
1431290001Sglebius    [ntp_ok=no]
1432290001Sglebius)
1433290001Sglebiuscase "$ntp_ok" in
1434290001Sglebius yes)
1435290001Sglebius    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1436181834Srobertoesac
1437290001SglebiusAC_MSG_RESULT([$ntp_ok])
1438181834Sroberto
1439290001SglebiusAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1440200576SrobertoAC_ARG_ENABLE(
1441290001Sglebius    [dst-minutes],
1442290001Sglebius    [AS_HELP_STRING(
1443200576Sroberto	[--enable-dst-minutes],
1444290001Sglebius	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1445290001Sglebius    ],
1446200576Sroberto    [ans=$enableval],
1447200576Sroberto    [ans=60]
1448200576Sroberto)
1449290001SglebiusAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1450290001Sglebius    [The number of minutes in a DST adjustment])
1451200576SrobertoAC_MSG_RESULT([$ans])
1452181834Sroberto
1453290001SglebiusAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1454200576SrobertoAC_ARG_ENABLE(
1455200576Sroberto    [ignore-dns-errors],
1456290001Sglebius    [AS_HELP_STRING(
1457290001Sglebius	[--enable-ignore-dns-errors],
1458200576Sroberto	[- retry DNS queries on any error]
1459290001Sglebius    )],
1460200576Sroberto    [ans=$enableval],
1461200576Sroberto    [ans=no]
1462200576Sroberto)
1463200576Srobertocase "$ans" in
1464200576Sroberto yes)
1465290001Sglebius    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1466290001Sglebius	[Retry queries on _any_ DNS error?])
1467200576Srobertoesac
1468200576SrobertoAC_MSG_RESULT([$ans])
1469200576Sroberto
1470290001SglebiusAC_CACHE_CHECK(
1471290001Sglebius    [availability of ntp_{adj,get}time()],
1472290001Sglebius    [ntp_cv_var_ntp_syscalls],
1473290001Sglebius    [
1474290001Sglebius	ntp_cv_var_ntp_syscalls=no
1475290001Sglebius	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1476290001Sglebius	 yesyes*)
1477290001Sglebius	    ntp_cv_var_ntp_syscalls=libc
1478181834Sroberto	    ;;
1479290001Sglebius	 *yes)
1480290001Sglebius	    ntp_cv_var_ntp_syscalls=inline
1481181834Sroberto	    ;;
1482290001Sglebius	 *)
1483290001Sglebius	    AC_PREPROC_IFELSE(
1484290001Sglebius		[AC_LANG_SOURCE(
1485290001Sglebius		    [
1486290001Sglebius			#include <sys/syscall.h>
1487290001Sglebius			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1488290001Sglebius			# error
1489290001Sglebius			#endif
1490290001Sglebius		    ])],
1491290001Sglebius		[ntp_cv_var_ntp_syscalls=kernel]
1492290001Sglebius	    )
1493181834Sroberto	    ;;
1494290001Sglebius	 esac
1495290001Sglebius    ]
1496290001Sglebius)
1497290001Sglebiuscase "$ntp_cv_var_ntp_syscalls" in
1498181834Sroberto libc)
1499290001Sglebius    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1500290001Sglebius	[Do we have ntp_{adj,get}time in libc?])
1501181834Sroberto    ;;
1502181834Sroberto kernel)
1503290001Sglebius    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1504290001Sglebius	[Do we have ntp_{adj,get}time in the kernel?])
1505181834Sroberto    ;;
1506181834Srobertoesac
1507181834Sroberto
1508290001SglebiusAC_CACHE_CHECK(
1509290001Sglebius    [if sys/timex.h has STA_FLL],
1510290001Sglebius    [ntp_cv_var_sta_fll],
1511290001Sglebius    [AC_PREPROC_IFELSE(
1512290001Sglebius	[AC_LANG_SOURCE(
1513290001Sglebius	    [
1514290001Sglebius		#include <sys/timex.h>
1515290001Sglebius		#ifndef STA_FLL
1516290001Sglebius		# error
1517290001Sglebius		#endif
1518290001Sglebius	    ])],
1519290001Sglebius	[ntp_cv_var_sta_fll=yes],
1520290001Sglebius	[ntp_cv_var_sta_fll=no]
1521290001Sglebius    )]
1522290001Sglebius)
1523181834Sroberto
1524290001SglebiusAC_CACHE_CHECK(
1525290001Sglebius    [if we have kernel PLL support],
1526290001Sglebius    [ntp_cv_var_kernel_pll],
1527290001Sglebius    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1528290001Sglebius	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1529290001Sglebius	 *no*)
1530290001Sglebius	    ntp_cv_var_kernel_pll=no
1531290001Sglebius	    ;;
1532290001Sglebius	 *) ntp_cv_var_kernel_pll=yes
1533290001Sglebius	    ;;
1534290001Sglebius	esac
1535290001Sglebius    ]
1536290001Sglebius)
1537290001Sglebiuscase "$ntp_cv_var_kernel_pll" in
1538181834Sroberto yes)
1539290001Sglebius    AC_DEFINE([KERNEL_PLL], [1],
1540290001Sglebius	[Does the kernel support precision time discipline?])
1541181834Srobertoesac
1542181834Sroberto
1543290001SglebiusAC_CACHE_CHECK(
1544290001Sglebius    [if SIOCGIFCONF returns buffer size in the buffer],
1545290001Sglebius    [ntp_cv_size_returned_in_buffer],
1546290001Sglebius    [
1547290001Sglebius	ans=no
1548290001Sglebius	case "$host" in
1549290001Sglebius	 *-fujitsu-uxp*)
1550290001Sglebius	    ans=yes
1551290001Sglebius	    ;;
1552290001Sglebius	 *-ncr-sysv4*)
1553290001Sglebius	    ans=yes
1554290001Sglebius	    ;;
1555290001Sglebius	 *-univel-sysv*)
1556290001Sglebius	    ans=yes
1557290001Sglebius	    ;;
1558290001Sglebius	esac
1559290001Sglebius	ntp_cv_size_returned_in_buffer=$ans
1560290001Sglebius    ]
1561290001Sglebius)
1562290001Sglebiuscase "$ntp_cv_size_returned_in_buffer" in
1563290001Sglebius yes)
1564290001Sglebius    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1565290001Sglebius	[Does SIOCGIFCONF return size in the buffer?])
1566181834Srobertoesac
1567181834Sroberto
1568181834Sroberto# Check for ioctls TIOCGPPSEV
1569290001SglebiusAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1570290001Sglebiuscase "$ac_cv_header_termios_h" in
1571290001Sglebius yes)
1572290001Sglebius    AC_PREPROC_IFELSE(
1573290001Sglebius	[AC_LANG_SOURCE([
1574290001Sglebius	    #include <termios.h>
1575290001Sglebius	    #ifndef TIOCGPPSEV
1576290001Sglebius	    # error
1577290001Sglebius	    #endif
1578290001Sglebius	])],
1579290001Sglebius	[ntp_ok=yes],
1580290001Sglebius	[ntp_ok=no]
1581290001Sglebius    )
1582290001Sglebius    ;;
1583290001Sglebius *)
1584290001Sglebius    ntp_ok=no
1585290001Sglebius    ;;
1586290001Sglebiusesac
1587290001Sglebiuscase "$ntp_ok" in
1588290001Sglebius yes)
1589290001Sglebius    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1590290001Sglebius	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1591290001Sglebiusesac
1592290001SglebiusAC_MSG_RESULT([$ntp_ok])
1593181834Sroberto
1594181834Sroberto# Check for ioctls TIOCSPPS
1595290001SglebiusAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1596290001Sglebiuscase "$ac_cv_header_termios_h" in
1597290001Sglebius yes)
1598290001Sglebius    AC_PREPROC_IFELSE(
1599290001Sglebius	[AC_LANG_SOURCE([
1600290001Sglebius	    #include <termios.h>
1601290001Sglebius	    #ifndef TIOCSPPS
1602290001Sglebius	    # error
1603290001Sglebius	    #endif
1604290001Sglebius	 ])],
1605290001Sglebius	 [ntp_ok=yes],
1606290001Sglebius	 [ntp_ok=no]
1607290001Sglebius    )
1608290001Sglebius    ;;
1609290001Sglebius *)
1610181834Sroberto    ntp_ok=no
1611290001Sglebius    ;;
1612290001Sglebiusesac
1613290001Sglebiuscase "$ntp_ok" in
1614290001Sglebius yes)
1615290001Sglebius    AC_DEFINE([HAVE_TIOCSPPS], [1],
1616290001Sglebius	[Do we have the TIOCSPPS ioctl (Solaris)?])
1617290001Sglebiusesac
1618290001SglebiusAC_MSG_RESULT([$ntp_ok])
1619181834Sroberto
1620181834Sroberto# Check for ioctls CIOGETEV
1621290001SglebiusAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1622290001Sglebiuscase "$ac_cv_header_sys_ppsclock_h" in
1623290001Sglebius yes)
1624290001Sglebius    AC_PREPROC_IFELSE(
1625290001Sglebius	[AC_LANG_SOURCE([
1626290001Sglebius	    #include <sys/ppsclock.h>
1627290001Sglebius	    #ifndef CIOGETEV
1628290001Sglebius	    # error
1629290001Sglebius	    #endif
1630290001Sglebius	])],
1631290001Sglebius	[ntp_ok=yes],
1632290001Sglebius	[ntp_ok=no]
1633290001Sglebius    )
1634290001Sglebius    ;;
1635290001Sglebius *)
1636290001Sglebius    ntp_ok=no
1637290001Sglebius    ;;
1638290001Sglebiusesac
1639290001Sglebiuscase "$ntp_ok" in
1640290001Sglebius yes)
1641290001Sglebius    AC_DEFINE([HAVE_CIOGETEV], [1],
1642290001Sglebius	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1643290001Sglebiusesac
1644290001SglebiusAC_MSG_RESULT([$ntp_ok])
1645181834Sroberto
1646181834Sroberto# ATOM/PPSAPI stuff.
1647181834Sroberto
1648290001Sglebiusntp_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
1656290001Sglebiuscase "$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?])
1661290001Sglebius	ntp_jupiter_ok=yes
1662290001Sglebius	ntp_oncore_ok=yes
1663290001Sglebius	ntp_parse_ok=yes
1664290001Sglebius	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
1671290001SglebiusAC_CHECK_HEADER([linux/serial.h])
1672181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1673181834Sroberto  yesyes)
1674290001Sglebius    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1675290001Sglebius    AC_PREPROC_IFELSE(
1676290001Sglebius	[AC_LANG_SOURCE([
1677290001Sglebius	    #include <sys/time.h>
1678290001Sglebius	    typedef int u_int;
1679290001Sglebius	    #include <sys/ppsclock.h>
1680290001Sglebius	    #include <linux/serial.h>
1681181834Sroberto
1682290001Sglebius	    #ifndef TIOCGSERIAL
1683290001Sglebius	    # error
1684290001Sglebius	    #endif
1685290001Sglebius	    #ifndef TIOCSSERIAL
1686290001Sglebius	    # error
1687290001Sglebius	    #endif
1688290001Sglebius	    #ifndef ASYNC_PPS_CD_POS
1689290001Sglebius	    # error
1690290001Sglebius	    #endif
1691290001Sglebius	    #ifndef ASYNC_PPS_CD_NEG
1692290001Sglebius	    # error
1693290001Sglebius	    #endif
1694290001Sglebius	    #ifndef CIOGETEV
1695290001Sglebius	    # error
1696290001Sglebius	    #endif
1697290001Sglebius	])],
1698290001Sglebius	[ntp_ok=yes],
1699290001Sglebius	[ntp_ok=no]
1700290001Sglebius    )
1701290001Sglebius    AC_MSG_RESULT([$ntp_ok])
1702290001Sglebius    ;;
1703181834Sroberto  *)
1704290001Sglebius    ntp_ok=no
1705290001Sglebius    ;;
1706181834Srobertoesac
1707290001Sglebiuscase "$ntp_ok" in
1708290001Sglebius yes)
1709290001Sglebius    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1710290001Sglebius	[Do we have the TIO serial stuff?])
1711290001Sglebiusesac
1712181834Sroberto
1713181834Sroberto# Check for SHMEM_STATUS support
1714200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1715181834Srobertocase "$ac_cv_header_sys_mman_h" in
1716290001Sglebius yes)
1717290001Sglebius    ntp_ok=yes
1718290001Sglebius    ;;
1719290001Sglebius *)
1720290001Sglebius    ntp_ok=no
1721290001Sglebius    ;;
1722181834Srobertoesac
1723290001Sglebiuscase "$ntp_ok" in
1724290001Sglebius yes)
1725290001Sglebius    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1726290001Sglebius	[Do we have support for SHMEM_STATUS?])
1727290001Sglebiusesac
1728290001SglebiusAC_MSG_RESULT([$ntp_ok])
1729181834Sroberto
1730181834Srobertontp_refclock=no
1731181834Sroberto
1732181834Sroberto# HPUX only, and by explicit request
1733200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1734290001SglebiusAC_ARG_ENABLE(
1735290001Sglebius    [BANCOMM],
1736290001Sglebius    [AS_HELP_STRING(
1737290001Sglebius	[--enable-BANCOMM],
1738290001Sglebius	[- Datum/Bancomm bc635/VME interface]
1739290001Sglebius    )],
1740290001Sglebius    [ntp_ok=$enableval],
1741290001Sglebius    [ntp_ok=no]
1742290001Sglebius)
1743290001Sglebiuscase "$ntp_ok" in
1744290001Sglebius yes)
1745181834Sroberto    ntp_refclock=yes
1746290001Sglebius    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1747290001Sglebius    ;;
1748290001Sglebiusesac
1749290001SglebiusAC_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])
1757290001SglebiusAC_ARG_ENABLE(
1758290001Sglebius    [GPSVME],
1759290001Sglebius    [AS_HELP_STRING(
1760290001Sglebius	[--enable-GPSVME],
1761290001Sglebius	[- TrueTime GPS receiver/VME interface]
1762290001Sglebius    )],
1763290001Sglebius    [ntp_ok=$enableval],
1764290001Sglebius    [ntp_ok=no]
1765290001Sglebius)
1766290001Sglebiuscase "$ntp_ok" in
1767290001Sglebius yes)
1768181834Sroberto    ntp_refclock=yes
1769290001Sglebius    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1770290001Sglebius    ;;
1771290001Sglebiusesac
1772290001SglebiusAC_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)
1781290001Sglebius    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])
1791290001SglebiusAC_ARG_ENABLE(
1792290001Sglebius    [all-clocks],
1793290001Sglebius    [AS_HELP_STRING(
1794290001Sglebius	[--enable-all-clocks],
1795290001Sglebius	[+ include all suitable non-PARSE clocks:]
1796290001Sglebius    )],
1797290001Sglebius    [ntp_eac=$enableval],
1798290001Sglebius    [ntp_eac=yes]
1799290001Sglebius)
1800290001SglebiusAC_MSG_RESULT([$ntp_eac])
1801181834Sroberto
1802290001Sglebius# HMS: Should we also require ntp_parse_ok?
1803200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1804290001Sglebiuscase "$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
1811290001SglebiusAC_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
1817290001Sglebius    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1818181834Sroberto    ;;
1819181834Sroberto *) ntp_canaudio=no ;;
1820181834Srobertoesac
1821290001SglebiusAC_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
1830290001SglebiusAC_MSG_RESULT([$ntp_canshm])
1831181834Sroberto
1832290001Sglebius# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1833290001SglebiusAC_CACHE_CHECK(
1834290001Sglebius    [for termios modem control],
1835290001Sglebius    [ntp_cv_modem_control],
1836290001Sglebius    [AC_COMPILE_IFELSE(
1837290001Sglebius	[AC_LANG_PROGRAM(
1838290001Sglebius	    [[
1839290001Sglebius		#ifdef HAVE_UNISTD_H
1840290001Sglebius		# include <unistd.h>
1841290001Sglebius		#endif
1842290001Sglebius		#ifdef HAVE_TERMIOS_H
1843290001Sglebius		# include <termios.h>
1844290001Sglebius		#endif
1845290001Sglebius		#ifdef HAVE_SYS_IOCTL_H
1846290001Sglebius		# include <sys/ioctl.h>
1847290001Sglebius		#endif
1848290001Sglebius	    ]],
1849290001Sglebius	    [[
1850290001Sglebius		int	dtr = TIOCM_DTR;
1851290001Sglebius
1852290001Sglebius		ioctl(1, TIOCMBIS, (char *)&dtr);
1853290001Sglebius	    ]]
1854290001Sglebius	)],
1855290001Sglebius	[ntp_cv_modem_control=yes],
1856290001Sglebius	[ntp_cv_modem_control=no]
1857290001Sglebius    )]
1858290001Sglebius)
1859290001Sglebiuscase "$ntp_eac::$ntp_cv_modem_control" in
1860290001Sglebius yes::yes)
1861290001Sglebius    ntp_enable_all_modem_control_clocks=yes
1862290001Sglebius    ;;
1863290001Sglebius *)
1864290001Sglebius    ntp_enable_all_modem_control_clocks=no
1865290001Sglebius    ;;
1866290001Sglebiusesac
1867290001Sglebius
1868181834Sroberto# Requires modem control
1869200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1870290001SglebiusAC_ARG_ENABLE(
1871290001Sglebius    [ACTS],
1872290001Sglebius    [AS_HELP_STRING(
1873290001Sglebius	[--enable-ACTS],
1874290001Sglebius	[s ACTS modem service]
1875290001Sglebius    )],
1876181834Sroberto    [ntp_ok=$enableval],
1877290001Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1878290001Sglebius)
1879290001Sglebiuscase "$ntp_ok" in
1880290001Sglebius yes)
1881181834Sroberto    ntp_refclock=yes
1882290001Sglebius    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1883290001Sglebius    ;;
1884290001Sglebiusesac
1885290001SglebiusAC_MSG_RESULT([$ntp_ok])
1886181834Sroberto
1887200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1888290001SglebiusAC_ARG_ENABLE(
1889290001Sglebius    [ARBITER],
1890290001Sglebius    [AS_HELP_STRING(
1891290001Sglebius	[--enable-ARBITER],
1892290001Sglebius	[+ Arbiter 1088A/B GPS receiver]
1893290001Sglebius    )],
1894290001Sglebius    [ntp_ok=$enableval],
1895290001Sglebius    [ntp_ok=$ntp_eac]
1896290001Sglebius)
1897290001Sglebiuscase "$ntp_ok" in
1898290001Sglebius yes)
1899181834Sroberto    ntp_refclock=yes
1900290001Sglebius    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1901290001Sglebius    ;;
1902290001Sglebiusesac
1903290001SglebiusAC_MSG_RESULT([$ntp_ok])
1904181834Sroberto
1905200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1906290001SglebiusAC_ARG_ENABLE(
1907290001Sglebius    [ARCRON_MSF],
1908290001Sglebius    [AS_HELP_STRING(
1909290001Sglebius	[--enable-ARCRON-MSF],
1910290001Sglebius	[+ Arcron MSF receiver]
1911290001Sglebius    )],
1912290001Sglebius    [ntp_ok=$enableval],
1913290001Sglebius    [ntp_ok=$ntp_eac]
1914290001Sglebius)
1915290001Sglebiuscase "$ntp_ok" in
1916290001Sglebius yes)
1917181834Sroberto    ntp_refclock=yes
1918290001Sglebius    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1919290001Sglebius    ;;
1920290001Sglebiusesac
1921290001SglebiusAC_MSG_RESULT([$ntp_ok])
1922181834Sroberto
1923200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1924290001SglebiusAC_ARG_ENABLE(
1925290001Sglebius    [AS2201],
1926290001Sglebius    [AS_HELP_STRING(
1927290001Sglebius	[--enable-AS2201],
1928290001Sglebius	[+ Austron 2200A/2201A GPS receiver]
1929290001Sglebius    )],
1930290001Sglebius    [ntp_ok=$enableval],
1931290001Sglebius    [ntp_ok=$ntp_eac]
1932290001Sglebius)
1933290001Sglebiuscase "$ntp_ok" in
1934290001Sglebius yes)
1935181834Sroberto    ntp_refclock=yes
1936290001Sglebius    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1937290001Sglebius    ;;
1938290001Sglebiusesac
1939290001SglebiusAC_MSG_RESULT([$ntp_ok])
1940181834Sroberto
1941200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1942290001SglebiusAC_ARG_ENABLE(
1943290001Sglebius    [ATOM],
1944290001Sglebius    [AS_HELP_STRING(
1945290001Sglebius	[--enable-ATOM],
1946290001Sglebius	[s ATOM PPS interface]
1947290001Sglebius    )],
1948290001Sglebius    [ntp_ok=$enableval],
1949290001Sglebius    [ntp_ok=$ntp_eac]
1950290001Sglebius)
1951290001Sglebiuscase "$ntp_atom_ok" in
1952181834Sroberto no) ntp_ok=no ;;
1953181834Srobertoesac
1954290001Sglebiuscase "$ntp_ok" in
1955290001Sglebius yes)
1956181834Sroberto    ntp_refclock=yes
1957290001Sglebius    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1958290001Sglebius    ;;
1959290001Sglebiusesac
1960290001SglebiusAC_MSG_RESULT([$ntp_ok])
1961181834Sroberto
1962200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1963290001SglebiusAC_ARG_ENABLE(
1964290001Sglebius    [CHRONOLOG],
1965290001Sglebius    [AS_HELP_STRING(
1966290001Sglebius	[--enable-CHRONOLOG],
1967290001Sglebius	[+ Chrono-log K-series WWVB receiver]
1968290001Sglebius    )],
1969290001Sglebius    [ntp_ok=$enableval],
1970290001Sglebius    [ntp_ok=$ntp_eac]
1971290001Sglebius)
1972290001Sglebiuscase "$ntp_ok" in
1973290001Sglebius yes)
1974181834Sroberto    ntp_refclock=yes
1975290001Sglebius    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1976290001Sglebius    ;;
1977290001Sglebiusesac
1978290001SglebiusAC_MSG_RESULT([$ntp_ok])
1979181834Sroberto
1980200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1981290001SglebiusAC_ARG_ENABLE(
1982290001Sglebius    [CHU],
1983290001Sglebius    [AS_HELP_STRING(
1984290001Sglebius	[--enable-CHU],
1985290001Sglebius	[+ CHU modem/decoder]
1986290001Sglebius    )],
1987290001Sglebius    [ntp_ok=$enableval],
1988290001Sglebius    [ntp_ok=$ntp_eac]
1989290001Sglebius)
1990290001Sglebiuscase "$ntp_ok" in
1991290001Sglebius yes)
1992181834Sroberto    ntp_refclock=yes
1993290001Sglebius    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1994290001Sglebius    ;;
1995290001Sglebiusesac
1996290001SglebiusAC_MSG_RESULT([$ntp_ok])
1997290001Sglebiusntp_refclock_chu=$ntp_ok
1998181834Sroberto
1999200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2000290001SglebiusAC_ARG_ENABLE(
2001290001Sglebius    [AUDIO-CHU],
2002290001Sglebius    [AS_HELP_STRING(
2003290001Sglebius	[--enable-AUDIO-CHU],
2004290001Sglebius	[s CHU audio/decoder]
2005290001Sglebius    )],
2006181834Sroberto    [ntp_ok=$enableval],
2007290001Sglebius    [
2008290001Sglebius	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2009290001Sglebius	 *no*)	ntp_ok=no  ;;
2010290001Sglebius	 *)	ntp_ok=yes ;;
2011290001Sglebius	esac
2012290001Sglebius    ]
2013290001Sglebius)
2014290001SglebiusAC_MSG_RESULT([$ntp_ok])
2015181834Sroberto# We used to check for sunos/solaris target...
2016290001Sglebiuscase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2017290001Sglebius 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])
2022290001SglebiusAC_ARG_ENABLE(
2023290001Sglebius    [DATUM],
2024290001Sglebius    [AS_HELP_STRING(
2025290001Sglebius	[--enable-DATUM],
2026290001Sglebius	[s Datum Programmable Time System]
2027290001Sglebius    )],
2028181834Sroberto    [ntp_ok=$enableval],
2029290001Sglebius    [
2030290001Sglebius	case "$ac_cv_header_termios_h" in
2031290001Sglebius	 yes)
2032290001Sglebius	    ntp_ok=$ntp_eac
2033290001Sglebius	    ;;
2034290001Sglebius	 *) ntp_ok=no
2035290001Sglebius	    ;;
2036290001Sglebius	esac
2037290001Sglebius    ]
2038290001Sglebius)
2039290001Sglebiuscase "$ntp_ok" in
2040290001Sglebius yes)
2041181834Sroberto    ntp_refclock=yes
2042290001Sglebius    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2043290001Sglebius    ;;
2044290001Sglebiusesac
2045290001SglebiusAC_MSG_RESULT([$ntp_ok])
2046181834Sroberto
2047200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2048290001SglebiusAC_ARG_ENABLE(
2049290001Sglebius    [DUMBCLOCK],
2050290001Sglebius    [AS_HELP_STRING(
2051290001Sglebius	[--enable-DUMBCLOCK],
2052290001Sglebius	[+ Dumb generic hh:mm:ss local clock]
2053290001Sglebius    )],
2054290001Sglebius    [ntp_ok=$enableval],
2055290001Sglebius    [ntp_ok=$ntp_eac]
2056290001Sglebius)
2057290001Sglebiuscase "$ntp_ok" in
2058290001Sglebius yes)
2059181834Sroberto    ntp_refclock=yes
2060290001Sglebius    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2061290001Sglebius    ;;
2062290001Sglebiusesac
2063290001SglebiusAC_MSG_RESULT([$ntp_ok])
2064181834Sroberto
2065200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2066290001SglebiusAC_ARG_ENABLE(
2067290001Sglebius    [FG],
2068290001Sglebius    [AS_HELP_STRING(
2069290001Sglebius	[--enable-FG],
2070290001Sglebius	[+ Forum Graphic GPS]
2071290001Sglebius    )],
2072290001Sglebius    [ntp_ok=$enableval],
2073290001Sglebius    [ntp_ok=$ntp_eac]
2074290001Sglebius)
2075290001Sglebiuscase "$ntp_ok" in
2076290001Sglebius yes)
2077181834Sroberto    ntp_refclock=yes
2078290001Sglebius    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2079290001Sglebius    ;;
2080290001Sglebiusesac
2081290001SglebiusAC_MSG_RESULT([$ntp_ok])
2082181834Sroberto
2083181834Sroberto# Requires modem control
2084200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2085290001SglebiusAC_ARG_ENABLE(
2086290001Sglebius    [HEATH],
2087290001Sglebius    [AS_HELP_STRING(
2088290001Sglebius	[--enable-HEATH],
2089290001Sglebius	[s Heath GC-1000 WWV/WWVH receiver]
2090290001Sglebius    )],
2091181834Sroberto    [ntp_ok=$enableval],
2092290001Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2093290001Sglebius)
2094290001Sglebiuscase "$ntp_ok" in
2095290001Sglebius yes)
2096181834Sroberto    ntp_refclock=yes
2097290001Sglebius    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2098290001Sglebius    ;;
2099290001Sglebiusesac
2100290001SglebiusAC_MSG_RESULT([$ntp_ok])
2101181834Sroberto
2102200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2103290001SglebiusAC_ARG_ENABLE(
2104290001Sglebius    [HOPFSERIAL],
2105290001Sglebius    [AS_HELP_STRING(
2106290001Sglebius	[--enable-HOPFSERIAL],
2107290001Sglebius	[+ hopf serial clock device]
2108290001Sglebius    )],
2109290001Sglebius    [ntp_ok=$enableval],
2110290001Sglebius    [ntp_ok=$ntp_eac]
2111290001Sglebius)
2112290001Sglebiuscase "$ntp_ok" in
2113290001Sglebius yes)
2114181834Sroberto    ntp_refclock=yes
2115290001Sglebius    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2116290001Sglebius    ;;
2117290001Sglebiusesac
2118290001SglebiusAC_MSG_RESULT([$ntp_ok])
2119181834Sroberto
2120200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2121290001SglebiusAC_ARG_ENABLE(
2122290001Sglebius    [HOPFPCI],
2123290001Sglebius    [AS_HELP_STRING(
2124290001Sglebius	[--enable-HOPFPCI],
2125290001Sglebius	[+ hopf 6039 PCI board]
2126290001Sglebius    )],
2127290001Sglebius    [ntp_ok=$enableval],
2128290001Sglebius    [ntp_ok=$ntp_eac]
2129290001Sglebius)
2130290001Sglebiuscase "$ntp_ok" in
2131290001Sglebius yes)
2132181834Sroberto    ntp_refclock=yes
2133290001Sglebius    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2134290001Sglebius    ;;
2135290001Sglebiusesac
2136290001SglebiusAC_MSG_RESULT([$ntp_ok])
2137181834Sroberto
2138200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2139290001SglebiusAC_ARG_ENABLE(
2140290001Sglebius    [HPGPS],
2141290001Sglebius    [AS_HELP_STRING(
2142290001Sglebius	[--enable-HPGPS],
2143290001Sglebius	[+ HP 58503A GPS receiver]
2144290001Sglebius    )],
2145290001Sglebius    [ntp_ok=$enableval],
2146290001Sglebius    [ntp_ok=$ntp_eac]
2147290001Sglebius)
2148290001Sglebiuscase "$ntp_ok" in
2149290001Sglebius yes)
2150181834Sroberto    ntp_refclock=yes
2151290001Sglebius    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2152290001Sglebius    ;;
2153290001Sglebiusesac
2154290001SglebiusAC_MSG_RESULT([$ntp_ok])
2155181834Sroberto
2156200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2157290001SglebiusAC_ARG_ENABLE(
2158290001Sglebius    [IRIG],
2159290001Sglebius    [AS_HELP_STRING(
2160290001Sglebius	[--enable-IRIG],
2161290001Sglebius	[s IRIG audio decoder]
2162290001Sglebius    )],
2163181834Sroberto    [ntp_ok=$enableval],
2164290001Sglebius    [
2165290001Sglebius	case "$ntp_eac$ntp_canaudio" in
2166290001Sglebius	 *no*)	ntp_ok=no  ;;
2167290001Sglebius	 *)	ntp_ok=yes ;;
2168290001Sglebius	esac
2169290001Sglebius    ]
2170290001Sglebius)
2171290001Sglebiuscase "$ntp_ok" in
2172290001Sglebius yes)
2173181834Sroberto    ntp_refclock=yes
2174290001Sglebius    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2175290001Sglebius    ;;
2176290001Sglebiusesac
2177290001SglebiusAC_MSG_RESULT([$ntp_ok])
2178181834Srobertocase "$ntp_ok$ntp_canaudio" in
2179290001Sglebius yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2180181834Srobertoesac
2181181834Sroberto
2182200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2183290001SglebiusAC_ARG_ENABLE(
2184290001Sglebius    [JJY],
2185290001Sglebius    [AS_HELP_STRING(
2186290001Sglebius	[--enable-JJY],
2187290001Sglebius	[+ JJY receiver]
2188290001Sglebius    )],
2189290001Sglebius    [ntp_ok=$enableval],
2190290001Sglebius    [ntp_ok=$ntp_eac]
2191290001Sglebius)
2192290001Sglebiuscase "$ntp_ok" in
2193290001Sglebius yes)
2194181834Sroberto    ntp_refclock=yes
2195290001Sglebius    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2196290001Sglebius    ;;
2197290001Sglebiusesac
2198290001SglebiusAC_MSG_RESULT([$ntp_ok])
2199181834Sroberto
2200200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2201290001SglebiusAC_ARG_ENABLE(
2202290001Sglebius    [JUPITER],
2203290001Sglebius    [AS_HELP_STRING(
2204290001Sglebius	[--enable-JUPITER],
2205290001Sglebius	[s Rockwell Jupiter GPS receiver]
2206290001Sglebius    )],
2207181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2208290001Sglebiuscase "$ntp_jupiter_ok" in
2209181834Sroberto no) ntp_ok=no ;;
2210181834Srobertoesac
2211290001Sglebiuscase "$ntp_ok" in
2212290001Sglebius yes)
2213181834Sroberto    ntp_refclock=yes
2214290001Sglebius    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2215290001Sglebius    ;;
2216290001Sglebiusesac
2217290001SglebiusAC_MSG_RESULT([$ntp_ok])
2218181834Sroberto
2219200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2220290001SglebiusAC_ARG_ENABLE(
2221290001Sglebius    [LEITCH],
2222290001Sglebius    [AS_HELP_STRING(
2223290001Sglebius	[--enable-LEITCH],
2224290001Sglebius	[+ Leitch CSD 5300 Master Clock System Driver]
2225290001Sglebius    )],
2226290001Sglebius    [ntp_ok=$enableval],
2227290001Sglebius    [ntp_ok=$ntp_eac]
2228290001Sglebius)
2229290001Sglebiuscase "$ntp_ok" in
2230290001Sglebius yes)
2231181834Sroberto    ntp_refclock=yes
2232290001Sglebius    AC_DEFINE([CLOCK_LEITCH], [1],
2233290001Sglebius	[Leitch CSD 5300 Master Clock System Driver?])
2234290001Sglebius    ;;
2235290001Sglebiusesac
2236290001SglebiusAC_MSG_RESULT([$ntp_ok])
2237181834Sroberto
2238200576SrobertoAC_MSG_CHECKING([local clock reference])
2239290001SglebiusAC_ARG_ENABLE(
2240290001Sglebius    [LOCAL-CLOCK],
2241290001Sglebius    [AS_HELP_STRING(
2242290001Sglebius	[--enable-LOCAL-CLOCK],
2243290001Sglebius	[+ local clock reference]
2244290001Sglebius    )],
2245290001Sglebius    [ntp_ok=$enableval],
2246290001Sglebius    [ntp_ok=$ntp_eac]
2247290001Sglebius)
2248290001Sglebiuscase "$ntp_ok" in
2249290001Sglebius yes)
2250181834Sroberto    ntp_refclock=yes
2251290001Sglebius    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2252290001Sglebius    ;;
2253290001Sglebiusesac
2254290001SglebiusAC_MSG_RESULT([$ntp_ok])
2255181834Sroberto
2256181834Srobertodnl Bug 340: longstanding unfixed bugs
2257290001Sglebiusdnl AC_MSG_CHECKING([EES M201 MSF receiver])
2258290001Sglebiusdnl AC_ARG_ENABLE([MSFEES],
2259290001Sglebiusdnl     [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
2263290001Sglebiusdnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2264181834Srobertodnl fi
2265290001Sglebiusdnl AC_MSG_RESULT([$ntp_ok])
2266181834Sroberto
2267181834Sroberto# Not Ultrix
2268200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2269290001SglebiusAC_ARG_ENABLE(
2270290001Sglebius    [MX4200],
2271290001Sglebius    [AS_HELP_STRING(
2272290001Sglebius	[--enable-MX4200 ],
2273290001Sglebius	[s Magnavox MX4200 GPS receiver]
2274290001Sglebius    )],
2275181834Sroberto    [ntp_ok=$enableval],
2276290001Sglebius    [
2277290001Sglebius	case "$ac_cv_var_ppsclock" in
2278290001Sglebius	 yes)
2279290001Sglebius	    ntp_ok=$ntp_eac
2280290001Sglebius	    ;;
2281290001Sglebius	 *)
2282290001Sglebius	    ntp_ok=no
2283290001Sglebius	    ;;
2284290001Sglebius	esac
2285290001Sglebius    ]
2286290001Sglebius)
2287290001Sglebiuscase "$ntp_ok" in
2288290001Sglebius yes)
2289181834Sroberto    ntp_refclock=yes
2290290001Sglebius    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2291290001Sglebius    ;;
2292290001Sglebiusesac
2293290001SglebiusAC_MSG_RESULT([$ntp_ok])
2294181834Srobertocase "$ntp_ok$host" in
2295290001Sglebius yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2296181834Srobertoesac
2297181834Sroberto
2298200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2299290001SglebiusAC_ARG_ENABLE(
2300290001Sglebius    [NEOCLOCK4X],
2301290001Sglebius    [AS_HELP_STRING(
2302290001Sglebius	[--enable-NEOCLOCK4X],
2303290001Sglebius	[+ NeoClock4X DCF77 / TDF receiver]
2304290001Sglebius    )],
2305290001Sglebius    [ntp_ok=$enableval],
2306290001Sglebius    [ntp_ok=$ntp_eac]
2307290001Sglebius)
2308290001Sglebiuscase "$ntp_ok" in
2309290001Sglebius yes)
2310181834Sroberto    ntp_refclock=yes
2311290001Sglebius    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2312290001Sglebius    ;;
2313290001Sglebiusesac
2314290001SglebiusAC_MSG_RESULT([$ntp_ok])
2315181834Sroberto
2316200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2317290001SglebiusAC_ARG_ENABLE(
2318290001Sglebius    [NMEA],
2319290001Sglebius    [AS_HELP_STRING(
2320290001Sglebius	[--enable-NMEA],
2321290001Sglebius	[+ NMEA GPS receiver]
2322290001Sglebius    )],
2323290001Sglebius    [ntp_ok=$enableval],
2324290001Sglebius    [ntp_ok=$ntp_eac]
2325290001Sglebius)
2326290001Sglebiuscase "$ntp_ok" in
2327290001Sglebius yes)
2328181834Sroberto    ntp_refclock=yes
2329290001Sglebius    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2330290001Sglebius    ;;
2331290001Sglebiusesac
2332290001SglebiusAC_MSG_RESULT([$ntp_ok])
2333181834Sroberto
2334290001SglebiusAC_CHECK_FUNCS([strtoll])
2335290001SglebiusAC_MSG_CHECKING([for GPSD JSON receiver])
2336290001SglebiusAC_ARG_ENABLE(
2337290001Sglebius    [GPSD],
2338290001Sglebius    [AS_HELP_STRING(
2339290001Sglebius	[--enable-GPSD],
2340290001Sglebius	[+ GPSD JSON receiver]
2341290001Sglebius    )],
2342290001Sglebius    [ntp_ok=$enableval],
2343290001Sglebius    [case "$ac_cv_func_strtoll" in
2344290001Sglebius     yes) ntp_ok=$ntp_eac ;;
2345290001Sglebius     *)   ntp_ok="no" ;;
2346290001Sglebius    esac]
2347290001Sglebius)
2348290001Sglebiuscase "$ntp_ok" in
2349290001Sglebius yes)
2350290001Sglebius    ntp_refclock=yes
2351290001Sglebius    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2352290001Sglebius    ;;
2353290001Sglebiusesac
2354290001SglebiusAC_MSG_RESULT([$ntp_ok])
2355290001Sglebius
2356200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2357290001SglebiusAC_ARG_ENABLE(
2358290001Sglebius    [ONCORE],
2359290001Sglebius    [AS_HELP_STRING(
2360290001Sglebius	[--enable-ONCORE],
2361290001Sglebius	[s Motorola VP/UT Oncore GPS receiver]
2362290001Sglebius    )],
2363290001Sglebius    [ntp_ok=$enableval],
2364290001Sglebius    [ntp_ok=$ntp_eac]
2365290001Sglebius)
2366290001Sglebiuscase "$ntp_oncore_ok" in
2367181834Sroberto no) ntp_ok=no ;;
2368181834Srobertoesac
2369290001Sglebiuscase "$ntp_ok" in
2370290001Sglebius yes)
2371181834Sroberto    ntp_refclock=yes
2372290001Sglebius    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2373290001Sglebius    ;;
2374290001Sglebiusesac
2375290001SglebiusAC_MSG_RESULT([$ntp_ok])
2376181834Sroberto
2377290001Sglebius# Requires modem control
2378200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2379290001SglebiusAC_ARG_ENABLE(
2380290001Sglebius    [PALISADE],
2381290001Sglebius    [AS_HELP_STRING(
2382290001Sglebius	[--enable-PALISADE],
2383290001Sglebius	[s Palisade clock]
2384290001Sglebius    )],
2385181834Sroberto    [ntp_ok=$enableval],
2386290001Sglebius    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2387290001Sglebius)
2388290001Sglebiuscase "$ntp_ok" in
2389290001Sglebius yes)
2390181834Sroberto    ntp_refclock=yes
2391290001Sglebius    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2392290001Sglebius    ;;
2393290001Sglebiusesac
2394290001SglebiusAC_MSG_RESULT([$ntp_ok])
2395181834Sroberto
2396200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2397290001SglebiusAC_ARG_ENABLE(
2398290001Sglebius    [PCF],
2399290001Sglebius    [AS_HELP_STRING(
2400290001Sglebius	[--enable-PCF ],
2401290001Sglebius	[+ Conrad parallel port radio clock]
2402290001Sglebius    )],
2403290001Sglebius    [ntp_ok=$enableval],
2404290001Sglebius    [ntp_ok=$ntp_eac]
2405290001Sglebius)
2406290001Sglebiuscase "$ntp_ok" in
2407290001Sglebius yes)
2408181834Sroberto    ntp_refclock=yes
2409290001Sglebius    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2410290001Sglebius    ;;
2411290001Sglebiusesac
2412290001SglebiusAC_MSG_RESULT([$ntp_ok])
2413181834Sroberto
2414200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2415290001SglebiusAC_ARG_ENABLE(
2416290001Sglebius    [PST],
2417290001Sglebius    [AS_HELP_STRING(
2418290001Sglebius	[--enable-PST],
2419290001Sglebius	[+ PST/Traconex 1020 WWV/WWVH receiver]
2420290001Sglebius    )],
2421290001Sglebius    [ntp_ok=$enableval],
2422290001Sglebius    [ntp_ok=$ntp_eac]
2423290001Sglebius)
2424290001Sglebiuscase "$ntp_ok" in
2425290001Sglebius yes)
2426181834Sroberto    ntp_refclock=yes
2427290001Sglebius    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2428290001Sglebius    ;;
2429290001Sglebiusesac
2430290001SglebiusAC_MSG_RESULT([$ntp_ok])
2431181834Sroberto
2432200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2433290001SglebiusAC_ARG_ENABLE(
2434290001Sglebius    [RIPENCC],
2435290001Sglebius    [AS_HELP_STRING(
2436290001Sglebius	[--enable-RIPENCC],
2437290001Sglebius	[- RIPENCC specific Trimble driver]
2438290001Sglebius    )],
2439290001Sglebius    [ntp_ok=$enableval],
2440290001Sglebius    [ntp_ok=no]
2441290001Sglebius)
2442181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2443290001Sglebiuscase "$ntp_ripe_ncc_ok" in
2444181834Sroberto no) ntp_ok=no ;;
2445181834Srobertoesac
2446290001Sglebiuscase "$ntp_ok" in
2447290001Sglebius yes)
2448181834Sroberto    ntp_refclock=yes
2449290001Sglebius    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2450290001Sglebius    ;;
2451290001Sglebiusesac
2452290001SglebiusAC_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])
2457290001SglebiusAC_ARG_ENABLE(
2458290001Sglebius    [SHM],
2459290001Sglebius    [AS_HELP_STRING(
2460290001Sglebius	[--enable-SHM],
2461290001Sglebius	[s SHM clock attached thru shared memory]
2462290001Sglebius    )],
2463181834Sroberto    [ntp_ok=$enableval],
2464290001Sglebius    [
2465290001Sglebius	case "$ntp_eac$ntp_canshm" in
2466290001Sglebius	 *no*)	ntp_ok=no  ;;
2467290001Sglebius	 *)	ntp_ok=yes ;;
2468290001Sglebius	esac
2469290001Sglebius    ]
2470290001Sglebius)
2471290001Sglebiuscase "$ntp_ok" in
2472290001Sglebius yes)
2473181834Sroberto    ntp_refclock=yes
2474290001Sglebius    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2475290001Sglebius    ;;
2476290001Sglebiusesac
2477290001SglebiusAC_MSG_RESULT([$ntp_ok])
2478181834Sroberto
2479200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2480290001SglebiusAC_ARG_ENABLE(
2481290001Sglebius    [SPECTRACOM],
2482290001Sglebius    [AS_HELP_STRING(
2483290001Sglebius	[--enable-SPECTRACOM],
2484290001Sglebius	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2485290001Sglebius    )],
2486290001Sglebius    [ntp_ok=$enableval],
2487290001Sglebius    [ntp_ok=$ntp_eac]
2488290001Sglebius)
2489290001Sglebiuscase "$ntp_ok" in
2490290001Sglebius yes)
2491181834Sroberto    ntp_refclock=yes
2492290001Sglebius    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2493290001Sglebius	[Spectracom 8170/Netclock/2 WWVB receiver])
2494290001Sglebius    ;;
2495290001Sglebiusesac
2496290001SglebiusAC_MSG_RESULT([$ntp_ok])
2497181834Sroberto
2498200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2499290001SglebiusAC_ARG_ENABLE(
2500290001Sglebius    [TPRO],
2501290001Sglebius    [AS_HELP_STRING(
2502290001Sglebius	[--enable-TPRO],
2503290001Sglebius	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2504290001Sglebius    )],
2505181834Sroberto    [ntp_ok=$enableval],
2506290001Sglebius    [
2507290001Sglebius	case "$ac_cv_header_sys_tpro_h" in
2508290001Sglebius	 yes)
2509290001Sglebius	    ntp_ok=$ntp_eac
2510290001Sglebius	    ;;
2511290001Sglebius	 *)
2512290001Sglebius	    ntp_ok=no
2513290001Sglebius	    ;;
2514290001Sglebius	esac
2515290001Sglebius    ]
2516290001Sglebius)
2517290001Sglebiuscase "$ntp_ok" in
2518290001Sglebius yes)
2519181834Sroberto    ntp_refclock=yes
2520290001Sglebius    AC_DEFINE([CLOCK_TPRO], [1],
2521290001Sglebius	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2522290001Sglebius    ;;
2523290001Sglebiusesac
2524290001SglebiusAC_MSG_RESULT([$ntp_ok])
2525181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2526290001Sglebius 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])
2531290001SglebiusAC_ARG_ENABLE(
2532290001Sglebius    [TRUETIME],
2533290001Sglebius    [AS_HELP_STRING(
2534290001Sglebius	[--enable-TRUETIME],
2535290001Sglebius	[s Kinemetrics/TrueTime receivers]
2536290001Sglebius    )],
2537181834Sroberto    [ntp_ok=$enableval],
2538290001Sglebius    [
2539290001Sglebius	case "$host" in
2540290001Sglebius	 vax-dec-bsd)
2541290001Sglebius	    ntp_ok=no
2542290001Sglebius	    ;;
2543290001Sglebius	 *)
2544290001Sglebius	    ntp_ok=$ntp_eac
2545290001Sglebius	    ;;
2546290001Sglebius	esac
2547290001Sglebius    ]
2548290001Sglebius)    
2549290001Sglebiuscase "$ntp_ok" in
2550290001Sglebius yes)
2551181834Sroberto    ntp_refclock=yes
2552290001Sglebius    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2553290001Sglebius    ;;
2554290001Sglebiusesac
2555290001SglebiusAC_MSG_RESULT([$ntp_ok])
2556181834Srobertocase "$ntp_ok$host" in
2557290001Sglebius yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2558181834Srobertoesac
2559181834Sroberto
2560200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2561290001SglebiusAC_ARG_ENABLE(
2562290001Sglebius    [TT560],
2563290001Sglebius    [AS_HELP_STRING(
2564290001Sglebius	[--enable-TT560],
2565290001Sglebius	[- TrueTime 560 IRIG-B decoder]
2566290001Sglebius    )],
2567290001Sglebius    [ntp_ok=$enableval],
2568290001Sglebius    [ntp_ok=no]
2569290001Sglebius)
2570290001Sglebiuscase "$ntp_ok" in
2571290001Sglebius yes)
2572181834Sroberto    ntp_refclock=yes
2573290001Sglebius    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2574290001Sglebius    ;;
2575290001Sglebiusesac
2576290001SglebiusAC_MSG_RESULT([$ntp_ok])
2577181834Sroberto
2578200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2579290001SglebiusAC_ARG_ENABLE(
2580290001Sglebius    [ULINK],
2581290001Sglebius    [AS_HELP_STRING(
2582290001Sglebius	[--enable-ULINK],
2583290001Sglebius	[+ Ultralink WWVB receiver]
2584290001Sglebius    )],
2585290001Sglebius    [ntp_ok=$enableval],
2586290001Sglebius    [ntp_ok=$ntp_eac]
2587290001Sglebius)
2588290001Sglebiuscase "$ntp_ok" in
2589290001Sglebius yes)
2590181834Sroberto    ntp_refclock=yes
2591290001Sglebius    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2592290001Sglebius    ;;
2593290001Sglebiusesac
2594290001SglebiusAC_MSG_RESULT([$ntp_ok])
2595181834Sroberto
2596290001SglebiusAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2597290001SglebiusAC_ARG_ENABLE(
2598290001Sglebius    [TSYNCPCI],
2599290001Sglebius    [AS_HELP_STRING(
2600290001Sglebius	[--enable-TSYNCPCI],
2601290001Sglebius	[s Spectracom TSYNC timing board]
2602290001Sglebius    )],
2603290001Sglebius    [ntp_ok=$enableval],
2604290001Sglebius    [
2605290001Sglebius	case "$host" in
2606290001Sglebius	 *-*-*linux*)
2607290001Sglebius	    ntp_ok=$ntp_eac
2608290001Sglebius	    ;;
2609290001Sglebius	 *)
2610290001Sglebius	    ntp_ok=no
2611290001Sglebius	esac
2612290001Sglebius    ]
2613290001Sglebius)
2614290001Sglebiuscase "$ntp_ok" in
2615290001Sglebius yes)
2616290001Sglebius    ntp_refclock=yes
2617290001Sglebius    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2618290001Sglebius    ;;
2619290001Sglebiusesac
2620290001SglebiusAC_MSG_RESULT([$ntp_ok])
2621290001Sglebius
2622200576SrobertoAC_MSG_CHECKING([WWV receiver])
2623290001SglebiusAC_ARG_ENABLE(
2624290001Sglebius    [WWV],
2625290001Sglebius    [AS_HELP_STRING(
2626290001Sglebius	[--enable-WWV],
2627290001Sglebius	[s WWV Audio receiver]
2628290001Sglebius    )],
2629181834Sroberto    [ntp_ok=$enableval],
2630290001Sglebius    [
2631290001Sglebius	case "$ntp_eac$ntp_canaudio" in
2632290001Sglebius	 *no*)	ntp_ok=no  ;;
2633290001Sglebius	 *)	ntp_ok=yes ;;
2634290001Sglebius	esac
2635290001Sglebius    ]
2636290001Sglebius)
2637290001Sglebiuscase "$ntp_ok" in
2638290001Sglebius yes)
2639181834Sroberto    ntp_refclock=yes
2640290001Sglebius    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2641290001Sglebius    ;;
2642290001Sglebiusesac
2643290001SglebiusAC_MSG_RESULT([$ntp_ok])
2644181834Srobertocase "$ntp_ok$ntp_canaudio" in
2645290001Sglebius yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2646181834Srobertoesac
2647181834Sroberto
2648200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2649290001SglebiusAC_ARG_ENABLE(
2650290001Sglebius    [ZYFER],
2651290001Sglebius    [AS_HELP_STRING(
2652290001Sglebius	[--enable-ZYFER],
2653290001Sglebius	[+ Zyfer GPStarplus receiver]
2654290001Sglebius    )],
2655290001Sglebius    [ntp_ok=$enableval],
2656290001Sglebius    [ntp_ok=$ntp_eac]
2657290001Sglebius)
2658290001Sglebiuscase "$ntp_ok" in
2659290001Sglebius yes)
2660181834Sroberto    ntp_refclock=yes
2661290001Sglebius    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2662290001Sglebius    ;;
2663290001Sglebiusesac
2664290001SglebiusAC_MSG_RESULT([$ntp_ok])
2665181834Sroberto
2666200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2667290001SglebiusAC_ARG_ENABLE(
2668290001Sglebius    [parse-clocks],
2669290001Sglebius    [AS_HELP_STRING(
2670290001Sglebius	[--enable-parse-clocks],
2671290001Sglebius	[- include all suitable PARSE clocks:]
2672290001Sglebius    )],
2673181834Sroberto    [ntp_eapc=$enableval],
2674290001Sglebius    [
2675290001Sglebius	case "$ntp_eac" in
2676290001Sglebius	 yes)	ntp_eapc=$ntp_canparse ;;
2677290001Sglebius	 *)	ntp_eapc=no ;;
2678290001Sglebius	esac
2679290001Sglebius	# Delete the next line one of these days
2680290001Sglebius	ntp_eapc=no
2681290001Sglebius    ]
2682290001Sglebius)
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])
2699290001SglebiusAC_ARG_ENABLE(
2700290001Sglebius    [COMPUTIME],
2701290001Sglebius    [AS_HELP_STRING(
2702290001Sglebius	[--enable-COMPUTIME],
2703290001Sglebius	[s Diem Computime Radio Clock]
2704290001Sglebius    )],
2705290001Sglebius    [ntp_ok=$enableval],
2706290001Sglebius    [ntp_ok=$ntp_eapc]
2707290001Sglebius)
2708290001Sglebiuscase "$ntp_ok" in
2709290001Sglebius yes)
2710181834Sroberto    ntp_libparse=yes
2711181834Sroberto    ntp_refclock=yes
2712290001Sglebius    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2713290001Sglebius    ;;
2714290001Sglebiusesac
2715290001SglebiusAC_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])
2722290001SglebiusAC_ARG_ENABLE(
2723290001Sglebius    [DCF7000],
2724290001Sglebius    [AS_HELP_STRING(
2725290001Sglebius	[--enable-DCF7000],
2726290001Sglebius	[s ELV/DCF7000 clock]
2727290001Sglebius    )],
2728290001Sglebius    [ntp_ok=$enableval],
2729290001Sglebius    [ntp_ok=$ntp_eapc]
2730290001Sglebius)
2731290001Sglebiuscase "$ntp_ok" in
2732290001Sglebius yes)
2733181834Sroberto    ntp_libparse=yes
2734181834Sroberto    ntp_refclock=yes
2735290001Sglebius    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2736290001Sglebius    ;;
2737290001Sglebiusesac
2738290001SglebiusAC_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])
2745290001SglebiusAC_ARG_ENABLE(
2746290001Sglebius    [HOPF6021],
2747290001Sglebius    [AS_HELP_STRING(
2748290001Sglebius	[--enable-HOPF6021],
2749290001Sglebius	[s HOPF 6021 clock]
2750290001Sglebius    )],
2751290001Sglebius    [ntp_ok=$enableval],
2752290001Sglebius    [ntp_ok=$ntp_eapc]
2753290001Sglebius)
2754290001Sglebiuscase "$ntp_ok" in
2755290001Sglebius yes)
2756181834Sroberto    ntp_libparse=yes
2757181834Sroberto    ntp_refclock=yes
2758290001Sglebius    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2759290001Sglebius    ;;
2760290001Sglebiusesac
2761290001SglebiusAC_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])
2768290001SglebiusAC_ARG_ENABLE(
2769290001Sglebius    [MEINBERG],
2770290001Sglebius    [AS_HELP_STRING(
2771290001Sglebius	[--enable-MEINBERG],
2772290001Sglebius	[s Meinberg clocks]
2773290001Sglebius    )],
2774290001Sglebius    [ntp_ok=$enableval],
2775290001Sglebius    [ntp_ok=$ntp_eapc]
2776290001Sglebius)
2777290001Sglebiuscase "$ntp_ok" in
2778290001Sglebius yes)
2779181834Sroberto    ntp_libparse=yes
2780181834Sroberto    ntp_refclock=yes
2781290001Sglebius    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2782290001Sglebius    ;;
2783290001Sglebiusesac
2784290001SglebiusAC_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])
2791290001SglebiusAC_ARG_ENABLE(
2792290001Sglebius    [RAWDCF],
2793290001Sglebius    [AS_HELP_STRING(
2794290001Sglebius	[--enable-RAWDCF],
2795290001Sglebius	[s DCF77 raw time code]
2796290001Sglebius    )],
2797290001Sglebius    [ntp_ok=$enableval],
2798290001Sglebius    [ntp_ok=$ntp_eapc]
2799290001Sglebius)
2800290001Sglebiuscase "$ntp_ok" in
2801290001Sglebius yes)
2802181834Sroberto    ntp_libparse=yes
2803181834Sroberto    ntp_parseutil=yes
2804181834Sroberto    ntp_refclock=yes
2805181834Sroberto    ntp_rawdcf=yes
2806290001Sglebius    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2807290001Sglebius    ;;
2808290001Sglebiusesac
2809290001SglebiusAC_MSG_RESULT([$ntp_ok])
2810181834Srobertocase "$ntp_ok$ntp_canparse" in
2811181834Sroberto yesno)
2812290001Sglebius    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],
2818290001Sglebius	[ntp_cv_rawdcf_parity],
2819290001Sglebius	[
2820290001Sglebius	    ans=no
2821290001Sglebius	    case "$host" in
2822290001Sglebius	     *-*-*linux*)
2823290001Sglebius		ans=yes
2824290001Sglebius		;;
2825290001Sglebius	    esac
2826290001Sglebius	    ntp_cv_rawdcf_parity=$ans
2827290001Sglebius	]
2828290001Sglebius    )
2829290001Sglebius    case "$ntp_cv_rawdcf_parity" in
2830290001Sglebius     yes)
2831290001Sglebius	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2832290001Sglebius	    [Should we not IGNPAR (Linux)?]) ;;
2833181834Sroberto    esac
2834181834Srobertoesac
2835181834Sroberto
2836200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2837290001SglebiusAC_ARG_ENABLE(
2838290001Sglebius    [RCC8000],
2839290001Sglebius    [AS_HELP_STRING(
2840290001Sglebius	[--enable-RCC8000],
2841290001Sglebius	[s RCC 8000 clock]
2842290001Sglebius    )],
2843290001Sglebius    [ntp_ok=$enableval],
2844290001Sglebius    [ntp_ok=$ntp_eapc]
2845290001Sglebius)
2846290001Sglebiuscase "$ntp_ok" in
2847290001Sglebius yes)
2848181834Sroberto    ntp_libparse=yes
2849181834Sroberto    ntp_refclock=yes
2850290001Sglebius    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2851290001Sglebius    ;;
2852290001Sglebiusesac
2853290001SglebiusAC_MSG_RESULT([$ntp_ok])
2854181834Srobertocase "$ntp_ok$ntp_canparse" in
2855181834Sroberto yesno)
2856290001Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2857181834Srobertoesac
2858181834Sroberto
2859200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2860290001SglebiusAC_ARG_ENABLE(
2861290001Sglebius    [SCHMID],
2862290001Sglebius    [AS_HELP_STRING(
2863290001Sglebius	[--enable-SCHMID ],
2864290001Sglebius	[s Schmid DCF77 clock]
2865290001Sglebius    )],
2866290001Sglebius    [ntp_ok=$enableval],
2867290001Sglebius    [ntp_ok=$ntp_eapc]
2868290001Sglebius)
2869290001Sglebiuscase "$ntp_ok" in
2870290001Sglebius yes)
2871181834Sroberto    ntp_libparse=yes
2872181834Sroberto    ntp_refclock=yes
2873290001Sglebius    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2874290001Sglebius    ;;
2875290001Sglebiusesac
2876290001SglebiusAC_MSG_RESULT([$ntp_ok])
2877181834Srobertocase "$ntp_ok$ntp_canparse" in
2878181834Sroberto yesno)
2879290001Sglebius    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])
2883290001SglebiusAC_ARG_ENABLE(
2884290001Sglebius    [TRIMTAIP],
2885290001Sglebius    [AS_HELP_STRING(
2886290001Sglebius	[--enable-TRIMTAIP],
2887290001Sglebius	[s Trimble GPS receiver/TAIP protocol]
2888290001Sglebius    )],
2889290001Sglebius    [ntp_ok=$enableval],
2890290001Sglebius    [ntp_ok=$ntp_eapc]
2891290001Sglebius)
2892290001Sglebiuscase "$ntp_ok" in
2893290001Sglebius yes)
2894181834Sroberto    ntp_libparse=yes
2895181834Sroberto    ntp_refclock=yes
2896290001Sglebius    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2897290001Sglebius	[Trimble GPS receiver/TAIP protocol])
2898290001Sglebius    ;;
2899290001Sglebiusesac
2900290001SglebiusAC_MSG_RESULT([$ntp_ok])
2901181834Srobertocase "$ntp_ok$ntp_canparse" in
2902181834Sroberto yesno)
2903290001Sglebius    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])
2907290001SglebiusAC_ARG_ENABLE(
2908290001Sglebius    [TRIMTSIP],
2909290001Sglebius    [AS_HELP_STRING(
2910290001Sglebius	[--enable-TRIMTSIP],
2911290001Sglebius	[s Trimble GPS receiver/TSIP protocol]
2912290001Sglebius    )],
2913290001Sglebius    [ntp_ok=$enableval],
2914290001Sglebius    [ntp_ok=$ntp_eapc]
2915290001Sglebius)
2916290001Sglebiuscase "$ntp_ok" in
2917290001Sglebius yes)
2918181834Sroberto    ntp_libparse=yes
2919181834Sroberto    ntp_refclock=yes
2920290001Sglebius    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2921290001Sglebius	[Trimble GPS receiver/TSIP protocol])
2922290001Sglebius    ;;
2923290001Sglebiusesac
2924290001SglebiusAC_MSG_RESULT([$ntp_ok])
2925181834Srobertocase "$ntp_ok$ntp_canparse" in
2926181834Sroberto yesno)
2927290001Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2928181834Srobertoesac
2929181834Sroberto
2930200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2931290001SglebiusAC_ARG_ENABLE(
2932290001Sglebius    [WHARTON],
2933290001Sglebius    [AS_HELP_STRING(
2934290001Sglebius	[--enable-WHARTON],
2935290001Sglebius	[s WHARTON 400A Series clock]
2936290001Sglebius    )],
2937290001Sglebius    [ntp_ok=$enableval],
2938290001Sglebius    [ntp_ok=$ntp_eapc]
2939290001Sglebius)
2940290001Sglebiuscase "$ntp_ok" in
2941290001Sglebius yes)
2942181834Sroberto    ntp_libparse=yes
2943181834Sroberto    ntp_refclock=yes
2944290001Sglebius    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2945290001Sglebius    ;;
2946290001Sglebiusesac
2947290001SglebiusAC_MSG_RESULT([$ntp_ok])
2948181834Srobertocase "$ntp_ok$ntp_canparse" in
2949181834Sroberto yesno)
2950290001Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2951290001Sglebiusesac
2952290001Sglebius
2953290001SglebiusAC_MSG_CHECKING([VARITEXT clock])
2954290001SglebiusAC_ARG_ENABLE(
2955290001Sglebius    [VARITEXT],
2956290001Sglebius    [AS_HELP_STRING(
2957290001Sglebius	[--enable-VARITEXT],
2958290001Sglebius	[s VARITEXT clock]
2959290001Sglebius    )],
2960290001Sglebius    [ntp_ok=$enableval],
2961290001Sglebius    [ntp_ok=$ntp_eapc]
2962290001Sglebius)
2963290001Sglebiuscase "$ntp_ok" in
2964290001Sglebius yes)
2965290001Sglebius    ntp_libparse=yes
2966290001Sglebius    ntp_refclock=yes
2967290001Sglebius    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2968181834Sroberto    ;;
2969181834Srobertoesac
2970290001SglebiusAC_MSG_RESULT([$ntp_ok])
2971290001Sglebiuscase "$ntp_ok$ntp_canparse" in
2972290001Sglebius yesno)
2973290001Sglebius    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2974290001Sglebiusesac
2975181834Sroberto
2976290001SglebiusAC_MSG_CHECKING(SEL240X clock)
2977290001SglebiusAC_ARG_ENABLE(SEL240X,
2978290001Sglebius    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
2983290001Sglebius    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2984181834Srobertofi
2985181834SrobertoAC_MSG_RESULT($ntp_ok)
2986181834Srobertocase "$ntp_ok$ntp_canparse" in
2987181834Sroberto yesno)
2988290001Sglebius    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2989181834Sroberto    ;;
2990181834Srobertoesac
2991290001Sglebius
2992290001SglebiusAC_SUBST([LIBPARSE])
2993290001SglebiusAC_SUBST([MAKE_LIBPARSE])
2994290001SglebiusAC_SUBST([MAKE_LIBPARSE_KERNEL])
2995290001SglebiusAC_SUBST([MAKE_CHECK_Y2K])
2996290001Sglebius
2997200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
2998181834Srobertoans=no
2999181834Srobertocase "$ntp_libparse" in
3000181834Sroberto yes)
3001181834Sroberto    ans=yes
3002290001Sglebius    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
3010290001SglebiusNTP_OPENSSL
3011181834Sroberto
3012290001SglebiusNTP_CRYPTO_RAND
3013181834Sroberto
3014290001Sglebius# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3015290001SglebiusAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3016290001SglebiusAC_ARG_ENABLE(
3017290001Sglebius    [autokey],
3018290001Sglebius    AS_HELP_STRING(
3019290001Sglebius	[--enable-autokey],
3020290001Sglebius	[+ support NTP Autokey protocol]
3021290001Sglebius	),
3022290001Sglebius    [ntp_autokey=$enableval],
3023290001Sglebius    [ntp_autokey=$ntp_openssl]
3024290001Sglebius)
3025290001Sglebiuscase "$ntp_autokey" in
3026290001Sglebius no)
3027181834Sroberto    ;;
3028290001Sglebius *)
3029290001Sglebius    case "$ntp_openssl" in
3030181834Sroberto     no)
3031290001Sglebius	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3032290001Sglebius	ntp_autokey=no
3033181834Sroberto	;;
3034290001Sglebius     *)
3035290001Sglebius	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3036290001Sglebius	ntp_autokey=yes
3037181834Sroberto	;;
3038181834Sroberto    esac
3039181834Sroberto    ;;
3040181834Srobertoesac
3041290001SglebiusAC_MSG_RESULT([$ntp_autokey])
3042181834Sroberto
3043290001SglebiusAC_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
3056290001SglebiusAC_SUBST([TESTDCF])
3057290001SglebiusAC_SUBST([DCFD])
3058200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3059181834Srobertoans=no
3060290001Sglebiuscase "$ntp_parseutil" in
3061290001Sglebius yes)
3062181834Sroberto    case "$host" in
3063200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3064181834Sroberto	ans="dcfd testdcf"
3065181834Sroberto	DCFD=dcfd
3066290001Sglebius	TESTDCF=testdcf
3067181834Sroberto    esac
3068290001Sglebius    ;;
3069290001Sglebiusesac
3070200576SrobertoAC_MSG_RESULT([$ans])
3071181834Sroberto
3072290001SglebiusAC_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*)
3079290001Sglebius        case "$ntp_cv_var_kernel_pll" in
3080181834Sroberto	yes)
3081290001Sglebius	    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
3090290001Sglebius	AC_CHECK_HEADERS([strings.h])
3091181834Sroberto	;;
3092181834Sroberto    esac
3093181834Sroberto    ;;
3094181834Srobertoesac
3095200576SrobertoAC_MSG_RESULT([$ans])
3096181834Sroberto
3097200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3098290001Sglebiuscase "$ntp_refclock" in
3099290001Sglebius yes)
3100290001Sglebius    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3101290001Sglebius    ;;
3102290001Sglebiusesac
3103181834SrobertoAC_MSG_RESULT($ntp_refclock)
3104181834Sroberto
3105290001Sglebiusdnl Things that can be made in clockstuff
3106290001SglebiusAC_SUBST([PROPDELAY], [propdelay])
3107290001SglebiusAC_SUBST([CHUTEST]) dnl needs work to compile
3108181834Sroberto
3109290001SglebiusAC_SUBST([MAKE_ADJTIMED])
3110290001SglebiusAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3111181834Srobertocase "$host" in
3112181834Sroberto *-*-hpux[[56789]]*)
3113181834Sroberto    ans=yes
3114181834Sroberto    ;;
3115181834Sroberto *) ans=no
3116181834Sroberto    ;;
3117181834Srobertoesac
3118290001Sglebiuscase "$ans" in
3119290001Sglebius yes)
3120181834Sroberto    MAKE_ADJTIMED=adjtimed
3121290001Sglebius    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3122290001Sglebius	[Do we need HPUX adjtime() library support?])
3123290001Sglebius    ;;
3124290001Sglebius *) ADJTIMED_DB=
3125290001Sglebius    ADJTIMED_DL=
3126290001Sglebius    ADJTIMED_DS=
3127290001Sglebius    ADJTIMED_MS=
3128290001Sglebius    ;;
3129290001Sglebiusesac
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
3140290001Sglebiuscase "$ans" in
3141290001Sglebius yes)
3142290001Sglebius    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3143290001Sglebius	[Do we need the qnx adjtime call?])
3144290001Sglebius    ;;
3145290001Sglebiusesac
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
3157290001Sglebius    ;;
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],
3184290001Sglebius    [AS_HELP_STRING(
3185200576Sroberto	[--enable-kmem],
3186200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3187290001Sglebius    )],
3188200576Sroberto    [ans=$enableval]
3189200576Sroberto)
3190200576Sroberto
3191200576SrobertoAC_MSG_RESULT([$ans])
3192200576Sroberto
3193200576Srobertocase "$ans" in
3194200576Sroberto yes)
3195200576Sroberto    can_kmem=yes
3196200576Sroberto    ;;
3197290001Sglebius *)
3198200576Sroberto    can_kmem=no
3199290001Sglebius    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    ;;
3220290001Sglebius *-ibm-aix[[4-9]]*)
3221290001Sglebius    # 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
3237290001Sglebius    ;;
3238200576Srobertoesac
3239200576Sroberto
3240200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3241200576Sroberto# override the default
3242290001SglebiusAC_ARG_ENABLE(
3243290001Sglebius    [accurate-adjtime],
3244290001Sglebius    [AS_HELP_STRING(
3245290001Sglebius	[--enable-accurate-adjtime],
3246290001Sglebius	[s the adjtime() call is accurate]
3247290001Sglebius    )],
3248290001Sglebius    [ans=$enableval]
3249200576Sroberto)
3250200576Sroberto
3251200576SrobertoAC_MSG_RESULT([$ans])
3252200576Sroberto
3253200576Srobertocase "$ans" in
3254290001Sglebius yes)
3255290001Sglebius    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3256200576Sroberto    adjtime_is_accurate=yes
3257200576Sroberto    ;;
3258200576Sroberto *)
3259200576Sroberto    adjtime_is_accurate=no
3260290001Sglebius    ;;
3261181834Srobertoesac
3262181834Sroberto
3263290001SglebiusAC_CACHE_CHECK(
3264290001Sglebius    [the name of 'tick' in the kernel],
3265290001Sglebius    [ntp_cv_nlist_tick],
3266290001Sglebius    [
3267290001Sglebius	ans=_tick
3268290001Sglebius	case "$host" in
3269290001Sglebius	 m68*-hp-hpux*) # HP9000/300?
3270290001Sglebius	    ans=_old_tick
3271290001Sglebius	    ;;
3272290001Sglebius	 *-apple-aux[[23]]*)
3273290001Sglebius	    ans=tick
3274290001Sglebius	    ;;
3275290001Sglebius	 *-hp-hpux*)
3276290001Sglebius	    ans=old_tick
3277290001Sglebius	    ;;
3278290001Sglebius	 *-ibm-aix[[3-9]]*)
3279290001Sglebius	    # XXX only verified thru AIX6.
3280290001Sglebius	    ans=no
3281290001Sglebius	    ;;
3282290001Sglebius	 *-*-mpeix*)
3283290001Sglebius	    ans=no
3284290001Sglebius	    ;;
3285290001Sglebius	 *-*-ptx*)
3286290001Sglebius	    ans=tick
3287290001Sglebius	    ;;
3288290001Sglebius	 *-*-sco3.2v[[45]]*)
3289290001Sglebius	    ans=no
3290290001Sglebius	    ;;
3291290001Sglebius	 *-*-solaris2*)
3292290001Sglebius	    ans=nsec_per_tick
3293290001Sglebius	    ;;
3294290001Sglebius	 *-*-sysv4*)
3295290001Sglebius	    ans=tick
3296290001Sglebius	    ;;
3297290001Sglebius	esac
3298290001Sglebius	ntp_cv_nlist_tick=$ans
3299290001Sglebius    ]
3300290001Sglebius)
3301290001Sglebiuscase "$ntp_cv_nlist_tick" in
3302290001Sglebius ''|no)
3303290001Sglebius    ;;	# HMS: I think we can only get 'no' here...
3304290001Sglebius *)
3305290001Sglebius    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3306290001Sglebius	[What is the name of TICK in the kernel?])
3307181834Srobertoesac
3308290001Sglebius
3309290001SglebiusAC_CACHE_CHECK(
3310290001Sglebius    [for the units of 'tick'],
3311290001Sglebius    [ntp_cv_tick_nano],
3312290001Sglebius    [
3313290001Sglebius	ans=usec
3314290001Sglebius	case "$host" in
3315290001Sglebius	 *-*-solaris2*)
3316290001Sglebius	    ans=nsec
3317290001Sglebius	    ;;
3318290001Sglebius	esac
3319290001Sglebius	ntp_cv_tick_nano=$ans
3320290001Sglebius    ]
3321290001Sglebius)
3322290001Sglebiuscase "$ntp_cv_tick_nano" in
3323181834Sroberto nsec)
3324290001Sglebius    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3325181834Srobertoesac
3326290001Sglebius
3327290001SglebiusAC_CACHE_CHECK(
3328290001Sglebius    [the name of 'tickadj' in the kernel],
3329290001Sglebius    [ntp_cv_nlist_tickadj],
3330290001Sglebius    [
3331290001Sglebius	ans=_tickadj
3332290001Sglebius	case "$host" in
3333290001Sglebius	 m68*-hp-hpux*) # HP9000/300?
3334290001Sglebius	    ans=_tickadj
3335290001Sglebius	    ;;
3336290001Sglebius	 *-apple-aux[[23]]*)
3337290001Sglebius	    ans=tickadj
3338290001Sglebius	    ;;
3339290001Sglebius	 *-hp-hpux10*)
3340290001Sglebius	    ans=no
3341290001Sglebius	    ;;
3342290001Sglebius	 *-hp-hpux9*)
3343290001Sglebius	    ans=no
3344290001Sglebius	    ;;
3345290001Sglebius	 *-hp-hpux*)
3346290001Sglebius	    ans=tickadj
3347290001Sglebius	    ;;
3348290001Sglebius	 *-*-aix*)
3349290001Sglebius	    ans=tickadj
3350290001Sglebius	    ;;
3351290001Sglebius	 *-*-mpeix*)
3352290001Sglebius	    ans=no
3353290001Sglebius	    ;;
3354290001Sglebius	 *-*-ptx*)
3355290001Sglebius	    ans=tickadj
3356290001Sglebius	    ;;
3357290001Sglebius	 *-*-sco3.2v4*)
3358290001Sglebius	    ans=no
3359290001Sglebius	    ;;
3360290001Sglebius	 *-*-sco3.2v5.0*)
3361290001Sglebius	    ans=clock_drift
3362290001Sglebius	    ;;
3363290001Sglebius	 *-*-solaris2*)
3364290001Sglebius	    ans=no	# hrestime_adj
3365290001Sglebius	    ;;
3366290001Sglebius	 *-*-sysv4*)
3367290001Sglebius	    ans=tickadj
3368290001Sglebius	    ;;
3369290001Sglebius	esac
3370290001Sglebius	ntp_cv_nlist_tickadj=$ans
3371290001Sglebius    ]
3372290001Sglebius)
3373290001Sglebiuscase "$ntp_cv_nlist_tickadj" in
3374290001Sglebius ''|no)
3375290001Sglebius    ;;	# HMS: I think we can only get 'no' here...
3376290001Sglebius *)
3377290001Sglebius    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3378290001Sglebius	[What is the name of TICKADJ in the kernel?])
3379181834Srobertoesac
3380290001Sglebius
3381290001SglebiusAC_CACHE_CHECK(
3382290001Sglebius    [for the units of 'tickadj'],
3383290001Sglebius    [ntp_cv_tickadj_nano],
3384290001Sglebius    [
3385290001Sglebius	ans=usec
3386290001Sglebius	case "$host" in
3387290001Sglebius	 *-*-solaris2*)
3388290001Sglebius	    ans=nsec
3389290001Sglebius	    ;;
3390290001Sglebius	esac
3391290001Sglebius	ntp_cv_tickadj_nano=$ans
3392290001Sglebius    ]
3393290001Sglebius)
3394290001Sglebiuscase "$ntp_cv_tickadj_nano" in
3395181834Sroberto nsec)
3396290001Sglebius    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3397181834Srobertoesac
3398290001Sglebius
3399290001SglebiusAC_CACHE_CHECK(
3400290001Sglebius    [half-heartedly for 'dosynctodr' in the kernel],
3401290001Sglebius    [ntp_cv_nlist_dosynctodr],
3402290001Sglebius    [
3403290001Sglebius	case "$host" in
3404290001Sglebius	 *-apple-aux[[23]]*)
3405290001Sglebius	    ans=no
3406290001Sglebius	    ;;
3407290001Sglebius	 *-sni-sysv*)
3408290001Sglebius	    ans=dosynctodr
3409290001Sglebius	    ;;
3410290001Sglebius	 *-stratus-vos)
3411290001Sglebius	    ans=no
3412290001Sglebius	    ;;
3413290001Sglebius	 *-*-aix*)
3414290001Sglebius	    ans=dosynctodr
3415290001Sglebius	    ;;
3416290001Sglebius	 *-*-hpux*)
3417290001Sglebius	    ans=no
3418290001Sglebius	    ;;
3419290001Sglebius	 *-*-mpeix*)
3420290001Sglebius	    ans=no
3421290001Sglebius	    ;;
3422290001Sglebius	 *-*-nextstep*)
3423290001Sglebius	    ans=_dosynctodr
3424290001Sglebius	    ;;
3425290001Sglebius	 *-*-ptx*)
3426290001Sglebius	    ans=doresettodr
3427290001Sglebius	    ;;
3428290001Sglebius	 *-*-sco3.2v4*)
3429290001Sglebius	    ans=no
3430290001Sglebius	    ;;
3431290001Sglebius	 *-*-sco3.2v5*)
3432290001Sglebius	    ans=track_rtc
3433290001Sglebius	    ;;
3434290001Sglebius	 *-*-solaris2*)
3435290001Sglebius	    ans=dosynctodr
3436290001Sglebius	    ;;
3437290001Sglebius	 *-*-sysv4*)
3438290001Sglebius	    ans=doresettodr
3439290001Sglebius	    ;;
3440290001Sglebius	 *)
3441290001Sglebius	    ans=_dosynctodr
3442290001Sglebius	    ;;
3443290001Sglebius	esac
3444290001Sglebius	ntp_cv_nlist_dosynctodr=$ans
3445290001Sglebius    ]
3446290001Sglebius)
3447290001Sglebiuscase "$ntp_cv_nlist_dosynctodr" in
3448290001Sglebius no)
3449181834Sroberto    ;;
3450181834Sroberto *)
3451290001Sglebius    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3452290001Sglebius	[What is (probably) the name of DOSYNCTODR in the kernel?])
3453181834Sroberto    ;;
3454181834Srobertoesac
3455290001Sglebius
3456290001SglebiusAC_CACHE_CHECK(
3457290001Sglebius    [half-heartedly for 'noprintf' in the kernel],
3458290001Sglebius    [ntp_cv_nlist_noprintf],
3459290001Sglebius    [
3460290001Sglebius	case "$host" in
3461290001Sglebius	 *-apple-aux[[23]]*)
3462290001Sglebius	    ans=no
3463290001Sglebius	    ;;
3464290001Sglebius	 *-sni-sysv*)
3465290001Sglebius	    ans=noprintf
3466290001Sglebius	    ;;
3467290001Sglebius	 *-stratus-vos)
3468290001Sglebius	    ans=no
3469290001Sglebius	    ;;
3470290001Sglebius	 *-*-aix*)
3471290001Sglebius	    ans=noprintf
3472290001Sglebius	    ;;
3473290001Sglebius	 *-*-hpux*)
3474290001Sglebius	    ans=no
3475290001Sglebius	    ;;
3476290001Sglebius	 *-*-mpeix*)
3477290001Sglebius	    ans=no
3478290001Sglebius	    ;;
3479290001Sglebius	 *-*-ptx*)
3480290001Sglebius	    ans=noprintf
3481290001Sglebius	    ;;
3482290001Sglebius	 *-*-nextstep*)
3483290001Sglebius	    ans=_noprintf
3484290001Sglebius	    ;;
3485290001Sglebius	 *-*-solaris2*)
3486290001Sglebius	    ans=noprintf
3487290001Sglebius	    ;;
3488290001Sglebius	 *-*-sysv4*)
3489290001Sglebius	    ans=noprintf
3490290001Sglebius	    ;;
3491290001Sglebius	 *)
3492290001Sglebius	    ans=_noprintf
3493290001Sglebius	    ;;
3494290001Sglebius	esac
3495290001Sglebius	ntp_cv_nlist_noprintf=$ans
3496290001Sglebius    ]
3497290001Sglebius)
3498290001Sglebiuscase "$ntp_cv_nlist_noprintf" in
3499290001Sglebius no)
3500181834Sroberto    ;;
3501181834Sroberto *)
3502290001Sglebius    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3503290001Sglebius	[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
3510290001Sglebiusdnl	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],
3557290001Sglebius    [AS_HELP_STRING(
3558200576Sroberto	[--enable-tick=VALUE],
3559200576Sroberto	[s force a value for 'tick']
3560290001Sglebius    )],
3561200576Sroberto    [ans=$enableval]
3562200576Sroberto)
3563200576Sroberto
3564200576SrobertoAC_MSG_RESULT([$ans])
3565200576Sroberto
3566200576Srobertocase "$ans" in
3567290001Sglebius ''|no)
3568290001Sglebius    ;;	# HMS: I think we can only get 'no' here...
3569290001Sglebius *)
3570290001Sglebius    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3571290001Sglebius	[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)
3582290001Sglebius	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
3592290001Sglebius	;;
3593200576Sroberto    esac
3594200576Sroberto    ;;
3595200576Sroberto *-*-domainos)	# Skippy: won't be found...
3596200576Sroberto    case "$can_kmem" in
3597200576Sroberto     no)
3598200576Sroberto	ans=668
3599290001Sglebius	;;
3600200576Sroberto    esac
3601200576Sroberto    ;;
3602200576Sroberto *-*-hpux*)
3603200576Sroberto    case "$adjtime_is_accurate" in
3604200576Sroberto     yes)
3605200576Sroberto	ans='tick/16'
3606290001Sglebius	;;
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
3623290001Sglebius    ;;
3624200576Srobertoesac
3625200576Sroberto
3626200576SrobertoAC_ARG_ENABLE(
3627200576Sroberto    [tickadj],
3628290001Sglebius    [AS_HELP_STRING(
3629290001Sglebius	[--enable-tickadj=VALUE],
3630290001Sglebius	[s force a value for 'tickadj']
3631290001Sglebius    )],
3632200576Sroberto    [ans=$enableval]
3633200576Sroberto)
3634200576Sroberto
3635200576SrobertoAC_MSG_RESULT([$ans])
3636200576Sroberto
3637200576Srobertodefault_tickadj=$ans
3638200576Sroberto
3639200576Srobertocase "$default_tickadj" in
3640290001Sglebius ''|no)
3641290001Sglebius    ;;	# HMS: I think we can only get 'no' here...
3642290001Sglebius *)
3643290001Sglebius    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3644290001Sglebius	[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
3652290001Sglebius mips-sni-sysv4*)
3653290001Sglebius    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3654290001Sglebius	[Do we want the ReliantUNIX clock hacks?])
3655181834Srobertoesac
3656181834Sroberto
3657181834Srobertocase "$host" in
3658290001Sglebius *-*-sco3.2v5*)
3659290001Sglebius    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3660181834Srobertoesac
3661181834Sroberto
3662290001Sglebiusntp_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.])
3666290001Sglebius    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.])
3670290001Sglebius    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.])
3674290001Sglebius    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
3695290001Sglebius *) 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    ;;
3710290001Sglebius *)
3711290001Sglebius    NTPTIME_DB=
3712290001Sglebius    NTPTIME_DL=
3713290001Sglebius    NTPTIME_DS=
3714290001Sglebius    NTPTIME_MS=
3715290001Sglebius    ;;
3716181834Srobertoesac
3717181834Sroberto
3718290001SglebiusAC_SUBST([MAKE_TICKADJ])
3719181834Srobertocase "$host" in
3720181834Sroberto mips-sni-sysv4*)
3721181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3722181834Sroberto    # Do not bother
3723290001Sglebius    ntp_cv_make_tickadj=no
3724181834Sroberto    ;;
3725181834Sroberto *-*-irix*)
3726290001Sglebius    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]]*)
3732290001Sglebius	ntp_cv_make_tickadj=no
3733181834Sroberto	;;
3734181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3735290001Sglebius     *) ntp_cv_make_tickadj=no ;;
3736181834Sroberto    esac
3737181834Sroberto    ;;
3738181834Sroberto *-*-unicosmp*)
3739290001Sglebius    ntp_cv_make_tickadj=no
3740181834Sroberto    ;;
3741181834Srobertoesac
3742200576Sroberto
3743200576Sroberto#
3744200576Sroberto# Despite all the above, we always make tickadj.  Setting
3745290001Sglebius# 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#
3750290001SglebiusAS_UNSET([ntp_cv_make_tickadj])
3751200576Sroberto
3752290001SglebiusAC_CACHE_CHECK(
3753290001Sglebius    [if we want and can make the tickadj utility],
3754290001Sglebius    [ntp_cv_make_tickadj],
3755290001Sglebius    [ntp_cv_make_tickadj=yes]
3756290001Sglebius)
3757290001Sglebiuscase "$ntp_cv_make_tickadj" in
3758181834Sroberto yes)
3759181834Sroberto    MAKE_TICKADJ=tickadj
3760181834Sroberto    ;;
3761290001Sglebius *)
3762290001Sglebius    CALC_TICKADJ_DB=
3763290001Sglebius    CALC_TICKADJ_DL=
3764290001Sglebius    CALC_TICKADJ_DS=
3765290001Sglebius    CALC_TICKADJ_MS=
3766290001Sglebius    TICKADJ_DB=
3767290001Sglebius    TICKADJ_DL=
3768290001Sglebius    TICKADJ_DS=
3769290001Sglebius    TICKADJ_MS=
3770290001Sglebius    ;;
3771181834Srobertoesac
3772181834Sroberto
3773290001SglebiusAC_SUBST([MAKE_TIMETRIM])
3774290001SglebiusAC_CACHE_CHECK(
3775290001Sglebius    [if we want and can make the timetrim utility],
3776290001Sglebius    [ntp_cv_make_timetrim],
3777290001Sglebius    [
3778290001Sglebius	case "$host" in
3779290001Sglebius	 *-*-irix*)
3780290001Sglebius	    ntp_cv_make_timetrim=yes
3781290001Sglebius	    ;;
3782290001Sglebius	 *-*-unicosmp*)
3783290001Sglebius	    ntp_cv_make_timetrim=yes
3784290001Sglebius	    ;;
3785290001Sglebius	 *)
3786290001Sglebius	    ntp_cv_make_timetrim=no
3787290001Sglebius	    ;;
3788290001Sglebius	esac
3789290001Sglebius    ]
3790290001Sglebius)
3791290001Sglebiuscase "$ntp_cv_make_timetrim" in
3792181834Sroberto yes)
3793181834Sroberto    MAKE_TIMETRIM=timetrim
3794181834Sroberto    ;;
3795290001Sglebius *) TIMETRIM_DB=
3796290001Sglebius    TIMETRIM_DL=
3797290001Sglebius    TIMETRIM_DS=
3798290001Sglebius    TIMETRIM_MS=
3799290001Sglebius    ;;
3800181834Srobertoesac
3801181834Sroberto
3802290001SglebiusAC_SUBST([MAKE_LIBNTPSIM])
3803290001SglebiusAC_SUBST([MAKE_NTPDSIM])
3804200576Sroberto
3805200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3806200576SrobertoAC_ARG_ENABLE(
3807200576Sroberto    [simulator],
3808290001Sglebius    [AS_HELP_STRING(
3809200576Sroberto	[--enable-simulator],
3810200576Sroberto	[- build/install the NTPD simulator?]
3811290001Sglebius    )],
3812290001Sglebius    [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    ;;
3821290001Sglebius *)
3822290001Sglebius    NTPDSIM_DB=
3823290001Sglebius    NTPDSIM_DL=
3824290001Sglebius    NTPDSIM_DS=
3825290001Sglebius    NTPDSIM_MS=
3826290001Sglebius    ;;
3827181834Srobertoesac
3828181834Sroberto
3829181834Srobertocase "$build" in
3830181834Sroberto $host)
3831181834Sroberto    ;;
3832181834Sroberto *) case "$host" in
3833181834Sroberto     *-*-vxworks*)
3834200576Sroberto	LDFLAGS="$LDFLAGS -r"
3835200576Sroberto	;;
3836181834Sroberto    esac
3837181834Sroberto    ;;
3838181834Srobertoesac
3839181834Sroberto
3840290001SglebiusNTP_WITHSNTP
3841200576Sroberto
3842290001SglebiusAC_MSG_CHECKING([if we want to build ntpsnmpd])
3843290001SglebiusAC_ARG_WITH(
3844290001Sglebius    [ntpsnmpd],
3845290001Sglebius    [AS_HELP_STRING(
3846290001Sglebius	[--with-ntpsnmpd],
3847290001Sglebius	[s Build ntpsnmpd MIB agent?]
3848290001Sglebius    )],
3849290001Sglebius    [ans=$withval],
3850290001Sglebius    [
3851290001Sglebius	case "$PATH_NET_SNMP_CONFIG" in
3852290001Sglebius	 /*)	ans=yes ;;
3853290001Sglebius	 *)	ans=no  ;;
3854290001Sglebius	esac
3855290001Sglebius    ]
3856290001Sglebius)
3857290001SglebiusAC_MSG_RESULT([$ans])
3858290001Sglebiuscase "$ans" in
3859290001Sglebius yes)
3860290001Sglebius    case "$PATH_NET_SNMP_CONFIG" in
3861290001Sglebius     /*)
3862290001Sglebius	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3863290001Sglebius	# Bug 2815.  This is a bit of a hack, but it works...
3864290001Sglebius	case "$ntp_cv_net_snmp_version" in
3865290001Sglebius	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3866290001Sglebius		;;
3867290001Sglebius	esac
3868290001Sglebius	AC_SUBST([SNMP_LIBS])
3869290001Sglebius	# HMS: we really want to separate CPPFLAGS and CFLAGS
3870290001Sglebius	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3871290001Sglebius	SNMP_CPPFLAGS=
3872290001Sglebius	SNMP_CFLAGS=
3873290001Sglebius	for i in $foo; do
3874290001Sglebius	    case "$i" in
3875290001Sglebius	     -D*|-U*|-I*)
3876290001Sglebius		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3877290001Sglebius		;;
3878290001Sglebius	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3879290001Sglebius		;;
3880290001Sglebius	    esac
3881290001Sglebius	done
3882290001Sglebius	AC_SUBST([SNMP_CPPFLAGS])
3883290001Sglebius	AC_SUBST([SNMP_CFLAGS])
3884290001Sglebius
3885290001Sglebius	save_CFLAGS=$CFLAGS
3886290001Sglebius	save_CPPFLAGS=$CPPFLAGS
3887290001Sglebius	save_LIBS=$LIBS
3888290001Sglebius	CFLAGS=$SNMP_CFLAGS
3889290001Sglebius	CPPFLAGS=$SNMP_CPPFLAGS
3890290001Sglebius
3891290001Sglebius	AC_CHECK_HEADER(
3892290001Sglebius	    [net-snmp/net-snmp-config.h],
3893290001Sglebius	    [MAKE_NTPSNMPD=ntpsnmpd],
3894290001Sglebius	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3895290001Sglebius	)
3896290001Sglebius
3897290001Sglebius	# Do this last, as we're messing up LIBS.
3898290001Sglebius	# check -lnetsnmp for netsnmp_daemonize
3899290001Sglebius	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3900290001Sglebius	AC_CHECK_LIB(
3901290001Sglebius	    [netsnmp],
3902290001Sglebius	    [netsnmp_daemonize],
3903290001Sglebius	    [ans=yes],
3904290001Sglebius	    [ans=no]
3905290001Sglebius	)
3906290001Sglebius	case "$ans" in
3907290001Sglebius	 no)
3908290001Sglebius	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3909290001Sglebius		[We need to provide netsnmp_daemonize()])
3910290001Sglebius	esac
3911290001Sglebius	
3912290001Sglebius	CFLAGS=$save_CFLAGS
3913290001Sglebius	AS_UNSET([save_CFLAGS])
3914290001Sglebius	CPPFLAGS=$save_CPPFLAGS
3915290001Sglebius	AS_UNSET([save_CPPFLAGS])
3916290001Sglebius	LIBS=$save_LIBS
3917290001Sglebius	AS_UNSET([save_LIBS])
3918290001Sglebius	;;
3919290001Sglebius     *) 
3920290001Sglebius	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3921290001Sglebius	;;
3922290001Sglebius    esac
3923290001Sglebius    ;;
3924290001Sglebiusesac
3925290001SglebiusAC_SUBST([MAKE_NTPSNMPD])
3926290001Sglebius
3927290001Sglebiuscase "$MAKE_NTPSNMPD" in
3928290001Sglebius '')
3929290001Sglebius    NTPSNMPD_DB=
3930290001Sglebius    NTPSNMPD_DL=
3931290001Sglebius    NTPSNMPD_DS=
3932290001Sglebius    NTPSNMPD_MS=
3933290001Sglebius    ;;
3934290001Sglebiusesac
3935290001Sglebius
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],
3961290001Sglebius    [AS_HELP_STRING(
3962200576Sroberto	[--enable-slew-always],
3963200576Sroberto	[s always slew the time]
3964290001Sglebius    )],
3965200576Sroberto    [ans=$enableval]
3966200576Sroberto)
3967200576Sroberto
3968200576SrobertoAC_MSG_RESULT([$ans])
3969200576Sroberto
3970200576Srobertocase "$ans" in
3971290001Sglebius yes)
3972290001Sglebius    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    ;;
3981290001Sglebius *-stratus-vos)
3982290001Sglebius    ans=no
3983290001Sglebius    ;;
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],
4005290001Sglebius    [AS_HELP_STRING(
4006200576Sroberto	[--enable-step-slew],
4007200576Sroberto	[s step and slew the time]
4008290001Sglebius    )],
4009200576Sroberto    [ans=$enableval]
4010200576Sroberto)
4011200576Sroberto
4012200576SrobertoAC_MSG_RESULT([$ans])
4013200576Sroberto
4014200576Srobertocase "$ans" in
4015290001Sglebius yes)
4016290001Sglebius    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
4026290001Sglebius    ;;
4027200576Srobertoesac
4028200576Sroberto
4029200576SrobertoAC_ARG_ENABLE(
4030200576Sroberto    [ntpdate-step],
4031290001Sglebius    [AS_HELP_STRING(
4032200576Sroberto	[--enable-ntpdate-step],
4033200576Sroberto	[s if ntpdate should step the time]
4034290001Sglebius    )],
4035200576Sroberto    [ans=$enableval]
4036200576Sroberto)
4037200576Sroberto
4038200576SrobertoAC_MSG_RESULT([$ans])
4039200576Sroberto
4040200576Srobertocase "$ans" in
4041290001Sglebius yes)
4042290001Sglebius    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4043290001Sglebius	[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
4058290001Sglebius    ;;
4059200576Srobertoesac
4060200576Sroberto
4061200576SrobertoAC_ARG_ENABLE(
4062200576Sroberto    [hourly-todr-sync],
4063290001Sglebius    [AS_HELP_STRING(
4064200576Sroberto	[--enable-hourly-todr-sync],
4065200576Sroberto	[s if we should sync TODR hourly]
4066290001Sglebius    )],
4067200576Sroberto    [ans=$enableval]
4068200576Sroberto)
4069200576Sroberto
4070200576SrobertoAC_MSG_RESULT([$ans])
4071200576Sroberto
4072181834Srobertocase "$ac_cv_var_sync_todr" in
4073290001Sglebius yes)
4074290001Sglebius    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	;;
4097290001Sglebius     *)
4098181834Sroberto	ans=yes
4099290001Sglebius	;;
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
4120290001Sglebius	;;
4121181834Sroberto    esac
4122200576Sroberto    ;;
4123200576Sroberto *)
4124200576Sroberto    ans=no
4125290001Sglebius    ;;
4126200576Srobertoesac
4127200576Sroberto
4128200576SrobertoAC_ARG_ENABLE(
4129200576Sroberto    [kernel-fll-bug],
4130290001Sglebius    [AS_HELP_STRING(
4131200576Sroberto	[--enable-kernel-fll-bug],
4132200576Sroberto	[s if we should avoid a kernel FLL bug]
4133290001Sglebius    )],
4134200576Sroberto    [ans=$enableval]
4135200576Sroberto)
4136200576Sroberto
4137200576SrobertoAC_MSG_RESULT([$ans])
4138200576Sroberto
4139200576Srobertocase "$ans" in
4140290001Sglebius yes)
4141290001Sglebius    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4142200576Srobertoesac
4143200576Sroberto
4144200576Sroberto
4145290001SglebiusAC_MSG_CHECKING([if we want new session key behavior])
4146290001SglebiusAC_ARG_ENABLE(
4147290001Sglebius    [bug1243-fix],
4148290001Sglebius    [AS_HELP_STRING(
4149290001Sglebius	[--enable-bug1243-fix],
4150290001Sglebius	[+ use unmodified autokey session keys]
4151290001Sglebius    )],
4152290001Sglebius    [ans=$enableval],
4153290001Sglebius    [ans=yes]
4154290001Sglebius)
4155290001SglebiusAC_MSG_RESULT([$ans])
4156290001Sglebiuscase "$ans" in
4157290001Sglebius no)
4158290001Sglebius    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4159290001Sglebius	[use old autokey session key behavior?])
4160290001Sglebiusesac
4161290001Sglebius
4162290001Sglebius
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
4191290001Sglebius    ;;
4192200576Srobertoesac
4193200576Sroberto
4194200576SrobertoAC_ARG_ENABLE(
4195290001Sglebius    [irig-sawtooth],
4196290001Sglebius    [AS_HELP_STRING(
4197200576Sroberto	[--enable-irig-sawtooth],
4198200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4199290001Sglebius    )],
4200200576Sroberto    [ans=$enableval]
4201200576Sroberto)
4202200576Sroberto
4203200576SrobertoAC_MSG_RESULT([$ans])
4204200576Sroberto
4205200576Srobertocase "$ans" in
4206290001Sglebius yes)
4207290001Sglebius    AC_DEFINE([IRIG_SUCKS], [1],
4208290001Sglebius	[Should we use the IRIG sawtooth filter?])
4209181834Srobertoesac
4210181834Sroberto
4211200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4212200576SrobertoAC_ARG_ENABLE(
4213290001Sglebius	[nist],
4214290001Sglebius	[AS_HELP_STRING(
4215200576Sroberto	    [--enable-nist],
4216200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4217290001Sglebius	)],
4218200576Sroberto	[ans=$enableval],
4219200576Sroberto	[ans=no]
4220200576Sroberto)
4221200576Sroberto
4222200576SrobertoAC_MSG_RESULT([$ans])
4223200576Sroberto
4224200576Srobertocase "$ans" in
4225290001Sglebius yes)
4226290001Sglebius    AC_DEFINE([LOCKCLOCK], [1],
4227290001Sglebius	[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],
4233290001Sglebius    [AS_HELP_STRING(
4234290001Sglebius	[--enable-ntp-signd],
4235290001Sglebius	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4236290001Sglebius    )],
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 *)
4258290001Sglebius    AC_DEFINE([HAVE_NTP_SIGND], [1],
4259290001Sglebius	[Do we want support for Samba's signing daemon?])
4260290001Sglebius    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4261290001Sglebius	[Path to sign daemon rendezvous socket])
4262200576Sroberto    ;;
4263200576Srobertoesac
4264200576Sroberto
4265200576SrobertoAC_CHECK_HEADERS([libscf.h])
4266290001SglebiusLSCF=
4267200576Srobertocase "$ac_cv_header_libscf_h" in
4268200576Sroberto yes)
4269290001Sglebius    LSCF='-lscf'
4270200576Srobertoesac
4271290001SglebiusAC_SUBST([LSCF])
4272200576Sroberto
4273290001SglebiusNTP_IPV6
4274200576Sroberto
4275200576Sroberto
4276181834Sroberto#
4277290001Sglebius# Look for a sysctl call to get the list of network interfaces.
4278181834Sroberto#
4279200576SrobertoAC_CACHE_CHECK(
4280290001Sglebius    [for interface list sysctl],
4281290001Sglebius    [ntp_cv_iflist_sysctl],
4282290001Sglebius    [AC_PREPROC_IFELSE(
4283290001Sglebius	[AC_LANG_SOURCE([
4284290001Sglebius	    #include <sys/param.h>
4285290001Sglebius	    #include <sys/sysctl.h>
4286290001Sglebius	    #include <sys/socket.h>
4287290001Sglebius	    #ifndef NET_RT_IFLIST
4288290001Sglebius	    # error
4289290001Sglebius	    #endif
4290290001Sglebius	])],
4291290001Sglebius	[ntp_cv_iflist_sysctl=yes],
4292290001Sglebius	[ntp_cv_iflist_sysctl=no]
4293290001Sglebius    )]
4294200576Sroberto)
4295290001Sglebiuscase "$ntp_cv_iflist_sysctl" in
4296200576Sroberto yes)
4297290001Sglebius    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4298181834Srobertoesac
4299181834Sroberto
4300290001Sglebius###
4301181834Sroberto
4302290001SglebiusAC_MSG_CHECKING([if we want the saveconfig mechanism])
4303290001SglebiusAC_ARG_ENABLE(
4304290001Sglebius    [saveconfig],
4305290001Sglebius    [AS_HELP_STRING(
4306290001Sglebius	[--enable-saveconfig],
4307290001Sglebius	[+ saveconfig mechanism]
4308290001Sglebius    )],
4309290001Sglebius    [ntp_ok=$enableval],
4310290001Sglebius    [ntp_ok=yes]
4311290001Sglebius)
4312290001Sglebiusntp_saveconfig_enabled=0
4313290001Sglebiuscase "$ntp_ok" in
4314290001Sglebius yes)
4315290001Sglebius    ntp_saveconfig_enabled=1
4316290001Sglebius    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4317200576Sroberto    ;;
4318181834Srobertoesac
4319290001SglebiusAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4320290001SglebiusAC_MSG_RESULT([$ntp_ok])
4321181834Sroberto
4322290001Sglebius###
4323181834Sroberto
4324290001SglebiusAC_MSG_CHECKING([if we want the experimental leap smear code])
4325290001SglebiusAC_ARG_ENABLE(
4326290001Sglebius    [leap-smear],
4327290001Sglebius    [AS_HELP_STRING(
4328290001Sglebius	[--enable-leap-smear],
4329290001Sglebius	[- experimental leap smear code]
4330290001Sglebius    )],
4331290001Sglebius    [ntp_ok=$enableval],
4332290001Sglebius    [ntp_ok=no]
4333181834Sroberto)
4334290001Sglebiusntp_leap_smear_enabled=0
4335290001Sglebiuscase "$ntp_ok" in
4336200576Sroberto yes)
4337290001Sglebius    ntp_leap_smear_enabled=1
4338290001Sglebius    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4339290001Sglebius    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4340290001Sglebius    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4341290001Sglebius    ;;
4342200576Srobertoesac
4343290001SglebiusAC_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
4367290001SglebiusNTP_UNITYBUILD
4368200576Sroberto
4369290001Sglebiusdnl  gtest is needed for our tests subdirs. It would be nice if we could
4370290001Sglebiusdnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4371290001Sglebiusdnl  can't be conditionalized.
4372290001SglebiusNTP_GOOGLETEST
4373200576Sroberto
4374290001SglebiusNTP_PROBLEM_TESTS
4375181834Sroberto
4376290001Sglebius###
4377200576Sroberto
4378290001SglebiusAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4379290001Sglebius    [Default location of crypto key info])
4380200576Sroberto
4381290001SglebiusAC_CONFIG_FILES([Makefile])
4382290001SglebiusAC_CONFIG_FILES([adjtimed/Makefile])
4383290001SglebiusAC_CONFIG_FILES([clockstuff/Makefile])
4384290001SglebiusAC_CONFIG_FILES([include/Makefile])
4385290001SglebiusAC_CONFIG_FILES([include/isc/Makefile])
4386290001SglebiusAC_CONFIG_FILES([kernel/Makefile])
4387290001SglebiusAC_CONFIG_FILES([kernel/sys/Makefile])
4388290001SglebiusAC_CONFIG_FILES([libntp/Makefile])
4389290001SglebiusAC_CONFIG_FILES([libparse/Makefile])
4390290001SglebiusAC_CONFIG_FILES([ntpd/Makefile])
4391290001SglebiusAC_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])
4392290001SglebiusAC_CONFIG_FILES([ntpdate/Makefile])
4393290001SglebiusAC_CONFIG_FILES([ntpdc/Makefile])
4394290001SglebiusAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4395290001SglebiusAC_CONFIG_FILES([ntpq/Makefile])
4396290001SglebiusAC_CONFIG_FILES([ntpsnmpd/Makefile])
4397290001SglebiusAC_CONFIG_FILES([parseutil/Makefile])
4398290001SglebiusAC_CONFIG_FILES([scripts/Makefile])
4399290001SglebiusAC_CONFIG_FILES([scripts/build/Makefile])
4400301301SdelphijAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4401290001SglebiusAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4402290001SglebiusAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4403290001SglebiusAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4404290001SglebiusAC_CONFIG_FILES([scripts/lib/Makefile])
4405290001SglebiusAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4406290001SglebiusAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4407290001SglebiusAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4408290001SglebiusAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4409290001SglebiusAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4410290001SglebiusAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4411290001SglebiusAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4412290001SglebiusAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4413290001SglebiusAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4414290001SglebiusAC_CONFIG_FILES([scripts/update-leap/Makefile])
4415290001SglebiusAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4416290001SglebiusAC_CONFIG_FILES([tests/Makefile])
4417290001SglebiusAC_CONFIG_FILES([tests/bug-2803/Makefile])
4418290001SglebiusAC_CONFIG_FILES([tests/libntp/Makefile])
4419290001SglebiusAC_CONFIG_FILES([tests/ntpd/Makefile])
4420290001SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4421290001SglebiusAC_CONFIG_FILES([tests/sandbox/Makefile])
4422290001SglebiusAC_CONFIG_FILES([tests/sec-2853/Makefile])
4423290001SglebiusAC_CONFIG_FILES([util/Makefile])
4424181834Sroberto
4425290001Sglebiusperllibdir="${datadir}/ntp/lib"
4426290001SglebiusAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4427181834Sroberto
4428290001Sglebiuscalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4429290001SglebiusAC_SUBST_FILE([calc_tickadj_opts])
4430290001Sglebiusntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4431290001SglebiusAC_SUBST_FILE([ntp_wait_opts])
4432290001Sglebiusntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4433290001SglebiusAC_SUBST_FILE([ntpsweep_opts])
4434290001Sglebiusntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4435290001SglebiusAC_SUBST_FILE([ntptrace_opts])
4436290001Sglebiussummary_opts="$srcdir/scripts/summary-opts"
4437290001SglebiusAC_SUBST_FILE([summary_opts])
4438290001Sglebiusplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4439290001SglebiusAC_SUBST_FILE([plot_summary_opts])
4440181834Sroberto
4441290001SglebiusAC_CONFIG_SUBDIRS([sntp])
4442181834Sroberto
4443181834SrobertoAC_OUTPUT
4444