~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-m4/fcntl_h.m4

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# serial 12
1
2
# Configure fcntl.h.
2
 
dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
3
dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
3
4
dnl This file is free software; the Free Software Foundation
4
5
dnl gives unlimited permission to copy and/or distribute it,
5
6
dnl with or without modifications, as long as this notice is preserved.
9
10
AC_DEFUN([gl_FCNTL_H],
10
11
[
11
12
  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
12
 
  AC_CACHE_CHECK([for working fcntl.h], gl_cv_header_working_fcntl_h,
13
 
    [AC_RUN_IFELSE(
14
 
       [AC_LANG_PROGRAM(
15
 
          [[#include <sys/types.h>
16
 
           #include <sys/stat.h>
17
 
           #include <unistd.h>
18
 
           #include <fcntl.h>
19
 
           #ifndef O_NOATIME
20
 
            #define O_NOATIME 0
21
 
           #endif
22
 
           #ifndef O_NOFOLLOW
23
 
            #define O_NOFOLLOW 0
24
 
           #endif
25
 
           static int const constants[] =
26
 
            {
27
 
              O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
28
 
              O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
29
 
            };
30
 
          ]],
31
 
          [[
32
 
            int status = !constants;
33
 
            {
34
 
              static char const sym[] = "conftest.sym";
35
 
              if (symlink (".", sym) != 0
36
 
                  || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
37
 
                status |= 32;
38
 
            }
39
 
            {
40
 
              static char const file[] = "confdefs.h";
41
 
              int fd = open (file, O_RDONLY | O_NOATIME);
42
 
              char c;
43
 
              struct stat st0, st1;
44
 
              if (fd < 0
45
 
                  || fstat (fd, &st0) != 0
46
 
                  || sleep (1) != 0
47
 
                  || read (fd, &c, 1) != 1
48
 
                  || close (fd) != 0
49
 
                  || stat (file, &st1) != 0
50
 
                  || st0.st_atime != st1.st_atime)
51
 
                status |= 64;
52
 
            }
53
 
            return status;]])],
54
 
       [gl_cv_header_working_fcntl_h=yes],
55
 
       [case $? in #(
56
 
        32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
57
 
        64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
58
 
        96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
59
 
         *) gl_cv_header_working_fcntl_h='no';;
60
 
        esac],
61
 
       [gl_cv_header_working_fcntl_h=cross-compiling])])
62
 
 
63
 
  case $gl_cv_header_working_fcntl_h in #(
64
 
  *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
65
 
  *) ac_val=1;;
66
 
  esac
67
 
  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
68
 
    [Define to 1 if O_NOATIME works.])
69
 
 
70
 
  case $gl_cv_header_working_fcntl_h in #(
71
 
  *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
72
 
  *) ac_val=1;;
73
 
  esac
74
 
  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
75
 
    [Define to 1 if O_NOFOLLOW works.])
76
 
 
 
13
  AC_REQUIRE([gl_FCNTL_O_FLAGS])
77
14
  gl_CHECK_NEXT_HEADERS([fcntl.h])
78
 
  FCNTL_H='fcntl.h'
79
 
  AC_SUBST([FCNTL_H])
 
15
 
 
16
  dnl Check for declarations of anything we want to poison if the
 
17
  dnl corresponding gnulib module is not in use, if it is not common
 
18
  dnl enough to be declared everywhere.
 
19
  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
 
20
    ]], [fcntl openat])
80
21
])
81
22
 
82
23
AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
83
24
[
84
25
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
85
26
  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
86
 
  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
 
27
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
 
28
  dnl Define it also as a C macro, for the benefit of the unit tests.
 
29
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
87
30
])
88
31
 
89
32
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
90
33
[
91
 
  GNULIB_OPEN=0;  AC_SUBST([GNULIB_OPEN])
 
34
  GNULIB_FCNTL=0;   AC_SUBST([GNULIB_FCNTL])
 
35
  GNULIB_OPEN=0;    AC_SUBST([GNULIB_OPEN])
 
36
  GNULIB_OPENAT=0;  AC_SUBST([GNULIB_OPENAT])
92
37
  dnl Assume proper GNU behavior unless another module says otherwise.
93
 
  REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
 
38
  HAVE_FCNTL=1;     AC_SUBST([HAVE_FCNTL])
 
39
  HAVE_OPENAT=1;    AC_SUBST([HAVE_OPENAT])
 
40
  REPLACE_FCNTL=0;  AC_SUBST([REPLACE_FCNTL])
 
41
  REPLACE_OPEN=0;   AC_SUBST([REPLACE_OPEN])
 
42
  REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
94
43
])