summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2023-02-08 14:39:43 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2023-02-10 17:50:27 +0100
commit1fb5107eea2182415eef50ba7bec0fdf7600659c (patch)
treecd1d5bf5e3e4f9e48eda14993a2848bd1858885a /configure.ac
parentcf204ce55ea892ffaa4ff63dac548145544679fb (diff)
downloadlvm2-1fb5107eea2182415eef50ba7bec0fdf7600659c.tar.gz
lvresize: better detection of BLKID_SUBLKS_FSINFO
Use configure detection instead of trying to directly include blkid.h inside lvresize.c - where we do not pass in BLKID_CFLAGS and since we actually do not need to use blkid there, introeduce test variable HAVE_BLKID_SUBLKS_FSINFO and avoid trying to use blkid.h in this place - this also fixes builing problem for systems without blkid.h.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac25
1 files changed, 24 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 4ddf0a430..95bc44b32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1109,9 +1109,30 @@ AC_ARG_ENABLE(blkid_wiping,
[disable libblkid detection of signatures when wiping and use native code instead]),
BLKID_WIPING=$enableval, BLKID_WIPING=maybe)
+# TODO: possibly detect right version of blkid with BLKID_SUBLKS_FSINFO support
+# so lvresize can check detected flag here
+#
DEFAULT_USE_BLKID_WIPING=0
+AS_IF([test "$BLKID_WIPING" != "no"], [blkdir_version=">= 2.24"], [blkid_version=""])
+
+PKG_CHECK_MODULES([BLKID], [blkid $blkid_version ], [
+ HAVE_BLKID=1
+
+ AC_CACHE_CHECK([for blkdid.h supports SUBLKS_FSINFO.],
+ [ac_cv_have_blkid_sublks_fsinfo],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <blkid/blkid.h>
+#ifndef BLKID_SUBLKS_FSINFO
+#error BLKID_SUBLKS_FSINFO is missing
+#endif])],
+ [ac_cv_have_blkid_sublks_fsinfo="yes"], [ac_cv_have_blkid_sublks_fsinfo="no"])])
+
+ AC_IF_YES(ac_cv_have_blkid_sublks_fsinfo,
+ AC_DEFINE(HAVE_BLKID_SUBLKS_FSINFO, 1,
+ [Define if blkid.h has BLKID_SUBLKS_FSINFO]))
+])
+
AS_IF([test "$BLKID_WIPING" != "no"], [
- PKG_CHECK_MODULES([BLKID], [blkid >= 2.24], [
+ AS_IF([test "$HAVE_BLKID" = 1], [
BLKID_WIPING=yes
BLKID_PC="blkid"
DEFAULT_USE_BLKID_WIPING=1
@@ -1858,6 +1879,8 @@ AC_SUBST(FSADM)
AC_SUBST(FSADM_PATH)
AC_SUBST(LVRESIZE_FS_HELPER_PATH)
AC_SUBST(BLKDEACTIVATE)
+AC_SUBST(HAVE_BLKID)
+AC_SUBST(HAVE_BLKID_SUBLKS_FSINFO)
AC_SUBST(HAVE_LIBDL)
AC_SUBST(HAVE_REALTIME)
AC_SUBST(HAVE_VALGRIND)