PageRenderTime 68ms CodeModel.GetById 49ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/ntp/configure.ac

https://bitbucket.org/freebsd/freebsd-head/
m4 | 4667 lines | 3824 code | 400 blank | 443 comment | 0 complexity | 6632014c43722c45fffbcdf4bfaef288 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1dnl -*-fundamental-*-
   2dnl Process this file with autoconf to produce a configure script.
   3m4_include([version.m4])
   4AC_INIT(ntp, VERSION_NUMBER)
   5AM_INIT_AUTOMAKE
   6AC_CANONICAL_HOST
   7dnl the 'build' machine is where we run configure and compile
   8dnl the 'host' machine is where the resulting stuff runs.
   9AC_DEFINE_UNQUOTED(STR_SYSTEM, "$host", [canonical system (cpu-vendor-os) of where we should run])
  10AM_CONFIG_HEADER([config.h])
  11dnl AC_ARG_PROGRAM
  12AC_PREREQ(2.53)
  13
  14ac_cv_var_atom_ok=no
  15ac_cv_var_oncore_ok=no
  16ac_cv_var_parse_ok=no
  17ac_cv_var_ripe_ncc_ok=no
  18ac_cv_var_jupiter_ok=no
  19
  20dnl Grab any initial CFLAGS so we can pick better defaults.
  21iCFLAGS="$CFLAGS"
  22
  23dnl check these early to avoid autoconf warnings
  24AC_AIX
  25AC_MINIX
  26
  27# So far, the only shared library we might use is libopts.
  28# It's a small library - we might as well use a static version of it.
  29AC_DISABLE_SHARED
  30
  31dnl  we need to check for cross compile tools for vxWorks here
  32AC_PROG_CC
  33# Ralf Wildenhues: With per-target flags we need CC_C_O
  34# AM_PROG_CC_C_O supersets AC_PROG_CC_C_O
  35AM_PROG_CC_C_O
  36AC_PROG_CC_STDC
  37AC_PROG_CPP
  38
  39# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
  40case "$host" in
  41 *-*-amigaos)
  42    CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA"
  43    ;;
  44 *-*-hpux10.*)	# at least for hppa2.0-hp-hpux10.20
  45    case "$GCC" in
  46     yes)
  47	;;
  48     *) CFLAGS="$CFLAGS -Wp,-H18816"
  49	;;
  50    esac
  51    ;;
  52 *-pc-cygwin*)
  53    CFLAGS="$CFLAGS -DSYS_CYGWIN32"
  54    ;;
  55 i386-sequent-sysv4)
  56    case "$CC" in
  57     cc)
  58	CFLAGS="$CFLAGS -Wc,+abi-socket"
  59	;;
  60    esac
  61    ;;
  62 *-*-mpeix*)
  63    CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB"
  64    LDFLAGS="$LDFLAGS -L/SYSLOG/PUB"
  65    LIBS="$LIBS -lcurses"
  66    ;;
  67 *-*-solaris*)
  68    # see "man standards".
  69    # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
  70    # -D_XOPEN_SOURCE=600 seems OK for c99
  71    #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
  72    CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
  73    libxnet=-lxnet
  74    ;;
  75esac
  76
  77AMU_OS_CFLAGS
  78
  79# NTP has (so far) been relying on leading-edge autogen.
  80# Therefore, by default:
  81# - use the version we ship with
  82# - do not install it
  83# - build a static copy (AC_DISABLE_SHARED - done earlier)
  84case "${enable_local_libopts+set}" in
  85 set) ;;
  86 *) enable_local_libopts=yes ;;
  87esac
  88case "${enable_libopts_install+set}" in
  89 set) ;;
  90 *) enable_libopts_install=no ;;
  91esac
  92LIBOPTS_CHECK(libopts)
  93
  94AC_CACHE_CHECK(
  95    [if $CC can handle @%:@warning],
  96    ac_cv_cpp_warning,
  97    [
  98	AC_COMPILE_IFELSE(
  99	    AC_LANG_PROGRAM([], [#warning foo]),
 100	    [ac_cv_cpp_warning=yes],
 101	    [ac_cv_cpp_warning=no],
 102	)
 103    ]
 104)
 105
 106case "$ac_cv_cpp_warning" in
 107 no)
 108    AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid @%:@warning on option name collisions?])
 109esac
 110
 111case "$GCC" in
 112 yes)
 113    SAVED_CFLAGS_AC="$CFLAGS"
 114    CFLAGS="$CFLAGS -Wstrict-overflow"
 115    AC_CACHE_CHECK(
 116	[if $CC can handle -Wstrict-overflow], 
 117	ac_cv_gcc_Wstrict_overflow, 
 118	[
 119	    AC_COMPILE_IFELSE(
 120		[AC_LANG_PROGRAM([], [])],
 121		[ac_cv_gcc_Wstrict_overflow=yes],
 122		[ac_cv_gcc_Wstrict_overflow=no]
 123	    )
 124	]
 125    )
 126    CFLAGS="$SAVED_CFLAGS_AC"
 127    unset SAVED_CFLAGS_AC
 128    #
 129    # $ac_cv_gcc_Wstrict_overflow is tested later to add the 
 130    # flag to CFLAGS.
 131    #
 132esac
 133
 134
 135case "$GCC" in
 136 yes)
 137    SAVED_CFLAGS_AC="$CFLAGS"
 138    CFLAGS="$CFLAGS -Winit-self"
 139    AC_CACHE_CHECK(
 140	[if $CC can handle -Winit-self], 
 141	ac_cv_gcc_Winit_self, 
 142	[
 143	    AC_COMPILE_IFELSE(
 144		[AC_LANG_PROGRAM([], [])],
 145		[ac_cv_gcc_Winit_self=yes],
 146		[ac_cv_gcc_Winit_self=no]
 147	    )
 148	]
 149    )
 150    CFLAGS="$SAVED_CFLAGS_AC"
 151    unset SAVED_CFLAGS_AC
 152    #
 153    # $ac_cv_gcc_Winit_self is tested later to add the 
 154    # flag to CFLAGS.
 155    #
 156esac
 157
 158
 159
 160AC_MSG_CHECKING([for bin subdirectory])
 161AC_ARG_WITH(binsubdir,
 162	AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
 163	use_binsubdir="$withval", use_binsubdir="bin")
 164
 165case "$use_binsubdir" in
 166 bin)
 167    ;;
 168 sbin)
 169    ;;
 170 *)
 171    AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
 172    ;;
 173esac
 174AC_MSG_RESULT($use_binsubdir)
 175BINSUBDIR=$use_binsubdir
 176AC_SUBST(BINSUBDIR)
 177
 178AC_MSG_CHECKING([if we want to use arlib])
 179AC_ARG_WITH(arlib,
 180	AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]),
 181	[ans=$withval], [ans=no])
 182AC_MSG_RESULT([$ans])
 183
 184if test -d $srcdir/arlib
 185then
 186    case "$ans" in
 187     yes)
 188	ARLIB_DIR=arlib
 189	AC_CONFIG_SUBDIRS(arlib)
 190	;;
 191    esac
 192fi
 193AC_SUBST(ARLIB_DIR)
 194
 195AC_ARG_WITH(rpath,
 196	AC_HELP_STRING([--without-rpath], [s Disable auto-added -R linker paths]),
 197[ans=$withval], [ans=x])
 198case "$ans" in
 199 no)
 200    need_dash_r=
 201    ;;
 202 yes)
 203    need_dash_r=1
 204    ;;
 205esac
 206# HMS: Why isn't this $build?
 207# Well, that depends on if we need this for the build toolchain or
 208# for info in the host executable...
 209# I still have no idea which way this should go, but nobody has complained.
 210case "$host" in
 211 *-*-netbsd*)
 212    case "$need_dash_r" in
 213     no) ;;
 214     *)  need_dash_r=1
 215	 ;;
 216    esac
 217    ;;
 218 *-*-solaris*)
 219    case "$need_dash_r" in
 220     no) ;;
 221     *)  need_dash_r=1
 222	 ;;
 223    esac
 224    ;;
 225esac
 226
 227
 228case "$build" in
 229 $host)
 230    ;;
 231 *) case "$host" in
 232     *-*-vxworks*)
 233	# Quick and dirty sanity check
 234	case "$VX_KERNEL" in
 235	 '') AC_MSG_ERROR(Please follow the directions in html/build/hints/vxworks.html!)
 236	    ;;
 237	esac
 238        CFLAGS="$CFLAGS -DSYS_VXWORKS"
 239        ;;
 240    esac
 241    ;;
 242esac
 243
 244dnl  we need to check for cross compile tools for vxWorks here
 245AC_PROG_AWK
 246AC_PROG_MAKE_SET
 247
 248rm -f conftest*
 249
 250case "$GCC" in
 251 yes)
 252    CFLAGS="$CFLAGS -Wall"
 253    # CFLAGS="$CFLAGS -Wcast-align"
 254    CFLAGS="$CFLAGS -Wcast-qual"
 255    # CFLAGS="$CFLAGS -Wconversion"
 256    # CFLAGS="$CFLAGS -Werror"
 257    # CFLAGS="$CFLAGS -Wextra"
 258    # CFLAGS="$CFLAGS -Wfloat-equal"
 259    CFLAGS="$CFLAGS -Wmissing-prototypes"
 260    CFLAGS="$CFLAGS -Wpointer-arith"
 261    CFLAGS="$CFLAGS -Wshadow"
 262    #
 263    # OpenSSL has a number of callback prototypes
 264    # inside other function prototypes which trigger
 265    # warnings with -Wstrict-prototypes, such as:
 266    #
 267    # int i2d_RSA_NET(const RSA *a, unsigned char **pp, 
 268    #                 int (*cb)(), int sgckey);
 269    #                 ^^^^^^^^^^^
 270    #
 271    CFLAGS="$CFLAGS -Wno-strict-prototypes"
 272    # CFLAGS="$CFLAGS -Wtraditional"
 273    # CFLAGS="$CFLAGS -Wwrite-strings"
 274    case "$ac_cv_gcc_Winit_self" in
 275     yes)
 276	CFLAGS="$CFLAGS -Winit-self"
 277    esac
 278    case "$ac_cv_gcc_Wstrict_overflow" in
 279     yes)
 280        #not yet: CFLAGS="$CFLAGS -Wstrict-overflow"
 281    esac
 282    ;;
 283esac
 284
 285case "$host" in
 286 *-next-nextstep3)
 287    CFLAGS="$CFLAGS -posix"
 288    ;;
 289dnl This is currently commented out by bor. 
 290dnl The new versions of ReliantUNIX round adjtime() interval down
 291dnl to 1/100s (system tick). This makes tickadj actually useless.
 292dnl So, I'd better not use additional flags.
 293dnl I leave it here just in case anybody has better idea
 294dnl  mips-sni-sysv4* )
 295dnl     #
 296dnl     # Add flags for 64 bit file access to enable tickadj to access /dev/kmem
 297dnl     #
 298dnl     if getconf _LFS_CFLAGS > /dev/null 2>&1 ; then
 299dnl       CFLAGS="$CFLAGS `getconf _LFS_CFLAGS`"
 300dnl     fi
 301dnl     ;;
 302esac
 303
 304ac_busted_vpath_in_make=no
 305
 306case "$build" in
 307 *-*-irix6.1*)	# 64 bit only
 308    # busted vpath?
 309    ;;
 310 *-*-irix6*)	# 6.2 (and later?)
 311    ac_busted_vpath_in_make=yes
 312    ;;
 313 *-*-solaris2.5.1)
 314    ac_busted_vpath_in_make=yes
 315    ;;
 316 *-*-unicosmp*)
 317    ac_busted_vpath_in_make=yes
 318    ;;
 319esac
 320
 321case "$ac_busted_vpath_in_make$srcdir" in
 322 no*) ;;
 323 yes.) ;;
 324 *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in
 325     '')
 326	AC_MSG_ERROR([building outside of the main directory requires GNU make])
 327	;;
 328     *) ;;
 329    esac
 330    ;;
 331esac
 332
 333AC_SUBST(CFLAGS)dnl
 334AC_SUBST(LDFLAGS)dnl
 335
 336m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
 337m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
 338
 339AC_PROG_LIBTOOL
 340
 341AC_PROG_LN_S
 342AC_PROG_GCC_TRADITIONAL
 343AC_C_VOLATILE
 344AC_ISC_POSIX
 345AC_PATH_PROG(PATH_SH, sh)
 346AC_PATH_PROG(PATH_PERL, perl)
 347
 348hs_ULONG_CONST		# remove for 4.2.5
 349
 350case "$host" in
 351 *-*-vxworks*)
 352    ac_link="$ac_link $VX_KERNEL"
 353    ;;
 354esac
 355
 356AC_PROG_INSTALL
 357
 358case "$host" in
 359 *-pc-cygwin*)
 360    AC_CHECK_LIB(advapi32, main)
 361    ;;
 362esac
 363
 364AC_CHECK_FUNC([gethostent], ,
 365  AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket]))
 366AC_CHECK_FUNC([openlog], , 
 367  AC_SEARCH_LIBS([openlog], [gen], , 
 368  AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])))
 369AC_SEARCH_LIBS([MD5Init], [md5 md])
 370AC_CHECK_FUNCS(MD5Init)
 371
 372# following block becomes on 4.2.5: NTP_LINEEDITLIBS
 373dnl HMS: What a hack...
 374AC_CHECK_HEADERS(readline/history.h readline/readline.h)
 375case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
 376 *no*) ;;
 377 *) save_LIBS=$LIBS
 378    LIBS=
 379    # Ralf Wildenhues: either unset ... or cache READLINE_LIBS
 380    unset ac_cv_lib_readline_readline
 381    AC_CHECK_LIB(readline, readline, ,
 382     AC_MSG_NOTICE([Trying again with -lcurses])
 383     unset ac_cv_lib_readline_readline
 384     AC_CHECK_LIB(readline, readline,
 385      LIBS="-lreadline -lcurses $LIBS"
 386      AC_DEFINE(HAVE_LIBREADLINE)
 387      AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]),
 388      AC_CHECK_LIB(edit, readline,
 389       LIBS="-ledit -lcurses"
 390       AC_DEFINE(HAVE_LIBEDIT, , [Do we have the edit library?])
 391       AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?])
 392       , , -lcurses)
 393      , -lcurses))
 394    READLINE_LIBS=$LIBS
 395    AC_SUBST(READLINE_LIBS)
 396    LIBS=$save_LIBS
 397    ;;
 398esac
 399
 400dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
 401dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
 402dnl so only use one of them.  Linux (glibc-2.1.2 and -2.2.2, at least)
 403dnl does Strange Things with extra processes using the Posix-compatibility
 404dnl real-time library, so we don't want to use it.
 405
 406case "$host" in
 407 *-*-*linux*) ;;
 408 *)
 409    AC_CHECK_LIB(rt, sched_setscheduler, ,
 410	AC_CHECK_LIB(posix4, sched_setscheduler))
 411    ;;
 412esac
 413
 414AC_CHECK_FUNC(setsockopt, ,
 415	[AC_SEARCH_LIBS([setsockopt], [socket xnet])])
 416
 417AC_HEADER_STDC
 418AC_CHECK_HEADERS(bstring.h)
 419AC_CHECK_HEADER(dns_sd.h,
 420	[AC_CHECK_LIB(dns_sd,
 421			DNSServiceRegister,
 422			[AC_DEFINE(HAVE_DNSREGISTRATION, 1,
 423				[Use Rendezvous/DNS-SD registration])])])
 424case "$ac_cv_lib_dns_sd_DNSServiceRegister" in
 425 yes) LIBS="-ldns_sd $LIBS" ;;
 426esac
 427AC_CHECK_HEADERS(errno.h fcntl.h ieeefp.h math.h)
 428
 429# HMS: Lame, but fast.
 430if test -f /etc/redhat-release
 431then
 432    :
 433else
 434    AC_CHECK_HEADERS(md5.h, [], [],
 435[#if HAVE_SYS_TYPES_H
 436#include <sys/types.h>
 437#endif
 438])
 439fi
 440AC_CHECK_HEADERS(memory.h netdb.h poll.h)
 441AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
 442AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
 443case "$host" in
 444 *-*-aix*)
 445    AC_CHECK_HEADERS(utmpx.h)
 446    case "$ac_cv_header_utmpx_h" in
 447     yes) ;;
 448     *) AC_CHECK_HEADERS(utmp.h) ;;
 449    esac
 450    ;;
 451 *) AC_CHECK_HEADERS(utmp.h utmpx.h) ;;
 452esac
 453AC_CHECK_HEADERS(arpa/nameser.h)
 454AC_CHECK_HEADERS(sys/socket.h)
 455AC_CHECK_HEADERS(net/if.h, [], [],
 456[#if HAVE_SYS_SOCKET_H
 457#include <sys/socket.h>
 458#endif
 459])
 460AC_CHECK_HEADERS(net/if6.h)
 461AC_CHECK_HEADERS(net/route.h, [], [], [
 462#include <sys/types.h>
 463#include <sys/socket.h>
 464#include <net/if.h>
 465])
 466AC_CHECK_HEADERS(netinet/in_system.h netinet/in_systm.h)
 467AC_CHECK_HEADERS(netinet/in.h)
 468AC_CHECK_HEADERS(netinet/ip.h, [], [],
 469[#if HAVE_SYS_TYPES_H
 470#include <sys/types.h>
 471#endif
 472#if HAVE_NETINET_IN_H
 473#include <netinet/in.h>
 474#endif
 475#if HAVE_NETINET_IN_SYSTM_H
 476#include <netinet/in_systm.h>
 477#endif
 478])
 479
 480# Check for IPTOS_PREC
 481AC_CACHE_CHECK(
 482    [IPPROTO_IP IP_TOS IPTOS_LOWDELAY],
 483    ac_cv_ip_tos,
 484    [
 485	AC_EGREP_CPP(
 486	    [yes],
 487	    [
 488		#if HAVE_SYS_TYPES_H
 489		#include <sys/types.h>
 490		#endif
 491		#if HAVE_NETINET_IP_H
 492		#include <netinet/in.h>
 493		#include <netinet/ip.h>
 494		#endif
 495		#if defined(IPPROTO_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
 496		  yes
 497		#endif
 498	    ],
 499	    [ac_cv_ip_tos=yes],
 500	    [ac_cv_ip_tos=no]
 501	)
 502    ]
 503)
 504
 505case "$ac_cv_ip_tos" in
 506 yes)
 507    AC_DEFINE(HAVE_IPTOS_SUPPORT, 1, [Do we have IPTOS support?])
 508esac
 509
 510AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])])
 511AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
 512dnl AC_CHECK_HEADERS(sys/chudefs.h)
 513AC_CHECK_HEADERS(sys/clkdefs.h sys/file.h)
 514case "$host" in
 515 *-*-sunos4*) ;;
 516 *) AC_CHECK_HEADERS(sys/ioctl.h)
 517    ;;
 518esac
 519AC_CHECK_HEADERS(sys/ipc.h)
 520AC_CHECK_HEADERS(sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h)
 521# HMS: Check sys/proc.h and sys/resource.h after some others
 522AC_CHECK_HEADERS(sys/ppstime.h)
 523case "$ac_cv_header_sched_h" in
 524 yes) ;;
 525 *) AC_CHECK_HEADERS(sys/sched.h) ;;
 526esac
 527case "$host" in
 528 *-*-sco*)
 529    AC_CHECK_HEADERS(sys/sio.h)
 530    ;;
 531esac
 532# HMS: Check sys/shm.h after some others
 533AC_CHECK_HEADERS(sys/select.h sys/signal.h sys/sockio.h)
 534# HMS: Checked sys/socket.h earlier
 535case "$host" in
 536 *-*-netbsd*) ;;
 537 *) AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h)
 538    ;;
 539esac
 540AC_CHECK_HEADERS(sys/stat.h sys/stream.h)
 541AC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/syssgi.h sys/systune.h)
 542AC_CHECK_HEADERS(sys/termios.h sys/time.h sys/signal.h)
 543AC_EGREP_CPP(yes,
 544[#if HAVE_SYS_TIME_H
 545# include <sys/time.h>
 546#endif
 547#if HAVE_ERRNO_H
 548# include <errno.h>
 549#endif
 550#include <sys/timepps.h>
 551#ifdef PPS_API_VERS_1
 552yes
 553#endif
 554], [AC_CHECK_HEADERS(sys/timepps.h, [], [],
 555[#if HAVE_SYS_TIME_H
 556# include <sys/time.h>
 557#endif
 558#if HAVE_ERRNO_H
 559# include <errno.h>
 560#endif
 561])
 562])
 563AC_CHECK_HEADERS(sys/timers.h sys/tpro.h sys/types.h sys/wait.h)
 564AC_HEADER_TIME
 565case "$host" in
 566*-convex-*)
 567  AC_CHECK_HEADERS(/sys/sync/queue.h /sys/sync/sema.h)
 568  ;;
 569*-*-bsdi*)
 570  AC_CHECK_HEADERS(machine/inline.h sys/pcl720.h sys/i8253.h)
 571  ;;
 572esac
 573
 574case "$host" in
 575 *-*-*linux*)
 576    AC_CHECK_FUNCS(__adjtimex __ntp_gettime)
 577    ;;
 578esac
 579case "$ac_cv_func___adjtimex" in
 580 yes) ;;
 581 *)
 582    AC_CHECK_LIB(elf, nlist)	dnl Only needed for tickadj...
 583    dnl AC_CHECK_LIB(kvm, main, , , -lelf)
 584    AC_CHECK_LIB(kvm, main)		dnl We already know about -lelf here...
 585    AC_CHECK_LIB(ld, nlist)
 586    AC_CHECK_LIB(mld, nlist)
 587    AC_CHECK_HEADER(nlist.h,
 588    [AC_DEFINE(NLIST_STRUCT, 1, [nlist stuff])
 589     AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
 590      [AC_TRY_COMPILE([#include <nlist.h>],
 591       [struct nlist n; n.n_un.n_name = 0;],
 592       ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
 593     if test $ac_cv_struct_nlist_n_un = yes; then
 594       AC_DEFINE(NLIST_NAME_UNION, 1, [does struct nlist use a name union?])
 595     fi
 596    ])dnl
 597    ;;
 598esac
 599
 600dnl AC_CHECK_HEADERS(net/if.h, [], [],
 601dnl [#if HAVE_SYS_TYPES_H
 602dnl # include <sys/types.h>
 603dnl #endif
 604dnl #if HAVE_SYS_SOCKET_H
 605dnl # include <sys/socket.h>
 606dnl #endif
 607dnl ])
 608
 609AC_CHECK_HEADERS(sys/proc.h, [], [],
 610[#if HAVE_SYS_TYPES_H
 611# include <sys/types.h>
 612#endif
 613#if HAVE_SYS_TIME_H
 614# include <sys/time.h>
 615#endif
 616])
 617
 618AC_CHECK_HEADERS(sys/resource.h, [], [],
 619[#if HAVE_SYS_TIME_H
 620# include <sys/time.h>
 621#endif
 622])
 623
 624AC_CHECK_HEADERS(sys/shm.h, [], [],
 625[#if HAVE_SYS_TYPES_H
 626# include <sys/types.h>
 627#endif
 628#if HAVE_SYS_IPC_H
 629# include <sys/ipc.h>
 630#endif
 631])
 632
 633AC_CHECK_HEADERS(sys/timex.h, [], [],
 634[#if HAVE_SYS_TIME_H
 635# include <sys/time.h>
 636#endif
 637])
 638
 639AC_CHECK_HEADERS(resolv.h, [], [],
 640[#if HAVE_SYS_TYPES_H
 641#include <sys/types.h>
 642#endif
 643#if HAVE_NETINET_IN_H
 644#include <netinet/in.h>
 645#endif
 646#if HAVE_ARPA_NAMESER_H
 647#include <arpa/nameser.h>
 648#endif
 649])
 650
 651AC_CACHE_CHECK([for basic volatile support], ac_cv_c_volatile,
 652[AC_TRY_COMPILE([],[
 653volatile int x;],
 654	ac_cv_c_volatile=yes,
 655	ac_cv_c_volatile=no)
 656])
 657case "$ac_cv_c_volatile" in
 658 yes)
 659    ;;
 660 *) AC_DEFINE(volatile, , [Does the compiler like "volatile"?])
 661    ;;
 662esac
 663
 664#
 665# following block goes away in 4.2.5
 666#
 667# AM_C_PROTOTYPES gives us ansi2knr
 668case "$build" in
 669 *-*-solaris2*)
 670    # Assume that solaris2 is Ansi C...
 671    ;;
 672 *)
 673    AM_C_PROTOTYPES
 674    ;;
 675esac
 676AC_CACHE_CHECK(if C compiler permits function prototypes, ac_cv_have_prototypes,
 677[AC_TRY_COMPILE([
 678extern int foo (short);
 679int foo(short i) { return i; }],[
 680int i;], ac_cv_have_prototypes=yes, ac_cv_have_prototypes=no)
 681])
 682if test "$ac_cv_have_prototypes" = yes; then
 683  AC_DEFINE(HAVE_PROTOTYPES, 1, [Are function prototypes OK?])
 684fi
 685#
 686# end block 
 687#
 688
 689AC_C_CONST
 690AC_C_BIGENDIAN
 691AC_TYPE_SIGNAL
 692AC_TYPE_OFF_T
 693AC_TYPE_SIZE_T
 694AC_CHECK_TYPE(time_t, long)
 695AC_CHECK_SIZEOF(time_t)
 696AC_CHECK_TYPES(uintptr_t)
 697 
 698AH_VERBATIM([TYPEDEF_UINTPTR_T],
 699[/* Provide a typedef for uintptr_t? */
 700#ifndef HAVE_UINTPTR_T
 701typedef unsigned int	uintptr_t;
 702#define HAVE_UINTPTR_T	1
 703#endif])
 704
 705AC_STRUCT_TM
 706
 707AC_CACHE_CHECK([for u_int8_t], ac_cv_type_u_int8_t,
 708[AC_TRY_COMPILE([#include <sys/types.h>],
 709	[u_int8_t len = 42; return 0;],
 710	ac_cv_type_u_int8_t=yes,
 711	ac_cv_type_u_int8_t=no)
 712])
 713if test $ac_cv_type_u_int8_t = yes; then
 714	AC_DEFINE(HAVE_TYPE_U_INT8_T, 1, [Does u_int8_t exist?])
 715fi
 716
 717AC_CACHE_CHECK([for u_int64_t], ac_cv_type_u_int64_t,
 718[AC_TRY_COMPILE([#include <sys/types.h>],
 719	[u_int64_t len = 42; return 0;],
 720	ac_cv_type_u_int64_t=yes,
 721	ac_cv_type_u_int64_t=no)
 722])
 723if test $ac_cv_type_u_int64_t = yes; then
 724	AC_DEFINE(HAVE_TYPE_U_INT64_T, 1, [Does u_int64_t exist?])
 725fi
 726
 727#
 728# Look for in_port_t.
 729#
 730AC_MSG_CHECKING([for in_port_t])
 731AC_TRY_COMPILE([
 732#include <sys/types.h>
 733#include <netinet/in.h>],
 734[in_port_t port = 25; return (0);],
 735	[AC_MSG_RESULT(yes)
 736	],
 737        [AC_MSG_RESULT(no)
 738	AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Do we need our own in_port_t?])
 739	])
 740
 741AC_CACHE_CHECK([for a fallback value for HZ], ac_cv_var_default_hz,
 742[ac_cv_var_default_hz=100
 743case "$host" in
 744 alpha*-dec-osf4*|alpha*-dec-osf5*)
 745    ac_cv_var_default_hz=1024
 746    ;;
 747 mips-dec-ultrix4*)
 748    ac_cv_var_default_hz=256
 749    ;;
 750esac])
 751AC_DEFINE_UNQUOTED(DEFAULT_HZ, $ac_cv_var_default_hz, [What is the fallback value for HZ?])
 752
 753AC_CACHE_CHECK([if we need to override the system's value for HZ], ac_cv_var_override_hz,
 754[ac_cv_var_override_hz=no
 755case "$host" in
 756 alpha*-dec-osf4*|alpha*-dec-osf5*)
 757    ac_cv_var_override_hz=yes
 758    ;;
 759 mips-dec-ultrix4*)
 760    ac_cv_var_override_hz=yes
 761    ;;
 762 *-*-freebsd*)
 763    ac_cv_var_override_hz=yes
 764    ;;
 765 *-*-sunos4*)
 766    ac_cv_var_override_hz=yes
 767    ;;
 768esac])
 769case "$ac_cv_var_override_hz" in
 770 yes)
 771    AC_DEFINE(OVERRIDE_HZ, 1, [Do we need to override the system's idea of HZ?])
 772    ;;
 773esac
 774
 775dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
 776dnl [AC_TRY_LINK([#include <sys/types.h>
 777dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
 778dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
 779dnl if test $su_cv_func_ut_host_in_utmp = yes; then
 780dnl   AC_DEFINE(HAVE_UT_HOST)
 781dnl fi
 782
 783dnl AC_MSG_CHECKING(if we can get the system boot time)
 784dnl AC_CACHE_VAL(su_cv_have_boot_time,
 785dnl [AC_EGREP_CPP(yes,
 786dnl [#ifdef HAVE_UTMPX_H
 787dnl #include <utmpx.h>
 788dnl #else
 789dnl #include <utmp.h>
 790dnl #endif
 791dnl #ifdef BOOT_TIME
 792dnl yes
 793dnl #endif
 794dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
 795dnl AC_MSG_RESULT($su_cv_have_boot_time)
 796
 797AC_CACHE_CHECK([for struct rt_msghdr], ac_cv_struct_rt_msghdr,
 798[AC_TRY_COMPILE([
 799#include <sys/types.h>
 800#include <sys/socket.h>
 801#include <net/if.h>
 802#include <net/route.h>],
 803[struct rt_msghdr p;],
 804	ac_cv_struct_rt_msghdr=yes,
 805	ac_cv_struct_rt_msghdr=no)
 806])
 807
 808if test $ac_cv_struct_rt_msghdr = yes; then
 809    AC_DEFINE(HAS_ROUTING_SOCKET, 1, [Do we have a routing socket (struct rt_msghdr)?])
 810fi
 811
 812AC_CACHE_CHECK(
 813  [struct sigaction for sa_sigaction],
 814  ac_cv_struct_sigaction_has_sa_sigaction,
 815  [
 816    AC_TRY_COMPILE(
 817      [#include <signal.h>],
 818      [struct sigaction act; act.sa_sigaction = 0;],
 819      ac_cv_struct_sigaction_has_sa_sigaction=yes,
 820      ac_cv_struct_sigaction_has_sa_sigaction=no
 821    )
 822  ]
 823)
 824if test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then
 825  AC_DEFINE(HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION, 1, [Obvious...])
 826fi
 827
 828AC_CACHE_CHECK([for struct ppsclockev], ac_cv_struct_ppsclockev,
 829[AC_TRY_COMPILE([
 830#include <sys/types.h>
 831#ifdef HAVE_SYS_TERMIOS_H
 832# include <sys/termios.h>
 833#endif
 834#ifdef HAVE_SYS_TIME_H
 835# include <sys/time.h>
 836#endif
 837#ifdef HAVE_SYS_PPSCLOCK_H
 838# include <sys/ppsclock.h>
 839#endif],[
 840extern struct ppsclockev *pce;
 841return pce->serial;],
 842	ac_cv_struct_ppsclockev=yes,
 843	ac_cv_struct_ppsclockev=no)
 844])
 845if test $ac_cv_struct_ppsclockev = yes; then
 846    AC_DEFINE(HAVE_STRUCT_PPSCLOCKEV, 1, [Does a system header define struct ppsclockev?])
 847fi
 848
 849AC_CACHE_CHECK([struct sockaddr for sa_len], ac_cv_struct_sockaddr_has_sa_len,
 850[AC_TRY_COMPILE([
 851#include <sys/types.h>
 852#include <sys/socket.h>],[
 853extern struct sockaddr *ps;
 854return ps->sa_len;],
 855	ac_cv_struct_sockaddr_has_sa_len=yes,
 856	ac_cv_struct_sockaddr_has_sa_len=no)
 857])
 858if test $ac_cv_struct_sockaddr_has_sa_len = yes; then
 859    AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR, 1, [Should be obvious...])
 860fi
 861
 862AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
 863[AC_TRY_COMPILE([
 864#include <sys/types.h>
 865#include <sys/socket.h>
 866#include <netinet/in.h>
 867],[
 868struct sockaddr_storage n;],
 869	ac_cv_struct_sockaddr_storage=yes,
 870	ac_cv_struct_sockaddr_storage=no)
 871])
 872if test $ac_cv_struct_sockaddr_storage = yes; then
 873    AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Does a system header define struct sockaddr_storage?])
 874fi
 875
 876AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
 877		ac_cv_have_ss_family_in_struct_ss, [
 878	AC_TRY_COMPILE(
 879		[
 880#include <sys/types.h>
 881#include <sys/socket.h>
 882		],
 883		[ struct sockaddr_storage s; s.ss_family = 1; ],
 884		[ ac_cv_have_ss_family_in_struct_ss="yes" ],
 885		[ ac_cv_have_ss_family_in_struct_ss="no" ],
 886	)
 887])
 888if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
 889	AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
 890else
 891    # Hack around a problem...
 892    # HMS: This is $host because we need the -D if we are building *for* it.
 893    # HMS: 061029: Now that we separate the ss_* checks this is causing
 894    # a problem - disable it until we get to the bottom of it.
 895    case "$host" in
 896     XXX*-*-hpux11.11) CPPFLAGS="$CPPFLAGS -D_NETINET_IN6_H"
 897	;;
 898    esac
 899fi
 900
 901AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
 902		ac_cv_have___ss_family_in_struct_ss, [
 903	AC_TRY_COMPILE(
 904		[
 905#include <sys/types.h>
 906#include <sys/socket.h>
 907		],
 908		[ struct sockaddr_storage s; s.__ss_family = 1; ],
 909		[ ac_cv_have___ss_family_in_struct_ss="yes" ],
 910		[ ac_cv_have___ss_family_in_struct_ss="no" ]
 911	)
 912])
 913if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
 914	AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
 915fi
 916
 917AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
 918[/* Handle ss_family */
 919#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
 920# define ss_family __ss_family
 921#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
 922
 923AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
 924		ac_cv_have_ss_len_in_struct_ss, [
 925	AC_TRY_COMPILE(
 926		[
 927#include <sys/types.h>
 928#include <sys/socket.h>
 929		],
 930		[ struct sockaddr_storage s; s.ss_len = 1; ],
 931		[ ac_cv_have_ss_len_in_struct_ss="yes" ],
 932		[ ac_cv_have_ss_len_in_struct_ss="no" ],
 933	)
 934])
 935if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
 936	AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len?])
 937fi
 938
 939AC_CACHE_CHECK([for __ss_len field in struct sockaddr_storage],
 940		ac_cv_have___ss_len_in_struct_ss, [
 941	AC_TRY_COMPILE(
 942		[
 943#include <sys/types.h>
 944#include <sys/socket.h>
 945		],
 946		[ struct sockaddr_storage s; s.__ss_len = 1; ],
 947		[ ac_cv_have___ss_len_in_struct_ss="yes" ],
 948		[ ac_cv_have___ss_len_in_struct_ss="no" ]
 949	)
 950])
 951if test "x$ac_cv_have___ss_len_in_struct_ss" = "xyes" ; then
 952	AC_DEFINE(HAVE___SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have __ss_len?])
 953fi
 954
 955AH_VERBATIM([X_HAVE_SS_LEN_IN_SS],
 956[/* Handle ss_len */
 957#if !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE___SS_LEN_IN_SS)
 958# define ss_len __ss_len
 959#endif /* !defined(HAVE_SS_LEN_IN_SS) && defined(HAVE_SA_LEN_IN_SS) */])
 960
 961case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
 962  *yes*)
 963    AC_CACHE_CHECK([for struct snd_size], ac_cv_struct_snd_size,
 964[AC_TRY_COMPILE([
 965#ifdef HAVE_MACHINE_SOUNDCARD_H
 966# include <machine/soundcard.h>
 967#endif
 968#ifdef HAVE_SYS_SOUNDCARD_H
 969# include <sys/soundcard.h>
 970#endif],[
 971extern struct snd_size *ss;
 972return ss->rec_size;],
 973    ac_cv_struct_snd_size=yes,
 974    ac_cv_struct_snd_size=no)
 975])
 976    case "$ac_cv_struct_snd_size" in
 977     yes) AC_DEFINE(HAVE_STRUCT_SND_SIZE, 1,[Do we have struct snd_size?]) ;;
 978    esac
 979    ;;
 980esac
 981
 982AC_CACHE_CHECK([struct clockinfo for hz], ac_cv_struct_clockinfo_has_hz,
 983[AC_TRY_COMPILE([
 984#include <sys/time.h>],[
 985extern struct clockinfo *pc;
 986return pc->hz;],
 987	ac_cv_struct_clockinfo_has_hz=yes,
 988	ac_cv_struct_clockinfo_has_hz=no)
 989])
 990if test $ac_cv_struct_clockinfo_has_hz = yes; then
 991    AC_DEFINE(HAVE_HZ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
 992fi
 993
 994AC_CACHE_CHECK([struct clockinfo for tickadj], ac_cv_struct_clockinfo_has_tickadj,
 995[AC_TRY_COMPILE([
 996#include <sys/time.h>],[
 997extern struct clockinfo *pc;
 998return pc->tickadj;],
 999	ac_cv_struct_clockinfo_has_tickadj=yes,
1000	ac_cv_struct_clockinfo_has_tickadj=no)
1001])
1002if test $ac_cv_struct_clockinfo_has_tickadj = yes; then
1003    AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO, 1, [Obvious...])
1004fi
1005
1006AC_CACHE_CHECK([for struct timespec], ac_cv_struct_timespec,
1007[AC_TRY_COMPILE([
1008#include <sys/time.h>
1009/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */
1010#ifdef HAVE_ERRNO_H
1011# include <errno.h>
1012#endif
1013#ifdef HAVE_SYS_TIMEPPS_H
1014# define FRAC 4294967296
1015# include <sys/timepps.h>
1016#endif],
1017[struct timespec n;],
1018ac_cv_struct_timespec=yes, ac_cv_struct_timespec=no)])
1019if test $ac_cv_struct_timespec = yes; then
1020  AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Do we have struct timespec?])
1021fi
1022
1023AC_CACHE_CHECK([for struct ntptimeval], ac_cv_struct_ntptimeval,
1024[AC_TRY_COMPILE([
1025#include <sys/time.h>
1026#include <sys/timex.h>],
1027[struct ntptimeval n;],
1028ac_cv_struct_ntptimeval=yes, ac_cv_struct_ntptimeval=no)])
1029if test $ac_cv_struct_ntptimeval = yes; then
1030  AC_DEFINE(HAVE_STRUCT_NTPTIMEVAL, 1, [Do we have struct ntptimeval?])
1031fi
1032
1033AC_CHECK_MEMBERS([struct ntptimeval.time.tv_nsec], , ,
1034[#ifdef HAVE_SYS_TIME_H
1035#include <sys/time.h>
1036#else
1037# ifdef HAVE_TIME_H
1038# include <time.h>
1039# endif
1040#endif
1041#ifdef HAVE_SYS_TIMEX_H
1042#include <sys/timex.h>
1043#else
1044# ifdef HAVE_TIMEX_H
1045# include <timex.h>
1046# endif
1047#endif])
1048
1049AC_C_INLINE
1050
1051case "$ac_cv_c_inline" in
1052 '')
1053    ;;
1054 *)
1055    AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
1056    AC_SUBST(HAVE_INLINE)
1057esac
1058
1059AC_C_CHAR_UNSIGNED		dnl CROSS_COMPILE?
1060AC_CHECK_SIZEOF(signed char)
1061AC_CHECK_SIZEOF(int)
1062AC_CHECK_SIZEOF(long)
1063
1064AC_CHECK_TYPES([s_char])
1065case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
1066 *yes)
1067    # We have a typedef for s_char.  Might as well believe it...
1068    ;;
1069 no0no)
1070    # We have signed chars, can't say 'signed char', no s_char typedef.
1071    AC_DEFINE(NEED_S_CHAR_TYPEDEF, 1, [Do we need an s_char typedef?])
1072    ;;
1073 no1no)
1074    # We have signed chars, can say 'signed char', no s_char typedef.
1075    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1076    ;;
1077 yes0no)
1078    # We have unsigned chars, can't say 'signed char', no s_char typedef.
1079    AC_MSG_ERROR(No way to specify a signed character!)
1080    ;;
1081 yes1no)
1082    # We have unsigned chars, can say 'signed char', no s_char typedef.
1083    AC_DEFINE(NEED_S_CHAR_TYPEDEF)
1084    ;;
1085esac
1086AC_TYPE_UID_T
1087
1088case "$host" in
1089 *-*-aix[[456]]*)
1090	# (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
1091	# (returning ENOSYS).  I didn't check 4.2.  If, in the future,
1092	# IBM pulls its thumbs out long enough to implement clock_settime,
1093	# this conditional will need to change.  Maybe use AC_TRY_RUN
1094	# instead to try to set the time to itself and check errno.
1095    ;;
1096 *) AC_CHECK_FUNCS(clock_gettime clock_settime)
1097    ;;
1098esac
1099AC_CHECK_FUNCS(daemon)
1100AC_CHECK_FUNCS(finite, ,
1101  [AC_CHECK_FUNCS(isfinite, ,
1102    [AC_MSG_CHECKING([for isfinite with <math.h>])
1103    _libs=$LIBS
1104    LIBS="$LIBS -lm"
1105    AC_TRY_LINK([#include <math.h>], [float f = 0.0; isfinite(f)],
1106      [AC_MSG_RESULT(yes)
1107      AC_DEFINE(HAVE_ISFINITE)],
1108      AC_MSG_RESULT(no))
1109    LIBS=$_libs])])
1110AC_CHECK_FUNCS(getbootfile getclock getdtablesize)
1111
1112AC_ARG_ENABLE(getifaddrs,
1113    AC_HELP_STRING([--enable-getifaddrs],
1114	[s Enable the use of getifaddrs() [[yes|no|glibc]].
1115glibc: Use getifaddrs() in glibc if you know it supports IPv6.]),
1116    want_getifaddrs="$enableval",  want_getifaddrs="yes")
1117
1118case $want_getifaddrs in
1119yes|glibc)
1120#
1121# Do we have getifaddrs() ?
1122#
1123case $host in
1124*-*linux*)
1125	# Some recent versions of glibc support getifaddrs() which does not
1126	# provide AF_INET6 addresses while the function provided by the USAGI
1127	# project handles the AF_INET6 case correctly.  We need to avoid
1128	# using the former but prefer the latter unless overridden by
1129	# --enable-getifaddrs=glibc.
1130	if test $want_getifaddrs = glibc
1131	then
1132		AC_CHECK_FUNCS(getifaddrs)
1133	else
1134		save_LIBS="$LIBS"
1135		LIBS="-L/usr/local/v6/lib $LIBS"
1136		AC_CHECK_LIB(inet6, getifaddrs,
1137			LIBS="$LIBS -linet6"
1138			AC_DEFINE(HAVE_GETIFADDRS),
1139			LIBS=${save_LIBS})
1140	fi
1141	;;
1142*)
1143	AC_CHECK_FUNCS(getifaddrs)
1144	;;
1145esac
1146;;
1147no)
1148;;
1149esac
1150
1151AC_MSG_CHECKING([type of socklen arg for getsockname()])
1152AC_CACHE_VAL(ac_cv_func_getsockname_arg2,dnl
1153[AC_CACHE_VAL(ac_cv_func_getsockname_socklen_type,dnl
1154 [for ac_cv_func_getsockname_arg2 in 'struct sockaddr *' 'void *'; do
1155  for ac_cv_func_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
1156   AC_TRY_COMPILE(dnl
1157[#ifdef HAVE_SYS_TYPES_H
1158#include <sys/types.h>
1159#endif
1160#ifdef HAVE_SYS_SOCKET_H
1161#include <sys/socket.h>
1162#endif
1163extern getsockname (int, $ac_cv_func_getsockname_arg2, $ac_cv_func_getsockname_socklen_type *);],,dnl
1164    [ac_not_found=no ; break 2], ac_not_found=yes)
1165   done
1166  done
1167 ])dnl AC_CACHE_VAL
1168])dnl AC_CACHE_VAL
1169if test "$ac_not_found" = yes; then
1170 ac_cv_func_getsockname_socklen_type='socklen_t'
1171fi
1172AC_MSG_RESULT([$ac_cv_func_getsockname_socklen_type])
1173AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
1174		   $ac_cv_func_getsockname_socklen_type,
1175		   [What is getsockname()'s socklen type?])
1176
1177AC_CHECK_FUNCS(getrusage)
1178AC_CHECK_FUNC(gettimeofday, ,[
1179case "$host" in
1180  *-*-mpeix*) ac_cv_func_gettimeofday=yes
1181    ;;
1182esac])
1183case "$host" in
1184 *-pc-cygwin*)
1185    ;;
1186 *) AC_CHECK_FUNCS(getuid)
1187    ;;
1188esac
1189AC_CHECK_FUNCS(hstrerror)
1190
1191#
1192# Check for if_nametoindex() for IPv6 scoped addresses support
1193#
1194AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
1195		ac_cv_have_if_nametoindex=no)
1196case $ac_cv_have_if_nametoindex in
1197 no)
1198	case "$host" in
1199  	*-hp-hpux*)
1200  		AC_CHECK_LIB(ipv6, if_nametoindex,
1201				ac_cv_have_if_nametoindex=yes
1202				LIBS="-lipv6 $LIBS",)
1203  	;;
1204	esac
1205esac
1206case $ac_cv_have_if_nametoindex in
1207 yes)
1208	AC_DEFINE(ISC_PLATFORM_HAVEIFNAMETOINDEX, 1, [ISC: do we have if_nametoindex()?])
1209	;;
1210esac
1211
1212AC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])])
1213AC_CHECK_FUNC(inet_pton, [], [AC_DEFINE(ISC_PLATFORM_NEEDPTON, 1, [ISC: provide inet_pton()])])
1214AC_CHECK_FUNC(inet_aton, [], [AC_DEFINE(ISC_PLATFORM_NEEDATON, 1, [ISC: provide inet_aton()])])
1215AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset)
1216case "$host" in
1217 *-*-sco3.2v5.0.*)
1218    # Just stubs.  Idiots.
1219    ;;
1220 *) AC_CHECK_FUNCS(mkstemp)
1221    ;;
1222esac
1223AC_CHECK_FUNCS(mktime)
1224case "$host" in
1225 *-*-aix[[456]]*)
1226    # Just a stub.  Idiots.
1227    ;;
1228 *-*-irix[[45]]*)
1229    # Just a stub in "old" Irix.  Idiots.
1230    ;;
1231 *-*-*linux*)
1232    # there, but more trouble than it is worth for now (resolver problems)
1233    ;;
1234 *-*-qnx*)
1235    # Apparently there but not working in QNX.  Idiots?
1236    ;;
1237 *-*-sco3.2v5.0.*)
1238    # Just a stub.  Idiots.
1239    ;;
1240 alpha*-dec-osf4*|alpha*-dec-osf5*)
1241    # mlockall is there, as a #define calling memlk via <sys/mman.h>
1242    # Not easy to test for - cheat.
1243    AC_CHECK_FUNCS(memlk, [ac_cv_func_mlockall='yes'])
1244    AC_CHECK_FUNCS(mlockall)
1245    ;;
1246 *) AC_CHECK_FUNCS(mlockall)
1247    ;;
1248esac
1249AC_CHECK_FUNCS(nice nlist)
1250case "$host" in
1251 *-*-solaris2.6)
1252    # Broken...
1253    ;;
1254 *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime)
1255    ;;
1256esac
1257AC_CHECK_FUNCS(plock pututline pututxline readlink recvmsg rtprio)
1258case "$host" in
1259 *-*-aix[[456]]*)
1260    # Just a stub in AIX 4.  Idiots.
1261    ;;
1262 *-*-solaris2.5*)
1263    # Just stubs in solaris2.5.  Idiots.
1264    ;;
1265 *) AC_CHECK_FUNCS(sched_setscheduler)
1266    ;;
1267esac
1268AC_CHECK_FUNCS(setlinebuf setpgid setpriority setsid)
1269AC_CHECK_FUNCS(setrlimit)
1270AC_CHECK_FUNCS(settimeofday, ,[
1271case "$host" in
1272  *-*-mpeix*) ac_cv_func_settimeofday=yes
1273    ;;
1274esac])
1275AC_CHECK_FUNCS(setvbuf sigaction)
1276AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
1277AC_CHECK_FUNCS(snprintf strdup strerror strstr)
1278AC_CHECK_FUNCS(timegm)
1279case "$host" in
1280 *-*-aix[[456]]*)
1281    # Just stubs.  Idiots.
1282    ;;
1283 *-*-netbsd1*)
1284    # Just stubs.  Idiots.
1285    ;;
1286 *-*-netbsdelf1*)
1287    # Just stubs.  Idiots.
1288    ;;
1289 *-*-openbsd*)
1290    # Just stubs.  Idiots.
1291    ;;
1292 *) AC_CHECK_FUNCS(timer_create timer_settime)
1293    ;;
1294esac
1295case "$host" in
1296 *-pc-cygwin*)
1297    # I have no idea...
1298    ;;
1299 *) AC_CHECK_FUNCS(umask)
1300    ;;
1301esac
1302AC_CHECK_FUNCS(uname updwtmp updwtmpx vsnprintf vsprintf)
1303
1304###
1305
1306# http://bugs.ntp.org/737
1307case "$ac_cv_func_recvmsg" in
1308 yes)
1309 AC_MSG_CHECKING([if we need extra help to define struct iovec])
1310 AC_CACHE_VAL(ac_cv_struct_iovec_help,dnl
1311 [for ac_cv_struct_iovec_help in '0' '1'; do
1312   AC_TRY_COMPILE(dnl
1313[#ifdef HAVE_SYS_TYPES_H
1314#include <sys/types.h>
1315#endif
1316#ifdef HAVE_SYS_SOCKET_H
1317#include <sys/socket.h>
1318#endif
1319#if $ac_cv_struct_iovec_help
1320#include <sys/uio.h>
1321#endif
1322
1323void foo();
1324void foo() {
1325	ssize_t x;
1326	int s = 0;
1327	struct iovec iov;
1328	struct msghdr mh;
1329	int flags = 0;
1330
1331	mh.msg_iov = &iov;
1332	x = recvmsg(s, &mh, flags);
1333}],,dnl
1334  [ac_worked=yes ; break 1], ac_worked=no)
1335  done
1336])dnl AC_CACHE_VAL
1337    case "$ac_worked$ac_cv_struct_iovec_help" in
1338     yes1)
1339	AC_DEFINE(HAVE_SYS_UIO_H, 1, [Use sys/uio.h for struct iovec help])
1340	ans=yes
1341	;;
1342     *) ans=no
1343    esac
1344    AC_MSG_RESULT([$ans])
1345    ;;
1346esac
1347
1348case "$host" in
1349 *-*-sunos4*)
1350    AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*])
1351    ;;
1352esac
1353
1354AC_CACHE_CHECK([number of arguments to gettimeofday()], ac_cv_func_Xettimeofday_nargs,
1355[AC_TRY_COMPILE([#include <sys/time.h>],[
1356gettimeofday((struct timeval*)0,(struct timezone*)0);
1357settimeofday((struct timeval*)0,(struct timezone*)0);
1358],
1359	ac_cv_func_Xettimeofday_nargs=2, ac_cv_func_Xettimeofday_nargs=1)
1360])
1361if test $ac_cv_func_Xettimeofday_nargs = 1; then
1362	AC_DEFINE(SYSV_TIMEOFDAY, 1, [Does Xettimeofday take 1 arg?])
1363fi
1364
1365AC_CACHE_CHECK([number of arguments taken by setpgrp()], ac_cv_func_setpgrp_nargs,
1366[AC_TRY_COMPILE([
1367#ifdef HAVE_SYS_TYPES_H
1368# include <sys/types.h>
1369#endif
1370#ifdef HAVE_UNISTD_H
1371# include <unistd.h>
1372#endif
1373],[setpgrp(0,0);],
1374        ac_cv_func_setpgrp_nargs=2, ac_cv_func_setpgrp_nargs=0)
1375])
1376if test $ac_cv_func_setpgrp_nargs = 0; then
1377        AC_DEFINE(HAVE_SETPGRP_0, 1, [define if setpgrp takes 0 arguments])
1378fi
1379
1380save_CFLAGS=$CFLAGS
1381CFLAGS="$CFLAGS -I$srcdir/include"
1382
1383AC_CACHE_CHECK([argument pointer type of qsort()'s compare function and base],
1384ac_cv_func_qsort_argtype,
1385[AC_TRY_COMPILE([
1386#include "l_stdlib.h"
1387
1388#ifdef HAVE_PROTOTYPES
1389#define P(x) x
1390#else
1391#define P(x) ()
1392#endif
1393
1394extern void *base;
1395extern sortfunc P((const void *, const void *));
1396int sortfunc(a, b)
1397  const void *a;
1398  const void *b; { return 0; }
1399],[
1400qsort(base, 2, sizeof(char *), sortfunc);
1401],
1402	ac_cv_func_qsort_argtype=void, ac_cv_func_qsort_argtype=char)
1403])
1404case "$ac_cv_func_qsort_argtype" in
1405 void)
1406    AC_DEFINE(QSORT_USES_VOID_P, 1, [Does qsort expect to work on "void *" stuff?])
1407    ;;
1408esac
1409
1410CFLAGS=$save_CFLAGS
1411
1412AC_CACHE_CHECK([if we need to declare 'errno'], ac_cv_decl_errno,
1413[AC_TRY_COMPILE([#ifdef HAVE_ERRNO_H
1414#include <errno.h>
1415#endif],
1416  [errno = 0;],
1417  ac_cv_decl_errno=no, ac_cv_decl_errno=yes)])
1418case "$ac_cv_decl_errno" in
1419 yes) AC_DEFINE(DECL_ERRNO, 1, [Declare errno?]) ;;
1420esac
1421
1422dnl FIXME: from ntpd/ntp_intres.c, but there's no info which header produces
1423dnl the clash.  <resolv.h> isn't currently used.
1424dnl
1425dnl (prr) aix 4.3 defines h_errno as (*(int *)h_errno_which()) for
1426dnl MT purposes.  This makes the line "extern int h_errno" choke
1427dnl the compiler.  Hopefully adding !defined(h_errno) fixes this
1428dnl without breaking any other platforms.
1429dnl
1430AC_CACHE_CHECK([if we may declare 'h_errno'], ac_cv_decl_h_errno,
1431[AC_TRY_COMPILE([#include <sys/types.h>
1432#ifdef HAVE_NETINET_IN_H
1433#include <netinet/in.h>
1434#endif
1435#ifdef HAVE_ARPA_NAMESER_H
1436#include <arpa/nameser.h>
1437#endif
1438#ifdef HAVE_NETDB_H
1439#include <netdb.h>
1440#endif
1441#ifdef HAVE_RESOLV_H
1442#include <resolv.h>
1443#endif],
1444  [extern int h_errno;],
1445  ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)])
1446case "$ac_cv_decl_h_errno" in
1447 yes) AC_DEFINE(DECL_H_ERRNO, 1, [Declare h_errno?]) ;;
1448esac
1449
1450dnl See if char *sys_errlist[] is OK.
1451AC_CACHE_CHECK([[if declaring 'char *sys_errlist[]' is ok]], ac_cv_decl_sys_errlist,
1452[AC_TRY_COMPILE([#include <stdio.h>
1453#ifdef HAVE_ERRNO_H
1454#include <errno.h>
1455#endif],
1456  [extern char *sys_errlist[];
1457],
1458  ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])
1459case "$ac_cv_decl_sys_errlist" in
1460 yes) AC_DEFINE(CHAR_SYS_ERRLIST, 1, [Declare char *sys_errlist array]) ;;
1461esac
1462
1463AC_CACHE_CHECK([if declaring 'syscall()' is ok], ac_cv_decl_syscall,
1464[AC_TRY_COMPILE([
1465#ifdef HAVE_SYS_TYPES_H
1466# include <sys/types.h>
1467#endif
1468#ifdef HAVE_UNISTD_H
1469# include <unistd.h>
1470#endif
1471#ifdef HAVE_PROTOTYPES
1472#define P(x) x
1473#else
1474#define P(x) ()
1475#endif
1476],
1477  [extern int syscall P((int, ...));],
1478  ac_cv_decl_syscall=yes, ac_cv_decl_syscall=no)])
1479case "$ac_cv_decl_syscall" in
1480 yes) AC_DEFINE(DECL_SYSCALL, 1, [Declare syscall()?]) ;;
1481esac
1482
1483case "$host" in
1484 *-*-aix4.3.*)
1485    AC_DEFINE(DECL_HSTRERROR_0, 1, [Declaration style])		# Needed for XLC under AIX 4.3.2
1486    ;;
1487 *-*-mpeix*)
1488    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1489    AC_DEFINE(DECL_INET_NTOA_0, 1, [Declaration style])
1490    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1491    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1492    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1493    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1494    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1495    ;;
1496 *-*-osf[[45]]*)
1497    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1498    AC_DEFINE(DECL_STIME_1, 1, [Declaration style])
1499    ;;
1500 *-*-qnx*)
1501    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1502    ;;
1503 *-*-riscos4*)
1504    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1505    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1506    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1507    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1508    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1509    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1510    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1511    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1512    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1513    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1514    AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1515    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1516    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1517    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1518    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1519    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1520    ;;
1521 *-*-solaris2*)
1522    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1523    AC_DEFINE(DECL_SETPRIORITY_1, 1, [Declaration style])
1524    case "$host" in
1525     *-*-solaris2.4)
1526        AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1527	;;
1528    esac
1529    ;;
1530 *-*-sunos4*)
1531    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1532    AC_DEFINE(DECL_BCOPY_0, 1, [Declaration style])
1533    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1534    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1535    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1536    AC_DEFINE(DECL_MEMMOVE_0, 1, [Declaration style])
1537    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1538    AC_DEFINE(DECL_MKSTEMP_0, 1, [Declaration style])
1539    AC_DEFINE(DECL_RENAME_0, 1, [Declaration style])
1540    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1541    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1542    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1543    AC_DEFINE(DECL_SIGVEC_0, 1, [Declaration style])
1544    case "`basename $ac_cv_prog_CC`" in
1545     acc*) ;;
1546     *) AC_DEFINE(DECL_STDIO_0, 1, [Declaration style])
1547	;;
1548    esac
1549    AC_DEFINE(DECL_STRTOL_0, 1, [Declaration style])
1550    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1551    AC_DEFINE(DECL_TIME_0, 1, [Declaration style])
1552    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1553    AC_DEFINE(DECL_TOLOWER_0, 1, [Declaration style])
1554    AC_DEFINE(DECL_TOUPPER_0, 1, [Declaration style])
1555    AC_DEFINE(DECL_STRERROR_0, 1, [Declaration style])
1556    ;;
1557 *-*-ultrix4*)
1558    AC_DEFINE(DECL_ADJTIME_0, 1, [Declaration style])
1559    AC_DEFINE(DECL_BZERO_0, 1, [Declaration style])
1560    AC_DEFINE(DECL_CFSETISPEED_0, 1, [Declaration style])
1561    AC_DEFINE(DECL_IOCTL_0, 1, [Declaration style])
1562    AC_DEFINE(DECL_IPC_0, 1, [Declaration style])
1563    AC_DEFINE(DECL_MKTEMP_0, 1, [Declaration style])
1564    AC_DEFINE(DECL_NLIST_0, 1, [Declaration style])
1565    AC_DEFINE(DECL_PLOCK_0, 1, [Declaration style])
1566    AC_DEFINE(DECL_SELECT_0, 1, [Declaration style])
1567    AC_DEFINE(DECL_SETITIMER_0, 1, [Declaration style])
1568    AC_DEFINE(DECL_SETPRIORITY_0, 1, [Declaration style])
1569    AC_DEFINE(DECL_STIME_0, 1, [Declaration style])
1570    AC_DEFINE(DECL_SYSLOG_0, 1, [Declaration style])
1571    AC_DEFINE(DECL_TIMEOFDAY_0, 1, [Declaration style])
1572    ;;
1573esac
1574
1575case "$host" in
1576 *-*-sco3.2*)
1577    AC_DEFINE(TERMIOS_NEEDS__SVID3, 1, [Do we need to #define _SVID3 when we #include <termios.h>?])
1578    ;;
1579esac
1580
1581AC_CACHE_CHECK([if we need extra room for SO_RCVBUF], ac_cv_var_rcvbuf_slop,
1582[ans=no
1583case "$host" in
1584 *-*-hpux[[567]]*)
1585    ans=yes
1586    ;;
1587esac
1588ac_cv_var_rcvbuf_slop=$ans])
1589case "$ac_cv_var_rcvbuf_slop" in
1590 yes) AC_DEFINE(NEED_RCVBUF_SLOP, 1, [Do we need extra room for SO_RCVBUF? (HPUX <8)]) ;;
1591esac
1592
1593AC_CACHE_CHECK([if we will open the broadcast socket], ac_cv_var_open_bcast_socket,
1594[ans=yes
1595case "$host" in
1596 *-*-domainos)
1597    ans=no
1598    ;;
1599esac
1600ac_cv_var_open_bcast_socket=$ans])
1601case "$ac_cv_var_open_bcast_socket" in
1602 yes) AC_DEFINE(OPEN_BCAST_SOCKET, 1, [Should we open the broadcast socket?]) ;;
1603esac
1604
1605AC_CACHE_CHECK([if we want the HPUX version of FindConfig()], ac_cv_var_hpux_findconfig,
1606[ans=no
1607case "$host" in
1608 *-*-hpux*)
1609    ans=yes
1610    ;;
1611esac
1612ac_cv_var_hpux_findconfig=$ans])
1613case "$ac_cv_var_hpux_findconfig" in
1614 yes) AC_DEFINE(NEED_HPUX_FINDCONFIG, 1, [Do we want the HPUX FindConfig()?]) ;;
1615esac
1616
1617AC_CACHE_CHECK([if process groups are set with -pid], ac_cv_arg_setpgrp_negpid,
1618[case "$host" in
1619 *-*-hpux[[567]]*)
1620    ans=no
1621    ;;
1622 *-*-hpux*)
1623    ans=yes
1624    ;;
1625 *-*-*linux*)
1626    ans=yes
1627    ;;
1628 *-*-sunos3*)
1629    ans=yes
1630    ;;
1631 *-*-ultrix2*)
1632    ans=yes
1633    ;;
1634 *)
1635    ans=no
1636    ;;
1637esac
1638ac_cv_arg_setpgrp_negpid=$ans])
1639case "$ac_cv_arg_setpgrp_negpid" in
1640 yes) AC_DEFINE(UDP_BACKWARDS_SETOWN, 1, [Do we set process groups with -pid?]) ;;
1641esac
1642
1643AC_CACHE_CHECK([if we need a ctty for F_SETOWN], ac_cv_func_ctty_for_f_setown,
1644[[case "$host" in
1645 *-*-bsdi[23]*)
1646    ans=yes
1647    ;;
1648 *-*-freebsd*)
1649    ans=yes
1650    ;;
1651 *-*-netbsd*3.[0-8]*|*-*-netbsd*[0-2].*|*-*-netbsd*3.99.[0-7])
1652    ans=yes
1653    ;;
1654 *-*-openbsd*)
1655    ans=yes
1656    ;;
1657 *-*-osf*)
1658    ans=yes
1659    ;;
1660 *-*-darwin*)
1661    ans=yes
1662    ;;
1663 *) ans=no
1664    ;;
1665esac
1666ac_cv_func_ctty_for_f_setown=$ans]])
1667case "$ac_cv_func_ctty_for_f_setown" in
1668 yes) AC_DEFINE(USE_FSETOWNCTTY, 1, [Must we have a CTTY for fsetown?]) ;;
1669esac
1670
1671AC_CACHE_CHECK([if the OS fails to clear cached routes when more specific routes become available], ac_cv_os_routeupdates,
1672[[case "$host" in
1673 *-*-netbsd*)
1674    ans=yes
1675    ;;
1676 *) ans=no
1677    ;;
1678esac
1679ac_cv_os_routeupdates=$ans]])
1680case "$ac_cv_os_routeupdates" in
1681 yes) AC_DEFINE(OS_MISSES_SPECIFIC_ROUTE_UPDATES, 1, [need to recreate sockets on changed routing?]) ;;
1682esac
1683
1684AC_CACHE_CHECK([if the OS needs the wildcard socket set to REUSEADDR for binding interface addresses], ac_cv_os_wildcardreuse,
1685[[case "$host" in
1686 *-*-*linux*)
1687    ans=yes
1688    ;;
1689 *) ans=no
1690    ;;
1691esac
1692ac_cv_os_wildcardreuse=$ans]])
1693case "$ac_cv_os_wildcardreuse" in
1694 yes) AC_DEFINE(OS_NEEDS_REUSEADDR_FOR_IFADDRBIND, 1, [wildcard socket needs to set REUSEADDR when binding to interface addresses]) ;;
1695esac
1696
1697ntp_warning='GRONK'
1698AC_MSG_CHECKING([if we'll use clock_settime or settimeofday or stime])
1699case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
1700 yes*)
1701    ntp_warning=''
1702    ans='clock_settime()'
1703    ;;
1704 noyes*)
1705    ntp_warning='But clock_settime() would be better (if we had it)'
1706    ans='settimeofday()'
1707    ;;
1708 nonoyes)
1709    ntp_warning='Which is the worst of the three'
1710    ans='stime()'
1711    ;;
1712 *) 
1713    case "$build" in
1714     $host) ntp_warning='Which leaves us with nothing to use!'
1715    ans=none
1716    ;;
1717esac
1718esac
1719AC_MSG_RESULT([$ans])
1720case "$ntp_warning" in
1721 '') ;;
1722 *) AC_MSG_WARN([*** $ntp_warning ***])
1723    ;;
1724esac
1725
1726AC_CACHE_CHECK([if we have a losing syscall()], ac_cv_var_syscall_bug,
1727[case "$host" in
1728 *-*-solaris2.4*)
1729    ans=yes
1730    ;;
1731 *) ans=no
1732    ;;
1733esac
1734ac_cv_var_syscall_bug=$ans])
1735case "$ac_cv_var_syscall_bug" in
1736 yes) AC_DEFINE(SYSCALL_BUG, 1, [Buggy syscall() (Solaris2.4)?]) ;;
1737esac
1738
1739AC_CACHE_CHECK([for SIGIO], ac_cv_hdr_def_sigio,
1740 AC_EGREP_CPP(yes,
1741  [#include <signal.h>
1742#ifdef SIGIO
1743   yes
1744#endif
1745  ], ac_cv_hdr_def_sigio=yes, ac_cv_hdr_def_sigio=no))
1746
1747dnl Override those system that have a losing SIGIO
1748AC_CACHE_CHECK([if we want to use signalled IO], ac_cv_var_signalled_io,
1749[ans=no
1750case "$ac_cv_hdr_def_sigio" in
1751 yes)
1752    ans=yes
1753    case "$host" in
1754     alpha*-dec-osf4*|alpha*-dec-osf5*)
1755        ans=no
1756        ;;
1757     *-convex-*)
1758        ans=no
1759        ;;
1760     *-dec-*)
1761        ans=no
1762        ;;
1763     *-pc-cygwin*)
1764	ans=no
1765	;;
1766     *-sni-sysv*)
1767        ans=no
1768        ;;
1769     *-univel-sysv*)
1770        ans=no
1771	;;
1772     *-*-irix6*)
1773	ans=no
1774	;;
1775     *-*-freebsd*)
1776	ans=no
1777	;;
1778     *-*-*linux*)
1779	ans=no
1780	;;
1781     *-*-unicosmp*)
1782	ans=no
1783	;;
1784    esac
1785    ;;
1786esac
1787ac_cv_var_signalled_io=$ans])
1788case "$ac_cv_var_signalled_io" in
1789 yes) AC_DEFINE(HAVE_SIGNALED_IO, 1, [Can we use SIGIO for tcp and udp IO?]) ;;
1790esac
1791
1792AC_CACHE_CHECK([for SIGPOLL], ac_cv_hdr_def_sigpoll,
1793 AC_EGREP_CPP(yes,
1794 [#include <signal.h>
1795#ifdef SIGPOLL
1796  yes
1797#endif
1798 ], ac_cv_hdr_def_sigpoll=yes, ac_cv_hdr_def_sigpoll=no))
1799
1800AC_CACHE_CHECK([for SIGSYS], ac_cv_hdr_def_sigsys,
1801 AC_EGREP_CPP(yes,
1802 [#include <signal.h>
1803#ifdef SIGSYS
1804  yes
1805#endif
1806 ], ac_cv_hdr_def_sigsys=yes, ac_cv_hdr_def_sigsys=no))
1807
1808AC_CACHE_CHECK([if we can use SIGPOLL for UDP I/O], ac_cv_var_use_udp_sigpoll,
1809[ans=no
1810case "$ac_cv_hdr_def_sigpoll" in
1811 yes)
1812    case "$host" in
1813     mips-sgi-irix*)
1814	ans=no
1815	;;
1816     vax-dec-bsd)
1817        ans=no
1818        ;;
1819     *-pc-cygwin*)
1820	ans=no
1821	;;
1822     *-sni-sysv*)
1823        ans=no
1824        ;;
1825     *-*-aix[[456]]*)
1826        ans=no
1827        ;;
1828     *-*-hpux*)
1829        ans=no
1830        ;;
1831     *-*-*linux*)
1832	ans=no
1833	;;
1834     *-*-osf*)
1835        ans=no
1836        ;;
1837     *-*-qnx*)
1838        ans=no
1839        ;;
1840     *-*-sunos*)
1841	ans=no
1842	;;
1843     *-*-solaris*)
1844	ans=no
1845	;;
1846     *-*-ultrix*)
1847        ans=no
1848        ;;
1849     *-*-unicosmp*)
1850        ans=no
1851        ;;
1852     *) ans=yes
1853        ;;
1854    esac
1855    ;;
1856esac
1857ac_cv_var_use_udp_sigpoll=$ans])
1858case "$ac_cv_var_use_udp_sigpoll" in
1859 yes) AC_DEFINE(USE_UDP_SIGPOLL, 1, [Can we use SIGPOLL for UDP?]) ;;
1860esac
1861
1862AC_CACHE_CHECK([if we can use SIGPOLL for TTY I/O], ac_cv_var_use_tty_sigpoll,
1863[ans=no
1864case "$ac_cv_hdr_def_sigpoll" in
1865 yes)
1866    case "$host" in
1867     mips-sgi-irix*)
1868        ans=no
1869        ;;
1870     vax-dec-bsd)
1871        ans=no
1872        ;;
1873     *-pc-cygwin*)
1874	ans=no
1875	;;
1876     *-sni-sysv*)
1877        ans=no
1878        ;;
1879     *-*-aix[[456]]*)
1880	ans=no
1881	;;
1882     *-*-hpux*)
1883        ans=no
1884        ;;
1885     *-*-*linux*)
1886	ans=no
1887	;;
1888     *-*-osf*)
1889        ans=no
1890        ;;
1891     *-*-sunos*)
1892	ans=no
1893	;;
1894     *-*-ultrix*)
1895        ans=no
1896        ;;
1897     *-*-qnx*)
1898        ans=no
1899        ;;
1900     *-*-unicosmp*)
1901        ans=no
1902        ;;
1903     *) ans=yes
1904        ;;
1905    esac
1906    ;;
1907esac
1908ac_cv_var_use_tty_sigpoll=$ans])
1909case "$ac_cv_var_use_tty_sigpoll" in
1910 yes) AC_DEFINE(USE_TTY_SIGPOLL, 1, [Can we use SIGPOLL for tty IO?]) ;;
1911esac
1912
1913case "$ac_cv_header_sys_sio_h" in
1914 yes)
1915    AC_CACHE_CHECK([sys/sio.h for TIOCDCDTIMESTAMP], ac_cv_hdr_def_tiocdcdtimestamp,
1916     AC_EGREP_CPP(yes,
1917[#include <sys/sio.h>
1918#ifdef TIOCDCDTIMESTAMP
1919  yes
1920#endif
1921     ], ac_cv_hdr_def_tiocdcdtimestamp=yes, ac_cv_hdr_def_tiocdcdtimestamp=no))
1922    ;;
1923esac
1924
1925case "$ac_cv_hdr_def_tiocdcdtimestamp" in
1926 yes)
1927    ac_cv_var_oncore_ok=yes
1928    ;;
1929esac
1930
1931AC_CACHE_CHECK([if nlist() values might require extra indirection],
1932ac_cv_var_nlist_extra_indirection,
1933[ans=no
1934case "$host" in
1935 *-*-aix*)
1936    ans=yes
1937    ;;
1938esac
1939ac_cv_var_nlist_extra_indirection=$ans])
1940case "$ac_cv_var_nlist_extra_indirection" in
1941 yes) AC_DEFINE(NLIST_EXTRA_INDIRECTION, 1, [Might nlist() values require an extra level of indirection (AIX)?]) ;;
1942esac
1943
1944AC_CACHE_CHECK([for a minimum recommended value of tickadj],
1945ac_cv_var_min_rec_tickadj,
1946[ans=no
1947case "$host" in
1948 *-*-aix*)
1949    ans=40
1950    ;;
1951esac
1952ac_cv_var_min_rec_tickadj=$ans])
1953case "$ac_cv_var_min_rec_tickadj" in
1954 ''|no) ;;
1955 *) AC_DEFINE_UNQUOTED(MIN_REC_TICKADJ, $ac_cv_var_min_rec_tickadj, [Should we recommend a minimum value for tickadj?]) ;;
1956esac
1957
1958AC_CACHE_CHECK([if the TTY code permits PARENB and IGNPAR],
1959ac_cv_var_no_parenb_ignpar,
1960[ans=no
1961case "$host" in
1962 i?86-*-*linux*)
1963    ans=yes
1964    ;;
1965 mips-sgi-irix*)
1966    ans=yes
1967    ;;
1968 i?86-*-freebsd[[123]].*)
1969    ;;
1970 i?86-*-freebsd*)
1971    ans=yes
1972    ;;
1973 *-*-unicosmp*)
1974    ans=yes
1975    ;;
1976esac
1977ac_cv_var_no_parenb_ignpar=$ans])
1978case "$ac_cv_var_no_parenb_ignpar" in
1979 yes) AC_DEFINE(NO_PARENB_IGNPAR, 1, [Is there a problem using PARENB and IGNPAR (IRIX)?]) ;;
1980esac
1981
1982AC_MSG_CHECKING([if we're including debugging code])
1983AC_ARG_ENABLE(debugging,
1984   AC_HELP_STRING([--enable-debugging], [+ include debugging code]),
1985    [ntp_ok=$enableval], [ntp_ok=yes])
1986if test "$ntp_ok" = "yes"; then
1987    AC_DEFINE(DEBUG, 1, [Enable debugging?])
1988fi
1989AC_MSG_RESULT($ntp_ok)
1990
1991AC_MSG_CHECKING([if we including processing time debugging code])
1992AC_ARG_ENABLE(debug-timing,
1993   AC_HELP_STRING([--enable-debug-timing], [- include processing time debugging code (costs performance)]),
1994    [ntp_ok=$enableval], [ntp_ok=no])
1995if test "$ntp_ok" = "yes"; then
1996    AC_DEFINE(DEBUG_TIMING, 1, [Enable processing time debugging?])
1997fi
1998AC_MSG_RESULT($ntp_ok)
1999
2000AC_MSG_C…

Large files files are truncated, but you can click here to view the full file