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