annotate m4/stdint_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 f6cba5a556ce
children c2cbabec01dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10979
diff changeset
1 # stdint_h.m4 serial 8
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10979
diff changeset
2 dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
5585
adff74659d81 Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents: 5019
diff changeset
3 dnl This file is free software; the Free Software Foundation
adff74659d81 Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents: 5019
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
adff74659d81 Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents: 5019
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 dnl From Paul Eggert.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 # doesn't clash with <sys/types.h>, and declares uintmax_t.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11
5016
7141ea4946af Change jm_ to gl_ in AC_DEFINE'd names. Update all uses.
Jim Meyering <jim@meyering.net>
parents: 4334
diff changeset
12 AC_DEFUN([gl_AC_HEADER_STDINT_H],
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 [
10979
03e819eea554 More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 7185
diff changeset
14 AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 [AC_TRY_COMPILE(
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 [#include <sys/types.h>
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 #include <stdint.h>],
7185
90f5608d1c64 * stdint_h.m4 (gl_AC_HEADER_STDINT_H): Avoid compiler warning.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5585
diff changeset
18 [uintmax_t i = (uintmax_t) -1; return !i;],
10979
03e819eea554 More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 7185
diff changeset
19 [gl_cv_header_stdint_h=yes],
03e819eea554 More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents: 7185
diff changeset
20 [gl_cv_header_stdint_h=no])])
5019
3c49e2a96a18 jm_ac_ -> gl_
Bruno Haible <bruno@clisp.org>
parents: 5016
diff changeset
21 if test $gl_cv_header_stdint_h = yes; then
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10979
diff changeset
22 AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 and declares uintmax_t. ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 fi
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 ])