]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ntp/configure.in
This commit was generated by cvs2svn to compensate for changes in r55357,
[FreeBSD/FreeBSD.git] / contrib / ntp / configure.in
1 dnl -*-fundamental-*-
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(ntpd/ntp_refclock.c)
4 AC_CANONICAL_SYSTEM
5 AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target")
6 AM_CONFIG_HEADER(config.h)
7 AC_ARG_PROGRAM
8 AM_INIT_AUTOMAKE(ntp, 4.0.98f)
9 AC_PREREQ(2.13)
10
11 ac_cv_var_oncore_ok=no
12
13 dnl Grab any initial CFLAGS so we can pick better defaults.
14 iCFLAGS="$CFLAGS"
15
16 dnl  we need to check for cross compile tools for vxWorks here
17 AC_PROG_CC
18 AC_PROG_CPP
19
20 case "$target" in
21  *-pc-cygwin*)
22     CFLAGS="$CFLAGS -DSYS_CYGWIN32"
23     ;;
24  i386-sequent-sysv4)
25     case "$CC" in
26      cc)
27         CFLAGS="$CFLAGS -Wc,+Abi-socket"
28         ;;
29     esac
30 esac
31
32 case "$host" in
33  $target)
34     ;;
35  *) case "$target" in
36      *-*-vxworks*)
37         # Quick and dirty sanity check
38         case "$VX_KERNEL" in
39          '') AC_MSG_ERROR(Please follow the directions in html/vxworks.html!)
40             ;;
41         esac
42         CFLAGS="$CFLAGS -DSYS_VXWORKS"
43         ;;
44     esac
45     ;;
46 esac
47
48 dnl  we need to check for cross compile tools for vxWorks here
49 AC_PROG_AWK
50 AC_PROG_MAKE_SET
51
52 rm -f conftest*
53
54 case "$GCC" in
55  yes)
56     CFLAGS="$CFLAGS -Wall"
57     # CFLAGS="$CFLAGS -Wtraditional"
58     CFLAGS="$CFLAGS -Wshadow"
59     # CFLAGS="$CFLAGS -Wwrite-strings"
60     CFLAGS="$CFLAGS -Wconversion"
61     CFLAGS="$CFLAGS -Wpointer-arith"
62     CFLAGS="$CFLAGS -Wcast-qual"
63     # CFLAGS="$CFLAGS -Wcast-align"
64     CFLAGS="$CFLAGS -Wstrict-prototypes"
65
66     AC_CACHE_CHECK(whether ${CC-cc} -pipe works, ac_cv_prog_cc_pipe,
67     [echo 'void f(){}' > conftest.c
68     if test -z "`${CC-cc} -pipe -c conftest.c 2>&1`" -a -s conftest.o; then
69       ac_cv_prog_cc_pipe=yes
70     else
71       ac_cv_prog_cc_pipe=no
72     fi
73     rm -f conftest*
74     ])
75
76     case "$ac_cv_prog_cc_pipe" in
77      yes)
78         CFLAGS="$CFLAGS -pipe"
79         ;;
80     esac
81     ;;
82 esac
83
84 ac_busted_vpath_in_make=no
85
86 case "$target" in
87  *-*-irix6.1*)  # 64 bit only
88     ;;
89  *-*-irix6*)    # 6.2 (and later?)
90     ac_busted_vpath_in_make=yes
91     # don't pass -n32 to gcc, it cannot handle and doesn't need it
92     if test "$GCC" != yes; then
93       case "$CFLAGS" in
94        *-n32*) ;;
95        *-n64*) ;;
96        *) case "$iCFLAGS" in
97            '') CFLAGS="-O2 -g3 -n32" ;;
98            *)  CFLAGS="$CFLAGS -n32" ;;
99           esac
100           ;;
101       esac
102       case "$LDFLAGS" in
103        *-n32*) ;;
104        *-n64*) ;;
105        *) LDFLAGS="$LDFLAGS -n32" ;;
106       esac
107     fi
108     ;;
109  *-next-nextstep3)
110     CFLAGS="$CFLAGS -posix" ;;
111  *-*-solaris2.5.1)
112     ac_busted_vpath_in_make=yes
113     ;;
114 dnl This is currently commented out by bor. 
115 dnl The new versions of ReliantUNIX round adjtime() interval down
116 dnl to 1/100s (system tick). This makes tickadj actually useless.
117 dnl So, I'd better not use additional flags.
118 dnl I leave it here just in case anybody has better idea
119 dnl  mips-sni-sysv4* )
120 dnl     #
121 dnl     # Add flags for 64 bit file access to enable tickadj to access /dev/kmem
122 dnl     #
123 dnl     if getconf _LFS_CFLAGS > /dev/null 2>&1 ; then
124 dnl       CFLAGS="$CFLAGS `getconf _LFS_CFLAGS`"
125 dnl     fi
126 dnl     ;;
127 esac
128
129 case "$ac_busted_vpath_in_make$srcdir" in
130  no*) ;;
131  yes.) ;;
132  *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in
133      '')
134         AC_MSG_ERROR(building outside of the main directory requires GNU make)
135         ;;
136      *) ;;
137     esac
138     ;;
139 esac
140
141 AC_SUBST(CFLAGS)dnl
142 AC_SUBST(LDFLAGS)dnl
143
144 AC_PROG_LN_S
145 AC_PROG_GCC_TRADITIONAL
146 AC_AIX
147 AC_MINIX
148 AC_ISC_POSIX
149 AC_PROG_RANLIB
150 AC_PATH_PROG(PATH_SH, sh)
151
152 case "$target" in
153  *-*-vxworks*)
154     ac_link="$ac_link $VX_KERNEL"
155     ;;
156 esac
157
158 AC_PROG_INSTALL
159
160 case "$target" in
161  *-pc-cygwin*)
162     AC_CHECK_LIB(advapi32, main)
163     ;;
164 esac
165 AC_CHECK_LIB(elf, nlist)
166 dnl AC_CHECK_LIB(kvm, main, , , -lelf)
167 AC_CHECK_LIB(kvm, main)         dnl We already know about -lelf here...
168 AC_CHECK_LIB(ld, nlist)
169 AC_CHECK_LIB(mld, nlist)
170 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent, , , -lsocket))
171 AC_CHECK_FUNC(openlog, , AC_CHECK_LIB(gen, openlog))
172
173 dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
174 dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
175 dnl so only use one of them
176 AC_CHECK_LIB(rt, sched_setscheduler, ,
177         AC_CHECK_LIB(posix4, sched_setscheduler))
178 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
179
180 AC_HEADER_STDC
181 AC_CHECK_HEADERS(bstring.h errno.h fcntl.h memory.h netdb.h poll.h resolv.h)
182 AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h termios.h)
183 AC_CHECK_HEADERS(timepps.h timex.h unistd.h utmp.h utmpx.h)
184 AC_CHECK_HEADERS(arpa/nameser.h net/if.h netinet/in.h netinet/ip.h)
185 AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO)])
186 AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
187 dnl AC_CHECK_HEADERS(sys/chudefs.h)
188 AC_CHECK_HEADERS(sys/clkdefs.h sys/file.h)
189 case "$target" in
190  *-*-sunos4*) ;;
191  *) AC_CHECK_HEADERS(sys/ioctl.h)
192     ;;
193 esac
194 AC_CHECK_HEADERS(sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h)
195 AC_CHECK_HEADERS(sys/ppstime.h sys/proc.h sys/resource.h sys/sched.h)
196 case "$target" in
197  *-*-sco*)
198     AC_CHECK_HEADERS(sys/sio.h)
199     ;;
200  *sgi*)
201     AC_CHECK_HEADERS(sys/syssgi.h)
202     ;;
203  *)
204     AC_CHECK_HEADERS(sys/select.h)
205     ;;
206 esac
207 AC_CHECK_HEADERS(sys/sockio.h sys/stat.h sys/stream.h sys/stropts.h)
208 AC_CHECK_HEADERS(sys/sysctl.h sys/termios.h sys/time.h)
209 AC_EGREP_CPP(yes,
210 [#include <sys/timepps.h>
211 #ifdef PPS_API_VERS_1
212 yes
213 #endif
214 ], AC_CHECK_HEADERS(sys/timepps.h))
215 AC_CHECK_HEADERS(sys/timers.h sys/timex.h sys/tpro.h sys/types.h sys/wait.h)
216 AC_HEADER_TIME
217 case "$target" in
218 *-convex-*)
219   AC_CHECK_HEADERS(/sys/sync/queue.h /sys/sync/sema.h)
220   ;;
221 *-*-bsdi*)
222   AC_CHECK_HEADERS(machine/inline.h sys/pcl720.h sys/i8253.h)
223   ;;
224 esac
225
226 AC_CHECK_HEADER(nlist.h,
227 [AC_DEFINE(NLIST_STRUCT)
228 AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
229 [AC_TRY_COMPILE([#include <nlist.h>],
230 [struct nlist n; n.n_un.n_name = 0;],
231 ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
232 if test $ac_cv_struct_nlist_n_un = yes; then
233   AC_DEFINE(NLIST_NAME_UNION)
234 fi
235 ])dnl
236
237 AC_CACHE_CHECK(for basic volatile support, ac_cv_c_volatile,
238 [AC_TRY_COMPILE([],[
239 volatile int x;],
240         ac_cv_c_volatile=yes,
241         ac_cv_c_volatile=no)
242 ])
243 case "$ac_cv_c_volatile" in
244  yes)
245     ;;
246  *) AC_DEFINE(volatile,)
247     ;;
248 esac
249
250 case "$target" in
251  sparc-*-solaris2*)
252     # Assume that solaris2 is Ansi C...
253     ;;
254  *)
255     AM_C_PROTOTYPES
256     ;;
257 esac
258 AC_CACHE_CHECK(if C compiler permits function prototypes, ac_cv_have_prototypes,
259 [AC_TRY_COMPILE([
260 extern int foo (short);
261 int foo(short i) { return i; }],[
262 int i;], ac_cv_have_prototypes=yes, ac_cv_have_prototypes=no)
263 ])
264 if test "$ac_cv_have_prototypes" = yes; then
265   AC_DEFINE(HAVE_PROTOTYPES)
266 fi
267
268 AC_C_CONST
269 case "$host" in
270  $target)
271     AC_C_BIGENDIAN
272     ;;
273  *) case "$target" in
274      i*86-*-vxworks*)
275         # LITTLEENDIAN
276         ;;
277      *-*-vxworks*)
278         AC_DEFINE(WORDS_BIGENDIAN)
279         ;;
280      *) AC_MSG_ERROR(Cross-compiling needs explicit byte order)
281         ;;
282     esac
283     ;;
284 esac
285 AC_TYPE_SIGNAL
286 AC_TYPE_OFF_T
287 AC_TYPE_SIZE_T
288 AC_CHECK_TYPE(time_t, long)
289 AC_STRUCT_TM
290
291 AC_CACHE_CHECK(for a fallback value for HZ, ac_cv_var_default_hz,
292 [ac_cv_var_default_hz=100
293 case "$target" in
294  alpha*-dec-osf4*|alpha*-dec-osf5*)
295     ac_cv_var_default_hz=1024
296     ;;
297  mips-dec-ultrix4*)
298     ac_cv_var_default_hz=256
299     ;;
300 esac])
301 AC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz)
302
303 AC_CACHE_CHECK(if we need to override the system's value for HZ, ac_cv_var_override_hz,
304 [ac_cv_var_override_hz=no
305 case "$target" in
306  alpha*-dec-osf4*|alpha*-dec-osf5*)
307     ac_cv_var_override_hz=yes
308     ;;
309  mips-dec-ultrix4*)
310     ac_cv_var_override_hz=yes
311     ;;
312  *-*-freebsd*)
313     ac_cv_var_override_hz=yes
314     ;;
315  *-*-sunos4*)
316     ac_cv_var_override_hz=yes
317     ;;
318 esac])
319 case "$ac_cv_var_override_hz" in
320  yes)
321     AC_DEFINE(OVERRIDE_HZ)
322     ;;
323 esac
324
325 dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
326 dnl [AC_TRY_LINK([#include <sys/types.h>
327 dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
328 dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
329 dnl if test $su_cv_func_ut_host_in_utmp = yes; then
330 dnl   AC_DEFINE(HAVE_UT_HOST)
331 dnl fi
332
333 dnl AC_MSG_CHECKING(if we can get the system boot time)
334 dnl AC_CACHE_VAL(su_cv_have_boot_time,
335 dnl [AC_EGREP_CPP(yes,
336 dnl [#ifdef HAVE_UTMPX_H
337 dnl #include <utmpx.h>
338 dnl #else
339 dnl #include <utmp.h>
340 dnl #endif
341 dnl #ifdef BOOT_TIME
342 dnl yes
343 dnl #endif
344 dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
345 dnl AC_MSG_RESULT($su_cv_have_boot_time)
346
347 AC_CACHE_CHECK(
348   struct sigaction for sa_sigaction,
349   ac_cv_struct_sigaction_has_sa_sigaction,
350   [
351     AC_TRY_COMPILE(
352       [#include <signal.h>],
353       [struct sigaction act; act.sa_sigaction = 0;],
354       ac_cv_struct_sigaction_has_sa_sigaction=yes,
355       ac_cv_struct_sigaction_has_sa_sigaction=no
356     )
357   ]
358 )
359 if test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then
360   AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION)
361 fi
362
363 AC_CACHE_CHECK(for struct ppsclockev, ac_cv_struct_ppsclockev,
364 [AC_TRY_COMPILE([
365 #include <sys/types.h>
366 #ifdef HAVE_SYS_TERMIOS_H
367 # include <sys/termios.h>
368 #endif
369 #ifdef HAVE_SYS_TIME_H
370 # include <sys/time.h>
371 #endif
372 #ifdef HAVE_SYS_PPSCLOCK_H
373 # include <sys/ppsclock.h>
374 #endif],[
375 extern struct ppsclockev *pce;
376 return pce->serial;],
377         ac_cv_struct_ppsclockev=yes,
378         ac_cv_struct_ppsclockev=no)
379 ])
380 if test $ac_cv_struct_ppsclockev = yes; then
381     AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV)
382 fi
383
384 AC_CACHE_CHECK(struct sockaddr for sa_len, ac_cv_struct_sockaddr_has_sa_len,
385 [AC_TRY_COMPILE([
386 #include <sys/types.h>
387 #include <sys/socket.h>],[
388 extern struct sockaddr *ps;
389 return ps->sa_len;],
390         ac_cv_struct_sockaddr_has_sa_len=yes,
391         ac_cv_struct_sockaddr_has_sa_len=no)
392 ])
393 if test $ac_cv_struct_sockaddr_has_sa_len = yes; then
394     AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR)
395 fi
396
397 AC_CACHE_CHECK(struct clockinfo for hz, ac_cv_struct_clockinfo_has_hz,
398 [AC_TRY_COMPILE([
399 #include <sys/time.h>],[
400 extern struct clockinfo *pc;
401 return pc->hz;],
402         ac_cv_struct_clockinfo_has_hz=yes,
403         ac_cv_struct_clockinfo_has_hz=no)
404 ])
405 if test $ac_cv_struct_clockinfo_has_hz = yes; then
406     AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO)
407 fi
408
409 AC_CACHE_CHECK(struct clockinfo for tickadj, ac_cv_struct_clockinfo_has_tickadj,
410 [AC_TRY_COMPILE([
411 #include <sys/time.h>],[
412 extern struct clockinfo *pc;
413 return pc->tickadj;],
414         ac_cv_struct_clockinfo_has_tickadj=yes,
415         ac_cv_struct_clockinfo_has_tickadj=no)
416 ])
417 if test $ac_cv_struct_clockinfo_has_tickadj = yes; then
418     AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO)
419 fi
420
421 AC_CACHE_CHECK([for struct ntptimeval], ac_cv_struct_ntptimeval,
422 [AC_TRY_COMPILE([
423 #include <sys/time.h>
424 #include <sys/timex.h>],
425 [struct ntptimeval n;],
426 ac_cv_struct_ntptimeval=yes, ac_cv_struct_ntptimeval=no)])
427 if test $ac_cv_struct_ntptimeval = yes; then
428   AC_DEFINE(HAVE_STRUCT_NTPTIMEVAL, 1, [Do we have struct ntptimeval?])
429 fi
430
431 AC_CACHE_CHECK(struct ntptimeval for time.tv_nsec, ac_cv_struct_ntptimeval_tv_nsec,
432 [AC_TRY_COMPILE([
433 #ifdef HAVE_SYS_TIME_H
434 #include <sys/time.h>
435 #else
436 # ifdef HAVE_TIME_H
437 # include <time.h>
438 # endif
439 #endif
440 #ifdef HAVE_SYS_TIMEX_H
441 #include <sys/timex.h>
442 #else
443 # ifdef HAVE_TIMEX_H
444 # include <timex.h>
445 # endif
446 #endif],[
447 extern struct ntptimeval *ntv;
448 return ntv->time.tv_nsec;],
449         ac_cv_struct_ntptimeval_tv_nsec=yes,
450         ac_cv_struct_ntptimeval_tv_nsec=no)
451 ])
452 if test "$ac_cv_struct_ntptimeval_tv_nsec" = "yes"; then
453         AC_DEFINE(HAVE_TV_NSEC_IN_NTPTIMEVAL)
454 fi
455
456 AC_CACHE_CHECK([for struct timespec in struct ntptimeval], ac_cv_struct_ntptimeval_timespec,
457 [AC_TRY_COMPILE([#include <sys/time.h>
458 #include <sys/timex.h>],
459 [struct ntptimeval n; n.time.tv_nsec = 0;],
460 ac_cv_struct_ntptimeval_timespec=yes, ac_cv_struct_ntptimeval_timespec=no)])
461 if test $ac_cv_struct_ntptimeval_timespec = yes; then
462   AC_DEFINE(TIMESPEC_IN_NTPTIMEVAL, 1, [Does ntptimeval use struct timespec?])
463 fi
464
465 AC_C_INLINE
466 AC_C_CHAR_UNSIGNED              dnl CROSS_COMPILE?
467 case "$host" in
468  $target)
469     AC_CHECK_SIZEOF(signed char)
470     ;;
471  *) case "$target" in
472      *-*-vxworks*)
473         AC_CHECK_SIZEOF(signed char, 1)
474         ;;
475      *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_SIGNED_LONG)
476         ;;
477     esac
478     ;;
479 esac
480
481 case "$host" in
482  $target)
483     AC_CHECK_SIZEOF(int)
484     ;;
485  *) case "$target" in
486      *-*-vxworks*)
487         AC_CHECK_SIZEOF(int, 4)
488         ;;
489      *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_INT)
490         ;;
491     esac
492     ;;
493 esac
494
495 case "$host" in
496  $target)
497     AC_CHECK_SIZEOF(long)
498     ;;
499  *) case "$target" in
500      *-*-vxworks*)
501         AC_CHECK_SIZEOF(long, 4)
502         ;;
503      *) AC_MSG_ERROR(Cross-compiling needs explicit SIZEOF_LONG)
504         ;;
505     esac
506     ;;
507 esac
508
509 AC_CHECK_TYPE(s_char, signed char)
510 case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
511  *yes)
512     # We have a typedef for s_char.  Might as well believe it...
513     ;;
514  no0no)
515     # We have signed chars, can't say 'signed char', no s_char typedef.
516     AC_DEFINE(NEED_S_CHAR_TYPEDEF)
517     ;;
518  no1no)
519     # We have signed chars, can say 'signed char', no s_char typedef.
520     AC_DEFINE(NEED_S_CHAR_TYPEDEF)
521     ;;
522  yes0no)
523     # We have unsigned chars, can't say 'signed char', no s_char typedef.
524     AC_MSG_ERROR(No way to specify a signed character!)
525     ;;
526  yes1no)
527     # We have unsigned chars, can say 'signed char', no s_char typedef.
528     AC_DEFINE(NEED_S_CHAR_TYPEDEF)
529     ;;
530 esac
531 AC_TYPE_UID_T
532
533 case "$target" in
534  *-*-linux*)
535     AC_CHECK_FUNCS(__adjtimex __ntp_gettime)
536     ;;
537 esac
538 case "$target" in
539  *-*-aix4*)
540         # (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
541         # (returning ENOSYS).  I didn't check 4.2.  If, in the future,
542         # IBM pulls its thumbs out long enough to implement clock_settime,
543         # this conditional will need to change.  Maybe use AC_TRY_RUN
544         # instead to try to set the time to itself and check errno.
545     ;;
546  *) AC_CHECK_FUNCS(clock_settime)
547     ;;
548 esac
549 AC_CHECK_FUNCS(daemon getbootfile getdtablesize getrusage)
550 AC_CHECK_FUNCS(gettimeofday)
551 case "$target" in
552  *-pc-cygwin*)
553     ;;
554  *) AC_CHECK_FUNCS(getuid)
555     ;;
556 esac
557 AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset)
558 case "$target" in
559  *-*-sco3.2v5.0.*)
560     # Just stubs.  Idiots.
561     ;;
562  *) AC_CHECK_FUNCS(mkstemp)
563     ;;
564 esac
565 AC_REPLACE_FUNCS(mktime)
566 case "$target" in
567  *-*-aix4*)
568     # Just a stub.  Idiots.
569     ;;
570  *-*-irix*)
571     # Just stubs in Irix.  Idiots.
572     ;;
573  *-*-sco3.2v5.0.*)
574     # Just stubs.  Idiots.
575     ;;
576  alpha*-dec-osf4*|alpha*-dec-osf5*)
577     # mlockall is there, as a #define calling memlk via <sys/mman.h>
578     # Not easy to test for - cheat.
579     AC_CHECK_FUNCS(memlk, [ac_cv_func_mlockall='yes'])
580     AC_CHECK_FUNCS(mlockall)
581     ;;
582  *) AC_CHECK_FUNCS(mlockall)
583     ;;
584 esac
585 AC_CHECK_FUNCS(nice nlist)
586 case "$target" in
587  *-*-solaris2.6)
588     # Broken...
589     ;;
590  *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime)
591     ;;
592 esac
593 AC_CHECK_FUNCS(plock pututline pututxline rtprio)
594 AC_CHECK_FUNCS(random srandom mrand48 srand48)
595 case "$target" in
596  *-*-aix4*)
597     # Just a stub in AIX 4.  Idiots.
598     ;;
599  *-*-solaris2.5*)
600     # Just stubs in solaris2.5.  Idiots.
601     ;;
602  *) AC_CHECK_FUNCS(sched_setscheduler)
603     ;;
604 esac
605 AC_CHECK_FUNCS(setlinebuf)
606 AC_CHECK_FUNCS(setpgid setpriority setsid settimeofday setvbuf sigaction)
607 AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
608 AC_REPLACE_FUNCS(strerror)
609 case "$target" in
610  *-*-aix4*)
611     # Just stubs.  Idiots.
612     ;;
613  *-*-netbsd*)
614     # Just stubs.  Idiots.
615     ;;
616  *-*-openbsd*)
617     # Just stubs.  Idiots.
618     ;;
619  *) AC_CHECK_FUNCS(timer_create timer_settime)
620     ;;
621 esac
622 case "$target" in
623  *-pc-cygwin*)
624     # I have no idea...
625     ;;
626  *) AC_CHECK_FUNCS(umask)
627     ;;
628 esac
629 AC_CHECK_FUNCS(uname updwtmp updwtmpx vsprintf)
630
631 AC_CACHE_CHECK(number of arguments to gettimeofday(), ac_cv_func_Xettimeofday_nargs,
632 [AC_TRY_COMPILE([#include <sys/time.h>],[
633 gettimeofday((struct timeval*)0,(struct timezone*)0);
634 settimeofday((struct timeval*)0,(struct timezone*)0);
635 ],
636         ac_cv_func_Xettimeofday_nargs=2, ac_cv_func_Xettimeofday_nargs=1)
637 ])
638 if test $ac_cv_func_Xettimeofday_nargs = 1; then
639         AC_DEFINE(SYSV_TIMEOFDAY)
640 fi
641
642 AC_CACHE_CHECK(number of arguments taken by setpgrp(), ac_cv_func_setpgrp_nargs,
643 [AC_TRY_COMPILE([
644 #ifdef HAVE_SYS_TYPES_H
645 # include <sys/types.h>
646 #endif
647 #ifdef HAVE_UNISTD_H
648 # include <unistd.h>
649 #endif
650 ],[setpgrp(0,0);],
651         ac_cv_func_setpgrp_nargs=2, ac_cv_func_setpgrp_nargs=0)
652 ])
653 if test $ac_cv_func_setpgrp_nargs = 0; then
654         AC_DEFINE(HAVE_SETPGRP_0)
655 fi
656
657 save_CFLAGS=$CFLAGS
658 CFLAGS="$CFLAGS -I$srcdir/include"
659
660 AC_CACHE_CHECK(argument pointer type of qsort()'s compare function and base,
661 ac_cv_func_qsort_argtype,
662 [AC_TRY_COMPILE([
663 #include "l_stdlib.h"
664
665 #ifdef HAVE_PROTOTYPES
666 #define P(x) x
667 #else
668 #define P(x) ()
669 #endif
670
671 extern void *base;
672 extern sortfunc P((const void *, const void *));
673 int sortfunc(a, b)
674   const void *a;
675   const void *b; { return 0; }
676 ],[
677 qsort(base, 2, sizeof(char *), sortfunc);
678 ],
679         ac_cv_func_qsort_argtype=void, ac_cv_func_qsort_argtype=char)
680 ])
681 case "$ac_cv_func_qsort_argtype" in
682  void)
683     AC_DEFINE(QSORT_USES_VOID_P)
684     ;;
685 esac
686
687 CFLAGS=$save_CFLAGS
688
689 AC_CACHE_CHECK(if we need to declare 'errno', ac_cv_decl_errno,
690 [AC_TRY_COMPILE([#ifdef HAVE_ERRNO_H
691 #include <errno.h>
692 #endif],
693   [errno = 0;],
694   ac_cv_decl_errno=no, ac_cv_decl_errno=yes)])
695 case "$ac_cv_decl_errno" in
696  yes) AC_DEFINE(DECL_ERRNO) ;;
697 esac
698
699 dnl FIXME: from ntpd/ntp_intres.c, but there's no info which header produces
700 dnl the clash.  <resolv.h> isn't currently used.
701 dnl
702 dnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
703 dnl MT purposes.  This makes the line "extern int h_errno" choke
704 dnl the compiler.  Hopefully adding !defined(h_errno) fixes this
705 dnl without breaking any other platforms.
706 dnl
707 AC_CACHE_CHECK(if we may declare 'h_errno', ac_cv_decl_h_errno,
708 [AC_TRY_COMPILE([#include <sys/types.h>
709 #ifdef HAVE_NETINET_IN_H
710 #include <netinet/in.h>
711 #endif
712 #ifdef HAVE_ARPA_NAMESER_H
713 #include <arpa/nameser.h>
714 #endif
715 #ifdef HAVE_NETDB_H
716 #include <netdb.h>
717 #endif
718 #ifdef HAVE_RESOLV_H
719 #include <resolv.h>
720 #endif],
721   [extern int h_errno;],
722   ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)])
723 case "$ac_cv_decl_h_errno" in
724  yes) AC_DEFINE(DECL_H_ERRNO) ;;
725 esac
726
727 dnl See if char *sys_errlist[] is OK.
728 dnl If you get the quoting right on the next line, you tried something I didn't.
729 AC_CACHE_CHECK(if declaring 'char *sys_errlist[]' is ok, ac_cv_decl_sys_errlist,
730 [AC_TRY_COMPILE([#include <stdio.h>
731 #ifdef HAVE_ERRNO_H
732 #include <errno.h>
733 #endif],
734   changequote(<<, >>)dnl
735   <<extern char *sys_errlist[];>>
736   changequote([, ]),
737   ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])
738 case "$ac_cv_decl_sys_errlist" in
739  yes) AC_DEFINE(CHAR_SYS_ERRLIST) ;;
740 esac
741
742 AC_CACHE_CHECK(if declaring 'syscall()' is ok, ac_cv_decl_syscall,
743 [AC_TRY_COMPILE([
744 #ifdef HAVE_SYS_TYPES_H
745 # include <sys/types.h>
746 #endif
747 #ifdef HAVE_UNISTD_H
748 # include <unistd.h>
749 #endif
750 #ifdef HAVE_PROTOTYPES
751 #define P(x) x
752 #else
753 #define P(x) ()
754 #endif
755 ],
756   [extern int syscall P((int, ...));],
757   ac_cv_decl_syscall=yes, ac_cv_decl_syscall=no)])
758 case "$ac_cv_decl_syscall" in
759  yes) AC_DEFINE(DECL_SYSCALL) ;;
760 esac
761
762 case "$target" in
763  *-*-osf[45]*)
764     AC_DEFINE(DECL_PLOCK_0)
765     AC_DEFINE(DECL_STIME_0)
766     ;;
767  *-*-riscos4*)
768     AC_DEFINE(DECL_ADJTIME_0)
769     AC_DEFINE(DECL_BZERO_0)
770     AC_DEFINE(DECL_IOCTL_0)
771     AC_DEFINE(DECL_IPC_0)
772     AC_DEFINE(DECL_MEMMOVE_0)
773     AC_DEFINE(DECL_MKTEMP_0)
774     AC_DEFINE(DECL_RENAME_0)
775     AC_DEFINE(DECL_SELECT_0)
776     AC_DEFINE(DECL_SETITIMER_0)
777     AC_DEFINE(DECL_SETPRIORITY_0)
778     AC_DEFINE(DECL_STDIO_0)
779     AC_DEFINE(DECL_STRTOL_0)
780     AC_DEFINE(DECL_SYSLOG_0)
781     AC_DEFINE(DECL_TIME_0)
782     AC_DEFINE(DECL_TIMEOFDAY_0)
783     AC_DEFINE(DECL_TOLOWER_0)
784     ;;
785  *-*-solaris2*)
786     AC_DEFINE(DECL_MKSTEMP_0)
787     AC_DEFINE(DECL_SETPRIORITY_1)
788     case "$target" in
789      *-*-solaris2.4)
790         AC_DEFINE(DECL_TIMEOFDAY_0)
791         ;;
792     esac
793     ;;
794  *-*-sunos4*)
795     AC_DEFINE(DECL_ADJTIME_0)
796     AC_DEFINE(DECL_BCOPY_0)
797     AC_DEFINE(DECL_BZERO_0)
798     AC_DEFINE(DECL_IOCTL_0)
799     AC_DEFINE(DECL_IPC_0)
800     AC_DEFINE(DECL_MEMMOVE_0)
801     AC_DEFINE(DECL_MKTEMP_0)
802     AC_DEFINE(DECL_MKSTEMP_0)
803     AC_DEFINE(DECL_MRAND48_0)
804     AC_DEFINE(DECL_RENAME_0)
805     AC_DEFINE(DECL_SELECT_0)
806     AC_DEFINE(DECL_SETITIMER_0)
807     AC_DEFINE(DECL_SETPRIORITY_0)
808     AC_DEFINE(DECL_SIGVEC_0)
809     AC_DEFINE(DECL_SRAND48_0)
810     case "`basename $ac_cv_prog_CC`" in
811      acc*) ;;
812      *) AC_DEFINE(DECL_STDIO_0)
813         ;;
814     esac
815     AC_DEFINE(DECL_STRTOL_0)
816     AC_DEFINE(DECL_SYSLOG_0)
817     AC_DEFINE(DECL_TIME_0)
818     AC_DEFINE(DECL_TIMEOFDAY_0)
819     AC_DEFINE(DECL_TOLOWER_0)
820     AC_DEFINE(DECL_TOUPPER_0)
821     ;;
822  *-*-ultrix4*)
823     AC_DEFINE(DECL_ADJTIME_0)
824     AC_DEFINE(DECL_BZERO_0)
825     AC_DEFINE(DECL_CFSETISPEED_0)
826     AC_DEFINE(DECL_IOCTL_0)
827     AC_DEFINE(DECL_IPC_0)
828     AC_DEFINE(DECL_MKTEMP_0)
829     AC_DEFINE(DECL_MRAND48_0)
830     AC_DEFINE(DECL_NLIST_0)
831     AC_DEFINE(DECL_PLOCK_0)
832     AC_DEFINE(DECL_SELECT_0)
833     AC_DEFINE(DECL_SETITIMER_0)
834     AC_DEFINE(DECL_SETPRIORITY_0)
835     AC_DEFINE(DECL_SRAND48_0)
836     AC_DEFINE(DECL_STIME_0)
837     AC_DEFINE(DECL_SYSLOG_0)
838     AC_DEFINE(DECL_TIMEOFDAY_0)
839     ;;
840 esac
841
842 case "$target" in
843  *-*-sco3.2*)
844     AC_DEFINE(TERMIOS_NEEDS__SVID3)
845     ;;
846 esac
847
848 AC_CACHE_CHECK(if we should use a streams device for ifconfig,
849  ac_cv_var_use_streams_device_for_ifconfig,
850  ac_cv_var_use_streams_device_for_ifconfig=no)
851
852 AC_CACHE_CHECK(if we need extra room for SO_RCVBUF, ac_cv_var_rcvbuf_slop,
853 [ans=no
854 changequote(<<, >>)dnl
855 case "$target" in
856  *-*-hpux[567]*)
857     ans=yes
858     ;;
859 esac
860 changequote([, ])dnl
861 ac_cv_var_rcvbuf_slop=$ans])
862 case "$ac_cv_var_rcvbuf_slop" in
863  yes) AC_DEFINE(NEED_RCVBUF_SLOP) ;;
864 esac
865
866 AC_CACHE_CHECK(if we will open the broadcast socket, ac_cv_var_open_bcast_socket,
867 [ans=yes
868 case "$target" in
869  *-*-domainos)
870     ans=no
871     ;;
872  *-*-linux*)
873     ans=no
874     ;;
875 esac
876 ac_cv_var_open_bcast_socket=$ans])
877 case "$ac_cv_var_open_bcast_socket" in
878  yes) AC_DEFINE(OPEN_BCAST_SOCKET) ;;
879 esac
880
881 AC_CACHE_CHECK(if we want the HPUX version of FindConfig(), ac_cv_var_hpux_findconfig,
882 [ans=no
883 case "$target" in
884  *-*-hpux*)
885     ans=yes
886     ;;
887 esac
888 ac_cv_var_hpux_findconfig=$ans])
889 case "$ac_cv_var_hpux_findconfig" in
890  yes) AC_DEFINE(NEED_HPUX_FINDCONFIG) ;;
891 esac
892
893 AC_CACHE_CHECK(if process groups are set with -pid, ac_cv_arg_setpgrp_negpid,
894 [changequote(<<, >>)dnl
895 case "$target" in
896  *-*-hpux[567]*)
897     ans=no
898     ;;
899  *-*-hpux*)
900     ans=yes
901     ;;
902  *-*-linux*)
903     ans=yes
904     ;;
905  *-*-sunos3*)
906     ans=yes
907     ;;
908  *-*-ultrix2*)
909     ans=yes
910     ;;
911  *)
912     ans=no
913     ;;
914 esac
915 changequote([, ])dnl
916 ac_cv_arg_setpgrp_negpid=$ans])
917 case "$ac_cv_arg_setpgrp_negpid" in
918  yes) AC_DEFINE(UDP_BACKWARDS_SETOWN) ;;
919 esac
920
921 AC_CACHE_CHECK(if we need a ctty for F_SETOWN, ac_cv_func_ctty_for_f_setown,
922 [case "$target" in
923  *-*-bsdi2*)
924     ans=yes
925     ;;
926  *-*-freebsd*)
927     ans=yes
928     ;;
929  *-*-netbsd*)
930     ans=yes
931     ;;
932  *-*-osf*)
933     ans=yes
934     ;;
935  *) ans=no
936     ;;
937 esac
938 ac_cv_func_ctty_for_f_setown=$ans])
939 case "$ac_cv_func_ctty_for_f_setown" in
940  yes) AC_DEFINE(USE_FSETOWNCTTY) ;;
941 esac
942
943 ntp_warning='GRONK'
944 AC_MSG_CHECKING(if we'll use clock_settime or settimeofday or stime)
945 case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
946  yes*)
947     ntp_warning=''
948     ans='clock_settime()'
949     ;;
950  noyes*)
951     ntp_warning='But clock_settime() would be better (if we had it)'
952     ans='settimeofday()'
953     ;;
954  nonoyes)
955     ntp_warning='Which is the worst of the three'
956     ans='stime()'
957     ;;
958  *) 
959     case "$host" in
960      $target) ntp_warning='Which leaves us with nothing to use!'
961     ans=none
962     ;;
963 esac
964 esac
965 AC_MSG_RESULT($ans)
966 case "$ntp_warning" in
967  '') ;;
968  *) AC_MSG_WARN(*** $ntp_warning ***)
969     ;;
970 esac
971
972 AC_CACHE_CHECK(if we have a losing syscall(), ac_cv_var_syscall_bug,
973 [case "$target" in
974  *-*-solaris2.4*)
975     ans=yes
976     ;;
977  *) ans=no
978     ;;
979 esac
980 ac_cv_var_syscall_bug=$ans])
981 case "$ac_cv_var_syscall_bug" in
982  yes) AC_DEFINE(SYSCALL_BUG) ;;
983 esac
984
985 AC_CACHE_CHECK(for Streams/TLI, ac_cv_var_streams_tli,
986 [ case "$ac_cv_header_sys_stropts_h" in
987   yes)
988      ans=no
989      # There must be a better way...
990      case "$target" in
991       *-*-ptx*)
992          ans=yes
993          ;;
994      esac
995      ;;
996  esac
997  ac_cv_var_streams_tli=$ans])
998 case "$ac_cv_var_streams_tli" in
999  yes)
1000     AC_DEFINE(STREAMS_TLI)
1001     ;;
1002 esac
1003
1004 AC_CACHE_CHECK(for SIGIO, ac_cv_hdr_def_sigio,
1005  AC_EGREP_CPP(yes,
1006   [#include <signal.h>
1007 #ifdef SIGIO
1008    yes
1009 #endif
1010   ], ac_cv_hdr_def_sigio=yes, ac_cv_hdr_def_sigio=no))
1011
1012 dnl Override those system that have a losing SIGIO
1013 AC_CACHE_CHECK(if we want to use signalled IO, ac_cv_var_signalled_io,
1014 [ans=no
1015 case "$ac_cv_hdr_def_sigio" in
1016  yes)
1017     ans=yes
1018     case "$target" in
1019      alpha*-dec-osf4*|alpha*-dec-osf5*)
1020         ans=no
1021         ;;
1022      *-convex-*)
1023         ans=no
1024         ;;
1025      *-dec-*)
1026         ans=no
1027         ;;
1028      *-pc-cygwin*)
1029         ans=no
1030         ;;
1031      *-sni-sysv*)
1032         ans=no
1033         ;;
1034      *-univel-sysv*)
1035         ans=no
1036         ;;
1037      *-*-irix6*)
1038         ans=no
1039         ;;
1040      *-*-freebsd*)
1041         ans=no
1042         ;;
1043      *-*-linux*)
1044         ans=no
1045         ;;
1046     esac
1047     ;;
1048 esac
1049 ac_cv_var_signalled_io=$ans])
1050 case "$ac_cv_var_signalled_io" in
1051  yes) AC_DEFINE(HAVE_SIGNALED_IO) ;;
1052 esac
1053
1054 AC_CACHE_CHECK(for SIGPOLL, ac_cv_hdr_def_sigpoll,
1055  AC_EGREP_CPP(yes,
1056  [#include <signal.h>
1057 #ifdef SIGPOLL
1058   yes
1059 #endif
1060  ], ac_cv_hdr_def_sigpoll=yes, ac_cv_hdr_def_sigpoll=no))
1061
1062 AC_CACHE_CHECK(for SIGSYS, ac_cv_hdr_def_sigsys,
1063  AC_EGREP_CPP(yes,
1064  [#include <signal.h>
1065 #ifdef SIGSYS
1066   yes
1067 #endif
1068  ], ac_cv_hdr_def_sigsys=yes, ac_cv_hdr_def_sigsys=no))
1069
1070 AC_CACHE_CHECK(if we can use SIGPOLL for UDP I/O, ac_cv_var_use_udp_sigpoll,
1071 [ans=no
1072 case "$ac_cv_hdr_def_sigpoll" in
1073  yes)
1074     changequote(<<, >>)dnl
1075     case "$target" in
1076      mips-sgi-irix*)
1077         ans=no
1078         ;;
1079      vax-dec-bsd)
1080         ans=no
1081         ;;
1082      *-pc-cygwin*)
1083         ans=no
1084         ;;
1085      *-sni-sysv*)
1086         ans=no
1087         ;;
1088      *-*-aix4*)
1089         ans=no
1090         ;;
1091      *-*-hpux*)
1092         ans=no
1093         ;;
1094      *-*-linux*)
1095         ans=no
1096         ;;
1097      *-*-osf*)
1098         ans=no
1099         ;;
1100      *-*-sunos*)
1101         ans=no
1102         ;;
1103      *-*-ultrix*)
1104         ans=no
1105         ;;
1106      *) ans=yes
1107         ;;
1108     esac
1109     changequote([, ])dnl
1110     ;;
1111 esac
1112 ac_cv_var_use_udp_sigpoll=$ans])
1113 case "$ac_cv_var_use_udp_sigpoll" in
1114  yes) AC_DEFINE(USE_UDP_SIGPOLL) ;;
1115 esac
1116
1117 AC_CACHE_CHECK(if we can use SIGPOLL for TTY I/O, ac_cv_var_use_tty_sigpoll,
1118 [ans=no
1119 case "$ac_cv_hdr_def_sigpoll" in
1120  yes)
1121     case "$target" in
1122      mips-sgi-irix*)
1123         ans=no
1124         ;;
1125      vax-dec-bsd)
1126         ans=no
1127         ;;
1128      *-pc-cygwin*)
1129         ans=no
1130         ;;
1131      *-sni-sysv*)
1132         ans=no
1133         ;;
1134      *-*-aix4*)
1135         ans=no
1136         ;;
1137      *-*-hpux*)
1138         ans=no
1139         ;;
1140      *-*-linux*)
1141         ans=no
1142         ;;
1143      *-*-osf*)
1144         ans=no
1145         ;;
1146      *-*-sunos*)
1147         ans=no
1148         ;;
1149      *-*-ultrix*)
1150         ans=no
1151         ;;
1152      *) ans=yes
1153         ;;
1154     esac
1155     ;;
1156 esac
1157 ac_cv_var_use_tty_sigpoll=$ans])
1158 case "$ac_cv_var_use_tty_sigpoll" in
1159  yes) AC_DEFINE(USE_TTY_SIGPOLL) ;;
1160 esac
1161
1162 case "$ac_cv_header_sys_sio_h" in
1163  yes)
1164     AC_CACHE_CHECK(sys/sio.h for TIOCDCDTIMESTAMP, ac_cv_hdr_def_tiocdcdtimestamp,
1165      AC_EGREP_CPP(yes,
1166 [#include <sys/sio.h>
1167 #ifdef TIOCDCDTIMESTAMP
1168   yes
1169 #endif
1170      ], ac_cv_hdr_def_tiocdcdtimestamp=yes, ac_cv_hdr_def_tiocdcdtimestamp=no))
1171     ;;
1172 esac
1173
1174 AC_CACHE_CHECK(if nlist() values might require extra indirection,
1175 ac_cv_var_nlist_extra_indirection,
1176 [ans=no
1177 case "$target" in
1178  *-*-aix*)
1179     ans=yes
1180     ;;
1181 esac
1182 ac_cv_var_nlist_extra_indirection=$ans])
1183 case "$ac_cv_var_nlist_extra_indirection" in
1184  yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION) ;;
1185 esac
1186
1187 AC_CACHE_CHECK(for a minimum recommended value of tickadj,
1188 ac_cv_var_min_rec_tickadj,
1189 [ans=no
1190 case "$target" in
1191  *-*-aix*)
1192     ans=40
1193     ;;
1194 esac
1195 ac_cv_var_min_rec_tickadj=$ans])
1196 case "$ac_cv_var_min_rec_tickadj" in
1197  ''|no) ;;
1198  *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj) ;;
1199 esac
1200
1201 AC_CACHE_CHECK(if the TTY code permits PARENB and IGNPAR,
1202 ac_cv_var_no_parenb_ignpar,
1203 [ans=no
1204 case "$target" in
1205  i?86-*-linux*)
1206     ans=yes
1207     ;;
1208  mips-sgi-irix*)
1209     ans=yes
1210     ;;
1211 esac
1212 ac_cv_var_no_parenb_ignpar=$ans])
1213 case "$ac_cv_var_no_parenb_ignpar" in
1214  yes) AC_DEFINE(NO_PARENB_IGNPAR) ;;
1215 esac
1216
1217 AC_MSG_CHECKING(if we're including debugging code)
1218 AC_ARG_ENABLE(debugging,        [  --enable-debugging      + include debugging code],
1219     [ntp_ok=$enableval], [ntp_ok=yes])
1220 if test "$ntp_ok" = "yes"; then
1221     AC_DEFINE(DEBUG)
1222 fi
1223 AC_MSG_RESULT($ntp_ok)
1224
1225 AC_MSG_CHECKING(for a the number of minutes in a DST adjustment)
1226 AC_ARG_ENABLE(dst_minutes,      [  --enable-dst-minutes=60 + minutes per DST adjustment],
1227     [ans=$enableval], [ans=60])
1228 AC_DEFINE_UNQUOTED(DSTMINUTES, $ans)
1229 AC_MSG_RESULT($ans)
1230
1231 AC_CACHE_CHECK(if we have the tty_clk line discipline/streams module,
1232  ac_cv_var_tty_clk,
1233  [case "$ac_cv_header_sys_clkdefs_h$ac_cv_hdr_def_tiocdcdtimestamp" in
1234   *yes*) ac_cv_var_tty_clk=yes ;;
1235  esac])
1236 case "$ac_cv_var_tty_clk" in
1237  yes) AC_DEFINE(TTYCLK) ;;
1238 esac
1239
1240 AC_CACHE_CHECK(for the ppsclock streams module,
1241  ac_cv_var_ppsclock,
1242  ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev)
1243 case "$ac_cv_var_ppsclock" in
1244  yes) AC_DEFINE(PPS) ;;
1245 esac
1246
1247 AC_CACHE_CHECK(for kernel multicast support, ac_cv_var_mcast,
1248   [ac_cv_var_mcast=no
1249   case "$target" in
1250    i386-sequent-sysv4) ;;
1251    *) AC_EGREP_CPP(yes,
1252   [#include <netinet/in.h>
1253 #ifdef IP_ADD_MEMBERSHIP
1254    yes
1255 #endif
1256   ], ac_cv_var_mcast=yes) ;;
1257   esac])
1258 case "$ac_cv_var_mcast" in
1259  yes) AC_DEFINE(MCAST) ;;
1260 esac
1261
1262 AC_CACHE_CHECK([availability of ntp_{adj,get}time()], ac_cv_var_ntp_syscalls,
1263  [ac_cv_var_ntp_syscalls=no
1264  case "$ac_cv_func___adjtimex" in
1265   yes)
1266     ac_cv_var_ntp_syscalls=libc
1267     ;;
1268   *) case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime" in
1269       yesyes)
1270         ac_cv_var_ntp_syscalls=libc
1271         ;;
1272       *) AC_EGREP_CPP(yes,
1273          [#include <sys/syscall.h>
1274 #if defined(SYS_ntp_gettime) && defined(SYS_ntp_adjtime)
1275            yes
1276 #endif
1277           ], ac_cv_var_ntp_syscalls=kernel)
1278          ;;
1279      esac
1280      ;;
1281  esac])
1282 case "$ac_cv_var_ntp_syscalls" in
1283  libc)
1284     AC_DEFINE(NTP_SYSCALLS_LIBC)
1285     ;;
1286  kernel)
1287     AC_DEFINE(NTP_SYSCALLS_STD)
1288     ;;
1289  *)
1290     ;;
1291 esac
1292
1293 AC_CACHE_CHECK(if sys/timex.h has STA_FLL, ac_cv_var_sta_fll,
1294 [AC_EGREP_CPP(yes,
1295     [#include <sys/timex.h>
1296 #ifdef STA_FLL
1297     yes
1298 #endif
1299     ], ac_cv_var_sta_fll=yes, ac_cv_var_sta_fll=no)])
1300
1301 AC_CACHE_CHECK(if we have kernel PLL support, ac_cv_var_kernel_pll,
1302 [dnl ac_cv_var_ntp_syscalls is {no,libc,kernel}
1303 case "$ac_cv_header_sys_timex_h$ac_cv_struct_ntptimeval$ac_cv_var_sta_fll$ac_cv_var_ntp_syscalls" in
1304  *no*)
1305     ac_cv_var_kernel_pll=no
1306     ;;
1307  *) ac_cv_var_kernel_pll=yes
1308     ;;
1309 esac])
1310 case "$ac_cv_var_kernel_pll" in
1311  yes)
1312     AC_DEFINE(KERNEL_PLL)
1313     ;;
1314 esac
1315
1316 AC_CACHE_CHECK(if SIOCGIFCONF returns buffer size in the buffer, ac_cv_var_size_returned_in_buffer,
1317   [ans=no
1318   case "$target" in
1319    *-fujitsu-uxp*)
1320       ans=yes
1321       ;;
1322    *-ncr-sysv4*)
1323       ans=yes
1324       ;;
1325    *-univel-sysv*)
1326       ans=yes
1327       ;;
1328   esac
1329   ac_cv_var_size_returned_in_buffer=$ans])
1330 case "$ac_cv_var_size_returned_in_buffer" in
1331  yes) AC_DEFINE(SIZE_RETURNED_IN_BUFFER) ;;
1332 esac
1333
1334 dnl AC_CACHE_CHECK(if we want GDT surveying code, ac_cv_var_gdt_surveying,
1335 dnl [AC_ARG_ENABLE(gdt-surveying,       [  --enable-gdt-surveying   - include GDT survey code],
1336 dnl     [ans=$enableval], [ans=no])
1337 dnl ac_cv_var_gdt_surveying=$ans])
1338 dnl case "$ac_cv_var_gdt_surveying" in
1339 dnl  yes) AC_DEFINE(GDT_SURVEYING) ;;
1340 dnl esac
1341
1342 AC_CACHE_CHECK(if we want to use MD5 authentication, ac_cv_var_use_md5,
1343 [AC_ARG_ENABLE(md5,             [  --enable-md5            + include support for MD5 keys],
1344     [ans=$enableval], [ans=yes])
1345 ac_cv_var_use_md5=$ans])
1346 case "$ac_cv_var_use_md5" in
1347  yes) AC_DEFINE(MD5) ;;
1348 esac
1349
1350 # Check for ioctls TIOCGPPSEV
1351 AC_MSG_CHECKING(ioctl TIOCGPPSEV)
1352 if test "$ac_cv_header_termios_h" = "yes"; then
1353     AC_EGREP_CPP(yes,
1354     [#include <termios.h>
1355 #ifdef TIOCGPPSEV
1356          yes
1357 #endif
1358          ], ntp_ok=yes, ntp_ok=no)
1359 else
1360 ntp_ok=no
1361 fi
1362
1363 if test "$ntp_ok" = "yes"; then
1364     AC_DEFINE(HAVE_TIOCGPPSEV)
1365     ac_cv_var_oncore_ok=yes
1366 fi
1367 AC_MSG_RESULT($ntp_ok)
1368
1369 # Check for ioctls TIOCSPPS
1370 AC_MSG_CHECKING(ioctl TIOCSPPS)
1371 if test "$ac_cv_header_termios_h" = "yes"; then
1372     AC_EGREP_CPP(yes,
1373     [#include <termios.h>
1374 #ifdef TIOCSPPS
1375          yes
1376 #endif
1377          ], ntp_ok=yes, ntp_ok=no)
1378 else
1379     ntp_ok=no
1380 fi
1381
1382 if test "$ntp_ok" = "yes"; then
1383     AC_DEFINE(HAVE_TIOCSPPS)
1384 fi
1385 AC_MSG_RESULT($ntp_ok)
1386
1387 # Check for ioctls CIOGETEV
1388 AC_MSG_CHECKING(ioctl CIOGETEV)
1389 if test "$ac_cv_header_sys_ppsclock_h" = "yes"; then
1390     AC_EGREP_CPP(yes,
1391     [#include <sys/ppsclock.h>
1392 #ifdef CIOGETEV
1393          yes
1394 #endif
1395          ], ntp_ok=yes, ntp_ok=no)
1396 else
1397 ntp_ok=no
1398 fi
1399
1400 if test "$ntp_ok" = "yes"; then
1401     ac_cv_var_oncore_ok=yes
1402     AC_DEFINE(HAVE_CIOGETEV)
1403 fi
1404 AC_MSG_RESULT($ntp_ok)
1405
1406 # Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
1407 # there is NO way that I can tell to tell if a given OS is using timespec or
1408 # timeval so just set it here for the one case that is KNOWN to use timespec.
1409
1410 case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h" in
1411  *yes*)
1412     AC_DEFINE(HAVE_PPSAPI)
1413     ac_cv_var_oncore_ok=yes
1414     AC_DEFINE(HAVE_TIMESPEC)
1415     ;;
1416 esac
1417
1418 # Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
1419 AC_CHECK_HEADER(linux/serial.h)
1420 AC_MSG_CHECKING(ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG)
1421 case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
1422   yesyes)
1423     AC_EGREP_CPP(yes,
1424     [#include <sys/time.h>
1425 typedef int u_int;
1426
1427 #include <sys/ppsclock.h>
1428 #include <linux/serial.h>
1429
1430 #ifdef TIOCGSERIAL
1431 #ifdef TIOCSSERIAL
1432 #ifdef ASYNC_PPS_CD_POS
1433 #ifdef ASYNC_PPS_CD_NEG
1434 #ifdef CIOGETEV
1435          yes
1436 #endif
1437 #endif
1438 #endif
1439 #endif
1440 #endif
1441          ], ntp_ok=yes)
1442         ;;
1443   *)
1444         ntp_ok=no
1445         ;;
1446 esac
1447
1448 if test "$ntp_ok" = "yes"; then
1449     AC_DEFINE(HAVE_TIO_SERIAL_STUFF)
1450 fi
1451 AC_MSG_RESULT($ntp_ok)
1452
1453 dnl dnl These are for OPT_PROGRAMS in authstuff/
1454 dnl AC_SUBST(AUTHCERT)
1455 dnl AC_SUBST(AUTHSPEED)
1456 dnl AC_SUBST(MD5DRIVER)
1457 dnl AC_SUBST(KEYPARITY)
1458 dnl AC_SUBST(MAKEIPFP)
1459 dnl AC_SUBST(MAKEPC1)
1460 dnl AC_SUBST(MAKEPC2)
1461 dnl AC_SUBST(MAKESP)
1462 dnl AC_SUBST(MKRANDKEYS)
1463 dnl AC_SUBST(OMAKEIPFP)
1464 dnl AC_SUBST(UNIXCERT)
1465
1466 ntp_refclock=no
1467
1468 # HPUX only, and by explicit request
1469 AC_MSG_CHECKING(Datum/Bancomm bc635/VME interface)
1470 AC_ARG_ENABLE(BANCOMM,          [  --enable-BANCOMM        - Datum/Bancomm bc635/VME interface],
1471     [ntp_ok=$enableval], [ntp_ok=no])
1472 if test "$ntp_ok" = "yes"; then
1473     ntp_refclock=yes
1474     AC_DEFINE(CLOCK_BANC)
1475 fi
1476 AC_MSG_RESULT($ntp_ok)
1477 case "$ntp_ok$target" in
1478  yes*-*-hpux*) ;;
1479  yes*) AC_WARN(*** But the expected answer is... no ***) ;;
1480 esac
1481
1482 #HPUX only, and only by explicit request
1483 AC_MSG_CHECKING(TrueTime GPS receiver/VME interface)
1484 AC_ARG_ENABLE(GPSVME,           [  --enable-GPSVME         - TrueTime GPS receiver/VME interface],
1485     [ntp_ok=$enableval], [ntp_ok=no])
1486 if test "$ntp_ok" = "yes"; then
1487     ntp_refclock=yes
1488     AC_DEFINE(CLOCK_GPSVME)
1489 fi
1490 AC_MSG_RESULT($ntp_ok)
1491 case "$ntp_ok$target" in
1492  yes*-*-hpux*) ;;
1493  yes*) AC_WARN(*** But the expected answer is... no ***) ;;
1494 esac
1495
1496 AC_MSG_CHECKING(for PCL720 clock support)
1497 case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
1498  yesyesyes)
1499     AC_DEFINE(CLOCK_PPS720)
1500     ans=yes
1501     ;;
1502  *)
1503     ans=no
1504     ;;
1505 esac
1506 AC_MSG_RESULT($ans)
1507
1508 AC_MSG_CHECKING(for SHM clock attached thru shared memory)
1509 AC_ARG_ENABLE(SHM,              [  --enable-SHM            - SHM clock attached thru shared memory],
1510     [ntp_ok=$enableval], [ntp_ok=no])
1511 if test "$ntp_ok" = "yes"; then
1512     ntp_refclock=yes
1513     AC_DEFINE(CLOCK_SHM)
1514 fi
1515 AC_MSG_RESULT($ntp_ok)
1516
1517 AC_MSG_CHECKING(for default inclusion of all suitable non-PARSE clocks)
1518 AC_ARG_ENABLE(all-clocks,       [  --enable-all-clocks     + include all suitable non-PARSE clocks:],
1519     [ntp_eac=$enableval], [ntp_eac=yes])
1520 AC_MSG_RESULT($ntp_eac)
1521
1522 AC_MSG_CHECKING(if we have support for PARSE clocks)
1523 case "$ac_cv_header_termio_h$ac_cv_header_termios_h" in
1524  *yes*)
1525     ntp_canparse=yes
1526     ;;
1527  *) ntp_canparse=no
1528     ;;
1529 esac
1530 AC_MSG_RESULT($ntp_canparse)
1531
1532 # Requires modem control
1533 AC_MSG_CHECKING(ACTS modem service)
1534 AC_ARG_ENABLE(ACTS,             [  --enable-ACTS           + ACTS modem service],
1535     [ntp_ok=$enableval],
1536     [AC_EGREP_CPP(yes,
1537         [#include <termios.h>
1538 #ifdef HAVE_SYS_IOCTL_H
1539 #include <sys/ioctl.h>
1540 #endif
1541 #ifdef TIOCMBIS
1542          yes
1543 #endif
1544          ], ntp_ok=$ntp_eac, ntp_ok=no)])
1545 if test "$ntp_ok" = "yes"; then
1546     ntp_refclock=yes
1547     AC_DEFINE(CLOCK_ACTS)
1548 fi
1549 AC_MSG_RESULT($ntp_ok)
1550
1551 AC_MSG_CHECKING(Arbiter 1088A/B GPS receiver)
1552 AC_ARG_ENABLE(ARBITER,          [  --enable-ARBITER        + Arbiter 1088A/B GPS receiver],
1553     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1554 if test "$ntp_ok" = "yes"; then
1555     ntp_refclock=yes
1556     AC_DEFINE(CLOCK_ARBITER)
1557 fi
1558 AC_MSG_RESULT($ntp_ok)
1559
1560 AC_MSG_CHECKING(Arcron MSF receiver)
1561 AC_ARG_ENABLE(ARCRON_MSF,       [  --enable-ARCRON-MSF     + Arcron MSF receiver],
1562     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1563 if test "$ntp_ok" = "yes"; then
1564     ntp_refclock=yes
1565     AC_DEFINE(CLOCK_ARCRON_MSF)
1566 fi
1567 AC_MSG_RESULT($ntp_ok)
1568
1569 AC_MSG_CHECKING(Austron 2200A/2201A GPS receiver)
1570 AC_ARG_ENABLE(AS2201,           [  --enable-AS2201         + Austron 2200A/2201A GPS receiver],
1571     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1572 if test "$ntp_ok" = "yes"; then
1573     ntp_refclock=yes
1574     AC_DEFINE(CLOCK_AS2201)
1575 fi
1576 AC_MSG_RESULT($ntp_ok)
1577
1578 AC_MSG_CHECKING(PPS interface)
1579 AC_ARG_ENABLE(ATOM,             [  --enable-ATOM           + PPS interface],
1580     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1581 if test "$ntp_ok" = "yes"; then
1582     ntp_refclock=yes
1583     AC_DEFINE(CLOCK_ATOM)
1584 fi
1585 AC_MSG_RESULT($ntp_ok)
1586
1587 AC_MSG_CHECKING(CHU modem/decoder)
1588 AC_ARG_ENABLE(CHU,              [  --enable-CHU            + CHU modem/decoder],
1589     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1590 if test "$ntp_ok" = "yes"; then
1591     ntp_refclock=yes
1592     AC_DEFINE(CLOCK_CHU)
1593 fi
1594 AC_MSG_RESULT($ntp_ok)
1595 ac_refclock_chu=$ntp_ok
1596
1597 AC_MSG_CHECKING(CHU audio/decoder)
1598 AC_ARG_ENABLE(AUDIO-CHU,        [  --enable-AUDIO-CHU      s - CHU audio/decoder],
1599     [ntp_ok=$enableval], [ntp_ok=no])
1600 if test "$ntp_ok" = "yes"; then
1601     AC_DEFINE(AUDIO_CHU)
1602 fi
1603 AC_MSG_RESULT($ntp_ok)
1604 case "$ntp_ok$ac_refclock_chu$target" in
1605  yesyes*-*-sunos*) ;;
1606  yesyes*-*-solaris*) ;;
1607  yes*) AC_WARN(*** But the expected answer is...no ***) ;;
1608 esac
1609
1610 # Not under HP-UX
1611 AC_MSG_CHECKING(Datum Programmable Time System)
1612 AC_ARG_ENABLE(DATUM,            [  --enable-DATUM          s Datum Programmable Time System],
1613     [ntp_ok=$enableval],
1614     [case "$ac_cv_header_termios_h" in
1615     yes)
1616         ntp_ok=$ntp_eac
1617         ;;
1618     *) ntp_ok=no
1619         ;;
1620     esac])
1621 if test "$ntp_ok" = "yes"; then
1622     ntp_refclock=yes
1623     AC_DEFINE(CLOCK_DATUM)
1624 fi
1625 AC_MSG_RESULT($ntp_ok)
1626
1627 # Requires modem control
1628 AC_MSG_CHECKING(Heath GC-1000 WWV/WWVH receiver)
1629 AC_ARG_ENABLE(HEATH,            [  --enable-HEATH          s Heath GC-1000 WWV/WWVH receiver],
1630     [ntp_ok=$enableval],
1631     [AC_EGREP_CPP(yes,
1632         [#include <termios.h>
1633 #ifdef HAVE_SYS_IOCTL_H
1634 #include <sys/ioctl.h>
1635 #endif
1636 #ifdef TIOCMBIS
1637          yes
1638 #endif
1639          ], ntp_ok=$ntp_eac, ntp_ok=no)])
1640 if test "$ntp_ok" = "yes"; then
1641     ntp_refclock=yes
1642     AC_DEFINE(CLOCK_HEATH)
1643 fi
1644 AC_MSG_RESULT($ntp_ok)
1645
1646 AC_MSG_CHECKING(HP 58503A GPS receiver)
1647 AC_ARG_ENABLE(HPGPS,            [  --enable-HPGPS          + HP 58503A GPS receiver],
1648     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1649 if test "$ntp_ok" = "yes"; then
1650     ntp_refclock=yes
1651     AC_DEFINE(CLOCK_HPGPS)
1652 fi
1653 AC_MSG_RESULT($ntp_ok)
1654
1655 AC_MSG_CHECKING(Sun IRIG audio decoder)
1656 AC_ARG_ENABLE(IRIG,             [  --enable-IRIG           s Sun IRIG audio decoder],
1657     [ntp_ok=$enableval],
1658     [case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in
1659      *yes*)
1660         ntp_ok=$ntp_eac
1661         ;;
1662      *) ntp_ok=no
1663         ;;
1664     esac])
1665 if test "$ntp_ok" = "yes"; then
1666     ntp_refclock=yes
1667     AC_DEFINE(CLOCK_IRIG)
1668 fi
1669 AC_MSG_RESULT($ntp_ok)
1670 case "$ntp_ok$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in
1671  yesnono) AC_WARN(*** But the expected answer is... no ***) ;;
1672 esac
1673
1674 AC_MSG_CHECKING(Leitch CSD 5300 Master Clock System Driver)
1675 AC_ARG_ENABLE(LEITCH,           [  --enable-LEITCH         + Leitch CSD 5300 Master Clock System Driver],
1676     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1677 if test "$ntp_ok" = "yes"; then
1678     ntp_refclock=yes
1679     AC_DEFINE(CLOCK_LEITCH)
1680 fi
1681 AC_MSG_RESULT($ntp_ok)
1682
1683 AC_MSG_CHECKING(local clock reference)
1684 AC_ARG_ENABLE(LOCAL-CLOCK,      [  --enable-LOCAL-CLOCK    + local clock reference],
1685     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1686 if test "$ntp_ok" = "yes"; then
1687     ntp_refclock=yes
1688     AC_DEFINE(CLOCK_LOCAL)
1689 fi
1690 AC_MSG_RESULT($ntp_ok)
1691
1692 AC_MSG_CHECKING(EES M201 MSF receiver)
1693 AC_ARG_ENABLE(MSFEES,           [  --enable-MSFEES         + EES M201 MSF receiver],
1694     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1695 if test "$ntp_ok" = "yes"; then
1696     ntp_refclock=yes
1697     AC_DEFINE(CLOCK_MSFEES)
1698 fi
1699 AC_MSG_RESULT($ntp_ok)
1700
1701 # Not Ultrix
1702 AC_MSG_CHECKING(Magnavox MX4200 GPS receiver)
1703 AC_ARG_ENABLE(MX4200,           [  --enable-MX4200         s Magnavox MX4200 GPS receiver],
1704     [ntp_ok=$enableval],
1705     [case "$ac_cv_var_ppsclock" in
1706      yes) ntp_ok=$ntp_eac
1707         ;;
1708      *) ntp_ok=no
1709         ;;
1710     esac])
1711 if test "$ntp_ok" = "yes"; then
1712     ntp_refclock=yes
1713     AC_DEFINE(CLOCK_MX4200)
1714 fi
1715 AC_MSG_RESULT($ntp_ok)
1716 case "$ntp_ok$target" in
1717  yes*-*-ultrix*) AC_WARN(*** But the expected answer is... no ***) ;;
1718 esac
1719
1720 AC_MSG_CHECKING(NMEA GPS receiver)
1721 AC_ARG_ENABLE(NMEA,             [  --enable-NMEA           + NMEA GPS receiver],
1722     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1723 if test "$ntp_ok" = "yes"; then
1724     ntp_refclock=yes
1725     AC_DEFINE(CLOCK_NMEA)
1726 fi
1727 AC_MSG_RESULT($ntp_ok)
1728
1729 AC_MSG_CHECKING(for ONCORE Motorola VP/UT Oncore GPS)
1730 AC_ARG_ENABLE(ONCORE,           [  --enable-ONCORE         + Motorola VP/UT Oncore GPS receiver],
1731     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1732 case "$ac_cv_var_oncore_ok" in
1733  no) ntp_ok=no ;;
1734 esac
1735 if test "$ntp_ok" = "yes"; then
1736     ntp_refclock=yes
1737     AC_DEFINE(CLOCK_ONCORE)
1738 fi
1739 AC_MSG_RESULT($ntp_ok)
1740
1741 AC_MSG_CHECKING(for Palisade clock)
1742 AC_ARG_ENABLE(PALISADE,         [  --enable-PALISADE       + Palisade clock],
1743     [ntp_ok=$enableval],
1744     [case "$ac_cv_header_termios_h" in
1745     yes)
1746         ntp_ok=$ntp_eac
1747         ;;
1748     *) ntp_ok=no
1749         ;;
1750     esac])
1751
1752 if test "$ntp_ok" = "yes"; then
1753     ntp_refclock=yes
1754     AC_DEFINE(CLOCK_PALISADE)
1755 fi
1756 AC_MSG_RESULT($ntp_ok)
1757
1758 AC_MSG_CHECKING(PST/Traconex 1020 WWV/WWVH receiver)
1759 AC_ARG_ENABLE(PST,              [  --enable-PST            + PST/Traconex 1020 WWV/WWVH receiver],
1760     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1761 if test "$ntp_ok" = "yes"; then
1762     ntp_refclock=yes
1763     AC_DEFINE(CLOCK_PST)
1764 fi
1765 AC_MSG_RESULT($ntp_ok)
1766
1767 # Not Ultrix
1768 AC_MSG_CHECKING(Rockwell Jupiter GPS receiver)
1769 AC_ARG_ENABLE(JUPITER,          [  --enable-JUPITER        s Rockwell Jupiter GPS receiver],
1770     [ntp_ok=$enableval],
1771     [case "$ac_cv_var_ppsclock" in
1772 #     yes) ntp_ok=$ntp_eac
1773 #        ;;
1774      *) ntp_ok=no
1775         ;;
1776     esac])
1777 if test "$ntp_ok" = "yes"; then
1778     ntp_refclock=yes
1779     AC_DEFINE(CLOCK_JUPITER)
1780 fi
1781 AC_MSG_RESULT($ntp_ok)
1782 case "$ntp_ok$target" in
1783  yes*-*-ultrix*) AC_WARN(*** But the expected answer is... no ***) ;;
1784 esac
1785
1786 # Requires modem control
1787 AC_MSG_CHECKING(PTB modem service)
1788 AC_ARG_ENABLE(PTBACTS,          [  --enable-PTBACTS        s PTB modem service],
1789     [ntp_ok=$enableval],
1790     [AC_EGREP_CPP(yes,
1791         [#include <termios.h>
1792 #ifdef HAVE_SYS_IOCTL_H
1793 #include <sys/ioctl.h>
1794 #endif
1795 #ifdef TIOCMBIS
1796          yes
1797 #endif
1798          ], ntp_ok=$ntp_eac, ntp_ok=no)])
1799 if test "$ntp_ok" = "yes"; then
1800     ntp_refclock=yes
1801     AC_DEFINE(CLOCK_PTBACTS)
1802 fi
1803 AC_MSG_RESULT($ntp_ok)
1804
1805 AC_MSG_CHECKING(KSI/Odetics TPRO/S GPS receiver/IRIG interface)
1806 AC_ARG_ENABLE(TPRO,             [  --enable-TPRO           s KSI/Odetics TPRO/S GPS receiver/IRIG interface],
1807     [ntp_ok=$enableval],
1808     [case "$ac_cv_header_sys_tpro_h" in
1809      yes)
1810         ntp_ok=$ntp_eac
1811         ;;
1812      *) ntp_ok=no
1813         ;;
1814     esac])
1815 if test "$ntp_ok" = "yes"; then
1816     ntp_refclock=yes
1817     AC_DEFINE(CLOCK_TPRO)
1818 fi
1819 AC_MSG_RESULT($ntp_ok)
1820 case "$ntp_ok$ac_cv_header_sys_tpro" in
1821  yesno) AC_WARN(*** But the expected answer is... no ***) ;;
1822 esac
1823
1824 AC_MSG_CHECKING(TRAK 8810 GPS receiver)
1825 AC_ARG_ENABLE(TRAK,             [  --enable-TRAK           + TRAK 8810 GPS receiver],
1826     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1827 if test "$ntp_ok" = "yes"; then
1828     ntp_refclock=yes
1829     AC_DEFINE(CLOCK_TRAK)
1830 fi
1831 AC_MSG_RESULT($ntp_ok)
1832
1833 AC_MSG_CHECKING(Chrono-log K-series WWVB receiver)
1834 AC_ARG_ENABLE(CHRONOLOG,        [  --enable-CHRONOLOG      + Chrono-log K-series WWVB receiver],
1835     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1836 if test "$ntp_ok" = "yes"; then
1837     ntp_refclock=yes
1838     AC_DEFINE(CLOCK_CHRONOLOG)
1839 fi
1840 AC_MSG_RESULT($ntp_ok)
1841
1842 AC_MSG_CHECKING(Dumb generic hh:mm:ss local clock)
1843 AC_ARG_ENABLE(DUMBCLOCK,        [  --enable-DUMBCLOCK      + Dumb generic hh:mm:ss local clock],
1844     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1845 if test "$ntp_ok" = "yes"; then
1846     ntp_refclock=yes
1847     AC_DEFINE(CLOCK_DUMBCLOCK)
1848 fi
1849 AC_MSG_RESULT($ntp_ok)
1850
1851 # Not on a vax-dec-bsd
1852 AC_MSG_CHECKING(Kinemetrics/TrueTime receivers)
1853 AC_ARG_ENABLE(TRUETIME,         [  --enable-TRUETIME       s Kinemetrics/TrueTime receivers],
1854     [ntp_ok=$enableval],
1855     [case "$target" in
1856      vax-dec-bsd)
1857         ntp_ok=no
1858         ;;
1859      *)
1860         ntp_ok=$ntp_eac
1861         ;;
1862     esac])
1863 if test "$ntp_ok" = "yes"; then
1864     ntp_refclock=yes
1865     AC_DEFINE(CLOCK_TRUETIME)
1866 fi
1867 AC_MSG_RESULT($ntp_ok)
1868 case "$ntp_ok$target" in
1869  yesvax-dec-bsd) AC_WARN(*** But the expected answer is... no ***) ;;
1870 esac
1871
1872 AC_MSG_CHECKING(Spectracom 8170/Netclock/2 WWVB receiver)
1873 AC_ARG_ENABLE(WWVB,             [  --enable-WWVB           + Spectracom 8170/Netclock/2 WWVB receiver],
1874     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1875 if test "$ntp_ok" = "yes"; then
1876     ntp_refclock=yes
1877     AC_DEFINE(CLOCK_WWVB)
1878 fi
1879 AC_MSG_RESULT($ntp_ok)
1880
1881 AC_MSG_CHECKING(Ultralink M320 WWVB receiver)
1882 AC_ARG_ENABLE(ULINK,            [  --enable-ULINK           + Ultralink WWVB receiver],
1883     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
1884 if test "$ntp_ok" = "yes"; then
1885     ntp_refclock=yes
1886     AC_DEFINE(CLOCK_ULINK)
1887 fi
1888 AC_MSG_RESULT($ntp_ok)
1889
1890 # Requires modem control
1891 AC_MSG_CHECKING(USNO modem service)
1892 AC_ARG_ENABLE(USNO,             [  --enable-USNO           s USNO modem service],
1893     [ntp_ok=$enableval],
1894     [AC_EGREP_CPP(yes,
1895         [#include <termios.h>
1896 #ifdef HAVE_SYS_IOCTL_H
1897 #include <sys/ioctl.h>
1898 #endif
1899 #ifdef TIOCMBIS
1900          yes
1901 #endif
1902          ], ntp_ok=$ntp_eac, ntp_ok=no)])
1903 if test "$ntp_ok" = "yes"; then
1904     ntp_refclock=yes
1905     AC_DEFINE(CLOCK_USNO)
1906 fi
1907 AC_MSG_RESULT($ntp_ok)
1908
1909 AC_MSG_CHECKING(for default inclusion of all suitable PARSE clocks)
1910 AC_ARG_ENABLE(parse-clocks,     [  --enable-parse-clocks   - include all suitable PARSE clocks:],
1911     [ntp_eapc=$enableval],
1912     [case "$ntp_eac" in
1913      yes) ntp_eapc=$ntp_canparse ;;
1914      *) ntp_eapc=no ;;
1915     esac
1916     ntp_eapc=no])
1917 AC_MSG_RESULT($ntp_eapc)
1918
1919 case "$ntp_eac$ntp_eapc$ntp_canparse" in
1920  noyes*)
1921     AC_MSG_ERROR("--enable-parse-clocks" requires "--enable-all-clocks".)
1922     ;;
1923  yesyesno)
1924     AC_MSG_ERROR(You said "--enable-parse-clocks" but PARSE isn't supported on this platform!)
1925     ;;
1926  *) ;;
1927 esac
1928
1929 ntp_libparse=no
1930 ntp_parseutil=no
1931 ntp_rawdcf=no
1932
1933 AC_MSG_CHECKING(Diem Computime Radio Clock)
1934 AC_ARG_ENABLE(COMPUTIME,        [  --enable-COMPUTIME      s Diem Computime Radio Clock],
1935     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
1936 if test "$ntp_ok" = "yes"; then
1937     ntp_libparse=yes
1938     ntp_refclock=yes
1939     AC_DEFINE(CLOCK_COMPUTIME)
1940 fi
1941 AC_MSG_RESULT($ntp_ok)
1942 case "$ntp_ok$ntp_canparse" in
1943  yesno)
1944     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
1945     ;;
1946 esac
1947
1948 AC_MSG_CHECKING(ELV/DCF7000 clock)
1949 AC_ARG_ENABLE(DCF7000,          [  --enable-DCF7000        s ELV/DCF7000 clock],
1950     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
1951 if test "$ntp_ok" = "yes"; then
1952     ntp_libparse=yes
1953     ntp_refclock=yes
1954     AC_DEFINE(CLOCK_DCF7000)
1955 fi
1956 AC_MSG_RESULT($ntp_ok)
1957 case "$ntp_ok$ntp_canparse" in
1958  yesno)
1959     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
1960     ;;
1961 esac
1962
1963 AC_MSG_CHECKING(HOPF 6021 clock)
1964 AC_ARG_ENABLE(HOPF6021,         [  --enable-HOPF6021       s HOPF 6021 clock],
1965     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
1966 if test "$ntp_ok" = "yes"; then
1967     ntp_libparse=yes
1968     ntp_refclock=yes
1969     AC_DEFINE(CLOCK_HOPF6021)
1970 fi
1971 AC_MSG_RESULT($ntp_ok)
1972 case "$ntp_ok$ntp_canparse" in
1973  yesno)
1974     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
1975     ;;
1976 esac
1977
1978 AC_MSG_CHECKING(Meinberg clocks)
1979 AC_ARG_ENABLE(MEINBERG,         [  --enable-MEINBERG       s Meinberg clocks],
1980     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
1981 if test "$ntp_ok" = "yes"; then
1982     ntp_libparse=yes
1983     ntp_refclock=yes
1984     AC_DEFINE(CLOCK_MEINBERG)
1985 fi
1986 AC_MSG_RESULT($ntp_ok)
1987 case "$ntp_ok$ntp_canparse" in
1988  yesno)
1989     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
1990     ;;
1991 esac
1992
1993 AC_MSG_CHECKING(DCF77 raw time code)
1994 AC_ARG_ENABLE(RAWDCF,           [  --enable-RAWDCF         s DCF77 raw time code],
1995     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
1996 if test "$ntp_ok" = "yes"; then
1997     ntp_libparse=yes
1998     ntp_parseutil=yes
1999     ntp_refclock=yes
2000     ntp_rawdcf=yes
2001     AC_DEFINE(CLOCK_RAWDCF)
2002 fi
2003 AC_MSG_RESULT($ntp_ok)
2004 case "$ntp_ok$ntp_canparse" in
2005  yesno)
2006     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2007     ;;
2008 esac
2009
2010 case "$ntp_rawdcf" in
2011  yes)
2012     AC_CACHE_CHECK(if we must enable parity for RAWDCF,
2013     ac_cv_var_rawdcf_parity,
2014     [ans=no
2015     case "$target" in
2016      *-*-linux*)
2017         ans=yes
2018         ;;
2019     esac
2020     ac_cv_var_rawdcf_parity=$ans])
2021     case "$ac_cv_var_rawdcf_parity" in
2022      yes) AC_DEFINE(RAWDCF_NO_IGNPAR) ;;
2023     esac
2024     ;;
2025
2026  *) # HMS: Is this a good idea?
2027     ac_cv_var_rawdcf_parity=no
2028     ;;
2029 esac
2030
2031 AC_MSG_CHECKING(RCC 8000 clock)
2032 AC_ARG_ENABLE(RCC8000,          [  --enable-RCC8000        s RCC 8000 clock],
2033     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2034 if test "$ntp_ok" = "yes"; then
2035     ntp_libparse=yes
2036     ntp_refclock=yes
2037     AC_DEFINE(CLOCK_RCC8000)
2038 fi
2039 AC_MSG_RESULT($ntp_ok)
2040 case "$ntp_ok$ntp_canparse" in
2041  yesno)
2042     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2043     ;;
2044 esac
2045
2046 AC_MSG_CHECKING(Schmid DCF77 clock)
2047 AC_ARG_ENABLE(SCHMID,           [  --enable-SCHMID         s Schmid DCF77 clock],
2048     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2049 if test "$ntp_ok" = "yes"; then
2050     ntp_libparse=yes
2051     ntp_refclock=yes
2052     AC_DEFINE(CLOCK_SCHMID)
2053 fi
2054 AC_MSG_RESULT($ntp_ok)
2055 case "$ntp_ok$ntp_canparse" in
2056  yesno)
2057     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2058     ;;
2059 esac
2060
2061 AC_MSG_CHECKING(Trimble GPS receiver/TAIP protocol)
2062 AC_ARG_ENABLE(TRIMTAIP,         [  --enable-TRIMTAIP       s Trimble GPS receiver/TAIP protocol],
2063     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2064 if test "$ntp_ok" = "yes"; then
2065     ntp_libparse=yes
2066     ntp_refclock=yes
2067     AC_DEFINE(CLOCK_TRIMTAIP)
2068 fi
2069 AC_MSG_RESULT($ntp_ok)
2070 case "$ntp_ok$ntp_canparse" in
2071  yesno)
2072     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2073     ;;
2074 esac
2075
2076 AC_MSG_CHECKING(Trimble GPS receiver/TSIP protocol)
2077 AC_ARG_ENABLE(TRIMTSIP,         [  --enable-TRIMTSIP       s Trimble GPS receiver/TSIP protocol],
2078     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2079 if test "$ntp_ok" = "yes"; then
2080     ntp_libparse=yes
2081     ntp_refclock=yes
2082     AC_DEFINE(CLOCK_TRIMTSIP)
2083 fi
2084 AC_MSG_RESULT($ntp_ok)
2085 case "$ntp_ok$ntp_canparse" in
2086  yesno)
2087     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2088     ;;
2089 esac
2090
2091 AC_MSG_CHECKING(WHARTON 400A Series clock)
2092 AC_ARG_ENABLE(WHARTON,          [  --enable-WHARTON        s WHARTON 400A Series clock],
2093     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2094 if test "$ntp_ok" = "yes"; then
2095     ntp_libparse=yes
2096     ntp_refclock=yes
2097     AC_DEFINE(CLOCK_WHARTON_400A)
2098 fi
2099 AC_MSG_RESULT($ntp_ok)
2100 case "$ntp_ok$ntp_canparse" in
2101  yesno)
2102     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2103     ;;
2104 esac
2105
2106 AC_MSG_CHECKING(VARITEXT clock)
2107 AC_ARG_ENABLE(VARITEXT,         [  --enable-VARITEXT       s VARITEXT clock],
2108     [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2109 if test "$ntp_ok" = "yes"; then
2110     ntp_libparse=yes
2111     ntp_refclock=yes
2112     AC_DEFINE(CLOCK_VARITEXT)
2113 fi
2114 AC_MSG_RESULT($ntp_ok)
2115 case "$ntp_ok$ntp_canparse" in
2116  yesno)
2117     AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2118     ;;
2119 esac
2120 AC_SUBST(LIBPARSE)
2121 AC_SUBST(MAKE_LIBPARSE)
2122 AC_SUBST(MAKE_LIBPARSE_KERNEL)
2123 AC_SUBST(MAKE_CHECK_Y2K)
2124 AC_MSG_CHECKING(if we need to make and use the parse libraries)
2125 ans=no
2126 case "$ntp_libparse" in
2127  yes)
2128     ans=yes
2129     AC_DEFINE(CLOCK_PARSE)
2130     LIBPARSE=../libparse/libparse.a
2131     MAKE_LIBPARSE=libparse.a
2132     MAKE_CHECK_Y2K=check_y2k
2133     AC_DEFINE(PPS_SAMPLE)
2134     AC_DEFINE(CLOCK_ATOM)
2135     ;;
2136 esac
2137 AC_MSG_RESULT($ans)
2138
2139 AC_SUBST(RSAREF)
2140 AC_SUBST(LIBRSAREF)
2141 AC_SUBST(MAKE_LIBRSAREF)
2142 AC_MSG_CHECKING(if we need to make and use the RSAREF library)
2143 ans=no
2144 if test -f $srcdir/rsaref2/source/rsa.c
2145 then
2146     ans=yes
2147     LIBRSAREF=../librsaref/librsaref.a
2148     MAKE_LIBRSAREF=librsaref.a
2149     AC_DEFINE(DES)
2150 fi
2151 AC_MSG_RESULT($ans)
2152
2153 AC_SUBST(TESTDCF)
2154 AC_SUBST(DCFD)
2155
2156 AC_MSG_CHECKING(if we can make dcf parse utilities)
2157 ans=no
2158 if test "$ntp_parseutil" = "yes"; then
2159     case "$target" in
2160      *-*-sunos4*|*-*-solaris2*|*-*-linux*)
2161         ans="dcfd testdcf"
2162         DCFD=dcfd
2163         TESTDCF=testdcf
2164         ;;
2165     esac
2166 fi
2167 AC_MSG_RESULT($ans)
2168
2169 AC_SUBST(MAKE_PARSEKMODULE)
2170 AC_MSG_CHECKING(if we can build kernel streams modules for parse)
2171 ans=no
2172 case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
2173  yesyes)
2174     case "$target" in
2175      sparc-*-sunos4*)
2176         case "$ac_cv_var_kernel_pll" in
2177         yes)
2178             AC_DEFINE(PPS_SYNC)
2179             ;;
2180         esac
2181         ans=parsestreams
2182         MAKE_PARSEKMODULE=parsestreams.loadable_module.o
2183         ;;
2184      sparc-*-solaris2*)
2185         ans=parsesolaris
2186         MAKE_PARSEKMODULE=parse
2187         ;;
2188     esac
2189     ;;
2190 esac
2191 AC_MSG_RESULT($ans)
2192
2193 AC_MSG_CHECKING(if we need basic refclock support)
2194 if test "$ntp_refclock" = "yes"; then
2195     AC_DEFINE(REFCLOCK)
2196 fi
2197 AC_MSG_RESULT($ntp_refclock)
2198
2199 dnl Things that can be made in clockstuff/
2200 AC_SUBST(PROPDELAY)     dnl Set to "propdelay"
2201 AC_SUBST(CHUTEST)       dnl Set to "chutest"
2202 AC_SUBST(CLKTEST)       dnl Set to "clktest"
2203
2204 AC_SUBST(MAKE_ADJTIMED)
2205 AC_MSG_CHECKING(if we want HP-UX adjtimed support)
2206 changequote(<<, >>)dnl
2207 case "$target" in
2208  *-*-hpux[56789]*)
2209     ans=yes
2210     ;;
2211  *) ans=no
2212     ;;
2213 esac
2214 changequote([, ])dnl
2215 if test "$ans" = "yes"; then
2216     MAKE_ADJTIMED=adjtimed
2217     AC_DEFINE(NEED_HPUX_ADJTIME)
2218 fi
2219 AC_MSG_RESULT($ans)
2220
2221 AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem,
2222 [AC_ARG_ENABLE(kmem,            [  --enable-kmem           s read /dev/kmem for tick and/or tickadj],
2223     [ans=$enableval],
2224     [changequote(<<, >>)dnl
2225     case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
2226      *yes*)
2227         ans=yes
2228         ;;
2229      *) ans=no
2230         ;;
2231     esac
2232     case "$target" in
2233      *-*-aix*)
2234         #ans=no
2235         ;;
2236      *-*-domainos)      # Won't be found...
2237         ans=no
2238         ;;
2239      *-*-hpux*)
2240         #ans=no
2241         ;;
2242      *-*-irix[456]*)
2243         ans=no
2244         ;;
2245      *-*-linux*)
2246         ans=no
2247         ;;
2248      *-*-winnt3.5)
2249         ans=no
2250         ;;
2251     esac
2252     changequote([, ])dnl
2253     ])
2254 ac_cv_var_can_kmem=$ans])
2255
2256 case "$ac_cv_var_can_kmem" in
2257  *yes*) ;;
2258  *) AC_DEFINE(NOKMEM) ;;
2259 esac
2260
2261 AC_CACHE_CHECK(if adjtime is accurate, ac_cv_var_adjtime_is_accurate,
2262 [AC_ARG_ENABLE(accurate-adjtime, [  --enable-accurate-adjtime
2263                           s the adjtime() call is accurate],
2264     [ans=$enableval],
2265     [changequote(<<, >>)dnl
2266     case "$target" in
2267       i386-sequent-ptx*)
2268          ans=no
2269          ;;
2270       i386-unknown-osf1*)
2271          ans=yes
2272          ;;
2273       mips-sgi-irix[456]*)
2274          ans=yes
2275          ;;
2276       *-fujitsu-uxp*)
2277          ans=yes
2278          ;;
2279       *-ibm-aix4*)
2280          ans=yes
2281          ;;
2282       *-*-linux*)
2283          ans=yes
2284          ;;
2285       *-*-solaris2.[01]*)
2286          ans=no
2287          ;;
2288       *-*-solaris2*)
2289          ans=yes
2290          ;;
2291       *) ans=no
2292          ;;
2293      esac
2294      changequote([, ])dnl
2295      ])
2296 ac_cv_var_adjtime_is_accurate=$ans])
2297 case "$ac_cv_var_adjtime_is_accurate" in
2298  yes) AC_DEFINE(ADJTIME_IS_ACCURATE) ;;
2299 esac
2300
2301 AC_CACHE_CHECK([the name of 'tick' in the kernel],
2302 ac_cv_var_nlist_tick,
2303 [changequote(<<, >>)dnl
2304 ans=_tick
2305 case "$target" in
2306  m68*-hp-hpux*) # HP9000/300?
2307     ans=_old_tick
2308     ;;
2309  *-apple-aux[23]*)
2310     ans=tick
2311     ;;
2312  *-hp-hpux*)
2313     ans=old_tick
2314     ;;
2315  *-ibm-aix[34]*)
2316     ans=no
2317     ;;
2318  *-*-ptx*)
2319     ans=tick
2320     ;;
2321  *-*-sco3.2v[45]*)
2322     ans=no
2323     ;;
2324  *-*-solaris2*)
2325     ans=nsec_per_tick
2326     ;;
2327  *-*-sysv4*)
2328     ans=tick
2329     ;;
2330 esac
2331 changequote([, ])dnl
2332 ac_cv_var_nlist_tick=$ans])
2333 case "$ac_cv_var_nlist_tick" in
2334  ''|no) ;;      # HMS: I think we can only get 'no' here...
2335  *) AC_DEFINE_UNQUOTED(K_TICK_NAME, "$ac_cv_var_nlist_tick") ;;
2336 esac
2337 #
2338 AC_CACHE_CHECK([for the units of 'tick'],
2339 ac_cv_var_tick_nano,
2340 [changequote(<<, >>)dnl
2341 ans=usec
2342 case "$target" in
2343  *-*-solaris2*)
2344     ans=nsec
2345     ;;
2346 esac
2347 changequote([, ])dnl
2348 ac_cv_var_tick_nano=$ans])
2349 case "$ac_cv_var_tick_nano" in
2350  nsec)
2351     AC_DEFINE(TICK_NANO)
2352     ;;
2353 esac
2354 #
2355 AC_CACHE_CHECK([the name of 'tickadj' in the kernel],
2356 ac_cv_var_nlist_tickadj,
2357 [changequote(<<, >>)dnl
2358 ans=_tickadj
2359 case "$target" in
2360  m68*-hp-hpux*) # HP9000/300?
2361     ans=_tickadj
2362     ;;
2363  *-apple-aux[23]*)
2364     ans=tickadj
2365     ;;
2366  *-hp-hpux10*)
2367     ans=no
2368     ;;
2369  *-hp-hpux9*)
2370     ans=no
2371     ;;
2372  *-hp-hpux*)
2373     ans=tickadj
2374     ;;
2375  *-*-aix*)
2376     ans=tickadj
2377     ;;
2378  *-*-ptx*)
2379     ans=tickadj
2380     ;;
2381  *-*-sco3.2v4*)
2382     ans=no
2383     ;;
2384  *-*-sco3.2v5.0*)
2385     ans=clock_drift
2386     ;;
2387  *-*-solaris2*)
2388     ans=no      # hrestime_adj
2389     ;;
2390  *-*-sysv4*)
2391     ans=tickadj
2392     ;;
2393 esac
2394 changequote([, ])dnl
2395 ac_cv_var_nlist_tickadj=$ans])
2396 case "$ac_cv_var_nlist_tickadj" in
2397  ''|no) ;;      # HMS: I think we can only get 'no' here...
2398  *) AC_DEFINE_UNQUOTED(K_TICKADJ_NAME, "$ac_cv_var_nlist_tickadj") ;;
2399 esac
2400 #
2401 AC_CACHE_CHECK([for the units of 'tickadj'],
2402 ac_cv_var_tickadj_nano,
2403 [changequote(<<, >>)dnl
2404 ans=usec
2405 case "$target" in
2406  *-*-solaris2*)
2407     ans=nsec
2408     ;;
2409 esac
2410 changequote([, ])dnl
2411 ac_cv_var_tickadj_nano=$ans])
2412 case "$ac_cv_var_tickadj_nano" in
2413  nsec)
2414     AC_DEFINE(TICKADJ_NANO)
2415     ;;
2416 esac
2417 #
2418 AC_CACHE_CHECK([half-heartedly for 'dosynctodr' in the kernel],
2419 ac_cv_var_nlist_dosynctodr,
2420 [changequote(<<, >>)dnl
2421 case "$target" in
2422  *-apple-aux[23]*)
2423     ans=no
2424     ;;
2425  *-sni-sysv*)
2426     ans=dosynctodr
2427     ;;
2428  *-*-aix*)
2429     ans=dosynctodr
2430     ;;
2431  *-*-hpux*)
2432     ans=no
2433     ;;
2434  *-*-nextstep*)
2435     ans=_dosynctodr
2436     ;;
2437  *-*-ptx*)
2438     ans=doresettodr
2439     ;;
2440  *-*-sco3.2v4*)
2441     ans=no
2442     ;;
2443  *-*-sco3.2v5*)
2444     ans=track_rtc
2445     ;;
2446  *-*-solaris2*)
2447     ans=dosynctodr
2448     ;;
2449  *-*-sysv4*)
2450     ans=doresettodr
2451     ;;
2452  *)
2453     ans=_dosynctodr
2454     ;;
2455 esac
2456 changequote([, ])dnl
2457 ac_cv_var_nlist_dosynctodr=$ans])
2458 case "$ac_cv_var_nlist_dosynctodr" in
2459  no) ;;
2460  *)  AC_DEFINE_UNQUOTED(K_DOSYNCTODR_NAME, "$ac_cv_var_nlist_dosynctodr")
2461      ;;
2462 esac
2463 #
2464 AC_CACHE_CHECK([half-heartedly for 'noprintf' in the kernel],
2465 ac_cv_var_nlist_noprintf,
2466 [changequote(<<, >>)dnl
2467 case "$target" in
2468  *-apple-aux[23]*)
2469     ans=no
2470     ;;
2471  *-sni-sysv*)
2472     ans=noprintf
2473     ;;
2474  *-*-aix*)
2475     ans=noprintf
2476     ;;
2477  *-*-hpux*)
2478     ans=no
2479     ;;
2480  *-*-ptx*)
2481     ans=noprintf
2482     ;;
2483  *-*-nextstep*)
2484     ans=_noprintf
2485     ;;
2486  *-*-solaris2*)
2487     ans=noprintf
2488     ;;
2489  *-*-sysv4*)
2490     ans=noprintf
2491     ;;
2492  *)
2493     ans=_noprintf
2494     ;;
2495 esac
2496 changequote([, ])dnl
2497 ac_cv_var_nlist_noprintf=$ans])
2498 case "$ac_cv_var_nlist_noprintf" in
2499  no) ;;
2500  *)  AC_DEFINE_UNQUOTED(K_NOPRINTF_NAME, "$ac_cv_var_nlist_noprintf")
2501      ;;
2502 esac
2503
2504 dnl The tick/tickadj sections were written by Skippy, who never learned
2505 dnl that it's impolite (horridly gross) to show your guts in public.
2506
2507 dnl     tick            tickadj 
2508 dnl     10000           80          Unixware
2509 dnl     1000000L/hz     tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
2510 dnl     10000           150         sgi IRIX
2511 dnl     1000000L/hz     1000        RS6000 && NOKMEM
2512 dnl     1000000L/hz     668         DOMAINOS && NOKMEM
2513 dnl     1000000L/hz     500/HZ      other && NOKMEM
2514 dnl     txc.tick        1           Linux
2515 dnl     (every / 10)    50          WinNT - tickadj is roughly 500/hz
2516 dnl     1000000L/hz     (nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
2517 dnl                                 (RS6000 && !NOKMEM), SINIX MIPS
2518
2519 dnl But we'll only use these "values" if we can't find anything else.
2520
2521 AC_CACHE_CHECK(for a default value for 'tick', ac_cv_var_tick,
2522 [AC_ARG_ENABLE(tick,            [  --enable-tick=VALUE     s force a value for 'tick'],
2523     [ans=$enableval],
2524     [ans=no
2525      case "$target" in
2526       XXX-*-pc-cygwin*)
2527          ;;
2528       *-univel-sysv*)
2529          ans=10000
2530          ;;
2531       *-*-irix*)
2532          ans=10000
2533          ;;
2534       *-*-linux*)
2535          ans=txc.tick
2536          ;;
2537       *-*-winnt3.5)
2538          ans='(every / 10)'
2539          ;;
2540       *)
2541          ans='1000000L/hz'
2542          ;;
2543      esac])
2544 ac_cv_var_tick=$ans])
2545 case "$ac_cv_var_tick" in
2546  ''|no) ;;      # HMS: I think we can only get 'no' here...
2547  *) AC_DEFINE_UNQUOTED(PRESET_TICK, $ac_cv_var_tick) ;;
2548 esac
2549
2550 AC_CACHE_CHECK(for a default value for 'tickadj', ac_cv_var_tickadj,
2551 [AC_ARG_ENABLE(tickadj,         [  --enable-tickadj=VALUE  s force a value for 'tickadj'],
2552   [ans=$enableval],
2553   [ans='500/hz'
2554   case "$target" in
2555    *-fujitsu-uxp*)
2556       case "$ac_cv_var_adjtime_is_accurate" in
2557        yes) ans='tick/16' ;;
2558       esac
2559       ;;
2560    XXX-*-pc-cygwin*)
2561       ans=no
2562       ;;
2563    *-univel-sysv*)
2564       ans=80
2565       ;;
2566    *-*-aix*)
2567       case "$ac_cv_var_can_kmem" in
2568        no) ans=1000 ;;
2569       esac
2570       ;;
2571    *-*-domainos)        # Skippy: won't be found...
2572       case "$ac_cv_var_can_kmem" in
2573        no) ans=668 ;;
2574       esac
2575       ;;
2576    *-*-hpux*)
2577       case "$ac_cv_var_adjtime_is_accurate" in
2578        yes) ans='tick/16' ;;
2579       esac
2580       ;;
2581    *-*-irix*)
2582       ans=150
2583       ;;
2584    *-*-sco3.2v5.0*)
2585       ans=10000L/hz
2586       ;;
2587    *-*-solaris2*)
2588       case "$ac_cv_var_adjtime_is_accurate" in
2589        yes)
2590           #ans='tick/16'
2591           ;;
2592       esac
2593       ;;
2594    *-*-winnt3.5)
2595       ans=50
2596       ;;
2597   esac])
2598 ac_cv_var_tickadj=$ans])
2599 case "$ac_cv_var_tickadj" in
2600  ''|no) ;;      # HMS: I think we can only get 'no' here...
2601  *) AC_DEFINE_UNQUOTED(PRESET_TICKADJ, $ac_cv_var_tickadj) ;;
2602 esac
2603
2604 # Newer versions of ReliantUNIX round adjtime() values down to
2605 # 1/100s (system tick). Sigh ...
2606 # Unfortunately, there is no easy way to know if particular release
2607 # has this "feature" or any obvious way to test for it.
2608 case "$target" in
2609  mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX_CLOCK) ;;
2610 esac
2611
2612 case "$target" in
2613  *-*-sco3.2v5*) AC_DEFINE(SCO5_CLOCK) ;;
2614 esac
2615
2616 ac_cv_make_tickadj=yes
2617 case "$ac_cv_var_can_kmem$ac_cv_var_tick$ac_cv_var_tickadj" in
2618  nonono)        # Don't read KMEM, no presets.  Bogus.
2619     AC_MSG_WARN(Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.)
2620     ac_cv_make_tickadj=no
2621     ;;
2622  nono*)         # Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
2623     AC_MSG_WARN(Can't read kmem but no PRESET_TICK.  No tickadj.)
2624     ac_cv_make_tickadj=no
2625     ;;
2626  no*no)         # Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
2627     AC_MSG_WARN(Can't read kmem but no PRESET_TICKADJ.  No tickadj.)
2628     ac_cv_make_tickadj=no
2629     ;;
2630  no*)           # Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
2631     ;;
2632  yesnono)       # Read KMEM, no presets.  Cool.
2633     ;;
2634  yesno*)        # Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
2635     AC_MSG_WARN(PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.)
2636     ;;
2637  yes*no)        # Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
2638     ;;
2639  yes*)          # READ KMEM, PRESET_TICK and PRESET_TICKADJ.
2640     ;;
2641  *)             # Generally bogus.
2642     AC_MSG_ERROR(This shouldn't happen.)
2643     ;;
2644 esac
2645
2646 case "$target" in
2647  mips-sni-sysv4*)
2648     # tickadj is pretty useless on newer versions of ReliantUNIX
2649     # Do not bother
2650     ac_cv_make_tickadj=no
2651  ;;
2652  *-*-solaris2*)
2653     # DLM says tickadj is a no-no starting with solaris2.5
2654     case "$target" in
2655      *-*-solaris2.[0-4]*) ;;
2656      *) ac_cv_make_tickadj=no ;;
2657     esac
2658  ;;
2659 esac
2660
2661 AC_SUBST(MAKE_TICKADJ)
2662 AC_CACHE_CHECK(if we want and can make the tickadj utility, ac_cv_make_tickadj,
2663 ac_cv_make_tickadj=yes)
2664 case "$ac_cv_make_tickadj" in
2665  yes)
2666     MAKE_TICKADJ=tickadj
2667     ;;
2668 esac
2669
2670 AC_SUBST(MAKE_NTPTIME)
2671 AC_CACHE_CHECK(if we want and can make the ntptime utility, ac_cv_make_ntptime,
2672 [case "$target" in
2673  *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in
2674      yesyes)
2675         ans=yes
2676         ;;
2677      *)
2678         ans=no
2679         ;;
2680     esac
2681     ;;
2682 esac
2683 ac_cv_make_ntptime=$ans])
2684 case "$ac_cv_make_ntptime" in
2685  yes)
2686     MAKE_NTPTIME=ntptime
2687     ;;
2688 esac
2689
2690 AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery,
2691 [AC_ARG_ENABLE(udp-wildcard,    [  --enable-udp-wildcard   s use UDP wildcard delivery],
2692     [ans=$enableval],
2693     [ans=no
2694      case "$target" in
2695       *-fujitsu-uxp*)
2696          ans=yes
2697          ;;
2698       *-univel-sysv*)
2699          ans=yes
2700          ;;
2701       *-*-aix3.2*)
2702          ans=yes
2703          ;;
2704       *-*-aix4*)
2705          ans=yes
2706          ;;
2707       *-*-bsdi*)
2708          ans=yes
2709          ;;
2710       *-*-domainos)
2711          ans=yes
2712          ;;
2713       *-*-freebsd*)
2714         ans=yes
2715         ;;
2716       *-*-hpux*)
2717          ans=yes
2718          ;;
2719       *-*-irix6*)
2720          ans=yes
2721          ;;
2722       *-*-linux*)
2723          ans=yes
2724          ;;
2725       *-*-osf*)
2726          ans=yes
2727          ;;
2728       *-*-ptx*)
2729          ans=yes
2730          ;;
2731       *-*-solaris2*)
2732          ans=yes
2733          ;;
2734       *-*-sunos4*)
2735          ans=yes
2736          ;;
2737      esac])
2738 ac_cv_var_udp_wildcard_delivery=$ans])
2739 case "$ac_cv_var_udp_wildcard_delivery" in
2740  yes) AC_DEFINE(UDP_WILDCARD_DELIVERY) ;;
2741 esac
2742
2743 case "$host" in
2744  $target)
2745     ;;
2746  *) case "$target" in
2747      *-*-vxworks*)
2748         LDFLAGS="$LDFLAGS -r"
2749         ;;
2750     esac
2751     ;;
2752 esac
2753
2754 AC_CACHE_CHECK(if we should always slew the time, ac_cv_var_slew_always,
2755 [AC_ARG_ENABLE(slew-always,      [  --enable-slew-always    s always slew the time],
2756     [ans=$enableval],
2757     [changequote(<<, >>)dnl
2758     case "$target" in
2759       *-apple-aux[23]*)
2760          ans=yes
2761          ;;
2762       *-*-bsdi[012]*)
2763          ans=no
2764          ;;
2765       *-*-bsdi*)
2766          ans=yes
2767          ;;
2768       *-*-openvms*)     # HMS: won't be found
2769          ans=yes
2770          ;;
2771       *) ans=no
2772          ;;
2773      esac
2774      changequote([, ])dnl
2775      ])
2776 ac_cv_var_slew_always=$ans])
2777 case "$ac_cv_var_slew_always" in
2778  yes) AC_DEFINE(SLEWALWAYS) ;;
2779 esac
2780
2781 AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew,
2782 [AC_ARG_ENABLE(step-slew,        [  --enable-step-slew      s step and slew the time],
2783     [ans=$enableval],
2784     [changequote(<<, >>)dnl
2785     case "$target" in
2786       *-sni-sysv*)
2787          ans=yes
2788          ;;
2789       *-univel-sysv*)
2790          ans=no
2791          ;;
2792       *-*-ptx*)
2793          ans=yes
2794          ;;
2795       *-*-solaris2.[012]*)
2796          ans=yes
2797          ;;
2798       *-*-sysv4*)       # HMS: Does this catch Fujitsu UXP?
2799          ans=yes
2800          ;;
2801       *) ans=no
2802          ;;
2803      esac
2804      changequote([, ])dnl
2805      ])
2806 ac_cv_var_step_slew=$ans])
2807 case "$ac_cv_var_step_slew" in
2808  yes) AC_DEFINE(STEP_SLEW) ;;
2809 esac
2810
2811 AC_CACHE_CHECK(if ntpdate should step the time, ac_cv_var_ntpdate_step,
2812 [AC_ARG_ENABLE(ntpdate-step,     [  --enable-ntpdate-step   s if ntpdate should step the time],
2813     [ans=$enableval],
2814     [changequote(<<, >>)dnl
2815     case "$target" in
2816       *-apple-aux[23]*)
2817          ans=yes
2818          ;;
2819       *) ans=no
2820          ;;
2821      esac
2822      changequote([, ])dnl
2823      ])
2824 ac_cv_var_ntpdate_step=$ans])
2825 case "$ac_cv_var_ntpdate_step" in
2826  yes) AC_DEFINE(FORCE_NTPDATE_STEP) ;;
2827 esac
2828
2829 AC_CACHE_CHECK(if we should sync TODR clock every hour, ac_cv_var_sync_todr,
2830 [AC_ARG_ENABLE(hourly-todr-sync, [  --enable-hourly-todr-sync
2831                           s if we should sync TODR hourly],
2832     [ans=$enableval],
2833     [case "$target" in
2834       *-*-nextstep*)
2835          ans=yes
2836          ;;
2837       *-*-openvms*)     # HMS: won't be found
2838          ans=yes
2839          ;;
2840       *) ans=no
2841          ;;
2842      esac])
2843 ac_cv_var_sync_todr=$ans])
2844 case "$ac_cv_var_sync_todr" in
2845  yes) AC_DEFINE(DOSYNCTODR) ;;
2846 esac
2847
2848 AC_CACHE_CHECK(if we should avoid kernel FLL bug, ac_cv_var_kernel_fll_bug,
2849 [AC_ARG_ENABLE(kernel-fll-bug, [  --enable-kernel-fll-bug s if we should avoid a kernel FLL bug],
2850     [ans=$enableval],
2851     [changequote(<<, >>)dnl
2852     case "$target" in
2853      *-*-solaris2.6)
2854          ans=yes
2855          ;;
2856      *-*-solaris2.7)
2857          case "`uname -v`" in
2858           Generic_106541-07)
2859              ans=no
2860              ;;
2861           *) ans=yes
2862              ;;
2863          esac
2864          ;;
2865      *) ans=no
2866          ;;
2867     esac
2868     changequote([, ])dnl
2869     ])
2870 ac_cv_var_kernel_fll_bug=$ans])
2871 case "$ac_cv_var_kernel_fll_bug" in
2872  yes) AC_DEFINE(KERNEL_FLL_BUG) ;;
2873 esac
2874
2875 case "$host" in
2876  $target)
2877     ;;
2878  *) case "$target" in
2879      *-*-vxworks*)
2880         LDFLAGS="$LDFLAGS -r"
2881         ;;
2882     esac
2883     ;;
2884 esac
2885
2886 # This is necessary so that .o files in LIBOBJS are also built via
2887 # the ANSI2KNR-filtering rules.
2888 LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
2889
2890 AC_OUTPUT(Makefile adjtimed/Makefile clockstuff/Makefile \
2891 include/Makefile kernel/Makefile kernel/sys/Makefile libntp/Makefile \
2892 libparse/Makefile librsaref/Makefile ntpd/Makefile ntpdc/Makefile \
2893 ntpdate/Makefile ntpq/Makefile ntptrace/Makefile parseutil/Makefile \
2894 scripts/Makefile scripts/mkver scripts/ntpver util/Makefile,
2895 [chmod +x scripts/ntpver scripts/mkver])
2896 #test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])