Mercurial > hg > octave-jordi > gnulib-hg
view m4/sys_time_h.m4 @ 12454:f7624052e60d
fcntl: support F_DUPFD_CLOEXEC on systems with fcntl
Implement F_DUPFD_CLOEXEC. The unit test still fails on systems
with other fcntl bugs (such as cygwin 1.5 mishandling F_DUPFD,
or mingw lacking fcntl altogether). Passes on Linux, both with
and without kernel support, and on cygwin 1.7.
* modules/fcntl (Files): List new files.
(configure.ac): Run a test.
* m4/fcntl.m4 (gl_FUNC_FCNTL): New file.
* lib/fcntl.c (rpl_fcntl): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness defaults.
(gl_FCNTL_H): Always replace fcntl.h.
* modules/fcntl-h (Makefile.am): Substitute witnesses.
* lib/fcntl.in.h (fcntl): Declare replacement.
(F_DUPFD_CLOEXEC, GNULIB_defined_F_DUPFD_CLOEXEC): New macro when
needed, plus a witness.
* doc/posix-functions/fcntl.texi (fcntl): Document this.
* doc/posix-headers/fcntl.texi (fcntl.h): Likewise.
* tests/test-fcntl.c: New file.
* modules/fcntl-tests: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 07 Dec 2009 11:50:59 -0700 |
parents | e8d2c6fc33ad |
children | b5e42ef33b49 |
line wrap: on
line source
# Configure a replacement for <sys/time.h>. # Copyright (C) 2007 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert and Martin Lambers. AC_DEFUN([gl_HEADER_SYS_TIME_H], [ dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 dnl statements that occur in other macros. AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY]) ]) AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) gl_CHECK_NEXT_HEADERS([sys/time.h]) if test $ac_cv_header_sys_time_h = yes; then HAVE_SYS_TIME_H=1 else HAVE_SYS_TIME_H=0 fi AC_SUBST([HAVE_SYS_TIME_H]) AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#if HAVE_SYS_TIME_H #include <sys/time.h> #endif #include <time.h> ]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])], [gl_cv_sys_struct_timeval=yes], [gl_cv_sys_struct_timeval=no])]) if test $gl_cv_sys_struct_timeval = yes; then HAVE_STRUCT_TIMEVAL=1 else HAVE_STRUCT_TIMEVAL=0 fi AC_SUBST([HAVE_STRUCT_TIMEVAL]) dnl Assume POSIX behavior unless another module says otherwise. REPLACE_GETTIMEOFDAY=0 AC_SUBST([REPLACE_GETTIMEOFDAY]) if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then SYS_TIME_H=sys/time.h else SYS_TIME_H= fi AC_SUBST([SYS_TIME_H]) ])