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