-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathacinclude.m4
159 lines (134 loc) · 3.53 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
dnl Checks for required headers and functions
dnl
dnl Version: 20190308
dnl Function to detect if posix_fadvise is available
AC_DEFUN([AX_LIBCFILE_CHECK_FUNC_POSIX_FADVISE],
[AC_CHECK_FUNCS([posix_fadvise])
AS_IF(
[test "x$ac_cv_func_posix_fadvise" = xyes],
[AC_MSG_CHECKING(
[whether posix_fadvise can be linked])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_LANG_PUSH(C)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <fcntl.h>]],
[[#if !defined( POSIX_FADV_SEQUENTIAL )
#define POSIX_FADV_SEQUENTIAL 2
#endif
posix_fadvise( 0, 0, 0, POSIX_FADV_SEQUENTIAL )]] )],
[ac_cv_func_posix_fadvise=yes],
[ac_cv_func_posix_fadvise=no])
AC_LANG_POP(C)
CFLAGS="$SAVE_CFLAGS"
AS_IF(
[test "x$ac_cv_func_posix_fadvise" = xyes],
[AC_MSG_RESULT(
[yes])
AC_DEFINE(
[HAVE_POSIX_FADVISE],
[1],
[Define to 1 if you have the posix_fadvise function.]) ],
[AC_MSG_RESULT(
[no]) ])
])
])
dnl Function to detect if libcfile dependencies are available
AC_DEFUN([AX_LIBCFILE_CHECK_LOCAL],
[dnl Headers included in libcfile/libcfile_file.c and libcfile/libcfile_support.c
AC_CHECK_HEADERS([errno.h stdio.h sys/stat.h])
dnl Headers included in libcfile/libcfile_file.c
AC_CHECK_HEADERS([cygwin/fs.h fcntl.h linux/fs.h sys/disk.h sys/disklabel.h sys/ioctl.h unistd.h])
dnl File input/output functions used in libcfile/libcfile_file.c
AC_CHECK_FUNCS([close fstat ftruncate ioctl lseek open read write])
AS_IF(
[test "x$ac_cv_func_close" != xyes],
[AC_MSG_FAILURE(
[Missing function: close],
[1])
])
AX_LIBCFILE_CHECK_FUNC_POSIX_FADVISE
AS_IF(
[test "x$ac_cv_func_fstat" != xyes],
[AC_MSG_FAILURE(
[Missing function: fstat],
[1])
])
AS_IF(
[test "x$ac_cv_func_ftruncate" != xyes],
[AC_MSG_FAILURE(
[Missing function: ftruncate],
[1])
])
AS_IF(
[test x"$ac_cv_enable_winapi" = xno],
[AS_IF(
[test "x$ac_cv_func_ioctl" != xyes],
[AC_MSG_FAILURE(
[Missing function: ioctl],
[1])
])
])
AS_IF(
[test "x$ac_cv_func_lseek" != xyes],
[AC_MSG_FAILURE(
[Missing function: lseek],
[1])
])
AS_IF(
[test "x$ac_cv_func_open" != xyes],
[AC_MSG_FAILURE(
[Missing function: open],
[1])
])
AS_IF(
[test "x$ac_cv_func_read" != xyes],
[AC_MSG_FAILURE(
[Missing function: read],
[1])
])
AS_IF(
[test "x$ac_cv_func_write" != xyes],
[AC_MSG_FAILURE(
[Missing function: write],
[1])
])
dnl File input/output functions used in libcfile/libcfile_support.c
AC_CHECK_FUNCS([stat unlink])
AS_IF(
[test "x$ac_cv_func_stat" != xyes],
[AC_MSG_FAILURE(
[Missing function: stat],
[1])
])
AS_IF(
[test "x$ac_cv_func_unlink" != xyes],
[AC_MSG_FAILURE(
[Missing function: unlink],
[1])
])
])
dnl Function to check if DLL support is needed
AC_DEFUN([AX_LIBCFILE_CHECK_DLL_SUPPORT],
[AS_IF(
[test "x$enable_shared" = xyes],
[AS_CASE(
[$host],
[*cygwin* | *mingw* | *msys*],
[AC_DEFINE(
[HAVE_DLLMAIN],
[1],
[Define to 1 to enable the DllMain function.])
AC_SUBST(
[HAVE_DLLMAIN],
[1])
AC_SUBST(
[LIBCFILE_DLL_EXPORT],
["-DLIBCFILE_DLL_EXPORT"])
AC_SUBST(
[LIBCFILE_DLL_IMPORT],
["-DLIBCFILE_DLL_IMPORT"])
])
])
])