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