]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - configure.ac
Virgin import of ntpd 4.2.6p5.
[FreeBSD/FreeBSD.git] / configure.ac
1 dnl -*-fundamental-*-
2 dnl Process this file with autoconf to produce a configure script.
3 m4_include([version.m4])
4 AC_PREREQ([2.61])
5 AC_INIT([ntp], [VERSION_NUMBER])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_AUX_DIR([.])
8
9 # Increment ntp_configure_cache_version by one for each change to
10 # configure.ac or .m4 files which invalidates cached values from
11 # previous versions.
12 #
13 # If the change affects cache variables used only by the main NTP
14 # configure.ac, then only its version number should be bumped, while
15 # the subdir configure.ac version numbers should be unchanged.  The
16 # same is true for a test/variable that is used only by one subdir
17 # being changed incompatibly; only that subdir's cache version needs
18 # bumping.
19 #
20 # If a change affects variables shared by all NTP configure scripts,
21 # please bump the version numbers of all three.  If you are not sure,
22 # the safe choice is to bump all three on any cache-invalidating change.
23 #
24 # In order to avoid the risk of version stamp collision between -stable
25 # and -dev branches, do not simply increment the version, instead use
26 # the date YYYYMMDD optionally with -HHMM if there is more than one
27 # bump in a day.
28
29 ntp_configure_cache_version=20091117
30
31 # When the cache version of config.cache and configure do not
32 # match, NTP_CACHEVERSION will flush the cache.
33
34 NTP_CACHEVERSION([main], [$ntp_configure_cache_version])
35
36 AM_INIT_AUTOMAKE
37 AC_CANONICAL_BUILD
38 AC_CANONICAL_HOST
39 dnl the 'build' machine is where we run configure and compile
40 dnl the 'host' machine is where the resulting stuff runs.
41 AC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
42     [canonical system (cpu-vendor-os) of where we should run])
43 AM_CONFIG_HEADER([config.h])
44 dnl AC_ARG_PROGRAM
45
46 ntp_atom_ok=${ntp_atom_ok=no}
47 ntp_oncore_ok=${ntp_oncore_ok=no}
48 ntp_parse_ok=${ntp_parse_ok=no}
49 ntp_ripe_ncc_ok=${ntp_parse_ok=no}
50 ntp_jupiter_ok=${ntp_jupiter_ok=no}
51
52 dnl check these early to avoid autoconf warnings
53 AC_AIX
54 AC_MINIX
55
56 # So far, the only shared library we might use is libopts.
57 # It's a small library - we might as well use a static version of it.
58 AC_DISABLE_SHARED
59
60 dnl  we need to check for cross compile tools for vxWorks here
61 AC_PROG_CC
62 # Ralf Wildenhues: With per-target flags we need CC_C_O
63 # AM_PROG_CC_C_O supersets AC_PROG_CC_C_O
64 AM_PROG_CC_C_O
65 AC_PROG_CPP
66 AC_PROG_YACC
67
68 # AC_PROG_CC_STDC has two functions.  It attempts to find a compiler
69 # capable of C99, or failing that, for C89.  CC is set afterward with
70 # the selected invocation, such as "gcc --std=gnu99".  Also, the
71 # ac_cv_prog_cc_stdc variable is no if the compiler selected for CC
72 # does not accept C89.
73
74 AC_PROG_CC_STDC
75
76 case "$ac_cv_prog_cc_stdc" in
77  no)
78     AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile NTP ]
79                 [version 4.2.5 and higher.])
80 esac
81
82 # HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
83 case "$host" in
84  *-pc-cygwin*)
85     CFLAGS="$CFLAGS -DSYS_CYGWIN32"
86     ;;
87  i386-sequent-sysv4)
88     case "$CC" in
89      cc)
90         CFLAGS="$CFLAGS -Wc,+abi-socket"
91         ;;
92     esac
93     ;;
94  *-*-mpeix*)
95     CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB"
96     LDFLAGS="$LDFLAGS -L/SYSLOG/PUB"
97     LIBS="$LIBS -lcurses"
98     ;;
99  *-*-solaris*)
100     # see "man standards".
101     # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
102     # -D_XOPEN_SOURCE=600 seems OK for c99
103     #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
104     CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
105     libxnet=-lxnet
106     ;;
107 esac
108
109 NTP_OS_CFLAGS
110 NTP_DIR_SEP
111 NTP_VPATH_HACK
112
113 # NTP has (so far) been relying on leading-edge autogen.
114 # Therefore, by default:
115 # - use the version we ship with
116 # - do not install it
117 # - build a static copy (AC_DISABLE_SHARED - done earlier)
118 case "${enable_local_libopts+set}" in
119  set) ;;
120  *) enable_local_libopts=yes ;;
121 esac
122 case "${enable_libopts_install+set}" in
123  set) ;;
124  *) enable_libopts_install=no ;;
125 esac
126 LIBOPTS_CHECK_NOBUILD([sntp/libopts])
127
128 AC_FUNC_FORK
129
130 AC_CACHE_CHECK(
131     [if $CC can handle @%:@warning],
132     [ntp_cv_cpp_warning],
133     [AC_COMPILE_IFELSE(
134         [AC_LANG_PROGRAM([[]], [[#warning foo]])],
135         [ntp_cv_cpp_warning=yes],
136         [ntp_cv_cpp_warning=no]
137     )]
138 )
139 case "$ntp_cv_cpp_warning" in
140  no)
141     AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1],
142         [Should we avoid @%:@warning on option name collisions?])
143 esac
144
145 case "$GCC" in
146  yes)
147     SAVED_CFLAGS_NTP="$CFLAGS"
148     CFLAGS="$CFLAGS -Wstrict-overflow"
149     AC_CACHE_CHECK(
150         [if $CC can handle -Wstrict-overflow], 
151         [ntp_cv_gcc_Wstrict_overflow], 
152         [AC_COMPILE_IFELSE(
153             [AC_LANG_PROGRAM([[]], [[]])],
154             [ntp_cv_gcc_Wstrict_overflow=yes],
155             [ntp_cv_gcc_Wstrict_overflow=no]
156         )       ]
157     )
158     #
159     # $ntp_cv_gcc_Wstrict_overflow is tested later to add the 
160     # flag to CFLAGS.
161     #
162     CFLAGS="$SAVED_CFLAGS_NTP -Winit-self"
163     AC_CACHE_CHECK(
164         [if $CC can handle -Winit-self], 
165         [ntp_cv_gcc_Winit_self],
166         [
167             AC_COMPILE_IFELSE(
168                 [AC_LANG_PROGRAM([[]], [[]])],
169                 [ntp_cv_gcc_Winit_self=yes],
170                 [ntp_cv_gcc_Winit_self=no]
171             )
172         ]
173     )
174     CFLAGS="$SAVED_CFLAGS_NTP"
175     AS_UNSET([SAVED_CFLAGS_NTP])
176     #
177     # $ntp_cv_gcc_Winit_self is tested later to add the 
178     # flag to CFLAGS.
179     #
180 esac
181
182 # Expose a cross-compilation indicator to makefiles
183 AM_CONDITIONAL([NTP_CROSSCOMPILE], [test $build != $host])
184
185 AC_MSG_CHECKING([for bin subdirectory])
186 AC_ARG_WITH(
187     [binsubdir],
188     [AS_HELP_STRING(
189         [--with-binsubdir],
190         [bin ={bin,sbin}]
191     )],
192     [use_binsubdir="$withval"],
193     [use_binsubdir="bin"]
194 )
195 case "$use_binsubdir" in
196  bin)
197     ;;
198  sbin)
199     ;;
200  *)
201     AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
202     ;;
203 esac
204 AC_MSG_RESULT([$use_binsubdir])
205
206 BINSUBDIR=$use_binsubdir
207 AC_SUBST([BINSUBDIR])
208 AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"])
209
210 AC_MSG_CHECKING([for deprecated --with-arlib])
211 AC_ARG_WITH([arlib],
212         AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
213         [ans=$withval], [ans=no])
214 AC_MSG_RESULT([$ans])
215
216 case "$ans" in
217  yes)
218     AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
219 esac
220
221 AC_ARG_WITH(rpath,
222         AS_HELP_STRING([--without-rpath], [s Disable auto-added -R linker paths]),
223 [ans=$withval], [ans=x])
224 case "$ans" in
225  no)
226     need_dash_r=
227     ;;
228  yes)
229     need_dash_r=1
230     ;;
231 esac
232 # HMS: Why isn't this $build?
233 # Well, that depends on if we need this for the build toolchain or
234 # for info in the host executable...
235 # I still have no idea which way this should go, but nobody has complained.
236 case "$host" in
237  *-*-netbsd*)
238     case "$need_dash_r" in
239      no) ;;
240      *)  need_dash_r=1
241          ;;
242     esac
243     ;;
244  *-*-solaris*)
245     case "$need_dash_r" in
246      no) ;;
247      *)  need_dash_r=1
248          ;;
249     esac
250     ;;
251 esac
252
253 dnl  we need to check for cross compile tools for vxWorks here
254 AC_PROG_AWK
255 AC_PROG_MAKE_SET
256
257 rm -f conftest*
258
259 case "$GCC" in
260  yes)
261     CFLAGS="$CFLAGS -Wall"
262     # CFLAGS="$CFLAGS -Wcast-align"
263     CFLAGS="$CFLAGS -Wcast-qual"
264     # CFLAGS="$CFLAGS -Wconversion"
265     # CFLAGS="$CFLAGS -Werror"
266     # CFLAGS="$CFLAGS -Wextra"
267     # CFLAGS="$CFLAGS -Wfloat-equal"
268     CFLAGS="$CFLAGS -Wmissing-prototypes"
269     CFLAGS="$CFLAGS -Wpointer-arith"
270     CFLAGS="$CFLAGS -Wshadow"
271     # CFLAGS="$CFLAGS -Wtraditional"
272     # CFLAGS="$CFLAGS -Wwrite-strings"
273     case "$ntp_cv_gcc_Winit_self" in
274      yes)
275         CFLAGS="$CFLAGS -Winit-self"
276     esac
277     case "$ntp_cv_gcc_Wstrict_overflow" in
278      yes)
279         CFLAGS="$CFLAGS -Wstrict-overflow"
280     esac
281     # -W[no-]strict-prototypes is added later depending on OpenSSL
282 esac
283
284 ac_busted_vpath_in_make=no
285
286 case "$build" in
287  *-*-irix6.1*)  # 64 bit only
288     # busted vpath?
289     ;;
290  *-*-irix6*)    # 6.2 (and later?)
291     ac_busted_vpath_in_make=yes
292     ;;
293  *-*-solaris2.5.1)
294     ac_busted_vpath_in_make=yes
295     ;;
296  *-*-unicosmp*)
297     ac_busted_vpath_in_make=yes
298     ;;
299 esac
300
301 case "$ac_busted_vpath_in_make$srcdir" in
302  no*) ;;
303  yes.) ;;
304  *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in
305      '')
306         AC_MSG_ERROR([building outside of the main directory requires GNU make])
307         ;;
308      *) ;;
309     esac
310     ;;
311 esac
312
313 AC_SUBST([CFLAGS])
314 AC_SUBST([LDFLAGS])
315
316 AC_PROG_LIBTOOL
317
318 AC_PROG_LN_S
319 AC_PROG_GCC_TRADITIONAL
320 AC_C_VOLATILE
321 AC_ISC_POSIX
322
323 AC_PATH_PROG([PATH_PERL], [perl])
324 AC_PATH_PROG([PATH_SH], [sh])
325 AC_PATH_PROG([PATH_TEST], [test])
326
327 AC_ARG_WITH(
328     [net-snmp-config],
329     [AS_HELP_STRING(
330         [--with-net-snmp-config],
331         [+ =net-snmp-config]
332     )],
333     [ans=$withval],
334     [ans=yes]
335 )
336 case "$ans" in
337  no)
338     ;;
339  yes)
340     ans=net-snmp-config
341     ;;
342  /*)
343     ;;
344  */*)
345     AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
346     ;;
347  *)
348     ;;
349 esac
350 PROG_NET_SNMP_CONFIG=$ans
351 AC_MSG_CHECKING([for net-snmp-config path])
352 case "$PROG_NET_SNMP_CONFIG" in
353  no) ;;
354  /*)
355     PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
356     ;;
357  *)
358     AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
359     ;;
360 esac
361 AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
362
363 case "$host" in
364  *-*-vxworks*)
365     ac_link="$ac_link $VX_KERNEL"
366     ;;
367 esac
368
369 AC_PROG_INSTALL
370
371 AC_CHECK_FUNC([gethostent], ,
372   AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket]))
373 AC_CHECK_FUNC([openlog], , 
374   AC_SEARCH_LIBS([openlog], [gen], , 
375   AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])))
376 AC_SEARCH_LIBS([MD5Init], [md5 md])
377 AC_CHECK_FUNCS(MD5Init)
378
379 NTP_LINEEDITLIBS
380
381 dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
382 dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
383 dnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
384 dnl does Strange Things with extra processes using the Posix-compatibility
385 dnl real-time library, so we don't want to use it.
386 dnl
387 dnl 081118 Harlan got tired of looking for a way to get the sched*()
388 dnl functions to link OK with either cc or gcc.
389
390 case "$host" in
391  *-*-*linux*) ;;
392  *-*-osf4*) ;;
393  *-*-osf5*) ;;
394  *)
395     AC_CHECK_LIB([rt], [sched_setscheduler], [],
396         [AC_CHECK_LIB([posix4], [sched_setscheduler])])
397     ;;
398 esac
399
400 AC_SEARCH_LIBS([setsockopt], [socket xnet])
401 AC_SEARCH_LIBS([res_init], [resolv], [], [], [-lsocket -lnsl])
402 case "$host" in
403  *-*-darwin*)
404     AC_CHECK_LIB([resolv],[res_9_init])
405     ;;
406 esac
407 AC_HEADER_RESOLV
408 AC_CHECK_FUNCS([res_init __res_init])
409
410 AC_HEADER_STDC
411 AC_CHECK_HEADERS([bstring.h])
412 AC_CHECK_HEADER(
413     [dns_sd.h],
414     [AC_CHECK_LIB(
415         [dns_sd],
416         [DNSServiceRegister],
417         [AC_DEFINE([HAVE_DNSREGISTRATION], [1],
418             [Use Rendezvous/DNS-SD registration])]
419     )]
420 )
421 case "$ac_cv_lib_dns_sd_DNSServiceRegister" in
422  yes)
423     LIBS="-ldns_sd $LIBS"
424 esac
425 AC_CHECK_HEADERS([errno.h fcntl.h ieeefp.h kvm.h math.h])
426
427 AC_CHECK_HEADERS(
428     [md5.h],
429     [],
430     [],
431     [
432         #ifdef HAVE_SYS_TYPES_H
433         # include <sys/types.h>
434         #endif
435     ]
436 )
437 AC_CHECK_HEADERS([memory.h netdb.h poll.h])
438 AC_CHECK_HEADERS([sgtty.h stdlib.h string.h termio.h])
439 AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
440
441 case "$host" in
442  *-*-aix*)
443     AC_CHECK_HEADERS([utmpx.h])
444     case "$ac_cv_header_utmpx_h" in
445      yes)
446         ;;
447      *)
448         AC_CHECK_HEADERS([utmp.h])
449         ;;
450     esac
451     ;;
452  *) 
453     AC_CHECK_HEADERS([utmp.h utmpx.h])
454     ;;
455 esac
456
457 #
458 # On Suns only (so far) getpass() truncates the typed password to 8
459 # characters, but getpassphrase() allows up to 257.  Most systems'
460 # getpass() does not truncate, at least not so as to affect ntpq and
461 # ntpdc password prompts.
462 #
463 # So check for getpassphrase(), but only on Sun operating systems.
464 #
465 case "$host" in
466  *-*-sunos*|*-*-solaris*)
467     AC_CHECK_FUNCS([getpassphrase])
468 esac
469
470 AC_CHECK_HEADERS([arpa/nameser.h])
471 AC_CHECK_HEADERS([sys/socket.h])
472
473 dnl  HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4
474 dnl  due to an incomplete type (a union) mpinfou used in an array.  gcc3
475 dnl  compiles it without complaint.  The mpinfou union is defined later
476 dnl  in the resulting preprocessed source than the spu_info array in
477 dnl  /usr/include/machine/sys/getppdp.h:
478 dnl     extern union mpinfou spu_info[];
479 dnl  triggering the error.  Our strategy is on HP-UX only, test for
480 dnl  net/netmp.h, which is the file included by net/if.h that leads to
481 dnl  getppdp.h.  If it is present but can't be compiled, try adding
482 dnl  a duplicate definition of mpinfou, which should then allow the
483 dnl  following net/if.h and net/if6.h tests to proceed normally.
484 dnl  Using net/netmp.h allows us to avoid polluting test results for
485 dnl  net/if.h.
486 #
487 case "$host" in
488  *-hp-hpux*)
489     AC_CHECK_HEADERS(
490         [net/netmp.h],
491         [netmp_h_works=yes],
492         [netmp_h_works=no]
493     )
494     case "$netmp_h_works" in
495      no)
496         cat >>confdefs.h <<_ACEOF
497 #ifndef MPINFOU_PREDECLARED
498 # define MPINFOU_PREDECLARED
499 typedef union mpinfou {         /* For lint */
500         struct pdk_mpinfo *pdkptr;
501         struct mpinfo *pikptr;
502 } mpinfou_t;
503 #endif
504 _ACEOF
505         AH_BOTTOM([
506 #ifndef MPINFOU_PREDECLARED
507 # define MPINFOU_PREDECLARED
508 typedef union mpinfou {         /* For lint */
509         struct pdk_mpinfo *pdkptr;
510         struct mpinfo *pikptr;
511 } mpinfou_t;
512 #endif
513 ])
514         ;;
515     esac
516     ;;
517 esac
518
519 case "$host" in
520  *-linux*)
521     AC_CHECK_HEADERS([linux/if_addr.h], [], [], [
522         #ifdef HAVE_SYS_SOCKET_H
523         # include <sys/socket.h>
524         #endif
525     ])
526 esac
527
528 AC_CHECK_HEADERS([net/if.h], [], [],
529 [#ifdef HAVE_SYS_SOCKET_H
530 #include <sys/socket.h>
531 #endif
532 ])
533 AC_CHECK_HEADERS([net/if6.h])
534 AC_CHECK_HEADERS([net/route.h], [], [], [
535 #include <sys/types.h>
536 #include <sys/socket.h>
537 #include <net/if.h>
538 ])
539 AC_CHECK_HEADERS([netinet/in_system.h netinet/in_systm.h netinet/in.h])
540 AC_CHECK_HEADERS([net/if_var.h], [], [],
541 [#if HAVE_SYS_TYPES_H
542 #include <sys/types.h>
543 #endif
544 #ifdef HAVE_SYS_SOCKET_H
545 #include <sys/socket.h>
546 #endif
547 #ifdef HAVE_NETINET_IN_H
548 #include <netinet/in.h>
549 #endif
550 #ifdef HAVE_NET_IF_H
551 #include <net/if.h>
552 #endif
553 ])
554 AC_CHECK_HEADERS([netinet/ip.h netinet/in_var.h], [], [],
555 [#ifdef HAVE_SYS_TYPES_H
556 #include <sys/types.h>
557 #endif
558 #ifdef HAVE_SYS_SOCKET_H
559 #include <sys/socket.h>
560 #endif
561 #ifdef HAVE_NET_IF_H
562 #include <net/if.h>
563 #endif
564 #ifdef HAVE_NETINET_IN_H
565 #include <netinet/in.h>
566 #endif
567 #ifdef HAVE_NET_IF_VAR_H
568 #include <net/if_var.h>
569 #endif
570 #ifdef HAVE_NETINET_IN_SYSTM_H
571 #include <netinet/in_systm.h>
572 #endif
573 ])
574
575 # Check for IPTOS_PREC
576 AC_CACHE_CHECK(
577     [IPPROTO_IP IP_TOS IPTOS_LOWDELAY],
578     [ntp_cv_ip_tos],
579     [AC_EGREP_CPP(
580         [yes],
581         [
582             #ifdef HAVE_SYS_TYPES_H
583             # include <sys/types.h>
584             #endif
585             #ifdef HAVE_NETINET_IP_H
586             # include <netinet/in.h>
587             # include <netinet/ip.h>
588             #endif
589             #if defined(IPPROTO_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
590                 yes
591             #endif
592         ],
593         [ntp_cv_ip_tos=yes],
594         [ntp_cv_ip_tos=no]
595     )]
596 )
597 case "$ntp_cv_ip_tos" in
598  yes)
599     AC_DEFINE([HAVE_IPTOS_SUPPORT], [1], [Do we have IPTOS support?])
600 esac
601
602 AC_CHECK_HEADERS([netinfo/ni.h])
603 case "$ac_cv_header_netinfo_ni_h" in
604  yes)
605     AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
606 esac
607 AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h])
608 dnl AC_CHECK_HEADERS([sys/chudefs.h])
609 AC_CHECK_HEADERS([sys/clkdefs.h sys/file.h])
610 case "$host" in
611  *-*-sunos4*)
612     ;;
613  *) 
614     AC_CHECK_HEADERS([sys/ioctl.h])
615     ;;
616 esac
617 AC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
618 AC_CHECK_HEADERS([sys/modem.h sys/param.h sys/ppsclock.h])
619 # HMS: Check sys/proc.h and sys/resource.h after some others
620 AC_CHECK_HEADERS([sys/ppstime.h sched.h])
621 case "$ac_cv_header_sched_h" in
622  yes)
623     ;;
624  *) 
625     AC_CHECK_HEADERS([sys/sched.h])
626     ;;
627 esac
628 case "$host" in
629  *-*-sco*)
630     AC_CHECK_HEADERS([sys/sio.h])
631     ;;
632 esac
633 # HMS: Check sys/shm.h after some others
634 AC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
635 # HMS: Checked sys/socket.h earlier
636 case "$host" in
637  *-*-netbsd*)
638     ;;
639  *) 
640     AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
641     ;;
642 esac
643 AC_CHECK_HEADERS([sys/stat.h sys/stream.h sys/stropts.h])
644 # sys/sysctl.h depends on sys/param.h on OpenBSD - Bug 1576
645 AC_CHECK_HEADERS([sys/sysctl.h], [], [],
646 [#if defined HAVE_SYS_PARAM_H
647 # include <sys/param.h>
648 #endif])
649 AC_CHECK_HEADERS([sys/syssgi.h sys/systune.h])
650 AC_CHECK_HEADERS([sys/termios.h sys/time.h sys/signal.h])
651 AC_EGREP_CPP(
652     [yes],
653     [
654         #ifdef HAVE_SYS_TIME_H
655         # include <sys/time.h>
656         #endif
657         #ifdef HAVE_ERRNO_H
658         # include <errno.h>
659         #endif
660         #include <sys/timepps.h>
661         #ifdef PPS_API_VERS_1
662             yes
663         #endif
664     ],
665     [AC_CHECK_HEADERS(
666         [sys/timepps.h],
667         [],
668         [],
669         [
670             #ifdef HAVE_SYS_TIME_H
671             # include <sys/time.h>
672             #endif
673             #ifdef HAVE_ERRNO_H
674             # include <errno.h>
675             #endif
676         ]
677     )]
678 )
679 AC_CHECK_HEADERS([sys/timers.h sys/tpro.h sys/types.h sys/wait.h])
680 AC_HEADER_TIME
681 case "$host" in
682 *-convex-*)
683     AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
684     ;;
685 *-*-bsdi*)
686     AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
687     ;;
688 esac
689
690 case "$host" in
691  *-*-*linux*)
692     AC_CHECK_FUNCS([__adjtimex __ntp_gettime])
693     ;;
694 esac
695 case "$ac_cv_func___adjtimex" in
696  yes)
697     ;;
698  *)
699     AC_CHECK_LIB([elf], [nlist])        dnl Only needed for tickadj...
700     dnl AC_CHECK_LIB(kvm, main, , , -lelf)
701     AC_CHECK_LIB([kvm], [main])         dnl We already know about -lelf here...
702     AC_CHECK_LIB([ld], [nlist])
703     AC_CHECK_LIB([mld], [nlist])
704     AC_CHECK_HEADERS([nlist.h sys/var.h])
705     case "$ac_cv_header_nlist_h" in
706      yes)
707         AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
708     esac
709     AC_CACHE_CHECK(
710         [for n_un in struct nlist],
711         [ntp_cv_struct_nlist_n_un],
712         [AC_COMPILE_IFELSE(
713             [AC_LANG_PROGRAM(
714                 [[
715                     #include <nlist.h>
716                 ]],
717                 [[
718                     struct nlist n;
719                     n.n_un.n_name = 0;
720                 ]]
721             )]
722             [ntp_cv_struct_nlist_n_un=yes],
723             [ntp_cv_struct_nlist_n_un=no]
724         )]
725     )
726     case "$ntp_cv_struct_nlist_n_un" in
727      yes)
728         AC_DEFINE([NLIST_NAME_UNION], [1],
729             [does struct nlist use a name union?])
730     esac
731     ;;
732 esac
733
734 AC_CHECK_HEADERS([sys/proc.h], [], [],
735 [#ifdef HAVE_SYS_TYPES_H
736 # include <sys/types.h>
737 #endif
738 #ifdef HAVE_SYS_TIME_H
739 # include <sys/time.h>
740 #endif
741 ])
742
743 AC_CHECK_HEADERS([sys/resource.h], [], [],
744 [#ifdef HAVE_SYS_TIME_H
745 # include <sys/time.h>
746 #endif
747 ])
748
749 AC_CHECK_HEADERS([sys/shm.h], [], [],
750 [#ifdef HAVE_SYS_TYPES_H
751 # include <sys/types.h>
752 #endif
753 #ifdef HAVE_SYS_IPC_H
754 # include <sys/ipc.h>
755 #endif
756 ])
757
758 AC_CHECK_HEADERS([sys/timex.h], [], [],
759 [#if HAVE_SYS_TIME_H
760 # include <sys/time.h>
761 #endif
762 ])
763
764 AC_CHECK_HEADERS([resolv.h], [], [],
765 [#ifdef HAVE_SYS_TYPES_H
766 #include <sys/types.h>
767 #endif
768 #ifdef HAVE_NETINET_IN_H
769 #include <netinet/in.h>
770 #endif
771 #ifdef HAVE_ARPA_NAMESER_H
772 #include <arpa/nameser.h>
773 #endif
774 ])
775
776 AC_CACHE_CHECK(
777     [for basic volatile support],
778     [ntp_cv_c_volatile],
779     [AC_COMPILE_IFELSE(
780         [AC_LANG_PROGRAM(
781             [[
782             ]],
783             [[
784                 volatile int x;
785             ]]
786         )]
787         [ntp_cv_c_volatile=yes],
788         [ntp_cv_c_volatile=no]
789     )]
790 )
791 case "$ntp_cv_c_volatile" in
792  yes)
793     ;;
794  *)
795     AC_DEFINE([volatile], [], [define away volatile?])
796     ;;
797 esac
798
799 AC_C_CONST
800 AC_C_BIGENDIAN
801 AC_TYPE_SIGNAL
802 AC_TYPE_OFF_T
803 AC_TYPE_SIZE_T
804 AC_CHECK_TYPES([time_t, long, uintptr_t])
805 AC_CHECK_SIZEOF([time_t])
806  
807 AH_VERBATIM([TYPEDEF_UINTPTR_T],
808 [/* Provide a typedef for uintptr_t? */
809 #ifndef HAVE_UINTPTR_T
810 typedef unsigned int    uintptr_t;
811 #define HAVE_UINTPTR_T  1
812 #endif])
813
814 AC_STRUCT_TM
815
816 AC_CACHE_CHECK(
817     [for u_int8_t],
818     [ntp_cv_type_u_int8_t],
819     [AC_COMPILE_IFELSE(
820         [AC_LANG_PROGRAM(
821             [[
822                 #ifdef HAVE_SYS_TYPES_H
823                 # include <sys/types.h>
824                 #endif
825             ]],
826             [[
827                 u_int8_t len = 42;
828             ]]
829         )],
830         [ntp_cv_type_u_int8_t=yes],
831         [ntp_cv_type_u_int8_t=no]
832     )]
833 )
834 case "$ntp_cv_type_u_int8_t" in
835  yes)
836     AC_DEFINE([HAVE_TYPE_U_INT8_T], [1], [Does u_int8_t exist?])
837 esac
838
839 AC_CACHE_CHECK(
840     [for u_int64_t],
841     [ntp_cv_type_u_int64_t],
842     [AC_COMPILE_IFELSE(
843         [AC_LANG_PROGRAM(
844             [[
845                 #ifdef HAVE_SYS_TYPES_H
846                 # include <sys/types.h>
847                 #endif
848             ]],
849             [[
850                 u_int64_t len = 42;
851             ]]
852         )],
853         [ntp_cv_type_u_int64_t=yes],
854         [ntp_cv_type_u_int64_t=no]
855     )]
856 )
857 case "$ntp_cv_type_u_int64_t" in
858  yes)
859     AC_DEFINE([HAVE_TYPE_U_INT64_T], [1], [Does u_int64_t exist?])
860 esac
861
862 AC_CACHE_CHECK(
863     [for a fallback value for HZ],
864     [ntp_cv_default_hz],
865     [
866         ntp_cv_default_hz=100
867         case "$host" in
868          alpha*-dec-osf4*|alpha*-dec-osf5*)
869             ntp_cv_default_hz=1024
870             ;;
871          mips-dec-ultrix4*)
872             ntp_cv_default_hz=256
873             ;;
874         esac
875     ]
876 )
877 AC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
878     [What is the fallback value for HZ?])
879
880 AC_CACHE_CHECK(
881     [if we need to override the system's value for HZ],
882     [ntp_cv_override_hz],
883     [
884         ntp_cv_override_hz=no
885         case "$host" in
886          alpha*-dec-osf4*|alpha*-dec-osf5*)
887             ntp_cv_override_hz=yes
888             ;;
889          mips-dec-ultrix4*)
890             ntp_cv_override_hz=yes
891             ;;
892          *-*-freebsd*)
893             ntp_cv_override_hz=yes
894             ;;
895          *-*-sunos4*)
896             ntp_cv_override_hz=yes
897             ;;
898          *-*-kfreebsd*)
899             ntp_cv_override_hz=yes
900             ;;
901         esac
902     ]
903 )
904 case "$ntp_cv_override_hz" in
905  yes)
906     AC_DEFINE([OVERRIDE_HZ], [1],
907         [Do we need to override the system's idea of HZ?])
908 esac
909
910 dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
911 dnl [AC_TRY_LINK([#include <sys/types.h>
912 dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
913 dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
914 dnl if test $su_cv_func_ut_host_in_utmp = yes; then
915 dnl   AC_DEFINE(HAVE_UT_HOST)
916 dnl fi
917
918 dnl AC_MSG_CHECKING(if we can get the system boot time)
919 dnl AC_CACHE_VAL(su_cv_have_boot_time,
920 dnl [AC_EGREP_CPP(yes,
921 dnl [#ifdef HAVE_UTMPX_H
922 dnl #include <utmpx.h>
923 dnl #else
924 dnl #include <utmp.h>
925 dnl #endif
926 dnl #ifdef BOOT_TIME
927 dnl yes
928 dnl #endif
929 dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
930 dnl AC_MSG_RESULT($su_cv_have_boot_time)
931
932 AC_CACHE_CHECK(
933     [for struct rt_msghdr],
934     [ntp_cv_struct_rt_msghdr],
935     [AC_COMPILE_IFELSE(
936         [AC_LANG_PROGRAM(
937             [[
938                 #include <sys/types.h>
939                 #include <sys/socket.h>
940                 #include <net/if.h>
941                 #include <net/route.h>
942             ]],
943             [[
944                 struct rt_msghdr p;
945             ]]
946         )],
947         [ntp_cv_struct_rt_msghdr=yes],
948         [ntp_cv_struct_rt_msghdr=no]
949     )]
950 )
951
952 AC_CACHE_CHECK(
953     [for struct rtattr],
954     [ntp_cv_rtattr],
955     [AC_COMPILE_IFELSE(
956         [AC_LANG_PROGRAM(
957             [[
958                 #include <stddef.h>
959                 #include <sys/socket.h>
960                 #include <linux/rtnetlink.h>
961             ]],
962             [[
963                 struct rtattr p;
964             ]]
965         )],
966         [ntp_cv_rtattr=yes],
967         [ntp_cv_rtattr=no]
968     )]
969 )
970
971 case "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
972  *yes*)
973     AC_DEFINE([HAS_ROUTING_SOCKET], [1],
974         [Do we have a routing socket (rt_msghdr or rtattr)?])
975     case "$ntp_cv_rtattr" in
976      yes)
977         AC_DEFINE([HAVE_RTNETLINK], [1],
978             [Do we have Linux routing socket?])
979     esac
980 esac
981
982 AC_CACHE_CHECK(
983     [struct sigaction for sa_sigaction],
984     [ntp_cv_struct_sigaction_has_sa_sigaction],
985     [AC_COMPILE_IFELSE(
986         [AC_LANG_PROGRAM(
987             [[
988                 #include <signal.h>
989             ]],
990             [[
991                 struct sigaction act;
992                 act.sa_sigaction = 0;
993             ]]
994         )],
995         [ntp_cv_struct_sigaction_has_sa_sigaction=yes],
996         [ntp_cv_struct_sigaction_has_sa_sigaction=no]
997     )]
998 )
999 case "$ntp_cv_struct_sigaction_has_sa_sigaction" in
1000  yes)
1001     AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
1002 esac
1003
1004 AC_CACHE_CHECK(
1005     [for struct ppsclockev],
1006     [ntp_cv_struct_ppsclockev],
1007     [AC_COMPILE_IFELSE(
1008         [AC_LANG_PROGRAM(
1009             [[
1010                 #ifdef HAVE_SYS_TYPES_H
1011                 # include <sys/types.h>
1012                 #endif
1013                 #ifdef HAVE_SYS_TERMIOS_H
1014                 # include <sys/termios.h>
1015                 #endif
1016                 #ifdef HAVE_SYS_TIME_H
1017                 # include <sys/time.h>
1018                 #endif
1019                 #ifdef HAVE_SYS_PPSCLOCK_H
1020                 # include <sys/ppsclock.h>
1021                 #endif
1022             ]],
1023             [[
1024                 extern struct ppsclockev *pce;
1025                 return pce->serial;
1026             ]]
1027         )],
1028         [ntp_cv_struct_ppsclockev=yes],
1029         [ntp_cv_struct_ppsclockev=no]
1030     )]
1031 )
1032 case "$ntp_cv_struct_ppsclockev" in
1033  yes)
1034     AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
1035         [Does a system header define struct ppsclockev?])
1036 esac
1037
1038 AC_CACHE_CHECK(
1039     [for struct sockaddr_storage],
1040     [ntp_cv_sockaddr_storage],
1041     [AC_COMPILE_IFELSE(
1042         [AC_LANG_PROGRAM(
1043             [[
1044                 #ifdef HAVE_SYS_TYPES_H
1045                 # include <sys/types.h>
1046                 #endif
1047                 #ifdef HAVE_SYS_SOCKET_H
1048                 # include <sys/socket.h>
1049                 #endif
1050                 #ifdef HAVE_NETINET_IN_H
1051                 # include <netinet/in.h>
1052                 #endif
1053             ]],
1054             [[
1055                 struct sockaddr_storage n;
1056             ]]
1057         )],
1058         [ntp_cv_sockaddr_storage=yes],
1059         [ntp_cv_sockaddr_storage=no]
1060     )]
1061 )
1062 case "$ntp_cv_sockaddr_storage" in
1063  yes)
1064     AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
1065         [Does a system header define struct sockaddr_storage?])
1066 esac
1067
1068 AC_CACHE_CHECK(
1069     [for sockaddr_storage.ss_family],
1070     [ntp_cv_have_ss_family],
1071     [AC_COMPILE_IFELSE(
1072         [AC_LANG_PROGRAM(
1073             [[
1074                 #ifdef HAVE_SYS_TYPES_H
1075                 # include <sys/types.h>
1076                 #endif
1077                 #ifdef HAVE_SYS_SOCKET_H
1078                 # include <sys/socket.h>
1079                 #endif
1080                 #ifdef HAVE_NETINET_IN_H
1081                 # include <netinet/in.h>
1082                 #endif
1083             ]],
1084             [[
1085                 struct sockaddr_storage s;
1086                 s.ss_family = 1;
1087             ]]
1088         )],
1089         [ntp_cv_have_ss_family=yes],
1090         [ntp_cv_have_ss_family=no]
1091     )]
1092 )
1093
1094 case "$ntp_cv_have_ss_family" in
1095  no)
1096     AC_CACHE_CHECK(
1097         [for sockaddr_storage.__ss_family],
1098         [ntp_cv_have___ss_family],
1099         [AC_COMPILE_IFELSE(
1100             [AC_LANG_PROGRAM(
1101                 [[
1102                     #ifdef HAVE_SYS_TYPES_H
1103                     # include <sys/types.h>
1104                     #endif
1105                     #ifdef HAVE_SYS_SOCKET_H
1106                     # include <sys/socket.h>
1107                     #endif
1108                     #ifdef HAVE_NETINET_IN_H
1109                     # include <netinet/in.h>
1110                     #endif
1111                 ]],
1112                 [[
1113                     struct sockaddr_storage s;
1114                     s.__ss_family = 1;
1115                 ]]
1116             )],
1117             [ntp_cv_have___ss_family=yes],
1118             [ntp_cv_have___ss_family=no]
1119         )]
1120     )
1121     case "$ntp_cv_have___ss_family" in
1122      yes)
1123         AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
1124             [Does struct sockaddr_storage have __ss_family?])
1125     esac
1126 esac
1127
1128 AH_VERBATIM(
1129     [HAVE___SS_FAMILY_IN_SS_VERBATIM],
1130     [
1131         /* Handle sockaddr_storage.__ss_family */
1132         #ifdef HAVE___SS_FAMILY_IN_SS
1133         # define ss_family __ss_family
1134         #endif /* HAVE___SS_FAMILY_IN_SS */
1135     ]
1136 )
1137
1138 AC_CACHE_CHECK(
1139     [for sockaddr_storage.ss_len],
1140     [ntp_cv_have_ss_len],
1141     [AC_COMPILE_IFELSE(
1142         [AC_LANG_PROGRAM(
1143             [[
1144                 #ifdef HAVE_SYS_TYPES_H
1145                 # include <sys/types.h>
1146                 #endif
1147                 #ifdef HAVE_SYS_SOCKET_H
1148                 # include <sys/socket.h>
1149                 #endif
1150                 #ifdef HAVE_NETINET_IN_H
1151                 # include <netinet/in.h>
1152                 #endif
1153             ]],
1154             [[
1155                 struct sockaddr_storage s;
1156                 s.ss_len = 1;
1157             ]]
1158         )],
1159         [ntp_cv_have_ss_len=yes],
1160         [ntp_cv_have_ss_len=no]
1161     )]
1162 )
1163
1164 case "$ntp_cv_have_ss_len" in
1165  no)
1166     AC_CACHE_CHECK(
1167         [for sockaddr_storage.__ss_len],
1168         [ntp_cv_have___ss_len],
1169         [AC_COMPILE_IFELSE(
1170             [AC_LANG_PROGRAM(
1171                 [[
1172                     #ifdef HAVE_SYS_TYPES_H
1173                     # include <sys/types.h>
1174                     #endif
1175                     #ifdef HAVE_SYS_SOCKET_H
1176                     # include <sys/socket.h>
1177                     #endif
1178                     #ifdef HAVE_NETINET_IN_H
1179                     # include <netinet/in.h>
1180                     #endif
1181                 ]],
1182                 [[
1183                     struct sockaddr_storage s;
1184                     s.__ss_len = 1;
1185                 ]]
1186             )],
1187             [ntp_cv_have___ss_len=yes],
1188             [ntp_cv_have___ss_len=no]
1189         )]
1190     )
1191     case "$ntp_cv_have___ss_len" in
1192      yes)
1193         AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
1194             [Does struct sockaddr_storage have __ss_len?])
1195     esac
1196 esac
1197
1198 AH_VERBATIM(
1199     [HAVE___SS_LEN_IN_SS_VERBATIM],
1200     [
1201         /* Handle sockaddr_storage.__ss_len */
1202         #ifdef HAVE___SS_LEN_IN_SS
1203         # define ss_len __ss_len
1204         #endif /* HAVE___SS_LEN_IN_SS */
1205     ]
1206 )
1207
1208 #
1209 # Look for in_port_t.
1210 #
1211 AC_CACHE_CHECK(
1212     [for in_port_t],
1213     [isc_cv_have_in_port_t],
1214     [AC_COMPILE_IFELSE(
1215         [AC_LANG_PROGRAM(
1216             [[
1217                 #include <sys/types.h>
1218                 #include <netinet/in.h>
1219             ]],
1220             [[
1221                 in_port_t port = 25; 
1222                 return (0);
1223             ]]
1224         )],
1225         [isc_cv_have_in_port_t=yes],
1226         [isc_cv_have_in_port_t=no]
1227     )]
1228 )
1229 case "$isc_cv_have_in_port_t" in
1230  no)
1231         AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
1232             [Declare in_port_t?])
1233 esac
1234
1235 case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
1236   *yes*)
1237     AC_CACHE_CHECK(
1238         [for struct snd_size],
1239         [ntp_cv_struct_snd_size],
1240         [AC_COMPILE_IFELSE(
1241             [AC_LANG_PROGRAM(
1242                 [[
1243                     #ifdef HAVE_MACHINE_SOUNDCARD_H
1244                     # include <machine/soundcard.h>
1245                     #endif
1246                     #ifdef HAVE_SYS_SOUNDCARD_H
1247                     # include <sys/soundcard.h>
1248                     #endif
1249                 ]],
1250                 [[
1251                     extern struct snd_size *ss;
1252                     return ss->rec_size;
1253                 ]]
1254             )],
1255             [ntp_cv_struct_snd_size=yes],
1256             [ntp_cv_struct_snd_size=no]
1257         )]
1258     )
1259     case "$ntp_cv_struct_snd_size" in
1260      yes)
1261         AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
1262             [Do we have struct snd_size?])
1263     esac
1264 esac
1265
1266 AC_CACHE_CHECK(
1267     [struct clockinfo for hz],
1268     [ntp_cv_struct_clockinfo_has_hz],
1269     [AC_COMPILE_IFELSE(
1270         [AC_LANG_PROGRAM(
1271             [[
1272                 #include <sys/time.h>
1273             ]],
1274             [[
1275                 extern struct clockinfo *pc;
1276                 return pc->hz;
1277             ]]
1278         )],
1279         [ntp_cv_struct_clockinfo_has_hz=yes],
1280         [ntp_cv_struct_clockinfo_has_hz=no]
1281     )]
1282 )
1283 case "$ntp_cv_struct_clockinfo_has_hz" in
1284  yes)
1285     AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
1286 esac
1287
1288 AC_CACHE_CHECK(
1289     [struct clockinfo for tickadj],
1290     [ntp_cv_struct_clockinfo_has_hz],
1291     [AC_COMPILE_IFELSE(
1292         [AC_LANG_PROGRAM(
1293             [[
1294                 #include <sys/time.h>
1295             ]],
1296             [[
1297                 extern struct clockinfo *pc;
1298                 return pc->tickadj;
1299             ]]
1300         )],
1301         [ntp_cv_struct_clockinfo_has_hz=yes],
1302         [ntp_cv_struct_clockinfo_has_hz=no]
1303     )]
1304 )
1305 case "$ntp_cv_struct_clockinfo_has_hz" in
1306  yes)
1307     AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
1308 esac
1309
1310 AC_CACHE_CHECK(
1311     [for struct timespec],
1312     [ntp_cv_struct_timespec],
1313     [AC_COMPILE_IFELSE(
1314         [AC_LANG_PROGRAM(
1315             [[
1316                 #include <sys/time.h>
1317                 /* Under SunOS, timespec is in sys/timepps.h,
1318                    which needs errno.h and FRAC */
1319                 #ifdef HAVE_ERRNO_H
1320                 # include <errno.h>
1321                 #endif
1322                 #ifdef HAVE_SYS_TIMEPPS_H
1323                 # define FRAC 4294967296
1324                 # include <sys/timepps.h>
1325                 #endif
1326             ]],
1327             [[
1328                 struct timespec n;
1329             ]]
1330         )],
1331         [ntp_cv_struct_timespec=yes],
1332         [ntp_cv_struct_timespec=no]
1333     )]
1334 )
1335 case "$ntp_cv_struct_timespec" in
1336  yes)
1337     AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [struct timespec declared?])
1338 esac
1339
1340 AC_CACHE_CHECK(
1341     [for struct ntptimeval],
1342     [ntp_cv_struct_ntptimeval],
1343     [AC_COMPILE_IFELSE(
1344         [AC_LANG_PROGRAM(
1345             [[
1346                 #include <sys/time.h>
1347                 #include <sys/timex.h>
1348             ]],
1349             [[
1350                 struct ntptimeval n;
1351             ]]
1352         )],
1353         [ntp_cv_struct_ntptimeval=yes],
1354         [ntp_cv_struct_ntptimeval=no]
1355     )]
1356 )
1357 case "$ntp_cv_struct_ntptimeval" in
1358  yes)
1359     AC_DEFINE([HAVE_STRUCT_NTPTIMEVAL], [1],
1360         [Do we have struct ntptimeval?])
1361 esac
1362
1363 AC_CHECK_MEMBERS(
1364     [struct ntptimeval.time.tv_nsec],
1365     [],
1366     [],
1367     [
1368         #ifdef HAVE_SYS_TIME_H
1369         #include <sys/time.h>
1370         #else
1371         # ifdef HAVE_TIME_H
1372         #  include <time.h>
1373         # endif
1374         #endif
1375         #ifdef HAVE_SYS_TIMEX_H
1376         # include <sys/timex.h>
1377         #else
1378         # ifdef HAVE_TIMEX_H
1379         #  include <timex.h>
1380         # endif
1381         #endif
1382     ]
1383 )
1384
1385 AC_C_INLINE
1386
1387 case "$ac_cv_c_inline" in
1388  '')
1389     ;;
1390  *)
1391     AC_DEFINE([HAVE_INLINE], [1], [inline keyword or macro available])
1392     AC_SUBST([HAVE_INLINE])
1393 esac
1394
1395 AC_C_CHAR_UNSIGNED              dnl CROSS_COMPILE?
1396 AC_CHECK_SIZEOF([signed char])
1397 AC_CHECK_TYPES([s_char])
1398 AC_CHECK_SIZEOF([int])
1399 AC_CHECK_SIZEOF([long])
1400
1401 case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
1402  *yes)
1403     # We have a typedef for s_char.  Might as well believe it...
1404     ;;
1405  no0no)
1406     # We have signed chars, can't say 'signed char', no s_char typedef.
1407     AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
1408         [Do we need an s_char typedef?])
1409     ;;
1410  no1no)
1411     # We have signed chars, can say 'signed char', no s_char typedef.
1412     AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
1413         [Do we need an s_char typedef?])
1414     ;;
1415  yes0no)
1416     # We have unsigned chars, can't say 'signed char', no s_char typedef.
1417     AC_MSG_ERROR([No way to specify a signed character!])
1418     ;;
1419  yes1no)
1420     # We have unsigned chars, can say 'signed char', no s_char typedef.
1421     AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
1422         [Do we need an s_char typedef?])
1423     ;;
1424 esac
1425 AC_TYPE_UID_T
1426
1427 case "$host" in
1428  *-*-aix[[456]]*)
1429         # (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
1430         # (returning ENOSYS).  I didn't check 4.2.  If, in the future,
1431         # IBM pulls its thumbs out long enough to implement clock_settime,
1432         # this conditional will need to change.  Maybe use AC_TRY_RUN
1433         # instead to try to set the time to itself and check errno.
1434     ;;
1435  *)
1436     AC_SEARCH_LIBS([clock_gettime], [rt])
1437     AC_CHECK_FUNCS([clock_gettime clock_settime])
1438     ;;
1439 esac
1440 AC_CHECK_FUNCS([daemon])
1441 AC_CHECK_FUNCS(
1442     [finite],
1443     [],
1444     [AC_CHECK_FUNCS(
1445         [isfinite],
1446         [],
1447         [
1448             AC_MSG_CHECKING([for isfinite with <math.h>])
1449             _libs=$LIBS
1450             LIBS="$LIBS -lm"
1451             AC_LINK_IFELSE(
1452                 [AC_LANG_PROGRAM(
1453                     [[
1454                         #include <math.h>
1455                     ]],
1456                     [[
1457                         float f = 0.0;
1458                         isfinite(f);
1459                     ]]
1460                 )],
1461                 [ans=yes],
1462                 [ans=no]
1463             )
1464             LIBS=$_libs
1465             AC_MSG_RESULT([$ans])
1466             case "$ans" in
1467              yes)
1468                 AC_DEFINE([HAVE_ISFINITE], [1])
1469             esac
1470         ]
1471     )]
1472 )
1473
1474 AC_CHECK_FUNCS([getbootfile getclock getdtablesize])
1475
1476 AC_ARG_ENABLE(
1477     [getifaddrs],
1478     [AS_HELP_STRING(
1479         [--enable-getifaddrs],
1480         [s Enable the use of getifaddrs() [[yes|no|glibc]].
1481 glibc: Use getifaddrs() in glibc if you know it supports IPv6.]
1482     )],
1483     [want_getifaddrs="$enableval"],
1484     [want_getifaddrs="yes"]
1485 )
1486
1487 case $want_getifaddrs in
1488  yes|glibc)
1489     #
1490     # Do we have getifaddrs() ?
1491     #
1492     case $host in
1493      *-*linux*)
1494         # Some recent versions of glibc support getifaddrs() which does not
1495         # provide AF_INET6 addresses while the function provided by the USAGI
1496         # project handles the AF_INET6 case correctly.  We need to avoid
1497         # using the former but prefer the latter unless overridden by
1498         # --enable-getifaddrs=glibc.
1499         case "$want_getifaddrs" in
1500          glibc)
1501             AC_CHECK_FUNCS([getifaddrs])
1502             ;;
1503          *)
1504             save_LIBS="$LIBS"
1505             LIBS="-L/usr/local/v6/lib $LIBS"
1506             AC_CHECK_LIB(
1507                 [inet6],
1508                 [getifaddrs],
1509                 [ans=yes],
1510                 [ans=no]
1511             )
1512             case "$ans" in
1513              yes)
1514                 LIBS="$LIBS -linet6"
1515                 AC_DEFINE([HAVE_GETIFADDRS], [1])
1516                 ;;
1517              *)
1518                 LIBS=${save_LIBS}
1519                 ;;
1520             esac
1521             ;;
1522         esac
1523         ;;
1524     esac
1525     ;;
1526  *)
1527     AC_CHECK_FUNCS([getifaddrs])
1528     ;;
1529 esac
1530
1531 AC_CACHE_CHECK(
1532     [type of socklen arg for getsockname()],
1533     [ntp_cv_getsockname_socklen_type],
1534     [
1535     getsockname_socklen_type_found=no
1536     for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
1537         for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
1538             AC_COMPILE_IFELSE(
1539                 [AC_LANG_PROGRAM(
1540                     [[
1541                         #ifdef HAVE_SYS_TYPES_H
1542                         # include <sys/types.h>
1543                         #endif
1544                         #ifdef HAVE_SYS_SOCKET_H
1545                         # include <sys/socket.h>
1546                         #endif
1547                     ]], [[
1548                         extern
1549                         getsockname(int, $getsockname_arg2, 
1550                                 $ntp_cv_getsockname_socklen_type *);
1551                     ]]
1552                 )],
1553                 [getsockname_socklen_type_found=yes ; break 2],
1554                 []
1555             )
1556         done
1557     done
1558     case "$getsockname_socklen_type_found" in
1559      no)
1560         ntp_cv_getsockname_socklen_type='socklen_t'
1561     esac
1562     AS_UNSET([getsockname_arg2])
1563     AS_UNSET([getsockname_socklen_type_found])
1564     ]
1565 )
1566 AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
1567                    [$ntp_cv_getsockname_socklen_type],
1568                    [What is getsockname()'s socklen type?])
1569
1570 AC_CHECK_FUNCS([getuid getrusage hstrerror])
1571 AC_CHECK_FUNC([gettimeofday], [], [
1572 case "$host" in
1573   *-*-mpeix*) ac_cv_func_gettimeofday=yes
1574     ;;
1575 esac])
1576
1577 #
1578 # Check for if_nametoindex() for IPv6 scoped addresses support
1579 #
1580 case "$host" in
1581  *-hp-hpux*)
1582     AC_SEARCH_LIBS([if_nametoindex], [ipv6])
1583 esac
1584 AC_CHECK_FUNCS([if_nametoindex])
1585 case "$ac_cv_func_if_nametoindex" in
1586  yes)
1587         AC_DEFINE([ISC_PLATFORM_HAVEIFNAMETOINDEX], [1],
1588             [ISC: do we have if_nametoindex()?])
1589 esac
1590
1591 AC_SEARCH_LIBS([inet_ntop], [resolv], , , [-lsocket -lnsl])
1592 AC_CHECK_FUNC([inet_ntop], [], 
1593     [AC_DEFINE([ISC_PLATFORM_NEEDNTOP], [1], [ISC: provide inet_ntop()])])
1594 AC_CHECK_FUNC([inet_pton], [],
1595     [AC_DEFINE([ISC_PLATFORM_NEEDPTON], [1], [ISC: provide inet_pton()])])
1596
1597 case "$ac_cv_header_kvm_h" in
1598  yes)
1599     AC_CHECK_FUNCS([kvm_open])
1600     ;;
1601 esac
1602
1603 AC_CHECK_FUNCS([memcpy memmove memset])
1604 case "$host" in
1605  *-*-sco3.2v5.0.*)
1606     # Just stubs.  Idiots.
1607     ;;
1608  *) AC_CHECK_FUNCS([mkstemp])
1609     ;;
1610 esac
1611 AC_CHECK_FUNCS([mktime])
1612 case "$host" in
1613  *-*-aix[[456]]*)
1614     # Just a stub.  Idiots.
1615     ;;
1616  *-*-irix[[45]]*)
1617     # Just a stub in "old" Irix.  Idiots.
1618     ;;
1619  *-*-*linux*)
1620     # there, but more trouble than it is worth for now (resolver problems)
1621     ;;
1622  *-*-qnx*)
1623     # Apparently there but not working in QNX.  Idiots?
1624     ;;
1625  *-*-sco3.2v5.0.*)
1626     # Just a stub.  Idiots.
1627     ;;
1628  alpha*-dec-osf4*|alpha*-dec-osf5*)
1629     # mlockall is there, as a #define calling memlk via <sys/mman.h>
1630     # Not easy to test for - cheat.
1631     AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
1632     AC_CHECK_FUNCS([mlockall])
1633     ;;
1634  *) AC_CHECK_FUNCS([mlockall])
1635     ;;
1636 esac
1637 AC_CHECK_FUNCS([nice nlist])
1638 case "$host" in
1639  *-*-solaris2.6)
1640     # Broken...
1641     ;;
1642  *) AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
1643     ;;
1644 esac
1645 AC_CHECK_FUNCS([plock pututline pututxline readlink recvmsg rtprio])
1646 case "$host" in
1647  *-*-aix[[456]]*)
1648     # Just a stub in AIX 4.  Idiots.
1649     ;;
1650  *-*-solaris2.5*)
1651     # Just stubs in solaris2.5.  Idiots.
1652     ;;
1653  *) AC_CHECK_FUNCS([sched_setscheduler])
1654     ;;
1655 esac
1656 AC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid])
1657 AC_CHECK_FUNCS([setrlimit])
1658 AC_CHECK_FUNCS([settimeofday], ,[
1659 case "$host" in
1660   *-*-mpeix*) ac_cv_func_settimeofday=yes
1661     ;;
1662 esac])
1663 AC_CHECK_FUNCS([setvbuf sigaction sigvec sigset sigsuspend stime strchr])
1664 AC_CHECK_FUNCS([sysconf sysctl snprintf strdup strerror strstr timegm])
1665 case "$host" in
1666  *-*-aix[[456]]*)
1667     # Just stubs.  Idiots.
1668     ;;
1669  *-*-netbsd1*)
1670     # Just stubs.  Idiots.
1671     ;;
1672  *-*-netbsdelf1*)
1673     # Just stubs.  Idiots.
1674     ;;
1675  *-*-openbsd*)
1676     # Just stubs.  Idiots.
1677     ;;
1678  *) AC_CHECK_FUNCS([timer_create timer_settime])
1679     ;;
1680 esac
1681 AC_CHECK_FUNCS([umask uname updwtmp updwtmpx vsnprintf vsprintf])
1682
1683 ###
1684
1685 # http://bugs.ntp.org/737
1686 case "$ac_cv_func_recvmsg" in
1687  yes)
1688     AC_CACHE_CHECK(
1689         [if we need extra help to define struct iovec],
1690         [ntp_cv_struct_iovec_help],
1691         [
1692             compiled=no
1693             for ntp_cv_struct_iovec_help in '0' '1'; do
1694                 AC_COMPILE_IFELSE(
1695                     [AC_LANG_PROGRAM(
1696                         [[
1697                             #ifdef HAVE_SYS_TYPES_H
1698                             # include <sys/types.h>
1699                             #endif
1700                             #ifdef HAVE_SYS_SOCKET_H
1701                             # include <sys/socket.h>
1702                             #endif
1703                             #if $ntp_cv_struct_iovec_help
1704                             # include <sys/uio.h>
1705                             #endif
1706                         ]],
1707                         [[
1708                             void foo(void) {
1709                                 ssize_t x;
1710                                 int s = 0;
1711                                 struct iovec iov;
1712                                 struct msghdr mh;
1713                                 int flags = 0;
1714
1715                                 mh.msg_iov = &iov;
1716                                 x = recvmsg(s, &mh, flags);
1717                             }
1718                         ]]
1719                     )],
1720                     [compiled=yes ; break 1],
1721                     []
1722                 )
1723             done
1724             case "$compiled" in
1725              no)
1726                 ntp_cv_struct_iovec_help=0
1727             esac
1728             AS_UNSET([compiled])
1729         ]
1730     )
1731     case "$ntp_cv_struct_iovec_help" in
1732      1)
1733         AC_DEFINE([HAVE_SYS_UIO_H], [1],
1734             [Use sys/uio.h for struct iovec help])
1735     esac
1736 esac
1737
1738 case "$host" in
1739  *-*-sunos4*)
1740     AC_DEFINE([SPRINTF_CHAR], [1], [*s*printf() functions are char*])
1741     ;;
1742 esac
1743
1744 AC_CACHE_CHECK(
1745     [number of arguments to gettimeofday()],
1746     [ntp_cv_func_Xettimeofday_nargs],
1747     [AC_COMPILE_IFELSE(
1748         [AC_LANG_PROGRAM(
1749             [[
1750                 #include <sys/time.h>
1751             ]],
1752             [[
1753                 gettimeofday(0, 0);
1754                 settimeofday(0, 0);
1755             ]]
1756         )],
1757         [ntp_cv_func_Xettimeofday_nargs=2],
1758         [ntp_cv_func_Xettimeofday_nargs=1]
1759     )]
1760 )
1761 case "$ntp_cv_func_Xettimeofday_nargs" in
1762  1)
1763     AC_DEFINE([SYSV_TIMEOFDAY], [1], [Does Xettimeofday take 1 arg?])
1764 esac
1765
1766 AC_CACHE_CHECK(
1767     [number of arguments taken by setpgrp()],
1768     [ntp_cv_func_setpgrp_nargs],
1769     [AC_COMPILE_IFELSE(
1770         [AC_LANG_PROGRAM(
1771             [[
1772                 #ifdef HAVE_SYS_TYPES_H
1773                 # include <sys/types.h>
1774                 #endif
1775                 #ifdef HAVE_UNISTD_H
1776                 # include <unistd.h>
1777                 #endif
1778             ]],
1779             [[
1780                 setpgrp(0, 0);
1781             ]]
1782         )],
1783         [ntp_cv_func_setpgrp_nargs=2],
1784         [ntp_cv_func_setpgrp_nargs=0]
1785     )]
1786 )
1787 case "$ntp_cv_func_setpgrp_nargs" in
1788  0)
1789     AC_DEFINE([HAVE_SETPGRP_0], [1],
1790               [define if setpgrp takes 0 arguments])
1791 esac
1792
1793 dnl we require ANSI C which mandates void * here
1794 dnl we should clean up all uses of QSORT_USES_VOID_P so
1795 dnl this can be removed.
1796 AC_DEFINE([QSORT_USES_VOID_P], [1],
1797     [Does qsort expect to work on "void *" stuff?])
1798
1799 AC_CACHE_CHECK(
1800     [if we need to declare 'errno'],
1801     [ntp_cv_decl_errno],
1802     [AC_COMPILE_IFELSE(
1803         [AC_LANG_PROGRAM(
1804             [[
1805                 #ifdef HAVE_ERRNO_H
1806                 # include <errno.h>
1807                 #endif
1808             ]],
1809             [[
1810                 errno = 0;
1811             ]]
1812         )],
1813         [ntp_cv_decl_errno=no],
1814         [ntp_cv_decl_errno=yes]
1815     )]
1816 )
1817 case "$ntp_cv_decl_errno" in
1818  yes)
1819     AC_DEFINE([DECL_ERRNO], [1], [Declare errno?])
1820 esac
1821
1822 dnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1823 dnl MT purposes.  This makes the line "extern int h_errno" choke
1824 dnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1825 dnl without breaking any other platforms.
1826 dnl
1827 AC_CACHE_CHECK(
1828     [if we may declare 'h_errno'],
1829     [ntp_cv_decl_h_errno],
1830     [AC_COMPILE_IFELSE(
1831         [AC_LANG_PROGRAM(
1832             [[
1833                 #include <sys/types.h>
1834                 #ifdef HAVE_NETINET_IN_H
1835                 # include <netinet/in.h>
1836                 #endif
1837                 #ifdef HAVE_ARPA_NAMESER_H
1838                 # include <arpa/nameser.h>
1839                 #endif
1840                 #ifdef HAVE_NETDB_H
1841                 # include <netdb.h>
1842                 #endif
1843                 #ifdef HAVE_RESOLV_H
1844                 # include <resolv.h>
1845                 #endif
1846             ]],
1847             [[
1848                 extern int h_errno;
1849             ]]
1850         )],
1851         [ntp_cv_decl_h_errno=yes],
1852         [ntp_cv_decl_h_errno=no]
1853     )]
1854 )
1855 case "$ntp_cv_decl_h_errno" in
1856  yes) 
1857     AC_DEFINE([DECL_H_ERRNO], [1], [Declare h_errno?])
1858 esac
1859
1860 AC_CACHE_CHECK(
1861     [if declaring 'syscall()' is ok],
1862     [ntp_cv_decl_syscall],
1863     [AC_COMPILE_IFELSE(
1864         [AC_LANG_PROGRAM(
1865             [[
1866                 #ifdef HAVE_SYS_TYPES_H
1867                 # include <sys/types.h>
1868                 #endif
1869                 #ifdef HAVE_UNISTD_H
1870                 # include <unistd.h>
1871                 #endif
1872             ]],
1873             [[
1874                 extern int syscall (int, ...);
1875             ]]
1876         )]
1877         [ntp_cv_decl_syscall=yes],
1878         [ntp_cv_decl_syscall=no]
1879     )]
1880 )
1881 case "$ntp_cv_decl_syscall" in
1882  yes)
1883     AC_DEFINE([DECL_SYSCALL], [1], [Declare syscall()?])
1884 esac
1885
1886 case "$host" in
1887  *-*-aix4.3.*)
1888     AC_DEFINE([DECL_HSTRERROR_0], [1], [Declaration style])             # Needed for XLC under AIX 4.3.2
1889     ;;
1890  *-*-mpeix*)
1891     AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1892     AC_DEFINE([DECL_INET_NTOA_0], [1], [Declaration style])
1893     AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1894     AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1895     AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1896     AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1897     AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1898     ;;
1899  *-*-osf[[45]]*)
1900     AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1901     AC_DEFINE([DECL_STIME_1], [1], [Declaration style])
1902     ;;
1903  *-*-qnx*)
1904     AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1905     ;;
1906  *-*-riscos4*)
1907     AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1908     AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1909     AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1910     AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1911     AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1912     AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1913     AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1914     AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1915     AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1916     AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1917     AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1918     AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1919     AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1920     AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1921     AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1922     AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1923     ;;
1924  *-*-solaris2*)
1925     AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1926     AC_DEFINE([DECL_SETPRIORITY_1], [1], [Declaration style])
1927     case "$host" in
1928      *-*-solaris2.4)
1929         AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1930         ;;
1931     esac
1932     ;;
1933  *-*-sunos4*)
1934     AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1935     AC_DEFINE([DECL_BCOPY_0], [1], [Declaration style])
1936     AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1937     AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1938     AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1939     AC_DEFINE([DECL_MEMMOVE_0], [1], [Declaration style])
1940     AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1941     AC_DEFINE([DECL_MKSTEMP_0], [1], [Declaration style])
1942     AC_DEFINE([DECL_RENAME_0], [1], [Declaration style])
1943     AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1944     AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1945     AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1946     AC_DEFINE([DECL_SIGVEC_0], [1], [Declaration style])
1947     case "`basename $ac_cv_prog_CC`" in
1948      acc*) ;;
1949      *) AC_DEFINE([DECL_STDIO_0], [1], [Declaration style])
1950         ;;
1951     esac
1952     AC_DEFINE([DECL_STRTOL_0], [1], [Declaration style])
1953     AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1954     AC_DEFINE([DECL_TIME_0], [1], [Declaration style])
1955     AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1956     AC_DEFINE([DECL_TOLOWER_0], [1], [Declaration style])
1957     AC_DEFINE([DECL_TOUPPER_0], [1], [Declaration style])
1958     AC_DEFINE([DECL_STRERROR_0], [1], [Declaration style])
1959     ;;
1960  *-*-ultrix4*)
1961     AC_DEFINE([DECL_ADJTIME_0], [1], [Declaration style])
1962     AC_DEFINE([DECL_BZERO_0], [1], [Declaration style])
1963     AC_DEFINE([DECL_CFSETISPEED_0], [1], [Declaration style])
1964     AC_DEFINE([DECL_IOCTL_0], [1], [Declaration style])
1965     AC_DEFINE([DECL_IPC_0], [1], [Declaration style])
1966     AC_DEFINE([DECL_MKTEMP_0], [1], [Declaration style])
1967     AC_DEFINE([DECL_NLIST_0], [1], [Declaration style])
1968     AC_DEFINE([DECL_PLOCK_0], [1], [Declaration style])
1969     AC_DEFINE([DECL_SELECT_0], [1], [Declaration style])
1970     AC_DEFINE([DECL_SETITIMER_0], [1], [Declaration style])
1971     AC_DEFINE([DECL_SETPRIORITY_0], [1], [Declaration style])
1972     AC_DEFINE([DECL_STIME_0], [1], [Declaration style])
1973     AC_DEFINE([DECL_SYSLOG_0], [1], [Declaration style])
1974     AC_DEFINE([DECL_TIMEOFDAY_0], [1], [Declaration style])
1975     ;;
1976 esac
1977
1978 case "$host" in
1979  *-*-sco3.2*)
1980     AC_DEFINE([TERMIOS_NEEDS__SVID3], [1],
1981         [Do we need to #define _SVID3 when we #include <termios.h>?])
1982     ;;
1983 esac
1984
1985 case "$host" in
1986  *-*-hpux[[567]]*)
1987     AC_DEFINE([NEED_RCVBUF_SLOP], [1],
1988         [Do we need extra room for SO_RCVBUF? (HPUX < 8)])
1989 esac
1990
1991 dnl Using AC_CACHE_CHECK to honor preset ntp_cv_var_open_bcast_socket
1992 AC_CACHE_CHECK(
1993     [if we will open the broadcast socket],
1994     [ntp_cv_var_open_bcast_socket],
1995     [
1996         ans=yes
1997         case "$host" in
1998          *-*-domainos)
1999             ans=no
2000         esac
2001         ntp_cv_var_open_bcast_socket=$ans
2002     ]
2003 )
2004 case "$ntp_cv_var_open_bcast_socket" in
2005  yes)
2006     AC_DEFINE([OPEN_BCAST_SOCKET], [1],
2007         [Should we open the broadcast socket?])
2008 esac
2009
2010 case "$host" in
2011  *-*-hpux*)
2012     AC_DEFINE([NEED_HPUX_FINDCONFIG], [1],
2013         [Do we want the HPUX FindConfig()?])
2014 esac
2015
2016 dnl using AC_CACHE_CHECK to honor preset $ntp_cv_arg_setpgrp_negpid
2017 AC_CACHE_CHECK(
2018     [if process groups are set with -pid],
2019     [ntp_cv_arg_setpgrp_negpid],
2020     [
2021         case "$host" in
2022          *-*-hpux[[567]]*)
2023             ans=no
2024             ;;
2025          *-*-hpux*)
2026             ans=yes
2027             ;;
2028          *-*-*linux*)
2029             ans=yes
2030             ;;
2031          *-*-sunos3*)
2032             ans=yes
2033             ;;
2034          *-*-ultrix2*)
2035             ans=yes
2036             ;;
2037          *)
2038             ans=no
2039             ;;
2040         esac
2041         ntp_cv_arg_setpgrp_negpid=$ans
2042     ]
2043 )
2044 case "$ntp_cv_arg_setpgrp_negpid" in
2045  yes)
2046     AC_DEFINE([UDP_BACKWARDS_SETOWN], [1],
2047         [Do we set process groups with -pid?])
2048 esac
2049
2050 AC_CACHE_CHECK(
2051     [if we need a ctty for F_SETOWN],
2052     [ntp_cv_func_ctty_for_f_setown],
2053     [
2054         case "$host" in
2055          *-*-bsdi[23]*)
2056             ans=yes
2057             ;;
2058          *-*-freebsd*)
2059             ans=yes
2060             ;;
2061         # NetBSD versions prior to 3.99.8 require a CTTY for F_SETOWN,
2062         # while later versions will fail a ioctl(TIOCSCTTY, 0) call in
2063         # some cases and so should not have USE_FSETOWNCTTY.  "netbsd"
2064         # in $host may be followed by "aout", "ecoff", or "elf".
2065          *-*-netbsd*[a-z]3.[0-8]*|*-*-netbsd*[a-z][0-2].*|*-*-netbsd*[a-z]3.99.[0-7])
2066             ans=yes
2067             ;;
2068          *-*-netbsd3.[0-8]*|*-*-netbsd[0-2].*|*-*-netbsd3.99.[0-7])
2069             ans=yes
2070             ;;
2071          *-*-openbsd*)
2072             ans=yes
2073             ;;
2074          *-*-osf*)
2075             ans=yes
2076             ;;
2077          *-*-darwin*)
2078             ans=yes
2079             ;;
2080          *) 
2081             ans=no
2082             ;;
2083         esac
2084         ntp_cv_func_ctty_for_f_setown=$ans
2085     ]
2086 )
2087 case "$ntp_cv_func_ctty_for_f_setown" in
2088  yes)
2089     AC_DEFINE([USE_FSETOWNCTTY], [1], [Must we have a CTTY for fsetown?])
2090 esac
2091
2092 AC_CACHE_CHECK(
2093     [if the OS clears cached routes when more specifics become available],
2094     [ntp_cv_os_routeupdates],
2095     [
2096         case "$host" in
2097          *-*-netbsd*)
2098             ans=yes
2099             ;;
2100          *) 
2101             ans=no
2102             ;;
2103         esac
2104         ntp_cv_os_routeupdates=$ans
2105     ]
2106 )
2107 case "$ntp_cv_os_routeupdates" in
2108  yes)
2109     AC_DEFINE([OS_MISSES_SPECIFIC_ROUTE_UPDATES], [1],
2110         [need to recreate sockets on changed routing?])
2111 esac
2112
2113 AC_CACHE_CHECK(
2114     [if the wildcard socket needs REUSEADDR to bind other addresses],
2115     [ntp_cv_os_wildcardreuse],
2116     [
2117         case "$host" in
2118          *-*-*linux*)
2119             ans=yes
2120             ;;
2121          *) ans=no
2122             ;;
2123         esac
2124         ntp_cv_os_wildcardreuse=$ans
2125     ]
2126 )
2127 case "$ntp_cv_os_wildcardreuse" in
2128  yes)
2129     AC_DEFINE([OS_NEEDS_REUSEADDR_FOR_IFADDRBIND], [1],
2130         [wildcard socket needs REUSEADDR to bind interface addresses])
2131 esac
2132
2133 AC_MSG_CHECKING([if we'll use clock_settime or settimeofday or stime])
2134 ntp_warning='GRONK'
2135 ans=none
2136 case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
2137  yes*)
2138     ntp_warning=''
2139     ans='clock_settime()'
2140     ;;
2141  noyes*)
2142     ntp_warning='But clock_settime() would be better (if we had it)'
2143     ans='settimeofday()'
2144     ;;
2145  nonoyes)
2146     ntp_warning='Which is the worst of the three'
2147     ans='stime()'
2148     ;;
2149  *) 
2150     case "$build" in
2151      $host) 
2152         ntp_warning='Which leaves us with nothing to use!'
2153     esac
2154 esac
2155 AC_MSG_RESULT([$ans])
2156 case "$ntp_warning" in
2157  '')
2158     ;;
2159  *)
2160     AC_MSG_WARN([*** $ntp_warning ***])
2161     ;;
2162 esac
2163
2164 AC_CACHE_CHECK(
2165     [for SIGIO],
2166     [ntp_cv_hdr_def_sigio],
2167     [AC_EGREP_CPP(
2168         [yes],
2169         [
2170             #include <signal.h>
2171
2172             #ifdef SIGIO
2173                 yes
2174             #endif
2175         ],
2176         [ntp_cv_hdr_def_sigio=yes],
2177         [ntp_cv_hdr_def_sigio=no]
2178     )]
2179  )
2180
2181 dnl Override those system that have a losing SIGIO
2182 AC_CACHE_CHECK(
2183     [if we want to use signalled IO],
2184     [ntp_cv_var_signalled_io],
2185     [
2186         ans=no
2187         case "$ntp_cv_hdr_def_sigio" in
2188          yes)
2189             ans=yes
2190             case "$host" in
2191              alpha*-dec-osf4*|alpha*-dec-osf5*)
2192                 ans=no
2193                 ;;
2194              *-convex-*)
2195                 ans=no
2196                 ;;
2197              *-dec-*)
2198                 ans=no
2199                 ;;
2200              *-pc-cygwin*)
2201                 ans=no
2202                 ;;
2203              *-sni-sysv*)
2204                 ans=no
2205                 ;;
2206              *-univel-sysv*)
2207                 ans=no
2208                 ;;
2209              *-*-irix6*)
2210                 ans=no
2211                 ;;
2212              *-*-freebsd*)
2213                 ans=no
2214                 ;;
2215              *-*-*linux*)
2216                 ans=no
2217                 ;;
2218              *-*-unicosmp*)
2219                 ans=no
2220                 ;;
2221              *-*-kfreebsd*)
2222                 ans=no
2223                 ;;
2224              m68k-*-mint*)
2225                 ans=no
2226                 ;;
2227             esac
2228             ;;
2229         esac
2230         ntp_cv_var_signalled_io=$ans
2231     ]
2232 )
2233 case "$ntp_cv_var_signalled_io" in
2234  yes)
2235     AC_DEFINE([HAVE_SIGNALED_IO], [1],
2236         [Can we use SIGIO for tcp and udp IO?])
2237 esac
2238
2239 AC_CACHE_CHECK(
2240     [for SIGPOLL],
2241     [ntp_cv_hdr_def_sigpoll],
2242     [AC_EGREP_CPP(
2243         [yes],
2244         [
2245             #include <signal.h>
2246             
2247             #ifdef SIGPOLL
2248                 yes
2249             #endif
2250         ],
2251         [ntp_cv_hdr_def_sigpoll=yes],
2252         [ntp_cv_hdr_def_sigpoll=no]
2253     )]
2254 )
2255
2256 AC_CACHE_CHECK(
2257     [for SIGSYS],
2258     [ntp_cv_hdr_def_sigsys],
2259     [AC_EGREP_CPP(
2260         [yes],
2261         [
2262             #include <signal.h>
2263
2264             #ifdef SIGSYS
2265                 yes
2266             #endif
2267         ],
2268         [ntp_cv_hdr_def_sigsys=yes],
2269         [ntp_cv_hdr_def_sigsys=no]
2270     )]
2271 )
2272
2273 AC_CACHE_CHECK(
2274     [if we can use SIGPOLL for UDP I/O],
2275     [ntp_cv_var_use_udp_sigpoll],
2276     [
2277         ans=no
2278         case "$ntp_cv_hdr_def_sigpoll" in
2279          yes)
2280             case "$host" in
2281              mips-sgi-irix*)
2282                 ans=no
2283                 ;;
2284              vax-dec-bsd)
2285                 ans=no
2286                 ;;
2287              *-pc-cygwin*)
2288                 ans=no
2289                 ;;
2290              *-sni-sysv*)
2291                 ans=no
2292                 ;;
2293              *-*-aix[[456]]*)
2294                 ans=no
2295                 ;;
2296              *-*-hpux*)
2297                 ans=no
2298                 ;;
2299              *-*-*linux*)
2300                 ans=no
2301                 ;;
2302              *-*-osf*)
2303                 ans=no
2304                 ;;
2305              *-*-qnx*)
2306                 ans=no
2307                 ;;
2308              *-*-sunos*)
2309                 ans=no
2310                 ;;
2311              *-*-solaris*)
2312                 ans=no
2313                 ;;
2314              *-*-ultrix*)
2315                 ans=no
2316                 ;;
2317              *-*-unicosmp*)
2318                 ans=no
2319                 ;;
2320              *-*-kfreebsd*)
2321                 ans=no
2322                 ;;
2323              *) ans=yes
2324                 ;;
2325             esac
2326             ;;
2327         esac
2328         ntp_cv_var_use_udp_sigpoll=$ans
2329     ]
2330 )
2331 case "$ntp_cv_var_use_udp_sigpoll" in
2332  yes)
2333     AC_DEFINE([USE_UDP_SIGPOLL], [1], [Can we use SIGPOLL for UDP?])
2334 esac
2335
2336 AC_CACHE_CHECK(
2337     [if we can use SIGPOLL for TTY I/O],
2338     [ntp_cv_var_use_tty_sigpoll],
2339     [
2340         ans=no
2341         case "$ntp_cv_hdr_def_sigpoll" in
2342          yes)
2343             case "$host" in
2344              mips-sgi-irix*)
2345                 ans=no
2346                 ;;
2347              vax-dec-bsd)
2348                 ans=no
2349                 ;;
2350              *-pc-cygwin*)
2351                 ans=no
2352                 ;;
2353              *-sni-sysv*)
2354                 ans=no
2355                 ;;
2356              *-*-aix[[456]]*)
2357                 ans=no
2358                 ;;
2359              *-*-hpux*)
2360                 ans=no
2361                 ;;
2362              *-*-*linux*)
2363                 ans=no
2364                 ;;
2365              *-*-osf*)
2366                 ans=no
2367                 ;;
2368              *-*-sunos*)
2369                 ans=no
2370                 ;;
2371              *-*-ultrix*)
2372                 ans=no
2373                 ;;
2374              *-*-qnx*)
2375                 ans=no
2376                 ;;
2377              *-*-unicosmp*)
2378                 ans=no
2379                 ;;
2380              *-*-kfreebsd*)
2381                 ans=no
2382                 ;;
2383              *) ans=yes
2384                 ;;
2385             esac
2386             ;;
2387         esac
2388         ntp_cv_var_use_tty_sigpoll=$ans
2389     ]
2390 )
2391 case "$ntp_cv_var_use_tty_sigpoll" in
2392  yes)
2393     AC_DEFINE([USE_TTY_SIGPOLL], [1], [Can we use SIGPOLL for tty IO?])
2394 esac
2395
2396 case "$host" in
2397  *-*-aix*)
2398     AC_DEFINE([NLIST_EXTRA_INDIRECTION], [1],
2399         [Might nlist() values require an extra level of indirection (AIX)?])
2400 esac
2401
2402 AC_CACHE_CHECK(
2403     [for a minimum recommended value of tickadj],
2404     [ntp_cv_var_min_rec_tickadj],
2405     [
2406         ans=no
2407         case "$host" in
2408          *-*-aix*)
2409             ans=40
2410             ;;
2411         esac
2412         ntp_cv_var_min_rec_tickadj=$ans
2413     ]
2414 )
2415 case "$ntp_cv_var_min_rec_tickadj" in
2416  ''|no)
2417     ;;
2418  *)
2419     AC_DEFINE_UNQUOTED([MIN_REC_TICKADJ], [$ntp_cv_var_min_rec_tickadj],
2420         [Should we recommend a minimum value for tickadj?])
2421 esac
2422
2423 AC_CACHE_CHECK(
2424     [if the TTY code permits PARENB and IGNPAR],
2425     [ntp_cv_no_parenb_ignpar],
2426     [
2427         ans=no
2428         case "$host" in
2429          i?86-*-*linux*)
2430             ans=yes
2431             ;;
2432          mips-sgi-irix*)
2433             ans=yes
2434             ;;
2435          i?86-*-freebsd[[123]].*)
2436             ;;
2437          i?86-*-freebsd*)
2438             ans=yes
2439             ;;
2440          *-*-unicosmp*)
2441             ans=yes
2442             ;;
2443         esac
2444         ntp_cv_no_parenb_ignpar=$ans
2445     ]
2446 )
2447 case "$ntp_cv_no_parenb_ignpar" in
2448  yes)
2449     AC_DEFINE([NO_PARENB_IGNPAR], [1],
2450         [Is there a problem using PARENB and IGNPAR?])
2451 esac
2452
2453 AC_MSG_CHECKING([if we're including ntpd debugging code])
2454 AC_ARG_ENABLE(
2455     [debugging],
2456     [AS_HELP_STRING(
2457         [--enable-debugging],
2458         [+ include ntpd debugging code]
2459     )],
2460     [ntp_ok=$enableval],
2461     [ntp_ok=yes]
2462 )
2463 case "$ntp_ok" in
2464  yes)
2465     AC_DEFINE([DEBUG], [1], [Enable ntpd debugging code?])
2466 esac
2467 AC_MSG_RESULT([$ntp_ok])
2468
2469 AC_MSG_CHECKING([if we're including processing time debugging code])
2470 AC_ARG_ENABLE(
2471     [debug-timing],
2472     [AS_HELP_STRING(
2473         [--enable-debug-timing],
2474         [- include processing time debugging code (costs performance)]
2475     )],
2476     [ntp_ok=$enableval],
2477     [ntp_ok=no]
2478 )
2479 case "$ntp_ok" in
2480  yes)
2481     AC_DEFINE([DEBUG_TIMING], [1], [Enable processing time debugging?])
2482 esac
2483 AC_MSG_RESULT([$ntp_ok])
2484
2485 AC_MSG_CHECKING([for a the number of minutes in a DST adjustment])
2486 AC_ARG_ENABLE(
2487     [dst-minutes],
2488     [AS_HELP_STRING(
2489         [--enable-dst-minutes],
2490         [n minutes per DST adjustment @<:@60@:>@])   dnl @<:@ is [, @:>@ is ]
2491     ],
2492     [ans=$enableval],
2493     [ans=60]
2494 )
2495 AC_DEFINE_UNQUOTED([DSTMINUTES], [$ans],
2496     [The number of minutes in a DST adjustment])
2497 AC_MSG_RESULT([$ans])
2498
2499 AC_MSG_CHECKING([if ntpd will retry permanent DNS failures])
2500 AC_ARG_ENABLE(
2501     [ignore-dns-errors],
2502     [AS_HELP_STRING(
2503         [--enable-ignore-dns-errors], 
2504         [- retry DNS queries on any error]
2505     )],
2506     [ans=$enableval],
2507     [ans=no]
2508 )
2509 case "$ans" in
2510  yes)
2511     AC_DEFINE([IGNORE_DNS_ERRORS], [1],
2512         [Retry queries on _any_ DNS error?])
2513 esac
2514 AC_MSG_RESULT([$ans])
2515
2516 AC_MSG_CHECKING([if ntpd will use the deferred DNS lookup path])
2517 AC_ARG_ENABLE(
2518     [force-defer-DNS],
2519     [AS_HELP_STRING(
2520         [--enable-force-defer-DNS],
2521         [- force all DNS lookups to take the deferred path]
2522     )],
2523     [ans=$enableval],
2524     [ans=no]
2525 )
2526 case "$ans" in
2527  yes)
2528     AC_DEFINE([FORCE_DEFER_DNS], [1], [Force deferred DNS lookups?])
2529 esac
2530 AC_MSG_RESULT([$ans])
2531
2532 case "$ac_cv_header_sys_sio_h" in
2533  yes)
2534     AC_CACHE_CHECK(
2535         [sys/sio.h for TIOCDCDTIMESTAMP],
2536         [ntp_cv_hdr_def_tiocdcdtimestamp],
2537         [AC_EGREP_CPP(
2538             [yes],
2539             [
2540                 #include <sys/sio.h>
2541
2542                 #ifdef TIOCDCDTIMESTAMP
2543                     yes
2544                 #endif
2545             ],
2546             [ntp_cv_hdr_def_tiocdcdtimestamp=yes],
2547             [ntp_cv_hdr_def_tiocdcdtimestamp=no]
2548         )]
2549     )
2550 esac
2551
2552 AC_CACHE_CHECK(
2553     [if we have the tty_clk line discipline/streams module],
2554     [ntp_cv_tty_clk],
2555     [
2556         case "$ac_cv_header_sys_clkdefs_h$ntp_cv_hdr_def_tiocdcdtimestamp" in
2557          *yes*)
2558             ntp_cv_tty_clk=yes
2559             ;;
2560          *)
2561             ntp_cv_tty_clk=no
2562             ;;
2563         esac
2564     ]
2565 )
2566 case "$ntp_cv_tty_clk" in
2567  yes)
2568     AC_DEFINE([TTYCLK], [1],
2569         [Do we have the tty_clk line discipline/streams module?])
2570 esac
2571
2572 AC_MSG_CHECKING([for the ppsclock streams module])
2573 case "$ntp_cv_struct_ppsclockev" in
2574  yes)
2575     ans=yes
2576     AC_DEFINE([PPS], [1],
2577         [Do we have the ppsclock streams module?])
2578     ;;
2579  *)
2580     ans=no
2581 esac
2582 AC_MSG_RESULT([$ans])
2583
2584 AC_CACHE_CHECK(
2585     [for multicast IP support],
2586     [ntp_cv_multicast],
2587     [
2588         ntp_cv_multicast=no
2589         case "$host" in
2590          i386-sequent-sysv4)
2591             ;;
2592          *)
2593             AC_COMPILE_IFELSE(
2594                 [AC_LANG_PROGRAM(
2595                     [[
2596                         #ifdef HAVE_NETINET_IN_H
2597                         #include <netinet/in.h>
2598                         #endif
2599                     ]],
2600                     [[
2601                         struct ip_mreq ipmr;
2602                         ipmr.imr_interface.s_addr = 0;
2603                     ]]
2604                 )],
2605                 [ntp_cv_multicast=yes],
2606                 []
2607             )
2608         esac
2609     ]
2610 )
2611 case "$ntp_cv_multicast" in
2612  yes)
2613     AC_DEFINE([MCAST], [1], [Does the target support multicast IP?])
2614     AC_CACHE_CHECK(
2615         [arg type needed for setsockopt() IP*_MULTICAST_LOOP],
2616         [ntp_cv_typeof_ip_multicast_loop],
2617         [
2618             case "$host" in
2619              *-*-netbsd*|*-*-*linux*)
2620                 ntp_cv_typeof_ip_multicast_loop=u_int
2621                 ;;
2622              *)
2623                 ntp_cv_typeof_ip_multicast_loop=u_char
2624             esac
2625         ]
2626     )
2627     AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
2628         [$ntp_cv_typeof_ip_multicast_loop],
2629         [What type to use for setsockopt])
2630 esac
2631
2632 AC_CACHE_CHECK(
2633     [availability of ntp_{adj,get}time()],
2634     [ntp_cv_var_ntp_syscalls],
2635     [
2636         ntp_cv_var_ntp_syscalls=no
2637         case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
2638          yesyes*)
2639             ntp_cv_var_ntp_syscalls=libc
2640             ;;
2641          *yes)
2642             ntp_cv_var_ntp_syscalls=inline
2643             ;;
2644          *) 
2645             AC_EGREP_CPP(
2646                 [yes],
2647                 [
2648                     #include <sys/syscall.h>
2649                     
2650                     #if defined(SYS_ntp_gettime) && defined(SYS_ntp_adjtime)
2651                         yes
2652                     #endif
2653                 ],
2654                 [ntp_cv_var_ntp_syscalls=kernel]
2655             )
2656             ;;
2657          esac
2658     ]
2659 )
2660 case "$ntp_cv_var_ntp_syscalls" in
2661  libc)
2662     AC_DEFINE([NTP_SYSCALLS_LIBC], [1],
2663         [Do we have ntp_{adj,get}time in libc?])
2664     ;;
2665  kernel)
2666     AC_DEFINE([NTP_SYSCALLS_STD], [1],
2667         [Do we have ntp_{adj,get}time in the kernel?])
2668     ;;
2669 esac
2670
2671 AC_CACHE_CHECK(
2672     [if sys/timex.h has STA_FLL],
2673     [ntp_cv_var_sta_fll],
2674     [AC_EGREP_CPP(
2675         [yes],
2676         [
2677             #include <sys/timex.h>
2678
2679             #ifdef STA_FLL
2680                 yes
2681             #endif
2682         ],
2683         [ntp_cv_var_sta_fll=yes],
2684         [ntp_cv_var_sta_fll=no]
2685     )]
2686 )
2687
2688 AC_CACHE_CHECK(
2689     [if we have kernel PLL support],
2690     [ntp_cv_var_kernel_pll],
2691     [dnl ntp_cv_var_ntp_syscalls is {no,libc,kernel}
2692         case "$ac_cv_header_sys_timex_h$ntp_cv_struct_ntptimeval$ntp_cv_var_sta_fll$ntp_cv_var_ntp_syscalls" in
2693          *no*)
2694             ntp_cv_var_kernel_pll=no
2695             ;;
2696          *) ntp_cv_var_kernel_pll=yes
2697             ;;
2698         esac
2699     ]
2700 )
2701 case "$ntp_cv_var_kernel_pll" in
2702  yes)
2703     AC_DEFINE([KERNEL_PLL], [1],
2704         [Does the kernel support precision time discipline?])
2705 esac
2706
2707 AC_CACHE_CHECK(
2708     [if SIOCGIFCONF returns buffer size in the buffer],
2709     [ntp_cv_size_returned_in_buffer],
2710     [
2711         ans=no
2712         case "$host" in
2713          *-fujitsu-uxp*)
2714             ans=yes
2715             ;;
2716          *-ncr-sysv4*)
2717             ans=yes
2718             ;;
2719          *-univel-sysv*)
2720             ans=yes
2721             ;;
2722         esac
2723         ntp_cv_size_returned_in_buffer=$ans
2724     ]
2725 )
2726 case "$ntp_cv_size_returned_in_buffer" in
2727  yes)
2728     AC_DEFINE([SIZE_RETURNED_IN_BUFFER], [1],
2729         [Does SIOCGIFCONF return size in the buffer?])
2730 esac
2731
2732 # Check for ioctls TIOCGPPSEV
2733 AC_MSG_CHECKING([for TTY PPS ioctl TIOCGPPSEV])
2734 case "$ac_cv_header_termios_h" in
2735  yes)
2736     AC_EGREP_CPP(
2737         [yes],
2738         [
2739             #include <termios.h>
2740
2741             #ifdef TIOCGPPSEV
2742                 yes
2743             #endif
2744         ],
2745         [ntp_ok=yes],
2746         [ntp_ok=no]
2747     )
2748     ;;
2749  *)
2750     ntp_ok=no
2751     ;;
2752 esac
2753 case "$ntp_ok" in
2754  yes)
2755     AC_DEFINE([HAVE_TIOCGPPSEV], [1],
2756         [Do we have the TIOCGPPSEV ioctl (Solaris)?])
2757 esac
2758 AC_MSG_RESULT([$ntp_ok])
2759
2760 # Check for ioctls TIOCSPPS
2761 AC_MSG_CHECKING([for TTY PPS ioctl TIOCSPPS])
2762 case "$ac_cv_header_termios_h" in
2763  yes)
2764     AC_EGREP_CPP(
2765         [yes],
2766         [
2767             #include <termios.h>
2768
2769             #ifdef TIOCSPPS
2770                 yes
2771             #endif
2772          ],
2773          [ntp_ok=yes],
2774          [ntp_ok=no]
2775     )
2776     ;;
2777  *)
2778     ntp_ok=no
2779     ;;
2780 esac
2781 case "$ntp_ok" in
2782  yes)
2783     AC_DEFINE([HAVE_TIOCSPPS], [1],
2784         [Do we have the TIOCSPPS ioctl (Solaris)?])
2785 esac
2786 AC_MSG_RESULT([$ntp_ok])
2787
2788 # Check for ioctls CIOGETEV
2789 AC_MSG_CHECKING([for TTY PPS ioctl CIOGETEV])
2790 case "$ac_cv_header_sys_ppsclock_h" in
2791  yes)
2792     AC_EGREP_CPP(
2793         [yes],
2794         [
2795             #include <sys/ppsclock.h>
2796
2797             #ifdef CIOGETEV
2798                 yes
2799             #endif
2800         ],
2801         [ntp_ok=yes],
2802         [ntp_ok=no]
2803     )
2804     ;;
2805  *)
2806     ntp_ok=no
2807     ;;
2808 esac
2809 case "$ntp_ok" in
2810  yes)
2811     AC_DEFINE([HAVE_CIOGETEV], [1],
2812         [Do we have the CIOGETEV ioctl (SunOS, Linux)?])
2813 esac
2814 AC_MSG_RESULT([$ntp_ok])
2815
2816 # ATOM/PPSAPI stuff.
2817
2818 ntp_atom_ok=yes
2819
2820 # Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
2821
2822 # The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
2823 # The PPSAPI needs struct timespec.
2824 # The PPSAPI also needs a timepps header.
2825
2826 case "$ac_cv_c_inline$ntp_cv_struct_timespec" in
2827  inlineyes)
2828     case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
2829      *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
2830         AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
2831         ntp_jupiter_ok=yes
2832         ntp_oncore_ok=yes
2833         ntp_parse_ok=yes
2834         ntp_ripe_ncc_ok=yes
2835         ;;
2836     esac
2837     ;;
2838 esac
2839
2840 # Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
2841 AC_CHECK_HEADER([linux/serial.h])
2842 case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
2843   yesyes)
2844     AC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
2845     AC_EGREP_CPP(
2846         [yes],
2847         [
2848             #include <sys/time.h>
2849             typedef int u_int;
2850             #include <sys/ppsclock.h>
2851             #include <linux/serial.h>
2852
2853             #ifdef TIOCGSERIAL
2854             #ifdef TIOCSSERIAL
2855             #ifdef ASYNC_PPS_CD_POS
2856             #ifdef ASYNC_PPS_CD_NEG
2857             #ifdef CIOGETEV
2858                  yes
2859             #endif
2860             #endif
2861             #endif
2862             #endif
2863             #endif
2864         ],
2865         [ntp_ok=yes],
2866         [ntp_ok=no]
2867     )
2868     AC_MSG_RESULT([$ntp_ok])
2869     ;;
2870   *)
2871     ntp_ok=no
2872     ;;
2873 esac
2874 case "$ntp_ok" in
2875  yes)
2876     AC_DEFINE([HAVE_TIO_SERIAL_STUFF], 1,
2877         [Do we have the TIO serial stuff?])
2878 esac
2879
2880 # Check for SHMEM_STATUS support
2881 AC_MSG_CHECKING([SHMEM_STATUS support])
2882 case "$ac_cv_header_sys_mman_h" in
2883  yes)
2884     ntp_ok=yes
2885     ;;
2886  *)
2887     ntp_ok=no
2888     ;;
2889 esac
2890 case "$ntp_ok" in
2891  yes)
2892     AC_DEFINE([ONCORE_SHMEM_STATUS], [1],
2893         [Do we have support for SHMEM_STATUS?])
2894 esac
2895 AC_MSG_RESULT([$ntp_ok])
2896
2897 ntp_refclock=no
2898
2899 # HPUX only, and by explicit request
2900 AC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
2901 AC_ARG_ENABLE(
2902     [BANCOMM],
2903     [AS_HELP_STRING(
2904         [--enable-BANCOMM], 
2905         [- Datum/Bancomm bc635/VME interface]
2906     )],
2907     [ntp_ok=$enableval],
2908     [ntp_ok=no]
2909 )
2910 if test "$ntp_ok" = "yes"; then
2911     ntp_refclock=yes
2912     AC_DEFINE([CLOCK_BANC], [1], [Datum/Bancomm bc635/VME interface?])
2913 fi
2914 AC_MSG_RESULT([$ntp_ok])
2915 case "$ntp_ok$host" in
2916  yes*-*-hpux*) ;;
2917  yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2918 esac
2919
2920 #HPUX only, and only by explicit request
2921 AC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
2922 AC_ARG_ENABLE(
2923     [GPSVME],
2924     [AS_HELP_STRING(
2925         [--enable-GPSVME],
2926         [- TrueTime GPS receiver/VME interface]
2927     )],
2928     [ntp_ok=$enableval],
2929     [ntp_ok=no]
2930 )
2931 if test "$ntp_ok" = "yes"; then
2932     ntp_refclock=yes
2933     AC_DEFINE([CLOCK_GPSVME], 1, [TrueTime GPS receiver/VME interface?])
2934 fi
2935 AC_MSG_RESULT([$ntp_ok])
2936 case "$ntp_ok$host" in
2937  yes*-*-hpux*) ;;
2938  yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2939 esac
2940
2941 AC_MSG_CHECKING([for PCL720 clock support])
2942 case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
2943  yesyesyes)
2944     AC_DEFINE([CLOCK_PPS720], 1, [PCL 720 clock support])
2945     ans=yes
2946     ;;
2947  *)
2948     ans=no
2949     ;;
2950 esac
2951 AC_MSG_RESULT([$ans])
2952
2953 AC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
2954 AC_ARG_ENABLE(
2955     [all-clocks],
2956     [AS_HELP_STRING(
2957         [--enable-all-clocks],
2958         [+ include all suitable non-PARSE clocks:]
2959     )],
2960     [ntp_eac=$enableval],
2961     [ntp_eac=yes]
2962 )
2963 AC_MSG_RESULT([$ntp_eac])
2964
2965 # HMS: Should we also require ntp_parse_ok?
2966 AC_MSG_CHECKING([if we have support for PARSE clocks])
2967 case "$ntp_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
2968  yes*yes*)
2969     ntp_canparse=yes
2970     ;;
2971  *) ntp_canparse=no
2972     ;;
2973 esac
2974 AC_MSG_RESULT([$ntp_canparse])
2975
2976 AC_MSG_CHECKING([if we have support for audio clocks])
2977 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
2978  *yes*)
2979     ntp_canaudio=yes
2980     AC_DEFINE([HAVE_AUDIO], [], [Do we have audio support?])
2981     ;;
2982  *) ntp_canaudio=no ;;
2983 esac
2984 AC_MSG_RESULT([$ntp_canaudio])
2985
2986 AC_MSG_CHECKING([if we have support for the SHM refclock interface])
2987 case "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
2988  yesyes)
2989     ntp_canshm=yes
2990     ;;
2991  *) ntp_canshm=no ;;
2992 esac
2993 AC_MSG_RESULT([$ntp_canshm])
2994
2995 # Test for termios TIOCMBIS modem control (ACTS, Heath, Palisade)
2996 AC_CACHE_CHECK(
2997     [for termios modem control],
2998     [ntp_cv_modem_control],
2999     [AC_COMPILE_IFELSE(
3000         [AC_LANG_PROGRAM(
3001             [[
3002                 #ifdef HAVE_UNISTD_H
3003                 # include <unistd.h>
3004                 #endif
3005                 #ifdef HAVE_TERMIOS_H
3006                 # include <termios.h>
3007                 #endif
3008                 #ifdef HAVE_SYS_IOCTL_H
3009                 # include <sys/ioctl.h>
3010                 #endif
3011             ]],
3012             [[
3013                 int     dtr = TIOCM_DTR;
3014                 
3015                 ioctl(1, TIOCMBIS, (char *)&dtr);
3016             ]]
3017         )],
3018         [ntp_cv_modem_control=yes],
3019         [ntp_cv_modem_control=no]
3020     )]
3021 )
3022 case "$ntp_eac::$ntp_cv_modem_control" in
3023  yes::yes)
3024     ntp_enable_all_modem_control_clocks=yes
3025     ;;
3026  *)
3027     ntp_enable_all_modem_control_clocks=no
3028     ;;
3029 esac
3030
3031 # Requires modem control
3032 AC_MSG_CHECKING([ACTS modem service])
3033 AC_ARG_ENABLE(
3034     [ACTS],
3035     [AS_HELP_STRING(
3036         [--enable-ACTS],
3037         [s ACTS modem service]
3038     )],
3039     [ntp_ok=$enableval],
3040     [ntp_ok=$ntp_enable_all_modem_control_clocks]
3041 )
3042 if test "$ntp_ok" = "yes"; then
3043     ntp_refclock=yes
3044     AC_DEFINE([CLOCK_ACTS], [1], [ACTS modem service])
3045 fi
3046 AC_MSG_RESULT([$ntp_ok])
3047
3048 AC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
3049 AC_ARG_ENABLE(
3050     [ARBITER],
3051     [AS_HELP_STRING(
3052         [--enable-ARBITER],
3053         [+ Arbiter 1088A/B GPS receiver]
3054     )],
3055     [ntp_ok=$enableval],
3056     [ntp_ok=$ntp_eac]
3057 )
3058 if test "$ntp_ok" = "yes"; then
3059     ntp_refclock=yes
3060     AC_DEFINE([CLOCK_ARBITER], [1], [Arbiter 1088A/B GPS receiver])
3061 fi
3062 AC_MSG_RESULT([$ntp_ok])
3063
3064 AC_MSG_CHECKING([Arcron MSF receiver])
3065 AC_ARG_ENABLE(
3066     [ARCRON_MSF],
3067     [AS_HELP_STRING(
3068         [--enable-ARCRON-MSF], 
3069         [+ Arcron MSF receiver]
3070     )],
3071     [ntp_ok=$enableval],
3072     [ntp_ok=$ntp_eac]
3073 )
3074 if test "$ntp_ok" = "yes"; then
3075     ntp_refclock=yes
3076     AC_DEFINE([CLOCK_ARCRON_MSF], [1], [ARCRON support?])
3077 fi
3078 AC_MSG_RESULT([$ntp_ok])
3079
3080 AC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
3081 AC_ARG_ENABLE(
3082     [AS2201],
3083     [AS_HELP_STRING(
3084         [--enable-AS2201],
3085         [+ Austron 2200A/2201A GPS receiver]
3086     )],
3087     [ntp_ok=$enableval],
3088     [ntp_ok=$ntp_eac]
3089 )
3090 if test "$ntp_ok" = "yes"; then
3091     ntp_refclock=yes
3092     AC_DEFINE([CLOCK_AS2201], [1], [Austron 2200A/2201A GPS receiver?])
3093 fi
3094 AC_MSG_RESULT([$ntp_ok])
3095
3096 AC_MSG_CHECKING([ATOM PPS interface])
3097 AC_ARG_ENABLE(
3098     [ATOM],
3099     [AS_HELP_STRING(
3100         [--enable-ATOM],
3101         [s ATOM PPS interface]
3102     )],
3103     [ntp_ok=$enableval],
3104     [ntp_ok=$ntp_eac]
3105 )
3106 case "$ntp_atom_ok" in
3107  no) ntp_ok=no ;;
3108 esac
3109 if test "$ntp_ok" = "yes"; then
3110     ntp_refclock=yes
3111     AC_DEFINE([CLOCK_ATOM], [1], [PPS interface?])
3112 fi
3113 AC_MSG_RESULT([$ntp_ok])
3114
3115 AC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
3116 AC_ARG_ENABLE(
3117     [CHRONOLOG],
3118     [AS_HELP_STRING(
3119         [--enable-CHRONOLOG],
3120         [+ Chrono-log K-series WWVB receiver]
3121     )],
3122     [ntp_ok=$enableval],
3123     [ntp_ok=$ntp_eac]
3124 )
3125 if test "$ntp_ok" = "yes"; then
3126     ntp_refclock=yes
3127     AC_DEFINE([CLOCK_CHRONOLOG], [1], [Chronolog K-series WWVB receiver?])
3128 fi
3129 AC_MSG_RESULT([$ntp_ok])
3130
3131 AC_MSG_CHECKING([CHU modem/decoder])
3132 AC_ARG_ENABLE(
3133     [CHU],
3134     [AS_HELP_STRING(
3135         [--enable-CHU],
3136         [+ CHU modem/decoder]
3137     )],
3138     [ntp_ok=$enableval],
3139     [ntp_ok=$ntp_eac]
3140 )
3141 if test "$ntp_ok" = "yes"; then
3142     ntp_refclock=yes
3143     AC_DEFINE([CLOCK_CHU], [1], [CHU modem/decoder])
3144 fi
3145 AC_MSG_RESULT([$ntp_ok])
3146 ntp_refclock_chu=$ntp_ok
3147
3148 AC_MSG_CHECKING([CHU audio/decoder])
3149 AC_ARG_ENABLE(
3150     [AUDIO-CHU],
3151     [AS_HELP_STRING(
3152         [--enable-AUDIO-CHU],
3153         [s CHU audio/decoder]
3154     )],
3155     [ntp_ok=$enableval],
3156     [
3157         case "$ntp_eac$ntp_refclock_chu$ntp_canaudio" in
3158          *no*)  ntp_ok=no  ;;
3159          *)     ntp_ok=yes ;;
3160         esac
3161     ]
3162 )
3163 if test "$ntp_ok" = "yes"; then
3164     AC_DEFINE([AUDIO_CHU], [1], [CHU audio/decoder?])
3165 fi
3166 AC_MSG_RESULT([$ntp_ok])
3167 # We used to check for sunos/solaris target...
3168 case "$ntp_ok$ntp_refclock_chu$ntp_canaudio" in
3169  yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***])
3170 esac
3171
3172 # Not under HP-UX
3173 AC_MSG_CHECKING([Datum Programmable Time System])
3174 AC_ARG_ENABLE(
3175     [DATUM],
3176     [AS_HELP_STRING(
3177         [--enable-DATUM],
3178         [s Datum Programmable Time System]
3179     )],
3180     [ntp_ok=$enableval],
3181     [
3182         case "$ac_cv_header_termios_h" in
3183          yes)
3184             ntp_ok=$ntp_eac
3185             ;;
3186          *) ntp_ok=no
3187             ;;
3188         esac
3189     ]
3190 )
3191 if test "$ntp_ok" = "yes"; then
3192     ntp_refclock=yes
3193     AC_DEFINE([CLOCK_DATUM], [1], [Datum Programmable Time System?])
3194 fi
3195 AC_MSG_RESULT([$ntp_ok])
3196
3197 AC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
3198 AC_ARG_ENABLE(
3199     [DUMBCLOCK],
3200     [AS_HELP_STRING(
3201         [--enable-DUMBCLOCK],
3202         [+ Dumb generic hh:mm:ss local clock]
3203     )],
3204     [ntp_ok=$enableval],
3205     [ntp_ok=$ntp_eac]
3206 )
3207 if test "$ntp_ok" = "yes"; then
3208     ntp_refclock=yes
3209     AC_DEFINE([CLOCK_DUMBCLOCK], [1], [Dumb generic hh:mm:ss local clock?])
3210 fi
3211 AC_MSG_RESULT([$ntp_ok])
3212
3213 AC_MSG_CHECKING([Forum Graphic GPS])
3214 AC_ARG_ENABLE(
3215     [FG],
3216     [AS_HELP_STRING(
3217         [--enable-FG],
3218         [+ Forum Graphic GPS]
3219     )],
3220     [ntp_ok=$enableval],
3221     [ntp_ok=$ntp_eac]
3222 )
3223 if test "$ntp_ok" = "yes"; then
3224     ntp_refclock=yes
3225     AC_DEFINE([CLOCK_FG], [1], [Forum Graphic GPS datating station driver?])
3226 fi
3227 AC_MSG_RESULT([$ntp_ok])
3228
3229 # Requires modem control
3230 AC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
3231 AC_ARG_ENABLE(
3232     [HEATH],
3233     [AS_HELP_STRING(
3234         [--enable-HEATH],
3235         [s Heath GC-1000 WWV/WWVH receiver]
3236     )],
3237     [ntp_ok=$enableval],
3238     [ntp_ok=$ntp_enable_all_modem_control_clocks]
3239 )
3240 if test "$ntp_ok" = "yes"; then
3241     ntp_refclock=yes
3242     AC_DEFINE([CLOCK_HEATH], [1], [Heath GC-1000 WWV/WWVH receiver?])
3243 fi
3244 AC_MSG_RESULT([$ntp_ok])
3245
3246 AC_MSG_CHECKING([for hopf serial clock device])
3247 AC_ARG_ENABLE(
3248     [HOPFSERIAL],
3249     [AS_HELP_STRING(
3250         [--enable-HOPFSERIAL],
3251         [+ hopf serial clock device]
3252     )],
3253     [ntp_ok=$enableval],
3254     [ntp_ok=$ntp_eac]
3255 )
3256 if test "$ntp_ok" = "yes"; then
3257     ntp_refclock=yes
3258     AC_DEFINE([CLOCK_HOPF_SERIAL], [1], [HOPF serial clock device?])
3259 fi
3260 AC_MSG_RESULT([$ntp_ok])
3261
3262 AC_MSG_CHECKING([for hopf PCI clock 6039])
3263 AC_ARG_ENABLE(
3264     [HOPFPCI],
3265     [AS_HELP_STRING(
3266         [--enable-HOPFPCI],
3267         [+ hopf 6039 PCI board]
3268     )],
3269     [ntp_ok=$enableval],
3270     [ntp_ok=$ntp_eac]
3271 )
3272 if test "$ntp_ok" = "yes"; then
3273     ntp_refclock=yes
3274     AC_DEFINE([CLOCK_HOPF_PCI], [1], [HOPF PCI clock device?])
3275 fi
3276 AC_MSG_RESULT([$ntp_ok])
3277
3278 AC_MSG_CHECKING([HP 58503A GPS receiver])
3279 AC_ARG_ENABLE(
3280     [HPGPS],
3281     [AS_HELP_STRING(
3282         [--enable-HPGPS],
3283         [+ HP 58503A GPS receiver]
3284     )],
3285     [ntp_ok=$enableval],
3286     [ntp_ok=$ntp_eac]
3287 )
3288 if test "$ntp_ok" = "yes"; then
3289     ntp_refclock=yes
3290     AC_DEFINE([CLOCK_HPGPS], 1, [HP 58503A GPS receiver?])
3291 fi
3292 AC_MSG_RESULT([$ntp_ok])
3293
3294 AC_MSG_CHECKING([IRIG audio decoder])
3295 AC_ARG_ENABLE(
3296     [IRIG],
3297     [AS_HELP_STRING(
3298         [--enable-IRIG],
3299         [s IRIG audio decoder]
3300     )],
3301     [ntp_ok=$enableval],
3302     [
3303         case "$ntp_eac$ntp_canaudio" in
3304          *no*)  ntp_ok=no  ;;
3305          *)     ntp_ok=yes ;;
3306         esac
3307     ]
3308 )
3309 if test "$ntp_ok" = "yes"; then
3310     ntp_refclock=yes
3311     AC_DEFINE([CLOCK_IRIG], [1], [IRIG audio decoder?])
3312 fi
3313 AC_MSG_RESULT([$ntp_ok])
3314 case "$ntp_ok$ntp_canaudio" in
3315  yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
3316 esac
3317
3318 AC_MSG_CHECKING([for JJY receiver])
3319 AC_ARG_ENABLE(
3320     [JJY],
3321     [AS_HELP_STRING(
3322         [--enable-JJY],
3323         [+ JJY receiver]
3324     )],
3325     [ntp_ok=$enableval],
3326     [ntp_ok=$ntp_eac]
3327 )
3328 if test "$ntp_ok" = "yes"; then
3329     ntp_refclock=yes
3330     AC_DEFINE([CLOCK_JJY], [1], [JJY receiver?])
3331 fi
3332 AC_MSG_RESULT([$ntp_ok])
3333
3334 AC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
3335 AC_ARG_ENABLE(
3336     [JUPITER],
3337     [AS_HELP_STRING(
3338         [--enable-JUPITER],
3339         [s Rockwell Jupiter GPS receiver]
3340     )],
3341     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
3342 case "$ntp_jupiter_ok" in
3343  no) ntp_ok=no ;;
3344 esac
3345 if test "$ntp_ok" = "yes"; then
3346     ntp_refclock=yes
3347     AC_DEFINE([CLOCK_JUPITER], [1], [Rockwell Jupiter GPS clock?])
3348 fi
3349 AC_MSG_RESULT([$ntp_ok])
3350
3351 AC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
3352 AC_ARG_ENABLE(
3353     [LEITCH],
3354     [AS_HELP_STRING(
3355         [--enable-LEITCH],
3356         [+ Leitch CSD 5300 Master Clock System Driver]
3357     )],
3358     [ntp_ok=$enableval],
3359     [ntp_ok=$ntp_eac]
3360 )
3361 if test "$ntp_ok" = "yes"; then
3362     ntp_refclock=yes
3363     AC_DEFINE([CLOCK_LEITCH], [1],
3364         [Leitch CSD 5300 Master Clock System Driver?])
3365 fi
3366 AC_MSG_RESULT([$ntp_ok])
3367
3368 AC_MSG_CHECKING([local clock reference])
3369 AC_ARG_ENABLE(
3370     [LOCAL-CLOCK],
3371     [AS_HELP_STRING(
3372         [--enable-LOCAL-CLOCK],
3373         [+ local clock reference]
3374     )],
3375     [ntp_ok=$enableval],
3376     [ntp_ok=$ntp_eac]
3377 )
3378 if test "$ntp_ok" = "yes"; then
3379     ntp_refclock=yes
3380     AC_DEFINE([CLOCK_LOCAL], [1], [local clock reference?])
3381 fi
3382 AC_MSG_RESULT([$ntp_ok])
3383
3384 dnl Bug 340: longstanding unfixed bugs
3385 dnl AC_MSG_CHECKING([EES M201 MSF receiver])
3386 dnl AC_ARG_ENABLE([MSFEES],
3387 dnl     [AS_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver])],
3388 dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
3389 dnl if test "$ntp_ok" = "yes"; then
3390 dnl     ntp_refclock=yes
3391 dnl     AC_DEFINE([CLOCK_MSFEES], [1], [EES M201 MSF receiver])
3392 dnl fi
3393 dnl AC_MSG_RESULT([$ntp_ok])
3394
3395 # Not Ultrix
3396 AC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
3397 AC_ARG_ENABLE(
3398     [MX4200],
3399     [AS_HELP_STRING(
3400         [--enable-MX4200 ],
3401         [s Magnavox MX4200 GPS receiver]
3402     )],
3403     [ntp_ok=$enableval],
3404     [
3405         case "$ac_cv_var_ppsclock" in
3406          yes)
3407             ntp_ok=$ntp_eac
3408             ;;
3409          *)
3410             ntp_ok=no
3411             ;;
3412         esac
3413     ]
3414 )
3415 if test "$ntp_ok" = "yes"; then
3416     ntp_refclock=yes
3417     AC_DEFINE([CLOCK_MX4200], [1], [Magnavox MX4200 GPS receiver])
3418 fi
3419 AC_MSG_RESULT([$ntp_ok])
3420 case "$ntp_ok$host" in
3421  yes*-*-ultrix*) AC_MSG_WARN([*** But the expected answer is... no ***])
3422 esac
3423
3424 AC_MSG_CHECKING([for NeoClock4X receiver])
3425 AC_ARG_ENABLE(
3426     [NEOCLOCK4X],
3427     [AS_HELP_STRING(
3428         [--enable-NEOCLOCK4X],
3429         [+ NeoClock4X DCF77 / TDF receiver]
3430     )],
3431     [ntp_ok=$enableval],
3432     [ntp_ok=$ntp_eac]
3433 )
3434 if test "$ntp_ok" = "yes"; then
3435     ntp_refclock=yes
3436     AC_DEFINE([CLOCK_NEOCLOCK4X], [1], [NeoClock4X])
3437 fi
3438 AC_MSG_RESULT([$ntp_ok])
3439
3440 AC_MSG_CHECKING([NMEA GPS receiver])
3441 AC_ARG_ENABLE(
3442     [NMEA],
3443     [AS_HELP_STRING(
3444         [--enable-NMEA],
3445         [+ NMEA GPS receiver]
3446     )],
3447     [ntp_ok=$enableval],
3448     [ntp_ok=$ntp_eac]
3449 )
3450 if test "$ntp_ok" = "yes"; then
3451     ntp_refclock=yes
3452     AC_DEFINE([CLOCK_NMEA], [1], [NMEA GPS receiver])
3453 fi
3454 AC_MSG_RESULT([$ntp_ok])
3455
3456 AC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
3457 AC_ARG_ENABLE(
3458     [ONCORE],
3459     [AS_HELP_STRING(
3460         [--enable-ONCORE],
3461         [s Motorola VP/UT Oncore GPS receiver]
3462     )],
3463     [ntp_ok=$enableval],
3464     [ntp_ok=$ntp_eac]
3465 )
3466 case "$ntp_oncore_ok" in
3467  no) ntp_ok=no ;;
3468 esac
3469 if test "$ntp_ok" = "yes"; then
3470     ntp_refclock=yes
3471     AC_DEFINE([CLOCK_ONCORE], 1, [Motorola UT Oncore GPS])
3472 fi
3473 AC_MSG_RESULT([$ntp_ok])
3474
3475 # Requires modem control
3476 AC_MSG_CHECKING([for Palisade clock])
3477 AC_ARG_ENABLE(
3478     [PALISADE],
3479     [AS_HELP_STRING(
3480         [--enable-PALISADE],
3481         [s Palisade clock]
3482     )],
3483     [ntp_ok=$enableval],
3484     [ntp_ok=$ntp_enable_all_modem_control_clocks]
3485 )
3486 if test "$ntp_ok" = "yes"; then
3487     ntp_refclock=yes
3488     AC_DEFINE([CLOCK_PALISADE], [1], [Palisade clock])
3489 fi
3490 AC_MSG_RESULT([$ntp_ok])
3491
3492 AC_MSG_CHECKING([Conrad parallel port radio clock])
3493 AC_ARG_ENABLE(
3494     [PCF],
3495     [AS_HELP_STRING(
3496         [--enable-PCF ],
3497         [+ Conrad parallel port radio clock]
3498     )],
3499     [ntp_ok=$enableval],
3500     [ntp_ok=$ntp_eac]
3501 )
3502 if test "$ntp_ok" = "yes"; then
3503     ntp_refclock=yes
3504     AC_DEFINE([CLOCK_PCF], [1], [Conrad parallel port radio clock])
3505 fi
3506 AC_MSG_RESULT([$ntp_ok])
3507
3508 AC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
3509 AC_ARG_ENABLE(
3510     [PST],
3511     [AS_HELP_STRING(
3512         [--enable-PST],
3513         [+ PST/Traconex 1020 WWV/WWVH receiver]
3514     )],
3515     [ntp_ok=$enableval],
3516     [ntp_ok=$ntp_eac]
3517 )
3518 if test "$ntp_ok" = "yes"; then
3519     ntp_refclock=yes
3520     AC_DEFINE([CLOCK_PST], [1], [PST/Traconex 1020 WWV/WWVH receiver])
3521 fi
3522 AC_MSG_RESULT([$ntp_ok])
3523
3524 AC_MSG_CHECKING([RIPENCC specific Trimble driver])
3525 AC_ARG_ENABLE(
3526     [RIPENCC],
3527     [AS_HELP_STRING(
3528         [--enable-RIPENCC],
3529         [- RIPENCC specific Trimble driver]
3530     )],
3531     [ntp_ok=$enableval],
3532     [ntp_ok=no]
3533 )
3534 # 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
3535 case "$ntp_ripe_ncc_ok" in
3536  no) ntp_ok=no ;;
3537 esac
3538 if test "$ntp_ok" = "yes"; then
3539     ntp_refclock=yes
3540     AC_DEFINE([CLOCK_RIPENCC], [],[RIPE NCC Trimble clock])
3541 fi
3542 AC_MSG_RESULT([$ntp_ok])
3543
3544 # Danny Meyer says SHM compiles (with a few warnings) under Win32.
3545 # For *IX, we need sys/ipc.h and sys/shm.h.
3546 AC_MSG_CHECKING([for SHM clock attached thru shared memory])
3547 AC_ARG_ENABLE(
3548     [SHM],
3549     [AS_HELP_STRING(
3550         [--enable-SHM],
3551         [s SHM clock attached thru shared memory]
3552     )],
3553     [ntp_ok=$enableval],
3554     [
3555         case "$ntp_eac$ntp_canshm" in
3556          *no*)  ntp_ok=no  ;;
3557          *)     ntp_ok=yes ;;
3558         esac
3559     ]
3560 )
3561 if test "$ntp_ok" = "yes"; then
3562     ntp_refclock=yes
3563     AC_DEFINE([CLOCK_SHM], [1], [clock thru shared memory])
3564 fi
3565 AC_MSG_RESULT([$ntp_ok])
3566
3567 AC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
3568 AC_ARG_ENABLE(
3569     [SPECTRACOM],
3570     [AS_HELP_STRING(
3571         [--enable-SPECTRACOM],
3572         [+ Spectracom 8170/Netclock/2 WWVB receiver]
3573     )],
3574     [ntp_ok=$enableval],
3575     [ntp_ok=$ntp_eac]
3576 )
3577 if test "$ntp_ok" = "yes"; then
3578     ntp_refclock=yes
3579     AC_DEFINE([CLOCK_SPECTRACOM], [1],
3580         [Spectracom 8170/Netclock/2 WWVB receiver])
3581 fi
3582 AC_MSG_RESULT([$ntp_ok])
3583
3584 AC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
3585 AC_ARG_ENABLE(
3586     [TPRO],
3587     [AS_HELP_STRING(
3588         [--enable-TPRO],
3589         [s KSI/Odetics TPRO/S GPS receiver/IRIG interface]
3590     )],
3591     [ntp_ok=$enableval],
3592     [
3593         case "$ac_cv_header_sys_tpro_h" in
3594          yes)
3595             ntp_ok=$ntp_eac
3596             ;;
3597          *)
3598             ntp_ok=no
3599             ;;
3600         esac
3601     ]
3602 )
3603 if test "$ntp_ok" = "yes"; then
3604     ntp_refclock=yes
3605     AC_DEFINE([CLOCK_TPRO], [1],
3606         [KSI/Odetics TPRO/S GPS receiver/IRIG interface])
3607 fi
3608 AC_MSG_RESULT([$ntp_ok])
3609 case "$ntp_ok$ac_cv_header_sys_tpro" in
3610  yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
3611 esac
3612
3613 dnl Bug 342: longstanding unfixed bugs
3614 dnl AC_MSG_CHECKING([TRAK 8810 GPS receiver])
3615 dnl AC_ARG_ENABLE([TRAK],
3616 dnl     [AS_HELP_STRING([--enable-TRAK], [+ TRAK 8810 GPS receiver])],
3617 dnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
3618 dnl if test "$ntp_ok" = "yes"; then
3619 dnl     ntp_refclock=yes
3620 dnl     AC_DEFINE([CLOCK_TRAK], [1], [TRAK 8810 GPS receiver])
3621 dnl fi
3622 dnl AC_MSG_RESULT([$ntp_ok])
3623
3624 # Not on a vax-dec-bsd
3625 AC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
3626 AC_ARG_ENABLE(
3627     [TRUETIME],
3628     [AS_HELP_STRING(
3629         [--enable-TRUETIME],
3630         [s Kinemetrics/TrueTime receivers]
3631     )],
3632     [ntp_ok=$enableval],
3633     [
3634         case "$host" in
3635          vax-dec-bsd)
3636             ntp_ok=no
3637             ;;
3638          *)
3639             ntp_ok=$ntp_eac
3640             ;;
3641         esac
3642     ]
3643 )    
3644 if test "$ntp_ok" = "yes"; then
3645     ntp_refclock=yes
3646     AC_DEFINE([CLOCK_TRUETIME], [1], [Kinemetrics/TrueTime receivers])
3647 fi
3648 AC_MSG_RESULT([$ntp_ok])
3649 case "$ntp_ok$host" in
3650  yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***])
3651 esac
3652
3653 AC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
3654 AC_ARG_ENABLE(
3655     [TT560],
3656     [AS_HELP_STRING(
3657         [--enable-TT560],
3658         [- TrueTime 560 IRIG-B decoder]
3659     )],
3660     [ntp_ok=$enableval],
3661     [ntp_ok=no]
3662 )
3663 if test "$ntp_ok" = "yes"; then
3664     ntp_refclock=yes
3665     AC_DEFINE([CLOCK_TT560], [], [TrueTime 560 IRIG-B decoder?])
3666 fi
3667 AC_MSG_RESULT([$ntp_ok])
3668
3669 AC_MSG_CHECKING([Ultralink M320 WWVB receiver])
3670 AC_ARG_ENABLE(
3671     [ULINK],
3672     [AS_HELP_STRING(
3673         [--enable-ULINK],
3674         [+ Ultralink WWVB receiver]
3675     )],
3676     [ntp_ok=$enableval],
3677     [ntp_ok=$ntp_eac]
3678 )
3679 if test "$ntp_ok" = "yes"; then
3680     ntp_refclock=yes
3681     AC_DEFINE([CLOCK_ULINK], [1], [Ultralink M320 WWVB receiver?])
3682 fi
3683 AC_MSG_RESULT([$ntp_ok])
3684
3685 AC_MSG_CHECKING([WWV receiver])
3686 AC_ARG_ENABLE(
3687     [WWV],
3688     [AS_HELP_STRING(
3689         [--enable-WWV],
3690         [s WWV Audio receiver]
3691     )],
3692     [ntp_ok=$enableval],
3693     [
3694         case "$ntp_eac$ntp_canaudio" in
3695          *no*)  ntp_ok=no  ;;
3696          *)     ntp_ok=yes ;;
3697         esac
3698     ]
3699 )
3700 if test "$ntp_ok" = "yes"; then
3701     ntp_refclock=yes
3702     AC_DEFINE([CLOCK_WWV], [1], [WWV audio driver])
3703 fi
3704 AC_MSG_RESULT([$ntp_ok])
3705 case "$ntp_ok$ntp_canaudio" in
3706  yesno) AC_MSG_WARN([*** But the expected answer is... no ***])
3707 esac
3708
3709 AC_MSG_CHECKING([for Zyfer receiver])
3710 AC_ARG_ENABLE(
3711     [ZYFER],
3712     [AS_HELP_STRING(
3713         [--enable-ZYFER],
3714         [+ Zyfer GPStarplus receiver]
3715     )],
3716     [ntp_ok=$enableval],
3717     [ntp_ok=$ntp_eac]
3718 )
3719 if test "$ntp_ok" = "yes"; then
3720     ntp_refclock=yes
3721     AC_DEFINE([CLOCK_ZYFER], [1], [Zyfer GPStarplus])
3722 fi
3723 AC_MSG_RESULT([$ntp_ok])
3724
3725 AC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
3726 AC_ARG_ENABLE(
3727     [parse-clocks],
3728     [AS_HELP_STRING(
3729         [--enable-parse-clocks],
3730         [- include all suitable PARSE clocks:]
3731     )],
3732     [ntp_eapc=$enableval],
3733     [
3734         case "$ntp_eac" in
3735          yes)   ntp_eapc=$ntp_canparse ;;
3736          *)     ntp_eapc=no ;;
3737         esac
3738         # Delete the next line one of these days
3739         ntp_eapc=no
3740     ]
3741 )
3742 AC_MSG_RESULT($ntp_eapc)
3743
3744 case "$ntp_eac$ntp_eapc$ntp_canparse" in
3745  noyes*)
3746     AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
3747     ;;
3748  yesyesno)
3749     AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
3750     ;;
3751 esac
3752
3753 ntp_libparse=no
3754 ntp_parseutil=no
3755 ntp_rawdcf=no
3756
3757 AC_MSG_CHECKING([Diem Computime Radio Clock])
3758 AC_ARG_ENABLE(
3759     [COMPUTIME],
3760     [AS_HELP_STRING(
3761         [--enable-COMPUTIME],
3762         [s Diem Computime Radio Clock]
3763     )],
3764     [ntp_ok=$enableval],
3765     [ntp_ok=$ntp_eapc]
3766 )
3767 if test "$ntp_ok" = "yes"; then
3768     ntp_libparse=yes
3769     ntp_refclock=yes
3770     AC_DEFINE([CLOCK_COMPUTIME], [1], [Diems Computime Radio Clock?])
3771 fi
3772 AC_MSG_RESULT([$ntp_ok])
3773 case "$ntp_ok$ntp_canparse" in
3774  yesno)
3775     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3776 esac
3777
3778 AC_MSG_CHECKING([ELV/DCF7000 clock])
3779 AC_ARG_ENABLE(
3780     [DCF7000],
3781     [AS_HELP_STRING(
3782         [--enable-DCF7000],
3783         [s ELV/DCF7000 clock]
3784     )],
3785     [ntp_ok=$enableval],
3786     [ntp_ok=$ntp_eapc]
3787 )
3788 if test "$ntp_ok" = "yes"; then
3789     ntp_libparse=yes
3790     ntp_refclock=yes
3791     AC_DEFINE([CLOCK_DCF7000], [1], [ELV/DCF7000 clock?])
3792 fi
3793 AC_MSG_RESULT([$ntp_ok])
3794 case "$ntp_ok$ntp_canparse" in
3795  yesno)
3796     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3797 esac
3798
3799 AC_MSG_CHECKING([HOPF 6021 clock])
3800 AC_ARG_ENABLE(
3801     [HOPF6021],
3802     [AS_HELP_STRING(
3803         [--enable-HOPF6021],
3804         [s HOPF 6021 clock]
3805     )],
3806     [ntp_ok=$enableval],
3807     [ntp_ok=$ntp_eapc]
3808 )
3809 if test "$ntp_ok" = "yes"; then
3810     ntp_libparse=yes
3811     ntp_refclock=yes
3812     AC_DEFINE([CLOCK_HOPF6021], [1], [HOPF 6021 clock?])
3813 fi
3814 AC_MSG_RESULT([$ntp_ok])
3815 case "$ntp_ok$ntp_canparse" in
3816  yesno)
3817     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3818 esac
3819
3820 AC_MSG_CHECKING([Meinberg clocks])
3821 AC_ARG_ENABLE(
3822     [MEINBERG],
3823     [AS_HELP_STRING(
3824         [--enable-MEINBERG],
3825         [s Meinberg clocks]
3826     )],
3827     [ntp_ok=$enableval],
3828     [ntp_ok=$ntp_eapc]
3829 )
3830 if test "$ntp_ok" = "yes"; then
3831     ntp_libparse=yes
3832     ntp_refclock=yes
3833     AC_DEFINE([CLOCK_MEINBERG], [1], [Meinberg clocks])
3834 fi
3835 AC_MSG_RESULT([$ntp_ok])
3836 case "$ntp_ok$ntp_canparse" in
3837  yesno)
3838     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3839 esac
3840
3841 AC_MSG_CHECKING([DCF77 raw time code])
3842 AC_ARG_ENABLE(
3843     [RAWDCF],
3844     [AS_HELP_STRING(
3845         [--enable-RAWDCF],
3846         [s DCF77 raw time code]
3847     )],
3848     [ntp_ok=$enableval],
3849     [ntp_ok=$ntp_eapc]
3850 )
3851 if test "$ntp_ok" = "yes"; then
3852     ntp_libparse=yes
3853     ntp_parseutil=yes
3854     ntp_refclock=yes
3855     ntp_rawdcf=yes
3856     AC_DEFINE([CLOCK_RAWDCF], [1], [DCF77 raw time code])
3857 fi
3858 AC_MSG_RESULT([$ntp_ok])
3859 case "$ntp_ok$ntp_canparse" in
3860  yesno)
3861     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3862 esac
3863
3864 case "$ntp_rawdcf" in
3865  yes)
3866     AC_CACHE_CHECK([if we must enable parity for RAWDCF],
3867         [ntp_cv_rawdcf_parity],
3868         [
3869             ans=no
3870             case "$host" in
3871              *-*-*linux*)
3872                 ans=yes
3873                 ;;
3874             esac
3875             ntp_cv_rawdcf_parity=$ans
3876         ]
3877     )
3878     case "$ntp_cv_rawdcf_parity" in
3879      yes)
3880         AC_DEFINE([RAWDCF_NO_IGNPAR], [1],
3881             [Should we not IGNPAR (Linux)?]) ;;
3882     esac
3883 esac
3884
3885 AC_MSG_CHECKING([RCC 8000 clock])
3886 AC_ARG_ENABLE(
3887     [RCC8000],
3888     [AS_HELP_STRING(
3889         [--enable-RCC8000],
3890         [s RCC 8000 clock]
3891     )],
3892     [ntp_ok=$enableval],
3893     [ntp_ok=$ntp_eapc]
3894 )
3895 if test "$ntp_ok" = "yes"; then
3896     ntp_libparse=yes
3897     ntp_refclock=yes
3898     AC_DEFINE([CLOCK_RCC8000], [1], [RCC 8000 clock])
3899 fi
3900 AC_MSG_RESULT([$ntp_ok])
3901 case "$ntp_ok$ntp_canparse" in
3902  yesno)
3903     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3904 esac
3905
3906 AC_MSG_CHECKING([Schmid DCF77 clock])
3907 AC_ARG_ENABLE(
3908     [SCHMID],
3909     [AS_HELP_STRING(
3910         [--enable-SCHMID ],
3911         [s Schmid DCF77 clock]
3912     )],
3913     [ntp_ok=$enableval],
3914     [ntp_ok=$ntp_eapc]
3915 )
3916 if test "$ntp_ok" = "yes"; then
3917     ntp_libparse=yes
3918     ntp_refclock=yes
3919     AC_DEFINE([CLOCK_SCHMID], [1], [Schmid DCF77 clock])
3920 fi
3921 AC_MSG_RESULT([$ntp_ok])
3922 case "$ntp_ok$ntp_canparse" in
3923  yesno)
3924     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3925 esac
3926
3927 AC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
3928 AC_ARG_ENABLE(
3929     [TRIMTAIP],
3930     [AS_HELP_STRING(
3931         [--enable-TRIMTAIP],
3932         [s Trimble GPS receiver/TAIP protocol]
3933     )],
3934     [ntp_ok=$enableval],
3935     [ntp_ok=$ntp_eapc]
3936 )
3937 if test "$ntp_ok" = "yes"; then
3938     ntp_libparse=yes
3939     ntp_refclock=yes
3940     AC_DEFINE([CLOCK_TRIMTAIP], [1],
3941         [Trimble GPS receiver/TAIP protocol])
3942 fi
3943 AC_MSG_RESULT([$ntp_ok])
3944 case "$ntp_ok$ntp_canparse" in
3945  yesno)
3946     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3947 esac
3948
3949 AC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
3950 AC_ARG_ENABLE(
3951     [TRIMTSIP],
3952     [AS_HELP_STRING(
3953         [--enable-TRIMTSIP],
3954         [s Trimble GPS receiver/TSIP protocol]
3955     )],
3956     [ntp_ok=$enableval],
3957     [ntp_ok=$ntp_eapc]
3958 )
3959 if test "$ntp_ok" = "yes"; then
3960     ntp_libparse=yes
3961     ntp_refclock=yes
3962     AC_DEFINE([CLOCK_TRIMTSIP], [1],
3963         [Trimble GPS receiver/TSIP protocol])
3964 fi
3965 AC_MSG_RESULT([$ntp_ok])
3966 case "$ntp_ok$ntp_canparse" in
3967  yesno)
3968     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3969 esac
3970
3971 AC_MSG_CHECKING([WHARTON 400A Series clock])
3972 AC_ARG_ENABLE(
3973     [WHARTON],
3974     [AS_HELP_STRING(
3975         [--enable-WHARTON],
3976         [s WHARTON 400A Series clock]
3977     )],
3978     [ntp_ok=$enableval],
3979     [ntp_ok=$ntp_eapc]
3980 )
3981 if test "$ntp_ok" = "yes"; then
3982     ntp_libparse=yes
3983     ntp_refclock=yes
3984     AC_DEFINE([CLOCK_WHARTON_400A], [1], [WHARTON 400A Series clock])
3985 fi
3986 AC_MSG_RESULT([$ntp_ok])
3987 case "$ntp_ok$ntp_canparse" in
3988  yesno)
3989     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3990 esac
3991
3992 AC_MSG_CHECKING([VARITEXT clock])
3993 AC_ARG_ENABLE(
3994     [VARITEXT],
3995     [AS_HELP_STRING(
3996         [--enable-VARITEXT],
3997         [s VARITEXT clock]
3998     )],
3999     [ntp_ok=$enableval],
4000     [ntp_ok=$ntp_eapc]
4001 )
4002 if test "$ntp_ok" = "yes"; then
4003     ntp_libparse=yes
4004     ntp_refclock=yes
4005     AC_DEFINE([CLOCK_VARITEXT], [1], [VARITEXT clock])
4006 fi
4007 AC_MSG_RESULT([$ntp_ok])
4008 case "$ntp_ok$ntp_canparse" in
4009  yesno)
4010     AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
4011 esac
4012
4013 AC_SUBST([LIBPARSE])
4014 AC_SUBST([MAKE_LIBPARSE])
4015 AC_SUBST([MAKE_LIBPARSE_KERNEL])
4016 AC_SUBST([MAKE_CHECK_Y2K])
4017
4018 AC_MSG_CHECKING([if we need to make and use the parse libraries])
4019 ans=no
4020 case "$ntp_libparse" in
4021  yes)
4022     ans=yes
4023     AC_DEFINE([CLOCK_PARSE], [1], [PARSE driver interface])
4024     LIBPARSE=../libparse/libparse.a
4025     MAKE_LIBPARSE=libparse.a
4026     # HMS: check_y2k trips the 34 year problem now...
4027     false && MAKE_CHECK_Y2K=check_y2k
4028 esac
4029 AC_MSG_RESULT([$ans])
4030
4031 NTP_OPENSSL
4032
4033 AC_MSG_CHECKING([if we want to compile with ElectricFence])
4034 AC_ARG_WITH(
4035     [electricfence],
4036     [AS_HELP_STRING(
4037         [--with-electricfence],
4038         [- compile with ElectricFence malloc debugger]
4039     )],
4040     [ans=$withval],
4041     [ans=no]
4042 )
4043 case "$ans" in
4044  no) ;;
4045  *)
4046     LIBS="$LIBS \${top_builddir}/ElectricFence/libefence.a"
4047     EF_PROGS="eftest tstheap"
4048     AC_SUBST([EF_PROGS])
4049     EF_LIBS=libefence.a
4050     AC_SUBST([EF_LIBS])
4051     ans=yes
4052     ;;
4053 esac
4054 AC_MSG_RESULT([$ans])
4055
4056 AC_SUBST([MAKE_CHECK_LAYOUT])
4057 AC_MSG_CHECKING([if we want to run check-layout])
4058 case "$cross_compiling$PATH_PERL" in
4059  no/*)
4060     MAKE_CHECK_LAYOUT=check-layout
4061     ans=yes
4062     ;;
4063  *)
4064     ans=no
4065     ;;
4066 esac
4067 AC_MSG_RESULT([$ans])
4068
4069 AC_SUBST([TESTDCF])
4070 AC_SUBST([DCFD])
4071 AC_MSG_CHECKING([if we can make dcf parse utilities])
4072 ans=no
4073 if test "$ntp_parseutil" = "yes"; then
4074     case "$host" in
4075      *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
4076         ans="dcfd testdcf"
4077         DCFD=dcfd
4078         TESTDCF=testdcf
4079     esac
4080 fi
4081 AC_MSG_RESULT([$ans])
4082
4083 AC_SUBST([MAKE_PARSEKMODULE])
4084 AC_MSG_CHECKING([if we can build kernel streams modules for parse])
4085 ans=no
4086 case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
4087  yesyes)
4088     case "$host" in
4089      sparc-*-sunos4*)
4090         case "$ntp_cv_var_kernel_pll" in
4091         yes)
4092             AC_DEFINE([PPS_SYNC], [1], [PARSE kernel PLL PPS support])
4093             ;;
4094         esac
4095         ans=parsestreams
4096         MAKE_PARSEKMODULE=parsestreams.loadable_module.o
4097         ;;
4098      sparc-*-solaris2*)
4099         ans=parsesolaris
4100         MAKE_PARSEKMODULE=parse
4101         AC_CHECK_HEADERS([strings.h])
4102         ;;
4103     esac
4104     ;;
4105 esac
4106 AC_MSG_RESULT([$ans])
4107
4108 AC_MSG_CHECKING([if we need basic refclock support])
4109 if test "$ntp_refclock" = "yes"; then
4110     AC_DEFINE([REFCLOCK], [1], [Basic refclock support?])
4111 fi
4112 AC_MSG_RESULT($ntp_refclock)
4113
4114 dnl Things that can be made in clockstuff/
4115 AC_SUBST([PROPDELAY])   dnl Set to "propdelay"
4116 AC_SUBST([CHUTEST])     dnl Set to "chutest"
4117 AC_SUBST([CLKTEST])     dnl Set to "clktest"
4118
4119 AC_SUBST([MAKE_ADJTIMED])
4120 AC_MSG_CHECKING([if we want HP-UX adjtimed support])
4121 case "$host" in
4122  *-*-hpux[[56789]]*)
4123     ans=yes
4124     ;;
4125  *) ans=no
4126     ;;
4127 esac
4128 if test "$ans" = "yes"; then
4129     MAKE_ADJTIMED=adjtimed
4130     AC_DEFINE([NEED_HPUX_ADJTIME], [1],
4131         [Do we need HPUX adjtime() library support?])
4132 fi
4133 AC_MSG_RESULT([$ans])
4134
4135 AC_MSG_CHECKING([if we want QNX adjtime support])
4136 case "$host" in
4137  *-*-qnx*)
4138     ans=yes
4139     ;;
4140  *) ans=no
4141     ;;
4142 esac
4143 if test "$ans" = "yes"; then
4144     AC_DEFINE([NEED_QNX_ADJTIME], [1],
4145         [Do we need the qnx adjtime call?])
4146 fi
4147 AC_MSG_RESULT([$ans])
4148
4149 AC_MSG_CHECKING([if we can read kmem])
4150
4151 #  the default is to enable it if the system has the capability
4152
4153 case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
4154  *yes*)
4155     ans=yes
4156     ;;
4157  *) ans=no
4158 esac
4159
4160 case "$host" in
4161  *-*-domainos)  # Won't be found...
4162     ans=no
4163     ;;
4164  *-*-hpux*)
4165     #ans=no
4166     ;;
4167  *-*-irix[[456]]*)
4168     ans=no
4169     ;;
4170  *-*-*linux*)
4171     ans=no
4172     ;;
4173  *-*-winnt3.5)
4174     ans=no
4175     ;;
4176  *-*-unicosmp*)
4177     ans=no
4178     ;;
4179 esac
4180
4181 # --enable-kmem / --disable-kmem controls if present
4182 AC_ARG_ENABLE(
4183     [kmem],
4184     [AS_HELP_STRING(
4185         [--enable-kmem],
4186         [s read /dev/kmem for tick and/or tickadj]
4187     )],
4188     [ans=$enableval]
4189 )
4190
4191 AC_MSG_RESULT([$ans])
4192
4193 case "$ans" in
4194  yes)
4195     can_kmem=yes
4196     ;;
4197  *) 
4198     can_kmem=no
4199     AC_DEFINE([NOKMEM], [1], [Should we NOT read /dev/kmem?])
4200 esac
4201
4202
4203 AC_MSG_CHECKING([if adjtime is accurate])
4204
4205 # target-dependent defaults
4206
4207 case "$host" in
4208  i386-sequent-ptx*)
4209     ans=no
4210     ;;
4211  i386-unknown-osf1*)
4212     ans=yes
4213     ;;
4214  mips-sgi-irix[[456]]*)
4215     ans=yes
4216     ;;
4217  *-fujitsu-uxp*)
4218     ans=yes
4219     ;;
4220  *-ibm-aix[[456]]*)
4221     ans=yes
4222     ;;
4223  *-*-*linux*)
4224     ans=yes
4225     ;;
4226  *-*-solaris2.[[01]])
4227     ans=no
4228     ;;
4229  *-*-solaris2*)
4230     ans=yes
4231     ;;
4232  *-*-unicosmp*)
4233     ans=yes
4234     ;;
4235  *) ans=no
4236 esac
4237
4238 # --enable-accurate-adjtime / --disable-accurate-adjtime
4239 # override the default
4240 AC_ARG_ENABLE(
4241     [accurate-adjtime],
4242     [AS_HELP_STRING(
4243         [--enable-accurate-adjtime], 
4244         [s the adjtime() call is accurate]
4245     )],
4246     [ans=$enableval]
4247 )
4248
4249 AC_MSG_RESULT([$ans])
4250
4251 case "$ans" in
4252  yes) 
4253     AC_DEFINE([ADJTIME_IS_ACCURATE], [1], [Is adjtime() accurate?])
4254     adjtime_is_accurate=yes
4255     ;;
4256  *)
4257     adjtime_is_accurate=no
4258     ;;
4259 esac
4260
4261 AC_CACHE_CHECK(
4262     [the name of 'tick' in the kernel],
4263     [ntp_cv_nlist_tick],
4264     [
4265         ans=_tick
4266         case "$host" in
4267          m68*-hp-hpux*) # HP9000/300?
4268             ans=_old_tick
4269             ;;
4270          *-apple-aux[[23]]*)
4271             ans=tick
4272             ;;
4273          *-hp-hpux*)
4274             ans=old_tick
4275             ;;
4276          *-ibm-aix[[3456]]*)
4277             ans=no
4278             ;;
4279          *-*-mpeix*)
4280             ans=no
4281             ;;
4282          *-*-ptx*)
4283             ans=tick
4284             ;;
4285          *-*-sco3.2v[[45]]*)
4286             ans=no
4287             ;;
4288          *-*-solaris2*)
4289             ans=nsec_per_tick
4290             ;;
4291          *-*-sysv4*)
4292             ans=tick
4293             ;;
4294         esac
4295         ntp_cv_nlist_tick=$ans
4296     ]
4297 )
4298 case "$ntp_cv_nlist_tick" in
4299  ''|no)
4300     ;;  # HMS: I think we can only get 'no' here...
4301  *) 
4302     AC_DEFINE_UNQUOTED([K_TICK_NAME], ["$ntp_cv_nlist_tick"],
4303         [What is the name of TICK in the kernel?])
4304 esac
4305
4306 AC_CACHE_CHECK(
4307     [for the units of 'tick'],
4308     [ntp_cv_tick_nano],
4309     [
4310         ans=usec
4311         case "$host" in
4312          *-*-solaris2*)
4313             ans=nsec
4314             ;;
4315         esac
4316         ntp_cv_tick_nano=$ans
4317     ]
4318 )
4319 case "$ntp_cv_tick_nano" in
4320  nsec)
4321     AC_DEFINE([TICK_NANO], [1], [Is K_TICK_NAME in nanoseconds?])
4322 esac
4323
4324 AC_CACHE_CHECK(
4325     [the name of 'tickadj' in the kernel],
4326     [ntp_cv_nlist_tickadj],
4327     [
4328         ans=_tickadj
4329         case "$host" in
4330          m68*-hp-hpux*) # HP9000/300?
4331             ans=_tickadj
4332             ;;
4333          *-apple-aux[[23]]*)
4334             ans=tickadj
4335             ;;
4336          *-hp-hpux10*)
4337             ans=no
4338             ;;
4339          *-hp-hpux9*)
4340             ans=no
4341             ;;
4342          *-hp-hpux*)
4343             ans=tickadj
4344             ;;
4345          *-*-aix*)
4346             ans=tickadj
4347             ;;
4348          *-*-mpeix*)
4349             ans=no
4350             ;;
4351          *-*-ptx*)
4352             ans=tickadj
4353             ;;
4354          *-*-sco3.2v4*)
4355             ans=no
4356             ;;
4357          *-*-sco3.2v5.0*)
4358             ans=clock_drift
4359             ;;
4360          *-*-solaris2*)
4361             ans=no      # hrestime_adj
4362             ;;
4363          *-*-sysv4*)
4364             ans=tickadj
4365             ;;
4366         esac
4367         ntp_cv_nlist_tickadj=$ans
4368     ]
4369 )
4370 case "$ntp_cv_nlist_tickadj" in
4371  ''|no)
4372     ;;  # HMS: I think we can only get 'no' here...
4373  *) 
4374     AC_DEFINE_UNQUOTED([K_TICKADJ_NAME], ["$ntp_cv_nlist_tickadj"],
4375         [What is the name of TICKADJ in the kernel?])
4376 esac
4377
4378 AC_CACHE_CHECK(
4379     [for the units of 'tickadj'],
4380     [ntp_cv_tickadj_nano],
4381     [
4382         ans=usec
4383         case "$host" in
4384          *-*-solaris2*)
4385             ans=nsec
4386             ;;
4387         esac
4388         ntp_cv_tickadj_nano=$ans
4389     ]
4390 )
4391 case "$ntp_cv_tickadj_nano" in
4392  nsec)
4393     AC_DEFINE([TICKADJ_NANO], [1], [Is K_TICKADJ_NAME in nanoseconds?])
4394 esac
4395
4396 AC_CACHE_CHECK(
4397     [half-heartedly for 'dosynctodr' in the kernel],
4398     [ntp_cv_nlist_dosynctodr],
4399     [
4400         case "$host" in
4401          *-apple-aux[[23]]*)
4402             ans=no
4403             ;;
4404          *-sni-sysv*)
4405             ans=dosynctodr
4406             ;;
4407          *-*-aix*)
4408             ans=dosynctodr
4409             ;;
4410          *-*-hpux*)
4411             ans=no
4412             ;;
4413          *-*-mpeix*)
4414             ans=no
4415             ;;
4416          *-*-nextstep*)
4417             ans=_dosynctodr
4418             ;;
4419          *-*-ptx*)
4420             ans=doresettodr
4421             ;;
4422          *-*-sco3.2v4*)
4423             ans=no
4424             ;;
4425          *-*-sco3.2v5*)
4426             ans=track_rtc
4427             ;;
4428          *-*-solaris2*)
4429             ans=dosynctodr
4430             ;;
4431          *-*-sysv4*)
4432             ans=doresettodr
4433             ;;
4434          *)
4435             ans=_dosynctodr
4436             ;;
4437         esac
4438         ntp_cv_nlist_dosynctodr=$ans
4439     ]
4440 )
4441 case "$ntp_cv_nlist_dosynctodr" in
4442  no)
4443     ;;
4444  *)
4445     AC_DEFINE_UNQUOTED([K_DOSYNCTODR_NAME], ["$ntp_cv_nlist_dosynctodr"],
4446         [What is (probably) the name of DOSYNCTODR in the kernel?])
4447     ;;
4448 esac
4449
4450 AC_CACHE_CHECK(
4451     [half-heartedly for 'noprintf' in the kernel],
4452     [ntp_cv_nlist_noprintf],
4453     [
4454         case "$host" in
4455          *-apple-aux[[23]]*)
4456             ans=no
4457             ;;
4458          *-sni-sysv*)
4459             ans=noprintf
4460             ;;
4461          *-*-aix*)
4462             ans=noprintf
4463             ;;
4464          *-*-hpux*)
4465             ans=no
4466             ;;
4467          *-*-mpeix*)
4468             ans=no
4469             ;;
4470          *-*-ptx*)
4471             ans=noprintf
4472             ;;
4473          *-*-nextstep*)
4474             ans=_noprintf
4475             ;;
4476          *-*-solaris2*)
4477             ans=noprintf
4478             ;;
4479          *-*-sysv4*)
4480             ans=noprintf
4481             ;;
4482          *)
4483             ans=_noprintf
4484             ;;
4485         esac
4486         ntp_cv_nlist_noprintf=$ans
4487     ]
4488 )
4489 case "$ntp_cv_nlist_noprintf" in
4490  no)
4491     ;;
4492  *)
4493     AC_DEFINE_UNQUOTED([K_NOPRINTF_NAME], ["$ntp_cv_nlist_noprintf"],
4494         [What is (probably) the name of NOPRINTF in the kernel?])
4495     ;;
4496 esac
4497
4498 dnl The tick/tickadj sections were written by Skippy, who never learned
4499 dnl that it's impolite (horridly gross) to show your guts in public.
4500
4501 dnl     tick            tickadj 
4502 dnl     10000           80          Unixware
4503 dnl     1000000L/hz     tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
4504 dnl     10000           150         sgi IRIX
4505 dnl     1000000L/hz     1000        RS6000 && NOKMEM
4506 dnl     1000000L/hz     668         DOMAINOS && NOKMEM
4507 dnl     1000000L/hz     500/HZ      other && NOKMEM
4508 dnl     txc.tick        1           Linux
4509 dnl     (every / 10)    50          WinNT - tickadj is roughly 500/hz
4510 dnl     1000000L/hz     (nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
4511 dnl                                 (RS6000 && !NOKMEM), SINIX MIPS
4512
4513 dnl But we'll only use these "values" if we can't find anything else.
4514
4515 AC_MSG_CHECKING([for a default value for 'tick'])
4516
4517 # target-dependent default for tick
4518
4519 case "$host" in
4520  *-*-pc-cygwin*)
4521     AC_MSG_ERROR([tick needs work for cygwin])
4522     ;;
4523  *-univel-sysv*)
4524     ans=10000
4525     ;;
4526  *-*-irix*)
4527     ans=10000
4528     ;;
4529  *-*-*linux*)
4530     ans=txc.tick
4531     ;;
4532  *-*-mpeix*)
4533     ans=no
4534     ;;
4535  *-*-winnt3.5)
4536     ans='(every / 10)'
4537     ;;
4538  *-*-unicosmp*)
4539     ans=10000
4540     ;;
4541  *)
4542     ans='1000000L/hz'
4543     ;;
4544 esac
4545
4546 AC_ARG_ENABLE(
4547     [tick],
4548     [AS_HELP_STRING(
4549         [--enable-tick=VALUE],
4550         [s force a value for 'tick']
4551     )],
4552     [ans=$enableval]
4553 )
4554
4555 AC_MSG_RESULT([$ans])
4556
4557 case "$ans" in
4558  ''|no)
4559     ;;  # HMS: I think we can only get 'no' here...
4560  *)
4561     AC_DEFINE_UNQUOTED([PRESET_TICK], [$ans],
4562         [Preset a value for 'tick'?])
4563 esac
4564
4565 AC_MSG_CHECKING([for a default value for 'tickadj'])
4566
4567 # target-specific default
4568 ans='500/hz'
4569 case "$host" in
4570  *-fujitsu-uxp*)
4571     case "$adjtime_is_accurate" in
4572      yes)
4573         ans='tick/16'
4574     esac
4575     ;;
4576  *-univel-sysv*)
4577     ans=80
4578     ;;
4579  *-*-aix*)
4580     case "$can_kmem" in
4581      no)
4582         ans=1000
4583     esac
4584     ;;
4585  *-*-domainos)  # Skippy: won't be found...
4586     case "$can_kmem" in
4587      no)
4588         ans=668
4589     esac
4590     ;;
4591  *-*-hpux*)
4592     case "$adjtime_is_accurate" in
4593      yes)
4594         ans='tick/16'
4595     esac
4596     ;;
4597  *-*-irix*)
4598     ans=150
4599     ;;
4600  *-*-mpeix*)
4601     ans=no
4602     ;;
4603  *-*-sco3.2v5.0*)
4604     ans=10000L/hz
4605     ;;
4606  *-*-winnt3.5)
4607     ans=50
4608     ;;
4609  *-*-unicosmp*)
4610     ans=150
4611 esac
4612
4613 AC_ARG_ENABLE(
4614     [tickadj],
4615     [AS_HELP_STRING(
4616         [--enable-tickadj=VALUE],
4617         [s force a value for 'tickadj']
4618     )],
4619     [ans=$enableval]
4620 )
4621
4622 AC_MSG_RESULT([$ans])
4623
4624 default_tickadj=$ans
4625
4626 case "$default_tickadj" in
4627  ''|no)
4628     ;;  # HMS: I think we can only get 'no' here...
4629  *)
4630     AC_DEFINE_UNQUOTED([PRESET_TICKADJ], [$default_tickadj],
4631         [Preset a value for 'tickadj'?]) ;;
4632 esac
4633
4634 # Newer versions of ReliantUNIX round adjtime() values down to
4635 # 1/100s (system tick). Sigh ...
4636 # Unfortunately, there is no easy way to know if particular release
4637 # has this "feature" or any obvious way to test for it.
4638 case "$host" in
4639  mips-sni-sysv4*)
4640     AC_DEFINE([RELIANTUNIX_CLOCK], [1],
4641         [Do we want the ReliantUNIX clock hacks?])
4642 esac
4643
4644 case "$host" in
4645  *-*-sco3.2v5*)
4646     AC_DEFINE([SCO5_CLOCK], [1], [Do we want the SCO clock hacks?])
4647 esac
4648
4649 ntp_cv_make_tickadj=yes
4650 case "$can_kmem$ac_cv_var_tick$default_tickadj" in
4651  nonono)        # Don't read KMEM, no presets.  Bogus.
4652     AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
4653     ntp_cv_make_tickadj=no
4654     ;;
4655  nono*)         # Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
4656     AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
4657     ntp_cv_make_tickadj=no
4658     ;;
4659  no*no)         # Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
4660     AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
4661     ntp_cv_make_tickadj=no
4662     ;;
4663  no*)           # Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
4664     ;;
4665  yesnono)       # Read KMEM, no presets.  Cool.
4666     ;;
4667  yesno*)        # Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
4668     AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
4669     ;;
4670  yes*no)        # Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
4671     ;;
4672  yes*)          # READ KMEM, PRESET_TICK and PRESET_TICKADJ.
4673     ;;
4674  *)             # Generally bogus.
4675     AC_MSG_ERROR([This shouldn't happen.])
4676     ;;
4677 esac
4678
4679 AC_SUBST(MAKE_NTPTIME)
4680 AC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
4681 [case "$host" in
4682  *) case "$ntp_cv_struct_ntptimeval$ntp_cv_var_kernel_pll" in
4683      yesyes)
4684         ans=yes
4685         ;;
4686      *)
4687         ans=no
4688         ;;
4689     esac
4690     ;;
4691 esac
4692 ac_cv_make_ntptime=$ans])
4693 case "$ac_cv_make_ntptime" in
4694  yes)
4695     MAKE_NTPTIME=ntptime
4696     ;;
4697 esac
4698
4699 AC_SUBST([MAKE_TICKADJ])
4700 case "$host" in
4701  mips-sni-sysv4*)
4702     # tickadj is pretty useless on newer versions of ReliantUNIX
4703     # Do not bother
4704     ntp_cv_make_tickadj=no
4705     ;;
4706  *-*-irix*)
4707     ntp_cv_make_tickadj=no
4708     ;;
4709  *-*-solaris2*)
4710     # DLM says tickadj is a no-no starting with solaris2.5
4711     case "$host" in
4712      *-*-solaris2.1[[0-9]]*)
4713         ntp_cv_make_tickadj=no
4714         ;;
4715      *-*-solaris2.[[0-4]]*) ;;
4716      *) ntp_cv_make_tickadj=no ;;
4717     esac
4718     ;;
4719  *-*-unicosmp*)
4720     ntp_cv_make_tickadj=no
4721     ;;
4722 esac
4723
4724 #
4725 # Despite all the above, we always make tickadj.  Setting
4726 # ntp_cv_make_tickadj before AC_CACHE_CHECK will cause a false
4727 # report that the configuration variable was cached.  It may
4728 # be better to simply remove the hunk above, I did not want
4729 # to remove it if there is hope it will be used again.
4730 #
4731 AS_UNSET([ntp_cv_make_tickadj])
4732
4733 AC_CACHE_CHECK(
4734     [if we want and can make the tickadj utility],
4735     [ntp_cv_make_tickadj],
4736     [ntp_cv_make_tickadj=yes]
4737 )
4738 case "$ntp_cv_make_tickadj" in
4739  yes)
4740     MAKE_TICKADJ=tickadj
4741 esac
4742
4743 AC_SUBST([MAKE_TIMETRIM])
4744 AC_CACHE_CHECK(
4745     [if we want and can make the timetrim utility],
4746     [ntp_cv_make_timetrim],
4747     [
4748         case "$host" in
4749          *-*-irix*)
4750             ntp_cv_make_timetrim=yes
4751             ;;
4752          *-*-unicosmp*)
4753             ntp_cv_make_timetrim=yes
4754             ;;
4755          *)
4756             ntp_cv_make_timetrim=no
4757             ;;
4758         esac
4759     ]
4760 )
4761 case "$ntp_cv_make_timetrim" in
4762  yes)
4763     MAKE_TIMETRIM=timetrim
4764 esac
4765
4766 AC_SUBST([MAKE_LIBNTPSIM])
4767 AC_SUBST([MAKE_NTPDSIM])
4768
4769 AC_MSG_CHECKING([if we want to build the NTPD simulator])
4770 AC_ARG_ENABLE(
4771     [simulator],
4772     [AS_HELP_STRING(
4773         [--enable-simulator],
4774         [- build/install the NTPD simulator?]
4775     )],
4776     [ans=$enableval], 
4777     [ans=no]
4778 )
4779 AC_MSG_RESULT([$ans])
4780 case "$ans" in
4781  yes)
4782     MAKE_NTPDSIM=ntpdsim
4783     MAKE_LIBNTPSIM=libntpsim.a
4784 esac
4785
4786 case "$build" in
4787  $host)
4788     ;;
4789  *) case "$host" in
4790      *-*-vxworks*)
4791         LDFLAGS="$LDFLAGS -r"
4792         ;;
4793     esac
4794     ;;
4795 esac
4796
4797
4798 AC_MSG_CHECKING([if we want to build ntpsnmpd])
4799 AC_ARG_WITH(
4800     [ntpsnmpd],
4801     [AS_HELP_STRING(
4802         [--with-ntpsnmpd],
4803         [s Build ntpsnmpd MIB agent?]
4804     )],
4805     [ans=$withval],
4806     [
4807         case "$PATH_NET_SNMP_CONFIG" in
4808          /*)    ans=yes ;;
4809          *)     ans=no  ;;
4810         esac
4811     ]
4812 )
4813 AC_MSG_RESULT([$ans])
4814 case "$ans" in
4815  yes)
4816     case "$PATH_NET_SNMP_CONFIG" in
4817      /*)
4818         SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
4819         AC_SUBST([SNMP_LIBS])
4820         # HMS: we really want to separate CPPFLAGS and CFLAGS
4821         foo=`$PATH_NET_SNMP_CONFIG --cflags`
4822         SNMP_CPPFLAGS=
4823         SNMP_CFLAGS=
4824         for i in $foo; do
4825             case "$i" in
4826              -D*|-U*|-I*)
4827                 SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
4828                 ;;
4829             *)  SNMP_CFLAGS="$SNMP_CFLAGS $i"
4830                 ;;
4831             esac
4832         done
4833         AC_SUBST([SNMP_CPPFLAGS])
4834         AC_SUBST([SNMP_CFLAGS])
4835
4836         save_CFLAGS=$CFLAGS
4837         save_CPPFLAGS=$CPPFLAGS
4838         save_LIBS=$LIBS
4839         CFLAGS=$SNMP_CFLAGS
4840         CPPFLAGS=$SNMP_CPPFLAGS
4841
4842         AC_CHECK_HEADER(
4843             [net-snmp/net-snmp-config.h],
4844             [MAKE_NTPSNMPD=ntpsnmpd],
4845             [AC_MSG_WARN([net-snmp-config present but net-snmp headers are not available!])]
4846         )
4847
4848         # Do this last, as we're messing up LIBS.
4849         # check -lnetsnmp for netsnmp_daemonize
4850         LIBS=`$PATH_NET_SNMP_CONFIG --libs`
4851         AC_CHECK_LIB(
4852             [netsnmp],
4853             [netsnmp_daemonize],
4854             [ans=yes],
4855             [ans=no]
4856         )
4857         case "$ans" in
4858          no)
4859             AC_DEFINE([NEED_NETSNMP_DAEMONIZE], [1],
4860                 [We need to provide netsnmp_daemonize()])
4861         esac
4862         
4863         CFLAGS=$save_CFLAGS
4864         CPPFLAGS=$save_CPPFLAGS
4865         LIBS=$save_LIBS
4866         ;;
4867      *) 
4868         AC_MSG_WARN([Cannot build ntpsnmpd - net-snmp-config cannot be found])
4869         ;;
4870     esac
4871     ;;
4872 esac
4873 AC_SUBST([MAKE_NTPSNMPD])
4874
4875
4876 AC_MSG_CHECKING([if we should always slew the time])
4877
4878 # target-specific defaults
4879
4880 case "$host" in
4881  *-apple-aux[[23]]*)
4882     ans=yes
4883     ;;
4884  *-*-bsdi[[012]]*)
4885     ans=no
4886     ;;
4887  *-*-bsdi*)
4888     ans=yes
4889     ;;
4890  *-*-openvms*)  # HMS: won't be found
4891     ans=yes
4892     ;;
4893  *) ans=no
4894     ;;
4895 esac
4896
4897 # --enable-slew-always / --disable-slew-always overrides default
4898
4899 AC_ARG_ENABLE(
4900     [slew-always],
4901     [AS_HELP_STRING(
4902         [--enable-slew-always],
4903         [s always slew the time]
4904     )],
4905     [ans=$enableval]
4906 )
4907
4908 AC_MSG_RESULT([$ans])
4909
4910 case "$ans" in
4911  yes)
4912     AC_DEFINE([SLEWALWAYS], [1], [Slew always?])
4913 esac
4914
4915 AC_MSG_CHECKING([if we should step and slew the time])
4916
4917 case "$host" in
4918  *-sni-sysv*)
4919     ans=yes
4920     ;;
4921  *-univel-sysv*)
4922     ans=no
4923     ;;
4924  *-*-ptx*)
4925     ans=yes
4926     ;;
4927  *-*-solaris2.1[[0-9]]*)
4928     ans=no
4929     ;;
4930  *-*-solaris2.[[012]]*)
4931     ans=yes
4932     ;;
4933  *-*-sysv4*)    # HMS: Does this catch Fujitsu UXP?
4934     ans=yes
4935     ;;
4936  *) ans=no
4937     ;;
4938 esac
4939
4940 AC_ARG_ENABLE(
4941     [step-slew],
4942     [AS_HELP_STRING(
4943         [--enable-step-slew],
4944         [s step and slew the time]
4945     )],
4946     [ans=$enableval]
4947 )
4948
4949 AC_MSG_RESULT([$ans])
4950
4951 case "$ans" in
4952  yes)
4953     AC_DEFINE([STEP_SLEW], [1], [Step, then slew the clock?])
4954 esac
4955
4956 AC_MSG_CHECKING([if ntpdate should step the time])
4957
4958 case "$host" in
4959  *-apple-aux[[23]]*)
4960     ans=yes
4961     ;;
4962  *) ans=no
4963 esac
4964
4965 AC_ARG_ENABLE(
4966     [ntpdate-step],
4967     [AS_HELP_STRING(
4968         [--enable-ntpdate-step],
4969         [s if ntpdate should step the time]
4970     )],
4971     [ans=$enableval]
4972 )
4973
4974 AC_MSG_RESULT([$ans])
4975
4976 case "$ans" in
4977  yes)
4978     AC_DEFINE([FORCE_NTPDATE_STEP], [1],
4979         [force ntpdate to step the clock if !defined(STEP_SLEW) ?])
4980 esac
4981
4982
4983 AC_MSG_CHECKING([if we should sync TODR clock every hour])
4984
4985 case "$host" in
4986  *-*-nextstep*)
4987     ans=yes
4988     ;;
4989  *-*-openvms*)  # HMS: won't be found
4990     ans=yes
4991     ;;
4992  *)
4993     ans=no
4994 esac
4995
4996 AC_ARG_ENABLE(
4997     [hourly-todr-sync],
4998     [AS_HELP_STRING(
4999         [--enable-hourly-todr-sync],
5000         [s if we should sync TODR hourly]
5001     )],
5002     [ans=$enableval]
5003 )
5004
5005 AC_MSG_RESULT([$ans])
5006
5007 case "$ac_cv_var_sync_todr" in
5008  yes)
5009     AC_DEFINE([DOSYNCTODR], [1], [synch TODR hourly?]) ;;
5010 esac
5011
5012
5013 AC_MSG_CHECKING([if we should avoid kernel FLL bug])
5014
5015 case "$host" in
5016  *-*-solaris2.6)
5017     unamev=`uname -v`
5018     case "$unamev" in
5019      Generic_105181-*)
5020         old_IFS="$IFS"
5021         IFS="-"
5022         set $unamev
5023         IFS="$old_IFS"
5024         if test "$2" -ge 17
5025         then
5026             # Generic_105181-17 and higher
5027             ans=no
5028         else
5029             ans=yes
5030         fi
5031         ;;
5032      *) 
5033         ans=yes
5034     esac
5035     ;;
5036  *-*-solaris2.7)
5037     unamev=`uname -v`
5038     case "$unamev" in
5039      Generic_106541-*)
5040         old_IFS="$IFS"
5041         IFS="-"
5042         set $unamev
5043         IFS="$old_IFS"
5044         if test "$2" -ge 07
5045         then
5046             # Generic_106541-07 and higher
5047             ans=no
5048         else
5049             ans=yes
5050         fi
5051         ;;
5052      *)
5053         ans=yes
5054     esac
5055     ;;
5056  *)
5057     ans=no
5058 esac
5059
5060 AC_ARG_ENABLE(
5061     [kernel-fll-bug],
5062     [AS_HELP_STRING(
5063         [--enable-kernel-fll-bug],
5064         [s if we should avoid a kernel FLL bug]
5065     )],
5066     [ans=$enableval]
5067 )
5068
5069 AC_MSG_RESULT([$ans])
5070
5071 case "$ans" in
5072  yes)
5073     AC_DEFINE([KERNEL_FLL_BUG], [1], [Does the kernel have an FLL bug?])
5074 esac
5075
5076
5077 AC_MSG_CHECKING([if we want new session key behavior])
5078 AC_ARG_ENABLE(
5079     [bug1243-fix],
5080     [AS_HELP_STRING(
5081         [--enable-bug1243-fix],
5082         [+ use unmodified autokey session keys]
5083     )],
5084     [ans=$enableval],
5085     [ans=yes]
5086 )
5087 AC_MSG_RESULT([$ans])
5088 case "$ans" in
5089  no)
5090     AC_DEFINE([DISABLE_BUG1243_FIX], [1],
5091         [use old autokey session key behavior?])
5092 esac
5093
5094
5095 AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
5096
5097 case "$host" in
5098  *-*-solaris2.[[89]])
5099     ans=yes
5100     ;;
5101  *-*-solaris2.1[[0-9]]*)
5102     ans=yes
5103     ;;
5104  *) ans=no
5105 esac
5106
5107 AC_ARG_ENABLE(
5108     [irig-sawtooth], 
5109     [AS_HELP_STRING(
5110         [--enable-irig-sawtooth],
5111         [s if we should enable the IRIG sawtooth filter]
5112     )],
5113     [ans=$enableval]
5114 )
5115
5116 AC_MSG_RESULT([$ans])
5117
5118 case "$ans" in
5119  yes)
5120     AC_DEFINE([IRIG_SUCKS], [1],
5121         [Should we use the IRIG sawtooth filter?])
5122 esac
5123
5124
5125 AC_MSG_CHECKING([if we should enable NIST lockclock scheme])
5126
5127 AC_ARG_ENABLE(
5128         [nist], 
5129         [AS_HELP_STRING(
5130             [--enable-nist],
5131             [- if we should enable the NIST lockclock scheme]
5132         )],
5133         [ans=$enableval],
5134         [ans=no]
5135 )
5136
5137 AC_MSG_RESULT([$ans])
5138
5139 case "$ans" in
5140  yes)
5141     AC_DEFINE([LOCKCLOCK], [1],
5142         [Should we align with the NIST lockclock scheme?]) ;;
5143 esac
5144
5145
5146 AC_MSG_CHECKING([if we want support for Samba's signing daemon])
5147
5148 AC_ARG_ENABLE(
5149     [ntp-signd],
5150     [AS_HELP_STRING(
5151         [--enable-ntp-signd],
5152         [- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
5153     )],
5154     [ans=$enableval],
5155     [ans=no]
5156 )
5157
5158 AC_MSG_RESULT([$ans])
5159
5160 case "$ans" in
5161  no)
5162     ntp_signd_path=
5163     ;;
5164  yes)
5165     ntp_signd_path=/var/run/ntp_signd
5166     ;;
5167  *)
5168     ntp_signd_path="$ans"
5169 esac
5170
5171 case "$ntp_signd_path" in
5172  '')
5173     ;;
5174  *)
5175     AC_DEFINE([HAVE_NTP_SIGND], [1],
5176         [Do we want support for Samba's signing daemon?])
5177     AC_DEFINE_UNQUOTED([NTP_SIGND_PATH], ["$ntp_signd_path"],
5178         [Path to sign daemon rendezvous socket])
5179 esac
5180
5181
5182 AC_CHECK_HEADERS([sys/clockctl.h])
5183
5184 case "$host" in
5185  *-*-netbsd*)
5186     ans=yes
5187     ;;
5188  *) ans=no
5189     ;;
5190 esac
5191
5192 AC_ARG_ENABLE(
5193     [clockctl],
5194     [AS_HELP_STRING(
5195         [--enable-clockctl],
5196         [s Use /dev/clockctl for non-root clock control]
5197     )],
5198     [ntp_use_dev_clockctl=$enableval],
5199     [ntp_use_dev_clockctl=$ac_cv_header_sys_clockctl_h]
5200 )
5201
5202 AC_MSG_CHECKING([[if we should use /dev/clockctl]])
5203 AC_MSG_RESULT([$ntp_use_dev_clockctl])
5204
5205
5206 AC_CHECK_HEADERS([sys/capability.h sys/prctl.h])
5207
5208 AC_MSG_CHECKING([if we have linux capabilities (libcap)])
5209
5210 case "$ac_cv_header_sys_capability_h$ac_cv_header_sys_prctl_h" in
5211  yesyes)
5212     case "$host" in
5213      mips-sgi-irix*)
5214         ntp_have_linuxcaps=no
5215         ;;
5216      *) ntp_have_linuxcaps=yes
5217         ;;
5218     esac
5219     ;;
5220  *)
5221     ntp_have_linuxcaps=no
5222     ;;
5223 esac
5224
5225 AC_ARG_ENABLE(
5226     [linuxcaps],
5227     [AS_HELP_STRING(
5228         [--enable-linuxcaps],
5229         [+ Use Linux capabilities for non-root clock control]
5230     )],
5231     [ntp_have_linuxcaps=$enableval]
5232 )
5233
5234 AC_MSG_RESULT([$ntp_have_linuxcaps])
5235
5236 case "$ntp_have_linuxcaps" in
5237  yes)
5238     AC_DEFINE([HAVE_LINUX_CAPABILITIES], [1],
5239         [Do we have Linux capabilities?])
5240     LIBS="$LIBS -lcap"
5241 esac
5242
5243 case "$ntp_use_dev_clockctl$ntp_have_linuxcaps" in
5244  *yes*)
5245     AC_DEFINE([HAVE_DROPROOT], [1],
5246         [Can we drop root privileges?])
5247 esac
5248
5249
5250 AC_CHECK_HEADERS([libscf.h])
5251 LSCF=
5252 case "$ac_cv_header_libscf_h" in
5253  yes)
5254     LSCF='-lscf'
5255 esac
5256 AC_SUBST([LSCF])
5257
5258 AC_CHECK_FUNC(
5259     [setppriv],
5260     [ans=yes],
5261     [ans=no]
5262 )
5263 case "$ans" in
5264  yes)
5265     AC_DEFINE([HAVE_SOLARIS_PRIVS], [1],
5266         [Are Solaris privileges available?])
5267 esac
5268
5269
5270 AC_CACHE_CHECK(
5271     [struct sockaddr for sa_len],
5272     [isc_cv_platform_havesalen],
5273     [AC_COMPILE_IFELSE(
5274         [AC_LANG_PROGRAM(
5275             [[
5276                 #include <sys/types.h>
5277                 #include <sys/socket.h>
5278             ]],
5279             [[
5280                 extern struct sockaddr *ps;
5281                 return ps->sa_len;
5282             ]]
5283         )],
5284         [isc_cv_platform_havesalen=yes],
5285         [isc_cv_platform_havesalen=no]
5286     )]
5287 )
5288 case "$isc_cv_platform_havesalen" in
5289  yes)
5290     AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
5291          [struct sockaddr has sa_len?])
5292 esac
5293
5294 AC_ARG_ENABLE(
5295     [ipv6],
5296     [AS_HELP_STRING(
5297         [--enable-ipv6],
5298         [s use IPv6?]
5299     )]
5300 )
5301
5302 case "$enable_ipv6" in
5303  yes|''|autodetect)
5304     case "$host" in
5305      powerpc-ibm-aix4*)
5306         ;;
5307      *)
5308         AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
5309         ;;
5310     esac
5311     ;;
5312  no)
5313     ;;
5314 esac
5315
5316
5317 dnl [Bug 1984] ntp/libisc fails to compile on OS X 10.7 (Lion)
5318 case "$host" in
5319  *-*-darwin*)
5320     AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Are we _special_?])
5321 esac
5322
5323
5324 AC_CACHE_CHECK(
5325     [for IPv6 structures],
5326     [isc_cv_found_ipv6],
5327     [AC_COMPILE_IFELSE(
5328         [AC_LANG_PROGRAM(
5329             [[
5330                 #include <sys/types.h>
5331                 #include <sys/socket.h>
5332                 #include <netinet/in.h>
5333             ]],
5334             [[
5335                 struct sockaddr_in6 sin6;
5336             ]]
5337         )],
5338         [isc_cv_found_ipv6=yes],
5339         [isc_cv_found_ipv6=no]
5340     )]
5341 )
5342
5343 #
5344 # See whether IPv6 support is provided via a Kame add-on.
5345 # This is done before other IPv6 linking tests so LIBS is properly set.
5346 #
5347 AC_MSG_CHECKING([for Kame IPv6 support])
5348 AC_ARG_WITH(
5349     [kame],
5350     [AS_HELP_STRING(
5351         [--with-kame],
5352         [- =/usr/local/v6]
5353     )],
5354     [use_kame="$withval"],
5355     [use_kame="no"]
5356 )
5357 case "$use_kame" in
5358  no)
5359     ;;
5360  yes)
5361     kame_path=/usr/local/v6
5362     ;;
5363  *)
5364     kame_path="$use_kame"
5365     ;;
5366 esac
5367 case "$use_kame" in
5368  no)
5369     AC_MSG_RESULT([no])
5370     ;;
5371  *)
5372     if test -f $kame_path/lib/libinet6.a; then
5373         AC_MSG_RESULT([$kame_path/lib/libinet6.a])
5374         LIBS="-L$kame_path/lib -linet6 $LIBS"
5375     else
5376         AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
5377
5378 Please choose the proper path with the following command:
5379
5380     configure --with-kame=PATH
5381 ])
5382     fi
5383     ;;
5384 esac
5385
5386 #
5387 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
5388 # Including it on Kame-using platforms is very bad, though, because
5389 # Kame uses #error against direct inclusion.   So include it on only
5390 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
5391 # This is done before the in6_pktinfo check because that's what
5392 # netinet6/in6.h is needed for.
5393 #
5394 case "$host" in
5395  *-bsdi4.[[01]]*)
5396     AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
5397         [Do we need netinet6/in6.h?])
5398     isc_netinet6in6_hack="#include <netinet6/in6.h>"
5399     ;;
5400  *)
5401     isc_netinet6in6_hack=""
5402     ;;
5403 esac
5404
5405 #
5406 # This is similar to the netinet6/in6.h issue.
5407 #
5408 case "$host" in
5409  *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
5410     AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
5411         [Do we need to fix in6isaddr?])
5412     isc_netinetin6_hack="#include <netinet/in6.h>"
5413     ;;
5414  *)
5415     isc_netinetin6_hack=""
5416     ;;
5417 esac
5418
5419
5420 case "$isc_cv_found_ipv6" in
5421  yes)
5422     AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
5423     AC_CACHE_CHECK(
5424         [for in6_pktinfo],
5425         [isc_cv_have_in6_pktinfo],
5426         [AC_COMPILE_IFELSE(
5427             [AC_LANG_PROGRAM(
5428                 [[
5429                     #include <sys/types.h>
5430                     #include <sys/socket.h>
5431                     #include <netinet/in.h>
5432                     $isc_netinetin6_hack
5433                     $isc_netinet6in6_hack
5434                 ]],
5435                 [[
5436                     struct in6_pktinfo xyzzy;
5437                 ]]
5438             )],
5439             [isc_cv_have_in6_pktinfo=yes],
5440             [isc_cv_have_in6_pktinfo=no]
5441         )]
5442     )
5443     case "$isc_cv_have_in6_pktinfo" in
5444      yes)
5445         AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
5446                 [have struct in6_pktinfo?])
5447     esac
5448
5449
5450     # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
5451     AC_CACHE_CHECK(
5452         [for sockaddr_in6.sin6_scope_id],
5453         [isc_cv_have_sin6_scope_id],
5454         [AC_COMPILE_IFELSE(
5455             [AC_LANG_PROGRAM(
5456                 [[
5457                     #include <sys/types.h>
5458                     #include <sys/socket.h>
5459                     #include <netinet/in.h>
5460                     $isc_netinetin6_hack
5461                     $isc_netinet6in6_hack
5462                 ]],
5463                 [[
5464                     struct sockaddr_in6 xyzzy;
5465                     xyzzy.sin6_scope_id = 0;
5466                 ]]
5467             )],
5468             [isc_cv_have_sin6_scope_id=yes],
5469             [isc_cv_have_sin6_scope_id=no]
5470         )]
5471     )
5472
5473     case "$isc_cv_have_sin6_scope_id" in
5474      yes)
5475         AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
5476     esac
5477 esac
5478
5479
5480 # We need this check run even without isc_cv_found_ipv6=yes
5481
5482 AC_CACHE_CHECK(
5483     [for in6addr_any],
5484     [isc_cv_have_in6addr_any],
5485     [AC_LINK_IFELSE(
5486         [AC_LANG_PROGRAM(
5487             [[
5488                 #include <sys/types.h>
5489                 #include <sys/socket.h>
5490                 #include <netinet/in.h>
5491                 $isc_netinetin6_hack
5492                 $isc_netinet6in6_hack
5493             ]],
5494             [[
5495                 struct in6_addr in6; 
5496                 in6 = in6addr_any;
5497             ]]
5498         )],
5499         [isc_cv_have_in6addr_any=yes],
5500         [isc_cv_have_in6addr_any=no]
5501     )]
5502 )
5503
5504 case "$isc_cv_have_in6addr_any" in
5505  no)
5506     AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
5507 esac
5508
5509
5510 AC_CACHE_CHECK(
5511     [for struct if_laddrconf],
5512     [isc_cv_struct_if_laddrconf],
5513     [AC_COMPILE_IFELSE(
5514         [AC_LANG_PROGRAM(
5515             [[
5516                 #include <sys/types.h>
5517                 #include <net/if6.h>
5518             ]],
5519             [[
5520                 struct if_laddrconf a;
5521             ]]
5522         )],
5523         [isc_cv_struct_if_laddrconf=yes],
5524         [isc_cv_struct_if_laddrconf=no]
5525     )]
5526 )
5527
5528 case "$isc_cv_struct_if_laddrconf" in
5529  yes)
5530     AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
5531         [have struct if_laddrconf?])
5532 esac
5533
5534 AC_CACHE_CHECK(
5535     [for struct if_laddrreq],
5536     isc_cv_struct_if_laddrreq,
5537     [AC_COMPILE_IFELSE(
5538         [AC_LANG_PROGRAM(
5539             [[
5540                 #include <sys/types.h>
5541                 #include <net/if6.h>
5542             ]],
5543             [[
5544                 struct if_laddrreq a;
5545             ]]
5546         )],
5547         [isc_cv_struct_if_laddrreq=yes],
5548         [isc_cv_struct_if_laddrreq=no]
5549     )]
5550 )
5551
5552 case "$isc_cv_struct_if_laddrreq" in
5553  yes)
5554     AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
5555         [have struct if_laddrreq?])
5556 esac
5557
5558 #
5559 # Look for a sysctl call to get the list of network interfaces.
5560 #
5561 AC_CACHE_CHECK(
5562     [for interface list sysctl],
5563     [ntp_cv_iflist_sysctl],
5564     [AC_EGREP_CPP(
5565         [found_rt_iflist], 
5566         [
5567             #include <sys/param.h>
5568             #include <sys/sysctl.h>
5569             #include <sys/socket.h>
5570             #ifdef NET_RT_IFLIST  
5571                 found_rt_iflist
5572             #endif
5573         ],
5574         [ntp_cv_iflist_sysctl=yes],
5575         [ntp_cv_iflist_sysctl=no]
5576     )]
5577 )
5578 case "$ntp_cv_iflist_sysctl" in
5579  yes)
5580     AC_DEFINE([HAVE_IFLIST_SYSCTL], [1], [have iflist_sysctl?])
5581 esac
5582
5583 ###
5584
5585 AC_MSG_CHECKING([if we want the saveconfig mechanism])
5586 AC_ARG_ENABLE(
5587     [saveconfig],
5588     [AS_HELP_STRING(
5589         [--enable-saveconfig],
5590         [+ saveconfig mechanism]
5591     )],
5592     [ntp_ok=$enableval],
5593     [ntp_ok=yes]
5594 )
5595 ntp_saveconfig_enabled=0
5596 if test "$ntp_ok" = "yes"; then
5597     ntp_saveconfig_enabled=1
5598     AC_DEFINE([SAVECONFIG], [1], [saveconfig mechanism])
5599 fi
5600 AM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
5601 AC_MSG_RESULT([$ntp_ok])
5602
5603 ###
5604
5605 AC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
5606     [Default location of crypto key info])
5607
5608 AC_CONFIG_FILES([Makefile])
5609 AC_CONFIG_FILES([ElectricFence/Makefile])
5610 AC_CONFIG_FILES([adjtimed/Makefile])
5611 AC_CONFIG_FILES([clockstuff/Makefile])
5612 AC_CONFIG_FILES([include/Makefile])
5613 AC_CONFIG_FILES([include/isc/Makefile])
5614 AC_CONFIG_FILES([kernel/Makefile])
5615 AC_CONFIG_FILES([kernel/sys/Makefile])
5616 AC_CONFIG_FILES([libntp/Makefile])
5617 AC_CONFIG_FILES([libparse/Makefile])
5618 AC_CONFIG_FILES([ntpd/Makefile])
5619 AC_CONFIG_FILES([ntpdate/Makefile])
5620 AC_CONFIG_FILES([ntpdc/Makefile])
5621 AC_CONFIG_FILES([ntpdc/nl.pl],          [chmod +x ntpdc/nl.pl])
5622 AC_CONFIG_FILES([ntpq/Makefile])
5623 AC_CONFIG_FILES([ntpsnmpd/Makefile])
5624 AC_CONFIG_FILES([parseutil/Makefile])
5625 AC_CONFIG_FILES([scripts/Makefile])
5626 AC_CONFIG_FILES([scripts/calc_tickadj], [chmod +x scripts/calc_tickadj])
5627 AC_CONFIG_FILES([scripts/checktime],    [chmod +x scripts/checktime])
5628 AC_CONFIG_FILES([scripts/freq_adj],     [chmod +x scripts/freq_adj])
5629 AC_CONFIG_FILES([scripts/html2man],     [chmod +x scripts/html2man])
5630 AC_CONFIG_FILES([scripts/mkver],        [chmod +x scripts/mkver])
5631 AC_CONFIG_FILES([scripts/ntp-wait],     [chmod +x scripts/ntp-wait])
5632 AC_CONFIG_FILES([scripts/ntpsweep],     [chmod +x scripts/ntpsweep])
5633 AC_CONFIG_FILES([scripts/ntptrace],     [chmod +x scripts/ntptrace])
5634 AC_CONFIG_FILES([scripts/ntpver],       [chmod +x scripts/ntpver])
5635 AC_CONFIG_FILES([scripts/plot_summary], [chmod +x scripts/plot_summary])
5636 AC_CONFIG_FILES([scripts/summary],      [chmod +x scripts/summary])
5637 AC_CONFIG_FILES([util/Makefile])
5638
5639 AC_CONFIG_SUBDIRS([sntp])
5640
5641 AC_OUTPUT