xref: /netbsd-src/external/bsd/ntp/dist/configure.ac (revision eabc0478de71e4e011a5b4e0392741e01d491794)
18585484eSchristosdnl NTP top-level configure.ac				-*- Autoconf -*-
28585484eSchristosdnl
38585484eSchristosm4_include([sntp/m4/version.m4])
4cdfa2a7eSchristosAC_PREREQ([2.68])
58585484eSchristosAC_INIT(
6b5bbe2e3Schristos    [ntp],
78585484eSchristos    [VERSION_NUMBER],
8*eabc0478Schristos    [https://bugs.ntp.org/],
98585484eSchristos    [],
10*eabc0478Schristos    [https://www.ntp.org/]dnl
118585484eSchristos)
128585484eSchristosAC_CONFIG_MACRO_DIR([sntp/m4])
138585484eSchristosAC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
14a6f3f22fSchristosAC_LANG([C])
15abb0f93cSkardel
168585484eSchristosAC_PRESERVE_HELP_ORDER
178585484eSchristos
188585484eSchristos# Bump ntp_configure_cache_version for each change to configure.ac or
198585484eSchristos# .m4 files which invalidates cached values from previous configure
208585484eSchristos# runs.
21abb0f93cSkardel#
22abb0f93cSkardel# If the change affects cache variables used only by the main NTP
23abb0f93cSkardel# configure.ac, then only its version number should be bumped, while
24abb0f93cSkardel# the subdir configure.ac version numbers should be unchanged.  The
25abb0f93cSkardel# same is true for a test/variable that is used only by one subdir
26abb0f93cSkardel# being changed incompatibly; only that subdir's cache version needs
27abb0f93cSkardel# bumping.
28abb0f93cSkardel#
29abb0f93cSkardel# If a change affects variables shared by all NTP configure scripts,
308585484eSchristos# please bump the version numbers of each.  If you are not sure, the
318585484eSchristos# safe choice is to bump all on any cache-invalidating change.
32abb0f93cSkardel#
33abb0f93cSkardel# In order to avoid the risk of version stamp collision between -stable
34abb0f93cSkardel# and -dev branches, do not simply increment the version, instead use
35abb0f93cSkardel# the date YYYYMMDD optionally with -HHMM if there is more than one
36abb0f93cSkardel# bump in a day.
37abb0f93cSkardel
38*eabc0478Schristosntp_configure_cache_version=20240218
39abb0f93cSkardel
40abb0f93cSkardel# When the cache version of config.cache and configure do not
41abb0f93cSkardel# match, NTP_CACHEVERSION will flush the cache.
42abb0f93cSkardel
43abb0f93cSkardelNTP_CACHEVERSION([main], [$ntp_configure_cache_version])
44abb0f93cSkardel
45*eabc0478SchristosAM_INIT_AUTOMAKE([1.15 foreign subdir-objects -Wall -Wno-gnu])
468585484eSchristos
47cdfa2a7eSchristosAM_SILENT_RULES([yes])
48cdfa2a7eSchristos
49abb0f93cSkardelAC_CANONICAL_BUILD
50abb0f93cSkardelAC_CANONICAL_HOST
51abb0f93cSkardeldnl the 'build' machine is where we run configure and compile
52abb0f93cSkardeldnl the 'host' machine is where the resulting stuff runs.
53f003fb54SkardelAC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
54f003fb54Skardel    [canonical system (cpu-vendor-os) of where we should run])
558585484eSchristosAC_CONFIG_HEADERS([config.h])
56abb0f93cSkardeldnl AC_ARG_PROGRAM
57abb0f93cSkardel
58*eabc0478SchristosAC_MSG_CHECKING([if we should enable build framework help])
59*eabc0478SchristosAC_ARG_ENABLE(
60*eabc0478Schristos    [build-framework-help],
61*eabc0478Schristos    [AS_HELP_STRING(
62*eabc0478Schristos	[--enable-build-framework-help],
63*eabc0478Schristos	[+ enable build framework help]
64*eabc0478Schristos    )],
65*eabc0478Schristos    [ntp_ok=$enableval],
66*eabc0478Schristos    [ntp_ok=yes]
67*eabc0478Schristos)
68*eabc0478Schristoscase "$ntp_ok" in
69*eabc0478Schristos yes)
70*eabc0478Schristos    ntp_cv_build_framework_help=yes ;;
71*eabc0478Schristos *) ntp_cv_build_framework_help=no ;;
72*eabc0478Schristosesac
73*eabc0478SchristosAC_MSG_RESULT([$ntp_ok])
74*eabc0478Schristos
75f003fb54Skardelntp_atom_ok=${ntp_atom_ok=no}
76f003fb54Skardelntp_oncore_ok=${ntp_oncore_ok=no}
77f003fb54Skardelntp_parse_ok=${ntp_parse_ok=no}
78f003fb54Skardelntp_ripe_ncc_ok=${ntp_parse_ok=no}
79f003fb54Skardelntp_jupiter_ok=${ntp_jupiter_ok=no}
80abb0f93cSkardel
818585484eSchristosNTP_PROG_CC
823e3909feSchristosNTP_COMPILER
833e3909feSchristos
848585484eSchristosAC_PROG_YACC
853e3909feSchristosdnl AC_PROG_CC_C_O 	# called by NTP_COMPILER
86b5bbe2e3SchristosAX_C99_STRUCT_INIT
878585484eSchristos
883e3909feSchristosNTP_HARDEN([sntp])
893e3909feSchristos
90*eabc0478SchristosNTP_VPATH_HACK		dnl used by ntpd/Makefile.am libparse/Makefile.am
918585484eSchristos
928585484eSchristosNTP_LOCINFO([sntp])	dnl takes over from NTP_BINDIR, in NTP_LIBNTP
938585484eSchristos
94*eabc0478SchristosAM_PROG_AR
95abb0f93cSkardel
96abb0f93cSkardel# So far, the only shared library we might use is libopts.
97abb0f93cSkardel# It's a small library - we might as well use a static version of it.
98*eabc0478SchristosLT_INIT([disable-shared])
998585484eSchristosAC_SUBST([LIBTOOL_DEPS])
100abb0f93cSkardel
1018585484eSchristos# NTP has (so far) been relying on leading-edge autogen, which
1028585484eSchristos# means we need the appropriate corresponding libopts as well.
103abb0f93cSkardel# Therefore, by default:
1048585484eSchristos# - use the version of libopts we ship with
105abb0f93cSkardel# - do not install it
106*eabc0478Schristos# - build a static copy (disable-shared - done earlier)
107abb0f93cSkardelcase "${enable_local_libopts+set}" in
108abb0f93cSkardel set) ;;
109abb0f93cSkardel *) enable_local_libopts=yes ;;
110abb0f93cSkardelesac
111abb0f93cSkardelcase "${enable_libopts_install+set}" in
112abb0f93cSkardel set) ;;
113abb0f93cSkardel *) enable_libopts_install=no ;;
114abb0f93cSkardelesac
1158585484eSchristosenable_nls=no
116f003fb54SkardelLIBOPTS_CHECK_NOBUILD([sntp/libopts])
117abb0f93cSkardel
118b5bbe2e3SchristosNTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
119abb0f93cSkardel
1208585484eSchristosNTP_LIBNTP
121f003fb54Skardel
122abb0f93cSkardeldnl  we need to check for cross compile tools for vxWorks here
123abb0f93cSkardelAC_PROG_AWK
1248585484eSchristosAS_UNSET([ac_cv_prog_AWK])
1258585484eSchristosAC_SUBST([AWK])				dnl scripts/ntpver.in
126abb0f93cSkardelAC_PROG_MAKE_SET
127abb0f93cSkardel
128abb0f93cSkardelAC_PROG_LN_S
129abb0f93cSkardel
1308585484eSchristos
131f003fb54SkardelAC_PATH_PROG([PATH_PERL], [perl])
1328585484eSchristosdnl  Saving cached hardcoded paths rather than searching $PATH during a
1338585484eSchristosdnl  cached configure run is an optimization not worth the the cost of
1348585484eSchristosdnl  preventing newly-installed tools from being found.  Short-circuit
1358585484eSchristosdnl  the caching after the tests so preset overrides still work.
1368585484eSchristosAS_UNSET([ac_cv_path_PATH_PERL])
137f003fb54SkardelAC_PATH_PROG([PATH_TEST], [test])
1388585484eSchristosAS_UNSET([ac_cv_path_PATH_TEST])
1398585484eSchristostest -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
1408585484eSchristosAC_SUBST([CONFIG_SHELL])		dnl for scripts #!/path/to/sh
141f003fb54Skardel
142f003fb54SkardelAC_ARG_WITH(
143f003fb54Skardel    [net-snmp-config],
144f003fb54Skardel    [AS_HELP_STRING(
145f003fb54Skardel	[--with-net-snmp-config],
146f003fb54Skardel	[+ =net-snmp-config]
147f003fb54Skardel    )],
148f003fb54Skardel    [ans=$withval],
149f003fb54Skardel    [ans=yes]
150f003fb54Skardel)
151abb0f93cSkardelcase "$ans" in
152f003fb54Skardel no)
153f003fb54Skardel    ;;
154abb0f93cSkardel yes)
155abb0f93cSkardel    ans=net-snmp-config
156abb0f93cSkardel    ;;
157f003fb54Skardel /*)
158f003fb54Skardel    ;;
159abb0f93cSkardel */*)
160abb0f93cSkardel    AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
161abb0f93cSkardel    ;;
162abb0f93cSkardel *)
163abb0f93cSkardel    ;;
164abb0f93cSkardelesac
165abb0f93cSkardelPROG_NET_SNMP_CONFIG=$ans
166abb0f93cSkardelcase "$PROG_NET_SNMP_CONFIG" in
167abb0f93cSkardel no) ;;
168abb0f93cSkardel /*)
169abb0f93cSkardel    PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
170abb0f93cSkardel    ;;
171f003fb54Skardel *)
172f003fb54Skardel    AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
1738585484eSchristos    AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
174abb0f93cSkardel;;
175abb0f93cSkardelesac
1763e3909feSchristosAC_MSG_CHECKING([for net-snmp-config path])
177abb0f93cSkardelAC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
178abb0f93cSkardel
179f17b710fSchristoscase "$PATH_NET_SNMP_CONFIG" in
180f17b710fSchristos /*)	AC_CACHE_CHECK(
181f17b710fSchristos	    [for net-snmp version],
182f17b710fSchristos	    [ntp_cv_net_snmp_version],
183f17b710fSchristos	    [ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
184f17b710fSchristos	)
185f17b710fSchristos	;;
186f17b710fSchristosesac
187f17b710fSchristos
188abb0f93cSkardelcase "$host" in
189abb0f93cSkardel *-*-vxworks*)
190abb0f93cSkardel    ac_link="$ac_link $VX_KERNEL"
191abb0f93cSkardel    ;;
192abb0f93cSkardelesac
193abb0f93cSkardel
1948585484eSchristos# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
1958585484eSchristosAC_SEARCH_LIBS([openlog], [gen syslog])
1968585484eSchristos# XXX library list will be in ac_cv_search_openlog
197abb0f93cSkardel
198b8ecfcfeSchristos# LIBSECCOMP is off by default -- needs testing with all the features
199b8ecfcfeSchristos# Please send bug reports to loganaden@gmail.com
200b8ecfcfeSchristosAC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
201b8ecfcfeSchristosAC_ARG_ENABLE(
202b8ecfcfeSchristos    [libseccomp],
203b8ecfcfeSchristos    [AS_HELP_STRING(
204b8ecfcfeSchristos	[--enable-libseccomp],
205b8ecfcfeSchristos	[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
206b8ecfcfeSchristos    )],
207b8ecfcfeSchristos    [ntp_ok=$enableval],
208b8ecfcfeSchristos    [ntp_ok=no]
209b8ecfcfeSchristos)
210b8ecfcfeSchristosAC_MSG_RESULT([$ntp_ok])
211b8ecfcfeSchristoscase "$ntp_ok" in
212b8ecfcfeSchristos yes)
213b8ecfcfeSchristos    AC_SEARCH_LIBS(
214b8ecfcfeSchristos	[seccomp_init],
215b8ecfcfeSchristos	[seccomp],
216b8ecfcfeSchristos	[AC_DEFINE([LIBSECCOMP], [1],
217b8ecfcfeSchristos	    [Define to any value to include libseccomp sandboxing.])]
218b8ecfcfeSchristos    )
219b8ecfcfeSchristos    AC_TRY_RUN([
220b8ecfcfeSchristos	#include <stdio.h>
221b8ecfcfeSchristos	#include <stdlib.h>
222b8ecfcfeSchristos	#include <errno.h>
223b8ecfcfeSchristos	#include <sys/prctl.h>
224b8ecfcfeSchristos	#include <linux/seccomp.h>
225b8ecfcfeSchristos
226b8ecfcfeSchristos	int main(void)
227b8ecfcfeSchristos	{
228b8ecfcfeSchristos		int ret;
229b8ecfcfeSchristos		ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
230b8ecfcfeSchristos		if (ret < 0) {
231b8ecfcfeSchristos			switch (errno) {
232b8ecfcfeSchristos			case ENOSYS:
233b8ecfcfeSchristos				return 1;
234b8ecfcfeSchristos			case EINVAL:
235b8ecfcfeSchristos				return 1;
236b8ecfcfeSchristos			default:
237b8ecfcfeSchristos				return 1;
238b8ecfcfeSchristos			}
239b8ecfcfeSchristos		}
240b8ecfcfeSchristos		ret =
241b8ecfcfeSchristos		prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
242b8ecfcfeSchristos		if (ret < 0) {
243b8ecfcfeSchristos			switch (errno) {
244b8ecfcfeSchristos			case EINVAL:
245b8ecfcfeSchristos				return 1;
246b8ecfcfeSchristos			case EFAULT:
247b8ecfcfeSchristos				return 0;
248b8ecfcfeSchristos			default:
249b8ecfcfeSchristos				return 1;
250b8ecfcfeSchristos		}
251b8ecfcfeSchristos	}
252b8ecfcfeSchristosreturn 1;
253b8ecfcfeSchristos}
254b8ecfcfeSchristos]
255b8ecfcfeSchristos, AC_DEFINE([KERN_SECCOMP], 1,
256b8ecfcfeSchristos[Define to use libseccomp system call filtering.])
257b8ecfcfeSchristos, []
258b8ecfcfeSchristos)
259b8ecfcfeSchristos    ;;
260b8ecfcfeSchristosesac
261b8ecfcfeSchristos
2628585484eSchristosNTP_FACILITYNAMES
263abb0f93cSkardel
264abb0f93cSkardeldnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
265abb0f93cSkardeldnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
266abb0f93cSkardeldnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
267abb0f93cSkardeldnl does Strange Things with extra processes using the Posix-compatibility
268abb0f93cSkardeldnl real-time library, so we don't want to use it.
269abb0f93cSkardeldnl
270abb0f93cSkardeldnl 081118 Harlan got tired of looking for a way to get the sched*()
271abb0f93cSkardeldnl functions to link OK with either cc or gcc.
272abb0f93cSkardel
273abb0f93cSkardelcase "$host" in
274abb0f93cSkardel *-*-*linux*) ;;
275abb0f93cSkardel *-*-osf4*) ;;
276abb0f93cSkardel *-*-osf5*) ;;
277abb0f93cSkardel *)
2788585484eSchristos    # HMS: Make sure we check for -lrt for clock_* before this...
2798585484eSchristos    case "$ac_cv_search_clock_gettime" in
280*eabc0478Schristos     '') AC_MSG_FAILURE([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
2818585484eSchristos    esac
2828585484eSchristos    AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
283abb0f93cSkardel    ;;
284abb0f93cSkardelesac
285abb0f93cSkardel
286*eabc0478SchristosAC_CHECK_HEADERS([bstring.h sys/procctl.h])
287f003fb54SkardelAC_CHECK_HEADER(
288f003fb54Skardel    [dns_sd.h],
2898585484eSchristos    [AC_SEARCH_LIBS(
290f003fb54Skardel	[DNSServiceRegister],
2918585484eSchristos	[dns_sd],
292f003fb54Skardel	[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
293f003fb54Skardel	    [Use Rendezvous/DNS-SD registration])]
294f003fb54Skardel    )]
295f003fb54Skardel)
296b8ecfcfeSchristosAC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
297abb0f93cSkardel
298f003fb54SkardelAC_CHECK_HEADERS([memory.h netdb.h poll.h])
299ae49d4a4SchristosAC_CHECK_HEADERS([sgtty.h stdatomic.h])
300ae49d4a4SchristosAC_HEADER_STDBOOL
301ae49d4a4SchristosAC_CHECK_HEADERS([stdlib.h string.h termio.h])
302f003fb54SkardelAC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
303abb0f93cSkardel
304abb0f93cSkardelcase "$host" in
305abb0f93cSkardel *-*-aix*)
306f003fb54Skardel    AC_CHECK_HEADERS([utmpx.h])
307abb0f93cSkardel    case "$ac_cv_header_utmpx_h" in
308f003fb54Skardel     yes)
309f003fb54Skardel	;;
310f003fb54Skardel     *)
311f003fb54Skardel	AC_CHECK_HEADERS([utmp.h])
312f003fb54Skardel	;;
313abb0f93cSkardel    esac
314abb0f93cSkardel    ;;
315f003fb54Skardel *)
316f003fb54Skardel    AC_CHECK_HEADERS([utmp.h utmpx.h])
317f003fb54Skardel    ;;
318abb0f93cSkardelesac
319abb0f93cSkardel
320abb0f93cSkardel#
321abb0f93cSkardel# On Suns only (so far) getpass() truncates the typed password to 8
322abb0f93cSkardel# characters, but getpassphrase() allows up to 257.  Most systems'
323abb0f93cSkardel# getpass() does not truncate, at least not so as to affect ntpq and
324abb0f93cSkardel# ntpdc password prompts.
325abb0f93cSkardel#
326abb0f93cSkardel# So check for getpassphrase(), but only on Sun operating systems.
327abb0f93cSkardel#
328abb0f93cSkardelcase "$host" in
329abb0f93cSkardel *-*-sunos*|*-*-solaris*)
330f003fb54Skardel    AC_CHECK_FUNCS([getpassphrase])
331abb0f93cSkardelesac
332abb0f93cSkardel
333f003fb54Skardel
334f003fb54SkardelAC_CHECK_HEADERS([net/if6.h])
335f003fb54SkardelAC_CHECK_HEADERS([net/route.h], [], [], [
336abb0f93cSkardel    #include <sys/types.h>
337abb0f93cSkardel    #include <sys/socket.h>
338abb0f93cSkardel    #include <net/if.h>
339abb0f93cSkardel])
340abb0f93cSkardel
341f003fb54SkardelAC_CHECK_HEADERS([netinfo/ni.h])
342f003fb54Skardelcase "$ac_cv_header_netinfo_ni_h" in
343f003fb54Skardel yes)
344f003fb54Skardel    AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
345f003fb54Skardelesac
3468585484eSchristosAC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
347abb0f93cSkardelcase "$host" in
348f003fb54Skardel *-*-sunos4*)
349f003fb54Skardel    ;;
350f003fb54Skardel *)
351f003fb54Skardel    AC_CHECK_HEADERS([sys/ioctl.h])
352abb0f93cSkardel    ;;
353abb0f93cSkardelesac
354f003fb54SkardelAC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
355abb0f93cSkardel# HMS: Check sys/proc.h and sys/resource.h after some others
3568585484eSchristosAC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
357abb0f93cSkardelcase "$ac_cv_header_sched_h" in
358f003fb54Skardel yes)
359f003fb54Skardel    ;;
360f003fb54Skardel *)
361f003fb54Skardel    AC_CHECK_HEADERS([sys/sched.h])
362f003fb54Skardel    ;;
363abb0f93cSkardelesac
364abb0f93cSkardel# HMS: Check sys/shm.h after some others
365f003fb54SkardelAC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
366abb0f93cSkardel# HMS: Checked sys/socket.h earlier
367abb0f93cSkardelcase "$host" in
368f003fb54Skardel *-*-netbsd*)
369f003fb54Skardel    ;;
370f003fb54Skardel *)
371f003fb54Skardel    AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
372abb0f93cSkardel    ;;
373abb0f93cSkardelesac
3748585484eSchristosAC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
3758585484eSchristosAC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
376cdfa2a7eSchristosAC_CHECK_FUNCS([waitpid])
377abb0f93cSkardelcase "$host" in
378abb0f93cSkardel*-convex-*)
379f003fb54Skardel    AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
380abb0f93cSkardel    ;;
381abb0f93cSkardel*-*-bsdi*)
382f003fb54Skardel    AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
383abb0f93cSkardel    ;;
384abb0f93cSkardelesac
385abb0f93cSkardel
386f17b710fSchristoscase "$ac_cv_header_stdatomic_h" in
387f17b710fSchristos yes)
388f17b710fSchristos	AC_CHECK_FUNCS([atomic_thread_fence])
389f17b710fSchristos	AC_CACHE_CHECK(
390f17b710fSchristos	    [for atomic_thread_fence()],
391f17b710fSchristos	    [ntp_cv_func_atomic_thread_fence],
392f17b710fSchristos	    [AC_COMPILE_IFELSE(
393f17b710fSchristos		[AC_LANG_PROGRAM(
394f17b710fSchristos		    [[
395f17b710fSchristos			#include <stdatomic.h>
396f17b710fSchristos		    ]],
397f17b710fSchristos		    [[
398f17b710fSchristos			atomic_thread_fence(memory_order_seq_cst);
399f17b710fSchristos		    ]]
400*eabc0478Schristos		)],
401f17b710fSchristos		[ntp_cv_func_atomic_thread_fence=yes],
402f17b710fSchristos		[ntp_cv_func_atomic_thread_fence=no]
403f17b710fSchristos	    )]
404f17b710fSchristos	)
405f17b710fSchristos    ;;
406f17b710fSchristosesac
407f17b710fSchristos
408abb0f93cSkardelcase "$host" in
4098585484eSchristos *-*-solaris2.6)
4108585484eSchristos    # Broken...
4118585484eSchristos    ;;
4128585484eSchristos *)
4138585484eSchristos    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
414abb0f93cSkardel    ;;
415abb0f93cSkardelesac
4168585484eSchristos
4178585484eSchristoscase "$host" in
4188585484eSchristos *-*-*linux*)
4198585484eSchristos    case "$ac_cv_func_ntp_gettime" in
420f003fb54Skardel     yes)
421f003fb54Skardel	;;
422abb0f93cSkardel     *)
4238585484eSchristos	AC_CHECK_FUNCS([__ntp_gettime])
4248585484eSchristos	case "$ac_cv_func___ntp_gettime" in
4258585484eSchristos	 yes)
4268585484eSchristos	    AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
4278585484eSchristos		    AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
4288585484eSchristos	esac
4298585484eSchristos	;;
4308585484eSchristos    esac
4318585484eSchristos    AC_CHECK_FUNCS([adjtimex])
4328585484eSchristos    case "$ac_cv_func_adjtimex" in
4338585484eSchristos     yes)
4348585484eSchristos	AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
4358585484eSchristos	AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
4368585484eSchristos	have_adjtimex=1
4378585484eSchristos	;;
4388585484eSchristos     *)
4398585484eSchristos	AC_CHECK_FUNCS([__adjtimex])
4408585484eSchristos	case "$ac_cv_func___adjtimex" in
4418585484eSchristos	 yes)
4428585484eSchristos	    AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
4438585484eSchristos	    AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
4448585484eSchristos	    AC_DEFINE([adjtimex], [__adjtimex], [deviant])
4458585484eSchristos	    AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
4468585484eSchristos	    have_adjtimex=1
4478585484eSchristos	esac
4488585484eSchristos	;;
4498585484eSchristos    esac
4508585484eSchristosesac
4518585484eSchristoscase "$have_adjtimex" in
4528585484eSchristos '')
4538585484eSchristos    # nlist stuff is only needed for tickadj.
4548585484eSchristos    saved_LIBS="$LIBS"
4558585484eSchristos    LIBS=
4568585484eSchristos    AC_SEARCH_LIBS([nlist], [elf ld mld])
4578585484eSchristos    # XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
4588585484eSchristos    AC_SEARCH_LIBS([kvm_open], [kvm])	dnl We already know about -lelf here...
4598585484eSchristos    # XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
460f003fb54Skardel    AC_CHECK_HEADERS([nlist.h sys/var.h])
461f003fb54Skardel    case "$ac_cv_header_nlist_h" in
462f003fb54Skardel     yes)
463f003fb54Skardel	AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
464f003fb54Skardel	AC_CACHE_CHECK(
465f003fb54Skardel	    [for n_un in struct nlist],
466f003fb54Skardel	    [ntp_cv_struct_nlist_n_un],
467f003fb54Skardel	    [AC_COMPILE_IFELSE(
468f003fb54Skardel		[AC_LANG_PROGRAM(
469f003fb54Skardel		    [[
470f003fb54Skardel			#include <nlist.h>
471f003fb54Skardel		    ]],
472f003fb54Skardel		    [[
473f003fb54Skardel			struct nlist n;
474f003fb54Skardel			n.n_un.n_name = 0;
475f003fb54Skardel		    ]]
476*eabc0478Schristos		)],
477f003fb54Skardel		[ntp_cv_struct_nlist_n_un=yes],
478f003fb54Skardel		[ntp_cv_struct_nlist_n_un=no]
479f003fb54Skardel	    )]
480f003fb54Skardel	)
481f003fb54Skardel	case "$ntp_cv_struct_nlist_n_un" in
482f003fb54Skardel	 yes)
483f003fb54Skardel	    AC_DEFINE([NLIST_NAME_UNION], [1],
484f003fb54Skardel		[does struct nlist use a name union?])
485f003fb54Skardel	esac
4868585484eSchristos    esac
4878585484eSchristos    AC_SUBST([LDADD_NLIST])
4888585484eSchristos    LDADD_NLIST="$LIBS"
4898585484eSchristos    LIBS="$saved_LIBS"
4908585484eSchristos    AS_UNSET([saved_LIBS])
491abb0f93cSkardelesac
492abb0f93cSkardel
4938585484eSchristosAC_CHECK_HEADERS([sys/proc.h], [], [], [
4948585484eSchristos    #ifdef HAVE_SYS_TYPES_H
495abb0f93cSkardel    # include <sys/types.h>
496abb0f93cSkardel    #endif
497f003fb54Skardel    #ifdef HAVE_SYS_TIME_H
498abb0f93cSkardel    # include <sys/time.h>
499abb0f93cSkardel    #endif
500abb0f93cSkardel])
501abb0f93cSkardel
5028585484eSchristosAC_CHECK_HEADERS([sys/resource.h], [], [], [
5038585484eSchristos    #ifdef HAVE_SYS_TIME_H
504abb0f93cSkardel    # include <sys/time.h>
505abb0f93cSkardel    #endif
506abb0f93cSkardel])
507abb0f93cSkardel
5088585484eSchristosAC_CHECK_HEADERS([sys/shm.h], [], [], [
5098585484eSchristos    #ifdef HAVE_SYS_TYPES_H
510abb0f93cSkardel    # include <sys/types.h>
511abb0f93cSkardel    #endif
512f003fb54Skardel    #ifdef HAVE_SYS_IPC_H
513abb0f93cSkardel    # include <sys/ipc.h>
514abb0f93cSkardel    #endif
515abb0f93cSkardel])
516abb0f93cSkardel
5178585484eSchristosAC_CHECK_HEADERS([sys/timex.h], [], [], [
5188585484eSchristos    #ifdef HAVE_SYS_TIME_H
519abb0f93cSkardel    # include <sys/time.h>
520abb0f93cSkardel    #endif
521abb0f93cSkardel])
522abb0f93cSkardel
52356f2724eSchristosNTP_AF_UNSPEC
52456f2724eSchristos
525abb0f93cSkardelAC_TYPE_SIGNAL
526abb0f93cSkardelAC_TYPE_OFF_T
5278585484eSchristosAC_STRUCT_TM	dnl defines TM_IN_SYS_TIME used by refclock_parse.c
528abb0f93cSkardel
529f003fb54SkardelAC_CACHE_CHECK(
530f003fb54Skardel    [for a fallback value for HZ],
531f003fb54Skardel    [ntp_cv_default_hz],
532f003fb54Skardel    [
533f003fb54Skardel	ntp_cv_default_hz=100
534abb0f93cSkardel	case "$host" in
535abb0f93cSkardel	 alpha*-dec-osf4*|alpha*-dec-osf5*)
536f003fb54Skardel	    ntp_cv_default_hz=1024
537abb0f93cSkardel	    ;;
538abb0f93cSkardel	 mips-dec-ultrix4*)
539f003fb54Skardel	    ntp_cv_default_hz=256
540abb0f93cSkardel	    ;;
541f003fb54Skardel	esac
542f003fb54Skardel    ]
543f003fb54Skardel)
544f003fb54SkardelAC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
545f003fb54Skardel    [What is the fallback value for HZ?])
546abb0f93cSkardel
547f003fb54SkardelAC_CACHE_CHECK(
548f003fb54Skardel    [if we need to override the system's value for HZ],
549f003fb54Skardel    [ntp_cv_override_hz],
550f003fb54Skardel    [
551f003fb54Skardel	ntp_cv_override_hz=no
552abb0f93cSkardel	case "$host" in
553abb0f93cSkardel	 alpha*-dec-osf4*|alpha*-dec-osf5*)
554f003fb54Skardel	    ntp_cv_override_hz=yes
555abb0f93cSkardel	    ;;
556abb0f93cSkardel	 mips-dec-ultrix4*)
557f003fb54Skardel	    ntp_cv_override_hz=yes
558abb0f93cSkardel	    ;;
559abb0f93cSkardel	 *-*-freebsd*)
560f003fb54Skardel	    ntp_cv_override_hz=yes
561abb0f93cSkardel	    ;;
562abb0f93cSkardel	 *-*-sunos4*)
563f003fb54Skardel	    ntp_cv_override_hz=yes
564abb0f93cSkardel	    ;;
565f003fb54Skardel	 *-*-kfreebsd*)
566f003fb54Skardel	    ntp_cv_override_hz=yes
567f003fb54Skardel	    ;;
568f003fb54Skardel	esac
569f003fb54Skardel    ]
570f003fb54Skardel)
571f003fb54Skardelcase "$ntp_cv_override_hz" in
572abb0f93cSkardel yes)
573f003fb54Skardel    AC_DEFINE([OVERRIDE_HZ], [1],
574f003fb54Skardel	[Do we need to override the system's idea of HZ?])
575abb0f93cSkardelesac
576abb0f93cSkardel
577abb0f93cSkardeldnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
578abb0f93cSkardeldnl [AC_TRY_LINK([#include <sys/types.h>
579abb0f93cSkardeldnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
580abb0f93cSkardeldnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
581abb0f93cSkardeldnl if test $su_cv_func_ut_host_in_utmp = yes; then
582abb0f93cSkardeldnl   AC_DEFINE(HAVE_UT_HOST)
583abb0f93cSkardeldnl fi
584abb0f93cSkardel
585abb0f93cSkardeldnl AC_MSG_CHECKING(if we can get the system boot time)
586abb0f93cSkardeldnl AC_CACHE_VAL(su_cv_have_boot_time,
587abb0f93cSkardeldnl [AC_EGREP_CPP(yes,
588abb0f93cSkardeldnl [#ifdef HAVE_UTMPX_H
589abb0f93cSkardeldnl #include <utmpx.h>
590abb0f93cSkardeldnl #else
591abb0f93cSkardeldnl #include <utmp.h>
592abb0f93cSkardeldnl #endif
593abb0f93cSkardeldnl #ifdef BOOT_TIME
594abb0f93cSkardeldnl yes
595abb0f93cSkardeldnl #endif
596abb0f93cSkardeldnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
597abb0f93cSkardeldnl AC_MSG_RESULT($su_cv_have_boot_time)
598abb0f93cSkardel
599f003fb54SkardelAC_CACHE_CHECK(
600f003fb54Skardel    [for struct rt_msghdr],
601f003fb54Skardel    [ntp_cv_struct_rt_msghdr],
602f003fb54Skardel    [AC_COMPILE_IFELSE(
603f003fb54Skardel	[AC_LANG_PROGRAM(
604f003fb54Skardel	    [[
605abb0f93cSkardel		#include <sys/types.h>
606abb0f93cSkardel		#include <sys/socket.h>
607abb0f93cSkardel		#include <net/if.h>
608f003fb54Skardel		#include <net/route.h>
609f003fb54Skardel	    ]],
610f003fb54Skardel	    [[
611f003fb54Skardel		struct rt_msghdr p;
612f003fb54Skardel	    ]]
613f003fb54Skardel	)],
614f003fb54Skardel	[ntp_cv_struct_rt_msghdr=yes],
615f003fb54Skardel	[ntp_cv_struct_rt_msghdr=no]
616f003fb54Skardel    )]
617f003fb54Skardel)
618abb0f93cSkardel
619f003fb54SkardelAC_CACHE_CHECK(
620f003fb54Skardel    [for struct rtattr],
621f003fb54Skardel    [ntp_cv_rtattr],
622f003fb54Skardel    [AC_COMPILE_IFELSE(
623f003fb54Skardel	[AC_LANG_PROGRAM(
624f003fb54Skardel	    [[
625f003fb54Skardel		#include <stddef.h>
626f003fb54Skardel		#include <sys/socket.h>
627f003fb54Skardel		#include <linux/rtnetlink.h>
628f003fb54Skardel	    ]],
629f003fb54Skardel	    [[
630f003fb54Skardel		struct rtattr p;
631f003fb54Skardel	    ]]
632f003fb54Skardel	)],
633f003fb54Skardel	[ntp_cv_rtattr=yes],
634f003fb54Skardel	[ntp_cv_rtattr=no]
635f003fb54Skardel    )]
636f003fb54Skardel)
637abb0f93cSkardel
638f003fb54Skardelcase "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
639f003fb54Skardel *yes*)
640f003fb54Skardel    AC_DEFINE([HAS_ROUTING_SOCKET], [1],
641f003fb54Skardel	[Do we have a routing socket (rt_msghdr or rtattr)?])
642f003fb54Skardel    case "$ntp_cv_rtattr" in
643f003fb54Skardel     yes)
644f003fb54Skardel	AC_DEFINE([HAVE_RTNETLINK], [1],
645f003fb54Skardel	    [Do we have Linux routing socket?])
646f003fb54Skardel    esac
647f003fb54Skardelesac
648abb0f93cSkardel
649abb0f93cSkardelAC_CACHE_CHECK(
650abb0f93cSkardel    [struct sigaction for sa_sigaction],
651f003fb54Skardel    [ntp_cv_struct_sigaction_has_sa_sigaction],
652f003fb54Skardel    [AC_COMPILE_IFELSE(
653f003fb54Skardel	[AC_LANG_PROGRAM(
654f003fb54Skardel	    [[
655f003fb54Skardel		#include <signal.h>
656f003fb54Skardel	    ]],
657f003fb54Skardel	    [[
658f003fb54Skardel		struct sigaction act;
659f003fb54Skardel		act.sa_sigaction = 0;
660f003fb54Skardel	    ]]
661f003fb54Skardel	)],
662f003fb54Skardel	[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
663f003fb54Skardel	[ntp_cv_struct_sigaction_has_sa_sigaction=no]
664f003fb54Skardel    )]
665abb0f93cSkardel)
666f003fb54Skardelcase "$ntp_cv_struct_sigaction_has_sa_sigaction" in
667f003fb54Skardel yes)
668f003fb54Skardel    AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
669f003fb54Skardelesac
670abb0f93cSkardel
671f003fb54SkardelAC_CACHE_CHECK(
672f003fb54Skardel    [for struct ppsclockev],
673f003fb54Skardel    [ntp_cv_struct_ppsclockev],
674f003fb54Skardel    [AC_COMPILE_IFELSE(
675f003fb54Skardel	[AC_LANG_PROGRAM(
676f003fb54Skardel	    [[
677f003fb54Skardel		#ifdef HAVE_SYS_TYPES_H
678abb0f93cSkardel		# include <sys/types.h>
679f003fb54Skardel		#endif
680abb0f93cSkardel		#ifdef HAVE_SYS_TERMIOS_H
681abb0f93cSkardel		# include <sys/termios.h>
682abb0f93cSkardel		#endif
683abb0f93cSkardel		#ifdef HAVE_SYS_TIME_H
684abb0f93cSkardel		# include <sys/time.h>
685abb0f93cSkardel		#endif
686abb0f93cSkardel		#ifdef HAVE_SYS_PPSCLOCK_H
687abb0f93cSkardel		# include <sys/ppsclock.h>
688f003fb54Skardel		#endif
689f003fb54Skardel	    ]],
690f003fb54Skardel	    [[
691abb0f93cSkardel		extern struct ppsclockev *pce;
692f003fb54Skardel		return pce->serial;
693f003fb54Skardel	    ]]
694f003fb54Skardel	)],
695f003fb54Skardel	[ntp_cv_struct_ppsclockev=yes],
696f003fb54Skardel	[ntp_cv_struct_ppsclockev=no]
697f003fb54Skardel    )]
698f003fb54Skardel)
699f003fb54Skardelcase "$ntp_cv_struct_ppsclockev" in
700f003fb54Skardel yes)
701f003fb54Skardel    AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
702f003fb54Skardel	[Does a system header define struct ppsclockev?])
703f003fb54Skardelesac
704abb0f93cSkardel
705abb0f93cSkardelcase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
706abb0f93cSkardel  *yes*)
707f003fb54Skardel    AC_CACHE_CHECK(
708f003fb54Skardel	[for struct snd_size],
709f003fb54Skardel	[ntp_cv_struct_snd_size],
710f003fb54Skardel	[AC_COMPILE_IFELSE(
711f003fb54Skardel	    [AC_LANG_PROGRAM(
712f003fb54Skardel		[[
713abb0f93cSkardel		    #ifdef HAVE_MACHINE_SOUNDCARD_H
714abb0f93cSkardel		    # include <machine/soundcard.h>
715abb0f93cSkardel		    #endif
716abb0f93cSkardel		    #ifdef HAVE_SYS_SOUNDCARD_H
717abb0f93cSkardel		    # include <sys/soundcard.h>
718f003fb54Skardel		    #endif
719f003fb54Skardel		]],
720f003fb54Skardel		[[
721abb0f93cSkardel		    extern struct snd_size *ss;
722f003fb54Skardel		    return ss->rec_size;
723f003fb54Skardel		]]
724f003fb54Skardel	    )],
725f003fb54Skardel	    [ntp_cv_struct_snd_size=yes],
726f003fb54Skardel	    [ntp_cv_struct_snd_size=no]
727f003fb54Skardel        )]
728f003fb54Skardel    )
729f003fb54Skardel    case "$ntp_cv_struct_snd_size" in
730f003fb54Skardel     yes)
731f003fb54Skardel	AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
732f003fb54Skardel	    [Do we have struct snd_size?])
733abb0f93cSkardel    esac
734abb0f93cSkardelesac
735abb0f93cSkardel
736f003fb54SkardelAC_CACHE_CHECK(
737f003fb54Skardel    [struct clockinfo for hz],
738f003fb54Skardel    [ntp_cv_struct_clockinfo_has_hz],
739f003fb54Skardel    [AC_COMPILE_IFELSE(
740f003fb54Skardel	[AC_LANG_PROGRAM(
741f003fb54Skardel	    [[
742abb0f93cSkardel		#include <sys/time.h>
743f003fb54Skardel	    ]],
744f003fb54Skardel	    [[
745f003fb54Skardel		extern struct clockinfo *pc;
746f003fb54Skardel		return pc->hz;
747f003fb54Skardel	    ]]
748f003fb54Skardel	)],
749f003fb54Skardel	[ntp_cv_struct_clockinfo_has_hz=yes],
750f003fb54Skardel	[ntp_cv_struct_clockinfo_has_hz=no]
751f003fb54Skardel    )]
752f003fb54Skardel)
753f003fb54Skardelcase "$ntp_cv_struct_clockinfo_has_hz" in
754f003fb54Skardel yes)
755f003fb54Skardel    AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
756f003fb54Skardelesac
757f003fb54Skardel
758f003fb54SkardelAC_CACHE_CHECK(
759f003fb54Skardel    [struct clockinfo for tickadj],
760f003fb54Skardel    [ntp_cv_struct_clockinfo_has_hz],
761f003fb54Skardel    [AC_COMPILE_IFELSE(
762f003fb54Skardel	[AC_LANG_PROGRAM(
763f003fb54Skardel	    [[
764f003fb54Skardel		#include <sys/time.h>
765f003fb54Skardel	    ]],
766f003fb54Skardel	    [[
767f003fb54Skardel		extern struct clockinfo *pc;
768f003fb54Skardel		return pc->tickadj;
769f003fb54Skardel	    ]]
770f003fb54Skardel	)],
771f003fb54Skardel	[ntp_cv_struct_clockinfo_has_hz=yes],
772f003fb54Skardel	[ntp_cv_struct_clockinfo_has_hz=no]
773f003fb54Skardel    )]
774f003fb54Skardel)
775f003fb54Skardelcase "$ntp_cv_struct_clockinfo_has_hz" in
776f003fb54Skardel yes)
777f003fb54Skardel    AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
778f003fb54Skardelesac
779f003fb54Skardel
780f003fb54Skardelcase "$ntp_cv_struct_ntptimeval" in
781f003fb54Skardel yes)
782f003fb54Skardel    AC_CHECK_MEMBERS(
783f003fb54Skardel	[struct ntptimeval.time.tv_nsec],
784f003fb54Skardel	[],
785f003fb54Skardel	[],
786f003fb54Skardel	[
787f003fb54Skardel	    #ifdef HAVE_SYS_TIME_H
788abb0f93cSkardel	    # include <sys/time.h>
789abb0f93cSkardel	    #else
790abb0f93cSkardel	    # ifdef HAVE_TIME_H
791abb0f93cSkardel	    #  include <time.h>
792abb0f93cSkardel	    # endif
793abb0f93cSkardel	    #endif
794abb0f93cSkardel	    #ifdef HAVE_SYS_TIMEX_H
795abb0f93cSkardel	    # include <sys/timex.h>
796abb0f93cSkardel	    #else
797abb0f93cSkardel	    # ifdef HAVE_TIMEX_H
798abb0f93cSkardel	    #  include <timex.h>
799abb0f93cSkardel	    # endif
800f003fb54Skardel	    #endif
801f003fb54Skardel	]
802f003fb54Skardel    )
803abb0f93cSkardelesac
804abb0f93cSkardel
8058585484eSchristos####
806f003fb54Skardel
807b5bbe2e3SchristosAC_CHECK_FUNCS([arc4random_buf])
808b5bbe2e3Schristos
809b5bbe2e3Schristos####
810b5bbe2e3Schristos
8118585484eSchristossaved_LIBS="$LIBS"
8128585484eSchristosLIBS="$LIBS $LDADD_LIBNTP"
813f003fb54SkardelAC_CHECK_FUNCS([daemon])
8148585484eSchristos# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
8158585484eSchristosLIBS="$saved_LIBS"
8168585484eSchristosAS_UNSET([saved_LIBS])
8178585484eSchristos
818f003fb54SkardelAC_CHECK_FUNCS(
819f003fb54Skardel    [finite],
820f003fb54Skardel    [],
821f003fb54Skardel    [AC_CHECK_FUNCS(
822f003fb54Skardel	[isfinite],
823f003fb54Skardel	[],
824f003fb54Skardel	[
825f003fb54Skardel	    AC_MSG_CHECKING([for isfinite with <math.h>])
826abb0f93cSkardel	    _libs=$LIBS
8278585484eSchristos	    # XXX
828abb0f93cSkardel	    LIBS="$LIBS -lm"
829f003fb54Skardel	    AC_LINK_IFELSE(
830f003fb54Skardel		[AC_LANG_PROGRAM(
831f003fb54Skardel		    [[
832f003fb54Skardel			#include <math.h>
833f003fb54Skardel		    ]],
834f003fb54Skardel		    [[
835f003fb54Skardel			float f = 0.0;
836f003fb54Skardel			isfinite(f);
837f003fb54Skardel		    ]]
838f003fb54Skardel		)],
839f003fb54Skardel		[ans=yes],
840f003fb54Skardel		[ans=no]
841f003fb54Skardel	    )
842f003fb54Skardel	    LIBS=$_libs
843f003fb54Skardel	    AC_MSG_RESULT([$ans])
844f003fb54Skardel	    case "$ans" in
845f003fb54Skardel	     yes)
846f003fb54Skardel		AC_DEFINE([HAVE_ISFINITE], [1])
847f003fb54Skardel	    esac
848f003fb54Skardel	]
849f003fb54Skardel    )]
850f003fb54Skardel)
851abb0f93cSkardel
852*eabc0478SchristosAC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal ]dnl
853*eabc0478Schristos	       [strsignal closefrom getdtablesize])
854*eabc0478Schristos
855f003fb54Skardel
8568585484eSchristos# kvm_open() is only used by tickadj.  Also see above.
857abb0f93cSkardelcase "$ac_cv_header_kvm_h" in
858abb0f93cSkardel yes)
859f003fb54Skardel    AC_CHECK_FUNCS([kvm_open])
860abb0f93cSkardel    ;;
861abb0f93cSkardelesac
862f003fb54Skardel
863abb0f93cSkardelcase "$host" in
864abb0f93cSkardel *-*-sco3.2v5.0.*)
8658585484eSchristos    # Just stubs.  Sigh.
866abb0f93cSkardel    ;;
867f003fb54Skardel *) AC_CHECK_FUNCS([mkstemp])
868abb0f93cSkardel    ;;
869abb0f93cSkardelesac
870f003fb54SkardelAC_CHECK_FUNCS([mktime])
871abb0f93cSkardelcase "$host" in
8728585484eSchristos *-*-aix[[4-9]]*)
8738585484eSchristos    # XXX only verified thru AIX6.
8748585484eSchristos    # Just a stub.  Sigh.
875abb0f93cSkardel    ;;
876abb0f93cSkardel *-*-irix[[45]]*)
8778585484eSchristos    # Just a stub in "old" Irix.  Sigh.
878abb0f93cSkardel    ;;
8798585484eSchristos# In the belief that the fix for bug 1223 fixes mlockall() under linux...
8808585484eSchristos# *-*-*linux*)
8818585484eSchristos#    # there, but more trouble than it is worth for now (resolver problems)
8828585484eSchristos#    ;;
883abb0f93cSkardel *-*-qnx*)
8848585484eSchristos    # Apparently there but not working in QNX.  Sigh?
885abb0f93cSkardel    ;;
886abb0f93cSkardel *-*-sco3.2v5.0.*)
8878585484eSchristos    # Just a stub.  Sigh.
888abb0f93cSkardel    ;;
889abb0f93cSkardel alpha*-dec-osf4*|alpha*-dec-osf5*)
890abb0f93cSkardel    # mlockall is there, as a #define calling memlk via <sys/mman.h>
891abb0f93cSkardel    # Not easy to test for - cheat.
892f003fb54Skardel    AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
893f003fb54Skardel    AC_CHECK_FUNCS([mlockall])
894abb0f93cSkardel    ;;
895f003fb54Skardel *) AC_CHECK_FUNCS([mlockall])
896abb0f93cSkardel    ;;
897abb0f93cSkardelesac
8988585484eSchristosAC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
899*eabc0478SchristosNTP_FUNC_REALPATH
900abb0f93cSkardelcase "$host" in
9018585484eSchristos *-*-aix[[4-9]]*)
9028585484eSchristos    # XXX only verified thru AIX6.
9038585484eSchristos    # Just a stub in AIX 4.  Sigh.
904abb0f93cSkardel    ;;
905abb0f93cSkardel *-*-solaris2.5*)
9068585484eSchristos    # Just stubs in solaris2.5.  Sigh.
907abb0f93cSkardel    ;;
908f003fb54Skardel *) AC_CHECK_FUNCS([sched_setscheduler])
909abb0f93cSkardel    ;;
910abb0f93cSkardelesac
9118585484eSchristosAC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
91250c1baceSchristosAC_CHECK_FUNCS([strdup strnlen memchr strerror setrlimit strchr])
913abb0f93cSkardelcase "$host" in
9148585484eSchristos *-*-aix[[4-9]]*)
9158585484eSchristos    # XXX only verified thru AIX6.
9168585484eSchristos    # Just stubs.  Sigh.
917abb0f93cSkardel    ;;
918abb0f93cSkardel *-*-netbsd1*)
9198585484eSchristos    # Just stubs.  Sigh.
920abb0f93cSkardel    ;;
921abb0f93cSkardel *-*-netbsdelf1*)
9228585484eSchristos    # Just stubs.  Sigh.
923abb0f93cSkardel    ;;
924abb0f93cSkardel *-*-openbsd*)
9258585484eSchristos    # Just stubs.  Sigh.
926abb0f93cSkardel    ;;
9278585484eSchristos *)
9288585484eSchristos    AC_CHECK_FUNCS([timer_create])
929abb0f93cSkardel    ;;
930abb0f93cSkardelesac
9318585484eSchristos
9328585484eSchristosNTP_RLIMIT_ITEMS
9338585484eSchristos
9348585484eSchristos# some OSes prefer _exit() in forked children to exit()
9358585484eSchristosAC_CHECK_FUNCS([_exit])
9368585484eSchristosntp_worker_child_exit=exit
9378585484eSchristoscase "$ac_cv_func__exit::$host_os" in
9388585484eSchristos yes::netbsd*)
9398585484eSchristos    ntp_worker_child_exit=_exit
9408585484eSchristos    ;;
9418585484eSchristos yes::openbsd*)
9428585484eSchristos    ntp_worker_child_exit=_exit
9438585484eSchristos    ;;
9448585484eSchristosesac
9458585484eSchristosAC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
9468585484eSchristos		   [routine worker child proc uses to exit.])
9478585484eSchristos
9488585484eSchristosAC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
949abb0f93cSkardel
950abb0f93cSkardel###
951abb0f93cSkardel
952abb0f93cSkardel# http://bugs.ntp.org/737
953abb0f93cSkardelcase "$ac_cv_func_recvmsg" in
954abb0f93cSkardel yes)
955f003fb54Skardel    AC_CACHE_CHECK(
956f003fb54Skardel	[if we need extra help to define struct iovec],
957f003fb54Skardel	[ntp_cv_struct_iovec_help],
958f003fb54Skardel	[
959f003fb54Skardel	    compiled=no
960f003fb54Skardel	    for ntp_cv_struct_iovec_help in '0' '1'; do
961f003fb54Skardel		AC_COMPILE_IFELSE(
962f003fb54Skardel		    [AC_LANG_PROGRAM(
963f003fb54Skardel			[[
964f003fb54Skardel			    #ifdef HAVE_SYS_TYPES_H
965abb0f93cSkardel			    # include <sys/types.h>
966abb0f93cSkardel			    #endif
967abb0f93cSkardel			    #ifdef HAVE_SYS_SOCKET_H
968abb0f93cSkardel			    # include <sys/socket.h>
969abb0f93cSkardel			    #endif
970f003fb54Skardel			    #if $ntp_cv_struct_iovec_help
971abb0f93cSkardel			    # include <sys/uio.h>
972abb0f93cSkardel			    #endif
973f003fb54Skardel			]],
974f003fb54Skardel			[[
975f003fb54Skardel			    void foo(void) {
976abb0f93cSkardel				ssize_t x;
977abb0f93cSkardel				int s = 0;
978abb0f93cSkardel				struct iovec iov;
979abb0f93cSkardel				struct msghdr mh;
980abb0f93cSkardel				int flags = 0;
981abb0f93cSkardel
982abb0f93cSkardel				mh.msg_iov = &iov;
983abb0f93cSkardel				x = recvmsg(s, &mh, flags);
984f003fb54Skardel			    }
985f003fb54Skardel			]]
986f003fb54Skardel		    )],
987f003fb54Skardel		    [compiled=yes ; break 1],
988f003fb54Skardel		    []
989f003fb54Skardel		)
990abb0f93cSkardel	    done
991f003fb54Skardel	    case "$compiled" in
992f003fb54Skardel	     no)
993f003fb54Skardel		ntp_cv_struct_iovec_help=0
994abb0f93cSkardel	    esac
995f003fb54Skardel	    AS_UNSET([compiled])
996f003fb54Skardel	]
997f003fb54Skardel    )
998f003fb54Skardel    case "$ntp_cv_struct_iovec_help" in
999f003fb54Skardel     1)
1000f003fb54Skardel	AC_DEFINE([HAVE_SYS_UIO_H], [1],
1001f003fb54Skardel	    [Use sys/uio.h for struct iovec help])
1002f003fb54Skardel    esac
1003abb0f93cSkardelesac
1004abb0f93cSkardel
1005f003fb54SkardelAC_CACHE_CHECK(
1006f003fb54Skardel    [number of arguments taken by setpgrp()],
1007f003fb54Skardel    [ntp_cv_func_setpgrp_nargs],
1008f003fb54Skardel    [AC_COMPILE_IFELSE(
1009f003fb54Skardel	[AC_LANG_PROGRAM(
1010f003fb54Skardel	    [[
1011abb0f93cSkardel		#ifdef HAVE_SYS_TYPES_H
1012abb0f93cSkardel		# include <sys/types.h>
1013abb0f93cSkardel		#endif
1014abb0f93cSkardel		#ifdef HAVE_UNISTD_H
1015abb0f93cSkardel		# include <unistd.h>
1016abb0f93cSkardel		#endif
1017f003fb54Skardel	    ]],
1018f003fb54Skardel	    [[
1019f003fb54Skardel		setpgrp(0, 0);
1020f003fb54Skardel	    ]]
1021f003fb54Skardel	)],
1022f003fb54Skardel	[ntp_cv_func_setpgrp_nargs=2],
1023f003fb54Skardel	[ntp_cv_func_setpgrp_nargs=0]
1024f003fb54Skardel    )]
1025f003fb54Skardel)
1026f003fb54Skardelcase "$ntp_cv_func_setpgrp_nargs" in
1027f003fb54Skardel 0)
1028f003fb54Skardel    AC_DEFINE([HAVE_SETPGRP_0], [1],
1029f003fb54Skardel	      [define if setpgrp takes 0 arguments])
1030abb0f93cSkardelesac
1031abb0f93cSkardel
1032f003fb54SkardelAC_CACHE_CHECK(
1033f003fb54Skardel    [if we need to declare 'errno'],
1034f003fb54Skardel    [ntp_cv_decl_errno],
1035f003fb54Skardel    [AC_COMPILE_IFELSE(
1036f003fb54Skardel	[AC_LANG_PROGRAM(
1037f003fb54Skardel	    [[
1038f003fb54Skardel		#ifdef HAVE_ERRNO_H
1039abb0f93cSkardel		# include <errno.h>
1040f003fb54Skardel		#endif
1041f003fb54Skardel	    ]],
1042f003fb54Skardel	    [[
1043f003fb54Skardel		errno = 0;
1044f003fb54Skardel	    ]]
1045f003fb54Skardel	)],
1046f003fb54Skardel	[ntp_cv_decl_errno=no],
1047f003fb54Skardel	[ntp_cv_decl_errno=yes]
1048f003fb54Skardel    )]
1049f003fb54Skardel)
1050f003fb54Skardelcase "$ntp_cv_decl_errno" in
1051f003fb54Skardel yes)
1052f003fb54Skardel    AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1053abb0f93cSkardelesac
1054abb0f93cSkardel
1055abb0f93cSkardeldnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1056abb0f93cSkardeldnl MT purposes.  This makes the line "extern int h_errno" choke
1057abb0f93cSkardeldnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1058abb0f93cSkardeldnl without breaking any other platforms.
1059abb0f93cSkardeldnl
1060f003fb54SkardelAC_CACHE_CHECK(
1061f003fb54Skardel    [if we may declare 'h_errno'],
1062f003fb54Skardel    [ntp_cv_decl_h_errno],
1063f003fb54Skardel    [AC_COMPILE_IFELSE(
1064f003fb54Skardel	[AC_LANG_PROGRAM(
1065f003fb54Skardel	    [[
1066f003fb54Skardel		#include <sys/types.h>
1067abb0f93cSkardel		#ifdef HAVE_NETINET_IN_H
1068abb0f93cSkardel		# include <netinet/in.h>
1069abb0f93cSkardel		#endif
1070abb0f93cSkardel		#ifdef HAVE_ARPA_NAMESER_H
1071abb0f93cSkardel		# include <arpa/nameser.h>
1072abb0f93cSkardel		#endif
1073abb0f93cSkardel		#ifdef HAVE_NETDB_H
1074abb0f93cSkardel		# include <netdb.h>
1075abb0f93cSkardel		#endif
1076abb0f93cSkardel		#ifdef HAVE_RESOLV_H
1077abb0f93cSkardel		# include <resolv.h>
1078f003fb54Skardel		#endif
1079f003fb54Skardel	    ]],
1080f003fb54Skardel	    [[
1081f003fb54Skardel		extern int h_errno;
1082f003fb54Skardel	    ]]
1083f003fb54Skardel	)],
1084f003fb54Skardel	[ntp_cv_decl_h_errno=yes],
1085f003fb54Skardel	[ntp_cv_decl_h_errno=no]
1086f003fb54Skardel    )]
1087f003fb54Skardel)
1088f003fb54Skardelcase "$ntp_cv_decl_h_errno" in
1089f003fb54Skardel yes)
1090f003fb54Skardel    AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1091abb0f93cSkardelesac
1092abb0f93cSkardel
1093f003fb54SkardelAC_CACHE_CHECK(
1094f003fb54Skardel    [if declaring 'syscall()' is ok],
1095f003fb54Skardel    [ntp_cv_decl_syscall],
1096f003fb54Skardel    [AC_COMPILE_IFELSE(
1097f003fb54Skardel	[AC_LANG_PROGRAM(
1098f003fb54Skardel	    [[
1099abb0f93cSkardel		#ifdef HAVE_SYS_TYPES_H
1100abb0f93cSkardel		# include <sys/types.h>
1101abb0f93cSkardel		#endif
1102abb0f93cSkardel		#ifdef HAVE_UNISTD_H
1103abb0f93cSkardel		# include <unistd.h>
1104abb0f93cSkardel		#endif
1105f003fb54Skardel	    ]],
1106f003fb54Skardel	    [[
1107f003fb54Skardel		extern int syscall (int, ...);
1108f003fb54Skardel	    ]]
1109*eabc0478Schristos	)],
1110f003fb54Skardel	[ntp_cv_decl_syscall=yes],
1111f003fb54Skardel	[ntp_cv_decl_syscall=no]
1112f003fb54Skardel    )]
1113f003fb54Skardel)
1114f003fb54Skardelcase "$ntp_cv_decl_syscall" in
1115f003fb54Skardel yes)
1116f003fb54Skardel    AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1117abb0f93cSkardelesac
1118abb0f93cSkardel
1119abb0f93cSkardelcase "$host" in
1120abb0f93cSkardel *-*-aix4.3.*)
1121f003fb54Skardel    AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])		# Needed for XLC under AIX 4.3.2
1122abb0f93cSkardel    ;;
1123abb0f93cSkardel *-*-mpeix*)
1124f003fb54Skardel    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1125f003fb54Skardel    AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1126f003fb54Skardel    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1127f003fb54Skardel    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1128f003fb54Skardel    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1129f003fb54Skardel    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1130f003fb54Skardel    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1131abb0f93cSkardel    ;;
1132abb0f93cSkardel *-*-osf[[45]]*)
1133f003fb54Skardel    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1134f003fb54Skardel    AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1135abb0f93cSkardel    ;;
1136abb0f93cSkardel *-*-qnx*)
1137f003fb54Skardel    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1138abb0f93cSkardel    ;;
1139abb0f93cSkardel *-*-riscos4*)
1140f003fb54Skardel    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1141f003fb54Skardel    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1142f003fb54Skardel    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1143f003fb54Skardel    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1144f003fb54Skardel    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1145f003fb54Skardel    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1146f003fb54Skardel    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1147f003fb54Skardel    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1148f003fb54Skardel    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1149f003fb54Skardel    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1150f003fb54Skardel    AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1151f003fb54Skardel    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1152f003fb54Skardel    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1153f003fb54Skardel    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1154f003fb54Skardel    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1155f003fb54Skardel    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1156abb0f93cSkardel    ;;
1157abb0f93cSkardel *-*-solaris2*)
1158f003fb54Skardel    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1159f003fb54Skardel    AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1160abb0f93cSkardel    case "$host" in
1161abb0f93cSkardel     *-*-solaris2.4)
1162f003fb54Skardel        AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1163abb0f93cSkardel	;;
1164abb0f93cSkardel    esac
1165abb0f93cSkardel    ;;
1166abb0f93cSkardel *-*-sunos4*)
1167f003fb54Skardel    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1168f003fb54Skardel    AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1169f003fb54Skardel    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1170f003fb54Skardel    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1171f003fb54Skardel    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1172f003fb54Skardel    AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1173f003fb54Skardel    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1174f003fb54Skardel    AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1175f003fb54Skardel    AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1176f003fb54Skardel    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1177f003fb54Skardel    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1178f003fb54Skardel    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1179f003fb54Skardel    AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1180abb0f93cSkardel    case "`basename $ac_cv_prog_CC`" in
1181abb0f93cSkardel     acc*) ;;
1182f003fb54Skardel     *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1183abb0f93cSkardel	;;
1184abb0f93cSkardel    esac
1185f003fb54Skardel    AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1186f003fb54Skardel    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1187f003fb54Skardel    AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1188f003fb54Skardel    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1189f003fb54Skardel    AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1190f003fb54Skardel    AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1191f003fb54Skardel    AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1192abb0f93cSkardel    ;;
1193abb0f93cSkardel *-*-ultrix4*)
1194f003fb54Skardel    AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1195f003fb54Skardel    AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1196f003fb54Skardel    AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1197f003fb54Skardel    AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1198f003fb54Skardel    AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1199f003fb54Skardel    AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1200f003fb54Skardel    AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1201f003fb54Skardel    AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1202f003fb54Skardel    AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1203f003fb54Skardel    AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1204f003fb54Skardel    AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1205f003fb54Skardel    AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1206f003fb54Skardel    AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1207f003fb54Skardel    AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1208abb0f93cSkardel    ;;
1209abb0f93cSkardelesac
1210abb0f93cSkardel
1211abb0f93cSkardelcase "$host" in
1212abb0f93cSkardel *-*-sco3.2*)
1213f003fb54Skardel    AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1214f003fb54Skardel	[Do we need to #define _SVID3 when we #include <termios.h>?])
1215abb0f93cSkardel    ;;
1216abb0f93cSkardelesac
1217abb0f93cSkardel
1218abb0f93cSkardelcase "$host" in
1219abb0f93cSkardel *-*-hpux[[567]]*)
1220f003fb54Skardel    AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1221f003fb54Skardel	[Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1222abb0f93cSkardelesac
1223abb0f93cSkardel
1224f003fb54Skardeldnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1225f003fb54SkardelAC_CACHE_CHECK(
1226f003fb54Skardel    [if we will open the broadcast socket],
1227f003fb54Skardel    [ntp_cv_var_open_bcast_socket],
1228f003fb54Skardel    [
1229f003fb54Skardel	ans=yes
1230abb0f93cSkardel	case "$host" in
1231abb0f93cSkardel	 *-*-domainos)
1232abb0f93cSkardel	    ans=no
1233abb0f93cSkardel	esac
1234f003fb54Skardel	ntp_cv_var_open_bcast_socket=$ans
1235f003fb54Skardel    ]
1236f003fb54Skardel)
1237f003fb54Skardelcase "$ntp_cv_var_open_bcast_socket" in
1238f003fb54Skardel yes)
1239f003fb54Skardel    AC_DEFINE([OPEN_BCAST_SOCKET], [1],
1240f003fb54Skardel	[Should we open the broadcast socket?])
1241abb0f93cSkardelesac
1242abb0f93cSkardel
1243abb0f93cSkardelcase "$host" in
1244abb0f93cSkardel *-*-hpux*)
1245f003fb54Skardel    AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
1246f003fb54Skardel	[Do we want the HPUX FindConfig()?])
1247abb0f93cSkardelesac
1248abb0f93cSkardel
1249f003fb54Skardeldnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
1250f003fb54SkardelAC_CACHE_CHECK(
1251f003fb54Skardel    [if process groups are set with -pid],
1252f003fb54Skardel    [ntp_cv_arg_setpgrp_negpid],
1253f003fb54Skardel    [
1254f003fb54Skardel	case "$host" in
1255abb0f93cSkardel	 *-*-hpux[[567]]*)
1256abb0f93cSkardel	    ans=no
1257abb0f93cSkardel	    ;;
1258abb0f93cSkardel	 *-*-hpux*)
1259abb0f93cSkardel	    ans=yes
1260abb0f93cSkardel	    ;;
1261abb0f93cSkardel	 *-*-*linux*)
1262abb0f93cSkardel	    ans=yes
1263abb0f93cSkardel	    ;;
1264abb0f93cSkardel	 *-*-sunos3*)
1265abb0f93cSkardel	    ans=yes
1266abb0f93cSkardel	    ;;
1267abb0f93cSkardel	 *-*-ultrix2*)
1268abb0f93cSkardel	    ans=yes
1269abb0f93cSkardel	    ;;
1270abb0f93cSkardel	 *)
1271abb0f93cSkardel	    ans=no
1272abb0f93cSkardel	    ;;
1273abb0f93cSkardel	esac
1274f003fb54Skardel	ntp_cv_arg_setpgrp_negpid=$ans
1275f003fb54Skardel    ]
1276f003fb54Skardel)
1277f003fb54Skardelcase "$ntp_cv_arg_setpgrp_negpid" in
1278f003fb54Skardel yes)
1279f003fb54Skardel    AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
1280f003fb54Skardel	[Do we set process groups with -pid?])
1281abb0f93cSkardelesac
1282abb0f93cSkardel
1283abb0f93cSkardelAC_CACHE_CHECK(
1284abb0f93cSkardel    [if we need a ctty for F_SETOWN],
1285f003fb54Skardel    [ntp_cv_func_ctty_for_f_setown],
1286abb0f93cSkardel    [
1287abb0f93cSkardel	case "$host" in
12888585484eSchristos	 *-*-bsdi[[23]]*)
1289abb0f93cSkardel	    ans=yes
1290abb0f93cSkardel	    ;;
1291abb0f93cSkardel	 *-*-freebsd*)
1292abb0f93cSkardel	    ans=yes
1293abb0f93cSkardel	    ;;
1294abb0f93cSkardel	# NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
1295abb0f93cSkardel	# while later versions will fail a ioctl(TIOCSCTTY, 0) call in
1296abb0f93cSkardel	# some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
1297abb0f93cSkardel	# in $host may be followed by "aout", "ecoff", or "elf".
12988585484eSchristos	 *-*-netbsd*[[a-z]]3.[[0-8]]*|*-*-netbsd*[[a-z]][[0-2]].*|*-*-netbsd*[[a-z]]3.99.[[0-7]])
1299abb0f93cSkardel	    ans=yes
1300abb0f93cSkardel	    ;;
13018585484eSchristos	 *-*-netbsd3.[[0-8]]*|*-*-netbsd[[0-2]].*|*-*-netbsd3.99.[[0-7]])
1302abb0f93cSkardel	    ans=yes
1303abb0f93cSkardel	    ;;
1304abb0f93cSkardel	 *-*-openbsd*)
1305abb0f93cSkardel	    ans=yes
1306abb0f93cSkardel	    ;;
1307abb0f93cSkardel	 *-*-osf*)
1308abb0f93cSkardel	    ans=yes
1309abb0f93cSkardel	    ;;
1310abb0f93cSkardel	 *-*-darwin*)
1311abb0f93cSkardel	    ans=yes
1312abb0f93cSkardel	    ;;
1313abb0f93cSkardel	 *)
1314abb0f93cSkardel	    ans=no
1315f003fb54Skardel	    ;;
1316abb0f93cSkardel	esac
1317abb0f93cSkardel	ntp_cv_func_ctty_for_f_setown=$ans
1318abb0f93cSkardel    ]
1319abb0f93cSkardel)
1320abb0f93cSkardelcase "$ntp_cv_func_ctty_for_f_setown" in
1321abb0f93cSkardel yes)
1322f003fb54Skardel    AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
1323abb0f93cSkardelesac
1324abb0f93cSkardel
1325f003fb54SkardelAC_CACHE_CHECK(
1326f003fb54Skardel    [if the OS clears cached routes when more specifics become available],
1327f003fb54Skardel    [ntp_cv_os_routeupdates],
1328f003fb54Skardel    [
1329f003fb54Skardel	case "$host" in
1330abb0f93cSkardel	 *-*-netbsd*)
1331abb0f93cSkardel	    ans=yes
1332abb0f93cSkardel	    ;;
1333f003fb54Skardel	 *)
1334f003fb54Skardel	    ans=no
1335abb0f93cSkardel	    ;;
1336abb0f93cSkardel	esac
1337f003fb54Skardel	ntp_cv_os_routeupdates=$ans
1338f003fb54Skardel    ]
1339f003fb54Skardel)
1340f003fb54Skardelcase "$ntp_cv_os_routeupdates" in
1341f003fb54Skardel yes)
1342f003fb54Skardel    AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
1343f003fb54Skardel	[need to recreate sockets on changed routing?])
1344abb0f93cSkardelesac
1345abb0f93cSkardel
1346f003fb54SkardelAC_CACHE_CHECK(
1347f003fb54Skardel    [if the wildcard socket needs REUSEADDR to bind other addresses],
1348f003fb54Skardel    [ntp_cv_os_wildcardreuse],
1349f003fb54Skardel    [
1350f003fb54Skardel	case "$host" in
1351abb0f93cSkardel	 *-*-*linux*)
1352abb0f93cSkardel	    ans=yes
1353abb0f93cSkardel	    ;;
1354abb0f93cSkardel	 *) ans=no
1355abb0f93cSkardel	    ;;
1356abb0f93cSkardel	esac
1357f003fb54Skardel	ntp_cv_os_wildcardreuse=$ans
1358f003fb54Skardel    ]
1359f003fb54Skardel)
1360f003fb54Skardelcase "$ntp_cv_os_wildcardreuse" in
1361f003fb54Skardel yes)
1362f003fb54Skardel    AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
1363f003fb54Skardel	[wildcard socket needs REUSEADDR to bind interface addresses])
1364abb0f93cSkardelesac
1365abb0f93cSkardel
1366abb0f93cSkardelcase "$host" in
1367abb0f93cSkardel *-*-aix*)
1368f003fb54Skardel    AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
1369f003fb54Skardel	[Might nlist() values require an extra level of indirection (AIX)?])
1370abb0f93cSkardelesac
1371abb0f93cSkardel
1372f003fb54SkardelAC_CACHE_CHECK(
1373f003fb54Skardel    [for a minimum recommended value of tickadj],
1374f003fb54Skardel    [ntp_cv_var_min_rec_tickadj],
1375f003fb54Skardel    [
1376f003fb54Skardel	ans=no
1377abb0f93cSkardel	case "$host" in
1378abb0f93cSkardel	 *-*-aix*)
1379abb0f93cSkardel	    ans=40
1380abb0f93cSkardel	    ;;
1381abb0f93cSkardel	esac
1382f003fb54Skardel	ntp_cv_var_min_rec_tickadj=$ans
1383f003fb54Skardel    ]
1384f003fb54Skardel)
1385f003fb54Skardelcase "$ntp_cv_var_min_rec_tickadj" in
1386f003fb54Skardel ''|no)
1387f003fb54Skardel    ;;
1388f003fb54Skardel *)
1389f003fb54Skardel    AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
1390f003fb54Skardel	[Should we recommend a minimum value for tickadj?])
1391abb0f93cSkardelesac
1392abb0f93cSkardel
1393f003fb54SkardelAC_CACHE_CHECK(
1394f003fb54Skardel    [if the TTY code permits PARENB and IGNPAR],
1395f003fb54Skardel    [ntp_cv_no_parenb_ignpar],
1396f003fb54Skardel    [
1397f003fb54Skardel	ans=no
1398abb0f93cSkardel	case "$host" in
1399abb0f93cSkardel	 i?86-*-*linux*)
1400abb0f93cSkardel	    ans=yes
1401abb0f93cSkardel	    ;;
1402abb0f93cSkardel	 mips-sgi-irix*)
1403abb0f93cSkardel	    ans=yes
1404abb0f93cSkardel	    ;;
1405abb0f93cSkardel	 i?86-*-freebsd[[123]].*)
1406abb0f93cSkardel	    ;;
1407abb0f93cSkardel	 i?86-*-freebsd*)
1408abb0f93cSkardel	    ans=yes
1409abb0f93cSkardel	    ;;
1410abb0f93cSkardel	 *-*-unicosmp*)
1411abb0f93cSkardel	    ans=yes
1412abb0f93cSkardel	    ;;
1413abb0f93cSkardel	esac
1414f003fb54Skardel	ntp_cv_no_parenb_ignpar=$ans
1415f003fb54Skardel    ]
1416f003fb54Skardel)
1417f003fb54Skardelcase "$ntp_cv_no_parenb_ignpar" in
1418f003fb54Skardel yes)
1419f003fb54Skardel    AC_DEFINE([NO_PARENB_IGNPAR], [1],
1420f003fb54Skardel	[Is there a problem using PARENB and IGNPAR?])
1421abb0f93cSkardelesac
1422abb0f93cSkardel
1423f003fb54SkardelAC_MSG_CHECKING([if we're including processing time debugging code])
1424f003fb54SkardelAC_ARG_ENABLE(
1425f003fb54Skardel    [debug-timing],
1426f003fb54Skardel    [AS_HELP_STRING(
1427f003fb54Skardel	[--enable-debug-timing],
1428f003fb54Skardel	[- include processing time debugging code (costs performance)]
1429f003fb54Skardel    )],
1430f003fb54Skardel    [ntp_ok=$enableval],
1431f003fb54Skardel    [ntp_ok=no]
1432f003fb54Skardel)
1433f003fb54Skardelcase "$ntp_ok" in
1434f003fb54Skardel yes)
1435f003fb54Skardel    AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
1436f003fb54Skardelesac
1437f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1438f003fb54Skardel
1439f003fb54SkardelAC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
1440f003fb54SkardelAC_ARG_ENABLE(
1441f003fb54Skardel    [dst-minutes],
1442f003fb54Skardel    [AS_HELP_STRING(
1443abb0f93cSkardel	[--enable-dst-minutes],
14448585484eSchristos	[=60 minutes per DST adjustment])   dnl @<:@ is [, @:>@ is ]
1445f003fb54Skardel    ],
1446abb0f93cSkardel    [ans=$enableval],
1447abb0f93cSkardel    [ans=60]
1448abb0f93cSkardel)
1449f003fb54SkardelAC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
1450f003fb54Skardel    [The number of minutes in a DST adjustment])
1451abb0f93cSkardelAC_MSG_RESULT([$ans])
1452abb0f93cSkardel
1453f003fb54SkardelAC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
1454abb0f93cSkardelAC_ARG_ENABLE(
1455abb0f93cSkardel    [ignore-dns-errors],
1456f003fb54Skardel    [AS_HELP_STRING(
1457abb0f93cSkardel	[--enable-ignore-dns-errors],
1458abb0f93cSkardel	[- retry DNS queries on any error]
1459f003fb54Skardel    )],
1460abb0f93cSkardel    [ans=$enableval],
1461abb0f93cSkardel    [ans=no]
1462abb0f93cSkardel)
1463abb0f93cSkardelcase "$ans" in
1464abb0f93cSkardel yes)
1465f003fb54Skardel    AC_DEFINE([IGNORE_DNS_ERRORS], [1],
1466f003fb54Skardel	[Retry queries on _any_ DNS error?])
1467abb0f93cSkardelesac
1468abb0f93cSkardelAC_MSG_RESULT([$ans])
1469abb0f93cSkardel
1470f003fb54SkardelAC_CACHE_CHECK(
1471f003fb54Skardel    [availability of ntp_{adj,get}time()],
1472f003fb54Skardel    [ntp_cv_var_ntp_syscalls],
1473f003fb54Skardel    [
1474f003fb54Skardel	ntp_cv_var_ntp_syscalls=no
1475abb0f93cSkardel	case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
1476abb0f93cSkardel	 yesyes*)
1477f003fb54Skardel	    ntp_cv_var_ntp_syscalls=libc
1478abb0f93cSkardel	    ;;
1479abb0f93cSkardel	 *yes)
1480f003fb54Skardel	    ntp_cv_var_ntp_syscalls=inline
1481abb0f93cSkardel	    ;;
1482f003fb54Skardel	 *)
1483b8ecfcfeSchristos	    AC_PREPROC_IFELSE(
1484b5bbe2e3Schristos		[AC_LANG_SOURCE(
1485f003fb54Skardel		    [
1486f003fb54Skardel			#include <sys/syscall.h>
1487b8ecfcfeSchristos			#if !defined(SYS_ntp_gettime) || !defined(SYS_ntp_adjtime)
1488b8ecfcfeSchristos			# error
1489abb0f93cSkardel			#endif
1490b5bbe2e3Schristos		    ])],
1491f003fb54Skardel		[ntp_cv_var_ntp_syscalls=kernel]
1492f003fb54Skardel	    )
1493abb0f93cSkardel	    ;;
1494f003fb54Skardel	 esac
1495f003fb54Skardel    ]
1496f003fb54Skardel)
1497f003fb54Skardelcase "$ntp_cv_var_ntp_syscalls" in
1498abb0f93cSkardel libc)
1499f003fb54Skardel    AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
1500f003fb54Skardel	[Do we have ntp_{adj,get}time in libc?])
1501abb0f93cSkardel    ;;
1502abb0f93cSkardel kernel)
1503f003fb54Skardel    AC_DEFINE([NTP_SYSCALLS_STD], [1],
1504f003fb54Skardel	[Do we have ntp_{adj,get}time in the kernel?])
1505abb0f93cSkardel    ;;
1506abb0f93cSkardelesac
1507abb0f93cSkardel
1508f003fb54SkardelAC_CACHE_CHECK(
1509f003fb54Skardel    [if sys/timex.h has STA_FLL],
1510f003fb54Skardel    [ntp_cv_var_sta_fll],
1511b8ecfcfeSchristos    [AC_PREPROC_IFELSE(
1512b5bbe2e3Schristos	[AC_LANG_SOURCE(
1513f003fb54Skardel	    [
1514f003fb54Skardel		#include <sys/timex.h>
1515b8ecfcfeSchristos		#ifndef STA_FLL
1516b8ecfcfeSchristos		# error
1517abb0f93cSkardel		#endif
1518b5bbe2e3Schristos	    ])],
1519f003fb54Skardel	[ntp_cv_var_sta_fll=yes],
1520f003fb54Skardel	[ntp_cv_var_sta_fll=no]
1521f003fb54Skardel    )]
1522f003fb54Skardel)
1523abb0f93cSkardel
1524f003fb54SkardelAC_CACHE_CHECK(
1525f003fb54Skardel    [if we have kernel PLL support],
1526f003fb54Skardel    [ntp_cv_var_kernel_pll],
1527f003fb54Skardel    [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
1528f003fb54Skardel	case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
1529abb0f93cSkardel	 *no*)
1530f003fb54Skardel	    ntp_cv_var_kernel_pll=no
1531abb0f93cSkardel	    ;;
1532f003fb54Skardel	 *) ntp_cv_var_kernel_pll=yes
1533abb0f93cSkardel	    ;;
1534abb0f93cSkardel	esac
1535f003fb54Skardel    ]
1536f003fb54Skardel)
1537f003fb54Skardelcase "$ntp_cv_var_kernel_pll" in
1538f003fb54Skardel yes)
1539f003fb54Skardel    AC_DEFINE([KERNEL_PLL], [1],
1540f003fb54Skardel	[Does the kernel support precision time discipline?])
1541f003fb54Skardelesac
1542abb0f93cSkardel
1543f003fb54SkardelAC_CACHE_CHECK(
1544f003fb54Skardel    [if SIOCGIFCONF returns buffer size in the buffer],
1545f003fb54Skardel    [ntp_cv_size_returned_in_buffer],
1546f003fb54Skardel    [
1547f003fb54Skardel	ans=no
1548abb0f93cSkardel	case "$host" in
1549abb0f93cSkardel	 *-fujitsu-uxp*)
1550abb0f93cSkardel	    ans=yes
1551abb0f93cSkardel	    ;;
1552abb0f93cSkardel	 *-ncr-sysv4*)
1553abb0f93cSkardel	    ans=yes
1554abb0f93cSkardel	    ;;
1555abb0f93cSkardel	 *-univel-sysv*)
1556abb0f93cSkardel	    ans=yes
1557abb0f93cSkardel	    ;;
1558abb0f93cSkardel	esac
1559f003fb54Skardel	ntp_cv_size_returned_in_buffer=$ans
1560f003fb54Skardel    ]
1561f003fb54Skardel)
1562f003fb54Skardelcase "$ntp_cv_size_returned_in_buffer" in
1563f003fb54Skardel yes)
1564f003fb54Skardel    AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
1565f003fb54Skardel	[Does SIOCGIFCONF return size in the buffer?])
1566abb0f93cSkardelesac
1567abb0f93cSkardel
1568abb0f93cSkardel# Check for ioctls TIOCGPPSEV
1569f003fb54SkardelAC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
1570f003fb54Skardelcase "$ac_cv_header_termios_h" in
1571f003fb54Skardel yes)
1572b8ecfcfeSchristos    AC_PREPROC_IFELSE(
1573b5bbe2e3Schristos	[AC_LANG_SOURCE([
1574f003fb54Skardel	    #include <termios.h>
1575b8ecfcfeSchristos	    #ifndef TIOCGPPSEV
1576b8ecfcfeSchristos	    # error
1577abb0f93cSkardel	    #endif
1578b5bbe2e3Schristos	])],
1579f003fb54Skardel	[ntp_ok=yes],
1580f003fb54Skardel	[ntp_ok=no]
1581f003fb54Skardel    )
1582f003fb54Skardel    ;;
1583f003fb54Skardel *)
1584abb0f93cSkardel    ntp_ok=no
1585f003fb54Skardel    ;;
1586f003fb54Skardelesac
1587f003fb54Skardelcase "$ntp_ok" in
1588f003fb54Skardel yes)
1589f003fb54Skardel    AC_DEFINE([HAVE_TIOCGPPSEV], [1],
1590f003fb54Skardel	[Do we have the TIOCGPPSEV ioctl (Solaris)?])
1591f003fb54Skardelesac
1592f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1593abb0f93cSkardel
1594abb0f93cSkardel# Check for ioctls TIOCSPPS
1595f003fb54SkardelAC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
1596f003fb54Skardelcase "$ac_cv_header_termios_h" in
1597f003fb54Skardel yes)
1598b8ecfcfeSchristos    AC_PREPROC_IFELSE(
1599b5bbe2e3Schristos	[AC_LANG_SOURCE([
1600f003fb54Skardel	    #include <termios.h>
1601b8ecfcfeSchristos	    #ifndef TIOCSPPS
1602b8ecfcfeSchristos	    # error
1603abb0f93cSkardel	    #endif
1604b5bbe2e3Schristos	 ])],
1605f003fb54Skardel	 [ntp_ok=yes],
1606f003fb54Skardel	 [ntp_ok=no]
1607f003fb54Skardel    )
1608f003fb54Skardel    ;;
1609f003fb54Skardel *)
1610abb0f93cSkardel    ntp_ok=no
1611f003fb54Skardel    ;;
1612f003fb54Skardelesac
1613f003fb54Skardelcase "$ntp_ok" in
1614f003fb54Skardel yes)
1615f003fb54Skardel    AC_DEFINE([HAVE_TIOCSPPS], [1],
1616f003fb54Skardel	[Do we have the TIOCSPPS ioctl (Solaris)?])
1617f003fb54Skardelesac
1618f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1619abb0f93cSkardel
1620abb0f93cSkardel# Check for ioctls CIOGETEV
1621f003fb54SkardelAC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
1622f003fb54Skardelcase "$ac_cv_header_sys_ppsclock_h" in
1623f003fb54Skardel yes)
1624b8ecfcfeSchristos    AC_PREPROC_IFELSE(
1625b5bbe2e3Schristos	[AC_LANG_SOURCE([
1626f003fb54Skardel	    #include <sys/ppsclock.h>
1627b8ecfcfeSchristos	    #ifndef CIOGETEV
1628b8ecfcfeSchristos	    # error
1629abb0f93cSkardel	    #endif
1630b5bbe2e3Schristos	])],
1631f003fb54Skardel	[ntp_ok=yes],
1632f003fb54Skardel	[ntp_ok=no]
1633f003fb54Skardel    )
1634f003fb54Skardel    ;;
1635f003fb54Skardel *)
1636abb0f93cSkardel    ntp_ok=no
1637f003fb54Skardel    ;;
1638f003fb54Skardelesac
1639f003fb54Skardelcase "$ntp_ok" in
1640f003fb54Skardel yes)
1641f003fb54Skardel    AC_DEFINE([HAVE_CIOGETEV], [1],
1642f003fb54Skardel	[Do we have the CIOGETEV ioctl (SunOS, Linux)?])
1643f003fb54Skardelesac
1644f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1645abb0f93cSkardel
1646abb0f93cSkardel# ATOM/PPSAPI stuff.
1647abb0f93cSkardel
1648f003fb54Skardelntp_atom_ok=yes
1649abb0f93cSkardel
1650abb0f93cSkardel# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1651abb0f93cSkardel
1652abb0f93cSkardel# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
1653abb0f93cSkardel# The PPSAPI needs struct timespec.
1654abb0f93cSkardel# The PPSAPI also needs a timepps header.
1655abb0f93cSkardel
1656f003fb54Skardelcase "$ac_cv_c_inline$ntp_cv_struct_timespec" in
1657abb0f93cSkardel inlineyes)
1658abb0f93cSkardel    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
1659abb0f93cSkardel     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
1660abb0f93cSkardel	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
1661f003fb54Skardel	ntp_jupiter_ok=yes
1662f003fb54Skardel	ntp_oncore_ok=yes
1663f003fb54Skardel	ntp_parse_ok=yes
1664f003fb54Skardel	ntp_ripe_ncc_ok=yes
1665abb0f93cSkardel	;;
1666abb0f93cSkardel    esac
1667abb0f93cSkardel    ;;
1668abb0f93cSkardelesac
1669abb0f93cSkardel
1670abb0f93cSkardel# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1671f003fb54SkardelAC_CHECK_HEADER([linux/serial.h])
1672abb0f93cSkardelcase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1673abb0f93cSkardel  yesyes)
1674f003fb54Skardel    AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
1675b8ecfcfeSchristos    AC_PREPROC_IFELSE(
1676b5bbe2e3Schristos	[AC_LANG_SOURCE([
1677f003fb54Skardel	    #include <sys/time.h>
1678abb0f93cSkardel	    typedef int u_int;
1679abb0f93cSkardel	    #include <sys/ppsclock.h>
1680abb0f93cSkardel	    #include <linux/serial.h>
1681abb0f93cSkardel
1682b8ecfcfeSchristos	    #ifndef TIOCGSERIAL
1683b8ecfcfeSchristos	    # error
1684abb0f93cSkardel	    #endif
1685b8ecfcfeSchristos	    #ifndef TIOCSSERIAL
1686b8ecfcfeSchristos	    # error
1687abb0f93cSkardel	    #endif
1688b8ecfcfeSchristos	    #ifndef ASYNC_PPS_CD_POS
1689b8ecfcfeSchristos	    # error
1690abb0f93cSkardel	    #endif
1691b8ecfcfeSchristos	    #ifndef ASYNC_PPS_CD_NEG
1692b8ecfcfeSchristos	    # error
1693abb0f93cSkardel	    #endif
1694b8ecfcfeSchristos	    #ifndef CIOGETEV
1695b8ecfcfeSchristos	    # error
1696abb0f93cSkardel	    #endif
1697b5bbe2e3Schristos	])],
1698f003fb54Skardel	[ntp_ok=yes],
1699f003fb54Skardel	[ntp_ok=no]
1700f003fb54Skardel    )
1701f003fb54Skardel    AC_MSG_RESULT([$ntp_ok])
1702abb0f93cSkardel    ;;
1703abb0f93cSkardel  *)
1704abb0f93cSkardel    ntp_ok=no
1705abb0f93cSkardel    ;;
1706abb0f93cSkardelesac
1707f003fb54Skardelcase "$ntp_ok" in
1708f003fb54Skardel yes)
1709f003fb54Skardel    AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
1710f003fb54Skardel	[Do we have the TIO serial stuff?])
1711f003fb54Skardelesac
1712abb0f93cSkardel
1713abb0f93cSkardel# Check for SHMEM_STATUS support
1714abb0f93cSkardelAC_MSG_CHECKING([SHMEM_STATUS support])
1715abb0f93cSkardelcase "$ac_cv_header_sys_mman_h" in
1716f003fb54Skardel yes)
1717f003fb54Skardel    ntp_ok=yes
1718f003fb54Skardel    ;;
1719f003fb54Skardel *)
1720f003fb54Skardel    ntp_ok=no
1721f003fb54Skardel    ;;
1722abb0f93cSkardelesac
1723f003fb54Skardelcase "$ntp_ok" in
1724f003fb54Skardel yes)
1725f003fb54Skardel    AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
1726f003fb54Skardel	[Do we have support for SHMEM_STATUS?])
1727f003fb54Skardelesac
1728f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1729abb0f93cSkardel
1730abb0f93cSkardelntp_refclock=no
1731abb0f93cSkardel
1732abb0f93cSkardel# HPUX only, and by explicit request
1733abb0f93cSkardelAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
1734f003fb54SkardelAC_ARG_ENABLE(
1735f003fb54Skardel    [BANCOMM],
1736f003fb54Skardel    [AS_HELP_STRING(
1737f003fb54Skardel	[--enable-BANCOMM],
1738f003fb54Skardel	[- Datum/Bancomm bc635/VME interface]
1739f003fb54Skardel    )],
1740f003fb54Skardel    [ntp_ok=$enableval],
1741f003fb54Skardel    [ntp_ok=no]
1742f003fb54Skardel)
17438585484eSchristoscase "$ntp_ok" in
17448585484eSchristos yes)
1745abb0f93cSkardel    ntp_refclock=yes
1746f003fb54Skardel    AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
1747cdfa2a7eSchristos    AC_SEARCH_LIBS([bcStartPci], [bcsdk], , , [])
17488585484eSchristos    ;;
17498585484eSchristosesac
1750f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1751abb0f93cSkardelcase "$ntp_ok$host" in
1752abb0f93cSkardel yes*-*-hpux*) ;;
1753abb0f93cSkardel yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1754abb0f93cSkardelesac
1755abb0f93cSkardel
1756abb0f93cSkardel#HPUX only, and only by explicit request
1757abb0f93cSkardelAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
1758f003fb54SkardelAC_ARG_ENABLE(
1759f003fb54Skardel    [GPSVME],
1760f003fb54Skardel    [AS_HELP_STRING(
1761f003fb54Skardel	[--enable-GPSVME],
1762f003fb54Skardel	[- TrueTime GPS receiver/VME interface]
1763f003fb54Skardel    )],
1764f003fb54Skardel    [ntp_ok=$enableval],
1765f003fb54Skardel    [ntp_ok=no]
1766f003fb54Skardel)
17678585484eSchristoscase "$ntp_ok" in
17688585484eSchristos yes)
1769abb0f93cSkardel    ntp_refclock=yes
1770f003fb54Skardel    AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
17718585484eSchristos    ;;
17728585484eSchristosesac
1773f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1774abb0f93cSkardelcase "$ntp_ok$host" in
1775abb0f93cSkardel yes*-*-hpux*) ;;
1776abb0f93cSkardel yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
1777abb0f93cSkardelesac
1778abb0f93cSkardel
1779abb0f93cSkardelAC_MSG_CHECKING([for PCL720 clock support])
1780abb0f93cSkardelcase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1781abb0f93cSkardel yesyesyes)
1782f003fb54Skardel    AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
1783abb0f93cSkardel    ans=yes
1784abb0f93cSkardel    ;;
1785abb0f93cSkardel *)
1786abb0f93cSkardel    ans=no
1787abb0f93cSkardel    ;;
1788abb0f93cSkardelesac
1789abb0f93cSkardelAC_MSG_RESULT([$ans])
1790abb0f93cSkardel
1791abb0f93cSkardelAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
1792f003fb54SkardelAC_ARG_ENABLE(
1793f003fb54Skardel    [all-clocks],
1794f003fb54Skardel    [AS_HELP_STRING(
1795f003fb54Skardel	[--enable-all-clocks],
1796f003fb54Skardel	[+ include all suitable non-PARSE clocks:]
1797f003fb54Skardel    )],
1798f003fb54Skardel    [ntp_eac=$enableval],
1799f003fb54Skardel    [ntp_eac=yes]
1800f003fb54Skardel)
1801f003fb54SkardelAC_MSG_RESULT([$ntp_eac])
1802abb0f93cSkardel
1803f003fb54Skardel# HMS: Should we also require ntp_parse_ok?
1804abb0f93cSkardelAC_MSG_CHECKING([if we have support for PARSE clocks])
1805f003fb54Skardelcase "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1806abb0f93cSkardel yes*yes*)
1807abb0f93cSkardel    ntp_canparse=yes
1808abb0f93cSkardel    ;;
1809abb0f93cSkardel *) ntp_canparse=no
1810abb0f93cSkardel    ;;
1811abb0f93cSkardelesac
1812f003fb54SkardelAC_MSG_RESULT([$ntp_canparse])
1813abb0f93cSkardel
1814abb0f93cSkardelAC_MSG_CHECKING([if we have support for audio clocks])
1815abb0f93cSkardelcase "$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
1816abb0f93cSkardel *yes*)
1817abb0f93cSkardel    ntp_canaudio=yes
1818f003fb54Skardel    AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
1819abb0f93cSkardel    ;;
1820abb0f93cSkardel *) ntp_canaudio=no ;;
1821abb0f93cSkardelesac
1822f003fb54SkardelAC_MSG_RESULT([$ntp_canaudio])
1823abb0f93cSkardel
1824abb0f93cSkardelAC_MSG_CHECKING([if we have support for the SHM refclock interface])
1825abb0f93cSkardelcase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
1826abb0f93cSkardel yesyes)
1827abb0f93cSkardel    ntp_canshm=yes
1828abb0f93cSkardel    ;;
1829abb0f93cSkardel *) ntp_canshm=no ;;
1830abb0f93cSkardelesac
1831f003fb54SkardelAC_MSG_RESULT([$ntp_canshm])
1832abb0f93cSkardel
1833f003fb54Skardel# Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
1834f003fb54SkardelAC_CACHE_CHECK(
1835f003fb54Skardel    [for termios modem control],
1836f003fb54Skardel    [ntp_cv_modem_control],
1837f003fb54Skardel    [AC_COMPILE_IFELSE(
1838f003fb54Skardel	[AC_LANG_PROGRAM(
1839f003fb54Skardel	    [[
1840f003fb54Skardel		#ifdef HAVE_UNISTD_H
1841f003fb54Skardel		# include <unistd.h>
1842f003fb54Skardel		#endif
1843f003fb54Skardel		#ifdef HAVE_TERMIOS_H
1844f003fb54Skardel		# include <termios.h>
1845f003fb54Skardel		#endif
1846abb0f93cSkardel		#ifdef HAVE_SYS_IOCTL_H
1847abb0f93cSkardel		# include <sys/ioctl.h>
1848abb0f93cSkardel		#endif
1849f003fb54Skardel	    ]],
1850f003fb54Skardel	    [[
1851f003fb54Skardel		int	dtr = TIOCM_DTR;
1852f003fb54Skardel
1853f003fb54Skardel		ioctl(1, TIOCMBIS, (char *)&dtr);
1854f003fb54Skardel	    ]]
1855f003fb54Skardel	)],
1856f003fb54Skardel	[ntp_cv_modem_control=yes],
1857f003fb54Skardel	[ntp_cv_modem_control=no]
1858f003fb54Skardel    )]
1859f003fb54Skardel)
1860f003fb54Skardelcase "$ntp_eac::$ntp_cv_modem_control" in
1861f003fb54Skardel yes::yes)
1862f003fb54Skardel    ntp_enable_all_modem_control_clocks=yes
1863f003fb54Skardel    ;;
1864f003fb54Skardel *)
1865f003fb54Skardel    ntp_enable_all_modem_control_clocks=no
1866f003fb54Skardel    ;;
1867f003fb54Skardelesac
1868f003fb54Skardel
1869f003fb54Skardel# Requires modem control
1870f003fb54SkardelAC_MSG_CHECKING([ACTS modem service])
1871f003fb54SkardelAC_ARG_ENABLE(
1872f003fb54Skardel    [ACTS],
1873f003fb54Skardel    [AS_HELP_STRING(
1874f003fb54Skardel	[--enable-ACTS],
1875f003fb54Skardel	[s ACTS modem service]
1876f003fb54Skardel    )],
1877f003fb54Skardel    [ntp_ok=$enableval],
1878f003fb54Skardel    [ntp_ok=$ntp_enable_all_modem_control_clocks]
1879f003fb54Skardel)
18808585484eSchristoscase "$ntp_ok" in
18818585484eSchristos yes)
1882abb0f93cSkardel    ntp_refclock=yes
1883f003fb54Skardel    AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
18848585484eSchristos    ;;
18858585484eSchristosesac
1886f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1887abb0f93cSkardel
1888abb0f93cSkardelAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
1889f003fb54SkardelAC_ARG_ENABLE(
1890f003fb54Skardel    [ARBITER],
1891f003fb54Skardel    [AS_HELP_STRING(
1892f003fb54Skardel	[--enable-ARBITER],
1893f003fb54Skardel	[+ Arbiter 1088A/B GPS receiver]
1894f003fb54Skardel    )],
1895f003fb54Skardel    [ntp_ok=$enableval],
1896f003fb54Skardel    [ntp_ok=$ntp_eac]
1897f003fb54Skardel)
18988585484eSchristoscase "$ntp_ok" in
18998585484eSchristos yes)
1900abb0f93cSkardel    ntp_refclock=yes
1901f003fb54Skardel    AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
19028585484eSchristos    ;;
19038585484eSchristosesac
1904f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1905abb0f93cSkardel
1906abb0f93cSkardelAC_MSG_CHECKING([Arcron MSF receiver])
1907f003fb54SkardelAC_ARG_ENABLE(
1908f003fb54Skardel    [ARCRON_MSF],
1909f003fb54Skardel    [AS_HELP_STRING(
1910f003fb54Skardel	[--enable-ARCRON-MSF],
1911f003fb54Skardel	[+ Arcron MSF receiver]
1912f003fb54Skardel    )],
1913f003fb54Skardel    [ntp_ok=$enableval],
1914f003fb54Skardel    [ntp_ok=$ntp_eac]
1915f003fb54Skardel)
19168585484eSchristoscase "$ntp_ok" in
19178585484eSchristos yes)
1918abb0f93cSkardel    ntp_refclock=yes
1919f003fb54Skardel    AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
19208585484eSchristos    ;;
19218585484eSchristosesac
1922f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1923abb0f93cSkardel
1924abb0f93cSkardelAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
1925f003fb54SkardelAC_ARG_ENABLE(
1926f003fb54Skardel    [AS2201],
1927f003fb54Skardel    [AS_HELP_STRING(
1928f003fb54Skardel	[--enable-AS2201],
1929f003fb54Skardel	[+ Austron 2200A/2201A GPS receiver]
1930f003fb54Skardel    )],
1931f003fb54Skardel    [ntp_ok=$enableval],
1932f003fb54Skardel    [ntp_ok=$ntp_eac]
1933f003fb54Skardel)
19348585484eSchristoscase "$ntp_ok" in
19358585484eSchristos yes)
1936abb0f93cSkardel    ntp_refclock=yes
1937f003fb54Skardel    AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
19388585484eSchristos    ;;
19398585484eSchristosesac
1940f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1941abb0f93cSkardel
1942abb0f93cSkardelAC_MSG_CHECKING([ATOM PPS interface])
1943f003fb54SkardelAC_ARG_ENABLE(
1944f003fb54Skardel    [ATOM],
1945f003fb54Skardel    [AS_HELP_STRING(
1946f003fb54Skardel	[--enable-ATOM],
1947f003fb54Skardel	[s ATOM PPS interface]
1948f003fb54Skardel    )],
1949f003fb54Skardel    [ntp_ok=$enableval],
1950f003fb54Skardel    [ntp_ok=$ntp_eac]
1951f003fb54Skardel)
1952f003fb54Skardelcase "$ntp_atom_ok" in
1953abb0f93cSkardel no) ntp_ok=no ;;
1954abb0f93cSkardelesac
19558585484eSchristoscase "$ntp_ok" in
19568585484eSchristos yes)
1957abb0f93cSkardel    ntp_refclock=yes
1958f003fb54Skardel    AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
19598585484eSchristos    ;;
19608585484eSchristosesac
1961f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1962abb0f93cSkardel
1963abb0f93cSkardelAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
1964f003fb54SkardelAC_ARG_ENABLE(
1965f003fb54Skardel    [CHRONOLOG],
1966f003fb54Skardel    [AS_HELP_STRING(
1967f003fb54Skardel	[--enable-CHRONOLOG],
1968f003fb54Skardel	[+ Chrono-log K-series WWVB receiver]
1969f003fb54Skardel    )],
1970f003fb54Skardel    [ntp_ok=$enableval],
1971f003fb54Skardel    [ntp_ok=$ntp_eac]
1972f003fb54Skardel)
19738585484eSchristoscase "$ntp_ok" in
19748585484eSchristos yes)
1975abb0f93cSkardel    ntp_refclock=yes
1976f003fb54Skardel    AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
19778585484eSchristos    ;;
19788585484eSchristosesac
1979f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1980abb0f93cSkardel
1981abb0f93cSkardelAC_MSG_CHECKING([CHU modem/decoder])
1982f003fb54SkardelAC_ARG_ENABLE(
1983f003fb54Skardel    [CHU],
1984f003fb54Skardel    [AS_HELP_STRING(
1985f003fb54Skardel	[--enable-CHU],
1986f003fb54Skardel	[+ CHU modem/decoder]
1987f003fb54Skardel    )],
1988f003fb54Skardel    [ntp_ok=$enableval],
1989f003fb54Skardel    [ntp_ok=$ntp_eac]
1990f003fb54Skardel)
19918585484eSchristoscase "$ntp_ok" in
19928585484eSchristos yes)
1993abb0f93cSkardel    ntp_refclock=yes
1994f003fb54Skardel    AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
19958585484eSchristos    ;;
19968585484eSchristosesac
1997f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
1998f003fb54Skardelntp_refclock_chu=$ntp_ok
1999abb0f93cSkardel
2000abb0f93cSkardelAC_MSG_CHECKING([CHU audio/decoder])
2001f003fb54SkardelAC_ARG_ENABLE(
2002f003fb54Skardel    [AUDIO-CHU],
2003f003fb54Skardel    [AS_HELP_STRING(
2004f003fb54Skardel	[--enable-AUDIO-CHU],
2005f003fb54Skardel	[s CHU audio/decoder]
2006f003fb54Skardel    )],
2007abb0f93cSkardel    [ntp_ok=$enableval],
2008f003fb54Skardel    [
2009f003fb54Skardel	case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
2010abb0f93cSkardel	 *no*)	ntp_ok=no  ;;
2011abb0f93cSkardel	 *)	ntp_ok=yes ;;
2012f003fb54Skardel	esac
2013f003fb54Skardel    ]
2014f003fb54Skardel)
2015f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2016abb0f93cSkardel# We used to check for sunos/solaris target...
2017f003fb54Skardelcase "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
2018f003fb54Skardel yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
2019abb0f93cSkardelesac
2020abb0f93cSkardel
2021abb0f93cSkardel# Not under HP-UX
2022abb0f93cSkardelAC_MSG_CHECKING([Datum Programmable Time System])
2023f003fb54SkardelAC_ARG_ENABLE(
2024f003fb54Skardel    [DATUM],
2025f003fb54Skardel    [AS_HELP_STRING(
2026f003fb54Skardel	[--enable-DATUM],
2027f003fb54Skardel	[s Datum Programmable Time System]
2028f003fb54Skardel    )],
2029abb0f93cSkardel    [ntp_ok=$enableval],
2030f003fb54Skardel    [
2031f003fb54Skardel	case "$ac_cv_header_termios_h" in
2032abb0f93cSkardel	 yes)
2033abb0f93cSkardel	    ntp_ok=$ntp_eac
2034abb0f93cSkardel	    ;;
2035abb0f93cSkardel	 *) ntp_ok=no
2036abb0f93cSkardel	    ;;
2037f003fb54Skardel	esac
2038f003fb54Skardel    ]
2039f003fb54Skardel)
20408585484eSchristoscase "$ntp_ok" in
20418585484eSchristos yes)
2042abb0f93cSkardel    ntp_refclock=yes
2043f003fb54Skardel    AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
20448585484eSchristos    ;;
20458585484eSchristosesac
2046f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2047abb0f93cSkardel
2048abb0f93cSkardelAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2049f003fb54SkardelAC_ARG_ENABLE(
2050f003fb54Skardel    [DUMBCLOCK],
2051f003fb54Skardel    [AS_HELP_STRING(
2052f003fb54Skardel	[--enable-DUMBCLOCK],
2053f003fb54Skardel	[+ Dumb generic hh:mm:ss local clock]
2054f003fb54Skardel    )],
2055f003fb54Skardel    [ntp_ok=$enableval],
2056f003fb54Skardel    [ntp_ok=$ntp_eac]
2057f003fb54Skardel)
20588585484eSchristoscase "$ntp_ok" in
20598585484eSchristos yes)
2060abb0f93cSkardel    ntp_refclock=yes
2061f003fb54Skardel    AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
20628585484eSchristos    ;;
20638585484eSchristosesac
2064f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2065abb0f93cSkardel
2066abb0f93cSkardelAC_MSG_CHECKING([Forum Graphic GPS])
2067f003fb54SkardelAC_ARG_ENABLE(
2068f003fb54Skardel    [FG],
2069f003fb54Skardel    [AS_HELP_STRING(
2070f003fb54Skardel	[--enable-FG],
2071f003fb54Skardel	[+ Forum Graphic GPS]
2072f003fb54Skardel    )],
2073f003fb54Skardel    [ntp_ok=$enableval],
2074f003fb54Skardel    [ntp_ok=$ntp_eac]
2075f003fb54Skardel)
20768585484eSchristoscase "$ntp_ok" in
20778585484eSchristos yes)
2078abb0f93cSkardel    ntp_refclock=yes
2079f003fb54Skardel    AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
20808585484eSchristos    ;;
20818585484eSchristosesac
2082f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2083abb0f93cSkardel
2084abb0f93cSkardel# Requires modem control
2085abb0f93cSkardelAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2086f003fb54SkardelAC_ARG_ENABLE(
2087f003fb54Skardel    [HEATH],
2088f003fb54Skardel    [AS_HELP_STRING(
2089f003fb54Skardel	[--enable-HEATH],
2090f003fb54Skardel	[s Heath GC-1000 WWV/WWVH receiver]
2091f003fb54Skardel    )],
2092abb0f93cSkardel    [ntp_ok=$enableval],
2093f003fb54Skardel    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2094f003fb54Skardel)
20958585484eSchristoscase "$ntp_ok" in
20968585484eSchristos yes)
2097abb0f93cSkardel    ntp_refclock=yes
2098f003fb54Skardel    AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
20998585484eSchristos    ;;
21008585484eSchristosesac
2101f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2102abb0f93cSkardel
2103abb0f93cSkardelAC_MSG_CHECKING([for hopf serial clock device])
2104f003fb54SkardelAC_ARG_ENABLE(
2105f003fb54Skardel    [HOPFSERIAL],
2106f003fb54Skardel    [AS_HELP_STRING(
2107f003fb54Skardel	[--enable-HOPFSERIAL],
2108f003fb54Skardel	[+ hopf serial clock device]
2109f003fb54Skardel    )],
2110f003fb54Skardel    [ntp_ok=$enableval],
2111f003fb54Skardel    [ntp_ok=$ntp_eac]
2112f003fb54Skardel)
21138585484eSchristoscase "$ntp_ok" in
21148585484eSchristos yes)
2115abb0f93cSkardel    ntp_refclock=yes
2116f003fb54Skardel    AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
21178585484eSchristos    ;;
21188585484eSchristosesac
2119f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2120abb0f93cSkardel
2121abb0f93cSkardelAC_MSG_CHECKING([for hopf PCI clock 6039])
2122f003fb54SkardelAC_ARG_ENABLE(
2123f003fb54Skardel    [HOPFPCI],
2124f003fb54Skardel    [AS_HELP_STRING(
2125f003fb54Skardel	[--enable-HOPFPCI],
2126f003fb54Skardel	[+ hopf 6039 PCI board]
2127f003fb54Skardel    )],
2128f003fb54Skardel    [ntp_ok=$enableval],
2129f003fb54Skardel    [ntp_ok=$ntp_eac]
2130f003fb54Skardel)
21318585484eSchristoscase "$ntp_ok" in
21328585484eSchristos yes)
2133abb0f93cSkardel    ntp_refclock=yes
2134f003fb54Skardel    AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
21358585484eSchristos    ;;
21368585484eSchristosesac
2137f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2138abb0f93cSkardel
2139abb0f93cSkardelAC_MSG_CHECKING([HP 58503A GPS receiver])
2140f003fb54SkardelAC_ARG_ENABLE(
2141f003fb54Skardel    [HPGPS],
2142f003fb54Skardel    [AS_HELP_STRING(
2143f003fb54Skardel	[--enable-HPGPS],
2144f003fb54Skardel	[+ HP 58503A GPS receiver]
2145f003fb54Skardel    )],
2146f003fb54Skardel    [ntp_ok=$enableval],
2147f003fb54Skardel    [ntp_ok=$ntp_eac]
2148f003fb54Skardel)
21498585484eSchristoscase "$ntp_ok" in
21508585484eSchristos yes)
2151abb0f93cSkardel    ntp_refclock=yes
2152f003fb54Skardel    AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
21538585484eSchristos    ;;
21548585484eSchristosesac
2155f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2156abb0f93cSkardel
2157abb0f93cSkardelAC_MSG_CHECKING([IRIG audio decoder])
2158f003fb54SkardelAC_ARG_ENABLE(
2159f003fb54Skardel    [IRIG],
2160f003fb54Skardel    [AS_HELP_STRING(
2161f003fb54Skardel	[--enable-IRIG],
2162f003fb54Skardel	[s IRIG audio decoder]
2163f003fb54Skardel    )],
2164abb0f93cSkardel    [ntp_ok=$enableval],
2165f003fb54Skardel    [
2166f003fb54Skardel	case "$ntp_eac$ntp_canaudio" in
2167abb0f93cSkardel	 *no*)	ntp_ok=no  ;;
2168abb0f93cSkardel	 *)	ntp_ok=yes ;;
2169f003fb54Skardel	esac
2170f003fb54Skardel    ]
2171f003fb54Skardel)
21728585484eSchristoscase "$ntp_ok" in
21738585484eSchristos yes)
2174abb0f93cSkardel    ntp_refclock=yes
2175f003fb54Skardel    AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
21768585484eSchristos    ;;
21778585484eSchristosesac
2178f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2179abb0f93cSkardelcase "$ntp_ok$ntp_canaudio" in
2180f003fb54Skardel yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2181abb0f93cSkardelesac
2182abb0f93cSkardel
2183abb0f93cSkardelAC_MSG_CHECKING([for JJY receiver])
2184f003fb54SkardelAC_ARG_ENABLE(
2185f003fb54Skardel    [JJY],
2186f003fb54Skardel    [AS_HELP_STRING(
2187f003fb54Skardel	[--enable-JJY],
2188f003fb54Skardel	[+ JJY receiver]
2189f003fb54Skardel    )],
2190f003fb54Skardel    [ntp_ok=$enableval],
2191f003fb54Skardel    [ntp_ok=$ntp_eac]
2192f003fb54Skardel)
21938585484eSchristoscase "$ntp_ok" in
21948585484eSchristos yes)
2195abb0f93cSkardel    ntp_refclock=yes
2196f003fb54Skardel    AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
21978585484eSchristos    ;;
21988585484eSchristosesac
2199f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2200abb0f93cSkardel
2201abb0f93cSkardelAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2202f003fb54SkardelAC_ARG_ENABLE(
2203f003fb54Skardel    [JUPITER],
2204f003fb54Skardel    [AS_HELP_STRING(
2205f003fb54Skardel	[--enable-JUPITER],
2206f003fb54Skardel	[s Rockwell Jupiter GPS receiver]
2207f003fb54Skardel    )],
2208abb0f93cSkardel    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2209f003fb54Skardelcase "$ntp_jupiter_ok" in
2210abb0f93cSkardel no) ntp_ok=no ;;
2211abb0f93cSkardelesac
22128585484eSchristoscase "$ntp_ok" in
22138585484eSchristos yes)
2214abb0f93cSkardel    ntp_refclock=yes
2215f003fb54Skardel    AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
22168585484eSchristos    ;;
22178585484eSchristosesac
2218f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2219abb0f93cSkardel
2220abb0f93cSkardelAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2221f003fb54SkardelAC_ARG_ENABLE(
2222f003fb54Skardel    [LEITCH],
2223f003fb54Skardel    [AS_HELP_STRING(
2224f003fb54Skardel	[--enable-LEITCH],
2225f003fb54Skardel	[+ Leitch CSD 5300 Master Clock System Driver]
2226f003fb54Skardel    )],
2227f003fb54Skardel    [ntp_ok=$enableval],
2228f003fb54Skardel    [ntp_ok=$ntp_eac]
2229f003fb54Skardel)
22308585484eSchristoscase "$ntp_ok" in
22318585484eSchristos yes)
2232abb0f93cSkardel    ntp_refclock=yes
2233f003fb54Skardel    AC_DEFINE([CLOCK_LEITCH], [1],
2234f003fb54Skardel	[Leitch CSD 5300 Master Clock System Driver?])
22358585484eSchristos    ;;
22368585484eSchristosesac
2237f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2238abb0f93cSkardel
2239abb0f93cSkardelAC_MSG_CHECKING([local clock reference])
2240f003fb54SkardelAC_ARG_ENABLE(
2241f003fb54Skardel    [LOCAL-CLOCK],
2242f003fb54Skardel    [AS_HELP_STRING(
2243f003fb54Skardel	[--enable-LOCAL-CLOCK],
2244f003fb54Skardel	[+ local clock reference]
2245f003fb54Skardel    )],
2246f003fb54Skardel    [ntp_ok=$enableval],
2247f003fb54Skardel    [ntp_ok=$ntp_eac]
2248f003fb54Skardel)
22498585484eSchristoscase "$ntp_ok" in
22508585484eSchristos yes)
2251abb0f93cSkardel    ntp_refclock=yes
2252f003fb54Skardel    AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
22538585484eSchristos    ;;
22548585484eSchristosesac
2255f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2256abb0f93cSkardel
2257abb0f93cSkardeldnl Bug 340: longstanding unfixed bugs
2258f003fb54Skardeldnl AC_MSG_CHECKING([EES M201 MSF receiver])
2259f003fb54Skardeldnl AC_ARG_ENABLE([MSFEES],
2260f003fb54Skardeldnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
2261abb0f93cSkardeldnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2262abb0f93cSkardeldnl if test "$ntp_ok" = "yes"; then
2263abb0f93cSkardeldnl     ntp_refclock=yes
2264f003fb54Skardeldnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
2265abb0f93cSkardeldnl fi
2266f003fb54Skardeldnl AC_MSG_RESULT([$ntp_ok])
2267abb0f93cSkardel
2268abb0f93cSkardel# Not Ultrix
2269abb0f93cSkardelAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2270f003fb54SkardelAC_ARG_ENABLE(
2271f003fb54Skardel    [MX4200],
2272f003fb54Skardel    [AS_HELP_STRING(
2273f003fb54Skardel	[--enable-MX4200 ],
2274f003fb54Skardel	[s Magnavox MX4200 GPS receiver]
2275f003fb54Skardel    )],
2276abb0f93cSkardel    [ntp_ok=$enableval],
2277f003fb54Skardel    [
2278f003fb54Skardel	case "$ac_cv_var_ppsclock" in
2279abb0f93cSkardel	 yes)
2280abb0f93cSkardel	    ntp_ok=$ntp_eac
2281abb0f93cSkardel	    ;;
2282f003fb54Skardel	 *)
2283f003fb54Skardel	    ntp_ok=no
2284abb0f93cSkardel	    ;;
2285f003fb54Skardel	esac
2286f003fb54Skardel    ]
2287f003fb54Skardel)
22888585484eSchristoscase "$ntp_ok" in
22898585484eSchristos yes)
2290abb0f93cSkardel    ntp_refclock=yes
2291f003fb54Skardel    AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
22928585484eSchristos    ;;
22938585484eSchristosesac
2294f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2295f003fb54Skardelcase "$ntp_ok$host" in
2296f003fb54Skardel yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
2297f003fb54Skardelesac
2298abb0f93cSkardel
2299f003fb54SkardelAC_MSG_CHECKING([for NeoClock4X receiver])
2300f003fb54SkardelAC_ARG_ENABLE(
2301f003fb54Skardel    [NEOCLOCK4X],
2302f003fb54Skardel    [AS_HELP_STRING(
2303f003fb54Skardel	[--enable-NEOCLOCK4X],
2304f003fb54Skardel	[+ NeoClock4X DCF77 / TDF receiver]
2305f003fb54Skardel    )],
2306f003fb54Skardel    [ntp_ok=$enableval],
2307f003fb54Skardel    [ntp_ok=$ntp_eac]
2308f003fb54Skardel)
23098585484eSchristoscase "$ntp_ok" in
23108585484eSchristos yes)
2311abb0f93cSkardel    ntp_refclock=yes
2312f003fb54Skardel    AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
23138585484eSchristos    ;;
23148585484eSchristosesac
2315f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2316abb0f93cSkardel
2317f003fb54SkardelAC_MSG_CHECKING([NMEA GPS receiver])
2318f003fb54SkardelAC_ARG_ENABLE(
2319f003fb54Skardel    [NMEA],
2320f003fb54Skardel    [AS_HELP_STRING(
2321f003fb54Skardel	[--enable-NMEA],
2322f003fb54Skardel	[+ NMEA GPS receiver]
2323f003fb54Skardel    )],
2324f003fb54Skardel    [ntp_ok=$enableval],
2325f003fb54Skardel    [ntp_ok=$ntp_eac]
2326f003fb54Skardel)
23278585484eSchristoscase "$ntp_ok" in
23288585484eSchristos yes)
2329abb0f93cSkardel    ntp_refclock=yes
2330f003fb54Skardel    AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
23318585484eSchristos    ;;
23328585484eSchristosesac
2333f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2334abb0f93cSkardel
2335b8ecfcfeSchristosAC_CHECK_FUNCS([strtoll])
2336b8ecfcfeSchristosAC_MSG_CHECKING([for GPSD JSON receiver])
2337b8ecfcfeSchristosAC_ARG_ENABLE(
2338b8ecfcfeSchristos    [GPSD],
2339b8ecfcfeSchristos    [AS_HELP_STRING(
2340b8ecfcfeSchristos	[--enable-GPSD],
2341b8ecfcfeSchristos	[+ GPSD JSON receiver]
2342b8ecfcfeSchristos    )],
2343b8ecfcfeSchristos    [ntp_ok=$enableval],
2344b8ecfcfeSchristos    [case "$ac_cv_func_strtoll" in
2345b8ecfcfeSchristos     yes) ntp_ok=$ntp_eac ;;
2346b8ecfcfeSchristos     *)   ntp_ok="no" ;;
2347b8ecfcfeSchristos    esac]
2348b8ecfcfeSchristos)
2349b8ecfcfeSchristoscase "$ntp_ok" in
2350b8ecfcfeSchristos yes)
2351b8ecfcfeSchristos    ntp_refclock=yes
2352b8ecfcfeSchristos    AC_DEFINE([CLOCK_GPSDJSON], [1], [GPSD JSON receiver])
2353b8ecfcfeSchristos    ;;
2354b8ecfcfeSchristosesac
2355b8ecfcfeSchristosAC_MSG_RESULT([$ntp_ok])
2356b8ecfcfeSchristos
2357f003fb54SkardelAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2358f003fb54SkardelAC_ARG_ENABLE(
2359f003fb54Skardel    [ONCORE],
2360f003fb54Skardel    [AS_HELP_STRING(
2361f003fb54Skardel	[--enable-ONCORE],
2362f003fb54Skardel	[s Motorola VP/UT Oncore GPS receiver]
2363f003fb54Skardel    )],
2364f003fb54Skardel    [ntp_ok=$enableval],
2365f003fb54Skardel    [ntp_ok=$ntp_eac]
2366f003fb54Skardel)
2367f003fb54Skardelcase "$ntp_oncore_ok" in
2368abb0f93cSkardel no) ntp_ok=no ;;
2369abb0f93cSkardelesac
23708585484eSchristoscase "$ntp_ok" in
23718585484eSchristos yes)
2372abb0f93cSkardel    ntp_refclock=yes
2373f003fb54Skardel    AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
23748585484eSchristos    ;;
23758585484eSchristosesac
2376f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2377f003fb54Skardel
2378f003fb54Skardel# Requires modem control
2379f003fb54SkardelAC_MSG_CHECKING([for Palisade clock])
2380f003fb54SkardelAC_ARG_ENABLE(
2381f003fb54Skardel    [PALISADE],
2382f003fb54Skardel    [AS_HELP_STRING(
2383f003fb54Skardel	[--enable-PALISADE],
2384f003fb54Skardel	[s Palisade clock]
2385f003fb54Skardel    )],
2386f003fb54Skardel    [ntp_ok=$enableval],
2387f003fb54Skardel    [ntp_ok=$ntp_enable_all_modem_control_clocks]
2388f003fb54Skardel)
23898585484eSchristoscase "$ntp_ok" in
23908585484eSchristos yes)
2391f003fb54Skardel    ntp_refclock=yes
2392f003fb54Skardel    AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
23938585484eSchristos    ;;
23948585484eSchristosesac
2395f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2396f003fb54Skardel
2397f003fb54SkardelAC_MSG_CHECKING([Conrad parallel port radio clock])
2398f003fb54SkardelAC_ARG_ENABLE(
2399f003fb54Skardel    [PCF],
2400f003fb54Skardel    [AS_HELP_STRING(
2401f003fb54Skardel	[--enable-PCF ],
2402f003fb54Skardel	[+ Conrad parallel port radio clock]
2403f003fb54Skardel    )],
2404f003fb54Skardel    [ntp_ok=$enableval],
2405f003fb54Skardel    [ntp_ok=$ntp_eac]
2406f003fb54Skardel)
24078585484eSchristoscase "$ntp_ok" in
24088585484eSchristos yes)
2409f003fb54Skardel    ntp_refclock=yes
2410f003fb54Skardel    AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
24118585484eSchristos    ;;
24128585484eSchristosesac
2413f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2414f003fb54Skardel
2415f003fb54SkardelAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2416f003fb54SkardelAC_ARG_ENABLE(
2417f003fb54Skardel    [PST],
2418f003fb54Skardel    [AS_HELP_STRING(
2419f003fb54Skardel	[--enable-PST],
2420f003fb54Skardel	[+ PST/Traconex 1020 WWV/WWVH receiver]
2421f003fb54Skardel    )],
2422f003fb54Skardel    [ntp_ok=$enableval],
2423f003fb54Skardel    [ntp_ok=$ntp_eac]
2424f003fb54Skardel)
24258585484eSchristoscase "$ntp_ok" in
24268585484eSchristos yes)
2427f003fb54Skardel    ntp_refclock=yes
2428f003fb54Skardel    AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
24298585484eSchristos    ;;
24308585484eSchristosesac
2431f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2432f003fb54Skardel
2433f003fb54SkardelAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2434f003fb54SkardelAC_ARG_ENABLE(
2435f003fb54Skardel    [RIPENCC],
2436f003fb54Skardel    [AS_HELP_STRING(
2437f003fb54Skardel	[--enable-RIPENCC],
2438f003fb54Skardel	[- RIPENCC specific Trimble driver]
2439f003fb54Skardel    )],
2440f003fb54Skardel    [ntp_ok=$enableval],
2441f003fb54Skardel    [ntp_ok=no]
2442f003fb54Skardel)
2443f003fb54Skardel# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2444f003fb54Skardelcase "$ntp_ripe_ncc_ok" in
2445f003fb54Skardel no) ntp_ok=no ;;
2446f003fb54Skardelesac
24478585484eSchristoscase "$ntp_ok" in
24488585484eSchristos yes)
2449f003fb54Skardel    ntp_refclock=yes
2450f003fb54Skardel    AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
24518585484eSchristos    ;;
24528585484eSchristosesac
2453f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2454abb0f93cSkardel
2455abb0f93cSkardel# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2456abb0f93cSkardel# For *IX, we need sys/ipc.h and sys/shm.h.
2457abb0f93cSkardelAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2458f003fb54SkardelAC_ARG_ENABLE(
2459f003fb54Skardel    [SHM],
2460f003fb54Skardel    [AS_HELP_STRING(
2461f003fb54Skardel	[--enable-SHM],
2462f003fb54Skardel	[s SHM clock attached thru shared memory]
2463f003fb54Skardel    )],
2464abb0f93cSkardel    [ntp_ok=$enableval],
2465f003fb54Skardel    [
2466f003fb54Skardel	case "$ntp_eac$ntp_canshm" in
2467abb0f93cSkardel	 *no*)	ntp_ok=no  ;;
2468abb0f93cSkardel	 *)	ntp_ok=yes ;;
2469f003fb54Skardel	esac
2470f003fb54Skardel    ]
2471f003fb54Skardel)
24728585484eSchristoscase "$ntp_ok" in
24738585484eSchristos yes)
2474abb0f93cSkardel    ntp_refclock=yes
2475f003fb54Skardel    AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
24768585484eSchristos    ;;
24778585484eSchristosesac
2478f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2479abb0f93cSkardel
2480abb0f93cSkardelAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2481f003fb54SkardelAC_ARG_ENABLE(
2482f003fb54Skardel    [SPECTRACOM],
2483f003fb54Skardel    [AS_HELP_STRING(
2484f003fb54Skardel	[--enable-SPECTRACOM],
2485f003fb54Skardel	[+ Spectracom 8170/Netclock/2 WWVB receiver]
2486f003fb54Skardel    )],
2487f003fb54Skardel    [ntp_ok=$enableval],
2488f003fb54Skardel    [ntp_ok=$ntp_eac]
2489f003fb54Skardel)
24908585484eSchristoscase "$ntp_ok" in
24918585484eSchristos yes)
2492abb0f93cSkardel    ntp_refclock=yes
2493f003fb54Skardel    AC_DEFINE([CLOCK_SPECTRACOM], [1],
2494f003fb54Skardel	[Spectracom 8170/Netclock/2 WWVB receiver])
24958585484eSchristos    ;;
24968585484eSchristosesac
2497f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2498abb0f93cSkardel
2499abb0f93cSkardelAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2500f003fb54SkardelAC_ARG_ENABLE(
2501f003fb54Skardel    [TPRO],
2502f003fb54Skardel    [AS_HELP_STRING(
2503f003fb54Skardel	[--enable-TPRO],
2504f003fb54Skardel	[s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
2505f003fb54Skardel    )],
2506abb0f93cSkardel    [ntp_ok=$enableval],
2507f003fb54Skardel    [
2508f003fb54Skardel	case "$ac_cv_header_sys_tpro_h" in
2509abb0f93cSkardel	 yes)
2510abb0f93cSkardel	    ntp_ok=$ntp_eac
2511abb0f93cSkardel	    ;;
2512f003fb54Skardel	 *)
2513f003fb54Skardel	    ntp_ok=no
2514abb0f93cSkardel	    ;;
2515f003fb54Skardel	esac
2516f003fb54Skardel    ]
2517f003fb54Skardel)
25188585484eSchristoscase "$ntp_ok" in
25198585484eSchristos yes)
2520abb0f93cSkardel    ntp_refclock=yes
2521f003fb54Skardel    AC_DEFINE([CLOCK_TPRO], [1],
2522f003fb54Skardel	[KSI/Odetics TPRO/S GPS receiver/IRIG interface])
25238585484eSchristos    ;;
25248585484eSchristosesac
2525f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2526abb0f93cSkardelcase "$ntp_ok$ac_cv_header_sys_tpro" in
2527f003fb54Skardel yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2528abb0f93cSkardelesac
2529abb0f93cSkardel
2530abb0f93cSkardel# Not on a vax-dec-bsd
2531abb0f93cSkardelAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2532f003fb54SkardelAC_ARG_ENABLE(
2533f003fb54Skardel    [TRUETIME],
2534f003fb54Skardel    [AS_HELP_STRING(
2535f003fb54Skardel	[--enable-TRUETIME],
2536f003fb54Skardel	[s Kinemetrics/TrueTime receivers]
2537f003fb54Skardel    )],
2538abb0f93cSkardel    [ntp_ok=$enableval],
2539f003fb54Skardel    [
2540f003fb54Skardel	case "$host" in
2541abb0f93cSkardel	 vax-dec-bsd)
2542abb0f93cSkardel	    ntp_ok=no
2543abb0f93cSkardel	    ;;
2544abb0f93cSkardel	 *)
2545abb0f93cSkardel	    ntp_ok=$ntp_eac
2546abb0f93cSkardel	    ;;
2547f003fb54Skardel	esac
2548f003fb54Skardel    ]
2549f003fb54Skardel)
25508585484eSchristoscase "$ntp_ok" in
25518585484eSchristos yes)
2552abb0f93cSkardel    ntp_refclock=yes
2553f003fb54Skardel    AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
25548585484eSchristos    ;;
25558585484eSchristosesac
2556f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2557abb0f93cSkardelcase "$ntp_ok$host" in
2558f003fb54Skardel yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
2559abb0f93cSkardelesac
2560abb0f93cSkardel
2561abb0f93cSkardelAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2562f003fb54SkardelAC_ARG_ENABLE(
2563f003fb54Skardel    [TT560],
2564f003fb54Skardel    [AS_HELP_STRING(
2565f003fb54Skardel	[--enable-TT560],
2566f003fb54Skardel	[- TrueTime 560 IRIG-B decoder]
2567f003fb54Skardel    )],
2568f003fb54Skardel    [ntp_ok=$enableval],
2569f003fb54Skardel    [ntp_ok=no]
2570f003fb54Skardel)
25718585484eSchristoscase "$ntp_ok" in
25728585484eSchristos yes)
2573abb0f93cSkardel    ntp_refclock=yes
2574f003fb54Skardel    AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
25758585484eSchristos    ;;
25768585484eSchristosesac
2577f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2578abb0f93cSkardel
2579abb0f93cSkardelAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2580f003fb54SkardelAC_ARG_ENABLE(
2581f003fb54Skardel    [ULINK],
2582f003fb54Skardel    [AS_HELP_STRING(
2583f003fb54Skardel	[--enable-ULINK],
2584f003fb54Skardel	[+ Ultralink WWVB receiver]
2585f003fb54Skardel    )],
2586f003fb54Skardel    [ntp_ok=$enableval],
2587f003fb54Skardel    [ntp_ok=$ntp_eac]
2588f003fb54Skardel)
25898585484eSchristoscase "$ntp_ok" in
25908585484eSchristos yes)
2591abb0f93cSkardel    ntp_refclock=yes
2592f003fb54Skardel    AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
25938585484eSchristos    ;;
25948585484eSchristosesac
25958585484eSchristosAC_MSG_RESULT([$ntp_ok])
25968585484eSchristos
25978585484eSchristosAC_MSG_CHECKING([Spectracom TSYNC PCI timing board])
25988585484eSchristosAC_ARG_ENABLE(
25998585484eSchristos    [TSYNCPCI],
26008585484eSchristos    [AS_HELP_STRING(
26018585484eSchristos	[--enable-TSYNCPCI],
26028585484eSchristos	[s Spectracom TSYNC timing board]
26038585484eSchristos    )],
26048585484eSchristos    [ntp_ok=$enableval],
26058585484eSchristos    [
26068585484eSchristos	case "$host" in
26078585484eSchristos	 *-*-*linux*)
26088585484eSchristos	    ntp_ok=$ntp_eac
26098585484eSchristos	    ;;
26108585484eSchristos	 *)
26118585484eSchristos	    ntp_ok=no
26128585484eSchristos	esac
26138585484eSchristos    ]
26148585484eSchristos)
26158585484eSchristoscase "$ntp_ok" in
26168585484eSchristos yes)
26178585484eSchristos    ntp_refclock=yes
26188585484eSchristos    AC_DEFINE([CLOCK_TSYNCPCI], [1], [Spectracom TSYNC timing board])
26198585484eSchristos    ;;
26208585484eSchristosesac
2621f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2622abb0f93cSkardel
2623abb0f93cSkardelAC_MSG_CHECKING([WWV receiver])
2624f003fb54SkardelAC_ARG_ENABLE(
2625f003fb54Skardel    [WWV],
2626f003fb54Skardel    [AS_HELP_STRING(
2627f003fb54Skardel	[--enable-WWV],
2628f003fb54Skardel	[s WWV Audio receiver]
2629f003fb54Skardel    )],
2630abb0f93cSkardel    [ntp_ok=$enableval],
2631f003fb54Skardel    [
2632f003fb54Skardel	case "$ntp_eac$ntp_canaudio" in
2633abb0f93cSkardel	 *no*)	ntp_ok=no  ;;
2634abb0f93cSkardel	 *)	ntp_ok=yes ;;
2635f003fb54Skardel	esac
2636f003fb54Skardel    ]
2637f003fb54Skardel)
26388585484eSchristoscase "$ntp_ok" in
26398585484eSchristos yes)
2640abb0f93cSkardel    ntp_refclock=yes
2641f003fb54Skardel    AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
26428585484eSchristos    ;;
26438585484eSchristosesac
2644f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2645abb0f93cSkardelcase "$ntp_ok$ntp_canaudio" in
2646f003fb54Skardel yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
2647abb0f93cSkardelesac
2648abb0f93cSkardel
2649abb0f93cSkardelAC_MSG_CHECKING([for Zyfer receiver])
2650f003fb54SkardelAC_ARG_ENABLE(
2651f003fb54Skardel    [ZYFER],
2652f003fb54Skardel    [AS_HELP_STRING(
2653f003fb54Skardel	[--enable-ZYFER],
2654f003fb54Skardel	[+ Zyfer GPStarplus receiver]
2655f003fb54Skardel    )],
2656f003fb54Skardel    [ntp_ok=$enableval],
2657f003fb54Skardel    [ntp_ok=$ntp_eac]
2658f003fb54Skardel)
26598585484eSchristoscase "$ntp_ok" in
26608585484eSchristos yes)
2661abb0f93cSkardel    ntp_refclock=yes
2662f003fb54Skardel    AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
26638585484eSchristos    ;;
26648585484eSchristosesac
2665f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2666abb0f93cSkardel
2667abb0f93cSkardelAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2668f003fb54SkardelAC_ARG_ENABLE(
2669f003fb54Skardel    [parse-clocks],
2670f003fb54Skardel    [AS_HELP_STRING(
2671f003fb54Skardel	[--enable-parse-clocks],
2672f003fb54Skardel	[- include all suitable PARSE clocks:]
2673f003fb54Skardel    )],
2674abb0f93cSkardel    [ntp_eapc=$enableval],
2675f003fb54Skardel    [
2676f003fb54Skardel	case "$ntp_eac" in
2677abb0f93cSkardel	 yes)	ntp_eapc=$ntp_canparse ;;
2678abb0f93cSkardel	 *)	ntp_eapc=no ;;
2679abb0f93cSkardel	esac
2680abb0f93cSkardel	# Delete the next line one of these days
2681f003fb54Skardel	ntp_eapc=no
2682f003fb54Skardel    ]
2683f003fb54Skardel)
2684abb0f93cSkardelAC_MSG_RESULT($ntp_eapc)
2685abb0f93cSkardel
2686abb0f93cSkardelcase "$ntp_eac$ntp_eapc$ntp_canparse" in
2687abb0f93cSkardel noyes*)
2688abb0f93cSkardel    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2689abb0f93cSkardel    ;;
2690abb0f93cSkardel yesyesno)
2691abb0f93cSkardel    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2692abb0f93cSkardel    ;;
2693abb0f93cSkardelesac
2694abb0f93cSkardel
2695abb0f93cSkardelntp_libparse=no
2696abb0f93cSkardelntp_parseutil=no
2697abb0f93cSkardelntp_rawdcf=no
2698abb0f93cSkardel
2699abb0f93cSkardelAC_MSG_CHECKING([Diem Computime Radio Clock])
2700f003fb54SkardelAC_ARG_ENABLE(
2701f003fb54Skardel    [COMPUTIME],
2702f003fb54Skardel    [AS_HELP_STRING(
2703f003fb54Skardel	[--enable-COMPUTIME],
2704f003fb54Skardel	[s Diem Computime Radio Clock]
2705f003fb54Skardel    )],
2706f003fb54Skardel    [ntp_ok=$enableval],
2707f003fb54Skardel    [ntp_ok=$ntp_eapc]
2708f003fb54Skardel)
27098585484eSchristoscase "$ntp_ok" in
27108585484eSchristos yes)
2711abb0f93cSkardel    ntp_libparse=yes
2712abb0f93cSkardel    ntp_refclock=yes
2713f003fb54Skardel    AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
27148585484eSchristos    ;;
27158585484eSchristosesac
2716f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2717abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2718abb0f93cSkardel yesno)
2719abb0f93cSkardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2720abb0f93cSkardelesac
2721abb0f93cSkardel
2722abb0f93cSkardelAC_MSG_CHECKING([ELV/DCF7000 clock])
2723f003fb54SkardelAC_ARG_ENABLE(
2724f003fb54Skardel    [DCF7000],
2725f003fb54Skardel    [AS_HELP_STRING(
2726f003fb54Skardel	[--enable-DCF7000],
2727f003fb54Skardel	[s ELV/DCF7000 clock]
2728f003fb54Skardel    )],
2729f003fb54Skardel    [ntp_ok=$enableval],
2730f003fb54Skardel    [ntp_ok=$ntp_eapc]
2731f003fb54Skardel)
27328585484eSchristoscase "$ntp_ok" in
27338585484eSchristos yes)
2734abb0f93cSkardel    ntp_libparse=yes
2735abb0f93cSkardel    ntp_refclock=yes
2736f003fb54Skardel    AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
27378585484eSchristos    ;;
27388585484eSchristosesac
2739f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2740abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2741abb0f93cSkardel yesno)
2742abb0f93cSkardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2743abb0f93cSkardelesac
2744abb0f93cSkardel
2745abb0f93cSkardelAC_MSG_CHECKING([HOPF 6021 clock])
2746f003fb54SkardelAC_ARG_ENABLE(
2747f003fb54Skardel    [HOPF6021],
2748f003fb54Skardel    [AS_HELP_STRING(
2749f003fb54Skardel	[--enable-HOPF6021],
2750f003fb54Skardel	[s HOPF 6021 clock]
2751f003fb54Skardel    )],
2752f003fb54Skardel    [ntp_ok=$enableval],
2753f003fb54Skardel    [ntp_ok=$ntp_eapc]
2754f003fb54Skardel)
27558585484eSchristoscase "$ntp_ok" in
27568585484eSchristos yes)
2757abb0f93cSkardel    ntp_libparse=yes
2758abb0f93cSkardel    ntp_refclock=yes
2759f003fb54Skardel    AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
27608585484eSchristos    ;;
27618585484eSchristosesac
2762f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2763abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2764abb0f93cSkardel yesno)
2765abb0f93cSkardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2766abb0f93cSkardelesac
2767abb0f93cSkardel
2768abb0f93cSkardelAC_MSG_CHECKING([Meinberg clocks])
2769f003fb54SkardelAC_ARG_ENABLE(
2770f003fb54Skardel    [MEINBERG],
2771f003fb54Skardel    [AS_HELP_STRING(
2772f003fb54Skardel	[--enable-MEINBERG],
2773f003fb54Skardel	[s Meinberg clocks]
2774f003fb54Skardel    )],
2775f003fb54Skardel    [ntp_ok=$enableval],
2776f003fb54Skardel    [ntp_ok=$ntp_eapc]
2777f003fb54Skardel)
27788585484eSchristoscase "$ntp_ok" in
27798585484eSchristos yes)
2780abb0f93cSkardel    ntp_libparse=yes
2781abb0f93cSkardel    ntp_refclock=yes
2782f003fb54Skardel    AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
27838585484eSchristos    ;;
27848585484eSchristosesac
2785f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2786abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2787abb0f93cSkardel yesno)
2788abb0f93cSkardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2789abb0f93cSkardelesac
2790abb0f93cSkardel
2791abb0f93cSkardelAC_MSG_CHECKING([DCF77 raw time code])
2792f003fb54SkardelAC_ARG_ENABLE(
2793f003fb54Skardel    [RAWDCF],
2794f003fb54Skardel    [AS_HELP_STRING(
2795f003fb54Skardel	[--enable-RAWDCF],
2796f003fb54Skardel	[s DCF77 raw time code]
2797f003fb54Skardel    )],
2798f003fb54Skardel    [ntp_ok=$enableval],
2799f003fb54Skardel    [ntp_ok=$ntp_eapc]
2800f003fb54Skardel)
28018585484eSchristoscase "$ntp_ok" in
28028585484eSchristos yes)
2803abb0f93cSkardel    ntp_libparse=yes
2804abb0f93cSkardel    ntp_parseutil=yes
2805abb0f93cSkardel    ntp_refclock=yes
2806abb0f93cSkardel    ntp_rawdcf=yes
2807f003fb54Skardel    AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
28088585484eSchristos    ;;
28098585484eSchristosesac
2810f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2811abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2812abb0f93cSkardel yesno)
2813f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2814abb0f93cSkardelesac
2815abb0f93cSkardel
2816abb0f93cSkardelcase "$ntp_rawdcf" in
2817abb0f93cSkardel yes)
2818abb0f93cSkardel    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2819f003fb54Skardel	[ntp_cv_rawdcf_parity],
2820f003fb54Skardel	[
2821f003fb54Skardel	    ans=no
2822abb0f93cSkardel	    case "$host" in
2823abb0f93cSkardel	     *-*-*linux*)
2824abb0f93cSkardel		ans=yes
2825abb0f93cSkardel		;;
2826abb0f93cSkardel	    esac
2827f003fb54Skardel	    ntp_cv_rawdcf_parity=$ans
2828f003fb54Skardel	]
2829f003fb54Skardel    )
2830f003fb54Skardel    case "$ntp_cv_rawdcf_parity" in
2831f003fb54Skardel     yes)
2832f003fb54Skardel	AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
2833f003fb54Skardel	    [Should we not IGNPAR (Linux)?]) ;;
2834abb0f93cSkardel    esac
2835abb0f93cSkardelesac
2836abb0f93cSkardel
2837abb0f93cSkardelAC_MSG_CHECKING([RCC 8000 clock])
2838f003fb54SkardelAC_ARG_ENABLE(
2839f003fb54Skardel    [RCC8000],
2840f003fb54Skardel    [AS_HELP_STRING(
2841f003fb54Skardel	[--enable-RCC8000],
2842f003fb54Skardel	[s RCC 8000 clock]
2843f003fb54Skardel    )],
2844f003fb54Skardel    [ntp_ok=$enableval],
2845f003fb54Skardel    [ntp_ok=$ntp_eapc]
2846f003fb54Skardel)
28478585484eSchristoscase "$ntp_ok" in
28488585484eSchristos yes)
2849abb0f93cSkardel    ntp_libparse=yes
2850abb0f93cSkardel    ntp_refclock=yes
2851f003fb54Skardel    AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
28528585484eSchristos    ;;
28538585484eSchristosesac
2854f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2855abb0f93cSkardelcase "$ntp_ok$ntp_canparse" in
2856abb0f93cSkardel yesno)
2857abb0f93cSkardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2858abb0f93cSkardelesac
2859f003fb54Skardel
2860f003fb54SkardelAC_MSG_CHECKING([Schmid DCF77 clock])
2861f003fb54SkardelAC_ARG_ENABLE(
2862f003fb54Skardel    [SCHMID],
2863f003fb54Skardel    [AS_HELP_STRING(
2864f003fb54Skardel	[--enable-SCHMID ],
2865f003fb54Skardel	[s Schmid DCF77 clock]
2866f003fb54Skardel    )],
2867f003fb54Skardel    [ntp_ok=$enableval],
2868f003fb54Skardel    [ntp_ok=$ntp_eapc]
2869f003fb54Skardel)
28708585484eSchristoscase "$ntp_ok" in
28718585484eSchristos yes)
2872f003fb54Skardel    ntp_libparse=yes
2873f003fb54Skardel    ntp_refclock=yes
2874f003fb54Skardel    AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
28758585484eSchristos    ;;
28768585484eSchristosesac
2877f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2878f003fb54Skardelcase "$ntp_ok$ntp_canparse" in
2879f003fb54Skardel yesno)
2880f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2881f003fb54Skardelesac
2882f003fb54Skardel
2883f003fb54SkardelAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
2884f003fb54SkardelAC_ARG_ENABLE(
2885f003fb54Skardel    [TRIMTAIP],
2886f003fb54Skardel    [AS_HELP_STRING(
2887f003fb54Skardel	[--enable-TRIMTAIP],
2888f003fb54Skardel	[s Trimble GPS receiver/TAIP protocol]
2889f003fb54Skardel    )],
2890f003fb54Skardel    [ntp_ok=$enableval],
2891f003fb54Skardel    [ntp_ok=$ntp_eapc]
2892f003fb54Skardel)
28938585484eSchristoscase "$ntp_ok" in
28948585484eSchristos yes)
2895f003fb54Skardel    ntp_libparse=yes
2896f003fb54Skardel    ntp_refclock=yes
2897f003fb54Skardel    AC_DEFINE([CLOCK_TRIMTAIP], [1],
2898f003fb54Skardel	[Trimble GPS receiver/TAIP protocol])
28998585484eSchristos    ;;
29008585484eSchristosesac
2901f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2902f003fb54Skardelcase "$ntp_ok$ntp_canparse" in
2903f003fb54Skardel yesno)
2904f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2905f003fb54Skardelesac
2906f003fb54Skardel
2907f003fb54SkardelAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
2908f003fb54SkardelAC_ARG_ENABLE(
2909f003fb54Skardel    [TRIMTSIP],
2910f003fb54Skardel    [AS_HELP_STRING(
2911f003fb54Skardel	[--enable-TRIMTSIP],
2912f003fb54Skardel	[s Trimble GPS receiver/TSIP protocol]
2913f003fb54Skardel    )],
2914f003fb54Skardel    [ntp_ok=$enableval],
2915f003fb54Skardel    [ntp_ok=$ntp_eapc]
2916f003fb54Skardel)
29178585484eSchristoscase "$ntp_ok" in
29188585484eSchristos yes)
2919f003fb54Skardel    ntp_libparse=yes
2920f003fb54Skardel    ntp_refclock=yes
2921f003fb54Skardel    AC_DEFINE([CLOCK_TRIMTSIP], [1],
2922f003fb54Skardel	[Trimble GPS receiver/TSIP protocol])
29238585484eSchristos    ;;
29248585484eSchristosesac
2925f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2926f003fb54Skardelcase "$ntp_ok$ntp_canparse" in
2927f003fb54Skardel yesno)
2928f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2929f003fb54Skardelesac
2930f003fb54Skardel
2931f003fb54SkardelAC_MSG_CHECKING([WHARTON 400A Series clock])
2932f003fb54SkardelAC_ARG_ENABLE(
2933f003fb54Skardel    [WHARTON],
2934f003fb54Skardel    [AS_HELP_STRING(
2935f003fb54Skardel	[--enable-WHARTON],
2936f003fb54Skardel	[s WHARTON 400A Series clock]
2937f003fb54Skardel    )],
2938f003fb54Skardel    [ntp_ok=$enableval],
2939f003fb54Skardel    [ntp_ok=$ntp_eapc]
2940f003fb54Skardel)
29418585484eSchristoscase "$ntp_ok" in
29428585484eSchristos yes)
2943f003fb54Skardel    ntp_libparse=yes
2944f003fb54Skardel    ntp_refclock=yes
2945f003fb54Skardel    AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
29468585484eSchristos    ;;
29478585484eSchristosesac
2948f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2949f003fb54Skardelcase "$ntp_ok$ntp_canparse" in
2950f003fb54Skardel yesno)
2951f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2952f003fb54Skardelesac
2953f003fb54Skardel
2954f003fb54SkardelAC_MSG_CHECKING([VARITEXT clock])
2955f003fb54SkardelAC_ARG_ENABLE(
2956f003fb54Skardel    [VARITEXT],
2957f003fb54Skardel    [AS_HELP_STRING(
2958f003fb54Skardel	[--enable-VARITEXT],
2959f003fb54Skardel	[s VARITEXT clock]
2960f003fb54Skardel    )],
2961f003fb54Skardel    [ntp_ok=$enableval],
2962f003fb54Skardel    [ntp_ok=$ntp_eapc]
2963f003fb54Skardel)
29648585484eSchristoscase "$ntp_ok" in
29658585484eSchristos yes)
2966f003fb54Skardel    ntp_libparse=yes
2967f003fb54Skardel    ntp_refclock=yes
2968f003fb54Skardel    AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
29698585484eSchristos    ;;
29708585484eSchristosesac
2971f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
2972f003fb54Skardelcase "$ntp_ok$ntp_canparse" in
2973f003fb54Skardel yesno)
2974f003fb54Skardel    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2975f003fb54Skardelesac
2976f003fb54Skardel
29778585484eSchristosAC_MSG_CHECKING(SEL240X clock)
29788585484eSchristosAC_ARG_ENABLE(SEL240X,
29798585484eSchristos    AC_HELP_STRING([--enable-SEL240X], [s SEL240X clock]),
29808585484eSchristos    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
29818585484eSchristosif test "$ntp_ok" = "yes"; then
29828585484eSchristos    ntp_libparse=yes
29838585484eSchristos    ntp_refclock=yes
29848585484eSchristos    AC_DEFINE(CLOCK_SEL240X, 1, [SEL240X protocol])
29858585484eSchristosfi
29868585484eSchristosAC_MSG_RESULT($ntp_ok)
29878585484eSchristoscase "$ntp_ok$ntp_canparse" in
29888585484eSchristos yesno)
29898585484eSchristos    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
29908585484eSchristos    ;;
29918585484eSchristosesac
29928585484eSchristos
2993f003fb54SkardelAC_SUBST([LIBPARSE])
2994f003fb54SkardelAC_SUBST([MAKE_LIBPARSE])
2995f003fb54SkardelAC_SUBST([MAKE_LIBPARSE_KERNEL])
2996f003fb54SkardelAC_SUBST([MAKE_CHECK_Y2K])
2997f003fb54Skardel
2998abb0f93cSkardelAC_MSG_CHECKING([if we need to make and use the parse libraries])
2999abb0f93cSkardelans=no
3000abb0f93cSkardelcase "$ntp_libparse" in
3001abb0f93cSkardel yes)
3002abb0f93cSkardel    ans=yes
3003f003fb54Skardel    AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
3004abb0f93cSkardel    LIBPARSE=../libparse/libparse.a
3005abb0f93cSkardel    MAKE_LIBPARSE=libparse.a
3006abb0f93cSkardel    # HMS: check_y2k trips the 34 year problem now...
3007abb0f93cSkardel    false && MAKE_CHECK_Y2K=check_y2k
3008abb0f93cSkardelesac
3009abb0f93cSkardelAC_MSG_RESULT([$ans])
3010abb0f93cSkardel
3011*eabc0478Schristos# if we have crypto, by default Autokey is enabled
30128585484eSchristosAC_ARG_ENABLE(
30138585484eSchristos    [autokey],
30148585484eSchristos    AS_HELP_STRING(
30158585484eSchristos	[--enable-autokey],
30168585484eSchristos	[+ support NTP Autokey protocol]
30178585484eSchristos	),
30188585484eSchristos    [ntp_autokey=$enableval],
30198585484eSchristos    [ntp_autokey=$ntp_openssl]
3020f003fb54Skardel)
30218585484eSchristoscase "$ntp_autokey" in
30228585484eSchristos no)
30238585484eSchristos    ;;
3024abb0f93cSkardel *)
30258585484eSchristos    case "$ntp_openssl" in
30268585484eSchristos     no)
3027*eabc0478Schristos	AC_MSG_WARN([Disabling Autokey, crypto unavailable.])
30288585484eSchristos	ntp_autokey=no
30298585484eSchristos	;;
30308585484eSchristos     *)
30318585484eSchristos	AC_DEFINE([AUTOKEY], [1], [Support NTP Autokey protocol?])
30328585484eSchristos	ntp_autokey=yes
3033abb0f93cSkardel	;;
3034abb0f93cSkardel    esac
30358585484eSchristos    ;;
30368585484eSchristosesac
3037*eabc0478SchristosAC_MSG_CHECKING([if NTP Autokey protocol will be supported])
30388585484eSchristosAC_MSG_RESULT([$ntp_autokey])
3039abb0f93cSkardel
3040f003fb54SkardelAC_SUBST([MAKE_CHECK_LAYOUT])
3041abb0f93cSkardelAC_MSG_CHECKING([if we want to run check-layout])
3042abb0f93cSkardelcase "$cross_compiling$PATH_PERL" in
3043abb0f93cSkardel no/*)
3044abb0f93cSkardel    MAKE_CHECK_LAYOUT=check-layout
3045abb0f93cSkardel    ans=yes
3046abb0f93cSkardel    ;;
3047abb0f93cSkardel *)
3048abb0f93cSkardel    ans=no
3049abb0f93cSkardel    ;;
3050abb0f93cSkardelesac
3051abb0f93cSkardelAC_MSG_RESULT([$ans])
3052abb0f93cSkardel
3053f003fb54SkardelAC_SUBST([TESTDCF])
3054f003fb54SkardelAC_SUBST([DCFD])
3055abb0f93cSkardelAC_MSG_CHECKING([if we can make dcf parse utilities])
3056abb0f93cSkardelans=no
30578585484eSchristoscase "$ntp_parseutil" in
30588585484eSchristos yes)
3059abb0f93cSkardel    case "$host" in
3060abb0f93cSkardel     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3061abb0f93cSkardel	ans="dcfd testdcf"
3062abb0f93cSkardel	DCFD=dcfd
3063abb0f93cSkardel	TESTDCF=testdcf
3064abb0f93cSkardel    esac
30658585484eSchristos    ;;
30668585484eSchristosesac
3067abb0f93cSkardelAC_MSG_RESULT([$ans])
3068abb0f93cSkardel
3069f003fb54SkardelAC_SUBST([MAKE_PARSEKMODULE])
3070abb0f93cSkardelAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3071abb0f93cSkardelans=no
3072abb0f93cSkardelcase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3073abb0f93cSkardel yesyes)
3074abb0f93cSkardel    case "$host" in
3075abb0f93cSkardel     sparc-*-sunos4*)
3076f003fb54Skardel        case "$ntp_cv_var_kernel_pll" in
3077abb0f93cSkardel	yes)
3078f003fb54Skardel	    AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
3079abb0f93cSkardel	    ;;
3080abb0f93cSkardel	esac
3081abb0f93cSkardel	ans=parsestreams
3082abb0f93cSkardel	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3083abb0f93cSkardel	;;
3084abb0f93cSkardel     sparc-*-solaris2*)
3085abb0f93cSkardel	ans=parsesolaris
3086abb0f93cSkardel	MAKE_PARSEKMODULE=parse
3087abb0f93cSkardel	AC_CHECK_HEADERS([strings.h])
3088abb0f93cSkardel	;;
3089abb0f93cSkardel    esac
3090abb0f93cSkardel    ;;
3091abb0f93cSkardelesac
3092abb0f93cSkardelAC_MSG_RESULT([$ans])
3093abb0f93cSkardel
3094abb0f93cSkardelAC_MSG_CHECKING([if we need basic refclock support])
30958585484eSchristoscase "$ntp_refclock" in
30968585484eSchristos yes)
3097f003fb54Skardel    AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
30988585484eSchristos    ;;
30998585484eSchristosesac
3100abb0f93cSkardelAC_MSG_RESULT($ntp_refclock)
3101abb0f93cSkardel
31028585484eSchristosdnl Things that can be made in clockstuff
31038585484eSchristosAC_SUBST([PROPDELAY], [propdelay])
31048585484eSchristosAC_SUBST([CHUTEST]) dnl needs work to compile
3105abb0f93cSkardel
3106f003fb54SkardelAC_SUBST([MAKE_ADJTIMED])
3107f003fb54SkardelAC_MSG_CHECKING([if we want HP-UX adjtimed support])
3108abb0f93cSkardelcase "$host" in
3109abb0f93cSkardel *-*-hpux[[56789]]*)
3110abb0f93cSkardel    ans=yes
3111abb0f93cSkardel    ;;
3112abb0f93cSkardel *) ans=no
3113abb0f93cSkardel    ;;
3114abb0f93cSkardelesac
31158585484eSchristoscase "$ans" in
31168585484eSchristos yes)
3117abb0f93cSkardel    MAKE_ADJTIMED=adjtimed
3118f003fb54Skardel    AC_DEFINE([NEED_HPUX_ADJTIME], [1],
3119f003fb54Skardel	[Do we need HPUX adjtime() library support?])
31208585484eSchristos    ;;
31218585484eSchristos *) ADJTIMED_DB=
31228585484eSchristos    ADJTIMED_DL=
31238585484eSchristos    ADJTIMED_DS=
31248585484eSchristos    ADJTIMED_MS=
31258585484eSchristos    ;;
31268585484eSchristosesac
3127abb0f93cSkardelAC_MSG_RESULT([$ans])
3128abb0f93cSkardel
3129abb0f93cSkardelAC_MSG_CHECKING([if we want QNX adjtime support])
3130abb0f93cSkardelcase "$host" in
3131abb0f93cSkardel *-*-qnx*)
3132abb0f93cSkardel    ans=yes
3133abb0f93cSkardel    ;;
3134abb0f93cSkardel *) ans=no
3135abb0f93cSkardel    ;;
3136abb0f93cSkardelesac
31378585484eSchristoscase "$ans" in
31388585484eSchristos yes)
3139f003fb54Skardel    AC_DEFINE([NEED_QNX_ADJTIME], [1],
3140f003fb54Skardel	[Do we need the qnx adjtime call?])
31418585484eSchristos    ;;
31428585484eSchristosesac
3143abb0f93cSkardelAC_MSG_RESULT([$ans])
3144abb0f93cSkardel
3145abb0f93cSkardelAC_MSG_CHECKING([if we can read kmem])
3146abb0f93cSkardel
3147abb0f93cSkardel#  the default is to enable it if the system has the capability
3148abb0f93cSkardel
3149abb0f93cSkardelcase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3150abb0f93cSkardel *yes*)
3151abb0f93cSkardel    ans=yes
3152abb0f93cSkardel    ;;
3153abb0f93cSkardel *) ans=no
31548585484eSchristos    ;;
3155abb0f93cSkardelesac
3156abb0f93cSkardel
3157abb0f93cSkardelcase "$host" in
3158abb0f93cSkardel *-*-domainos)	# Won't be found...
3159abb0f93cSkardel    ans=no
3160abb0f93cSkardel    ;;
3161abb0f93cSkardel *-*-hpux*)
3162abb0f93cSkardel    #ans=no
3163abb0f93cSkardel    ;;
3164abb0f93cSkardel *-*-irix[[456]]*)
3165abb0f93cSkardel    ans=no
3166abb0f93cSkardel    ;;
3167abb0f93cSkardel *-*-*linux*)
3168abb0f93cSkardel    ans=no
3169abb0f93cSkardel    ;;
3170abb0f93cSkardel *-*-winnt3.5)
3171abb0f93cSkardel    ans=no
3172abb0f93cSkardel    ;;
3173abb0f93cSkardel *-*-unicosmp*)
3174abb0f93cSkardel    ans=no
3175abb0f93cSkardel    ;;
3176abb0f93cSkardelesac
3177abb0f93cSkardel
3178abb0f93cSkardel# --enable-kmem / --disable-kmem controls if present
3179abb0f93cSkardelAC_ARG_ENABLE(
3180abb0f93cSkardel    [kmem],
3181f003fb54Skardel    [AS_HELP_STRING(
3182abb0f93cSkardel	[--enable-kmem],
3183abb0f93cSkardel	[s read /dev/kmem for tick and/or tickadj]
3184f003fb54Skardel    )],
3185abb0f93cSkardel    [ans=$enableval]
3186abb0f93cSkardel)
3187abb0f93cSkardel
3188abb0f93cSkardelAC_MSG_RESULT([$ans])
3189abb0f93cSkardel
3190abb0f93cSkardelcase "$ans" in
3191abb0f93cSkardel yes)
3192abb0f93cSkardel    can_kmem=yes
3193abb0f93cSkardel    ;;
3194abb0f93cSkardel *)
3195abb0f93cSkardel    can_kmem=no
3196f003fb54Skardel    AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
3197abb0f93cSkardelesac
3198abb0f93cSkardel
3199abb0f93cSkardel
3200abb0f93cSkardelAC_MSG_CHECKING([if adjtime is accurate])
3201abb0f93cSkardel
3202abb0f93cSkardel# target-dependent defaults
3203abb0f93cSkardel
3204abb0f93cSkardelcase "$host" in
3205abb0f93cSkardel i386-sequent-ptx*)
3206abb0f93cSkardel    ans=no
3207abb0f93cSkardel    ;;
3208abb0f93cSkardel i386-unknown-osf1*)
3209abb0f93cSkardel    ans=yes
3210abb0f93cSkardel    ;;
3211abb0f93cSkardel mips-sgi-irix[[456]]*)
3212abb0f93cSkardel    ans=yes
3213abb0f93cSkardel    ;;
3214abb0f93cSkardel *-fujitsu-uxp*)
3215abb0f93cSkardel    ans=yes
3216abb0f93cSkardel    ;;
32178585484eSchristos *-ibm-aix[[4-9]]*)
32188585484eSchristos    # XXX only verified thru AIX6.
3219abb0f93cSkardel    ans=yes
3220abb0f93cSkardel    ;;
3221abb0f93cSkardel *-*-*linux*)
3222abb0f93cSkardel    ans=yes
3223abb0f93cSkardel    ;;
3224abb0f93cSkardel *-*-solaris2.[[01]])
3225abb0f93cSkardel    ans=no
3226abb0f93cSkardel    ;;
3227abb0f93cSkardel *-*-solaris2*)
3228abb0f93cSkardel    ans=yes
3229abb0f93cSkardel    ;;
3230abb0f93cSkardel *-*-unicosmp*)
3231abb0f93cSkardel    ans=yes
3232abb0f93cSkardel    ;;
3233abb0f93cSkardel *) ans=no
32348585484eSchristos    ;;
3235abb0f93cSkardelesac
3236abb0f93cSkardel
3237abb0f93cSkardel# --enable-accurate-adjtime / --disable-accurate-adjtime
3238abb0f93cSkardel# override the default
3239f003fb54SkardelAC_ARG_ENABLE(
3240f003fb54Skardel    [accurate-adjtime],
3241f003fb54Skardel    [AS_HELP_STRING(
3242abb0f93cSkardel	[--enable-accurate-adjtime],
3243abb0f93cSkardel	[s the adjtime() call is accurate]
3244f003fb54Skardel    )],
3245f003fb54Skardel    [ans=$enableval]
3246abb0f93cSkardel)
3247abb0f93cSkardel
3248abb0f93cSkardelAC_MSG_RESULT([$ans])
3249abb0f93cSkardel
3250abb0f93cSkardelcase "$ans" in
3251abb0f93cSkardel yes)
3252f003fb54Skardel    AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
3253abb0f93cSkardel    adjtime_is_accurate=yes
3254abb0f93cSkardel    ;;
3255abb0f93cSkardel *)
3256abb0f93cSkardel    adjtime_is_accurate=no
3257f003fb54Skardel    ;;
3258abb0f93cSkardelesac
3259abb0f93cSkardel
3260f003fb54SkardelAC_CACHE_CHECK(
3261f003fb54Skardel    [the name of 'tick' in the kernel],
3262f003fb54Skardel    [ntp_cv_nlist_tick],
3263f003fb54Skardel    [
3264f003fb54Skardel	ans=_tick
3265abb0f93cSkardel	case "$host" in
3266abb0f93cSkardel	 m68*-hp-hpux*) # HP9000/300?
3267abb0f93cSkardel	    ans=_old_tick
3268abb0f93cSkardel	    ;;
3269abb0f93cSkardel	 *-apple-aux[[23]]*)
3270abb0f93cSkardel	    ans=tick
3271abb0f93cSkardel	    ;;
3272abb0f93cSkardel	 *-hp-hpux*)
3273abb0f93cSkardel	    ans=old_tick
3274abb0f93cSkardel	    ;;
32758585484eSchristos	 *-ibm-aix[[3-9]]*)
32768585484eSchristos	    # XXX only verified thru AIX6.
3277abb0f93cSkardel	    ans=no
3278abb0f93cSkardel	    ;;
3279abb0f93cSkardel	 *-*-mpeix*)
3280abb0f93cSkardel	    ans=no
3281abb0f93cSkardel	    ;;
3282abb0f93cSkardel	 *-*-ptx*)
3283abb0f93cSkardel	    ans=tick
3284abb0f93cSkardel	    ;;
3285abb0f93cSkardel	 *-*-sco3.2v[[45]]*)
3286abb0f93cSkardel	    ans=no
3287abb0f93cSkardel	    ;;
3288abb0f93cSkardel	 *-*-solaris2*)
3289abb0f93cSkardel	    ans=nsec_per_tick
3290abb0f93cSkardel	    ;;
3291abb0f93cSkardel	 *-*-sysv4*)
3292abb0f93cSkardel	    ans=tick
3293abb0f93cSkardel	    ;;
3294abb0f93cSkardel	esac
3295f003fb54Skardel	ntp_cv_nlist_tick=$ans
3296f003fb54Skardel    ]
3297f003fb54Skardel)
3298f003fb54Skardelcase "$ntp_cv_nlist_tick" in
3299f003fb54Skardel ''|no)
3300f003fb54Skardel    ;;	# HMS: I think we can only get 'no' here...
3301f003fb54Skardel *)
3302f003fb54Skardel    AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
3303f003fb54Skardel	[What is the name of TICK in the kernel?])
3304abb0f93cSkardelesac
3305f003fb54Skardel
3306f003fb54SkardelAC_CACHE_CHECK(
3307f003fb54Skardel    [for the units of 'tick'],
3308f003fb54Skardel    [ntp_cv_tick_nano],
3309f003fb54Skardel    [
3310f003fb54Skardel	ans=usec
3311abb0f93cSkardel	case "$host" in
3312abb0f93cSkardel	 *-*-solaris2*)
3313abb0f93cSkardel	    ans=nsec
3314abb0f93cSkardel	    ;;
3315abb0f93cSkardel	esac
3316f003fb54Skardel	ntp_cv_tick_nano=$ans
3317f003fb54Skardel    ]
3318f003fb54Skardel)
3319f003fb54Skardelcase "$ntp_cv_tick_nano" in
3320abb0f93cSkardel nsec)
3321f003fb54Skardel    AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
3322abb0f93cSkardelesac
3323f003fb54Skardel
3324f003fb54SkardelAC_CACHE_CHECK(
3325f003fb54Skardel    [the name of 'tickadj' in the kernel],
3326f003fb54Skardel    [ntp_cv_nlist_tickadj],
3327f003fb54Skardel    [
3328f003fb54Skardel	ans=_tickadj
3329abb0f93cSkardel	case "$host" in
3330abb0f93cSkardel	 m68*-hp-hpux*) # HP9000/300?
3331abb0f93cSkardel	    ans=_tickadj
3332abb0f93cSkardel	    ;;
3333abb0f93cSkardel	 *-apple-aux[[23]]*)
3334abb0f93cSkardel	    ans=tickadj
3335abb0f93cSkardel	    ;;
3336abb0f93cSkardel	 *-hp-hpux10*)
3337abb0f93cSkardel	    ans=no
3338abb0f93cSkardel	    ;;
3339abb0f93cSkardel	 *-hp-hpux9*)
3340abb0f93cSkardel	    ans=no
3341abb0f93cSkardel	    ;;
3342abb0f93cSkardel	 *-hp-hpux*)
3343abb0f93cSkardel	    ans=tickadj
3344abb0f93cSkardel	    ;;
3345abb0f93cSkardel	 *-*-aix*)
3346abb0f93cSkardel	    ans=tickadj
3347abb0f93cSkardel	    ;;
3348abb0f93cSkardel	 *-*-mpeix*)
3349abb0f93cSkardel	    ans=no
3350abb0f93cSkardel	    ;;
3351abb0f93cSkardel	 *-*-ptx*)
3352abb0f93cSkardel	    ans=tickadj
3353abb0f93cSkardel	    ;;
3354abb0f93cSkardel	 *-*-sco3.2v4*)
3355abb0f93cSkardel	    ans=no
3356abb0f93cSkardel	    ;;
3357abb0f93cSkardel	 *-*-sco3.2v5.0*)
3358abb0f93cSkardel	    ans=clock_drift
3359abb0f93cSkardel	    ;;
3360abb0f93cSkardel	 *-*-solaris2*)
3361abb0f93cSkardel	    ans=no	# hrestime_adj
3362abb0f93cSkardel	    ;;
3363abb0f93cSkardel	 *-*-sysv4*)
3364abb0f93cSkardel	    ans=tickadj
3365abb0f93cSkardel	    ;;
3366abb0f93cSkardel	esac
3367f003fb54Skardel	ntp_cv_nlist_tickadj=$ans
3368f003fb54Skardel    ]
3369f003fb54Skardel)
3370f003fb54Skardelcase "$ntp_cv_nlist_tickadj" in
3371f003fb54Skardel ''|no)
3372f003fb54Skardel    ;;	# HMS: I think we can only get 'no' here...
3373f003fb54Skardel *)
3374f003fb54Skardel    AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
3375f003fb54Skardel	[What is the name of TICKADJ in the kernel?])
3376abb0f93cSkardelesac
3377f003fb54Skardel
3378f003fb54SkardelAC_CACHE_CHECK(
3379f003fb54Skardel    [for the units of 'tickadj'],
3380f003fb54Skardel    [ntp_cv_tickadj_nano],
3381f003fb54Skardel    [
3382f003fb54Skardel	ans=usec
3383abb0f93cSkardel	case "$host" in
3384abb0f93cSkardel	 *-*-solaris2*)
3385abb0f93cSkardel	    ans=nsec
3386abb0f93cSkardel	    ;;
3387abb0f93cSkardel	esac
3388f003fb54Skardel	ntp_cv_tickadj_nano=$ans
3389f003fb54Skardel    ]
3390f003fb54Skardel)
3391f003fb54Skardelcase "$ntp_cv_tickadj_nano" in
3392abb0f93cSkardel nsec)
3393f003fb54Skardel    AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
3394abb0f93cSkardelesac
3395f003fb54Skardel
3396f003fb54SkardelAC_CACHE_CHECK(
3397f003fb54Skardel    [half-heartedly for 'dosynctodr' in the kernel],
3398f003fb54Skardel    [ntp_cv_nlist_dosynctodr],
3399f003fb54Skardel    [
3400f003fb54Skardel	case "$host" in
3401abb0f93cSkardel	 *-apple-aux[[23]]*)
3402abb0f93cSkardel	    ans=no
3403abb0f93cSkardel	    ;;
3404abb0f93cSkardel	 *-sni-sysv*)
3405abb0f93cSkardel	    ans=dosynctodr
3406abb0f93cSkardel	    ;;
3407f17b710fSchristos	 *-stratus-vos)
3408f17b710fSchristos	    ans=no
3409f17b710fSchristos	    ;;
3410abb0f93cSkardel	 *-*-aix*)
3411abb0f93cSkardel	    ans=dosynctodr
3412abb0f93cSkardel	    ;;
3413abb0f93cSkardel	 *-*-hpux*)
3414abb0f93cSkardel	    ans=no
3415abb0f93cSkardel	    ;;
3416abb0f93cSkardel	 *-*-mpeix*)
3417abb0f93cSkardel	    ans=no
3418abb0f93cSkardel	    ;;
3419abb0f93cSkardel	 *-*-nextstep*)
3420abb0f93cSkardel	    ans=_dosynctodr
3421abb0f93cSkardel	    ;;
3422abb0f93cSkardel	 *-*-ptx*)
3423abb0f93cSkardel	    ans=doresettodr
3424abb0f93cSkardel	    ;;
3425abb0f93cSkardel	 *-*-sco3.2v4*)
3426abb0f93cSkardel	    ans=no
3427abb0f93cSkardel	    ;;
3428abb0f93cSkardel	 *-*-sco3.2v5*)
3429abb0f93cSkardel	    ans=track_rtc
3430abb0f93cSkardel	    ;;
3431abb0f93cSkardel	 *-*-solaris2*)
3432abb0f93cSkardel	    ans=dosynctodr
3433abb0f93cSkardel	    ;;
3434abb0f93cSkardel	 *-*-sysv4*)
3435abb0f93cSkardel	    ans=doresettodr
3436abb0f93cSkardel	    ;;
3437abb0f93cSkardel	 *)
3438abb0f93cSkardel	    ans=_dosynctodr
3439abb0f93cSkardel	    ;;
3440abb0f93cSkardel	esac
3441f003fb54Skardel	ntp_cv_nlist_dosynctodr=$ans
3442f003fb54Skardel    ]
3443f003fb54Skardel)
3444f003fb54Skardelcase "$ntp_cv_nlist_dosynctodr" in
3445f003fb54Skardel no)
3446f003fb54Skardel    ;;
3447f003fb54Skardel *)
3448f003fb54Skardel    AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
3449f003fb54Skardel	[What is (probably) the name of DOSYNCTODR in the kernel?])
3450abb0f93cSkardel    ;;
3451abb0f93cSkardelesac
3452f003fb54Skardel
3453f003fb54SkardelAC_CACHE_CHECK(
3454f003fb54Skardel    [half-heartedly for 'noprintf' in the kernel],
3455f003fb54Skardel    [ntp_cv_nlist_noprintf],
3456f003fb54Skardel    [
3457f003fb54Skardel	case "$host" in
3458abb0f93cSkardel	 *-apple-aux[[23]]*)
3459abb0f93cSkardel	    ans=no
3460abb0f93cSkardel	    ;;
3461abb0f93cSkardel	 *-sni-sysv*)
3462abb0f93cSkardel	    ans=noprintf
3463abb0f93cSkardel	    ;;
3464f17b710fSchristos	 *-stratus-vos)
3465f17b710fSchristos	    ans=no
3466f17b710fSchristos	    ;;
3467abb0f93cSkardel	 *-*-aix*)
3468abb0f93cSkardel	    ans=noprintf
3469abb0f93cSkardel	    ;;
3470abb0f93cSkardel	 *-*-hpux*)
3471abb0f93cSkardel	    ans=no
3472abb0f93cSkardel	    ;;
3473abb0f93cSkardel	 *-*-mpeix*)
3474abb0f93cSkardel	    ans=no
3475abb0f93cSkardel	    ;;
3476abb0f93cSkardel	 *-*-ptx*)
3477abb0f93cSkardel	    ans=noprintf
3478abb0f93cSkardel	    ;;
3479abb0f93cSkardel	 *-*-nextstep*)
3480abb0f93cSkardel	    ans=_noprintf
3481abb0f93cSkardel	    ;;
3482abb0f93cSkardel	 *-*-solaris2*)
3483abb0f93cSkardel	    ans=noprintf
3484abb0f93cSkardel	    ;;
3485abb0f93cSkardel	 *-*-sysv4*)
3486abb0f93cSkardel	    ans=noprintf
3487abb0f93cSkardel	    ;;
3488abb0f93cSkardel	 *)
3489abb0f93cSkardel	    ans=_noprintf
3490abb0f93cSkardel	    ;;
3491abb0f93cSkardel	esac
3492f003fb54Skardel	ntp_cv_nlist_noprintf=$ans
3493f003fb54Skardel    ]
3494f003fb54Skardel)
3495f003fb54Skardelcase "$ntp_cv_nlist_noprintf" in
3496f003fb54Skardel no)
3497f003fb54Skardel    ;;
3498f003fb54Skardel *)
3499f003fb54Skardel    AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
3500f003fb54Skardel	[What is (probably) the name of NOPRINTF in the kernel?])
3501abb0f93cSkardel    ;;
3502abb0f93cSkardelesac
3503abb0f93cSkardel
3504abb0f93cSkardeldnl The tick/tickadj sections were written by Skippy, who never learned
3505abb0f93cSkardeldnl that it's impolite (horridly gross) to show your guts in public.
3506abb0f93cSkardel
3507abb0f93cSkardeldnl	tick		tickadj
3508abb0f93cSkardeldnl	10000		80	    Unixware
3509abb0f93cSkardeldnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3510abb0f93cSkardeldnl	10000		150	    sgi IRIX
3511abb0f93cSkardeldnl	1000000L/hz	1000	    RS6000 && NOKMEM
3512abb0f93cSkardeldnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3513abb0f93cSkardeldnl	1000000L/hz	500/HZ	    other && NOKMEM
3514abb0f93cSkardeldnl	txc.tick	1	    Linux
3515abb0f93cSkardeldnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3516abb0f93cSkardeldnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3517abb0f93cSkardeldnl				    (RS6000 && !NOKMEM), SINIX MIPS
3518abb0f93cSkardel
3519abb0f93cSkardeldnl But we'll only use these "values" if we can't find anything else.
3520abb0f93cSkardel
3521abb0f93cSkardelAC_MSG_CHECKING([for a default value for 'tick'])
3522abb0f93cSkardel
3523abb0f93cSkardel# target-dependent default for tick
3524abb0f93cSkardel
3525abb0f93cSkardelcase "$host" in
3526abb0f93cSkardel *-*-pc-cygwin*)
3527abb0f93cSkardel    AC_MSG_ERROR([tick needs work for cygwin])
3528abb0f93cSkardel    ;;
3529abb0f93cSkardel *-univel-sysv*)
3530abb0f93cSkardel    ans=10000
3531abb0f93cSkardel    ;;
3532abb0f93cSkardel *-*-irix*)
3533abb0f93cSkardel    ans=10000
3534abb0f93cSkardel    ;;
3535abb0f93cSkardel *-*-*linux*)
3536abb0f93cSkardel    ans=txc.tick
3537abb0f93cSkardel    ;;
3538abb0f93cSkardel *-*-mpeix*)
3539abb0f93cSkardel    ans=no
3540abb0f93cSkardel    ;;
3541abb0f93cSkardel *-*-winnt3.5)
3542abb0f93cSkardel    ans='(every / 10)'
3543abb0f93cSkardel    ;;
3544abb0f93cSkardel *-*-unicosmp*)
3545abb0f93cSkardel    ans=10000
3546abb0f93cSkardel    ;;
3547abb0f93cSkardel *)
3548abb0f93cSkardel    ans='1000000L/hz'
3549abb0f93cSkardel    ;;
3550abb0f93cSkardelesac
3551abb0f93cSkardel
3552abb0f93cSkardelAC_ARG_ENABLE(
3553abb0f93cSkardel    [tick],
3554f003fb54Skardel    [AS_HELP_STRING(
3555abb0f93cSkardel	[--enable-tick=VALUE],
3556abb0f93cSkardel	[s force a value for 'tick']
3557f003fb54Skardel    )],
3558abb0f93cSkardel    [ans=$enableval]
3559abb0f93cSkardel)
3560abb0f93cSkardel
3561abb0f93cSkardelAC_MSG_RESULT([$ans])
3562abb0f93cSkardel
3563abb0f93cSkardelcase "$ans" in
3564f003fb54Skardel ''|no)
3565f003fb54Skardel    ;;	# HMS: I think we can only get 'no' here...
3566f003fb54Skardel *)
3567f003fb54Skardel    AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
3568f003fb54Skardel	[Preset a value for 'tick'?])
3569abb0f93cSkardelesac
3570abb0f93cSkardel
3571abb0f93cSkardelAC_MSG_CHECKING([for a default value for 'tickadj'])
3572abb0f93cSkardel
3573abb0f93cSkardel# target-specific default
3574abb0f93cSkardelans='500/hz'
3575abb0f93cSkardelcase "$host" in
3576abb0f93cSkardel *-fujitsu-uxp*)
3577abb0f93cSkardel    case "$adjtime_is_accurate" in
3578abb0f93cSkardel     yes)
3579abb0f93cSkardel	ans='tick/16'
3580abb0f93cSkardel    esac
3581abb0f93cSkardel    ;;
3582abb0f93cSkardel *-univel-sysv*)
3583abb0f93cSkardel    ans=80
3584abb0f93cSkardel    ;;
3585abb0f93cSkardel *-*-aix*)
3586abb0f93cSkardel    case "$can_kmem" in
3587abb0f93cSkardel     no)
3588abb0f93cSkardel	ans=1000
35898585484eSchristos	;;
3590abb0f93cSkardel    esac
3591abb0f93cSkardel    ;;
3592abb0f93cSkardel *-*-domainos)	# Skippy: won't be found...
3593abb0f93cSkardel    case "$can_kmem" in
3594abb0f93cSkardel     no)
3595abb0f93cSkardel	ans=668
35968585484eSchristos	;;
3597abb0f93cSkardel    esac
3598abb0f93cSkardel    ;;
3599abb0f93cSkardel *-*-hpux*)
3600abb0f93cSkardel    case "$adjtime_is_accurate" in
3601abb0f93cSkardel     yes)
3602abb0f93cSkardel	ans='tick/16'
36038585484eSchristos	;;
3604abb0f93cSkardel    esac
3605abb0f93cSkardel    ;;
3606abb0f93cSkardel *-*-irix*)
3607abb0f93cSkardel    ans=150
3608abb0f93cSkardel    ;;
3609abb0f93cSkardel *-*-mpeix*)
3610abb0f93cSkardel    ans=no
3611abb0f93cSkardel    ;;
3612abb0f93cSkardel *-*-sco3.2v5.0*)
3613abb0f93cSkardel    ans=10000L/hz
3614abb0f93cSkardel    ;;
3615abb0f93cSkardel *-*-winnt3.5)
3616abb0f93cSkardel    ans=50
3617abb0f93cSkardel    ;;
3618abb0f93cSkardel *-*-unicosmp*)
3619abb0f93cSkardel    ans=150
36208585484eSchristos    ;;
3621abb0f93cSkardelesac
3622abb0f93cSkardel
3623abb0f93cSkardelAC_ARG_ENABLE(
3624abb0f93cSkardel    [tickadj],
3625f003fb54Skardel    [AS_HELP_STRING(
3626abb0f93cSkardel	[--enable-tickadj=VALUE],
3627abb0f93cSkardel	[s force a value for 'tickadj']
3628f003fb54Skardel    )],
3629abb0f93cSkardel    [ans=$enableval]
3630abb0f93cSkardel)
3631abb0f93cSkardel
3632abb0f93cSkardelAC_MSG_RESULT([$ans])
3633abb0f93cSkardel
3634abb0f93cSkardeldefault_tickadj=$ans
3635abb0f93cSkardel
3636abb0f93cSkardelcase "$default_tickadj" in
3637f003fb54Skardel ''|no)
3638f003fb54Skardel    ;;	# HMS: I think we can only get 'no' here...
3639f003fb54Skardel *)
3640f003fb54Skardel    AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
3641f003fb54Skardel	[Preset a value for 'tickadj'?]) ;;
3642abb0f93cSkardelesac
3643abb0f93cSkardel
3644abb0f93cSkardel# Newer versions of ReliantUNIX round adjtime() values down to
3645abb0f93cSkardel# 1/100s (system tick). Sigh ...
3646abb0f93cSkardel# Unfortunately, there is no easy way to know if particular release
3647abb0f93cSkardel# has this "feature" or any obvious way to test for it.
3648abb0f93cSkardelcase "$host" in
3649f003fb54Skardel mips-sni-sysv4*)
3650f003fb54Skardel    AC_DEFINE([RELIANTUNIX_CLOCK], [1],
3651f003fb54Skardel	[Do we want the ReliantUNIX clock hacks?])
3652abb0f93cSkardelesac
3653abb0f93cSkardel
3654abb0f93cSkardelcase "$host" in
3655f003fb54Skardel *-*-sco3.2v5*)
3656f003fb54Skardel    AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
3657abb0f93cSkardelesac
3658abb0f93cSkardel
3659f003fb54Skardelntp_cv_make_tickadj=yes
3660abb0f93cSkardelcase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3661abb0f93cSkardel nonono)	# Don't read KMEM, no presets.  Bogus.
3662abb0f93cSkardel    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3663f003fb54Skardel    ntp_cv_make_tickadj=no
3664abb0f93cSkardel    ;;
3665abb0f93cSkardel nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3666abb0f93cSkardel    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3667f003fb54Skardel    ntp_cv_make_tickadj=no
3668abb0f93cSkardel    ;;
3669abb0f93cSkardel no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3670abb0f93cSkardel    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3671f003fb54Skardel    ntp_cv_make_tickadj=no
3672abb0f93cSkardel    ;;
3673abb0f93cSkardel no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3674abb0f93cSkardel    ;;
3675abb0f93cSkardel yesnono)	# Read KMEM, no presets.  Cool.
3676abb0f93cSkardel    ;;
3677abb0f93cSkardel yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3678abb0f93cSkardel    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3679abb0f93cSkardel    ;;
3680abb0f93cSkardel yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3681abb0f93cSkardel    ;;
3682abb0f93cSkardel yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3683abb0f93cSkardel    ;;
3684abb0f93cSkardel *)		# Generally bogus.
3685abb0f93cSkardel    AC_MSG_ERROR([This shouldn't happen.])
3686abb0f93cSkardel    ;;
3687abb0f93cSkardelesac
3688abb0f93cSkardel
3689abb0f93cSkardelAC_SUBST(MAKE_NTPTIME)
3690abb0f93cSkardelAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3691abb0f93cSkardel[case "$host" in
3692f003fb54Skardel *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
3693abb0f93cSkardel     yesyes)
3694abb0f93cSkardel	ans=yes
3695abb0f93cSkardel	;;
3696abb0f93cSkardel     *)
3697abb0f93cSkardel	ans=no
3698abb0f93cSkardel	;;
3699abb0f93cSkardel    esac
3700abb0f93cSkardel    ;;
3701abb0f93cSkardelesac
3702abb0f93cSkardelac_cv_make_ntptime=$ans])
3703abb0f93cSkardelcase "$ac_cv_make_ntptime" in
3704abb0f93cSkardel yes)
3705abb0f93cSkardel    MAKE_NTPTIME=ntptime
3706abb0f93cSkardel    ;;
37078585484eSchristos *)
37088585484eSchristos    NTPTIME_DB=
37098585484eSchristos    NTPTIME_DL=
37108585484eSchristos    NTPTIME_DS=
37118585484eSchristos    NTPTIME_MS=
37128585484eSchristos    ;;
3713abb0f93cSkardelesac
3714abb0f93cSkardel
3715f003fb54SkardelAC_SUBST([MAKE_TICKADJ])
3716abb0f93cSkardelcase "$host" in
3717abb0f93cSkardel mips-sni-sysv4*)
3718abb0f93cSkardel    # tickadj is pretty useless on newer versions of ReliantUNIX
3719abb0f93cSkardel    # Do not bother
3720f003fb54Skardel    ntp_cv_make_tickadj=no
3721abb0f93cSkardel    ;;
3722abb0f93cSkardel *-*-irix*)
3723f003fb54Skardel    ntp_cv_make_tickadj=no
3724abb0f93cSkardel    ;;
3725abb0f93cSkardel *-*-solaris2*)
3726abb0f93cSkardel    # DLM says tickadj is a no-no starting with solaris2.5
3727abb0f93cSkardel    case "$host" in
3728abb0f93cSkardel     *-*-solaris2.1[[0-9]]*)
3729f003fb54Skardel	ntp_cv_make_tickadj=no
3730abb0f93cSkardel	;;
3731abb0f93cSkardel     *-*-solaris2.[[0-4]]*) ;;
3732f003fb54Skardel     *) ntp_cv_make_tickadj=no ;;
3733abb0f93cSkardel    esac
3734abb0f93cSkardel    ;;
3735abb0f93cSkardel *-*-unicosmp*)
3736f003fb54Skardel    ntp_cv_make_tickadj=no
3737abb0f93cSkardel    ;;
3738abb0f93cSkardelesac
3739abb0f93cSkardel
3740abb0f93cSkardel#
3741abb0f93cSkardel# Despite all the above, we always make tickadj.  Setting
3742f003fb54Skardel# ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3743abb0f93cSkardel# report that the configuration variable was cached.  It may
3744abb0f93cSkardel# be better to simply remove the hunk above, I did not want
3745abb0f93cSkardel# to remove it if there is hope it will be used again.
3746abb0f93cSkardel#
3747f003fb54SkardelAS_UNSET([ntp_cv_make_tickadj])
3748abb0f93cSkardel
3749f003fb54SkardelAC_CACHE_CHECK(
3750f003fb54Skardel    [if we want and can make the tickadj utility],
3751f003fb54Skardel    [ntp_cv_make_tickadj],
3752f003fb54Skardel    [ntp_cv_make_tickadj=yes]
3753f003fb54Skardel)
3754f003fb54Skardelcase "$ntp_cv_make_tickadj" in
3755abb0f93cSkardel yes)
3756abb0f93cSkardel    MAKE_TICKADJ=tickadj
37578585484eSchristos    ;;
37588585484eSchristos *)
37598585484eSchristos    CALC_TICKADJ_DB=
37608585484eSchristos    CALC_TICKADJ_DL=
37618585484eSchristos    CALC_TICKADJ_DS=
37628585484eSchristos    CALC_TICKADJ_MS=
37638585484eSchristos    TICKADJ_DB=
37648585484eSchristos    TICKADJ_DL=
37658585484eSchristos    TICKADJ_DS=
37668585484eSchristos    TICKADJ_MS=
37678585484eSchristos    ;;
3768abb0f93cSkardelesac
3769abb0f93cSkardel
3770f003fb54SkardelAC_SUBST([MAKE_TIMETRIM])
3771f003fb54SkardelAC_CACHE_CHECK(
3772f003fb54Skardel    [if we want and can make the timetrim utility],
3773f003fb54Skardel    [ntp_cv_make_timetrim],
3774f003fb54Skardel    [
3775f003fb54Skardel	case "$host" in
3776abb0f93cSkardel	 *-*-irix*)
3777f003fb54Skardel	    ntp_cv_make_timetrim=yes
3778abb0f93cSkardel	    ;;
3779abb0f93cSkardel	 *-*-unicosmp*)
3780f003fb54Skardel	    ntp_cv_make_timetrim=yes
3781abb0f93cSkardel	    ;;
3782abb0f93cSkardel	 *)
3783f003fb54Skardel	    ntp_cv_make_timetrim=no
3784abb0f93cSkardel	    ;;
3785abb0f93cSkardel	esac
3786f003fb54Skardel    ]
3787f003fb54Skardel)
3788f003fb54Skardelcase "$ntp_cv_make_timetrim" in
3789f003fb54Skardel yes)
3790f003fb54Skardel    MAKE_TIMETRIM=timetrim
37918585484eSchristos    ;;
37928585484eSchristos *) TIMETRIM_DB=
37938585484eSchristos    TIMETRIM_DL=
37948585484eSchristos    TIMETRIM_DS=
37958585484eSchristos    TIMETRIM_MS=
37968585484eSchristos    ;;
3797f003fb54Skardelesac
3798abb0f93cSkardel
3799f003fb54SkardelAC_SUBST([MAKE_LIBNTPSIM])
3800f003fb54SkardelAC_SUBST([MAKE_NTPDSIM])
3801abb0f93cSkardel
3802abb0f93cSkardelAC_MSG_CHECKING([if we want to build the NTPD simulator])
3803abb0f93cSkardelAC_ARG_ENABLE(
3804abb0f93cSkardel    [simulator],
3805f003fb54Skardel    [AS_HELP_STRING(
3806abb0f93cSkardel	[--enable-simulator],
3807abb0f93cSkardel	[- build/install the NTPD simulator?]
3808f003fb54Skardel    )],
3809abb0f93cSkardel    [ans=$enableval],
3810abb0f93cSkardel    [ans=no]
3811abb0f93cSkardel)
3812abb0f93cSkardelAC_MSG_RESULT([$ans])
3813abb0f93cSkardelcase "$ans" in
3814abb0f93cSkardel yes)
3815abb0f93cSkardel    MAKE_NTPDSIM=ntpdsim
3816abb0f93cSkardel    MAKE_LIBNTPSIM=libntpsim.a
38178585484eSchristos    ;;
38188585484eSchristos *)
38198585484eSchristos    NTPDSIM_DB=
38208585484eSchristos    NTPDSIM_DL=
38218585484eSchristos    NTPDSIM_DS=
38228585484eSchristos    NTPDSIM_MS=
38238585484eSchristos    ;;
3824abb0f93cSkardelesac
3825abb0f93cSkardel
3826abb0f93cSkardelcase "$build" in
3827abb0f93cSkardel $host)
3828abb0f93cSkardel    ;;
3829abb0f93cSkardel *) case "$host" in
3830abb0f93cSkardel     *-*-vxworks*)
3831abb0f93cSkardel	LDFLAGS="$LDFLAGS -r"
3832abb0f93cSkardel	;;
3833abb0f93cSkardel    esac
3834abb0f93cSkardel    ;;
3835abb0f93cSkardelesac
3836abb0f93cSkardel
38378585484eSchristosNTP_WITHSNTP
3838abb0f93cSkardel
3839abb0f93cSkardelAC_MSG_CHECKING([if we want to build ntpsnmpd])
3840f003fb54SkardelAC_ARG_WITH(
3841f003fb54Skardel    [ntpsnmpd],
3842f003fb54Skardel    [AS_HELP_STRING(
3843f003fb54Skardel	[--with-ntpsnmpd],
3844f003fb54Skardel	[s Build ntpsnmpd MIB agent?]
3845f003fb54Skardel    )],
3846abb0f93cSkardel    [ans=$withval],
3847f003fb54Skardel    [
3848f003fb54Skardel	case "$PATH_NET_SNMP_CONFIG" in
3849abb0f93cSkardel	 /*)	ans=yes ;;
3850abb0f93cSkardel	 *)	ans=no  ;;
3851f003fb54Skardel	esac
3852f003fb54Skardel    ]
3853f003fb54Skardel)
3854f003fb54SkardelAC_MSG_RESULT([$ans])
3855abb0f93cSkardelcase "$ans" in
3856abb0f93cSkardel yes)
3857abb0f93cSkardel    case "$PATH_NET_SNMP_CONFIG" in
3858abb0f93cSkardel     /*)
3859abb0f93cSkardel	SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
3860f17b710fSchristos	# Bug 2815.  This is a bit of a hack, but it works...
3861f17b710fSchristos	case "$ntp_cv_net_snmp_version" in
3862f17b710fSchristos	 5.3*)	SNMP_LIBS=`echo $SNMP_LIBS | $SED -e 's/-lnetsnmpagent/-lnetsnmpagent -lnetsnmpmibs/'`
3863f17b710fSchristos		;;
3864f17b710fSchristos	esac
3865f003fb54Skardel	AC_SUBST([SNMP_LIBS])
3866abb0f93cSkardel	# HMS: we really want to separate CPPFLAGS and CFLAGS
3867abb0f93cSkardel	foo=`$PATH_NET_SNMP_CONFIG --cflags`
3868abb0f93cSkardel	SNMP_CPPFLAGS=
3869abb0f93cSkardel	SNMP_CFLAGS=
3870abb0f93cSkardel	for i in $foo; do
3871abb0f93cSkardel	    case "$i" in
3872abb0f93cSkardel	     -D*|-U*|-I*)
3873abb0f93cSkardel		SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
3874abb0f93cSkardel		;;
3875abb0f93cSkardel	    *)	SNMP_CFLAGS="$SNMP_CFLAGS $i"
3876abb0f93cSkardel		;;
3877abb0f93cSkardel	    esac
3878abb0f93cSkardel	done
3879f003fb54Skardel	AC_SUBST([SNMP_CPPFLAGS])
3880f003fb54Skardel	AC_SUBST([SNMP_CFLAGS])
3881abb0f93cSkardel
3882abb0f93cSkardel	save_CFLAGS=$CFLAGS
3883abb0f93cSkardel	save_CPPFLAGS=$CPPFLAGS
3884abb0f93cSkardel	save_LIBS=$LIBS
3885abb0f93cSkardel	CFLAGS=$SNMP_CFLAGS
3886abb0f93cSkardel	CPPFLAGS=$SNMP_CPPFLAGS
3887abb0f93cSkardel
3888f003fb54Skardel	AC_CHECK_HEADER(
3889f003fb54Skardel	    [net-snmp/net-snmp-config.h],
3890f003fb54Skardel	    [MAKE_NTPSNMPD=ntpsnmpd],
3891f003fb54Skardel	    [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
3892f003fb54Skardel	)
3893abb0f93cSkardel
3894abb0f93cSkardel	# Do this last, as we're messing up LIBS.
3895abb0f93cSkardel	# check -lnetsnmp for netsnmp_daemonize
3896abb0f93cSkardel	LIBS=`$PATH_NET_SNMP_CONFIG --libs`
3897f003fb54Skardel	AC_CHECK_LIB(
3898f003fb54Skardel	    [netsnmp],
3899f003fb54Skardel	    [netsnmp_daemonize],
3900f003fb54Skardel	    [ans=yes],
3901f003fb54Skardel	    [ans=no]
3902f003fb54Skardel	)
3903f003fb54Skardel	case "$ans" in
3904f003fb54Skardel	 no)
3905f003fb54Skardel	    AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
3906f003fb54Skardel		[We need to provide netsnmp_daemonize()])
3907f003fb54Skardel	esac
3908abb0f93cSkardel
3909abb0f93cSkardel	CFLAGS=$save_CFLAGS
39108585484eSchristos	AS_UNSET([save_CFLAGS])
3911abb0f93cSkardel	CPPFLAGS=$save_CPPFLAGS
39128585484eSchristos	AS_UNSET([save_CPPFLAGS])
3913abb0f93cSkardel	LIBS=$save_LIBS
39148585484eSchristos	AS_UNSET([save_LIBS])
3915abb0f93cSkardel	;;
3916f003fb54Skardel     *)
3917f003fb54Skardel	AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
3918abb0f93cSkardel	;;
3919abb0f93cSkardel    esac
3920abb0f93cSkardel    ;;
3921abb0f93cSkardelesac
3922f003fb54SkardelAC_SUBST([MAKE_NTPSNMPD])
3923abb0f93cSkardel
39248585484eSchristoscase "$MAKE_NTPSNMPD" in
39258585484eSchristos '')
39268585484eSchristos    NTPSNMPD_DB=
39278585484eSchristos    NTPSNMPD_DL=
39288585484eSchristos    NTPSNMPD_DS=
39298585484eSchristos    NTPSNMPD_MS=
39308585484eSchristos    ;;
39318585484eSchristosesac
3932abb0f93cSkardel
3933abb0f93cSkardelAC_MSG_CHECKING([if we should always slew the time])
3934abb0f93cSkardel
3935abb0f93cSkardel# target-specific defaults
3936abb0f93cSkardel
3937abb0f93cSkardelcase "$host" in
3938abb0f93cSkardel *-apple-aux[[23]]*)
3939abb0f93cSkardel    ans=yes
3940abb0f93cSkardel    ;;
3941abb0f93cSkardel *-*-bsdi[[012]]*)
3942abb0f93cSkardel    ans=no
3943abb0f93cSkardel    ;;
3944abb0f93cSkardel *-*-bsdi*)
3945abb0f93cSkardel    ans=yes
3946abb0f93cSkardel    ;;
3947abb0f93cSkardel *-*-openvms*)	# HMS: won't be found
3948abb0f93cSkardel    ans=yes
3949abb0f93cSkardel    ;;
3950abb0f93cSkardel *) ans=no
3951abb0f93cSkardel    ;;
3952abb0f93cSkardelesac
3953abb0f93cSkardel
3954abb0f93cSkardel# --enable-slew-always / --disable-slew-always overrides default
3955abb0f93cSkardel
3956abb0f93cSkardelAC_ARG_ENABLE(
3957abb0f93cSkardel    [slew-always],
3958f003fb54Skardel    [AS_HELP_STRING(
3959abb0f93cSkardel	[--enable-slew-always],
3960abb0f93cSkardel	[s always slew the time]
3961f003fb54Skardel    )],
3962abb0f93cSkardel    [ans=$enableval]
3963abb0f93cSkardel)
3964abb0f93cSkardel
3965abb0f93cSkardelAC_MSG_RESULT([$ans])
3966abb0f93cSkardel
3967abb0f93cSkardelcase "$ans" in
3968f003fb54Skardel yes)
3969f003fb54Skardel    AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
3970abb0f93cSkardelesac
3971abb0f93cSkardel
3972abb0f93cSkardelAC_MSG_CHECKING([if we should step and slew the time])
3973abb0f93cSkardel
3974abb0f93cSkardelcase "$host" in
3975abb0f93cSkardel *-sni-sysv*)
3976abb0f93cSkardel    ans=yes
3977abb0f93cSkardel    ;;
3978f17b710fSchristos *-stratus-vos)
3979f17b710fSchristos    ans=no
3980f17b710fSchristos    ;;
3981abb0f93cSkardel *-univel-sysv*)
3982abb0f93cSkardel    ans=no
3983abb0f93cSkardel    ;;
3984abb0f93cSkardel *-*-ptx*)
3985abb0f93cSkardel    ans=yes
3986abb0f93cSkardel    ;;
3987abb0f93cSkardel *-*-solaris2.1[[0-9]]*)
3988abb0f93cSkardel    ans=no
3989abb0f93cSkardel    ;;
3990abb0f93cSkardel *-*-solaris2.[[012]]*)
3991abb0f93cSkardel    ans=yes
3992abb0f93cSkardel    ;;
3993abb0f93cSkardel *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
3994abb0f93cSkardel    ans=yes
3995abb0f93cSkardel    ;;
3996abb0f93cSkardel *) ans=no
3997abb0f93cSkardel    ;;
3998abb0f93cSkardelesac
3999abb0f93cSkardel
4000abb0f93cSkardelAC_ARG_ENABLE(
4001abb0f93cSkardel    [step-slew],
4002f003fb54Skardel    [AS_HELP_STRING(
4003abb0f93cSkardel	[--enable-step-slew],
4004abb0f93cSkardel	[s step and slew the time]
4005f003fb54Skardel    )],
4006abb0f93cSkardel    [ans=$enableval]
4007abb0f93cSkardel)
4008abb0f93cSkardel
4009abb0f93cSkardelAC_MSG_RESULT([$ans])
4010abb0f93cSkardel
4011abb0f93cSkardelcase "$ans" in
4012f003fb54Skardel yes)
4013f003fb54Skardel    AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4014abb0f93cSkardelesac
4015abb0f93cSkardel
4016abb0f93cSkardelAC_MSG_CHECKING([if ntpdate should step the time])
4017abb0f93cSkardel
4018abb0f93cSkardelcase "$host" in
4019abb0f93cSkardel *-apple-aux[[23]]*)
4020abb0f93cSkardel    ans=yes
4021abb0f93cSkardel    ;;
4022abb0f93cSkardel *) ans=no
40238585484eSchristos    ;;
4024abb0f93cSkardelesac
4025abb0f93cSkardel
4026abb0f93cSkardelAC_ARG_ENABLE(
4027abb0f93cSkardel    [ntpdate-step],
4028f003fb54Skardel    [AS_HELP_STRING(
4029abb0f93cSkardel	[--enable-ntpdate-step],
4030abb0f93cSkardel	[s if ntpdate should step the time]
4031f003fb54Skardel    )],
4032abb0f93cSkardel    [ans=$enableval]
4033abb0f93cSkardel)
4034abb0f93cSkardel
4035abb0f93cSkardelAC_MSG_RESULT([$ans])
4036abb0f93cSkardel
4037abb0f93cSkardelcase "$ans" in
4038f003fb54Skardel yes)
4039f003fb54Skardel    AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4040f003fb54Skardel	[force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4041abb0f93cSkardelesac
4042abb0f93cSkardel
4043abb0f93cSkardel
4044abb0f93cSkardelAC_MSG_CHECKING([if we should sync TODR clock every hour])
4045abb0f93cSkardel
4046abb0f93cSkardelcase "$host" in
4047abb0f93cSkardel *-*-nextstep*)
4048abb0f93cSkardel    ans=yes
4049abb0f93cSkardel    ;;
4050abb0f93cSkardel *-*-openvms*)	# HMS: won't be found
4051abb0f93cSkardel    ans=yes
4052abb0f93cSkardel    ;;
4053abb0f93cSkardel *)
4054abb0f93cSkardel    ans=no
40558585484eSchristos    ;;
4056abb0f93cSkardelesac
4057abb0f93cSkardel
4058abb0f93cSkardelAC_ARG_ENABLE(
4059abb0f93cSkardel    [hourly-todr-sync],
4060f003fb54Skardel    [AS_HELP_STRING(
4061abb0f93cSkardel	[--enable-hourly-todr-sync],
4062abb0f93cSkardel	[s if we should sync TODR hourly]
4063f003fb54Skardel    )],
4064abb0f93cSkardel    [ans=$enableval]
4065abb0f93cSkardel)
4066abb0f93cSkardel
4067abb0f93cSkardelAC_MSG_RESULT([$ans])
4068abb0f93cSkardel
4069abb0f93cSkardelcase "$ac_cv_var_sync_todr" in
4070f003fb54Skardel yes)
4071f003fb54Skardel    AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
4072abb0f93cSkardelesac
4073abb0f93cSkardel
4074abb0f93cSkardel
4075abb0f93cSkardelAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4076abb0f93cSkardel
4077abb0f93cSkardelcase "$host" in
4078abb0f93cSkardel *-*-solaris2.6)
4079abb0f93cSkardel    unamev=`uname -v`
4080abb0f93cSkardel    case "$unamev" in
4081abb0f93cSkardel     Generic_105181-*)
4082abb0f93cSkardel	old_IFS="$IFS"
4083abb0f93cSkardel	IFS="-"
4084abb0f93cSkardel	set $unamev
4085abb0f93cSkardel	IFS="$old_IFS"
4086abb0f93cSkardel	if test "$2" -ge 17
4087abb0f93cSkardel	then
4088abb0f93cSkardel	    # Generic_105181-17 and higher
4089abb0f93cSkardel	    ans=no
4090abb0f93cSkardel	else
4091abb0f93cSkardel	    ans=yes
4092abb0f93cSkardel	fi
4093abb0f93cSkardel	;;
4094abb0f93cSkardel     *)
4095abb0f93cSkardel	ans=yes
40968585484eSchristos	;;
4097abb0f93cSkardel    esac
4098abb0f93cSkardel    ;;
4099abb0f93cSkardel *-*-solaris2.7)
4100abb0f93cSkardel    unamev=`uname -v`
4101abb0f93cSkardel    case "$unamev" in
4102abb0f93cSkardel     Generic_106541-*)
4103abb0f93cSkardel	old_IFS="$IFS"
4104abb0f93cSkardel	IFS="-"
4105abb0f93cSkardel	set $unamev
4106abb0f93cSkardel	IFS="$old_IFS"
4107abb0f93cSkardel	if test "$2" -ge 07
4108abb0f93cSkardel	then
4109abb0f93cSkardel	    # Generic_106541-07 and higher
4110abb0f93cSkardel	    ans=no
4111abb0f93cSkardel	else
4112abb0f93cSkardel	    ans=yes
4113abb0f93cSkardel	fi
4114abb0f93cSkardel	;;
4115abb0f93cSkardel     *)
4116abb0f93cSkardel	ans=yes
41178585484eSchristos	;;
4118abb0f93cSkardel    esac
4119abb0f93cSkardel    ;;
4120abb0f93cSkardel *)
4121abb0f93cSkardel    ans=no
41228585484eSchristos    ;;
4123abb0f93cSkardelesac
4124abb0f93cSkardel
4125abb0f93cSkardelAC_ARG_ENABLE(
4126abb0f93cSkardel    [kernel-fll-bug],
4127f003fb54Skardel    [AS_HELP_STRING(
4128abb0f93cSkardel	[--enable-kernel-fll-bug],
4129abb0f93cSkardel	[s if we should avoid a kernel FLL bug]
4130f003fb54Skardel    )],
4131abb0f93cSkardel    [ans=$enableval]
4132abb0f93cSkardel)
4133abb0f93cSkardel
4134abb0f93cSkardelAC_MSG_RESULT([$ans])
4135abb0f93cSkardel
4136abb0f93cSkardelcase "$ans" in
4137f003fb54Skardel yes)
4138f003fb54Skardel    AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
4139abb0f93cSkardelesac
4140abb0f93cSkardel
4141abb0f93cSkardel
4142abb0f93cSkardelAC_MSG_CHECKING([if we want new session key behavior])
4143abb0f93cSkardelAC_ARG_ENABLE(
4144abb0f93cSkardel    [bug1243-fix],
4145f003fb54Skardel    [AS_HELP_STRING(
4146abb0f93cSkardel	[--enable-bug1243-fix],
4147abb0f93cSkardel	[+ use unmodified autokey session keys]
4148f003fb54Skardel    )],
4149abb0f93cSkardel    [ans=$enableval],
4150abb0f93cSkardel    [ans=yes]
4151abb0f93cSkardel)
4152abb0f93cSkardelAC_MSG_RESULT([$ans])
4153abb0f93cSkardelcase "$ans" in
4154abb0f93cSkardel no)
4155f003fb54Skardel    AC_DEFINE([DISABLE_BUG1243_FIX], [1],
4156f003fb54Skardel	[use old autokey session key behavior?])
4157abb0f93cSkardelesac
4158abb0f93cSkardel
4159abb0f93cSkardel
4160ae49d4a4SchristosAC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
4161ae49d4a4SchristosAC_ARG_ENABLE(
4162ae49d4a4Schristos    [bug3020-fix],
4163ae49d4a4Schristos    [AS_HELP_STRING(
4164ae49d4a4Schristos	[--enable-bug3020-fix],
4165ae49d4a4Schristos	[+ Provide the explicit 127.0.0.0/8 martian filter]
4166ae49d4a4Schristos    )],
4167ae49d4a4Schristos    [ans=$enableval],
4168ae49d4a4Schristos    [ans=yes]
4169ae49d4a4Schristos)
4170ae49d4a4SchristosAC_MSG_RESULT([$ans])
4171ae49d4a4Schristoscase "$ans" in
4172ae49d4a4Schristos yes)
4173ae49d4a4Schristos    AC_DEFINE([ENABLE_BUG3020_FIX], [1],
4174ae49d4a4Schristos	[Provide the explicit 127.0.0.0/8 martian filter?])
4175ae49d4a4Schristosesac
4176ae49d4a4Schristos
4177ae49d4a4Schristos
4178cdfa2a7eSchristosAC_MSG_CHECKING([if we want correct mode7 fudgetime2 behavior])
4179cdfa2a7eSchristosAC_ARG_ENABLE(
4180cdfa2a7eSchristos    [bug3527-fix],
4181cdfa2a7eSchristos    [AS_HELP_STRING(
4182cdfa2a7eSchristos	[--enable-bug3527-fix],
4183cdfa2a7eSchristos	[+ provide correct mode7 fudgetime2 behavior]
4184cdfa2a7eSchristos    )],
4185cdfa2a7eSchristos    [ans=$enableval],
4186cdfa2a7eSchristos    [ans=yes]
4187cdfa2a7eSchristos)
4188cdfa2a7eSchristosAC_MSG_RESULT([$ans])
4189cdfa2a7eSchristoscase "$ans" in
4190cdfa2a7eSchristos no)
4191cdfa2a7eSchristos    AC_DEFINE([DISABLE_BUG3527_FIX], [1],
4192cdfa2a7eSchristos	[use old autokey session key behavior?])
4193cdfa2a7eSchristosesac
4194cdfa2a7eSchristos
4195cdfa2a7eSchristos
4196*eabc0478SchristosAC_MSG_CHECKING([if we want a debug assert on an OOB KoD RATE value])
4197*eabc0478SchristosAC_ARG_ENABLE(
4198*eabc0478Schristos    [bug3767-fix],
4199*eabc0478Schristos    [AS_HELP_STRING(
4200*eabc0478Schristos	[--enable-bug3767-fix],
4201*eabc0478Schristos	[+ Disable debug assertion on OOB KoD RATE value]
4202*eabc0478Schristos    )],
4203*eabc0478Schristos    [ans=$enableval],
4204*eabc0478Schristos    [ans=yes]
4205*eabc0478Schristos)
4206*eabc0478SchristosAC_MSG_RESULT([$ans])
4207*eabc0478Schristoscase "$ans" in
4208*eabc0478Schristos no)
4209*eabc0478Schristos    AC_DEFINE([DISABLE_BUG3767_FIX], [1],
4210*eabc0478Schristos	[Disable debug assertion on OOB KoD RATE value?])
4211*eabc0478Schristosesac
4212*eabc0478Schristos
4213*eabc0478Schristos
4214abb0f93cSkardelAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4215abb0f93cSkardel
4216abb0f93cSkardelcase "$host" in
4217abb0f93cSkardel *-*-solaris2.[[89]])
4218abb0f93cSkardel    ans=yes
4219abb0f93cSkardel    ;;
4220abb0f93cSkardel *-*-solaris2.1[[0-9]]*)
4221abb0f93cSkardel    ans=yes
4222abb0f93cSkardel    ;;
4223abb0f93cSkardel *) ans=no
42248585484eSchristos    ;;
4225abb0f93cSkardelesac
4226abb0f93cSkardel
4227abb0f93cSkardelAC_ARG_ENABLE(
4228abb0f93cSkardel    [irig-sawtooth],
4229f003fb54Skardel    [AS_HELP_STRING(
4230abb0f93cSkardel	[--enable-irig-sawtooth],
4231abb0f93cSkardel	[s if we should enable the IRIG sawtooth filter]
4232f003fb54Skardel    )],
4233abb0f93cSkardel    [ans=$enableval]
4234abb0f93cSkardel)
4235abb0f93cSkardel
4236abb0f93cSkardelAC_MSG_RESULT([$ans])
4237abb0f93cSkardel
4238abb0f93cSkardelcase "$ans" in
4239f003fb54Skardel yes)
4240f003fb54Skardel    AC_DEFINE([IRIG_SUCKS], [1],
4241f003fb54Skardel	[Should we use the IRIG sawtooth filter?])
4242abb0f93cSkardelesac
4243abb0f93cSkardel
4244abb0f93cSkardelAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4245abb0f93cSkardelAC_ARG_ENABLE(
4246abb0f93cSkardel	[nist],
4247f003fb54Skardel	[AS_HELP_STRING(
4248abb0f93cSkardel	    [--enable-nist],
4249abb0f93cSkardel	    [- if we should enable the NIST lockclock scheme]
4250f003fb54Skardel	)],
4251abb0f93cSkardel	[ans=$enableval],
4252abb0f93cSkardel	[ans=no]
4253abb0f93cSkardel)
4254abb0f93cSkardel
4255abb0f93cSkardelAC_MSG_RESULT([$ans])
4256abb0f93cSkardel
4257abb0f93cSkardelcase "$ans" in
4258f003fb54Skardel yes)
4259f003fb54Skardel    AC_DEFINE([LOCKCLOCK], [1],
4260f003fb54Skardel	[Should we align with the NIST lockclock scheme?]) ;;
4261abb0f93cSkardelesac
4262abb0f93cSkardel
4263abb0f93cSkardelAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4264abb0f93cSkardelAC_ARG_ENABLE(
4265abb0f93cSkardel    [ntp-signd],
4266f003fb54Skardel    [AS_HELP_STRING(
4267abb0f93cSkardel	[--enable-ntp-signd],
4268abb0f93cSkardel	[- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4269f003fb54Skardel    )],
4270abb0f93cSkardel    [ans=$enableval],
4271abb0f93cSkardel    [ans=no]
4272abb0f93cSkardel)
4273abb0f93cSkardel
4274abb0f93cSkardelAC_MSG_RESULT([$ans])
4275abb0f93cSkardel
4276abb0f93cSkardelcase "$ans" in
4277abb0f93cSkardel no)
4278abb0f93cSkardel    ntp_signd_path=
4279abb0f93cSkardel    ;;
4280abb0f93cSkardel yes)
4281abb0f93cSkardel    ntp_signd_path=/var/run/ntp_signd
4282abb0f93cSkardel    ;;
4283abb0f93cSkardel *)
4284abb0f93cSkardel    ntp_signd_path="$ans"
4285abb0f93cSkardelesac
4286abb0f93cSkardel
4287abb0f93cSkardelcase "$ntp_signd_path" in
4288abb0f93cSkardel '')
4289abb0f93cSkardel    ;;
4290abb0f93cSkardel *)
4291f003fb54Skardel    AC_DEFINE([HAVE_NTP_SIGND], [1],
4292f003fb54Skardel	[Do we want support for Samba's signing daemon?])
4293f003fb54Skardel    AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
4294f003fb54Skardel	[Path to sign daemon rendezvous socket])
4295abb0f93cSkardel    ;;
4296abb0f93cSkardelesac
4297abb0f93cSkardel
4298*eabc0478Schristosdnl check for 'magic pps' for Linux
4299*eabc0478SchristosAC_MSG_CHECKING([if we want 'magic' PPS support])
4300*eabc0478SchristosAC_ARG_ENABLE(
4301*eabc0478Schristos    [magicpps],
4302*eabc0478Schristos    [AS_HELP_STRING(
4303*eabc0478Schristos	[--enable-magicpps],
4304*eabc0478Schristos	[+ try to auto-instantiate PPS devices on Linux]
4305*eabc0478Schristos    )],
4306*eabc0478Schristos    [ans=$enableval],
4307*eabc0478Schristos    [ans=yes]
4308*eabc0478Schristos)
4309*eabc0478SchristosAC_MSG_RESULT([$ans])
4310*eabc0478Schristoscase "$ans" in
4311*eabc0478Schristos yes)
4312*eabc0478Schristos    AC_DEFINE([ENABLE_MAGICPPS], [1],
4313*eabc0478Schristos	[auto-instantiate missing PPS devices on Linux])
4314*eabc0478Schristos    AC_CHECK_FUNCS([openat fdopendir fstatat])
4315*eabc0478Schristos    ;;
4316*eabc0478Schristosesac
4317*eabc0478Schristos
4318abb0f93cSkardelAC_CHECK_HEADERS([libscf.h])
4319f003fb54SkardelLSCF=
4320abb0f93cSkardelcase "$ac_cv_header_libscf_h" in
4321abb0f93cSkardel yes)
4322f003fb54Skardel    LSCF='-lscf'
4323abb0f93cSkardelesac
4324f003fb54SkardelAC_SUBST([LSCF])
4325abb0f93cSkardel
43268585484eSchristosNTP_IPV6
4327abb0f93cSkardel
4328abb0f93cSkardel
4329abb0f93cSkardel#
4330abb0f93cSkardel# Look for a sysctl call to get the list of network interfaces.
4331abb0f93cSkardel#
4332abb0f93cSkardelAC_CACHE_CHECK(
4333abb0f93cSkardel    [for interface list sysctl],
4334f003fb54Skardel    [ntp_cv_iflist_sysctl],
4335b8ecfcfeSchristos    [AC_PREPROC_IFELSE(
4336b5bbe2e3Schristos	[AC_LANG_SOURCE([
4337abb0f93cSkardel	    #include <sys/param.h>
4338abb0f93cSkardel	    #include <sys/sysctl.h>
4339abb0f93cSkardel	    #include <sys/socket.h>
4340b8ecfcfeSchristos	    #ifndef NET_RT_IFLIST
4341b8ecfcfeSchristos	    # error
4342abb0f93cSkardel	    #endif
4343b5bbe2e3Schristos	])],
4344f003fb54Skardel	[ntp_cv_iflist_sysctl=yes],
4345f003fb54Skardel	[ntp_cv_iflist_sysctl=no]
4346f003fb54Skardel    )]
4347abb0f93cSkardel)
4348f003fb54Skardelcase "$ntp_cv_iflist_sysctl" in
4349abb0f93cSkardel yes)
4350f003fb54Skardel    AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
4351abb0f93cSkardelesac
4352abb0f93cSkardel
4353abb0f93cSkardel###
4354abb0f93cSkardel
4355abb0f93cSkardelAC_MSG_CHECKING([if we want the saveconfig mechanism])
4356f003fb54SkardelAC_ARG_ENABLE(
4357f003fb54Skardel    [saveconfig],
4358f003fb54Skardel    [AS_HELP_STRING(
4359f003fb54Skardel	[--enable-saveconfig],
4360f003fb54Skardel	[+ saveconfig mechanism]
4361f003fb54Skardel    )],
4362f003fb54Skardel    [ntp_ok=$enableval],
4363f003fb54Skardel    [ntp_ok=yes]
4364f003fb54Skardel)
4365abb0f93cSkardelntp_saveconfig_enabled=0
43668585484eSchristoscase "$ntp_ok" in
43678585484eSchristos yes)
4368abb0f93cSkardel    ntp_saveconfig_enabled=1
4369f003fb54Skardel    AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
43708585484eSchristos    ;;
43718585484eSchristosesac
4372abb0f93cSkardelAM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
4373f003fb54SkardelAC_MSG_RESULT([$ntp_ok])
4374abb0f93cSkardel
4375f17b710fSchristos###
4376f17b710fSchristos
4377f17b710fSchristosAC_MSG_CHECKING([if we want the experimental leap smear code])
4378f17b710fSchristosAC_ARG_ENABLE(
4379f17b710fSchristos    [leap-smear],
4380f17b710fSchristos    [AS_HELP_STRING(
4381f17b710fSchristos	[--enable-leap-smear],
4382f17b710fSchristos	[- experimental leap smear code]
4383f17b710fSchristos    )],
4384f17b710fSchristos    [ntp_ok=$enableval],
4385f17b710fSchristos    [ntp_ok=no]
4386f17b710fSchristos)
4387f17b710fSchristosntp_leap_smear_enabled=0
4388f17b710fSchristoscase "$ntp_ok" in
4389f17b710fSchristos yes)
4390f17b710fSchristos    ntp_leap_smear_enabled=1
4391f17b710fSchristos    AC_DEFINE([LEAP_SMEAR], [1], [leap smear mechanism])
4392f17b710fSchristos    AC_SUBST([HAVE_LEAPSMEARINTERVAL])
4393f17b710fSchristos    HAVE_LEAPSMEARINTERVAL="leapsmearinterval 0"
4394f17b710fSchristos    ;;
4395f17b710fSchristosesac
4396f17b710fSchristosAC_MSG_RESULT([$ntp_ok])
4397f17b710fSchristos
4398ae49d4a4Schristos###
4399ae49d4a4Schristos
4400ae49d4a4SchristosAC_MSG_CHECKING([if we want dynamic interleave support])
4401ae49d4a4SchristosAC_ARG_ENABLE(
4402ae49d4a4Schristos    [dynamic-interleave],
4403ae49d4a4Schristos    [AS_HELP_STRING(
4404ae49d4a4Schristos	[--enable-dynamic-interleave],
4405ae49d4a4Schristos	[- dynamic interleave support]
4406ae49d4a4Schristos    )],
4407ae49d4a4Schristos    [ntp_ok=$enableval],
4408ae49d4a4Schristos    [ntp_ok=no]
4409ae49d4a4Schristos)
4410ae49d4a4Schristosntp_dynamic_interleave=0
4411ae49d4a4Schristoscase "$ntp_ok" in
4412ae49d4a4Schristos yes)
4413ae49d4a4Schristos    ntp_dynamic_interleave=1
4414ae49d4a4Schristos    ;;
4415ae49d4a4Schristosesac
4416ae49d4a4SchristosAC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
4417ae49d4a4Schristos    [support dynamic interleave?])
4418ae49d4a4SchristosAC_MSG_RESULT([$ntp_ok])
4419ae49d4a4Schristos
4420*eabc0478SchristosAH_BOTTOM([
4421*eabc0478Schristos	/*
4422*eabc0478Schristos	 * Macro to use in otherwise-empty source files to comply with ANSI C
4423*eabc0478Schristos	 * requirement that each translation unit (source file) contain some
4424*eabc0478Schristos	 * declaration.  This has commonly been done by declaring an unused
4425*eabc0478Schristos	 * global variable of type int or char.  An extern reference to abs()
4426*eabc0478Schristos	 * serves the same purpose without bloat.  We once used exit() but
4427*eabc0478Schristos	 * that can produce warnings on systems that declare exit() noreturn.
4428*eabc0478Schristos	 */
4429*eabc0478Schristos	#define	NONEMPTY_TRANSLATION_UNIT	extern int abs(int);
4430*eabc0478Schristos])
4431f17b710fSchristos
4432*eabc0478SchristosNTP_UNITYBUILD
44338585484eSchristos
4434a6f3f22fSchristosNTP_PROBLEM_TESTS
4435a6f3f22fSchristos
4436abb0f93cSkardel###
4437abb0f93cSkardel
443879045f13SchristosAC_CHECK_DECLS([sigsetjmp,siglongjmp], [], [], [[#include <setjmp.h>]])
443979045f13Schristos
444079045f13Schristos###
444179045f13Schristos
4442f003fb54SkardelAC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
4443f003fb54Skardel    [Default location of crypto key info])
4444abb0f93cSkardel
4445f003fb54SkardelAC_CONFIG_FILES([Makefile])
4446f003fb54SkardelAC_CONFIG_FILES([adjtimed/Makefile])
4447f003fb54SkardelAC_CONFIG_FILES([clockstuff/Makefile])
4448f003fb54SkardelAC_CONFIG_FILES([include/Makefile])
4449f003fb54SkardelAC_CONFIG_FILES([include/isc/Makefile])
4450f003fb54SkardelAC_CONFIG_FILES([kernel/Makefile])
4451f003fb54SkardelAC_CONFIG_FILES([kernel/sys/Makefile])
4452f003fb54SkardelAC_CONFIG_FILES([libntp/Makefile])
4453f003fb54SkardelAC_CONFIG_FILES([libparse/Makefile])
4454f003fb54SkardelAC_CONFIG_FILES([ntpd/Makefile])
4455*eabc0478SchristosAC_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])
4456f003fb54SkardelAC_CONFIG_FILES([ntpdate/Makefile])
4457f003fb54SkardelAC_CONFIG_FILES([ntpdc/Makefile])
4458f003fb54SkardelAC_CONFIG_FILES([ntpdc/nl.pl],		[chmod +x ntpdc/nl.pl])
4459f003fb54SkardelAC_CONFIG_FILES([ntpq/Makefile])
4460f003fb54SkardelAC_CONFIG_FILES([ntpsnmpd/Makefile])
4461f003fb54SkardelAC_CONFIG_FILES([parseutil/Makefile])
4462f003fb54SkardelAC_CONFIG_FILES([scripts/Makefile])
4463b5bbe2e3SchristosAC_CONFIG_FILES([scripts/build/Makefile])
446442c29440SchristosAC_CONFIG_FILES([scripts/build/genAuthors],	[chmod +x scripts/build/genAuthors])
44658585484eSchristosAC_CONFIG_FILES([scripts/build/mkver],	[chmod +x scripts/build/mkver])
4466b5bbe2e3SchristosAC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
4467b5bbe2e3SchristosAC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
4468b5bbe2e3SchristosAC_CONFIG_FILES([scripts/lib/Makefile])
44698585484eSchristosAC_CONFIG_FILES([scripts/ntp-wait/Makefile])
4470b5bbe2e3SchristosAC_CONFIG_FILES([scripts/ntp-wait/ntp-wait],	[chmod +x scripts/ntp-wait/ntp-wait])
44718585484eSchristosAC_CONFIG_FILES([scripts/ntpsweep/Makefile])
4472b5bbe2e3SchristosAC_CONFIG_FILES([scripts/ntpsweep/ntpsweep],	[chmod +x scripts/ntpsweep/ntpsweep])
44738585484eSchristosAC_CONFIG_FILES([scripts/ntptrace/Makefile])
4474b5bbe2e3SchristosAC_CONFIG_FILES([scripts/ntptrace/ntptrace],	[chmod +x scripts/ntptrace/ntptrace])
4475f003fb54SkardelAC_CONFIG_FILES([scripts/ntpver],	[chmod +x scripts/ntpver])
4476f003fb54SkardelAC_CONFIG_FILES([scripts/plot_summary],	[chmod +x scripts/plot_summary])
4477f003fb54SkardelAC_CONFIG_FILES([scripts/summary],	[chmod +x scripts/summary])
4478b5bbe2e3SchristosAC_CONFIG_FILES([scripts/update-leap/Makefile])
4479f17b710fSchristosAC_CONFIG_FILES([scripts/update-leap/update-leap], [chmod +x scripts/update-leap/update-leap])
44808585484eSchristosAC_CONFIG_FILES([tests/Makefile])
4481f17b710fSchristosAC_CONFIG_FILES([tests/bug-2803/Makefile])
44828585484eSchristosAC_CONFIG_FILES([tests/libntp/Makefile])
44838585484eSchristosAC_CONFIG_FILES([tests/ntpd/Makefile])
4484a6f3f22fSchristosAC_CONFIG_FILES([tests/ntpq/Makefile])
4485f17b710fSchristosAC_CONFIG_FILES([tests/sandbox/Makefile])
4486f17b710fSchristosAC_CONFIG_FILES([tests/sec-2853/Makefile])
4487f003fb54SkardelAC_CONFIG_FILES([util/Makefile])
4488abb0f93cSkardel
44898585484eSchristosperllibdir="${datadir}/ntp/lib"
44908585484eSchristosAC_DEFINE_DIR([PERLLIBDIR], [perllibdir], [data dir])
44918585484eSchristos
44928585484eSchristoscalc_tickadj_opts="$srcdir/scripts/calc_tickadj/calc_tickadj-opts"
44938585484eSchristosAC_SUBST_FILE([calc_tickadj_opts])
44948585484eSchristosntp_wait_opts="$srcdir/scripts/ntp-wait/ntp-wait-opts"
44958585484eSchristosAC_SUBST_FILE([ntp_wait_opts])
44968585484eSchristosntpsweep_opts="$srcdir/scripts/ntpsweep/ntpsweep-opts"
44978585484eSchristosAC_SUBST_FILE([ntpsweep_opts])
44988585484eSchristosntptrace_opts="$srcdir/scripts/ntptrace/ntptrace-opts"
44998585484eSchristosAC_SUBST_FILE([ntptrace_opts])
45008585484eSchristossummary_opts="$srcdir/scripts/summary-opts"
45018585484eSchristosAC_SUBST_FILE([summary_opts])
45028585484eSchristosplot_summary_opts="$srcdir/scripts/plot_summary-opts"
45038585484eSchristosAC_SUBST_FILE([plot_summary_opts])
45048585484eSchristos
4505f003fb54SkardelAC_CONFIG_SUBDIRS([sntp])
4506abb0f93cSkardel
4507abb0f93cSkardelAC_OUTPUT
4508