configure.ac revision 285612
1163953Srrsdnl NTP top-level configure.ac				-*- Autoconf -*-
2185694Srrsdnl
3235828Stuexenm4_include([sntp/m4/version.m4])
4235828StuexenAC_PREREQ([2.61])
5163953SrrsAC_INIT(
6163953Srrs    [ntp],
7163953Srrs    [VERSION_NUMBER],
8163953Srrs    [http://bugs.ntp.org./],
9163953Srrs    [],
10228653Stuexen    [http://www.ntp.org./]dnl
11163953Srrs)
12163953SrrsAC_CONFIG_MACRO_DIR([sntp/m4])
13163953SrrsAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14228653Stuexen
15163953SrrsAC_PRESERVE_HELP_ORDER
16163953Srrs
17163953Srrs# Bump ntp_configure_cache_version for each change to configure.ac or
18163953Srrs# .m4 files which invalidates cached values from previous configure 
19163953Srrs# runs.
20163953Srrs#
21163953Srrs# If the change affects cache variables used only by the main NTP
22163953Srrs# configure.ac, then only its version number should be bumped, while
23163953Srrs# the subdir configure.ac version numbers should be unchanged.  The
24163953Srrs# same is true for a test/variable that is used only by one subdir
25163953Srrs# being changed incompatibly; only that subdir's cache version needs
26163953Srrs# bumping.
27163953Srrs#
28163953Srrs# If a change affects variables shared by all NTP configure scripts,
29163953Srrs# please bump the version numbers of each.  If you are not sure, the
30163953Srrs# safe choice is to bump all on any cache-invalidating change.
31163953Srrs#
32163953Srrs# In order to avoid the risk of version stamp collision between -stable
33163953Srrs# and -dev branches, do not simply increment the version, instead use
34163953Srrs# the date YYYYMMDD optionally with -HHMM if there is more than one
35163953Srrs# bump in a day.
36235828Stuexen
37235828Stuexenntp_configure_cache_version=20120806
38163953Srrs
39165647Srrs# When the cache version of config.cache and configure do not
40163953Srrs# match, NTP_CACHEVERSION will flush the cache.
41163953Srrs
42163953SrrsNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
43163953Srrs
44165647SrrsAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
45165647Srrs
46163953Srrsdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
47163953Srrsm4_ifdef(
48163953Srrs    [AM_SILENT_RULES],
49163953Srrs    [AM_SILENT_RULES([yes])]
50163953Srrs)
51163953SrrsAC_CANONICAL_BUILD
52163953SrrsAC_CANONICAL_HOST
53163953Srrsdnl the 'build' machine is where we run configure and compile
54197326Stuexendnl the 'host' machine is where the resulting stuff runs.
55163953SrrsAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
56163953Srrs    [canonical system (cpu-vendor-os) of where we should run])
57163953SrrsAC_CONFIG_HEADERS([config.h])
58163953Srrsdnl AC_ARG_PROGRAM
59165220Srrs
60163953Srrsntp_atom_ok=${ntp_atom_ok=no}
61163953Srrsntp_oncore_ok=${ntp_oncore_ok=no}
62163953Srrsntp_parse_ok=${ntp_parse_ok=no}
63165220Srrsntp_ripe_ncc_ok=${ntp_parse_ok=no}
64165220Srrsntp_jupiter_ok=${ntp_jupiter_ok=no}
65165220Srrs
66165220SrrsNTP_PROG_CC
67165220SrrsAC_PROG_CPP
68165220Srrs# Do we need CXX for anything besides google test?
69163953SrrsAC_PROG_CXX
70165220SrrsAC_PROG_YACC
71163953SrrsAC_PROG_CC_C_O
72163953SrrsAX_C99_STRUCT_INIT
73163953Srrs
74163953SrrsNTP_VPATH_HACK		dnl used only by ntpd/Makefile.am
75163953Srrs
76163953SrrsNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
77163953Srrs
78163953Srrsdnl AM_PROG_AR req. automake 1.12
79294140Stuexenm4_ifdef(
80163953Srrs    [AM_PROG_AR],
81240198Stuexen    [AM_PROG_AR]
82240198Stuexen)
83163953Srrs
84163953Srrs# So far, the only shared library we might use is libopts.
85163953Srrs# It's a small library - we might as well use a static version of it.
86163953SrrsAC_DISABLE_SHARED
87163953SrrsAC_PROG_LIBTOOL
88163953SrrsAC_SUBST([LIBTOOL_DEPS])
89167598Srrs
90163953Srrs# NTP has (so far) been relying on leading-edge autogen, which
91163953Srrs# means we need the appropriate corresponding libopts as well.
92163953Srrs# Therefore, by default:
93163953Srrs# - use the version of libopts we ship with
94163953Srrs# - do not install it
95163953Srrs# - build a static copy (AC_DISABLE_SHARED - done earlier)
96163953Srrscase "${enable_local_libopts+set}" in
97163953Srrs set) ;;
98163953Srrs *) enable_local_libopts=yes ;;
99163953Srrsesac
100163953Srrscase "${enable_libopts_install+set}" in
101163953Srrs set) ;;
102163953Srrs *) enable_libopts_install=no ;;
103163953Srrsesac
104163953Srrsenable_nls=no
105163953SrrsLIBOPTS_CHECK_NOBUILD([sntp/libopts])
106163953Srrs
107167598SrrsNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
108163953Srrs
109163953SrrsNTP_LIBNTP
110218211Srrs
111218211SrrsAC_MSG_CHECKING([for deprecated --with-arlib])
112218211SrrsAC_ARG_WITH([arlib],
113218211Srrs	AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
114218211Srrs	[ans=$withval], [ans=no])
115218211SrrsAC_MSG_RESULT([$ans])
116218211Srrs
117218211Srrscase "$ans" in
118218211Srrs yes)
119218211Srrs    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
120218211Srrs    ;;
121218211Srrsesac
122218211Srrs
123218211Srrsdnl  we need to check for cross compile tools for vxWorks here
124218211SrrsAC_PROG_AWK
125218211SrrsAS_UNSET([ac_cv_prog_AWK])
126218211SrrsAC_SUBST([AWK])				dnl scripts/ntpver.in
127218211SrrsAC_PROG_MAKE_SET
128218211Srrs
129218211SrrsAC_SUBST([CFLAGS])
130218211SrrsAC_SUBST([LDFLAGS])
131218211Srrs
132218211SrrsAC_PROG_LN_S
133218211SrrsAC_ISC_POSIX
134218211Srrs
135163953Srrs
136167598SrrsAC_PATH_PROG([PATH_PERL], [perl])
137208160Srrsdnl  Saving cached hardcoded paths rather than searching $PATH during a
138163953Srrsdnl  cached configure run is an optimization not worth the the cost of
139163953Srrsdnl  preventing newly-installed tools from being found.  Short-circuit
140163953Srrsdnl  the caching after the tests so preset overrides still work.
141208160SrrsAS_UNSET([ac_cv_path_PATH_PERL])
142163953SrrsAC_PATH_PROG([PATH_TEST], [test])
143163953SrrsAS_UNSET([ac_cv_path_PATH_TEST])
144167598Srrstest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
145163953SrrsAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
146163953Srrs
147163953SrrsAC_ARG_WITH(
148163953Srrs    [net-snmp-config],
149163953Srrs    [AS_HELP_STRING(
150163953Srrs	[--with-net-snmp-config],
151163953Srrs	[+ =net-snmp-config]
152163953Srrs    )],
153167598Srrs    [ans=$withval],
154163953Srrs    [ans=yes]
155163953Srrs)
156163953Srrscase "$ans" in
157163953Srrs no)
158163953Srrs    ;;
159163953Srrs yes)
160208160Srrs    ans=net-snmp-config
161167598Srrs    ;;
162163953Srrs /*)
163163953Srrs    ;;
164163953Srrs */*)
165163953Srrs    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
166163953Srrs    ;;
167163953Srrs *)
168163953Srrs    ;;
169163953Srrsesac
170163953SrrsPROG_NET_SNMP_CONFIG=$ans
171163953SrrsAC_MSG_CHECKING([for net-snmp-config path])
172167598Srrscase "$PROG_NET_SNMP_CONFIG" in
173167598Srrs no) ;;
174167598Srrs /*)
175167598Srrs    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
176167598Srrs    ;;
177208160Srrs *)
178208160Srrs    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
179208160Srrs    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
180208160Srrs;;
181208160Srrsesac
182208160SrrsAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
183208160Srrs
184208160Srrscase "$PATH_NET_SNMP_CONFIG" in
185208160Srrs /*)	AC_CACHE_CHECK(
186208160Srrs	    [for net-snmp version],
187225676Stuexen	    [ntp_cv_net_snmp_version],
188225676Stuexen	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
189208160Srrs	)
190169352Srrs	;;
191169352Srrsesac
192191117Skmacy
193226222Stuexencase "$host" in
194226222Stuexen *-*-vxworks*)
195169352Srrs    ac_link="$ac_link $VX_KERNEL"
196169352Srrs    ;;
197169352Srrsesac
198169352Srrs
199171440Srrs# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
200171440SrrsAC_SEARCH_LIBS([openlog], [gen syslog])
201171440Srrs# XXX library list will be in ac_cv_search_openlog
202171440Srrs
203171440Srrs# LIBSECCOMP is off by default -- needs testing with all the features
204171440Srrs# Please send bug reports to loganaden@gmail.com
205171440SrrsAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
206171440SrrsAC_ARG_ENABLE(
207171440Srrs    [libseccomp],
208171440Srrs    [AS_HELP_STRING(
209171440Srrs	[--enable-libseccomp],
210171440Srrs	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
211171440Srrs    )],
212171440Srrs    [ntp_ok=$enableval],
213171440Srrs    [ntp_ok=no]
214171440Srrs)
215171440SrrsAC_MSG_RESULT([$ntp_ok])
216171440Srrscase "$ntp_ok" in
217171440Srrs yes)
218171440Srrs    AC_SEARCH_LIBS(
219171440Srrs	[seccomp_init],
220171440Srrs	[seccomp],
221171440Srrs	[AC_DEFINE([LIBSECCOMP], [1],
222219120Srrs	    [Define to any value to include libseccomp sandboxing.])]
223219120Srrs    )
224219120Srrs    AC_TRY_RUN([
225219120Srrs	#include <stdio.h>
226219120Srrs	#include <stdlib.h>
227219120Srrs	#include <errno.h>
228219120Srrs	#include <sys/prctl.h>
229219397Srrs	#include <linux/seccomp.h>
230219397Srrs
231219397Srrs	int main(void)
232219397Srrs	{
233219397Srrs		int ret;
234219397Srrs		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
235219397Srrs		if (ret < 0) {
236219397Srrs			switch (errno) {
237219120Srrs			case ENOSYS:
238219120Srrs				return 1;
239219397Srrs			case EINVAL:
240219397Srrs				return 1;
241219397Srrs			default:
242219397Srrs				return 1;
243219120Srrs			}
244219120Srrs		}
245219120Srrs		ret = 
246163953Srrs		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
247163953Srrs		if (ret < 0) {
248163953Srrs			switch (errno) {
249163953Srrs			case EINVAL:
250163953Srrs				return 1;
251163953Srrs			case EFAULT:
252163953Srrs				return 0;
253163953Srrs			default:
254224641Stuexen				return 1;
255163953Srrs		}
256163953Srrs	}
257163953Srrsreturn 1;
258163953Srrs}
259163953Srrs]
260169352Srrs, AC_DEFINE([KERN_SECCOMP], 1, 
261169352Srrs[Define to use libseccomp system call filtering.])   
262163953Srrs, []
263163953Srrs)
264163953Srrs    ;;
265218072Srrsesac
266218072Srrs
267218072SrrsNTP_FACILITYNAMES
268218072Srrs
269163953Srrsdnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
270163953Srrsdnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
271163953Srrsdnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
272219013Stuexendnl does Strange Things with extra processes using the Posix-compatibility
273163953Srrsdnl real-time library, so we don't want to use it.
274163953Srrsdnl
275163953Srrsdnl 081118 Harlan got tired of looking for a way to get the sched*()
276163953Srrsdnl functions to link OK with either cc or gcc.
277163953Srrs
278163953Srrscase "$host" in
279163953Srrs *-*-*linux*) ;;
280219057Srrs *-*-osf4*) ;;
281219057Srrs *-*-osf5*) ;;
282219120Srrs *)
283219057Srrs    # HMS: Make sure we check for -lrt for clock_* before this...
284163953Srrs    case "$ac_cv_search_clock_gettime" in
285163953Srrs     '') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
286163953Srrs    esac
287163953Srrs    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
288163953Srrs    ;;
289163953Srrsesac
290163953Srrs
291163953SrrsAC_CHECK_HEADERS([bstring.h])
292163953SrrsAC_CHECK_HEADER(
293163953Srrs    [dns_sd.h],
294218186Srrs    [AC_SEARCH_LIBS(
295218186Srrs	[DNSServiceRegister],
296163953Srrs	[dns_sd],
297163953Srrs	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
298163953Srrs	    [Use Rendezvous/DNS-SD registration])]
299163953Srrs    )]
300163953Srrs)
301163953SrrsAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
302171440Srrs
303171440SrrsAC_CHECK_HEADERS([memory.h netdb.h poll.h])
304171440SrrsAC_CHECK_HEADERS([sgtty.h stdatomic.h stdlib.h string.h termio.h])
305171440SrrsAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
306171440Srrs
307171440Srrscase "$host" in
308163953Srrs *-*-aix*)
309163953Srrs    AC_CHECK_HEADERS([utmpx.h])
310163953Srrs    case "$ac_cv_header_utmpx_h" in
311163953Srrs     yes)
312163953Srrs	;;
313163953Srrs     *)
314163953Srrs	AC_CHECK_HEADERS([utmp.h])
315163953Srrs	;;
316163953Srrs    esac
317163953Srrs    ;;
318163953Srrs *)
319163953Srrs    AC_CHECK_HEADERS([utmp.h utmpx.h])
320163953Srrs    ;;
321163953Srrsesac
322163953Srrs
323163953Srrs#
324225549Stuexen# On Suns only (so far) getpass() truncates the typed password to 8
325224870Stuexen# characters, but getpassphrase() allows up to 257.  Most systems'
326225549Stuexen# getpass() does not truncate, at least not so as to affect ntpq and
327224870Stuexen# ntpdc password prompts.
328163953Srrs#
329168124Srrs# So check for getpassphrase(), but only on Sun operating systems.
330168124Srrs#
331168124Srrscase "$host" in
332168124Srrs *-*-sunos*|*-*-solaris*)
333224641Stuexen    AC_CHECK_FUNCS([getpassphrase])
334168124Srrsesac
335163953Srrs
336163953Srrs
337224641StuexenAC_CHECK_HEADERS([net/if6.h])
338163953SrrsAC_CHECK_HEADERS([net/route.h], [], [], [
339224641Stuexen    #include <sys/types.h>
340224641Stuexen    #include <sys/socket.h>
341224641Stuexen    #include <net/if.h>
342163953Srrs])
343179157Srrs
344179157SrrsAC_CHECK_HEADERS([netinfo/ni.h])
345163953Srrscase "$ac_cv_header_netinfo_ni_h" in
346163953Srrs yes)
347163953Srrs    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
348163953Srrsesac
349163953SrrsAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
350163953Srrscase "$host" in
351163953Srrs *-*-sunos4*)
352163953Srrs    ;;
353163953Srrs *)
354163953Srrs    AC_CHECK_HEADERS([sys/ioctl.h])
355163953Srrs    ;;
356163953Srrsesac
357163953SrrsAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
358163953Srrs# HMS: Check sys/proc.h and sys/resource.h after some others
359163953SrrsAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
360163953Srrscase "$ac_cv_header_sched_h" in
361163953Srrs yes)
362163953Srrs    ;;
363163953Srrs *)
364163953Srrs    AC_CHECK_HEADERS([sys/sched.h])
365163953Srrs    ;;
366163953Srrsesac
367163953Srrs# HMS: Check sys/shm.h after some others
368163953SrrsAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
369163953Srrs# HMS: Checked sys/socket.h earlier
370163953Srrscase "$host" in
371163953Srrs *-*-netbsd*)
372163953Srrs    ;;
373163953Srrs *)
374163953Srrs    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
375163953Srrs    ;;
376163953Srrsesac
377163953SrrsAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
378168124SrrsAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
379170642Srrscase "$host" in
380163953Srrs*-convex-*)
381218186Srrs    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
382219397Srrs    ;;
383218335Stuexen*-*-bsdi*)
384281955Shiren    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
385163953Srrs    ;;
386163953Srrsesac
387163953Srrs
388163953Srrscase "$ac_cv_header_stdatomic_h" in
389163953Srrs yes)
390163953Srrs	AC_CHECK_FUNCS([atomic_thread_fence])
391163953Srrs	AC_CACHE_CHECK(
392163953Srrs	    [for atomic_thread_fence()],
393163953Srrs	    [ntp_cv_func_atomic_thread_fence],
394218186Srrs	    [AC_COMPILE_IFELSE(
395163953Srrs		[AC_LANG_PROGRAM(
396163953Srrs		    [[
397163953Srrs			#include <stdatomic.h>
398163953Srrs		    ]],
399163953Srrs		    [[
400163953Srrs			atomic_thread_fence(memory_order_seq_cst);
401163953Srrs		    ]]
402163953Srrs		)]
403165220Srrs		[ntp_cv_func_atomic_thread_fence=yes],
404163953Srrs		[ntp_cv_func_atomic_thread_fence=no]
405163953Srrs	    )]
406218186Srrs	)
407163953Srrs    ;;
408163953Srrsesac
409163953Srrs
410163953Srrscase "$host" in
411163953Srrs *-*-solaris2.6)
412163953Srrs    # Broken...
413163953Srrs    ;;
414163953Srrs *)
415163953Srrs    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
416231074Stuexen    ;;
417163953Srrsesac
418163953Srrs
419163953Srrscase "$host" in
420271750Stuexen *-*-*linux*)
421271750Stuexen    case "$ac_cv_func_ntp_gettime" in
422163953Srrs     yes)
423163953Srrs	;;
424163953Srrs     *)
425163953Srrs	AC_CHECK_FUNCS([__ntp_gettime])
426163953Srrs	case "$ac_cv_func___ntp_gettime" in
427163953Srrs	 yes)
428163953Srrs	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
429163953Srrs		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
430163953Srrs	esac
431163953Srrs	;;
432163953Srrs    esac
433163953Srrs    AC_CHECK_FUNCS([adjtimex])
434163953Srrs    case "$ac_cv_func_adjtimex" in
435163953Srrs     yes)
436163953Srrs	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
437163953Srrs	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
438163953Srrs	have_adjtimex=1
439163953Srrs	;;
440163953Srrs     *)
441163953Srrs	AC_CHECK_FUNCS([__adjtimex])
442185694Srrs	case "$ac_cv_func___adjtimex" in
443185694Srrs	 yes)
444163953Srrs	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
445163953Srrs	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
446163953Srrs	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
447163953Srrs	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
448163953Srrs	    have_adjtimex=1
449168124Srrs	esac
450163953Srrs	;;
451163953Srrs    esac
452163953Srrsesac
453163953Srrscase "$have_adjtimex" in
454163953Srrs '')
455163953Srrs    # nlist stuff is only needed for tickadj.
456163953Srrs    saved_LIBS="$LIBS"
457163953Srrs    LIBS=
458163953Srrs    AC_SEARCH_LIBS([nlist], [elf ld mld])
459163953Srrs    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
460163953Srrs    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
461163953Srrs    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
462163953Srrs    AC_CHECK_HEADERS([nlist.h sys/var.h])
463163953Srrs    case "$ac_cv_header_nlist_h" in
464163953Srrs     yes)
465163953Srrs	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
466163953Srrs	AC_CACHE_CHECK(
467163953Srrs	    [for n_un in struct nlist],
468163953Srrs	    [ntp_cv_struct_nlist_n_un],
469163953Srrs	    [AC_COMPILE_IFELSE(
470163953Srrs		[AC_LANG_PROGRAM(
471163953Srrs		    [[
472163953Srrs			#include <nlist.h>
473163953Srrs		    ]],
474163953Srrs		    [[
475169352Srrs			struct nlist n;
476169352Srrs			n.n_un.n_name = 0;
477163953Srrs		    ]]
478163953Srrs		)]
479163953Srrs		[ntp_cv_struct_nlist_n_un=yes],
480165647Srrs		[ntp_cv_struct_nlist_n_un=no]
481163953Srrs	    )]
482163953Srrs	)
483164085Srrs	case "$ntp_cv_struct_nlist_n_un" in
484168943Srrs	 yes)
485163953Srrs	    AC_DEFINE([NLIST_NAME_UNION], [1],
486163953Srrs		[does struct nlist use a name union?])
487163953Srrs	esac
488163953Srrs    esac
489163953Srrs    AC_SUBST([LDADD_NLIST])
490163953Srrs    LDADD_NLIST="$LIBS"
491163953Srrs    LIBS="$saved_LIBS"
492163953Srrs    AS_UNSET([saved_LIBS])
493163953Srrsesac
494163953Srrs
495163953SrrsAC_CHECK_HEADERS([sys/proc.h], [], [], [
496163953Srrs    #ifdef HAVE_SYS_TYPES_H
497163953Srrs    # include <sys/types.h>
498163953Srrs    #endif
499163953Srrs    #ifdef HAVE_SYS_TIME_H
500163953Srrs    # include <sys/time.h>
501163953Srrs    #endif
502163953Srrs])
503163953Srrs
504163953SrrsAC_CHECK_HEADERS([sys/resource.h], [], [], [
505163953Srrs    #ifdef HAVE_SYS_TIME_H
506163953Srrs    # include <sys/time.h>
507163953Srrs    #endif
508163953Srrs])
509163953Srrs
510163953SrrsAC_CHECK_HEADERS([sys/shm.h], [], [], [
511218241Stuexen    #ifdef HAVE_SYS_TYPES_H
512163953Srrs    # include <sys/types.h>
513163953Srrs    #endif
514163953Srrs    #ifdef HAVE_SYS_IPC_H
515163953Srrs    # include <sys/ipc.h>
516163953Srrs    #endif
517163953Srrs])
518165220Srrs
519185694SrrsAC_CHECK_HEADERS([sys/timex.h], [], [], [
520185694Srrs    #ifdef HAVE_SYS_TIME_H
521163953Srrs    # include <sys/time.h>
522163953Srrs    #endif
523168755Srrs])
524168859Srrs
525189836SrrsAC_TYPE_SIGNAL
526163953SrrsAC_TYPE_OFF_T
527163953SrrsAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
528163953Srrs
529163953SrrsAC_CACHE_CHECK(
530163953Srrs    [for a fallback value for HZ],
531163953Srrs    [ntp_cv_default_hz],
532163953Srrs    [
533163953Srrs	ntp_cv_default_hz=100
534163953Srrs	case "$host" in
535163953Srrs	 alpha*-dec-osf4*|alpha*-dec-osf5*)
536163953Srrs	    ntp_cv_default_hz=1024
537168943Srrs	    ;;
538163953Srrs	 mips-dec-ultrix4*)
539163953Srrs	    ntp_cv_default_hz=256
540217760Stuexen	    ;;
541217760Stuexen	esac
542217760Stuexen    ]
543217760Stuexen)
544217760StuexenAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
545217760Stuexen    [What is the fallback value for HZ?])
546217760Stuexen
547217760StuexenAC_CACHE_CHECK(
548217760Stuexen    [if we need to override the system's value for HZ],
549217760Stuexen    [ntp_cv_override_hz],
550217760Stuexen    [
551217760Stuexen	ntp_cv_override_hz=no
552217760Stuexen	case "$host" in
553217760Stuexen	 alpha*-dec-osf4*|alpha*-dec-osf5*)
554217760Stuexen	    ntp_cv_override_hz=yes
555217760Stuexen	    ;;
556217760Stuexen	 mips-dec-ultrix4*)
557217760Stuexen	    ntp_cv_override_hz=yes
558217760Stuexen	    ;;
559217760Stuexen	 *-*-freebsd*)
560217760Stuexen	    ntp_cv_override_hz=yes
561217760Stuexen	    ;;
562217760Stuexen	 *-*-sunos4*)
563217760Stuexen	    ntp_cv_override_hz=yes
564217760Stuexen	    ;;
565217760Stuexen	 *-*-kfreebsd*)
566217760Stuexen	    ntp_cv_override_hz=yes
567217760Stuexen	    ;;
568217760Stuexen	esac
569217760Stuexen    ]
570217760Stuexen)
571217760Stuexencase "$ntp_cv_override_hz" in
572217760Stuexen yes)
573217760Stuexen    AC_DEFINE([OVERRIDE_HZ], [1],
574217760Stuexen	[Do we need to override the system's idea of HZ?])
575217760Stuexenesac
576217760Stuexen
577217760Stuexendnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
578217760Stuexendnl [AC_TRY_LINK([#include <sys/types.h>
579217760Stuexendnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
580217760Stuexendnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
581217760Stuexendnl if test $su_cv_func_ut_host_in_utmp = yes; then
582217760Stuexendnl   AC_DEFINE(HAVE_UT_HOST)
583217760Stuexendnl fi
584294140Stuexen
585294140Stuexendnl AC_MSG_CHECKING(if we can get the system boot time)
586294140Stuexendnl AC_CACHE_VAL(su_cv_have_boot_time,
587294140Stuexendnl [AC_EGREP_CPP(yes,
588294140Stuexendnl [#ifdef HAVE_UTMPX_H
589294140Stuexendnl #include <utmpx.h>
590294140Stuexendnl #else
591294140Stuexendnl #include <utmp.h>
592294140Stuexendnl #endif
593163953Srrsdnl #ifdef BOOT_TIME
594163953Srrsdnl yes
595163953Srrsdnl #endif
596217760Stuexendnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
597294140Stuexendnl AC_MSG_RESULT($su_cv_have_boot_time)
598270363Stuexen
599270363StuexenAC_CACHE_CHECK(
600270363Stuexen    [for struct rt_msghdr],
601270363Stuexen    [ntp_cv_struct_rt_msghdr],
602270363Stuexen    [AC_COMPILE_IFELSE(
603270363Stuexen	[AC_LANG_PROGRAM(
604270363Stuexen	    [[
605270363Stuexen		#include <sys/types.h>
606163953Srrs		#include <sys/socket.h>
607242627Stuexen		#include <net/if.h>
608163953Srrs		#include <net/route.h>
609294140Stuexen	    ]],
610163953Srrs	    [[
611163953Srrs		struct rt_msghdr p;
612163953Srrs	    ]]
613163953Srrs	)],
614163953Srrs	[ntp_cv_struct_rt_msghdr=yes],
615163953Srrs	[ntp_cv_struct_rt_msghdr=no]
616163953Srrs    )]
617167598Srrs)
618163953Srrs
619185694SrrsAC_CACHE_CHECK(
620163953Srrs    [for struct rtattr],
621163953Srrs    [ntp_cv_rtattr],
622163953Srrs    [AC_COMPILE_IFELSE(
623163953Srrs	[AC_LANG_PROGRAM(
624163953Srrs	    [[
625163953Srrs		#include <stddef.h>
626163953Srrs		#include <sys/socket.h>
627163953Srrs		#include <linux/rtnetlink.h>
628163953Srrs	    ]],
629163953Srrs	    [[
630163953Srrs		struct rtattr p;
631166675Srrs	    ]]
632166675Srrs	)],
633166675Srrs	[ntp_cv_rtattr=yes],
634171477Srrs	[ntp_cv_rtattr=no]
635166675Srrs    )]
636166675Srrs)
637166675Srrs
638168859Srrscase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
639168859Srrs *yes*)
640171477Srrs    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
641171477Srrs	[Do we have a routing socket (rt_msghdr or rtattr)?])
642166675Srrs    case "$ntp_cv_rtattr" in
643166675Srrs     yes)
644171440Srrs	AC_DEFINE([HAVE_RTNETLINK], [1],
645171440Srrs	    [Do we have Linux routing socket?])
646171440Srrs    esac
647171440Srrsesac
648171440Srrs
649171440SrrsAC_CACHE_CHECK(
650171440Srrs    [struct sigaction for sa_sigaction],
651171440Srrs    [ntp_cv_struct_sigaction_has_sa_sigaction],
652171440Srrs    [AC_COMPILE_IFELSE(
653170056Srrs	[AC_LANG_PROGRAM(
654170056Srrs	    [[
655170056Srrs		#include <signal.h>
656170056Srrs	    ]],
657170056Srrs	    [[
658170056Srrs		struct sigaction act;
659170056Srrs		act.sa_sigaction = 0;
660170056Srrs	    ]]
661170056Srrs	)],
662170056Srrs	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
663170056Srrs	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
664170056Srrs    )]
665170056Srrs)
666170056Srrscase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
667170056Srrs yes)
668170056Srrs    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
669170056Srrsesac
670223132Stuexen
671223132StuexenAC_CACHE_CHECK(
672170056Srrs    [for struct ppsclockev],
673170056Srrs    [ntp_cv_struct_ppsclockev],
674163953Srrs    [AC_COMPILE_IFELSE(
675171440Srrs	[AC_LANG_PROGRAM(
676171440Srrs	    [[
677171440Srrs		#ifdef HAVE_SYS_TYPES_H
678171440Srrs		# include <sys/types.h>
679171440Srrs		#endif
680171440Srrs		#ifdef HAVE_SYS_TERMIOS_H
681171440Srrs		# include <sys/termios.h>
682171440Srrs		#endif
683171440Srrs		#ifdef HAVE_SYS_TIME_H
684224641Stuexen		# include <sys/time.h>
685171440Srrs		#endif
686171440Srrs		#ifdef HAVE_SYS_PPSCLOCK_H
687171440Srrs		# include <sys/ppsclock.h>
688171440Srrs		#endif
689171440Srrs	    ]],
690218129Srrs	    [[
691171440Srrs		extern struct ppsclockev *pce;
692171440Srrs		return pce->serial;
693171440Srrs	    ]]
694171440Srrs	)],
695171440Srrs	[ntp_cv_struct_ppsclockev=yes],
696219057Srrs	[ntp_cv_struct_ppsclockev=no]
697219057Srrs    )]
698219057Srrs)
699219057Srrscase "$ntp_cv_struct_ppsclockev" in
700219057Srrs yes)
701219057Srrs    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
702219057Srrs	[Does a system header define struct ppsclockev?])
703219057Srrsesac
704219057Srrs
705219397Srrscase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
706171440Srrs  *yes*)
707171440Srrs    AC_CACHE_CHECK(
708217760Stuexen	[for struct snd_size],
709217760Stuexen	[ntp_cv_struct_snd_size],
710217760Stuexen	[AC_COMPILE_IFELSE(
711217760Stuexen	    [AC_LANG_PROGRAM(
712217760Stuexen		[[
713217760Stuexen		    #ifdef HAVE_MACHINE_SOUNDCARD_H
714217760Stuexen		    # include <machine/soundcard.h>
715217760Stuexen		    #endif
716217760Stuexen		    #ifdef HAVE_SYS_SOUNDCARD_H
717218241Stuexen		    # include <sys/soundcard.h>
718217760Stuexen		    #endif
719217760Stuexen		]],
720217760Stuexen		[[
721217760Stuexen		    extern struct snd_size *ss;
722217760Stuexen		    return ss->rec_size;
723217760Stuexen		]]
724217760Stuexen	    )],
725217760Stuexen	    [ntp_cv_struct_snd_size=yes],
726217760Stuexen	    [ntp_cv_struct_snd_size=no]
727217760Stuexen        )]
728217760Stuexen    )
729217760Stuexen    case "$ntp_cv_struct_snd_size" in
730217760Stuexen     yes)
731217760Stuexen	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
732217760Stuexen	    [Do we have struct snd_size?])
733217760Stuexen    esac
734217760Stuexenesac
735179157Srrs
736179157SrrsAC_CACHE_CHECK(
737179157Srrs    [struct clockinfo for hz],
738179157Srrs    [ntp_cv_struct_clockinfo_has_hz],
739179157Srrs    [AC_COMPILE_IFELSE(
740179157Srrs	[AC_LANG_PROGRAM(
741179157Srrs	    [[
742179157Srrs		#include <sys/time.h>
743179157Srrs	    ]],
744179157Srrs	    [[
745171990Srrs		extern struct clockinfo *pc;
746171990Srrs		return pc->hz;
747171990Srrs	    ]]
748171990Srrs	)],
749171990Srrs	[ntp_cv_struct_clockinfo_has_hz=yes],
750171990Srrs	[ntp_cv_struct_clockinfo_has_hz=no]
751171990Srrs    )]
752171990Srrs)
753171990Srrscase "$ntp_cv_struct_clockinfo_has_hz" in
754171990Srrs yes)
755171440Srrs    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
756163953Srrsesac
757163953Srrs
758163953SrrsAC_CACHE_CHECK(
759163953Srrs    [struct clockinfo for tickadj],
760163953Srrs    [ntp_cv_struct_clockinfo_has_hz],
761163953Srrs    [AC_COMPILE_IFELSE(
762163953Srrs	[AC_LANG_PROGRAM(
763163953Srrs	    [[
764171572Srrs		#include <sys/time.h>
765163953Srrs	    ]],
766163953Srrs	    [[
767171572Srrs		extern struct clockinfo *pc;
768163953Srrs		return pc->tickadj;
769163953Srrs	    ]]
770163953Srrs	)],
771163953Srrs	[ntp_cv_struct_clockinfo_has_hz=yes],
772170056Srrs	[ntp_cv_struct_clockinfo_has_hz=no]
773163953Srrs    )]
774163953Srrs)
775163953Srrscase "$ntp_cv_struct_clockinfo_has_hz" in
776171572Srrs yes)
777163953Srrs    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
778171572Srrsesac
779163953Srrs
780163953Srrscase "$ntp_cv_struct_ntptimeval" in
781172091Srrs yes)
782163953Srrs    AC_CHECK_MEMBERS(
783171572Srrs	[struct ntptimeval.time.tv_nsec],
784167598Srrs	[],
785167598Srrs	[],
786171572Srrs	[
787171572Srrs	    #ifdef HAVE_SYS_TIME_H
788172091Srrs	    # include <sys/time.h>
789172091Srrs	    #else
790163953Srrs	    # ifdef HAVE_TIME_H
791171572Srrs	    #  include <time.h>
792171572Srrs	    # endif
793163953Srrs	    #endif
794163953Srrs	    #ifdef HAVE_SYS_TIMEX_H
795163953Srrs	    # include <sys/timex.h>
796163953Srrs	    #else
797163953Srrs	    # ifdef HAVE_TIMEX_H
798163953Srrs	    #  include <timex.h>
799179157Srrs	    # endif
800179157Srrs	    #endif
801179157Srrs	]
802163953Srrs    )
803163953Srrsesac
804163953Srrs
805163953Srrs#### 
806163953Srrs
807163953SrrsAC_CHECK_FUNCS([arc4random_buf])
808163953Srrs
809163953Srrs#### 
810163953Srrs
811163953Srrssaved_LIBS="$LIBS"
812163953SrrsLIBS="$LIBS $LDADD_LIBNTP"
813163953SrrsAC_CHECK_FUNCS([daemon])
814163953Srrs# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
815218241StuexenLIBS="$saved_LIBS"
816217760StuexenAS_UNSET([saved_LIBS])
817163953Srrs
818163953SrrsAC_CHECK_FUNCS(
819163953Srrs    [finite],
820163953Srrs    [],
821163953Srrs    [AC_CHECK_FUNCS(
822163953Srrs	[isfinite],
823163953Srrs	[],
824163953Srrs	[
825163953Srrs	    AC_MSG_CHECKING([for isfinite with <math.h>])
826163953Srrs	    _libs=$LIBS
827163953Srrs	    # XXX
828163953Srrs	    LIBS="$LIBS -lm"
829163953Srrs	    AC_LINK_IFELSE(
830171990Srrs		[AC_LANG_PROGRAM(
831163953Srrs		    [[
832163953Srrs			#include <math.h>
833163953Srrs		    ]],
834163953Srrs		    [[
835163953Srrs			float f = 0.0;
836163953Srrs			isfinite(f);
837163953Srrs		    ]]
838163953Srrs		)],
839163953Srrs		[ans=yes],
840163953Srrs		[ans=no]
841163953Srrs	    )
842163953Srrs	    LIBS=$_libs
843163953Srrs	    AC_MSG_RESULT([$ans])
844163953Srrs	    case "$ans" in
845163953Srrs	     yes)
846163953Srrs		AC_DEFINE([HAVE_ISFINITE], [1])
847163953Srrs	    esac
848163953Srrs	]
849224641Stuexen    )]
850163953Srrs)
851190689Srrs
852163953SrrsAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
853163953Srrs
854163953Srrs# kvm_open() is only used by tickadj.  Also see above.
855163953Srrscase "$ac_cv_header_kvm_h" in
856163953Srrs yes)
857163953Srrs    AC_CHECK_FUNCS([kvm_open])
858163953Srrs    ;;
859163953Srrsesac
860163953Srrs
861163953Srrscase "$host" in
862163953Srrs *-*-sco3.2v5.0.*)
863163953Srrs    # Just stubs.  Sigh.
864163953Srrs    ;;
865163953Srrs *) AC_CHECK_FUNCS([mkstemp])
866163953Srrs    ;;
867163953Srrsesac
868163953SrrsAC_CHECK_FUNCS([mktime])
869171440Srrscase "$host" in
870171440Srrs *-*-aix[[4-9]]*)
871171440Srrs    # XXX only verified thru AIX6.
872171440Srrs    # Just a stub.  Sigh.
873171440Srrs    ;;
874171440Srrs *-*-irix[[45]]*)
875171440Srrs    # Just a stub in "old" Irix.  Sigh.
876217760Stuexen    ;;
877217760Stuexen# In the belief that the fix for bug 1223 fixes mlockall() under linux...
878217760Stuexen# *-*-*linux*)
879217760Stuexen#    # there, but more trouble than it is worth for now (resolver problems)
880171440Srrs#    ;;
881167598Srrs *-*-qnx*)
882167598Srrs    # Apparently there but not working in QNX.  Sigh?
883163953Srrs    ;;
884163953Srrs *-*-sco3.2v5.0.*)
885163953Srrs    # Just a stub.  Sigh.
886179157Srrs    ;;
887163953Srrs alpha*-dec-osf4*|alpha*-dec-osf5*)
888163953Srrs    # mlockall is there, as a #define calling memlk via <sys/mman.h>
889163953Srrs    # Not easy to test for - cheat.
890163953Srrs    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
891163953Srrs    AC_CHECK_FUNCS([mlockall])
892163953Srrs    ;;
893163953Srrs *) AC_CHECK_FUNCS([mlockall])
894163953Srrs    ;;
895163953Srrsesac
896163953SrrsAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
897163953Srrscase "$host" in
898163953Srrs *-*-aix[[4-9]]*)
899163953Srrs    # XXX only verified thru AIX6.
900163953Srrs    # Just a stub in AIX 4.  Sigh.
901163953Srrs    ;;
902163953Srrs *-*-solaris2.5*)
903163953Srrs    # Just stubs in solaris2.5.  Sigh.
904163953Srrs    ;;
905163953Srrs *) AC_CHECK_FUNCS([sched_setscheduler])
906163953Srrs    ;;
907163953Srrsesac
908163953SrrsAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
909163953SrrsAC_CHECK_FUNCS([strdup strerror setrlimit strchr])
910163953Srrscase "$host" in
911163953Srrs *-*-aix[[4-9]]*)
912163953Srrs    # XXX only verified thru AIX6.
913163953Srrs    # Just stubs.  Sigh.
914163953Srrs    ;;
915163953Srrs *-*-netbsd1*)
916163953Srrs    # Just stubs.  Sigh.
917163953Srrs    ;;
918163953Srrs *-*-netbsdelf1*)
919163953Srrs    # Just stubs.  Sigh.
920163953Srrs    ;;
921163953Srrs *-*-openbsd*)
922163953Srrs    # Just stubs.  Sigh.
923163953Srrs    ;;
924163953Srrs *)
925163953Srrs    AC_CHECK_FUNCS([timer_create])
926163953Srrs    ;;
927163953Srrsesac
928163953Srrs
929163953SrrsNTP_RLIMIT_ITEMS
930163953Srrs
931163953Srrs# HMS: Only if we are doing the MLOCKALL stuff...
932163953SrrsAC_MSG_CHECKING([for the default number of 4k stack pages])
933163953SrrsAC_ARG_WITH(
934163953Srrs    [stack-limit],
935163953Srrs    [AS_HELP_STRING(
936163953Srrs	[--with-stack-limit],
937163953Srrs	[? =50 (200 for openbsd) 4k pages]
938163953Srrs    )],
939163953Srrs    [ans=$withval],
940163953Srrs    [ans=yes]
941163953Srrs)
942163953Srrscase "$ans" in
943163953Srrs yes | no)
944163953Srrs    case "$host" in
945163953Srrs     *-*-openbsd*)
946163953Srrs	ans=200
947163953Srrs	;;
948185694Srrs     *) ans=50
949185694Srrs        ;;
950185694Srrs    esac
951185694Srrs    ;;
952163953Srrs [[1-9]][[0-9]]*)
953163953Srrs    ;;
954163953Srrs *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
955163953Srrs    ;;
956163953Srrsesac
957163953SrrsAC_MSG_RESULT([$ans])
958163953SrrsAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
959163953Srrs    [Default number of 4k pages for RLIMIT_STACK])
960163953Srrs
961163953Srrs# HMS: only if we have RLIMIT_MEMLOCK
962163953SrrsAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
963163953SrrsAC_ARG_WITH(
964163953Srrs    [memlock],
965163953Srrs    [AS_HELP_STRING(
966163953Srrs	[--with-memlock],
967163953Srrs	[? =32 (megabytes)]
968163953Srrs    )],
969163953Srrs    [ans=$withval],
970166675Srrs    [ans=yes]
971163953Srrs)
972166675Srrscase "$ans" in
973166675Srrs yes | no)
974166675Srrs    ans=32
975166675Srrs    ;;
976166675Srrs [[1-9]][[0-9]]*) ;;
977171477Srrs *) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
978172703Srrs     ;;
979166675Srrsesac
980166675SrrsAC_MSG_RESULT([$ans])
981168859SrrsAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
982168859Srrs    [Default number of megabytes for RLIMIT_MEMLOCK])
983171477Srrs
984172703Srrs
985166675Srrs# some OSes prefer _exit() in forked children to exit()
986171440SrrsAC_CHECK_FUNCS([_exit])
987171440Srrsntp_worker_child_exit=exit
988171440Srrscase "$ac_cv_func__exit::$host_os" in
989171440Srrs yes::netbsd*)
990171440Srrs    ntp_worker_child_exit=_exit
991166675Srrs    ;;
992163953Srrs yes::openbsd*)
993163953Srrs    ntp_worker_child_exit=_exit
994163953Srrs    ;;
995163953Srrsesac
996163953SrrsAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
997163953Srrs		   [routine worker child proc uses to exit.])
998170056Srrs
999163953SrrsAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
1000163953Srrs
1001163953Srrs###
1002171943Srrs
1003174257Srrs# http://bugs.ntp.org/737
1004171943Srrscase "$ac_cv_func_recvmsg" in
1005171943Srrs yes)
1006225549Stuexen    AC_CACHE_CHECK(
1007163953Srrs	[if we need extra help to define struct iovec],
1008225549Stuexen	[ntp_cv_struct_iovec_help],
1009163953Srrs	[
1010218129Srrs	    compiled=no
1011163953Srrs	    for ntp_cv_struct_iovec_help in '0' '1'; do
1012163953Srrs		AC_COMPILE_IFELSE(
1013163953Srrs		    [AC_LANG_PROGRAM(
1014163953Srrs			[[
1015163953Srrs			    #ifdef HAVE_SYS_TYPES_H
1016163953Srrs			    # include <sys/types.h>
1017163953Srrs			    #endif
1018163953Srrs			    #ifdef HAVE_SYS_SOCKET_H
1019163953Srrs			    # include <sys/socket.h>
1020163953Srrs			    #endif
1021163953Srrs			    #if $ntp_cv_struct_iovec_help
1022163953Srrs			    # include <sys/uio.h>
1023163953Srrs			    #endif
1024163953Srrs			]],
1025163953Srrs			[[
1026163953Srrs			    void foo(void) {
1027163953Srrs				ssize_t x;
1028163953Srrs				int s = 0;
1029210599Srrs				struct iovec iov;
1030163953Srrs				struct msghdr mh;
1031163953Srrs				int flags = 0;
1032163953Srrs
1033163953Srrs				mh.msg_iov = &iov;
1034163953Srrs				x = recvmsg(s, &mh, flags);
1035163953Srrs			    }
1036163953Srrs			]]
1037163953Srrs		    )],
1038163953Srrs		    [compiled=yes ; break 1],
1039163953Srrs		    []
1040163953Srrs		)
1041163953Srrs	    done
1042163953Srrs	    case "$compiled" in
1043163953Srrs	     no)
1044163953Srrs		ntp_cv_struct_iovec_help=0
1045163953Srrs	    esac
1046163953Srrs	    AS_UNSET([compiled])
1047224641Stuexen	]
1048224641Stuexen    )
1049163953Srrs    case "$ntp_cv_struct_iovec_help" in
1050163953Srrs     1)
1051163953Srrs	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1052163953Srrs	    [Use sys/uio.h for struct iovec help])
1053163953Srrs    esac
1054163953Srrsesac
1055163953Srrs
1056163953SrrsAC_CACHE_CHECK(
1057163953Srrs    [number of arguments taken by setpgrp()],
1058163953Srrs    [ntp_cv_func_setpgrp_nargs],
1059163953Srrs    [AC_COMPILE_IFELSE(
1060163953Srrs	[AC_LANG_PROGRAM(
1061163953Srrs	    [[
1062163953Srrs		#ifdef HAVE_SYS_TYPES_H
1063167598Srrs		# include <sys/types.h>
1064167598Srrs		#endif
1065167598Srrs		#ifdef HAVE_UNISTD_H
1066163953Srrs		# include <unistd.h>
1067163953Srrs		#endif
1068163953Srrs	    ]],
1069163953Srrs	    [[
1070163953Srrs		setpgrp(0, 0);
1071163953Srrs	    ]]
1072163953Srrs	)],
1073163953Srrs	[ntp_cv_func_setpgrp_nargs=2],
1074163953Srrs	[ntp_cv_func_setpgrp_nargs=0]
1075163953Srrs    )]
1076163953Srrs)
1077163953Srrscase "$ntp_cv_func_setpgrp_nargs" in
1078163953Srrs 0)
1079163953Srrs    AC_DEFINE([HAVE_SETPGRP_0], [1],
1080163953Srrs	      [define if setpgrp takes 0 arguments])
1081163953Srrsesac
1082163953Srrs
1083163953SrrsAC_CACHE_CHECK(
1084163953Srrs    [if we need to declare 'errno'],
1085163996Srrs    [ntp_cv_decl_errno],
1086163996Srrs    [AC_COMPILE_IFELSE(
1087163996Srrs	[AC_LANG_PROGRAM(
1088171990Srrs	    [[
1089163996Srrs		#ifdef HAVE_ERRNO_H
1090163996Srrs		# include <errno.h>
1091163953Srrs		#endif
1092163953Srrs	    ]],
1093163953Srrs	    [[
1094163953Srrs		errno = 0;
1095163953Srrs	    ]]
1096163953Srrs	)],
1097163953Srrs	[ntp_cv_decl_errno=no],
1098163953Srrs	[ntp_cv_decl_errno=yes]
1099163953Srrs    )]
1100163953Srrs)
1101163953Srrscase "$ntp_cv_decl_errno" in
1102163953Srrs yes)
1103163953Srrs    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1104163953Srrsesac
1105163953Srrs
1106163953Srrsdnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1107163953Srrsdnl MT purposes.  This makes the line "extern int h_errno" choke
1108163953Srrsdnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1109163953Srrsdnl without breaking any other platforms.
1110188854Srrsdnl
1111233660SrrsAC_CACHE_CHECK(
1112163953Srrs    [if we may declare 'h_errno'],
1113163953Srrs    [ntp_cv_decl_h_errno],
1114163953Srrs    [AC_COMPILE_IFELSE(
1115163953Srrs	[AC_LANG_PROGRAM(
1116163953Srrs	    [[
1117163953Srrs		#include <sys/types.h>
1118163953Srrs		#ifdef HAVE_NETINET_IN_H
1119224641Stuexen		# include <netinet/in.h>
1120224641Stuexen		#endif
1121163953Srrs		#ifdef HAVE_ARPA_NAMESER_H
1122163953Srrs		# include <arpa/nameser.h>
1123163953Srrs		#endif
1124163953Srrs		#ifdef HAVE_NETDB_H
1125163953Srrs		# include <netdb.h>
1126163953Srrs		#endif
1127163953Srrs		#ifdef HAVE_RESOLV_H
1128163953Srrs		# include <resolv.h>
1129163953Srrs		#endif
1130163953Srrs	    ]],
1131163953Srrs	    [[
1132163953Srrs		extern int h_errno;
1133163953Srrs	    ]]
1134163953Srrs	)],
1135163953Srrs	[ntp_cv_decl_h_errno=yes],
1136163953Srrs	[ntp_cv_decl_h_errno=no]
1137163953Srrs    )]
1138163953Srrs)
1139163953Srrscase "$ntp_cv_decl_h_errno" in
1140167598Srrs yes)
1141167598Srrs    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1142163953Srrsesac
1143167598Srrs
1144163953SrrsAC_CACHE_CHECK(
1145218186Srrs    [if declaring 'syscall()' is ok],
1146217894Stuexen    [ntp_cv_decl_syscall],
1147218186Srrs    [AC_COMPILE_IFELSE(
1148218186Srrs	[AC_LANG_PROGRAM(
1149163953Srrs	    [[
1150163953Srrs		#ifdef HAVE_SYS_TYPES_H
1151163953Srrs		# include <sys/types.h>
1152163953Srrs		#endif
1153163953Srrs		#ifdef HAVE_UNISTD_H
1154163953Srrs		# include <unistd.h>
1155163953Srrs		#endif
1156163953Srrs	    ]],
1157163953Srrs	    [[
1158163953Srrs		extern int syscall (int, ...);
1159163953Srrs	    ]]
1160224870Stuexen	)]
1161171572Srrs	[ntp_cv_decl_syscall=yes],
1162294140Stuexen	[ntp_cv_decl_syscall=no]
1163163953Srrs    )]
1164163953Srrs)
1165163953Srrscase "$ntp_cv_decl_syscall" in
1166163953Srrs yes)
1167163953Srrs    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1168163953Srrsesac
1169218129Srrs
1170270357Stuexencase "$host" in
1171270356Stuexen *-*-aix4.3.*)
1172270357Stuexen    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1173270362Stuexen    ;;
1174270362Stuexen *-*-mpeix*)
1175270361Stuexen    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1176270359Stuexen    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1177270360Stuexen    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1178163953Srrs    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1179233660Srrs    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1180233660Srrs    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1181233660Srrs    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1182233660Srrs    ;;
1183163953Srrs *-*-osf[[45]]*)
1184185694Srrs    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1185163953Srrs    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1186246595Stuexen    ;;
1187163953Srrs *-*-qnx*)
1188163953Srrs    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1189163953Srrs    ;;
1190163953Srrs *-*-riscos4*)
1191163953Srrs    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1192163953Srrs    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1193163953Srrs    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1194163953Srrs    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1195163953Srrs    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1196163953Srrs    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1197163953Srrs    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1198216188Stuexen    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1199185694Srrs    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1200163953Srrs    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1201171990Srrs    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1202171990Srrs    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1203163953Srrs    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1204163953Srrs    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1205163953Srrs    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1206163953Srrs    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1207166023Srrs    ;;
1208171440Srrs *-*-solaris2*)
1209171440Srrs    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1210219057Srrs    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1211254670Stuexen    case "$host" in
1212283724Stuexen     *-*-solaris2.4)
1213227755Stuexen        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1214163953Srrs	;;
1215163953Srrs    esac
1216163953Srrs    ;;
1217163953Srrs *-*-sunos4*)
1218163953Srrs    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1219163953Srrs    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1220163953Srrs    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1221166675Srrs    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1222166675Srrs    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1223166675Srrs    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1224166675Srrs    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1225166675Srrs    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1226166675Srrs    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1227166675Srrs    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1228166675Srrs    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1229166675Srrs    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1230166675Srrs    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1231270363Stuexen    case "`basename $ac_cv_prog_CC`" in
1232270363Stuexen     acc*) ;;
1233163953Srrs     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1234163953Srrs	;;
1235163953Srrs    esac
1236    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1237    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1238    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1239    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1240    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1241    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1242    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1243    ;;
1244 *-*-ultrix4*)
1245    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1246    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1247    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1248    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1249    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1250    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1251    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1252    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1253    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1254    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1255    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1256    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1257    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1258    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1259    ;;
1260esac
1261
1262case "$host" in
1263 *-*-sco3.2*)
1264    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1265	[Do we need to #define _SVID3 when we #include <termios.h>?])
1266    ;;
1267esac
1268
1269case "$host" in
1270 *-*-hpux[[567]]*)
1271    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1272	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1273esac
1274
1275dnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1276AC_CACHE_CHECK(
1277    [if we will open the broadcast socket],
1278    [ntp_cv_var_open_bcast_socket],
1279    [
1280	ans=yes
1281	case "$host" in
1282	 *-*-domainos)
1283	    ans=no
1284	esac
1285	ntp_cv_var_open_bcast_socket=$ans
1286    ]
1287)
1288case "$ntp_cv_var_open_bcast_socket" in
1289 yes)
1290    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1291	[Should we open the broadcast socket?])
1292esac
1293
1294case "$host" in
1295 *-*-hpux*)
1296    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1297	[Do we want the HPUX FindConfig()?])
1298esac
1299
1300dnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1301AC_CACHE_CHECK(
1302    [if process groups are set with -pid],
1303    [ntp_cv_arg_setpgrp_negpid],
1304    [
1305	case "$host" in
1306	 *-*-hpux[[567]]*)
1307	    ans=no
1308	    ;;
1309	 *-*-hpux*)
1310	    ans=yes
1311	    ;;
1312	 *-*-*linux*)
1313	    ans=yes
1314	    ;;
1315	 *-*-sunos3*)
1316	    ans=yes
1317	    ;;
1318	 *-*-ultrix2*)
1319	    ans=yes
1320	    ;;
1321	 *)
1322	    ans=no
1323	    ;;
1324	esac
1325	ntp_cv_arg_setpgrp_negpid=$ans
1326    ]
1327)
1328case "$ntp_cv_arg_setpgrp_negpid" in
1329 yes)
1330    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1331	[Do we set process groups with -pid?])
1332esac
1333
1334AC_CACHE_CHECK(
1335    [if we need a ctty for F_SETOWN],
1336    [ntp_cv_func_ctty_for_f_setown],
1337    [
1338	case "$host" in
1339	 *-*-bsdi[[23]]*)
1340	    ans=yes
1341	    ;;
1342	 *-*-freebsd*)
1343	    ans=yes
1344	    ;;
1345	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1346	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1347	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1348	# in $host may be followed by "aout", "ecoff", or "elf".
1349	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1350	    ans=yes
1351	    ;;
1352	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1353	    ans=yes
1354	    ;;
1355	 *-*-openbsd*)
1356	    ans=yes
1357	    ;;
1358	 *-*-osf*)
1359	    ans=yes
1360	    ;;
1361	 *-*-darwin*)
1362	    ans=yes
1363	    ;;
1364	 *)
1365	    ans=no
1366	    ;;
1367	esac
1368	ntp_cv_func_ctty_for_f_setown=$ans
1369    ]
1370)
1371case "$ntp_cv_func_ctty_for_f_setown" in
1372 yes)
1373    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1374esac
1375
1376AC_CACHE_CHECK(
1377    [if the OS clears cached routes when more specifics become available],
1378    [ntp_cv_os_routeupdates],
1379    [
1380	case "$host" in
1381	 *-*-netbsd*)
1382	    ans=yes
1383	    ;;
1384	 *)
1385	    ans=no
1386	    ;;
1387	esac
1388	ntp_cv_os_routeupdates=$ans
1389    ]
1390)
1391case "$ntp_cv_os_routeupdates" in
1392 yes)
1393    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1394	[need to recreate sockets on changed routing?])
1395esac
1396
1397AC_CACHE_CHECK(
1398    [if the wildcard socket needs REUSEADDR to bind other addresses],
1399    [ntp_cv_os_wildcardreuse],
1400    [
1401	case "$host" in
1402	 *-*-*linux*)
1403	    ans=yes
1404	    ;;
1405	 *) ans=no
1406	    ;;
1407	esac
1408	ntp_cv_os_wildcardreuse=$ans
1409    ]
1410)
1411case "$ntp_cv_os_wildcardreuse" in
1412 yes)
1413    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1414	[wildcard socket needs REUSEADDR to bind interface addresses])
1415esac
1416
1417case "$host" in
1418 *-*-aix*)
1419    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1420	[Might nlist() values require an extra level of indirection (AIX)?])
1421esac
1422
1423AC_CACHE_CHECK(
1424    [for a minimum recommended value of tickadj],
1425    [ntp_cv_var_min_rec_tickadj],
1426    [
1427	ans=no
1428	case "$host" in
1429	 *-*-aix*)
1430	    ans=40
1431	    ;;
1432	esac
1433	ntp_cv_var_min_rec_tickadj=$ans
1434    ]
1435)
1436case "$ntp_cv_var_min_rec_tickadj" in
1437 ''|no)
1438    ;;
1439 *)
1440    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1441	[Should we recommend a minimum value for tickadj?])
1442esac
1443
1444AC_CACHE_CHECK(
1445    [if the TTY code permits PARENB and IGNPAR],
1446    [ntp_cv_no_parenb_ignpar],
1447    [
1448	ans=no
1449	case "$host" in
1450	 i?86-*-*linux*)
1451	    ans=yes
1452	    ;;
1453	 mips-sgi-irix*)
1454	    ans=yes
1455	    ;;
1456	 i?86-*-freebsd[[123]].*)
1457	    ;;
1458	 i?86-*-freebsd*)
1459	    ans=yes
1460	    ;;
1461	 *-*-unicosmp*)
1462	    ans=yes
1463	    ;;
1464	esac
1465	ntp_cv_no_parenb_ignpar=$ans
1466    ]
1467)
1468case "$ntp_cv_no_parenb_ignpar" in
1469 yes)
1470    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1471	[Is there a problem using PARENB and IGNPAR?])
1472esac
1473
1474AC_MSG_CHECKING([if we're including processing time debugging code])
1475AC_ARG_ENABLE(
1476    [debug-timing],
1477    [AS_HELP_STRING(
1478	[--enable-debug-timing],
1479	[- include processing time debugging code (costs performance)]
1480    )],
1481    [ntp_ok=$enableval],
1482    [ntp_ok=no]
1483)
1484case "$ntp_ok" in
1485 yes)
1486    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1487esac
1488AC_MSG_RESULT([$ntp_ok])
1489
1490AC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1491AC_ARG_ENABLE(
1492    [dst-minutes],
1493    [AS_HELP_STRING(
1494	[--enable-dst-minutes],
1495	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1496    ],
1497    [ans=$enableval],
1498    [ans=60]
1499)
1500AC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1501    [The number of minutes in a DST adjustment])
1502AC_MSG_RESULT([$ans])
1503
1504AC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1505AC_ARG_ENABLE(
1506    [ignore-dns-errors],
1507    [AS_HELP_STRING(
1508	[--enable-ignore-dns-errors],
1509	[- retry DNS queries on any error]
1510    )],
1511    [ans=$enableval],
1512    [ans=no]
1513)
1514case "$ans" in
1515 yes)
1516    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1517	[Retry queries on _any_ DNS error?])
1518esac
1519AC_MSG_RESULT([$ans])
1520
1521AC_CACHE_CHECK(
1522    [availability of ntp_{adj,get}time()],
1523    [ntp_cv_var_ntp_syscalls],
1524    [
1525	ntp_cv_var_ntp_syscalls=no
1526	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1527	 yesyes*)
1528	    ntp_cv_var_ntp_syscalls=libc
1529	    ;;
1530	 *yes)
1531	    ntp_cv_var_ntp_syscalls=inline
1532	    ;;
1533	 *)
1534	    AC_PREPROC_IFELSE(
1535		[AC_LANG_SOURCE(
1536		    [
1537			#include <sys/syscall.h>
1538			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1539			# error
1540			#endif
1541		    ])],
1542		[ntp_cv_var_ntp_syscalls=kernel]
1543	    )
1544	    ;;
1545	 esac
1546    ]
1547)
1548case "$ntp_cv_var_ntp_syscalls" in
1549 libc)
1550    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1551	[Do we have ntp_{adj,get}time in libc?])
1552    ;;
1553 kernel)
1554    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1555	[Do we have ntp_{adj,get}time in the kernel?])
1556    ;;
1557esac
1558
1559AC_CACHE_CHECK(
1560    [if sys/timex.h has STA_FLL],
1561    [ntp_cv_var_sta_fll],
1562    [AC_PREPROC_IFELSE(
1563	[AC_LANG_SOURCE(
1564	    [
1565		#include <sys/timex.h>
1566		#ifndef STA_FLL
1567		# error
1568		#endif
1569	    ])],
1570	[ntp_cv_var_sta_fll=yes],
1571	[ntp_cv_var_sta_fll=no]
1572    )]
1573)
1574
1575AC_CACHE_CHECK(
1576    [if we have kernel PLL support],
1577    [ntp_cv_var_kernel_pll],
1578    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1579	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1580	 *no*)
1581	    ntp_cv_var_kernel_pll=no
1582	    ;;
1583	 *) ntp_cv_var_kernel_pll=yes
1584	    ;;
1585	esac
1586    ]
1587)
1588case "$ntp_cv_var_kernel_pll" in
1589 yes)
1590    AC_DEFINE([KERNEL_PLL], [1],
1591	[Does the kernel support precision time discipline?])
1592esac
1593
1594AC_CACHE_CHECK(
1595    [if SIOCGIFCONF returns buffer size in the buffer],
1596    [ntp_cv_size_returned_in_buffer],
1597    [
1598	ans=no
1599	case "$host" in
1600	 *-fujitsu-uxp*)
1601	    ans=yes
1602	    ;;
1603	 *-ncr-sysv4*)
1604	    ans=yes
1605	    ;;
1606	 *-univel-sysv*)
1607	    ans=yes
1608	    ;;
1609	esac
1610	ntp_cv_size_returned_in_buffer=$ans
1611    ]
1612)
1613case "$ntp_cv_size_returned_in_buffer" in
1614 yes)
1615    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1616	[Does SIOCGIFCONF return size in the buffer?])
1617esac
1618
1619# Check for ioctls TIOCGPPSEV
1620AC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1621case "$ac_cv_header_termios_h" in
1622 yes)
1623    AC_PREPROC_IFELSE(
1624	[AC_LANG_SOURCE([
1625	    #include <termios.h>
1626	    #ifndef TIOCGPPSEV
1627	    # error
1628	    #endif
1629	])],
1630	[ntp_ok=yes],
1631	[ntp_ok=no]
1632    )
1633    ;;
1634 *)
1635    ntp_ok=no
1636    ;;
1637esac
1638case "$ntp_ok" in
1639 yes)
1640    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1641	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1642esac
1643AC_MSG_RESULT([$ntp_ok])
1644
1645# Check for ioctls TIOCSPPS
1646AC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1647case "$ac_cv_header_termios_h" in
1648 yes)
1649    AC_PREPROC_IFELSE(
1650	[AC_LANG_SOURCE([
1651	    #include <termios.h>
1652	    #ifndef TIOCSPPS
1653	    # error
1654	    #endif
1655	 ])],
1656	 [ntp_ok=yes],
1657	 [ntp_ok=no]
1658    )
1659    ;;
1660 *)
1661    ntp_ok=no
1662    ;;
1663esac
1664case "$ntp_ok" in
1665 yes)
1666    AC_DEFINE([HAVE_TIOCSPPS], [1],
1667	[Do we have the TIOCSPPS ioctl (Solaris)?])
1668esac
1669AC_MSG_RESULT([$ntp_ok])
1670
1671# Check for ioctls CIOGETEV
1672AC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1673case "$ac_cv_header_sys_ppsclock_h" in
1674 yes)
1675    AC_PREPROC_IFELSE(
1676	[AC_LANG_SOURCE([
1677	    #include <sys/ppsclock.h>
1678	    #ifndef CIOGETEV
1679	    # error
1680	    #endif
1681	])],
1682	[ntp_ok=yes],
1683	[ntp_ok=no]
1684    )
1685    ;;
1686 *)
1687    ntp_ok=no
1688    ;;
1689esac
1690case "$ntp_ok" in
1691 yes)
1692    AC_DEFINE([HAVE_CIOGETEV], [1],
1693	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1694esac
1695AC_MSG_RESULT([$ntp_ok])
1696
1697# ATOM/PPSAPI stuff.
1698
1699ntp_atom_ok=yes
1700
1701# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1702
1703# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1704# The PPSAPI needs struct timespec.
1705# The PPSAPI also needs a timepps header.
1706
1707case "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1708 inlineyes)
1709    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1710     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1711	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1712	ntp_jupiter_ok=yes
1713	ntp_oncore_ok=yes
1714	ntp_parse_ok=yes
1715	ntp_ripe_ncc_ok=yes
1716	;;
1717    esac
1718    ;;
1719esac
1720
1721# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1722AC_CHECK_HEADER([linux/serial.h])
1723case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1724  yesyes)
1725    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1726    AC_PREPROC_IFELSE(
1727	[AC_LANG_SOURCE([
1728	    #include <sys/time.h>
1729	    typedef int u_int;
1730	    #include <sys/ppsclock.h>
1731	    #include <linux/serial.h>
1732
1733	    #ifndef TIOCGSERIAL
1734	    # error
1735	    #endif
1736	    #ifndef TIOCSSERIAL
1737	    # error
1738	    #endif
1739	    #ifndef ASYNC_PPS_CD_POS
1740	    # error
1741	    #endif
1742	    #ifndef ASYNC_PPS_CD_NEG
1743	    # error
1744	    #endif
1745	    #ifndef CIOGETEV
1746	    # error
1747	    #endif
1748	])],
1749	[ntp_ok=yes],
1750	[ntp_ok=no]
1751    )
1752    AC_MSG_RESULT([$ntp_ok])
1753    ;;
1754  *)
1755    ntp_ok=no
1756    ;;
1757esac
1758case "$ntp_ok" in
1759 yes)
1760    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1761	[Do we have the TIO serial stuff?])
1762esac
1763
1764# Check for SHMEM_STATUS support
1765AC_MSG_CHECKING([SHMEM_STATUS support])
1766case "$ac_cv_header_sys_mman_h" in
1767 yes)
1768    ntp_ok=yes
1769    ;;
1770 *)
1771    ntp_ok=no
1772    ;;
1773esac
1774case "$ntp_ok" in
1775 yes)
1776    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1777	[Do we have support for SHMEM_STATUS?])
1778esac
1779AC_MSG_RESULT([$ntp_ok])
1780
1781ntp_refclock=no
1782
1783# HPUX only, and by explicit request
1784AC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1785AC_ARG_ENABLE(
1786    [BANCOMM],
1787    [AS_HELP_STRING(
1788	[--enable-BANCOMM],
1789	[- Datum/Bancomm bc635/VME interface]
1790    )],
1791    [ntp_ok=$enableval],
1792    [ntp_ok=no]
1793)
1794case "$ntp_ok" in
1795 yes)
1796    ntp_refclock=yes
1797    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1798    ;;
1799esac
1800AC_MSG_RESULT([$ntp_ok])
1801case "$ntp_ok$host" in
1802 yes*-*-hpux*) ;;
1803 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1804esac
1805
1806#HPUX only, and only by explicit request
1807AC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1808AC_ARG_ENABLE(
1809    [GPSVME],
1810    [AS_HELP_STRING(
1811	[--enable-GPSVME],
1812	[- TrueTime GPS receiver/VME interface]
1813    )],
1814    [ntp_ok=$enableval],
1815    [ntp_ok=no]
1816)
1817case "$ntp_ok" in
1818 yes)
1819    ntp_refclock=yes
1820    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
1821    ;;
1822esac
1823AC_MSG_RESULT([$ntp_ok])
1824case "$ntp_ok$host" in
1825 yes*-*-hpux*) ;;
1826 yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1827esac
1828
1829AC_MSG_CHECKING([for PCL720 clock support])
1830case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1831 yesyesyes)
1832    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1833    ans=yes
1834    ;;
1835 *)
1836    ans=no
1837    ;;
1838esac
1839AC_MSG_RESULT([$ans])
1840
1841AC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1842AC_ARG_ENABLE(
1843    [all-clocks],
1844    [AS_HELP_STRING(
1845	[--enable-all-clocks],
1846	[+ include all suitable non-PARSE clocks:]
1847    )],
1848    [ntp_eac=$enableval],
1849    [ntp_eac=yes]
1850)
1851AC_MSG_RESULT([$ntp_eac])
1852
1853# HMS: Should we also require ntp_parse_ok?
1854AC_MSG_CHECKING([if we have support for PARSE clocks])
1855case "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1856 yes*yes*)
1857    ntp_canparse=yes
1858    ;;
1859 *) ntp_canparse=no
1860    ;;
1861esac
1862AC_MSG_RESULT([$ntp_canparse])
1863
1864AC_MSG_CHECKING([if we have support for audio clocks])
1865case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
1866 *yes*)
1867    ntp_canaudio=yes
1868    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1869    ;;
1870 *) ntp_canaudio=no ;;
1871esac
1872AC_MSG_RESULT([$ntp_canaudio])
1873
1874AC_MSG_CHECKING([if we have support for the SHM refclock interface])
1875case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1876 yesyes)
1877    ntp_canshm=yes
1878    ;;
1879 *) ntp_canshm=no ;;
1880esac
1881AC_MSG_RESULT([$ntp_canshm])
1882
1883# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1884AC_CACHE_CHECK(
1885    [for termios modem control],
1886    [ntp_cv_modem_control],
1887    [AC_COMPILE_IFELSE(
1888	[AC_LANG_PROGRAM(
1889	    [[
1890		#ifdef HAVE_UNISTD_H
1891		# include <unistd.h>
1892		#endif
1893		#ifdef HAVE_TERMIOS_H
1894		# include <termios.h>
1895		#endif
1896		#ifdef HAVE_SYS_IOCTL_H
1897		# include <sys/ioctl.h>
1898		#endif
1899	    ]],
1900	    [[
1901		int	dtr = TIOCM_DTR;
1902
1903		ioctl(1, TIOCMBIS, (char *)&dtr);
1904	    ]]
1905	)],
1906	[ntp_cv_modem_control=yes],
1907	[ntp_cv_modem_control=no]
1908    )]
1909)
1910case "$ntp_eac::$ntp_cv_modem_control" in
1911 yes::yes)
1912    ntp_enable_all_modem_control_clocks=yes
1913    ;;
1914 *)
1915    ntp_enable_all_modem_control_clocks=no
1916    ;;
1917esac
1918
1919# Requires modem control
1920AC_MSG_CHECKING([ACTS modem service])
1921AC_ARG_ENABLE(
1922    [ACTS],
1923    [AS_HELP_STRING(
1924	[--enable-ACTS],
1925	[s ACTS modem service]
1926    )],
1927    [ntp_ok=$enableval],
1928    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1929)
1930case "$ntp_ok" in
1931 yes)
1932    ntp_refclock=yes
1933    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
1934    ;;
1935esac
1936AC_MSG_RESULT([$ntp_ok])
1937
1938AC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1939AC_ARG_ENABLE(
1940    [ARBITER],
1941    [AS_HELP_STRING(
1942	[--enable-ARBITER],
1943	[+ Arbiter 1088A/B GPS receiver]
1944    )],
1945    [ntp_ok=$enableval],
1946    [ntp_ok=$ntp_eac]
1947)
1948case "$ntp_ok" in
1949 yes)
1950    ntp_refclock=yes
1951    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
1952    ;;
1953esac
1954AC_MSG_RESULT([$ntp_ok])
1955
1956AC_MSG_CHECKING([Arcron MSF receiver])
1957AC_ARG_ENABLE(
1958    [ARCRON_MSF],
1959    [AS_HELP_STRING(
1960	[--enable-ARCRON-MSF],
1961	[+ Arcron MSF receiver]
1962    )],
1963    [ntp_ok=$enableval],
1964    [ntp_ok=$ntp_eac]
1965)
1966case "$ntp_ok" in
1967 yes)
1968    ntp_refclock=yes
1969    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
1970    ;;
1971esac
1972AC_MSG_RESULT([$ntp_ok])
1973
1974AC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1975AC_ARG_ENABLE(
1976    [AS2201],
1977    [AS_HELP_STRING(
1978	[--enable-AS2201],
1979	[+ Austron 2200A/2201A GPS receiver]
1980    )],
1981    [ntp_ok=$enableval],
1982    [ntp_ok=$ntp_eac]
1983)
1984case "$ntp_ok" in
1985 yes)
1986    ntp_refclock=yes
1987    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
1988    ;;
1989esac
1990AC_MSG_RESULT([$ntp_ok])
1991
1992AC_MSG_CHECKING([ATOM PPS interface])
1993AC_ARG_ENABLE(
1994    [ATOM],
1995    [AS_HELP_STRING(
1996	[--enable-ATOM],
1997	[s ATOM PPS interface]
1998    )],
1999    [ntp_ok=$enableval],
2000    [ntp_ok=$ntp_eac]
2001)
2002case "$ntp_atom_ok" in
2003 no) ntp_ok=no ;;
2004esac
2005case "$ntp_ok" in
2006 yes)
2007    ntp_refclock=yes
2008    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
2009    ;;
2010esac
2011AC_MSG_RESULT([$ntp_ok])
2012
2013AC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
2014AC_ARG_ENABLE(
2015    [CHRONOLOG],
2016    [AS_HELP_STRING(
2017	[--enable-CHRONOLOG],
2018	[+ Chrono-log K-series WWVB receiver]
2019    )],
2020    [ntp_ok=$enableval],
2021    [ntp_ok=$ntp_eac]
2022)
2023case "$ntp_ok" in
2024 yes)
2025    ntp_refclock=yes
2026    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
2027    ;;
2028esac
2029AC_MSG_RESULT([$ntp_ok])
2030
2031AC_MSG_CHECKING([CHU modem/decoder])
2032AC_ARG_ENABLE(
2033    [CHU],
2034    [AS_HELP_STRING(
2035	[--enable-CHU],
2036	[+ CHU modem/decoder]
2037    )],
2038    [ntp_ok=$enableval],
2039    [ntp_ok=$ntp_eac]
2040)
2041case "$ntp_ok" in
2042 yes)
2043    ntp_refclock=yes
2044    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
2045    ;;
2046esac
2047AC_MSG_RESULT([$ntp_ok])
2048ntp_refclock_chu=$ntp_ok
2049
2050AC_MSG_CHECKING([CHU audio/decoder])
2051AC_ARG_ENABLE(
2052    [AUDIO-CHU],
2053    [AS_HELP_STRING(
2054	[--enable-AUDIO-CHU],
2055	[s CHU audio/decoder]
2056    )],
2057    [ntp_ok=$enableval],
2058    [
2059	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2060	 *no*)	ntp_ok=no  ;;
2061	 *)	ntp_ok=yes ;;
2062	esac
2063    ]
2064)
2065AC_MSG_RESULT([$ntp_ok])
2066# We used to check for sunos/solaris target...
2067case "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2068 yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2069esac
2070
2071# Not under HP-UX
2072AC_MSG_CHECKING([Datum Programmable Time System])
2073AC_ARG_ENABLE(
2074    [DATUM],
2075    [AS_HELP_STRING(
2076	[--enable-DATUM],
2077	[s Datum Programmable Time System]
2078    )],
2079    [ntp_ok=$enableval],
2080    [
2081	case "$ac_cv_header_termios_h" in
2082	 yes)
2083	    ntp_ok=$ntp_eac
2084	    ;;
2085	 *) ntp_ok=no
2086	    ;;
2087	esac
2088    ]
2089)
2090case "$ntp_ok" in
2091 yes)
2092    ntp_refclock=yes
2093    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
2094    ;;
2095esac
2096AC_MSG_RESULT([$ntp_ok])
2097
2098AC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2099AC_ARG_ENABLE(
2100    [DUMBCLOCK],
2101    [AS_HELP_STRING(
2102	[--enable-DUMBCLOCK],
2103	[+ Dumb generic hh:mm:ss local clock]
2104    )],
2105    [ntp_ok=$enableval],
2106    [ntp_ok=$ntp_eac]
2107)
2108case "$ntp_ok" in
2109 yes)
2110    ntp_refclock=yes
2111    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
2112    ;;
2113esac
2114AC_MSG_RESULT([$ntp_ok])
2115
2116AC_MSG_CHECKING([Forum Graphic GPS])
2117AC_ARG_ENABLE(
2118    [FG],
2119    [AS_HELP_STRING(
2120	[--enable-FG],
2121	[+ Forum Graphic GPS]
2122    )],
2123    [ntp_ok=$enableval],
2124    [ntp_ok=$ntp_eac]
2125)
2126case "$ntp_ok" in
2127 yes)
2128    ntp_refclock=yes
2129    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
2130    ;;
2131esac
2132AC_MSG_RESULT([$ntp_ok])
2133
2134# Requires modem control
2135AC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2136AC_ARG_ENABLE(
2137    [HEATH],
2138    [AS_HELP_STRING(
2139	[--enable-HEATH],
2140	[s Heath GC-1000 WWV/WWVH receiver]
2141    )],
2142    [ntp_ok=$enableval],
2143    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2144)
2145case "$ntp_ok" in
2146 yes)
2147    ntp_refclock=yes
2148    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
2149    ;;
2150esac
2151AC_MSG_RESULT([$ntp_ok])
2152
2153AC_MSG_CHECKING([for hopf serial clock device])
2154AC_ARG_ENABLE(
2155    [HOPFSERIAL],
2156    [AS_HELP_STRING(
2157	[--enable-HOPFSERIAL],
2158	[+ hopf serial clock device]
2159    )],
2160    [ntp_ok=$enableval],
2161    [ntp_ok=$ntp_eac]
2162)
2163case "$ntp_ok" in
2164 yes)
2165    ntp_refclock=yes
2166    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
2167    ;;
2168esac
2169AC_MSG_RESULT([$ntp_ok])
2170
2171AC_MSG_CHECKING([for hopf PCI clock 6039])
2172AC_ARG_ENABLE(
2173    [HOPFPCI],
2174    [AS_HELP_STRING(
2175	[--enable-HOPFPCI],
2176	[+ hopf 6039 PCI board]
2177    )],
2178    [ntp_ok=$enableval],
2179    [ntp_ok=$ntp_eac]
2180)
2181case "$ntp_ok" in
2182 yes)
2183    ntp_refclock=yes
2184    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
2185    ;;
2186esac
2187AC_MSG_RESULT([$ntp_ok])
2188
2189AC_MSG_CHECKING([HP 58503A GPS receiver])
2190AC_ARG_ENABLE(
2191    [HPGPS],
2192    [AS_HELP_STRING(
2193	[--enable-HPGPS],
2194	[+ HP 58503A GPS receiver]
2195    )],
2196    [ntp_ok=$enableval],
2197    [ntp_ok=$ntp_eac]
2198)
2199case "$ntp_ok" in
2200 yes)
2201    ntp_refclock=yes
2202    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
2203    ;;
2204esac
2205AC_MSG_RESULT([$ntp_ok])
2206
2207AC_MSG_CHECKING([IRIG audio decoder])
2208AC_ARG_ENABLE(
2209    [IRIG],
2210    [AS_HELP_STRING(
2211	[--enable-IRIG],
2212	[s IRIG audio decoder]
2213    )],
2214    [ntp_ok=$enableval],
2215    [
2216	case "$ntp_eac$ntp_canaudio" in
2217	 *no*)	ntp_ok=no  ;;
2218	 *)	ntp_ok=yes ;;
2219	esac
2220    ]
2221)
2222case "$ntp_ok" in
2223 yes)
2224    ntp_refclock=yes
2225    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
2226    ;;
2227esac
2228AC_MSG_RESULT([$ntp_ok])
2229case "$ntp_ok$ntp_canaudio" in
2230 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2231esac
2232
2233AC_MSG_CHECKING([for JJY receiver])
2234AC_ARG_ENABLE(
2235    [JJY],
2236    [AS_HELP_STRING(
2237	[--enable-JJY],
2238	[+ JJY receiver]
2239    )],
2240    [ntp_ok=$enableval],
2241    [ntp_ok=$ntp_eac]
2242)
2243case "$ntp_ok" in
2244 yes)
2245    ntp_refclock=yes
2246    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
2247    ;;
2248esac
2249AC_MSG_RESULT([$ntp_ok])
2250
2251AC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2252AC_ARG_ENABLE(
2253    [JUPITER],
2254    [AS_HELP_STRING(
2255	[--enable-JUPITER],
2256	[s Rockwell Jupiter GPS receiver]
2257    )],
2258    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2259case "$ntp_jupiter_ok" in
2260 no) ntp_ok=no ;;
2261esac
2262case "$ntp_ok" in
2263 yes)
2264    ntp_refclock=yes
2265    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
2266    ;;
2267esac
2268AC_MSG_RESULT([$ntp_ok])
2269
2270AC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2271AC_ARG_ENABLE(
2272    [LEITCH],
2273    [AS_HELP_STRING(
2274	[--enable-LEITCH],
2275	[+ Leitch CSD 5300 Master Clock System Driver]
2276    )],
2277    [ntp_ok=$enableval],
2278    [ntp_ok=$ntp_eac]
2279)
2280case "$ntp_ok" in
2281 yes)
2282    ntp_refclock=yes
2283    AC_DEFINE([CLOCK_LEITCH], [1],
2284	[Leitch CSD 5300 Master Clock System Driver?])
2285    ;;
2286esac
2287AC_MSG_RESULT([$ntp_ok])
2288
2289AC_MSG_CHECKING([local clock reference])
2290AC_ARG_ENABLE(
2291    [LOCAL-CLOCK],
2292    [AS_HELP_STRING(
2293	[--enable-LOCAL-CLOCK],
2294	[+ local clock reference]
2295    )],
2296    [ntp_ok=$enableval],
2297    [ntp_ok=$ntp_eac]
2298)
2299case "$ntp_ok" in
2300 yes)
2301    ntp_refclock=yes
2302    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
2303    ;;
2304esac
2305AC_MSG_RESULT([$ntp_ok])
2306
2307dnl Bug 340: longstanding unfixed bugs
2308dnl AC_MSG_CHECKING([EES M201 MSF receiver])
2309dnl AC_ARG_ENABLE([MSFEES],
2310dnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2311dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2312dnl if test "$ntp_ok" = "yes"; then
2313dnl     ntp_refclock=yes
2314dnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2315dnl fi
2316dnl AC_MSG_RESULT([$ntp_ok])
2317
2318# Not Ultrix
2319AC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2320AC_ARG_ENABLE(
2321    [MX4200],
2322    [AS_HELP_STRING(
2323	[--enable-MX4200 ],
2324	[s Magnavox MX4200 GPS receiver]
2325    )],
2326    [ntp_ok=$enableval],
2327    [
2328	case "$ac_cv_var_ppsclock" in
2329	 yes)
2330	    ntp_ok=$ntp_eac
2331	    ;;
2332	 *)
2333	    ntp_ok=no
2334	    ;;
2335	esac
2336    ]
2337)
2338case "$ntp_ok" in
2339 yes)
2340    ntp_refclock=yes
2341    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
2342    ;;
2343esac
2344AC_MSG_RESULT([$ntp_ok])
2345case "$ntp_ok$host" in
2346 yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2347esac
2348
2349AC_MSG_CHECKING([for NeoClock4X receiver])
2350AC_ARG_ENABLE(
2351    [NEOCLOCK4X],
2352    [AS_HELP_STRING(
2353	[--enable-NEOCLOCK4X],
2354	[+ NeoClock4X DCF77 / TDF receiver]
2355    )],
2356    [ntp_ok=$enableval],
2357    [ntp_ok=$ntp_eac]
2358)
2359case "$ntp_ok" in
2360 yes)
2361    ntp_refclock=yes
2362    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
2363    ;;
2364esac
2365AC_MSG_RESULT([$ntp_ok])
2366
2367AC_MSG_CHECKING([NMEA GPS receiver])
2368AC_ARG_ENABLE(
2369    [NMEA],
2370    [AS_HELP_STRING(
2371	[--enable-NMEA],
2372	[+ NMEA GPS receiver]
2373    )],
2374    [ntp_ok=$enableval],
2375    [ntp_ok=$ntp_eac]
2376)
2377case "$ntp_ok" in
2378 yes)
2379    ntp_refclock=yes
2380    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
2381    ;;
2382esac
2383AC_MSG_RESULT([$ntp_ok])
2384
2385AC_CHECK_FUNCS([strtoll])
2386AC_MSG_CHECKING([for GPSD JSON receiver])
2387AC_ARG_ENABLE(
2388    [GPSD],
2389    [AS_HELP_STRING(
2390	[--enable-GPSD],
2391	[+ GPSD JSON receiver]
2392    )],
2393    [ntp_ok=$enableval],
2394    [case "$ac_cv_func_strtoll" in
2395     yes) ntp_ok=$ntp_eac ;;
2396     *)   ntp_ok="no" ;;
2397    esac]
2398)
2399case "$ntp_ok" in
2400 yes)
2401    ntp_refclock=yes
2402    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2403    ;;
2404esac
2405AC_MSG_RESULT([$ntp_ok])
2406
2407AC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2408AC_ARG_ENABLE(
2409    [ONCORE],
2410    [AS_HELP_STRING(
2411	[--enable-ONCORE],
2412	[s Motorola VP/UT Oncore GPS receiver]
2413    )],
2414    [ntp_ok=$enableval],
2415    [ntp_ok=$ntp_eac]
2416)
2417case "$ntp_oncore_ok" in
2418 no) ntp_ok=no ;;
2419esac
2420case "$ntp_ok" in
2421 yes)
2422    ntp_refclock=yes
2423    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
2424    ;;
2425esac
2426AC_MSG_RESULT([$ntp_ok])
2427
2428# Requires modem control
2429AC_MSG_CHECKING([for Palisade clock])
2430AC_ARG_ENABLE(
2431    [PALISADE],
2432    [AS_HELP_STRING(
2433	[--enable-PALISADE],
2434	[s Palisade clock]
2435    )],
2436    [ntp_ok=$enableval],
2437    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2438)
2439case "$ntp_ok" in
2440 yes)
2441    ntp_refclock=yes
2442    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
2443    ;;
2444esac
2445AC_MSG_RESULT([$ntp_ok])
2446
2447AC_MSG_CHECKING([Conrad parallel port radio clock])
2448AC_ARG_ENABLE(
2449    [PCF],
2450    [AS_HELP_STRING(
2451	[--enable-PCF ],
2452	[+ Conrad parallel port radio clock]
2453    )],
2454    [ntp_ok=$enableval],
2455    [ntp_ok=$ntp_eac]
2456)
2457case "$ntp_ok" in
2458 yes)
2459    ntp_refclock=yes
2460    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
2461    ;;
2462esac
2463AC_MSG_RESULT([$ntp_ok])
2464
2465AC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2466AC_ARG_ENABLE(
2467    [PST],
2468    [AS_HELP_STRING(
2469	[--enable-PST],
2470	[+ PST/Traconex 1020 WWV/WWVH receiver]
2471    )],
2472    [ntp_ok=$enableval],
2473    [ntp_ok=$ntp_eac]
2474)
2475case "$ntp_ok" in
2476 yes)
2477    ntp_refclock=yes
2478    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
2479    ;;
2480esac
2481AC_MSG_RESULT([$ntp_ok])
2482
2483AC_MSG_CHECKING([RIPENCC specific Trimble driver])
2484AC_ARG_ENABLE(
2485    [RIPENCC],
2486    [AS_HELP_STRING(
2487	[--enable-RIPENCC],
2488	[- RIPENCC specific Trimble driver]
2489    )],
2490    [ntp_ok=$enableval],
2491    [ntp_ok=no]
2492)
2493# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2494case "$ntp_ripe_ncc_ok" in
2495 no) ntp_ok=no ;;
2496esac
2497case "$ntp_ok" in
2498 yes)
2499    ntp_refclock=yes
2500    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
2501    ;;
2502esac
2503AC_MSG_RESULT([$ntp_ok])
2504
2505# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2506# For *IX, we need sys/ipc.h and sys/shm.h.
2507AC_MSG_CHECKING([for SHM clock attached thru shared memory])
2508AC_ARG_ENABLE(
2509    [SHM],
2510    [AS_HELP_STRING(
2511	[--enable-SHM],
2512	[s SHM clock attached thru shared memory]
2513    )],
2514    [ntp_ok=$enableval],
2515    [
2516	case "$ntp_eac$ntp_canshm" in
2517	 *no*)	ntp_ok=no  ;;
2518	 *)	ntp_ok=yes ;;
2519	esac
2520    ]
2521)
2522case "$ntp_ok" in
2523 yes)
2524    ntp_refclock=yes
2525    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
2526    ;;
2527esac
2528AC_MSG_RESULT([$ntp_ok])
2529
2530AC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2531AC_ARG_ENABLE(
2532    [SPECTRACOM],
2533    [AS_HELP_STRING(
2534	[--enable-SPECTRACOM],
2535	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2536    )],
2537    [ntp_ok=$enableval],
2538    [ntp_ok=$ntp_eac]
2539)
2540case "$ntp_ok" in
2541 yes)
2542    ntp_refclock=yes
2543    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2544	[Spectracom 8170/Netclock/2 WWVB receiver])
2545    ;;
2546esac
2547AC_MSG_RESULT([$ntp_ok])
2548
2549AC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2550AC_ARG_ENABLE(
2551    [TPRO],
2552    [AS_HELP_STRING(
2553	[--enable-TPRO],
2554	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2555    )],
2556    [ntp_ok=$enableval],
2557    [
2558	case "$ac_cv_header_sys_tpro_h" in
2559	 yes)
2560	    ntp_ok=$ntp_eac
2561	    ;;
2562	 *)
2563	    ntp_ok=no
2564	    ;;
2565	esac
2566    ]
2567)
2568case "$ntp_ok" in
2569 yes)
2570    ntp_refclock=yes
2571    AC_DEFINE([CLOCK_TPRO], [1],
2572	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2573    ;;
2574esac
2575AC_MSG_RESULT([$ntp_ok])
2576case "$ntp_ok$ac_cv_header_sys_tpro" in
2577 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2578esac
2579
2580# Not on a vax-dec-bsd
2581AC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2582AC_ARG_ENABLE(
2583    [TRUETIME],
2584    [AS_HELP_STRING(
2585	[--enable-TRUETIME],
2586	[s Kinemetrics/TrueTime receivers]
2587    )],
2588    [ntp_ok=$enableval],
2589    [
2590	case "$host" in
2591	 vax-dec-bsd)
2592	    ntp_ok=no
2593	    ;;
2594	 *)
2595	    ntp_ok=$ntp_eac
2596	    ;;
2597	esac
2598    ]
2599)    
2600case "$ntp_ok" in
2601 yes)
2602    ntp_refclock=yes
2603    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
2604    ;;
2605esac
2606AC_MSG_RESULT([$ntp_ok])
2607case "$ntp_ok$host" in
2608 yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2609esac
2610
2611AC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2612AC_ARG_ENABLE(
2613    [TT560],
2614    [AS_HELP_STRING(
2615	[--enable-TT560],
2616	[- TrueTime 560 IRIG-B decoder]
2617    )],
2618    [ntp_ok=$enableval],
2619    [ntp_ok=no]
2620)
2621case "$ntp_ok" in
2622 yes)
2623    ntp_refclock=yes
2624    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
2625    ;;
2626esac
2627AC_MSG_RESULT([$ntp_ok])
2628
2629AC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2630AC_ARG_ENABLE(
2631    [ULINK],
2632    [AS_HELP_STRING(
2633	[--enable-ULINK],
2634	[+ Ultralink WWVB receiver]
2635    )],
2636    [ntp_ok=$enableval],
2637    [ntp_ok=$ntp_eac]
2638)
2639case "$ntp_ok" in
2640 yes)
2641    ntp_refclock=yes
2642    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
2643    ;;
2644esac
2645AC_MSG_RESULT([$ntp_ok])
2646
2647AC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
2648AC_ARG_ENABLE(
2649    [TSYNCPCI],
2650    [AS_HELP_STRING(
2651	[--enable-TSYNCPCI],
2652	[s Spectracom TSYNC timing board]
2653    )],
2654    [ntp_ok=$enableval],
2655    [
2656	case "$host" in
2657	 *-*-*linux*)
2658	    ntp_ok=$ntp_eac
2659	    ;;
2660	 *)
2661	    ntp_ok=no
2662	esac
2663    ]
2664)
2665case "$ntp_ok" in
2666 yes)
2667    ntp_refclock=yes
2668    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
2669    ;;
2670esac
2671AC_MSG_RESULT([$ntp_ok])
2672
2673AC_MSG_CHECKING([WWV receiver])
2674AC_ARG_ENABLE(
2675    [WWV],
2676    [AS_HELP_STRING(
2677	[--enable-WWV],
2678	[s WWV Audio receiver]
2679    )],
2680    [ntp_ok=$enableval],
2681    [
2682	case "$ntp_eac$ntp_canaudio" in
2683	 *no*)	ntp_ok=no  ;;
2684	 *)	ntp_ok=yes ;;
2685	esac
2686    ]
2687)
2688case "$ntp_ok" in
2689 yes)
2690    ntp_refclock=yes
2691    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
2692    ;;
2693esac
2694AC_MSG_RESULT([$ntp_ok])
2695case "$ntp_ok$ntp_canaudio" in
2696 yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2697esac
2698
2699AC_MSG_CHECKING([for Zyfer receiver])
2700AC_ARG_ENABLE(
2701    [ZYFER],
2702    [AS_HELP_STRING(
2703	[--enable-ZYFER],
2704	[+ Zyfer GPStarplus receiver]
2705    )],
2706    [ntp_ok=$enableval],
2707    [ntp_ok=$ntp_eac]
2708)
2709case "$ntp_ok" in
2710 yes)
2711    ntp_refclock=yes
2712    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
2713    ;;
2714esac
2715AC_MSG_RESULT([$ntp_ok])
2716
2717AC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2718AC_ARG_ENABLE(
2719    [parse-clocks],
2720    [AS_HELP_STRING(
2721	[--enable-parse-clocks],
2722	[- include all suitable PARSE clocks:]
2723    )],
2724    [ntp_eapc=$enableval],
2725    [
2726	case "$ntp_eac" in
2727	 yes)	ntp_eapc=$ntp_canparse ;;
2728	 *)	ntp_eapc=no ;;
2729	esac
2730	# Delete the next line one of these days
2731	ntp_eapc=no
2732    ]
2733)
2734AC_MSG_RESULT($ntp_eapc)
2735
2736case "$ntp_eac$ntp_eapc$ntp_canparse" in
2737 noyes*)
2738    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2739    ;;
2740 yesyesno)
2741    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2742    ;;
2743esac
2744
2745ntp_libparse=no
2746ntp_parseutil=no
2747ntp_rawdcf=no
2748
2749AC_MSG_CHECKING([Diem Computime Radio Clock])
2750AC_ARG_ENABLE(
2751    [COMPUTIME],
2752    [AS_HELP_STRING(
2753	[--enable-COMPUTIME],
2754	[s Diem Computime Radio Clock]
2755    )],
2756    [ntp_ok=$enableval],
2757    [ntp_ok=$ntp_eapc]
2758)
2759case "$ntp_ok" in
2760 yes)
2761    ntp_libparse=yes
2762    ntp_refclock=yes
2763    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
2764    ;;
2765esac
2766AC_MSG_RESULT([$ntp_ok])
2767case "$ntp_ok$ntp_canparse" in
2768 yesno)
2769    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2770esac
2771
2772AC_MSG_CHECKING([ELV/DCF7000 clock])
2773AC_ARG_ENABLE(
2774    [DCF7000],
2775    [AS_HELP_STRING(
2776	[--enable-DCF7000],
2777	[s ELV/DCF7000 clock]
2778    )],
2779    [ntp_ok=$enableval],
2780    [ntp_ok=$ntp_eapc]
2781)
2782case "$ntp_ok" in
2783 yes)
2784    ntp_libparse=yes
2785    ntp_refclock=yes
2786    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
2787    ;;
2788esac
2789AC_MSG_RESULT([$ntp_ok])
2790case "$ntp_ok$ntp_canparse" in
2791 yesno)
2792    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2793esac
2794
2795AC_MSG_CHECKING([HOPF 6021 clock])
2796AC_ARG_ENABLE(
2797    [HOPF6021],
2798    [AS_HELP_STRING(
2799	[--enable-HOPF6021],
2800	[s HOPF 6021 clock]
2801    )],
2802    [ntp_ok=$enableval],
2803    [ntp_ok=$ntp_eapc]
2804)
2805case "$ntp_ok" in
2806 yes)
2807    ntp_libparse=yes
2808    ntp_refclock=yes
2809    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
2810    ;;
2811esac
2812AC_MSG_RESULT([$ntp_ok])
2813case "$ntp_ok$ntp_canparse" in
2814 yesno)
2815    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2816esac
2817
2818AC_MSG_CHECKING([Meinberg clocks])
2819AC_ARG_ENABLE(
2820    [MEINBERG],
2821    [AS_HELP_STRING(
2822	[--enable-MEINBERG],
2823	[s Meinberg clocks]
2824    )],
2825    [ntp_ok=$enableval],
2826    [ntp_ok=$ntp_eapc]
2827)
2828case "$ntp_ok" in
2829 yes)
2830    ntp_libparse=yes
2831    ntp_refclock=yes
2832    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
2833    ;;
2834esac
2835AC_MSG_RESULT([$ntp_ok])
2836case "$ntp_ok$ntp_canparse" in
2837 yesno)
2838    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2839esac
2840
2841AC_MSG_CHECKING([DCF77 raw time code])
2842AC_ARG_ENABLE(
2843    [RAWDCF],
2844    [AS_HELP_STRING(
2845	[--enable-RAWDCF],
2846	[s DCF77 raw time code]
2847    )],
2848    [ntp_ok=$enableval],
2849    [ntp_ok=$ntp_eapc]
2850)
2851case "$ntp_ok" in
2852 yes)
2853    ntp_libparse=yes
2854    ntp_parseutil=yes
2855    ntp_refclock=yes
2856    ntp_rawdcf=yes
2857    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
2858    ;;
2859esac
2860AC_MSG_RESULT([$ntp_ok])
2861case "$ntp_ok$ntp_canparse" in
2862 yesno)
2863    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2864esac
2865
2866case "$ntp_rawdcf" in
2867 yes)
2868    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2869	[ntp_cv_rawdcf_parity],
2870	[
2871	    ans=no
2872	    case "$host" in
2873	     *-*-*linux*)
2874		ans=yes
2875		;;
2876	    esac
2877	    ntp_cv_rawdcf_parity=$ans
2878	]
2879    )
2880    case "$ntp_cv_rawdcf_parity" in
2881     yes)
2882	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2883	    [Should we not IGNPAR (Linux)?]) ;;
2884    esac
2885esac
2886
2887AC_MSG_CHECKING([RCC 8000 clock])
2888AC_ARG_ENABLE(
2889    [RCC8000],
2890    [AS_HELP_STRING(
2891	[--enable-RCC8000],
2892	[s RCC 8000 clock]
2893    )],
2894    [ntp_ok=$enableval],
2895    [ntp_ok=$ntp_eapc]
2896)
2897case "$ntp_ok" in
2898 yes)
2899    ntp_libparse=yes
2900    ntp_refclock=yes
2901    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
2902    ;;
2903esac
2904AC_MSG_RESULT([$ntp_ok])
2905case "$ntp_ok$ntp_canparse" in
2906 yesno)
2907    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2908esac
2909
2910AC_MSG_CHECKING([Schmid DCF77 clock])
2911AC_ARG_ENABLE(
2912    [SCHMID],
2913    [AS_HELP_STRING(
2914	[--enable-SCHMID ],
2915	[s Schmid DCF77 clock]
2916    )],
2917    [ntp_ok=$enableval],
2918    [ntp_ok=$ntp_eapc]
2919)
2920case "$ntp_ok" in
2921 yes)
2922    ntp_libparse=yes
2923    ntp_refclock=yes
2924    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
2925    ;;
2926esac
2927AC_MSG_RESULT([$ntp_ok])
2928case "$ntp_ok$ntp_canparse" in
2929 yesno)
2930    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2931esac
2932
2933AC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2934AC_ARG_ENABLE(
2935    [TRIMTAIP],
2936    [AS_HELP_STRING(
2937	[--enable-TRIMTAIP],
2938	[s Trimble GPS receiver/TAIP protocol]
2939    )],
2940    [ntp_ok=$enableval],
2941    [ntp_ok=$ntp_eapc]
2942)
2943case "$ntp_ok" in
2944 yes)
2945    ntp_libparse=yes
2946    ntp_refclock=yes
2947    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2948	[Trimble GPS receiver/TAIP protocol])
2949    ;;
2950esac
2951AC_MSG_RESULT([$ntp_ok])
2952case "$ntp_ok$ntp_canparse" in
2953 yesno)
2954    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2955esac
2956
2957AC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2958AC_ARG_ENABLE(
2959    [TRIMTSIP],
2960    [AS_HELP_STRING(
2961	[--enable-TRIMTSIP],
2962	[s Trimble GPS receiver/TSIP protocol]
2963    )],
2964    [ntp_ok=$enableval],
2965    [ntp_ok=$ntp_eapc]
2966)
2967case "$ntp_ok" in
2968 yes)
2969    ntp_libparse=yes
2970    ntp_refclock=yes
2971    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2972	[Trimble GPS receiver/TSIP protocol])
2973    ;;
2974esac
2975AC_MSG_RESULT([$ntp_ok])
2976case "$ntp_ok$ntp_canparse" in
2977 yesno)
2978    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2979esac
2980
2981AC_MSG_CHECKING([WHARTON 400A Series clock])
2982AC_ARG_ENABLE(
2983    [WHARTON],
2984    [AS_HELP_STRING(
2985	[--enable-WHARTON],
2986	[s WHARTON 400A Series clock]
2987    )],
2988    [ntp_ok=$enableval],
2989    [ntp_ok=$ntp_eapc]
2990)
2991case "$ntp_ok" in
2992 yes)
2993    ntp_libparse=yes
2994    ntp_refclock=yes
2995    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
2996    ;;
2997esac
2998AC_MSG_RESULT([$ntp_ok])
2999case "$ntp_ok$ntp_canparse" in
3000 yesno)
3001    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3002esac
3003
3004AC_MSG_CHECKING([VARITEXT clock])
3005AC_ARG_ENABLE(
3006    [VARITEXT],
3007    [AS_HELP_STRING(
3008	[--enable-VARITEXT],
3009	[s VARITEXT clock]
3010    )],
3011    [ntp_ok=$enableval],
3012    [ntp_ok=$ntp_eapc]
3013)
3014case "$ntp_ok" in
3015 yes)
3016    ntp_libparse=yes
3017    ntp_refclock=yes
3018    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
3019    ;;
3020esac
3021AC_MSG_RESULT([$ntp_ok])
3022case "$ntp_ok$ntp_canparse" in
3023 yesno)
3024    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3025esac
3026
3027AC_MSG_CHECKING(SEL240X clock)
3028AC_ARG_ENABLE(SEL240X,
3029    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
3030    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3031if test "$ntp_ok" = "yes"; then
3032    ntp_libparse=yes
3033    ntp_refclock=yes
3034    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
3035fi
3036AC_MSG_RESULT($ntp_ok)
3037case "$ntp_ok$ntp_canparse" in
3038 yesno)
3039    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3040    ;;
3041esac
3042
3043AC_SUBST([LIBPARSE])
3044AC_SUBST([MAKE_LIBPARSE])
3045AC_SUBST([MAKE_LIBPARSE_KERNEL])
3046AC_SUBST([MAKE_CHECK_Y2K])
3047
3048AC_MSG_CHECKING([if we need to make and use the parse libraries])
3049ans=no
3050case "$ntp_libparse" in
3051 yes)
3052    ans=yes
3053    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3054    LIBPARSE=../libparse/libparse.a
3055    MAKE_LIBPARSE=libparse.a
3056    # HMS: check_y2k trips the 34 year problem now...
3057    false && MAKE_CHECK_Y2K=check_y2k
3058esac
3059AC_MSG_RESULT([$ans])
3060
3061NTP_OPENSSL
3062
3063NTP_CRYPTO_RAND
3064
3065# if we are using OpenSSL (--with-crypto), by default Autokey is enabled
3066AC_MSG_CHECKING([if we want to include NTP Autokey protocol support])
3067AC_ARG_ENABLE(
3068    [autokey],
3069    AS_HELP_STRING(
3070	[--enable-autokey],
3071	[+ support NTP Autokey protocol]
3072	),
3073    [ntp_autokey=$enableval],
3074    [ntp_autokey=$ntp_openssl]
3075)
3076case "$ntp_autokey" in
3077 no)
3078    ;;
3079 *)
3080    case "$ntp_openssl" in
3081     no)
3082	AC_MSG_WARN([Disabling Autokey, --enable-autokey requires --with-crypto.])
3083	ntp_autokey=no
3084	;;
3085     *)
3086	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
3087	ntp_autokey=yes
3088	;;
3089    esac
3090    ;;
3091esac
3092AC_MSG_RESULT([$ntp_autokey])
3093
3094AC_SUBST([MAKE_CHECK_LAYOUT])
3095AC_MSG_CHECKING([if we want to run check-layout])
3096case "$cross_compiling$PATH_PERL" in
3097 no/*)
3098    MAKE_CHECK_LAYOUT=check-layout
3099    ans=yes
3100    ;;
3101 *)
3102    ans=no
3103    ;;
3104esac
3105AC_MSG_RESULT([$ans])
3106
3107AC_SUBST([TESTDCF])
3108AC_SUBST([DCFD])
3109AC_MSG_CHECKING([if we can make dcf parse utilities])
3110ans=no
3111case "$ntp_parseutil" in
3112 yes)
3113    case "$host" in
3114     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3115	ans="dcfd testdcf"
3116	DCFD=dcfd
3117	TESTDCF=testdcf
3118    esac
3119    ;;
3120esac
3121AC_MSG_RESULT([$ans])
3122
3123AC_SUBST([MAKE_PARSEKMODULE])
3124AC_MSG_CHECKING([if we can build kernel streams modules for parse])
3125ans=no
3126case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3127 yesyes)
3128    case "$host" in
3129     sparc-*-sunos4*)
3130        case "$ntp_cv_var_kernel_pll" in
3131	yes)
3132	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3133	    ;;
3134	esac
3135	ans=parsestreams
3136	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3137	;;
3138     sparc-*-solaris2*)
3139	ans=parsesolaris
3140	MAKE_PARSEKMODULE=parse
3141	AC_CHECK_HEADERS([strings.h])
3142	;;
3143    esac
3144    ;;
3145esac
3146AC_MSG_RESULT([$ans])
3147
3148AC_MSG_CHECKING([if we need basic refclock support])
3149case "$ntp_refclock" in
3150 yes)
3151    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
3152    ;;
3153esac
3154AC_MSG_RESULT($ntp_refclock)
3155
3156dnl Things that can be made in clockstuff
3157AC_SUBST([PROPDELAY], [propdelay])
3158AC_SUBST([CHUTEST]) dnl needs work to compile
3159
3160AC_SUBST([MAKE_ADJTIMED])
3161AC_MSG_CHECKING([if we want HP-UX adjtimed support])
3162case "$host" in
3163 *-*-hpux[[56789]]*)
3164    ans=yes
3165    ;;
3166 *) ans=no
3167    ;;
3168esac
3169case "$ans" in
3170 yes)
3171    MAKE_ADJTIMED=adjtimed
3172    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3173	[Do we need HPUX adjtime() library support?])
3174    ;;
3175 *) ADJTIMED_DB=
3176    ADJTIMED_DL=
3177    ADJTIMED_DS=
3178    ADJTIMED_MS=
3179    ;;
3180esac
3181AC_MSG_RESULT([$ans])
3182
3183AC_MSG_CHECKING([if we want QNX adjtime support])
3184case "$host" in
3185 *-*-qnx*)
3186    ans=yes
3187    ;;
3188 *) ans=no
3189    ;;
3190esac
3191case "$ans" in
3192 yes)
3193    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3194	[Do we need the qnx adjtime call?])
3195    ;;
3196esac
3197AC_MSG_RESULT([$ans])
3198
3199AC_MSG_CHECKING([if we can read kmem])
3200
3201#  the default is to enable it if the system has the capability
3202
3203case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3204 *yes*)
3205    ans=yes
3206    ;;
3207 *) ans=no
3208    ;;
3209esac
3210
3211case "$host" in
3212 *-*-domainos)	# Won't be found...
3213    ans=no
3214    ;;
3215 *-*-hpux*)
3216    #ans=no
3217    ;;
3218 *-*-irix[[456]]*)
3219    ans=no
3220    ;;
3221 *-*-*linux*)
3222    ans=no
3223    ;;
3224 *-*-winnt3.5)
3225    ans=no
3226    ;;
3227 *-*-unicosmp*)
3228    ans=no
3229    ;;
3230esac
3231
3232# --enable-kmem / --disable-kmem controls if present
3233AC_ARG_ENABLE(
3234    [kmem],
3235    [AS_HELP_STRING(
3236	[--enable-kmem],
3237	[s read /dev/kmem for tick and/or tickadj]
3238    )],
3239    [ans=$enableval]
3240)
3241
3242AC_MSG_RESULT([$ans])
3243
3244case "$ans" in
3245 yes)
3246    can_kmem=yes
3247    ;;
3248 *)
3249    can_kmem=no
3250    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3251esac
3252
3253
3254AC_MSG_CHECKING([if adjtime is accurate])
3255
3256# target-dependent defaults
3257
3258case "$host" in
3259 i386-sequent-ptx*)
3260    ans=no
3261    ;;
3262 i386-unknown-osf1*)
3263    ans=yes
3264    ;;
3265 mips-sgi-irix[[456]]*)
3266    ans=yes
3267    ;;
3268 *-fujitsu-uxp*)
3269    ans=yes
3270    ;;
3271 *-ibm-aix[[4-9]]*)
3272    # XXX only verified thru AIX6.
3273    ans=yes
3274    ;;
3275 *-*-*linux*)
3276    ans=yes
3277    ;;
3278 *-*-solaris2.[[01]])
3279    ans=no
3280    ;;
3281 *-*-solaris2*)
3282    ans=yes
3283    ;;
3284 *-*-unicosmp*)
3285    ans=yes
3286    ;;
3287 *) ans=no
3288    ;;
3289esac
3290
3291# --enable-accurate-adjtime / --disable-accurate-adjtime
3292# override the default
3293AC_ARG_ENABLE(
3294    [accurate-adjtime],
3295    [AS_HELP_STRING(
3296	[--enable-accurate-adjtime],
3297	[s the adjtime() call is accurate]
3298    )],
3299    [ans=$enableval]
3300)
3301
3302AC_MSG_RESULT([$ans])
3303
3304case "$ans" in
3305 yes)
3306    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3307    adjtime_is_accurate=yes
3308    ;;
3309 *)
3310    adjtime_is_accurate=no
3311    ;;
3312esac
3313
3314AC_CACHE_CHECK(
3315    [the name of 'tick' in the kernel],
3316    [ntp_cv_nlist_tick],
3317    [
3318	ans=_tick
3319	case "$host" in
3320	 m68*-hp-hpux*) # HP9000/300?
3321	    ans=_old_tick
3322	    ;;
3323	 *-apple-aux[[23]]*)
3324	    ans=tick
3325	    ;;
3326	 *-hp-hpux*)
3327	    ans=old_tick
3328	    ;;
3329	 *-ibm-aix[[3-9]]*)
3330	    # XXX only verified thru AIX6.
3331	    ans=no
3332	    ;;
3333	 *-*-mpeix*)
3334	    ans=no
3335	    ;;
3336	 *-*-ptx*)
3337	    ans=tick
3338	    ;;
3339	 *-*-sco3.2v[[45]]*)
3340	    ans=no
3341	    ;;
3342	 *-*-solaris2*)
3343	    ans=nsec_per_tick
3344	    ;;
3345	 *-*-sysv4*)
3346	    ans=tick
3347	    ;;
3348	esac
3349	ntp_cv_nlist_tick=$ans
3350    ]
3351)
3352case "$ntp_cv_nlist_tick" in
3353 ''|no)
3354    ;;	# HMS: I think we can only get 'no' here...
3355 *)
3356    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3357	[What is the name of TICK in the kernel?])
3358esac
3359
3360AC_CACHE_CHECK(
3361    [for the units of 'tick'],
3362    [ntp_cv_tick_nano],
3363    [
3364	ans=usec
3365	case "$host" in
3366	 *-*-solaris2*)
3367	    ans=nsec
3368	    ;;
3369	esac
3370	ntp_cv_tick_nano=$ans
3371    ]
3372)
3373case "$ntp_cv_tick_nano" in
3374 nsec)
3375    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3376esac
3377
3378AC_CACHE_CHECK(
3379    [the name of 'tickadj' in the kernel],
3380    [ntp_cv_nlist_tickadj],
3381    [
3382	ans=_tickadj
3383	case "$host" in
3384	 m68*-hp-hpux*) # HP9000/300?
3385	    ans=_tickadj
3386	    ;;
3387	 *-apple-aux[[23]]*)
3388	    ans=tickadj
3389	    ;;
3390	 *-hp-hpux10*)
3391	    ans=no
3392	    ;;
3393	 *-hp-hpux9*)
3394	    ans=no
3395	    ;;
3396	 *-hp-hpux*)
3397	    ans=tickadj
3398	    ;;
3399	 *-*-aix*)
3400	    ans=tickadj
3401	    ;;
3402	 *-*-mpeix*)
3403	    ans=no
3404	    ;;
3405	 *-*-ptx*)
3406	    ans=tickadj
3407	    ;;
3408	 *-*-sco3.2v4*)
3409	    ans=no
3410	    ;;
3411	 *-*-sco3.2v5.0*)
3412	    ans=clock_drift
3413	    ;;
3414	 *-*-solaris2*)
3415	    ans=no	# hrestime_adj
3416	    ;;
3417	 *-*-sysv4*)
3418	    ans=tickadj
3419	    ;;
3420	esac
3421	ntp_cv_nlist_tickadj=$ans
3422    ]
3423)
3424case "$ntp_cv_nlist_tickadj" in
3425 ''|no)
3426    ;;	# HMS: I think we can only get 'no' here...
3427 *)
3428    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3429	[What is the name of TICKADJ in the kernel?])
3430esac
3431
3432AC_CACHE_CHECK(
3433    [for the units of 'tickadj'],
3434    [ntp_cv_tickadj_nano],
3435    [
3436	ans=usec
3437	case "$host" in
3438	 *-*-solaris2*)
3439	    ans=nsec
3440	    ;;
3441	esac
3442	ntp_cv_tickadj_nano=$ans
3443    ]
3444)
3445case "$ntp_cv_tickadj_nano" in
3446 nsec)
3447    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3448esac
3449
3450AC_CACHE_CHECK(
3451    [half-heartedly for 'dosynctodr' in the kernel],
3452    [ntp_cv_nlist_dosynctodr],
3453    [
3454	case "$host" in
3455	 *-apple-aux[[23]]*)
3456	    ans=no
3457	    ;;
3458	 *-sni-sysv*)
3459	    ans=dosynctodr
3460	    ;;
3461	 *-stratus-vos)
3462	    ans=no
3463	    ;;
3464	 *-*-aix*)
3465	    ans=dosynctodr
3466	    ;;
3467	 *-*-hpux*)
3468	    ans=no
3469	    ;;
3470	 *-*-mpeix*)
3471	    ans=no
3472	    ;;
3473	 *-*-nextstep*)
3474	    ans=_dosynctodr
3475	    ;;
3476	 *-*-ptx*)
3477	    ans=doresettodr
3478	    ;;
3479	 *-*-sco3.2v4*)
3480	    ans=no
3481	    ;;
3482	 *-*-sco3.2v5*)
3483	    ans=track_rtc
3484	    ;;
3485	 *-*-solaris2*)
3486	    ans=dosynctodr
3487	    ;;
3488	 *-*-sysv4*)
3489	    ans=doresettodr
3490	    ;;
3491	 *)
3492	    ans=_dosynctodr
3493	    ;;
3494	esac
3495	ntp_cv_nlist_dosynctodr=$ans
3496    ]
3497)
3498case "$ntp_cv_nlist_dosynctodr" in
3499 no)
3500    ;;
3501 *)
3502    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3503	[What is (probably) the name of DOSYNCTODR in the kernel?])
3504    ;;
3505esac
3506
3507AC_CACHE_CHECK(
3508    [half-heartedly for 'noprintf' in the kernel],
3509    [ntp_cv_nlist_noprintf],
3510    [
3511	case "$host" in
3512	 *-apple-aux[[23]]*)
3513	    ans=no
3514	    ;;
3515	 *-sni-sysv*)
3516	    ans=noprintf
3517	    ;;
3518	 *-stratus-vos)
3519	    ans=no
3520	    ;;
3521	 *-*-aix*)
3522	    ans=noprintf
3523	    ;;
3524	 *-*-hpux*)
3525	    ans=no
3526	    ;;
3527	 *-*-mpeix*)
3528	    ans=no
3529	    ;;
3530	 *-*-ptx*)
3531	    ans=noprintf
3532	    ;;
3533	 *-*-nextstep*)
3534	    ans=_noprintf
3535	    ;;
3536	 *-*-solaris2*)
3537	    ans=noprintf
3538	    ;;
3539	 *-*-sysv4*)
3540	    ans=noprintf
3541	    ;;
3542	 *)
3543	    ans=_noprintf
3544	    ;;
3545	esac
3546	ntp_cv_nlist_noprintf=$ans
3547    ]
3548)
3549case "$ntp_cv_nlist_noprintf" in
3550 no)
3551    ;;
3552 *)
3553    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3554	[What is (probably) the name of NOPRINTF in the kernel?])
3555    ;;
3556esac
3557
3558dnl The tick/tickadj sections were written by Skippy, who never learned
3559dnl that it's impolite (horridly gross) to show your guts in public.
3560
3561dnl	tick		tickadj
3562dnl	10000		80	    Unixware
3563dnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3564dnl	10000		150	    sgi IRIX
3565dnl	1000000L/hz	1000	    RS6000 && NOKMEM
3566dnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3567dnl	1000000L/hz	500/HZ	    other && NOKMEM
3568dnl	txc.tick	1	    Linux
3569dnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3570dnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3571dnl				    (RS6000 && !NOKMEM), SINIX MIPS
3572
3573dnl But we'll only use these "values" if we can't find anything else.
3574
3575AC_MSG_CHECKING([for a default value for 'tick'])
3576
3577# target-dependent default for tick
3578
3579case "$host" in
3580 *-*-pc-cygwin*)
3581    AC_MSG_ERROR([tick needs work for cygwin])
3582    ;;
3583 *-univel-sysv*)
3584    ans=10000
3585    ;;
3586 *-*-irix*)
3587    ans=10000
3588    ;;
3589 *-*-*linux*)
3590    ans=txc.tick
3591    ;;
3592 *-*-mpeix*)
3593    ans=no
3594    ;;
3595 *-*-winnt3.5)
3596    ans='(every / 10)'
3597    ;;
3598 *-*-unicosmp*)
3599    ans=10000
3600    ;;
3601 *)
3602    ans='1000000L/hz'
3603    ;;
3604esac
3605
3606AC_ARG_ENABLE(
3607    [tick],
3608    [AS_HELP_STRING(
3609	[--enable-tick=VALUE],
3610	[s force a value for 'tick']
3611    )],
3612    [ans=$enableval]
3613)
3614
3615AC_MSG_RESULT([$ans])
3616
3617case "$ans" in
3618 ''|no)
3619    ;;	# HMS: I think we can only get 'no' here...
3620 *)
3621    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3622	[Preset a value for 'tick'?])
3623esac
3624
3625AC_MSG_CHECKING([for a default value for 'tickadj'])
3626
3627# target-specific default
3628ans='500/hz'
3629case "$host" in
3630 *-fujitsu-uxp*)
3631    case "$adjtime_is_accurate" in
3632     yes)
3633	ans='tick/16'
3634    esac
3635    ;;
3636 *-univel-sysv*)
3637    ans=80
3638    ;;
3639 *-*-aix*)
3640    case "$can_kmem" in
3641     no)
3642	ans=1000
3643	;;
3644    esac
3645    ;;
3646 *-*-domainos)	# Skippy: won't be found...
3647    case "$can_kmem" in
3648     no)
3649	ans=668
3650	;;
3651    esac
3652    ;;
3653 *-*-hpux*)
3654    case "$adjtime_is_accurate" in
3655     yes)
3656	ans='tick/16'
3657	;;
3658    esac
3659    ;;
3660 *-*-irix*)
3661    ans=150
3662    ;;
3663 *-*-mpeix*)
3664    ans=no
3665    ;;
3666 *-*-sco3.2v5.0*)
3667    ans=10000L/hz
3668    ;;
3669 *-*-winnt3.5)
3670    ans=50
3671    ;;
3672 *-*-unicosmp*)
3673    ans=150
3674    ;;
3675esac
3676
3677AC_ARG_ENABLE(
3678    [tickadj],
3679    [AS_HELP_STRING(
3680	[--enable-tickadj=VALUE],
3681	[s force a value for 'tickadj']
3682    )],
3683    [ans=$enableval]
3684)
3685
3686AC_MSG_RESULT([$ans])
3687
3688default_tickadj=$ans
3689
3690case "$default_tickadj" in
3691 ''|no)
3692    ;;	# HMS: I think we can only get 'no' here...
3693 *)
3694    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3695	[Preset a value for 'tickadj'?]) ;;
3696esac
3697
3698# Newer versions of ReliantUNIX round adjtime() values down to
3699# 1/100s (system tick). Sigh ...
3700# Unfortunately, there is no easy way to know if particular release
3701# has this "feature" or any obvious way to test for it.
3702case "$host" in
3703 mips-sni-sysv4*)
3704    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3705	[Do we want the ReliantUNIX clock hacks?])
3706esac
3707
3708case "$host" in
3709 *-*-sco3.2v5*)
3710    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3711esac
3712
3713ntp_cv_make_tickadj=yes
3714case "$can_kmem$ac_cv_var_tick$default_tickadj" in
3715 nonono)	# Don't read KMEM, no presets.  Bogus.
3716    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3717    ntp_cv_make_tickadj=no
3718    ;;
3719 nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3720    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3721    ntp_cv_make_tickadj=no
3722    ;;
3723 no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3724    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3725    ntp_cv_make_tickadj=no
3726    ;;
3727 no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3728    ;;
3729 yesnono)	# Read KMEM, no presets.  Cool.
3730    ;;
3731 yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3732    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3733    ;;
3734 yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3735    ;;
3736 yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3737    ;;
3738 *)		# Generally bogus.
3739    AC_MSG_ERROR([This shouldn't happen.])
3740    ;;
3741esac
3742
3743AC_SUBST(MAKE_NTPTIME)
3744AC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3745[case "$host" in
3746 *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3747     yesyes)
3748	ans=yes
3749	;;
3750     *)
3751	ans=no
3752	;;
3753    esac
3754    ;;
3755esac
3756ac_cv_make_ntptime=$ans])
3757case "$ac_cv_make_ntptime" in
3758 yes)
3759    MAKE_NTPTIME=ntptime
3760    ;;
3761 *)
3762    NTPTIME_DB=
3763    NTPTIME_DL=
3764    NTPTIME_DS=
3765    NTPTIME_MS=
3766    ;;
3767esac
3768
3769AC_SUBST([MAKE_TICKADJ])
3770case "$host" in
3771 mips-sni-sysv4*)
3772    # tickadj is pretty useless on newer versions of ReliantUNIX
3773    # Do not bother
3774    ntp_cv_make_tickadj=no
3775    ;;
3776 *-*-irix*)
3777    ntp_cv_make_tickadj=no
3778    ;;
3779 *-*-solaris2*)
3780    # DLM says tickadj is a no-no starting with solaris2.5
3781    case "$host" in
3782     *-*-solaris2.1[[0-9]]*)
3783	ntp_cv_make_tickadj=no
3784	;;
3785     *-*-solaris2.[[0-4]]*) ;;
3786     *) ntp_cv_make_tickadj=no ;;
3787    esac
3788    ;;
3789 *-*-unicosmp*)
3790    ntp_cv_make_tickadj=no
3791    ;;
3792esac
3793
3794#
3795# Despite all the above, we always make tickadj.  Setting
3796# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3797# report that the configuration variable was cached.  It may
3798# be better to simply remove the hunk above, I did not want
3799# to remove it if there is hope it will be used again.
3800#
3801AS_UNSET([ntp_cv_make_tickadj])
3802
3803AC_CACHE_CHECK(
3804    [if we want and can make the tickadj utility],
3805    [ntp_cv_make_tickadj],
3806    [ntp_cv_make_tickadj=yes]
3807)
3808case "$ntp_cv_make_tickadj" in
3809 yes)
3810    MAKE_TICKADJ=tickadj
3811    ;;
3812 *)
3813    CALC_TICKADJ_DB=
3814    CALC_TICKADJ_DL=
3815    CALC_TICKADJ_DS=
3816    CALC_TICKADJ_MS=
3817    TICKADJ_DB=
3818    TICKADJ_DL=
3819    TICKADJ_DS=
3820    TICKADJ_MS=
3821    ;;
3822esac
3823
3824AC_SUBST([MAKE_TIMETRIM])
3825AC_CACHE_CHECK(
3826    [if we want and can make the timetrim utility],
3827    [ntp_cv_make_timetrim],
3828    [
3829	case "$host" in
3830	 *-*-irix*)
3831	    ntp_cv_make_timetrim=yes
3832	    ;;
3833	 *-*-unicosmp*)
3834	    ntp_cv_make_timetrim=yes
3835	    ;;
3836	 *)
3837	    ntp_cv_make_timetrim=no
3838	    ;;
3839	esac
3840    ]
3841)
3842case "$ntp_cv_make_timetrim" in
3843 yes)
3844    MAKE_TIMETRIM=timetrim
3845    ;;
3846 *) TIMETRIM_DB=
3847    TIMETRIM_DL=
3848    TIMETRIM_DS=
3849    TIMETRIM_MS=
3850    ;;
3851esac
3852
3853AC_SUBST([MAKE_LIBNTPSIM])
3854AC_SUBST([MAKE_NTPDSIM])
3855
3856AC_MSG_CHECKING([if we want to build the NTPD simulator])
3857AC_ARG_ENABLE(
3858    [simulator],
3859    [AS_HELP_STRING(
3860	[--enable-simulator],
3861	[- build/install the NTPD simulator?]
3862    )],
3863    [ans=$enableval],
3864    [ans=no]
3865)
3866AC_MSG_RESULT([$ans])
3867case "$ans" in
3868 yes)
3869    MAKE_NTPDSIM=ntpdsim
3870    MAKE_LIBNTPSIM=libntpsim.a
3871    ;;
3872 *)
3873    NTPDSIM_DB=
3874    NTPDSIM_DL=
3875    NTPDSIM_DS=
3876    NTPDSIM_MS=
3877    ;;
3878esac
3879
3880case "$build" in
3881 $host)
3882    ;;
3883 *) case "$host" in
3884     *-*-vxworks*)
3885	LDFLAGS="$LDFLAGS -r"
3886	;;
3887    esac
3888    ;;
3889esac
3890
3891NTP_WITHSNTP
3892
3893AC_MSG_CHECKING([if we want to build ntpsnmpd])
3894AC_ARG_WITH(
3895    [ntpsnmpd],
3896    [AS_HELP_STRING(
3897	[--with-ntpsnmpd],
3898	[s Build ntpsnmpd MIB agent?]
3899    )],
3900    [ans=$withval],
3901    [
3902	case "$PATH_NET_SNMP_CONFIG" in
3903	 /*)	ans=yes ;;
3904	 *)	ans=no  ;;
3905	esac
3906    ]
3907)
3908AC_MSG_RESULT([$ans])
3909case "$ans" in
3910 yes)
3911    case "$PATH_NET_SNMP_CONFIG" in
3912     /*)
3913	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3914	# Bug 2815.  This is a bit of a hack, but it works...
3915	case "$ntp_cv_net_snmp_version" in
3916	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3917		;;
3918	esac
3919	AC_SUBST([SNMP_LIBS])
3920	# HMS: we really want to separate CPPFLAGS and CFLAGS
3921	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3922	SNMP_CPPFLAGS=
3923	SNMP_CFLAGS=
3924	for i in $foo; do
3925	    case "$i" in
3926	     -D*|-U*|-I*)
3927		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3928		;;
3929	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3930		;;
3931	    esac
3932	done
3933	AC_SUBST([SNMP_CPPFLAGS])
3934	AC_SUBST([SNMP_CFLAGS])
3935
3936	save_CFLAGS=$CFLAGS
3937	save_CPPFLAGS=$CPPFLAGS
3938	save_LIBS=$LIBS
3939	CFLAGS=$SNMP_CFLAGS
3940	CPPFLAGS=$SNMP_CPPFLAGS
3941
3942	AC_CHECK_HEADER(
3943	    [net-snmp/net-snmp-config.h],
3944	    [MAKE_NTPSNMPD=ntpsnmpd],
3945	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3946	)
3947
3948	# Do this last, as we're messing up LIBS.
3949	# check -lnetsnmp for netsnmp_daemonize
3950	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3951	AC_CHECK_LIB(
3952	    [netsnmp],
3953	    [netsnmp_daemonize],
3954	    [ans=yes],
3955	    [ans=no]
3956	)
3957	case "$ans" in
3958	 no)
3959	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3960		[We need to provide netsnmp_daemonize()])
3961	esac
3962	
3963	CFLAGS=$save_CFLAGS
3964	AS_UNSET([save_CFLAGS])
3965	CPPFLAGS=$save_CPPFLAGS
3966	AS_UNSET([save_CPPFLAGS])
3967	LIBS=$save_LIBS
3968	AS_UNSET([save_LIBS])
3969	;;
3970     *) 
3971	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3972	;;
3973    esac
3974    ;;
3975esac
3976AC_SUBST([MAKE_NTPSNMPD])
3977
3978case "$MAKE_NTPSNMPD" in
3979 '')
3980    NTPSNMPD_DB=
3981    NTPSNMPD_DL=
3982    NTPSNMPD_DS=
3983    NTPSNMPD_MS=
3984    ;;
3985esac
3986
3987AC_MSG_CHECKING([if we should always slew the time])
3988
3989# target-specific defaults
3990
3991case "$host" in
3992 *-apple-aux[[23]]*)
3993    ans=yes
3994    ;;
3995 *-*-bsdi[[012]]*)
3996    ans=no
3997    ;;
3998 *-*-bsdi*)
3999    ans=yes
4000    ;;
4001 *-*-openvms*)	# HMS: won't be found
4002    ans=yes
4003    ;;
4004 *) ans=no
4005    ;;
4006esac
4007
4008# --enable-slew-always / --disable-slew-always overrides default
4009
4010AC_ARG_ENABLE(
4011    [slew-always],
4012    [AS_HELP_STRING(
4013	[--enable-slew-always],
4014	[s always slew the time]
4015    )],
4016    [ans=$enableval]
4017)
4018
4019AC_MSG_RESULT([$ans])
4020
4021case "$ans" in
4022 yes)
4023    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
4024esac
4025
4026AC_MSG_CHECKING([if we should step and slew the time])
4027
4028case "$host" in
4029 *-sni-sysv*)
4030    ans=yes
4031    ;;
4032 *-stratus-vos)
4033    ans=no
4034    ;;
4035 *-univel-sysv*)
4036    ans=no
4037    ;;
4038 *-*-ptx*)
4039    ans=yes
4040    ;;
4041 *-*-solaris2.1[[0-9]]*)
4042    ans=no
4043    ;;
4044 *-*-solaris2.[[012]]*)
4045    ans=yes
4046    ;;
4047 *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4048    ans=yes
4049    ;;
4050 *) ans=no
4051    ;;
4052esac
4053
4054AC_ARG_ENABLE(
4055    [step-slew],
4056    [AS_HELP_STRING(
4057	[--enable-step-slew],
4058	[s step and slew the time]
4059    )],
4060    [ans=$enableval]
4061)
4062
4063AC_MSG_RESULT([$ans])
4064
4065case "$ans" in
4066 yes)
4067    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4068esac
4069
4070AC_MSG_CHECKING([if ntpdate should step the time])
4071
4072case "$host" in
4073 *-apple-aux[[23]]*)
4074    ans=yes
4075    ;;
4076 *) ans=no
4077    ;;
4078esac
4079
4080AC_ARG_ENABLE(
4081    [ntpdate-step],
4082    [AS_HELP_STRING(
4083	[--enable-ntpdate-step],
4084	[s if ntpdate should step the time]
4085    )],
4086    [ans=$enableval]
4087)
4088
4089AC_MSG_RESULT([$ans])
4090
4091case "$ans" in
4092 yes)
4093    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4094	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4095esac
4096
4097
4098AC_MSG_CHECKING([if we should sync TODR clock every hour])
4099
4100case "$host" in
4101 *-*-nextstep*)
4102    ans=yes
4103    ;;
4104 *-*-openvms*)	# HMS: won't be found
4105    ans=yes
4106    ;;
4107 *)
4108    ans=no
4109    ;;
4110esac
4111
4112AC_ARG_ENABLE(
4113    [hourly-todr-sync],
4114    [AS_HELP_STRING(
4115	[--enable-hourly-todr-sync],
4116	[s if we should sync TODR hourly]
4117    )],
4118    [ans=$enableval]
4119)
4120
4121AC_MSG_RESULT([$ans])
4122
4123case "$ac_cv_var_sync_todr" in
4124 yes)
4125    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4126esac
4127
4128
4129AC_MSG_CHECKING([if we should avoid kernel FLL bug])
4130
4131case "$host" in
4132 *-*-solaris2.6)
4133    unamev=`uname -v`
4134    case "$unamev" in
4135     Generic_105181-*)
4136	old_IFS="$IFS"
4137	IFS="-"
4138	set $unamev
4139	IFS="$old_IFS"
4140	if test "$2" -ge 17
4141	then
4142	    # Generic_105181-17 and higher
4143	    ans=no
4144	else
4145	    ans=yes
4146	fi
4147	;;
4148     *)
4149	ans=yes
4150	;;
4151    esac
4152    ;;
4153 *-*-solaris2.7)
4154    unamev=`uname -v`
4155    case "$unamev" in
4156     Generic_106541-*)
4157	old_IFS="$IFS"
4158	IFS="-"
4159	set $unamev
4160	IFS="$old_IFS"
4161	if test "$2" -ge 07
4162	then
4163	    # Generic_106541-07 and higher
4164	    ans=no
4165	else
4166	    ans=yes
4167	fi
4168	;;
4169     *)
4170	ans=yes
4171	;;
4172    esac
4173    ;;
4174 *)
4175    ans=no
4176    ;;
4177esac
4178
4179AC_ARG_ENABLE(
4180    [kernel-fll-bug],
4181    [AS_HELP_STRING(
4182	[--enable-kernel-fll-bug],
4183	[s if we should avoid a kernel FLL bug]
4184    )],
4185    [ans=$enableval]
4186)
4187
4188AC_MSG_RESULT([$ans])
4189
4190case "$ans" in
4191 yes)
4192    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4193esac
4194
4195
4196AC_MSG_CHECKING([if we want new session key behavior])
4197AC_ARG_ENABLE(
4198    [bug1243-fix],
4199    [AS_HELP_STRING(
4200	[--enable-bug1243-fix],
4201	[+ use unmodified autokey session keys]
4202    )],
4203    [ans=$enableval],
4204    [ans=yes]
4205)
4206AC_MSG_RESULT([$ans])
4207case "$ans" in
4208 no)
4209    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4210	[use old autokey session key behavior?])
4211esac
4212
4213
4214AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4215
4216case "$host" in
4217 *-*-solaris2.[[89]])
4218    ans=yes
4219    ;;
4220 *-*-solaris2.1[[0-9]]*)
4221    ans=yes
4222    ;;
4223 *) ans=no
4224    ;;
4225esac
4226
4227AC_ARG_ENABLE(
4228    [irig-sawtooth],
4229    [AS_HELP_STRING(
4230	[--enable-irig-sawtooth],
4231	[s if we should enable the IRIG sawtooth filter]
4232    )],
4233    [ans=$enableval]
4234)
4235
4236AC_MSG_RESULT([$ans])
4237
4238case "$ans" in
4239 yes)
4240    AC_DEFINE([IRIG_SUCKS], [1],
4241	[Should we use the IRIG sawtooth filter?])
4242esac
4243
4244AC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4245AC_ARG_ENABLE(
4246	[nist],
4247	[AS_HELP_STRING(
4248	    [--enable-nist],
4249	    [- if we should enable the NIST lockclock scheme]
4250	)],
4251	[ans=$enableval],
4252	[ans=no]
4253)
4254
4255AC_MSG_RESULT([$ans])
4256
4257case "$ans" in
4258 yes)
4259    AC_DEFINE([LOCKCLOCK], [1],
4260	[Should we align with the NIST lockclock scheme?]) ;;
4261esac
4262
4263AC_MSG_CHECKING([if we want support for Samba's signing daemon])
4264AC_ARG_ENABLE(
4265    [ntp-signd],
4266    [AS_HELP_STRING(
4267	[--enable-ntp-signd],
4268	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4269    )],
4270    [ans=$enableval],
4271    [ans=no]
4272)
4273
4274AC_MSG_RESULT([$ans])
4275
4276case "$ans" in
4277 no)
4278    ntp_signd_path=
4279    ;;
4280 yes)
4281    ntp_signd_path=/var/run/ntp_signd
4282    ;;
4283 *)
4284    ntp_signd_path="$ans"
4285esac
4286
4287case "$ntp_signd_path" in
4288 '')
4289    ;;
4290 *)
4291    AC_DEFINE([HAVE_NTP_SIGND], [1],
4292	[Do we want support for Samba's signing daemon?])
4293    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4294	[Path to sign daemon rendezvous socket])
4295    ;;
4296esac
4297
4298AC_CHECK_HEADERS([libscf.h])
4299LSCF=
4300case "$ac_cv_header_libscf_h" in
4301 yes)
4302    LSCF='-lscf'
4303esac
4304AC_SUBST([LSCF])
4305
4306NTP_IPV6
4307
4308
4309#
4310# Look for a sysctl call to get the list of network interfaces.
4311#
4312AC_CACHE_CHECK(
4313    [for interface list sysctl],
4314    [ntp_cv_iflist_sysctl],
4315    [AC_PREPROC_IFELSE(
4316	[AC_LANG_SOURCE([
4317	    #include <sys/param.h>
4318	    #include <sys/sysctl.h>
4319	    #include <sys/socket.h>
4320	    #ifndef NET_RT_IFLIST
4321	    # error
4322	    #endif
4323	])],
4324	[ntp_cv_iflist_sysctl=yes],
4325	[ntp_cv_iflist_sysctl=no]
4326    )]
4327)
4328case "$ntp_cv_iflist_sysctl" in
4329 yes)
4330    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4331esac
4332
4333###
4334
4335AC_MSG_CHECKING([if we want the saveconfig mechanism])
4336AC_ARG_ENABLE(
4337    [saveconfig],
4338    [AS_HELP_STRING(
4339	[--enable-saveconfig],
4340	[+ saveconfig mechanism]
4341    )],
4342    [ntp_ok=$enableval],
4343    [ntp_ok=yes]
4344)
4345ntp_saveconfig_enabled=0
4346case "$ntp_ok" in
4347 yes)
4348    ntp_saveconfig_enabled=1
4349    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
4350    ;;
4351esac
4352AM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4353AC_MSG_RESULT([$ntp_ok])
4354
4355###
4356
4357AC_MSG_CHECKING([if we want the experimental leap smear code])
4358AC_ARG_ENABLE(
4359    [leap-smear],
4360    [AS_HELP_STRING(
4361	[--enable-leap-smear],
4362	[- experimental leap smear code]
4363    )],
4364    [ntp_ok=$enableval],
4365    [ntp_ok=no]
4366)
4367ntp_leap_smear_enabled=0
4368case "$ntp_ok" in
4369 yes)
4370    ntp_leap_smear_enabled=1
4371    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4372    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4373    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4374    ;;
4375esac
4376AC_MSG_RESULT([$ntp_ok])
4377
4378NTP_UNITYBUILD
4379
4380dnl  gtest is needed for our tests subdirs. It would be nice if we could
4381dnl  require a C++ compiler only if we will use gtest, but AC_PROG_CXX
4382dnl  can't be conditionalized.
4383NTP_GOOGLETEST
4384
4385###
4386
4387AC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4388    [Default location of crypto key info])
4389
4390AC_CONFIG_FILES([Makefile])
4391AC_CONFIG_FILES([adjtimed/Makefile])
4392AC_CONFIG_FILES([clockstuff/Makefile])
4393AC_CONFIG_FILES([include/Makefile])
4394AC_CONFIG_FILES([include/isc/Makefile])
4395AC_CONFIG_FILES([kernel/Makefile])
4396AC_CONFIG_FILES([kernel/sys/Makefile])
4397AC_CONFIG_FILES([libntp/Makefile])
4398AC_CONFIG_FILES([libparse/Makefile])
4399AC_CONFIG_FILES([ntpd/Makefile])
4400AC_CONFIG_FILES([ntpd/complete.conf],	[sed -e '/^rlimit$/d' -e '/^$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf])
4401AC_CONFIG_FILES([ntpdate/Makefile])
4402AC_CONFIG_FILES([ntpdc/Makefile])
4403AC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4404AC_CONFIG_FILES([ntpq/Makefile])
4405AC_CONFIG_FILES([ntpsnmpd/Makefile])
4406AC_CONFIG_FILES([parseutil/Makefile])
4407AC_CONFIG_FILES([scripts/Makefile])
4408AC_CONFIG_FILES([scripts/build/Makefile])
4409AC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4410AC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4411AC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4412AC_CONFIG_FILES([scripts/lib/Makefile])
4413AC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4414AC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
4415AC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4416AC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
4417AC_CONFIG_FILES([scripts/ntptrace/Makefile])
4418AC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4419AC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4420AC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4421AC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4422AC_CONFIG_FILES([scripts/update-leap/Makefile])
4423AC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
4424AC_CONFIG_FILES([tests/Makefile])
4425AC_CONFIG_FILES([tests/bug-2803/Makefile])
4426AC_CONFIG_FILES([tests/libntp/Makefile])
4427AC_CONFIG_FILES([tests/ntpd/Makefile])
4428AC_CONFIG_FILES([tests/sandbox/Makefile])
4429AC_CONFIG_FILES([tests/sec-2853/Makefile])
4430AC_CONFIG_FILES([util/Makefile])
4431
4432perllibdir="${datadir}/ntp/lib"
4433AC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
4434
4435calc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
4436AC_SUBST_FILE([calc_tickadj_opts])
4437ntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
4438AC_SUBST_FILE([ntp_wait_opts])
4439ntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
4440AC_SUBST_FILE([ntpsweep_opts])
4441ntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
4442AC_SUBST_FILE([ntptrace_opts])
4443summary_opts="$srcdir/scripts/summary-opts"
4444AC_SUBST_FILE([summary_opts])
4445plot_summary_opts="$srcdir/scripts/plot_summary-opts"
4446AC_SUBST_FILE([plot_summary_opts])
4447
4448AC_CONFIG_SUBDIRS([sntp])
4449
4450AC_OUTPUT
4451