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