xref: /freebsd/contrib/ntp/configure.ac (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1dnl NTP top-level configure.ac				-*- Autoconf -*-
2dnl
3m4_include([sntp/m4/version.m4])
4AC_PREREQ([2.68])
5AC_INIT(
6    [ntp],
7    [VERSION_NUMBER],
8    [http://bugs.ntp.org./],
9    [],
10    [http://www.ntp.org./]dnl
11)
12AC_CONFIG_MACRO_DIR([sntp/m4])
13AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14AC_LANG([C])
15
16AC_PRESERVE_HELP_ORDER
17
18# Bump ntp_configure_cache_version for each change to configure.ac or
19# .m4 files which invalidates cached values from previous configure
20# runs.
21#
22# If the change affects cache variables used only by the main NTP
23# configure.ac, then only its version number should be bumped, while
24# the subdir configure.ac version numbers should be unchanged.  The
25# same is true for a test/variable that is used only by one subdir
26# being changed incompatibly; only that subdir's cache version needs
27# bumping.
28#
29# If a change affects variables shared by all NTP configure scripts,
30# please bump the version numbers of each.  If you are not sure, the
31# safe choice is to bump all on any cache-invalidating change.
32#
33# In order to avoid the risk of version stamp collision between -stable
34# and -dev branches, do not simply increment the version, instead use
35# the date YYYYMMDD optionally with -HHMM if there is more than one
36# bump in a day.
37
38ntp_configure_cache_version=20120806
39
40# When the cache version of config.cache and configure do not
41# match, NTP_CACHEVERSION will flush the cache.
42
43NTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44
45AM_INIT_AUTOMAKE([1.15 foreign -Wall -Wno-gnu])
46
47AM_SILENT_RULES([yes])
48
49AC_CANONICAL_BUILD
50AC_CANONICAL_HOST
51dnl the 'build' machine is where we run configure and compile
52dnl the 'host' machine is where the resulting stuff runs.
53AC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
54    [canonical system (cpu-vendor-os) of where we should run])
55AC_CONFIG_HEADERS([config.h])
56dnl AC_ARG_PROGRAM
57
58ntp_atom_ok=${ntp_atom_ok=no}
59ntp_oncore_ok=${ntp_oncore_ok=no}
60ntp_parse_ok=${ntp_parse_ok=no}
61ntp_ripe_ncc_ok=${ntp_parse_ok=no}
62ntp_jupiter_ok=${ntp_jupiter_ok=no}
63
64NTP_PROG_CC
65NTP_COMPILER
66
67dnl # Do we need CXX for anything besides google test?
68dnl AC_PROG_CXX
69AC_PROG_YACC
70dnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
71AX_C99_STRUCT_INIT
72
73NTP_HARDEN([sntp])
74
75NTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
76
77NTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
78
79dnl AM_PROG_AR req. automake 1.12
80m4_ifdef(
81    [AM_PROG_AR],
82    [AM_PROG_AR]
83)
84
85# So far, the only shared library we might use is libopts.
86# It's a small library - we might as well use a static version of it.
87AC_DISABLE_SHARED
88AC_PROG_LIBTOOL
89AC_SUBST([LIBTOOL_DEPS])
90
91# NTP has (so far) been relying on leading-edge autogen, which
92# means we need the appropriate corresponding libopts as well.
93# Therefore, by default:
94# - use the version of libopts we ship with
95# - do not install it
96# - build a static copy (AC_DISABLE_SHARED - done earlier)
97case "${enable_local_libopts+set}" in
98 set) ;;
99 *) enable_local_libopts=yes ;;
100esac
101case "${enable_libopts_install+set}" in
102 set) ;;
103 *) enable_libopts_install=no ;;
104esac
105enable_nls=no
106LIBOPTS_CHECK_NOBUILD([sntp/libopts])
107
108NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
109
110NTP_LIBNTP
111
112AC_MSG_CHECKING([for deprecated --with-arlib])
113AC_ARG_WITH([arlib],
114	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
115	[ans=$withval], [ans=no])
116AC_MSG_RESULT([$ans])
117
118case "$ans" in
119 yes)
120    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
121    ;;
122esac
123
124dnl  we need to check for cross compile tools for vxWorks here
125AC_PROG_AWK
126AS_UNSET([ac_cv_prog_AWK])
127AC_SUBST([AWK])				dnl scripts/ntpver.in
128AC_PROG_MAKE_SET
129
130AC_SUBST([CFLAGS])
131AC_SUBST([LDFLAGS])
132
133AC_PROG_LN_S
134AC_ISC_POSIX
135
136
137AC_PATH_PROG([PATH_PERL], [perl])
138dnl  Saving cached hardcoded paths rather than searching $PATH during a
139dnl  cached configure run is an optimization not worth the the cost of
140dnl  preventing newly-installed tools from being found.  Short-circuit
141dnl  the caching after the tests so preset overrides still work.
142AS_UNSET([ac_cv_path_PATH_PERL])
143AC_PATH_PROG([PATH_TEST], [test])
144AS_UNSET([ac_cv_path_PATH_TEST])
145test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
146AC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
147
148AC_ARG_WITH(
149    [net-snmp-config],
150    [AS_HELP_STRING(
151	[--with-net-snmp-config],
152	[+ =net-snmp-config]
153    )],
154    [ans=$withval],
155    [ans=yes]
156)
157case "$ans" in
158 no)
159    ;;
160 yes)
161    ans=net-snmp-config
162    ;;
163 /*)
164    ;;
165 */*)
166    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
167    ;;
168 *)
169    ;;
170esac
171PROG_NET_SNMP_CONFIG=$ans
172case "$PROG_NET_SNMP_CONFIG" in
173 no) ;;
174 /*)
175    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
176    ;;
177 *)
178    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
179    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
180;;
181esac
182AC_MSG_CHECKING([for net-snmp-config path])
183AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
184
185case "$PATH_NET_SNMP_CONFIG" in
186 /*)	AC_CACHE_CHECK(
187	    [for net-snmp version],
188	    [ntp_cv_net_snmp_version],
189	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
190	)
191	;;
192esac
193
194case "$host" in
195 *-*-vxworks*)
196    ac_link="$ac_link $VX_KERNEL"
197    ;;
198esac
199
200# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
201AC_SEARCH_LIBS([openlog], [gen syslog])
202# XXX library list will be in ac_cv_search_openlog
203
204# LIBSECCOMP is off by default -- needs testing with all the features
205# Please send bug reports to loganaden@gmail.com
206AC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
207AC_ARG_ENABLE(
208    [libseccomp],
209    [AS_HELP_STRING(
210	[--enable-libseccomp],
211	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
212    )],
213    [ntp_ok=$enableval],
214    [ntp_ok=no]
215)
216AC_MSG_RESULT([$ntp_ok])
217case "$ntp_ok" in
218 yes)
219    AC_SEARCH_LIBS(
220	[seccomp_init],
221	[seccomp],
222	[AC_DEFINE([LIBSECCOMP], [1],
223	    [Define to any value to include libseccomp sandboxing.])]
224    )
225    AC_TRY_RUN([
226	#include <stdio.h>
227	#include <stdlib.h>
228	#include <errno.h>
229	#include <sys/prctl.h>
230	#include <linux/seccomp.h>
231
232	int main(void)
233	{
234		int ret;
235		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
236		if (ret < 0) {
237			switch (errno) {
238			case ENOSYS:
239				return 1;
240			case EINVAL:
241				return 1;
242			default:
243				return 1;
244			}
245		}
246		ret =
247		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
248		if (ret < 0) {
249			switch (errno) {
250			case EINVAL:
251				return 1;
252			case EFAULT:
253				return 0;
254			default:
255				return 1;
256		}
257	}
258return 1;
259}
260]
261, AC_DEFINE([KERN_SECCOMP], 1,
262[Define to use libseccomp system call filtering.])
263, []
264)
265    ;;
266esac
267
268NTP_FACILITYNAMES
269
270dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
271dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
272dnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
273dnl does Strange Things with extra processes using the Posix-compatibility
274dnl real-time library, so we don't want to use it.
275dnl
276dnl 081118 Harlan got tired of looking for a way to get the sched*()
277dnl functions to link OK with either cc or gcc.
278
279case "$host" in
280 *-*-*linux*) ;;
281 *-*-osf4*) ;;
282 *-*-osf5*) ;;
283 *)
284    # HMS: Make sure we check for -lrt for clock_* before this...
285    case "$ac_cv_search_clock_gettime" in
286     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
287    esac
288    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
289    ;;
290esac
291
292AC_CHECK_HEADERS([bstring.h])
293AC_CHECK_HEADER(
294    [dns_sd.h],
295    [AC_SEARCH_LIBS(
296	[DNSServiceRegister],
297	[dns_sd],
298	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
299	    [Use Rendezvous/DNS-SD registration])]
300    )]
301)
302AC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
303
304AC_CHECK_HEADERS([memory.h netdb.h poll.h])
305AC_CHECK_HEADERS([sgtty.h stdatomic.h])
306AC_HEADER_STDBOOL
307AC_CHECK_HEADERS([stdlib.h string.h termio.h])
308AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
309
310case "$host" in
311 *-*-aix*)
312    AC_CHECK_HEADERS([utmpx.h])
313    case "$ac_cv_header_utmpx_h" in
314     yes)
315	;;
316     *)
317	AC_CHECK_HEADERS([utmp.h])
318	;;
319    esac
320    ;;
321 *)
322    AC_CHECK_HEADERS([utmp.h utmpx.h])
323    ;;
324esac
325
326#
327# On Suns only (so far) getpass() truncates the typed password to 8
328# characters, but getpassphrase() allows up to 257.  Most systems'
329# getpass() does not truncate, at least not so as to affect ntpq and
330# ntpdc password prompts.
331#
332# So check for getpassphrase(), but only on Sun operating systems.
333#
334case "$host" in
335 *-*-sunos*|*-*-solaris*)
336    AC_CHECK_FUNCS([getpassphrase])
337esac
338
339
340AC_CHECK_HEADERS([net/if6.h])
341AC_CHECK_HEADERS([net/route.h], [], [], [
342    #include <sys/types.h>
343    #include <sys/socket.h>
344    #include <net/if.h>
345])
346
347AC_CHECK_HEADERS([netinfo/ni.h])
348case "$ac_cv_header_netinfo_ni_h" in
349 yes)
350    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
351esac
352AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
353case "$host" in
354 *-*-sunos4*)
355    ;;
356 *)
357    AC_CHECK_HEADERS([sys/ioctl.h])
358    ;;
359esac
360AC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
361# HMS: Check sys/proc.h and sys/resource.h after some others
362AC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
363case "$ac_cv_header_sched_h" in
364 yes)
365    ;;
366 *)
367    AC_CHECK_HEADERS([sys/sched.h])
368    ;;
369esac
370# HMS: Check sys/shm.h after some others
371AC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
372# HMS: Checked sys/socket.h earlier
373case "$host" in
374 *-*-netbsd*)
375    ;;
376 *)
377    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
378    ;;
379esac
380AC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
381AC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
382AC_CHECK_FUNCS([waitpid])
383case "$host" in
384*-convex-*)
385    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
386    ;;
387*-*-bsdi*)
388    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
389    ;;
390esac
391
392case "$ac_cv_header_stdatomic_h" in
393 yes)
394	AC_CHECK_FUNCS([atomic_thread_fence])
395	AC_CACHE_CHECK(
396	    [for atomic_thread_fence()],
397	    [ntp_cv_func_atomic_thread_fence],
398	    [AC_COMPILE_IFELSE(
399		[AC_LANG_PROGRAM(
400		    [[
401			#include <stdatomic.h>
402		    ]],
403		    [[
404			atomic_thread_fence(memory_order_seq_cst);
405		    ]]
406		)]
407		[ntp_cv_func_atomic_thread_fence=yes],
408		[ntp_cv_func_atomic_thread_fence=no]
409	    )]
410	)
411    ;;
412esac
413
414case "$host" in
415 *-*-solaris2.6)
416    # Broken...
417    ;;
418 *)
419    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
420    ;;
421esac
422
423case "$host" in
424 *-*-*linux*)
425    case "$ac_cv_func_ntp_gettime" in
426     yes)
427	;;
428     *)
429	AC_CHECK_FUNCS([__ntp_gettime])
430	case "$ac_cv_func___ntp_gettime" in
431	 yes)
432	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
433		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
434	esac
435	;;
436    esac
437    AC_CHECK_FUNCS([adjtimex])
438    case "$ac_cv_func_adjtimex" in
439     yes)
440	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
441	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
442	have_adjtimex=1
443	;;
444     *)
445	AC_CHECK_FUNCS([__adjtimex])
446	case "$ac_cv_func___adjtimex" in
447	 yes)
448	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
449	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
450	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
451	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
452	    have_adjtimex=1
453	esac
454	;;
455    esac
456esac
457case "$have_adjtimex" in
458 '')
459    # nlist stuff is only needed for tickadj.
460    saved_LIBS="$LIBS"
461    LIBS=
462    AC_SEARCH_LIBS([nlist], [elf ld mld])
463    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
464    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
465    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
466    AC_CHECK_HEADERS([nlist.h sys/var.h])
467    case "$ac_cv_header_nlist_h" in
468     yes)
469	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
470	AC_CACHE_CHECK(
471	    [for n_un in struct nlist],
472	    [ntp_cv_struct_nlist_n_un],
473	    [AC_COMPILE_IFELSE(
474		[AC_LANG_PROGRAM(
475		    [[
476			#include <nlist.h>
477		    ]],
478		    [[
479			struct nlist n;
480			n.n_un.n_name = 0;
481		    ]]
482		)]
483		[ntp_cv_struct_nlist_n_un=yes],
484		[ntp_cv_struct_nlist_n_un=no]
485	    )]
486	)
487	case "$ntp_cv_struct_nlist_n_un" in
488	 yes)
489	    AC_DEFINE([NLIST_NAME_UNION], [1],
490		[does struct nlist use a name union?])
491	esac
492    esac
493    AC_SUBST([LDADD_NLIST])
494    LDADD_NLIST="$LIBS"
495    LIBS="$saved_LIBS"
496    AS_UNSET([saved_LIBS])
497esac
498
499AC_CHECK_HEADERS([sys/proc.h], [], [], [
500    #ifdef HAVE_SYS_TYPES_H
501    # include <sys/types.h>
502    #endif
503    #ifdef HAVE_SYS_TIME_H
504    # include <sys/time.h>
505    #endif
506])
507
508AC_CHECK_HEADERS([sys/resource.h], [], [], [
509    #ifdef HAVE_SYS_TIME_H
510    # include <sys/time.h>
511    #endif
512])
513
514AC_CHECK_HEADERS([sys/shm.h], [], [], [
515    #ifdef HAVE_SYS_TYPES_H
516    # include <sys/types.h>
517    #endif
518    #ifdef HAVE_SYS_IPC_H
519    # include <sys/ipc.h>
520    #endif
521])
522
523AC_CHECK_HEADERS([sys/timex.h], [], [], [
524    #ifdef HAVE_SYS_TIME_H
525    # include <sys/time.h>
526    #endif
527])
528
529NTP_AF_UNSPEC
530
531AC_TYPE_SIGNAL
532AC_TYPE_OFF_T
533AC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
534
535AC_CACHE_CHECK(
536    [for a fallback value for HZ],
537    [ntp_cv_default_hz],
538    [
539	ntp_cv_default_hz=100
540	case "$host" in
541	 alpha*-dec-osf4*|alpha*-dec-osf5*)
542	    ntp_cv_default_hz=1024
543	    ;;
544	 mips-dec-ultrix4*)
545	    ntp_cv_default_hz=256
546	    ;;
547	esac
548    ]
549)
550AC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
551    [What is the fallback value for HZ?])
552
553AC_CACHE_CHECK(
554    [if we need to override the system's value for HZ],
555    [ntp_cv_override_hz],
556    [
557	ntp_cv_override_hz=no
558	case "$host" in
559	 alpha*-dec-osf4*|alpha*-dec-osf5*)
560	    ntp_cv_override_hz=yes
561	    ;;
562	 mips-dec-ultrix4*)
563	    ntp_cv_override_hz=yes
564	    ;;
565	 *-*-freebsd*)
566	    ntp_cv_override_hz=yes
567	    ;;
568	 *-*-sunos4*)
569	    ntp_cv_override_hz=yes
570	    ;;
571	 *-*-kfreebsd*)
572	    ntp_cv_override_hz=yes
573	    ;;
574	esac
575    ]
576)
577case "$ntp_cv_override_hz" in
578 yes)
579    AC_DEFINE([OVERRIDE_HZ], [1],
580	[Do we need to override the system's idea of HZ?])
581esac
582
583dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
584dnl [AC_TRY_LINK([#include <sys/types.h>
585dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
586dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
587dnl if test $su_cv_func_ut_host_in_utmp = yes; then
588dnl   AC_DEFINE(HAVE_UT_HOST)
589dnl fi
590
591dnl AC_MSG_CHECKING(if we can get the system boot time)
592dnl AC_CACHE_VAL(su_cv_have_boot_time,
593dnl [AC_EGREP_CPP(yes,
594dnl [#ifdef HAVE_UTMPX_H
595dnl #include <utmpx.h>
596dnl #else
597dnl #include <utmp.h>
598dnl #endif
599dnl #ifdef BOOT_TIME
600dnl yes
601dnl #endif
602dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
603dnl AC_MSG_RESULT($su_cv_have_boot_time)
604
605AC_CACHE_CHECK(
606    [for struct rt_msghdr],
607    [ntp_cv_struct_rt_msghdr],
608    [AC_COMPILE_IFELSE(
609	[AC_LANG_PROGRAM(
610	    [[
611		#include <sys/types.h>
612		#include <sys/socket.h>
613		#include <net/if.h>
614		#include <net/route.h>
615	    ]],
616	    [[
617		struct rt_msghdr p;
618	    ]]
619	)],
620	[ntp_cv_struct_rt_msghdr=yes],
621	[ntp_cv_struct_rt_msghdr=no]
622    )]
623)
624
625AC_CACHE_CHECK(
626    [for struct rtattr],
627    [ntp_cv_rtattr],
628    [AC_COMPILE_IFELSE(
629	[AC_LANG_PROGRAM(
630	    [[
631		#include <stddef.h>
632		#include <sys/socket.h>
633		#include <linux/rtnetlink.h>
634	    ]],
635	    [[
636		struct rtattr p;
637	    ]]
638	)],
639	[ntp_cv_rtattr=yes],
640	[ntp_cv_rtattr=no]
641    )]
642)
643
644case "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
645 *yes*)
646    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
647	[Do we have a routing socket (rt_msghdr or rtattr)?])
648    case "$ntp_cv_rtattr" in
649     yes)
650	AC_DEFINE([HAVE_RTNETLINK], [1],
651	    [Do we have Linux routing socket?])
652    esac
653esac
654
655AC_CACHE_CHECK(
656    [struct sigaction for sa_sigaction],
657    [ntp_cv_struct_sigaction_has_sa_sigaction],
658    [AC_COMPILE_IFELSE(
659	[AC_LANG_PROGRAM(
660	    [[
661		#include <signal.h>
662	    ]],
663	    [[
664		struct sigaction act;
665		act.sa_sigaction = 0;
666	    ]]
667	)],
668	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
669	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
670    )]
671)
672case "$ntp_cv_struct_sigaction_has_sa_sigaction" in
673 yes)
674    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
675esac
676
677AC_CACHE_CHECK(
678    [for struct ppsclockev],
679    [ntp_cv_struct_ppsclockev],
680    [AC_COMPILE_IFELSE(
681	[AC_LANG_PROGRAM(
682	    [[
683		#ifdef HAVE_SYS_TYPES_H
684		# include <sys/types.h>
685		#endif
686		#ifdef HAVE_SYS_TERMIOS_H
687		# include <sys/termios.h>
688		#endif
689		#ifdef HAVE_SYS_TIME_H
690		# include <sys/time.h>
691		#endif
692		#ifdef HAVE_SYS_PPSCLOCK_H
693		# include <sys/ppsclock.h>
694		#endif
695	    ]],
696	    [[
697		extern struct ppsclockev *pce;
698		return pce->serial;
699	    ]]
700	)],
701	[ntp_cv_struct_ppsclockev=yes],
702	[ntp_cv_struct_ppsclockev=no]
703    )]
704)
705case "$ntp_cv_struct_ppsclockev" in
706 yes)
707    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
708	[Does a system header define struct ppsclockev?])
709esac
710
711case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
712  *yes*)
713    AC_CACHE_CHECK(
714	[for struct snd_size],
715	[ntp_cv_struct_snd_size],
716	[AC_COMPILE_IFELSE(
717	    [AC_LANG_PROGRAM(
718		[[
719		    #ifdef HAVE_MACHINE_SOUNDCARD_H
720		    # include <machine/soundcard.h>
721		    #endif
722		    #ifdef HAVE_SYS_SOUNDCARD_H
723		    # include <sys/soundcard.h>
724		    #endif
725		]],
726		[[
727		    extern struct snd_size *ss;
728		    return ss->rec_size;
729		]]
730	    )],
731	    [ntp_cv_struct_snd_size=yes],
732	    [ntp_cv_struct_snd_size=no]
733        )]
734    )
735    case "$ntp_cv_struct_snd_size" in
736     yes)
737	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
738	    [Do we have struct snd_size?])
739    esac
740esac
741
742AC_CACHE_CHECK(
743    [struct clockinfo for hz],
744    [ntp_cv_struct_clockinfo_has_hz],
745    [AC_COMPILE_IFELSE(
746	[AC_LANG_PROGRAM(
747	    [[
748		#include <sys/time.h>
749	    ]],
750	    [[
751		extern struct clockinfo *pc;
752		return pc->hz;
753	    ]]
754	)],
755	[ntp_cv_struct_clockinfo_has_hz=yes],
756	[ntp_cv_struct_clockinfo_has_hz=no]
757    )]
758)
759case "$ntp_cv_struct_clockinfo_has_hz" in
760 yes)
761    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
762esac
763
764AC_CACHE_CHECK(
765    [struct clockinfo for tickadj],
766    [ntp_cv_struct_clockinfo_has_hz],
767    [AC_COMPILE_IFELSE(
768	[AC_LANG_PROGRAM(
769	    [[
770		#include <sys/time.h>
771	    ]],
772	    [[
773		extern struct clockinfo *pc;
774		return pc->tickadj;
775	    ]]
776	)],
777	[ntp_cv_struct_clockinfo_has_hz=yes],
778	[ntp_cv_struct_clockinfo_has_hz=no]
779    )]
780)
781case "$ntp_cv_struct_clockinfo_has_hz" in
782 yes)
783    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
784esac
785
786case "$ntp_cv_struct_ntptimeval" in
787 yes)
788    AC_CHECK_MEMBERS(
789	[struct ntptimeval.time.tv_nsec],
790	[],
791	[],
792	[
793	    #ifdef HAVE_SYS_TIME_H
794	    # include <sys/time.h>
795	    #else
796	    # ifdef HAVE_TIME_H
797	    #  include <time.h>
798	    # endif
799	    #endif
800	    #ifdef HAVE_SYS_TIMEX_H
801	    # include <sys/timex.h>
802	    #else
803	    # ifdef HAVE_TIMEX_H
804	    #  include <timex.h>
805	    # endif
806	    #endif
807	]
808    )
809esac
810
811####
812
813AC_CHECK_FUNCS([arc4random_buf])
814
815####
816
817saved_LIBS="$LIBS"
818LIBS="$LIBS $LDADD_LIBNTP"
819AC_CHECK_FUNCS([daemon])
820# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
821LIBS="$saved_LIBS"
822AS_UNSET([saved_LIBS])
823
824AC_CHECK_FUNCS(
825    [finite],
826    [],
827    [AC_CHECK_FUNCS(
828	[isfinite],
829	[],
830	[
831	    AC_MSG_CHECKING([for isfinite with <math.h>])
832	    _libs=$LIBS
833	    # XXX
834	    LIBS="$LIBS -lm"
835	    AC_LINK_IFELSE(
836		[AC_LANG_PROGRAM(
837		    [[
838			#include <math.h>
839		    ]],
840		    [[
841			float f = 0.0;
842			isfinite(f);
843		    ]]
844		)],
845		[ans=yes],
846		[ans=no]
847	    )
848	    LIBS=$_libs
849	    AC_MSG_RESULT([$ans])
850	    case "$ans" in
851	     yes)
852		AC_DEFINE([HAVE_ISFINITE], [1])
853	    esac
854	]
855    )]
856)
857
858AC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
859
860# kvm_open() is only used by tickadj.  Also see above.
861case "$ac_cv_header_kvm_h" in
862 yes)
863    AC_CHECK_FUNCS([kvm_open])
864    ;;
865esac
866
867case "$host" in
868 *-*-sco3.2v5.0.*)
869    # Just stubs.  Sigh.
870    ;;
871 *) AC_CHECK_FUNCS([mkstemp])
872    ;;
873esac
874AC_CHECK_FUNCS([mktime])
875case "$host" in
876 *-*-aix[[4-9]]*)
877    # XXX only verified thru AIX6.
878    # Just a stub.  Sigh.
879    ;;
880 *-*-irix[[45]]*)
881    # Just a stub in "old" Irix.  Sigh.
882    ;;
883# In the belief that the fix for bug 1223 fixes mlockall() under linux...
884# *-*-*linux*)
885#    # there, but more trouble than it is worth for now (resolver problems)
886#    ;;
887 *-*-qnx*)
888    # Apparently there but not working in QNX.  Sigh?
889    ;;
890 *-*-sco3.2v5.0.*)
891    # Just a stub.  Sigh.
892    ;;
893 alpha*-dec-osf4*|alpha*-dec-osf5*)
894    # mlockall is there, as a #define calling memlk via <sys/mman.h>
895    # Not easy to test for - cheat.
896    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
897    AC_CHECK_FUNCS([mlockall])
898    ;;
899 *) AC_CHECK_FUNCS([mlockall])
900    ;;
901esac
902AC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
903case "$host" in
904 *-*-aix[[4-9]]*)
905    # XXX only verified thru AIX6.
906    # Just a stub in AIX 4.  Sigh.
907    ;;
908 *-*-solaris2.5*)
909    # Just stubs in solaris2.5.  Sigh.
910    ;;
911 *) AC_CHECK_FUNCS([sched_setscheduler])
912    ;;
913esac
914AC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
915AC_CHECK_FUNCS([strdup strerror setrlimit strchr])
916case "$host" in
917 *-*-aix[[4-9]]*)
918    # XXX only verified thru AIX6.
919    # Just stubs.  Sigh.
920    ;;
921 *-*-netbsd1*)
922    # Just stubs.  Sigh.
923    ;;
924 *-*-netbsdelf1*)
925    # Just stubs.  Sigh.
926    ;;
927 *-*-openbsd*)
928    # Just stubs.  Sigh.
929    ;;
930 *)
931    AC_CHECK_FUNCS([timer_create])
932    ;;
933esac
934
935NTP_RLIMIT_ITEMS
936
937# some OSes prefer _exit() in forked children to exit()
938AC_CHECK_FUNCS([_exit])
939ntp_worker_child_exit=exit
940case "$ac_cv_func__exit::$host_os" in
941 yes::netbsd*)
942    ntp_worker_child_exit=_exit
943    ;;
944 yes::openbsd*)
945    ntp_worker_child_exit=_exit
946    ;;
947esac
948AC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
949		   [routine worker child proc uses to exit.])
950
951AC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
952
953###
954
955# http://bugs.ntp.org/737
956case "$ac_cv_func_recvmsg" in
957 yes)
958    AC_CACHE_CHECK(
959	[if we need extra help to define struct iovec],
960	[ntp_cv_struct_iovec_help],
961	[
962	    compiled=no
963	    for ntp_cv_struct_iovec_help in '0' '1'; do
964		AC_COMPILE_IFELSE(
965		    [AC_LANG_PROGRAM(
966			[[
967			    #ifdef HAVE_SYS_TYPES_H
968			    # include <sys/types.h>
969			    #endif
970			    #ifdef HAVE_SYS_SOCKET_H
971			    # include <sys/socket.h>
972			    #endif
973			    #if $ntp_cv_struct_iovec_help
974			    # include <sys/uio.h>
975			    #endif
976			]],
977			[[
978			    void foo(void) {
979				ssize_t x;
980				int s = 0;
981				struct iovec iov;
982				struct msghdr mh;
983				int flags = 0;
984
985				mh.msg_iov = &iov;
986				x = recvmsg(s, &mh, flags);
987			    }
988			]]
989		    )],
990		    [compiled=yes ; break 1],
991		    []
992		)
993	    done
994	    case "$compiled" in
995	     no)
996		ntp_cv_struct_iovec_help=0
997	    esac
998	    AS_UNSET([compiled])
999	]
1000    )
1001    case "$ntp_cv_struct_iovec_help" in
1002     1)
1003	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1004	    [Use sys/uio.h for struct iovec help])
1005    esac
1006esac
1007
1008AC_CACHE_CHECK(
1009    [number of arguments taken by setpgrp()],
1010    [ntp_cv_func_setpgrp_nargs],
1011    [AC_COMPILE_IFELSE(
1012	[AC_LANG_PROGRAM(
1013	    [[
1014		#ifdef HAVE_SYS_TYPES_H
1015		# include <sys/types.h>
1016		#endif
1017		#ifdef HAVE_UNISTD_H
1018		# include <unistd.h>
1019		#endif
1020	    ]],
1021	    [[
1022		setpgrp(0, 0);
1023	    ]]
1024	)],
1025	[ntp_cv_func_setpgrp_nargs=2],
1026	[ntp_cv_func_setpgrp_nargs=0]
1027    )]
1028)
1029case "$ntp_cv_func_setpgrp_nargs" in
1030 0)
1031    AC_DEFINE([HAVE_SETPGRP_0], [1],
1032	      [define if setpgrp takes 0 arguments])
1033esac
1034
1035AC_CACHE_CHECK(
1036    [if we need to declare 'errno'],
1037    [ntp_cv_decl_errno],
1038    [AC_COMPILE_IFELSE(
1039	[AC_LANG_PROGRAM(
1040	    [[
1041		#ifdef HAVE_ERRNO_H
1042		# include <errno.h>
1043		#endif
1044	    ]],
1045	    [[
1046		errno = 0;
1047	    ]]
1048	)],
1049	[ntp_cv_decl_errno=no],
1050	[ntp_cv_decl_errno=yes]
1051    )]
1052)
1053case "$ntp_cv_decl_errno" in
1054 yes)
1055    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1056esac
1057
1058dnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1059dnl MT purposes.  This makes the line "extern int h_errno" choke
1060dnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1061dnl without breaking any other platforms.
1062dnl
1063AC_CACHE_CHECK(
1064    [if we may declare 'h_errno'],
1065    [ntp_cv_decl_h_errno],
1066    [AC_COMPILE_IFELSE(
1067	[AC_LANG_PROGRAM(
1068	    [[
1069		#include <sys/types.h>
1070		#ifdef HAVE_NETINET_IN_H
1071		# include <netinet/in.h>
1072		#endif
1073		#ifdef HAVE_ARPA_NAMESER_H
1074		# include <arpa/nameser.h>
1075		#endif
1076		#ifdef HAVE_NETDB_H
1077		# include <netdb.h>
1078		#endif
1079		#ifdef HAVE_RESOLV_H
1080		# include <resolv.h>
1081		#endif
1082	    ]],
1083	    [[
1084		extern int h_errno;
1085	    ]]
1086	)],
1087	[ntp_cv_decl_h_errno=yes],
1088	[ntp_cv_decl_h_errno=no]
1089    )]
1090)
1091case "$ntp_cv_decl_h_errno" in
1092 yes)
1093    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1094esac
1095
1096AC_CACHE_CHECK(
1097    [if declaring 'syscall()' is ok],
1098    [ntp_cv_decl_syscall],
1099    [AC_COMPILE_IFELSE(
1100	[AC_LANG_PROGRAM(
1101	    [[
1102		#ifdef HAVE_SYS_TYPES_H
1103		# include <sys/types.h>
1104		#endif
1105		#ifdef HAVE_UNISTD_H
1106		# include <unistd.h>
1107		#endif
1108	    ]],
1109	    [[
1110		extern int syscall (int, ...);
1111	    ]]
1112	)]
1113	[ntp_cv_decl_syscall=yes],
1114	[ntp_cv_decl_syscall=no]
1115    )]
1116)
1117case "$ntp_cv_decl_syscall" in
1118 yes)
1119    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1120esac
1121
1122case "$host" in
1123 *-*-aix4.3.*)
1124    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1125    ;;
1126 *-*-mpeix*)
1127    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1128    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1129    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1130    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1131    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1132    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1133    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1134    ;;
1135 *-*-osf[[45]]*)
1136    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1137    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1138    ;;
1139 *-*-qnx*)
1140    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141    ;;
1142 *-*-riscos4*)
1143    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1144    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1145    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1146    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1147    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1148    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1149    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1150    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1151    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1152    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1153    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1154    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1155    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1156    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1157    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1158    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1159    ;;
1160 *-*-solaris2*)
1161    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1162    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1163    case "$host" in
1164     *-*-solaris2.4)
1165        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1166	;;
1167    esac
1168    ;;
1169 *-*-sunos4*)
1170    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1171    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1172    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1173    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1174    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1175    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1176    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1177    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1178    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1179    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1180    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1181    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1182    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1183    case "`basename $ac_cv_prog_CC`" in
1184     acc*) ;;
1185     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1186	;;
1187    esac
1188    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1189    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1190    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1191    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1192    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1193    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1194    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1195    ;;
1196 *-*-ultrix4*)
1197    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1198    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1199    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1200    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1201    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1202    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1203    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1204    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1205    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1206    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1207    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1208    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1209    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1210    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1211    ;;
1212esac
1213
1214case "$host" in
1215 *-*-sco3.2*)
1216    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1217	[Do we need to #define _SVID3 when we #include <termios.h>?])
1218    ;;
1219esac
1220
1221case "$host" in
1222 *-*-hpux[[567]]*)
1223    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1224	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1225esac
1226
1227dnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1228AC_CACHE_CHECK(
1229    [if we will open the broadcast socket],
1230    [ntp_cv_var_open_bcast_socket],
1231    [
1232	ans=yes
1233	case "$host" in
1234	 *-*-domainos)
1235	    ans=no
1236	esac
1237	ntp_cv_var_open_bcast_socket=$ans
1238    ]
1239)
1240case "$ntp_cv_var_open_bcast_socket" in
1241 yes)
1242    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1243	[Should we open the broadcast socket?])
1244esac
1245
1246case "$host" in
1247 *-*-hpux*)
1248    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1249	[Do we want the HPUX FindConfig()?])
1250esac
1251
1252dnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1253AC_CACHE_CHECK(
1254    [if process groups are set with -pid],
1255    [ntp_cv_arg_setpgrp_negpid],
1256    [
1257	case "$host" in
1258	 *-*-hpux[[567]]*)
1259	    ans=no
1260	    ;;
1261	 *-*-hpux*)
1262	    ans=yes
1263	    ;;
1264	 *-*-*linux*)
1265	    ans=yes
1266	    ;;
1267	 *-*-sunos3*)
1268	    ans=yes
1269	    ;;
1270	 *-*-ultrix2*)
1271	    ans=yes
1272	    ;;
1273	 *)
1274	    ans=no
1275	    ;;
1276	esac
1277	ntp_cv_arg_setpgrp_negpid=$ans
1278    ]
1279)
1280case "$ntp_cv_arg_setpgrp_negpid" in
1281 yes)
1282    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1283	[Do we set process groups with -pid?])
1284esac
1285
1286AC_CACHE_CHECK(
1287    [if we need a ctty for F_SETOWN],
1288    [ntp_cv_func_ctty_for_f_setown],
1289    [
1290	case "$host" in
1291	 *-*-bsdi[[23]]*)
1292	    ans=yes
1293	    ;;
1294	 *-*-freebsd*)
1295	    ans=yes
1296	    ;;
1297	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1298	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1299	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1300	# in $host may be followed by "aout", "ecoff", or "elf".
1301	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1302	    ans=yes
1303	    ;;
1304	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1305	    ans=yes
1306	    ;;
1307	 *-*-openbsd*)
1308	    ans=yes
1309	    ;;
1310	 *-*-osf*)
1311	    ans=yes
1312	    ;;
1313	 *-*-darwin*)
1314	    ans=yes
1315	    ;;
1316	 *)
1317	    ans=no
1318	    ;;
1319	esac
1320	ntp_cv_func_ctty_for_f_setown=$ans
1321    ]
1322)
1323case "$ntp_cv_func_ctty_for_f_setown" in
1324 yes)
1325    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1326esac
1327
1328AC_CACHE_CHECK(
1329    [if the OS clears cached routes when more specifics become available],
1330    [ntp_cv_os_routeupdates],
1331    [
1332	case "$host" in
1333	 *-*-netbsd*)
1334	    ans=yes
1335	    ;;
1336	 *)
1337	    ans=no
1338	    ;;
1339	esac
1340	ntp_cv_os_routeupdates=$ans
1341    ]
1342)
1343case "$ntp_cv_os_routeupdates" in
1344 yes)
1345    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1346	[need to recreate sockets on changed routing?])
1347esac
1348
1349AC_CACHE_CHECK(
1350    [if the wildcard socket needs REUSEADDR to bind other addresses],
1351    [ntp_cv_os_wildcardreuse],
1352    [
1353	case "$host" in
1354	 *-*-*linux*)
1355	    ans=yes
1356	    ;;
1357	 *) ans=no
1358	    ;;
1359	esac
1360	ntp_cv_os_wildcardreuse=$ans
1361    ]
1362)
1363case "$ntp_cv_os_wildcardreuse" in
1364 yes)
1365    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1366	[wildcard socket needs REUSEADDR to bind interface addresses])
1367esac
1368
1369case "$host" in
1370 *-*-aix*)
1371    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1372	[Might nlist() values require an extra level of indirection (AIX)?])
1373esac
1374
1375AC_CACHE_CHECK(
1376    [for a minimum recommended value of tickadj],
1377    [ntp_cv_var_min_rec_tickadj],
1378    [
1379	ans=no
1380	case "$host" in
1381	 *-*-aix*)
1382	    ans=40
1383	    ;;
1384	esac
1385	ntp_cv_var_min_rec_tickadj=$ans
1386    ]
1387)
1388case "$ntp_cv_var_min_rec_tickadj" in
1389 ''|no)
1390    ;;
1391 *)
1392    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1393	[Should we recommend a minimum value for tickadj?])
1394esac
1395
1396AC_CACHE_CHECK(
1397    [if the TTY code permits PARENB and IGNPAR],
1398    [ntp_cv_no_parenb_ignpar],
1399    [
1400	ans=no
1401	case "$host" in
1402	 i?86-*-*linux*)
1403	    ans=yes
1404	    ;;
1405	 mips-sgi-irix*)
1406	    ans=yes
1407	    ;;
1408	 i?86-*-freebsd[[123]].*)
1409	    ;;
1410	 i?86-*-freebsd*)
1411	    ans=yes
1412	    ;;
1413	 *-*-unicosmp*)
1414	    ans=yes
1415	    ;;
1416	esac
1417	ntp_cv_no_parenb_ignpar=$ans
1418    ]
1419)
1420case "$ntp_cv_no_parenb_ignpar" in
1421 yes)
1422    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1423	[Is there a problem using PARENB and IGNPAR?])
1424esac
1425
1426AC_MSG_CHECKING([if we're including processing time debugging code])
1427AC_ARG_ENABLE(
1428    [debug-timing],
1429    [AS_HELP_STRING(
1430	[--enable-debug-timing],
1431	[- include processing time debugging code (costs performance)]
1432    )],
1433    [ntp_ok=$enableval],
1434    [ntp_ok=no]
1435)
1436case "$ntp_ok" in
1437 yes)
1438    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1439esac
1440AC_MSG_RESULT([$ntp_ok])
1441
1442AC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1443AC_ARG_ENABLE(
1444    [dst-minutes],
1445    [AS_HELP_STRING(
1446	[--enable-dst-minutes],
1447	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1448    ],
1449    [ans=$enableval],
1450    [ans=60]
1451)
1452AC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1453    [The number of minutes in a DST adjustment])
1454AC_MSG_RESULT([$ans])
1455
1456AC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1457AC_ARG_ENABLE(
1458    [ignore-dns-errors],
1459    [AS_HELP_STRING(
1460	[--enable-ignore-dns-errors],
1461	[- retry DNS queries on any error]
1462    )],
1463    [ans=$enableval],
1464    [ans=no]
1465)
1466case "$ans" in
1467 yes)
1468    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1469	[Retry queries on _any_ DNS error?])
1470esac
1471AC_MSG_RESULT([$ans])
1472
1473AC_CACHE_CHECK(
1474    [availability of ntp_{adj,get}time()],
1475    [ntp_cv_var_ntp_syscalls],
1476    [
1477	ntp_cv_var_ntp_syscalls=no
1478	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1479	 yesyes*)
1480	    ntp_cv_var_ntp_syscalls=libc
1481	    ;;
1482	 *yes)
1483	    ntp_cv_var_ntp_syscalls=inline
1484	    ;;
1485	 *)
1486	    AC_PREPROC_IFELSE(
1487		[AC_LANG_SOURCE(
1488		    [
1489			#include <sys/syscall.h>
1490			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1491			# error
1492			#endif
1493		    ])],
1494		[ntp_cv_var_ntp_syscalls=kernel]
1495	    )
1496	    ;;
1497	 esac
1498    ]
1499)
1500case "$ntp_cv_var_ntp_syscalls" in
1501 libc)
1502    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1503	[Do we have ntp_{adj,get}time in libc?])
1504    ;;
1505 kernel)
1506    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1507	[Do we have ntp_{adj,get}time in the kernel?])
1508    ;;
1509esac
1510
1511AC_CACHE_CHECK(
1512    [if sys/timex.h has STA_FLL],
1513    [ntp_cv_var_sta_fll],
1514    [AC_PREPROC_IFELSE(
1515	[AC_LANG_SOURCE(
1516	    [
1517		#include <sys/timex.h>
1518		#ifndef STA_FLL
1519		# error
1520		#endif
1521	    ])],
1522	[ntp_cv_var_sta_fll=yes],
1523	[ntp_cv_var_sta_fll=no]
1524    )]
1525)
1526
1527AC_CACHE_CHECK(
1528    [if we have kernel PLL support],
1529    [ntp_cv_var_kernel_pll],
1530    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1531	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1532	 *no*)
1533	    ntp_cv_var_kernel_pll=no
1534	    ;;
1535	 *) ntp_cv_var_kernel_pll=yes
1536	    ;;
1537	esac
1538    ]
1539)
1540case "$ntp_cv_var_kernel_pll" in
1541 yes)
1542    AC_DEFINE([KERNEL_PLL], [1],
1543	[Does the kernel support precision time discipline?])
1544esac
1545
1546AC_CACHE_CHECK(
1547    [if SIOCGIFCONF returns buffer size in the buffer],
1548    [ntp_cv_size_returned_in_buffer],
1549    [
1550	ans=no
1551	case "$host" in
1552	 *-fujitsu-uxp*)
1553	    ans=yes
1554	    ;;
1555	 *-ncr-sysv4*)
1556	    ans=yes
1557	    ;;
1558	 *-univel-sysv*)
1559	    ans=yes
1560	    ;;
1561	esac
1562	ntp_cv_size_returned_in_buffer=$ans
1563    ]
1564)
1565case "$ntp_cv_size_returned_in_buffer" in
1566 yes)
1567    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1568	[Does SIOCGIFCONF return size in the buffer?])
1569esac
1570
1571# Check for ioctls TIOCGPPSEV
1572AC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1573case "$ac_cv_header_termios_h" in
1574 yes)
1575    AC_PREPROC_IFELSE(
1576	[AC_LANG_SOURCE([
1577	    #include <termios.h>
1578	    #ifndef TIOCGPPSEV
1579	    # error
1580	    #endif
1581	])],
1582	[ntp_ok=yes],
1583	[ntp_ok=no]
1584    )
1585    ;;
1586 *)
1587    ntp_ok=no
1588    ;;
1589esac
1590case "$ntp_ok" in
1591 yes)
1592    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1593	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1594esac
1595AC_MSG_RESULT([$ntp_ok])
1596
1597# Check for ioctls TIOCSPPS
1598AC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1599case "$ac_cv_header_termios_h" in
1600 yes)
1601    AC_PREPROC_IFELSE(
1602	[AC_LANG_SOURCE([
1603	    #include <termios.h>
1604	    #ifndef TIOCSPPS
1605	    # error
1606	    #endif
1607	 ])],
1608	 [ntp_ok=yes],
1609	 [ntp_ok=no]
1610    )
1611    ;;
1612 *)
1613    ntp_ok=no
1614    ;;
1615esac
1616case "$ntp_ok" in
1617 yes)
1618    AC_DEFINE([HAVE_TIOCSPPS], [1],
1619	[Do we have the TIOCSPPS ioctl (Solaris)?])
1620esac
1621AC_MSG_RESULT([$ntp_ok])
1622
1623# Check for ioctls CIOGETEV
1624AC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1625case "$ac_cv_header_sys_ppsclock_h" in
1626 yes)
1627    AC_PREPROC_IFELSE(
1628	[AC_LANG_SOURCE([
1629	    #include <sys/ppsclock.h>
1630	    #ifndef CIOGETEV
1631	    # error
1632	    #endif
1633	])],
1634	[ntp_ok=yes],
1635	[ntp_ok=no]
1636    )
1637    ;;
1638 *)
1639    ntp_ok=no
1640    ;;
1641esac
1642case "$ntp_ok" in
1643 yes)
1644    AC_DEFINE([HAVE_CIOGETEV], [1],
1645	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1646esac
1647AC_MSG_RESULT([$ntp_ok])
1648
1649# ATOM/PPSAPI stuff.
1650
1651ntp_atom_ok=yes
1652
1653# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1654
1655# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1656# The PPSAPI needs struct timespec.
1657# The PPSAPI also needs a timepps header.
1658
1659case "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1660 inlineyes)
1661    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1662     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1663	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1664	ntp_jupiter_ok=yes
1665	ntp_oncore_ok=yes
1666	ntp_parse_ok=yes
1667	ntp_ripe_ncc_ok=yes
1668	;;
1669    esac
1670    ;;
1671esac
1672
1673# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1674AC_CHECK_HEADER([linux/serial.h])
1675case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1676  yesyes)
1677    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1678    AC_PREPROC_IFELSE(
1679	[AC_LANG_SOURCE([
1680	    #include <sys/time.h>
1681	    typedef int u_int;
1682	    #include <sys/ppsclock.h>
1683	    #include <linux/serial.h>
1684
1685	    #ifndef TIOCGSERIAL
1686	    # error
1687	    #endif
1688	    #ifndef TIOCSSERIAL
1689	    # error
1690	    #endif
1691	    #ifndef ASYNC_PPS_CD_POS
1692	    # error
1693	    #endif
1694	    #ifndef ASYNC_PPS_CD_NEG
1695	    # error
1696	    #endif
1697	    #ifndef CIOGETEV
1698	    # error
1699	    #endif
1700	])],
1701	[ntp_ok=yes],
1702	[ntp_ok=no]
1703    )
1704    AC_MSG_RESULT([$ntp_ok])
1705    ;;
1706  *)
1707    ntp_ok=no
1708    ;;
1709esac
1710case "$ntp_ok" in
1711 yes)
1712    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1713	[Do we have the TIO serial stuff?])
1714esac
1715
1716# Check for SHMEM_STATUS support
1717AC_MSG_CHECKING([SHMEM_STATUS support])
1718case "$ac_cv_header_sys_mman_h" in
1719 yes)
1720    ntp_ok=yes
1721    ;;
1722 *)
1723    ntp_ok=no
1724    ;;
1725esac
1726case "$ntp_ok" in
1727 yes)
1728    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1729	[Do we have support for SHMEM_STATUS?])
1730esac
1731AC_MSG_RESULT([$ntp_ok])
1732
1733ntp_refclock=no
1734
1735# HPUX only, and by explicit request
1736AC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1737AC_ARG_ENABLE(
1738    [BANCOMM],
1739    [AS_HELP_STRING(
1740	[--enable-BANCOMM],
1741	[- Datum/Bancomm bc635/VME interface]
1742    )],
1743    [ntp_ok=$enableval],
1744    [ntp_ok=no]
1745)
1746case "$ntp_ok" in
1747 yes)
1748    ntp_refclock=yes
1749    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1750    AC_SEARCH_LIBS([bcStartPci], [bcsdk], , , [])
1751    ;;
1752esac
1753AC_MSG_RESULT([$ntp_ok])
1754case "$ntp_ok$host" in
1755 yes*-*-hpux*) ;;
1756 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1757esac
1758
1759#HPUX only, and only by explicit request
1760AC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1761AC_ARG_ENABLE(
1762    [GPSVME],
1763    [AS_HELP_STRING(
1764	[--enable-GPSVME],
1765	[- TrueTime GPS receiver/VME interface]
1766    )],
1767    [ntp_ok=$enableval],
1768    [ntp_ok=no]
1769)
1770case "$ntp_ok" in
1771 yes)
1772    ntp_refclock=yes
1773    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1774    ;;
1775esac
1776AC_MSG_RESULT([$ntp_ok])
1777case "$ntp_ok$host" in
1778 yes*-*-hpux*) ;;
1779 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1780esac
1781
1782AC_MSG_CHECKING([for PCL720 clock support])
1783case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1784 yesyesyes)
1785    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1786    ans=yes
1787    ;;
1788 *)
1789    ans=no
1790    ;;
1791esac
1792AC_MSG_RESULT([$ans])
1793
1794AC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1795AC_ARG_ENABLE(
1796    [all-clocks],
1797    [AS_HELP_STRING(
1798	[--enable-all-clocks],
1799	[+ include all suitable non-PARSE clocks:]
1800    )],
1801    [ntp_eac=$enableval],
1802    [ntp_eac=yes]
1803)
1804AC_MSG_RESULT([$ntp_eac])
1805
1806# HMS: Should we also require ntp_parse_ok?
1807AC_MSG_CHECKING([if we have support for PARSE clocks])
1808case "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1809 yes*yes*)
1810    ntp_canparse=yes
1811    ;;
1812 *) ntp_canparse=no
1813    ;;
1814esac
1815AC_MSG_RESULT([$ntp_canparse])
1816
1817AC_MSG_CHECKING([if we have support for audio clocks])
1818case "$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
1819 *yes*)
1820    ntp_canaudio=yes
1821    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1822    ;;
1823 *) ntp_canaudio=no ;;
1824esac
1825AC_MSG_RESULT([$ntp_canaudio])
1826
1827AC_MSG_CHECKING([if we have support for the SHM refclock interface])
1828case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1829 yesyes)
1830    ntp_canshm=yes
1831    ;;
1832 *) ntp_canshm=no ;;
1833esac
1834AC_MSG_RESULT([$ntp_canshm])
1835
1836# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1837AC_CACHE_CHECK(
1838    [for termios modem control],
1839    [ntp_cv_modem_control],
1840    [AC_COMPILE_IFELSE(
1841	[AC_LANG_PROGRAM(
1842	    [[
1843		#ifdef HAVE_UNISTD_H
1844		# include <unistd.h>
1845		#endif
1846		#ifdef HAVE_TERMIOS_H
1847		# include <termios.h>
1848		#endif
1849		#ifdef HAVE_SYS_IOCTL_H
1850		# include <sys/ioctl.h>
1851		#endif
1852	    ]],
1853	    [[
1854		int	dtr = TIOCM_DTR;
1855
1856		ioctl(1, TIOCMBIS, (char *)&dtr);
1857	    ]]
1858	)],
1859	[ntp_cv_modem_control=yes],
1860	[ntp_cv_modem_control=no]
1861    )]
1862)
1863case "$ntp_eac::$ntp_cv_modem_control" in
1864 yes::yes)
1865    ntp_enable_all_modem_control_clocks=yes
1866    ;;
1867 *)
1868    ntp_enable_all_modem_control_clocks=no
1869    ;;
1870esac
1871
1872# Requires modem control
1873AC_MSG_CHECKING([ACTS modem service])
1874AC_ARG_ENABLE(
1875    [ACTS],
1876    [AS_HELP_STRING(
1877	[--enable-ACTS],
1878	[s ACTS modem service]
1879    )],
1880    [ntp_ok=$enableval],
1881    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1882)
1883case "$ntp_ok" in
1884 yes)
1885    ntp_refclock=yes
1886    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1887    ;;
1888esac
1889AC_MSG_RESULT([$ntp_ok])
1890
1891AC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1892AC_ARG_ENABLE(
1893    [ARBITER],
1894    [AS_HELP_STRING(
1895	[--enable-ARBITER],
1896	[+ Arbiter 1088A/B GPS receiver]
1897    )],
1898    [ntp_ok=$enableval],
1899    [ntp_ok=$ntp_eac]
1900)
1901case "$ntp_ok" in
1902 yes)
1903    ntp_refclock=yes
1904    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1905    ;;
1906esac
1907AC_MSG_RESULT([$ntp_ok])
1908
1909AC_MSG_CHECKING([Arcron MSF receiver])
1910AC_ARG_ENABLE(
1911    [ARCRON_MSF],
1912    [AS_HELP_STRING(
1913	[--enable-ARCRON-MSF],
1914	[+ Arcron MSF receiver]
1915    )],
1916    [ntp_ok=$enableval],
1917    [ntp_ok=$ntp_eac]
1918)
1919case "$ntp_ok" in
1920 yes)
1921    ntp_refclock=yes
1922    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1923    ;;
1924esac
1925AC_MSG_RESULT([$ntp_ok])
1926
1927AC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1928AC_ARG_ENABLE(
1929    [AS2201],
1930    [AS_HELP_STRING(
1931	[--enable-AS2201],
1932	[+ Austron 2200A/2201A GPS receiver]
1933    )],
1934    [ntp_ok=$enableval],
1935    [ntp_ok=$ntp_eac]
1936)
1937case "$ntp_ok" in
1938 yes)
1939    ntp_refclock=yes
1940    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1941    ;;
1942esac
1943AC_MSG_RESULT([$ntp_ok])
1944
1945AC_MSG_CHECKING([ATOM PPS interface])
1946AC_ARG_ENABLE(
1947    [ATOM],
1948    [AS_HELP_STRING(
1949	[--enable-ATOM],
1950	[s ATOM PPS interface]
1951    )],
1952    [ntp_ok=$enableval],
1953    [ntp_ok=$ntp_eac]
1954)
1955case "$ntp_atom_ok" in
1956 no) ntp_ok=no ;;
1957esac
1958case "$ntp_ok" in
1959 yes)
1960    ntp_refclock=yes
1961    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1962    ;;
1963esac
1964AC_MSG_RESULT([$ntp_ok])
1965
1966AC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1967AC_ARG_ENABLE(
1968    [CHRONOLOG],
1969    [AS_HELP_STRING(
1970	[--enable-CHRONOLOG],
1971	[+ Chrono-log K-series WWVB receiver]
1972    )],
1973    [ntp_ok=$enableval],
1974    [ntp_ok=$ntp_eac]
1975)
1976case "$ntp_ok" in
1977 yes)
1978    ntp_refclock=yes
1979    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1980    ;;
1981esac
1982AC_MSG_RESULT([$ntp_ok])
1983
1984AC_MSG_CHECKING([CHU modem/decoder])
1985AC_ARG_ENABLE(
1986    [CHU],
1987    [AS_HELP_STRING(
1988	[--enable-CHU],
1989	[+ CHU modem/decoder]
1990    )],
1991    [ntp_ok=$enableval],
1992    [ntp_ok=$ntp_eac]
1993)
1994case "$ntp_ok" in
1995 yes)
1996    ntp_refclock=yes
1997    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1998    ;;
1999esac
2000AC_MSG_RESULT([$ntp_ok])
2001ntp_refclock_chu=$ntp_ok
2002
2003AC_MSG_CHECKING([CHU audio/decoder])
2004AC_ARG_ENABLE(
2005    [AUDIO-CHU],
2006    [AS_HELP_STRING(
2007	[--enable-AUDIO-CHU],
2008	[s CHU audio/decoder]
2009    )],
2010    [ntp_ok=$enableval],
2011    [
2012	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2013	 *no*)	ntp_ok=no  ;;
2014	 *)	ntp_ok=yes ;;
2015	esac
2016    ]
2017)
2018AC_MSG_RESULT([$ntp_ok])
2019# We used to check for sunos/solaris target...
2020case "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2021 yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2022esac
2023
2024# Not under HP-UX
2025AC_MSG_CHECKING([Datum Programmable Time System])
2026AC_ARG_ENABLE(
2027    [DATUM],
2028    [AS_HELP_STRING(
2029	[--enable-DATUM],
2030	[s Datum Programmable Time System]
2031    )],
2032    [ntp_ok=$enableval],
2033    [
2034	case "$ac_cv_header_termios_h" in
2035	 yes)
2036	    ntp_ok=$ntp_eac
2037	    ;;
2038	 *) ntp_ok=no
2039	    ;;
2040	esac
2041    ]
2042)
2043case "$ntp_ok" in
2044 yes)
2045    ntp_refclock=yes
2046    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2047    ;;
2048esac
2049AC_MSG_RESULT([$ntp_ok])
2050
2051AC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2052AC_ARG_ENABLE(
2053    [DUMBCLOCK],
2054    [AS_HELP_STRING(
2055	[--enable-DUMBCLOCK],
2056	[+ Dumb generic hh:mm:ss local clock]
2057    )],
2058    [ntp_ok=$enableval],
2059    [ntp_ok=$ntp_eac]
2060)
2061case "$ntp_ok" in
2062 yes)
2063    ntp_refclock=yes
2064    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2065    ;;
2066esac
2067AC_MSG_RESULT([$ntp_ok])
2068
2069AC_MSG_CHECKING([Forum Graphic GPS])
2070AC_ARG_ENABLE(
2071    [FG],
2072    [AS_HELP_STRING(
2073	[--enable-FG],
2074	[+ Forum Graphic GPS]
2075    )],
2076    [ntp_ok=$enableval],
2077    [ntp_ok=$ntp_eac]
2078)
2079case "$ntp_ok" in
2080 yes)
2081    ntp_refclock=yes
2082    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2083    ;;
2084esac
2085AC_MSG_RESULT([$ntp_ok])
2086
2087# Requires modem control
2088AC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2089AC_ARG_ENABLE(
2090    [HEATH],
2091    [AS_HELP_STRING(
2092	[--enable-HEATH],
2093	[s Heath GC-1000 WWV/WWVH receiver]
2094    )],
2095    [ntp_ok=$enableval],
2096    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2097)
2098case "$ntp_ok" in
2099 yes)
2100    ntp_refclock=yes
2101    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2102    ;;
2103esac
2104AC_MSG_RESULT([$ntp_ok])
2105
2106AC_MSG_CHECKING([for hopf serial clock device])
2107AC_ARG_ENABLE(
2108    [HOPFSERIAL],
2109    [AS_HELP_STRING(
2110	[--enable-HOPFSERIAL],
2111	[+ hopf serial clock device]
2112    )],
2113    [ntp_ok=$enableval],
2114    [ntp_ok=$ntp_eac]
2115)
2116case "$ntp_ok" in
2117 yes)
2118    ntp_refclock=yes
2119    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2120    ;;
2121esac
2122AC_MSG_RESULT([$ntp_ok])
2123
2124AC_MSG_CHECKING([for hopf PCI clock 6039])
2125AC_ARG_ENABLE(
2126    [HOPFPCI],
2127    [AS_HELP_STRING(
2128	[--enable-HOPFPCI],
2129	[+ hopf 6039 PCI board]
2130    )],
2131    [ntp_ok=$enableval],
2132    [ntp_ok=$ntp_eac]
2133)
2134case "$ntp_ok" in
2135 yes)
2136    ntp_refclock=yes
2137    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2138    ;;
2139esac
2140AC_MSG_RESULT([$ntp_ok])
2141
2142AC_MSG_CHECKING([HP 58503A GPS receiver])
2143AC_ARG_ENABLE(
2144    [HPGPS],
2145    [AS_HELP_STRING(
2146	[--enable-HPGPS],
2147	[+ HP 58503A GPS receiver]
2148    )],
2149    [ntp_ok=$enableval],
2150    [ntp_ok=$ntp_eac]
2151)
2152case "$ntp_ok" in
2153 yes)
2154    ntp_refclock=yes
2155    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2156    ;;
2157esac
2158AC_MSG_RESULT([$ntp_ok])
2159
2160AC_MSG_CHECKING([IRIG audio decoder])
2161AC_ARG_ENABLE(
2162    [IRIG],
2163    [AS_HELP_STRING(
2164	[--enable-IRIG],
2165	[s IRIG audio decoder]
2166    )],
2167    [ntp_ok=$enableval],
2168    [
2169	case "$ntp_eac$ntp_canaudio" in
2170	 *no*)	ntp_ok=no  ;;
2171	 *)	ntp_ok=yes ;;
2172	esac
2173    ]
2174)
2175case "$ntp_ok" in
2176 yes)
2177    ntp_refclock=yes
2178    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2179    ;;
2180esac
2181AC_MSG_RESULT([$ntp_ok])
2182case "$ntp_ok$ntp_canaudio" in
2183 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2184esac
2185
2186AC_MSG_CHECKING([for JJY receiver])
2187AC_ARG_ENABLE(
2188    [JJY],
2189    [AS_HELP_STRING(
2190	[--enable-JJY],
2191	[+ JJY receiver]
2192    )],
2193    [ntp_ok=$enableval],
2194    [ntp_ok=$ntp_eac]
2195)
2196case "$ntp_ok" in
2197 yes)
2198    ntp_refclock=yes
2199    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2200    ;;
2201esac
2202AC_MSG_RESULT([$ntp_ok])
2203
2204AC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2205AC_ARG_ENABLE(
2206    [JUPITER],
2207    [AS_HELP_STRING(
2208	[--enable-JUPITER],
2209	[s Rockwell Jupiter GPS receiver]
2210    )],
2211    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2212case "$ntp_jupiter_ok" in
2213 no) ntp_ok=no ;;
2214esac
2215case "$ntp_ok" in
2216 yes)
2217    ntp_refclock=yes
2218    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2219    ;;
2220esac
2221AC_MSG_RESULT([$ntp_ok])
2222
2223AC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2224AC_ARG_ENABLE(
2225    [LEITCH],
2226    [AS_HELP_STRING(
2227	[--enable-LEITCH],
2228	[+ Leitch CSD 5300 Master Clock System Driver]
2229    )],
2230    [ntp_ok=$enableval],
2231    [ntp_ok=$ntp_eac]
2232)
2233case "$ntp_ok" in
2234 yes)
2235    ntp_refclock=yes
2236    AC_DEFINE([CLOCK_LEITCH], [1],
2237	[Leitch CSD 5300 Master Clock System Driver?])
2238    ;;
2239esac
2240AC_MSG_RESULT([$ntp_ok])
2241
2242AC_MSG_CHECKING([local clock reference])
2243AC_ARG_ENABLE(
2244    [LOCAL-CLOCK],
2245    [AS_HELP_STRING(
2246	[--enable-LOCAL-CLOCK],
2247	[+ local clock reference]
2248    )],
2249    [ntp_ok=$enableval],
2250    [ntp_ok=$ntp_eac]
2251)
2252case "$ntp_ok" in
2253 yes)
2254    ntp_refclock=yes
2255    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2256    ;;
2257esac
2258AC_MSG_RESULT([$ntp_ok])
2259
2260dnl Bug 340: longstanding unfixed bugs
2261dnl AC_MSG_CHECKING([EES M201 MSF receiver])
2262dnl AC_ARG_ENABLE([MSFEES],
2263dnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2264dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2265dnl if test "$ntp_ok" = "yes"; then
2266dnl     ntp_refclock=yes
2267dnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2268dnl fi
2269dnl AC_MSG_RESULT([$ntp_ok])
2270
2271# Not Ultrix
2272AC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2273AC_ARG_ENABLE(
2274    [MX4200],
2275    [AS_HELP_STRING(
2276	[--enable-MX4200 ],
2277	[s Magnavox MX4200 GPS receiver]
2278    )],
2279    [ntp_ok=$enableval],
2280    [
2281	case "$ac_cv_var_ppsclock" in
2282	 yes)
2283	    ntp_ok=$ntp_eac
2284	    ;;
2285	 *)
2286	    ntp_ok=no
2287	    ;;
2288	esac
2289    ]
2290)
2291case "$ntp_ok" in
2292 yes)
2293    ntp_refclock=yes
2294    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2295    ;;
2296esac
2297AC_MSG_RESULT([$ntp_ok])
2298case "$ntp_ok$host" in
2299 yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2300esac
2301
2302AC_MSG_CHECKING([for NeoClock4X receiver])
2303AC_ARG_ENABLE(
2304    [NEOCLOCK4X],
2305    [AS_HELP_STRING(
2306	[--enable-NEOCLOCK4X],
2307	[+ NeoClock4X DCF77 / TDF receiver]
2308    )],
2309    [ntp_ok=$enableval],
2310    [ntp_ok=$ntp_eac]
2311)
2312case "$ntp_ok" in
2313 yes)
2314    ntp_refclock=yes
2315    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2316    ;;
2317esac
2318AC_MSG_RESULT([$ntp_ok])
2319
2320AC_MSG_CHECKING([NMEA GPS receiver])
2321AC_ARG_ENABLE(
2322    [NMEA],
2323    [AS_HELP_STRING(
2324	[--enable-NMEA],
2325	[+ NMEA GPS receiver]
2326    )],
2327    [ntp_ok=$enableval],
2328    [ntp_ok=$ntp_eac]
2329)
2330case "$ntp_ok" in
2331 yes)
2332    ntp_refclock=yes
2333    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2334    ;;
2335esac
2336AC_MSG_RESULT([$ntp_ok])
2337
2338AC_CHECK_FUNCS([strtoll])
2339AC_MSG_CHECKING([for GPSD JSON receiver])
2340AC_ARG_ENABLE(
2341    [GPSD],
2342    [AS_HELP_STRING(
2343	[--enable-GPSD],
2344	[+ GPSD JSON receiver]
2345    )],
2346    [ntp_ok=$enableval],
2347    [case "$ac_cv_func_strtoll" in
2348     yes) ntp_ok=$ntp_eac ;;
2349     *)   ntp_ok="no" ;;
2350    esac]
2351)
2352case "$ntp_ok" in
2353 yes)
2354    ntp_refclock=yes
2355    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2356    ;;
2357esac
2358AC_MSG_RESULT([$ntp_ok])
2359
2360AC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2361AC_ARG_ENABLE(
2362    [ONCORE],
2363    [AS_HELP_STRING(
2364	[--enable-ONCORE],
2365	[s Motorola VP/UT Oncore GPS receiver]
2366    )],
2367    [ntp_ok=$enableval],
2368    [ntp_ok=$ntp_eac]
2369)
2370case "$ntp_oncore_ok" in
2371 no) ntp_ok=no ;;
2372esac
2373case "$ntp_ok" in
2374 yes)
2375    ntp_refclock=yes
2376    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2377    ;;
2378esac
2379AC_MSG_RESULT([$ntp_ok])
2380
2381# Requires modem control
2382AC_MSG_CHECKING([for Palisade clock])
2383AC_ARG_ENABLE(
2384    [PALISADE],
2385    [AS_HELP_STRING(
2386	[--enable-PALISADE],
2387	[s Palisade clock]
2388    )],
2389    [ntp_ok=$enableval],
2390    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2391)
2392case "$ntp_ok" in
2393 yes)
2394    ntp_refclock=yes
2395    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2396    ;;
2397esac
2398AC_MSG_RESULT([$ntp_ok])
2399
2400AC_MSG_CHECKING([Conrad parallel port radio clock])
2401AC_ARG_ENABLE(
2402    [PCF],
2403    [AS_HELP_STRING(
2404	[--enable-PCF ],
2405	[+ Conrad parallel port radio clock]
2406    )],
2407    [ntp_ok=$enableval],
2408    [ntp_ok=$ntp_eac]
2409)
2410case "$ntp_ok" in
2411 yes)
2412    ntp_refclock=yes
2413    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2414    ;;
2415esac
2416AC_MSG_RESULT([$ntp_ok])
2417
2418AC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2419AC_ARG_ENABLE(
2420    [PST],
2421    [AS_HELP_STRING(
2422	[--enable-PST],
2423	[+ PST/Traconex 1020 WWV/WWVH receiver]
2424    )],
2425    [ntp_ok=$enableval],
2426    [ntp_ok=$ntp_eac]
2427)
2428case "$ntp_ok" in
2429 yes)
2430    ntp_refclock=yes
2431    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2432    ;;
2433esac
2434AC_MSG_RESULT([$ntp_ok])
2435
2436AC_MSG_CHECKING([RIPENCC specific Trimble driver])
2437AC_ARG_ENABLE(
2438    [RIPENCC],
2439    [AS_HELP_STRING(
2440	[--enable-RIPENCC],
2441	[- RIPENCC specific Trimble driver]
2442    )],
2443    [ntp_ok=$enableval],
2444    [ntp_ok=no]
2445)
2446# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2447case "$ntp_ripe_ncc_ok" in
2448 no) ntp_ok=no ;;
2449esac
2450case "$ntp_ok" in
2451 yes)
2452    ntp_refclock=yes
2453    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2454    ;;
2455esac
2456AC_MSG_RESULT([$ntp_ok])
2457
2458# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2459# For *IX, we need sys/ipc.h and sys/shm.h.
2460AC_MSG_CHECKING([for SHM clock attached thru shared memory])
2461AC_ARG_ENABLE(
2462    [SHM],
2463    [AS_HELP_STRING(
2464	[--enable-SHM],
2465	[s SHM clock attached thru shared memory]
2466    )],
2467    [ntp_ok=$enableval],
2468    [
2469	case "$ntp_eac$ntp_canshm" in
2470	 *no*)	ntp_ok=no  ;;
2471	 *)	ntp_ok=yes ;;
2472	esac
2473    ]
2474)
2475case "$ntp_ok" in
2476 yes)
2477    ntp_refclock=yes
2478    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2479    ;;
2480esac
2481AC_MSG_RESULT([$ntp_ok])
2482
2483AC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2484AC_ARG_ENABLE(
2485    [SPECTRACOM],
2486    [AS_HELP_STRING(
2487	[--enable-SPECTRACOM],
2488	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2489    )],
2490    [ntp_ok=$enableval],
2491    [ntp_ok=$ntp_eac]
2492)
2493case "$ntp_ok" in
2494 yes)
2495    ntp_refclock=yes
2496    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2497	[Spectracom 8170/Netclock/2 WWVB receiver])
2498    ;;
2499esac
2500AC_MSG_RESULT([$ntp_ok])
2501
2502AC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2503AC_ARG_ENABLE(
2504    [TPRO],
2505    [AS_HELP_STRING(
2506	[--enable-TPRO],
2507	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2508    )],
2509    [ntp_ok=$enableval],
2510    [
2511	case "$ac_cv_header_sys_tpro_h" in
2512	 yes)
2513	    ntp_ok=$ntp_eac
2514	    ;;
2515	 *)
2516	    ntp_ok=no
2517	    ;;
2518	esac
2519    ]
2520)
2521case "$ntp_ok" in
2522 yes)
2523    ntp_refclock=yes
2524    AC_DEFINE([CLOCK_TPRO], [1],
2525	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2526    ;;
2527esac
2528AC_MSG_RESULT([$ntp_ok])
2529case "$ntp_ok$ac_cv_header_sys_tpro" in
2530 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2531esac
2532
2533# Not on a vax-dec-bsd
2534AC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2535AC_ARG_ENABLE(
2536    [TRUETIME],
2537    [AS_HELP_STRING(
2538	[--enable-TRUETIME],
2539	[s Kinemetrics/TrueTime receivers]
2540    )],
2541    [ntp_ok=$enableval],
2542    [
2543	case "$host" in
2544	 vax-dec-bsd)
2545	    ntp_ok=no
2546	    ;;
2547	 *)
2548	    ntp_ok=$ntp_eac
2549	    ;;
2550	esac
2551    ]
2552)
2553case "$ntp_ok" in
2554 yes)
2555    ntp_refclock=yes
2556    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2557    ;;
2558esac
2559AC_MSG_RESULT([$ntp_ok])
2560case "$ntp_ok$host" in
2561 yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2562esac
2563
2564AC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2565AC_ARG_ENABLE(
2566    [TT560],
2567    [AS_HELP_STRING(
2568	[--enable-TT560],
2569	[- TrueTime 560 IRIG-B decoder]
2570    )],
2571    [ntp_ok=$enableval],
2572    [ntp_ok=no]
2573)
2574case "$ntp_ok" in
2575 yes)
2576    ntp_refclock=yes
2577    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2578    ;;
2579esac
2580AC_MSG_RESULT([$ntp_ok])
2581
2582AC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2583AC_ARG_ENABLE(
2584    [ULINK],
2585    [AS_HELP_STRING(
2586	[--enable-ULINK],
2587	[+ Ultralink WWVB receiver]
2588    )],
2589    [ntp_ok=$enableval],
2590    [ntp_ok=$ntp_eac]
2591)
2592case "$ntp_ok" in
2593 yes)
2594    ntp_refclock=yes
2595    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2596    ;;
2597esac
2598AC_MSG_RESULT([$ntp_ok])
2599
2600AC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2601AC_ARG_ENABLE(
2602    [TSYNCPCI],
2603    [AS_HELP_STRING(
2604	[--enable-TSYNCPCI],
2605	[s Spectracom TSYNC timing board]
2606    )],
2607    [ntp_ok=$enableval],
2608    [
2609	case "$host" in
2610	 *-*-*linux*)
2611	    ntp_ok=$ntp_eac
2612	    ;;
2613	 *)
2614	    ntp_ok=no
2615	esac
2616    ]
2617)
2618case "$ntp_ok" in
2619 yes)
2620    ntp_refclock=yes
2621    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2622    ;;
2623esac
2624AC_MSG_RESULT([$ntp_ok])
2625
2626AC_MSG_CHECKING([WWV receiver])
2627AC_ARG_ENABLE(
2628    [WWV],
2629    [AS_HELP_STRING(
2630	[--enable-WWV],
2631	[s WWV Audio receiver]
2632    )],
2633    [ntp_ok=$enableval],
2634    [
2635	case "$ntp_eac$ntp_canaudio" in
2636	 *no*)	ntp_ok=no  ;;
2637	 *)	ntp_ok=yes ;;
2638	esac
2639    ]
2640)
2641case "$ntp_ok" in
2642 yes)
2643    ntp_refclock=yes
2644    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2645    ;;
2646esac
2647AC_MSG_RESULT([$ntp_ok])
2648case "$ntp_ok$ntp_canaudio" in
2649 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2650esac
2651
2652AC_MSG_CHECKING([for Zyfer receiver])
2653AC_ARG_ENABLE(
2654    [ZYFER],
2655    [AS_HELP_STRING(
2656	[--enable-ZYFER],
2657	[+ Zyfer GPStarplus receiver]
2658    )],
2659    [ntp_ok=$enableval],
2660    [ntp_ok=$ntp_eac]
2661)
2662case "$ntp_ok" in
2663 yes)
2664    ntp_refclock=yes
2665    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2666    ;;
2667esac
2668AC_MSG_RESULT([$ntp_ok])
2669
2670AC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2671AC_ARG_ENABLE(
2672    [parse-clocks],
2673    [AS_HELP_STRING(
2674	[--enable-parse-clocks],
2675	[- include all suitable PARSE clocks:]
2676    )],
2677    [ntp_eapc=$enableval],
2678    [
2679	case "$ntp_eac" in
2680	 yes)	ntp_eapc=$ntp_canparse ;;
2681	 *)	ntp_eapc=no ;;
2682	esac
2683	# Delete the next line one of these days
2684	ntp_eapc=no
2685    ]
2686)
2687AC_MSG_RESULT($ntp_eapc)
2688
2689case "$ntp_eac$ntp_eapc$ntp_canparse" in
2690 noyes*)
2691    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2692    ;;
2693 yesyesno)
2694    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2695    ;;
2696esac
2697
2698ntp_libparse=no
2699ntp_parseutil=no
2700ntp_rawdcf=no
2701
2702AC_MSG_CHECKING([Diem Computime Radio Clock])
2703AC_ARG_ENABLE(
2704    [COMPUTIME],
2705    [AS_HELP_STRING(
2706	[--enable-COMPUTIME],
2707	[s Diem Computime Radio Clock]
2708    )],
2709    [ntp_ok=$enableval],
2710    [ntp_ok=$ntp_eapc]
2711)
2712case "$ntp_ok" in
2713 yes)
2714    ntp_libparse=yes
2715    ntp_refclock=yes
2716    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2717    ;;
2718esac
2719AC_MSG_RESULT([$ntp_ok])
2720case "$ntp_ok$ntp_canparse" in
2721 yesno)
2722    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2723esac
2724
2725AC_MSG_CHECKING([ELV/DCF7000 clock])
2726AC_ARG_ENABLE(
2727    [DCF7000],
2728    [AS_HELP_STRING(
2729	[--enable-DCF7000],
2730	[s ELV/DCF7000 clock]
2731    )],
2732    [ntp_ok=$enableval],
2733    [ntp_ok=$ntp_eapc]
2734)
2735case "$ntp_ok" in
2736 yes)
2737    ntp_libparse=yes
2738    ntp_refclock=yes
2739    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2740    ;;
2741esac
2742AC_MSG_RESULT([$ntp_ok])
2743case "$ntp_ok$ntp_canparse" in
2744 yesno)
2745    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2746esac
2747
2748AC_MSG_CHECKING([HOPF 6021 clock])
2749AC_ARG_ENABLE(
2750    [HOPF6021],
2751    [AS_HELP_STRING(
2752	[--enable-HOPF6021],
2753	[s HOPF 6021 clock]
2754    )],
2755    [ntp_ok=$enableval],
2756    [ntp_ok=$ntp_eapc]
2757)
2758case "$ntp_ok" in
2759 yes)
2760    ntp_libparse=yes
2761    ntp_refclock=yes
2762    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2763    ;;
2764esac
2765AC_MSG_RESULT([$ntp_ok])
2766case "$ntp_ok$ntp_canparse" in
2767 yesno)
2768    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2769esac
2770
2771AC_MSG_CHECKING([Meinberg clocks])
2772AC_ARG_ENABLE(
2773    [MEINBERG],
2774    [AS_HELP_STRING(
2775	[--enable-MEINBERG],
2776	[s Meinberg clocks]
2777    )],
2778    [ntp_ok=$enableval],
2779    [ntp_ok=$ntp_eapc]
2780)
2781case "$ntp_ok" in
2782 yes)
2783    ntp_libparse=yes
2784    ntp_refclock=yes
2785    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2786    ;;
2787esac
2788AC_MSG_RESULT([$ntp_ok])
2789case "$ntp_ok$ntp_canparse" in
2790 yesno)
2791    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2792esac
2793
2794AC_MSG_CHECKING([DCF77 raw time code])
2795AC_ARG_ENABLE(
2796    [RAWDCF],
2797    [AS_HELP_STRING(
2798	[--enable-RAWDCF],
2799	[s DCF77 raw time code]
2800    )],
2801    [ntp_ok=$enableval],
2802    [ntp_ok=$ntp_eapc]
2803)
2804case "$ntp_ok" in
2805 yes)
2806    ntp_libparse=yes
2807    ntp_parseutil=yes
2808    ntp_refclock=yes
2809    ntp_rawdcf=yes
2810    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2811    ;;
2812esac
2813AC_MSG_RESULT([$ntp_ok])
2814case "$ntp_ok$ntp_canparse" in
2815 yesno)
2816    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2817esac
2818
2819case "$ntp_rawdcf" in
2820 yes)
2821    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2822	[ntp_cv_rawdcf_parity],
2823	[
2824	    ans=no
2825	    case "$host" in
2826	     *-*-*linux*)
2827		ans=yes
2828		;;
2829	    esac
2830	    ntp_cv_rawdcf_parity=$ans
2831	]
2832    )
2833    case "$ntp_cv_rawdcf_parity" in
2834     yes)
2835	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2836	    [Should we not IGNPAR (Linux)?]) ;;
2837    esac
2838esac
2839
2840AC_MSG_CHECKING([RCC 8000 clock])
2841AC_ARG_ENABLE(
2842    [RCC8000],
2843    [AS_HELP_STRING(
2844	[--enable-RCC8000],
2845	[s RCC 8000 clock]
2846    )],
2847    [ntp_ok=$enableval],
2848    [ntp_ok=$ntp_eapc]
2849)
2850case "$ntp_ok" in
2851 yes)
2852    ntp_libparse=yes
2853    ntp_refclock=yes
2854    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2855    ;;
2856esac
2857AC_MSG_RESULT([$ntp_ok])
2858case "$ntp_ok$ntp_canparse" in
2859 yesno)
2860    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2861esac
2862
2863AC_MSG_CHECKING([Schmid DCF77 clock])
2864AC_ARG_ENABLE(
2865    [SCHMID],
2866    [AS_HELP_STRING(
2867	[--enable-SCHMID ],
2868	[s Schmid DCF77 clock]
2869    )],
2870    [ntp_ok=$enableval],
2871    [ntp_ok=$ntp_eapc]
2872)
2873case "$ntp_ok" in
2874 yes)
2875    ntp_libparse=yes
2876    ntp_refclock=yes
2877    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2878    ;;
2879esac
2880AC_MSG_RESULT([$ntp_ok])
2881case "$ntp_ok$ntp_canparse" in
2882 yesno)
2883    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2884esac
2885
2886AC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2887AC_ARG_ENABLE(
2888    [TRIMTAIP],
2889    [AS_HELP_STRING(
2890	[--enable-TRIMTAIP],
2891	[s Trimble GPS receiver/TAIP protocol]
2892    )],
2893    [ntp_ok=$enableval],
2894    [ntp_ok=$ntp_eapc]
2895)
2896case "$ntp_ok" in
2897 yes)
2898    ntp_libparse=yes
2899    ntp_refclock=yes
2900    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2901	[Trimble GPS receiver/TAIP protocol])
2902    ;;
2903esac
2904AC_MSG_RESULT([$ntp_ok])
2905case "$ntp_ok$ntp_canparse" in
2906 yesno)
2907    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2908esac
2909
2910AC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2911AC_ARG_ENABLE(
2912    [TRIMTSIP],
2913    [AS_HELP_STRING(
2914	[--enable-TRIMTSIP],
2915	[s Trimble GPS receiver/TSIP protocol]
2916    )],
2917    [ntp_ok=$enableval],
2918    [ntp_ok=$ntp_eapc]
2919)
2920case "$ntp_ok" in
2921 yes)
2922    ntp_libparse=yes
2923    ntp_refclock=yes
2924    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2925	[Trimble GPS receiver/TSIP protocol])
2926    ;;
2927esac
2928AC_MSG_RESULT([$ntp_ok])
2929case "$ntp_ok$ntp_canparse" in
2930 yesno)
2931    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2932esac
2933
2934AC_MSG_CHECKING([WHARTON 400A Series clock])
2935AC_ARG_ENABLE(
2936    [WHARTON],
2937    [AS_HELP_STRING(
2938	[--enable-WHARTON],
2939	[s WHARTON 400A Series clock]
2940    )],
2941    [ntp_ok=$enableval],
2942    [ntp_ok=$ntp_eapc]
2943)
2944case "$ntp_ok" in
2945 yes)
2946    ntp_libparse=yes
2947    ntp_refclock=yes
2948    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2949    ;;
2950esac
2951AC_MSG_RESULT([$ntp_ok])
2952case "$ntp_ok$ntp_canparse" in
2953 yesno)
2954    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2955esac
2956
2957AC_MSG_CHECKING([VARITEXT clock])
2958AC_ARG_ENABLE(
2959    [VARITEXT],
2960    [AS_HELP_STRING(
2961	[--enable-VARITEXT],
2962	[s VARITEXT clock]
2963    )],
2964    [ntp_ok=$enableval],
2965    [ntp_ok=$ntp_eapc]
2966)
2967case "$ntp_ok" in
2968 yes)
2969    ntp_libparse=yes
2970    ntp_refclock=yes
2971    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2972    ;;
2973esac
2974AC_MSG_RESULT([$ntp_ok])
2975case "$ntp_ok$ntp_canparse" in
2976 yesno)
2977    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2978esac
2979
2980AC_MSG_CHECKING(SEL240X clock)
2981AC_ARG_ENABLE(SEL240X,
2982    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2983    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2984if test "$ntp_ok" = "yes"; then
2985    ntp_libparse=yes
2986    ntp_refclock=yes
2987    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2988fi
2989AC_MSG_RESULT($ntp_ok)
2990case "$ntp_ok$ntp_canparse" in
2991 yesno)
2992    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2993    ;;
2994esac
2995
2996AC_SUBST([LIBPARSE])
2997AC_SUBST([MAKE_LIBPARSE])
2998AC_SUBST([MAKE_LIBPARSE_KERNEL])
2999AC_SUBST([MAKE_CHECK_Y2K])
3000
3001AC_MSG_CHECKING([if we need to make and use the parse libraries])
3002ans=no
3003case "$ntp_libparse" in
3004 yes)
3005    ans=yes
3006    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3007    LIBPARSE=../libparse/libparse.a
3008    MAKE_LIBPARSE=libparse.a
3009    # HMS: check_y2k trips the 34 year problem now...
3010    false && MAKE_CHECK_Y2K=check_y2k
3011esac
3012AC_MSG_RESULT([$ans])
3013
3014NTP_OPENSSL
3015
3016AC_MSG_CHECKING([if we want to enable CMAC support])
3017case "$ac_cv_header_openssl_cmac_h" in
3018 yes)
3019    AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?])
3020    ans="yes"
3021    ;;
3022 *) ans="no"
3023    ;;
3024esac
3025AC_MSG_RESULT([$ans])
3026
3027NTP_CRYPTO_RAND
3028
3029# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3030AC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3031AC_ARG_ENABLE(
3032    [autokey],
3033    AS_HELP_STRING(
3034	[--enable-autokey],
3035	[+ support NTP Autokey protocol]
3036	),
3037    [ntp_autokey=$enableval],
3038    [ntp_autokey=$ntp_openssl]
3039)
3040case "$ntp_autokey" in
3041 no)
3042    ;;
3043 *)
3044    case "$ntp_openssl" in
3045     no)
3046	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3047	ntp_autokey=no
3048	;;
3049     *)
3050	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3051	ntp_autokey=yes
3052	;;
3053    esac
3054    ;;
3055esac
3056AC_MSG_RESULT([$ntp_autokey])
3057
3058AC_SUBST([MAKE_CHECK_LAYOUT])
3059AC_MSG_CHECKING([if we want to run check-layout])
3060case "$cross_compiling$PATH_PERL" in
3061 no/*)
3062    MAKE_CHECK_LAYOUT=check-layout
3063    ans=yes
3064    ;;
3065 *)
3066    ans=no
3067    ;;
3068esac
3069AC_MSG_RESULT([$ans])
3070
3071AC_SUBST([TESTDCF])
3072AC_SUBST([DCFD])
3073AC_MSG_CHECKING([if we can make dcf parse utilities])
3074ans=no
3075case "$ntp_parseutil" in
3076 yes)
3077    case "$host" in
3078     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3079	ans="dcfd testdcf"
3080	DCFD=dcfd
3081	TESTDCF=testdcf
3082    esac
3083    ;;
3084esac
3085AC_MSG_RESULT([$ans])
3086
3087AC_SUBST([MAKE_PARSEKMODULE])
3088AC_MSG_CHECKING([if we can build kernel streams modules for parse])
3089ans=no
3090case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3091 yesyes)
3092    case "$host" in
3093     sparc-*-sunos4*)
3094        case "$ntp_cv_var_kernel_pll" in
3095	yes)
3096	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3097	    ;;
3098	esac
3099	ans=parsestreams
3100	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3101	;;
3102     sparc-*-solaris2*)
3103	ans=parsesolaris
3104	MAKE_PARSEKMODULE=parse
3105	AC_CHECK_HEADERS([strings.h])
3106	;;
3107    esac
3108    ;;
3109esac
3110AC_MSG_RESULT([$ans])
3111
3112AC_MSG_CHECKING([if we need basic refclock support])
3113case "$ntp_refclock" in
3114 yes)
3115    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3116    ;;
3117esac
3118AC_MSG_RESULT($ntp_refclock)
3119
3120dnl Things that can be made in clockstuff
3121AC_SUBST([PROPDELAY], [propdelay])
3122AC_SUBST([CHUTEST]) dnl needs work to compile
3123
3124AC_SUBST([MAKE_ADJTIMED])
3125AC_MSG_CHECKING([if we want HP-UX adjtimed support])
3126case "$host" in
3127 *-*-hpux[[56789]]*)
3128    ans=yes
3129    ;;
3130 *) ans=no
3131    ;;
3132esac
3133case "$ans" in
3134 yes)
3135    MAKE_ADJTIMED=adjtimed
3136    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3137	[Do we need HPUX adjtime() library support?])
3138    ;;
3139 *) ADJTIMED_DB=
3140    ADJTIMED_DL=
3141    ADJTIMED_DS=
3142    ADJTIMED_MS=
3143    ;;
3144esac
3145AC_MSG_RESULT([$ans])
3146
3147AC_MSG_CHECKING([if we want QNX adjtime support])
3148case "$host" in
3149 *-*-qnx*)
3150    ans=yes
3151    ;;
3152 *) ans=no
3153    ;;
3154esac
3155case "$ans" in
3156 yes)
3157    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3158	[Do we need the qnx adjtime call?])
3159    ;;
3160esac
3161AC_MSG_RESULT([$ans])
3162
3163AC_MSG_CHECKING([if we can read kmem])
3164
3165#  the default is to enable it if the system has the capability
3166
3167case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3168 *yes*)
3169    ans=yes
3170    ;;
3171 *) ans=no
3172    ;;
3173esac
3174
3175case "$host" in
3176 *-*-domainos)	# Won't be found...
3177    ans=no
3178    ;;
3179 *-*-hpux*)
3180    #ans=no
3181    ;;
3182 *-*-irix[[456]]*)
3183    ans=no
3184    ;;
3185 *-*-*linux*)
3186    ans=no
3187    ;;
3188 *-*-winnt3.5)
3189    ans=no
3190    ;;
3191 *-*-unicosmp*)
3192    ans=no
3193    ;;
3194esac
3195
3196# --enable-kmem / --disable-kmem controls if present
3197AC_ARG_ENABLE(
3198    [kmem],
3199    [AS_HELP_STRING(
3200	[--enable-kmem],
3201	[s read /dev/kmem for tick and/or tickadj]
3202    )],
3203    [ans=$enableval]
3204)
3205
3206AC_MSG_RESULT([$ans])
3207
3208case "$ans" in
3209 yes)
3210    can_kmem=yes
3211    ;;
3212 *)
3213    can_kmem=no
3214    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3215esac
3216
3217
3218AC_MSG_CHECKING([if adjtime is accurate])
3219
3220# target-dependent defaults
3221
3222case "$host" in
3223 i386-sequent-ptx*)
3224    ans=no
3225    ;;
3226 i386-unknown-osf1*)
3227    ans=yes
3228    ;;
3229 mips-sgi-irix[[456]]*)
3230    ans=yes
3231    ;;
3232 *-fujitsu-uxp*)
3233    ans=yes
3234    ;;
3235 *-ibm-aix[[4-9]]*)
3236    # XXX only verified thru AIX6.
3237    ans=yes
3238    ;;
3239 *-*-*linux*)
3240    ans=yes
3241    ;;
3242 *-*-solaris2.[[01]])
3243    ans=no
3244    ;;
3245 *-*-solaris2*)
3246    ans=yes
3247    ;;
3248 *-*-unicosmp*)
3249    ans=yes
3250    ;;
3251 *) ans=no
3252    ;;
3253esac
3254
3255# --enable-accurate-adjtime / --disable-accurate-adjtime
3256# override the default
3257AC_ARG_ENABLE(
3258    [accurate-adjtime],
3259    [AS_HELP_STRING(
3260	[--enable-accurate-adjtime],
3261	[s the adjtime() call is accurate]
3262    )],
3263    [ans=$enableval]
3264)
3265
3266AC_MSG_RESULT([$ans])
3267
3268case "$ans" in
3269 yes)
3270    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3271    adjtime_is_accurate=yes
3272    ;;
3273 *)
3274    adjtime_is_accurate=no
3275    ;;
3276esac
3277
3278AC_CACHE_CHECK(
3279    [the name of 'tick' in the kernel],
3280    [ntp_cv_nlist_tick],
3281    [
3282	ans=_tick
3283	case "$host" in
3284	 m68*-hp-hpux*) # HP9000/300?
3285	    ans=_old_tick
3286	    ;;
3287	 *-apple-aux[[23]]*)
3288	    ans=tick
3289	    ;;
3290	 *-hp-hpux*)
3291	    ans=old_tick
3292	    ;;
3293	 *-ibm-aix[[3-9]]*)
3294	    # XXX only verified thru AIX6.
3295	    ans=no
3296	    ;;
3297	 *-*-mpeix*)
3298	    ans=no
3299	    ;;
3300	 *-*-ptx*)
3301	    ans=tick
3302	    ;;
3303	 *-*-sco3.2v[[45]]*)
3304	    ans=no
3305	    ;;
3306	 *-*-solaris2*)
3307	    ans=nsec_per_tick
3308	    ;;
3309	 *-*-sysv4*)
3310	    ans=tick
3311	    ;;
3312	esac
3313	ntp_cv_nlist_tick=$ans
3314    ]
3315)
3316case "$ntp_cv_nlist_tick" in
3317 ''|no)
3318    ;;	# HMS: I think we can only get 'no' here...
3319 *)
3320    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3321	[What is the name of TICK in the kernel?])
3322esac
3323
3324AC_CACHE_CHECK(
3325    [for the units of 'tick'],
3326    [ntp_cv_tick_nano],
3327    [
3328	ans=usec
3329	case "$host" in
3330	 *-*-solaris2*)
3331	    ans=nsec
3332	    ;;
3333	esac
3334	ntp_cv_tick_nano=$ans
3335    ]
3336)
3337case "$ntp_cv_tick_nano" in
3338 nsec)
3339    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3340esac
3341
3342AC_CACHE_CHECK(
3343    [the name of 'tickadj' in the kernel],
3344    [ntp_cv_nlist_tickadj],
3345    [
3346	ans=_tickadj
3347	case "$host" in
3348	 m68*-hp-hpux*) # HP9000/300?
3349	    ans=_tickadj
3350	    ;;
3351	 *-apple-aux[[23]]*)
3352	    ans=tickadj
3353	    ;;
3354	 *-hp-hpux10*)
3355	    ans=no
3356	    ;;
3357	 *-hp-hpux9*)
3358	    ans=no
3359	    ;;
3360	 *-hp-hpux*)
3361	    ans=tickadj
3362	    ;;
3363	 *-*-aix*)
3364	    ans=tickadj
3365	    ;;
3366	 *-*-mpeix*)
3367	    ans=no
3368	    ;;
3369	 *-*-ptx*)
3370	    ans=tickadj
3371	    ;;
3372	 *-*-sco3.2v4*)
3373	    ans=no
3374	    ;;
3375	 *-*-sco3.2v5.0*)
3376	    ans=clock_drift
3377	    ;;
3378	 *-*-solaris2*)
3379	    ans=no	# hrestime_adj
3380	    ;;
3381	 *-*-sysv4*)
3382	    ans=tickadj
3383	    ;;
3384	esac
3385	ntp_cv_nlist_tickadj=$ans
3386    ]
3387)
3388case "$ntp_cv_nlist_tickadj" in
3389 ''|no)
3390    ;;	# HMS: I think we can only get 'no' here...
3391 *)
3392    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3393	[What is the name of TICKADJ in the kernel?])
3394esac
3395
3396AC_CACHE_CHECK(
3397    [for the units of 'tickadj'],
3398    [ntp_cv_tickadj_nano],
3399    [
3400	ans=usec
3401	case "$host" in
3402	 *-*-solaris2*)
3403	    ans=nsec
3404	    ;;
3405	esac
3406	ntp_cv_tickadj_nano=$ans
3407    ]
3408)
3409case "$ntp_cv_tickadj_nano" in
3410 nsec)
3411    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3412esac
3413
3414AC_CACHE_CHECK(
3415    [half-heartedly for 'dosynctodr' in the kernel],
3416    [ntp_cv_nlist_dosynctodr],
3417    [
3418	case "$host" in
3419	 *-apple-aux[[23]]*)
3420	    ans=no
3421	    ;;
3422	 *-sni-sysv*)
3423	    ans=dosynctodr
3424	    ;;
3425	 *-stratus-vos)
3426	    ans=no
3427	    ;;
3428	 *-*-aix*)
3429	    ans=dosynctodr
3430	    ;;
3431	 *-*-hpux*)
3432	    ans=no
3433	    ;;
3434	 *-*-mpeix*)
3435	    ans=no
3436	    ;;
3437	 *-*-nextstep*)
3438	    ans=_dosynctodr
3439	    ;;
3440	 *-*-ptx*)
3441	    ans=doresettodr
3442	    ;;
3443	 *-*-sco3.2v4*)
3444	    ans=no
3445	    ;;
3446	 *-*-sco3.2v5*)
3447	    ans=track_rtc
3448	    ;;
3449	 *-*-solaris2*)
3450	    ans=dosynctodr
3451	    ;;
3452	 *-*-sysv4*)
3453	    ans=doresettodr
3454	    ;;
3455	 *)
3456	    ans=_dosynctodr
3457	    ;;
3458	esac
3459	ntp_cv_nlist_dosynctodr=$ans
3460    ]
3461)
3462case "$ntp_cv_nlist_dosynctodr" in
3463 no)
3464    ;;
3465 *)
3466    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3467	[What is (probably) the name of DOSYNCTODR in the kernel?])
3468    ;;
3469esac
3470
3471AC_CACHE_CHECK(
3472    [half-heartedly for 'noprintf' in the kernel],
3473    [ntp_cv_nlist_noprintf],
3474    [
3475	case "$host" in
3476	 *-apple-aux[[23]]*)
3477	    ans=no
3478	    ;;
3479	 *-sni-sysv*)
3480	    ans=noprintf
3481	    ;;
3482	 *-stratus-vos)
3483	    ans=no
3484	    ;;
3485	 *-*-aix*)
3486	    ans=noprintf
3487	    ;;
3488	 *-*-hpux*)
3489	    ans=no
3490	    ;;
3491	 *-*-mpeix*)
3492	    ans=no
3493	    ;;
3494	 *-*-ptx*)
3495	    ans=noprintf
3496	    ;;
3497	 *-*-nextstep*)
3498	    ans=_noprintf
3499	    ;;
3500	 *-*-solaris2*)
3501	    ans=noprintf
3502	    ;;
3503	 *-*-sysv4*)
3504	    ans=noprintf
3505	    ;;
3506	 *)
3507	    ans=_noprintf
3508	    ;;
3509	esac
3510	ntp_cv_nlist_noprintf=$ans
3511    ]
3512)
3513case "$ntp_cv_nlist_noprintf" in
3514 no)
3515    ;;
3516 *)
3517    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3518	[What is (probably) the name of NOPRINTF in the kernel?])
3519    ;;
3520esac
3521
3522dnl The tick/tickadj sections were written by Skippy, who never learned
3523dnl that it's impolite (horridly gross) to show your guts in public.
3524
3525dnl	tick		tickadj
3526dnl	10000		80	    Unixware
3527dnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3528dnl	10000		150	    sgi IRIX
3529dnl	1000000L/hz	1000	    RS6000 && NOKMEM
3530dnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3531dnl	1000000L/hz	500/HZ	    other && NOKMEM
3532dnl	txc.tick	1	    Linux
3533dnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3534dnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3535dnl				    (RS6000 && !NOKMEM), SINIX MIPS
3536
3537dnl But we'll only use these "values" if we can't find anything else.
3538
3539AC_MSG_CHECKING([for a default value for 'tick'])
3540
3541# target-dependent default for tick
3542
3543case "$host" in
3544 *-*-pc-cygwin*)
3545    AC_MSG_ERROR([tick needs work for cygwin])
3546    ;;
3547 *-univel-sysv*)
3548    ans=10000
3549    ;;
3550 *-*-irix*)
3551    ans=10000
3552    ;;
3553 *-*-*linux*)
3554    ans=txc.tick
3555    ;;
3556 *-*-mpeix*)
3557    ans=no
3558    ;;
3559 *-*-winnt3.5)
3560    ans='(every / 10)'
3561    ;;
3562 *-*-unicosmp*)
3563    ans=10000
3564    ;;
3565 *)
3566    ans='1000000L/hz'
3567    ;;
3568esac
3569
3570AC_ARG_ENABLE(
3571    [tick],
3572    [AS_HELP_STRING(
3573	[--enable-tick=VALUE],
3574	[s force a value for 'tick']
3575    )],
3576    [ans=$enableval]
3577)
3578
3579AC_MSG_RESULT([$ans])
3580
3581case "$ans" in
3582 ''|no)
3583    ;;	# HMS: I think we can only get 'no' here...
3584 *)
3585    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3586	[Preset a value for 'tick'?])
3587esac
3588
3589AC_MSG_CHECKING([for a default value for 'tickadj'])
3590
3591# target-specific default
3592ans='500/hz'
3593case "$host" in
3594 *-fujitsu-uxp*)
3595    case "$adjtime_is_accurate" in
3596     yes)
3597	ans='tick/16'
3598    esac
3599    ;;
3600 *-univel-sysv*)
3601    ans=80
3602    ;;
3603 *-*-aix*)
3604    case "$can_kmem" in
3605     no)
3606	ans=1000
3607	;;
3608    esac
3609    ;;
3610 *-*-domainos)	# Skippy: won't be found...
3611    case "$can_kmem" in
3612     no)
3613	ans=668
3614	;;
3615    esac
3616    ;;
3617 *-*-hpux*)
3618    case "$adjtime_is_accurate" in
3619     yes)
3620	ans='tick/16'
3621	;;
3622    esac
3623    ;;
3624 *-*-irix*)
3625    ans=150
3626    ;;
3627 *-*-mpeix*)
3628    ans=no
3629    ;;
3630 *-*-sco3.2v5.0*)
3631    ans=10000L/hz
3632    ;;
3633 *-*-winnt3.5)
3634    ans=50
3635    ;;
3636 *-*-unicosmp*)
3637    ans=150
3638    ;;
3639esac
3640
3641AC_ARG_ENABLE(
3642    [tickadj],
3643    [AS_HELP_STRING(
3644	[--enable-tickadj=VALUE],
3645	[s force a value for 'tickadj']
3646    )],
3647    [ans=$enableval]
3648)
3649
3650AC_MSG_RESULT([$ans])
3651
3652default_tickadj=$ans
3653
3654case "$default_tickadj" in
3655 ''|no)
3656    ;;	# HMS: I think we can only get 'no' here...
3657 *)
3658    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3659	[Preset a value for 'tickadj'?]) ;;
3660esac
3661
3662# Newer versions of ReliantUNIX round adjtime() values down to
3663# 1/100s (system tick). Sigh ...
3664# Unfortunately, there is no easy way to know if particular release
3665# has this "feature" or any obvious way to test for it.
3666case "$host" in
3667 mips-sni-sysv4*)
3668    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3669	[Do we want the ReliantUNIX clock hacks?])
3670esac
3671
3672case "$host" in
3673 *-*-sco3.2v5*)
3674    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3675esac
3676
3677ntp_cv_make_tickadj=yes
3678case "$can_kmem$ac_cv_var_tick$default_tickadj" in
3679 nonono)	# Don't read KMEM, no presets.  Bogus.
3680    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3681    ntp_cv_make_tickadj=no
3682    ;;
3683 nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3684    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3685    ntp_cv_make_tickadj=no
3686    ;;
3687 no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3688    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3689    ntp_cv_make_tickadj=no
3690    ;;
3691 no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3692    ;;
3693 yesnono)	# Read KMEM, no presets.  Cool.
3694    ;;
3695 yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3696    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3697    ;;
3698 yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3699    ;;
3700 yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3701    ;;
3702 *)		# Generally bogus.
3703    AC_MSG_ERROR([This shouldn't happen.])
3704    ;;
3705esac
3706
3707AC_SUBST(MAKE_NTPTIME)
3708AC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3709[case "$host" in
3710 *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3711     yesyes)
3712	ans=yes
3713	;;
3714     *)
3715	ans=no
3716	;;
3717    esac
3718    ;;
3719esac
3720ac_cv_make_ntptime=$ans])
3721case "$ac_cv_make_ntptime" in
3722 yes)
3723    MAKE_NTPTIME=ntptime
3724    ;;
3725 *)
3726    NTPTIME_DB=
3727    NTPTIME_DL=
3728    NTPTIME_DS=
3729    NTPTIME_MS=
3730    ;;
3731esac
3732
3733AC_SUBST([MAKE_TICKADJ])
3734case "$host" in
3735 mips-sni-sysv4*)
3736    # tickadj is pretty useless on newer versions of ReliantUNIX
3737    # Do not bother
3738    ntp_cv_make_tickadj=no
3739    ;;
3740 *-*-irix*)
3741    ntp_cv_make_tickadj=no
3742    ;;
3743 *-*-solaris2*)
3744    # DLM says tickadj is a no-no starting with solaris2.5
3745    case "$host" in
3746     *-*-solaris2.1[[0-9]]*)
3747	ntp_cv_make_tickadj=no
3748	;;
3749     *-*-solaris2.[[0-4]]*) ;;
3750     *) ntp_cv_make_tickadj=no ;;
3751    esac
3752    ;;
3753 *-*-unicosmp*)
3754    ntp_cv_make_tickadj=no
3755    ;;
3756esac
3757
3758#
3759# Despite all the above, we always make tickadj.  Setting
3760# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3761# report that the configuration variable was cached.  It may
3762# be better to simply remove the hunk above, I did not want
3763# to remove it if there is hope it will be used again.
3764#
3765AS_UNSET([ntp_cv_make_tickadj])
3766
3767AC_CACHE_CHECK(
3768    [if we want and can make the tickadj utility],
3769    [ntp_cv_make_tickadj],
3770    [ntp_cv_make_tickadj=yes]
3771)
3772case "$ntp_cv_make_tickadj" in
3773 yes)
3774    MAKE_TICKADJ=tickadj
3775    ;;
3776 *)
3777    CALC_TICKADJ_DB=
3778    CALC_TICKADJ_DL=
3779    CALC_TICKADJ_DS=
3780    CALC_TICKADJ_MS=
3781    TICKADJ_DB=
3782    TICKADJ_DL=
3783    TICKADJ_DS=
3784    TICKADJ_MS=
3785    ;;
3786esac
3787
3788AC_SUBST([MAKE_TIMETRIM])
3789AC_CACHE_CHECK(
3790    [if we want and can make the timetrim utility],
3791    [ntp_cv_make_timetrim],
3792    [
3793	case "$host" in
3794	 *-*-irix*)
3795	    ntp_cv_make_timetrim=yes
3796	    ;;
3797	 *-*-unicosmp*)
3798	    ntp_cv_make_timetrim=yes
3799	    ;;
3800	 *)
3801	    ntp_cv_make_timetrim=no
3802	    ;;
3803	esac
3804    ]
3805)
3806case "$ntp_cv_make_timetrim" in
3807 yes)
3808    MAKE_TIMETRIM=timetrim
3809    ;;
3810 *) TIMETRIM_DB=
3811    TIMETRIM_DL=
3812    TIMETRIM_DS=
3813    TIMETRIM_MS=
3814    ;;
3815esac
3816
3817AC_SUBST([MAKE_LIBNTPSIM])
3818AC_SUBST([MAKE_NTPDSIM])
3819
3820AC_MSG_CHECKING([if we want to build the NTPD simulator])
3821AC_ARG_ENABLE(
3822    [simulator],
3823    [AS_HELP_STRING(
3824	[--enable-simulator],
3825	[- build/install the NTPD simulator?]
3826    )],
3827    [ans=$enableval],
3828    [ans=no]
3829)
3830AC_MSG_RESULT([$ans])
3831case "$ans" in
3832 yes)
3833    MAKE_NTPDSIM=ntpdsim
3834    MAKE_LIBNTPSIM=libntpsim.a
3835    ;;
3836 *)
3837    NTPDSIM_DB=
3838    NTPDSIM_DL=
3839    NTPDSIM_DS=
3840    NTPDSIM_MS=
3841    ;;
3842esac
3843
3844case "$build" in
3845 $host)
3846    ;;
3847 *) case "$host" in
3848     *-*-vxworks*)
3849	LDFLAGS="$LDFLAGS -r"
3850	;;
3851    esac
3852    ;;
3853esac
3854
3855NTP_WITHSNTP
3856
3857AC_MSG_CHECKING([if we want to build ntpsnmpd])
3858AC_ARG_WITH(
3859    [ntpsnmpd],
3860    [AS_HELP_STRING(
3861	[--with-ntpsnmpd],
3862	[s Build ntpsnmpd MIB agent?]
3863    )],
3864    [ans=$withval],
3865    [
3866	case "$PATH_NET_SNMP_CONFIG" in
3867	 /*)	ans=yes ;;
3868	 *)	ans=no  ;;
3869	esac
3870    ]
3871)
3872AC_MSG_RESULT([$ans])
3873case "$ans" in
3874 yes)
3875    case "$PATH_NET_SNMP_CONFIG" in
3876     /*)
3877	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3878	# Bug 2815.  This is a bit of a hack, but it works...
3879	case "$ntp_cv_net_snmp_version" in
3880	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3881		;;
3882	esac
3883	AC_SUBST([SNMP_LIBS])
3884	# HMS: we really want to separate CPPFLAGS and CFLAGS
3885	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3886	SNMP_CPPFLAGS=
3887	SNMP_CFLAGS=
3888	for i in $foo; do
3889	    case "$i" in
3890	     -D*|-U*|-I*)
3891		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3892		;;
3893	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3894		;;
3895	    esac
3896	done
3897	AC_SUBST([SNMP_CPPFLAGS])
3898	AC_SUBST([SNMP_CFLAGS])
3899
3900	save_CFLAGS=$CFLAGS
3901	save_CPPFLAGS=$CPPFLAGS
3902	save_LIBS=$LIBS
3903	CFLAGS=$SNMP_CFLAGS
3904	CPPFLAGS=$SNMP_CPPFLAGS
3905
3906	AC_CHECK_HEADER(
3907	    [net-snmp/net-snmp-config.h],
3908	    [MAKE_NTPSNMPD=ntpsnmpd],
3909	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3910	)
3911
3912	# Do this last, as we're messing up LIBS.
3913	# check -lnetsnmp for netsnmp_daemonize
3914	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3915	AC_CHECK_LIB(
3916	    [netsnmp],
3917	    [netsnmp_daemonize],
3918	    [ans=yes],
3919	    [ans=no]
3920	)
3921	case "$ans" in
3922	 no)
3923	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3924		[We need to provide netsnmp_daemonize()])
3925	esac
3926
3927	CFLAGS=$save_CFLAGS
3928	AS_UNSET([save_CFLAGS])
3929	CPPFLAGS=$save_CPPFLAGS
3930	AS_UNSET([save_CPPFLAGS])
3931	LIBS=$save_LIBS
3932	AS_UNSET([save_LIBS])
3933	;;
3934     *)
3935	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3936	;;
3937    esac
3938    ;;
3939esac
3940AC_SUBST([MAKE_NTPSNMPD])
3941
3942case "$MAKE_NTPSNMPD" in
3943 '')
3944    NTPSNMPD_DB=
3945    NTPSNMPD_DL=
3946    NTPSNMPD_DS=
3947    NTPSNMPD_MS=
3948    ;;
3949esac
3950
3951AC_MSG_CHECKING([if we should always slew the time])
3952
3953# target-specific defaults
3954
3955case "$host" in
3956 *-apple-aux[[23]]*)
3957    ans=yes
3958    ;;
3959 *-*-bsdi[[012]]*)
3960    ans=no
3961    ;;
3962 *-*-bsdi*)
3963    ans=yes
3964    ;;
3965 *-*-openvms*)	# HMS: won't be found
3966    ans=yes
3967    ;;
3968 *) ans=no
3969    ;;
3970esac
3971
3972# --enable-slew-always / --disable-slew-always overrides default
3973
3974AC_ARG_ENABLE(
3975    [slew-always],
3976    [AS_HELP_STRING(
3977	[--enable-slew-always],
3978	[s always slew the time]
3979    )],
3980    [ans=$enableval]
3981)
3982
3983AC_MSG_RESULT([$ans])
3984
3985case "$ans" in
3986 yes)
3987    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3988esac
3989
3990AC_MSG_CHECKING([if we should step and slew the time])
3991
3992case "$host" in
3993 *-sni-sysv*)
3994    ans=yes
3995    ;;
3996 *-stratus-vos)
3997    ans=no
3998    ;;
3999 *-univel-sysv*)
4000    ans=no
4001    ;;
4002 *-*-ptx*)
4003    ans=yes
4004    ;;
4005 *-*-solaris2.1[[0-9]]*)
4006    ans=no
4007    ;;
4008 *-*-solaris2.[[012]]*)
4009    ans=yes
4010    ;;
4011 *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4012    ans=yes
4013    ;;
4014 *) ans=no
4015    ;;
4016esac
4017
4018AC_ARG_ENABLE(
4019    [step-slew],
4020    [AS_HELP_STRING(
4021	[--enable-step-slew],
4022	[s step and slew the time]
4023    )],
4024    [ans=$enableval]
4025)
4026
4027AC_MSG_RESULT([$ans])
4028
4029case "$ans" in
4030 yes)
4031    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4032esac
4033
4034AC_MSG_CHECKING([if ntpdate should step the time])
4035
4036case "$host" in
4037 *-apple-aux[[23]]*)
4038    ans=yes
4039    ;;
4040 *) ans=no
4041    ;;
4042esac
4043
4044AC_ARG_ENABLE(
4045    [ntpdate-step],
4046    [AS_HELP_STRING(
4047	[--enable-ntpdate-step],
4048	[s if ntpdate should step the time]
4049    )],
4050    [ans=$enableval]
4051)
4052
4053AC_MSG_RESULT([$ans])
4054
4055case "$ans" in
4056 yes)
4057    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4058	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4059esac
4060
4061
4062AC_MSG_CHECKING([if we should sync TODR clock every hour])
4063
4064case "$host" in
4065 *-*-nextstep*)
4066    ans=yes
4067    ;;
4068 *-*-openvms*)	# HMS: won't be found
4069    ans=yes
4070    ;;
4071 *)
4072    ans=no
4073    ;;
4074esac
4075
4076AC_ARG_ENABLE(
4077    [hourly-todr-sync],
4078    [AS_HELP_STRING(
4079	[--enable-hourly-todr-sync],
4080	[s if we should sync TODR hourly]
4081    )],
4082    [ans=$enableval]
4083)
4084
4085AC_MSG_RESULT([$ans])
4086
4087case "$ac_cv_var_sync_todr" in
4088 yes)
4089    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4090esac
4091
4092
4093AC_MSG_CHECKING([if we should avoid kernel FLL bug])
4094
4095case "$host" in
4096 *-*-solaris2.6)
4097    unamev=`uname -v`
4098    case "$unamev" in
4099     Generic_105181-*)
4100	old_IFS="$IFS"
4101	IFS="-"
4102	set $unamev
4103	IFS="$old_IFS"
4104	if test "$2" -ge 17
4105	then
4106	    # Generic_105181-17 and higher
4107	    ans=no
4108	else
4109	    ans=yes
4110	fi
4111	;;
4112     *)
4113	ans=yes
4114	;;
4115    esac
4116    ;;
4117 *-*-solaris2.7)
4118    unamev=`uname -v`
4119    case "$unamev" in
4120     Generic_106541-*)
4121	old_IFS="$IFS"
4122	IFS="-"
4123	set $unamev
4124	IFS="$old_IFS"
4125	if test "$2" -ge 07
4126	then
4127	    # Generic_106541-07 and higher
4128	    ans=no
4129	else
4130	    ans=yes
4131	fi
4132	;;
4133     *)
4134	ans=yes
4135	;;
4136    esac
4137    ;;
4138 *)
4139    ans=no
4140    ;;
4141esac
4142
4143AC_ARG_ENABLE(
4144    [kernel-fll-bug],
4145    [AS_HELP_STRING(
4146	[--enable-kernel-fll-bug],
4147	[s if we should avoid a kernel FLL bug]
4148    )],
4149    [ans=$enableval]
4150)
4151
4152AC_MSG_RESULT([$ans])
4153
4154case "$ans" in
4155 yes)
4156    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4157esac
4158
4159
4160AC_MSG_CHECKING([if we want new session key behavior])
4161AC_ARG_ENABLE(
4162    [bug1243-fix],
4163    [AS_HELP_STRING(
4164	[--enable-bug1243-fix],
4165	[+ use unmodified autokey session keys]
4166    )],
4167    [ans=$enableval],
4168    [ans=yes]
4169)
4170AC_MSG_RESULT([$ans])
4171case "$ans" in
4172 no)
4173    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4174	[use old autokey session key behavior?])
4175esac
4176
4177
4178AC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4179AC_ARG_ENABLE(
4180    [bug3020-fix],
4181    [AS_HELP_STRING(
4182	[--enable-bug3020-fix],
4183	[+ Provide the explicit 127.0.0.0/8 martian filter]
4184    )],
4185    [ans=$enableval],
4186    [ans=yes]
4187)
4188AC_MSG_RESULT([$ans])
4189case "$ans" in
4190 yes)
4191    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4192	[Provide the explicit 127.0.0.0/8 martian filter?])
4193esac
4194
4195
4196AC_MSG_CHECKING([if we want correct mode7 fudgetime2 behavior])
4197AC_ARG_ENABLE(
4198    [bug3527-fix],
4199    [AS_HELP_STRING(
4200	[--enable-bug3527-fix],
4201	[+ provide correct mode7 fudgetime2 behavior]
4202    )],
4203    [ans=$enableval],
4204    [ans=yes]
4205)
4206AC_MSG_RESULT([$ans])
4207case "$ans" in
4208 no)
4209    AC_DEFINE([DISABLE_BUG3527_FIX], [1],
4210	[use old autokey session key behavior?])
4211esac
4212
4213
4214AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4215
4216case "$host" in
4217 *-*-solaris2.[[89]])
4218    ans=yes
4219    ;;
4220 *-*-solaris2.1[[0-9]]*)
4221    ans=yes
4222    ;;
4223 *) ans=no
4224    ;;
4225esac
4226
4227AC_ARG_ENABLE(
4228    [irig-sawtooth],
4229    [AS_HELP_STRING(
4230	[--enable-irig-sawtooth],
4231	[s if we should enable the IRIG sawtooth filter]
4232    )],
4233    [ans=$enableval]
4234)
4235
4236AC_MSG_RESULT([$ans])
4237
4238case "$ans" in
4239 yes)
4240    AC_DEFINE([IRIG_SUCKS], [1],
4241	[Should we use the IRIG sawtooth filter?])
4242esac
4243
4244AC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4245AC_ARG_ENABLE(
4246	[nist],
4247	[AS_HELP_STRING(
4248	    [--enable-nist],
4249	    [- if we should enable the NIST lockclock scheme]
4250	)],
4251	[ans=$enableval],
4252	[ans=no]
4253)
4254
4255AC_MSG_RESULT([$ans])
4256
4257case "$ans" in
4258 yes)
4259    AC_DEFINE([LOCKCLOCK], [1],
4260	[Should we align with the NIST lockclock scheme?]) ;;
4261esac
4262
4263AC_MSG_CHECKING([if we want support for Samba's signing daemon])
4264AC_ARG_ENABLE(
4265    [ntp-signd],
4266    [AS_HELP_STRING(
4267	[--enable-ntp-signd],
4268	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4269    )],
4270    [ans=$enableval],
4271    [ans=no]
4272)
4273
4274AC_MSG_RESULT([$ans])
4275
4276case "$ans" in
4277 no)
4278    ntp_signd_path=
4279    ;;
4280 yes)
4281    ntp_signd_path=/var/run/ntp_signd
4282    ;;
4283 *)
4284    ntp_signd_path="$ans"
4285esac
4286
4287case "$ntp_signd_path" in
4288 '')
4289    ;;
4290 *)
4291    AC_DEFINE([HAVE_NTP_SIGND], [1],
4292	[Do we want support for Samba's signing daemon?])
4293    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4294	[Path to sign daemon rendezvous socket])
4295    ;;
4296esac
4297
4298AC_CHECK_HEADERS([libscf.h])
4299LSCF=
4300case "$ac_cv_header_libscf_h" in
4301 yes)
4302    LSCF='-lscf'
4303esac
4304AC_SUBST([LSCF])
4305
4306NTP_IPV6
4307
4308
4309#
4310# Look for a sysctl call to get the list of network interfaces.
4311#
4312AC_CACHE_CHECK(
4313    [for interface list sysctl],
4314    [ntp_cv_iflist_sysctl],
4315    [AC_PREPROC_IFELSE(
4316	[AC_LANG_SOURCE([
4317	    #include <sys/param.h>
4318	    #include <sys/sysctl.h>
4319	    #include <sys/socket.h>
4320	    #ifndef NET_RT_IFLIST
4321	    # error
4322	    #endif
4323	])],
4324	[ntp_cv_iflist_sysctl=yes],
4325	[ntp_cv_iflist_sysctl=no]
4326    )]
4327)
4328case "$ntp_cv_iflist_sysctl" in
4329 yes)
4330    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4331esac
4332
4333###
4334
4335AC_MSG_CHECKING([if we want the saveconfig mechanism])
4336AC_ARG_ENABLE(
4337    [saveconfig],
4338    [AS_HELP_STRING(
4339	[--enable-saveconfig],
4340	[+ saveconfig mechanism]
4341    )],
4342    [ntp_ok=$enableval],
4343    [ntp_ok=yes]
4344)
4345ntp_saveconfig_enabled=0
4346case "$ntp_ok" in
4347 yes)
4348    ntp_saveconfig_enabled=1
4349    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4350    ;;
4351esac
4352AM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4353AC_MSG_RESULT([$ntp_ok])
4354
4355###
4356
4357AC_MSG_CHECKING([if we want the experimental leap smear code])
4358AC_ARG_ENABLE(
4359    [leap-smear],
4360    [AS_HELP_STRING(
4361	[--enable-leap-smear],
4362	[- experimental leap smear code]
4363    )],
4364    [ntp_ok=$enableval],
4365    [ntp_ok=no]
4366)
4367ntp_leap_smear_enabled=0
4368case "$ntp_ok" in
4369 yes)
4370    ntp_leap_smear_enabled=1
4371    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4372    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4373    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4374    ;;
4375esac
4376AC_MSG_RESULT([$ntp_ok])
4377
4378###
4379
4380AC_MSG_CHECKING([if we want dynamic interleave support])
4381AC_ARG_ENABLE(
4382    [dynamic-interleave],
4383    [AS_HELP_STRING(
4384	[--enable-dynamic-interleave],
4385	[- dynamic interleave support]
4386    )],
4387    [ntp_ok=$enableval],
4388    [ntp_ok=no]
4389)
4390ntp_dynamic_interleave=0
4391case "$ntp_ok" in
4392 yes)
4393    ntp_dynamic_interleave=1
4394    ;;
4395esac
4396AC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4397    [support dynamic interleave?])
4398AC_MSG_RESULT([$ntp_ok])
4399
4400NTP_UNITYBUILD
4401
4402dnl  gtest is needed for our tests subdirs. It would be nice if we could
4403dnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4404dnl  can't be conditionalized.
4405NTP_GOOGLETEST
4406
4407NTP_PROBLEM_TESTS
4408
4409###
4410
4411AC_CHECK_DECLS([sigsetjmp,siglongjmp], [], [], [[#include <setjmp.h>]])
4412
4413###
4414
4415AC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4416    [Default location of crypto key info])
4417
4418AC_CONFIG_FILES([Makefile])
4419AC_CONFIG_FILES([adjtimed/Makefile])
4420AC_CONFIG_FILES([clockstuff/Makefile])
4421AC_CONFIG_FILES([include/Makefile])
4422AC_CONFIG_FILES([include/isc/Makefile])
4423AC_CONFIG_FILES([kernel/Makefile])
4424AC_CONFIG_FILES([kernel/sys/Makefile])
4425AC_CONFIG_FILES([libntp/Makefile])
4426AC_CONFIG_FILES([libparse/Makefile])
4427AC_CONFIG_FILES([ntpd/Makefile])
4428AC_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])
4429AC_CONFIG_FILES([ntpdate/Makefile])
4430AC_CONFIG_FILES([ntpdc/Makefile])
4431AC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4432AC_CONFIG_FILES([ntpq/Makefile])
4433AC_CONFIG_FILES([ntpsnmpd/Makefile])
4434AC_CONFIG_FILES([parseutil/Makefile])
4435AC_CONFIG_FILES([scripts/Makefile])
4436AC_CONFIG_FILES([scripts/build/Makefile])
4437AC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4438AC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4439AC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4440AC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4441AC_CONFIG_FILES([scripts/lib/Makefile])
4442AC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4443AC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4444AC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4445AC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4446AC_CONFIG_FILES([scripts/ntptrace/Makefile])
4447AC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4448AC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4449AC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4450AC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4451AC_CONFIG_FILES([scripts/update-leap/Makefile])
4452AC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4453AC_CONFIG_FILES([tests/Makefile])
4454AC_CONFIG_FILES([tests/bug-2803/Makefile])
4455AC_CONFIG_FILES([tests/libntp/Makefile])
4456AC_CONFIG_FILES([tests/ntpd/Makefile])
4457AC_CONFIG_FILES([tests/ntpq/Makefile])
4458AC_CONFIG_FILES([tests/sandbox/Makefile])
4459AC_CONFIG_FILES([tests/sec-2853/Makefile])
4460AC_CONFIG_FILES([util/Makefile])
4461
4462perllibdir="${datadir}/ntp/lib"
4463AC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4464
4465calc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4466AC_SUBST_FILE([calc_tickadj_opts])
4467ntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4468AC_SUBST_FILE([ntp_wait_opts])
4469ntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4470AC_SUBST_FILE([ntpsweep_opts])
4471ntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4472AC_SUBST_FILE([ntptrace_opts])
4473summary_opts="$srcdir/scripts/summary-opts"
4474AC_SUBST_FILE([summary_opts])
4475plot_summary_opts="$srcdir/scripts/plot_summary-opts"
4476AC_SUBST_FILE([plot_summary_opts])
4477
4478AC_CONFIG_SUBDIRS([sntp])
4479
4480AC_OUTPUT
4481