xref: /freebsd/contrib/ntp/configure.ac (revision e46d47141338a644d751b14bbb194bed431e3748)
1dnl NTP top-level configure.ac				-*- Autoconf -*-
2dnl
3m4_include([sntp/m4/version.m4])
4AC_PREREQ([2.61])
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.10 foreign -Wall -Wno-gnu])
46
47dnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
48m4_ifdef(
49    [AM_SILENT_RULES],
50    [AM_SILENT_RULES([yes])]
51)
52AC_CANONICAL_BUILD
53AC_CANONICAL_HOST
54dnl the 'build' machine is where we run configure and compile
55dnl the 'host' machine is where the resulting stuff runs.
56AC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
57    [canonical system (cpu-vendor-os) of where we should run])
58AC_CONFIG_HEADERS([config.h])
59dnl AC_ARG_PROGRAM
60
61ntp_atom_ok=${ntp_atom_ok=no}
62ntp_oncore_ok=${ntp_oncore_ok=no}
63ntp_parse_ok=${ntp_parse_ok=no}
64ntp_ripe_ncc_ok=${ntp_parse_ok=no}
65ntp_jupiter_ok=${ntp_jupiter_ok=no}
66
67NTP_PROG_CC
68NTP_COMPILER
69
70dnl # Do we need CXX for anything besides google test?
71dnl AC_PROG_CXX
72AC_PROG_YACC
73dnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
74AX_C99_STRUCT_INIT
75
76NTP_HARDEN([sntp])
77
78NTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
79
80NTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
81
82dnl AM_PROG_AR req. automake 1.12
83m4_ifdef(
84    [AM_PROG_AR],
85    [AM_PROG_AR]
86)
87
88# So far, the only shared library we might use is libopts.
89# It's a small library - we might as well use a static version of it.
90AC_DISABLE_SHARED
91AC_PROG_LIBTOOL
92AC_SUBST([LIBTOOL_DEPS])
93
94# NTP has (so far) been relying on leading-edge autogen, which
95# means we need the appropriate corresponding libopts as well.
96# Therefore, by default:
97# - use the version of libopts we ship with
98# - do not install it
99# - build a static copy (AC_DISABLE_SHARED - done earlier)
100case "${enable_local_libopts+set}" in
101 set) ;;
102 *) enable_local_libopts=yes ;;
103esac
104case "${enable_libopts_install+set}" in
105 set) ;;
106 *) enable_libopts_install=no ;;
107esac
108enable_nls=no
109LIBOPTS_CHECK_NOBUILD([sntp/libopts])
110
111NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
112
113NTP_LIBNTP
114
115AC_MSG_CHECKING([for deprecated --with-arlib])
116AC_ARG_WITH([arlib],
117	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
118	[ans=$withval], [ans=no])
119AC_MSG_RESULT([$ans])
120
121case "$ans" in
122 yes)
123    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
124    ;;
125esac
126
127dnl  we need to check for cross compile tools for vxWorks here
128AC_PROG_AWK
129AS_UNSET([ac_cv_prog_AWK])
130AC_SUBST([AWK])				dnl scripts/ntpver.in
131AC_PROG_MAKE_SET
132
133AC_SUBST([CFLAGS])
134AC_SUBST([LDFLAGS])
135
136AC_PROG_LN_S
137AC_ISC_POSIX
138
139
140AC_PATH_PROG([PATH_PERL], [perl])
141dnl  Saving cached hardcoded paths rather than searching $PATH during a
142dnl  cached configure run is an optimization not worth the the cost of
143dnl  preventing newly-installed tools from being found.  Short-circuit
144dnl  the caching after the tests so preset overrides still work.
145AS_UNSET([ac_cv_path_PATH_PERL])
146AC_PATH_PROG([PATH_TEST], [test])
147AS_UNSET([ac_cv_path_PATH_TEST])
148test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
149AC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
150
151AC_ARG_WITH(
152    [net-snmp-config],
153    [AS_HELP_STRING(
154	[--with-net-snmp-config],
155	[+ =net-snmp-config]
156    )],
157    [ans=$withval],
158    [ans=yes]
159)
160case "$ans" in
161 no)
162    ;;
163 yes)
164    ans=net-snmp-config
165    ;;
166 /*)
167    ;;
168 */*)
169    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
170    ;;
171 *)
172    ;;
173esac
174PROG_NET_SNMP_CONFIG=$ans
175case "$PROG_NET_SNMP_CONFIG" in
176 no) ;;
177 /*)
178    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
179    ;;
180 *)
181    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
182    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
183;;
184esac
185AC_MSG_CHECKING([for net-snmp-config path])
186AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
187
188case "$PATH_NET_SNMP_CONFIG" in
189 /*)	AC_CACHE_CHECK(
190	    [for net-snmp version],
191	    [ntp_cv_net_snmp_version],
192	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
193	)
194	;;
195esac
196
197case "$host" in
198 *-*-vxworks*)
199    ac_link="$ac_link $VX_KERNEL"
200    ;;
201esac
202
203# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
204AC_SEARCH_LIBS([openlog], [gen syslog])
205# XXX library list will be in ac_cv_search_openlog
206
207# LIBSECCOMP is off by default -- needs testing with all the features
208# Please send bug reports to loganaden@gmail.com
209AC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
210AC_ARG_ENABLE(
211    [libseccomp],
212    [AS_HELP_STRING(
213	[--enable-libseccomp],
214	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
215    )],
216    [ntp_ok=$enableval],
217    [ntp_ok=no]
218)
219AC_MSG_RESULT([$ntp_ok])
220case "$ntp_ok" in
221 yes)
222    AC_SEARCH_LIBS(
223	[seccomp_init],
224	[seccomp],
225	[AC_DEFINE([LIBSECCOMP], [1],
226	    [Define to any value to include libseccomp sandboxing.])]
227    )
228    AC_TRY_RUN([
229	#include <stdio.h>
230	#include <stdlib.h>
231	#include <errno.h>
232	#include <sys/prctl.h>
233	#include <linux/seccomp.h>
234
235	int main(void)
236	{
237		int ret;
238		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
239		if (ret < 0) {
240			switch (errno) {
241			case ENOSYS:
242				return 1;
243			case EINVAL:
244				return 1;
245			default:
246				return 1;
247			}
248		}
249		ret =
250		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
251		if (ret < 0) {
252			switch (errno) {
253			case EINVAL:
254				return 1;
255			case EFAULT:
256				return 0;
257			default:
258				return 1;
259		}
260	}
261return 1;
262}
263]
264, AC_DEFINE([KERN_SECCOMP], 1,
265[Define to use libseccomp system call filtering.])
266, []
267)
268    ;;
269esac
270
271NTP_FACILITYNAMES
272
273dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
274dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
275dnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
276dnl does Strange Things with extra processes using the Posix-compatibility
277dnl real-time library, so we don't want to use it.
278dnl
279dnl 081118 Harlan got tired of looking for a way to get the sched*()
280dnl functions to link OK with either cc or gcc.
281
282case "$host" in
283 *-*-*linux*) ;;
284 *-*-osf4*) ;;
285 *-*-osf5*) ;;
286 *)
287    # HMS: Make sure we check for -lrt for clock_* before this...
288    case "$ac_cv_search_clock_gettime" in
289     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
290    esac
291    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
292    ;;
293esac
294
295AC_CHECK_HEADERS([bstring.h])
296AC_CHECK_HEADER(
297    [dns_sd.h],
298    [AC_SEARCH_LIBS(
299	[DNSServiceRegister],
300	[dns_sd],
301	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
302	    [Use Rendezvous/DNS-SD registration])]
303    )]
304)
305AC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
306
307AC_CHECK_HEADERS([memory.h netdb.h poll.h])
308AC_CHECK_HEADERS([sgtty.h stdatomic.h])
309AC_HEADER_STDBOOL
310AC_CHECK_HEADERS([stdlib.h string.h termio.h])
311AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
312
313case "$host" in
314 *-*-aix*)
315    AC_CHECK_HEADERS([utmpx.h])
316    case "$ac_cv_header_utmpx_h" in
317     yes)
318	;;
319     *)
320	AC_CHECK_HEADERS([utmp.h])
321	;;
322    esac
323    ;;
324 *)
325    AC_CHECK_HEADERS([utmp.h utmpx.h])
326    ;;
327esac
328
329#
330# On Suns only (so far) getpass() truncates the typed password to 8
331# characters, but getpassphrase() allows up to 257.  Most systems'
332# getpass() does not truncate, at least not so as to affect ntpq and
333# ntpdc password prompts.
334#
335# So check for getpassphrase(), but only on Sun operating systems.
336#
337case "$host" in
338 *-*-sunos*|*-*-solaris*)
339    AC_CHECK_FUNCS([getpassphrase])
340esac
341
342
343AC_CHECK_HEADERS([net/if6.h])
344AC_CHECK_HEADERS([net/route.h], [], [], [
345    #include <sys/types.h>
346    #include <sys/socket.h>
347    #include <net/if.h>
348])
349
350AC_CHECK_HEADERS([netinfo/ni.h])
351case "$ac_cv_header_netinfo_ni_h" in
352 yes)
353    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
354esac
355AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
356case "$host" in
357 *-*-sunos4*)
358    ;;
359 *)
360    AC_CHECK_HEADERS([sys/ioctl.h])
361    ;;
362esac
363AC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
364# HMS: Check sys/proc.h and sys/resource.h after some others
365AC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
366case "$ac_cv_header_sched_h" in
367 yes)
368    ;;
369 *)
370    AC_CHECK_HEADERS([sys/sched.h])
371    ;;
372esac
373# HMS: Check sys/shm.h after some others
374AC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
375# HMS: Checked sys/socket.h earlier
376case "$host" in
377 *-*-netbsd*)
378    ;;
379 *)
380    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
381    ;;
382esac
383AC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
384AC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
385case "$host" in
386*-convex-*)
387    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
388    ;;
389*-*-bsdi*)
390    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
391    ;;
392esac
393
394case "$ac_cv_header_stdatomic_h" in
395 yes)
396	AC_CHECK_FUNCS([atomic_thread_fence])
397	AC_CACHE_CHECK(
398	    [for atomic_thread_fence()],
399	    [ntp_cv_func_atomic_thread_fence],
400	    [AC_COMPILE_IFELSE(
401		[AC_LANG_PROGRAM(
402		    [[
403			#include <stdatomic.h>
404		    ]],
405		    [[
406			atomic_thread_fence(memory_order_seq_cst);
407		    ]]
408		)]
409		[ntp_cv_func_atomic_thread_fence=yes],
410		[ntp_cv_func_atomic_thread_fence=no]
411	    )]
412	)
413    ;;
414esac
415
416case "$host" in
417 *-*-solaris2.6)
418    # Broken...
419    ;;
420 *)
421    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
422    ;;
423esac
424
425case "$host" in
426 *-*-*linux*)
427    case "$ac_cv_func_ntp_gettime" in
428     yes)
429	;;
430     *)
431	AC_CHECK_FUNCS([__ntp_gettime])
432	case "$ac_cv_func___ntp_gettime" in
433	 yes)
434	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
435		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
436	esac
437	;;
438    esac
439    AC_CHECK_FUNCS([adjtimex])
440    case "$ac_cv_func_adjtimex" in
441     yes)
442	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
443	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
444	have_adjtimex=1
445	;;
446     *)
447	AC_CHECK_FUNCS([__adjtimex])
448	case "$ac_cv_func___adjtimex" in
449	 yes)
450	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
451	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
452	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
453	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
454	    have_adjtimex=1
455	esac
456	;;
457    esac
458esac
459case "$have_adjtimex" in
460 '')
461    # nlist stuff is only needed for tickadj.
462    saved_LIBS="$LIBS"
463    LIBS=
464    AC_SEARCH_LIBS([nlist], [elf ld mld])
465    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
466    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
467    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
468    AC_CHECK_HEADERS([nlist.h sys/var.h])
469    case "$ac_cv_header_nlist_h" in
470     yes)
471	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
472	AC_CACHE_CHECK(
473	    [for n_un in struct nlist],
474	    [ntp_cv_struct_nlist_n_un],
475	    [AC_COMPILE_IFELSE(
476		[AC_LANG_PROGRAM(
477		    [[
478			#include <nlist.h>
479		    ]],
480		    [[
481			struct nlist n;
482			n.n_un.n_name = 0;
483		    ]]
484		)]
485		[ntp_cv_struct_nlist_n_un=yes],
486		[ntp_cv_struct_nlist_n_un=no]
487	    )]
488	)
489	case "$ntp_cv_struct_nlist_n_un" in
490	 yes)
491	    AC_DEFINE([NLIST_NAME_UNION], [1],
492		[does struct nlist use a name union?])
493	esac
494    esac
495    AC_SUBST([LDADD_NLIST])
496    LDADD_NLIST="$LIBS"
497    LIBS="$saved_LIBS"
498    AS_UNSET([saved_LIBS])
499esac
500
501AC_CHECK_HEADERS([sys/proc.h], [], [], [
502    #ifdef HAVE_SYS_TYPES_H
503    # include <sys/types.h>
504    #endif
505    #ifdef HAVE_SYS_TIME_H
506    # include <sys/time.h>
507    #endif
508])
509
510AC_CHECK_HEADERS([sys/resource.h], [], [], [
511    #ifdef HAVE_SYS_TIME_H
512    # include <sys/time.h>
513    #endif
514])
515
516AC_CHECK_HEADERS([sys/shm.h], [], [], [
517    #ifdef HAVE_SYS_TYPES_H
518    # include <sys/types.h>
519    #endif
520    #ifdef HAVE_SYS_IPC_H
521    # include <sys/ipc.h>
522    #endif
523])
524
525AC_CHECK_HEADERS([sys/timex.h], [], [], [
526    #ifdef HAVE_SYS_TIME_H
527    # include <sys/time.h>
528    #endif
529])
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    ;;
1751esac
1752AC_MSG_RESULT([$ntp_ok])
1753case "$ntp_ok$host" in
1754 yes*-*-hpux*) ;;
1755 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1756esac
1757
1758#HPUX only, and only by explicit request
1759AC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1760AC_ARG_ENABLE(
1761    [GPSVME],
1762    [AS_HELP_STRING(
1763	[--enable-GPSVME],
1764	[- TrueTime GPS receiver/VME interface]
1765    )],
1766    [ntp_ok=$enableval],
1767    [ntp_ok=no]
1768)
1769case "$ntp_ok" in
1770 yes)
1771    ntp_refclock=yes
1772    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1773    ;;
1774esac
1775AC_MSG_RESULT([$ntp_ok])
1776case "$ntp_ok$host" in
1777 yes*-*-hpux*) ;;
1778 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1779esac
1780
1781AC_MSG_CHECKING([for PCL720 clock support])
1782case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1783 yesyesyes)
1784    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1785    ans=yes
1786    ;;
1787 *)
1788    ans=no
1789    ;;
1790esac
1791AC_MSG_RESULT([$ans])
1792
1793AC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1794AC_ARG_ENABLE(
1795    [all-clocks],
1796    [AS_HELP_STRING(
1797	[--enable-all-clocks],
1798	[+ include all suitable non-PARSE clocks:]
1799    )],
1800    [ntp_eac=$enableval],
1801    [ntp_eac=yes]
1802)
1803AC_MSG_RESULT([$ntp_eac])
1804
1805# HMS: Should we also require ntp_parse_ok?
1806AC_MSG_CHECKING([if we have support for PARSE clocks])
1807case "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1808 yes*yes*)
1809    ntp_canparse=yes
1810    ;;
1811 *) ntp_canparse=no
1812    ;;
1813esac
1814AC_MSG_RESULT([$ntp_canparse])
1815
1816AC_MSG_CHECKING([if we have support for audio clocks])
1817case "$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
1818 *yes*)
1819    ntp_canaudio=yes
1820    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1821    ;;
1822 *) ntp_canaudio=no ;;
1823esac
1824AC_MSG_RESULT([$ntp_canaudio])
1825
1826AC_MSG_CHECKING([if we have support for the SHM refclock interface])
1827case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1828 yesyes)
1829    ntp_canshm=yes
1830    ;;
1831 *) ntp_canshm=no ;;
1832esac
1833AC_MSG_RESULT([$ntp_canshm])
1834
1835# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1836AC_CACHE_CHECK(
1837    [for termios modem control],
1838    [ntp_cv_modem_control],
1839    [AC_COMPILE_IFELSE(
1840	[AC_LANG_PROGRAM(
1841	    [[
1842		#ifdef HAVE_UNISTD_H
1843		# include <unistd.h>
1844		#endif
1845		#ifdef HAVE_TERMIOS_H
1846		# include <termios.h>
1847		#endif
1848		#ifdef HAVE_SYS_IOCTL_H
1849		# include <sys/ioctl.h>
1850		#endif
1851	    ]],
1852	    [[
1853		int	dtr = TIOCM_DTR;
1854
1855		ioctl(1, TIOCMBIS, (char *)&dtr);
1856	    ]]
1857	)],
1858	[ntp_cv_modem_control=yes],
1859	[ntp_cv_modem_control=no]
1860    )]
1861)
1862case "$ntp_eac::$ntp_cv_modem_control" in
1863 yes::yes)
1864    ntp_enable_all_modem_control_clocks=yes
1865    ;;
1866 *)
1867    ntp_enable_all_modem_control_clocks=no
1868    ;;
1869esac
1870
1871# Requires modem control
1872AC_MSG_CHECKING([ACTS modem service])
1873AC_ARG_ENABLE(
1874    [ACTS],
1875    [AS_HELP_STRING(
1876	[--enable-ACTS],
1877	[s ACTS modem service]
1878    )],
1879    [ntp_ok=$enableval],
1880    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1881)
1882case "$ntp_ok" in
1883 yes)
1884    ntp_refclock=yes
1885    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1886    ;;
1887esac
1888AC_MSG_RESULT([$ntp_ok])
1889
1890AC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1891AC_ARG_ENABLE(
1892    [ARBITER],
1893    [AS_HELP_STRING(
1894	[--enable-ARBITER],
1895	[+ Arbiter 1088A/B GPS receiver]
1896    )],
1897    [ntp_ok=$enableval],
1898    [ntp_ok=$ntp_eac]
1899)
1900case "$ntp_ok" in
1901 yes)
1902    ntp_refclock=yes
1903    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1904    ;;
1905esac
1906AC_MSG_RESULT([$ntp_ok])
1907
1908AC_MSG_CHECKING([Arcron MSF receiver])
1909AC_ARG_ENABLE(
1910    [ARCRON_MSF],
1911    [AS_HELP_STRING(
1912	[--enable-ARCRON-MSF],
1913	[+ Arcron MSF receiver]
1914    )],
1915    [ntp_ok=$enableval],
1916    [ntp_ok=$ntp_eac]
1917)
1918case "$ntp_ok" in
1919 yes)
1920    ntp_refclock=yes
1921    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1922    ;;
1923esac
1924AC_MSG_RESULT([$ntp_ok])
1925
1926AC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1927AC_ARG_ENABLE(
1928    [AS2201],
1929    [AS_HELP_STRING(
1930	[--enable-AS2201],
1931	[+ Austron 2200A/2201A GPS receiver]
1932    )],
1933    [ntp_ok=$enableval],
1934    [ntp_ok=$ntp_eac]
1935)
1936case "$ntp_ok" in
1937 yes)
1938    ntp_refclock=yes
1939    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1940    ;;
1941esac
1942AC_MSG_RESULT([$ntp_ok])
1943
1944AC_MSG_CHECKING([ATOM PPS interface])
1945AC_ARG_ENABLE(
1946    [ATOM],
1947    [AS_HELP_STRING(
1948	[--enable-ATOM],
1949	[s ATOM PPS interface]
1950    )],
1951    [ntp_ok=$enableval],
1952    [ntp_ok=$ntp_eac]
1953)
1954case "$ntp_atom_ok" in
1955 no) ntp_ok=no ;;
1956esac
1957case "$ntp_ok" in
1958 yes)
1959    ntp_refclock=yes
1960    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
1961    ;;
1962esac
1963AC_MSG_RESULT([$ntp_ok])
1964
1965AC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1966AC_ARG_ENABLE(
1967    [CHRONOLOG],
1968    [AS_HELP_STRING(
1969	[--enable-CHRONOLOG],
1970	[+ Chrono-log K-series WWVB receiver]
1971    )],
1972    [ntp_ok=$enableval],
1973    [ntp_ok=$ntp_eac]
1974)
1975case "$ntp_ok" in
1976 yes)
1977    ntp_refclock=yes
1978    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
1979    ;;
1980esac
1981AC_MSG_RESULT([$ntp_ok])
1982
1983AC_MSG_CHECKING([CHU modem/decoder])
1984AC_ARG_ENABLE(
1985    [CHU],
1986    [AS_HELP_STRING(
1987	[--enable-CHU],
1988	[+ CHU modem/decoder]
1989    )],
1990    [ntp_ok=$enableval],
1991    [ntp_ok=$ntp_eac]
1992)
1993case "$ntp_ok" in
1994 yes)
1995    ntp_refclock=yes
1996    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
1997    ;;
1998esac
1999AC_MSG_RESULT([$ntp_ok])
2000ntp_refclock_chu=$ntp_ok
2001
2002AC_MSG_CHECKING([CHU audio/decoder])
2003AC_ARG_ENABLE(
2004    [AUDIO-CHU],
2005    [AS_HELP_STRING(
2006	[--enable-AUDIO-CHU],
2007	[s CHU audio/decoder]
2008    )],
2009    [ntp_ok=$enableval],
2010    [
2011	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2012	 *no*)	ntp_ok=no  ;;
2013	 *)	ntp_ok=yes ;;
2014	esac
2015    ]
2016)
2017AC_MSG_RESULT([$ntp_ok])
2018# We used to check for sunos/solaris target...
2019case "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2020 yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2021esac
2022
2023# Not under HP-UX
2024AC_MSG_CHECKING([Datum Programmable Time System])
2025AC_ARG_ENABLE(
2026    [DATUM],
2027    [AS_HELP_STRING(
2028	[--enable-DATUM],
2029	[s Datum Programmable Time System]
2030    )],
2031    [ntp_ok=$enableval],
2032    [
2033	case "$ac_cv_header_termios_h" in
2034	 yes)
2035	    ntp_ok=$ntp_eac
2036	    ;;
2037	 *) ntp_ok=no
2038	    ;;
2039	esac
2040    ]
2041)
2042case "$ntp_ok" in
2043 yes)
2044    ntp_refclock=yes
2045    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2046    ;;
2047esac
2048AC_MSG_RESULT([$ntp_ok])
2049
2050AC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2051AC_ARG_ENABLE(
2052    [DUMBCLOCK],
2053    [AS_HELP_STRING(
2054	[--enable-DUMBCLOCK],
2055	[+ Dumb generic hh:mm:ss local clock]
2056    )],
2057    [ntp_ok=$enableval],
2058    [ntp_ok=$ntp_eac]
2059)
2060case "$ntp_ok" in
2061 yes)
2062    ntp_refclock=yes
2063    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2064    ;;
2065esac
2066AC_MSG_RESULT([$ntp_ok])
2067
2068AC_MSG_CHECKING([Forum Graphic GPS])
2069AC_ARG_ENABLE(
2070    [FG],
2071    [AS_HELP_STRING(
2072	[--enable-FG],
2073	[+ Forum Graphic GPS]
2074    )],
2075    [ntp_ok=$enableval],
2076    [ntp_ok=$ntp_eac]
2077)
2078case "$ntp_ok" in
2079 yes)
2080    ntp_refclock=yes
2081    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2082    ;;
2083esac
2084AC_MSG_RESULT([$ntp_ok])
2085
2086# Requires modem control
2087AC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2088AC_ARG_ENABLE(
2089    [HEATH],
2090    [AS_HELP_STRING(
2091	[--enable-HEATH],
2092	[s Heath GC-1000 WWV/WWVH receiver]
2093    )],
2094    [ntp_ok=$enableval],
2095    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2096)
2097case "$ntp_ok" in
2098 yes)
2099    ntp_refclock=yes
2100    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2101    ;;
2102esac
2103AC_MSG_RESULT([$ntp_ok])
2104
2105AC_MSG_CHECKING([for hopf serial clock device])
2106AC_ARG_ENABLE(
2107    [HOPFSERIAL],
2108    [AS_HELP_STRING(
2109	[--enable-HOPFSERIAL],
2110	[+ hopf serial clock device]
2111    )],
2112    [ntp_ok=$enableval],
2113    [ntp_ok=$ntp_eac]
2114)
2115case "$ntp_ok" in
2116 yes)
2117    ntp_refclock=yes
2118    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2119    ;;
2120esac
2121AC_MSG_RESULT([$ntp_ok])
2122
2123AC_MSG_CHECKING([for hopf PCI clock 6039])
2124AC_ARG_ENABLE(
2125    [HOPFPCI],
2126    [AS_HELP_STRING(
2127	[--enable-HOPFPCI],
2128	[+ hopf 6039 PCI board]
2129    )],
2130    [ntp_ok=$enableval],
2131    [ntp_ok=$ntp_eac]
2132)
2133case "$ntp_ok" in
2134 yes)
2135    ntp_refclock=yes
2136    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2137    ;;
2138esac
2139AC_MSG_RESULT([$ntp_ok])
2140
2141AC_MSG_CHECKING([HP 58503A GPS receiver])
2142AC_ARG_ENABLE(
2143    [HPGPS],
2144    [AS_HELP_STRING(
2145	[--enable-HPGPS],
2146	[+ HP 58503A GPS receiver]
2147    )],
2148    [ntp_ok=$enableval],
2149    [ntp_ok=$ntp_eac]
2150)
2151case "$ntp_ok" in
2152 yes)
2153    ntp_refclock=yes
2154    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2155    ;;
2156esac
2157AC_MSG_RESULT([$ntp_ok])
2158
2159AC_MSG_CHECKING([IRIG audio decoder])
2160AC_ARG_ENABLE(
2161    [IRIG],
2162    [AS_HELP_STRING(
2163	[--enable-IRIG],
2164	[s IRIG audio decoder]
2165    )],
2166    [ntp_ok=$enableval],
2167    [
2168	case "$ntp_eac$ntp_canaudio" in
2169	 *no*)	ntp_ok=no  ;;
2170	 *)	ntp_ok=yes ;;
2171	esac
2172    ]
2173)
2174case "$ntp_ok" in
2175 yes)
2176    ntp_refclock=yes
2177    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2178    ;;
2179esac
2180AC_MSG_RESULT([$ntp_ok])
2181case "$ntp_ok$ntp_canaudio" in
2182 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2183esac
2184
2185AC_MSG_CHECKING([for JJY receiver])
2186AC_ARG_ENABLE(
2187    [JJY],
2188    [AS_HELP_STRING(
2189	[--enable-JJY],
2190	[+ JJY receiver]
2191    )],
2192    [ntp_ok=$enableval],
2193    [ntp_ok=$ntp_eac]
2194)
2195case "$ntp_ok" in
2196 yes)
2197    ntp_refclock=yes
2198    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2199    ;;
2200esac
2201AC_MSG_RESULT([$ntp_ok])
2202
2203AC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2204AC_ARG_ENABLE(
2205    [JUPITER],
2206    [AS_HELP_STRING(
2207	[--enable-JUPITER],
2208	[s Rockwell Jupiter GPS receiver]
2209    )],
2210    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2211case "$ntp_jupiter_ok" in
2212 no) ntp_ok=no ;;
2213esac
2214case "$ntp_ok" in
2215 yes)
2216    ntp_refclock=yes
2217    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2218    ;;
2219esac
2220AC_MSG_RESULT([$ntp_ok])
2221
2222AC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2223AC_ARG_ENABLE(
2224    [LEITCH],
2225    [AS_HELP_STRING(
2226	[--enable-LEITCH],
2227	[+ Leitch CSD 5300 Master Clock System Driver]
2228    )],
2229    [ntp_ok=$enableval],
2230    [ntp_ok=$ntp_eac]
2231)
2232case "$ntp_ok" in
2233 yes)
2234    ntp_refclock=yes
2235    AC_DEFINE([CLOCK_LEITCH], [1],
2236	[Leitch CSD 5300 Master Clock System Driver?])
2237    ;;
2238esac
2239AC_MSG_RESULT([$ntp_ok])
2240
2241AC_MSG_CHECKING([local clock reference])
2242AC_ARG_ENABLE(
2243    [LOCAL-CLOCK],
2244    [AS_HELP_STRING(
2245	[--enable-LOCAL-CLOCK],
2246	[+ local clock reference]
2247    )],
2248    [ntp_ok=$enableval],
2249    [ntp_ok=$ntp_eac]
2250)
2251case "$ntp_ok" in
2252 yes)
2253    ntp_refclock=yes
2254    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2255    ;;
2256esac
2257AC_MSG_RESULT([$ntp_ok])
2258
2259dnl Bug 340: longstanding unfixed bugs
2260dnl AC_MSG_CHECKING([EES M201 MSF receiver])
2261dnl AC_ARG_ENABLE([MSFEES],
2262dnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2263dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2264dnl if test "$ntp_ok" = "yes"; then
2265dnl     ntp_refclock=yes
2266dnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2267dnl fi
2268dnl AC_MSG_RESULT([$ntp_ok])
2269
2270# Not Ultrix
2271AC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2272AC_ARG_ENABLE(
2273    [MX4200],
2274    [AS_HELP_STRING(
2275	[--enable-MX4200 ],
2276	[s Magnavox MX4200 GPS receiver]
2277    )],
2278    [ntp_ok=$enableval],
2279    [
2280	case "$ac_cv_var_ppsclock" in
2281	 yes)
2282	    ntp_ok=$ntp_eac
2283	    ;;
2284	 *)
2285	    ntp_ok=no
2286	    ;;
2287	esac
2288    ]
2289)
2290case "$ntp_ok" in
2291 yes)
2292    ntp_refclock=yes
2293    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2294    ;;
2295esac
2296AC_MSG_RESULT([$ntp_ok])
2297case "$ntp_ok$host" in
2298 yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2299esac
2300
2301AC_MSG_CHECKING([for NeoClock4X receiver])
2302AC_ARG_ENABLE(
2303    [NEOCLOCK4X],
2304    [AS_HELP_STRING(
2305	[--enable-NEOCLOCK4X],
2306	[+ NeoClock4X DCF77 / TDF receiver]
2307    )],
2308    [ntp_ok=$enableval],
2309    [ntp_ok=$ntp_eac]
2310)
2311case "$ntp_ok" in
2312 yes)
2313    ntp_refclock=yes
2314    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2315    ;;
2316esac
2317AC_MSG_RESULT([$ntp_ok])
2318
2319AC_MSG_CHECKING([NMEA GPS receiver])
2320AC_ARG_ENABLE(
2321    [NMEA],
2322    [AS_HELP_STRING(
2323	[--enable-NMEA],
2324	[+ NMEA GPS receiver]
2325    )],
2326    [ntp_ok=$enableval],
2327    [ntp_ok=$ntp_eac]
2328)
2329case "$ntp_ok" in
2330 yes)
2331    ntp_refclock=yes
2332    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2333    ;;
2334esac
2335AC_MSG_RESULT([$ntp_ok])
2336
2337AC_CHECK_FUNCS([strtoll])
2338AC_MSG_CHECKING([for GPSD JSON receiver])
2339AC_ARG_ENABLE(
2340    [GPSD],
2341    [AS_HELP_STRING(
2342	[--enable-GPSD],
2343	[+ GPSD JSON receiver]
2344    )],
2345    [ntp_ok=$enableval],
2346    [case "$ac_cv_func_strtoll" in
2347     yes) ntp_ok=$ntp_eac ;;
2348     *)   ntp_ok="no" ;;
2349    esac]
2350)
2351case "$ntp_ok" in
2352 yes)
2353    ntp_refclock=yes
2354    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2355    ;;
2356esac
2357AC_MSG_RESULT([$ntp_ok])
2358
2359AC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2360AC_ARG_ENABLE(
2361    [ONCORE],
2362    [AS_HELP_STRING(
2363	[--enable-ONCORE],
2364	[s Motorola VP/UT Oncore GPS receiver]
2365    )],
2366    [ntp_ok=$enableval],
2367    [ntp_ok=$ntp_eac]
2368)
2369case "$ntp_oncore_ok" in
2370 no) ntp_ok=no ;;
2371esac
2372case "$ntp_ok" in
2373 yes)
2374    ntp_refclock=yes
2375    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2376    ;;
2377esac
2378AC_MSG_RESULT([$ntp_ok])
2379
2380# Requires modem control
2381AC_MSG_CHECKING([for Palisade clock])
2382AC_ARG_ENABLE(
2383    [PALISADE],
2384    [AS_HELP_STRING(
2385	[--enable-PALISADE],
2386	[s Palisade clock]
2387    )],
2388    [ntp_ok=$enableval],
2389    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2390)
2391case "$ntp_ok" in
2392 yes)
2393    ntp_refclock=yes
2394    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2395    ;;
2396esac
2397AC_MSG_RESULT([$ntp_ok])
2398
2399AC_MSG_CHECKING([Conrad parallel port radio clock])
2400AC_ARG_ENABLE(
2401    [PCF],
2402    [AS_HELP_STRING(
2403	[--enable-PCF ],
2404	[+ Conrad parallel port radio clock]
2405    )],
2406    [ntp_ok=$enableval],
2407    [ntp_ok=$ntp_eac]
2408)
2409case "$ntp_ok" in
2410 yes)
2411    ntp_refclock=yes
2412    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2413    ;;
2414esac
2415AC_MSG_RESULT([$ntp_ok])
2416
2417AC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2418AC_ARG_ENABLE(
2419    [PST],
2420    [AS_HELP_STRING(
2421	[--enable-PST],
2422	[+ PST/Traconex 1020 WWV/WWVH receiver]
2423    )],
2424    [ntp_ok=$enableval],
2425    [ntp_ok=$ntp_eac]
2426)
2427case "$ntp_ok" in
2428 yes)
2429    ntp_refclock=yes
2430    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2431    ;;
2432esac
2433AC_MSG_RESULT([$ntp_ok])
2434
2435AC_MSG_CHECKING([RIPENCC specific Trimble driver])
2436AC_ARG_ENABLE(
2437    [RIPENCC],
2438    [AS_HELP_STRING(
2439	[--enable-RIPENCC],
2440	[- RIPENCC specific Trimble driver]
2441    )],
2442    [ntp_ok=$enableval],
2443    [ntp_ok=no]
2444)
2445# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2446case "$ntp_ripe_ncc_ok" in
2447 no) ntp_ok=no ;;
2448esac
2449case "$ntp_ok" in
2450 yes)
2451    ntp_refclock=yes
2452    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2453    ;;
2454esac
2455AC_MSG_RESULT([$ntp_ok])
2456
2457# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2458# For *IX, we need sys/ipc.h and sys/shm.h.
2459AC_MSG_CHECKING([for SHM clock attached thru shared memory])
2460AC_ARG_ENABLE(
2461    [SHM],
2462    [AS_HELP_STRING(
2463	[--enable-SHM],
2464	[s SHM clock attached thru shared memory]
2465    )],
2466    [ntp_ok=$enableval],
2467    [
2468	case "$ntp_eac$ntp_canshm" in
2469	 *no*)	ntp_ok=no  ;;
2470	 *)	ntp_ok=yes ;;
2471	esac
2472    ]
2473)
2474case "$ntp_ok" in
2475 yes)
2476    ntp_refclock=yes
2477    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2478    ;;
2479esac
2480AC_MSG_RESULT([$ntp_ok])
2481
2482AC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2483AC_ARG_ENABLE(
2484    [SPECTRACOM],
2485    [AS_HELP_STRING(
2486	[--enable-SPECTRACOM],
2487	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2488    )],
2489    [ntp_ok=$enableval],
2490    [ntp_ok=$ntp_eac]
2491)
2492case "$ntp_ok" in
2493 yes)
2494    ntp_refclock=yes
2495    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2496	[Spectracom 8170/Netclock/2 WWVB receiver])
2497    ;;
2498esac
2499AC_MSG_RESULT([$ntp_ok])
2500
2501AC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2502AC_ARG_ENABLE(
2503    [TPRO],
2504    [AS_HELP_STRING(
2505	[--enable-TPRO],
2506	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2507    )],
2508    [ntp_ok=$enableval],
2509    [
2510	case "$ac_cv_header_sys_tpro_h" in
2511	 yes)
2512	    ntp_ok=$ntp_eac
2513	    ;;
2514	 *)
2515	    ntp_ok=no
2516	    ;;
2517	esac
2518    ]
2519)
2520case "$ntp_ok" in
2521 yes)
2522    ntp_refclock=yes
2523    AC_DEFINE([CLOCK_TPRO], [1],
2524	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2525    ;;
2526esac
2527AC_MSG_RESULT([$ntp_ok])
2528case "$ntp_ok$ac_cv_header_sys_tpro" in
2529 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2530esac
2531
2532# Not on a vax-dec-bsd
2533AC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2534AC_ARG_ENABLE(
2535    [TRUETIME],
2536    [AS_HELP_STRING(
2537	[--enable-TRUETIME],
2538	[s Kinemetrics/TrueTime receivers]
2539    )],
2540    [ntp_ok=$enableval],
2541    [
2542	case "$host" in
2543	 vax-dec-bsd)
2544	    ntp_ok=no
2545	    ;;
2546	 *)
2547	    ntp_ok=$ntp_eac
2548	    ;;
2549	esac
2550    ]
2551)
2552case "$ntp_ok" in
2553 yes)
2554    ntp_refclock=yes
2555    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2556    ;;
2557esac
2558AC_MSG_RESULT([$ntp_ok])
2559case "$ntp_ok$host" in
2560 yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2561esac
2562
2563AC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2564AC_ARG_ENABLE(
2565    [TT560],
2566    [AS_HELP_STRING(
2567	[--enable-TT560],
2568	[- TrueTime 560 IRIG-B decoder]
2569    )],
2570    [ntp_ok=$enableval],
2571    [ntp_ok=no]
2572)
2573case "$ntp_ok" in
2574 yes)
2575    ntp_refclock=yes
2576    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2577    ;;
2578esac
2579AC_MSG_RESULT([$ntp_ok])
2580
2581AC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2582AC_ARG_ENABLE(
2583    [ULINK],
2584    [AS_HELP_STRING(
2585	[--enable-ULINK],
2586	[+ Ultralink WWVB receiver]
2587    )],
2588    [ntp_ok=$enableval],
2589    [ntp_ok=$ntp_eac]
2590)
2591case "$ntp_ok" in
2592 yes)
2593    ntp_refclock=yes
2594    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2595    ;;
2596esac
2597AC_MSG_RESULT([$ntp_ok])
2598
2599AC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2600AC_ARG_ENABLE(
2601    [TSYNCPCI],
2602    [AS_HELP_STRING(
2603	[--enable-TSYNCPCI],
2604	[s Spectracom TSYNC timing board]
2605    )],
2606    [ntp_ok=$enableval],
2607    [
2608	case "$host" in
2609	 *-*-*linux*)
2610	    ntp_ok=$ntp_eac
2611	    ;;
2612	 *)
2613	    ntp_ok=no
2614	esac
2615    ]
2616)
2617case "$ntp_ok" in
2618 yes)
2619    ntp_refclock=yes
2620    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2621    ;;
2622esac
2623AC_MSG_RESULT([$ntp_ok])
2624
2625AC_MSG_CHECKING([WWV receiver])
2626AC_ARG_ENABLE(
2627    [WWV],
2628    [AS_HELP_STRING(
2629	[--enable-WWV],
2630	[s WWV Audio receiver]
2631    )],
2632    [ntp_ok=$enableval],
2633    [
2634	case "$ntp_eac$ntp_canaudio" in
2635	 *no*)	ntp_ok=no  ;;
2636	 *)	ntp_ok=yes ;;
2637	esac
2638    ]
2639)
2640case "$ntp_ok" in
2641 yes)
2642    ntp_refclock=yes
2643    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2644    ;;
2645esac
2646AC_MSG_RESULT([$ntp_ok])
2647case "$ntp_ok$ntp_canaudio" in
2648 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2649esac
2650
2651AC_MSG_CHECKING([for Zyfer receiver])
2652AC_ARG_ENABLE(
2653    [ZYFER],
2654    [AS_HELP_STRING(
2655	[--enable-ZYFER],
2656	[+ Zyfer GPStarplus receiver]
2657    )],
2658    [ntp_ok=$enableval],
2659    [ntp_ok=$ntp_eac]
2660)
2661case "$ntp_ok" in
2662 yes)
2663    ntp_refclock=yes
2664    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2665    ;;
2666esac
2667AC_MSG_RESULT([$ntp_ok])
2668
2669AC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2670AC_ARG_ENABLE(
2671    [parse-clocks],
2672    [AS_HELP_STRING(
2673	[--enable-parse-clocks],
2674	[- include all suitable PARSE clocks:]
2675    )],
2676    [ntp_eapc=$enableval],
2677    [
2678	case "$ntp_eac" in
2679	 yes)	ntp_eapc=$ntp_canparse ;;
2680	 *)	ntp_eapc=no ;;
2681	esac
2682	# Delete the next line one of these days
2683	ntp_eapc=no
2684    ]
2685)
2686AC_MSG_RESULT($ntp_eapc)
2687
2688case "$ntp_eac$ntp_eapc$ntp_canparse" in
2689 noyes*)
2690    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2691    ;;
2692 yesyesno)
2693    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2694    ;;
2695esac
2696
2697ntp_libparse=no
2698ntp_parseutil=no
2699ntp_rawdcf=no
2700
2701AC_MSG_CHECKING([Diem Computime Radio Clock])
2702AC_ARG_ENABLE(
2703    [COMPUTIME],
2704    [AS_HELP_STRING(
2705	[--enable-COMPUTIME],
2706	[s Diem Computime Radio Clock]
2707    )],
2708    [ntp_ok=$enableval],
2709    [ntp_ok=$ntp_eapc]
2710)
2711case "$ntp_ok" in
2712 yes)
2713    ntp_libparse=yes
2714    ntp_refclock=yes
2715    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2716    ;;
2717esac
2718AC_MSG_RESULT([$ntp_ok])
2719case "$ntp_ok$ntp_canparse" in
2720 yesno)
2721    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2722esac
2723
2724AC_MSG_CHECKING([ELV/DCF7000 clock])
2725AC_ARG_ENABLE(
2726    [DCF7000],
2727    [AS_HELP_STRING(
2728	[--enable-DCF7000],
2729	[s ELV/DCF7000 clock]
2730    )],
2731    [ntp_ok=$enableval],
2732    [ntp_ok=$ntp_eapc]
2733)
2734case "$ntp_ok" in
2735 yes)
2736    ntp_libparse=yes
2737    ntp_refclock=yes
2738    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2739    ;;
2740esac
2741AC_MSG_RESULT([$ntp_ok])
2742case "$ntp_ok$ntp_canparse" in
2743 yesno)
2744    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2745esac
2746
2747AC_MSG_CHECKING([HOPF 6021 clock])
2748AC_ARG_ENABLE(
2749    [HOPF6021],
2750    [AS_HELP_STRING(
2751	[--enable-HOPF6021],
2752	[s HOPF 6021 clock]
2753    )],
2754    [ntp_ok=$enableval],
2755    [ntp_ok=$ntp_eapc]
2756)
2757case "$ntp_ok" in
2758 yes)
2759    ntp_libparse=yes
2760    ntp_refclock=yes
2761    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2762    ;;
2763esac
2764AC_MSG_RESULT([$ntp_ok])
2765case "$ntp_ok$ntp_canparse" in
2766 yesno)
2767    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2768esac
2769
2770AC_MSG_CHECKING([Meinberg clocks])
2771AC_ARG_ENABLE(
2772    [MEINBERG],
2773    [AS_HELP_STRING(
2774	[--enable-MEINBERG],
2775	[s Meinberg clocks]
2776    )],
2777    [ntp_ok=$enableval],
2778    [ntp_ok=$ntp_eapc]
2779)
2780case "$ntp_ok" in
2781 yes)
2782    ntp_libparse=yes
2783    ntp_refclock=yes
2784    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2785    ;;
2786esac
2787AC_MSG_RESULT([$ntp_ok])
2788case "$ntp_ok$ntp_canparse" in
2789 yesno)
2790    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2791esac
2792
2793AC_MSG_CHECKING([DCF77 raw time code])
2794AC_ARG_ENABLE(
2795    [RAWDCF],
2796    [AS_HELP_STRING(
2797	[--enable-RAWDCF],
2798	[s DCF77 raw time code]
2799    )],
2800    [ntp_ok=$enableval],
2801    [ntp_ok=$ntp_eapc]
2802)
2803case "$ntp_ok" in
2804 yes)
2805    ntp_libparse=yes
2806    ntp_parseutil=yes
2807    ntp_refclock=yes
2808    ntp_rawdcf=yes
2809    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2810    ;;
2811esac
2812AC_MSG_RESULT([$ntp_ok])
2813case "$ntp_ok$ntp_canparse" in
2814 yesno)
2815    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2816esac
2817
2818case "$ntp_rawdcf" in
2819 yes)
2820    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2821	[ntp_cv_rawdcf_parity],
2822	[
2823	    ans=no
2824	    case "$host" in
2825	     *-*-*linux*)
2826		ans=yes
2827		;;
2828	    esac
2829	    ntp_cv_rawdcf_parity=$ans
2830	]
2831    )
2832    case "$ntp_cv_rawdcf_parity" in
2833     yes)
2834	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2835	    [Should we not IGNPAR (Linux)?]) ;;
2836    esac
2837esac
2838
2839AC_MSG_CHECKING([RCC 8000 clock])
2840AC_ARG_ENABLE(
2841    [RCC8000],
2842    [AS_HELP_STRING(
2843	[--enable-RCC8000],
2844	[s RCC 8000 clock]
2845    )],
2846    [ntp_ok=$enableval],
2847    [ntp_ok=$ntp_eapc]
2848)
2849case "$ntp_ok" in
2850 yes)
2851    ntp_libparse=yes
2852    ntp_refclock=yes
2853    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2854    ;;
2855esac
2856AC_MSG_RESULT([$ntp_ok])
2857case "$ntp_ok$ntp_canparse" in
2858 yesno)
2859    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2860esac
2861
2862AC_MSG_CHECKING([Schmid DCF77 clock])
2863AC_ARG_ENABLE(
2864    [SCHMID],
2865    [AS_HELP_STRING(
2866	[--enable-SCHMID ],
2867	[s Schmid DCF77 clock]
2868    )],
2869    [ntp_ok=$enableval],
2870    [ntp_ok=$ntp_eapc]
2871)
2872case "$ntp_ok" in
2873 yes)
2874    ntp_libparse=yes
2875    ntp_refclock=yes
2876    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2877    ;;
2878esac
2879AC_MSG_RESULT([$ntp_ok])
2880case "$ntp_ok$ntp_canparse" in
2881 yesno)
2882    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2883esac
2884
2885AC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2886AC_ARG_ENABLE(
2887    [TRIMTAIP],
2888    [AS_HELP_STRING(
2889	[--enable-TRIMTAIP],
2890	[s Trimble GPS receiver/TAIP protocol]
2891    )],
2892    [ntp_ok=$enableval],
2893    [ntp_ok=$ntp_eapc]
2894)
2895case "$ntp_ok" in
2896 yes)
2897    ntp_libparse=yes
2898    ntp_refclock=yes
2899    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2900	[Trimble GPS receiver/TAIP protocol])
2901    ;;
2902esac
2903AC_MSG_RESULT([$ntp_ok])
2904case "$ntp_ok$ntp_canparse" in
2905 yesno)
2906    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2907esac
2908
2909AC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2910AC_ARG_ENABLE(
2911    [TRIMTSIP],
2912    [AS_HELP_STRING(
2913	[--enable-TRIMTSIP],
2914	[s Trimble GPS receiver/TSIP protocol]
2915    )],
2916    [ntp_ok=$enableval],
2917    [ntp_ok=$ntp_eapc]
2918)
2919case "$ntp_ok" in
2920 yes)
2921    ntp_libparse=yes
2922    ntp_refclock=yes
2923    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2924	[Trimble GPS receiver/TSIP protocol])
2925    ;;
2926esac
2927AC_MSG_RESULT([$ntp_ok])
2928case "$ntp_ok$ntp_canparse" in
2929 yesno)
2930    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2931esac
2932
2933AC_MSG_CHECKING([WHARTON 400A Series clock])
2934AC_ARG_ENABLE(
2935    [WHARTON],
2936    [AS_HELP_STRING(
2937	[--enable-WHARTON],
2938	[s WHARTON 400A Series clock]
2939    )],
2940    [ntp_ok=$enableval],
2941    [ntp_ok=$ntp_eapc]
2942)
2943case "$ntp_ok" in
2944 yes)
2945    ntp_libparse=yes
2946    ntp_refclock=yes
2947    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2948    ;;
2949esac
2950AC_MSG_RESULT([$ntp_ok])
2951case "$ntp_ok$ntp_canparse" in
2952 yesno)
2953    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2954esac
2955
2956AC_MSG_CHECKING([VARITEXT clock])
2957AC_ARG_ENABLE(
2958    [VARITEXT],
2959    [AS_HELP_STRING(
2960	[--enable-VARITEXT],
2961	[s VARITEXT clock]
2962    )],
2963    [ntp_ok=$enableval],
2964    [ntp_ok=$ntp_eapc]
2965)
2966case "$ntp_ok" in
2967 yes)
2968    ntp_libparse=yes
2969    ntp_refclock=yes
2970    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
2971    ;;
2972esac
2973AC_MSG_RESULT([$ntp_ok])
2974case "$ntp_ok$ntp_canparse" in
2975 yesno)
2976    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2977esac
2978
2979AC_MSG_CHECKING(SEL240X clock)
2980AC_ARG_ENABLE(SEL240X,
2981    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
2982    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2983if test "$ntp_ok" = "yes"; then
2984    ntp_libparse=yes
2985    ntp_refclock=yes
2986    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
2987fi
2988AC_MSG_RESULT($ntp_ok)
2989case "$ntp_ok$ntp_canparse" in
2990 yesno)
2991    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2992    ;;
2993esac
2994
2995AC_SUBST([LIBPARSE])
2996AC_SUBST([MAKE_LIBPARSE])
2997AC_SUBST([MAKE_LIBPARSE_KERNEL])
2998AC_SUBST([MAKE_CHECK_Y2K])
2999
3000AC_MSG_CHECKING([if we need to make and use the parse libraries])
3001ans=no
3002case "$ntp_libparse" in
3003 yes)
3004    ans=yes
3005    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3006    LIBPARSE=../libparse/libparse.a
3007    MAKE_LIBPARSE=libparse.a
3008    # HMS: check_y2k trips the 34 year problem now...
3009    false && MAKE_CHECK_Y2K=check_y2k
3010esac
3011AC_MSG_RESULT([$ans])
3012
3013NTP_OPENSSL
3014
3015NTP_CRYPTO_RAND
3016
3017# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3018AC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3019AC_ARG_ENABLE(
3020    [autokey],
3021    AS_HELP_STRING(
3022	[--enable-autokey],
3023	[+ support NTP Autokey protocol]
3024	),
3025    [ntp_autokey=$enableval],
3026    [ntp_autokey=$ntp_openssl]
3027)
3028case "$ntp_autokey" in
3029 no)
3030    ;;
3031 *)
3032    case "$ntp_openssl" in
3033     no)
3034	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3035	ntp_autokey=no
3036	;;
3037     *)
3038	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3039	ntp_autokey=yes
3040	;;
3041    esac
3042    ;;
3043esac
3044AC_MSG_RESULT([$ntp_autokey])
3045
3046AC_SUBST([MAKE_CHECK_LAYOUT])
3047AC_MSG_CHECKING([if we want to run check-layout])
3048case "$cross_compiling$PATH_PERL" in
3049 no/*)
3050    MAKE_CHECK_LAYOUT=check-layout
3051    ans=yes
3052    ;;
3053 *)
3054    ans=no
3055    ;;
3056esac
3057AC_MSG_RESULT([$ans])
3058
3059AC_SUBST([TESTDCF])
3060AC_SUBST([DCFD])
3061AC_MSG_CHECKING([if we can make dcf parse utilities])
3062ans=no
3063case "$ntp_parseutil" in
3064 yes)
3065    case "$host" in
3066     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3067	ans="dcfd testdcf"
3068	DCFD=dcfd
3069	TESTDCF=testdcf
3070    esac
3071    ;;
3072esac
3073AC_MSG_RESULT([$ans])
3074
3075AC_SUBST([MAKE_PARSEKMODULE])
3076AC_MSG_CHECKING([if we can build kernel streams modules for parse])
3077ans=no
3078case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3079 yesyes)
3080    case "$host" in
3081     sparc-*-sunos4*)
3082        case "$ntp_cv_var_kernel_pll" in
3083	yes)
3084	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3085	    ;;
3086	esac
3087	ans=parsestreams
3088	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3089	;;
3090     sparc-*-solaris2*)
3091	ans=parsesolaris
3092	MAKE_PARSEKMODULE=parse
3093	AC_CHECK_HEADERS([strings.h])
3094	;;
3095    esac
3096    ;;
3097esac
3098AC_MSG_RESULT([$ans])
3099
3100AC_MSG_CHECKING([if we need basic refclock support])
3101case "$ntp_refclock" in
3102 yes)
3103    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3104    ;;
3105esac
3106AC_MSG_RESULT($ntp_refclock)
3107
3108dnl Things that can be made in clockstuff
3109AC_SUBST([PROPDELAY], [propdelay])
3110AC_SUBST([CHUTEST]) dnl needs work to compile
3111
3112AC_SUBST([MAKE_ADJTIMED])
3113AC_MSG_CHECKING([if we want HP-UX adjtimed support])
3114case "$host" in
3115 *-*-hpux[[56789]]*)
3116    ans=yes
3117    ;;
3118 *) ans=no
3119    ;;
3120esac
3121case "$ans" in
3122 yes)
3123    MAKE_ADJTIMED=adjtimed
3124    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3125	[Do we need HPUX adjtime() library support?])
3126    ;;
3127 *) ADJTIMED_DB=
3128    ADJTIMED_DL=
3129    ADJTIMED_DS=
3130    ADJTIMED_MS=
3131    ;;
3132esac
3133AC_MSG_RESULT([$ans])
3134
3135AC_MSG_CHECKING([if we want QNX adjtime support])
3136case "$host" in
3137 *-*-qnx*)
3138    ans=yes
3139    ;;
3140 *) ans=no
3141    ;;
3142esac
3143case "$ans" in
3144 yes)
3145    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3146	[Do we need the qnx adjtime call?])
3147    ;;
3148esac
3149AC_MSG_RESULT([$ans])
3150
3151AC_MSG_CHECKING([if we can read kmem])
3152
3153#  the default is to enable it if the system has the capability
3154
3155case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3156 *yes*)
3157    ans=yes
3158    ;;
3159 *) ans=no
3160    ;;
3161esac
3162
3163case "$host" in
3164 *-*-domainos)	# Won't be found...
3165    ans=no
3166    ;;
3167 *-*-hpux*)
3168    #ans=no
3169    ;;
3170 *-*-irix[[456]]*)
3171    ans=no
3172    ;;
3173 *-*-*linux*)
3174    ans=no
3175    ;;
3176 *-*-winnt3.5)
3177    ans=no
3178    ;;
3179 *-*-unicosmp*)
3180    ans=no
3181    ;;
3182esac
3183
3184# --enable-kmem / --disable-kmem controls if present
3185AC_ARG_ENABLE(
3186    [kmem],
3187    [AS_HELP_STRING(
3188	[--enable-kmem],
3189	[s read /dev/kmem for tick and/or tickadj]
3190    )],
3191    [ans=$enableval]
3192)
3193
3194AC_MSG_RESULT([$ans])
3195
3196case "$ans" in
3197 yes)
3198    can_kmem=yes
3199    ;;
3200 *)
3201    can_kmem=no
3202    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3203esac
3204
3205
3206AC_MSG_CHECKING([if adjtime is accurate])
3207
3208# target-dependent defaults
3209
3210case "$host" in
3211 i386-sequent-ptx*)
3212    ans=no
3213    ;;
3214 i386-unknown-osf1*)
3215    ans=yes
3216    ;;
3217 mips-sgi-irix[[456]]*)
3218    ans=yes
3219    ;;
3220 *-fujitsu-uxp*)
3221    ans=yes
3222    ;;
3223 *-ibm-aix[[4-9]]*)
3224    # XXX only verified thru AIX6.
3225    ans=yes
3226    ;;
3227 *-*-*linux*)
3228    ans=yes
3229    ;;
3230 *-*-solaris2.[[01]])
3231    ans=no
3232    ;;
3233 *-*-solaris2*)
3234    ans=yes
3235    ;;
3236 *-*-unicosmp*)
3237    ans=yes
3238    ;;
3239 *) ans=no
3240    ;;
3241esac
3242
3243# --enable-accurate-adjtime / --disable-accurate-adjtime
3244# override the default
3245AC_ARG_ENABLE(
3246    [accurate-adjtime],
3247    [AS_HELP_STRING(
3248	[--enable-accurate-adjtime],
3249	[s the adjtime() call is accurate]
3250    )],
3251    [ans=$enableval]
3252)
3253
3254AC_MSG_RESULT([$ans])
3255
3256case "$ans" in
3257 yes)
3258    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3259    adjtime_is_accurate=yes
3260    ;;
3261 *)
3262    adjtime_is_accurate=no
3263    ;;
3264esac
3265
3266AC_CACHE_CHECK(
3267    [the name of 'tick' in the kernel],
3268    [ntp_cv_nlist_tick],
3269    [
3270	ans=_tick
3271	case "$host" in
3272	 m68*-hp-hpux*) # HP9000/300?
3273	    ans=_old_tick
3274	    ;;
3275	 *-apple-aux[[23]]*)
3276	    ans=tick
3277	    ;;
3278	 *-hp-hpux*)
3279	    ans=old_tick
3280	    ;;
3281	 *-ibm-aix[[3-9]]*)
3282	    # XXX only verified thru AIX6.
3283	    ans=no
3284	    ;;
3285	 *-*-mpeix*)
3286	    ans=no
3287	    ;;
3288	 *-*-ptx*)
3289	    ans=tick
3290	    ;;
3291	 *-*-sco3.2v[[45]]*)
3292	    ans=no
3293	    ;;
3294	 *-*-solaris2*)
3295	    ans=nsec_per_tick
3296	    ;;
3297	 *-*-sysv4*)
3298	    ans=tick
3299	    ;;
3300	esac
3301	ntp_cv_nlist_tick=$ans
3302    ]
3303)
3304case "$ntp_cv_nlist_tick" in
3305 ''|no)
3306    ;;	# HMS: I think we can only get 'no' here...
3307 *)
3308    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3309	[What is the name of TICK in the kernel?])
3310esac
3311
3312AC_CACHE_CHECK(
3313    [for the units of 'tick'],
3314    [ntp_cv_tick_nano],
3315    [
3316	ans=usec
3317	case "$host" in
3318	 *-*-solaris2*)
3319	    ans=nsec
3320	    ;;
3321	esac
3322	ntp_cv_tick_nano=$ans
3323    ]
3324)
3325case "$ntp_cv_tick_nano" in
3326 nsec)
3327    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3328esac
3329
3330AC_CACHE_CHECK(
3331    [the name of 'tickadj' in the kernel],
3332    [ntp_cv_nlist_tickadj],
3333    [
3334	ans=_tickadj
3335	case "$host" in
3336	 m68*-hp-hpux*) # HP9000/300?
3337	    ans=_tickadj
3338	    ;;
3339	 *-apple-aux[[23]]*)
3340	    ans=tickadj
3341	    ;;
3342	 *-hp-hpux10*)
3343	    ans=no
3344	    ;;
3345	 *-hp-hpux9*)
3346	    ans=no
3347	    ;;
3348	 *-hp-hpux*)
3349	    ans=tickadj
3350	    ;;
3351	 *-*-aix*)
3352	    ans=tickadj
3353	    ;;
3354	 *-*-mpeix*)
3355	    ans=no
3356	    ;;
3357	 *-*-ptx*)
3358	    ans=tickadj
3359	    ;;
3360	 *-*-sco3.2v4*)
3361	    ans=no
3362	    ;;
3363	 *-*-sco3.2v5.0*)
3364	    ans=clock_drift
3365	    ;;
3366	 *-*-solaris2*)
3367	    ans=no	# hrestime_adj
3368	    ;;
3369	 *-*-sysv4*)
3370	    ans=tickadj
3371	    ;;
3372	esac
3373	ntp_cv_nlist_tickadj=$ans
3374    ]
3375)
3376case "$ntp_cv_nlist_tickadj" in
3377 ''|no)
3378    ;;	# HMS: I think we can only get 'no' here...
3379 *)
3380    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3381	[What is the name of TICKADJ in the kernel?])
3382esac
3383
3384AC_CACHE_CHECK(
3385    [for the units of 'tickadj'],
3386    [ntp_cv_tickadj_nano],
3387    [
3388	ans=usec
3389	case "$host" in
3390	 *-*-solaris2*)
3391	    ans=nsec
3392	    ;;
3393	esac
3394	ntp_cv_tickadj_nano=$ans
3395    ]
3396)
3397case "$ntp_cv_tickadj_nano" in
3398 nsec)
3399    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3400esac
3401
3402AC_CACHE_CHECK(
3403    [half-heartedly for 'dosynctodr' in the kernel],
3404    [ntp_cv_nlist_dosynctodr],
3405    [
3406	case "$host" in
3407	 *-apple-aux[[23]]*)
3408	    ans=no
3409	    ;;
3410	 *-sni-sysv*)
3411	    ans=dosynctodr
3412	    ;;
3413	 *-stratus-vos)
3414	    ans=no
3415	    ;;
3416	 *-*-aix*)
3417	    ans=dosynctodr
3418	    ;;
3419	 *-*-hpux*)
3420	    ans=no
3421	    ;;
3422	 *-*-mpeix*)
3423	    ans=no
3424	    ;;
3425	 *-*-nextstep*)
3426	    ans=_dosynctodr
3427	    ;;
3428	 *-*-ptx*)
3429	    ans=doresettodr
3430	    ;;
3431	 *-*-sco3.2v4*)
3432	    ans=no
3433	    ;;
3434	 *-*-sco3.2v5*)
3435	    ans=track_rtc
3436	    ;;
3437	 *-*-solaris2*)
3438	    ans=dosynctodr
3439	    ;;
3440	 *-*-sysv4*)
3441	    ans=doresettodr
3442	    ;;
3443	 *)
3444	    ans=_dosynctodr
3445	    ;;
3446	esac
3447	ntp_cv_nlist_dosynctodr=$ans
3448    ]
3449)
3450case "$ntp_cv_nlist_dosynctodr" in
3451 no)
3452    ;;
3453 *)
3454    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3455	[What is (probably) the name of DOSYNCTODR in the kernel?])
3456    ;;
3457esac
3458
3459AC_CACHE_CHECK(
3460    [half-heartedly for 'noprintf' in the kernel],
3461    [ntp_cv_nlist_noprintf],
3462    [
3463	case "$host" in
3464	 *-apple-aux[[23]]*)
3465	    ans=no
3466	    ;;
3467	 *-sni-sysv*)
3468	    ans=noprintf
3469	    ;;
3470	 *-stratus-vos)
3471	    ans=no
3472	    ;;
3473	 *-*-aix*)
3474	    ans=noprintf
3475	    ;;
3476	 *-*-hpux*)
3477	    ans=no
3478	    ;;
3479	 *-*-mpeix*)
3480	    ans=no
3481	    ;;
3482	 *-*-ptx*)
3483	    ans=noprintf
3484	    ;;
3485	 *-*-nextstep*)
3486	    ans=_noprintf
3487	    ;;
3488	 *-*-solaris2*)
3489	    ans=noprintf
3490	    ;;
3491	 *-*-sysv4*)
3492	    ans=noprintf
3493	    ;;
3494	 *)
3495	    ans=_noprintf
3496	    ;;
3497	esac
3498	ntp_cv_nlist_noprintf=$ans
3499    ]
3500)
3501case "$ntp_cv_nlist_noprintf" in
3502 no)
3503    ;;
3504 *)
3505    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3506	[What is (probably) the name of NOPRINTF in the kernel?])
3507    ;;
3508esac
3509
3510dnl The tick/tickadj sections were written by Skippy, who never learned
3511dnl that it's impolite (horridly gross) to show your guts in public.
3512
3513dnl	tick		tickadj
3514dnl	10000		80	    Unixware
3515dnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3516dnl	10000		150	    sgi IRIX
3517dnl	1000000L/hz	1000	    RS6000 && NOKMEM
3518dnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3519dnl	1000000L/hz	500/HZ	    other && NOKMEM
3520dnl	txc.tick	1	    Linux
3521dnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3522dnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3523dnl				    (RS6000 && !NOKMEM), SINIX MIPS
3524
3525dnl But we'll only use these "values" if we can't find anything else.
3526
3527AC_MSG_CHECKING([for a default value for 'tick'])
3528
3529# target-dependent default for tick
3530
3531case "$host" in
3532 *-*-pc-cygwin*)
3533    AC_MSG_ERROR([tick needs work for cygwin])
3534    ;;
3535 *-univel-sysv*)
3536    ans=10000
3537    ;;
3538 *-*-irix*)
3539    ans=10000
3540    ;;
3541 *-*-*linux*)
3542    ans=txc.tick
3543    ;;
3544 *-*-mpeix*)
3545    ans=no
3546    ;;
3547 *-*-winnt3.5)
3548    ans='(every / 10)'
3549    ;;
3550 *-*-unicosmp*)
3551    ans=10000
3552    ;;
3553 *)
3554    ans='1000000L/hz'
3555    ;;
3556esac
3557
3558AC_ARG_ENABLE(
3559    [tick],
3560    [AS_HELP_STRING(
3561	[--enable-tick=VALUE],
3562	[s force a value for 'tick']
3563    )],
3564    [ans=$enableval]
3565)
3566
3567AC_MSG_RESULT([$ans])
3568
3569case "$ans" in
3570 ''|no)
3571    ;;	# HMS: I think we can only get 'no' here...
3572 *)
3573    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3574	[Preset a value for 'tick'?])
3575esac
3576
3577AC_MSG_CHECKING([for a default value for 'tickadj'])
3578
3579# target-specific default
3580ans='500/hz'
3581case "$host" in
3582 *-fujitsu-uxp*)
3583    case "$adjtime_is_accurate" in
3584     yes)
3585	ans='tick/16'
3586    esac
3587    ;;
3588 *-univel-sysv*)
3589    ans=80
3590    ;;
3591 *-*-aix*)
3592    case "$can_kmem" in
3593     no)
3594	ans=1000
3595	;;
3596    esac
3597    ;;
3598 *-*-domainos)	# Skippy: won't be found...
3599    case "$can_kmem" in
3600     no)
3601	ans=668
3602	;;
3603    esac
3604    ;;
3605 *-*-hpux*)
3606    case "$adjtime_is_accurate" in
3607     yes)
3608	ans='tick/16'
3609	;;
3610    esac
3611    ;;
3612 *-*-irix*)
3613    ans=150
3614    ;;
3615 *-*-mpeix*)
3616    ans=no
3617    ;;
3618 *-*-sco3.2v5.0*)
3619    ans=10000L/hz
3620    ;;
3621 *-*-winnt3.5)
3622    ans=50
3623    ;;
3624 *-*-unicosmp*)
3625    ans=150
3626    ;;
3627esac
3628
3629AC_ARG_ENABLE(
3630    [tickadj],
3631    [AS_HELP_STRING(
3632	[--enable-tickadj=VALUE],
3633	[s force a value for 'tickadj']
3634    )],
3635    [ans=$enableval]
3636)
3637
3638AC_MSG_RESULT([$ans])
3639
3640default_tickadj=$ans
3641
3642case "$default_tickadj" in
3643 ''|no)
3644    ;;	# HMS: I think we can only get 'no' here...
3645 *)
3646    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3647	[Preset a value for 'tickadj'?]) ;;
3648esac
3649
3650# Newer versions of ReliantUNIX round adjtime() values down to
3651# 1/100s (system tick). Sigh ...
3652# Unfortunately, there is no easy way to know if particular release
3653# has this "feature" or any obvious way to test for it.
3654case "$host" in
3655 mips-sni-sysv4*)
3656    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3657	[Do we want the ReliantUNIX clock hacks?])
3658esac
3659
3660case "$host" in
3661 *-*-sco3.2v5*)
3662    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3663esac
3664
3665ntp_cv_make_tickadj=yes
3666case "$can_kmem$ac_cv_var_tick$default_tickadj" in
3667 nonono)	# Don't read KMEM, no presets.  Bogus.
3668    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3669    ntp_cv_make_tickadj=no
3670    ;;
3671 nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3672    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3673    ntp_cv_make_tickadj=no
3674    ;;
3675 no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3676    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3677    ntp_cv_make_tickadj=no
3678    ;;
3679 no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3680    ;;
3681 yesnono)	# Read KMEM, no presets.  Cool.
3682    ;;
3683 yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3684    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3685    ;;
3686 yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3687    ;;
3688 yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3689    ;;
3690 *)		# Generally bogus.
3691    AC_MSG_ERROR([This shouldn't happen.])
3692    ;;
3693esac
3694
3695AC_SUBST(MAKE_NTPTIME)
3696AC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3697[case "$host" in
3698 *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3699     yesyes)
3700	ans=yes
3701	;;
3702     *)
3703	ans=no
3704	;;
3705    esac
3706    ;;
3707esac
3708ac_cv_make_ntptime=$ans])
3709case "$ac_cv_make_ntptime" in
3710 yes)
3711    MAKE_NTPTIME=ntptime
3712    ;;
3713 *)
3714    NTPTIME_DB=
3715    NTPTIME_DL=
3716    NTPTIME_DS=
3717    NTPTIME_MS=
3718    ;;
3719esac
3720
3721AC_SUBST([MAKE_TICKADJ])
3722case "$host" in
3723 mips-sni-sysv4*)
3724    # tickadj is pretty useless on newer versions of ReliantUNIX
3725    # Do not bother
3726    ntp_cv_make_tickadj=no
3727    ;;
3728 *-*-irix*)
3729    ntp_cv_make_tickadj=no
3730    ;;
3731 *-*-solaris2*)
3732    # DLM says tickadj is a no-no starting with solaris2.5
3733    case "$host" in
3734     *-*-solaris2.1[[0-9]]*)
3735	ntp_cv_make_tickadj=no
3736	;;
3737     *-*-solaris2.[[0-4]]*) ;;
3738     *) ntp_cv_make_tickadj=no ;;
3739    esac
3740    ;;
3741 *-*-unicosmp*)
3742    ntp_cv_make_tickadj=no
3743    ;;
3744esac
3745
3746#
3747# Despite all the above, we always make tickadj.  Setting
3748# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3749# report that the configuration variable was cached.  It may
3750# be better to simply remove the hunk above, I did not want
3751# to remove it if there is hope it will be used again.
3752#
3753AS_UNSET([ntp_cv_make_tickadj])
3754
3755AC_CACHE_CHECK(
3756    [if we want and can make the tickadj utility],
3757    [ntp_cv_make_tickadj],
3758    [ntp_cv_make_tickadj=yes]
3759)
3760case "$ntp_cv_make_tickadj" in
3761 yes)
3762    MAKE_TICKADJ=tickadj
3763    ;;
3764 *)
3765    CALC_TICKADJ_DB=
3766    CALC_TICKADJ_DL=
3767    CALC_TICKADJ_DS=
3768    CALC_TICKADJ_MS=
3769    TICKADJ_DB=
3770    TICKADJ_DL=
3771    TICKADJ_DS=
3772    TICKADJ_MS=
3773    ;;
3774esac
3775
3776AC_SUBST([MAKE_TIMETRIM])
3777AC_CACHE_CHECK(
3778    [if we want and can make the timetrim utility],
3779    [ntp_cv_make_timetrim],
3780    [
3781	case "$host" in
3782	 *-*-irix*)
3783	    ntp_cv_make_timetrim=yes
3784	    ;;
3785	 *-*-unicosmp*)
3786	    ntp_cv_make_timetrim=yes
3787	    ;;
3788	 *)
3789	    ntp_cv_make_timetrim=no
3790	    ;;
3791	esac
3792    ]
3793)
3794case "$ntp_cv_make_timetrim" in
3795 yes)
3796    MAKE_TIMETRIM=timetrim
3797    ;;
3798 *) TIMETRIM_DB=
3799    TIMETRIM_DL=
3800    TIMETRIM_DS=
3801    TIMETRIM_MS=
3802    ;;
3803esac
3804
3805AC_SUBST([MAKE_LIBNTPSIM])
3806AC_SUBST([MAKE_NTPDSIM])
3807
3808AC_MSG_CHECKING([if we want to build the NTPD simulator])
3809AC_ARG_ENABLE(
3810    [simulator],
3811    [AS_HELP_STRING(
3812	[--enable-simulator],
3813	[- build/install the NTPD simulator?]
3814    )],
3815    [ans=$enableval],
3816    [ans=no]
3817)
3818AC_MSG_RESULT([$ans])
3819case "$ans" in
3820 yes)
3821    MAKE_NTPDSIM=ntpdsim
3822    MAKE_LIBNTPSIM=libntpsim.a
3823    ;;
3824 *)
3825    NTPDSIM_DB=
3826    NTPDSIM_DL=
3827    NTPDSIM_DS=
3828    NTPDSIM_MS=
3829    ;;
3830esac
3831
3832case "$build" in
3833 $host)
3834    ;;
3835 *) case "$host" in
3836     *-*-vxworks*)
3837	LDFLAGS="$LDFLAGS -r"
3838	;;
3839    esac
3840    ;;
3841esac
3842
3843NTP_WITHSNTP
3844
3845AC_MSG_CHECKING([if we want to build ntpsnmpd])
3846AC_ARG_WITH(
3847    [ntpsnmpd],
3848    [AS_HELP_STRING(
3849	[--with-ntpsnmpd],
3850	[s Build ntpsnmpd MIB agent?]
3851    )],
3852    [ans=$withval],
3853    [
3854	case "$PATH_NET_SNMP_CONFIG" in
3855	 /*)	ans=yes ;;
3856	 *)	ans=no  ;;
3857	esac
3858    ]
3859)
3860AC_MSG_RESULT([$ans])
3861case "$ans" in
3862 yes)
3863    case "$PATH_NET_SNMP_CONFIG" in
3864     /*)
3865	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3866	# Bug 2815.  This is a bit of a hack, but it works...
3867	case "$ntp_cv_net_snmp_version" in
3868	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3869		;;
3870	esac
3871	AC_SUBST([SNMP_LIBS])
3872	# HMS: we really want to separate CPPFLAGS and CFLAGS
3873	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3874	SNMP_CPPFLAGS=
3875	SNMP_CFLAGS=
3876	for i in $foo; do
3877	    case "$i" in
3878	     -D*|-U*|-I*)
3879		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3880		;;
3881	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3882		;;
3883	    esac
3884	done
3885	AC_SUBST([SNMP_CPPFLAGS])
3886	AC_SUBST([SNMP_CFLAGS])
3887
3888	save_CFLAGS=$CFLAGS
3889	save_CPPFLAGS=$CPPFLAGS
3890	save_LIBS=$LIBS
3891	CFLAGS=$SNMP_CFLAGS
3892	CPPFLAGS=$SNMP_CPPFLAGS
3893
3894	AC_CHECK_HEADER(
3895	    [net-snmp/net-snmp-config.h],
3896	    [MAKE_NTPSNMPD=ntpsnmpd],
3897	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3898	)
3899
3900	# Do this last, as we're messing up LIBS.
3901	# check -lnetsnmp for netsnmp_daemonize
3902	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3903	AC_CHECK_LIB(
3904	    [netsnmp],
3905	    [netsnmp_daemonize],
3906	    [ans=yes],
3907	    [ans=no]
3908	)
3909	case "$ans" in
3910	 no)
3911	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3912		[We need to provide netsnmp_daemonize()])
3913	esac
3914
3915	CFLAGS=$save_CFLAGS
3916	AS_UNSET([save_CFLAGS])
3917	CPPFLAGS=$save_CPPFLAGS
3918	AS_UNSET([save_CPPFLAGS])
3919	LIBS=$save_LIBS
3920	AS_UNSET([save_LIBS])
3921	;;
3922     *)
3923	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3924	;;
3925    esac
3926    ;;
3927esac
3928AC_SUBST([MAKE_NTPSNMPD])
3929
3930case "$MAKE_NTPSNMPD" in
3931 '')
3932    NTPSNMPD_DB=
3933    NTPSNMPD_DL=
3934    NTPSNMPD_DS=
3935    NTPSNMPD_MS=
3936    ;;
3937esac
3938
3939AC_MSG_CHECKING([if we should always slew the time])
3940
3941# target-specific defaults
3942
3943case "$host" in
3944 *-apple-aux[[23]]*)
3945    ans=yes
3946    ;;
3947 *-*-bsdi[[012]]*)
3948    ans=no
3949    ;;
3950 *-*-bsdi*)
3951    ans=yes
3952    ;;
3953 *-*-openvms*)	# HMS: won't be found
3954    ans=yes
3955    ;;
3956 *) ans=no
3957    ;;
3958esac
3959
3960# --enable-slew-always / --disable-slew-always overrides default
3961
3962AC_ARG_ENABLE(
3963    [slew-always],
3964    [AS_HELP_STRING(
3965	[--enable-slew-always],
3966	[s always slew the time]
3967    )],
3968    [ans=$enableval]
3969)
3970
3971AC_MSG_RESULT([$ans])
3972
3973case "$ans" in
3974 yes)
3975    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3976esac
3977
3978AC_MSG_CHECKING([if we should step and slew the time])
3979
3980case "$host" in
3981 *-sni-sysv*)
3982    ans=yes
3983    ;;
3984 *-stratus-vos)
3985    ans=no
3986    ;;
3987 *-univel-sysv*)
3988    ans=no
3989    ;;
3990 *-*-ptx*)
3991    ans=yes
3992    ;;
3993 *-*-solaris2.1[[0-9]]*)
3994    ans=no
3995    ;;
3996 *-*-solaris2.[[012]]*)
3997    ans=yes
3998    ;;
3999 *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4000    ans=yes
4001    ;;
4002 *) ans=no
4003    ;;
4004esac
4005
4006AC_ARG_ENABLE(
4007    [step-slew],
4008    [AS_HELP_STRING(
4009	[--enable-step-slew],
4010	[s step and slew the time]
4011    )],
4012    [ans=$enableval]
4013)
4014
4015AC_MSG_RESULT([$ans])
4016
4017case "$ans" in
4018 yes)
4019    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4020esac
4021
4022AC_MSG_CHECKING([if ntpdate should step the time])
4023
4024case "$host" in
4025 *-apple-aux[[23]]*)
4026    ans=yes
4027    ;;
4028 *) ans=no
4029    ;;
4030esac
4031
4032AC_ARG_ENABLE(
4033    [ntpdate-step],
4034    [AS_HELP_STRING(
4035	[--enable-ntpdate-step],
4036	[s if ntpdate should step the time]
4037    )],
4038    [ans=$enableval]
4039)
4040
4041AC_MSG_RESULT([$ans])
4042
4043case "$ans" in
4044 yes)
4045    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4046	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4047esac
4048
4049
4050AC_MSG_CHECKING([if we should sync TODR clock every hour])
4051
4052case "$host" in
4053 *-*-nextstep*)
4054    ans=yes
4055    ;;
4056 *-*-openvms*)	# HMS: won't be found
4057    ans=yes
4058    ;;
4059 *)
4060    ans=no
4061    ;;
4062esac
4063
4064AC_ARG_ENABLE(
4065    [hourly-todr-sync],
4066    [AS_HELP_STRING(
4067	[--enable-hourly-todr-sync],
4068	[s if we should sync TODR hourly]
4069    )],
4070    [ans=$enableval]
4071)
4072
4073AC_MSG_RESULT([$ans])
4074
4075case "$ac_cv_var_sync_todr" in
4076 yes)
4077    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4078esac
4079
4080
4081AC_MSG_CHECKING([if we should avoid kernel FLL bug])
4082
4083case "$host" in
4084 *-*-solaris2.6)
4085    unamev=`uname -v`
4086    case "$unamev" in
4087     Generic_105181-*)
4088	old_IFS="$IFS"
4089	IFS="-"
4090	set $unamev
4091	IFS="$old_IFS"
4092	if test "$2" -ge 17
4093	then
4094	    # Generic_105181-17 and higher
4095	    ans=no
4096	else
4097	    ans=yes
4098	fi
4099	;;
4100     *)
4101	ans=yes
4102	;;
4103    esac
4104    ;;
4105 *-*-solaris2.7)
4106    unamev=`uname -v`
4107    case "$unamev" in
4108     Generic_106541-*)
4109	old_IFS="$IFS"
4110	IFS="-"
4111	set $unamev
4112	IFS="$old_IFS"
4113	if test "$2" -ge 07
4114	then
4115	    # Generic_106541-07 and higher
4116	    ans=no
4117	else
4118	    ans=yes
4119	fi
4120	;;
4121     *)
4122	ans=yes
4123	;;
4124    esac
4125    ;;
4126 *)
4127    ans=no
4128    ;;
4129esac
4130
4131AC_ARG_ENABLE(
4132    [kernel-fll-bug],
4133    [AS_HELP_STRING(
4134	[--enable-kernel-fll-bug],
4135	[s if we should avoid a kernel FLL bug]
4136    )],
4137    [ans=$enableval]
4138)
4139
4140AC_MSG_RESULT([$ans])
4141
4142case "$ans" in
4143 yes)
4144    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4145esac
4146
4147
4148AC_MSG_CHECKING([if we want new session key behavior])
4149AC_ARG_ENABLE(
4150    [bug1243-fix],
4151    [AS_HELP_STRING(
4152	[--enable-bug1243-fix],
4153	[+ use unmodified autokey session keys]
4154    )],
4155    [ans=$enableval],
4156    [ans=yes]
4157)
4158AC_MSG_RESULT([$ans])
4159case "$ans" in
4160 no)
4161    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4162	[use old autokey session key behavior?])
4163esac
4164
4165
4166AC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4167AC_ARG_ENABLE(
4168    [bug3020-fix],
4169    [AS_HELP_STRING(
4170	[--enable-bug3020-fix],
4171	[+ Provide the explicit 127.0.0.0/8 martian filter]
4172    )],
4173    [ans=$enableval],
4174    [ans=yes]
4175)
4176AC_MSG_RESULT([$ans])
4177case "$ans" in
4178 yes)
4179    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4180	[Provide the explicit 127.0.0.0/8 martian filter?])
4181esac
4182
4183
4184AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4185
4186case "$host" in
4187 *-*-solaris2.[[89]])
4188    ans=yes
4189    ;;
4190 *-*-solaris2.1[[0-9]]*)
4191    ans=yes
4192    ;;
4193 *) ans=no
4194    ;;
4195esac
4196
4197AC_ARG_ENABLE(
4198    [irig-sawtooth],
4199    [AS_HELP_STRING(
4200	[--enable-irig-sawtooth],
4201	[s if we should enable the IRIG sawtooth filter]
4202    )],
4203    [ans=$enableval]
4204)
4205
4206AC_MSG_RESULT([$ans])
4207
4208case "$ans" in
4209 yes)
4210    AC_DEFINE([IRIG_SUCKS], [1],
4211	[Should we use the IRIG sawtooth filter?])
4212esac
4213
4214AC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4215AC_ARG_ENABLE(
4216	[nist],
4217	[AS_HELP_STRING(
4218	    [--enable-nist],
4219	    [- if we should enable the NIST lockclock scheme]
4220	)],
4221	[ans=$enableval],
4222	[ans=no]
4223)
4224
4225AC_MSG_RESULT([$ans])
4226
4227case "$ans" in
4228 yes)
4229    AC_DEFINE([LOCKCLOCK], [1],
4230	[Should we align with the NIST lockclock scheme?]) ;;
4231esac
4232
4233AC_MSG_CHECKING([if we want support for Samba's signing daemon])
4234AC_ARG_ENABLE(
4235    [ntp-signd],
4236    [AS_HELP_STRING(
4237	[--enable-ntp-signd],
4238	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4239    )],
4240    [ans=$enableval],
4241    [ans=no]
4242)
4243
4244AC_MSG_RESULT([$ans])
4245
4246case "$ans" in
4247 no)
4248    ntp_signd_path=
4249    ;;
4250 yes)
4251    ntp_signd_path=/var/run/ntp_signd
4252    ;;
4253 *)
4254    ntp_signd_path="$ans"
4255esac
4256
4257case "$ntp_signd_path" in
4258 '')
4259    ;;
4260 *)
4261    AC_DEFINE([HAVE_NTP_SIGND], [1],
4262	[Do we want support for Samba's signing daemon?])
4263    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4264	[Path to sign daemon rendezvous socket])
4265    ;;
4266esac
4267
4268AC_CHECK_HEADERS([libscf.h])
4269LSCF=
4270case "$ac_cv_header_libscf_h" in
4271 yes)
4272    LSCF='-lscf'
4273esac
4274AC_SUBST([LSCF])
4275
4276NTP_IPV6
4277
4278
4279#
4280# Look for a sysctl call to get the list of network interfaces.
4281#
4282AC_CACHE_CHECK(
4283    [for interface list sysctl],
4284    [ntp_cv_iflist_sysctl],
4285    [AC_PREPROC_IFELSE(
4286	[AC_LANG_SOURCE([
4287	    #include <sys/param.h>
4288	    #include <sys/sysctl.h>
4289	    #include <sys/socket.h>
4290	    #ifndef NET_RT_IFLIST
4291	    # error
4292	    #endif
4293	])],
4294	[ntp_cv_iflist_sysctl=yes],
4295	[ntp_cv_iflist_sysctl=no]
4296    )]
4297)
4298case "$ntp_cv_iflist_sysctl" in
4299 yes)
4300    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4301esac
4302
4303###
4304
4305AC_MSG_CHECKING([if we want the saveconfig mechanism])
4306AC_ARG_ENABLE(
4307    [saveconfig],
4308    [AS_HELP_STRING(
4309	[--enable-saveconfig],
4310	[+ saveconfig mechanism]
4311    )],
4312    [ntp_ok=$enableval],
4313    [ntp_ok=yes]
4314)
4315ntp_saveconfig_enabled=0
4316case "$ntp_ok" in
4317 yes)
4318    ntp_saveconfig_enabled=1
4319    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4320    ;;
4321esac
4322AM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4323AC_MSG_RESULT([$ntp_ok])
4324
4325###
4326
4327AC_MSG_CHECKING([if we want the experimental leap smear code])
4328AC_ARG_ENABLE(
4329    [leap-smear],
4330    [AS_HELP_STRING(
4331	[--enable-leap-smear],
4332	[- experimental leap smear code]
4333    )],
4334    [ntp_ok=$enableval],
4335    [ntp_ok=no]
4336)
4337ntp_leap_smear_enabled=0
4338case "$ntp_ok" in
4339 yes)
4340    ntp_leap_smear_enabled=1
4341    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4342    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4343    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4344    ;;
4345esac
4346AC_MSG_RESULT([$ntp_ok])
4347
4348###
4349
4350AC_MSG_CHECKING([if we want dynamic interleave support])
4351AC_ARG_ENABLE(
4352    [dynamic-interleave],
4353    [AS_HELP_STRING(
4354	[--enable-dynamic-interleave],
4355	[- dynamic interleave support]
4356    )],
4357    [ntp_ok=$enableval],
4358    [ntp_ok=no]
4359)
4360ntp_dynamic_interleave=0
4361case "$ntp_ok" in
4362 yes)
4363    ntp_dynamic_interleave=1
4364    ;;
4365esac
4366AC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4367    [support dynamic interleave?])
4368AC_MSG_RESULT([$ntp_ok])
4369
4370NTP_UNITYBUILD
4371
4372dnl  gtest is needed for our tests subdirs. It would be nice if we could
4373dnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4374dnl  can't be conditionalized.
4375NTP_GOOGLETEST
4376
4377NTP_PROBLEM_TESTS
4378
4379###
4380
4381AC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4382    [Default location of crypto key info])
4383
4384AC_CONFIG_FILES([Makefile])
4385AC_CONFIG_FILES([adjtimed/Makefile])
4386AC_CONFIG_FILES([clockstuff/Makefile])
4387AC_CONFIG_FILES([include/Makefile])
4388AC_CONFIG_FILES([include/isc/Makefile])
4389AC_CONFIG_FILES([kernel/Makefile])
4390AC_CONFIG_FILES([kernel/sys/Makefile])
4391AC_CONFIG_FILES([libntp/Makefile])
4392AC_CONFIG_FILES([libparse/Makefile])
4393AC_CONFIG_FILES([ntpd/Makefile])
4394AC_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])
4395AC_CONFIG_FILES([ntpdate/Makefile])
4396AC_CONFIG_FILES([ntpdc/Makefile])
4397AC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4398AC_CONFIG_FILES([ntpq/Makefile])
4399AC_CONFIG_FILES([ntpsnmpd/Makefile])
4400AC_CONFIG_FILES([parseutil/Makefile])
4401AC_CONFIG_FILES([scripts/Makefile])
4402AC_CONFIG_FILES([scripts/build/Makefile])
4403AC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
4404AC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4405AC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4406AC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4407AC_CONFIG_FILES([scripts/lib/Makefile])
4408AC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4409AC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4410AC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4411AC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4412AC_CONFIG_FILES([scripts/ntptrace/Makefile])
4413AC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4414AC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4415AC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4416AC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4417AC_CONFIG_FILES([scripts/update-leap/Makefile])
4418AC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4419AC_CONFIG_FILES([tests/Makefile])
4420AC_CONFIG_FILES([tests/bug-2803/Makefile])
4421AC_CONFIG_FILES([tests/libntp/Makefile])
4422AC_CONFIG_FILES([tests/ntpd/Makefile])
4423AC_CONFIG_FILES([tests/ntpq/Makefile])
4424AC_CONFIG_FILES([tests/sandbox/Makefile])
4425AC_CONFIG_FILES([tests/sec-2853/Makefile])
4426AC_CONFIG_FILES([util/Makefile])
4427
4428perllibdir="${datadir}/ntp/lib"
4429AC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4430
4431calc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4432AC_SUBST_FILE([calc_tickadj_opts])
4433ntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4434AC_SUBST_FILE([ntp_wait_opts])
4435ntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4436AC_SUBST_FILE([ntpsweep_opts])
4437ntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4438AC_SUBST_FILE([ntptrace_opts])
4439summary_opts="$srcdir/scripts/summary-opts"
4440AC_SUBST_FILE([summary_opts])
4441plot_summary_opts="$srcdir/scripts/plot_summary-opts"
4442AC_SUBST_FILE([plot_summary_opts])
4443
4444AC_CONFIG_SUBDIRS([sntp])
4445
4446AC_OUTPUT
4447