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