configure.ac revision 200576
1181834Srobertodnl -*-fundamental-*-
2181834Srobertodnl Process this file with autoconf to produce a configure script.
3181834Srobertom4_include([version.m4])
4181834SrobertoAC_INIT(ntp, VERSION_NUMBER)
5181834SrobertoAM_INIT_AUTOMAKE
6181834SrobertoAC_CANONICAL_HOST
7181834Srobertodnl the 'build' machine is where we run configure and compile
8181834Srobertodnl the 'host' machine is where the resulting stuff runs.
9181834SrobertoAC_DEFINE_UNQUOTED(STR_SYSTEM, "$host", [canonical system (cpu-vendor-os) of where we should run])
10200576SrobertoAM_CONFIG_HEADER([config.h])
11181834Srobertodnl AC_ARG_PROGRAM
12181834SrobertoAC_PREREQ(2.53)
13181834Sroberto
14181834Srobertoac_cv_var_atom_ok=no
15181834Srobertoac_cv_var_oncore_ok=no
16181834Srobertoac_cv_var_parse_ok=no
17181834Srobertoac_cv_var_ripe_ncc_ok=no
18181834Srobertoac_cv_var_jupiter_ok=no
19181834Sroberto
20181834Srobertodnl Grab any initial CFLAGS so we can pick better defaults.
21181834SrobertoiCFLAGS="$CFLAGS"
22181834Sroberto
23181834Srobertodnl check these early to avoid autoconf warnings
24181834SrobertoAC_AIX
25181834SrobertoAC_MINIX
26181834Sroberto
27200576Sroberto# So far, the only shared library we might use is libopts.
28200576Sroberto# It's a small library - we might as well use a static version of it.
29200576SrobertoAC_DISABLE_SHARED
30200576Sroberto
31181834Srobertodnl  we need to check for cross compile tools for vxWorks here
32181834SrobertoAC_PROG_CC
33181834Sroberto# Ralf Wildenhues: With per-target flags we need CC_C_O
34200576Sroberto# AM_PROG_CC_C_O supersets AC_PROG_CC_C_O
35200576SrobertoAM_PROG_CC_C_O
36181834SrobertoAC_PROG_CC_STDC
37181834SrobertoAC_PROG_CPP
38181834Sroberto
39181834Sroberto# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
40181834Srobertocase "$host" in
41181834Sroberto *-*-amigaos)
42181834Sroberto    CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA"
43181834Sroberto    ;;
44181834Sroberto *-*-hpux10.*)	# at least for hppa2.0-hp-hpux10.20
45181834Sroberto    case "$GCC" in
46181834Sroberto     yes)
47181834Sroberto	;;
48181834Sroberto     *) CFLAGS="$CFLAGS -Wp,-H18816"
49181834Sroberto	;;
50181834Sroberto    esac
51181834Sroberto    ;;
52181834Sroberto *-pc-cygwin*)
53181834Sroberto    CFLAGS="$CFLAGS -DSYS_CYGWIN32"
54181834Sroberto    ;;
55181834Sroberto i386-sequent-sysv4)
56181834Sroberto    case "$CC" in
57181834Sroberto     cc)
58181834Sroberto	CFLAGS="$CFLAGS -Wc,+abi-socket"
59181834Sroberto	;;
60181834Sroberto    esac
61181834Sroberto    ;;
62181834Sroberto *-*-mpeix*)
63181834Sroberto    CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB"
64181834Sroberto    LDFLAGS="$LDFLAGS -L/SYSLOG/PUB"
65181834Sroberto    LIBS="$LIBS -lcurses"
66181834Sroberto    ;;
67181834Sroberto *-*-solaris*)
68181834Sroberto    # see "man standards".
69181834Sroberto    # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
70181834Sroberto    # -D_XOPEN_SOURCE=600 seems OK for c99
71181834Sroberto    #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
72181834Sroberto    CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
73181834Sroberto    libxnet=-lxnet
74181834Sroberto    ;;
75181834Srobertoesac
76181834Sroberto
77181834SrobertoAMU_OS_CFLAGS
78181834Sroberto
79181834Sroberto# NTP has (so far) been relying on leading-edge autogen.
80181834Sroberto# Therefore, by default:
81181834Sroberto# - use the version we ship with
82181834Sroberto# - do not install it
83181834Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
84181834Srobertocase "${enable_local_libopts+set}" in
85181834Sroberto set) ;;
86181834Sroberto *) enable_local_libopts=yes ;;
87181834Srobertoesac
88181834Srobertocase "${enable_libopts_install+set}" in
89181834Sroberto set) ;;
90181834Sroberto *) enable_libopts_install=no ;;
91181834Srobertoesac
92181834SrobertoLIBOPTS_CHECK(libopts)
93181834Sroberto
94200576SrobertoAC_CACHE_CHECK(
95200576Sroberto    [if $CC can handle @%:@warning],
96200576Sroberto    ac_cv_cpp_warning,
97200576Sroberto    [
98200576Sroberto	AC_COMPILE_IFELSE(
99200576Sroberto	    AC_LANG_PROGRAM([], [#warning foo]),
100200576Sroberto	    [ac_cv_cpp_warning=yes],
101200576Sroberto	    [ac_cv_cpp_warning=no],
102200576Sroberto	)
103200576Sroberto    ]
104200576Sroberto)
105181834Sroberto
106181834Srobertocase "$ac_cv_cpp_warning" in
107181834Sroberto no)
108200576Sroberto    AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid @%:@warning on option name collisions?])
109181834Srobertoesac
110181834Sroberto
111200576Srobertocase "$GCC" in
112200576Sroberto yes)
113200576Sroberto    SAVED_CFLAGS_AC="$CFLAGS"
114200576Sroberto    CFLAGS="$CFLAGS -Wstrict-overflow"
115200576Sroberto    AC_CACHE_CHECK(
116200576Sroberto	[if $CC can handle -Wstrict-overflow], 
117200576Sroberto	ac_cv_gcc_Wstrict_overflow, 
118200576Sroberto	[
119200576Sroberto	    AC_COMPILE_IFELSE(
120200576Sroberto		[AC_LANG_PROGRAM([], [])],
121200576Sroberto		[ac_cv_gcc_Wstrict_overflow=yes],
122200576Sroberto		[ac_cv_gcc_Wstrict_overflow=no]
123200576Sroberto	    )
124200576Sroberto	]
125200576Sroberto    )
126200576Sroberto    CFLAGS="$SAVED_CFLAGS_AC"
127200576Sroberto    unset SAVED_CFLAGS_AC
128200576Sroberto    #
129200576Sroberto    # $ac_cv_gcc_Wstrict_overflow is tested later to add the 
130200576Sroberto    # flag to CFLAGS.
131200576Sroberto    #
132200576Srobertoesac
133200576Sroberto
134200576Sroberto
135200576Srobertocase "$GCC" in
136200576Sroberto yes)
137200576Sroberto    SAVED_CFLAGS_AC="$CFLAGS"
138200576Sroberto    CFLAGS="$CFLAGS -Winit-self"
139200576Sroberto    AC_CACHE_CHECK(
140200576Sroberto	[if $CC can handle -Winit-self], 
141200576Sroberto	ac_cv_gcc_Winit_self, 
142200576Sroberto	[
143200576Sroberto	    AC_COMPILE_IFELSE(
144200576Sroberto		[AC_LANG_PROGRAM([], [])],
145200576Sroberto		[ac_cv_gcc_Winit_self=yes],
146200576Sroberto		[ac_cv_gcc_Winit_self=no]
147200576Sroberto	    )
148200576Sroberto	]
149200576Sroberto    )
150200576Sroberto    CFLAGS="$SAVED_CFLAGS_AC"
151200576Sroberto    unset SAVED_CFLAGS_AC
152200576Sroberto    #
153200576Sroberto    # $ac_cv_gcc_Winit_self is tested later to add the 
154200576Sroberto    # flag to CFLAGS.
155200576Sroberto    #
156200576Srobertoesac
157200576Sroberto
158200576Sroberto
159200576Sroberto
160200576SrobertoAC_MSG_CHECKING([for bin subdirectory])
161181834SrobertoAC_ARG_WITH(binsubdir,
162181834Sroberto	AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
163181834Sroberto	use_binsubdir="$withval", use_binsubdir="bin")
164181834Sroberto
165181834Srobertocase "$use_binsubdir" in
166181834Sroberto bin)
167181834Sroberto    ;;
168181834Sroberto sbin)
169181834Sroberto    ;;
170181834Sroberto *)
171181834Sroberto    AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
172181834Sroberto    ;;
173181834Srobertoesac
174181834SrobertoAC_MSG_RESULT($use_binsubdir)
175181834SrobertoBINSUBDIR=$use_binsubdir
176181834SrobertoAC_SUBST(BINSUBDIR)
177181834Sroberto
178200576SrobertoAC_MSG_CHECKING([if we want to use arlib])
179181834SrobertoAC_ARG_WITH(arlib,
180181834Sroberto	AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]),
181181834Sroberto	[ans=$withval], [ans=no])
182200576SrobertoAC_MSG_RESULT([$ans])
183181834Sroberto
184181834Srobertoif test -d $srcdir/arlib
185181834Srobertothen
186181834Sroberto    case "$ans" in
187181834Sroberto     yes)
188181834Sroberto	ARLIB_DIR=arlib
189181834Sroberto	AC_CONFIG_SUBDIRS(arlib)
190181834Sroberto	;;
191181834Sroberto    esac
192181834Srobertofi
193181834SrobertoAC_SUBST(ARLIB_DIR)
194181834Sroberto
195181834SrobertoAC_ARG_WITH(rpath,
196181834Sroberto	AC_HELP_STRING([--without-rpath], [s Disable auto-added -R linker paths]),
197181834Sroberto[ans=$withval], [ans=x])
198181834Srobertocase "$ans" in
199181834Sroberto no)
200181834Sroberto    need_dash_r=
201181834Sroberto    ;;
202181834Sroberto yes)
203181834Sroberto    need_dash_r=1
204181834Sroberto    ;;
205181834Srobertoesac
206181834Sroberto# HMS: Why isn't this $build?
207181834Sroberto# Well, that depends on if we need this for the build toolchain or
208181834Sroberto# for info in the host executable...
209181834Sroberto# I still have no idea which way this should go, but nobody has complained.
210181834Srobertocase "$host" in
211181834Sroberto *-*-netbsd*)
212181834Sroberto    case "$need_dash_r" in
213181834Sroberto     no) ;;
214181834Sroberto     *)  need_dash_r=1
215181834Sroberto	 ;;
216181834Sroberto    esac
217181834Sroberto    ;;
218181834Sroberto *-*-solaris*)
219181834Sroberto    case "$need_dash_r" in
220181834Sroberto     no) ;;
221181834Sroberto     *)  need_dash_r=1
222181834Sroberto	 ;;
223181834Sroberto    esac
224181834Sroberto    ;;
225181834Srobertoesac
226181834Sroberto
227181834Sroberto
228181834Srobertocase "$build" in
229181834Sroberto $host)
230181834Sroberto    ;;
231181834Sroberto *) case "$host" in
232181834Sroberto     *-*-vxworks*)
233181834Sroberto	# Quick and dirty sanity check
234181834Sroberto	case "$VX_KERNEL" in
235181834Sroberto	 '') AC_MSG_ERROR(Please follow the directions in html/build/hints/vxworks.html!)
236181834Sroberto	    ;;
237181834Sroberto	esac
238181834Sroberto        CFLAGS="$CFLAGS -DSYS_VXWORKS"
239181834Sroberto        ;;
240181834Sroberto    esac
241181834Sroberto    ;;
242181834Srobertoesac
243181834Sroberto
244181834Srobertodnl  we need to check for cross compile tools for vxWorks here
245181834SrobertoAC_PROG_AWK
246181834SrobertoAC_PROG_MAKE_SET
247181834Sroberto
248181834Srobertorm -f conftest*
249181834Sroberto
250181834Srobertocase "$GCC" in
251181834Sroberto yes)
252181834Sroberto    CFLAGS="$CFLAGS -Wall"
253181834Sroberto    # CFLAGS="$CFLAGS -Wcast-align"
254181834Sroberto    CFLAGS="$CFLAGS -Wcast-qual"
255181834Sroberto    # CFLAGS="$CFLAGS -Wconversion"
256181834Sroberto    # CFLAGS="$CFLAGS -Werror"
257181834Sroberto    # CFLAGS="$CFLAGS -Wextra"
258181834Sroberto    # CFLAGS="$CFLAGS -Wfloat-equal"
259181834Sroberto    CFLAGS="$CFLAGS -Wmissing-prototypes"
260181834Sroberto    CFLAGS="$CFLAGS -Wpointer-arith"
261181834Sroberto    CFLAGS="$CFLAGS -Wshadow"
262200576Sroberto    #
263200576Sroberto    # OpenSSL has a number of callback prototypes
264200576Sroberto    # inside other function prototypes which trigger
265200576Sroberto    # warnings with -Wstrict-prototypes, such as:
266200576Sroberto    #
267200576Sroberto    # int i2d_RSA_NET(const RSA *a, unsigned char **pp, 
268200576Sroberto    #                 int (*cb)(), int sgckey);
269200576Sroberto    #                 ^^^^^^^^^^^
270200576Sroberto    #
271200576Sroberto    CFLAGS="$CFLAGS -Wno-strict-prototypes"
272181834Sroberto    # CFLAGS="$CFLAGS -Wtraditional"
273181834Sroberto    # CFLAGS="$CFLAGS -Wwrite-strings"
274200576Sroberto    case "$ac_cv_gcc_Winit_self" in
275200576Sroberto     yes)
276200576Sroberto	CFLAGS="$CFLAGS -Winit-self"
277200576Sroberto    esac
278200576Sroberto    case "$ac_cv_gcc_Wstrict_overflow" in
279200576Sroberto     yes)
280200576Sroberto        #not yet: CFLAGS="$CFLAGS -Wstrict-overflow"
281200576Sroberto    esac
282181834Sroberto    ;;
283181834Srobertoesac
284181834Sroberto
285181834Srobertocase "$host" in
286181834Sroberto *-next-nextstep3)
287181834Sroberto    CFLAGS="$CFLAGS -posix"
288181834Sroberto    ;;
289181834Srobertodnl This is currently commented out by bor. 
290181834Srobertodnl The new versions of ReliantUNIX round adjtime() interval down
291181834Srobertodnl to 1/100s (system tick). This makes tickadj actually useless.
292181834Srobertodnl So, I'd better not use additional flags.
293181834Srobertodnl I leave it here just in case anybody has better idea
294181834Srobertodnl  mips-sni-sysv4* )
295181834Srobertodnl     #
296181834Srobertodnl     # Add flags for 64 bit file access to enable tickadj to access /dev/kmem
297181834Srobertodnl     #
298181834Srobertodnl     if getconf _LFS_CFLAGS > /dev/null 2>&1 ; then
299181834Srobertodnl       CFLAGS="$CFLAGS `getconf _LFS_CFLAGS`"
300181834Srobertodnl     fi
301181834Srobertodnl     ;;
302181834Srobertoesac
303181834Sroberto
304181834Srobertoac_busted_vpath_in_make=no
305181834Sroberto
306181834Srobertocase "$build" in
307181834Sroberto *-*-irix6.1*)	# 64 bit only
308181834Sroberto    # busted vpath?
309181834Sroberto    ;;
310181834Sroberto *-*-irix6*)	# 6.2 (and later?)
311181834Sroberto    ac_busted_vpath_in_make=yes
312181834Sroberto    ;;
313181834Sroberto *-*-solaris2.5.1)
314181834Sroberto    ac_busted_vpath_in_make=yes
315181834Sroberto    ;;
316181834Sroberto *-*-unicosmp*)
317181834Sroberto    ac_busted_vpath_in_make=yes
318181834Sroberto    ;;
319181834Srobertoesac
320181834Sroberto
321181834Srobertocase "$ac_busted_vpath_in_make$srcdir" in
322181834Sroberto no*) ;;
323181834Sroberto yes.) ;;
324181834Sroberto *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in
325181834Sroberto     '')
326200576Sroberto	AC_MSG_ERROR([building outside of the main directory requires GNU make])
327181834Sroberto	;;
328181834Sroberto     *) ;;
329181834Sroberto    esac
330181834Sroberto    ;;
331181834Srobertoesac
332181834Sroberto
333181834SrobertoAC_SUBST(CFLAGS)dnl
334181834SrobertoAC_SUBST(LDFLAGS)dnl
335181834Sroberto
336200576Srobertom4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
337200576Srobertom4_defun([_LT_AC_LANG_F77_CONFIG], [:])
338181834Sroberto
339181834SrobertoAC_PROG_LIBTOOL
340200576Sroberto
341181834SrobertoAC_PROG_LN_S
342181834SrobertoAC_PROG_GCC_TRADITIONAL
343181834SrobertoAC_C_VOLATILE
344181834SrobertoAC_ISC_POSIX
345181834SrobertoAC_PATH_PROG(PATH_SH, sh)
346181834SrobertoAC_PATH_PROG(PATH_PERL, perl)
347181834Sroberto
348200576Srobertohs_ULONG_CONST		# remove for 4.2.5
349181834Sroberto
350181834Srobertocase "$host" in
351181834Sroberto *-*-vxworks*)
352181834Sroberto    ac_link="$ac_link $VX_KERNEL"
353181834Sroberto    ;;
354181834Srobertoesac
355181834Sroberto
356181834SrobertoAC_PROG_INSTALL
357181834Sroberto
358181834Srobertocase "$host" in
359181834Sroberto *-pc-cygwin*)
360181834Sroberto    AC_CHECK_LIB(advapi32, main)
361181834Sroberto    ;;
362181834Srobertoesac
363181834Sroberto
364200576SrobertoAC_CHECK_FUNC([gethostent], ,
365200576Sroberto  AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket]))
366200576SrobertoAC_CHECK_FUNC([openlog], , 
367200576Sroberto  AC_SEARCH_LIBS([openlog], [gen], , 
368200576Sroberto  AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])))
369200576SrobertoAC_SEARCH_LIBS([MD5Init], [md5 md])
370181834SrobertoAC_CHECK_FUNCS(MD5Init)
371200576Sroberto
372200576Sroberto# following block becomes on 4.2.5: NTP_LINEEDITLIBS
373181834Srobertodnl HMS: What a hack...
374181834SrobertoAC_CHECK_HEADERS(readline/history.h readline/readline.h)
375181834Srobertocase "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
376181834Sroberto *no*) ;;
377181834Sroberto *) save_LIBS=$LIBS
378181834Sroberto    LIBS=
379181834Sroberto    # Ralf Wildenhues: either unset ... or cache READLINE_LIBS
380181834Sroberto    unset ac_cv_lib_readline_readline
381181834Sroberto    AC_CHECK_LIB(readline, readline, ,
382181834Sroberto     AC_MSG_NOTICE([Trying again with -lcurses])
383181834Sroberto     unset ac_cv_lib_readline_readline
384181834Sroberto     AC_CHECK_LIB(readline, readline,
385181834Sroberto      LIBS="-lreadline -lcurses $LIBS"
386181834Sroberto      AC_DEFINE(HAVE_LIBREADLINE)
387181834Sroberto      AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]),
388181834Sroberto      AC_CHECK_LIB(edit, readline,
389181834Sroberto       LIBS="-ledit -lcurses"
390181834Sroberto       AC_DEFINE(HAVE_LIBEDIT, , [Do we have the edit library?])
391181834Sroberto       AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?])
392181834Sroberto       , , -lcurses)
393181834Sroberto      , -lcurses))
394181834Sroberto    READLINE_LIBS=$LIBS
395181834Sroberto    AC_SUBST(READLINE_LIBS)
396181834Sroberto    LIBS=$save_LIBS
397181834Sroberto    ;;
398181834Srobertoesac
399181834Sroberto
400181834Srobertodnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
401181834Srobertodnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
402181834Srobertodnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
403181834Srobertodnl does Strange Things with extra processes using the Posix-compatibility
404181834Srobertodnl real-time library, so we don't want to use it.
405181834Sroberto
406181834Srobertocase "$host" in
407200576Sroberto *-*-*linux*) ;;
408181834Sroberto *)
409181834Sroberto    AC_CHECK_LIB(rt, sched_setscheduler, ,
410181834Sroberto	AC_CHECK_LIB(posix4, sched_setscheduler))
411181834Sroberto    ;;
412181834Srobertoesac
413181834Sroberto
414181834SrobertoAC_CHECK_FUNC(setsockopt, ,
415200576Sroberto	[AC_SEARCH_LIBS([setsockopt], [socket xnet])])
416181834Sroberto
417181834SrobertoAC_HEADER_STDC
418181834SrobertoAC_CHECK_HEADERS(bstring.h)
419181834SrobertoAC_CHECK_HEADER(dns_sd.h,
420181834Sroberto	[AC_CHECK_LIB(dns_sd,
421181834Sroberto			DNSServiceRegister,
422181834Sroberto			[AC_DEFINE(HAVE_DNSREGISTRATION, 1,
423181834Sroberto				[Use Rendezvous/DNS-SD registration])])])
424181834Srobertocase "$ac_cv_lib_dns_sd_DNSServiceRegister" in
425181834Sroberto yes) LIBS="-ldns_sd $LIBS" ;;
426181834Srobertoesac
427181834SrobertoAC_CHECK_HEADERS(errno.h fcntl.h ieeefp.h math.h)
428181834Sroberto
429181834Sroberto# HMS: Lame, but fast.
430181834Srobertoif test -f /etc/redhat-release
431181834Srobertothen
432181834Sroberto    :
433181834Srobertoelse
434181834Sroberto    AC_CHECK_HEADERS(md5.h, [], [],
435181834Sroberto[#if HAVE_SYS_TYPES_H
436181834Sroberto#include <sys/types.h>
437181834Sroberto#endif
438181834Sroberto])
439181834Srobertofi
440181834SrobertoAC_CHECK_HEADERS(memory.h netdb.h poll.h)
441181834SrobertoAC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
442181834SrobertoAC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
443181834Srobertocase "$host" in
444181834Sroberto *-*-aix*)
445181834Sroberto    AC_CHECK_HEADERS(utmpx.h)
446181834Sroberto    case "$ac_cv_header_utmpx_h" in
447181834Sroberto     yes) ;;
448181834Sroberto     *) AC_CHECK_HEADERS(utmp.h) ;;
449181834Sroberto    esac
450181834Sroberto    ;;
451181834Sroberto *) AC_CHECK_HEADERS(utmp.h utmpx.h) ;;
452181834Srobertoesac
453181834SrobertoAC_CHECK_HEADERS(arpa/nameser.h)
454181834SrobertoAC_CHECK_HEADERS(sys/socket.h)
455181834SrobertoAC_CHECK_HEADERS(net/if.h, [], [],
456181834Sroberto[#if HAVE_SYS_SOCKET_H
457181834Sroberto#include <sys/socket.h>
458181834Sroberto#endif
459181834Sroberto])
460181834SrobertoAC_CHECK_HEADERS(net/if6.h)
461181834SrobertoAC_CHECK_HEADERS(net/route.h, [], [], [
462181834Sroberto#include <sys/types.h>
463181834Sroberto#include <sys/socket.h>
464181834Sroberto#include <net/if.h>
465181834Sroberto])
466181834SrobertoAC_CHECK_HEADERS(netinet/in_system.h netinet/in_systm.h)
467181834SrobertoAC_CHECK_HEADERS(netinet/in.h)
468181834SrobertoAC_CHECK_HEADERS(netinet/ip.h, [], [],
469181834Sroberto[#if HAVE_SYS_TYPES_H
470181834Sroberto#include <sys/types.h>
471181834Sroberto#endif
472181834Sroberto#if HAVE_NETINET_IN_H
473181834Sroberto#include <netinet/in.h>
474181834Sroberto#endif
475181834Sroberto#if HAVE_NETINET_IN_SYSTM_H
476181834Sroberto#include <netinet/in_systm.h>
477181834Sroberto#endif
478181834Sroberto])
479200576Sroberto
480200576Sroberto# Check for IPTOS_PREC
481200576SrobertoAC_CACHE_CHECK(
482200576Sroberto    [IPPROTO_IP IP_TOS IPTOS_LOWDELAY],
483200576Sroberto    ac_cv_ip_tos,
484200576Sroberto    [
485200576Sroberto	AC_EGREP_CPP(
486200576Sroberto	    [yes],
487200576Sroberto	    [
488200576Sroberto		#if HAVE_SYS_TYPES_H
489200576Sroberto		#include <sys/types.h>
490200576Sroberto		#endif
491200576Sroberto		#if HAVE_NETINET_IP_H
492200576Sroberto		#include <netinet/in.h>
493200576Sroberto		#include <netinet/ip.h>
494200576Sroberto		#endif
495200576Sroberto		#if defined(IPPROTO_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
496200576Sroberto		  yes
497200576Sroberto		#endif
498200576Sroberto	    ],
499200576Sroberto	    [ac_cv_ip_tos=yes],
500200576Sroberto	    [ac_cv_ip_tos=no]
501200576Sroberto	)
502200576Sroberto    ]
503200576Sroberto)
504200576Sroberto
505200576Srobertocase "$ac_cv_ip_tos" in
506200576Sroberto yes)
507200576Sroberto    AC_DEFINE(HAVE_IPTOS_SUPPORT, 1, [Do we have IPTOS support?])
508200576Srobertoesac
509200576Sroberto
510181834SrobertoAC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])])
511181834SrobertoAC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
512181834Srobertodnl AC_CHECK_HEADERS(sys/chudefs.h)
513181834SrobertoAC_CHECK_HEADERS(sys/clkdefs.h sys/file.h)
514181834Srobertocase "$host" in
515181834Sroberto *-*-sunos4*) ;;
516181834Sroberto *) AC_CHECK_HEADERS(sys/ioctl.h)
517181834Sroberto    ;;
518181834Srobertoesac
519181834SrobertoAC_CHECK_HEADERS(sys/ipc.h)
520181834SrobertoAC_CHECK_HEADERS(sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h)
521181834Sroberto# HMS: Check sys/proc.h and sys/resource.h after some others
522181834SrobertoAC_CHECK_HEADERS(sys/ppstime.h)
523181834Srobertocase "$ac_cv_header_sched_h" in
524181834Sroberto yes) ;;
525181834Sroberto *) AC_CHECK_HEADERS(sys/sched.h) ;;
526181834Srobertoesac
527181834Srobertocase "$host" in
528181834Sroberto *-*-sco*)
529181834Sroberto    AC_CHECK_HEADERS(sys/sio.h)
530181834Sroberto    ;;
531181834Srobertoesac
532181834Sroberto# HMS: Check sys/shm.h after some others
533181834SrobertoAC_CHECK_HEADERS(sys/select.h sys/signal.h sys/sockio.h)
534181834Sroberto# HMS: Checked sys/socket.h earlier
535181834Srobertocase "$host" in
536181834Sroberto *-*-netbsd*) ;;
537181834Sroberto *) AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h)
538181834Sroberto    ;;
539181834Srobertoesac
540181834SrobertoAC_CHECK_HEADERS(sys/stat.h sys/stream.h)
541181834SrobertoAC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/syssgi.h sys/systune.h)
542181834SrobertoAC_CHECK_HEADERS(sys/termios.h sys/time.h sys/signal.h)
543181834SrobertoAC_EGREP_CPP(yes,
544181834Sroberto[#if HAVE_SYS_TIME_H
545181834Sroberto# include <sys/time.h>
546181834Sroberto#endif
547181834Sroberto#if HAVE_ERRNO_H
548181834Sroberto# include <errno.h>
549181834Sroberto#endif
550181834Sroberto#include <sys/timepps.h>
551181834Sroberto#ifdef PPS_API_VERS_1
552181834Srobertoyes
553181834Sroberto#endif
554181834Sroberto], [AC_CHECK_HEADERS(sys/timepps.h, [], [],
555181834Sroberto[#if HAVE_SYS_TIME_H
556181834Sroberto# include <sys/time.h>
557181834Sroberto#endif
558181834Sroberto#if HAVE_ERRNO_H
559181834Sroberto# include <errno.h>
560181834Sroberto#endif
561181834Sroberto])
562181834Sroberto])
563181834SrobertoAC_CHECK_HEADERS(sys/timers.h sys/tpro.h sys/types.h sys/wait.h)
564181834SrobertoAC_HEADER_TIME
565181834Srobertocase "$host" in
566181834Sroberto*-convex-*)
567181834Sroberto  AC_CHECK_HEADERS(/sys/sync/queue.h /sys/sync/sema.h)
568181834Sroberto  ;;
569181834Sroberto*-*-bsdi*)
570181834Sroberto  AC_CHECK_HEADERS(machine/inline.h sys/pcl720.h sys/i8253.h)
571181834Sroberto  ;;
572181834Srobertoesac
573181834Sroberto
574181834Srobertocase "$host" in
575200576Sroberto *-*-*linux*)
576181834Sroberto    AC_CHECK_FUNCS(__adjtimex __ntp_gettime)
577181834Sroberto    ;;
578181834Srobertoesac
579181834Srobertocase "$ac_cv_func___adjtimex" in
580181834Sroberto yes) ;;
581181834Sroberto *)
582181834Sroberto    AC_CHECK_LIB(elf, nlist)	dnl Only needed for tickadj...
583181834Sroberto    dnl AC_CHECK_LIB(kvm, main, , , -lelf)
584181834Sroberto    AC_CHECK_LIB(kvm, main)		dnl We already know about -lelf here...
585181834Sroberto    AC_CHECK_LIB(ld, nlist)
586181834Sroberto    AC_CHECK_LIB(mld, nlist)
587181834Sroberto    AC_CHECK_HEADER(nlist.h,
588181834Sroberto    [AC_DEFINE(NLIST_STRUCT, 1, [nlist stuff])
589181834Sroberto     AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
590181834Sroberto      [AC_TRY_COMPILE([#include <nlist.h>],
591181834Sroberto       [struct nlist n; n.n_un.n_name = 0;],
592181834Sroberto       ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
593181834Sroberto     if test $ac_cv_struct_nlist_n_un = yes; then
594181834Sroberto       AC_DEFINE(NLIST_NAME_UNION, 1, [does struct nlist use a name union?])
595181834Sroberto     fi
596181834Sroberto    ])dnl
597181834Sroberto    ;;
598181834Srobertoesac
599181834Sroberto
600181834Srobertodnl AC_CHECK_HEADERS(net/if.h, [], [],
601181834Srobertodnl [#if HAVE_SYS_TYPES_H
602181834Srobertodnl # include <sys/types.h>
603181834Srobertodnl #endif
604181834Srobertodnl #if HAVE_SYS_SOCKET_H
605181834Srobertodnl # include <sys/socket.h>
606181834Srobertodnl #endif
607181834Srobertodnl ])
608181834Sroberto
609181834SrobertoAC_CHECK_HEADERS(sys/proc.h, [], [],
610181834Sroberto[#if HAVE_SYS_TYPES_H
611181834Sroberto# include <sys/types.h>
612181834Sroberto#endif
613181834Sroberto#if HAVE_SYS_TIME_H
614181834Sroberto# include <sys/time.h>
615181834Sroberto#endif
616181834Sroberto])
617181834Sroberto
618181834SrobertoAC_CHECK_HEADERS(sys/resource.h, [], [],
619181834Sroberto[#if HAVE_SYS_TIME_H
620181834Sroberto# include <sys/time.h>
621181834Sroberto#endif
622181834Sroberto])
623181834Sroberto
624181834SrobertoAC_CHECK_HEADERS(sys/shm.h, [], [],
625181834Sroberto[#if HAVE_SYS_TYPES_H
626181834Sroberto# include <sys/types.h>
627181834Sroberto#endif
628181834Sroberto#if HAVE_SYS_IPC_H
629181834Sroberto# include <sys/ipc.h>
630181834Sroberto#endif
631181834Sroberto])
632181834Sroberto
633181834SrobertoAC_CHECK_HEADERS(sys/timex.h, [], [],
634181834Sroberto[#if HAVE_SYS_TIME_H
635181834Sroberto# include <sys/time.h>
636181834Sroberto#endif
637181834Sroberto])
638181834Sroberto
639181834SrobertoAC_CHECK_HEADERS(resolv.h, [], [],
640181834Sroberto[#if HAVE_SYS_TYPES_H
641181834Sroberto#include <sys/types.h>
642181834Sroberto#endif
643181834Sroberto#if HAVE_NETINET_IN_H
644181834Sroberto#include <netinet/in.h>
645181834Sroberto#endif
646181834Sroberto#if HAVE_ARPA_NAMESER_H
647181834Sroberto#include <arpa/nameser.h>
648181834Sroberto#endif
649181834Sroberto])
650181834Sroberto
651200576SrobertoAC_CACHE_CHECK([for basic volatile support], ac_cv_c_volatile,
652181834Sroberto[AC_TRY_COMPILE([],[
653181834Srobertovolatile int x;],
654181834Sroberto	ac_cv_c_volatile=yes,
655181834Sroberto	ac_cv_c_volatile=no)
656181834Sroberto])
657181834Srobertocase "$ac_cv_c_volatile" in
658181834Sroberto yes)
659181834Sroberto    ;;
660181834Sroberto *) AC_DEFINE(volatile, , [Does the compiler like "volatile"?])
661181834Sroberto    ;;
662181834Srobertoesac
663181834Sroberto
664200576Sroberto#
665200576Sroberto# following block goes away in 4.2.5
666200576Sroberto#
667181834Sroberto# AM_C_PROTOTYPES gives us ansi2knr
668181834Srobertocase "$build" in
669181834Sroberto *-*-solaris2*)
670181834Sroberto    # Assume that solaris2 is Ansi C...
671181834Sroberto    ;;
672181834Sroberto *)
673181834Sroberto    AM_C_PROTOTYPES
674181834Sroberto    ;;
675181834Srobertoesac
676181834SrobertoAC_CACHE_CHECK(if C compiler permits function prototypes, ac_cv_have_prototypes,
677181834Sroberto[AC_TRY_COMPILE([
678181834Srobertoextern int foo (short);
679181834Srobertoint foo(short i) { return i; }],[
680181834Srobertoint i;], ac_cv_have_prototypes=yes, ac_cv_have_prototypes=no)
681181834Sroberto])
682181834Srobertoif test "$ac_cv_have_prototypes" = yes; then
683181834Sroberto  AC_DEFINE(HAVE_PROTOTYPES, 1, [Are function prototypes OK?])
684181834Srobertofi
685200576Sroberto#
686200576Sroberto# end block 
687200576Sroberto#
688181834Sroberto
689181834SrobertoAC_C_CONST
690181834SrobertoAC_C_BIGENDIAN
691181834SrobertoAC_TYPE_SIGNAL
692181834SrobertoAC_TYPE_OFF_T
693181834SrobertoAC_TYPE_SIZE_T
694181834SrobertoAC_CHECK_TYPE(time_t, long)
695181834SrobertoAC_CHECK_SIZEOF(time_t)
696181834SrobertoAC_CHECK_TYPES(uintptr_t)
697181834Sroberto 
698181834SrobertoAH_VERBATIM([TYPEDEF_UINTPTR_T],
699181834Sroberto[/* Provide a typedef for uintptr_t? */
700181834Sroberto#ifndef HAVE_UINTPTR_T
701181834Srobertotypedef unsigned int	uintptr_t;
702181834Sroberto#define HAVE_UINTPTR_T	1
703181834Sroberto#endif])
704181834Sroberto
705181834SrobertoAC_STRUCT_TM
706181834Sroberto
707181834SrobertoAC_CACHE_CHECK([for u_int8_t], ac_cv_type_u_int8_t,
708181834Sroberto[AC_TRY_COMPILE([#include <sys/types.h>],
709181834Sroberto	[u_int8_t len = 42; return 0;],
710181834Sroberto	ac_cv_type_u_int8_t=yes,
711181834Sroberto	ac_cv_type_u_int8_t=no)
712181834Sroberto])
713181834Srobertoif test $ac_cv_type_u_int8_t = yes; then
714181834Sroberto	AC_DEFINE(HAVE_TYPE_U_INT8_T, 1, [Does u_int8_t exist?])
715181834Srobertofi
716181834Sroberto
717181834SrobertoAC_CACHE_CHECK([for u_int64_t], ac_cv_type_u_int64_t,
718181834Sroberto[AC_TRY_COMPILE([#include <sys/types.h>],
719181834Sroberto	[u_int64_t len = 42; return 0;],
720181834Sroberto	ac_cv_type_u_int64_t=yes,
721181834Sroberto	ac_cv_type_u_int64_t=no)
722181834Sroberto])
723181834Srobertoif test $ac_cv_type_u_int64_t = yes; then
724181834Sroberto	AC_DEFINE(HAVE_TYPE_U_INT64_T, 1, [Does u_int64_t exist?])
725181834Srobertofi
726181834Sroberto
727181834Sroberto#
728181834Sroberto# Look for in_port_t.
729181834Sroberto#
730200576SrobertoAC_MSG_CHECKING([for in_port_t])
731181834SrobertoAC_TRY_COMPILE([
732181834Sroberto#include <sys/types.h>
733181834Sroberto#include <netinet/in.h>],
734181834Sroberto[in_port_t port = 25; return (0);],
735181834Sroberto	[AC_MSG_RESULT(yes)
736181834Sroberto	],
737181834Sroberto        [AC_MSG_RESULT(no)
738181834Sroberto	AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Do we need our own in_port_t?])
739181834Sroberto	])
740181834Sroberto
741200576SrobertoAC_CACHE_CHECK([for a fallback value for HZ], ac_cv_var_default_hz,
742181834Sroberto[ac_cv_var_default_hz=100
743181834Srobertocase "$host" in
744181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
745181834Sroberto    ac_cv_var_default_hz=1024
746181834Sroberto    ;;
747181834Sroberto mips-dec-ultrix4*)
748181834Sroberto    ac_cv_var_default_hz=256
749181834Sroberto    ;;
750181834Srobertoesac])
751181834SrobertoAC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz, [What is the fallback value for HZ?])
752181834Sroberto
753200576SrobertoAC_CACHE_CHECK([if we need to override the system's value for HZ], ac_cv_var_override_hz,
754181834Sroberto[ac_cv_var_override_hz=no
755181834Srobertocase "$host" in
756181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
757181834Sroberto    ac_cv_var_override_hz=yes
758181834Sroberto    ;;
759181834Sroberto mips-dec-ultrix4*)
760181834Sroberto    ac_cv_var_override_hz=yes
761181834Sroberto    ;;
762181834Sroberto *-*-freebsd*)
763181834Sroberto    ac_cv_var_override_hz=yes
764181834Sroberto    ;;
765181834Sroberto *-*-sunos4*)
766181834Sroberto    ac_cv_var_override_hz=yes
767181834Sroberto    ;;
768181834Srobertoesac])
769181834Srobertocase "$ac_cv_var_override_hz" in
770181834Sroberto yes)
771181834Sroberto    AC_DEFINE(OVERRIDE_HZ, 1, [Do we need to override the system's idea of HZ?])
772181834Sroberto    ;;
773181834Srobertoesac
774181834Sroberto
775181834Srobertodnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
776181834Srobertodnl [AC_TRY_LINK([#include <sys/types.h>
777181834Srobertodnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
778181834Srobertodnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
779181834Srobertodnl if test $su_cv_func_ut_host_in_utmp = yes; then
780181834Srobertodnl   AC_DEFINE(HAVE_UT_HOST)
781181834Srobertodnl fi
782181834Sroberto
783181834Srobertodnl AC_MSG_CHECKING(if we can get the system boot time)
784181834Srobertodnl AC_CACHE_VAL(su_cv_have_boot_time,
785181834Srobertodnl [AC_EGREP_CPP(yes,
786181834Srobertodnl [#ifdef HAVE_UTMPX_H
787181834Srobertodnl #include <utmpx.h>
788181834Srobertodnl #else
789181834Srobertodnl #include <utmp.h>
790181834Srobertodnl #endif
791181834Srobertodnl #ifdef BOOT_TIME
792181834Srobertodnl yes
793181834Srobertodnl #endif
794181834Srobertodnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
795181834Srobertodnl AC_MSG_RESULT($su_cv_have_boot_time)
796181834Sroberto
797200576SrobertoAC_CACHE_CHECK([for struct rt_msghdr], ac_cv_struct_rt_msghdr,
798181834Sroberto[AC_TRY_COMPILE([
799181834Sroberto#include <sys/types.h>
800181834Sroberto#include <sys/socket.h>
801181834Sroberto#include <net/if.h>
802181834Sroberto#include <net/route.h>],
803181834Sroberto[struct rt_msghdr p;],
804181834Sroberto	ac_cv_struct_rt_msghdr=yes,
805181834Sroberto	ac_cv_struct_rt_msghdr=no)
806181834Sroberto])
807200576Sroberto
808181834Srobertoif test $ac_cv_struct_rt_msghdr = yes; then
809181834Sroberto    AC_DEFINE(HAS_ROUTING_SOCKET, 1, [Do we have a routing socket (struct rt_msghdr)?])
810181834Srobertofi
811181834Sroberto
812181834SrobertoAC_CACHE_CHECK(
813200576Sroberto  [struct sigaction for sa_sigaction],
814181834Sroberto  ac_cv_struct_sigaction_has_sa_sigaction,
815181834Sroberto  [
816181834Sroberto    AC_TRY_COMPILE(
817181834Sroberto      [#include <signal.h>],
818181834Sroberto      [struct sigaction act; act.sa_sigaction = 0;],
819181834Sroberto      ac_cv_struct_sigaction_has_sa_sigaction=yes,
820181834Sroberto      ac_cv_struct_sigaction_has_sa_sigaction=no
821181834Sroberto    )
822181834Sroberto  ]
823181834Sroberto)
824181834Srobertoif test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then
825181834Sroberto  AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION, 1, [Obvious...])
826181834Srobertofi
827181834Sroberto
828200576SrobertoAC_CACHE_CHECK([for struct ppsclockev], ac_cv_struct_ppsclockev,
829181834Sroberto[AC_TRY_COMPILE([
830181834Sroberto#include <sys/types.h>
831181834Sroberto#ifdef HAVE_SYS_TERMIOS_H
832181834Sroberto# include <sys/termios.h>
833181834Sroberto#endif
834181834Sroberto#ifdef HAVE_SYS_TIME_H
835181834Sroberto# include <sys/time.h>
836181834Sroberto#endif
837181834Sroberto#ifdef HAVE_SYS_PPSCLOCK_H
838181834Sroberto# include <sys/ppsclock.h>
839181834Sroberto#endif],[
840181834Srobertoextern struct ppsclockev *pce;
841181834Srobertoreturn pce->serial;],
842181834Sroberto	ac_cv_struct_ppsclockev=yes,
843181834Sroberto	ac_cv_struct_ppsclockev=no)
844181834Sroberto])
845181834Srobertoif test $ac_cv_struct_ppsclockev = yes; then
846181834Sroberto    AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV, 1, [Does a system header define struct ppsclockev?])
847181834Srobertofi
848181834Sroberto
849200576SrobertoAC_CACHE_CHECK([struct sockaddr for sa_len], ac_cv_struct_sockaddr_has_sa_len,
850181834Sroberto[AC_TRY_COMPILE([
851181834Sroberto#include <sys/types.h>
852181834Sroberto#include <sys/socket.h>],[
853181834Srobertoextern struct sockaddr *ps;
854181834Srobertoreturn ps->sa_len;],
855181834Sroberto	ac_cv_struct_sockaddr_has_sa_len=yes,
856181834Sroberto	ac_cv_struct_sockaddr_has_sa_len=no)
857181834Sroberto])
858181834Srobertoif test $ac_cv_struct_sockaddr_has_sa_len = yes; then
859181834Sroberto    AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR, 1, [Should be obvious...])
860181834Srobertofi
861181834Sroberto
862200576SrobertoAC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
863181834Sroberto[AC_TRY_COMPILE([
864181834Sroberto#include <sys/types.h>
865181834Sroberto#include <sys/socket.h>
866181834Sroberto#include <netinet/in.h>
867181834Sroberto],[
868181834Srobertostruct sockaddr_storage n;],
869181834Sroberto	ac_cv_struct_sockaddr_storage=yes,
870181834Sroberto	ac_cv_struct_sockaddr_storage=no)
871181834Sroberto])
872181834Srobertoif test $ac_cv_struct_sockaddr_storage = yes; then
873181834Sroberto    AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Does a system header define struct sockaddr_storage?])
874181834Srobertofi
875181834Sroberto
876181834SrobertoAC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
877181834Sroberto		ac_cv_have_ss_family_in_struct_ss, [
878181834Sroberto	AC_TRY_COMPILE(
879181834Sroberto		[
880181834Sroberto#include <sys/types.h>
881181834Sroberto#include <sys/socket.h>
882181834Sroberto		],
883181834Sroberto		[ struct sockaddr_storage s; s.ss_family = 1; ],
884181834Sroberto		[ ac_cv_have_ss_family_in_struct_ss="yes" ],
885181834Sroberto		[ ac_cv_have_ss_family_in_struct_ss="no" ],
886181834Sroberto	)
887181834Sroberto])
888181834Srobertoif test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
889181834Sroberto	AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
890181834Srobertoelse
891181834Sroberto    # Hack around a problem...
892181834Sroberto    # HMS: This is $host because we need the -D if we are building *for* it.
893181834Sroberto    # HMS: 061029: Now that we separate the ss_* checks this is causing
894181834Sroberto    # a problem - disable it until we get to the bottom of it.
895181834Sroberto    case "$host" in
896181834Sroberto     XXX*-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H"
897181834Sroberto	;;
898181834Sroberto    esac
899181834Srobertofi
900181834Sroberto
901181834SrobertoAC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
902181834Sroberto		ac_cv_have___ss_family_in_struct_ss, [
903181834Sroberto	AC_TRY_COMPILE(
904181834Sroberto		[
905181834Sroberto#include <sys/types.h>
906181834Sroberto#include <sys/socket.h>
907181834Sroberto		],
908181834Sroberto		[ struct sockaddr_storage s; s.__ss_family = 1; ],
909181834Sroberto		[ ac_cv_have___ss_family_in_struct_ss="yes" ],
910181834Sroberto		[ ac_cv_have___ss_family_in_struct_ss="no" ]
911181834Sroberto	)
912181834Sroberto])
913181834Srobertoif test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
914181834Sroberto	AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
915181834Srobertofi
916181834Sroberto
917181834SrobertoAH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
918181834Sroberto[/* Handle ss_family */
919181834Sroberto#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
920181834Sroberto# define ss_family __ss_family
921181834Sroberto#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
922181834Sroberto
923181834SrobertoAC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
924181834Sroberto		ac_cv_have_ss_len_in_struct_ss, [
925181834Sroberto	AC_TRY_COMPILE(
926181834Sroberto		[
927181834Sroberto#include <sys/types.h>
928181834Sroberto#include <sys/socket.h>
929181834Sroberto		],
930181834Sroberto		[ struct sockaddr_storage s; s.ss_len = 1; ],
931181834Sroberto		[ ac_cv_have_ss_len_in_struct_ss="yes" ],
932181834Sroberto		[ ac_cv_have_ss_len_in_struct_ss="no" ],
933181834Sroberto	)
934181834Sroberto])
935181834Srobertoif test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
936181834Sroberto	AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len?])
937181834Srobertofi
938181834Sroberto
939181834SrobertoAC_CACHE_CHECK([for __ss_len field in struct sockaddr_storage],
940181834Sroberto		ac_cv_have___ss_len_in_struct_ss, [
941181834Sroberto	AC_TRY_COMPILE(
942181834Sroberto		[
943181834Sroberto#include <sys/types.h>
944181834Sroberto#include <sys/socket.h>
945181834Sroberto		],
946181834Sroberto		[ struct sockaddr_storage s; s.__ss_len = 1; ],
947181834Sroberto		[ ac_cv_have___ss_len_in_struct_ss="yes" ],
948181834Sroberto		[ ac_cv_have___ss_len_in_struct_ss="no" ]
949181834Sroberto	)
950181834Sroberto])
951181834Srobertoif test "x$ac_cv_have___ss_len_in_struct_ss" = "xyes" ; then
952181834Sroberto	AC_DEFINE(HAVE___SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have __ss_len?])
953181834Srobertofi
954181834Sroberto
955181834SrobertoAH_VERBATIM([X_HAVE_SS_LEN_IN_SS],
956181834Sroberto[/* Handle ss_len */
957181834Sroberto#if !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE___SS_LEN_IN_SS)
958181834Sroberto# define ss_len __ss_len
959181834Sroberto#endif /* !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE_SA_LEN_IN_SS) */])
960181834Sroberto
961181834Srobertocase "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
962181834Sroberto  *yes*)
963181834Sroberto    AC_CACHE_CHECK([for struct snd_size], ac_cv_struct_snd_size,
964181834Sroberto[AC_TRY_COMPILE([
965181834Sroberto#ifdef HAVE_MACHINE_SOUNDCARD_H
966181834Sroberto# include <machine/soundcard.h>
967181834Sroberto#endif
968181834Sroberto#ifdef HAVE_SYS_SOUNDCARD_H
969181834Sroberto# include <sys/soundcard.h>
970181834Sroberto#endif],[
971181834Srobertoextern struct snd_size *ss;
972181834Srobertoreturn ss->rec_size;],
973181834Sroberto    ac_cv_struct_snd_size=yes,
974181834Sroberto    ac_cv_struct_snd_size=no)
975181834Sroberto])
976181834Sroberto    case "$ac_cv_struct_snd_size" in
977181834Sroberto     yes) AC_DEFINE(HAVE_STRUCT_SND_SIZE, 1,[Do we have struct snd_size?]) ;;
978181834Sroberto    esac
979181834Sroberto    ;;
980181834Srobertoesac
981181834Sroberto
982200576SrobertoAC_CACHE_CHECK([struct clockinfo for hz], ac_cv_struct_clockinfo_has_hz,
983181834Sroberto[AC_TRY_COMPILE([
984181834Sroberto#include <sys/time.h>],[
985181834Srobertoextern struct clockinfo *pc;
986181834Srobertoreturn pc->hz;],
987181834Sroberto	ac_cv_struct_clockinfo_has_hz=yes,
988181834Sroberto	ac_cv_struct_clockinfo_has_hz=no)
989181834Sroberto])
990181834Srobertoif test $ac_cv_struct_clockinfo_has_hz = yes; then
991181834Sroberto    AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
992181834Srobertofi
993181834Sroberto
994200576SrobertoAC_CACHE_CHECK([struct clockinfo for tickadj], ac_cv_struct_clockinfo_has_tickadj,
995181834Sroberto[AC_TRY_COMPILE([
996181834Sroberto#include <sys/time.h>],[
997181834Srobertoextern struct clockinfo *pc;
998181834Srobertoreturn pc->tickadj;],
999181834Sroberto	ac_cv_struct_clockinfo_has_tickadj=yes,
1000181834Sroberto	ac_cv_struct_clockinfo_has_tickadj=no)
1001181834Sroberto])
1002181834Srobertoif test $ac_cv_struct_clockinfo_has_tickadj = yes; then
1003181834Sroberto    AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
1004181834Srobertofi
1005181834Sroberto
1006181834SrobertoAC_CACHE_CHECK([for struct timespec], ac_cv_struct_timespec,
1007181834Sroberto[AC_TRY_COMPILE([
1008181834Sroberto#include <sys/time.h>
1009181834Sroberto/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */
1010181834Sroberto#ifdef HAVE_ERRNO_H
1011181834Sroberto# include <errno.h>
1012181834Sroberto#endif
1013181834Sroberto#ifdef HAVE_SYS_TIMEPPS_H
1014181834Sroberto# define FRAC 4294967296
1015181834Sroberto# include <sys/timepps.h>
1016181834Sroberto#endif],
1017181834Sroberto[struct timespec n;],
1018181834Srobertoac_cv_struct_timespec=yes, ac_cv_struct_timespec=no)])
1019181834Srobertoif test $ac_cv_struct_timespec = yes; then
1020181834Sroberto  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Do we have struct timespec?])
1021181834Srobertofi
1022181834Sroberto
1023181834SrobertoAC_CACHE_CHECK([for struct ntptimeval], ac_cv_struct_ntptimeval,
1024181834Sroberto[AC_TRY_COMPILE([
1025181834Sroberto#include <sys/time.h>
1026181834Sroberto#include <sys/timex.h>],
1027181834Sroberto[struct ntptimeval n;],
1028181834Srobertoac_cv_struct_ntptimeval=yes, ac_cv_struct_ntptimeval=no)])
1029181834Srobertoif test $ac_cv_struct_ntptimeval = yes; then
1030181834Sroberto  AC_DEFINE(HAVE_STRUCT_NTPTIMEVAL, 1, [Do we have struct ntptimeval?])
1031181834Srobertofi
1032181834Sroberto
1033181834SrobertoAC_CHECK_MEMBERS([struct ntptimeval.time.tv_nsec], , ,
1034181834Sroberto[#ifdef HAVE_SYS_TIME_H
1035181834Sroberto#include <sys/time.h>
1036181834Sroberto#else
1037181834Sroberto# ifdef HAVE_TIME_H
1038181834Sroberto# include <time.h>
1039181834Sroberto# endif
1040181834Sroberto#endif
1041181834Sroberto#ifdef HAVE_SYS_TIMEX_H
1042181834Sroberto#include <sys/timex.h>
1043181834Sroberto#else
1044181834Sroberto# ifdef HAVE_TIMEX_H
1045181834Sroberto# include <timex.h>
1046181834Sroberto# endif
1047181834Sroberto#endif])
1048181834Sroberto
1049181834SrobertoAC_C_INLINE
1050200576Sroberto
1051200576Srobertocase "$ac_cv_c_inline" in
1052200576Sroberto '')
1053200576Sroberto    ;;
1054200576Sroberto *)
1055200576Sroberto    AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
1056200576Sroberto    AC_SUBST(HAVE_INLINE)
1057200576Srobertoesac
1058200576Sroberto
1059181834SrobertoAC_C_CHAR_UNSIGNED		dnl CROSS_COMPILE?
1060181834SrobertoAC_CHECK_SIZEOF(signed char)
1061181834SrobertoAC_CHECK_SIZEOF(int)
1062181834SrobertoAC_CHECK_SIZEOF(long)
1063181834Sroberto
1064181834SrobertoAC_CHECK_TYPES([s_char])
1065181834Srobertocase "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
1066181834Sroberto *yes)
1067181834Sroberto    # We have a typedef for s_char.  Might as well believe it...
1068181834Sroberto    ;;
1069181834Sroberto no0no)
1070181834Sroberto    # We have signed chars, can't say 'signed char', no s_char typedef.
1071181834Sroberto    AC_DEFINE(NEED_S_CHAR_TYPEDEF, 1, [Do we need an s_char typedef?])
1072181834Sroberto    ;;
1073181834Sroberto no1no)
1074181834Sroberto    # We have signed chars, can say 'signed char', no s_char typedef.
1075181834Sroberto    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1076181834Sroberto    ;;
1077181834Sroberto yes0no)
1078181834Sroberto    # We have unsigned chars, can't say 'signed char', no s_char typedef.
1079181834Sroberto    AC_MSG_ERROR(No way to specify a signed character!)
1080181834Sroberto    ;;
1081181834Sroberto yes1no)
1082181834Sroberto    # We have unsigned chars, can say 'signed char', no s_char typedef.
1083181834Sroberto    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1084181834Sroberto    ;;
1085181834Srobertoesac
1086181834SrobertoAC_TYPE_UID_T
1087181834Sroberto
1088181834Srobertocase "$host" in
1089200576Sroberto *-*-aix[[456]]*)
1090181834Sroberto	# (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
1091181834Sroberto	# (returning ENOSYS).  I didn't check 4.2.  If, in the future,
1092181834Sroberto	# IBM pulls its thumbs out long enough to implement clock_settime,
1093181834Sroberto	# this conditional will need to change.  Maybe use AC_TRY_RUN
1094181834Sroberto	# instead to try to set the time to itself and check errno.
1095181834Sroberto    ;;
1096181834Sroberto *) AC_CHECK_FUNCS(clock_gettime clock_settime)
1097181834Sroberto    ;;
1098181834Srobertoesac
1099181834SrobertoAC_CHECK_FUNCS(daemon)
1100181834SrobertoAC_CHECK_FUNCS(finite, ,
1101181834Sroberto  [AC_CHECK_FUNCS(isfinite, ,
1102200576Sroberto    [AC_MSG_CHECKING([for isfinite with <math.h>])
1103181834Sroberto    _libs=$LIBS
1104181834Sroberto    LIBS="$LIBS -lm"
1105181834Sroberto    AC_TRY_LINK([#include <math.h>], [float f = 0.0; isfinite(f)],
1106181834Sroberto      [AC_MSG_RESULT(yes)
1107181834Sroberto      AC_DEFINE(HAVE_ISFINITE)],
1108181834Sroberto      AC_MSG_RESULT(no))
1109181834Sroberto    LIBS=$_libs])])
1110181834SrobertoAC_CHECK_FUNCS(getbootfile getclock getdtablesize)
1111181834Sroberto
1112181834SrobertoAC_ARG_ENABLE(getifaddrs,
1113181834Sroberto    AC_HELP_STRING([--enable-getifaddrs],
1114181834Sroberto	[s Enable the use of getifaddrs() [[yes|no|glibc]].
1115181834Srobertoglibc: Use getifaddrs() in glibc if you know it supports IPv6.]),
1116181834Sroberto    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1117181834Sroberto
1118181834Srobertocase $want_getifaddrs in
1119181834Srobertoyes|glibc)
1120181834Sroberto#
1121181834Sroberto# Do we have getifaddrs() ?
1122181834Sroberto#
1123181834Srobertocase $host in
1124200576Sroberto*-*linux*)
1125181834Sroberto	# Some recent versions of glibc support getifaddrs() which does not
1126181834Sroberto	# provide AF_INET6 addresses while the function provided by the USAGI
1127181834Sroberto	# project handles the AF_INET6 case correctly.  We need to avoid
1128181834Sroberto	# using the former but prefer the latter unless overridden by
1129181834Sroberto	# --enable-getifaddrs=glibc.
1130181834Sroberto	if test $want_getifaddrs = glibc
1131181834Sroberto	then
1132181834Sroberto		AC_CHECK_FUNCS(getifaddrs)
1133181834Sroberto	else
1134181834Sroberto		save_LIBS="$LIBS"
1135181834Sroberto		LIBS="-L/usr/local/v6/lib $LIBS"
1136181834Sroberto		AC_CHECK_LIB(inet6, getifaddrs,
1137181834Sroberto			LIBS="$LIBS -linet6"
1138181834Sroberto			AC_DEFINE(HAVE_GETIFADDRS),
1139181834Sroberto			LIBS=${save_LIBS})
1140181834Sroberto	fi
1141181834Sroberto	;;
1142181834Sroberto*)
1143181834Sroberto	AC_CHECK_FUNCS(getifaddrs)
1144181834Sroberto	;;
1145181834Srobertoesac
1146181834Sroberto;;
1147181834Srobertono)
1148181834Sroberto;;
1149181834Srobertoesac
1150181834Sroberto
1151181834SrobertoAC_MSG_CHECKING([type of socklen arg for getsockname()])
1152181834SrobertoAC_CACHE_VAL(ac_cv_func_getsockname_arg2,dnl
1153181834Sroberto[AC_CACHE_VAL(ac_cv_func_getsockname_socklen_type,dnl
1154181834Sroberto [for ac_cv_func_getsockname_arg2 in 'struct sockaddr *' 'void *'; do
1155181834Sroberto  for ac_cv_func_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
1156181834Sroberto   AC_TRY_COMPILE(dnl
1157181834Sroberto[#ifdef HAVE_SYS_TYPES_H
1158181834Sroberto#include <sys/types.h>
1159181834Sroberto#endif
1160181834Sroberto#ifdef HAVE_SYS_SOCKET_H
1161181834Sroberto#include <sys/socket.h>
1162181834Sroberto#endif
1163181834Srobertoextern getsockname (int, $ac_cv_func_getsockname_arg2, $ac_cv_func_getsockname_socklen_type *);],,dnl
1164181834Sroberto    [ac_not_found=no ; break 2], ac_not_found=yes)
1165181834Sroberto   done
1166181834Sroberto  done
1167181834Sroberto ])dnl AC_CACHE_VAL
1168181834Sroberto])dnl AC_CACHE_VAL
1169181834Srobertoif test "$ac_not_found" = yes; then
1170181834Sroberto ac_cv_func_getsockname_socklen_type='socklen_t'
1171181834Srobertofi
1172181834SrobertoAC_MSG_RESULT([$ac_cv_func_getsockname_socklen_type])
1173181834SrobertoAC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
1174181834Sroberto		   $ac_cv_func_getsockname_socklen_type,
1175181834Sroberto		   [What is getsockname()'s socklen type?])
1176181834Sroberto
1177181834SrobertoAC_CHECK_FUNCS(getrusage)
1178181834SrobertoAC_CHECK_FUNC(gettimeofday, ,[
1179181834Srobertocase "$host" in
1180181834Sroberto  *-*-mpeix*) ac_cv_func_gettimeofday=yes
1181181834Sroberto    ;;
1182181834Srobertoesac])
1183181834Srobertocase "$host" in
1184181834Sroberto *-pc-cygwin*)
1185181834Sroberto    ;;
1186181834Sroberto *) AC_CHECK_FUNCS(getuid)
1187181834Sroberto    ;;
1188181834Srobertoesac
1189181834SrobertoAC_CHECK_FUNCS(hstrerror)
1190181834Sroberto
1191181834Sroberto#
1192181834Sroberto# Check for if_nametoindex() for IPv6 scoped addresses support
1193181834Sroberto#
1194181834SrobertoAC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
1195181834Sroberto		ac_cv_have_if_nametoindex=no)
1196181834Srobertocase $ac_cv_have_if_nametoindex in
1197181834Sroberto no)
1198181834Sroberto	case "$host" in
1199181834Sroberto  	*-hp-hpux*)
1200181834Sroberto  		AC_CHECK_LIB(ipv6, if_nametoindex,
1201181834Sroberto				ac_cv_have_if_nametoindex=yes
1202181834Sroberto				LIBS="-lipv6 $LIBS",)
1203181834Sroberto  	;;
1204181834Sroberto	esac
1205181834Srobertoesac
1206181834Srobertocase $ac_cv_have_if_nametoindex in
1207181834Sroberto yes)
1208181834Sroberto	AC_DEFINE(ISC_PLATFORM_HAVEIFNAMETOINDEX, 1, [ISC: do we have if_nametoindex()?])
1209181834Sroberto	;;
1210181834Srobertoesac
1211181834Sroberto
1212181834SrobertoAC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])])
1213181834SrobertoAC_CHECK_FUNC(inet_pton, [], [AC_DEFINE(ISC_PLATFORM_NEEDPTON, 1, [ISC: provide inet_pton()])])
1214181834SrobertoAC_CHECK_FUNC(inet_aton, [], [AC_DEFINE(ISC_PLATFORM_NEEDATON, 1, [ISC: provide inet_aton()])])
1215181834SrobertoAC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset)
1216181834Srobertocase "$host" in
1217181834Sroberto *-*-sco3.2v5.0.*)
1218181834Sroberto    # Just stubs.  Idiots.
1219181834Sroberto    ;;
1220181834Sroberto *) AC_CHECK_FUNCS(mkstemp)
1221181834Sroberto    ;;
1222181834Srobertoesac
1223181834SrobertoAC_CHECK_FUNCS(mktime)
1224181834Srobertocase "$host" in
1225200576Sroberto *-*-aix[[456]]*)
1226181834Sroberto    # Just a stub.  Idiots.
1227181834Sroberto    ;;
1228181834Sroberto *-*-irix[[45]]*)
1229181834Sroberto    # Just a stub in "old" Irix.  Idiots.
1230181834Sroberto    ;;
1231200576Sroberto *-*-*linux*)
1232181834Sroberto    # there, but more trouble than it is worth for now (resolver problems)
1233181834Sroberto    ;;
1234181834Sroberto *-*-qnx*)
1235181834Sroberto    # Apparently there but not working in QNX.  Idiots?
1236181834Sroberto    ;;
1237181834Sroberto *-*-sco3.2v5.0.*)
1238181834Sroberto    # Just a stub.  Idiots.
1239181834Sroberto    ;;
1240181834Sroberto alpha*-dec-osf4*|alpha*-dec-osf5*)
1241181834Sroberto    # mlockall is there, as a #define calling memlk via <sys/mman.h>
1242181834Sroberto    # Not easy to test for - cheat.
1243181834Sroberto    AC_CHECK_FUNCS(memlk, [ac_cv_func_mlockall='yes'])
1244181834Sroberto    AC_CHECK_FUNCS(mlockall)
1245181834Sroberto    ;;
1246181834Sroberto *) AC_CHECK_FUNCS(mlockall)
1247181834Sroberto    ;;
1248181834Srobertoesac
1249181834SrobertoAC_CHECK_FUNCS(nice nlist)
1250181834Srobertocase "$host" in
1251181834Sroberto *-*-solaris2.6)
1252181834Sroberto    # Broken...
1253181834Sroberto    ;;
1254181834Sroberto *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime)
1255181834Sroberto    ;;
1256181834Srobertoesac
1257181834SrobertoAC_CHECK_FUNCS(plock pututline pututxline readlink recvmsg rtprio)
1258181834Srobertocase "$host" in
1259200576Sroberto *-*-aix[[456]]*)
1260181834Sroberto    # Just a stub in AIX 4.  Idiots.
1261181834Sroberto    ;;
1262181834Sroberto *-*-solaris2.5*)
1263181834Sroberto    # Just stubs in solaris2.5.  Idiots.
1264181834Sroberto    ;;
1265181834Sroberto *) AC_CHECK_FUNCS(sched_setscheduler)
1266181834Sroberto    ;;
1267181834Srobertoesac
1268181834SrobertoAC_CHECK_FUNCS(setlinebuf setpgid setpriority setsid)
1269181834SrobertoAC_CHECK_FUNCS(setrlimit)
1270181834SrobertoAC_CHECK_FUNCS(settimeofday, ,[
1271181834Srobertocase "$host" in
1272181834Sroberto  *-*-mpeix*) ac_cv_func_settimeofday=yes
1273181834Sroberto    ;;
1274181834Srobertoesac])
1275181834SrobertoAC_CHECK_FUNCS(setvbuf sigaction)
1276181834SrobertoAC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
1277181834SrobertoAC_CHECK_FUNCS(snprintf strdup strerror strstr)
1278181834SrobertoAC_CHECK_FUNCS(timegm)
1279181834Srobertocase "$host" in
1280200576Sroberto *-*-aix[[456]]*)
1281181834Sroberto    # Just stubs.  Idiots.
1282181834Sroberto    ;;
1283181834Sroberto *-*-netbsd1*)
1284181834Sroberto    # Just stubs.  Idiots.
1285181834Sroberto    ;;
1286181834Sroberto *-*-netbsdelf1*)
1287181834Sroberto    # Just stubs.  Idiots.
1288181834Sroberto    ;;
1289181834Sroberto *-*-openbsd*)
1290181834Sroberto    # Just stubs.  Idiots.
1291181834Sroberto    ;;
1292181834Sroberto *) AC_CHECK_FUNCS(timer_create timer_settime)
1293181834Sroberto    ;;
1294181834Srobertoesac
1295181834Srobertocase "$host" in
1296181834Sroberto *-pc-cygwin*)
1297181834Sroberto    # I have no idea...
1298181834Sroberto    ;;
1299181834Sroberto *) AC_CHECK_FUNCS(umask)
1300181834Sroberto    ;;
1301181834Srobertoesac
1302181834SrobertoAC_CHECK_FUNCS(uname updwtmp updwtmpx vsnprintf vsprintf)
1303181834Sroberto
1304181834Sroberto###
1305181834Sroberto
1306200576Sroberto# http://bugs.ntp.org/737
1307181834Srobertocase "$ac_cv_func_recvmsg" in
1308181834Sroberto yes)
1309181834Sroberto AC_MSG_CHECKING([if we need extra help to define struct iovec])
1310181834Sroberto AC_CACHE_VAL(ac_cv_struct_iovec_help,dnl
1311181834Sroberto [for ac_cv_struct_iovec_help in '0' '1'; do
1312181834Sroberto   AC_TRY_COMPILE(dnl
1313181834Sroberto[#ifdef HAVE_SYS_TYPES_H
1314181834Sroberto#include <sys/types.h>
1315181834Sroberto#endif
1316181834Sroberto#ifdef HAVE_SYS_SOCKET_H
1317181834Sroberto#include <sys/socket.h>
1318181834Sroberto#endif
1319181834Sroberto#if $ac_cv_struct_iovec_help
1320181834Sroberto#include <sys/uio.h>
1321181834Sroberto#endif
1322181834Sroberto
1323181834Srobertovoid foo();
1324181834Srobertovoid foo() {
1325181834Sroberto	ssize_t x;
1326181834Sroberto	int s = 0;
1327181834Sroberto	struct iovec iov;
1328181834Sroberto	struct msghdr mh;
1329181834Sroberto	int flags = 0;
1330181834Sroberto
1331181834Sroberto	mh.msg_iov = &iov;
1332181834Sroberto	x = recvmsg(s, &mh, flags);
1333181834Sroberto}],,dnl
1334181834Sroberto  [ac_worked=yes ; break 1], ac_worked=no)
1335181834Sroberto  done
1336181834Sroberto])dnl AC_CACHE_VAL
1337181834Sroberto    case "$ac_worked$ac_cv_struct_iovec_help" in
1338181834Sroberto     yes1)
1339181834Sroberto	AC_DEFINE(HAVE_SYS_UIO_H, 1, [Use sys/uio.h for struct iovec help])
1340181834Sroberto	ans=yes
1341181834Sroberto	;;
1342181834Sroberto     *) ans=no
1343181834Sroberto    esac
1344181834Sroberto    AC_MSG_RESULT([$ans])
1345181834Sroberto    ;;
1346181834Srobertoesac
1347181834Sroberto
1348181834Srobertocase "$host" in
1349181834Sroberto *-*-sunos4*)
1350181834Sroberto    AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*])
1351181834Sroberto    ;;
1352181834Srobertoesac
1353181834Sroberto
1354200576SrobertoAC_CACHE_CHECK([number of arguments to gettimeofday()], ac_cv_func_Xettimeofday_nargs,
1355181834Sroberto[AC_TRY_COMPILE([#include <sys/time.h>],[
1356181834Srobertogettimeofday((struct timeval*)0,(struct timezone*)0);
1357181834Srobertosettimeofday((struct timeval*)0,(struct timezone*)0);
1358181834Sroberto],
1359181834Sroberto	ac_cv_func_Xettimeofday_nargs=2, ac_cv_func_Xettimeofday_nargs=1)
1360181834Sroberto])
1361181834Srobertoif test $ac_cv_func_Xettimeofday_nargs = 1; then
1362181834Sroberto	AC_DEFINE(SYSV_TIMEOFDAY, 1, [Does Xettimeofday take 1 arg?])
1363181834Srobertofi
1364181834Sroberto
1365200576SrobertoAC_CACHE_CHECK([number of arguments taken by setpgrp()], ac_cv_func_setpgrp_nargs,
1366181834Sroberto[AC_TRY_COMPILE([
1367181834Sroberto#ifdef HAVE_SYS_TYPES_H
1368181834Sroberto# include <sys/types.h>
1369181834Sroberto#endif
1370181834Sroberto#ifdef HAVE_UNISTD_H
1371181834Sroberto# include <unistd.h>
1372181834Sroberto#endif
1373181834Sroberto],[setpgrp(0,0);],
1374181834Sroberto        ac_cv_func_setpgrp_nargs=2, ac_cv_func_setpgrp_nargs=0)
1375181834Sroberto])
1376181834Srobertoif test $ac_cv_func_setpgrp_nargs = 0; then
1377181834Sroberto        AC_DEFINE(HAVE_SETPGRP_0, 1, [define if setpgrp takes 0 arguments])
1378181834Srobertofi
1379181834Sroberto
1380181834Srobertosave_CFLAGS=$CFLAGS
1381181834SrobertoCFLAGS="$CFLAGS -I$srcdir/include"
1382181834Sroberto
1383200576SrobertoAC_CACHE_CHECK([argument pointer type of qsort()'s compare function and base],
1384181834Srobertoac_cv_func_qsort_argtype,
1385181834Sroberto[AC_TRY_COMPILE([
1386181834Sroberto#include "l_stdlib.h"
1387181834Sroberto
1388181834Sroberto#ifdef HAVE_PROTOTYPES
1389181834Sroberto#define P(x) x
1390181834Sroberto#else
1391181834Sroberto#define P(x) ()
1392181834Sroberto#endif
1393181834Sroberto
1394181834Srobertoextern void *base;
1395181834Srobertoextern sortfunc P((const void *, const void *));
1396181834Srobertoint sortfunc(a, b)
1397181834Sroberto  const void *a;
1398181834Sroberto  const void *b; { return 0; }
1399181834Sroberto],[
1400181834Srobertoqsort(base, 2, sizeof(char *), sortfunc);
1401181834Sroberto],
1402181834Sroberto	ac_cv_func_qsort_argtype=void, ac_cv_func_qsort_argtype=char)
1403181834Sroberto])
1404181834Srobertocase "$ac_cv_func_qsort_argtype" in
1405181834Sroberto void)
1406181834Sroberto    AC_DEFINE(QSORT_USES_VOID_P, 1, [Does qsort expect to work on "void *" stuff?])
1407181834Sroberto    ;;
1408181834Srobertoesac
1409181834Sroberto
1410181834SrobertoCFLAGS=$save_CFLAGS
1411181834Sroberto
1412200576SrobertoAC_CACHE_CHECK([if we need to declare 'errno'], ac_cv_decl_errno,
1413181834Sroberto[AC_TRY_COMPILE([#ifdef HAVE_ERRNO_H
1414181834Sroberto#include <errno.h>
1415181834Sroberto#endif],
1416181834Sroberto  [errno = 0;],
1417181834Sroberto  ac_cv_decl_errno=no, ac_cv_decl_errno=yes)])
1418181834Srobertocase "$ac_cv_decl_errno" in
1419181834Sroberto yes) AC_DEFINE(DECL_ERRNO, 1, [Declare errno?]) ;;
1420181834Srobertoesac
1421181834Sroberto
1422181834Srobertodnl FIXME: from ntpd/ntp_intres.c, but there's no info which header produces
1423181834Srobertodnl the clash.  <resolv.h> isn't currently used.
1424181834Srobertodnl
1425181834Srobertodnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1426181834Srobertodnl MT purposes.  This makes the line "extern int h_errno" choke
1427181834Srobertodnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1428181834Srobertodnl without breaking any other platforms.
1429181834Srobertodnl
1430200576SrobertoAC_CACHE_CHECK([if we may declare 'h_errno'], ac_cv_decl_h_errno,
1431181834Sroberto[AC_TRY_COMPILE([#include <sys/types.h>
1432181834Sroberto#ifdef HAVE_NETINET_IN_H
1433181834Sroberto#include <netinet/in.h>
1434181834Sroberto#endif
1435181834Sroberto#ifdef HAVE_ARPA_NAMESER_H
1436181834Sroberto#include <arpa/nameser.h>
1437181834Sroberto#endif
1438181834Sroberto#ifdef HAVE_NETDB_H
1439181834Sroberto#include <netdb.h>
1440181834Sroberto#endif
1441181834Sroberto#ifdef HAVE_RESOLV_H
1442181834Sroberto#include <resolv.h>
1443181834Sroberto#endif],
1444181834Sroberto  [extern int h_errno;],
1445181834Sroberto  ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)])
1446181834Srobertocase "$ac_cv_decl_h_errno" in
1447181834Sroberto yes) AC_DEFINE(DECL_H_ERRNO, 1, [Declare h_errno?]) ;;
1448181834Srobertoesac
1449181834Sroberto
1450181834Srobertodnl See if char *sys_errlist[] is OK.
1451181834SrobertoAC_CACHE_CHECK([[if declaring 'char *sys_errlist[]' is ok]], ac_cv_decl_sys_errlist,
1452181834Sroberto[AC_TRY_COMPILE([#include <stdio.h>
1453181834Sroberto#ifdef HAVE_ERRNO_H
1454181834Sroberto#include <errno.h>
1455181834Sroberto#endif],
1456181834Sroberto  [extern char *sys_errlist[];
1457181834Sroberto],
1458181834Sroberto  ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])
1459181834Srobertocase "$ac_cv_decl_sys_errlist" in
1460181834Sroberto yes) AC_DEFINE(CHAR_SYS_ERRLIST, 1, [Declare char *sys_errlist array]) ;;
1461181834Srobertoesac
1462181834Sroberto
1463200576SrobertoAC_CACHE_CHECK([if declaring 'syscall()' is ok], ac_cv_decl_syscall,
1464181834Sroberto[AC_TRY_COMPILE([
1465181834Sroberto#ifdef HAVE_SYS_TYPES_H
1466181834Sroberto# include <sys/types.h>
1467181834Sroberto#endif
1468181834Sroberto#ifdef HAVE_UNISTD_H
1469181834Sroberto# include <unistd.h>
1470181834Sroberto#endif
1471181834Sroberto#ifdef HAVE_PROTOTYPES
1472181834Sroberto#define P(x) x
1473181834Sroberto#else
1474181834Sroberto#define P(x) ()
1475181834Sroberto#endif
1476181834Sroberto],
1477181834Sroberto  [extern int syscall P((int, ...));],
1478181834Sroberto  ac_cv_decl_syscall=yes, ac_cv_decl_syscall=no)])
1479181834Srobertocase "$ac_cv_decl_syscall" in
1480181834Sroberto yes) AC_DEFINE(DECL_SYSCALL, 1, [Declare syscall()?]) ;;
1481181834Srobertoesac
1482181834Sroberto
1483181834Srobertocase "$host" in
1484181834Sroberto *-*-aix4.3.*)
1485181834Sroberto    AC_DEFINE(DECL_HSTRERROR_0, 1, [Declaration style])		# Needed for XLC under AIX 4.3.2
1486181834Sroberto    ;;
1487181834Sroberto *-*-mpeix*)
1488181834Sroberto    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1489181834Sroberto    AC_DEFINE(DECL_INET_NTOA_0, 1, [Declaration style])
1490181834Sroberto    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1491181834Sroberto    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1492181834Sroberto    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1493181834Sroberto    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1494181834Sroberto    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1495181834Sroberto    ;;
1496181834Sroberto *-*-osf[[45]]*)
1497181834Sroberto    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1498181834Sroberto    AC_DEFINE(DECL_STIME_1, 1, [Declaration style])
1499181834Sroberto    ;;
1500181834Sroberto *-*-qnx*)
1501181834Sroberto    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1502181834Sroberto    ;;
1503181834Sroberto *-*-riscos4*)
1504181834Sroberto    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1505181834Sroberto    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1506181834Sroberto    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1507181834Sroberto    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1508181834Sroberto    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1509181834Sroberto    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1510181834Sroberto    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1511181834Sroberto    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1512181834Sroberto    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1513181834Sroberto    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1514181834Sroberto    AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1515181834Sroberto    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1516181834Sroberto    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1517181834Sroberto    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1518181834Sroberto    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1519181834Sroberto    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1520181834Sroberto    ;;
1521181834Sroberto *-*-solaris2*)
1522181834Sroberto    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1523181834Sroberto    AC_DEFINE(DECL_SETPRIORITY_1, 1, [Declaration style])
1524181834Sroberto    case "$host" in
1525181834Sroberto     *-*-solaris2.4)
1526181834Sroberto        AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1527181834Sroberto	;;
1528181834Sroberto    esac
1529181834Sroberto    ;;
1530181834Sroberto *-*-sunos4*)
1531181834Sroberto    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1532181834Sroberto    AC_DEFINE(DECL_BCOPY_0, 1, [Declaration style])
1533181834Sroberto    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1534181834Sroberto    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1535181834Sroberto    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1536181834Sroberto    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1537181834Sroberto    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1538181834Sroberto    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1539181834Sroberto    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1540181834Sroberto    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1541181834Sroberto    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1542181834Sroberto    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1543181834Sroberto    AC_DEFINE(DECL_SIGVEC_0, 1, [Declaration style])
1544181834Sroberto    case "`basename $ac_cv_prog_CC`" in
1545181834Sroberto     acc*) ;;
1546181834Sroberto     *) AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1547181834Sroberto	;;
1548181834Sroberto    esac
1549181834Sroberto    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1550181834Sroberto    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1551181834Sroberto    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1552181834Sroberto    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1553181834Sroberto    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1554181834Sroberto    AC_DEFINE(DECL_TOUPPER_0, 1, [Declaration style])
1555181834Sroberto    AC_DEFINE(DECL_STRERROR_0, 1, [Declaration style])
1556181834Sroberto    ;;
1557181834Sroberto *-*-ultrix4*)
1558181834Sroberto    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1559181834Sroberto    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1560181834Sroberto    AC_DEFINE(DECL_CFSETISPEED_0, 1, [Declaration style])
1561181834Sroberto    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1562181834Sroberto    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1563181834Sroberto    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1564181834Sroberto    AC_DEFINE(DECL_NLIST_0, 1, [Declaration style])
1565181834Sroberto    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1566181834Sroberto    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1567181834Sroberto    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1568181834Sroberto    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1569181834Sroberto    AC_DEFINE(DECL_STIME_0, 1, [Declaration style])
1570181834Sroberto    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1571181834Sroberto    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1572181834Sroberto    ;;
1573181834Srobertoesac
1574181834Sroberto
1575181834Srobertocase "$host" in
1576181834Sroberto *-*-sco3.2*)
1577181834Sroberto    AC_DEFINE(TERMIOS_NEEDS__SVID3, 1, [Do we need to #define _SVID3 when we #include <termios.h>?])
1578181834Sroberto    ;;
1579181834Srobertoesac
1580181834Sroberto
1581200576SrobertoAC_CACHE_CHECK([if we need extra room for SO_RCVBUF], ac_cv_var_rcvbuf_slop,
1582181834Sroberto[ans=no
1583181834Srobertocase "$host" in
1584181834Sroberto *-*-hpux[[567]]*)
1585181834Sroberto    ans=yes
1586181834Sroberto    ;;
1587181834Srobertoesac
1588181834Srobertoac_cv_var_rcvbuf_slop=$ans])
1589181834Srobertocase "$ac_cv_var_rcvbuf_slop" in
1590181834Sroberto yes) AC_DEFINE(NEED_RCVBUF_SLOP, 1, [Do we need extra room for SO_RCVBUF? (HPUX <8)]) ;;
1591181834Srobertoesac
1592181834Sroberto
1593200576SrobertoAC_CACHE_CHECK([if we will open the broadcast socket], ac_cv_var_open_bcast_socket,
1594181834Sroberto[ans=yes
1595181834Srobertocase "$host" in
1596181834Sroberto *-*-domainos)
1597181834Sroberto    ans=no
1598181834Sroberto    ;;
1599181834Srobertoesac
1600181834Srobertoac_cv_var_open_bcast_socket=$ans])
1601181834Srobertocase "$ac_cv_var_open_bcast_socket" in
1602181834Sroberto yes) AC_DEFINE(OPEN_BCAST_SOCKET, 1, [Should we open the broadcast socket?]) ;;
1603181834Srobertoesac
1604181834Sroberto
1605200576SrobertoAC_CACHE_CHECK([if we want the HPUX version of FindConfig()], ac_cv_var_hpux_findconfig,
1606181834Sroberto[ans=no
1607181834Srobertocase "$host" in
1608181834Sroberto *-*-hpux*)
1609181834Sroberto    ans=yes
1610181834Sroberto    ;;
1611181834Srobertoesac
1612181834Srobertoac_cv_var_hpux_findconfig=$ans])
1613181834Srobertocase "$ac_cv_var_hpux_findconfig" in
1614181834Sroberto yes) AC_DEFINE(NEED_HPUX_FINDCONFIG, 1, [Do we want the HPUX FindConfig()?]) ;;
1615181834Srobertoesac
1616181834Sroberto
1617200576SrobertoAC_CACHE_CHECK([if process groups are set with -pid], ac_cv_arg_setpgrp_negpid,
1618181834Sroberto[case "$host" in
1619181834Sroberto *-*-hpux[[567]]*)
1620181834Sroberto    ans=no
1621181834Sroberto    ;;
1622181834Sroberto *-*-hpux*)
1623181834Sroberto    ans=yes
1624181834Sroberto    ;;
1625200576Sroberto *-*-*linux*)
1626181834Sroberto    ans=yes
1627181834Sroberto    ;;
1628181834Sroberto *-*-sunos3*)
1629181834Sroberto    ans=yes
1630181834Sroberto    ;;
1631181834Sroberto *-*-ultrix2*)
1632181834Sroberto    ans=yes
1633181834Sroberto    ;;
1634181834Sroberto *)
1635181834Sroberto    ans=no
1636181834Sroberto    ;;
1637181834Srobertoesac
1638181834Srobertoac_cv_arg_setpgrp_negpid=$ans])
1639181834Srobertocase "$ac_cv_arg_setpgrp_negpid" in
1640181834Sroberto yes) AC_DEFINE(UDP_BACKWARDS_SETOWN, 1, [Do we set process groups with -pid?]) ;;
1641181834Srobertoesac
1642181834Sroberto
1643200576SrobertoAC_CACHE_CHECK([if we need a ctty for F_SETOWN], ac_cv_func_ctty_for_f_setown,
1644181834Sroberto[[case "$host" in
1645181834Sroberto *-*-bsdi[23]*)
1646181834Sroberto    ans=yes
1647181834Sroberto    ;;
1648181834Sroberto *-*-freebsd*)
1649181834Sroberto    ans=yes
1650181834Sroberto    ;;
1651181834Sroberto *-*-netbsd*3.[0-8]*|*-*-netbsd*[0-2].*|*-*-netbsd*3.99.[0-7])
1652181834Sroberto    ans=yes
1653181834Sroberto    ;;
1654181834Sroberto *-*-openbsd*)
1655181834Sroberto    ans=yes
1656181834Sroberto    ;;
1657181834Sroberto *-*-osf*)
1658181834Sroberto    ans=yes
1659181834Sroberto    ;;
1660200576Sroberto *-*-darwin*)
1661200576Sroberto    ans=yes
1662200576Sroberto    ;;
1663181834Sroberto *) ans=no
1664181834Sroberto    ;;
1665181834Srobertoesac
1666181834Srobertoac_cv_func_ctty_for_f_setown=$ans]])
1667181834Srobertocase "$ac_cv_func_ctty_for_f_setown" in
1668181834Sroberto yes) AC_DEFINE(USE_FSETOWNCTTY, 1, [Must we have a CTTY for fsetown?]) ;;
1669181834Srobertoesac
1670181834Sroberto
1671200576SrobertoAC_CACHE_CHECK([if the OS fails to clear cached routes when more specific routes become available], ac_cv_os_routeupdates,
1672181834Sroberto[[case "$host" in
1673181834Sroberto *-*-netbsd*)
1674181834Sroberto    ans=yes
1675181834Sroberto    ;;
1676181834Sroberto *) ans=no
1677181834Sroberto    ;;
1678181834Srobertoesac
1679181834Srobertoac_cv_os_routeupdates=$ans]])
1680181834Srobertocase "$ac_cv_os_routeupdates" in
1681181834Sroberto yes) AC_DEFINE(OS_MISSES_SPECIFIC_ROUTE_UPDATES, 1, [need to recreate sockets on changed routing?]) ;;
1682181834Srobertoesac
1683181834Sroberto
1684200576SrobertoAC_CACHE_CHECK([if the OS needs the wildcard socket set to REUSEADDR for binding interface addresses], ac_cv_os_wildcardreuse,
1685181834Sroberto[[case "$host" in
1686200576Sroberto *-*-*linux*)
1687181834Sroberto    ans=yes
1688181834Sroberto    ;;
1689181834Sroberto *) ans=no
1690181834Sroberto    ;;
1691181834Srobertoesac
1692181834Srobertoac_cv_os_wildcardreuse=$ans]])
1693181834Srobertocase "$ac_cv_os_wildcardreuse" in
1694181834Sroberto yes) AC_DEFINE(OS_NEEDS_REUSEADDR_FOR_IFADDRBIND, 1, [wildcard socket needs to set REUSEADDR when binding to interface addresses]) ;;
1695181834Srobertoesac
1696181834Sroberto
1697181834Srobertontp_warning='GRONK'
1698200576SrobertoAC_MSG_CHECKING([if we'll use clock_settime or settimeofday or stime])
1699181834Srobertocase "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
1700181834Sroberto yes*)
1701181834Sroberto    ntp_warning=''
1702181834Sroberto    ans='clock_settime()'
1703181834Sroberto    ;;
1704181834Sroberto noyes*)
1705181834Sroberto    ntp_warning='But clock_settime() would be better (if we had it)'
1706181834Sroberto    ans='settimeofday()'
1707181834Sroberto    ;;
1708181834Sroberto nonoyes)
1709181834Sroberto    ntp_warning='Which is the worst of the three'
1710181834Sroberto    ans='stime()'
1711181834Sroberto    ;;
1712181834Sroberto *) 
1713181834Sroberto    case "$build" in
1714181834Sroberto     $host) ntp_warning='Which leaves us with nothing to use!'
1715181834Sroberto    ans=none
1716181834Sroberto    ;;
1717181834Srobertoesac
1718181834Srobertoesac
1719200576SrobertoAC_MSG_RESULT([$ans])
1720181834Srobertocase "$ntp_warning" in
1721181834Sroberto '') ;;
1722200576Sroberto *) AC_MSG_WARN([*** $ntp_warning ***])
1723181834Sroberto    ;;
1724181834Srobertoesac
1725181834Sroberto
1726200576SrobertoAC_CACHE_CHECK([if we have a losing syscall()], ac_cv_var_syscall_bug,
1727181834Sroberto[case "$host" in
1728181834Sroberto *-*-solaris2.4*)
1729181834Sroberto    ans=yes
1730181834Sroberto    ;;
1731181834Sroberto *) ans=no
1732181834Sroberto    ;;
1733181834Srobertoesac
1734181834Srobertoac_cv_var_syscall_bug=$ans])
1735181834Srobertocase "$ac_cv_var_syscall_bug" in
1736181834Sroberto yes) AC_DEFINE(SYSCALL_BUG, 1, [Buggy syscall() (Solaris2.4)?]) ;;
1737181834Srobertoesac
1738181834Sroberto
1739200576SrobertoAC_CACHE_CHECK([for SIGIO], ac_cv_hdr_def_sigio,
1740181834Sroberto AC_EGREP_CPP(yes,
1741181834Sroberto  [#include <signal.h>
1742181834Sroberto#ifdef SIGIO
1743181834Sroberto   yes
1744181834Sroberto#endif
1745181834Sroberto  ], ac_cv_hdr_def_sigio=yes, ac_cv_hdr_def_sigio=no))
1746181834Sroberto
1747181834Srobertodnl Override those system that have a losing SIGIO
1748200576SrobertoAC_CACHE_CHECK([if we want to use signalled IO], ac_cv_var_signalled_io,
1749181834Sroberto[ans=no
1750181834Srobertocase "$ac_cv_hdr_def_sigio" in
1751181834Sroberto yes)
1752181834Sroberto    ans=yes
1753181834Sroberto    case "$host" in
1754181834Sroberto     alpha*-dec-osf4*|alpha*-dec-osf5*)
1755181834Sroberto        ans=no
1756181834Sroberto        ;;
1757181834Sroberto     *-convex-*)
1758181834Sroberto        ans=no
1759181834Sroberto        ;;
1760181834Sroberto     *-dec-*)
1761181834Sroberto        ans=no
1762181834Sroberto        ;;
1763181834Sroberto     *-pc-cygwin*)
1764181834Sroberto	ans=no
1765181834Sroberto	;;
1766181834Sroberto     *-sni-sysv*)
1767181834Sroberto        ans=no
1768181834Sroberto        ;;
1769181834Sroberto     *-univel-sysv*)
1770181834Sroberto        ans=no
1771181834Sroberto	;;
1772181834Sroberto     *-*-irix6*)
1773181834Sroberto	ans=no
1774181834Sroberto	;;
1775181834Sroberto     *-*-freebsd*)
1776181834Sroberto	ans=no
1777181834Sroberto	;;
1778200576Sroberto     *-*-*linux*)
1779181834Sroberto	ans=no
1780181834Sroberto	;;
1781181834Sroberto     *-*-unicosmp*)
1782181834Sroberto	ans=no
1783181834Sroberto	;;
1784181834Sroberto    esac
1785181834Sroberto    ;;
1786181834Srobertoesac
1787181834Srobertoac_cv_var_signalled_io=$ans])
1788181834Srobertocase "$ac_cv_var_signalled_io" in
1789181834Sroberto yes) AC_DEFINE(HAVE_SIGNALED_IO, 1, [Can we use SIGIO for tcp and udp IO?]) ;;
1790181834Srobertoesac
1791181834Sroberto
1792200576SrobertoAC_CACHE_CHECK([for SIGPOLL], ac_cv_hdr_def_sigpoll,
1793181834Sroberto AC_EGREP_CPP(yes,
1794181834Sroberto [#include <signal.h>
1795181834Sroberto#ifdef SIGPOLL
1796181834Sroberto  yes
1797181834Sroberto#endif
1798181834Sroberto ], ac_cv_hdr_def_sigpoll=yes, ac_cv_hdr_def_sigpoll=no))
1799181834Sroberto
1800200576SrobertoAC_CACHE_CHECK([for SIGSYS], ac_cv_hdr_def_sigsys,
1801181834Sroberto AC_EGREP_CPP(yes,
1802181834Sroberto [#include <signal.h>
1803181834Sroberto#ifdef SIGSYS
1804181834Sroberto  yes
1805181834Sroberto#endif
1806181834Sroberto ], ac_cv_hdr_def_sigsys=yes, ac_cv_hdr_def_sigsys=no))
1807181834Sroberto
1808200576SrobertoAC_CACHE_CHECK([if we can use SIGPOLL for UDP I/O], ac_cv_var_use_udp_sigpoll,
1809181834Sroberto[ans=no
1810181834Srobertocase "$ac_cv_hdr_def_sigpoll" in
1811181834Sroberto yes)
1812181834Sroberto    case "$host" in
1813181834Sroberto     mips-sgi-irix*)
1814181834Sroberto	ans=no
1815181834Sroberto	;;
1816181834Sroberto     vax-dec-bsd)
1817181834Sroberto        ans=no
1818181834Sroberto        ;;
1819181834Sroberto     *-pc-cygwin*)
1820181834Sroberto	ans=no
1821181834Sroberto	;;
1822181834Sroberto     *-sni-sysv*)
1823181834Sroberto        ans=no
1824181834Sroberto        ;;
1825200576Sroberto     *-*-aix[[456]]*)
1826181834Sroberto        ans=no
1827181834Sroberto        ;;
1828181834Sroberto     *-*-hpux*)
1829181834Sroberto        ans=no
1830181834Sroberto        ;;
1831200576Sroberto     *-*-*linux*)
1832181834Sroberto	ans=no
1833181834Sroberto	;;
1834181834Sroberto     *-*-osf*)
1835181834Sroberto        ans=no
1836181834Sroberto        ;;
1837181834Sroberto     *-*-qnx*)
1838181834Sroberto        ans=no
1839181834Sroberto        ;;
1840181834Sroberto     *-*-sunos*)
1841181834Sroberto	ans=no
1842181834Sroberto	;;
1843200576Sroberto     *-*-solaris*)
1844200576Sroberto	ans=no
1845200576Sroberto	;;
1846181834Sroberto     *-*-ultrix*)
1847181834Sroberto        ans=no
1848181834Sroberto        ;;
1849181834Sroberto     *-*-unicosmp*)
1850181834Sroberto        ans=no
1851181834Sroberto        ;;
1852181834Sroberto     *) ans=yes
1853181834Sroberto        ;;
1854181834Sroberto    esac
1855181834Sroberto    ;;
1856181834Srobertoesac
1857181834Srobertoac_cv_var_use_udp_sigpoll=$ans])
1858181834Srobertocase "$ac_cv_var_use_udp_sigpoll" in
1859181834Sroberto yes) AC_DEFINE(USE_UDP_SIGPOLL, 1, [Can we use SIGPOLL for UDP?]) ;;
1860181834Srobertoesac
1861181834Sroberto
1862200576SrobertoAC_CACHE_CHECK([if we can use SIGPOLL for TTY I/O], ac_cv_var_use_tty_sigpoll,
1863181834Sroberto[ans=no
1864181834Srobertocase "$ac_cv_hdr_def_sigpoll" in
1865181834Sroberto yes)
1866181834Sroberto    case "$host" in
1867181834Sroberto     mips-sgi-irix*)
1868181834Sroberto        ans=no
1869181834Sroberto        ;;
1870181834Sroberto     vax-dec-bsd)
1871181834Sroberto        ans=no
1872181834Sroberto        ;;
1873181834Sroberto     *-pc-cygwin*)
1874181834Sroberto	ans=no
1875181834Sroberto	;;
1876181834Sroberto     *-sni-sysv*)
1877181834Sroberto        ans=no
1878181834Sroberto        ;;
1879200576Sroberto     *-*-aix[[456]]*)
1880181834Sroberto	ans=no
1881181834Sroberto	;;
1882181834Sroberto     *-*-hpux*)
1883181834Sroberto        ans=no
1884181834Sroberto        ;;
1885200576Sroberto     *-*-*linux*)
1886181834Sroberto	ans=no
1887181834Sroberto	;;
1888181834Sroberto     *-*-osf*)
1889181834Sroberto        ans=no
1890181834Sroberto        ;;
1891181834Sroberto     *-*-sunos*)
1892181834Sroberto	ans=no
1893181834Sroberto	;;
1894181834Sroberto     *-*-ultrix*)
1895181834Sroberto        ans=no
1896181834Sroberto        ;;
1897181834Sroberto     *-*-qnx*)
1898181834Sroberto        ans=no
1899181834Sroberto        ;;
1900181834Sroberto     *-*-unicosmp*)
1901181834Sroberto        ans=no
1902181834Sroberto        ;;
1903181834Sroberto     *) ans=yes
1904181834Sroberto        ;;
1905181834Sroberto    esac
1906181834Sroberto    ;;
1907181834Srobertoesac
1908181834Srobertoac_cv_var_use_tty_sigpoll=$ans])
1909181834Srobertocase "$ac_cv_var_use_tty_sigpoll" in
1910181834Sroberto yes) AC_DEFINE(USE_TTY_SIGPOLL, 1, [Can we use SIGPOLL for tty IO?]) ;;
1911181834Srobertoesac
1912181834Sroberto
1913181834Srobertocase "$ac_cv_header_sys_sio_h" in
1914181834Sroberto yes)
1915200576Sroberto    AC_CACHE_CHECK([sys/sio.h for TIOCDCDTIMESTAMP], ac_cv_hdr_def_tiocdcdtimestamp,
1916181834Sroberto     AC_EGREP_CPP(yes,
1917181834Sroberto[#include <sys/sio.h>
1918181834Sroberto#ifdef TIOCDCDTIMESTAMP
1919181834Sroberto  yes
1920181834Sroberto#endif
1921181834Sroberto     ], ac_cv_hdr_def_tiocdcdtimestamp=yes, ac_cv_hdr_def_tiocdcdtimestamp=no))
1922181834Sroberto    ;;
1923181834Srobertoesac
1924181834Sroberto
1925181834Srobertocase "$ac_cv_hdr_def_tiocdcdtimestamp" in
1926181834Sroberto yes)
1927181834Sroberto    ac_cv_var_oncore_ok=yes
1928181834Sroberto    ;;
1929181834Srobertoesac
1930181834Sroberto
1931200576SrobertoAC_CACHE_CHECK([if nlist() values might require extra indirection],
1932181834Srobertoac_cv_var_nlist_extra_indirection,
1933181834Sroberto[ans=no
1934181834Srobertocase "$host" in
1935181834Sroberto *-*-aix*)
1936181834Sroberto    ans=yes
1937181834Sroberto    ;;
1938181834Srobertoesac
1939181834Srobertoac_cv_var_nlist_extra_indirection=$ans])
1940181834Srobertocase "$ac_cv_var_nlist_extra_indirection" in
1941181834Sroberto yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION, 1, [Might nlist() values require an extra level of indirection (AIX)?]) ;;
1942181834Srobertoesac
1943181834Sroberto
1944200576SrobertoAC_CACHE_CHECK([for a minimum recommended value of tickadj],
1945181834Srobertoac_cv_var_min_rec_tickadj,
1946181834Sroberto[ans=no
1947181834Srobertocase "$host" in
1948181834Sroberto *-*-aix*)
1949181834Sroberto    ans=40
1950181834Sroberto    ;;
1951181834Srobertoesac
1952181834Srobertoac_cv_var_min_rec_tickadj=$ans])
1953181834Srobertocase "$ac_cv_var_min_rec_tickadj" in
1954181834Sroberto ''|no) ;;
1955181834Sroberto *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj, [Should we recommend a minimum value for tickadj?]) ;;
1956181834Srobertoesac
1957181834Sroberto
1958200576SrobertoAC_CACHE_CHECK([if the TTY code permits PARENB and IGNPAR],
1959181834Srobertoac_cv_var_no_parenb_ignpar,
1960181834Sroberto[ans=no
1961181834Srobertocase "$host" in
1962200576Sroberto i?86-*-*linux*)
1963181834Sroberto    ans=yes
1964181834Sroberto    ;;
1965181834Sroberto mips-sgi-irix*)
1966181834Sroberto    ans=yes
1967181834Sroberto    ;;
1968181834Sroberto i?86-*-freebsd[[123]].*)
1969181834Sroberto    ;;
1970181834Sroberto i?86-*-freebsd*)
1971181834Sroberto    ans=yes
1972181834Sroberto    ;;
1973181834Sroberto *-*-unicosmp*)
1974181834Sroberto    ans=yes
1975181834Sroberto    ;;
1976181834Srobertoesac
1977181834Srobertoac_cv_var_no_parenb_ignpar=$ans])
1978181834Srobertocase "$ac_cv_var_no_parenb_ignpar" in
1979181834Sroberto yes) AC_DEFINE(NO_PARENB_IGNPAR, 1, [Is there a problem using PARENB and IGNPAR (IRIX)?]) ;;
1980181834Srobertoesac
1981181834Sroberto
1982200576SrobertoAC_MSG_CHECKING([if we're including debugging code])
1983181834SrobertoAC_ARG_ENABLE(debugging,
1984181834Sroberto   AC_HELP_STRING([--enable-debugging], [+ include debugging code]),
1985181834Sroberto    [ntp_ok=$enableval], [ntp_ok=yes])
1986181834Srobertoif test "$ntp_ok" = "yes"; then
1987181834Sroberto    AC_DEFINE(DEBUG, 1, [Enable debugging?])
1988181834Srobertofi
1989181834SrobertoAC_MSG_RESULT($ntp_ok)
1990181834Sroberto
1991200576SrobertoAC_MSG_CHECKING([if we including processing time debugging code])
1992181834SrobertoAC_ARG_ENABLE(debug-timing,
1993181834Sroberto   AC_HELP_STRING([--enable-debug-timing], [- include processing time debugging code (costs performance)]),
1994181834Sroberto    [ntp_ok=$enableval], [ntp_ok=no])
1995181834Srobertoif test "$ntp_ok" = "yes"; then
1996181834Sroberto    AC_DEFINE(DEBUG_TIMING, 1, [Enable processing time debugging?])
1997181834Srobertofi
1998181834SrobertoAC_MSG_RESULT($ntp_ok)
1999181834Sroberto
2000200576SrobertoAC_MSG_CHECKING([[for a the number of minutes in a DST adjustment]])
2001200576SrobertoAC_ARG_ENABLE(
2002200576Sroberto    [dst_minutes],
2003200576Sroberto    AS_HELP_STRING(
2004200576Sroberto	[--enable-dst-minutes],
2005200576Sroberto	[n minutes per DST adjustment @<:@60@:>@]	dnl @<:@ is [
2006200576Sroberto    ),
2007200576Sroberto    [ans=$enableval],
2008200576Sroberto    [ans=60]
2009200576Sroberto)
2010181834SrobertoAC_DEFINE_UNQUOTED(DSTMINUTES, $ans, [The number of minutes in a DST adjustment])
2011200576SrobertoAC_MSG_RESULT([$ans])
2012181834Sroberto
2013200576SrobertoAC_MSG_CHECKING([[if ntpd will retry on permanent DNS errors]])
2014200576SrobertoAC_ARG_ENABLE(
2015200576Sroberto    [ignore-dns-errors],
2016200576Sroberto    AS_HELP_STRING(
2017200576Sroberto	[--enable-ignore-dns-errors], 
2018200576Sroberto	[- retry DNS queries on any error]
2019200576Sroberto    ),
2020200576Sroberto    [ans=$enableval],
2021200576Sroberto    [ans=no]
2022200576Sroberto)
2023200576Srobertocase "$ans" in
2024200576Sroberto yes)
2025200576Sroberto    AC_DEFINE(IGNORE_DNS_ERRORS, 1, [[Retry queries on _any_ DNS error?]])
2026200576Srobertoesac
2027200576SrobertoAC_MSG_RESULT([$ans])
2028200576Sroberto
2029200576SrobertoAC_CACHE_CHECK([if we have the tty_clk line discipline/streams module],
2030181834Sroberto ac_cv_var_tty_clk,
2031181834Sroberto [case "$ac_cv_header_sys_clkdefs_h$ac_cv_hdr_def_tiocdcdtimestamp" in
2032181834Sroberto  *yes*) ac_cv_var_tty_clk=yes ;;
2033200576Sroberto  *)     ac_cv_var_tty_clk=no ;;
2034181834Sroberto esac])
2035181834Srobertocase "$ac_cv_var_tty_clk" in
2036181834Sroberto yes) AC_DEFINE(TTYCLK, 1, [Do we have the tty_clk line discipline/streams module?]) ;;
2037181834Srobertoesac
2038181834Sroberto
2039200576SrobertoAC_CACHE_CHECK([for the ppsclock streams module],
2040181834Sroberto ac_cv_var_ppsclock,
2041181834Sroberto ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev)
2042181834Srobertocase "$ac_cv_var_ppsclock" in
2043181834Sroberto yes) AC_DEFINE(PPS, 1, [Do we have the ppsclock streams module?]) ;;
2044181834Srobertoesac
2045181834Sroberto
2046200576SrobertoAC_CACHE_CHECK([for kernel multicast support], ac_cv_var_mcast,
2047181834Sroberto  [ac_cv_var_mcast=no
2048181834Sroberto  case "$host" in
2049181834Sroberto   i386-sequent-sysv4) ;;
2050181834Sroberto   *) AC_EGREP_CPP(yes,
2051181834Sroberto  [#include <netinet/in.h>
2052181834Sroberto#ifdef IP_ADD_MEMBERSHIP
2053181834Sroberto   yes
2054181834Sroberto#endif
2055181834Sroberto  ], ac_cv_var_mcast=yes) ;;
2056181834Sroberto  esac])
2057181834Srobertocase "$ac_cv_var_mcast" in
2058181834Sroberto yes)
2059181834Sroberto    AC_DEFINE(MCAST, 1, [Does the kernel support multicasting IP?])
2060181834Sroberto    AC_CACHE_CHECK([[arg type needed for IP*_MULTICAST_LOOP for setsockopt()]],
2061181834Sroberto	ac_cv_var_typeof_ip_multicast_loop,
2062181834Sroberto	[case "$host" in
2063200576Sroberto	 *-*-netbsd*|*-*-*linux*)
2064181834Sroberto	    ac_cv_var_typeof_ip_multicast_loop=u_int
2065181834Sroberto	    ;;
2066181834Sroberto	 *-*-winnt*)
2067181834Sroberto	    ac_cv_var_typeof_ip_multicast_loop=BOOL
2068181834Sroberto	    ;;
2069181834Sroberto	 *) ac_cv_var_typeof_ip_multicast_loop=u_char
2070181834Sroberto	    ;;
2071181834Sroberto	esac])
2072181834Sroberto    AC_DEFINE_UNQUOTED(TYPEOF_IP_MULTICAST_LOOP,
2073181834Sroberto		   $ac_cv_var_typeof_ip_multicast_loop,
2074181834Sroberto		   [What type to use for setsockopt])
2075181834Sroberto    ;;
2076181834Srobertoesac
2077181834Sroberto
2078181834SrobertoAC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls,
2079181834Sroberto [ac_cv_var_ntp_syscalls=no
2080181834Sroberto case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
2081181834Sroberto  yesyes*)
2082181834Sroberto    ac_cv_var_ntp_syscalls=libc
2083181834Sroberto    ;;
2084181834Sroberto  *yes)
2085181834Sroberto    ac_cv_var_ntp_syscalls=inline
2086181834Sroberto    ;;
2087181834Sroberto  *) AC_EGREP_CPP(yes,
2088181834Sroberto         [#include <sys/syscall.h>
2089181834Sroberto#if defined(SYS_ntp_gettime) && defined(SYS_ntp_adjtime)
2090181834Sroberto           yes
2091181834Sroberto#endif
2092181834Sroberto          ], ac_cv_var_ntp_syscalls=kernel)
2093181834Sroberto    ;;
2094181834Sroberto esac])
2095181834Srobertocase "$ac_cv_var_ntp_syscalls" in
2096181834Sroberto libc)
2097181834Sroberto    AC_DEFINE(NTP_SYSCALLS_LIBC, 1, [Do we have ntp_{adj,get}time in libc?])
2098181834Sroberto    ;;
2099181834Sroberto kernel)
2100181834Sroberto    AC_DEFINE(NTP_SYSCALLS_STD, 1, [Do we have ntp_{adj,get}time in the kernel?])
2101181834Sroberto    ;;
2102181834Sroberto *)
2103181834Sroberto    ;;
2104181834Srobertoesac
2105181834Sroberto
2106181834SrobertoAC_CACHE_CHECK(if sys/timex.h has STA_FLL, ac_cv_var_sta_fll,
2107181834Sroberto[AC_EGREP_CPP(yes,
2108181834Sroberto    [#include <sys/timex.h>
2109181834Sroberto#ifdef STA_FLL
2110181834Sroberto    yes
2111181834Sroberto#endif
2112181834Sroberto    ], ac_cv_var_sta_fll=yes, ac_cv_var_sta_fll=no)])
2113181834Sroberto
2114181834SrobertoAC_CACHE_CHECK(if we have kernel PLL support, ac_cv_var_kernel_pll,
2115181834Sroberto[dnl ac_cv_var_ntp_syscalls is {no,libc,kernel}
2116181834Srobertocase "$ac_cv_header_sys_timex_h$ac_cv_struct_ntptimeval$ac_cv_var_sta_fll$ac_cv_var_ntp_syscalls" in
2117181834Sroberto *no*)
2118181834Sroberto    ac_cv_var_kernel_pll=no
2119181834Sroberto    ;;
2120181834Sroberto *) ac_cv_var_kernel_pll=yes
2121181834Sroberto    ;;
2122181834Srobertoesac])
2123181834Srobertocase "$ac_cv_var_kernel_pll" in
2124181834Sroberto yes)
2125181834Sroberto    AC_DEFINE(KERNEL_PLL, 1, [Does the kernel support precision time discipline?])
2126181834Sroberto    ;;
2127181834Srobertoesac
2128181834Sroberto
2129181834SrobertoAC_CACHE_CHECK(if SIOCGIFCONF returns buffer size in the buffer, ac_cv_var_size_returned_in_buffer,
2130181834Sroberto  [ans=no
2131181834Sroberto  case "$host" in
2132181834Sroberto   *-fujitsu-uxp*)
2133181834Sroberto      ans=yes
2134181834Sroberto      ;;
2135181834Sroberto   *-ncr-sysv4*)
2136181834Sroberto      ans=yes
2137181834Sroberto      ;;
2138181834Sroberto   *-univel-sysv*)
2139181834Sroberto      ans=yes
2140181834Sroberto      ;;
2141181834Sroberto  esac
2142181834Sroberto  ac_cv_var_size_returned_in_buffer=$ans])
2143181834Srobertocase "$ac_cv_var_size_returned_in_buffer" in
2144181834Sroberto yes) AC_DEFINE(SIZE_RETURNED_IN_BUFFER, 1, [Does SIOCGIFCONF return size in the buffer?]) ;;
2145181834Srobertoesac
2146181834Sroberto
2147200576Srobertodnl    vvvvv-- this is wrong, if you re-enable the switch do not cache the result
2148181834Srobertodnl AC_CACHE_CHECK(if we want GDT surveying code, ac_cv_var_gdt_surveying,
2149181834Srobertodnl [AC_ARG_ENABLE(gdt-surveying,	[  --enable-gdt-surveying   - include GDT survey code],
2150181834Srobertodnl     [ans=$enableval], [ans=no])
2151181834Srobertodnl ac_cv_var_gdt_surveying=$ans])
2152181834Srobertodnl case "$ac_cv_var_gdt_surveying" in
2153181834Srobertodnl  yes) AC_DEFINE(GDT_SURVEYING, 1, [Include the GDT Surveying code?]) ;;
2154181834Srobertodnl esac
2155181834Sroberto
2156181834Sroberto# Check for ioctls TIOCGPPSEV
2157181834SrobertoAC_MSG_CHECKING(ioctl TIOCGPPSEV)
2158181834Srobertoif test "$ac_cv_header_termios_h" = "yes"; then
2159181834Sroberto    AC_EGREP_CPP(yes,
2160181834Sroberto    [#include <termios.h>
2161181834Sroberto#ifdef TIOCGPPSEV
2162181834Sroberto         yes
2163181834Sroberto#endif
2164181834Sroberto	 ], ntp_ok=yes, ntp_ok=no)
2165181834Srobertoelse
2166181834Srobertontp_ok=no
2167181834Srobertofi
2168181834Srobertoif test "$ntp_ok" = "yes"; then
2169181834Sroberto    AC_DEFINE(HAVE_TIOCGPPSEV, 1, [Do we have the TIOCGPPSEV ioctl (Solaris)?])
2170181834Sroberto    ac_cv_var_oncore_ok=yes
2171181834Srobertofi
2172181834SrobertoAC_MSG_RESULT($ntp_ok)
2173181834Sroberto
2174181834Sroberto# Check for ioctls TIOCSPPS
2175181834SrobertoAC_MSG_CHECKING(ioctl TIOCSPPS)
2176181834Srobertoif test "$ac_cv_header_termios_h" = "yes"; then
2177181834Sroberto    AC_EGREP_CPP(yes,
2178181834Sroberto    [#include <termios.h>
2179181834Sroberto#ifdef TIOCSPPS
2180181834Sroberto         yes
2181181834Sroberto#endif
2182181834Sroberto	 ], ntp_ok=yes, ntp_ok=no)
2183181834Srobertoelse
2184181834Sroberto    ntp_ok=no
2185181834Srobertofi
2186181834Sroberto
2187181834Srobertoif test "$ntp_ok" = "yes"; then
2188181834Sroberto    AC_DEFINE(HAVE_TIOCSPPS, 1, [Do we have the TIOCSPPS ioctl (Solaris)?])
2189181834Srobertofi
2190181834SrobertoAC_MSG_RESULT($ntp_ok)
2191181834Sroberto
2192181834Sroberto# Check for ioctls CIOGETEV
2193200576SrobertoAC_MSG_CHECKING([ioctl CIOGETEV])
2194181834Srobertoif test "$ac_cv_header_sys_ppsclock_h" = "yes"; then
2195181834Sroberto    AC_EGREP_CPP(yes,
2196181834Sroberto    [#include <sys/ppsclock.h>
2197181834Sroberto#ifdef CIOGETEV
2198181834Sroberto         yes
2199181834Sroberto#endif
2200181834Sroberto	 ], ntp_ok=yes, ntp_ok=no)
2201181834Srobertoelse
2202181834Srobertontp_ok=no
2203181834Srobertofi
2204181834Srobertoif test "$ntp_ok" = "yes"; then
2205181834Sroberto    ac_cv_var_oncore_ok=yes
2206181834Sroberto    AC_DEFINE(HAVE_CIOGETEV, 1, [Do we have the CIOGETEV ioctl (SunOS, Linux)?])
2207181834Srobertofi
2208181834SrobertoAC_MSG_RESULT($ntp_ok)
2209181834Sroberto
2210181834Sroberto
2211181834Sroberto# ATOM/PPSAPI stuff.
2212181834Sroberto
2213181834Sroberto# ATOM used to require struct timespec, but that's been fixed now.
2214181834Sroberto
2215181834Sroberto# case "$ac_cv_struct_timespec" in
2216181834Sroberto#  'yes')
2217181834Sroberto#     ac_cv_var_atom_ok=yes
2218181834Sroberto#     ;;
2219181834Sroberto# esac
2220181834Srobertoac_cv_var_atom_ok=yes
2221181834Sroberto
2222181834Sroberto# Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff.
2223181834Sroberto
2224181834Sroberto# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline')
2225181834Sroberto
2226181834Sroberto# The PPSAPI needs struct timespec.
2227181834Sroberto
2228181834Sroberto# The PPSAPI also needs a timepps header.
2229181834Sroberto
2230181834Srobertocase "$ac_cv_c_inline$ac_cv_struct_timespec" in
2231181834Sroberto inlineyes)
2232181834Sroberto    case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h$host_os" in
2233181834Sroberto     *yes* | *sunos* | *solaris* | *sco* | *netbsd* )
2234181834Sroberto	AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
2235181834Sroberto	ac_cv_var_jupiter_ok=yes
2236181834Sroberto	ac_cv_var_oncore_ok=yes
2237181834Sroberto	ac_cv_var_parse_ok=yes
2238181834Sroberto	ac_cv_var_ripe_ncc_ok=yes
2239181834Sroberto	;;
2240181834Sroberto    esac
2241181834Sroberto    ;;
2242181834Srobertoesac
2243181834Sroberto
2244181834Sroberto# Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG
2245181834SrobertoAC_CHECK_HEADER(linux/serial.h)
2246200576SrobertoAC_MSG_CHECKING([ioctl TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG])
2247181834Srobertocase "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in
2248181834Sroberto  yesyes)
2249181834Sroberto    AC_EGREP_CPP(yes,
2250181834Sroberto    [#include <sys/time.h>
2251181834Srobertotypedef int u_int;
2252181834Sroberto
2253181834Sroberto#include <sys/ppsclock.h>
2254181834Sroberto#include <linux/serial.h>
2255181834Sroberto
2256181834Sroberto#ifdef TIOCGSERIAL
2257181834Sroberto#ifdef TIOCSSERIAL
2258181834Sroberto#ifdef ASYNC_PPS_CD_POS
2259181834Sroberto#ifdef ASYNC_PPS_CD_NEG
2260181834Sroberto#ifdef CIOGETEV
2261181834Sroberto         yes
2262181834Sroberto#endif
2263181834Sroberto#endif
2264181834Sroberto#endif
2265181834Sroberto#endif
2266181834Sroberto#endif
2267181834Sroberto	 ], ntp_ok=yes)
2268181834Sroberto	;;
2269181834Sroberto  *)
2270181834Sroberto	ntp_ok=no
2271181834Sroberto	;;
2272181834Srobertoesac
2273181834Srobertoif test "$ntp_ok" = "yes"; then
2274181834Sroberto    AC_DEFINE(HAVE_TIO_SERIAL_STUFF, 1, [Do we have the TIO serial stuff?])
2275181834Srobertofi
2276181834SrobertoAC_MSG_RESULT($ntp_ok)
2277181834Sroberto
2278181834Sroberto# Check for SHMEM_STATUS support
2279200576SrobertoAC_MSG_CHECKING([SHMEM_STATUS support])
2280181834Srobertocase "$ac_cv_header_sys_mman_h" in
2281181834Sroberto yes) ntp_ok=yes ;;
2282181834Sroberto *)   ntp_ok=no  ;;
2283181834Srobertoesac
2284181834Srobertoif test "$ntp_ok" = "yes"; then
2285181834Sroberto    AC_DEFINE(ONCORE_SHMEM_STATUS, 1, [Do we have support for SHMEM_STATUS?])
2286181834Srobertofi
2287181834SrobertoAC_MSG_RESULT($ntp_ok)
2288181834Sroberto
2289181834Srobertodnl dnl These are for OPT_PROGRAMS in authstuff/
2290181834Srobertodnl AC_SUBST(AUTHCERT)
2291181834Srobertodnl AC_SUBST(AUTHSPEED)
2292181834Srobertodnl AC_SUBST(MD5DRIVER)
2293181834Srobertodnl AC_SUBST(KEYPARITY)
2294181834Srobertodnl AC_SUBST(MAKEIPFP)
2295181834Srobertodnl AC_SUBST(MAKEPC1)
2296181834Srobertodnl AC_SUBST(MAKEPC2)
2297181834Srobertodnl AC_SUBST(MAKESP)
2298181834Srobertodnl AC_SUBST(MKRANDKEYS)
2299181834Srobertodnl AC_SUBST(OMAKEIPFP)
2300181834Srobertodnl AC_SUBST(UNIXCERT)
2301181834Sroberto
2302181834Srobertontp_refclock=no
2303181834Sroberto
2304181834Sroberto# HPUX only, and by explicit request
2305200576SrobertoAC_MSG_CHECKING([Datum/Bancomm bc635/VME interface])
2306181834SrobertoAC_ARG_ENABLE(BANCOMM,
2307181834Sroberto    AC_HELP_STRING([--enable-BANCOMM], [- Datum/Bancomm bc635/VME interface]),
2308181834Sroberto    [ntp_ok=$enableval], [ntp_ok=no])
2309181834Srobertoif test "$ntp_ok" = "yes"; then
2310181834Sroberto    ntp_refclock=yes
2311181834Sroberto    AC_DEFINE(CLOCK_BANC, 1, [Datum/Bancomm bc635/VME interface?])
2312181834Srobertofi
2313181834SrobertoAC_MSG_RESULT($ntp_ok)
2314181834Srobertocase "$ntp_ok$host" in
2315181834Sroberto yes*-*-hpux*) ;;
2316200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2317181834Srobertoesac
2318181834Sroberto
2319181834Sroberto#HPUX only, and only by explicit request
2320200576SrobertoAC_MSG_CHECKING([TrueTime GPS receiver/VME interface])
2321181834SrobertoAC_ARG_ENABLE(GPSVME,
2322181834Sroberto    AC_HELP_STRING([--enable-GPSVME], [- TrueTime GPS receiver/VME interface]),
2323181834Sroberto    [ntp_ok=$enableval], [ntp_ok=no])
2324181834Srobertoif test "$ntp_ok" = "yes"; then
2325181834Sroberto    ntp_refclock=yes
2326181834Sroberto    AC_DEFINE(CLOCK_GPSVME, 1, [TrueTime GPS receiver/VME interface?])
2327181834Srobertofi
2328181834SrobertoAC_MSG_RESULT($ntp_ok)
2329181834Srobertocase "$ntp_ok$host" in
2330181834Sroberto yes*-*-hpux*) ;;
2331200576Sroberto yes*) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2332181834Srobertoesac
2333181834Sroberto
2334200576SrobertoAC_MSG_CHECKING([for PCL720 clock support])
2335181834Srobertocase "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in
2336181834Sroberto yesyesyes)
2337181834Sroberto    AC_DEFINE(CLOCK_PPS720, 1, [PCL 720 clock support])
2338181834Sroberto    ans=yes
2339181834Sroberto    ;;
2340181834Sroberto *)
2341181834Sroberto    ans=no
2342181834Sroberto    ;;
2343181834Srobertoesac
2344200576SrobertoAC_MSG_RESULT([$ans])
2345181834Sroberto
2346200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable non-PARSE clocks])
2347181834SrobertoAC_ARG_ENABLE(all-clocks,
2348181834Sroberto    AC_HELP_STRING([--enable-all-clocks], [+ include all suitable non-PARSE clocks:]),
2349181834Sroberto    [ntp_eac=$enableval], [ntp_eac=yes])
2350181834SrobertoAC_MSG_RESULT($ntp_eac)
2351181834Sroberto
2352181834Sroberto# HMS: Should we also require ac_cv_var_parse_ok?
2353200576SrobertoAC_MSG_CHECKING([if we have support for PARSE clocks])
2354181834Srobertocase "$ac_cv_var_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in
2355181834Sroberto yes*yes*)
2356181834Sroberto    ntp_canparse=yes
2357181834Sroberto    ;;
2358181834Sroberto *) ntp_canparse=no
2359181834Sroberto    ;;
2360181834Srobertoesac
2361181834SrobertoAC_MSG_RESULT($ntp_canparse)
2362181834Sroberto
2363181834SrobertoAC_MSG_CHECKING([if we have support for audio clocks])
2364181834Srobertocase "$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
2365181834Sroberto *yes*)
2366181834Sroberto    ntp_canaudio=yes
2367181834Sroberto    AC_DEFINE(HAVE_AUDIO, , [Do we have audio support?])
2368181834Sroberto    ;;
2369181834Sroberto *) ntp_canaudio=no ;;
2370181834Srobertoesac
2371181834SrobertoAC_MSG_RESULT($ntp_canaudio)
2372181834Sroberto
2373181834SrobertoAC_MSG_CHECKING([if we have support for the SHM refclock interface])
2374181834Srobertocase "$ac_cv_header_sys_ipc_h$ac_cv_header_sys_shm_h" in
2375181834Sroberto yesyes)
2376181834Sroberto    ntp_canshm=yes
2377181834Sroberto    ;;
2378181834Sroberto *) ntp_canshm=no ;;
2379181834Srobertoesac
2380181834SrobertoAC_MSG_RESULT($ntp_canshm)
2381181834Sroberto
2382181834Sroberto# Requires modem control
2383200576SrobertoAC_MSG_CHECKING([ACTS modem service])
2384181834SrobertoAC_ARG_ENABLE(ACTS,
2385181834Sroberto    AC_HELP_STRING([--enable-ACTS], [s ACTS modem service]),
2386181834Sroberto    [ntp_ok=$enableval],
2387181834Sroberto    [AC_EGREP_CPP(yes,
2388181834Sroberto        [#include <termios.h>
2389181834Sroberto#ifdef HAVE_SYS_IOCTL_H
2390181834Sroberto#include <sys/ioctl.h>
2391181834Sroberto#endif
2392181834Sroberto#ifdef TIOCMBIS
2393181834Sroberto         yes
2394181834Sroberto#endif
2395181834Sroberto         ], ntp_ok=$ntp_eac, ntp_ok=no)])
2396181834Srobertoif test "$ntp_ok" = "yes"; then
2397181834Sroberto    ntp_refclock=yes
2398181834Sroberto    AC_DEFINE(CLOCK_ACTS, 1, [ACTS modem service])
2399181834Srobertofi
2400181834SrobertoAC_MSG_RESULT($ntp_ok)
2401181834Sroberto
2402200576SrobertoAC_MSG_CHECKING([Arbiter 1088A/B GPS receiver])
2403181834SrobertoAC_ARG_ENABLE(ARBITER,
2404181834Sroberto    AC_HELP_STRING([--enable-ARBITER], [+ Arbiter 1088A/B GPS receiver]),
2405181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2406181834Srobertoif test "$ntp_ok" = "yes"; then
2407181834Sroberto    ntp_refclock=yes
2408181834Sroberto    AC_DEFINE(CLOCK_ARBITER, 1, [Arbiter 1088A/B GPS receiver])
2409181834Srobertofi
2410181834SrobertoAC_MSG_RESULT($ntp_ok)
2411181834Sroberto
2412200576SrobertoAC_MSG_CHECKING([Arcron MSF receiver])
2413181834SrobertoAC_ARG_ENABLE(ARCRON_MSF,
2414181834Sroberto    AC_HELP_STRING([--enable-ARCRON-MSF], [+ Arcron MSF receiver]),
2415181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2416181834Srobertoif test "$ntp_ok" = "yes"; then
2417181834Sroberto    ntp_refclock=yes
2418181834Sroberto    AC_DEFINE(CLOCK_ARCRON_MSF, 1, [ARCRON support?])
2419181834Srobertofi
2420181834SrobertoAC_MSG_RESULT($ntp_ok)
2421181834Sroberto
2422200576SrobertoAC_MSG_CHECKING([Austron 2200A/2201A GPS receiver])
2423181834SrobertoAC_ARG_ENABLE(AS2201,
2424181834Sroberto    AC_HELP_STRING([--enable-AS2201], [+ Austron 2200A/2201A GPS receiver]),
2425181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2426181834Srobertoif test "$ntp_ok" = "yes"; then
2427181834Sroberto    ntp_refclock=yes
2428181834Sroberto    AC_DEFINE(CLOCK_AS2201, 1, [Austron 2200A/2201A GPS receiver?])
2429181834Srobertofi
2430181834SrobertoAC_MSG_RESULT($ntp_ok)
2431181834Sroberto
2432200576SrobertoAC_MSG_CHECKING([ATOM PPS interface])
2433181834SrobertoAC_ARG_ENABLE(ATOM,	
2434181834Sroberto    AC_HELP_STRING([--enable-ATOM], [s ATOM PPS interface]),
2435181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2436181834Srobertocase "$ac_cv_var_atom_ok" in
2437181834Sroberto no) ntp_ok=no ;;
2438181834Srobertoesac
2439181834Srobertoif test "$ntp_ok" = "yes"; then
2440181834Sroberto    ntp_refclock=yes
2441181834Sroberto    AC_DEFINE(CLOCK_ATOM, 1, [PPS interface?])
2442181834Srobertofi
2443181834SrobertoAC_MSG_RESULT($ntp_ok)
2444181834Sroberto
2445200576SrobertoAC_MSG_CHECKING([Chrono-log K-series WWVB receiver])
2446181834SrobertoAC_ARG_ENABLE(CHRONOLOG,
2447181834Sroberto    AC_HELP_STRING([--enable-CHRONOLOG], [+ Chrono-log K-series WWVB receiver]),
2448181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2449181834Srobertoif test "$ntp_ok" = "yes"; then
2450181834Sroberto    ntp_refclock=yes
2451181834Sroberto    AC_DEFINE(CLOCK_CHRONOLOG, 1, [Chronolog K-series WWVB receiver?])
2452181834Srobertofi
2453181834SrobertoAC_MSG_RESULT($ntp_ok)
2454181834Sroberto
2455200576SrobertoAC_MSG_CHECKING([CHU modem/decoder])
2456181834SrobertoAC_ARG_ENABLE(CHU,
2457181834Sroberto    AC_HELP_STRING([--enable-CHU], [+ CHU modem/decoder]),
2458181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2459181834Srobertoif test "$ntp_ok" = "yes"; then
2460181834Sroberto    ntp_refclock=yes
2461181834Sroberto    AC_DEFINE(CLOCK_CHU, 1, [CHU modem/decoder])
2462181834Srobertofi
2463181834SrobertoAC_MSG_RESULT($ntp_ok)
2464181834Srobertoac_refclock_chu=$ntp_ok
2465181834Sroberto
2466200576SrobertoAC_MSG_CHECKING([CHU audio/decoder])
2467181834SrobertoAC_ARG_ENABLE(AUDIO-CHU,
2468181834Sroberto    AC_HELP_STRING([--enable-AUDIO-CHU], [s CHU audio/decoder]),
2469181834Sroberto    [ntp_ok=$enableval],
2470181834Sroberto    [case "$ntp_eac$ac_refclock_chu$ntp_canaudio" in
2471181834Sroberto *no*)	ntp_ok=no  ;;
2472181834Sroberto *)	ntp_ok=yes ;;
2473181834Srobertoesac])
2474181834Srobertoif test "$ntp_ok" = "yes"; then
2475181834Sroberto    AC_DEFINE(AUDIO_CHU, 1, [CHU audio/decoder?])
2476181834Srobertofi
2477181834SrobertoAC_MSG_RESULT($ntp_ok)
2478181834Sroberto# We used to check for sunos/solaris target...
2479181834Srobertocase "$ntp_ok$ac_refclock_chu$ntp_canaudio" in
2480200576Sroberto yes*no*) AC_MSG_WARN([*** But the expected answer is...no ***]) ;;
2481181834Srobertoesac
2482181834Sroberto
2483181834Sroberto# Not under HP-UX
2484200576SrobertoAC_MSG_CHECKING([Datum Programmable Time System])
2485181834SrobertoAC_ARG_ENABLE(DATUM,
2486181834Sroberto    AC_HELP_STRING([--enable-DATUM], [s Datum Programmable Time System]),
2487181834Sroberto    [ntp_ok=$enableval],
2488181834Sroberto    [case "$ac_cv_header_termios_h" in
2489181834Sroberto    yes)
2490181834Sroberto        ntp_ok=$ntp_eac
2491181834Sroberto        ;;
2492181834Sroberto    *) ntp_ok=no
2493181834Sroberto        ;;
2494181834Sroberto    esac])
2495181834Srobertoif test "$ntp_ok" = "yes"; then
2496181834Sroberto    ntp_refclock=yes
2497181834Sroberto    AC_DEFINE(CLOCK_DATUM, 1, [Datum Programmable Time System?])
2498181834Srobertofi
2499181834SrobertoAC_MSG_RESULT($ntp_ok)
2500181834Sroberto
2501200576SrobertoAC_MSG_CHECKING([Dumb generic hh:mm:ss local clock])
2502181834SrobertoAC_ARG_ENABLE(DUMBCLOCK,
2503181834Sroberto    AC_HELP_STRING([--enable-DUMBCLOCK], [+ Dumb generic hh:mm:ss local clock]),
2504181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2505181834Srobertoif test "$ntp_ok" = "yes"; then
2506181834Sroberto    ntp_refclock=yes
2507181834Sroberto    AC_DEFINE(CLOCK_DUMBCLOCK, 1, [Dumb generic hh:mm:ss local clock?])
2508181834Srobertofi
2509181834SrobertoAC_MSG_RESULT($ntp_ok)
2510181834Sroberto
2511200576SrobertoAC_MSG_CHECKING([Forum Graphic GPS])
2512181834SrobertoAC_ARG_ENABLE(FG,
2513181834Sroberto    AC_HELP_STRING([--enable-FG], [+ Forum Graphic GPS]),
2514181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2515181834Srobertoif test "$ntp_ok" = "yes"; then
2516181834Sroberto    ntp_refclock=yes
2517181834Sroberto    AC_DEFINE(CLOCK_FG, 1, [Forum Graphic GPS datating station driver?])
2518181834Srobertofi
2519181834SrobertoAC_MSG_RESULT($ntp_ok)
2520181834Sroberto
2521181834Sroberto# Requires modem control
2522200576SrobertoAC_MSG_CHECKING([Heath GC-1000 WWV/WWVH receiver])
2523181834SrobertoAC_ARG_ENABLE(HEATH,
2524181834Sroberto    AC_HELP_STRING([--enable-HEATH], [s Heath GC-1000 WWV/WWVH receiver]),
2525181834Sroberto    [ntp_ok=$enableval],
2526181834Sroberto    [AC_EGREP_CPP(yes,
2527181834Sroberto        [#include <termios.h>
2528181834Sroberto#ifdef HAVE_SYS_IOCTL_H
2529181834Sroberto#include <sys/ioctl.h>
2530181834Sroberto#endif
2531181834Sroberto#ifdef TIOCMBIS
2532181834Sroberto         yes
2533181834Sroberto#endif
2534181834Sroberto         ], ntp_ok=$ntp_eac, ntp_ok=no)])
2535181834Srobertoif test "$ntp_ok" = "yes"; then
2536181834Sroberto    ntp_refclock=yes
2537181834Sroberto    AC_DEFINE(CLOCK_HEATH, 1, [Heath GC-1000 WWV/WWVH receiver?])
2538181834Srobertofi
2539181834SrobertoAC_MSG_RESULT($ntp_ok)
2540181834Sroberto
2541200576SrobertoAC_MSG_CHECKING([for hopf serial clock device])
2542181834SrobertoAC_ARG_ENABLE(HOPFSERIAL,
2543181834Sroberto    AC_HELP_STRING([--enable-HOPFSERIAL], [+ hopf serial clock device]),
2544181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2545181834Srobertoif test "$ntp_ok" = "yes"; then
2546181834Sroberto    ntp_refclock=yes
2547181834Sroberto    AC_DEFINE(CLOCK_HOPF_SERIAL, 1, [HOPF serial clock device?])
2548181834Srobertofi
2549181834SrobertoAC_MSG_RESULT($ntp_ok)
2550181834Sroberto
2551200576SrobertoAC_MSG_CHECKING([for hopf PCI clock 6039])
2552181834SrobertoAC_ARG_ENABLE(HOPFPCI,
2553181834Sroberto    AC_HELP_STRING([--enable-HOPFPCI], [+ hopf 6039 PCI board]),
2554181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2555181834Srobertoif test "$ntp_ok" = "yes"; then
2556181834Sroberto    ntp_refclock=yes
2557181834Sroberto    AC_DEFINE(CLOCK_HOPF_PCI, 1, [HOPF PCI clock device?])
2558181834Srobertofi
2559181834SrobertoAC_MSG_RESULT($ntp_ok)
2560181834Sroberto
2561200576SrobertoAC_MSG_CHECKING([HP 58503A GPS receiver])
2562181834SrobertoAC_ARG_ENABLE(HPGPS,
2563181834Sroberto    AC_HELP_STRING([--enable-HPGPS], [+ HP 58503A GPS receiver]),
2564181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2565181834Srobertoif test "$ntp_ok" = "yes"; then
2566181834Sroberto    ntp_refclock=yes
2567181834Sroberto    AC_DEFINE(CLOCK_HPGPS, 1, [HP 58503A GPS receiver?])
2568181834Srobertofi
2569181834SrobertoAC_MSG_RESULT($ntp_ok)
2570181834Sroberto
2571200576SrobertoAC_MSG_CHECKING([IRIG audio decoder])
2572181834SrobertoAC_ARG_ENABLE(IRIG,
2573181834Sroberto    AC_HELP_STRING([--enable-IRIG], [s IRIG audio decoder]),
2574181834Sroberto    [ntp_ok=$enableval],
2575181834Sroberto    [case "$ntp_eac$ntp_canaudio" in
2576181834Sroberto     *no*)	ntp_ok=no  ;;
2577181834Sroberto     *)		ntp_ok=yes ;;
2578181834Sroberto    esac])
2579181834Srobertoif test "$ntp_ok" = "yes"; then
2580181834Sroberto    ntp_refclock=yes
2581181834Sroberto    AC_DEFINE(CLOCK_IRIG, 1, [IRIG audio decoder?])
2582181834Srobertofi
2583181834SrobertoAC_MSG_RESULT($ntp_ok)
2584181834Srobertocase "$ntp_ok$ntp_canaudio" in
2585200576Sroberto yesno) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2586181834Srobertoesac
2587181834Sroberto
2588200576SrobertoAC_MSG_CHECKING([for JJY receiver])
2589181834SrobertoAC_ARG_ENABLE(JJY,
2590181834Sroberto    AC_HELP_STRING([--enable-JJY], [+ JJY receiver]),
2591181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2592181834Srobertoif test "$ntp_ok" = "yes"; then
2593181834Sroberto    ntp_refclock=yes
2594181834Sroberto    AC_DEFINE(CLOCK_JJY, 1, [JJY receiver?])
2595181834Srobertofi
2596181834SrobertoAC_MSG_RESULT($ntp_ok)
2597181834Sroberto
2598200576SrobertoAC_MSG_CHECKING([Rockwell Jupiter GPS receiver])
2599181834SrobertoAC_ARG_ENABLE(JUPITER,
2600181834Sroberto    AC_HELP_STRING([--enable-JUPITER], [s Rockwell Jupiter GPS receiver]),
2601181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2602181834Srobertocase "$ac_cv_var_jupiter_ok" in
2603181834Sroberto no) ntp_ok=no ;;
2604181834Srobertoesac
2605181834Srobertoif test "$ntp_ok" = "yes"; then
2606181834Sroberto    ntp_refclock=yes
2607181834Sroberto    AC_DEFINE(CLOCK_JUPITER, 1, [Rockwell Jupiter GPS clock?])
2608181834Srobertofi
2609181834SrobertoAC_MSG_RESULT($ntp_ok)
2610181834Sroberto
2611200576SrobertoAC_MSG_CHECKING([Leitch CSD 5300 Master Clock System Driver])
2612181834SrobertoAC_ARG_ENABLE(LEITCH,
2613181834Sroberto    AC_HELP_STRING([--enable-LEITCH], [+ Leitch CSD 5300 Master Clock System Driver]),
2614181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2615181834Srobertoif test "$ntp_ok" = "yes"; then
2616181834Sroberto    ntp_refclock=yes
2617181834Sroberto    AC_DEFINE(CLOCK_LEITCH, 1, [Leitch CSD 5300 Master Clock System Driver?])
2618181834Srobertofi
2619181834SrobertoAC_MSG_RESULT($ntp_ok)
2620181834Sroberto
2621200576SrobertoAC_MSG_CHECKING([local clock reference])
2622181834SrobertoAC_ARG_ENABLE(LOCAL-CLOCK,
2623181834Sroberto    AC_HELP_STRING([--enable-LOCAL-CLOCK], [+ local clock reference]),
2624181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2625181834Srobertoif test "$ntp_ok" = "yes"; then
2626181834Sroberto    ntp_refclock=yes
2627181834Sroberto    AC_DEFINE(CLOCK_LOCAL, 1, [local clock reference?])
2628181834Srobertofi
2629181834SrobertoAC_MSG_RESULT($ntp_ok)
2630181834Sroberto
2631181834Srobertodnl Bug 340: longstanding unfixed bugs
2632181834Srobertodnl AC_MSG_CHECKING(EES M201 MSF receiver)
2633181834Srobertodnl AC_ARG_ENABLE(MSFEES,
2634181834Srobertodnl     AC_HELP_STRING([--enable-MSFEES], [+ EES M201 MSF receiver]),
2635181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2636181834Srobertodnl if test "$ntp_ok" = "yes"; then
2637181834Srobertodnl     ntp_refclock=yes
2638181834Srobertodnl     AC_DEFINE(CLOCK_MSFEES, 1, [EES M201 MSF receiver])
2639181834Srobertodnl fi
2640181834Srobertodnl AC_MSG_RESULT($ntp_ok)
2641181834Sroberto
2642181834Sroberto# Not Ultrix
2643200576SrobertoAC_MSG_CHECKING([Magnavox MX4200 GPS receiver])
2644181834SrobertoAC_ARG_ENABLE(MX4200,
2645181834Sroberto    AC_HELP_STRING([--enable-MX4200 ], [s Magnavox MX4200 GPS receiver]),
2646181834Sroberto    [ntp_ok=$enableval],
2647181834Sroberto    [case "$ac_cv_var_ppsclock" in
2648181834Sroberto     yes) ntp_ok=$ntp_eac
2649181834Sroberto        ;;
2650181834Sroberto     *) ntp_ok=no
2651181834Sroberto        ;;
2652181834Sroberto    esac])
2653181834Srobertoif test "$ntp_ok" = "yes"; then
2654181834Sroberto    ntp_refclock=yes
2655181834Sroberto    AC_DEFINE(CLOCK_MX4200, 1, [Magnavox MX4200 GPS receiver])
2656181834Srobertofi
2657181834SrobertoAC_MSG_RESULT($ntp_ok)
2658181834Srobertocase "$ntp_ok$host" in
2659181834Sroberto yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;;
2660181834Srobertoesac
2661181834Sroberto
2662200576SrobertoAC_MSG_CHECKING([for NeoClock4X receiver])
2663181834SrobertoAC_ARG_ENABLE(NEOCLOCK4X,
2664181834Sroberto    AC_HELP_STRING([--enable-NEOCLOCK4X], [+ NeoClock4X DCF77 / TDF receiver]),
2665181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2666181834Srobertoif test "$ntp_ok" = "yes"; then
2667181834Sroberto    ntp_refclock=yes
2668181834Sroberto    AC_DEFINE(CLOCK_NEOCLOCK4X, 1, [NeoClock4X])
2669181834Srobertofi
2670181834SrobertoAC_MSG_RESULT($ntp_ok)
2671181834Sroberto
2672200576SrobertoAC_MSG_CHECKING([NMEA GPS receiver])
2673181834SrobertoAC_ARG_ENABLE(NMEA,
2674181834Sroberto    AC_HELP_STRING([--enable-NMEA], [+ NMEA GPS receiver]),
2675181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2676181834Srobertoif test "$ntp_ok" = "yes"; then
2677181834Sroberto    ntp_refclock=yes
2678181834Sroberto    AC_DEFINE(CLOCK_NMEA, 1, [NMEA GPS receiver])
2679181834Srobertofi
2680181834SrobertoAC_MSG_RESULT($ntp_ok)
2681181834Sroberto
2682200576SrobertoAC_MSG_CHECKING([for ONCORE Motorola VP/UT Oncore GPS])
2683181834SrobertoAC_ARG_ENABLE(ONCORE,
2684181834Sroberto    AC_HELP_STRING([--enable-ONCORE], [s Motorola VP/UT Oncore GPS receiver]),
2685181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2686181834Srobertocase "$ac_cv_var_oncore_ok" in
2687181834Sroberto no) ntp_ok=no ;;
2688181834Srobertoesac
2689181834Srobertoif test "$ntp_ok" = "yes"; then
2690181834Sroberto    ntp_refclock=yes
2691181834Sroberto    AC_DEFINE(CLOCK_ONCORE, 1, [Motorola UT Oncore GPS])
2692181834Srobertofi
2693181834SrobertoAC_MSG_RESULT($ntp_ok)
2694181834Sroberto
2695200576SrobertoAC_MSG_CHECKING([for Palisade clock])
2696181834SrobertoAC_ARG_ENABLE(PALISADE,
2697181834Sroberto    AC_HELP_STRING([--enable-PALISADE], [s Palisade clock]),
2698181834Sroberto    [ntp_ok=$enableval],
2699181834Sroberto    [case "$ac_cv_header_termios_h" in
2700181834Sroberto    yes)
2701181834Sroberto        ntp_ok=$ntp_eac
2702181834Sroberto        ;;
2703181834Sroberto    *) ntp_ok=no
2704181834Sroberto        ;;
2705181834Sroberto    esac])
2706181834Sroberto
2707181834Srobertoif test "$ntp_ok" = "yes"; then
2708181834Sroberto    ntp_refclock=yes
2709181834Sroberto    AC_DEFINE(CLOCK_PALISADE, 1, [Palisade clock])
2710181834Srobertofi
2711181834SrobertoAC_MSG_RESULT($ntp_ok)
2712181834Sroberto
2713200576SrobertoAC_MSG_CHECKING([Conrad parallel port radio clock])
2714181834SrobertoAC_ARG_ENABLE(PCF,
2715181834Sroberto    AC_HELP_STRING([--enable-PCF ], [+ Conrad parallel port radio clock]),
2716181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2717181834Srobertoif test "$ntp_ok" = "yes"; then
2718181834Sroberto    ntp_refclock=yes
2719181834Sroberto    AC_DEFINE(CLOCK_PCF, 1, [Conrad parallel port radio clock])
2720181834Srobertofi
2721181834SrobertoAC_MSG_RESULT($ntp_ok)
2722181834Sroberto
2723200576SrobertoAC_MSG_CHECKING([PST/Traconex 1020 WWV/WWVH receiver])
2724181834SrobertoAC_ARG_ENABLE(PST,
2725181834Sroberto    AC_HELP_STRING([--enable-PST], [+ PST/Traconex 1020 WWV/WWVH receiver]),
2726181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2727181834Srobertoif test "$ntp_ok" = "yes"; then
2728181834Sroberto    ntp_refclock=yes
2729181834Sroberto    AC_DEFINE(CLOCK_PST, 1, [PST/Traconex 1020 WWV/WWVH receiver])
2730181834Srobertofi
2731181834SrobertoAC_MSG_RESULT($ntp_ok)
2732181834Sroberto
2733200576SrobertoAC_MSG_CHECKING([RIPENCC specific Trimble driver])
2734181834SrobertoAC_ARG_ENABLE(RIPENCC,
2735181834Sroberto    AC_HELP_STRING([--enable-RIPENCC], [- RIPENCC specific Trimble driver]),
2736181834Sroberto    [ntp_ok=$enableval], [ntp_ok=no])
2737181834Sroberto# 020629: HMS: s/$ntp_eac -> -/no because of ptr += sprintf(ptr, ...) usage
2738181834Srobertocase "$ac_cv_var_ripe_ncc_ok" in
2739181834Sroberto no) ntp_ok=no ;;
2740181834Srobertoesac
2741181834Srobertoif test "$ntp_ok" = "yes"; then
2742181834Sroberto    ntp_refclock=yes
2743181834Sroberto    AC_DEFINE(CLOCK_RIPENCC, ,[RIPE NCC Trimble clock])
2744181834Srobertofi
2745181834SrobertoAC_MSG_RESULT($ntp_ok)
2746181834Sroberto
2747181834Sroberto# Danny Meyer says SHM compiles (with a few warnings) under Win32.
2748181834Sroberto# For *IX, we need sys/ipc.h and sys/shm.h.
2749200576SrobertoAC_MSG_CHECKING([for SHM clock attached thru shared memory])
2750181834SrobertoAC_ARG_ENABLE(SHM,
2751181834Sroberto    AC_HELP_STRING([--enable-SHM], [s SHM clock attached thru shared memory]),
2752181834Sroberto    [ntp_ok=$enableval],
2753181834Sroberto    [case "$ntp_eac$ntp_canshm" in
2754181834Sroberto *no*)	ntp_ok=no  ;;
2755181834Sroberto *)	ntp_ok=yes ;;
2756181834Srobertoesac])
2757181834Srobertoif test "$ntp_ok" = "yes"; then
2758181834Sroberto    ntp_refclock=yes
2759181834Sroberto    AC_DEFINE(CLOCK_SHM, 1, [clock thru shared memory])
2760181834Srobertofi
2761181834SrobertoAC_MSG_RESULT($ntp_ok)
2762181834Sroberto
2763200576SrobertoAC_MSG_CHECKING([Spectracom 8170/Netclock/2 WWVB receiver])
2764181834SrobertoAC_ARG_ENABLE(SPECTRACOM,
2765181834Sroberto    AC_HELP_STRING([--enable-SPECTRACOM], [+ Spectracom 8170/Netclock/2 WWVB receiver]),
2766181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2767181834Srobertoif test "$ntp_ok" = "yes"; then
2768181834Sroberto    ntp_refclock=yes
2769181834Sroberto    AC_DEFINE(CLOCK_SPECTRACOM, 1, [Spectracom 8170/Netclock/2 WWVB receiver])
2770181834Srobertofi
2771181834SrobertoAC_MSG_RESULT($ntp_ok)
2772181834Sroberto
2773200576SrobertoAC_MSG_CHECKING([KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2774181834SrobertoAC_ARG_ENABLE(TPRO,
2775181834Sroberto    AC_HELP_STRING([--enable-TPRO], [s KSI/Odetics TPRO/S GPS receiver/IRIG interface]),
2776181834Sroberto    [ntp_ok=$enableval],
2777181834Sroberto    [case "$ac_cv_header_sys_tpro_h" in
2778181834Sroberto     yes)
2779181834Sroberto	ntp_ok=$ntp_eac
2780181834Sroberto	;;
2781181834Sroberto     *)	ntp_ok=no
2782181834Sroberto	;;
2783181834Sroberto    esac])
2784181834Srobertoif test "$ntp_ok" = "yes"; then
2785181834Sroberto    ntp_refclock=yes
2786181834Sroberto    AC_DEFINE(CLOCK_TPRO, 1, [KSI/Odetics TPRO/S GPS receiver/IRIG interface])
2787181834Srobertofi
2788181834SrobertoAC_MSG_RESULT($ntp_ok)
2789181834Srobertocase "$ntp_ok$ac_cv_header_sys_tpro" in
2790200576Sroberto yesno) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2791181834Srobertoesac
2792181834Sroberto
2793181834Srobertodnl Bug 342: longstanding unfixed bugs
2794181834Srobertodnl AC_MSG_CHECKING(TRAK 8810 GPS receiver)
2795181834Srobertodnl AC_ARG_ENABLE(TRAK,
2796181834Srobertodnl     AC_HELP_STRING([--enable-TRAK], [+ TRAK 8810 GPS receiver]),
2797181834Srobertodnl     [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2798181834Srobertodnl if test "$ntp_ok" = "yes"; then
2799181834Srobertodnl     ntp_refclock=yes
2800181834Srobertodnl     AC_DEFINE(CLOCK_TRAK, 1, [TRAK 8810 GPS receiver])
2801181834Srobertodnl fi
2802181834Srobertodnl AC_MSG_RESULT($ntp_ok)
2803181834Sroberto
2804181834Sroberto# Not on a vax-dec-bsd
2805200576SrobertoAC_MSG_CHECKING([Kinemetrics/TrueTime receivers])
2806181834SrobertoAC_ARG_ENABLE(TRUETIME,
2807181834Sroberto    AC_HELP_STRING([--enable-TRUETIME], [s Kinemetrics/TrueTime receivers]),
2808181834Sroberto    [ntp_ok=$enableval],
2809181834Sroberto    [case "$host" in
2810181834Sroberto     vax-dec-bsd)
2811181834Sroberto	ntp_ok=no
2812181834Sroberto	;;
2813181834Sroberto     *)
2814181834Sroberto	ntp_ok=$ntp_eac
2815181834Sroberto	;;
2816181834Sroberto    esac])
2817200576Sroberto    
2818181834Srobertoif test "$ntp_ok" = "yes"; then
2819181834Sroberto    ntp_refclock=yes
2820181834Sroberto    AC_DEFINE(CLOCK_TRUETIME, 1, [Kinemetrics/TrueTime receivers])
2821181834Srobertofi
2822181834SrobertoAC_MSG_RESULT($ntp_ok)
2823181834Srobertocase "$ntp_ok$host" in
2824200576Sroberto yesvax-dec-bsd) AC_MSG_WARN([*** But the expected answer is... no ***]) ;;
2825181834Srobertoesac
2826181834Sroberto
2827200576SrobertoAC_MSG_CHECKING([TrueTime 560 IRIG-B decoder])
2828181834SrobertoAC_ARG_ENABLE(TT560,
2829181834Sroberto    AC_HELP_STRING([--enable-TT560], [- TrueTime 560 IRIG-B decoder]),
2830181834Sroberto    [ntp_ok=$enableval], [ntp_ok=no])
2831181834Srobertoif test "$ntp_ok" = "yes"; then
2832181834Sroberto    ntp_refclock=yes
2833181834Sroberto    AC_DEFINE(CLOCK_TT560, , [TrueTime 560 IRIG-B decoder?])
2834181834Srobertofi
2835181834SrobertoAC_MSG_RESULT($ntp_ok)
2836181834Sroberto
2837200576SrobertoAC_MSG_CHECKING([Ultralink M320 WWVB receiver])
2838181834SrobertoAC_ARG_ENABLE(ULINK,
2839181834Sroberto    AC_HELP_STRING([--enable-ULINK], [+ Ultralink WWVB receiver]),
2840181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2841181834Srobertoif test "$ntp_ok" = "yes"; then
2842181834Sroberto    ntp_refclock=yes
2843181834Sroberto    AC_DEFINE(CLOCK_ULINK, 1, [Ultralink M320 WWVB receiver?])
2844181834Srobertofi
2845181834SrobertoAC_MSG_RESULT($ntp_ok)
2846181834Sroberto
2847200576SrobertoAC_MSG_CHECKING([WWV receiver])
2848181834SrobertoAC_ARG_ENABLE(WWV,
2849181834Sroberto    AC_HELP_STRING([--enable-WWV], [s WWV Audio receiver]),
2850181834Sroberto    [ntp_ok=$enableval],
2851181834Sroberto    [case "$ntp_eac$ntp_canaudio" in
2852181834Sroberto     *no*)	ntp_ok=no  ;;
2853181834Sroberto     *)		ntp_ok=yes ;;
2854181834Sroberto    esac])
2855181834Srobertoif test "$ntp_ok" = "yes"; then
2856181834Sroberto    ntp_refclock=yes
2857181834Sroberto    AC_DEFINE(CLOCK_WWV, 1, [WWV audio driver])
2858181834Srobertofi
2859181834SrobertoAC_MSG_RESULT($ntp_ok)
2860181834Srobertocase "$ntp_ok$ntp_canaudio" in
2861181834Sroberto yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;;
2862181834Srobertoesac
2863181834Sroberto
2864200576SrobertoAC_MSG_CHECKING([for Zyfer receiver])
2865181834SrobertoAC_ARG_ENABLE(ZYFER,
2866181834Sroberto    AC_HELP_STRING([--enable-ZYFER], [+ Zyfer GPStarplus receiver]),
2867181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
2868181834Srobertoif test "$ntp_ok" = "yes"; then
2869181834Sroberto    ntp_refclock=yes
2870181834Sroberto    AC_DEFINE(CLOCK_ZYFER, 1, [Zyfer GPStarplus])
2871181834Srobertofi
2872181834SrobertoAC_MSG_RESULT($ntp_ok)
2873181834Sroberto
2874200576SrobertoAC_MSG_CHECKING([for default inclusion of all suitable PARSE clocks])
2875181834SrobertoAC_ARG_ENABLE(parse-clocks,
2876181834Sroberto   AC_HELP_STRING([--enable-parse-clocks], [- include all suitable PARSE clocks:]),
2877181834Sroberto    [ntp_eapc=$enableval],
2878181834Sroberto    [case "$ntp_eac" in
2879181834Sroberto     yes) ntp_eapc=$ntp_canparse ;;
2880181834Sroberto     *) ntp_eapc=no ;;
2881181834Sroberto    esac
2882181834Sroberto    # Delete the next line one of these days
2883181834Sroberto    ntp_eapc=no])
2884181834SrobertoAC_MSG_RESULT($ntp_eapc)
2885181834Sroberto
2886181834Srobertocase "$ntp_eac$ntp_eapc$ntp_canparse" in
2887181834Sroberto noyes*)
2888200576Sroberto    AC_MSG_ERROR(["--enable-parse-clocks" requires "--enable-all-clocks".])
2889181834Sroberto    ;;
2890181834Sroberto yesyesno)
2891200576Sroberto    AC_MSG_ERROR([You said "--enable-parse-clocks" but PARSE isn't supported on this platform!])
2892181834Sroberto    ;;
2893181834Sroberto *) ;;
2894181834Srobertoesac
2895181834Sroberto
2896181834Srobertontp_libparse=no
2897181834Srobertontp_parseutil=no
2898181834Srobertontp_rawdcf=no
2899181834Sroberto
2900200576SrobertoAC_MSG_CHECKING([Diem Computime Radio Clock])
2901181834SrobertoAC_ARG_ENABLE(COMPUTIME,
2902181834Sroberto    AC_HELP_STRING([--enable-COMPUTIME], [s Diem Computime Radio Clock]),
2903181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2904181834Srobertoif test "$ntp_ok" = "yes"; then
2905181834Sroberto    ntp_libparse=yes
2906181834Sroberto    ntp_refclock=yes
2907181834Sroberto    AC_DEFINE(CLOCK_COMPUTIME, 1, [Diems Computime Radio Clock?])
2908181834Srobertofi
2909181834SrobertoAC_MSG_RESULT($ntp_ok)
2910181834Srobertocase "$ntp_ok$ntp_canparse" in
2911181834Sroberto yesno)
2912200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2913181834Sroberto    ;;
2914181834Srobertoesac
2915181834Sroberto
2916200576SrobertoAC_MSG_CHECKING([ELV/DCF7000 clock])
2917181834SrobertoAC_ARG_ENABLE(DCF7000,
2918181834Sroberto    AC_HELP_STRING([--enable-DCF7000], [s ELV/DCF7000 clock]),
2919181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2920181834Srobertoif test "$ntp_ok" = "yes"; then
2921181834Sroberto    ntp_libparse=yes
2922181834Sroberto    ntp_refclock=yes
2923181834Sroberto    AC_DEFINE(CLOCK_DCF7000, 1, [ELV/DCF7000 clock?])
2924181834Srobertofi
2925181834SrobertoAC_MSG_RESULT($ntp_ok)
2926181834Srobertocase "$ntp_ok$ntp_canparse" in
2927181834Sroberto yesno)
2928200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2929181834Sroberto    ;;
2930181834Srobertoesac
2931181834Sroberto
2932200576SrobertoAC_MSG_CHECKING([HOPF 6021 clock])
2933181834SrobertoAC_ARG_ENABLE(HOPF6021,
2934181834Sroberto    AC_HELP_STRING([--enable-HOPF6021 ], [s HOPF 6021 clock]),
2935181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2936181834Srobertoif test "$ntp_ok" = "yes"; then
2937181834Sroberto    ntp_libparse=yes
2938181834Sroberto    ntp_refclock=yes
2939181834Sroberto    AC_DEFINE(CLOCK_HOPF6021, 1, [HOPF 6021 clock?])
2940181834Srobertofi
2941181834SrobertoAC_MSG_RESULT($ntp_ok)
2942181834Srobertocase "$ntp_ok$ntp_canparse" in
2943181834Sroberto yesno)
2944200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2945181834Sroberto    ;;
2946181834Srobertoesac
2947181834Sroberto
2948200576SrobertoAC_MSG_CHECKING([Meinberg clocks])
2949181834SrobertoAC_ARG_ENABLE(MEINBERG,
2950181834Sroberto    AC_HELP_STRING([--enable-MEINBERG], [s Meinberg clocks]),
2951181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2952181834Srobertoif test "$ntp_ok" = "yes"; then
2953181834Sroberto    ntp_libparse=yes
2954181834Sroberto    ntp_refclock=yes
2955181834Sroberto    AC_DEFINE(CLOCK_MEINBERG, 1, [Meinberg clocks])
2956181834Srobertofi
2957181834SrobertoAC_MSG_RESULT($ntp_ok)
2958181834Srobertocase "$ntp_ok$ntp_canparse" in
2959181834Sroberto yesno)
2960200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
2961181834Sroberto    ;;
2962181834Srobertoesac
2963181834Sroberto
2964200576SrobertoAC_MSG_CHECKING([DCF77 raw time code])
2965181834SrobertoAC_ARG_ENABLE(RAWDCF,
2966181834Sroberto    AC_HELP_STRING([--enable-RAWDCF], [s DCF77 raw time code]),
2967181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
2968181834Srobertoif test "$ntp_ok" = "yes"; then
2969181834Sroberto    ntp_libparse=yes
2970181834Sroberto    ntp_parseutil=yes
2971181834Sroberto    ntp_refclock=yes
2972181834Sroberto    ntp_rawdcf=yes
2973181834Sroberto    AC_DEFINE(CLOCK_RAWDCF, 1, [DCF77 raw time code])
2974181834Srobertofi
2975181834SrobertoAC_MSG_RESULT($ntp_ok)
2976181834Srobertocase "$ntp_ok$ntp_canparse" in
2977181834Sroberto yesno)
2978181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
2979181834Sroberto    ;;
2980181834Srobertoesac
2981181834Sroberto
2982181834Srobertocase "$ntp_rawdcf" in
2983181834Sroberto yes)
2984200576Sroberto    AC_CACHE_CHECK([if we must enable parity for RAWDCF],
2985181834Sroberto    ac_cv_var_rawdcf_parity,
2986181834Sroberto    [ans=no
2987181834Sroberto    case "$host" in
2988200576Sroberto     *-*-*linux*)
2989181834Sroberto        ans=yes
2990181834Sroberto        ;;
2991181834Sroberto    esac
2992181834Sroberto    ac_cv_var_rawdcf_parity=$ans])
2993181834Sroberto    case "$ac_cv_var_rawdcf_parity" in
2994181834Sroberto     yes) AC_DEFINE(RAWDCF_NO_IGNPAR, 1, [Should we not IGNPAR (Linux)?]) ;;
2995181834Sroberto    esac
2996181834Sroberto    ;;
2997181834Sroberto
2998181834Sroberto *) # HMS: Is this a good idea?
2999181834Sroberto    ac_cv_var_rawdcf_parity=no
3000181834Sroberto    ;;
3001181834Srobertoesac
3002181834Sroberto
3003200576SrobertoAC_MSG_CHECKING([RCC 8000 clock])
3004181834SrobertoAC_ARG_ENABLE(RCC8000,
3005181834Sroberto    AC_HELP_STRING([--enable-RCC8000], [s RCC 8000 clock]),
3006181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3007181834Srobertoif test "$ntp_ok" = "yes"; then
3008181834Sroberto    ntp_libparse=yes
3009181834Sroberto    ntp_refclock=yes
3010181834Sroberto    AC_DEFINE(CLOCK_RCC8000, 1, [RCC 8000 clock])
3011181834Srobertofi
3012181834SrobertoAC_MSG_RESULT($ntp_ok)
3013181834Srobertocase "$ntp_ok$ntp_canparse" in
3014181834Sroberto yesno)
3015181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3016181834Sroberto    ;;
3017181834Srobertoesac
3018181834Sroberto
3019200576SrobertoAC_MSG_CHECKING([Schmid DCF77 clock])
3020181834SrobertoAC_ARG_ENABLE(SCHMID,
3021181834Sroberto    AC_HELP_STRING([--enable-SCHMID ], [s Schmid DCF77 clock]),
3022181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3023181834Srobertoif test "$ntp_ok" = "yes"; then
3024181834Sroberto    ntp_libparse=yes
3025181834Sroberto    ntp_refclock=yes
3026181834Sroberto    AC_DEFINE(CLOCK_SCHMID, 1, [Schmid DCF77 clock])
3027181834Srobertofi
3028181834SrobertoAC_MSG_RESULT($ntp_ok)
3029181834Srobertocase "$ntp_ok$ntp_canparse" in
3030181834Sroberto yesno)
3031181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3032181834Sroberto    ;;
3033181834Srobertoesac
3034181834Sroberto
3035200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TAIP protocol])
3036181834SrobertoAC_ARG_ENABLE(TRIMTAIP,
3037181834Sroberto    AC_HELP_STRING([--enable-TRIMTAIP], [s Trimble GPS receiver/TAIP protocol]),
3038181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3039181834Srobertoif test "$ntp_ok" = "yes"; then
3040181834Sroberto    ntp_libparse=yes
3041181834Sroberto    ntp_refclock=yes
3042181834Sroberto    AC_DEFINE(CLOCK_TRIMTAIP, 1, [Trimble GPS receiver/TAIP protocol])
3043181834Srobertofi
3044181834SrobertoAC_MSG_RESULT($ntp_ok)
3045181834Srobertocase "$ntp_ok$ntp_canparse" in
3046181834Sroberto yesno)
3047181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3048181834Sroberto    ;;
3049181834Srobertoesac
3050181834Sroberto
3051200576SrobertoAC_MSG_CHECKING([Trimble GPS receiver/TSIP protocol])
3052181834SrobertoAC_ARG_ENABLE(TRIMTSIP,
3053181834Sroberto    AC_HELP_STRING([--enable-TRIMTSIP], [s Trimble GPS receiver/TSIP protocol]),
3054181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3055181834Srobertoif test "$ntp_ok" = "yes"; then
3056181834Sroberto    ntp_libparse=yes
3057181834Sroberto    ntp_refclock=yes
3058181834Sroberto    AC_DEFINE(CLOCK_TRIMTSIP, 1, [Trimble GPS receiver/TSIP protocol])
3059181834Srobertofi
3060181834SrobertoAC_MSG_RESULT($ntp_ok)
3061181834Srobertocase "$ntp_ok$ntp_canparse" in
3062181834Sroberto yesno)
3063181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3064181834Sroberto    ;;
3065181834Srobertoesac
3066181834Sroberto
3067200576SrobertoAC_MSG_CHECKING([WHARTON 400A Series clock])
3068181834SrobertoAC_ARG_ENABLE(WHARTON,
3069181834Sroberto    AC_HELP_STRING([--enable-WHARTON], [s WHARTON 400A Series clock]),
3070181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3071181834Srobertoif test "$ntp_ok" = "yes"; then
3072181834Sroberto    ntp_libparse=yes
3073181834Sroberto    ntp_refclock=yes
3074181834Sroberto    AC_DEFINE(CLOCK_WHARTON_400A, 1, [WHARTON 400A Series protocol])
3075181834Srobertofi
3076181834SrobertoAC_MSG_RESULT($ntp_ok)
3077181834Srobertocase "$ntp_ok$ntp_canparse" in
3078181834Sroberto yesno)
3079181834Sroberto    AC_MSG_ERROR(That's a parse clock and this system doesn't support it!)
3080181834Sroberto    ;;
3081181834Srobertoesac
3082181834Sroberto
3083200576SrobertoAC_MSG_CHECKING([VARITEXT clock])
3084181834SrobertoAC_ARG_ENABLE(VARITEXT,
3085181834Sroberto    AC_HELP_STRING([--enable-VARITEXT], [s VARITEXT clock]),
3086181834Sroberto    [ntp_ok=$enableval], [ntp_ok=$ntp_eapc])
3087181834Srobertoif test "$ntp_ok" = "yes"; then
3088181834Sroberto    ntp_libparse=yes
3089181834Sroberto    ntp_refclock=yes
3090181834Sroberto    AC_DEFINE(CLOCK_VARITEXT, 1, [VARITEXT protocol])
3091181834Srobertofi
3092181834SrobertoAC_MSG_RESULT($ntp_ok)
3093181834Srobertocase "$ntp_ok$ntp_canparse" in
3094181834Sroberto yesno)
3095200576Sroberto    AC_MSG_ERROR([That's a parse clock and this system doesn't support it!])
3096181834Sroberto    ;;
3097181834Srobertoesac
3098181834SrobertoAC_SUBST(LIBPARSE)
3099181834SrobertoAC_SUBST(MAKE_LIBPARSE)
3100181834SrobertoAC_SUBST(MAKE_LIBPARSE_KERNEL)
3101181834SrobertoAC_SUBST(MAKE_CHECK_Y2K)
3102200576SrobertoAC_MSG_CHECKING([if we need to make and use the parse libraries])
3103181834Srobertoans=no
3104181834Srobertocase "$ntp_libparse" in
3105181834Sroberto yes)
3106181834Sroberto    ans=yes
3107181834Sroberto    AC_DEFINE(CLOCK_PARSE, 1, [PARSE driver interface])
3108181834Sroberto    LIBPARSE=../libparse/libparse.a
3109181834Sroberto    MAKE_LIBPARSE=libparse.a
3110181834Sroberto    # HMS: check_y2k trips the 34 year problem now...
3111181834Sroberto    false && MAKE_CHECK_Y2K=check_y2k
3112181834Sroberto    AC_DEFINE(PPS_SAMPLE, 1, [PPS auxiliary interface for ATOM?])
3113181834Sroberto    AC_DEFINE(CLOCK_ATOM)
3114181834Sroberto    ;;
3115181834Srobertoesac
3116200576SrobertoAC_MSG_RESULT([$ans])
3117181834Sroberto
3118181834Sroberto# AC_SUBST(RSAOBJS)
3119181834Sroberto# AC_SUBST(RSASRCS)
3120181834Sroberto# AC_SUBST(RSADIR)
3121181834Sroberto# AC_SUBST(RSAREF)
3122181834Sroberto# AC_SUBST(LIBRSAREF)
3123181834Sroberto# AC_SUBST(MAKE_LIBRSAREF)
3124181834Sroberto
3125181834SrobertoAC_SUBST(OPENSSL)
3126181834SrobertoAC_SUBST(OPENSSL_INC)
3127181834SrobertoAC_SUBST(OPENSSL_LIB)
3128181834Sroberto
3129200576SrobertoAC_MSG_CHECKING([for openssl library directory])
3130181834SrobertoAC_ARG_WITH(openssl-libdir,
3131181834Sroberto	AC_HELP_STRING([--with-openssl-libdir], [+ =/something/reasonable]),
3132181834Sroberto[ans=$withval],
3133181834Sroberto[case "$build" in
3134181834Sroberto $host) ans=yes ;;
3135181834Sroberto *)     ans=no ;;
3136181834Srobertoesac])
3137181834Srobertocase "$ans" in
3138181834Sroberto no) ;;
3139181834Sroberto yes) # Look in:
3140181834Sroberto    ans="/usr/lib /usr/lib/openssl /usr/sfw/lib /usr/local/lib /usr/local/ssl/lib"
3141181834Sroberto    ;;
3142181834Sroberto *) # Look where they said
3143181834Sroberto    ;;
3144181834Srobertoesac
3145181834Srobertocase "$ans" in
3146181834Sroberto no) ;;
3147181834Sroberto *) # Look for libcrypto.a and libssl.a:
3148181834Sroberto    for i in $ans no
3149181834Sroberto    do
3150181834Sroberto	case "$host" in
3151181834Sroberto	 *-*-darwin*)
3152181834Sroberto	    test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
3153181834Sroberto	    ;;
3154181834Sroberto	 *)
3155181834Sroberto	    test -f $i/libcrypto.so -a -f $i/libssl.so && break
3156181834Sroberto	    test -f $i/libcrypto.a -a -f $i/libssl.a && break
3157181834Sroberto	    ;;
3158181834Sroberto	esac
3159181834Sroberto    done
3160181834Sroberto    case "$i" in
3161181834Sroberto     no)
3162181834Sroberto	ans=no
3163181834Sroberto	OPENSSL_LIB=
3164181834Sroberto	;;
3165181834Sroberto     *) ans=$i
3166181834Sroberto	OPENSSL_LIB=$ans
3167181834Sroberto	;;
3168181834Sroberto    esac
3169181834Sroberto    ;;
3170181834Srobertoesac
3171200576SrobertoAC_MSG_RESULT([$ans])
3172181834Sroberto
3173200576SrobertoAC_MSG_CHECKING([for openssl include directory])
3174181834SrobertoAC_ARG_WITH(openssl-incdir,
3175181834Sroberto	AC_HELP_STRING([--with-openssl-incdir], [+ =/something/reasonable]),
3176181834Sroberto[ans=$withval],
3177181834Sroberto[case "$build" in
3178181834Sroberto $host) ans=yes ;;
3179181834Sroberto *)     ans=no ;;
3180181834Srobertoesac])
3181181834Srobertocase "$ans" in
3182181834Sroberto no) ;;
3183181834Sroberto yes) # look in:
3184181834Sroberto    ans="/usr/include /usr/sfw/include /usr/local/include /usr/local/ssl/include"
3185181834Sroberto    ;;
3186181834Sroberto *) # Look where they said
3187181834Sroberto    ;;
3188181834Srobertoesac
3189181834Srobertocase "$ans" in
3190181834Sroberto no) ;;
3191181834Sroberto *) # look for openssl/opensslconf.h:
3192181834Sroberto    for i in $ans no
3193181834Sroberto    do
3194181834Sroberto	test -f $i/openssl/opensslconf.h && break
3195181834Sroberto    done
3196181834Sroberto    case "$i" in
3197181834Sroberto     no)
3198181834Sroberto	ans=no
3199181834Sroberto	OPENSSL_INC=
3200181834Sroberto	;;
3201181834Sroberto     *) ans=$i
3202181834Sroberto	OPENSSL_INC=$ans
3203181834Sroberto	;;
3204181834Sroberto    esac
3205181834Sroberto    ;;
3206181834Srobertoesac
3207200576SrobertoAC_MSG_RESULT([$ans])
3208181834Sroberto
3209181834SrobertoAC_ARG_WITH(crypto,
3210181834Sroberto	AC_HELP_STRING([--with-crypto], [+ =openssl]),
3211181834Sroberto[ans=$withval], [ans=yes])
3212181834Srobertocase "$ans" in
3213181834Sroberto no) ;;
3214181834Sroberto yes|openssl)
3215181834Sroberto    if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC"
3216181834Sroberto    then
3217181834Sroberto	ans=no
3218181834Sroberto    else
3219181834Sroberto	# We have OpenSSL inc/lib - use them.
3220181834Sroberto	ans=openssl
3221181834Sroberto	CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
3222181834Sroberto	LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
3223181834Sroberto	case "$need_dash_r" in
3224181834Sroberto	 1) LDFLAGS="$LDFLAGS -R$OPENSSL_LIB"
3225181834Sroberto	    ;;
3226181834Sroberto	esac
3227181834Sroberto	AC_SUBST(LCRYPTO, [-lcrypto])
3228181834Sroberto	AC_DEFINE(OPENSSL, , [Use OpenSSL?])
3229181834Sroberto	AC_CHECK_FUNCS(EVP_md2 EVP_mdc2)
3230181834Sroberto    fi
3231181834Sroberto    ;;
3232181834Srobertoesac
3233181834SrobertoAC_MSG_CHECKING(for the level of crypto support)
3234200576SrobertoAC_MSG_RESULT([$ans])
3235181834Sroberto
3236200576SrobertoAC_MSG_CHECKING([if we want to compile with ElectricFence])
3237181834SrobertoAC_ARG_WITH(electricfence,
3238181834Sroberto	AC_HELP_STRING([--with-electricfence], [- compile with ElectricFence malloc debugger]),
3239181834Sroberto[ans=$withval], [ans=no])
3240181834Srobertocase "$ans" in
3241181834Sroberto no) ;;
3242181834Sroberto *)
3243181834Sroberto    LIBS="$LIBS \${top_builddir}/ElectricFence/libefence.a"
3244181834Sroberto    EF_PROGS="eftest tstheap"
3245181834Sroberto    AC_SUBST(EF_PROGS)
3246181834Sroberto    EF_LIBS=libefence.a
3247181834Sroberto    AC_SUBST(EF_LIBS)
3248181834Sroberto    ans=yes
3249181834Sroberto    ;;
3250181834Srobertoesac
3251200576SrobertoAC_MSG_RESULT([$ans])
3252181834Sroberto
3253181834SrobertoAC_SUBST(MAKE_CHECK_LAYOUT)
3254200576SrobertoAC_MSG_CHECKING([if we want to run check-layout])
3255181834Srobertocase "$cross_compiling$PATH_PERL" in
3256181834Sroberto no/*)
3257181834Sroberto    MAKE_CHECK_LAYOUT=check-layout
3258181834Sroberto    ans=yes
3259181834Sroberto    ;;
3260181834Sroberto *)
3261181834Sroberto    ans=no
3262181834Sroberto    ;;
3263181834Srobertoesac
3264200576SrobertoAC_MSG_RESULT([$ans])
3265181834Sroberto
3266181834SrobertoAC_SUBST(TESTDCF)
3267181834SrobertoAC_SUBST(DCFD)
3268181834Sroberto
3269200576SrobertoAC_MSG_CHECKING([if we can make dcf parse utilities])
3270181834Srobertoans=no
3271181834Srobertoif test "$ntp_parseutil" = "yes"; then
3272181834Sroberto    case "$host" in
3273200576Sroberto     *-*-sunos4*|*-*-solaris2*|*-*-*linux*|*-*-netbsd*)
3274181834Sroberto	ans="dcfd testdcf"
3275181834Sroberto	DCFD=dcfd
3276181834Sroberto        TESTDCF=testdcf
3277181834Sroberto	;;
3278181834Sroberto    esac
3279181834Srobertofi
3280200576SrobertoAC_MSG_RESULT([$ans])
3281181834Sroberto
3282181834SrobertoAC_SUBST(MAKE_PARSEKMODULE)
3283200576SrobertoAC_MSG_CHECKING([if we can build kernel streams modules for parse])
3284181834Srobertoans=no
3285181834Srobertocase "$ntp_parseutil$ac_cv_header_sys_stropts_h" in
3286181834Sroberto yesyes)
3287181834Sroberto    case "$host" in
3288181834Sroberto     sparc-*-sunos4*)
3289181834Sroberto        case "$ac_cv_var_kernel_pll" in
3290181834Sroberto	yes)
3291181834Sroberto	    AC_DEFINE(PPS_SYNC, 1, [PARSE kernel PLL PPS support])
3292181834Sroberto	    ;;
3293181834Sroberto	esac
3294181834Sroberto	ans=parsestreams
3295181834Sroberto	MAKE_PARSEKMODULE=parsestreams.loadable_module.o
3296181834Sroberto	;;
3297181834Sroberto     sparc-*-solaris2*)
3298181834Sroberto	ans=parsesolaris
3299181834Sroberto	MAKE_PARSEKMODULE=parse
3300181834Sroberto	;;
3301181834Sroberto    esac
3302181834Sroberto    ;;
3303181834Srobertoesac
3304200576SrobertoAC_MSG_RESULT([$ans])
3305181834Sroberto
3306200576SrobertoAC_MSG_CHECKING([if we need basic refclock support])
3307181834Srobertoif test "$ntp_refclock" = "yes"; then
3308181834Sroberto    AC_DEFINE(REFCLOCK, 1, [Basic refclock support?])
3309181834Srobertofi
3310181834SrobertoAC_MSG_RESULT($ntp_refclock)
3311181834Sroberto
3312181834Srobertodnl Things that can be made in clockstuff/
3313181834SrobertoAC_SUBST(PROPDELAY)	dnl Set to "propdelay"
3314181834SrobertoAC_SUBST(CHUTEST)	dnl Set to "chutest"
3315181834SrobertoAC_SUBST(CLKTEST)	dnl Set to "clktest"
3316181834Sroberto
3317181834SrobertoAC_SUBST(MAKE_ADJTIMED)
3318181834SrobertoAC_MSG_CHECKING(if we want HP-UX adjtimed support)
3319181834Srobertocase "$host" in
3320181834Sroberto *-*-hpux[[56789]]*)
3321181834Sroberto    ans=yes
3322181834Sroberto    ;;
3323181834Sroberto *) ans=no
3324181834Sroberto    ;;
3325181834Srobertoesac
3326181834Srobertoif test "$ans" = "yes"; then
3327181834Sroberto    MAKE_ADJTIMED=adjtimed
3328181834Sroberto    AC_DEFINE(NEED_HPUX_ADJTIME, 1, [Do we need HPUX adjtime() library support?])
3329181834Srobertofi
3330200576SrobertoAC_MSG_RESULT([$ans])
3331181834Sroberto
3332200576SrobertoAC_MSG_CHECKING([if we want QNX adjtime support])
3333181834Srobertocase "$host" in
3334181834Sroberto *-*-qnx*)
3335181834Sroberto    ans=yes
3336181834Sroberto    ;;
3337181834Sroberto *) ans=no
3338181834Sroberto    ;;
3339181834Srobertoesac
3340181834Srobertoif test "$ans" = "yes"; then
3341181834Sroberto    AC_DEFINE(NEED_QNX_ADJTIME, 1, [Do we need the qnx adjtime call?])
3342181834Srobertofi
3343200576SrobertoAC_MSG_RESULT([$ans])
3344181834Sroberto
3345200576SrobertoAC_MSG_CHECKING([if we can read kmem])
3346181834Sroberto
3347200576Sroberto#  the default is to enable it if the system has the capability
3348200576Sroberto
3349200576Srobertocase "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in
3350200576Sroberto *yes*)
3351200576Sroberto    ans=yes
3352200576Sroberto    ;;
3353200576Sroberto *) ans=no
3354181834Srobertoesac
3355181834Sroberto
3356200576Srobertocase "$host" in
3357200576Sroberto *-*-domainos)	# Won't be found...
3358200576Sroberto    ans=no
3359200576Sroberto    ;;
3360200576Sroberto *-*-hpux*)
3361200576Sroberto    #ans=no
3362200576Sroberto    ;;
3363200576Sroberto *-*-irix[[456]]*)
3364200576Sroberto    ans=no
3365200576Sroberto    ;;
3366200576Sroberto *-*-*linux*)
3367200576Sroberto    ans=no
3368200576Sroberto    ;;
3369200576Sroberto *-*-winnt3.5)
3370200576Sroberto    ans=no
3371200576Sroberto    ;;
3372200576Sroberto *-*-unicosmp*)
3373200576Sroberto    ans=no
3374200576Sroberto    ;;
3375200576Srobertoesac
3376200576Sroberto
3377200576Sroberto# --enable-kmem / --disable-kmem controls if present
3378200576SrobertoAC_ARG_ENABLE(
3379200576Sroberto    [kmem],
3380200576Sroberto    AC_HELP_STRING(
3381200576Sroberto	[--enable-kmem],
3382200576Sroberto	[s read /dev/kmem for tick and/or tickadj]
3383200576Sroberto    ),
3384200576Sroberto    [ans=$enableval]
3385200576Sroberto)
3386200576Sroberto
3387200576SrobertoAC_MSG_RESULT([$ans])
3388200576Sroberto
3389200576Srobertocase "$ans" in
3390200576Sroberto yes)
3391200576Sroberto    can_kmem=yes
3392200576Sroberto    ;;
3393200576Sroberto *) 
3394200576Sroberto    can_kmem=no
3395200576Sroberto    AC_DEFINE(NOKMEM, 1, [Should we NOT read /dev/kmem?])
3396200576Srobertoesac
3397200576Sroberto
3398200576Sroberto
3399200576SrobertoAC_MSG_CHECKING([if adjtime is accurate])
3400200576Sroberto
3401200576Sroberto# target-dependent defaults
3402200576Sroberto
3403200576Srobertocase "$host" in
3404200576Sroberto i386-sequent-ptx*)
3405200576Sroberto    ans=no
3406200576Sroberto    ;;
3407200576Sroberto i386-unknown-osf1*)
3408200576Sroberto    ans=yes
3409200576Sroberto    ;;
3410200576Sroberto mips-sgi-irix[[456]]*)
3411200576Sroberto    ans=yes
3412200576Sroberto    ;;
3413200576Sroberto *-fujitsu-uxp*)
3414200576Sroberto    ans=yes
3415200576Sroberto    ;;
3416200576Sroberto *-ibm-aix[[456]]*)
3417200576Sroberto    ans=yes
3418200576Sroberto    ;;
3419200576Sroberto *-*-*linux*)
3420200576Sroberto    ans=yes
3421200576Sroberto    ;;
3422200576Sroberto *-*-solaris2.[[01]])
3423200576Sroberto    ans=no
3424200576Sroberto    ;;
3425200576Sroberto *-*-solaris2*)
3426200576Sroberto    ans=yes
3427200576Sroberto    ;;
3428200576Sroberto *-*-unicosmp*)
3429200576Sroberto    ans=yes
3430200576Sroberto    ;;
3431200576Sroberto *) ans=no
3432200576Srobertoesac
3433200576Sroberto
3434200576Sroberto# --enable-accurate-adjtime / --disable-accurate-adjtime
3435200576Sroberto# override the default
3436200576SrobertoAC_ARG_ENABLE([accurate-adjtime],
3437200576Sroberto    AC_HELP_STRING(
3438200576Sroberto        [--enable-accurate-adjtime], 
3439200576Sroberto        [s the adjtime() call is accurate]
3440200576Sroberto    ),
3441181834Sroberto    [ans=$enableval],
3442200576Sroberto)
3443200576Sroberto
3444200576SrobertoAC_MSG_RESULT([$ans])
3445200576Sroberto
3446200576Srobertocase "$ans" in
3447200576Sroberto yes) 
3448200576Sroberto    AC_DEFINE(ADJTIME_IS_ACCURATE, 1, [Is adjtime() accurate?])
3449200576Sroberto    adjtime_is_accurate=yes
3450200576Sroberto    ;;
3451200576Sroberto *)
3452200576Sroberto    adjtime_is_accurate=no
3453181834Srobertoesac
3454181834Sroberto
3455181834SrobertoAC_CACHE_CHECK([the name of 'tick' in the kernel],
3456181834Srobertoac_cv_var_nlist_tick,
3457181834Sroberto[ans=_tick
3458181834Srobertocase "$host" in
3459181834Sroberto m68*-hp-hpux*) # HP9000/300?
3460181834Sroberto    ans=_old_tick
3461181834Sroberto    ;;
3462181834Sroberto *-apple-aux[[23]]*)
3463181834Sroberto    ans=tick
3464181834Sroberto    ;;
3465181834Sroberto *-hp-hpux*)
3466181834Sroberto    ans=old_tick
3467181834Sroberto    ;;
3468200576Sroberto *-ibm-aix[[3456]]*)
3469181834Sroberto    ans=no
3470181834Sroberto    ;;
3471181834Sroberto *-*-mpeix*)
3472181834Sroberto    ans=no
3473181834Sroberto    ;;
3474181834Sroberto *-*-ptx*)
3475181834Sroberto    ans=tick
3476181834Sroberto    ;;
3477181834Sroberto *-*-sco3.2v[[45]]*)
3478181834Sroberto    ans=no
3479181834Sroberto    ;;
3480181834Sroberto *-*-solaris2*)
3481181834Sroberto    ans=nsec_per_tick
3482181834Sroberto    ;;
3483181834Sroberto *-*-sysv4*)
3484181834Sroberto    ans=tick
3485181834Sroberto    ;;
3486181834Srobertoesac
3487181834Srobertoac_cv_var_nlist_tick=$ans])
3488181834Srobertocase "$ac_cv_var_nlist_tick" in
3489181834Sroberto ''|no) ;;	# HMS: I think we can only get 'no' here...
3490181834Sroberto *) AC_DEFINE_UNQUOTED(K_TICK_NAME, "$ac_cv_var_nlist_tick", [What is the name of TICK in the kernel?]) ;;
3491181834Srobertoesac
3492181834Sroberto#
3493181834SrobertoAC_CACHE_CHECK([for the units of 'tick'],
3494181834Srobertoac_cv_var_tick_nano,
3495181834Sroberto[ans=usec
3496181834Srobertocase "$host" in
3497181834Sroberto *-*-solaris2*)
3498181834Sroberto    ans=nsec
3499181834Sroberto    ;;
3500181834Srobertoesac
3501181834Srobertoac_cv_var_tick_nano=$ans])
3502181834Srobertocase "$ac_cv_var_tick_nano" in
3503181834Sroberto nsec)
3504181834Sroberto    AC_DEFINE(TICK_NANO, 1, [Is K_TICK_NAME in nanoseconds?])
3505181834Sroberto    ;;
3506181834Srobertoesac
3507181834Sroberto#
3508181834SrobertoAC_CACHE_CHECK([the name of 'tickadj' in the kernel],
3509181834Srobertoac_cv_var_nlist_tickadj,
3510181834Sroberto[ans=_tickadj
3511181834Srobertocase "$host" in
3512181834Sroberto m68*-hp-hpux*) # HP9000/300?
3513181834Sroberto    ans=_tickadj
3514181834Sroberto    ;;
3515181834Sroberto *-apple-aux[[23]]*)
3516181834Sroberto    ans=tickadj
3517181834Sroberto    ;;
3518181834Sroberto *-hp-hpux10*)
3519181834Sroberto    ans=no
3520181834Sroberto    ;;
3521181834Sroberto *-hp-hpux9*)
3522181834Sroberto    ans=no
3523181834Sroberto    ;;
3524181834Sroberto *-hp-hpux*)
3525181834Sroberto    ans=tickadj
3526181834Sroberto    ;;
3527181834Sroberto *-*-aix*)
3528181834Sroberto    ans=tickadj
3529181834Sroberto    ;;
3530181834Sroberto *-*-mpeix*)
3531181834Sroberto    ans=no
3532181834Sroberto    ;;
3533181834Sroberto *-*-ptx*)
3534181834Sroberto    ans=tickadj
3535181834Sroberto    ;;
3536181834Sroberto *-*-sco3.2v4*)
3537181834Sroberto    ans=no
3538181834Sroberto    ;;
3539181834Sroberto *-*-sco3.2v5.0*)
3540181834Sroberto    ans=clock_drift
3541181834Sroberto    ;;
3542181834Sroberto *-*-solaris2*)
3543181834Sroberto    ans=no	# hrestime_adj
3544181834Sroberto    ;;
3545181834Sroberto *-*-sysv4*)
3546181834Sroberto    ans=tickadj
3547181834Sroberto    ;;
3548181834Srobertoesac
3549181834Srobertoac_cv_var_nlist_tickadj=$ans])
3550181834Srobertocase "$ac_cv_var_nlist_tickadj" in
3551181834Sroberto ''|no) ;;	# HMS: I think we can only get 'no' here...
3552181834Sroberto *) AC_DEFINE_UNQUOTED(K_TICKADJ_NAME, "$ac_cv_var_nlist_tickadj", [What is the name of TICKADJ in the kernel?]) ;;
3553181834Srobertoesac
3554181834Sroberto#
3555181834SrobertoAC_CACHE_CHECK([for the units of 'tickadj'],
3556181834Srobertoac_cv_var_tickadj_nano,
3557181834Sroberto[ans=usec
3558181834Srobertocase "$host" in
3559181834Sroberto *-*-solaris2*)
3560181834Sroberto    ans=nsec
3561181834Sroberto    ;;
3562181834Srobertoesac
3563181834Srobertoac_cv_var_tickadj_nano=$ans])
3564181834Srobertocase "$ac_cv_var_tickadj_nano" in
3565181834Sroberto nsec)
3566181834Sroberto    AC_DEFINE(TICKADJ_NANO, 1, [Is K_TICKADJ_NAME in nanoseconds?])
3567181834Sroberto    ;;
3568181834Srobertoesac
3569181834Sroberto#
3570181834SrobertoAC_CACHE_CHECK([half-heartedly for 'dosynctodr' in the kernel],
3571181834Srobertoac_cv_var_nlist_dosynctodr,
3572181834Sroberto[case "$host" in
3573181834Sroberto *-apple-aux[[23]]*)
3574181834Sroberto    ans=no
3575181834Sroberto    ;;
3576181834Sroberto *-sni-sysv*)
3577181834Sroberto    ans=dosynctodr
3578181834Sroberto    ;;
3579181834Sroberto *-*-aix*)
3580181834Sroberto    ans=dosynctodr
3581181834Sroberto    ;;
3582181834Sroberto *-*-hpux*)
3583181834Sroberto    ans=no
3584181834Sroberto    ;;
3585181834Sroberto *-*-mpeix*)
3586181834Sroberto    ans=no
3587181834Sroberto    ;;
3588181834Sroberto *-*-nextstep*)
3589181834Sroberto    ans=_dosynctodr
3590181834Sroberto    ;;
3591181834Sroberto *-*-ptx*)
3592181834Sroberto    ans=doresettodr
3593181834Sroberto    ;;
3594181834Sroberto *-*-sco3.2v4*)
3595181834Sroberto    ans=no
3596181834Sroberto    ;;
3597181834Sroberto *-*-sco3.2v5*)
3598181834Sroberto    ans=track_rtc
3599181834Sroberto    ;;
3600181834Sroberto *-*-solaris2*)
3601181834Sroberto    ans=dosynctodr
3602181834Sroberto    ;;
3603181834Sroberto *-*-sysv4*)
3604181834Sroberto    ans=doresettodr
3605181834Sroberto    ;;
3606181834Sroberto *)
3607181834Sroberto    ans=_dosynctodr
3608181834Sroberto    ;;
3609181834Srobertoesac
3610181834Srobertoac_cv_var_nlist_dosynctodr=$ans])
3611181834Srobertocase "$ac_cv_var_nlist_dosynctodr" in
3612181834Sroberto no) ;;
3613181834Sroberto *)  AC_DEFINE_UNQUOTED(K_DOSYNCTODR_NAME, "$ac_cv_var_nlist_dosynctodr", [What is (probably) the name of DOSYNCTODR in the kernel?])
3614181834Sroberto     ;;
3615181834Srobertoesac
3616181834Sroberto#
3617181834SrobertoAC_CACHE_CHECK([half-heartedly for 'noprintf' in the kernel],
3618181834Srobertoac_cv_var_nlist_noprintf,
3619181834Sroberto[case "$host" in
3620181834Sroberto *-apple-aux[[23]]*)
3621181834Sroberto    ans=no
3622181834Sroberto    ;;
3623181834Sroberto *-sni-sysv*)
3624181834Sroberto    ans=noprintf
3625181834Sroberto    ;;
3626181834Sroberto *-*-aix*)
3627181834Sroberto    ans=noprintf
3628181834Sroberto    ;;
3629181834Sroberto *-*-hpux*)
3630181834Sroberto    ans=no
3631181834Sroberto    ;;
3632181834Sroberto *-*-mpeix*)
3633181834Sroberto    ans=no
3634181834Sroberto    ;;
3635181834Sroberto *-*-ptx*)
3636181834Sroberto    ans=noprintf
3637181834Sroberto    ;;
3638181834Sroberto *-*-nextstep*)
3639181834Sroberto    ans=_noprintf
3640181834Sroberto    ;;
3641181834Sroberto *-*-solaris2*)
3642181834Sroberto    ans=noprintf
3643181834Sroberto    ;;
3644181834Sroberto *-*-sysv4*)
3645181834Sroberto    ans=noprintf
3646181834Sroberto    ;;
3647181834Sroberto *)
3648181834Sroberto    ans=_noprintf
3649181834Sroberto    ;;
3650181834Srobertoesac
3651181834Srobertoac_cv_var_nlist_noprintf=$ans])
3652181834Srobertocase "$ac_cv_var_nlist_noprintf" in
3653181834Sroberto no) ;;
3654181834Sroberto *)  AC_DEFINE_UNQUOTED(K_NOPRINTF_NAME, "$ac_cv_var_nlist_noprintf", [What is (probably) the name of NOPRINTF in the kernel?])
3655181834Sroberto     ;;
3656181834Srobertoesac
3657181834Sroberto
3658181834Srobertodnl The tick/tickadj sections were written by Skippy, who never learned
3659181834Srobertodnl that it's impolite (horridly gross) to show your guts in public.
3660181834Sroberto
3661181834Srobertodnl	tick		tickadj	
3662181834Srobertodnl	10000		80	    Unixware
3663181834Srobertodnl	1000000L/hz	tick/16     (Solaris,UXPV,HPUX) && ADJTIME_IS_ACCURATE
3664181834Srobertodnl	10000		150	    sgi IRIX
3665181834Srobertodnl	1000000L/hz	1000	    RS6000 && NOKMEM
3666181834Srobertodnl	1000000L/hz	668	    DOMAINOS && NOKMEM
3667181834Srobertodnl	1000000L/hz	500/HZ	    other && NOKMEM
3668181834Srobertodnl	txc.tick	1	    Linux
3669181834Srobertodnl	(every / 10)	50	    WinNT - tickadj is roughly 500/hz
3670181834Srobertodnl	1000000L/hz	(nlist)     (Solaris && !ADJTIME_IS_ACCURATE),
3671181834Srobertodnl				    (RS6000 && !NOKMEM), SINIX MIPS
3672181834Sroberto
3673181834Srobertodnl But we'll only use these "values" if we can't find anything else.
3674181834Sroberto
3675200576SrobertoAC_MSG_CHECKING([for a default value for 'tick'])
3676200576Sroberto
3677200576Sroberto# target-dependent default for tick
3678200576Sroberto
3679200576Srobertocase "$host" in
3680200576Sroberto *-*-pc-cygwin*)
3681200576Sroberto    AC_MSG_ERROR([tick needs work for cygwin])
3682200576Sroberto    ;;
3683200576Sroberto *-univel-sysv*)
3684200576Sroberto    ans=10000
3685200576Sroberto    ;;
3686200576Sroberto *-*-irix*)
3687200576Sroberto    ans=10000
3688200576Sroberto    ;;
3689200576Sroberto *-*-*linux*)
3690200576Sroberto    ans=txc.tick
3691200576Sroberto    ;;
3692200576Sroberto *-*-mpeix*)
3693200576Sroberto    ans=no
3694200576Sroberto    ;;
3695200576Sroberto *-*-winnt3.5)
3696200576Sroberto    ans='(every / 10)'
3697200576Sroberto    ;;
3698200576Sroberto *-*-unicosmp*)
3699200576Sroberto    ans=10000
3700200576Sroberto    ;;
3701200576Sroberto *)
3702200576Sroberto    ans='1000000L/hz'
3703200576Sroberto    ;;
3704200576Srobertoesac
3705200576Sroberto
3706200576SrobertoAC_ARG_ENABLE(
3707200576Sroberto    [tick],
3708200576Sroberto    AC_HELP_STRING(
3709200576Sroberto	[--enable-tick=VALUE],
3710200576Sroberto	[s force a value for 'tick']
3711200576Sroberto    ),
3712200576Sroberto    [ans=$enableval]
3713200576Sroberto)
3714200576Sroberto
3715200576SrobertoAC_MSG_RESULT([$ans])
3716200576Sroberto
3717200576Srobertocase "$ans" in
3718181834Sroberto ''|no) ;;	# HMS: I think we can only get 'no' here...
3719200576Sroberto *) AC_DEFINE_UNQUOTED(PRESET_TICK, [$ans], [Preset a value for 'tick'?]) ;;
3720181834Srobertoesac
3721181834Sroberto
3722200576Sroberto
3723200576SrobertoAC_MSG_CHECKING([for a default value for 'tickadj'])
3724200576Sroberto
3725200576Sroberto# target-specific default
3726200576Sroberto
3727200576Srobertoans='500/hz'
3728200576Sroberto
3729200576Srobertocase "$host" in
3730200576Sroberto *-fujitsu-uxp*)
3731200576Sroberto    case "$adjtime_is_accurate" in
3732200576Sroberto     yes)
3733200576Sroberto         ans='tick/16'
3734200576Sroberto    esac
3735200576Sroberto    ;;
3736200576Sroberto XXX-*-pc-cygwin*)
3737200576Sroberto    ans=no
3738200576Sroberto    ;;
3739200576Sroberto *-univel-sysv*)
3740200576Sroberto    ans=80
3741200576Sroberto    ;;
3742200576Sroberto *-*-aix*)
3743200576Sroberto    case "$can_kmem" in
3744200576Sroberto     no)
3745200576Sroberto	ans=1000
3746200576Sroberto    esac
3747200576Sroberto    ;;
3748200576Sroberto *-*-domainos)	# Skippy: won't be found...
3749200576Sroberto    case "$can_kmem" in
3750200576Sroberto     no)
3751200576Sroberto	ans=668
3752200576Sroberto    esac
3753200576Sroberto    ;;
3754200576Sroberto *-*-hpux*)
3755200576Sroberto    case "$adjtime_is_accurate" in
3756200576Sroberto     yes)
3757200576Sroberto	ans='tick/16'
3758200576Sroberto    esac
3759200576Sroberto    ;;
3760200576Sroberto *-*-irix*)
3761200576Sroberto    ans=150
3762200576Sroberto    ;;
3763200576Sroberto *-*-mpeix*)
3764200576Sroberto    ans=no
3765200576Sroberto    ;;
3766200576Sroberto *-*-sco3.2v5.0*)
3767200576Sroberto    ans=10000L/hz
3768200576Sroberto    ;;
3769200576Sroberto *-*-winnt3.5)
3770200576Sroberto    ans=50
3771200576Sroberto    ;;
3772200576Sroberto *-*-unicosmp*)
3773200576Sroberto    ans=150
3774200576Srobertoesac
3775200576Sroberto
3776200576SrobertoAC_ARG_ENABLE(
3777200576Sroberto    [tickadj],
3778200576Sroberto    AC_HELP_STRING(
3779200576Sroberto        [--enable-tickadj=VALUE],
3780200576Sroberto        [s force a value for 'tickadj']
3781200576Sroberto    ),
3782200576Sroberto    [ans=$enableval]
3783200576Sroberto)
3784200576Sroberto
3785200576SrobertoAC_MSG_RESULT([$ans])
3786200576Sroberto
3787200576Srobertodefault_tickadj=$ans
3788200576Sroberto
3789200576Srobertocase "$default_tickadj" in
3790181834Sroberto ''|no) ;;	# HMS: I think we can only get 'no' here...
3791200576Sroberto *) AC_DEFINE_UNQUOTED(PRESET_TICKADJ, $default_tickadj, [Preset a value for 'tickadj'?]) ;;
3792181834Srobertoesac
3793181834Sroberto
3794181834Sroberto# Newer versions of ReliantUNIX round adjtime() values down to
3795181834Sroberto# 1/100s (system tick). Sigh ...
3796181834Sroberto# Unfortunately, there is no easy way to know if particular release
3797181834Sroberto# has this "feature" or any obvious way to test for it.
3798181834Srobertocase "$host" in
3799181834Sroberto mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX_CLOCK, 1, [Do we want the ReliantUNIX clock hacks?]) ;;
3800181834Srobertoesac
3801181834Sroberto
3802181834Srobertocase "$host" in
3803181834Sroberto *-*-sco3.2v5*) AC_DEFINE(SCO5_CLOCK, 1, [Do we want the SCO clock hacks?]) ;;
3804181834Srobertoesac
3805181834Sroberto
3806181834Srobertoac_cv_make_tickadj=yes
3807200576Srobertocase "$can_kmem$ac_cv_var_tick$default_tickadj" in
3808181834Sroberto nonono)	# Don't read KMEM, no presets.  Bogus.
3809200576Sroberto    AC_MSG_WARN([Can't read kmem, no PRESET_TICK or PRESET_TICKADJ.  No tickadj.])
3810181834Sroberto    ac_cv_make_tickadj=no
3811181834Sroberto    ;;
3812181834Sroberto nono*)		# Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3813200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICK.  No tickadj.])
3814181834Sroberto    ac_cv_make_tickadj=no
3815181834Sroberto    ;;
3816181834Sroberto no*no)		# Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Bogus.
3817200576Sroberto    AC_MSG_WARN([Can't read kmem but no PRESET_TICKADJ.  No tickadj.])
3818181834Sroberto    ac_cv_make_tickadj=no
3819181834Sroberto    ;;
3820181834Sroberto no*)		# Don't read KMEM, PRESET_TICK and PRESET_TICKADJ.  Cool.
3821181834Sroberto    ;;
3822181834Sroberto yesnono)	# Read KMEM, no presets.  Cool.
3823181834Sroberto    ;;
3824181834Sroberto yesno*)	# Read KMEM, no PRESET_TICK but PRESET_TICKADJ.  Bogus.
3825200576Sroberto    AC_MSG_WARN([PRESET_TICKADJ is defined but not PRESET_TICK.  Please report this.])
3826181834Sroberto    ;;
3827181834Sroberto yes*no)	# Read KMEM, PRESET_TICK but no PRESET_TICKADJ.  Cool.
3828181834Sroberto    ;;
3829181834Sroberto yes*)		# READ KMEM, PRESET_TICK and PRESET_TICKADJ.
3830181834Sroberto    ;;
3831181834Sroberto *)		# Generally bogus.
3832200576Sroberto    AC_MSG_ERROR([This shouldn't happen.])
3833181834Sroberto    ;;
3834181834Srobertoesac
3835181834Sroberto
3836181834SrobertoAC_SUBST(MAKE_NTPTIME)
3837200576SrobertoAC_CACHE_CHECK([if we want and can make the ntptime utility], ac_cv_make_ntptime,
3838181834Sroberto[case "$host" in
3839181834Sroberto *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in
3840181834Sroberto     yesyes)
3841181834Sroberto	ans=yes
3842181834Sroberto	;;
3843181834Sroberto     *)
3844181834Sroberto	ans=no
3845181834Sroberto	;;
3846181834Sroberto    esac
3847181834Sroberto    ;;
3848181834Srobertoesac
3849181834Srobertoac_cv_make_ntptime=$ans])
3850181834Srobertocase "$ac_cv_make_ntptime" in
3851181834Sroberto yes)
3852181834Sroberto    MAKE_NTPTIME=ntptime
3853181834Sroberto    ;;
3854181834Srobertoesac
3855181834Sroberto
3856181834SrobertoAC_SUBST(MAKE_TICKADJ)
3857181834Srobertocase "$host" in
3858181834Sroberto mips-sni-sysv4*)
3859181834Sroberto    # tickadj is pretty useless on newer versions of ReliantUNIX
3860181834Sroberto    # Do not bother
3861181834Sroberto    ac_cv_make_tickadj=no
3862181834Sroberto    ;;
3863181834Sroberto *-*-irix*)
3864181834Sroberto    ac_cv_make_tickadj=no
3865181834Sroberto    ;;
3866181834Sroberto *-*-solaris2*)
3867181834Sroberto    # DLM says tickadj is a no-no starting with solaris2.5
3868181834Sroberto    case "$host" in
3869181834Sroberto     *-*-solaris2.1[[0-9]]*)
3870181834Sroberto	ac_cv_make_tickadj=no
3871181834Sroberto	;;
3872181834Sroberto     *-*-solaris2.[[0-4]]*) ;;
3873181834Sroberto     *) ac_cv_make_tickadj=no ;;
3874181834Sroberto    esac
3875181834Sroberto    ;;
3876181834Sroberto *-*-unicosmp*)
3877181834Sroberto    ac_cv_make_tickadj=no
3878181834Sroberto    ;;
3879181834Srobertoesac
3880200576Sroberto
3881200576Sroberto#
3882200576Sroberto# Despite all the above, we always make tickadj.  Setting
3883200576Sroberto# ac_cv_make_tickadj before AC_CACHE_CHECK will cause a false
3884200576Sroberto# report that the configuration variable was cached.  It may
3885200576Sroberto# be better to simply remove the hunk above, I did not want
3886200576Sroberto# to remove it if there is hope it will be used again.
3887200576Sroberto#
3888200576Srobertounset ac_cv_make_tickadj
3889200576Sroberto
3890200576SrobertoAC_CACHE_CHECK([if we want and can make the tickadj utility], ac_cv_make_tickadj,
3891181834Srobertoac_cv_make_tickadj=yes)
3892181834Srobertocase "$ac_cv_make_tickadj" in
3893181834Sroberto yes)
3894181834Sroberto    MAKE_TICKADJ=tickadj
3895181834Sroberto    ;;
3896181834Srobertoesac
3897181834Sroberto
3898181834SrobertoAC_SUBST(MAKE_TIMETRIM)
3899200576SrobertoAC_CACHE_CHECK([if we want and can make the timetrim utility], ac_cv_make_timetrim,
3900181834Sroberto[case "$host" in
3901181834Sroberto *-*-irix*)
3902181834Sroberto    ac_cv_make_timetrim=yes
3903181834Sroberto    ;;
3904181834Sroberto *-*-unicosmp*)
3905181834Sroberto    ac_cv_make_timetrim=yes
3906181834Sroberto    ;;
3907181834Sroberto *)
3908181834Sroberto    ac_cv_make_timetrim=no
3909181834Sroberto    ;;
3910181834Srobertoesac])
3911181834Srobertocase "$ac_cv_make_timetrim" in
3912181834Sroberto yes)
3913181834Sroberto    MAKE_TIMETRIM=timetrim
3914181834Sroberto    ;;
3915181834Srobertoesac
3916181834Sroberto
3917181834SrobertoAC_SUBST(MAKE_LIBNTPSIM)
3918181834SrobertoAC_SUBST(MAKE_NTPDSIM)
3919200576Sroberto
3920200576SrobertoAC_MSG_CHECKING([if we want to build the NTPD simulator])
3921200576Sroberto
3922200576SrobertoAC_ARG_ENABLE(
3923200576Sroberto    [simulator],
3924200576Sroberto    AC_HELP_STRING(
3925200576Sroberto	[--enable-simulator],
3926200576Sroberto	[- build/install the NTPD simulator?]
3927200576Sroberto    ),
3928200576Sroberto    [ans=$enableval], 
3929200576Sroberto    [ans=no]
3930200576Sroberto)
3931200576Sroberto
3932200576SrobertoAC_MSG_RESULT([$ans])
3933200576Sroberto
3934200576Srobertocase "$ans" in
3935181834Sroberto yes)
3936181834Sroberto    MAKE_NTPDSIM=ntpdsim
3937181834Sroberto    MAKE_LIBNTPSIM=libntpsim.a
3938181834Sroberto    ;;
3939181834Srobertoesac
3940181834Sroberto
3941181834Srobertocase "$build" in
3942181834Sroberto $host)
3943181834Sroberto    ;;
3944181834Sroberto *) case "$host" in
3945181834Sroberto     *-*-vxworks*)
3946200576Sroberto	LDFLAGS="$LDFLAGS -r"
3947200576Sroberto	;;
3948181834Sroberto    esac
3949181834Sroberto    ;;
3950181834Srobertoesac
3951181834Sroberto
3952200576Sroberto
3953200576SrobertoAC_MSG_CHECKING([if we should always slew the time])
3954200576Sroberto
3955200576Sroberto# target-specific defaults
3956200576Sroberto
3957200576Srobertocase "$host" in
3958200576Sroberto *-apple-aux[[23]]*)
3959200576Sroberto    ans=yes
3960200576Sroberto    ;;
3961200576Sroberto *-*-bsdi[[012]]*)
3962200576Sroberto    ans=no
3963200576Sroberto    ;;
3964200576Sroberto *-*-bsdi*)
3965200576Sroberto    ans=yes
3966200576Sroberto    ;;
3967200576Sroberto *-*-openvms*)	# HMS: won't be found
3968200576Sroberto    ans=yes
3969200576Sroberto    ;;
3970200576Sroberto *) ans=no
3971200576Sroberto    ;;
3972200576Srobertoesac
3973200576Sroberto
3974200576Sroberto# --enable-slew-always / --disable-slew-always overrides default
3975200576Sroberto
3976200576SrobertoAC_ARG_ENABLE(
3977200576Sroberto    [slew-always],
3978200576Sroberto    AC_HELP_STRING(
3979200576Sroberto	[--enable-slew-always],
3980200576Sroberto	[s always slew the time]
3981200576Sroberto    ),
3982200576Sroberto    [ans=$enableval]
3983200576Sroberto)
3984200576Sroberto
3985200576SrobertoAC_MSG_RESULT([$ans])
3986200576Sroberto
3987200576Srobertocase "$ans" in
3988181834Sroberto yes) AC_DEFINE(SLEWALWAYS, 1, [Slew always?]) ;;
3989181834Srobertoesac
3990181834Sroberto
3991200576SrobertoAC_MSG_CHECKING([if we should step and slew the time])
3992200576Sroberto
3993200576Srobertocase "$host" in
3994200576Sroberto *-sni-sysv*)
3995200576Sroberto    ans=yes
3996200576Sroberto    ;;
3997200576Sroberto *-univel-sysv*)
3998200576Sroberto    ans=no
3999200576Sroberto    ;;
4000200576Sroberto *-*-ptx*)
4001200576Sroberto    ans=yes
4002200576Sroberto    ;;
4003200576Sroberto *-*-solaris2.1[[0-9]]*)
4004200576Sroberto    ans=no
4005200576Sroberto    ;;
4006200576Sroberto *-*-solaris2.[[012]]*)
4007200576Sroberto    ans=yes
4008200576Sroberto    ;;
4009200576Sroberto *-*-sysv4*)	# HMS: Does this catch Fujitsu UXP?
4010200576Sroberto    ans=yes
4011200576Sroberto    ;;
4012200576Sroberto *) ans=no
4013200576Sroberto    ;;
4014200576Srobertoesac
4015200576Sroberto
4016200576Sroberto
4017200576SrobertoAC_ARG_ENABLE(
4018200576Sroberto    [step-slew],
4019200576Sroberto    AC_HELP_STRING(
4020200576Sroberto	[--enable-step-slew],
4021200576Sroberto	[s step and slew the time]
4022200576Sroberto    ),
4023200576Sroberto    [ans=$enableval]
4024200576Sroberto)
4025200576Sroberto
4026200576SrobertoAC_MSG_RESULT([$ans])
4027200576Sroberto
4028200576Srobertocase "$ans" in
4029181834Sroberto yes) AC_DEFINE(STEP_SLEW, 1, [Step, then slew the clock?]) ;;
4030181834Srobertoesac
4031181834Sroberto
4032200576SrobertoAC_MSG_CHECKING([if ntpdate should step the time])
4033200576Sroberto
4034200576Srobertocase "$host" in
4035200576Sroberto *-apple-aux[[23]]*)
4036200576Sroberto    ans=yes
4037200576Sroberto    ;;
4038200576Sroberto *) ans=no
4039200576Srobertoesac
4040200576Sroberto
4041200576SrobertoAC_ARG_ENABLE(
4042200576Sroberto    [ntpdate-step],
4043200576Sroberto    AC_HELP_STRING(
4044200576Sroberto	[--enable-ntpdate-step],
4045200576Sroberto	[s if ntpdate should step the time]
4046200576Sroberto    ),
4047200576Sroberto    [ans=$enableval]
4048200576Sroberto)
4049200576Sroberto
4050200576SrobertoAC_MSG_RESULT([$ans])
4051200576Sroberto
4052200576Srobertocase "$ans" in
4053181834Sroberto yes) AC_DEFINE(FORCE_NTPDATE_STEP, 1, [force ntpdate to step the clock if !defined(STEP_SLEW) ?]) ;;
4054181834Srobertoesac
4055181834Sroberto
4056200576Sroberto
4057200576SrobertoAC_MSG_CHECKING([if we should sync TODR clock every hour])
4058200576Sroberto
4059200576Srobertocase "$host" in
4060200576Sroberto *-*-nextstep*)
4061200576Sroberto    ans=yes
4062200576Sroberto    ;;
4063200576Sroberto *-*-openvms*)	# HMS: won't be found
4064200576Sroberto    ans=yes
4065200576Sroberto    ;;
4066200576Sroberto *)
4067200576Sroberto    ans=no
4068200576Srobertoesac
4069200576Sroberto
4070200576SrobertoAC_ARG_ENABLE(
4071200576Sroberto    [hourly-todr-sync],
4072200576Sroberto    AC_HELP_STRING(
4073200576Sroberto	[--enable-hourly-todr-sync],
4074200576Sroberto	[s if we should sync TODR hourly]
4075200576Sroberto    ),
4076200576Sroberto    [ans=$enableval]
4077200576Sroberto)
4078200576Sroberto
4079200576SrobertoAC_MSG_RESULT([$ans])
4080200576Sroberto
4081181834Srobertocase "$ac_cv_var_sync_todr" in
4082181834Sroberto yes) AC_DEFINE(DOSYNCTODR, 1, [synch TODR hourly?]) ;;
4083181834Srobertoesac
4084181834Sroberto
4085181834Sroberto
4086200576SrobertoAC_MSG_CHECKING([if we should avoid kernel FLL bug])
4087200576Sroberto
4088200576Srobertocase "$host" in
4089200576Sroberto *-*-solaris2.6)
4090200576Sroberto    unamev=`uname -v`
4091200576Sroberto    case "$unamev" in
4092200576Sroberto     Generic_105181-*)
4093200576Sroberto	old_IFS="$IFS"
4094200576Sroberto	IFS="-"
4095200576Sroberto	set $unamev
4096200576Sroberto	IFS="$old_IFS"
4097200576Sroberto	if test "$2" -ge 17
4098200576Sroberto	then
4099200576Sroberto	    # Generic_105181-17 and higher
4100200576Sroberto	    ans=no
4101200576Sroberto	else
4102200576Sroberto	    ans=yes
4103200576Sroberto	fi
4104200576Sroberto	;;
4105200576Sroberto     *) 
4106181834Sroberto	ans=yes
4107200576Sroberto    esac
4108200576Sroberto    ;;
4109200576Sroberto *-*-solaris2.7)
4110200576Sroberto    unamev=`uname -v`
4111200576Sroberto    case "$unamev" in
4112200576Sroberto     Generic_106541-*)
4113200576Sroberto	old_IFS="$IFS"
4114200576Sroberto	IFS="-"
4115200576Sroberto	set $unamev
4116200576Sroberto	IFS="$old_IFS"
4117200576Sroberto	if test "$2" -ge 07
4118200576Sroberto	then
4119200576Sroberto	    # Generic_106541-07 and higher
4120200576Sroberto	    ans=no
4121200576Sroberto	else
4122200576Sroberto	    ans=yes
4123200576Sroberto	fi
4124181834Sroberto	;;
4125200576Sroberto     *)
4126181834Sroberto	ans=yes
4127181834Sroberto    esac
4128200576Sroberto    ;;
4129200576Sroberto *)
4130200576Sroberto    ans=no
4131200576Srobertoesac
4132200576Sroberto
4133200576SrobertoAC_ARG_ENABLE(
4134200576Sroberto    [kernel-fll-bug],
4135200576Sroberto    AC_HELP_STRING(
4136200576Sroberto	[--enable-kernel-fll-bug],
4137200576Sroberto	[s if we should avoid a kernel FLL bug]
4138200576Sroberto    ),
4139200576Sroberto    [ans=$enableval]
4140200576Sroberto)
4141200576Sroberto
4142200576SrobertoAC_MSG_RESULT([$ans])
4143200576Sroberto
4144200576Srobertocase "$ans" in
4145200576Sroberto yes) AC_DEFINE(KERNEL_FLL_BUG, 1, [Does the kernel have an FLL bug?]) ;;
4146200576Srobertoesac
4147200576Sroberto
4148200576Sroberto
4149200576SrobertoAC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
4150200576Sroberto
4151200576Srobertocase "$host" in
4152200576Sroberto *-*-solaris2.[[89]])
4153200576Sroberto    ans=yes
4154200576Sroberto    ;;
4155200576Sroberto *-*-solaris2.1[[0-9]]*)
4156200576Sroberto    ans=yes
4157200576Sroberto    ;;
4158200576Sroberto *) ans=no
4159200576Srobertoesac
4160200576Sroberto
4161200576SrobertoAC_ARG_ENABLE(
4162200576Sroberto    [irig-sawtooth], 
4163200576Sroberto    AC_HELP_STRING(
4164200576Sroberto	[--enable-irig-sawtooth],
4165200576Sroberto	[s if we should enable the IRIG sawtooth filter]
4166200576Sroberto    ),
4167200576Sroberto    [ans=$enableval]
4168200576Sroberto)
4169200576Sroberto
4170200576SrobertoAC_MSG_RESULT([$ans])
4171200576Sroberto
4172200576Srobertocase "$ans" in
4173181834Sroberto yes) AC_DEFINE(IRIG_SUCKS, 1, [Should we use the IRIG sawtooth filter?]) ;;
4174181834Srobertoesac
4175181834Sroberto
4176200576Sroberto
4177200576SrobertoAC_MSG_CHECKING([if we should enable NIST lockclock scheme])
4178200576Sroberto
4179200576SrobertoAC_ARG_ENABLE(
4180200576Sroberto	[nist], 
4181200576Sroberto	AC_HELP_STRING(
4182200576Sroberto	    [--enable-nist],
4183200576Sroberto	    [- if we should enable the NIST lockclock scheme]
4184200576Sroberto	),
4185200576Sroberto	[ans=$enableval],
4186200576Sroberto	[ans=no]
4187200576Sroberto)
4188200576Sroberto
4189200576SrobertoAC_MSG_RESULT([$ans])
4190200576Sroberto
4191200576Srobertocase "$ans" in
4192181834Sroberto yes) AC_DEFINE(LOCKCLOCK, 1, [Should we align with the NIST lockclock scheme?]) ;;
4193181834Srobertoesac
4194181834Sroberto
4195200576Sroberto
4196200576SrobertoAC_MSG_CHECKING([if we want support for Samba's signing daemon])
4197200576Sroberto
4198200576SrobertoAC_ARG_ENABLE(
4199200576Sroberto    [ntp-signd],
4200200576Sroberto    AC_HELP_STRING(
4201200576Sroberto        [--enable-ntp-signd],
4202200576Sroberto        [- Provide support for Samba's signing daemon, =/var/run/ntp_signd]
4203200576Sroberto    ),
4204200576Sroberto    [ans=$enableval],
4205200576Sroberto    [ans=no]
4206200576Sroberto)
4207200576Sroberto
4208200576SrobertoAC_MSG_RESULT([$ans])
4209200576Sroberto
4210200576Srobertocase "$ans" in
4211200576Sroberto no)
4212200576Sroberto    ntp_signd_path=
4213200576Sroberto    ;;
4214200576Sroberto yes)
4215200576Sroberto    ntp_signd_path=/var/run/ntp_signd
4216200576Sroberto    ;;
4217200576Sroberto *)
4218200576Sroberto    ntp_signd_path="$ans"
4219200576Srobertoesac
4220200576Sroberto
4221200576Srobertocase "$ntp_signd_path" in
4222200576Sroberto '')
4223200576Sroberto    wintime_default=no
4224200576Sroberto    ;;
4225200576Sroberto *)
4226200576Sroberto    wintime_default=yes
4227200576Sroberto    AC_DEFINE(HAVE_NTP_SIGND, ,[Do we want support for Samba's signing daemon?])
4228200576Sroberto    AC_DEFINE_UNQUOTED(NTP_SIGND_PATH, "$ntp_signd_path", [Path to sign daemon rendezvous socket])
4229200576Srobertoesac
4230200576Sroberto
4231200576Sroberto
4232200576SrobertoAC_MSG_CHECKING([if we want the windows symmetric client hack])
4233200576Sroberto
4234200576Sroberto# default is no, unless --enable-ntp-signd was given
4235200576Srobertoans=$wintime_default
4236200576Srobertounset wintime_default
4237200576Sroberto
4238200576SrobertoAC_ARG_ENABLE(
4239200576Sroberto    [wintime],
4240200576Sroberto    AC_HELP_STRING(
4241200576Sroberto        [--enable-wintime],
4242200576Sroberto        [- Provide the windows symmetric client hack]
4243200576Sroberto    ),
4244200576Sroberto    [ans=$enableval],
4245200576Sroberto)
4246200576Sroberto
4247200576SrobertoAC_MSG_RESULT([$ans])
4248200576Sroberto
4249200576Srobertocase "$ans" in
4250200576Sroberto yes)
4251200576Sroberto    AC_DEFINE(WINTIME, ,[Do we want the windows symmetric client hack?])
4252200576Srobertoesac
4253200576Sroberto
4254200576Sroberto
4255200576SrobertoAC_CHECK_HEADERS(sys/clockctl.h)
4256200576Sroberto
4257200576Srobertocase "$host" in
4258200576Sroberto *-*-netbsd*)
4259200576Sroberto    ans=yes
4260200576Sroberto    ;;
4261200576Sroberto *) ans=no
4262200576Sroberto    ;;
4263200576Srobertoesac
4264200576Sroberto
4265200576SrobertoAC_ARG_ENABLE(
4266200576Sroberto    [clockctl],
4267200576Sroberto    AC_HELP_STRING(
4268200576Sroberto	[--enable-clockctl],
4269200576Sroberto	[s Use /dev/clockctl for non-root clock control]
4270200576Sroberto    ),
4271200576Sroberto    [ntp_use_dev_clockctl=$enableval],
4272200576Sroberto    [ntp_use_dev_clockctl=$ac_cv_header_sys_clockctl_h]
4273200576Sroberto)
4274200576Sroberto
4275200576SrobertoAC_MSG_CHECKING([[if we should use /dev/clockctl]])
4276200576SrobertoAC_MSG_RESULT([$ntp_use_dev_clockctl])
4277200576Sroberto
4278200576Sroberto
4279200576SrobertoAC_CHECK_HEADERS([sys/capability.h])
4280200576SrobertoAC_CHECK_HEADERS([sys/prctl.h])
4281200576Sroberto
4282200576SrobertoAC_MSG_CHECKING([[if we have linux capabilities (libcap)]])
4283200576Sroberto
4284200576Srobertocase "$ac_cv_header_sys_capability_h$ac_cv_header_sys_prctl_h" in
4285200576Sroberto yesyes)
4286200576Sroberto    ntp_have_linuxcaps=yes
4287200576Sroberto    ;;
4288200576Sroberto *)
4289200576Sroberto    ntp_have_linuxcaps=no
4290200576Srobertoesac
4291200576Sroberto
4292200576SrobertoAC_MSG_RESULT([$ntp_have_linuxcaps])
4293200576Sroberto
4294200576Sroberto
4295200576SrobertoAC_ARG_ENABLE(
4296200576Sroberto    [linuxcaps],
4297200576Sroberto    AC_HELP_STRING(
4298200576Sroberto	[--enable-linuxcaps],
4299200576Sroberto	[+ Use Linux capabilities for non-root clock control]
4300200576Sroberto    ),
4301200576Sroberto    [ntp_have_linuxcaps=$enableval]
4302200576Sroberto)
4303200576Sroberto
4304200576Sroberto
4305200576Srobertocase "$ntp_have_linuxcaps" in
4306200576Sroberto yes)
4307200576Sroberto    AC_DEFINE(HAVE_LINUX_CAPABILITIES, ,[[Do we have Linux capabilities?]])
4308200576Sroberto    LIBS="$LIBS -lcap"
4309200576Srobertoesac
4310200576Sroberto
4311200576Sroberto
4312200576Srobertocase "$ntp_use_dev_clockctl$ntp_have_linuxcaps" in
4313200576Sroberto *yes*)
4314200576Sroberto    AC_DEFINE(HAVE_DROPROOT, ,[[Can we drop root privileges?]])
4315200576Srobertoesac
4316200576Sroberto
4317200576Sroberto
4318200576SrobertoAC_CHECK_HEADERS([libscf.h])
4319200576Sroberto
4320200576Srobertocase "$ac_cv_header_libscf_h" in
4321200576Sroberto yes)
4322200576Sroberto    AC_SUBST(LSCF, [-lscf])
4323200576Srobertoesac
4324200576Sroberto
4325200576SrobertoAC_CHECK_FUNC(
4326200576Sroberto    [setppriv],
4327200576Sroberto    AC_DEFINE(HAVE_SOLARIS_PRIVS, ,[[Are Solaris privileges available?]])
4328200576Sroberto)
4329200576Sroberto
4330200576Sroberto
4331181834Sroberto#
4332181834Sroberto# ISC stuff
4333181834Sroberto#
4334181834Sroberto
4335181834Srobertoif test $ac_cv_struct_sockaddr_has_sa_len = yes; then
4336181834Sroberto    AC_DEFINE(ISC_PLATFORM_HAVESALEN, ,[ISC: struct sockaddr as sa_len?])
4337181834Srobertofi
4338181834Sroberto
4339181834SrobertoAC_ARG_ENABLE(ipv6, AC_HELP_STRING([--enable-ipv6], [s use IPv6?]))
4340181834Sroberto
4341181834Srobertocase "$enable_ipv6" in
4342181834Sroberto yes|''|autodetect)
4343181834Sroberto    case "$host" in
4344181834Sroberto     powerpc-ibm-aix4*) ;;
4345181834Sroberto     *)
4346200576Sroberto	AC_DEFINE(WANT_IPV6, ,[configure --enable-ipv6])
4347181834Sroberto	;;
4348181834Sroberto    esac
4349181834Sroberto    ;;
4350181834Sroberto no)
4351181834Sroberto    ;;
4352181834Srobertoesac
4353181834Sroberto
4354181834Sroberto
4355200576SrobertoAC_CACHE_CHECK(
4356200576Sroberto    [for IPv6 structures],
4357200576Sroberto    ac_cv_isc_found_ipv6,
4358200576Sroberto    [
4359200576Sroberto	AC_COMPILE_IFELSE(
4360200576Sroberto	    [
4361200576Sroberto		AC_LANG_PROGRAM(
4362200576Sroberto		    [
4363200576Sroberto			#include <sys/types.h>
4364200576Sroberto			#include <sys/socket.h>
4365200576Sroberto			#include <netinet/in.h>
4366200576Sroberto		    ],
4367200576Sroberto		    [
4368200576Sroberto			struct sockaddr_in6 sin6;
4369200576Sroberto		    ]
4370200576Sroberto		)
4371200576Sroberto	    ],
4372200576Sroberto	    [ac_cv_isc_found_ipv6=yes],
4373200576Sroberto	    [ac_cv_isc_found_ipv6=no]
4374200576Sroberto	)
4375200576Sroberto    ]
4376200576Sroberto)
4377200576Sroberto
4378181834Sroberto#
4379181834Sroberto# See whether IPv6 support is provided via a Kame add-on.
4380181834Sroberto# This is done before other IPv6 linking tests so LIBS is properly set.
4381181834Sroberto#
4382200576SrobertoAC_MSG_CHECKING([for Kame IPv6 support])
4383181834SrobertoAC_ARG_WITH(kame,
4384200576Sroberto	[AC_HELP_STRING([--with-kame], [- =/usr/local/v6])],
4385181834Sroberto	use_kame="$withval", use_kame="no")
4386181834Sroberto
4387181834Srobertocase "$use_kame" in
4388200576Sroberto no)
4389200576Sroberto    ;;
4390200576Sroberto yes)
4391200576Sroberto    kame_path=/usr/local/v6
4392200576Sroberto    ;;
4393200576Sroberto *)
4394200576Sroberto    kame_path="$use_kame"
4395200576Sroberto    ;;
4396181834Srobertoesac
4397181834Sroberto
4398181834Srobertocase "$use_kame" in
4399200576Sroberto no)
4400200576Sroberto    AC_MSG_RESULT(no)
4401200576Sroberto    ;;
4402200576Sroberto *)
4403200576Sroberto    if test -f $kame_path/lib/libinet6.a; then
4404200576Sroberto	AC_MSG_RESULT($kame_path/lib/libinet6.a)
4405200576Sroberto	LIBS="-L$kame_path/lib -linet6 $LIBS"
4406200576Sroberto    else
4407200576Sroberto	AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
4408181834Sroberto
4409181834SrobertoPlease choose the proper path with the following command:
4410181834Sroberto
4411181834Sroberto    configure --with-kame=PATH
4412181834Sroberto])
4413200576Sroberto    fi
4414200576Sroberto    ;;
4415181834Srobertoesac
4416181834Sroberto
4417181834Sroberto#
4418181834Sroberto# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
4419181834Sroberto# Including it on Kame-using platforms is very bad, though, because
4420181834Sroberto# Kame uses #error against direct inclusion.   So include it on only
4421181834Sroberto# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
4422181834Sroberto# This is done before the in6_pktinfo check because that's what
4423181834Sroberto# netinet6/in6.h is needed for.
4424181834Sroberto#
4425181834Srobertocase "$host" in
4426200576Sroberto *-bsdi4.[[01]]*)
4427200576Sroberto    AC_DEFINE(ISC_PLATFORM_NEEDNETINET6IN6H, 1, [Do we need netinet6/in6.h?])
4428200576Sroberto    isc_netinet6in6_hack="#include <netinet6/in6.h>"
4429200576Sroberto    ;;
4430200576Sroberto *)
4431200576Sroberto    isc_netinet6in6_hack=""
4432181834Srobertoesac
4433181834Sroberto
4434181834Sroberto#
4435181834Sroberto# This is similar to the netinet6/in6.h issue.
4436181834Sroberto#
4437181834Srobertocase "$host" in
4438200576Sroberto *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
4439200576Sroberto    AC_DEFINE(ISC_PLATFORM_FIXIN6ISADDR, 1,[Do we need to fix in6isaddr?])
4440200576Sroberto    isc_netinetin6_hack="#include <netinet/in6.h>"
4441200576Sroberto    ;;
4442200576Sroberto *)
4443200576Sroberto    isc_netinetin6_hack=""
4444181834Srobertoesac
4445181834Sroberto
4446181834Sroberto
4447200576Srobertocase "$ac_cv_isc_found_ipv6" in
4448200576Sroberto yes)
4449200576Sroberto    AC_DEFINE(ISC_PLATFORM_HAVEIPV6, ,[have IPv6?])
4450181834Sroberto
4451200576Sroberto    AC_CACHE_CHECK(
4452200576Sroberto	[for in6_pktinfo],
4453200576Sroberto	ac_cv_have_in6_pktinfo,
4454200576Sroberto	[
4455200576Sroberto	    AC_COMPILE_IFELSE(
4456200576Sroberto		[
4457200576Sroberto		    AC_LANG_PROGRAM(
4458200576Sroberto			[
4459200576Sroberto			    #include <sys/types.h>
4460200576Sroberto			    #include <sys/socket.h>
4461200576Sroberto			    #include <netinet/in.h>
4462200576Sroberto			    $isc_netinetin6_hack
4463200576Sroberto			    $isc_netinet6in6_hack
4464200576Sroberto			],
4465200576Sroberto			[
4466200576Sroberto			    struct in6_pktinfo xyzzy;
4467200576Sroberto			]
4468200576Sroberto		    )
4469200576Sroberto		],
4470200576Sroberto		[ac_cv_have_in6_pktinfo=yes],
4471200576Sroberto		[ac_cv_have_in6_pktinfo=no]
4472200576Sroberto	    )
4473200576Sroberto	]
4474200576Sroberto    )
4475181834Sroberto
4476200576Sroberto    case "$ac_cv_have_in6_pktinfo" in
4477200576Sroberto     yes)
4478200576Sroberto	AC_DEFINE(ISC_PLATFORM_HAVEIN6PKTINFO, , [have struct in6_pktinfo?])
4479200576Sroberto    esac
4480181834Sroberto
4481181834Sroberto
4482181834Sroberto    # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
4483200576Sroberto    AC_CACHE_CHECK(
4484200576Sroberto	[for sockaddr_in6.sin6_scope_id],
4485200576Sroberto	ac_cv_have_sin6_scope_id,
4486200576Sroberto	[
4487200576Sroberto	    AC_COMPILE_IFELSE(
4488200576Sroberto		[
4489200576Sroberto		    AC_LANG_PROGRAM(
4490200576Sroberto			[
4491200576Sroberto			    #include <sys/types.h>
4492200576Sroberto			    #include <sys/socket.h>
4493200576Sroberto			    #include <netinet/in.h>
4494200576Sroberto			    $isc_netinetin6_hack
4495200576Sroberto			    $isc_netinet6in6_hack
4496200576Sroberto			],
4497200576Sroberto			[
4498200576Sroberto			    struct sockaddr_in6 xyzzy;
4499200576Sroberto			    xyzzy.sin6_scope_id = 0;
4500200576Sroberto			]
4501200576Sroberto		    )
4502200576Sroberto		],
4503200576Sroberto		[ac_cv_have_sin6_scope_id=yes],
4504200576Sroberto		[ac_cv_have_sin6_scope_id=no]
4505200576Sroberto	    )
4506200576Sroberto	]
4507200576Sroberto    )
4508181834Sroberto
4509200576Sroberto    case "$ac_cv_have_sin6_scope_id" in
4510200576Sroberto     yes)
4511200576Sroberto	AC_DEFINE(ISC_PLATFORM_HAVESCOPEID, , [have sin6_scope_id?])
4512200576Sroberto    esac
4513181834Srobertoesac
4514181834Sroberto
4515200576Sroberto
4516200576Sroberto# We need this check run even without ac_cv_isc_found_ipv6=yes
4517200576Sroberto
4518200576SrobertoAC_CACHE_CHECK(
4519200576Sroberto    [for in6addr_any],
4520200576Sroberto    ac_cv_have_in6addr_any,
4521200576Sroberto    [
4522200576Sroberto	AC_COMPILE_IFELSE(
4523200576Sroberto	    [
4524200576Sroberto		AC_LANG_PROGRAM(
4525200576Sroberto		    [
4526200576Sroberto			#include <sys/types.h>
4527200576Sroberto			#include <sys/socket.h>
4528200576Sroberto			#include <netinet/in.h>
4529200576Sroberto			$isc_netinetin6_hack
4530200576Sroberto			$isc_netinet6in6_hack
4531200576Sroberto		    ],
4532200576Sroberto		    [
4533200576Sroberto			struct in6_addr in6; 
4534200576Sroberto			in6 = in6addr_any;
4535200576Sroberto		    ]
4536200576Sroberto		)
4537200576Sroberto	    ],
4538200576Sroberto	    [ac_cv_have_in6addr_any=yes],
4539200576Sroberto	    [ac_cv_have_in6addr_any=no]
4540200576Sroberto	)
4541200576Sroberto    ]
4542181834Sroberto)
4543181834Sroberto
4544200576Srobertocase "$ac_cv_have_in6addr_any" in
4545200576Sroberto no)
4546200576Sroberto    AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, , [missing in6addr_any?])
4547200576Srobertoesac
4548200576Sroberto
4549200576Sroberto
4550200576SrobertoAC_CACHE_CHECK(
4551200576Sroberto    [for struct if_laddrconf],
4552200576Sroberto    ac_cv_isc_struct_if_laddrconf,
4553200576Sroberto    [
4554200576Sroberto        AC_COMPILE_IFELSE(
4555200576Sroberto	    [
4556200576Sroberto		AC_LANG_PROGRAM(
4557200576Sroberto		    [
4558200576Sroberto			#include <sys/types.h>
4559200576Sroberto			#include <net/if6.h>
4560200576Sroberto		    ],
4561200576Sroberto		    [
4562200576Sroberto			struct if_laddrconf a;
4563200576Sroberto		    ]
4564200576Sroberto		)
4565200576Sroberto	    ],
4566200576Sroberto	    [ac_cv_isc_struct_if_laddrconf=yes],
4567200576Sroberto	    [ac_cv_isc_struct_if_laddrconf=no]
4568200576Sroberto	)
4569200576Sroberto    ]
4570200576Sroberto)
4571200576Sroberto
4572200576Srobertocase "$ac_cv_isc_struct_if_laddrconf" in
4573200576Sroberto yes)
4574200576Sroberto    AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRCONF, , [have struct if_laddrconf?])
4575200576Srobertoesac
4576200576Sroberto
4577200576SrobertoAC_CACHE_CHECK(
4578200576Sroberto    [for struct if_laddrreq],
4579200576Sroberto    ac_cv_isc_struct_if_laddrreq,
4580200576Sroberto    [
4581200576Sroberto        AC_COMPILE_IFELSE(
4582200576Sroberto	    [
4583200576Sroberto		AC_LANG_PROGRAM(
4584200576Sroberto		    [
4585200576Sroberto			#include <sys/types.h>
4586200576Sroberto			#include <net/if6.h>
4587200576Sroberto		    ],
4588200576Sroberto		    [
4589200576Sroberto			struct if_laddrreq a;
4590200576Sroberto		    ]
4591200576Sroberto		)
4592200576Sroberto	    ],
4593200576Sroberto	    [ac_cv_isc_struct_if_laddrreq=yes],
4594200576Sroberto	    [ac_cv_isc_struct_if_laddrreq=no]
4595200576Sroberto	)
4596200576Sroberto    ]
4597200576Sroberto)
4598200576Sroberto
4599200576Srobertocase "$ac_cv_isc_struct_if_laddrreq" in
4600200576Sroberto yes)
4601200576Sroberto    AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRREQ, , [have struct if_laddrreq?])
4602200576Srobertoesac
4603200576Sroberto
4604181834Sroberto#
4605181834Sroberto# Look for a sysctl call to get the list of network interfaces.
4606181834Sroberto#
4607200576SrobertoAC_CACHE_CHECK(
4608200576Sroberto    [for interface list sysctl],
4609200576Sroberto    ac_cv_iflist_sysctl,
4610200576Sroberto    AC_EGREP_CPP(
4611200576Sroberto	[found_rt_iflist], 
4612200576Sroberto	[
4613200576Sroberto	    #include <sys/param.h>
4614200576Sroberto	    #include <sys/sysctl.h>
4615200576Sroberto	    #include <sys/socket.h>
4616200576Sroberto	    #ifdef NET_RT_IFLIST  
4617200576Sroberto	    found_rt_iflist
4618200576Sroberto	    #endif
4619200576Sroberto	],
4620200576Sroberto	[ac_cv_iflist_sysctl=yes],
4621200576Sroberto	[ac_cv_iflist_sysctl=no]
4622200576Sroberto    )
4623200576Sroberto)
4624181834Sroberto
4625200576Srobertocase "$ac_cv_iflist_sysctl" in
4626200576Sroberto yes)
4627200576Sroberto    AC_DEFINE(HAVE_IFLIST_SYSCTL,1,[have iflist_sysctl?])
4628200576Srobertoesac
4629200576Sroberto
4630200576Sroberto
4631181834Sroberto###
4632181834Sroberto
4633181834SrobertoAC_DEFINE_DIR(NTP_KEYSDIR, sysconfdir, [Default location of crypto key info])
4634181834Sroberto
4635181834SrobertoAC_CONFIG_FILES(Makefile)
4636181834SrobertoAC_CONFIG_FILES(ElectricFence/Makefile)
4637181834SrobertoAC_CONFIG_FILES(adjtimed/Makefile)
4638181834SrobertoAC_CONFIG_FILES(clockstuff/Makefile)
4639181834SrobertoAC_CONFIG_FILES(include/Makefile)
4640181834SrobertoAC_CONFIG_FILES(include/isc/Makefile)
4641181834SrobertoAC_CONFIG_FILES(kernel/Makefile)
4642181834SrobertoAC_CONFIG_FILES(kernel/sys/Makefile)
4643181834SrobertoAC_CONFIG_FILES(libntp/Makefile)
4644181834SrobertoAC_CONFIG_FILES(libparse/Makefile)
4645181834SrobertoAC_CONFIG_FILES(ntpd/Makefile)
4646181834SrobertoAC_CONFIG_FILES(ntpdate/Makefile)
4647181834SrobertoAC_CONFIG_FILES(ntpdc/Makefile)
4648181834SrobertoAC_CONFIG_FILES(ntpdc/nl.pl,		[chmod +x ntpdc/nl.pl])
4649181834SrobertoAC_CONFIG_FILES(ntpq/Makefile)
4650181834SrobertoAC_CONFIG_FILES(parseutil/Makefile)
4651181834SrobertoAC_CONFIG_FILES(scripts/Makefile)
4652181834SrobertoAC_CONFIG_FILES(scripts/calc_tickadj,	[chmod +x scripts/calc_tickadj])
4653181834SrobertoAC_CONFIG_FILES(scripts/checktime,	[chmod +x scripts/checktime])
4654181834SrobertoAC_CONFIG_FILES(scripts/freq_adj,	[chmod +x scripts/freq_adj])
4655181834SrobertoAC_CONFIG_FILES(scripts/html2man,	[chmod +x scripts/html2man])
4656181834SrobertoAC_CONFIG_FILES(scripts/mkver,		[chmod +x scripts/mkver])
4657181834SrobertoAC_CONFIG_FILES(scripts/ntp-wait,	[chmod +x scripts/ntp-wait])
4658181834SrobertoAC_CONFIG_FILES(scripts/ntpsweep,	[chmod +x scripts/ntpsweep])
4659181834SrobertoAC_CONFIG_FILES(scripts/ntptrace,	[chmod +x scripts/ntptrace])
4660181834SrobertoAC_CONFIG_FILES(scripts/ntpver,		[chmod +x scripts/ntpver])
4661181834SrobertoAC_CONFIG_FILES(scripts/plot_summary,	[chmod +x scripts/plot_summary])
4662181834SrobertoAC_CONFIG_FILES(scripts/summary,	[chmod +x scripts/summary])
4663181834SrobertoAC_CONFIG_FILES(util/Makefile)
4664181834Sroberto
4665181834SrobertoAC_CONFIG_SUBDIRS(sntp)
4666181834Sroberto
4667181834SrobertoAC_OUTPUT
4668