dnl Copyright (c)1997-1998 Begemot Computer Associates. All rights reserved. dnl See the file COPYRIGHT for details of redistribution and use. dnl dnl $Id: configure.in,v 1.10 1999/10/27 18:44:05 hbb Exp $ dnl AC_INIT(intro.man) AC_CONFIG_AUX_DIR(config) AC_CANONICAL_HOST AC_PROG_CC AC_PROG_CPP AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) dnl ------------------------------------------------------------ dnl Figure out, how the times are stored in struct stat. There dnl are at least four variants: st_atime, which are time_t's dnl (BDS/OS 1.0), st_atimespec, which is a timeval, st_atimespec dnl which is a timespec and st_atim, which is a timeval. dnl We got the following route: dnl 1. figure out, if we have timespecs dnl 1.1 if yes: find out wheter it contains tv_sec or ts_sec dnl 2. else figure out if we have timevals dnl 2.1 if yes: find out if we need to declare cftime dnl 3. else assume we have time_t's dnl ------------------------------------------------------------ AC_CACHE_CHECK([whether struct stat times are timespecs], ac_cv_stat_has_timespec, AC_TRY_COMPILE([ # include # include # include ], [struct stat statb; (void)memset(&statb.st_atimespec, 0, 10)], ac_cv_stat_has_timespec=yes, ac_cv_stat_has_timespec=no)) if test $ac_cv_stat_has_timespec = yes ; then AC_DEFINE(STAT_HAS_TIMESPEC) fi if test $ac_cv_stat_has_timespec = yes ; then AC_CACHE_CHECK([whether timespecs have ts_sec (instead of tv_sec)], ac_cv_timespec_has_ts, AC_TRY_COMPILE([ # include # include ], [struct stat statb; statb.st_atimespec.ts_nsec = 12], ac_cv_timespec_has_ts=yes, ac_cv_timespec_has_ts=no)) if test $ac_cv_timespec_has_ts = yes ; then AC_DEFINE(TIMESPEC_HAS_TS) fi else AC_CACHE_CHECK([whether struct stat times are timevals], ac_cv_stat_has_timeval, AC_TRY_COMPILE([ # include # include ], [struct stat statb; (void)memset(&statb.st_atim, 0, 10)], ac_cv_stat_has_timeval=yes, ac_cv_stat_has_timeval=no)) if test $ac_cv_stat_has_timeval = yes ; then AC_DEFINE(STAT_HAS_TIMEVAL) AC_CACHE_CHECK([whether time.h declares cftime], ac_cv_decl_cftime, AC_EGREP_HEADER(cftime, time.h, ac_cv_decl_cftime=yes, ac_cv_decl_cftime=no)) if test $ac_cv_decl_cftime = no ; then AC_DEFINE(DECL_CFTIME) fi fi fi dnl ------------------------------------------------------------ dnl look for the st_fstype member in struct stat. On Solaris dnl this is a string we can print. dnl ------------------------------------------------------------ AC_CACHE_CHECK([whether struct stat has st_fstype], ac_cv_fstype, AC_TRY_COMPILE([ # include # include ], [struct stat statb; foo(&statb.st_fstype], ac_cv_fstype=yes, ac_cv_fstype=no)) if test $ac_cv_fstype = yes ; then AC_DEFINE(STAT_HAS_FSTYPE) fi dnl ------------------------------------------------------------ dnl Look for streams. If we have them use poll(2) for the poll_ dnl functions. Else use select(). In theory this are entirely dnl different things. Maybe we should always use select(2). dnl XXX if we use select, we should figure out, whether it dnl leaves the remaining time in the time value, if it returns dnl due to a ready file descriptor. This could save us a system call dnl ------------------------------------------------------------ AC_CHECK_HEADER(stropts.h, AC_DEFINE(HAVE_STREAMS) use_poll=yes AC_DEFINE(USE_POLL), use_poll=no AC_DEFINE(USE_SELECT)) dnl ------------------------------------------------------------ dnl dnl figure out, whether we have to fiddle with USE_XOPEN under F... linux. dnl dnl ------------------------------------------------------------ if test $use_poll = "yes" ; then AC_EGREP_CPP(yes, [# include # ifndef POLLRDNORM yes # endif ], AC_DEFINE(NEED_POLL_XOPEN_TWIDDLE)) fi dnl ------------------------------------------------------------ dnl These are needed on Solaris dnl ------------------------------------------------------------ AC_CHECK_HEADER(sys/sysmacros.h, AC_DEFINE(HAVE_SYSMACROS)) dnl ------------------------------------------------------------ dnl BSD4.4 (I think) changed the way rights are passed accross dnl a socket. Find out whether we have the old or the new struct dnl msghdr. dnl ------------------------------------------------------------ AC_CACHE_CHECK([whether we have the historical struct msghdr], ac_cv_oldmsghdr, AC_TRY_COMPILE([ # include # include ], [struct msghdr msg; msg.msg_control = 0], ac_cv_oldmsghdr=no, ac_cv_oldmsghdr=yes)) if test $ac_cv_oldmsghdr = yes ; then AC_DEFINE(HAVE_OLDMSGHDR) fi dnl ------------------------------------------------------------ dnl Quads are printed differently on different systems. Figure dnl out how to do it. dnl ------------------------------------------------------------ AC_CACHE_CHECK([how to print quads], ac_cv_quad_fmt, AC_TRY_RUN( [ changequote(<<, >>)dnl # include # include # include int main() { char buf[100]; sprintf(buf, "%qx", 0x1234567887654321LLU); exit((strcmp(buf, "1234567887654321") == 0) ? 0 : 1); } changequote([, ]) ], ac_cv_quad_fmt=q, ac_cv_quad_fmt=ll, ac_cv_quad_fmt=ll)) AC_DEFINE_UNQUOTED(QUADFMT, "$ac_cv_quad_fmt") dnl ------------------------------------------------------------ dnl The following is really hard to figure out. We would need a dnl test program the compilation of which depends on other config options. dnl Let's define it statically for now. It seems, that dnl the Solaris 2.5 socket emulation has a brokeness. dnl ------------------------------------------------------------ AC_MSG_CHECKING([whether send fd is broken]) case $host_os in solaris2.6|solaris2.7) ac_send_fd_bug=no ;; solaris*) ac_send_fd_bug=yes ;; *) ac_send_fd_bug=no ;; esac AC_MSG_RESULT([$ac_send_fd_bug]) if test $ac_send_fd_bug = yes; then AC_DEFINE(SEND_FD_BUG) fi dnl ------------------------------------------------------------ dnl Figure out, which library we need for sendmsg/recvmsg and dnl socketpair. Use the right order of test to get Solaris 2.6 dnl right. dnl ------------------------------------------------------------ SYSLIBS= AC_CHECK_LIB(xnet, socketpair, SYSLIBS="$SYSLIBS -lxnet", AC_CHECK_LIB(socket, socketpair, SYSLIBS="$SYSLIBS -lsocket -lnsl", , -lnsl)) AC_SUBST(SYSLIBS) dnl ------------------------------------------------------------ dnl HP/UX has definitions for fd_set, but fails to use these in dnl the prototype of select. Figure out, whether the prototype dnl is correct. dnl ------------------------------------------------------------ AC_MSG_CHECKING([whether select prototype is broken]) AC_EGREP_CPP(changequote(<<, >>)<>dnl changequote([, ]),[ # include # include # include ], ac_broken_select=no, ac_broken_select=yes) AC_MSG_RESULT([$ac_broken_select]) if test $ac_broken_select = yes; then AC_DEFINE(BROKEN_SELECT_PROTO) fi dnl ------------------------------------------------------------ dnl Check whether this is f.... Linux, which defines POLL_IN/OUT. dnl ------------------------------------------------------------ AC_MSG_CHECKING([whether signal.h defines POLL_{IN,OUT}]) AC_EGREP_CPP(yes,[ #include #ifdef POLL_IN yes #endif ], ac_defined_pollin=yes, ac_defined_pollin=no) AC_MSG_RESULT([$ac_defined_pollin]) if test $ac_defined_pollin = yes ; then DEFINED_POLLIN=1 else DEFINED_POLLIN=0 fi AC_SUBST(DEFINED_POLLIN) dnl ------------------------------------------------------------ AC_OUTPUT(Makefile rpoll.h)