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