Merge branch 'master' of ctdb into 'master' of samba
[samba.git] / ctdb / 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 sys/file.h)
5
6 # select
7 AC_CHECK_HEADERS(sys/select.h)
8
9 # poll
10 AC_CHECK_HEADERS(poll.h)
11 AC_CHECK_FUNCS(poll,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/poll.o"])
12
13 # time
14 AC_CHECK_HEADERS(sys/time.h utime.h)
15 AC_HEADER_TIME
16 AC_CHECK_FUNCS(utime utimes)
17
18 AC_CACHE_CHECK([if gettimeofday takes TZ argument],libreplace_cv_HAVE_GETTIMEOFDAY_TZ,[
19 AC_TRY_RUN([
20 #include <sys/time.h>
21 #include <unistd.h>
22 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
23            libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=no,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes)])
24 if test x"$libreplace_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
25     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
26 fi
27
28 # wait
29 AC_HEADER_SYS_WAIT
30
31 # capability
32 AC_CHECK_HEADERS(sys/capability.h)
33
34 case "$host_os" in
35 *linux*)
36 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
37 AC_TRY_COMPILE([
38         #ifdef HAVE_SYS_VFS_H
39         #include <sys/vfs.h>
40         #endif
41         #ifdef HAVE_SYS_CAPABILITY_H
42         #include <sys/capability.h>
43         #endif
44         ],[
45         int i;
46         ],
47         libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,
48         libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes
49 )])
50 if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
51         AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
52 fi
53
54 AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[
55 AC_TRY_COMPILE([
56         #ifdef HAVE_SYS_CAPABILITY_H
57         #include <sys/capability.h>
58         #endif
59         #include <linux/types.h>
60         ],[
61         __s8 i;
62         ],
63         libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no,
64         libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
65 )])
66 if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
67         AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h])
68 fi
69 ;;
70 esac
71
72 # passwd
73 AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h)
74 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getpwent_r)
75 AC_HAVE_DECL(getpwent_r, [
76         #include <unistd.h>
77         #include <pwd.h>
78         ])
79 AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)],
80         [
81         #ifndef HAVE_GETPWENT_R_DECL
82         #error missing getpwent_r prototype
83         #endif
84         return NULL;
85         ],[
86         AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r solaris function prototype])
87         ],[],[
88         #include <unistd.h>
89         #include <pwd.h>
90         ])
91 AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
92         [
93         #ifndef HAVE_GETPWENT_R_DECL
94         #error missing getpwent_r prototype
95         #endif
96         return NULL;
97         ],[
98         AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
99         ],[],[
100         #include <unistd.h>
101         #include <pwd.h>
102         ])
103 AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
104 AC_HAVE_DECL(getgrent_r, [
105         #include <unistd.h>
106         #include <grp.h>
107         ])
108 AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, int buflen)],
109         [
110         #ifndef HAVE_GETGRENT_R_DECL
111         #error missing getgrent_r prototype
112         #endif
113         return NULL;
114         ],[
115         AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r solaris function prototype])
116         ],[],[
117         #include <unistd.h>
118         #include <grp.h>
119         ])
120
121 AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
122         [
123         #ifndef HAVE_GETGRENT_R_DECL
124         #error missing getgrent_r prototype
125         #endif
126         return NULL;
127         ],[
128         AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris)  function prototype])
129         ],[],[
130         #include <unistd.h>
131         #include <grp.h>
132         ])
133 AC_CHECK_FUNCS(getgrouplist)
134
135 # locale
136 AC_CHECK_HEADERS(ctype.h locale.h langinfo.h)
137
138 # glob
139 AC_CHECK_HEADERS(fnmatch.h)
140
141 # shmem
142 AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h )
143
144 # terminal
145 AC_CHECK_HEADERS(termios.h termio.h sys/termio.h )