chiark / gitweb /
udev: make blkid optional
authorAnders Olofsson <Anders.Olofsson@axis.com>
Fri, 16 Nov 2012 00:17:18 +0000 (01:17 +0100)
committerKay Sievers <kay@vrfy.org>
Fri, 16 Nov 2012 00:17:18 +0000 (01:17 +0100)
I'm building systemd for an embedded system and we would prefer not having
to include the entire util-linux package just to get a libblkid whose
functionality we don't need.

Makefile.am
configure.ac
src/udev/udev-builtin.c
src/udev/udev.h

index 3c59009..43db5a5 100644 (file)
@@ -1893,7 +1893,6 @@ libudev_core_la_SOURCES = \
        src/udev/udev-rules.c \
        src/udev/udev-ctrl.c \
        src/udev/udev-builtin.c \
-       src/udev/udev-builtin-blkid.c \
        src/udev/udev-builtin-btrfs.c \
        src/udev/udev-builtin-firmware.c \
        src/udev/udev-builtin-hwdb.c \
@@ -1920,6 +1919,11 @@ libudev_core_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 
+if HAVE_BLKID
+libudev_core_la_SOURCES += \
+       src/udev/udev-builtin-blkid.c
+endif
+
 if HAVE_ACL
 libudev_core_la_SOURCES += \
        src/udev/udev-builtin-uaccess.c \
index 71ea6ad..437ca60 100644 (file)
@@ -194,7 +194,18 @@ m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-conf
 
 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2])
 PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
-PKG_CHECK_MODULES(BLKID,[blkid >= 2.20])
+
+# ------------------------------------------------------------------------------
+have_blkid=no
+AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
+if test "x$enable_blkid" != "xno"; then
+        PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
+                [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
+        if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
+                AC_MSG_ERROR([*** blkid support requested but libraries not found])
+        fi
+fi
+AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])
 
 # ------------------------------------------------------------------------------
 have_ima=yes
@@ -849,6 +860,7 @@ AC_MSG_RESULT([
         timedated:               ${have_timedated}
         localed:                 ${have_localed}
         coredump:                ${have_coredump}
+        blkid:                   ${have_blkid}
         firmware path:           ${FIRMWARE_PATH}
         gudev:                   ${enable_gudev}
         gintrospection:          ${enable_introspection}
index ee81b2d..26d65ed 100644 (file)
@@ -30,7 +30,9 @@
 static bool initialized;
 
 static const struct udev_builtin *builtins[] = {
+#ifdef HAVE_BLKID
         [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
+#endif
         [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
         [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
         [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
index 82cd2ad..63de30c 100644 (file)
@@ -134,7 +134,9 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg);
 
 /* built-in commands */
 enum udev_builtin_cmd {
+#ifdef HAVE_BLKID
         UDEV_BUILTIN_BLKID,
+#endif
         UDEV_BUILTIN_BTRFS,
         UDEV_BUILTIN_FIRMWARE,
         UDEV_BUILTIN_HWDB,
@@ -157,7 +159,9 @@ struct udev_builtin {
         bool (*validate)(struct udev *udev);
         bool run_once;
 };
+#ifdef HAVE_BLKID
 extern const struct udev_builtin udev_builtin_blkid;
+#endif
 extern const struct udev_builtin udev_builtin_btrfs;
 extern const struct udev_builtin udev_builtin_firmware;
 extern const struct udev_builtin udev_builtin_hwdb;