-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathacinclude.m4
More file actions
187 lines (159 loc) · 4.57 KB
/
acinclude.m4
File metadata and controls
187 lines (159 loc) · 4.57 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
dnl Checks for required headers and functions
dnl
dnl Version: 20240520
dnl Check if winioctl.h defines STORAGE_BUS_TYPE
AC_DEFUN([AX_LIBSMDEV_CHECK_HEADER_WINIOCTL_H_STORAGE_BUS_TYPE],
[AC_CACHE_CHECK(
[whether winioctl.h defines STORAGE_BUS_TYPE],
[ac_cv_header_winioctl_h_storage_bus_type],
[AC_LANG_PUSH(C)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <windows.h>
#include <winioctl.h>]],
[[STORAGE_BUS_TYPE storage_bus_type;
storage_bus_type = BusTypeUnknown;]] )],
[ac_cv_header_winioctl_h_storage_bus_type=yes],
[ac_cv_header_winioctl_h_storage_bus_type=no])
AC_LANG_POP(C)],
[ac_cv_header_winioctl_h_storage_bus_type=no])
AS_IF(
[test "x$ac_cv_header_winioctl_h_storage_bus_type" = xyes],
[AC_DEFINE(
[HAVE_WINIOCTL_H_STORAGE_BUS_TYPE],
[1],
[Define to 1 if STORAGE_BUS_TYPE is defined.])
])
])
dnl Function to detect if libsmdev dependencies are available
AC_DEFUN([AX_LIBSMDEV_CHECK_LOCAL],
[dnl Headers included in libsmdev/libsmdev_handle.c and libsmdev/libsmdev_support.c
AC_CHECK_HEADERS([errno.h fcntl.h sys/stat.h unistd.h])
dnl Headers included in libsmdev/libsmdev_metadata.c
AS_IF(
[test "x$ac_cv_enable_winapi" = xno],
[AC_CHECK_HEADERS([cygwin/fs.h linux/fs.h sys/disk.h sys/disklabel.h])
])
dnl Headers included in libsmdev/libsmdev_ata.c
AS_IF(
[test "x$ac_cv_enable_winapi" = xno],
[AC_CHECK_HEADERS([cygwin/hdreg.h linux/hdreg.h])
])
dnl Headers included in libsmdev/libsmdev_scsi.c
AS_IF(
[test "x$ac_cv_enable_winapi" = xno],
[AC_CHECK_HEADERS([scsi/scsi.h scsi/scsi_ioctl.h scsi/sg.h])
])
dnl Headers included in libsmdev/libsmdev_optical_disk.c
AS_IF(
[test "x$ac_cv_enable_winapi" = xno],
[AC_CHECK_HEADERS([linux/cdrom.h])
])
dnl Headers included in libsmdev/libsmdev_usb.c
AS_IF(
[test "x$ac_cv_enable_winapi" = xno],
[AC_CHECK_HEADERS([linux/usbdevice_fs.h linux/usb/ch9.h sys/ioctl.h])
])
dnl File input/output functions used in libbfio/libbfio_file.h
AC_CHECK_FUNCS([close fstat ftruncate lseek open read stat write])
AS_IF(
[test "x$ac_cv_func_close" != xyes],
[AC_MSG_FAILURE(
[Missing function: close],
[1])
])
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_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_stat" != xyes],
[AC_MSG_FAILURE(
[Missing function: stat],
[1])
])
AS_IF(
[test "x$ac_cv_func_write" != xyes],
[AC_MSG_FAILURE(
[Missing function: write],
[1])
])
dnl Check for error string functions used in libsmdev/libsmdev_error_string.c
AC_FUNC_STRERROR_R()
AS_IF(
[test "x$ac_cv_have_decl_strerror_r" = xno],
[AC_CHECK_FUNCS([strerror])
AS_IF(
[test "x$ac_cv_func_strerror" != xyes],
[AC_MSG_FAILURE(
[Missing functions: strerror and strerror_r],
[1])
])
])
dnl Check if winioctl.h defines STORAGE_BUS_TYPE
AS_IF(
[test "x$ac_cv_enable_winapi" = xyes],
[AX_LIBSMDEV_CHECK_HEADER_WINIOCTL_H_STORAGE_BUS_TYPE])
dnl Check for internationalization functions in libsmdev/libsmdev_i18n.c
AC_CHECK_FUNCS([bindtextdomain])
])
dnl Function to detect if smdevtools dependencies are available
AC_DEFUN([AX_SMDEVTOOLS_CHECK_LOCAL],
[AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h])
AC_CHECK_FUNCS([close getopt setvbuf])
AS_IF(
[test "x$ac_cv_func_close" != xyes],
[AC_MSG_FAILURE(
[Missing function: close],
[1])
])
])
dnl Function to check if DLL support is needed
AC_DEFUN([AX_LIBSMDEV_CHECK_DLL_SUPPORT],
[AS_IF(
[test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno],
[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(
[LIBSMDEV_DLL_EXPORT],
["-DLIBSMDEV_DLL_EXPORT"])
AC_SUBST(
[LIBSMDEV_DLL_IMPORT],
["-DLIBSMDEV_DLL_IMPORT"])
])
])
])