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