-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathconfigure.ac
402 lines (345 loc) · 14.1 KB
/
configure.ac
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# configure.ac for libblockdev
AC_INIT([libblockdev], [3.2.1], [], [], [https://github.com/storaged-project/libblockdev])
# Disable building static libraries.
# This needs to be set before initializing automake
AC_DISABLE_STATIC
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-syntax -Wno-portability])
AC_CONFIG_MACRO_DIR([m4])
AM_PATH_PYTHON
AX_CHECK_ENABLE_DEBUG([no], [DEBUG], [NDEBUG])
AM_PROG_AR
AC_PROG_CC
LT_INIT
AC_CONFIG_FILES([Makefile src/Makefile \
src/plugins/Makefile \
src/plugins/fs/Makefile \
src/plugins/nvme/Makefile \
src/plugins/smart/Makefile \
src/utils/Makefile \
src/utils/blockdev-utils.pc \
src/lib/Makefile \
src/lib/plugin_apis/Makefile \
src/lib/blockdev.c \
src/lib/blockdev.pc \
src/python/Makefile \
src/python/gi/Makefile \
src/python/gi/overrides/Makefile \
include/Makefile \
include/blockdev/Makefile \
docs/Makefile \
docs/libblockdev-docs.xml \
dist/Makefile \
dist/libblockdev.spec \
scripts/Makefile \
tools/Makefile \
data/Makefile \
data/conf.d/Makefile \
tests/Makefile])
m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
[GOBJECT_INTROSPECTION_CHECK([1.3.0])],
[found_introspection=no
AM_CONDITIONAL(HAVE_INTROSPECTION, false)])
AS_IF([test "x$found_introspection" = xyes],
[AC_SUBST(WITH_GI, 1)],
[AC_SUBST(WITH_GI, 0)])
AC_CANONICAL_HOST
case $host_cpu in
s390|s390x) on_s390=yes ;;
*) on_s390=no ;;
esac
AC_ARG_WITH([s390],
AS_HELP_STRING([--with-s390], [support s390 @<:@default=check@:>@]),
[],
[with_s390=check])
AC_SUBST(WITH_S390, 0)
if test "x$with_s390" != "xno"; then
AS_IF([test "x$on_s390" = "xno" -a "x$with_s390" = "xyes"],
[LIBBLOCKDEV_SOFT_FAILURE([s390 support requested, but not on s390 arch])
AM_CONDITIONAL(WITH_S390, false)],
[test "x$on_s390" = "xyes" -a "x$with_s390" != "xno"],
[AC_SUBST(WITH_S390, 1)
AM_CONDITIONAL(WITH_S390, true)
],
[AC_SUBST(WITH_S390, 0)
AM_CONDITIONAL(WITH_S390, false)
])
else
AM_CONDITIONAL(WITH_S390, false)
fi
AC_ARG_WITH([python3],
AS_HELP_STRING([--with-python3], [support python3 @<:@default=check@:>@]),
[],
[with_python3=check])
AC_SUBST(WITH_PYTHON3, 0)
if test "x$with_python3" != "xno"; then
AC_PATH_PROG([python3], [python3], [no])
AS_IF([test "x$python3" = "xno"],
[if test "x$with_python3" = "xyes"; then
LIBBLOCKDEV_SOFT_FAILURE([Python3 support requested, but python3 is not available])
fi],
[AC_SUBST(WITH_PYTHON3, 1)])
fi
AM_CONDITIONAL(WITH_PYTHON3, test "x$with_python3" != "xno" -a "x$python3" != "xno")
AC_ARG_WITH([gtk-doc],
AS_HELP_STRING([--with-gtk-doc], [generate documentation with gtk-doc @<:@default=check@:>@]),
[],
[with_gtk_doc=check])
AC_SUBST(WITH_GTK_DOC, 0)
if test "x$with_gtk_doc" != "xno"; then
AC_PATH_PROG([gtkdoc_scan], [gtkdoc-scan], [no])
AS_IF([test "x$gtkdoc_scan" = "xno"],
[if test "x$with_gtk_doc" = "xyes"; then
LIBBLOCKDEV_SOFT_FAILURE([Building documentation with gtk-doc requested, but not available])
fi],
[AC_SUBST(WITH_GTK_DOC, 1)])
fi
AM_CONDITIONAL(WITH_GTK_DOC, test "x$with_gtk_doc" != "xno" -a "x$gtkdoc_scan" != "xno")
# Run tests on build?
AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [Run tests at compile time (default=yes)]))
test "x$enable_tests" = "x" && enable_tests="yes"
AM_CONDITIONAL([TESTS_ENABLED], [test "x$enable_tests" = "xyes"])
AC_CHECK_HEADERS([dlfcn.h string.h unistd.h sys/fcntl.h sys/ioctl.h linux/random.h glob.h syslog.h math.h],
[],
[LIBBLOCKDEV_SOFT_FAILURE([Header file $ac_header not found.])],
[])
AC_ARG_WITH([escrow],
AS_HELP_STRING([--with-escrow], [support escrow @<:@default=yes@:>@]),
[],
[with_escrow=yes])
AC_SUBST([WITH_ESCROW], [0])
AM_CONDITIONAL(WITH_ESCROW, test "x$with_escrow" != "xno")
AS_IF([test "x$with_escrow" != "xno"],
[AC_DEFINE([WITH_BD_ESCROW], [], [Define if escrow is supported]) AC_SUBST([WITH_ESCROW], [1])],
[])
AC_ARG_WITH([tools],
AS_HELP_STRING([--with-tools], [build tools @<:@default=yes@:>@]),
[],
[with_tools=yes])
AC_SUBST([WITH_TOOLS], [0])
AM_CONDITIONAL(WITH_TOOLS, test "x$with_tools" != "xno")
AS_IF([test "x$with_tools" != "xno"],
[AC_SUBST([WITH_TOOLS], [1])],
[])
AC_ARG_WITH([nvme],
AS_HELP_STRING([--with-nvme], [support nvme @<:@default=yes@:>@]),
[],
[with_nvme=yes])
AC_SUBST([WITH_NVME], [0])
AM_CONDITIONAL(WITH_NVME, test "x$with_nvme" != "xno")
AS_IF([test "x$with_nvme" != "xno"],
[AC_DEFINE([WITH_BD_NVME], [], [Define if nvme is supported]) AC_SUBST([WITH_NVME], [1])],
[])
AC_ARG_WITH([smart],
AS_HELP_STRING([--with-smart], [support ATA S.M.A.R.T. via libatasmart @<:@default=yes@:>@]),
[],
[with_smart=yes])
AC_SUBST([WITH_SMART], [0])
AM_CONDITIONAL(WITH_SMART, test "x$with_smart" != "xno")
AS_IF([test "x$with_smart" != "xno"],
[AC_SUBST([WITH_SMART], [1])],
[])
AC_ARG_WITH([smartmontools],
AS_HELP_STRING([--with-smartmontools], [support ATA/SCSI S.M.A.R.T. via smartmontools @<:@default=yes@:>@]),
[],
[with_smartmontools=yes])
AC_SUBST([WITH_SMARTMONTOOLS], [0])
AM_CONDITIONAL(WITH_SMARTMONTOOLS, test "x$with_smartmontools" != "xno")
AS_IF([test "x$with_smartmontools" != "xno"],
[AC_SUBST([WITH_SMARTMONTOOLS], [1])],
[])
LIBBLOCKDEV_PLUGIN([BTRFS], [btrfs])
LIBBLOCKDEV_PLUGIN([CRYPTO], [crypto])
LIBBLOCKDEV_PLUGIN([DM], [dm])
LIBBLOCKDEV_PLUGIN([LOOP], [loop])
LIBBLOCKDEV_PLUGIN([LVM], [lvm])
LIBBLOCKDEV_PLUGIN([LVM_DBUS], [lvm_dbus])
LIBBLOCKDEV_PLUGIN([MDRAID], [mdraid])
LIBBLOCKDEV_PLUGIN([MPATH], [mpath])
LIBBLOCKDEV_PLUGIN([SWAP], [swap])
LIBBLOCKDEV_PLUGIN([PART], [part])
LIBBLOCKDEV_PLUGIN([FS], [fs])
LIBBLOCKDEV_PLUGIN([NVDIMM], [nvdimm])
LIBBLOCKDEV_PLUGIN([NVME], [nvme])
LIBBLOCKDEV_PLUGIN([SMART], [smart])
dnl these packages/modules are always needed
LIBBLOCKDEV_PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.42.2])
LIBBLOCKDEV_PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.42.2])
LIBBLOCKDEV_PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.42.2])
LIBBLOCKDEV_PKG_CHECK_MODULES([UDEV], [libudev >= 216])
LIBBLOCKDEV_PKG_CHECK_MODULES([KMOD], [libkmod >= 19])
AS_IF([test "x$with_crypto" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([CRYPTSETUP], [libcryptsetup >= 2.3.0])
AS_IF([$PKG_CONFIG --atleast-version=2.4.0 libcryptsetup],
[AC_DEFINE([LIBCRYPTSETUP_24])], [])
AS_IF([$PKG_CONFIG --atleast-version=2.6.0 libcryptsetup],
[AC_DEFINE([LIBCRYPTSETUP_26])], [])
AS_IF([$PKG_CONFIG --atleast-version=2.7.0 libcryptsetup],
[AC_DEFINE([LIBCRYPTSETUP_27])], [])
AC_CHECK_HEADER([linux/sed-opal.h],
[AC_DEFINE([HAVE_LINUX_OPAL])], [])
AS_IF([test "x$with_escrow" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([NSS], [nss >= 3.18.0])
LIBBLOCKDEV_CHECK_HEADER([volume_key/libvolume_key.h], [$GLIB_CFLAGS $NSS_CFLAGS], [libvolume_key.h not available])],
[])
dnl pkg-config support was added in keyutils 1.6 but CentOS/RHEL 8 has only 1.5
LIBBLOCKDEV_CHECK_HEADER([keyutils.h], [], [keyutils.h not available])
],
[])
AS_IF([test "x$with_dm" != "xno" -o "x$with_lvm" != "xno" -o "x$with_lvm_dbus" != "xno" -o "x$with_mpath" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.93])],
[])
AS_IF([test "x$with_lvm" != "xno" -o "x$with_lvm_dbus" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([YAML], [yaml-0.1])],
[])
AS_IF([test "x$with_part" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([FDISK], [fdisk >= 2.31.0])],
[])
AS_IF([test "x$with_swap" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([UUID], [uuid])],
[])
AS_IF([test "x$with_fs" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([UUID], [uuid])
LIBBLOCKDEV_PKG_CHECK_MODULES([MOUNT], [mount >= 2.23.0])
# new versions of libmount has some new functions we can use
AS_IF([$PKG_CONFIG --atleast-version=2.30.0 mount],
[AC_DEFINE([LIBMOUNT_NEW_ERR_API])], [])
LIBBLOCKDEV_PKG_CHECK_MODULES([EXT2FS], [ext2fs e2p])]
[])
AS_IF([test "x$with_tools" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([PARTED], [libparted >= 3.1])
# older versions of parted don't provide the libparted-fs-resize.pc file
AS_IF([$PKG_CONFIG libparted-fs-resize],
[LIBBLOCKDEV_PKG_CHECK_MODULES([PARTED_FS], [libparted-fs-resize >= 3.2])],
[AC_SUBST([PARTED_FS_LIBS], [-lparted-fs-resize])
AC_SUBST([PARTED_FS_CFLAGS], [])])],
[])
AS_IF([test "x$with_fs" != "xno" -o "x$with_crypto" != "xno" -o "x$with_swap" != "xno" -o "x$with_part" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([BLKID], [blkid >= 2.23.0])
# older versions of libblkid don't support BLKID_SUBLKS_BADCSUM so let's just
# define it as 0 (neutral value for bit combinations of flags)
AS_IF([$PKG_CONFIG --atleast-version=2.27.0 blkid], [],
[AC_DEFINE([BLKID_SUBLKS_BADCSUM], [0],
[Define as neutral value if libblkid doesn't provide the definition])])]
[])
AS_IF([test "x$with_btrfs" != "xno" -o "x$with_mdraid" != "xno" -o "x$with_tools" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([BYTESIZE], [bytesize >= 0.1])],
[])
AS_IF([test "x$with_nvdimm" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([UUID], [uuid])
LIBBLOCKDEV_PKG_CHECK_MODULES([NDCTL], [libndctl >= 58.4])
# new versions of libndctl new modes
AS_IF([$PKG_CONFIG --atleast-version=60 libndctl],
[AC_DEFINE([LIBNDCTL_NEW_MODES])], [])]
[])
AS_IF([test "x$with_nvme" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([NVME], [libnvme >= 1.3])
AS_IF([$PKG_CONFIG --atleast-version=1.4 libnvme],
[AC_DEFINE([HAVE_LIBNVME_1_4])], [])
],
[])
AS_IF([test "x$with_smart" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([SMART], [libatasmart >= 0.17])
AC_DEFINE([HAVE_SMART])
drivedb_path="$datarootdir/smartmontools"
AC_ARG_WITH([drivedb],
[AS_HELP_STRING([--with-drivedb@<:@=PATH@:>@],
[support for smartmontools drivedb.h (EXPERIMENTAL) (default=$datarootdir/smartmontools)])],
[], [with_drivedb=$drivedb_path])
AX_RECURSIVE_EVAL([$with_drivedb], [drivedb_path])
case $drivedb_path in
yes)
;;
/*)
if @<:@ -z ${drivedb_path##*drivedb.h} @:>@; then
drivedb_path=`dirname $drivedb_path`
fi
;;
no|'')
;;
*)
AC_MSG_RESULT([$drivedb_path])
AC_MSG_ERROR([The drivedb must be an absolute path.])
;;
esac
],
[])
AS_IF([test "x$with_smart" != "xno"],
[SAVED_CFLAGS=$CFLAGS
CFLAGS+=" -I$drivedb_path"
AC_MSG_CHECKING([for drivedb.h presence])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
struct drive_settings {
const char* modelfamily;
const char* modelregexp;
const char* firmwareregexp;
const char* warningmsg;
const char* presets;
};
static const struct drive_settings builtin_knowndrives@<:@@:>@ = {
#include <drivedb.h>
};
])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DRIVEDB_H])
AC_SUBST([DRIVEDB_H_CFLAGS], [-I$drivedb_path])],
[AC_MSG_RESULT([no])])
CFLAGS=$SAVED_CFLAGS
],
[])
AS_IF([test "x$with_smartmontools" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0])
AC_DEFINE([HAVE_SMARTMONTOOLS])],
[])
AC_SUBST([MAJOR_VER], [3])
CFLAGS="$CFLAGS -std=gnu99"
LIBBLOCKDEV_FAILURES
AC_OUTPUT
if test "x$with_python3" != "xno" -a "x$python3" != "xno"; then
python3_info=yes
else
python3_info=no
fi
if test "x$with_s390" != "xno" -a "x$on_s390" = "xyes"; then
s390_info=yes
else
s390_info=no
fi
dnl ==========================================================================
echo "
libblockdev $VERSION
====================
prefix: ${prefix}
libdir: ${libdir}
libexecdir: ${libexecdir}
bindir: ${bindir}
sbindir: ${sbindir}
datadir: ${datadir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
docdir: ${docdir}
compiler: ${CC}
cflags: ${CFLAGS}
cppflags: ${CPPFLAGS}
ldflags: ${LDFLAGS}
BTRFS plugin: ${with_btrfs}
Crypto plugin: ${with_crypto}
escrow support: ${with_escrow}
DM plugin: ${with_dm}
FS plugin: ${with_fs}
Loop plugin: ${with_loop}
LVM plugin: ${with_lvm}
LVM DBus plugin: ${with_lvm_dbus}
MDRAID plugin: ${with_mdraid}
MPath plugin ${with_mpath}
NVDIMM plugin (deprecated): ${with_nvdimm}
NVMe plugin: ${with_nvme}
Part plugin: ${with_part}
S390 plugin: ${s390_info}
SMART plugin (libatasmart): ${with_smart}
SMART plugin (smartmontools): ${with_smartmontools}
Swap plugin: ${with_swap}
GObject introspection: ${found_introspection}
Python 3 bindings: ${python3_info}
tools: ${with_tools}
"