-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·266 lines (253 loc) · 6.46 KB
/
configure
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/usr/bin/env bash
set -e
function usage()
{
echo "'configure' configures SPDK to compile on supported platforms."
echo ""
echo "Usage: ./configure [OPTION]..."
echo ""
echo "Defaults for the options are specified in brackets."
echo ""
echo "General:"
echo " -h, --help Display this help and exit"
echo " --enable-debug Configure for debug builds"
echo " --enable-werror Treat compiler warnings as errors"
echo " --enable-asan Enable address sanitizer"
echo " --enable-ubsan Enable undefined behavior sanitizer"
echo " --enable-coverage Enable code coverage tracking"
echo " --enable-lto Enable link-time optimization"
echo " --with-env=path Use an alternate environment implementation"
echo ""
echo "Specifying Dependencies:"
echo "--with-DEPENDENCY[=path] Use the given dependency. Optionally, provide the"
echo " path."
echo "--without-DEPENDENCY Do not link to the given dependency. This may"
echo " disable features and components."
echo ""
echo "Valid dependencies are listed below."
echo " dpdk Optional. Uses dpdk submodule in spdk tree if not specified."
echo " example: /usr/share/dpdk/x86_64-default-linuxapp-gcc"
echo " fio Required to build fio_plugin."
echo " example: /usr/src/fio"
echo " virtio Required to build vhost initiator (Virtio) bdev module."
echo " No path required."
echo " nvml Required to build persistent memory bdev."
echo " example: /usr/share/nvml"
echo " rbd [disabled]"
echo " No path required."
echo " rdma [disabled]"
echo " No path required."
echo " vtune Required to profile I/O under Intel VTune Amplifier XE."
echo " example: /opt/intel/vtune_amplifier_xe_version"
echo ""
}
for i in "$@"; do
case "$i" in
-h|--help)
usage
exit 0
;;
--enable-debug)
CONFIG_DEBUG=y
;;
--disable-debug)
CONFIG_DEBUG=n
;;
--enable-asan)
CONFIG_ASAN=y
;;
--disable-asan)
CONFIG_ASAN=n
;;
--enable-ubsan)
CONFIG_UBSAN=y
;;
--disable-ubsan)
CONFIG_UBSAN=n
;;
--enable-tsan)
CONFIG_TSAN=y
;;
--disable-tsan)
CONFIG_TSAN=n
;;
--enable-coverage)
CONFIG_COVERAGE=y
;;
--disable-coverage)
CONFIG_COVERAGE=n
;;
--enable-lto)
CONFIG_LTO=y
;;
--disable-lto)
CONFIG_LTO=n
;;
--enable-werror)
CONFIG_WERROR=y
;;
--disable-werror)
CONFIG_WERROR=n
;;
--with-env=*)
CONFIG_ENV="${i#*=}"
;;
--with-rbd)
CONFIG_RBD=y
;;
--without-rbd)
CONFIG_RBD=n
;;
--with-rdma)
CONFIG_RDMA=y
;;
--without-rdma)
CONFIG_RDMA=n
;;
--with-dpdk=*)
CONFIG_DPDK_DIR=$(readlink -f ${i#*=})
;;
--without-dpdk)
CONFIG_DPDK_DIR=
;;
--with-virtio)
CONFIG_VIRTIO=y
;;
--without-virtio)
CONFIG_VIRTIO=n
;;
--with-nvml)
CONFIG_NVML=y
;;
--with-nvml=*)
CONFIG_NVML=y
CONFIG_NVML_DIR=$(readlink -f ${i#*=})
;;
--without-nvml)
CONFIG_NVML=n
;;
--with-fio=*)
FIO_SOURCE_DIR="${i#*=}"
CONFIG_FIO_PLUGIN=y
;;
--without-fio)
FIO_SOURCE_DIR=
CONFIG_FIO_PLUGIN=n
;;
--with-vtune=*)
VTUNE_SOURCE_DIR="${i#*=}"
CONFIG_VTUNE=y
;;
--without-vtune)
VTUNE_SOURCE_DIR=
CONFIG_VTUNE=n
;;
--)
break
;;
*)
echo "Unrecognized option $i"
usage
exit 1
esac
done
if [ -z "$CONFIG_ENV" ]; then
if [ -z "$CONFIG_DPDK_DIR" ]; then
rootdir=$(readlink -f $(dirname $0))
if [ ! -f "$rootdir"/dpdk/config/common_spdk ]; then
echo "DPDK not found; please specify --with-dpdk=<path> or run:"
echo
echo " git submodule update --init"
exit 1
fi
CONFIG_DPDK_DIR="$rootdir"/dpdk/build
fi
fi
if [ "$CONFIG_FIO_PLUGIN" = "y" ]; then
if [ -z "$FIO_SOURCE_DIR" ]; then
echo "When fio is enabled, you must specify the fio directory using --with-fio=path"
exit 1
fi
fi
if [ "$CONFIG_VTUNE" = "y" ]; then
if [ -z "$VTUNE_SOURCE_DIR" ]; then
echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path"
exit 1
fi
fi
if [ "$CONFIG_ASAN" = "y" -a "$CONFIG_TSAN" = "y" ]; then
echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
exit 1
fi
if [[ "$OSTYPE" == "FreeBSD"* ]]; then
# FreeBSD doesn't support all configurations
if [[ "$CONFIG_COVERAGE" == "y" ]]; then
echo "ERROR: CONFIG_COVERAGE not available on FreeBSD"
exit 1
fi
fi
echo -n "Creating CONFIG.local..."
# Write the configuration file
rm -f CONFIG.local
if [ -n "$CONFIG_DEBUG" ]; then
echo "CONFIG_DEBUG?=$CONFIG_DEBUG" >> CONFIG.local
fi
if [ -n "$CONFIG_WERROR" ]; then
echo "CONFIG_WERROR?=$CONFIG_WERROR" >> CONFIG.local
fi
if [ -n "$CONFIG_COVERAGE" ]; then
echo "CONFIG_COVERAGE?=$CONFIG_COVERAGE" >> CONFIG.local
fi
if [ -n "$CONFIG_LTO" ]; then
echo "CONFIG_LTO?=$CONFIG_LTO" >> CONFIG.local
fi
if [ -n "$CONFIG_ASAN" ]; then
echo "CONFIG_ASAN?=$CONFIG_ASAN" >> CONFIG.local
fi
if [ -n "$CONFIG_UBSAN" ]; then
echo "CONFIG_UBSAN?=$CONFIG_UBSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_TSAN" ]; then
echo "CONFIG_TSAN?=$CONFIG_TSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_ENV" ]; then
echo "CONFIG_ENV?=$CONFIG_ENV" >> CONFIG.local
fi
if [ -n "$CONFIG_DPDK_DIR" ]; then
echo "CONFIG_DPDK_DIR?=$CONFIG_DPDK_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_VIRTIO" ]; then
echo "CONFIG_VIRTIO?=$CONFIG_VIRTIO" >> CONFIG.local
fi
if [ -n "$CONFIG_NVML" ]; then
echo "CONFIG_NVML?=$CONFIG_NVML" >> CONFIG.local
fi
if [ -n "$CONFIG_NVML_DIR" ]; then
echo "CONFIG_NVML_DIR?=$CONFIG_NVML_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_FIO_PLUGIN" ]; then
echo "CONFIG_FIO_PLUGIN?=$CONFIG_FIO_PLUGIN" >> CONFIG.local
fi
if [ -n "$FIO_SOURCE_DIR" ]; then
echo "FIO_SOURCE_DIR?=$FIO_SOURCE_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_RDMA" ]; then
echo "CONFIG_RDMA?=$CONFIG_RDMA" >> CONFIG.local
fi
if [ -n "$CONFIG_RBD" ]; then
echo "CONFIG_RBD?=$CONFIG_RBD" >> CONFIG.local
fi
if [ -n "$CONFIG_VTUNE" ]; then
echo "CONFIG_VTUNE?=$CONFIG_VTUNE" >> CONFIG.local
fi
if [ -n "$VTUNE_SOURCE_DIR" ]; then
echo "VTUNE_SOURCE_DIR?=$VTUNE_SOURCE_DIR" >> CONFIG.local
fi
python scripts/genconfig.py > config.h
echo "done."
if [[ "$OSTYPE" == "FreeBSD"* ]]; then
echo "Type 'gmake' to build."
else
echo "Type 'make' to build."
fi
exit 0