-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
228 lines (198 loc) · 5.84 KB
/
configure.in
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
dnl Process this file with autoconf to produce a configure script.
AC_INIT()
AC_PREREQ(2.52)
AC_MSG_NOTICE([Configuring dbench])
AC_CONFIG_HEADER(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_DEFINE([_GNU_SOURCE], 1,
[Define _GNU_SOURCE so that we get all necessary prototypes])
# If GCC, turn on warnings.
if test "x$GCC" = "xyes"
then
CFLAGS="$CFLAGS -Wall -W"
else
CFLAGS="$CFLAGS -O"
fi
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h sys/vfs.h sys/statvfs.h stdint.h)
AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
AC_CHECK_HEADERS(sys/mount.h)
AC_CHECK_FUNCS(fdatasync)
# Check if we have libattr
AC_SEARCH_LIBS(getxattr, [attr])
AC_SEARCH_LIBS(socket, [socket])
AC_SEARCH_LIBS(gethostbyname, [nsl])
AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr listxattr llistxattr)
AC_CHECK_FUNCS(flistxattr removexattr lremovexattr fremovexattr)
AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
# Check if we have attr_get
AC_CHECK_FUNCS(attr_get attr_list attr_set attr_remove)
AC_CHECK_FUNCS(attr_getf attr_listf attr_setf attr_removef)
# Check if we have extattr
AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_file extattr_delete_link)
AC_CHECK_FUNCS(extattr_get_fd extattr_get_file extattr_get_link)
AC_CHECK_FUNCS(extattr_list_fd extattr_list_file extattr_list_link)
AC_CHECK_FUNCS(extattr_set_fd extattr_set_file extattr_set_link)
AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
if test x"$ac_cv_func_fgetxattr" = x"yes" -o \
x"$ac_cv_func_attr_getf" = x"yes" -o \
x"$ac_cv_func_extattr_get_fd" = x"yes"; then
AC_DEFINE(HAVE_EA_SUPPORT, 1, [Whether we have EA support])
fi
AC_CACHE_CHECK([for va_copy],dbench_cv_HAVE_VA_COPY,[
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [va_copy(ap1,ap2);],
dbench_cv_HAVE_VA_COPY=yes,dbench_cv_HAVE_VA_COPY=no)])
if test x"$dbench_cv_HAVE_VA_COPY" = x"yes"; then
AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
fi
if test x"$dbench_cv_HAVE_VA_COPY" != x"yes"; then
AC_CACHE_CHECK([for __va_copy],dbench_cv_HAVE___VA_COPY,[
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [__va_copy(ap1,ap2);],
dbench_cv_HAVE___VA_COPY=yes,dbench_cv_HAVE___VA_COPY=no)])
if test x"$dbench_cv_HAVE___VA_COPY" = x"yes"; then
AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
fi
fi
#
# Check that POPT is available
#
AC_MSG_CHECKING(whether libpopt is available)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS -lpopt"
AC_TRY_RUN([
/*
* Just see if we can compile/link with popt
*/
#include <popt.h>
int main(int argc, const char *argv[])
{
struct poptOption popt_options[] = {
POPT_TABLEEND
};
poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
return 0;
}
], ac_cv_have_popt=yes, ac_cv_have_popt=no,
[echo $ac_n "compile with POPT. Assuming OK... $ac_c"
ac_cv_have_popt=yes])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$ac_cv_have_popt" = yes ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_NOTICE(You need libpopt to compile DBENCH. Install the libpopt-dev package.)
exit
fi
#
# Check that libsmbclient is available
#
AC_MSG_CHECKING(whether libsmbclient is available)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS -lsmbclient"
AC_TRY_RUN([
#include <stdio.h>
#include <libsmbclient.h>
int main(int argc, char *argv[])
{
SMBCCTX *ctx;
ctx = smbc_new_context();
if (ctx == NULL) {
fprintf(stderr, "Could not allocate SMB Context\n");
return 1;
}
smbc_free_context(ctx, 1);
return 0;
}
], ac_cv_have_libsmbclient=yes, ac_cv_have_libsmbclient=no,
[echo $ac_n "compile with LIBSMBCLIENT. Assuming OK... $ac_c"
ac_cv_have_libsmbclient=yes])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$ac_cv_have_libsmbclient" = yes ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBSMBCLIENT, 1, [Whether we have LIBSMBCLIENT support])
LIBSMBCLIENT="-lsmbclient"
SMBO="smb.o"
else
AC_MSG_RESULT(no)
AC_MSG_NOTICE(Libsmbclient-dev not available. Building DBENCH without SMB support)
LIBSMBCLIENT=""
SMBO=""
fi
#
# Check whether we have access to Linux SCSI Generic ioctl()
#
AC_MSG_CHECKING(whether Linux SCSI Generic is available)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
AC_TRY_RUN([
/* We can only check that this program compiles. We cant check whether the
actual ioctl works since opening the device and doing i/o can only be
done by root.
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <scsi/sg.h>
int main(int argc, char *argv[])
{
const char *dev="/dev/sda";
int fd, vers;
if((fd=open(dev, O_RDWR))<0){
return 0;
}
if ((ioctl(fd, SG_GET_VERSION_NUM, &vers) < 0) || (vers < 30000)) {
close(fd);
return 0;
}
close(fd);
return 0;
}
], ac_cv_linux_scsi_sg=yes, ac_cv_linux_scsi_sg=no,
[echo $ac_n "cross compiling; assumed OK... $ac_c"
ac_cv_linux_scsi_sg=yes])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$ac_cv_linux_scsi_sg" = yes ; then
AC_MSG_RESULT(yes)
have_linux_scsi_sg=yes
LINUXSCSI="linux_scsi.o"
else
AC_MSG_RESULT(no)
have_linux_scsi_sg=no
LINUXSCSI=""
fi
if test x$have_linux_scsi_sg = xyes
then
AC_DEFINE(HAVE_LINUX_SCSI_SG, 1, [Define if Linux SCSI Generic is enabled])
fi
AC_SUBST(LIBSMBCLIENT)
AC_SUBST(SMBO)
AC_SUBST(LINUXSCSI)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AC_MSG_NOTICE(============================================)
if test "$ac_cv_have_libsmbclient" = yes ; then
AC_MSG_NOTICE(SMB support .......................... [YES])
else
AC_MSG_NOTICE(SMB support .......................... [NO])
fi
if test "$ac_cv_linux_scsi_sg" = yes ; then
AC_MSG_NOTICE(LINUX SCSI SG support ................ [YES])
else
AC_MSG_NOTICE(LINUX SCSI SG support ................ [NO])
fi