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