[systemd-commits] configure.ac Makefile.am src/udev

Kay Sievers kay at kemper.freedesktop.org
Thu Nov 15 16:23:06 PST 2012


 Makefile.am             |    6 +++++-
 configure.ac            |   14 +++++++++++++-
 src/udev/udev-builtin.c |    2 ++
 src/udev/udev.h         |    4 ++++
 4 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit f553b3b1074151200187df916427a1468186435e
Author: Anders Olofsson <Anders.Olofsson at axis.com>
Date:   Fri Nov 16 01:17:18 2012 +0100

    udev: make blkid optional
    
    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.

diff --git a/Makefile.am b/Makefile.am
index 3c59009..43db5a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/configure.ac b/configure.ac
index 71ea6ad..437ca60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index ee81b2d..26d65ed 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -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,
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 82cd2ad..63de30c 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -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;



More information about the systemd-commits mailing list