diff --git a/configure.ac b/configure.ac index 155061e98..a63cf9bc2 100644 --- a/configure.ac +++ b/configure.ac @@ -1420,7 +1420,7 @@ MERCURY_CHECK_FOR_HEADERS( \ sys/types.h sys/stat.h fcntl.h termios.h sys/ioctl.h \ sys/resource.h sys/stropts.h windows.h dirent.h getopt.h malloc.h \ semaphore.h pthread.h time.h spawn.h fenv.h sys/mman.h sys/sem.h \ - sched.h utmpx.h dispatch/dispatch.h stdint.h) + sched.h utmpx.h dispatch/dispatch.h stdint.h sys/select.h ) if test "$MR_HAVE_GETOPT_H" = 1; then GETOPT_H_AVAILABLE=yes @@ -2426,6 +2426,9 @@ AC_MSG_CHECKING(to see if we can handle contexts blocking on IO) AC_CACHE_VAL(mercury_cv_can_do_pending_io, AC_TRY_RUN( [ + #ifdef MR_HAVE_SYS_SELECT_H + #include + #endif #include #include int main() { diff --git a/runtime/mercury_conf.h.in b/runtime/mercury_conf.h.in index 99d4d1ad2..7a46afa26 100644 --- a/runtime/mercury_conf.h.in +++ b/runtime/mercury_conf.h.in @@ -140,7 +140,8 @@ // MR_HAVE_UTMPX_H we have // MR_HAVE_SYS_RESOURCE_H we have // MR_HAVE_DISPATCH_DISPATCH_H we have -// MR_HAVE_STDINT we have +// MR_HAVE_STDINT_H we have +// MR_HAVE_SYS_SELECT_H we have #undef MR_HAVE_SYS_SIGINFO_H #undef MR_HAVE_SYS_SIGNAL_H @@ -175,6 +176,7 @@ #undef MR_HAVE_SYS_RESOURCE_H #undef MR_HAVE_DISPATCH_DISPATCH_H #undef MR_HAVE_STDINT_H +#undef MR_HAVE_SYS_SELECT_H // MR_HAVE_POSIX_TIMES is defined if we have the POSIX // `struct tms' struct and times() function. diff --git a/runtime/mercury_reg_workarounds.c b/runtime/mercury_reg_workarounds.c index 0464a48fd..943fb5ed2 100644 --- a/runtime/mercury_reg_workarounds.c +++ b/runtime/mercury_reg_workarounds.c @@ -14,15 +14,19 @@ #ifdef MR_CAN_DO_PENDING_IO - #ifdef MR_BZERO_NEEDS_STRINGS_HEADER - #include - #endif +#ifdef MR_BZERO_NEEDS_STRINGS_HEADER + #include +#endif -#include // for fd_set and FD_ZERO() -#include // for FD_ZERO() +#ifdef MR_HAVE_SYS_SELECT_H + #include // for select() -- POSIX +#endif + +#include // for fd_set and FD_ZERO() +#include // for FD_ZERO() #ifdef MR_HAVE_UNISTD_H - #include // for FD_ZERO() + #include // for FD_ZERO() #endif void diff --git a/runtime/mercury_reg_workarounds.h b/runtime/mercury_reg_workarounds.h index f4fb2bcfd..f260c655c 100644 --- a/runtime/mercury_reg_workarounds.h +++ b/runtime/mercury_reg_workarounds.h @@ -12,6 +12,9 @@ #include "mercury_conf.h" #ifdef MR_CAN_DO_PENDING_IO + #ifdef MR_HAVE_SYS_SELECT_H + #include // for select() -- POSIX + #endif #include // for fd_set #include // for FD_ZERO() #endif