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