1285612Sdelphijdnl NTP top-level configure.ac				-*- Autoconf -*-
2285612Sdelphijdnl
3285612Sdelphijm4_include([sntp/m4/version.m4])
4285612SdelphijAC_PREREQ([2.61])
5285612SdelphijAC_INIT(
6285612Sdelphij    [ntp],
7285612Sdelphij    [VERSION_NUMBER],
8285612Sdelphij    [http://bugs.ntp.org./],
9285612Sdelphij    [],
10285612Sdelphij    [http://www.ntp.org./]dnl
11285612Sdelphij)
12285612SdelphijAC_CONFIG_MACRO_DIR([sntp/m4])
13285612SdelphijAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14289997SglebiusAC_LANG([C])
15285612Sdelphij
16285612SdelphijAC_PRESERVE_HELP_ORDER
17285612Sdelphij
18285612Sdelphij# Bump ntp_configure_cache_version for each change to configure.ac or
19285612Sdelphij# .m4 files which invalidates cached values from previous configure 
20285612Sdelphij# runs.
21285612Sdelphij#
22285612Sdelphij# If the change affects cache variables used only by the main NTP
23285612Sdelphij# configure.ac, then only its version number should be bumped, while
24285612Sdelphij# the subdir configure.ac version numbers should be unchanged.  The
25285612Sdelphij# same is true for a test/variable that is used only by one subdir
26285612Sdelphij# being changed incompatibly; only that subdir's cache version needs
27285612Sdelphij# bumping.
28285612Sdelphij#
29285612Sdelphij# If a change affects variables shared by all NTP configure scripts,
30285612Sdelphij# please bump the version numbers of each.  If you are not sure, the
31285612Sdelphij# safe choice is to bump all on any cache-invalidating change.
32285612Sdelphij#
33285612Sdelphij# In order to avoid the risk of version stamp collision between -stable
34285612Sdelphij# and -dev branches, do not simply increment the version, instead use
35285612Sdelphij# the date YYYYMMDD optionally with -HHMM if there is more than one
36285612Sdelphij# bump in a day.
37285612Sdelphij
38285612Sdelphijntp_configure_cache_version=20120806
39285612Sdelphij
40285612Sdelphij# When the cache version of config.cache and configure do not
41285612Sdelphij# match, NTP_CACHEVERSION will flush the cache.
42285612Sdelphij
43285612SdelphijNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44285612Sdelphij
45285612SdelphijAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
46285612Sdelphij
47285612Sdelphijdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48285612Sdelphijm4_ifdef(
49285612Sdelphij    [AM_SILENT_RULES],
50285612Sdelphij    [AM_SILENT_RULES([yes])]
51285612Sdelphij)
52285612SdelphijAC_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.
56285612SdelphijAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57285612Sdelphij    [canonical system (cpu-vendor-os) of where we should run])
58285612SdelphijAC_CONFIG_HEADERS([config.h])
59181834Srobertodnl AC_ARG_PROGRAM
60181834Sroberto
61285612Sdelphijntp_atom_ok=${ntp_atom_ok=no}
62285612Sdelphijntp_oncore_ok=${ntp_oncore_ok=no}
63285612Sdelphijntp_parse_ok=${ntp_parse_ok=no}
64285612Sdelphijntp_ripe_ncc_ok=${ntp_parse_ok=no}
65285612Sdelphijntp_jupiter_ok=${ntp_jupiter_ok=no}
66181834Sroberto
67285612SdelphijNTP_PROG_CC
68316069SdelphijNTP_COMPILER
69316069Sdelphij
70316069Sdelphijdnl # Do we need CXX for anything besides google test?
71316069Sdelphijdnl AC_PROG_CXX
72285612SdelphijAC_PROG_YACC
73316069Sdelphijdnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
74285612SdelphijAX_C99_STRUCT_INIT
75181834Sroberto
76316069SdelphijNTP_HARDEN([sntp])
77316069Sdelphij
78285612SdelphijNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
79181834Sroberto
80285612SdelphijNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
81285612Sdelphij
82285612Sdelphijdnl AM_PROG_AR req. automake 1.12
83285612Sdelphijm4_ifdef(
84285612Sdelphij    [AM_PROG_AR],
85285612Sdelphij    [AM_PROG_AR]
86285612Sdelphij)
87285612Sdelphij
88200576Sroberto# So far, the only shared library we might use is libopts.
89200576Sroberto# It's a small library - we might as well use a static version of it.
90200576SrobertoAC_DISABLE_SHARED
91285612SdelphijAC_PROG_LIBTOOL
92285612SdelphijAC_SUBST([LIBTOOL_DEPS])
93200576Sroberto
94285612Sdelphij# NTP has (so far) been relying on leading-edge autogen, which
95285612Sdelphij# means we need the appropriate corresponding libopts as well.
96181834Sroberto# Therefore, by default:
97285612Sdelphij# - use the version of libopts we ship with
98181834Sroberto# - do not install it
99181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
100181834Srobertocase "${enable_local_libopts+set}" in
101181834Sroberto set) ;;
102181834Sroberto *) enable_local_libopts=yes ;;
103181834Srobertoesac
104181834Srobertocase "${enable_libopts_install+set}" in
105181834Sroberto set) ;;
106181834Sroberto *) enable_libopts_install=no ;;
107181834Srobertoesac
108285612Sdelphijenable_nls=no
109285612SdelphijLIBOPTS_CHECK_NOBUILD([sntp/libopts])
110181834Sroberto
111285612SdelphijNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
112181834Sroberto
113285612SdelphijNTP_LIBNTP
114181834Sroberto
115285612SdelphijAC_MSG_CHECKING([for deprecated --with-arlib])
116285612SdelphijAC_ARG_WITH([arlib],
117285612Sdelphij	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
118181834Sroberto	[ans=$withval], [ans=no])
119200576SrobertoAC_MSG_RESULT([$ans])
120181834Sroberto
121181834Srobertocase "$ans" in
122181834Sroberto yes)
123285612Sdelphij    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
124181834Sroberto    ;;
125181834Srobertoesac
126181834Sroberto
127181834Srobertodnl  we need to check for cross compile tools for vxWorks here
128181834SrobertoAC_PROG_AWK
129285612SdelphijAS_UNSET([ac_cv_prog_AWK])
130285612SdelphijAC_SUBST([AWK])				dnl scripts/ntpver.in
131181834SrobertoAC_PROG_MAKE_SET
132181834Sroberto
133285612SdelphijAC_SUBST([CFLAGS])
134285612SdelphijAC_SUBST([LDFLAGS])
135181834Sroberto
136285612SdelphijAC_PROG_LN_S
137285612SdelphijAC_ISC_POSIX
138181834Sroberto
139181834Sroberto
140285612SdelphijAC_PATH_PROG([PATH_PERL], [perl])
141285612Sdelphijdnl  Saving cached hardcoded paths rather than searching $PATH during a
142285612Sdelphijdnl  cached configure run is an optimization not worth the the cost of
143285612Sdelphijdnl  preventing newly-installed tools from being found.  Short-circuit
144285612Sdelphijdnl  the caching after the tests so preset overrides still work.
145285612SdelphijAS_UNSET([ac_cv_path_PATH_PERL])
146285612SdelphijAC_PATH_PROG([PATH_TEST], [test])
147285612SdelphijAS_UNSET([ac_cv_path_PATH_TEST])
148285612Sdelphijtest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
149285612SdelphijAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
150181834Sroberto
151285612SdelphijAC_ARG_WITH(
152285612Sdelphij    [net-snmp-config],
153285612Sdelphij    [AS_HELP_STRING(
154285612Sdelphij	[--with-net-snmp-config],
155285612Sdelphij	[+ =net-snmp-config]
156285612Sdelphij    )],
157285612Sdelphij    [ans=$withval],
158285612Sdelphij    [ans=yes]
159285612Sdelphij)
160285612Sdelphijcase "$ans" in
161285612Sdelphij no)
162181834Sroberto    ;;
163285612Sdelphij yes)
164285612Sdelphij    ans=net-snmp-config
165181834Sroberto    ;;
166285612Sdelphij /*)
167181834Sroberto    ;;
168285612Sdelphij */*)
169285612Sdelphij    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
170181834Sroberto    ;;
171285612Sdelphij *)
172285612Sdelphij    ;;
173181834Srobertoesac
174285612SdelphijPROG_NET_SNMP_CONFIG=$ans
175285612Sdelphijcase "$PROG_NET_SNMP_CONFIG" in
176285612Sdelphij no) ;;
177285612Sdelphij /*)
178285612Sdelphij    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
179285612Sdelphij    ;;
180285612Sdelphij *)
181285612Sdelphij    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
182285612Sdelphij    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
183285612Sdelphij;;
184285612Sdelphijesac
185316069SdelphijAC_MSG_CHECKING([for net-snmp-config path])
186285612SdelphijAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
187181834Sroberto
188285612Sdelphijcase "$PATH_NET_SNMP_CONFIG" in
189285612Sdelphij /*)	AC_CACHE_CHECK(
190285612Sdelphij	    [for net-snmp version],
191285612Sdelphij	    [ntp_cv_net_snmp_version],
192285612Sdelphij	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
193285612Sdelphij	)
194181834Sroberto	;;
195181834Srobertoesac
196181834Sroberto
197181834Srobertocase "$host" in
198181834Sroberto *-*-vxworks*)
199181834Sroberto    ac_link="$ac_link $VX_KERNEL"
200181834Sroberto    ;;
201181834Srobertoesac
202181834Sroberto
203285612Sdelphij# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
204285612SdelphijAC_SEARCH_LIBS([openlog], [gen syslog])
205285612Sdelphij# XXX library list will be in ac_cv_search_openlog
206181834Sroberto
207285612Sdelphij# LIBSECCOMP is off by default -- needs testing with all the features
208285612Sdelphij# Please send bug reports to loganaden@gmail.com
209285612SdelphijAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
210285612SdelphijAC_ARG_ENABLE(
211285612Sdelphij    [libseccomp],
212285612Sdelphij    [AS_HELP_STRING(
213285612Sdelphij	[--enable-libseccomp],
214285612Sdelphij	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
215285612Sdelphij    )],
216285612Sdelphij    [ntp_ok=$enableval],
217285612Sdelphij    [ntp_ok=no]
218285612Sdelphij)
219285612SdelphijAC_MSG_RESULT([$ntp_ok])
220285612Sdelphijcase "$ntp_ok" in
221285612Sdelphij yes)
222285612Sdelphij    AC_SEARCH_LIBS(
223285612Sdelphij	[seccomp_init],
224285612Sdelphij	[seccomp],
225285612Sdelphij	[AC_DEFINE([LIBSECCOMP], [1],
226285612Sdelphij	    [Define to any value to include libseccomp sandboxing.])]
227285612Sdelphij    )
228285612Sdelphij    AC_TRY_RUN([
229285612Sdelphij	#include <stdio.h>
230285612Sdelphij	#include <stdlib.h>
231285612Sdelphij	#include <errno.h>
232285612Sdelphij	#include <sys/prctl.h>
233285612Sdelphij	#include <linux/seccomp.h>
234285612Sdelphij
235285612Sdelphij	int main(void)
236285612Sdelphij	{
237285612Sdelphij		int ret;
238285612Sdelphij		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
239285612Sdelphij		if (ret < 0) {
240285612Sdelphij			switch (errno) {
241285612Sdelphij			case ENOSYS:
242285612Sdelphij				return 1;
243285612Sdelphij			case EINVAL:
244285612Sdelphij				return 1;
245285612Sdelphij			default:
246285612Sdelphij				return 1;
247285612Sdelphij			}
248285612Sdelphij		}
249285612Sdelphij		ret = 
250285612Sdelphij		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
251285612Sdelphij		if (ret < 0) {
252285612Sdelphij			switch (errno) {
253285612Sdelphij			case EINVAL:
254285612Sdelphij				return 1;
255285612Sdelphij			case EFAULT:
256285612Sdelphij				return 0;
257285612Sdelphij			default:
258285612Sdelphij				return 1;
259285612Sdelphij		}
260285612Sdelphij	}
261285612Sdelphijreturn 1;
262285612Sdelphij}
263285612Sdelphij]
264285612Sdelphij, AC_DEFINE([KERN_SECCOMP], 1, 
265285612Sdelphij[Define to use libseccomp system call filtering.])   
266285612Sdelphij, []
267285612Sdelphij)
268181834Sroberto    ;;
269181834Srobertoesac
270181834Sroberto
271285612SdelphijNTP_FACILITYNAMES
272200576Sroberto
273181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
274181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
275181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
276181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
277181834Srobertodnl real-time library, so we don't want to use it.
278285612Sdelphijdnl
279285612Sdelphijdnl 081118 Harlan got tired of looking for a way to get the sched*()
280285612Sdelphijdnl functions to link OK with either cc or gcc.
281181834Sroberto
282181834Srobertocase "$host" in
283200576Sroberto *-*-*linux*) ;;
284285612Sdelphij *-*-osf4*) ;;
285285612Sdelphij *-*-osf5*) ;;
286181834Sroberto *)
287285612Sdelphij    # HMS: Make sure we check for -lrt for clock_* before this...
288285612Sdelphij    case "$ac_cv_search_clock_gettime" in
289285612Sdelphij     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
290285612Sdelphij    esac
291285612Sdelphij    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
292181834Sroberto    ;;
293181834Srobertoesac
294181834Sroberto
295285612SdelphijAC_CHECK_HEADERS([bstring.h])
296285612SdelphijAC_CHECK_HEADER(
297285612Sdelphij    [dns_sd.h],
298285612Sdelphij    [AC_SEARCH_LIBS(
299285612Sdelphij	[DNSServiceRegister],
300285612Sdelphij	[dns_sd],
301285612Sdelphij	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
302285612Sdelphij	    [Use Rendezvous/DNS-SD registration])]
303285612Sdelphij    )]
304285612Sdelphij)
305285612SdelphijAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
306181834Sroberto
307285612SdelphijAC_CHECK_HEADERS([memory.h netdb.h poll.h])
308298699SdelphijAC_CHECK_HEADERS([sgtty.h stdatomic.h])
309298699SdelphijAC_HEADER_STDBOOL
310298699SdelphijAC_CHECK_HEADERS([stdlib.h string.h termio.h])
311285612SdelphijAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
312181834Sroberto
313181834Srobertocase "$host" in
314181834Sroberto *-*-aix*)
315285612Sdelphij    AC_CHECK_HEADERS([utmpx.h])
316181834Sroberto    case "$ac_cv_header_utmpx_h" in
317285612Sdelphij     yes)
318285612Sdelphij	;;
319285612Sdelphij     *)
320285612Sdelphij	AC_CHECK_HEADERS([utmp.h])
321285612Sdelphij	;;
322181834Sroberto    esac
323181834Sroberto    ;;
324285612Sdelphij *)
325285612Sdelphij    AC_CHECK_HEADERS([utmp.h utmpx.h])
326285612Sdelphij    ;;
327181834Srobertoesac
328285612Sdelphij
329285612Sdelphij#
330285612Sdelphij# On Suns only (so far) getpass() truncates the typed password to 8
331285612Sdelphij# characters, but getpassphrase() allows up to 257.  Most systems'
332285612Sdelphij# getpass() does not truncate, at least not so as to affect ntpq and
333285612Sdelphij# ntpdc password prompts.
334285612Sdelphij#
335285612Sdelphij# So check for getpassphrase(), but only on Sun operating systems.
336285612Sdelphij#
337285612Sdelphijcase "$host" in
338285612Sdelphij *-*-sunos*|*-*-solaris*)
339285612Sdelphij    AC_CHECK_FUNCS([getpassphrase])
340285612Sdelphijesac
341285612Sdelphij
342285612Sdelphij
343285612SdelphijAC_CHECK_HEADERS([net/if6.h])
344285612SdelphijAC_CHECK_HEADERS([net/route.h], [], [], [
345285612Sdelphij    #include <sys/types.h>
346285612Sdelphij    #include <sys/socket.h>
347285612Sdelphij    #include <net/if.h>
348181834Sroberto])
349200576Sroberto
350285612SdelphijAC_CHECK_HEADERS([netinfo/ni.h])
351285612Sdelphijcase "$ac_cv_header_netinfo_ni_h" in
352200576Sroberto yes)
353285612Sdelphij    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
354200576Srobertoesac
355285612SdelphijAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
356181834Srobertocase "$host" in
357285612Sdelphij *-*-sunos4*)
358181834Sroberto    ;;
359285612Sdelphij *)
360285612Sdelphij    AC_CHECK_HEADERS([sys/ioctl.h])
361285612Sdelphij    ;;
362181834Srobertoesac
363285612SdelphijAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
364181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
365285612SdelphijAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
366181834Srobertocase "$ac_cv_header_sched_h" in
367285612Sdelphij yes)
368181834Sroberto    ;;
369285612Sdelphij *)
370285612Sdelphij    AC_CHECK_HEADERS([sys/sched.h])
371285612Sdelphij    ;;
372181834Srobertoesac
373181834Sroberto# HMS: Check sys/shm.h after some others
374285612SdelphijAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
375181834Sroberto# HMS: Checked sys/socket.h earlier
376181834Srobertocase "$host" in
377285612Sdelphij *-*-netbsd*)
378181834Sroberto    ;;
379285612Sdelphij *)
380285612Sdelphij    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
381285612Sdelphij    ;;
382181834Srobertoesac
383285612SdelphijAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
384285612SdelphijAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
385181834Srobertocase "$host" in
386181834Sroberto*-convex-*)
387285612Sdelphij    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
388285612Sdelphij    ;;
389181834Sroberto*-*-bsdi*)
390285612Sdelphij    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
391285612Sdelphij    ;;
392181834Srobertoesac
393181834Sroberto
394285612Sdelphijcase "$ac_cv_header_stdatomic_h" in
395285612Sdelphij yes)
396285612Sdelphij	AC_CHECK_FUNCS([atomic_thread_fence])
397285612Sdelphij	AC_CACHE_CHECK(
398285612Sdelphij	    [for atomic_thread_fence()],
399285612Sdelphij	    [ntp_cv_func_atomic_thread_fence],
400285612Sdelphij	    [AC_COMPILE_IFELSE(
401285612Sdelphij		[AC_LANG_PROGRAM(
402285612Sdelphij		    [[
403285612Sdelphij			#include <stdatomic.h>
404285612Sdelphij		    ]],
405285612Sdelphij		    [[
406285612Sdelphij			atomic_thread_fence(memory_order_seq_cst);
407285612Sdelphij		    ]]
408285612Sdelphij		)]
409285612Sdelphij		[ntp_cv_func_atomic_thread_fence=yes],
410285612Sdelphij		[ntp_cv_func_atomic_thread_fence=no]
411285612Sdelphij	    )]
412285612Sdelphij	)
413285612Sdelphij    ;;
414285612Sdelphijesac
415285612Sdelphij
416181834Srobertocase "$host" in
417285612Sdelphij *-*-solaris2.6)
418285612Sdelphij    # Broken...
419181834Sroberto    ;;
420181834Sroberto *)
421285612Sdelphij    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
422181834Sroberto    ;;
423181834Srobertoesac
424181834Sroberto
425285612Sdelphijcase "$host" in
426285612Sdelphij *-*-*linux*)
427285612Sdelphij    case "$ac_cv_func_ntp_gettime" in
428285612Sdelphij     yes)
429285612Sdelphij	;;
430285612Sdelphij     *)
431285612Sdelphij	AC_CHECK_FUNCS([__ntp_gettime])
432285612Sdelphij	case "$ac_cv_func___ntp_gettime" in
433285612Sdelphij	 yes)
434285612Sdelphij	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
435285612Sdelphij		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
436285612Sdelphij	esac
437285612Sdelphij	;;
438285612Sdelphij    esac
439285612Sdelphij    AC_CHECK_FUNCS([adjtimex])
440285612Sdelphij    case "$ac_cv_func_adjtimex" in
441285612Sdelphij     yes)
442285612Sdelphij	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
443285612Sdelphij	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
444285612Sdelphij	have_adjtimex=1
445285612Sdelphij	;;
446285612Sdelphij     *)
447285612Sdelphij	AC_CHECK_FUNCS([__adjtimex])
448285612Sdelphij	case "$ac_cv_func___adjtimex" in
449285612Sdelphij	 yes)
450285612Sdelphij	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
451285612Sdelphij	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
452285612Sdelphij	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
453285612Sdelphij	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
454285612Sdelphij	    have_adjtimex=1
455285612Sdelphij	esac
456285612Sdelphij	;;
457285612Sdelphij    esac
458285612Sdelphijesac
459285612Sdelphijcase "$have_adjtimex" in
460285612Sdelphij '')
461285612Sdelphij    # nlist stuff is only needed for tickadj.
462285612Sdelphij    saved_LIBS="$LIBS"
463285612Sdelphij    LIBS=
464285612Sdelphij    AC_SEARCH_LIBS([nlist], [elf ld mld])
465285612Sdelphij    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
466285612Sdelphij    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
467285612Sdelphij    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
468285612Sdelphij    AC_CHECK_HEADERS([nlist.h sys/var.h])
469285612Sdelphij    case "$ac_cv_header_nlist_h" in
470285612Sdelphij     yes)
471285612Sdelphij	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
472285612Sdelphij	AC_CACHE_CHECK(
473285612Sdelphij	    [for n_un in struct nlist],
474285612Sdelphij	    [ntp_cv_struct_nlist_n_un],
475285612Sdelphij	    [AC_COMPILE_IFELSE(
476285612Sdelphij		[AC_LANG_PROGRAM(
477285612Sdelphij		    [[
478285612Sdelphij			#include <nlist.h>
479285612Sdelphij		    ]],
480285612Sdelphij		    [[
481285612Sdelphij			struct nlist n;
482285612Sdelphij			n.n_un.n_name = 0;
483285612Sdelphij		    ]]
484285612Sdelphij		)]
485285612Sdelphij		[ntp_cv_struct_nlist_n_un=yes],
486285612Sdelphij		[ntp_cv_struct_nlist_n_un=no]
487285612Sdelphij	    )]
488285612Sdelphij	)
489285612Sdelphij	case "$ntp_cv_struct_nlist_n_un" in
490285612Sdelphij	 yes)
491285612Sdelphij	    AC_DEFINE([NLIST_NAME_UNION], [1],
492285612Sdelphij		[does struct nlist use a name union?])
493285612Sdelphij	esac
494285612Sdelphij    esac
495285612Sdelphij    AC_SUBST([LDADD_NLIST])
496285612Sdelphij    LDADD_NLIST="$LIBS"
497285612Sdelphij    LIBS="$saved_LIBS"
498285612Sdelphij    AS_UNSET([saved_LIBS])
499285612Sdelphijesac
500181834Sroberto
501285612SdelphijAC_CHECK_HEADERS([sys/proc.h], [], [], [
502285612Sdelphij    #ifdef HAVE_SYS_TYPES_H
503285612Sdelphij    # include <sys/types.h>
504285612Sdelphij    #endif
505285612Sdelphij    #ifdef HAVE_SYS_TIME_H
506285612Sdelphij    # include <sys/time.h>
507285612Sdelphij    #endif
508181834Sroberto])
509181834Sroberto
510285612SdelphijAC_CHECK_HEADERS([sys/resource.h], [], [], [
511285612Sdelphij    #ifdef HAVE_SYS_TIME_H
512285612Sdelphij    # include <sys/time.h>
513285612Sdelphij    #endif
514181834Sroberto])
515181834Sroberto
516285612SdelphijAC_CHECK_HEADERS([sys/shm.h], [], [], [
517285612Sdelphij    #ifdef HAVE_SYS_TYPES_H
518285612Sdelphij    # include <sys/types.h>
519285612Sdelphij    #endif
520285612Sdelphij    #ifdef HAVE_SYS_IPC_H
521285612Sdelphij    # include <sys/ipc.h>
522285612Sdelphij    #endif
523181834Sroberto])
524181834Sroberto
525285612SdelphijAC_CHECK_HEADERS([sys/timex.h], [], [], [
526285612Sdelphij    #ifdef HAVE_SYS_TIME_H
527285612Sdelphij    # include <sys/time.h>
528285612Sdelphij    #endif
529181834Sroberto])
530181834Sroberto
531330141SdelphijNTP_AF_UNSPEC
532330141Sdelphij
533181834SrobertoAC_TYPE_SIGNAL
534181834SrobertoAC_TYPE_OFF_T
535285612SdelphijAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
536181834Sroberto
537285612SdelphijAC_CACHE_CHECK(
538285612Sdelphij    [for a fallback value for HZ],
539285612Sdelphij    [ntp_cv_default_hz],
540285612Sdelphij    [
541285612Sdelphij	ntp_cv_default_hz=100
542285612Sdelphij	case "$host" in
543285612Sdelphij	 alpha*-dec-osf4*|alpha*-dec-osf5*)
544285612Sdelphij	    ntp_cv_default_hz=1024
545285612Sdelphij	    ;;
546285612Sdelphij	 mips-dec-ultrix4*)
547285612Sdelphij	    ntp_cv_default_hz=256
548285612Sdelphij	    ;;
549285612Sdelphij	esac
550285612Sdelphij    ]
551285612Sdelphij)
552285612SdelphijAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
553285612Sdelphij    [What is the fallback value for HZ?])
554181834Sroberto
555285612SdelphijAC_CACHE_CHECK(
556285612Sdelphij    [if we need to override the system's value for HZ],
557285612Sdelphij    [ntp_cv_override_hz],
558285612Sdelphij    [
559285612Sdelphij	ntp_cv_override_hz=no
560285612Sdelphij	case "$host" in
561285612Sdelphij	 alpha*-dec-osf4*|alpha*-dec-osf5*)
562285612Sdelphij	    ntp_cv_override_hz=yes
563285612Sdelphij	    ;;
564285612Sdelphij	 mips-dec-ultrix4*)
565285612Sdelphij	    ntp_cv_override_hz=yes
566285612Sdelphij	    ;;
567285612Sdelphij	 *-*-freebsd*)
568285612Sdelphij	    ntp_cv_override_hz=yes
569285612Sdelphij	    ;;
570285612Sdelphij	 *-*-sunos4*)
571285612Sdelphij	    ntp_cv_override_hz=yes
572285612Sdelphij	    ;;
573285612Sdelphij	 *-*-kfreebsd*)
574285612Sdelphij	    ntp_cv_override_hz=yes
575285612Sdelphij	    ;;
576285612Sdelphij	esac
577285612Sdelphij    ]
578285612Sdelphij)
579285612Sdelphijcase "$ntp_cv_override_hz" in
580181834Sroberto yes)
581285612Sdelphij    AC_DEFINE([OVERRIDE_HZ], [1],
582285612Sdelphij	[Do we need to override the system's idea of HZ?])
583181834Srobertoesac
584181834Sroberto
585181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
586181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
587181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
588181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
589181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
590181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
591181834Srobertodnl fi
592181834Sroberto
593181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
594181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
595181834Srobertodnl [AC_EGREP_CPP(yes,
596181834Srobertodnl [#ifdef HAVE_UTMPX_H
597181834Srobertodnl #include <utmpx.h>
598181834Srobertodnl #else
599181834Srobertodnl #include <utmp.h>
600181834Srobertodnl #endif
601181834Srobertodnl #ifdef BOOT_TIME
602181834Srobertodnl yes
603181834Srobertodnl #endif
604181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
605181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
606181834Sroberto
607285612SdelphijAC_CACHE_CHECK(
608285612Sdelphij    [for struct rt_msghdr],
609285612Sdelphij    [ntp_cv_struct_rt_msghdr],
610285612Sdelphij    [AC_COMPILE_IFELSE(
611285612Sdelphij	[AC_LANG_PROGRAM(
612285612Sdelphij	    [[
613285612Sdelphij		#include <sys/types.h>
614285612Sdelphij		#include <sys/socket.h>
615285612Sdelphij		#include <net/if.h>
616285612Sdelphij		#include <net/route.h>
617285612Sdelphij	    ]],
618285612Sdelphij	    [[
619285612Sdelphij		struct rt_msghdr p;
620285612Sdelphij	    ]]
621285612Sdelphij	)],
622285612Sdelphij	[ntp_cv_struct_rt_msghdr=yes],
623285612Sdelphij	[ntp_cv_struct_rt_msghdr=no]
624285612Sdelphij    )]
625285612Sdelphij)
626200576Sroberto
627181834SrobertoAC_CACHE_CHECK(
628285612Sdelphij    [for struct rtattr],
629285612Sdelphij    [ntp_cv_rtattr],
630285612Sdelphij    [AC_COMPILE_IFELSE(
631285612Sdelphij	[AC_LANG_PROGRAM(
632285612Sdelphij	    [[
633285612Sdelphij		#include <stddef.h>
634285612Sdelphij		#include <sys/socket.h>
635285612Sdelphij		#include <linux/rtnetlink.h>
636285612Sdelphij	    ]],
637285612Sdelphij	    [[
638285612Sdelphij		struct rtattr p;
639285612Sdelphij	    ]]
640285612Sdelphij	)],
641285612Sdelphij	[ntp_cv_rtattr=yes],
642285612Sdelphij	[ntp_cv_rtattr=no]
643285612Sdelphij    )]
644181834Sroberto)
645181834Sroberto
646285612Sdelphijcase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
647285612Sdelphij *yes*)
648285612Sdelphij    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
649285612Sdelphij	[Do we have a routing socket (rt_msghdr or rtattr)?])
650285612Sdelphij    case "$ntp_cv_rtattr" in
651285612Sdelphij     yes)
652285612Sdelphij	AC_DEFINE([HAVE_RTNETLINK], [1],
653285612Sdelphij	    [Do we have Linux routing socket?])
654181834Sroberto    esac
655285612Sdelphijesac
656181834Sroberto
657285612SdelphijAC_CACHE_CHECK(
658285612Sdelphij    [struct sigaction for sa_sigaction],
659285612Sdelphij    [ntp_cv_struct_sigaction_has_sa_sigaction],
660285612Sdelphij    [AC_COMPILE_IFELSE(
661285612Sdelphij	[AC_LANG_PROGRAM(
662285612Sdelphij	    [[
663285612Sdelphij		#include <signal.h>
664285612Sdelphij	    ]],
665285612Sdelphij	    [[
666285612Sdelphij		struct sigaction act;
667285612Sdelphij		act.sa_sigaction = 0;
668285612Sdelphij	    ]]
669285612Sdelphij	)],
670285612Sdelphij	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
671285612Sdelphij	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
672285612Sdelphij    )]
673285612Sdelphij)
674285612Sdelphijcase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
675285612Sdelphij yes)
676285612Sdelphij    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
677285612Sdelphijesac
678181834Sroberto
679285612SdelphijAC_CACHE_CHECK(
680285612Sdelphij    [for struct ppsclockev],
681285612Sdelphij    [ntp_cv_struct_ppsclockev],
682285612Sdelphij    [AC_COMPILE_IFELSE(
683285612Sdelphij	[AC_LANG_PROGRAM(
684285612Sdelphij	    [[
685285612Sdelphij		#ifdef HAVE_SYS_TYPES_H
686285612Sdelphij		# include <sys/types.h>
687285612Sdelphij		#endif
688285612Sdelphij		#ifdef HAVE_SYS_TERMIOS_H
689285612Sdelphij		# include <sys/termios.h>
690285612Sdelphij		#endif
691285612Sdelphij		#ifdef HAVE_SYS_TIME_H
692285612Sdelphij		# include <sys/time.h>
693285612Sdelphij		#endif
694285612Sdelphij		#ifdef HAVE_SYS_PPSCLOCK_H
695285612Sdelphij		# include <sys/ppsclock.h>
696285612Sdelphij		#endif
697285612Sdelphij	    ]],
698285612Sdelphij	    [[
699285612Sdelphij		extern struct ppsclockev *pce;
700285612Sdelphij		return pce->serial;
701285612Sdelphij	    ]]
702285612Sdelphij	)],
703285612Sdelphij	[ntp_cv_struct_ppsclockev=yes],
704285612Sdelphij	[ntp_cv_struct_ppsclockev=no]
705285612Sdelphij    )]
706285612Sdelphij)
707285612Sdelphijcase "$ntp_cv_struct_ppsclockev" in
708285612Sdelphij yes)
709285612Sdelphij    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
710285612Sdelphij	[Does a system header define struct ppsclockev?])
711285612Sdelphijesac
712181834Sroberto
713181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
714181834Sroberto  *yes*)
715285612Sdelphij    AC_CACHE_CHECK(
716285612Sdelphij	[for struct snd_size],
717285612Sdelphij	[ntp_cv_struct_snd_size],
718285612Sdelphij	[AC_COMPILE_IFELSE(
719285612Sdelphij	    [AC_LANG_PROGRAM(
720285612Sdelphij		[[
721285612Sdelphij		    #ifdef HAVE_MACHINE_SOUNDCARD_H
722285612Sdelphij		    # include <machine/soundcard.h>
723285612Sdelphij		    #endif
724285612Sdelphij		    #ifdef HAVE_SYS_SOUNDCARD_H
725285612Sdelphij		    # include <sys/soundcard.h>
726285612Sdelphij		    #endif
727285612Sdelphij		]],
728285612Sdelphij		[[
729285612Sdelphij		    extern struct snd_size *ss;
730285612Sdelphij		    return ss->rec_size;
731285612Sdelphij		]]
732285612Sdelphij	    )],
733285612Sdelphij	    [ntp_cv_struct_snd_size=yes],
734285612Sdelphij	    [ntp_cv_struct_snd_size=no]
735285612Sdelphij        )]
736285612Sdelphij    )
737285612Sdelphij    case "$ntp_cv_struct_snd_size" in
738285612Sdelphij     yes)
739285612Sdelphij	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
740285612Sdelphij	    [Do we have struct snd_size?])
741181834Sroberto    esac
742181834Srobertoesac
743181834Sroberto
744285612SdelphijAC_CACHE_CHECK(
745285612Sdelphij    [struct clockinfo for hz],
746285612Sdelphij    [ntp_cv_struct_clockinfo_has_hz],
747285612Sdelphij    [AC_COMPILE_IFELSE(
748285612Sdelphij	[AC_LANG_PROGRAM(
749285612Sdelphij	    [[
750285612Sdelphij		#include <sys/time.h>
751285612Sdelphij	    ]],
752285612Sdelphij	    [[
753285612Sdelphij		extern struct clockinfo *pc;
754285612Sdelphij		return pc->hz;
755285612Sdelphij	    ]]
756285612Sdelphij	)],
757285612Sdelphij	[ntp_cv_struct_clockinfo_has_hz=yes],
758285612Sdelphij	[ntp_cv_struct_clockinfo_has_hz=no]
759285612Sdelphij    )]
760285612Sdelphij)
761285612Sdelphijcase "$ntp_cv_struct_clockinfo_has_hz" in
762285612Sdelphij yes)
763285612Sdelphij    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
764285612Sdelphijesac
765181834Sroberto
766285612SdelphijAC_CACHE_CHECK(
767285612Sdelphij    [struct clockinfo for tickadj],
768285612Sdelphij    [ntp_cv_struct_clockinfo_has_hz],
769285612Sdelphij    [AC_COMPILE_IFELSE(
770285612Sdelphij	[AC_LANG_PROGRAM(
771285612Sdelphij	    [[
772285612Sdelphij		#include <sys/time.h>
773285612Sdelphij	    ]],
774285612Sdelphij	    [[
775285612Sdelphij		extern struct clockinfo *pc;
776285612Sdelphij		return pc->tickadj;
777285612Sdelphij	    ]]
778285612Sdelphij	)],
779285612Sdelphij	[ntp_cv_struct_clockinfo_has_hz=yes],
780285612Sdelphij	[ntp_cv_struct_clockinfo_has_hz=no]
781285612Sdelphij    )]
782285612Sdelphij)
783285612Sdelphijcase "$ntp_cv_struct_clockinfo_has_hz" in
784285612Sdelphij yes)
785285612Sdelphij    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
786285612Sdelphijesac
787181834Sroberto
788285612Sdelphijcase "$ntp_cv_struct_ntptimeval" in
789285612Sdelphij yes)
790285612Sdelphij    AC_CHECK_MEMBERS(
791285612Sdelphij	[struct ntptimeval.time.tv_nsec],
792285612Sdelphij	[],
793285612Sdelphij	[],
794285612Sdelphij	[
795285612Sdelphij	    #ifdef HAVE_SYS_TIME_H
796285612Sdelphij	    # include <sys/time.h>
797285612Sdelphij	    #else
798285612Sdelphij	    # ifdef HAVE_TIME_H
799285612Sdelphij	    #  include <time.h>
800285612Sdelphij	    # endif
801285612Sdelphij	    #endif
802285612Sdelphij	    #ifdef HAVE_SYS_TIMEX_H
803285612Sdelphij	    # include <sys/timex.h>
804285612Sdelphij	    #else
805285612Sdelphij	    # ifdef HAVE_TIMEX_H
806285612Sdelphij	    #  include <timex.h>
807285612Sdelphij	    # endif
808285612Sdelphij	    #endif
809285612Sdelphij	]
810285612Sdelphij    )
811200576Srobertoesac
812200576Sroberto
813285612Sdelphij#### 
814181834Sroberto
815285612SdelphijAC_CHECK_FUNCS([arc4random_buf])
816181834Sroberto
817285612Sdelphij#### 
818181834Sroberto
819285612Sdelphijsaved_LIBS="$LIBS"
820285612SdelphijLIBS="$LIBS $LDADD_LIBNTP"
821285612SdelphijAC_CHECK_FUNCS([daemon])
822285612Sdelphij# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
823285612SdelphijLIBS="$saved_LIBS"
824285612SdelphijAS_UNSET([saved_LIBS])
825181834Sroberto
826285612SdelphijAC_CHECK_FUNCS(
827285612Sdelphij    [finite],
828285612Sdelphij    [],
829285612Sdelphij    [AC_CHECK_FUNCS(
830285612Sdelphij	[isfinite],
831285612Sdelphij	[],
832285612Sdelphij	[
833285612Sdelphij	    AC_MSG_CHECKING([for isfinite with <math.h>])
834285612Sdelphij	    _libs=$LIBS
835285612Sdelphij	    # XXX
836285612Sdelphij	    LIBS="$LIBS -lm"
837285612Sdelphij	    AC_LINK_IFELSE(
838285612Sdelphij		[AC_LANG_PROGRAM(
839285612Sdelphij		    [[
840285612Sdelphij			#include <math.h>
841285612Sdelphij		    ]],
842285612Sdelphij		    [[
843285612Sdelphij			float f = 0.0;
844285612Sdelphij			isfinite(f);
845285612Sdelphij		    ]]
846285612Sdelphij		)],
847285612Sdelphij		[ans=yes],
848285612Sdelphij		[ans=no]
849285612Sdelphij	    )
850285612Sdelphij	    LIBS=$_libs
851285612Sdelphij	    AC_MSG_RESULT([$ans])
852285612Sdelphij	    case "$ans" in
853285612Sdelphij	     yes)
854285612Sdelphij		AC_DEFINE([HAVE_ISFINITE], [1])
855285612Sdelphij	    esac
856285612Sdelphij	]
857285612Sdelphij    )]
858285612Sdelphij)
859181834Sroberto
860285612SdelphijAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
861181834Sroberto
862285612Sdelphij# kvm_open() is only used by tickadj.  Also see above.
863285612Sdelphijcase "$ac_cv_header_kvm_h" in
864285612Sdelphij yes)
865285612Sdelphij    AC_CHECK_FUNCS([kvm_open])
866181834Sroberto    ;;
867181834Srobertoesac
868181834Sroberto
869181834Srobertocase "$host" in
870181834Sroberto *-*-sco3.2v5.0.*)
871285612Sdelphij    # Just stubs.  Sigh.
872181834Sroberto    ;;
873285612Sdelphij *) AC_CHECK_FUNCS([mkstemp])
874181834Sroberto    ;;
875181834Srobertoesac
876285612SdelphijAC_CHECK_FUNCS([mktime])
877181834Srobertocase "$host" in
878285612Sdelphij *-*-aix[[4-9]]*)
879285612Sdelphij    # XXX only verified thru AIX6.
880285612Sdelphij    # Just a stub.  Sigh.
881181834Sroberto    ;;
882181834Sroberto *-*-irix[[45]]*)
883285612Sdelphij    # Just a stub in "old" Irix.  Sigh.
884181834Sroberto    ;;
885285612Sdelphij# In the belief that the fix for bug 1223 fixes mlockall() under linux...
886285612Sdelphij# *-*-*linux*)
887285612Sdelphij#    # there, but more trouble than it is worth for now (resolver problems)
888285612Sdelphij#    ;;
889181834Sroberto *-*-qnx*)
890285612Sdelphij    # Apparently there but not working in QNX.  Sigh?
891181834Sroberto    ;;
892181834Sroberto *-*-sco3.2v5.0.*)
893285612Sdelphij    # Just a stub.  Sigh.
894181834Sroberto    ;;
895181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
896181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
897181834Sroberto    # Not easy to test for - cheat.
898285612Sdelphij    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
899285612Sdelphij    AC_CHECK_FUNCS([mlockall])
900181834Sroberto    ;;
901285612Sdelphij *) AC_CHECK_FUNCS([mlockall])
902181834Sroberto    ;;
903181834Srobertoesac
904285612SdelphijAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
905181834Srobertocase "$host" in
906285612Sdelphij *-*-aix[[4-9]]*)
907285612Sdelphij    # XXX only verified thru AIX6.
908285612Sdelphij    # Just a stub in AIX 4.  Sigh.
909181834Sroberto    ;;
910181834Sroberto *-*-solaris2.5*)
911285612Sdelphij    # Just stubs in solaris2.5.  Sigh.
912181834Sroberto    ;;
913285612Sdelphij *) AC_CHECK_FUNCS([sched_setscheduler])
914181834Sroberto    ;;
915181834Srobertoesac
916285612SdelphijAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
917285612SdelphijAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
918181834Srobertocase "$host" in
919285612Sdelphij *-*-aix[[4-9]]*)
920285612Sdelphij    # XXX only verified thru AIX6.
921285612Sdelphij    # Just stubs.  Sigh.
922181834Sroberto    ;;
923181834Sroberto *-*-netbsd1*)
924285612Sdelphij    # Just stubs.  Sigh.
925181834Sroberto    ;;
926181834Sroberto *-*-netbsdelf1*)
927285612Sdelphij    # Just stubs.  Sigh.
928181834Sroberto    ;;
929181834Sroberto *-*-openbsd*)
930285612Sdelphij    # Just stubs.  Sigh.
931181834Sroberto    ;;
932285612Sdelphij *)
933285612Sdelphij    AC_CHECK_FUNCS([timer_create])
934181834Sroberto    ;;
935181834Srobertoesac
936181834Sroberto
937285612SdelphijNTP_RLIMIT_ITEMS
938181834Sroberto
939285612Sdelphij# some OSes prefer _exit() in forked children to exit()
940285612SdelphijAC_CHECK_FUNCS([_exit])
941285612Sdelphijntp_worker_child_exit=exit
942285612Sdelphijcase "$ac_cv_func__exit::$host_os" in
943285612Sdelphij yes::netbsd*)
944285612Sdelphij    ntp_worker_child_exit=_exit
945285612Sdelphij    ;;
946285612Sdelphij yes::openbsd*)
947285612Sdelphij    ntp_worker_child_exit=_exit
948285612Sdelphij    ;;
949285612Sdelphijesac
950285612SdelphijAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
951285612Sdelphij		   [routine worker child proc uses to exit.])
952181834Sroberto
953285612SdelphijAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
954181834Sroberto
955285612Sdelphij###
956181834Sroberto
957285612Sdelphij# http://bugs.ntp.org/737
958285612Sdelphijcase "$ac_cv_func_recvmsg" in
959285612Sdelphij yes)
960285612Sdelphij    AC_CACHE_CHECK(
961285612Sdelphij	[if we need extra help to define struct iovec],
962285612Sdelphij	[ntp_cv_struct_iovec_help],
963285612Sdelphij	[
964285612Sdelphij	    compiled=no
965285612Sdelphij	    for ntp_cv_struct_iovec_help in '0' '1'; do
966285612Sdelphij		AC_COMPILE_IFELSE(
967285612Sdelphij		    [AC_LANG_PROGRAM(
968285612Sdelphij			[[
969285612Sdelphij			    #ifdef HAVE_SYS_TYPES_H
970285612Sdelphij			    # include <sys/types.h>
971285612Sdelphij			    #endif
972285612Sdelphij			    #ifdef HAVE_SYS_SOCKET_H
973285612Sdelphij			    # include <sys/socket.h>
974285612Sdelphij			    #endif
975285612Sdelphij			    #if $ntp_cv_struct_iovec_help
976285612Sdelphij			    # include <sys/uio.h>
977285612Sdelphij			    #endif
978285612Sdelphij			]],
979285612Sdelphij			[[
980285612Sdelphij			    void foo(void) {
981285612Sdelphij				ssize_t x;
982285612Sdelphij				int s = 0;
983285612Sdelphij				struct iovec iov;
984285612Sdelphij				struct msghdr mh;
985285612Sdelphij				int flags = 0;
986181834Sroberto
987285612Sdelphij				mh.msg_iov = &iov;
988285612Sdelphij				x = recvmsg(s, &mh, flags);
989285612Sdelphij			    }
990285612Sdelphij			]]
991285612Sdelphij		    )],
992285612Sdelphij		    [compiled=yes ; break 1],
993285612Sdelphij		    []
994285612Sdelphij		)
995285612Sdelphij	    done
996285612Sdelphij	    case "$compiled" in
997285612Sdelphij	     no)
998285612Sdelphij		ntp_cv_struct_iovec_help=0
999285612Sdelphij	    esac
1000285612Sdelphij	    AS_UNSET([compiled])
1001285612Sdelphij	]
1002285612Sdelphij    )
1003285612Sdelphij    case "$ntp_cv_struct_iovec_help" in
1004285612Sdelphij     1)
1005285612Sdelphij	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1006285612Sdelphij	    [Use sys/uio.h for struct iovec help])
1007285612Sdelphij    esac
1008181834Srobertoesac
1009181834Sroberto
1010285612SdelphijAC_CACHE_CHECK(
1011285612Sdelphij    [number of arguments taken by setpgrp()],
1012285612Sdelphij    [ntp_cv_func_setpgrp_nargs],
1013285612Sdelphij    [AC_COMPILE_IFELSE(
1014285612Sdelphij	[AC_LANG_PROGRAM(
1015285612Sdelphij	    [[
1016285612Sdelphij		#ifdef HAVE_SYS_TYPES_H
1017285612Sdelphij		# include <sys/types.h>
1018285612Sdelphij		#endif
1019285612Sdelphij		#ifdef HAVE_UNISTD_H
1020285612Sdelphij		# include <unistd.h>
1021285612Sdelphij		#endif
1022285612Sdelphij	    ]],
1023285612Sdelphij	    [[
1024285612Sdelphij		setpgrp(0, 0);
1025285612Sdelphij	    ]]
1026285612Sdelphij	)],
1027285612Sdelphij	[ntp_cv_func_setpgrp_nargs=2],
1028285612Sdelphij	[ntp_cv_func_setpgrp_nargs=0]
1029285612Sdelphij    )]
1030285612Sdelphij)
1031285612Sdelphijcase "$ntp_cv_func_setpgrp_nargs" in
1032285612Sdelphij 0)
1033285612Sdelphij    AC_DEFINE([HAVE_SETPGRP_0], [1],
1034285612Sdelphij	      [define if setpgrp takes 0 arguments])
1035285612Sdelphijesac
1036181834Sroberto
1037285612SdelphijAC_CACHE_CHECK(
1038285612Sdelphij    [if we need to declare 'errno'],
1039285612Sdelphij    [ntp_cv_decl_errno],
1040285612Sdelphij    [AC_COMPILE_IFELSE(
1041285612Sdelphij	[AC_LANG_PROGRAM(
1042285612Sdelphij	    [[
1043285612Sdelphij		#ifdef HAVE_ERRNO_H
1044285612Sdelphij		# include <errno.h>
1045285612Sdelphij		#endif
1046285612Sdelphij	    ]],
1047285612Sdelphij	    [[
1048285612Sdelphij		errno = 0;
1049285612Sdelphij	    ]]
1050285612Sdelphij	)],
1051285612Sdelphij	[ntp_cv_decl_errno=no],
1052285612Sdelphij	[ntp_cv_decl_errno=yes]
1053285612Sdelphij    )]
1054285612Sdelphij)
1055285612Sdelphijcase "$ntp_cv_decl_errno" in
1056285612Sdelphij yes)
1057285612Sdelphij    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1058181834Srobertoesac
1059181834Sroberto
1060181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1061181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1062181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1063181834Srobertodnl without breaking any other platforms.
1064181834Srobertodnl
1065285612SdelphijAC_CACHE_CHECK(
1066285612Sdelphij    [if we may declare 'h_errno'],
1067285612Sdelphij    [ntp_cv_decl_h_errno],
1068285612Sdelphij    [AC_COMPILE_IFELSE(
1069285612Sdelphij	[AC_LANG_PROGRAM(
1070285612Sdelphij	    [[
1071285612Sdelphij		#include <sys/types.h>
1072285612Sdelphij		#ifdef HAVE_NETINET_IN_H
1073285612Sdelphij		# include <netinet/in.h>
1074285612Sdelphij		#endif
1075285612Sdelphij		#ifdef HAVE_ARPA_NAMESER_H
1076285612Sdelphij		# include <arpa/nameser.h>
1077285612Sdelphij		#endif
1078285612Sdelphij		#ifdef HAVE_NETDB_H
1079285612Sdelphij		# include <netdb.h>
1080285612Sdelphij		#endif
1081285612Sdelphij		#ifdef HAVE_RESOLV_H
1082285612Sdelphij		# include <resolv.h>
1083285612Sdelphij		#endif
1084285612Sdelphij	    ]],
1085285612Sdelphij	    [[
1086285612Sdelphij		extern int h_errno;
1087285612Sdelphij	    ]]
1088285612Sdelphij	)],
1089285612Sdelphij	[ntp_cv_decl_h_errno=yes],
1090285612Sdelphij	[ntp_cv_decl_h_errno=no]
1091285612Sdelphij    )]
1092285612Sdelphij)
1093285612Sdelphijcase "$ntp_cv_decl_h_errno" in
1094285612Sdelphij yes)
1095285612Sdelphij    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1096181834Srobertoesac
1097181834Sroberto
1098285612SdelphijAC_CACHE_CHECK(
1099285612Sdelphij    [if declaring 'syscall()' is ok],
1100285612Sdelphij    [ntp_cv_decl_syscall],
1101285612Sdelphij    [AC_COMPILE_IFELSE(
1102285612Sdelphij	[AC_LANG_PROGRAM(
1103285612Sdelphij	    [[
1104285612Sdelphij		#ifdef HAVE_SYS_TYPES_H
1105285612Sdelphij		# include <sys/types.h>
1106285612Sdelphij		#endif
1107285612Sdelphij		#ifdef HAVE_UNISTD_H
1108285612Sdelphij		# include <unistd.h>
1109285612Sdelphij		#endif
1110285612Sdelphij	    ]],
1111285612Sdelphij	    [[
1112285612Sdelphij		extern int syscall (int, ...);
1113285612Sdelphij	    ]]
1114285612Sdelphij	)]
1115285612Sdelphij	[ntp_cv_decl_syscall=yes],
1116285612Sdelphij	[ntp_cv_decl_syscall=no]
1117285612Sdelphij    )]
1118285612Sdelphij)
1119285612Sdelphijcase "$ntp_cv_decl_syscall" in
1120285612Sdelphij yes)
1121285612Sdelphij    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1122181834Srobertoesac
1123181834Sroberto
1124181834Srobertocase "$host" in
1125181834Sroberto *-*-aix4.3.*)
1126285612Sdelphij    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1127181834Sroberto    ;;
1128181834Sroberto *-*-mpeix*)
1129285612Sdelphij    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1130285612Sdelphij    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1131285612Sdelphij    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1132285612Sdelphij    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1133285612Sdelphij    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1134285612Sdelphij    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1135285612Sdelphij    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1136181834Sroberto    ;;
1137181834Sroberto *-*-osf[[45]]*)
1138285612Sdelphij    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1139285612Sdelphij    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1140181834Sroberto    ;;
1141181834Sroberto *-*-qnx*)
1142285612Sdelphij    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1143181834Sroberto    ;;
1144181834Sroberto *-*-riscos4*)
1145285612Sdelphij    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1146285612Sdelphij    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1147285612Sdelphij    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1148285612Sdelphij    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1149285612Sdelphij    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1150285612Sdelphij    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1151285612Sdelphij    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1152285612Sdelphij    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1153285612Sdelphij    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1154285612Sdelphij    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1155285612Sdelphij    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1156285612Sdelphij    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1157285612Sdelphij    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1158285612Sdelphij    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1159285612Sdelphij    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1160285612Sdelphij    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1161181834Sroberto    ;;
1162181834Sroberto *-*-solaris2*)
1163285612Sdelphij    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1164285612Sdelphij    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1165181834Sroberto    case "$host" in
1166181834Sroberto     *-*-solaris2.4)
1167285612Sdelphij        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1168181834Sroberto	;;
1169181834Sroberto    esac
1170181834Sroberto    ;;
1171181834Sroberto *-*-sunos4*)
1172285612Sdelphij    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1173285612Sdelphij    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1174285612Sdelphij    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1175285612Sdelphij    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1176285612Sdelphij    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1177285612Sdelphij    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1178285612Sdelphij    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1179285612Sdelphij    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1180285612Sdelphij    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1181285612Sdelphij    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1182285612Sdelphij    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1183285612Sdelphij    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1184285612Sdelphij    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1185181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1186181834Sroberto     acc*) ;;
1187285612Sdelphij     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1188181834Sroberto	;;
1189181834Sroberto    esac
1190285612Sdelphij    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1191285612Sdelphij    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1192285612Sdelphij    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1193285612Sdelphij    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1194285612Sdelphij    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1195285612Sdelphij    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1196285612Sdelphij    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1197181834Sroberto    ;;
1198181834Sroberto *-*-ultrix4*)
1199285612Sdelphij    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1200285612Sdelphij    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1201285612Sdelphij    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1202285612Sdelphij    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1203285612Sdelphij    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1204285612Sdelphij    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1205285612Sdelphij    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1206285612Sdelphij    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1207285612Sdelphij    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1208285612Sdelphij    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1209285612Sdelphij    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1210285612Sdelphij    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1211285612Sdelphij    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1212285612Sdelphij    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1213181834Sroberto    ;;
1214181834Srobertoesac
1215181834Sroberto
1216181834Srobertocase "$host" in
1217181834Sroberto *-*-sco3.2*)
1218285612Sdelphij    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1219285612Sdelphij	[Do we need to #define _SVID3 when we #include <termios.h>?])
1220181834Sroberto    ;;
1221181834Srobertoesac
1222181834Sroberto
1223181834Srobertocase "$host" in
1224181834Sroberto *-*-hpux[[567]]*)
1225285612Sdelphij    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1226285612Sdelphij	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1227181834Srobertoesac
1228181834Sroberto
1229285612Sdelphijdnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1230285612SdelphijAC_CACHE_CHECK(
1231285612Sdelphij    [if we will open the broadcast socket],
1232285612Sdelphij    [ntp_cv_var_open_bcast_socket],
1233285612Sdelphij    [
1234285612Sdelphij	ans=yes
1235285612Sdelphij	case "$host" in
1236285612Sdelphij	 *-*-domainos)
1237285612Sdelphij	    ans=no
1238285612Sdelphij	esac
1239285612Sdelphij	ntp_cv_var_open_bcast_socket=$ans
1240285612Sdelphij    ]
1241285612Sdelphij)
1242285612Sdelphijcase "$ntp_cv_var_open_bcast_socket" in
1243285612Sdelphij yes)
1244285612Sdelphij    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1245285612Sdelphij	[Should we open the broadcast socket?])
1246181834Srobertoesac
1247181834Sroberto
1248181834Srobertocase "$host" in
1249181834Sroberto *-*-hpux*)
1250285612Sdelphij    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1251285612Sdelphij	[Do we want the HPUX FindConfig()?])
1252181834Srobertoesac
1253181834Sroberto
1254285612Sdelphijdnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1255285612SdelphijAC_CACHE_CHECK(
1256285612Sdelphij    [if process groups are set with -pid],
1257285612Sdelphij    [ntp_cv_arg_setpgrp_negpid],
1258285612Sdelphij    [
1259285612Sdelphij	case "$host" in
1260285612Sdelphij	 *-*-hpux[[567]]*)
1261285612Sdelphij	    ans=no
1262285612Sdelphij	    ;;
1263285612Sdelphij	 *-*-hpux*)
1264285612Sdelphij	    ans=yes
1265285612Sdelphij	    ;;
1266285612Sdelphij	 *-*-*linux*)
1267285612Sdelphij	    ans=yes
1268285612Sdelphij	    ;;
1269285612Sdelphij	 *-*-sunos3*)
1270285612Sdelphij	    ans=yes
1271285612Sdelphij	    ;;
1272285612Sdelphij	 *-*-ultrix2*)
1273285612Sdelphij	    ans=yes
1274285612Sdelphij	    ;;
1275285612Sdelphij	 *)
1276285612Sdelphij	    ans=no
1277285612Sdelphij	    ;;
1278285612Sdelphij	esac
1279285612Sdelphij	ntp_cv_arg_setpgrp_negpid=$ans
1280285612Sdelphij    ]
1281285612Sdelphij)
1282285612Sdelphijcase "$ntp_cv_arg_setpgrp_negpid" in
1283181834Sroberto yes)
1284285612Sdelphij    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1285285612Sdelphij	[Do we set process groups with -pid?])
1286181834Srobertoesac
1287181834Sroberto
1288285612SdelphijAC_CACHE_CHECK(
1289285612Sdelphij    [if we need a ctty for F_SETOWN],
1290285612Sdelphij    [ntp_cv_func_ctty_for_f_setown],
1291285612Sdelphij    [
1292285612Sdelphij	case "$host" in
1293285612Sdelphij	 *-*-bsdi[[23]]*)
1294285612Sdelphij	    ans=yes
1295285612Sdelphij	    ;;
1296285612Sdelphij	 *-*-freebsd*)
1297285612Sdelphij	    ans=yes
1298285612Sdelphij	    ;;
1299285612Sdelphij	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1300285612Sdelphij	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1301285612Sdelphij	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1302285612Sdelphij	# in $host may be followed by "aout", "ecoff", or "elf".
1303285612Sdelphij	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1304285612Sdelphij	    ans=yes
1305285612Sdelphij	    ;;
1306285612Sdelphij	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1307285612Sdelphij	    ans=yes
1308285612Sdelphij	    ;;
1309285612Sdelphij	 *-*-openbsd*)
1310285612Sdelphij	    ans=yes
1311285612Sdelphij	    ;;
1312285612Sdelphij	 *-*-osf*)
1313285612Sdelphij	    ans=yes
1314285612Sdelphij	    ;;
1315285612Sdelphij	 *-*-darwin*)
1316285612Sdelphij	    ans=yes
1317285612Sdelphij	    ;;
1318285612Sdelphij	 *)
1319285612Sdelphij	    ans=no
1320285612Sdelphij	    ;;
1321285612Sdelphij	esac
1322285612Sdelphij	ntp_cv_func_ctty_for_f_setown=$ans
1323285612Sdelphij    ]
1324285612Sdelphij)
1325285612Sdelphijcase "$ntp_cv_func_ctty_for_f_setown" in
1326181834Sroberto yes)
1327285612Sdelphij    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1328181834Srobertoesac
1329181834Sroberto
1330285612SdelphijAC_CACHE_CHECK(
1331285612Sdelphij    [if the OS clears cached routes when more specifics become available],
1332285612Sdelphij    [ntp_cv_os_routeupdates],
1333285612Sdelphij    [
1334285612Sdelphij	case "$host" in
1335285612Sdelphij	 *-*-netbsd*)
1336285612Sdelphij	    ans=yes
1337285612Sdelphij	    ;;
1338285612Sdelphij	 *)
1339285612Sdelphij	    ans=no
1340285612Sdelphij	    ;;
1341285612Sdelphij	esac
1342285612Sdelphij	ntp_cv_os_routeupdates=$ans
1343285612Sdelphij    ]
1344285612Sdelphij)
1345285612Sdelphijcase "$ntp_cv_os_routeupdates" in
1346181834Sroberto yes)
1347285612Sdelphij    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1348285612Sdelphij	[need to recreate sockets on changed routing?])
1349181834Srobertoesac
1350181834Sroberto
1351285612SdelphijAC_CACHE_CHECK(
1352285612Sdelphij    [if the wildcard socket needs REUSEADDR to bind other addresses],
1353285612Sdelphij    [ntp_cv_os_wildcardreuse],
1354285612Sdelphij    [
1355285612Sdelphij	case "$host" in
1356285612Sdelphij	 *-*-*linux*)
1357285612Sdelphij	    ans=yes
1358285612Sdelphij	    ;;
1359285612Sdelphij	 *) ans=no
1360285612Sdelphij	    ;;
1361285612Sdelphij	esac
1362285612Sdelphij	ntp_cv_os_wildcardreuse=$ans
1363285612Sdelphij    ]
1364285612Sdelphij)
1365285612Sdelphijcase "$ntp_cv_os_wildcardreuse" in
1366181834Sroberto yes)
1367285612Sdelphij    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1368285612Sdelphij	[wildcard socket needs REUSEADDR to bind interface addresses])
1369181834Srobertoesac
1370181834Sroberto
1371181834Srobertocase "$host" in
1372181834Sroberto *-*-aix*)
1373285612Sdelphij    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1374285612Sdelphij	[Might nlist() values require an extra level of indirection (AIX)?])
1375181834Srobertoesac
1376181834Sroberto
1377285612SdelphijAC_CACHE_CHECK(
1378285612Sdelphij    [for a minimum recommended value of tickadj],
1379285612Sdelphij    [ntp_cv_var_min_rec_tickadj],
1380285612Sdelphij    [
1381285612Sdelphij	ans=no
1382285612Sdelphij	case "$host" in
1383285612Sdelphij	 *-*-aix*)
1384285612Sdelphij	    ans=40
1385285612Sdelphij	    ;;
1386285612Sdelphij	esac
1387285612Sdelphij	ntp_cv_var_min_rec_tickadj=$ans
1388285612Sdelphij    ]
1389285612Sdelphij)
1390285612Sdelphijcase "$ntp_cv_var_min_rec_tickadj" in
1391285612Sdelphij ''|no)
1392181834Sroberto    ;;
1393285612Sdelphij *)
1394285612Sdelphij    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1395285612Sdelphij	[Should we recommend a minimum value for tickadj?])
1396181834Srobertoesac
1397285612Sdelphij
1398285612SdelphijAC_CACHE_CHECK(
1399285612Sdelphij    [if the TTY code permits PARENB and IGNPAR],
1400285612Sdelphij    [ntp_cv_no_parenb_ignpar],
1401285612Sdelphij    [
1402285612Sdelphij	ans=no
1403285612Sdelphij	case "$host" in
1404285612Sdelphij	 i?86-*-*linux*)
1405285612Sdelphij	    ans=yes
1406285612Sdelphij	    ;;
1407285612Sdelphij	 mips-sgi-irix*)
1408285612Sdelphij	    ans=yes
1409285612Sdelphij	    ;;
1410285612Sdelphij	 i?86-*-freebsd[[123]].*)
1411285612Sdelphij	    ;;
1412285612Sdelphij	 i?86-*-freebsd*)
1413285612Sdelphij	    ans=yes
1414285612Sdelphij	    ;;
1415285612Sdelphij	 *-*-unicosmp*)
1416285612Sdelphij	    ans=yes
1417285612Sdelphij	    ;;
1418285612Sdelphij	esac
1419285612Sdelphij	ntp_cv_no_parenb_ignpar=$ans
1420285612Sdelphij    ]
1421285612Sdelphij)
1422285612Sdelphijcase "$ntp_cv_no_parenb_ignpar" in
1423285612Sdelphij yes)
1424285612Sdelphij    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1425285612Sdelphij	[Is there a problem using PARENB and IGNPAR?])
1426181834Srobertoesac
1427181834Sroberto
1428285612SdelphijAC_MSG_CHECKING([if we're including processing time debugging code])
1429285612SdelphijAC_ARG_ENABLE(
1430285612Sdelphij    [debug-timing],
1431285612Sdelphij    [AS_HELP_STRING(
1432285612Sdelphij	[--enable-debug-timing],
1433285612Sdelphij	[- include processing time debugging code (costs performance)]
1434285612Sdelphij    )],
1435285612Sdelphij    [ntp_ok=$enableval],
1436285612Sdelphij    [ntp_ok=no]
1437285612Sdelphij)
1438285612Sdelphijcase "$ntp_ok" in
1439285612Sdelphij yes)
1440285612Sdelphij    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1441181834Srobertoesac
1442285612SdelphijAC_MSG_RESULT([$ntp_ok])
1443181834Sroberto
1444285612SdelphijAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1445200576SrobertoAC_ARG_ENABLE(
1446285612Sdelphij    [dst-minutes],
1447285612Sdelphij    [AS_HELP_STRING(
1448200576Sroberto	[--enable-dst-minutes],
1449285612Sdelphij	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1450285612Sdelphij    ],
1451200576Sroberto    [ans=$enableval],
1452200576Sroberto    [ans=60]
1453200576Sroberto)
1454285612SdelphijAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1455285612Sdelphij    [The number of minutes in a DST adjustment])
1456200576SrobertoAC_MSG_RESULT([$ans])
1457181834Sroberto
1458285612SdelphijAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1459200576SrobertoAC_ARG_ENABLE(
1460200576Sroberto    [ignore-dns-errors],
1461285612Sdelphij    [AS_HELP_STRING(
1462285612Sdelphij	[--enable-ignore-dns-errors],
1463200576Sroberto	[- retry DNS queries on any error]
1464285612Sdelphij    )],
1465200576Sroberto    [ans=$enableval],
1466200576Sroberto    [ans=no]
1467200576Sroberto)
1468200576Srobertocase "$ans" in
1469200576Sroberto yes)
1470285612Sdelphij    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1471285612Sdelphij	[Retry queries on _any_ DNS error?])
1472200576Srobertoesac
1473200576SrobertoAC_MSG_RESULT([$ans])
1474200576Sroberto
1475285612SdelphijAC_CACHE_CHECK(
1476285612Sdelphij    [availability of ntp_{adj,get}time()],
1477285612Sdelphij    [ntp_cv_var_ntp_syscalls],
1478285612Sdelphij    [
1479285612Sdelphij	ntp_cv_var_ntp_syscalls=no
1480285612Sdelphij	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1481285612Sdelphij	 yesyes*)
1482285612Sdelphij	    ntp_cv_var_ntp_syscalls=libc
1483181834Sroberto	    ;;
1484285612Sdelphij	 *yes)
1485285612Sdelphij	    ntp_cv_var_ntp_syscalls=inline
1486181834Sroberto	    ;;
1487285612Sdelphij	 *)
1488285612Sdelphij	    AC_PREPROC_IFELSE(
1489285612Sdelphij		[AC_LANG_SOURCE(
1490285612Sdelphij		    [
1491285612Sdelphij			#include <sys/syscall.h>
1492285612Sdelphij			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1493285612Sdelphij			# error
1494285612Sdelphij			#endif
1495285612Sdelphij		    ])],
1496285612Sdelphij		[ntp_cv_var_ntp_syscalls=kernel]
1497285612Sdelphij	    )
1498181834Sroberto	    ;;
1499285612Sdelphij	 esac
1500285612Sdelphij    ]
1501285612Sdelphij)
1502285612Sdelphijcase "$ntp_cv_var_ntp_syscalls" in
1503181834Sroberto libc)
1504285612Sdelphij    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1505285612Sdelphij	[Do we have ntp_{adj,get}time in libc?])
1506181834Sroberto    ;;
1507181834Sroberto kernel)
1508285612Sdelphij    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1509285612Sdelphij	[Do we have ntp_{adj,get}time in the kernel?])
1510181834Sroberto    ;;
1511181834Srobertoesac
1512181834Sroberto
1513285612SdelphijAC_CACHE_CHECK(
1514285612Sdelphij    [if sys/timex.h has STA_FLL],
1515285612Sdelphij    [ntp_cv_var_sta_fll],
1516285612Sdelphij    [AC_PREPROC_IFELSE(
1517285612Sdelphij	[AC_LANG_SOURCE(
1518285612Sdelphij	    [
1519285612Sdelphij		#include <sys/timex.h>
1520285612Sdelphij		#ifndef STA_FLL
1521285612Sdelphij		# error
1522285612Sdelphij		#endif
1523285612Sdelphij	    ])],
1524285612Sdelphij	[ntp_cv_var_sta_fll=yes],
1525285612Sdelphij	[ntp_cv_var_sta_fll=no]
1526285612Sdelphij    )]
1527285612Sdelphij)
1528181834Sroberto
1529285612SdelphijAC_CACHE_CHECK(
1530285612Sdelphij    [if we have kernel PLL support],
1531285612Sdelphij    [ntp_cv_var_kernel_pll],
1532285612Sdelphij    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1533285612Sdelphij	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1534285612Sdelphij	 *no*)
1535285612Sdelphij	    ntp_cv_var_kernel_pll=no
1536285612Sdelphij	    ;;
1537285612Sdelphij	 *) ntp_cv_var_kernel_pll=yes
1538285612Sdelphij	    ;;
1539285612Sdelphij	esac
1540285612Sdelphij    ]
1541285612Sdelphij)
1542285612Sdelphijcase "$ntp_cv_var_kernel_pll" in
1543181834Sroberto yes)
1544285612Sdelphij    AC_DEFINE([KERNEL_PLL], [1],
1545285612Sdelphij	[Does the kernel support precision time discipline?])
1546181834Srobertoesac
1547181834Sroberto
1548285612SdelphijAC_CACHE_CHECK(
1549285612Sdelphij    [if SIOCGIFCONF returns buffer size in the buffer],
1550285612Sdelphij    [ntp_cv_size_returned_in_buffer],
1551285612Sdelphij    [
1552285612Sdelphij	ans=no
1553285612Sdelphij	case "$host" in
1554285612Sdelphij	 *-fujitsu-uxp*)
1555285612Sdelphij	    ans=yes
1556285612Sdelphij	    ;;
1557285612Sdelphij	 *-ncr-sysv4*)
1558285612Sdelphij	    ans=yes
1559285612Sdelphij	    ;;
1560285612Sdelphij	 *-univel-sysv*)
1561285612Sdelphij	    ans=yes
1562285612Sdelphij	    ;;
1563285612Sdelphij	esac
1564285612Sdelphij	ntp_cv_size_returned_in_buffer=$ans
1565285612Sdelphij    ]
1566285612Sdelphij)
1567285612Sdelphijcase "$ntp_cv_size_returned_in_buffer" in
1568285612Sdelphij yes)
1569285612Sdelphij    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1570285612Sdelphij	[Does SIOCGIFCONF return size in the buffer?])
1571181834Srobertoesac
1572181834Sroberto
1573181834Sroberto# Check for ioctls TIOCGPPSEV
1574285612SdelphijAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1575285612Sdelphijcase "$ac_cv_header_termios_h" in
1576285612Sdelphij yes)
1577285612Sdelphij    AC_PREPROC_IFELSE(
1578285612Sdelphij	[AC_LANG_SOURCE([
1579285612Sdelphij	    #include <termios.h>
1580285612Sdelphij	    #ifndef TIOCGPPSEV
1581285612Sdelphij	    # error
1582285612Sdelphij	    #endif
1583285612Sdelphij	])],
1584285612Sdelphij	[ntp_ok=yes],
1585285612Sdelphij	[ntp_ok=no]
1586285612Sdelphij    )
1587285612Sdelphij    ;;
1588285612Sdelphij *)
1589285612Sdelphij    ntp_ok=no
1590285612Sdelphij    ;;
1591285612Sdelphijesac
1592285612Sdelphijcase "$ntp_ok" in
1593285612Sdelphij yes)
1594285612Sdelphij    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1595285612Sdelphij	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1596285612Sdelphijesac
1597285612SdelphijAC_MSG_RESULT([$ntp_ok])
1598181834Sroberto
1599181834Sroberto# Check for ioctls TIOCSPPS
1600285612SdelphijAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1601285612Sdelphijcase "$ac_cv_header_termios_h" in
1602285612Sdelphij yes)
1603285612Sdelphij    AC_PREPROC_IFELSE(
1604285612Sdelphij	[AC_LANG_SOURCE([
1605285612Sdelphij	    #include <termios.h>
1606285612Sdelphij	    #ifndef TIOCSPPS
1607285612Sdelphij	    # error
1608285612Sdelphij	    #endif
1609285612Sdelphij	 ])],
1610285612Sdelphij	 [ntp_ok=yes],
1611285612Sdelphij	 [ntp_ok=no]
1612285612Sdelphij    )
1613285612Sdelphij    ;;
1614285612Sdelphij *)
1615181834Sroberto    ntp_ok=no
1616285612Sdelphij    ;;
1617285612Sdelphijesac
1618285612Sdelphijcase "$ntp_ok" in
1619285612Sdelphij yes)
1620285612Sdelphij    AC_DEFINE([HAVE_TIOCSPPS], [1],
1621285612Sdelphij	[Do we have the TIOCSPPS ioctl (Solaris)?])
1622285612Sdelphijesac
1623285612SdelphijAC_MSG_RESULT([$ntp_ok])
1624181834Sroberto
1625181834Sroberto# Check for ioctls CIOGETEV
1626285612SdelphijAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1627285612Sdelphijcase "$ac_cv_header_sys_ppsclock_h" in
1628285612Sdelphij yes)
1629285612Sdelphij    AC_PREPROC_IFELSE(
1630285612Sdelphij	[AC_LANG_SOURCE([
1631285612Sdelphij	    #include <sys/ppsclock.h>
1632285612Sdelphij	    #ifndef CIOGETEV
1633285612Sdelphij	    # error
1634285612Sdelphij	    #endif
1635285612Sdelphij	])],
1636285612Sdelphij	[ntp_ok=yes],
1637285612Sdelphij	[ntp_ok=no]
1638285612Sdelphij    )
1639285612Sdelphij    ;;
1640285612Sdelphij *)
1641285612Sdelphij    ntp_ok=no
1642285612Sdelphij    ;;
1643285612Sdelphijesac
1644285612Sdelphijcase "$ntp_ok" in
1645285612Sdelphij yes)
1646285612Sdelphij    AC_DEFINE([HAVE_CIOGETEV], [1],
1647285612Sdelphij	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1648285612Sdelphijesac
1649285612SdelphijAC_MSG_RESULT([$ntp_ok])
1650181834Sroberto
1651181834Sroberto# ATOM/PPSAPI stuff.
1652181834Sroberto
1653285612Sdelphijntp_atom_ok=yes
1654181834Sroberto
1655181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1656181834Sroberto
1657181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1658181834Sroberto# The PPSAPI needs struct timespec.
1659181834Sroberto# The PPSAPI also needs a timepps header.
1660181834Sroberto
1661285612Sdelphijcase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1662181834Sroberto inlineyes)
1663181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1664181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1665181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1666285612Sdelphij	ntp_jupiter_ok=yes
1667285612Sdelphij	ntp_oncore_ok=yes
1668285612Sdelphij	ntp_parse_ok=yes
1669285612Sdelphij	ntp_ripe_ncc_ok=yes
1670181834Sroberto	;;
1671181834Sroberto    esac
1672181834Sroberto    ;;
1673181834Srobertoesac
1674181834Sroberto
1675181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1676285612SdelphijAC_CHECK_HEADER([linux/serial.h])
1677181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1678181834Sroberto  yesyes)
1679285612Sdelphij    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1680285612Sdelphij    AC_PREPROC_IFELSE(
1681285612Sdelphij	[AC_LANG_SOURCE([
1682285612Sdelphij	    #include <sys/time.h>
1683285612Sdelphij	    typedef int u_int;
1684285612Sdelphij	    #include <sys/ppsclock.h>
1685285612Sdelphij	    #include <linux/serial.h>
1686181834Sroberto
1687285612Sdelphij	    #ifndef TIOCGSERIAL
1688285612Sdelphij	    # error
1689285612Sdelphij	    #endif
1690285612Sdelphij	    #ifndef TIOCSSERIAL
1691285612Sdelphij	    # error
1692285612Sdelphij	    #endif
1693285612Sdelphij	    #ifndef ASYNC_PPS_CD_POS
1694285612Sdelphij	    # error
1695285612Sdelphij	    #endif
1696285612Sdelphij	    #ifndef ASYNC_PPS_CD_NEG
1697285612Sdelphij	    # error
1698285612Sdelphij	    #endif
1699285612Sdelphij	    #ifndef CIOGETEV
1700285612Sdelphij	    # error
1701285612Sdelphij	    #endif
1702285612Sdelphij	])],
1703285612Sdelphij	[ntp_ok=yes],
1704285612Sdelphij	[ntp_ok=no]
1705285612Sdelphij    )
1706285612Sdelphij    AC_MSG_RESULT([$ntp_ok])
1707285612Sdelphij    ;;
1708181834Sroberto  *)
1709285612Sdelphij    ntp_ok=no
1710285612Sdelphij    ;;
1711181834Srobertoesac
1712285612Sdelphijcase "$ntp_ok" in
1713285612Sdelphij yes)
1714285612Sdelphij    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1715285612Sdelphij	[Do we have the TIO serial stuff?])
1716285612Sdelphijesac
1717181834Sroberto
1718181834Sroberto# Check for SHMEM_STATUS support
1719200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
1720181834Srobertocase "$ac_cv_header_sys_mman_h" in
1721285612Sdelphij yes)
1722285612Sdelphij    ntp_ok=yes
1723285612Sdelphij    ;;
1724285612Sdelphij *)
1725285612Sdelphij    ntp_ok=no
1726285612Sdelphij    ;;
1727181834Srobertoesac
1728285612Sdelphijcase "$ntp_ok" in
1729285612Sdelphij yes)
1730285612Sdelphij    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1731285612Sdelphij	[Do we have support for SHMEM_STATUS?])
1732285612Sdelphijesac
1733285612SdelphijAC_MSG_RESULT([$ntp_ok])
1734181834Sroberto
1735181834Srobertontp_refclock=no
1736181834Sroberto
1737181834Sroberto# HPUX only, and by explicit request
1738200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1739285612SdelphijAC_ARG_ENABLE(
1740285612Sdelphij    [BANCOMM],
1741285612Sdelphij    [AS_HELP_STRING(
1742285612Sdelphij	[--enable-BANCOMM],
1743285612Sdelphij	[- Datum/Bancomm bc635/VME interface]
1744285612Sdelphij    )],
1745285612Sdelphij    [ntp_ok=$enableval],
1746285612Sdelphij    [ntp_ok=no]
1747285612Sdelphij)
1748285612Sdelphijcase "$ntp_ok" in
1749285612Sdelphij yes)
1750181834Sroberto    ntp_refclock=yes
1751285612Sdelphij    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1752285612Sdelphij    ;;
1753285612Sdelphijesac
1754285612SdelphijAC_MSG_RESULT([$ntp_ok])
1755181834Srobertocase "$ntp_ok$host" in
1756181834Sroberto yes*-*-hpux*) ;;
1757200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1758181834Srobertoesac
1759181834Sroberto
1760181834Sroberto#HPUX only, and only by explicit request
1761200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1762285612SdelphijAC_ARG_ENABLE(
1763285612Sdelphij    [GPSVME],
1764285612Sdelphij    [AS_HELP_STRING(
1765285612Sdelphij	[--enable-GPSVME],
1766285612Sdelphij	[- TrueTime GPS receiver/VME interface]
1767285612Sdelphij    )],
1768285612Sdelphij    [ntp_ok=$enableval],
1769285612Sdelphij    [ntp_ok=no]
1770285612Sdelphij)
1771285612Sdelphijcase "$ntp_ok" in
1772285612Sdelphij yes)
1773181834Sroberto    ntp_refclock=yes
1774285612Sdelphij    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1775285612Sdelphij    ;;
1776285612Sdelphijesac
1777285612SdelphijAC_MSG_RESULT([$ntp_ok])
1778181834Srobertocase "$ntp_ok$host" in
1779181834Sroberto yes*-*-hpux*) ;;
1780200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1781181834Srobertoesac
1782181834Sroberto
1783200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
1784181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1785181834Sroberto yesyesyes)
1786285612Sdelphij    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1787181834Sroberto    ans=yes
1788181834Sroberto    ;;
1789181834Sroberto *)
1790181834Sroberto    ans=no
1791181834Sroberto    ;;
1792181834Srobertoesac
1793200576SrobertoAC_MSG_RESULT([$ans])
1794181834Sroberto
1795200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1796285612SdelphijAC_ARG_ENABLE(
1797285612Sdelphij    [all-clocks],
1798285612Sdelphij    [AS_HELP_STRING(
1799285612Sdelphij	[--enable-all-clocks],
1800285612Sdelphij	[+ include all suitable non-PARSE clocks:]
1801285612Sdelphij    )],
1802285612Sdelphij    [ntp_eac=$enableval],
1803285612Sdelphij    [ntp_eac=yes]
1804285612Sdelphij)
1805285612SdelphijAC_MSG_RESULT([$ntp_eac])
1806181834Sroberto
1807285612Sdelphij# HMS: Should we also require ntp_parse_ok?
1808200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
1809285612Sdelphijcase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1810181834Sroberto yes*yes*)
1811181834Sroberto    ntp_canparse=yes
1812181834Sroberto    ;;
1813181834Sroberto *) ntp_canparse=no
1814181834Sroberto    ;;
1815181834Srobertoesac
1816285612SdelphijAC_MSG_RESULT([$ntp_canparse])
1817181834Sroberto
1818181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
1819181834Srobertocase "$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
1820181834Sroberto *yes*)
1821181834Sroberto    ntp_canaudio=yes
1822285612Sdelphij    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1823181834Sroberto    ;;
1824181834Sroberto *) ntp_canaudio=no ;;
1825181834Srobertoesac
1826285612SdelphijAC_MSG_RESULT([$ntp_canaudio])
1827181834Sroberto
1828181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1829181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1830181834Sroberto yesyes)
1831181834Sroberto    ntp_canshm=yes
1832181834Sroberto    ;;
1833181834Sroberto *) ntp_canshm=no ;;
1834181834Srobertoesac
1835285612SdelphijAC_MSG_RESULT([$ntp_canshm])
1836181834Sroberto
1837285612Sdelphij# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1838285612SdelphijAC_CACHE_CHECK(
1839285612Sdelphij    [for termios modem control],
1840285612Sdelphij    [ntp_cv_modem_control],
1841285612Sdelphij    [AC_COMPILE_IFELSE(
1842285612Sdelphij	[AC_LANG_PROGRAM(
1843285612Sdelphij	    [[
1844285612Sdelphij		#ifdef HAVE_UNISTD_H
1845285612Sdelphij		# include <unistd.h>
1846285612Sdelphij		#endif
1847285612Sdelphij		#ifdef HAVE_TERMIOS_H
1848285612Sdelphij		# include <termios.h>
1849285612Sdelphij		#endif
1850285612Sdelphij		#ifdef HAVE_SYS_IOCTL_H
1851285612Sdelphij		# include <sys/ioctl.h>
1852285612Sdelphij		#endif
1853285612Sdelphij	    ]],
1854285612Sdelphij	    [[
1855285612Sdelphij		int	dtr = TIOCM_DTR;
1856285612Sdelphij
1857285612Sdelphij		ioctl(1, TIOCMBIS, (char *)&dtr);
1858285612Sdelphij	    ]]
1859285612Sdelphij	)],
1860285612Sdelphij	[ntp_cv_modem_control=yes],
1861285612Sdelphij	[ntp_cv_modem_control=no]
1862285612Sdelphij    )]
1863285612Sdelphij)
1864285612Sdelphijcase "$ntp_eac::$ntp_cv_modem_control" in
1865285612Sdelphij yes::yes)
1866285612Sdelphij    ntp_enable_all_modem_control_clocks=yes
1867285612Sdelphij    ;;
1868285612Sdelphij *)
1869285612Sdelphij    ntp_enable_all_modem_control_clocks=no
1870285612Sdelphij    ;;
1871285612Sdelphijesac
1872285612Sdelphij
1873181834Sroberto# Requires modem control
1874200576SrobertoAC_MSG_CHECKING([ACTS modem service])
1875285612SdelphijAC_ARG_ENABLE(
1876285612Sdelphij    [ACTS],
1877285612Sdelphij    [AS_HELP_STRING(
1878285612Sdelphij	[--enable-ACTS],
1879285612Sdelphij	[s ACTS modem service]
1880285612Sdelphij    )],
1881181834Sroberto    [ntp_ok=$enableval],
1882285612Sdelphij    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1883285612Sdelphij)
1884285612Sdelphijcase "$ntp_ok" in
1885285612Sdelphij yes)
1886181834Sroberto    ntp_refclock=yes
1887285612Sdelphij    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1888285612Sdelphij    ;;
1889285612Sdelphijesac
1890285612SdelphijAC_MSG_RESULT([$ntp_ok])
1891181834Sroberto
1892200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1893285612SdelphijAC_ARG_ENABLE(
1894285612Sdelphij    [ARBITER],
1895285612Sdelphij    [AS_HELP_STRING(
1896285612Sdelphij	[--enable-ARBITER],
1897285612Sdelphij	[+ Arbiter 1088A/B GPS receiver]
1898285612Sdelphij    )],
1899285612Sdelphij    [ntp_ok=$enableval],
1900285612Sdelphij    [ntp_ok=$ntp_eac]
1901285612Sdelphij)
1902285612Sdelphijcase "$ntp_ok" in
1903285612Sdelphij yes)
1904181834Sroberto    ntp_refclock=yes
1905285612Sdelphij    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1906285612Sdelphij    ;;
1907285612Sdelphijesac
1908285612SdelphijAC_MSG_RESULT([$ntp_ok])
1909181834Sroberto
1910200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
1911285612SdelphijAC_ARG_ENABLE(
1912285612Sdelphij    [ARCRON_MSF],
1913285612Sdelphij    [AS_HELP_STRING(
1914285612Sdelphij	[--enable-ARCRON-MSF],
1915285612Sdelphij	[+ Arcron MSF receiver]
1916285612Sdelphij    )],
1917285612Sdelphij    [ntp_ok=$enableval],
1918285612Sdelphij    [ntp_ok=$ntp_eac]
1919285612Sdelphij)
1920285612Sdelphijcase "$ntp_ok" in
1921285612Sdelphij yes)
1922181834Sroberto    ntp_refclock=yes
1923285612Sdelphij    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1924285612Sdelphij    ;;
1925285612Sdelphijesac
1926285612SdelphijAC_MSG_RESULT([$ntp_ok])
1927181834Sroberto
1928200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1929285612SdelphijAC_ARG_ENABLE(
1930285612Sdelphij    [AS2201],
1931285612Sdelphij    [AS_HELP_STRING(
1932285612Sdelphij	[--enable-AS2201],
1933285612Sdelphij	[+ Austron 2200A/2201A GPS receiver]
1934285612Sdelphij    )],
1935285612Sdelphij    [ntp_ok=$enableval],
1936285612Sdelphij    [ntp_ok=$ntp_eac]
1937285612Sdelphij)
1938285612Sdelphijcase "$ntp_ok" in
1939285612Sdelphij yes)
1940181834Sroberto    ntp_refclock=yes
1941285612Sdelphij    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1942285612Sdelphij    ;;
1943285612Sdelphijesac
1944285612SdelphijAC_MSG_RESULT([$ntp_ok])
1945181834Sroberto
1946200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
1947285612SdelphijAC_ARG_ENABLE(
1948285612Sdelphij    [ATOM],
1949285612Sdelphij    [AS_HELP_STRING(
1950285612Sdelphij	[--enable-ATOM],
1951285612Sdelphij	[s ATOM PPS interface]
1952285612Sdelphij    )],
1953285612Sdelphij    [ntp_ok=$enableval],
1954285612Sdelphij    [ntp_ok=$ntp_eac]
1955285612Sdelphij)
1956285612Sdelphijcase "$ntp_atom_ok" in
1957181834Sroberto no) ntp_ok=no ;;
1958181834Srobertoesac
1959285612Sdelphijcase "$ntp_ok" in
1960285612Sdelphij yes)
1961181834Sroberto    ntp_refclock=yes
1962285612Sdelphij    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1963285612Sdelphij    ;;
1964285612Sdelphijesac
1965285612SdelphijAC_MSG_RESULT([$ntp_ok])
1966181834Sroberto
1967200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1968285612SdelphijAC_ARG_ENABLE(
1969285612Sdelphij    [CHRONOLOG],
1970285612Sdelphij    [AS_HELP_STRING(
1971285612Sdelphij	[--enable-CHRONOLOG],
1972285612Sdelphij	[+ Chrono-log K-series WWVB receiver]
1973285612Sdelphij    )],
1974285612Sdelphij    [ntp_ok=$enableval],
1975285612Sdelphij    [ntp_ok=$ntp_eac]
1976285612Sdelphij)
1977285612Sdelphijcase "$ntp_ok" in
1978285612Sdelphij yes)
1979181834Sroberto    ntp_refclock=yes
1980285612Sdelphij    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1981285612Sdelphij    ;;
1982285612Sdelphijesac
1983285612SdelphijAC_MSG_RESULT([$ntp_ok])
1984181834Sroberto
1985200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
1986285612SdelphijAC_ARG_ENABLE(
1987285612Sdelphij    [CHU],
1988285612Sdelphij    [AS_HELP_STRING(
1989285612Sdelphij	[--enable-CHU],
1990285612Sdelphij	[+ CHU modem/decoder]
1991285612Sdelphij    )],
1992285612Sdelphij    [ntp_ok=$enableval],
1993285612Sdelphij    [ntp_ok=$ntp_eac]
1994285612Sdelphij)
1995285612Sdelphijcase "$ntp_ok" in
1996285612Sdelphij yes)
1997181834Sroberto    ntp_refclock=yes
1998285612Sdelphij    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1999285612Sdelphij    ;;
2000285612Sdelphijesac
2001285612SdelphijAC_MSG_RESULT([$ntp_ok])
2002285612Sdelphijntp_refclock_chu=$ntp_ok
2003181834Sroberto
2004200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2005285612SdelphijAC_ARG_ENABLE(
2006285612Sdelphij    [AUDIO-CHU],
2007285612Sdelphij    [AS_HELP_STRING(
2008285612Sdelphij	[--enable-AUDIO-CHU],
2009285612Sdelphij	[s CHU audio/decoder]
2010285612Sdelphij    )],
2011181834Sroberto    [ntp_ok=$enableval],
2012285612Sdelphij    [
2013285612Sdelphij	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2014285612Sdelphij	 *no*)	ntp_ok=no  ;;
2015285612Sdelphij	 *)	ntp_ok=yes ;;
2016285612Sdelphij	esac
2017285612Sdelphij    ]
2018285612Sdelphij)
2019285612SdelphijAC_MSG_RESULT([$ntp_ok])
2020181834Sroberto# We used to check for sunos/solaris target...
2021285612Sdelphijcase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2022285612Sdelphij yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2023181834Srobertoesac
2024181834Sroberto
2025181834Sroberto# Not under HP-UX
2026200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2027285612SdelphijAC_ARG_ENABLE(
2028285612Sdelphij    [DATUM],
2029285612Sdelphij    [AS_HELP_STRING(
2030285612Sdelphij	[--enable-DATUM],
2031285612Sdelphij	[s Datum Programmable Time System]
2032285612Sdelphij    )],
2033181834Sroberto    [ntp_ok=$enableval],
2034285612Sdelphij    [
2035285612Sdelphij	case "$ac_cv_header_termios_h" in
2036285612Sdelphij	 yes)
2037285612Sdelphij	    ntp_ok=$ntp_eac
2038285612Sdelphij	    ;;
2039285612Sdelphij	 *) ntp_ok=no
2040285612Sdelphij	    ;;
2041285612Sdelphij	esac
2042285612Sdelphij    ]
2043285612Sdelphij)
2044285612Sdelphijcase "$ntp_ok" in
2045285612Sdelphij yes)
2046181834Sroberto    ntp_refclock=yes
2047285612Sdelphij    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2048285612Sdelphij    ;;
2049285612Sdelphijesac
2050285612SdelphijAC_MSG_RESULT([$ntp_ok])
2051181834Sroberto
2052200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2053285612SdelphijAC_ARG_ENABLE(
2054285612Sdelphij    [DUMBCLOCK],
2055285612Sdelphij    [AS_HELP_STRING(
2056285612Sdelphij	[--enable-DUMBCLOCK],
2057285612Sdelphij	[+ Dumb generic hh:mm:ss local clock]
2058285612Sdelphij    )],
2059285612Sdelphij    [ntp_ok=$enableval],
2060285612Sdelphij    [ntp_ok=$ntp_eac]
2061285612Sdelphij)
2062285612Sdelphijcase "$ntp_ok" in
2063285612Sdelphij yes)
2064181834Sroberto    ntp_refclock=yes
2065285612Sdelphij    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2066285612Sdelphij    ;;
2067285612Sdelphijesac
2068285612SdelphijAC_MSG_RESULT([$ntp_ok])
2069181834Sroberto
2070200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2071285612SdelphijAC_ARG_ENABLE(
2072285612Sdelphij    [FG],
2073285612Sdelphij    [AS_HELP_STRING(
2074285612Sdelphij	[--enable-FG],
2075285612Sdelphij	[+ Forum Graphic GPS]
2076285612Sdelphij    )],
2077285612Sdelphij    [ntp_ok=$enableval],
2078285612Sdelphij    [ntp_ok=$ntp_eac]
2079285612Sdelphij)
2080285612Sdelphijcase "$ntp_ok" in
2081285612Sdelphij yes)
2082181834Sroberto    ntp_refclock=yes
2083285612Sdelphij    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2084285612Sdelphij    ;;
2085285612Sdelphijesac
2086285612SdelphijAC_MSG_RESULT([$ntp_ok])
2087181834Sroberto
2088181834Sroberto# Requires modem control
2089200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2090285612SdelphijAC_ARG_ENABLE(
2091285612Sdelphij    [HEATH],
2092285612Sdelphij    [AS_HELP_STRING(
2093285612Sdelphij	[--enable-HEATH],
2094285612Sdelphij	[s Heath GC-1000 WWV/WWVH receiver]
2095285612Sdelphij    )],
2096181834Sroberto    [ntp_ok=$enableval],
2097285612Sdelphij    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2098285612Sdelphij)
2099285612Sdelphijcase "$ntp_ok" in
2100285612Sdelphij yes)
2101181834Sroberto    ntp_refclock=yes
2102285612Sdelphij    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2103285612Sdelphij    ;;
2104285612Sdelphijesac
2105285612SdelphijAC_MSG_RESULT([$ntp_ok])
2106181834Sroberto
2107200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2108285612SdelphijAC_ARG_ENABLE(
2109285612Sdelphij    [HOPFSERIAL],
2110285612Sdelphij    [AS_HELP_STRING(
2111285612Sdelphij	[--enable-HOPFSERIAL],
2112285612Sdelphij	[+ hopf serial clock device]
2113285612Sdelphij    )],
2114285612Sdelphij    [ntp_ok=$enableval],
2115285612Sdelphij    [ntp_ok=$ntp_eac]
2116285612Sdelphij)
2117285612Sdelphijcase "$ntp_ok" in
2118285612Sdelphij yes)
2119181834Sroberto    ntp_refclock=yes
2120285612Sdelphij    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2121285612Sdelphij    ;;
2122285612Sdelphijesac
2123285612SdelphijAC_MSG_RESULT([$ntp_ok])
2124181834Sroberto
2125200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2126285612SdelphijAC_ARG_ENABLE(
2127285612Sdelphij    [HOPFPCI],
2128285612Sdelphij    [AS_HELP_STRING(
2129285612Sdelphij	[--enable-HOPFPCI],
2130285612Sdelphij	[+ hopf 6039 PCI board]
2131285612Sdelphij    )],
2132285612Sdelphij    [ntp_ok=$enableval],
2133285612Sdelphij    [ntp_ok=$ntp_eac]
2134285612Sdelphij)
2135285612Sdelphijcase "$ntp_ok" in
2136285612Sdelphij yes)
2137181834Sroberto    ntp_refclock=yes
2138285612Sdelphij    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2139285612Sdelphij    ;;
2140285612Sdelphijesac
2141285612SdelphijAC_MSG_RESULT([$ntp_ok])
2142181834Sroberto
2143200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2144285612SdelphijAC_ARG_ENABLE(
2145285612Sdelphij    [HPGPS],
2146285612Sdelphij    [AS_HELP_STRING(
2147285612Sdelphij	[--enable-HPGPS],
2148285612Sdelphij	[+ HP 58503A GPS receiver]
2149285612Sdelphij    )],
2150285612Sdelphij    [ntp_ok=$enableval],
2151285612Sdelphij    [ntp_ok=$ntp_eac]
2152285612Sdelphij)
2153285612Sdelphijcase "$ntp_ok" in
2154285612Sdelphij yes)
2155181834Sroberto    ntp_refclock=yes
2156285612Sdelphij    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2157285612Sdelphij    ;;
2158285612Sdelphijesac
2159285612SdelphijAC_MSG_RESULT([$ntp_ok])
2160181834Sroberto
2161200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2162285612SdelphijAC_ARG_ENABLE(
2163285612Sdelphij    [IRIG],
2164285612Sdelphij    [AS_HELP_STRING(
2165285612Sdelphij	[--enable-IRIG],
2166285612Sdelphij	[s IRIG audio decoder]
2167285612Sdelphij    )],
2168181834Sroberto    [ntp_ok=$enableval],
2169285612Sdelphij    [
2170285612Sdelphij	case "$ntp_eac$ntp_canaudio" in
2171285612Sdelphij	 *no*)	ntp_ok=no  ;;
2172285612Sdelphij	 *)	ntp_ok=yes ;;
2173285612Sdelphij	esac
2174285612Sdelphij    ]
2175285612Sdelphij)
2176285612Sdelphijcase "$ntp_ok" in
2177285612Sdelphij yes)
2178181834Sroberto    ntp_refclock=yes
2179285612Sdelphij    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2180285612Sdelphij    ;;
2181285612Sdelphijesac
2182285612SdelphijAC_MSG_RESULT([$ntp_ok])
2183181834Srobertocase "$ntp_ok$ntp_canaudio" in
2184285612Sdelphij yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2185181834Srobertoesac
2186181834Sroberto
2187200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2188285612SdelphijAC_ARG_ENABLE(
2189285612Sdelphij    [JJY],
2190285612Sdelphij    [AS_HELP_STRING(
2191285612Sdelphij	[--enable-JJY],
2192285612Sdelphij	[+ JJY receiver]
2193285612Sdelphij    )],
2194285612Sdelphij    [ntp_ok=$enableval],
2195285612Sdelphij    [ntp_ok=$ntp_eac]
2196285612Sdelphij)
2197285612Sdelphijcase "$ntp_ok" in
2198285612Sdelphij yes)
2199181834Sroberto    ntp_refclock=yes
2200285612Sdelphij    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2201285612Sdelphij    ;;
2202285612Sdelphijesac
2203285612SdelphijAC_MSG_RESULT([$ntp_ok])
2204181834Sroberto
2205200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2206285612SdelphijAC_ARG_ENABLE(
2207285612Sdelphij    [JUPITER],
2208285612Sdelphij    [AS_HELP_STRING(
2209285612Sdelphij	[--enable-JUPITER],
2210285612Sdelphij	[s Rockwell Jupiter GPS receiver]
2211285612Sdelphij    )],
2212181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2213285612Sdelphijcase "$ntp_jupiter_ok" in
2214181834Sroberto no) ntp_ok=no ;;
2215181834Srobertoesac
2216285612Sdelphijcase "$ntp_ok" in
2217285612Sdelphij yes)
2218181834Sroberto    ntp_refclock=yes
2219285612Sdelphij    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2220285612Sdelphij    ;;
2221285612Sdelphijesac
2222285612SdelphijAC_MSG_RESULT([$ntp_ok])
2223181834Sroberto
2224200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2225285612SdelphijAC_ARG_ENABLE(
2226285612Sdelphij    [LEITCH],
2227285612Sdelphij    [AS_HELP_STRING(
2228285612Sdelphij	[--enable-LEITCH],
2229285612Sdelphij	[+ Leitch CSD 5300 Master Clock System Driver]
2230285612Sdelphij    )],
2231285612Sdelphij    [ntp_ok=$enableval],
2232285612Sdelphij    [ntp_ok=$ntp_eac]
2233285612Sdelphij)
2234285612Sdelphijcase "$ntp_ok" in
2235285612Sdelphij yes)
2236181834Sroberto    ntp_refclock=yes
2237285612Sdelphij    AC_DEFINE([CLOCK_LEITCH], [1],
2238285612Sdelphij	[Leitch CSD 5300 Master Clock System Driver?])
2239285612Sdelphij    ;;
2240285612Sdelphijesac
2241285612SdelphijAC_MSG_RESULT([$ntp_ok])
2242181834Sroberto
2243200576SrobertoAC_MSG_CHECKING([local clock reference])
2244285612SdelphijAC_ARG_ENABLE(
2245285612Sdelphij    [LOCAL-CLOCK],
2246285612Sdelphij    [AS_HELP_STRING(
2247285612Sdelphij	[--enable-LOCAL-CLOCK],
2248285612Sdelphij	[+ local clock reference]
2249285612Sdelphij    )],
2250285612Sdelphij    [ntp_ok=$enableval],
2251285612Sdelphij    [ntp_ok=$ntp_eac]
2252285612Sdelphij)
2253285612Sdelphijcase "$ntp_ok" in
2254285612Sdelphij yes)
2255181834Sroberto    ntp_refclock=yes
2256285612Sdelphij    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2257285612Sdelphij    ;;
2258285612Sdelphijesac
2259285612SdelphijAC_MSG_RESULT([$ntp_ok])
2260181834Sroberto
2261181834Srobertodnl Bug 340: longstanding unfixed bugs
2262285612Sdelphijdnl AC_MSG_CHECKING([EES M201 MSF receiver])
2263285612Sdelphijdnl AC_ARG_ENABLE([MSFEES],
2264285612Sdelphijdnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2265181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2266181834Srobertodnl if test "$ntp_ok" = "yes"; then
2267181834Srobertodnl     ntp_refclock=yes
2268285612Sdelphijdnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2269181834Srobertodnl fi
2270285612Sdelphijdnl AC_MSG_RESULT([$ntp_ok])
2271181834Sroberto
2272181834Sroberto# Not Ultrix
2273200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2274285612SdelphijAC_ARG_ENABLE(
2275285612Sdelphij    [MX4200],
2276285612Sdelphij    [AS_HELP_STRING(
2277285612Sdelphij	[--enable-MX4200 ],
2278285612Sdelphij	[s Magnavox MX4200 GPS receiver]
2279285612Sdelphij    )],
2280181834Sroberto    [ntp_ok=$enableval],
2281285612Sdelphij    [
2282285612Sdelphij	case "$ac_cv_var_ppsclock" in
2283285612Sdelphij	 yes)
2284285612Sdelphij	    ntp_ok=$ntp_eac
2285285612Sdelphij	    ;;
2286285612Sdelphij	 *)
2287285612Sdelphij	    ntp_ok=no
2288285612Sdelphij	    ;;
2289285612Sdelphij	esac
2290285612Sdelphij    ]
2291285612Sdelphij)
2292285612Sdelphijcase "$ntp_ok" in
2293285612Sdelphij yes)
2294181834Sroberto    ntp_refclock=yes
2295285612Sdelphij    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2296285612Sdelphij    ;;
2297285612Sdelphijesac
2298285612SdelphijAC_MSG_RESULT([$ntp_ok])
2299181834Srobertocase "$ntp_ok$host" in
2300285612Sdelphij yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2301181834Srobertoesac
2302181834Sroberto
2303200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2304285612SdelphijAC_ARG_ENABLE(
2305285612Sdelphij    [NEOCLOCK4X],
2306285612Sdelphij    [AS_HELP_STRING(
2307285612Sdelphij	[--enable-NEOCLOCK4X],
2308285612Sdelphij	[+ NeoClock4X DCF77 / TDF receiver]
2309285612Sdelphij    )],
2310285612Sdelphij    [ntp_ok=$enableval],
2311285612Sdelphij    [ntp_ok=$ntp_eac]
2312285612Sdelphij)
2313285612Sdelphijcase "$ntp_ok" in
2314285612Sdelphij yes)
2315181834Sroberto    ntp_refclock=yes
2316285612Sdelphij    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2317285612Sdelphij    ;;
2318285612Sdelphijesac
2319285612SdelphijAC_MSG_RESULT([$ntp_ok])
2320181834Sroberto
2321200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2322285612SdelphijAC_ARG_ENABLE(
2323285612Sdelphij    [NMEA],
2324285612Sdelphij    [AS_HELP_STRING(
2325285612Sdelphij	[--enable-NMEA],
2326285612Sdelphij	[+ NMEA GPS receiver]
2327285612Sdelphij    )],
2328285612Sdelphij    [ntp_ok=$enableval],
2329285612Sdelphij    [ntp_ok=$ntp_eac]
2330285612Sdelphij)
2331285612Sdelphijcase "$ntp_ok" in
2332285612Sdelphij yes)
2333181834Sroberto    ntp_refclock=yes
2334285612Sdelphij    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2335285612Sdelphij    ;;
2336285612Sdelphijesac
2337285612SdelphijAC_MSG_RESULT([$ntp_ok])
2338181834Sroberto
2339285612SdelphijAC_CHECK_FUNCS([strtoll])
2340285612SdelphijAC_MSG_CHECKING([for GPSD JSON receiver])
2341285612SdelphijAC_ARG_ENABLE(
2342285612Sdelphij    [GPSD],
2343285612Sdelphij    [AS_HELP_STRING(
2344285612Sdelphij	[--enable-GPSD],
2345285612Sdelphij	[+ GPSD JSON receiver]
2346285612Sdelphij    )],
2347285612Sdelphij    [ntp_ok=$enableval],
2348285612Sdelphij    [case "$ac_cv_func_strtoll" in
2349285612Sdelphij     yes) ntp_ok=$ntp_eac ;;
2350285612Sdelphij     *)   ntp_ok="no" ;;
2351285612Sdelphij    esac]
2352285612Sdelphij)
2353285612Sdelphijcase "$ntp_ok" in
2354285612Sdelphij yes)
2355285612Sdelphij    ntp_refclock=yes
2356285612Sdelphij    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2357285612Sdelphij    ;;
2358285612Sdelphijesac
2359285612SdelphijAC_MSG_RESULT([$ntp_ok])
2360285612Sdelphij
2361200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2362285612SdelphijAC_ARG_ENABLE(
2363285612Sdelphij    [ONCORE],
2364285612Sdelphij    [AS_HELP_STRING(
2365285612Sdelphij	[--enable-ONCORE],
2366285612Sdelphij	[s Motorola VP/UT Oncore GPS receiver]
2367285612Sdelphij    )],
2368285612Sdelphij    [ntp_ok=$enableval],
2369285612Sdelphij    [ntp_ok=$ntp_eac]
2370285612Sdelphij)
2371285612Sdelphijcase "$ntp_oncore_ok" in
2372181834Sroberto no) ntp_ok=no ;;
2373181834Srobertoesac
2374285612Sdelphijcase "$ntp_ok" in
2375285612Sdelphij yes)
2376181834Sroberto    ntp_refclock=yes
2377285612Sdelphij    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2378285612Sdelphij    ;;
2379285612Sdelphijesac
2380285612SdelphijAC_MSG_RESULT([$ntp_ok])
2381181834Sroberto
2382285612Sdelphij# Requires modem control
2383200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2384285612SdelphijAC_ARG_ENABLE(
2385285612Sdelphij    [PALISADE],
2386285612Sdelphij    [AS_HELP_STRING(
2387285612Sdelphij	[--enable-PALISADE],
2388285612Sdelphij	[s Palisade clock]
2389285612Sdelphij    )],
2390181834Sroberto    [ntp_ok=$enableval],
2391285612Sdelphij    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2392285612Sdelphij)
2393285612Sdelphijcase "$ntp_ok" in
2394285612Sdelphij yes)
2395181834Sroberto    ntp_refclock=yes
2396285612Sdelphij    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2397285612Sdelphij    ;;
2398285612Sdelphijesac
2399285612SdelphijAC_MSG_RESULT([$ntp_ok])
2400181834Sroberto
2401200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2402285612SdelphijAC_ARG_ENABLE(
2403285612Sdelphij    [PCF],
2404285612Sdelphij    [AS_HELP_STRING(
2405285612Sdelphij	[--enable-PCF ],
2406285612Sdelphij	[+ Conrad parallel port radio clock]
2407285612Sdelphij    )],
2408285612Sdelphij    [ntp_ok=$enableval],
2409285612Sdelphij    [ntp_ok=$ntp_eac]
2410285612Sdelphij)
2411285612Sdelphijcase "$ntp_ok" in
2412285612Sdelphij yes)
2413181834Sroberto    ntp_refclock=yes
2414285612Sdelphij    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2415285612Sdelphij    ;;
2416285612Sdelphijesac
2417285612SdelphijAC_MSG_RESULT([$ntp_ok])
2418181834Sroberto
2419200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2420285612SdelphijAC_ARG_ENABLE(
2421285612Sdelphij    [PST],
2422285612Sdelphij    [AS_HELP_STRING(
2423285612Sdelphij	[--enable-PST],
2424285612Sdelphij	[+ PST/Traconex 1020 WWV/WWVH receiver]
2425285612Sdelphij    )],
2426285612Sdelphij    [ntp_ok=$enableval],
2427285612Sdelphij    [ntp_ok=$ntp_eac]
2428285612Sdelphij)
2429285612Sdelphijcase "$ntp_ok" in
2430285612Sdelphij yes)
2431181834Sroberto    ntp_refclock=yes
2432285612Sdelphij    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2433285612Sdelphij    ;;
2434285612Sdelphijesac
2435285612SdelphijAC_MSG_RESULT([$ntp_ok])
2436181834Sroberto
2437200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2438285612SdelphijAC_ARG_ENABLE(
2439285612Sdelphij    [RIPENCC],
2440285612Sdelphij    [AS_HELP_STRING(
2441285612Sdelphij	[--enable-RIPENCC],
2442285612Sdelphij	[- RIPENCC specific Trimble driver]
2443285612Sdelphij    )],
2444285612Sdelphij    [ntp_ok=$enableval],
2445285612Sdelphij    [ntp_ok=no]
2446285612Sdelphij)
2447181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2448285612Sdelphijcase "$ntp_ripe_ncc_ok" in
2449181834Sroberto no) ntp_ok=no ;;
2450181834Srobertoesac
2451285612Sdelphijcase "$ntp_ok" in
2452285612Sdelphij yes)
2453181834Sroberto    ntp_refclock=yes
2454285612Sdelphij    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2455285612Sdelphij    ;;
2456285612Sdelphijesac
2457285612SdelphijAC_MSG_RESULT([$ntp_ok])
2458181834Sroberto
2459181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2460181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2461200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2462285612SdelphijAC_ARG_ENABLE(
2463285612Sdelphij    [SHM],
2464285612Sdelphij    [AS_HELP_STRING(
2465285612Sdelphij	[--enable-SHM],
2466285612Sdelphij	[s SHM clock attached thru shared memory]
2467285612Sdelphij    )],
2468181834Sroberto    [ntp_ok=$enableval],
2469285612Sdelphij    [
2470285612Sdelphij	case "$ntp_eac$ntp_canshm" in
2471285612Sdelphij	 *no*)	ntp_ok=no  ;;
2472285612Sdelphij	 *)	ntp_ok=yes ;;
2473285612Sdelphij	esac
2474285612Sdelphij    ]
2475285612Sdelphij)
2476285612Sdelphijcase "$ntp_ok" in
2477285612Sdelphij yes)
2478181834Sroberto    ntp_refclock=yes
2479285612Sdelphij    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2480285612Sdelphij    ;;
2481285612Sdelphijesac
2482285612SdelphijAC_MSG_RESULT([$ntp_ok])
2483181834Sroberto
2484200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2485285612SdelphijAC_ARG_ENABLE(
2486285612Sdelphij    [SPECTRACOM],
2487285612Sdelphij    [AS_HELP_STRING(
2488285612Sdelphij	[--enable-SPECTRACOM],
2489285612Sdelphij	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2490285612Sdelphij    )],
2491285612Sdelphij    [ntp_ok=$enableval],
2492285612Sdelphij    [ntp_ok=$ntp_eac]
2493285612Sdelphij)
2494285612Sdelphijcase "$ntp_ok" in
2495285612Sdelphij yes)
2496181834Sroberto    ntp_refclock=yes
2497285612Sdelphij    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2498285612Sdelphij	[Spectracom 8170/Netclock/2 WWVB receiver])
2499285612Sdelphij    ;;
2500285612Sdelphijesac
2501285612SdelphijAC_MSG_RESULT([$ntp_ok])
2502181834Sroberto
2503200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2504285612SdelphijAC_ARG_ENABLE(
2505285612Sdelphij    [TPRO],
2506285612Sdelphij    [AS_HELP_STRING(
2507285612Sdelphij	[--enable-TPRO],
2508285612Sdelphij	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2509285612Sdelphij    )],
2510181834Sroberto    [ntp_ok=$enableval],
2511285612Sdelphij    [
2512285612Sdelphij	case "$ac_cv_header_sys_tpro_h" in
2513285612Sdelphij	 yes)
2514285612Sdelphij	    ntp_ok=$ntp_eac
2515285612Sdelphij	    ;;
2516285612Sdelphij	 *)
2517285612Sdelphij	    ntp_ok=no
2518285612Sdelphij	    ;;
2519285612Sdelphij	esac
2520285612Sdelphij    ]
2521285612Sdelphij)
2522285612Sdelphijcase "$ntp_ok" in
2523285612Sdelphij yes)
2524181834Sroberto    ntp_refclock=yes
2525285612Sdelphij    AC_DEFINE([CLOCK_TPRO], [1],
2526285612Sdelphij	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2527285612Sdelphij    ;;
2528285612Sdelphijesac
2529285612SdelphijAC_MSG_RESULT([$ntp_ok])
2530181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2531285612Sdelphij yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2532181834Srobertoesac
2533181834Sroberto
2534181834Sroberto# Not on a vax-dec-bsd
2535200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2536285612SdelphijAC_ARG_ENABLE(
2537285612Sdelphij    [TRUETIME],
2538285612Sdelphij    [AS_HELP_STRING(
2539285612Sdelphij	[--enable-TRUETIME],
2540285612Sdelphij	[s Kinemetrics/TrueTime receivers]
2541285612Sdelphij    )],
2542181834Sroberto    [ntp_ok=$enableval],
2543285612Sdelphij    [
2544285612Sdelphij	case "$host" in
2545285612Sdelphij	 vax-dec-bsd)
2546285612Sdelphij	    ntp_ok=no
2547285612Sdelphij	    ;;
2548285612Sdelphij	 *)
2549285612Sdelphij	    ntp_ok=$ntp_eac
2550285612Sdelphij	    ;;
2551285612Sdelphij	esac
2552285612Sdelphij    ]
2553285612Sdelphij)    
2554285612Sdelphijcase "$ntp_ok" in
2555285612Sdelphij yes)
2556181834Sroberto    ntp_refclock=yes
2557285612Sdelphij    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2558285612Sdelphij    ;;
2559285612Sdelphijesac
2560285612SdelphijAC_MSG_RESULT([$ntp_ok])
2561181834Srobertocase "$ntp_ok$host" in
2562285612Sdelphij yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2563181834Srobertoesac
2564181834Sroberto
2565200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2566285612SdelphijAC_ARG_ENABLE(
2567285612Sdelphij    [TT560],
2568285612Sdelphij    [AS_HELP_STRING(
2569285612Sdelphij	[--enable-TT560],
2570285612Sdelphij	[- TrueTime 560 IRIG-B decoder]
2571285612Sdelphij    )],
2572285612Sdelphij    [ntp_ok=$enableval],
2573285612Sdelphij    [ntp_ok=no]
2574285612Sdelphij)
2575285612Sdelphijcase "$ntp_ok" in
2576285612Sdelphij yes)
2577181834Sroberto    ntp_refclock=yes
2578285612Sdelphij    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2579285612Sdelphij    ;;
2580285612Sdelphijesac
2581285612SdelphijAC_MSG_RESULT([$ntp_ok])
2582181834Sroberto
2583200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2584285612SdelphijAC_ARG_ENABLE(
2585285612Sdelphij    [ULINK],
2586285612Sdelphij    [AS_HELP_STRING(
2587285612Sdelphij	[--enable-ULINK],
2588285612Sdelphij	[+ Ultralink WWVB receiver]
2589285612Sdelphij    )],
2590285612Sdelphij    [ntp_ok=$enableval],
2591285612Sdelphij    [ntp_ok=$ntp_eac]
2592285612Sdelphij)
2593285612Sdelphijcase "$ntp_ok" in
2594285612Sdelphij yes)
2595181834Sroberto    ntp_refclock=yes
2596285612Sdelphij    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2597285612Sdelphij    ;;
2598285612Sdelphijesac
2599285612SdelphijAC_MSG_RESULT([$ntp_ok])
2600181834Sroberto
2601285612SdelphijAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2602285612SdelphijAC_ARG_ENABLE(
2603285612Sdelphij    [TSYNCPCI],
2604285612Sdelphij    [AS_HELP_STRING(
2605285612Sdelphij	[--enable-TSYNCPCI],
2606285612Sdelphij	[s Spectracom TSYNC timing board]
2607285612Sdelphij    )],
2608285612Sdelphij    [ntp_ok=$enableval],
2609285612Sdelphij    [
2610285612Sdelphij	case "$host" in
2611285612Sdelphij	 *-*-*linux*)
2612285612Sdelphij	    ntp_ok=$ntp_eac
2613285612Sdelphij	    ;;
2614285612Sdelphij	 *)
2615285612Sdelphij	    ntp_ok=no
2616285612Sdelphij	esac
2617285612Sdelphij    ]
2618285612Sdelphij)
2619285612Sdelphijcase "$ntp_ok" in
2620285612Sdelphij yes)
2621285612Sdelphij    ntp_refclock=yes
2622285612Sdelphij    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2623285612Sdelphij    ;;
2624285612Sdelphijesac
2625285612SdelphijAC_MSG_RESULT([$ntp_ok])
2626285612Sdelphij
2627200576SrobertoAC_MSG_CHECKING([WWV receiver])
2628285612SdelphijAC_ARG_ENABLE(
2629285612Sdelphij    [WWV],
2630285612Sdelphij    [AS_HELP_STRING(
2631285612Sdelphij	[--enable-WWV],
2632285612Sdelphij	[s WWV Audio receiver]
2633285612Sdelphij    )],
2634181834Sroberto    [ntp_ok=$enableval],
2635285612Sdelphij    [
2636285612Sdelphij	case "$ntp_eac$ntp_canaudio" in
2637285612Sdelphij	 *no*)	ntp_ok=no  ;;
2638285612Sdelphij	 *)	ntp_ok=yes ;;
2639285612Sdelphij	esac
2640285612Sdelphij    ]
2641285612Sdelphij)
2642285612Sdelphijcase "$ntp_ok" in
2643285612Sdelphij yes)
2644181834Sroberto    ntp_refclock=yes
2645285612Sdelphij    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2646285612Sdelphij    ;;
2647285612Sdelphijesac
2648285612SdelphijAC_MSG_RESULT([$ntp_ok])
2649181834Srobertocase "$ntp_ok$ntp_canaudio" in
2650285612Sdelphij yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2651181834Srobertoesac
2652181834Sroberto
2653200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2654285612SdelphijAC_ARG_ENABLE(
2655285612Sdelphij    [ZYFER],
2656285612Sdelphij    [AS_HELP_STRING(
2657285612Sdelphij	[--enable-ZYFER],
2658285612Sdelphij	[+ Zyfer GPStarplus receiver]
2659285612Sdelphij    )],
2660285612Sdelphij    [ntp_ok=$enableval],
2661285612Sdelphij    [ntp_ok=$ntp_eac]
2662285612Sdelphij)
2663285612Sdelphijcase "$ntp_ok" in
2664285612Sdelphij yes)
2665181834Sroberto    ntp_refclock=yes
2666285612Sdelphij    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2667285612Sdelphij    ;;
2668285612Sdelphijesac
2669285612SdelphijAC_MSG_RESULT([$ntp_ok])
2670181834Sroberto
2671200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2672285612SdelphijAC_ARG_ENABLE(
2673285612Sdelphij    [parse-clocks],
2674285612Sdelphij    [AS_HELP_STRING(
2675285612Sdelphij	[--enable-parse-clocks],
2676285612Sdelphij	[- include all suitable PARSE clocks:]
2677285612Sdelphij    )],
2678181834Sroberto    [ntp_eapc=$enableval],
2679285612Sdelphij    [
2680285612Sdelphij	case "$ntp_eac" in
2681285612Sdelphij	 yes)	ntp_eapc=$ntp_canparse ;;
2682285612Sdelphij	 *)	ntp_eapc=no ;;
2683285612Sdelphij	esac
2684285612Sdelphij	# Delete the next line one of these days
2685285612Sdelphij	ntp_eapc=no
2686285612Sdelphij    ]
2687285612Sdelphij)
2688181834SrobertoAC_MSG_RESULT($ntp_eapc)
2689181834Sroberto
2690181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2691181834Sroberto noyes*)
2692200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2693181834Sroberto    ;;
2694181834Sroberto yesyesno)
2695200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2696181834Sroberto    ;;
2697181834Srobertoesac
2698181834Sroberto
2699181834Srobertontp_libparse=no
2700181834Srobertontp_parseutil=no
2701181834Srobertontp_rawdcf=no
2702181834Sroberto
2703200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2704285612SdelphijAC_ARG_ENABLE(
2705285612Sdelphij    [COMPUTIME],
2706285612Sdelphij    [AS_HELP_STRING(
2707285612Sdelphij	[--enable-COMPUTIME],
2708285612Sdelphij	[s Diem Computime Radio Clock]
2709285612Sdelphij    )],
2710285612Sdelphij    [ntp_ok=$enableval],
2711285612Sdelphij    [ntp_ok=$ntp_eapc]
2712285612Sdelphij)
2713285612Sdelphijcase "$ntp_ok" in
2714285612Sdelphij yes)
2715181834Sroberto    ntp_libparse=yes
2716181834Sroberto    ntp_refclock=yes
2717285612Sdelphij    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2718285612Sdelphij    ;;
2719285612Sdelphijesac
2720285612SdelphijAC_MSG_RESULT([$ntp_ok])
2721181834Srobertocase "$ntp_ok$ntp_canparse" in
2722181834Sroberto yesno)
2723200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2724181834Srobertoesac
2725181834Sroberto
2726200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2727285612SdelphijAC_ARG_ENABLE(
2728285612Sdelphij    [DCF7000],
2729285612Sdelphij    [AS_HELP_STRING(
2730285612Sdelphij	[--enable-DCF7000],
2731285612Sdelphij	[s ELV/DCF7000 clock]
2732285612Sdelphij    )],
2733285612Sdelphij    [ntp_ok=$enableval],
2734285612Sdelphij    [ntp_ok=$ntp_eapc]
2735285612Sdelphij)
2736285612Sdelphijcase "$ntp_ok" in
2737285612Sdelphij yes)
2738181834Sroberto    ntp_libparse=yes
2739181834Sroberto    ntp_refclock=yes
2740285612Sdelphij    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2741285612Sdelphij    ;;
2742285612Sdelphijesac
2743285612SdelphijAC_MSG_RESULT([$ntp_ok])
2744181834Srobertocase "$ntp_ok$ntp_canparse" in
2745181834Sroberto yesno)
2746200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2747181834Srobertoesac
2748181834Sroberto
2749200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2750285612SdelphijAC_ARG_ENABLE(
2751285612Sdelphij    [HOPF6021],
2752285612Sdelphij    [AS_HELP_STRING(
2753285612Sdelphij	[--enable-HOPF6021],
2754285612Sdelphij	[s HOPF 6021 clock]
2755285612Sdelphij    )],
2756285612Sdelphij    [ntp_ok=$enableval],
2757285612Sdelphij    [ntp_ok=$ntp_eapc]
2758285612Sdelphij)
2759285612Sdelphijcase "$ntp_ok" in
2760285612Sdelphij yes)
2761181834Sroberto    ntp_libparse=yes
2762181834Sroberto    ntp_refclock=yes
2763285612Sdelphij    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2764285612Sdelphij    ;;
2765285612Sdelphijesac
2766285612SdelphijAC_MSG_RESULT([$ntp_ok])
2767181834Srobertocase "$ntp_ok$ntp_canparse" in
2768181834Sroberto yesno)
2769200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2770181834Srobertoesac
2771181834Sroberto
2772200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2773285612SdelphijAC_ARG_ENABLE(
2774285612Sdelphij    [MEINBERG],
2775285612Sdelphij    [AS_HELP_STRING(
2776285612Sdelphij	[--enable-MEINBERG],
2777285612Sdelphij	[s Meinberg clocks]
2778285612Sdelphij    )],
2779285612Sdelphij    [ntp_ok=$enableval],
2780285612Sdelphij    [ntp_ok=$ntp_eapc]
2781285612Sdelphij)
2782285612Sdelphijcase "$ntp_ok" in
2783285612Sdelphij yes)
2784181834Sroberto    ntp_libparse=yes
2785181834Sroberto    ntp_refclock=yes
2786285612Sdelphij    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2787285612Sdelphij    ;;
2788285612Sdelphijesac
2789285612SdelphijAC_MSG_RESULT([$ntp_ok])
2790181834Srobertocase "$ntp_ok$ntp_canparse" in
2791181834Sroberto yesno)
2792200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2793181834Srobertoesac
2794181834Sroberto
2795200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2796285612SdelphijAC_ARG_ENABLE(
2797285612Sdelphij    [RAWDCF],
2798285612Sdelphij    [AS_HELP_STRING(
2799285612Sdelphij	[--enable-RAWDCF],
2800285612Sdelphij	[s DCF77 raw time code]
2801285612Sdelphij    )],
2802285612Sdelphij    [ntp_ok=$enableval],
2803285612Sdelphij    [ntp_ok=$ntp_eapc]
2804285612Sdelphij)
2805285612Sdelphijcase "$ntp_ok" in
2806285612Sdelphij yes)
2807181834Sroberto    ntp_libparse=yes
2808181834Sroberto    ntp_parseutil=yes
2809181834Sroberto    ntp_refclock=yes
2810181834Sroberto    ntp_rawdcf=yes
2811285612Sdelphij    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2812285612Sdelphij    ;;
2813285612Sdelphijesac
2814285612SdelphijAC_MSG_RESULT([$ntp_ok])
2815181834Srobertocase "$ntp_ok$ntp_canparse" in
2816181834Sroberto yesno)
2817285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2818181834Srobertoesac
2819181834Sroberto
2820181834Srobertocase "$ntp_rawdcf" in
2821181834Sroberto yes)
2822200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2823285612Sdelphij	[ntp_cv_rawdcf_parity],
2824285612Sdelphij	[
2825285612Sdelphij	    ans=no
2826285612Sdelphij	    case "$host" in
2827285612Sdelphij	     *-*-*linux*)
2828285612Sdelphij		ans=yes
2829285612Sdelphij		;;
2830285612Sdelphij	    esac
2831285612Sdelphij	    ntp_cv_rawdcf_parity=$ans
2832285612Sdelphij	]
2833285612Sdelphij    )
2834285612Sdelphij    case "$ntp_cv_rawdcf_parity" in
2835285612Sdelphij     yes)
2836285612Sdelphij	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2837285612Sdelphij	    [Should we not IGNPAR (Linux)?]) ;;
2838181834Sroberto    esac
2839181834Srobertoesac
2840181834Sroberto
2841200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
2842285612SdelphijAC_ARG_ENABLE(
2843285612Sdelphij    [RCC8000],
2844285612Sdelphij    [AS_HELP_STRING(
2845285612Sdelphij	[--enable-RCC8000],
2846285612Sdelphij	[s RCC 8000 clock]
2847285612Sdelphij    )],
2848285612Sdelphij    [ntp_ok=$enableval],
2849285612Sdelphij    [ntp_ok=$ntp_eapc]
2850285612Sdelphij)
2851285612Sdelphijcase "$ntp_ok" in
2852285612Sdelphij yes)
2853181834Sroberto    ntp_libparse=yes
2854181834Sroberto    ntp_refclock=yes
2855285612Sdelphij    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2856285612Sdelphij    ;;
2857285612Sdelphijesac
2858285612SdelphijAC_MSG_RESULT([$ntp_ok])
2859181834Srobertocase "$ntp_ok$ntp_canparse" in
2860181834Sroberto yesno)
2861285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2862181834Srobertoesac
2863181834Sroberto
2864200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
2865285612SdelphijAC_ARG_ENABLE(
2866285612Sdelphij    [SCHMID],
2867285612Sdelphij    [AS_HELP_STRING(
2868285612Sdelphij	[--enable-SCHMID ],
2869285612Sdelphij	[s Schmid DCF77 clock]
2870285612Sdelphij    )],
2871285612Sdelphij    [ntp_ok=$enableval],
2872285612Sdelphij    [ntp_ok=$ntp_eapc]
2873285612Sdelphij)
2874285612Sdelphijcase "$ntp_ok" in
2875285612Sdelphij yes)
2876181834Sroberto    ntp_libparse=yes
2877181834Sroberto    ntp_refclock=yes
2878285612Sdelphij    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2879285612Sdelphij    ;;
2880285612Sdelphijesac
2881285612SdelphijAC_MSG_RESULT([$ntp_ok])
2882181834Srobertocase "$ntp_ok$ntp_canparse" in
2883181834Sroberto yesno)
2884285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2885181834Srobertoesac
2886181834Sroberto
2887200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2888285612SdelphijAC_ARG_ENABLE(
2889285612Sdelphij    [TRIMTAIP],
2890285612Sdelphij    [AS_HELP_STRING(
2891285612Sdelphij	[--enable-TRIMTAIP],
2892285612Sdelphij	[s Trimble GPS receiver/TAIP protocol]
2893285612Sdelphij    )],
2894285612Sdelphij    [ntp_ok=$enableval],
2895285612Sdelphij    [ntp_ok=$ntp_eapc]
2896285612Sdelphij)
2897285612Sdelphijcase "$ntp_ok" in
2898285612Sdelphij yes)
2899181834Sroberto    ntp_libparse=yes
2900181834Sroberto    ntp_refclock=yes
2901285612Sdelphij    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2902285612Sdelphij	[Trimble GPS receiver/TAIP protocol])
2903285612Sdelphij    ;;
2904285612Sdelphijesac
2905285612SdelphijAC_MSG_RESULT([$ntp_ok])
2906181834Srobertocase "$ntp_ok$ntp_canparse" in
2907181834Sroberto yesno)
2908285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2909181834Srobertoesac
2910181834Sroberto
2911200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2912285612SdelphijAC_ARG_ENABLE(
2913285612Sdelphij    [TRIMTSIP],
2914285612Sdelphij    [AS_HELP_STRING(
2915285612Sdelphij	[--enable-TRIMTSIP],
2916285612Sdelphij	[s Trimble GPS receiver/TSIP protocol]
2917285612Sdelphij    )],
2918285612Sdelphij    [ntp_ok=$enableval],
2919285612Sdelphij    [ntp_ok=$ntp_eapc]
2920285612Sdelphij)
2921285612Sdelphijcase "$ntp_ok" in
2922285612Sdelphij yes)
2923181834Sroberto    ntp_libparse=yes
2924181834Sroberto    ntp_refclock=yes
2925285612Sdelphij    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2926285612Sdelphij	[Trimble GPS receiver/TSIP protocol])
2927285612Sdelphij    ;;
2928285612Sdelphijesac
2929285612SdelphijAC_MSG_RESULT([$ntp_ok])
2930181834Srobertocase "$ntp_ok$ntp_canparse" in
2931181834Sroberto yesno)
2932285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2933181834Srobertoesac
2934181834Sroberto
2935200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
2936285612SdelphijAC_ARG_ENABLE(
2937285612Sdelphij    [WHARTON],
2938285612Sdelphij    [AS_HELP_STRING(
2939285612Sdelphij	[--enable-WHARTON],
2940285612Sdelphij	[s WHARTON 400A Series clock]
2941285612Sdelphij    )],
2942285612Sdelphij    [ntp_ok=$enableval],
2943285612Sdelphij    [ntp_ok=$ntp_eapc]
2944285612Sdelphij)
2945285612Sdelphijcase "$ntp_ok" in
2946285612Sdelphij yes)
2947181834Sroberto    ntp_libparse=yes
2948181834Sroberto    ntp_refclock=yes
2949285612Sdelphij    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2950285612Sdelphij    ;;
2951285612Sdelphijesac
2952285612SdelphijAC_MSG_RESULT([$ntp_ok])
2953181834Srobertocase "$ntp_ok$ntp_canparse" in
2954181834Sroberto yesno)
2955285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2956285612Sdelphijesac
2957285612Sdelphij
2958285612SdelphijAC_MSG_CHECKING([VARITEXT clock])
2959285612SdelphijAC_ARG_ENABLE(
2960285612Sdelphij    [VARITEXT],
2961285612Sdelphij    [AS_HELP_STRING(
2962285612Sdelphij	[--enable-VARITEXT],
2963285612Sdelphij	[s VARITEXT clock]
2964285612Sdelphij    )],
2965285612Sdelphij    [ntp_ok=$enableval],
2966285612Sdelphij    [ntp_ok=$ntp_eapc]
2967285612Sdelphij)
2968285612Sdelphijcase "$ntp_ok" in
2969285612Sdelphij yes)
2970285612Sdelphij    ntp_libparse=yes
2971285612Sdelphij    ntp_refclock=yes
2972285612Sdelphij    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2973181834Sroberto    ;;
2974181834Srobertoesac
2975285612SdelphijAC_MSG_RESULT([$ntp_ok])
2976285612Sdelphijcase "$ntp_ok$ntp_canparse" in
2977285612Sdelphij yesno)
2978285612Sdelphij    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2979285612Sdelphijesac
2980181834Sroberto
2981285612SdelphijAC_MSG_CHECKING(SEL240X clock)
2982285612SdelphijAC_ARG_ENABLE(SEL240X,
2983285612Sdelphij    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2984181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2985181834Srobertoif test "$ntp_ok" = "yes"; then
2986181834Sroberto    ntp_libparse=yes
2987181834Sroberto    ntp_refclock=yes
2988285612Sdelphij    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2989181834Srobertofi
2990181834SrobertoAC_MSG_RESULT($ntp_ok)
2991181834Srobertocase "$ntp_ok$ntp_canparse" in
2992181834Sroberto yesno)
2993285612Sdelphij    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2994181834Sroberto    ;;
2995181834Srobertoesac
2996285612Sdelphij
2997285612SdelphijAC_SUBST([LIBPARSE])
2998285612SdelphijAC_SUBST([MAKE_LIBPARSE])
2999285612SdelphijAC_SUBST([MAKE_LIBPARSE_KERNEL])
3000285612SdelphijAC_SUBST([MAKE_CHECK_Y2K])
3001285612Sdelphij
3002200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3003181834Srobertoans=no
3004181834Srobertocase "$ntp_libparse" in
3005181834Sroberto yes)
3006181834Sroberto    ans=yes
3007285612Sdelphij    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3008181834Sroberto    LIBPARSE=../libparse/libparse.a
3009181834Sroberto    MAKE_LIBPARSE=libparse.a
3010181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3011181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3012181834Srobertoesac
3013200576SrobertoAC_MSG_RESULT([$ans])
3014181834Sroberto
3015285612SdelphijNTP_OPENSSL
3016181834Sroberto
3017338531SdelphijAC_MSG_CHECKING([if we want to enable CMAC support])
3018338531Sdelphijcase "$ac_cv_header_openssl_cmac_h" in
3019338531Sdelphij yes)
3020338531Sdelphij    AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?])
3021338531Sdelphij    ans="yes"
3022338531Sdelphij    ;;
3023338531Sdelphij *) ans="no"
3024338531Sdelphij    ;;
3025338531Sdelphijesac
3026338531SdelphijAC_MSG_RESULT([$ans])
3027338531Sdelphij
3028285612SdelphijNTP_CRYPTO_RAND
3029181834Sroberto
3030285612Sdelphij# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3031285612SdelphijAC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3032285612SdelphijAC_ARG_ENABLE(
3033285612Sdelphij    [autokey],
3034285612Sdelphij    AS_HELP_STRING(
3035285612Sdelphij	[--enable-autokey],
3036285612Sdelphij	[+ support NTP Autokey protocol]
3037285612Sdelphij	),
3038285612Sdelphij    [ntp_autokey=$enableval],
3039285612Sdelphij    [ntp_autokey=$ntp_openssl]
3040285612Sdelphij)
3041285612Sdelphijcase "$ntp_autokey" in
3042285612Sdelphij no)
3043181834Sroberto    ;;
3044285612Sdelphij *)
3045285612Sdelphij    case "$ntp_openssl" in
3046181834Sroberto     no)
3047285612Sdelphij	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3048285612Sdelphij	ntp_autokey=no
3049181834Sroberto	;;
3050285612Sdelphij     *)
3051285612Sdelphij	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3052285612Sdelphij	ntp_autokey=yes
3053181834Sroberto	;;
3054181834Sroberto    esac
3055181834Sroberto    ;;
3056181834Srobertoesac
3057285612SdelphijAC_MSG_RESULT([$ntp_autokey])
3058181834Sroberto
3059285612SdelphijAC_SUBST([MAKE_CHECK_LAYOUT])
3060200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3061181834Srobertocase "$cross_compiling$PATH_PERL" in
3062181834Sroberto no/*)
3063181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3064181834Sroberto    ans=yes
3065181834Sroberto    ;;
3066181834Sroberto *)
3067181834Sroberto    ans=no
3068181834Sroberto    ;;
3069181834Srobertoesac
3070200576SrobertoAC_MSG_RESULT([$ans])
3071181834Sroberto
3072285612SdelphijAC_SUBST([TESTDCF])
3073285612SdelphijAC_SUBST([DCFD])
3074200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3075181834Srobertoans=no
3076285612Sdelphijcase "$ntp_parseutil" in
3077285612Sdelphij yes)
3078181834Sroberto    case "$host" in
3079200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3080181834Sroberto	ans="dcfd testdcf"
3081181834Sroberto	DCFD=dcfd
3082285612Sdelphij	TESTDCF=testdcf
3083181834Sroberto    esac
3084285612Sdelphij    ;;
3085285612Sdelphijesac
3086200576SrobertoAC_MSG_RESULT([$ans])
3087181834Sroberto
3088285612SdelphijAC_SUBST([MAKE_PARSEKMODULE])
3089200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3090181834Srobertoans=no
3091181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3092181834Sroberto yesyes)
3093181834Sroberto    case "$host" in
3094181834Sroberto     sparc-*-sunos4*)
3095285612Sdelphij        case "$ntp_cv_var_kernel_pll" in
3096181834Sroberto	yes)
3097285612Sdelphij	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3098181834Sroberto	    ;;
3099181834Sroberto	esac
3100181834Sroberto	ans=parsestreams
3101181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3102181834Sroberto	;;
3103181834Sroberto     sparc-*-solaris2*)
3104181834Sroberto	ans=parsesolaris
3105181834Sroberto	MAKE_PARSEKMODULE=parse
3106285612Sdelphij	AC_CHECK_HEADERS([strings.h])
3107181834Sroberto	;;
3108181834Sroberto    esac
3109181834Sroberto    ;;
3110181834Srobertoesac
3111200576SrobertoAC_MSG_RESULT([$ans])
3112181834Sroberto
3113200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3114285612Sdelphijcase "$ntp_refclock" in
3115285612Sdelphij yes)
3116285612Sdelphij    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3117285612Sdelphij    ;;
3118285612Sdelphijesac
3119181834SrobertoAC_MSG_RESULT($ntp_refclock)
3120181834Sroberto
3121285612Sdelphijdnl Things that can be made in clockstuff
3122285612SdelphijAC_SUBST([PROPDELAY], [propdelay])
3123285612SdelphijAC_SUBST([CHUTEST]) dnl needs work to compile
3124181834Sroberto
3125285612SdelphijAC_SUBST([MAKE_ADJTIMED])
3126285612SdelphijAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3127181834Srobertocase "$host" in
3128181834Sroberto *-*-hpux[[56789]]*)
3129181834Sroberto    ans=yes
3130181834Sroberto    ;;
3131181834Sroberto *) ans=no
3132181834Sroberto    ;;
3133181834Srobertoesac
3134285612Sdelphijcase "$ans" in
3135285612Sdelphij yes)
3136181834Sroberto    MAKE_ADJTIMED=adjtimed
3137285612Sdelphij    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3138285612Sdelphij	[Do we need HPUX adjtime() library support?])
3139285612Sdelphij    ;;
3140285612Sdelphij *) ADJTIMED_DB=
3141285612Sdelphij    ADJTIMED_DL=
3142285612Sdelphij    ADJTIMED_DS=
3143285612Sdelphij    ADJTIMED_MS=
3144285612Sdelphij    ;;
3145285612Sdelphijesac
3146200576SrobertoAC_MSG_RESULT([$ans])
3147181834Sroberto
3148200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3149181834Srobertocase "$host" in
3150181834Sroberto *-*-qnx*)
3151181834Sroberto    ans=yes
3152181834Sroberto    ;;
3153181834Sroberto *) ans=no
3154181834Sroberto    ;;
3155181834Srobertoesac
3156285612Sdelphijcase "$ans" in
3157285612Sdelphij yes)
3158285612Sdelphij    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3159285612Sdelphij	[Do we need the qnx adjtime call?])
3160285612Sdelphij    ;;
3161285612Sdelphijesac
3162200576SrobertoAC_MSG_RESULT([$ans])
3163181834Sroberto
3164200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3165181834Sroberto
3166200576Sroberto#  the default is to enable it if the system has the capability
3167200576Sroberto
3168200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3169200576Sroberto *yes*)
3170200576Sroberto    ans=yes
3171200576Sroberto    ;;
3172200576Sroberto *) ans=no
3173285612Sdelphij    ;;
3174181834Srobertoesac
3175181834Sroberto
3176200576Srobertocase "$host" in
3177200576Sroberto *-*-domainos)	# Won't be found...
3178200576Sroberto    ans=no
3179200576Sroberto    ;;
3180200576Sroberto *-*-hpux*)
3181200576Sroberto    #ans=no
3182200576Sroberto    ;;
3183200576Sroberto *-*-irix[[456]]*)
3184200576Sroberto    ans=no
3185200576Sroberto    ;;
3186200576Sroberto *-*-*linux*)
3187200576Sroberto    ans=no
3188200576Sroberto    ;;
3189200576Sroberto *-*-winnt3.5)
3190200576Sroberto    ans=no
3191200576Sroberto    ;;
3192200576Sroberto *-*-unicosmp*)
3193200576Sroberto    ans=no
3194200576Sroberto    ;;
3195200576Srobertoesac
3196200576Sroberto
3197200576Sroberto# --enable-kmem / --disable-kmem controls if present
3198200576SrobertoAC_ARG_ENABLE(
3199200576Sroberto    [kmem],
3200285612Sdelphij    [AS_HELP_STRING(
3201200576Sroberto	[--enable-kmem],
3202200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3203285612Sdelphij    )],
3204200576Sroberto    [ans=$enableval]
3205200576Sroberto)
3206200576Sroberto
3207200576SrobertoAC_MSG_RESULT([$ans])
3208200576Sroberto
3209200576Srobertocase "$ans" in
3210200576Sroberto yes)
3211200576Sroberto    can_kmem=yes
3212200576Sroberto    ;;
3213285612Sdelphij *)
3214200576Sroberto    can_kmem=no
3215285612Sdelphij    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3216200576Srobertoesac
3217200576Sroberto
3218200576Sroberto
3219200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3220200576Sroberto
3221200576Sroberto# target-dependent defaults
3222200576Sroberto
3223200576Srobertocase "$host" in
3224200576Sroberto i386-sequent-ptx*)
3225200576Sroberto    ans=no
3226200576Sroberto    ;;
3227200576Sroberto i386-unknown-osf1*)
3228200576Sroberto    ans=yes
3229200576Sroberto    ;;
3230200576Sroberto mips-sgi-irix[[456]]*)
3231200576Sroberto    ans=yes
3232200576Sroberto    ;;
3233200576Sroberto *-fujitsu-uxp*)
3234200576Sroberto    ans=yes
3235200576Sroberto    ;;
3236285612Sdelphij *-ibm-aix[[4-9]]*)
3237285612Sdelphij    # XXX only verified thru AIX6.
3238200576Sroberto    ans=yes
3239200576Sroberto    ;;
3240200576Sroberto *-*-*linux*)
3241200576Sroberto    ans=yes
3242200576Sroberto    ;;
3243200576Sroberto *-*-solaris2.[[01]])
3244200576Sroberto    ans=no
3245200576Sroberto    ;;
3246200576Sroberto *-*-solaris2*)
3247200576Sroberto    ans=yes
3248200576Sroberto    ;;
3249200576Sroberto *-*-unicosmp*)
3250200576Sroberto    ans=yes
3251200576Sroberto    ;;
3252200576Sroberto *) ans=no
3253285612Sdelphij    ;;
3254200576Srobertoesac
3255200576Sroberto
3256200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3257200576Sroberto# override the default
3258285612SdelphijAC_ARG_ENABLE(
3259285612Sdelphij    [accurate-adjtime],
3260285612Sdelphij    [AS_HELP_STRING(
3261285612Sdelphij	[--enable-accurate-adjtime],
3262285612Sdelphij	[s the adjtime() call is accurate]
3263285612Sdelphij    )],
3264285612Sdelphij    [ans=$enableval]
3265200576Sroberto)
3266200576Sroberto
3267200576SrobertoAC_MSG_RESULT([$ans])
3268200576Sroberto
3269200576Srobertocase "$ans" in
3270285612Sdelphij yes)
3271285612Sdelphij    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3272200576Sroberto    adjtime_is_accurate=yes
3273200576Sroberto    ;;
3274200576Sroberto *)
3275200576Sroberto    adjtime_is_accurate=no
3276285612Sdelphij    ;;
3277181834Srobertoesac
3278181834Sroberto
3279285612SdelphijAC_CACHE_CHECK(
3280285612Sdelphij    [the name of 'tick' in the kernel],
3281285612Sdelphij    [ntp_cv_nlist_tick],
3282285612Sdelphij    [
3283285612Sdelphij	ans=_tick
3284285612Sdelphij	case "$host" in
3285285612Sdelphij	 m68*-hp-hpux*) # HP9000/300?
3286285612Sdelphij	    ans=_old_tick
3287285612Sdelphij	    ;;
3288285612Sdelphij	 *-apple-aux[[23]]*)
3289285612Sdelphij	    ans=tick
3290285612Sdelphij	    ;;
3291285612Sdelphij	 *-hp-hpux*)
3292285612Sdelphij	    ans=old_tick
3293285612Sdelphij	    ;;
3294285612Sdelphij	 *-ibm-aix[[3-9]]*)
3295285612Sdelphij	    # XXX only verified thru AIX6.
3296285612Sdelphij	    ans=no
3297285612Sdelphij	    ;;
3298285612Sdelphij	 *-*-mpeix*)
3299285612Sdelphij	    ans=no
3300285612Sdelphij	    ;;
3301285612Sdelphij	 *-*-ptx*)
3302285612Sdelphij	    ans=tick
3303285612Sdelphij	    ;;
3304285612Sdelphij	 *-*-sco3.2v[[45]]*)
3305285612Sdelphij	    ans=no
3306285612Sdelphij	    ;;
3307285612Sdelphij	 *-*-solaris2*)
3308285612Sdelphij	    ans=nsec_per_tick
3309285612Sdelphij	    ;;
3310285612Sdelphij	 *-*-sysv4*)
3311285612Sdelphij	    ans=tick
3312285612Sdelphij	    ;;
3313285612Sdelphij	esac
3314285612Sdelphij	ntp_cv_nlist_tick=$ans
3315285612Sdelphij    ]
3316285612Sdelphij)
3317285612Sdelphijcase "$ntp_cv_nlist_tick" in
3318285612Sdelphij ''|no)
3319285612Sdelphij    ;;	# HMS: I think we can only get 'no' here...
3320285612Sdelphij *)
3321285612Sdelphij    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3322285612Sdelphij	[What is the name of TICK in the kernel?])
3323181834Srobertoesac
3324285612Sdelphij
3325285612SdelphijAC_CACHE_CHECK(
3326285612Sdelphij    [for the units of 'tick'],
3327285612Sdelphij    [ntp_cv_tick_nano],
3328285612Sdelphij    [
3329285612Sdelphij	ans=usec
3330285612Sdelphij	case "$host" in
3331285612Sdelphij	 *-*-solaris2*)
3332285612Sdelphij	    ans=nsec
3333285612Sdelphij	    ;;
3334285612Sdelphij	esac
3335285612Sdelphij	ntp_cv_tick_nano=$ans
3336285612Sdelphij    ]
3337285612Sdelphij)
3338285612Sdelphijcase "$ntp_cv_tick_nano" in
3339181834Sroberto nsec)
3340285612Sdelphij    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3341181834Srobertoesac
3342285612Sdelphij
3343285612SdelphijAC_CACHE_CHECK(
3344285612Sdelphij    [the name of 'tickadj' in the kernel],
3345285612Sdelphij    [ntp_cv_nlist_tickadj],
3346285612Sdelphij    [
3347285612Sdelphij	ans=_tickadj
3348285612Sdelphij	case "$host" in
3349285612Sdelphij	 m68*-hp-hpux*) # HP9000/300?
3350285612Sdelphij	    ans=_tickadj
3351285612Sdelphij	    ;;
3352285612Sdelphij	 *-apple-aux[[23]]*)
3353285612Sdelphij	    ans=tickadj
3354285612Sdelphij	    ;;
3355285612Sdelphij	 *-hp-hpux10*)
3356285612Sdelphij	    ans=no
3357285612Sdelphij	    ;;
3358285612Sdelphij	 *-hp-hpux9*)
3359285612Sdelphij	    ans=no
3360285612Sdelphij	    ;;
3361285612Sdelphij	 *-hp-hpux*)
3362285612Sdelphij	    ans=tickadj
3363285612Sdelphij	    ;;
3364285612Sdelphij	 *-*-aix*)
3365285612Sdelphij	    ans=tickadj
3366285612Sdelphij	    ;;
3367285612Sdelphij	 *-*-mpeix*)
3368285612Sdelphij	    ans=no
3369285612Sdelphij	    ;;
3370285612Sdelphij	 *-*-ptx*)
3371285612Sdelphij	    ans=tickadj
3372285612Sdelphij	    ;;
3373285612Sdelphij	 *-*-sco3.2v4*)
3374285612Sdelphij	    ans=no
3375285612Sdelphij	    ;;
3376285612Sdelphij	 *-*-sco3.2v5.0*)
3377285612Sdelphij	    ans=clock_drift
3378285612Sdelphij	    ;;
3379285612Sdelphij	 *-*-solaris2*)
3380285612Sdelphij	    ans=no	# hrestime_adj
3381285612Sdelphij	    ;;
3382285612Sdelphij	 *-*-sysv4*)
3383285612Sdelphij	    ans=tickadj
3384285612Sdelphij	    ;;
3385285612Sdelphij	esac
3386285612Sdelphij	ntp_cv_nlist_tickadj=$ans
3387285612Sdelphij    ]
3388285612Sdelphij)
3389285612Sdelphijcase "$ntp_cv_nlist_tickadj" in
3390285612Sdelphij ''|no)
3391285612Sdelphij    ;;	# HMS: I think we can only get 'no' here...
3392285612Sdelphij *)
3393285612Sdelphij    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3394285612Sdelphij	[What is the name of TICKADJ in the kernel?])
3395181834Srobertoesac
3396285612Sdelphij
3397285612SdelphijAC_CACHE_CHECK(
3398285612Sdelphij    [for the units of 'tickadj'],
3399285612Sdelphij    [ntp_cv_tickadj_nano],
3400285612Sdelphij    [
3401285612Sdelphij	ans=usec
3402285612Sdelphij	case "$host" in
3403285612Sdelphij	 *-*-solaris2*)
3404285612Sdelphij	    ans=nsec
3405285612Sdelphij	    ;;
3406285612Sdelphij	esac
3407285612Sdelphij	ntp_cv_tickadj_nano=$ans
3408285612Sdelphij    ]
3409285612Sdelphij)
3410285612Sdelphijcase "$ntp_cv_tickadj_nano" in
3411181834Sroberto nsec)
3412285612Sdelphij    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3413181834Srobertoesac
3414285612Sdelphij
3415285612SdelphijAC_CACHE_CHECK(
3416285612Sdelphij    [half-heartedly for 'dosynctodr' in the kernel],
3417285612Sdelphij    [ntp_cv_nlist_dosynctodr],
3418285612Sdelphij    [
3419285612Sdelphij	case "$host" in
3420285612Sdelphij	 *-apple-aux[[23]]*)
3421285612Sdelphij	    ans=no
3422285612Sdelphij	    ;;
3423285612Sdelphij	 *-sni-sysv*)
3424285612Sdelphij	    ans=dosynctodr
3425285612Sdelphij	    ;;
3426285612Sdelphij	 *-stratus-vos)
3427285612Sdelphij	    ans=no
3428285612Sdelphij	    ;;
3429285612Sdelphij	 *-*-aix*)
3430285612Sdelphij	    ans=dosynctodr
3431285612Sdelphij	    ;;
3432285612Sdelphij	 *-*-hpux*)
3433285612Sdelphij	    ans=no
3434285612Sdelphij	    ;;
3435285612Sdelphij	 *-*-mpeix*)
3436285612Sdelphij	    ans=no
3437285612Sdelphij	    ;;
3438285612Sdelphij	 *-*-nextstep*)
3439285612Sdelphij	    ans=_dosynctodr
3440285612Sdelphij	    ;;
3441285612Sdelphij	 *-*-ptx*)
3442285612Sdelphij	    ans=doresettodr
3443285612Sdelphij	    ;;
3444285612Sdelphij	 *-*-sco3.2v4*)
3445285612Sdelphij	    ans=no
3446285612Sdelphij	    ;;
3447285612Sdelphij	 *-*-sco3.2v5*)
3448285612Sdelphij	    ans=track_rtc
3449285612Sdelphij	    ;;
3450285612Sdelphij	 *-*-solaris2*)
3451285612Sdelphij	    ans=dosynctodr
3452285612Sdelphij	    ;;
3453285612Sdelphij	 *-*-sysv4*)
3454285612Sdelphij	    ans=doresettodr
3455285612Sdelphij	    ;;
3456285612Sdelphij	 *)
3457285612Sdelphij	    ans=_dosynctodr
3458285612Sdelphij	    ;;
3459285612Sdelphij	esac
3460285612Sdelphij	ntp_cv_nlist_dosynctodr=$ans
3461285612Sdelphij    ]
3462285612Sdelphij)
3463285612Sdelphijcase "$ntp_cv_nlist_dosynctodr" in
3464285612Sdelphij no)
3465181834Sroberto    ;;
3466181834Sroberto *)
3467285612Sdelphij    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3468285612Sdelphij	[What is (probably) the name of DOSYNCTODR in the kernel?])
3469181834Sroberto    ;;
3470181834Srobertoesac
3471285612Sdelphij
3472285612SdelphijAC_CACHE_CHECK(
3473285612Sdelphij    [half-heartedly for 'noprintf' in the kernel],
3474285612Sdelphij    [ntp_cv_nlist_noprintf],
3475285612Sdelphij    [
3476285612Sdelphij	case "$host" in
3477285612Sdelphij	 *-apple-aux[[23]]*)
3478285612Sdelphij	    ans=no
3479285612Sdelphij	    ;;
3480285612Sdelphij	 *-sni-sysv*)
3481285612Sdelphij	    ans=noprintf
3482285612Sdelphij	    ;;
3483285612Sdelphij	 *-stratus-vos)
3484285612Sdelphij	    ans=no
3485285612Sdelphij	    ;;
3486285612Sdelphij	 *-*-aix*)
3487285612Sdelphij	    ans=noprintf
3488285612Sdelphij	    ;;
3489285612Sdelphij	 *-*-hpux*)
3490285612Sdelphij	    ans=no
3491285612Sdelphij	    ;;
3492285612Sdelphij	 *-*-mpeix*)
3493285612Sdelphij	    ans=no
3494285612Sdelphij	    ;;
3495285612Sdelphij	 *-*-ptx*)
3496285612Sdelphij	    ans=noprintf
3497285612Sdelphij	    ;;
3498285612Sdelphij	 *-*-nextstep*)
3499285612Sdelphij	    ans=_noprintf
3500285612Sdelphij	    ;;
3501285612Sdelphij	 *-*-solaris2*)
3502285612Sdelphij	    ans=noprintf
3503285612Sdelphij	    ;;
3504285612Sdelphij	 *-*-sysv4*)
3505285612Sdelphij	    ans=noprintf
3506285612Sdelphij	    ;;
3507285612Sdelphij	 *)
3508285612Sdelphij	    ans=_noprintf
3509285612Sdelphij	    ;;
3510285612Sdelphij	esac
3511285612Sdelphij	ntp_cv_nlist_noprintf=$ans
3512285612Sdelphij    ]
3513285612Sdelphij)
3514285612Sdelphijcase "$ntp_cv_nlist_noprintf" in
3515285612Sdelphij no)
3516181834Sroberto    ;;
3517181834Sroberto *)
3518285612Sdelphij    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3519285612Sdelphij	[What is (probably) the name of NOPRINTF in the kernel?])
3520181834Sroberto    ;;
3521181834Srobertoesac
3522181834Sroberto
3523181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3524181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3525181834Sroberto
3526285612Sdelphijdnl	tick		tickadj
3527181834Srobertodnl	10000		80	    Unixware
3528181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3529181834Srobertodnl	10000		150	    sgi IRIX
3530181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3531181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3532181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3533181834Srobertodnl	txc.tick	1	    Linux
3534181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3535181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3536181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3537181834Sroberto
3538181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3539181834Sroberto
3540200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3541200576Sroberto
3542200576Sroberto# target-dependent default for tick
3543200576Sroberto
3544200576Srobertocase "$host" in
3545200576Sroberto *-*-pc-cygwin*)
3546200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3547200576Sroberto    ;;
3548200576Sroberto *-univel-sysv*)
3549200576Sroberto    ans=10000
3550200576Sroberto    ;;
3551200576Sroberto *-*-irix*)
3552200576Sroberto    ans=10000
3553200576Sroberto    ;;
3554200576Sroberto *-*-*linux*)
3555200576Sroberto    ans=txc.tick
3556200576Sroberto    ;;
3557200576Sroberto *-*-mpeix*)
3558200576Sroberto    ans=no
3559200576Sroberto    ;;
3560200576Sroberto *-*-winnt3.5)
3561200576Sroberto    ans='(every / 10)'
3562200576Sroberto    ;;
3563200576Sroberto *-*-unicosmp*)
3564200576Sroberto    ans=10000
3565200576Sroberto    ;;
3566200576Sroberto *)
3567200576Sroberto    ans='1000000L/hz'
3568200576Sroberto    ;;
3569200576Srobertoesac
3570200576Sroberto
3571200576SrobertoAC_ARG_ENABLE(
3572200576Sroberto    [tick],
3573285612Sdelphij    [AS_HELP_STRING(
3574200576Sroberto	[--enable-tick=VALUE],
3575200576Sroberto	[s force a value for 'tick']
3576285612Sdelphij    )],
3577200576Sroberto    [ans=$enableval]
3578200576Sroberto)
3579200576Sroberto
3580200576SrobertoAC_MSG_RESULT([$ans])
3581200576Sroberto
3582200576Srobertocase "$ans" in
3583285612Sdelphij ''|no)
3584285612Sdelphij    ;;	# HMS: I think we can only get 'no' here...
3585285612Sdelphij *)
3586285612Sdelphij    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3587285612Sdelphij	[Preset a value for 'tick'?])
3588181834Srobertoesac
3589181834Sroberto
3590200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3591200576Sroberto
3592200576Sroberto# target-specific default
3593200576Srobertoans='500/hz'
3594200576Srobertocase "$host" in
3595200576Sroberto *-fujitsu-uxp*)
3596200576Sroberto    case "$adjtime_is_accurate" in
3597200576Sroberto     yes)
3598285612Sdelphij	ans='tick/16'
3599200576Sroberto    esac
3600200576Sroberto    ;;
3601200576Sroberto *-univel-sysv*)
3602200576Sroberto    ans=80
3603200576Sroberto    ;;
3604200576Sroberto *-*-aix*)
3605200576Sroberto    case "$can_kmem" in
3606200576Sroberto     no)
3607200576Sroberto	ans=1000
3608285612Sdelphij	;;
3609200576Sroberto    esac
3610200576Sroberto    ;;
3611200576Sroberto *-*-domainos)	# Skippy: won't be found...
3612200576Sroberto    case "$can_kmem" in
3613200576Sroberto     no)
3614200576Sroberto	ans=668
3615285612Sdelphij	;;
3616200576Sroberto    esac
3617200576Sroberto    ;;
3618200576Sroberto *-*-hpux*)
3619200576Sroberto    case "$adjtime_is_accurate" in
3620200576Sroberto     yes)
3621200576Sroberto	ans='tick/16'
3622285612Sdelphij	;;
3623200576Sroberto    esac
3624200576Sroberto    ;;
3625200576Sroberto *-*-irix*)
3626200576Sroberto    ans=150
3627200576Sroberto    ;;
3628200576Sroberto *-*-mpeix*)
3629200576Sroberto    ans=no
3630200576Sroberto    ;;
3631200576Sroberto *-*-sco3.2v5.0*)
3632200576Sroberto    ans=10000L/hz
3633200576Sroberto    ;;
3634200576Sroberto *-*-winnt3.5)
3635200576Sroberto    ans=50
3636200576Sroberto    ;;
3637200576Sroberto *-*-unicosmp*)
3638200576Sroberto    ans=150
3639285612Sdelphij    ;;
3640200576Srobertoesac
3641200576Sroberto
3642200576SrobertoAC_ARG_ENABLE(
3643200576Sroberto    [tickadj],
3644285612Sdelphij    [AS_HELP_STRING(
3645285612Sdelphij	[--enable-tickadj=VALUE],
3646285612Sdelphij	[s force a value for 'tickadj']
3647285612Sdelphij    )],
3648200576Sroberto    [ans=$enableval]
3649200576Sroberto)
3650200576Sroberto
3651200576SrobertoAC_MSG_RESULT([$ans])
3652200576Sroberto
3653200576Srobertodefault_tickadj=$ans
3654200576Sroberto
3655200576Srobertocase "$default_tickadj" in
3656285612Sdelphij ''|no)
3657285612Sdelphij    ;;	# HMS: I think we can only get 'no' here...
3658285612Sdelphij *)
3659285612Sdelphij    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3660285612Sdelphij	[Preset a value for 'tickadj'?]) ;;
3661181834Srobertoesac
3662181834Sroberto
3663181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3664181834Sroberto# 1/100s (system tick). Sigh ...
3665181834Sroberto# Unfortunately, there is no easy way to know if particular release
3666181834Sroberto# has this "feature" or any obvious way to test for it.
3667181834Srobertocase "$host" in
3668285612Sdelphij mips-sni-sysv4*)
3669285612Sdelphij    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3670285612Sdelphij	[Do we want the ReliantUNIX clock hacks?])
3671181834Srobertoesac
3672181834Sroberto
3673181834Srobertocase "$host" in
3674285612Sdelphij *-*-sco3.2v5*)
3675285612Sdelphij    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3676181834Srobertoesac
3677181834Sroberto
3678285612Sdelphijntp_cv_make_tickadj=yes
3679200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3680181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3681200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3682285612Sdelphij    ntp_cv_make_tickadj=no
3683181834Sroberto    ;;
3684181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3685200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3686285612Sdelphij    ntp_cv_make_tickadj=no
3687181834Sroberto    ;;
3688181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3689200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3690285612Sdelphij    ntp_cv_make_tickadj=no
3691181834Sroberto    ;;
3692181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3693181834Sroberto    ;;
3694181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3695181834Sroberto    ;;
3696181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3697200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3698181834Sroberto    ;;
3699181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3700181834Sroberto    ;;
3701181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3702181834Sroberto    ;;
3703181834Sroberto *)		# Generally bogus.
3704200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3705181834Sroberto    ;;
3706181834Srobertoesac
3707181834Sroberto
3708181834SrobertoAC_SUBST(MAKE_NTPTIME)
3709200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3710181834Sroberto[case "$host" in
3711285612Sdelphij *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3712181834Sroberto     yesyes)
3713181834Sroberto	ans=yes
3714181834Sroberto	;;
3715181834Sroberto     *)
3716181834Sroberto	ans=no
3717181834Sroberto	;;
3718181834Sroberto    esac
3719181834Sroberto    ;;
3720181834Srobertoesac
3721181834Srobertoac_cv_make_ntptime=$ans])
3722181834Srobertocase "$ac_cv_make_ntptime" in
3723181834Sroberto yes)
3724181834Sroberto    MAKE_NTPTIME=ntptime
3725181834Sroberto    ;;
3726285612Sdelphij *)
3727285612Sdelphij    NTPTIME_DB=
3728285612Sdelphij    NTPTIME_DL=
3729285612Sdelphij    NTPTIME_DS=
3730285612Sdelphij    NTPTIME_MS=
3731285612Sdelphij    ;;
3732181834Srobertoesac
3733181834Sroberto
3734285612SdelphijAC_SUBST([MAKE_TICKADJ])
3735181834Srobertocase "$host" in
3736181834Sroberto mips-sni-sysv4*)
3737181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3738181834Sroberto    # Do not bother
3739285612Sdelphij    ntp_cv_make_tickadj=no
3740181834Sroberto    ;;
3741181834Sroberto *-*-irix*)
3742285612Sdelphij    ntp_cv_make_tickadj=no
3743181834Sroberto    ;;
3744181834Sroberto *-*-solaris2*)
3745181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3746181834Sroberto    case "$host" in
3747181834Sroberto     *-*-solaris2.1[[0-9]]*)
3748285612Sdelphij	ntp_cv_make_tickadj=no
3749181834Sroberto	;;
3750181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3751285612Sdelphij     *) ntp_cv_make_tickadj=no ;;
3752181834Sroberto    esac
3753181834Sroberto    ;;
3754181834Sroberto *-*-unicosmp*)
3755285612Sdelphij    ntp_cv_make_tickadj=no
3756181834Sroberto    ;;
3757181834Srobertoesac
3758200576Sroberto
3759200576Sroberto#
3760200576Sroberto# Despite all the above, we always make tickadj.  Setting
3761285612Sdelphij# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3762200576Sroberto# report that the configuration variable was cached.  It may
3763200576Sroberto# be better to simply remove the hunk above, I did not want
3764200576Sroberto# to remove it if there is hope it will be used again.
3765200576Sroberto#
3766285612SdelphijAS_UNSET([ntp_cv_make_tickadj])
3767200576Sroberto
3768285612SdelphijAC_CACHE_CHECK(
3769285612Sdelphij    [if we want and can make the tickadj utility],
3770285612Sdelphij    [ntp_cv_make_tickadj],
3771285612Sdelphij    [ntp_cv_make_tickadj=yes]
3772285612Sdelphij)
3773285612Sdelphijcase "$ntp_cv_make_tickadj" in
3774181834Sroberto yes)
3775181834Sroberto    MAKE_TICKADJ=tickadj
3776181834Sroberto    ;;
3777285612Sdelphij *)
3778285612Sdelphij    CALC_TICKADJ_DB=
3779285612Sdelphij    CALC_TICKADJ_DL=
3780285612Sdelphij    CALC_TICKADJ_DS=
3781285612Sdelphij    CALC_TICKADJ_MS=
3782285612Sdelphij    TICKADJ_DB=
3783285612Sdelphij    TICKADJ_DL=
3784285612Sdelphij    TICKADJ_DS=
3785285612Sdelphij    TICKADJ_MS=
3786285612Sdelphij    ;;
3787181834Srobertoesac
3788181834Sroberto
3789285612SdelphijAC_SUBST([MAKE_TIMETRIM])
3790285612SdelphijAC_CACHE_CHECK(
3791285612Sdelphij    [if we want and can make the timetrim utility],
3792285612Sdelphij    [ntp_cv_make_timetrim],
3793285612Sdelphij    [
3794285612Sdelphij	case "$host" in
3795285612Sdelphij	 *-*-irix*)
3796285612Sdelphij	    ntp_cv_make_timetrim=yes
3797285612Sdelphij	    ;;
3798285612Sdelphij	 *-*-unicosmp*)
3799285612Sdelphij	    ntp_cv_make_timetrim=yes
3800285612Sdelphij	    ;;
3801285612Sdelphij	 *)
3802285612Sdelphij	    ntp_cv_make_timetrim=no
3803285612Sdelphij	    ;;
3804285612Sdelphij	esac
3805285612Sdelphij    ]
3806285612Sdelphij)
3807285612Sdelphijcase "$ntp_cv_make_timetrim" in
3808181834Sroberto yes)
3809181834Sroberto    MAKE_TIMETRIM=timetrim
3810181834Sroberto    ;;
3811285612Sdelphij *) TIMETRIM_DB=
3812285612Sdelphij    TIMETRIM_DL=
3813285612Sdelphij    TIMETRIM_DS=
3814285612Sdelphij    TIMETRIM_MS=
3815285612Sdelphij    ;;
3816181834Srobertoesac
3817181834Sroberto
3818285612SdelphijAC_SUBST([MAKE_LIBNTPSIM])
3819285612SdelphijAC_SUBST([MAKE_NTPDSIM])
3820200576Sroberto
3821200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3822200576SrobertoAC_ARG_ENABLE(
3823200576Sroberto    [simulator],
3824285612Sdelphij    [AS_HELP_STRING(
3825200576Sroberto	[--enable-simulator],
3826200576Sroberto	[- build/install the NTPD simulator?]
3827285612Sdelphij    )],
3828285612Sdelphij    [ans=$enableval],
3829200576Sroberto    [ans=no]
3830200576Sroberto)
3831200576SrobertoAC_MSG_RESULT([$ans])
3832200576Srobertocase "$ans" in
3833181834Sroberto yes)
3834181834Sroberto    MAKE_NTPDSIM=ntpdsim
3835181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3836181834Sroberto    ;;
3837285612Sdelphij *)
3838285612Sdelphij    NTPDSIM_DB=
3839285612Sdelphij    NTPDSIM_DL=
3840285612Sdelphij    NTPDSIM_DS=
3841285612Sdelphij    NTPDSIM_MS=
3842285612Sdelphij    ;;
3843181834Srobertoesac
3844181834Sroberto
3845181834Srobertocase "$build" in
3846181834Sroberto $host)
3847181834Sroberto    ;;
3848181834Sroberto *) case "$host" in
3849181834Sroberto     *-*-vxworks*)
3850200576Sroberto	LDFLAGS="$LDFLAGS -r"
3851200576Sroberto	;;
3852181834Sroberto    esac
3853181834Sroberto    ;;
3854181834Srobertoesac
3855181834Sroberto
3856285612SdelphijNTP_WITHSNTP
3857200576Sroberto
3858285612SdelphijAC_MSG_CHECKING([if we want to build ntpsnmpd])
3859285612SdelphijAC_ARG_WITH(
3860285612Sdelphij    [ntpsnmpd],
3861285612Sdelphij    [AS_HELP_STRING(
3862285612Sdelphij	[--with-ntpsnmpd],
3863285612Sdelphij	[s Build ntpsnmpd MIB agent?]
3864285612Sdelphij    )],
3865285612Sdelphij    [ans=$withval],
3866285612Sdelphij    [
3867285612Sdelphij	case "$PATH_NET_SNMP_CONFIG" in
3868285612Sdelphij	 /*)	ans=yes ;;
3869285612Sdelphij	 *)	ans=no  ;;
3870285612Sdelphij	esac
3871285612Sdelphij    ]
3872285612Sdelphij)
3873285612SdelphijAC_MSG_RESULT([$ans])
3874285612Sdelphijcase "$ans" in
3875285612Sdelphij yes)
3876285612Sdelphij    case "$PATH_NET_SNMP_CONFIG" in
3877285612Sdelphij     /*)
3878285612Sdelphij	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3879285612Sdelphij	# Bug 2815.  This is a bit of a hack, but it works...
3880285612Sdelphij	case "$ntp_cv_net_snmp_version" in
3881285612Sdelphij	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3882285612Sdelphij		;;
3883285612Sdelphij	esac
3884285612Sdelphij	AC_SUBST([SNMP_LIBS])
3885285612Sdelphij	# HMS: we really want to separate CPPFLAGS and CFLAGS
3886285612Sdelphij	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3887285612Sdelphij	SNMP_CPPFLAGS=
3888285612Sdelphij	SNMP_CFLAGS=
3889285612Sdelphij	for i in $foo; do
3890285612Sdelphij	    case "$i" in
3891285612Sdelphij	     -D*|-U*|-I*)
3892285612Sdelphij		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3893285612Sdelphij		;;
3894285612Sdelphij	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3895285612Sdelphij		;;
3896285612Sdelphij	    esac
3897285612Sdelphij	done
3898285612Sdelphij	AC_SUBST([SNMP_CPPFLAGS])
3899285612Sdelphij	AC_SUBST([SNMP_CFLAGS])
3900285612Sdelphij
3901285612Sdelphij	save_CFLAGS=$CFLAGS
3902285612Sdelphij	save_CPPFLAGS=$CPPFLAGS
3903285612Sdelphij	save_LIBS=$LIBS
3904285612Sdelphij	CFLAGS=$SNMP_CFLAGS
3905285612Sdelphij	CPPFLAGS=$SNMP_CPPFLAGS
3906285612Sdelphij
3907285612Sdelphij	AC_CHECK_HEADER(
3908285612Sdelphij	    [net-snmp/net-snmp-config.h],
3909285612Sdelphij	    [MAKE_NTPSNMPD=ntpsnmpd],
3910285612Sdelphij	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3911285612Sdelphij	)
3912285612Sdelphij
3913285612Sdelphij	# Do this last, as we're messing up LIBS.
3914285612Sdelphij	# check -lnetsnmp for netsnmp_daemonize
3915285612Sdelphij	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3916285612Sdelphij	AC_CHECK_LIB(
3917285612Sdelphij	    [netsnmp],
3918285612Sdelphij	    [netsnmp_daemonize],
3919285612Sdelphij	    [ans=yes],
3920285612Sdelphij	    [ans=no]
3921285612Sdelphij	)
3922285612Sdelphij	case "$ans" in
3923285612Sdelphij	 no)
3924285612Sdelphij	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3925285612Sdelphij		[We need to provide netsnmp_daemonize()])
3926285612Sdelphij	esac
3927285612Sdelphij	
3928285612Sdelphij	CFLAGS=$save_CFLAGS
3929285612Sdelphij	AS_UNSET([save_CFLAGS])
3930285612Sdelphij	CPPFLAGS=$save_CPPFLAGS
3931285612Sdelphij	AS_UNSET([save_CPPFLAGS])
3932285612Sdelphij	LIBS=$save_LIBS
3933285612Sdelphij	AS_UNSET([save_LIBS])
3934285612Sdelphij	;;
3935285612Sdelphij     *) 
3936285612Sdelphij	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3937285612Sdelphij	;;
3938285612Sdelphij    esac
3939285612Sdelphij    ;;
3940285612Sdelphijesac
3941285612SdelphijAC_SUBST([MAKE_NTPSNMPD])
3942285612Sdelphij
3943285612Sdelphijcase "$MAKE_NTPSNMPD" in
3944285612Sdelphij '')
3945285612Sdelphij    NTPSNMPD_DB=
3946285612Sdelphij    NTPSNMPD_DL=
3947285612Sdelphij    NTPSNMPD_DS=
3948285612Sdelphij    NTPSNMPD_MS=
3949285612Sdelphij    ;;
3950285612Sdelphijesac
3951285612Sdelphij
3952200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3953200576Sroberto
3954200576Sroberto# target-specific defaults
3955200576Sroberto
3956200576Srobertocase "$host" in
3957200576Sroberto *-apple-aux[[23]]*)
3958200576Sroberto    ans=yes
3959200576Sroberto    ;;
3960200576Sroberto *-*-bsdi[[012]]*)
3961200576Sroberto    ans=no
3962200576Sroberto    ;;
3963200576Sroberto *-*-bsdi*)
3964200576Sroberto    ans=yes
3965200576Sroberto    ;;
3966200576Sroberto *-*-openvms*)	# HMS: won't be found
3967200576Sroberto    ans=yes
3968200576Sroberto    ;;
3969200576Sroberto *) ans=no
3970200576Sroberto    ;;
3971200576Srobertoesac
3972200576Sroberto
3973200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3974200576Sroberto
3975200576SrobertoAC_ARG_ENABLE(
3976200576Sroberto    [slew-always],
3977285612Sdelphij    [AS_HELP_STRING(
3978200576Sroberto	[--enable-slew-always],
3979200576Sroberto	[s always slew the time]
3980285612Sdelphij    )],
3981200576Sroberto    [ans=$enableval]
3982200576Sroberto)
3983200576Sroberto
3984200576SrobertoAC_MSG_RESULT([$ans])
3985200576Sroberto
3986200576Srobertocase "$ans" in
3987285612Sdelphij yes)
3988285612Sdelphij    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3989181834Srobertoesac
3990181834Sroberto
3991200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3992200576Sroberto
3993200576Srobertocase "$host" in
3994200576Sroberto *-sni-sysv*)
3995200576Sroberto    ans=yes
3996200576Sroberto    ;;
3997285612Sdelphij *-stratus-vos)
3998285612Sdelphij    ans=no
3999285612Sdelphij    ;;
4000200576Sroberto *-univel-sysv*)
4001200576Sroberto    ans=no
4002200576Sroberto    ;;
4003200576Sroberto *-*-ptx*)
4004200576Sroberto    ans=yes
4005200576Sroberto    ;;
4006200576Sroberto *-*-solaris2.1[[0-9]]*)
4007200576Sroberto    ans=no
4008200576Sroberto    ;;
4009200576Sroberto *-*-solaris2.[[012]]*)
4010200576Sroberto    ans=yes
4011200576Sroberto    ;;
4012200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4013200576Sroberto    ans=yes
4014200576Sroberto    ;;
4015200576Sroberto *) ans=no
4016200576Sroberto    ;;
4017200576Srobertoesac
4018200576Sroberto
4019200576SrobertoAC_ARG_ENABLE(
4020200576Sroberto    [step-slew],
4021285612Sdelphij    [AS_HELP_STRING(
4022200576Sroberto	[--enable-step-slew],
4023200576Sroberto	[s step and slew the time]
4024285612Sdelphij    )],
4025200576Sroberto    [ans=$enableval]
4026200576Sroberto)
4027200576Sroberto
4028200576SrobertoAC_MSG_RESULT([$ans])
4029200576Sroberto
4030200576Srobertocase "$ans" in
4031285612Sdelphij yes)
4032285612Sdelphij    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4033181834Srobertoesac
4034181834Sroberto
4035200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4036200576Sroberto
4037200576Srobertocase "$host" in
4038200576Sroberto *-apple-aux[[23]]*)
4039200576Sroberto    ans=yes
4040200576Sroberto    ;;
4041200576Sroberto *) ans=no
4042285612Sdelphij    ;;
4043200576Srobertoesac
4044200576Sroberto
4045200576SrobertoAC_ARG_ENABLE(
4046200576Sroberto    [ntpdate-step],
4047285612Sdelphij    [AS_HELP_STRING(
4048200576Sroberto	[--enable-ntpdate-step],
4049200576Sroberto	[s if ntpdate should step the time]
4050285612Sdelphij    )],
4051200576Sroberto    [ans=$enableval]
4052200576Sroberto)
4053200576Sroberto
4054200576SrobertoAC_MSG_RESULT([$ans])
4055200576Sroberto
4056200576Srobertocase "$ans" in
4057285612Sdelphij yes)
4058285612Sdelphij    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4059285612Sdelphij	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4060181834Srobertoesac
4061181834Sroberto
4062200576Sroberto
4063200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4064200576Sroberto
4065200576Srobertocase "$host" in
4066200576Sroberto *-*-nextstep*)
4067200576Sroberto    ans=yes
4068200576Sroberto    ;;
4069200576Sroberto *-*-openvms*)	# HMS: won't be found
4070200576Sroberto    ans=yes
4071200576Sroberto    ;;
4072200576Sroberto *)
4073200576Sroberto    ans=no
4074285612Sdelphij    ;;
4075200576Srobertoesac
4076200576Sroberto
4077200576SrobertoAC_ARG_ENABLE(
4078200576Sroberto    [hourly-todr-sync],
4079285612Sdelphij    [AS_HELP_STRING(
4080200576Sroberto	[--enable-hourly-todr-sync],
4081200576Sroberto	[s if we should sync TODR hourly]
4082285612Sdelphij    )],
4083200576Sroberto    [ans=$enableval]
4084200576Sroberto)
4085200576Sroberto
4086200576SrobertoAC_MSG_RESULT([$ans])
4087200576Sroberto
4088181834Srobertocase "$ac_cv_var_sync_todr" in
4089285612Sdelphij yes)
4090285612Sdelphij    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4091181834Srobertoesac
4092181834Sroberto
4093181834Sroberto
4094200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4095200576Sroberto
4096200576Srobertocase "$host" in
4097200576Sroberto *-*-solaris2.6)
4098200576Sroberto    unamev=`uname -v`
4099200576Sroberto    case "$unamev" in
4100200576Sroberto     Generic_105181-*)
4101200576Sroberto	old_IFS="$IFS"
4102200576Sroberto	IFS="-"
4103200576Sroberto	set $unamev
4104200576Sroberto	IFS="$old_IFS"
4105200576Sroberto	if test "$2" -ge 17
4106200576Sroberto	then
4107200576Sroberto	    # Generic_105181-17 and higher
4108200576Sroberto	    ans=no
4109200576Sroberto	else
4110200576Sroberto	    ans=yes
4111200576Sroberto	fi
4112200576Sroberto	;;
4113285612Sdelphij     *)
4114181834Sroberto	ans=yes
4115285612Sdelphij	;;
4116200576Sroberto    esac
4117200576Sroberto    ;;
4118200576Sroberto *-*-solaris2.7)
4119200576Sroberto    unamev=`uname -v`
4120200576Sroberto    case "$unamev" in
4121200576Sroberto     Generic_106541-*)
4122200576Sroberto	old_IFS="$IFS"
4123200576Sroberto	IFS="-"
4124200576Sroberto	set $unamev
4125200576Sroberto	IFS="$old_IFS"
4126200576Sroberto	if test "$2" -ge 07
4127200576Sroberto	then
4128200576Sroberto	    # Generic_106541-07 and higher
4129200576Sroberto	    ans=no
4130200576Sroberto	else
4131200576Sroberto	    ans=yes
4132200576Sroberto	fi
4133181834Sroberto	;;
4134200576Sroberto     *)
4135181834Sroberto	ans=yes
4136285612Sdelphij	;;
4137181834Sroberto    esac
4138200576Sroberto    ;;
4139200576Sroberto *)
4140200576Sroberto    ans=no
4141285612Sdelphij    ;;
4142200576Srobertoesac
4143200576Sroberto
4144200576SrobertoAC_ARG_ENABLE(
4145200576Sroberto    [kernel-fll-bug],
4146285612Sdelphij    [AS_HELP_STRING(
4147200576Sroberto	[--enable-kernel-fll-bug],
4148200576Sroberto	[s if we should avoid a kernel FLL bug]
4149285612Sdelphij    )],
4150200576Sroberto    [ans=$enableval]
4151200576Sroberto)
4152200576Sroberto
4153200576SrobertoAC_MSG_RESULT([$ans])
4154200576Sroberto
4155200576Srobertocase "$ans" in
4156285612Sdelphij yes)
4157285612Sdelphij    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4158200576Srobertoesac
4159200576Sroberto
4160200576Sroberto
4161285612SdelphijAC_MSG_CHECKING([if we want new session key behavior])
4162285612SdelphijAC_ARG_ENABLE(
4163285612Sdelphij    [bug1243-fix],
4164285612Sdelphij    [AS_HELP_STRING(
4165285612Sdelphij	[--enable-bug1243-fix],
4166285612Sdelphij	[+ use unmodified autokey session keys]
4167285612Sdelphij    )],
4168285612Sdelphij    [ans=$enableval],
4169285612Sdelphij    [ans=yes]
4170285612Sdelphij)
4171285612SdelphijAC_MSG_RESULT([$ans])
4172285612Sdelphijcase "$ans" in
4173285612Sdelphij no)
4174285612Sdelphij    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4175285612Sdelphij	[use old autokey session key behavior?])
4176285612Sdelphijesac
4177285612Sdelphij
4178285612Sdelphij
4179298699SdelphijAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4180298699SdelphijAC_ARG_ENABLE(
4181298699Sdelphij    [bug3020-fix],
4182298699Sdelphij    [AS_HELP_STRING(
4183298699Sdelphij	[--enable-bug3020-fix],
4184298699Sdelphij	[+ Provide the explicit 127.0.0.0/8 martian filter]
4185298699Sdelphij    )],
4186298699Sdelphij    [ans=$enableval],
4187298699Sdelphij    [ans=yes]
4188298699Sdelphij)
4189298699SdelphijAC_MSG_RESULT([$ans])
4190298699Sdelphijcase "$ans" in
4191298699Sdelphij yes)
4192298699Sdelphij    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4193298699Sdelphij	[Provide the explicit 127.0.0.0/8 martian filter?])
4194298699Sdelphijesac
4195298699Sdelphij
4196298699Sdelphij
4197200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4198200576Sroberto
4199200576Srobertocase "$host" in
4200200576Sroberto *-*-solaris2.[[89]])
4201200576Sroberto    ans=yes
4202200576Sroberto    ;;
4203200576Sroberto *-*-solaris2.1[[0-9]]*)
4204200576Sroberto    ans=yes
4205200576Sroberto    ;;
4206200576Sroberto *) ans=no
4207285612Sdelphij    ;;
4208200576Srobertoesac
4209200576Sroberto
4210200576SrobertoAC_ARG_ENABLE(
4211285612Sdelphij    [irig-sawtooth],
4212285612Sdelphij    [AS_HELP_STRING(
4213200576Sroberto	[--enable-irig-sawtooth],
4214200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4215285612Sdelphij    )],
4216200576Sroberto    [ans=$enableval]
4217200576Sroberto)
4218200576Sroberto
4219200576SrobertoAC_MSG_RESULT([$ans])
4220200576Sroberto
4221200576Srobertocase "$ans" in
4222285612Sdelphij yes)
4223285612Sdelphij    AC_DEFINE([IRIG_SUCKS], [1],
4224285612Sdelphij	[Should we use the IRIG sawtooth filter?])
4225181834Srobertoesac
4226181834Sroberto
4227200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4228200576SrobertoAC_ARG_ENABLE(
4229285612Sdelphij	[nist],
4230285612Sdelphij	[AS_HELP_STRING(
4231200576Sroberto	    [--enable-nist],
4232200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4233285612Sdelphij	)],
4234200576Sroberto	[ans=$enableval],
4235200576Sroberto	[ans=no]
4236200576Sroberto)
4237200576Sroberto
4238200576SrobertoAC_MSG_RESULT([$ans])
4239200576Sroberto
4240200576Srobertocase "$ans" in
4241285612Sdelphij yes)
4242285612Sdelphij    AC_DEFINE([LOCKCLOCK], [1],
4243285612Sdelphij	[Should we align with the NIST lockclock scheme?]) ;;
4244181834Srobertoesac
4245181834Sroberto
4246200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4247200576SrobertoAC_ARG_ENABLE(
4248200576Sroberto    [ntp-signd],
4249285612Sdelphij    [AS_HELP_STRING(
4250285612Sdelphij	[--enable-ntp-signd],
4251285612Sdelphij	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4252285612Sdelphij    )],
4253200576Sroberto    [ans=$enableval],
4254200576Sroberto    [ans=no]
4255200576Sroberto)
4256200576Sroberto
4257200576SrobertoAC_MSG_RESULT([$ans])
4258200576Sroberto
4259200576Srobertocase "$ans" in
4260200576Sroberto no)
4261200576Sroberto    ntp_signd_path=
4262200576Sroberto    ;;
4263200576Sroberto yes)
4264200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4265200576Sroberto    ;;
4266200576Sroberto *)
4267200576Sroberto    ntp_signd_path="$ans"
4268200576Srobertoesac
4269200576Sroberto
4270200576Srobertocase "$ntp_signd_path" in
4271200576Sroberto '')
4272200576Sroberto    ;;
4273200576Sroberto *)
4274285612Sdelphij    AC_DEFINE([HAVE_NTP_SIGND], [1],
4275285612Sdelphij	[Do we want support for Samba's signing daemon?])
4276285612Sdelphij    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4277285612Sdelphij	[Path to sign daemon rendezvous socket])
4278200576Sroberto    ;;
4279200576Srobertoesac
4280200576Sroberto
4281200576SrobertoAC_CHECK_HEADERS([libscf.h])
4282285612SdelphijLSCF=
4283200576Srobertocase "$ac_cv_header_libscf_h" in
4284200576Sroberto yes)
4285285612Sdelphij    LSCF='-lscf'
4286200576Srobertoesac
4287285612SdelphijAC_SUBST([LSCF])
4288200576Sroberto
4289285612SdelphijNTP_IPV6
4290200576Sroberto
4291200576Sroberto
4292181834Sroberto#
4293285612Sdelphij# Look for a sysctl call to get the list of network interfaces.
4294181834Sroberto#
4295200576SrobertoAC_CACHE_CHECK(
4296285612Sdelphij    [for interface list sysctl],
4297285612Sdelphij    [ntp_cv_iflist_sysctl],
4298285612Sdelphij    [AC_PREPROC_IFELSE(
4299285612Sdelphij	[AC_LANG_SOURCE([
4300285612Sdelphij	    #include <sys/param.h>
4301285612Sdelphij	    #include <sys/sysctl.h>
4302285612Sdelphij	    #include <sys/socket.h>
4303285612Sdelphij	    #ifndef NET_RT_IFLIST
4304285612Sdelphij	    # error
4305285612Sdelphij	    #endif
4306285612Sdelphij	])],
4307285612Sdelphij	[ntp_cv_iflist_sysctl=yes],
4308285612Sdelphij	[ntp_cv_iflist_sysctl=no]
4309285612Sdelphij    )]
4310200576Sroberto)
4311285612Sdelphijcase "$ntp_cv_iflist_sysctl" in
4312200576Sroberto yes)
4313285612Sdelphij    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4314181834Srobertoesac
4315181834Sroberto
4316285612Sdelphij###
4317181834Sroberto
4318285612SdelphijAC_MSG_CHECKING([if we want the saveconfig mechanism])
4319285612SdelphijAC_ARG_ENABLE(
4320285612Sdelphij    [saveconfig],
4321285612Sdelphij    [AS_HELP_STRING(
4322285612Sdelphij	[--enable-saveconfig],
4323285612Sdelphij	[+ saveconfig mechanism]
4324285612Sdelphij    )],
4325285612Sdelphij    [ntp_ok=$enableval],
4326285612Sdelphij    [ntp_ok=yes]
4327285612Sdelphij)
4328285612Sdelphijntp_saveconfig_enabled=0
4329285612Sdelphijcase "$ntp_ok" in
4330285612Sdelphij yes)
4331285612Sdelphij    ntp_saveconfig_enabled=1
4332285612Sdelphij    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4333200576Sroberto    ;;
4334181834Srobertoesac
4335285612SdelphijAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4336285612SdelphijAC_MSG_RESULT([$ntp_ok])
4337181834Sroberto
4338285612Sdelphij###
4339181834Sroberto
4340285612SdelphijAC_MSG_CHECKING([if we want the experimental leap smear code])
4341285612SdelphijAC_ARG_ENABLE(
4342285612Sdelphij    [leap-smear],
4343285612Sdelphij    [AS_HELP_STRING(
4344285612Sdelphij	[--enable-leap-smear],
4345285612Sdelphij	[- experimental leap smear code]
4346285612Sdelphij    )],
4347285612Sdelphij    [ntp_ok=$enableval],
4348285612Sdelphij    [ntp_ok=no]
4349181834Sroberto)
4350285612Sdelphijntp_leap_smear_enabled=0
4351285612Sdelphijcase "$ntp_ok" in
4352200576Sroberto yes)
4353285612Sdelphij    ntp_leap_smear_enabled=1
4354285612Sdelphij    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4355285612Sdelphij    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4356285612Sdelphij    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4357285612Sdelphij    ;;
4358200576Srobertoesac
4359285612SdelphijAC_MSG_RESULT([$ntp_ok])
4360200576Sroberto
4361298699Sdelphij###
4362298699Sdelphij
4363298699SdelphijAC_MSG_CHECKING([if we want dynamic interleave support])
4364298699SdelphijAC_ARG_ENABLE(
4365298699Sdelphij    [dynamic-interleave],
4366298699Sdelphij    [AS_HELP_STRING(
4367298699Sdelphij	[--enable-dynamic-interleave],
4368298699Sdelphij	[- dynamic interleave support]
4369298699Sdelphij    )],
4370298699Sdelphij    [ntp_ok=$enableval],
4371298699Sdelphij    [ntp_ok=no]
4372298699Sdelphij)
4373298699Sdelphijntp_dynamic_interleave=0
4374298699Sdelphijcase "$ntp_ok" in
4375298699Sdelphij yes)
4376298699Sdelphij    ntp_dynamic_interleave=1
4377298699Sdelphij    ;;
4378298699Sdelphijesac
4379298699SdelphijAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4380298699Sdelphij    [support dynamic interleave?])
4381298699SdelphijAC_MSG_RESULT([$ntp_ok])
4382298699Sdelphij
4383285612SdelphijNTP_UNITYBUILD
4384200576Sroberto
4385285612Sdelphijdnl  gtest is needed for our tests subdirs. It would be nice if we could
4386285612Sdelphijdnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4387285612Sdelphijdnl  can't be conditionalized.
4388285612SdelphijNTP_GOOGLETEST
4389200576Sroberto
4390289997SglebiusNTP_PROBLEM_TESTS
4391289997Sglebius
4392285612Sdelphij###
4393181834Sroberto
4394338531SdelphijAC_CHECK_DECLS([sigsetjmp,siglongjmp], [], [], [[#include <setjmp.h>]])
4395338531Sdelphij
4396338531Sdelphij###
4397338531Sdelphij
4398285612SdelphijAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4399285612Sdelphij    [Default location of crypto key info])
4400200576Sroberto
4401285612SdelphijAC_CONFIG_FILES([Makefile])
4402285612SdelphijAC_CONFIG_FILES([adjtimed/Makefile])
4403285612SdelphijAC_CONFIG_FILES([clockstuff/Makefile])
4404285612SdelphijAC_CONFIG_FILES([include/Makefile])
4405285612SdelphijAC_CONFIG_FILES([include/isc/Makefile])
4406285612SdelphijAC_CONFIG_FILES([kernel/Makefile])
4407285612SdelphijAC_CONFIG_FILES([kernel/sys/Makefile])
4408285612SdelphijAC_CONFIG_FILES([libntp/Makefile])
4409285612SdelphijAC_CONFIG_FILES([libparse/Makefile])
4410285612SdelphijAC_CONFIG_FILES([ntpd/Makefile])
4411285612SdelphijAC_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])
4412285612SdelphijAC_CONFIG_FILES([ntpdate/Makefile])
4413285612SdelphijAC_CONFIG_FILES([ntpdc/Makefile])
4414285612SdelphijAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4415285612SdelphijAC_CONFIG_FILES([ntpq/Makefile])
4416285612SdelphijAC_CONFIG_FILES([ntpsnmpd/Makefile])
4417285612SdelphijAC_CONFIG_FILES([parseutil/Makefile])
4418285612SdelphijAC_CONFIG_FILES([scripts/Makefile])
4419285612SdelphijAC_CONFIG_FILES([scripts/build/Makefile])
4420301256SdelphijAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4421285612SdelphijAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4422285612SdelphijAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4423285612SdelphijAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4424285612SdelphijAC_CONFIG_FILES([scripts/lib/Makefile])
4425285612SdelphijAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4426285612SdelphijAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4427285612SdelphijAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4428285612SdelphijAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4429285612SdelphijAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4430285612SdelphijAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4431285612SdelphijAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4432285612SdelphijAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4433285612SdelphijAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4434285612SdelphijAC_CONFIG_FILES([scripts/update-leap/Makefile])
4435285612SdelphijAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4436285612SdelphijAC_CONFIG_FILES([tests/Makefile])
4437285612SdelphijAC_CONFIG_FILES([tests/bug-2803/Makefile])
4438285612SdelphijAC_CONFIG_FILES([tests/libntp/Makefile])
4439285612SdelphijAC_CONFIG_FILES([tests/ntpd/Makefile])
4440289997SglebiusAC_CONFIG_FILES([tests/ntpq/Makefile])
4441285612SdelphijAC_CONFIG_FILES([tests/sandbox/Makefile])
4442285612SdelphijAC_CONFIG_FILES([tests/sec-2853/Makefile])
4443285612SdelphijAC_CONFIG_FILES([util/Makefile])
4444200576Sroberto
4445285612Sdelphijperllibdir="${datadir}/ntp/lib"
4446285612SdelphijAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4447181834Sroberto
4448285612Sdelphijcalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4449285612SdelphijAC_SUBST_FILE([calc_tickadj_opts])
4450285612Sdelphijntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4451285612SdelphijAC_SUBST_FILE([ntp_wait_opts])
4452285612Sdelphijntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4453285612SdelphijAC_SUBST_FILE([ntpsweep_opts])
4454285612Sdelphijntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4455285612SdelphijAC_SUBST_FILE([ntptrace_opts])
4456285612Sdelphijsummary_opts="$srcdir/scripts/summary-opts"
4457285612SdelphijAC_SUBST_FILE([summary_opts])
4458285612Sdelphijplot_summary_opts="$srcdir/scripts/plot_summary-opts"
4459285612SdelphijAC_SUBST_FILE([plot_summary_opts])
4460181834Sroberto
4461285612SdelphijAC_CONFIG_SUBDIRS([sntp])
4462181834Sroberto
4463181834SrobertoAC_OUTPUT
4464