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