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