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