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