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