Fix bug #6421 - POSIX read-only open fails on read-only shares.
[ira/wip.git] / lib / replace / system / config.m4
1 # filesys
2 AC_HEADER_DIRENT 
3 AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h)
4 AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
5
6 # select
7 AC_CHECK_HEADERS(sys/select.h)
8
9 # time
10 AC_CHECK_HEADERS(sys/time.h utime.h)
11 AC_HEADER_TIME
12 AC_CHECK_FUNCS(utime utimes)
13
14 # wait
15 AC_HEADER_SYS_WAIT
16
17 # capability
18 AC_CHECK_HEADERS(sys/capability.h)
19
20 case "$host_os" in
21 *linux*)
22 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
23 AC_TRY_COMPILE([
24         #ifdef HAVE_SYS_VFS_H
25         #include <sys/vfs.h>
26         #endif
27         #ifdef HAVE_SYS_CAPABILITY_H
28         #include <sys/capability.h>
29         #endif
30         ],[
31         int i;
32         ],
33         libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,
34         libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes
35 )])
36 if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
37         AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
38 fi
39
40 AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[
41 AC_TRY_COMPILE([
42         #ifdef HAVE_SYS_CAPABILITY_H
43         #include <sys/capability.h>
44         #endif
45         #include <linux/types.h>
46         ],[
47         __s8 i;
48         ],
49         libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no,
50         libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
51 )])
52 if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
53         AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h])
54 fi
55 ;;
56 esac
57
58 # passwd
59 AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h)
60 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getpwent_r)
61 AC_HAVE_DECL(getpwent_r, [
62         #include <unistd.h>
63         #include <pwd.h>
64         ])
65 AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)],
66         [
67         #ifndef HAVE_GETPWENT_R_DECL
68         #error missing getpwent_r prototype
69         #endif
70         return NULL;
71         ],[
72         AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r solaris function prototype])
73         ],[],[
74         #include <unistd.h>
75         #include <pwd.h>
76         ])
77 AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
78         [
79         #ifndef HAVE_GETPWENT_R_DECL
80         #error missing getpwent_r prototype
81         #endif
82         return NULL;
83         ],[
84         AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
85         ],[],[
86         #include <unistd.h>
87         #include <pwd.h>
88         ])
89 AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
90 AC_HAVE_DECL(getgrent_r, [
91         #include <unistd.h>
92         #include <grp.h>
93         ])
94 AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, int buflen)],
95         [
96         #ifndef HAVE_GETGRENT_R_DECL
97         #error missing getgrent_r prototype
98         #endif
99         return NULL;
100         ],[
101         AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r solaris function prototype])
102         ],[],[
103         #include <unistd.h>
104         #include <grp.h>
105         ])
106
107 AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
108         [
109         #ifndef HAVE_GETGRENT_R_DECL
110         #error missing getgrent_r prototype
111         #endif
112         return NULL;
113         ],[
114         AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris)  function prototype])
115         ],[],[
116         #include <unistd.h>
117         #include <grp.h>
118         ])
119
120 # locale
121 AC_CHECK_HEADERS(ctype.h locale.h)
122
123 # glob
124 AC_CHECK_HEADERS(fnmatch.h)
125
126 # shmem
127 AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h )
128
129 # terminal
130 AC_CHECK_HEADERS(termios.h termio.h sys/termio.h )