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