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