summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Olofsson <Anders.Olofsson@axis.com>2012-11-16 01:17:18 +0100
committerKay Sievers <kay@vrfy.org>2012-11-16 01:17:18 +0100
commitf553b3b1074151200187df916427a1468186435e (patch)
treedfbbab0e5db3b6008588a65bdae169274602de20
parentd4205751d4643c272059a3728045929dd0e5e800 (diff)
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.
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac14
-rw-r--r--src/udev/udev-builtin.c2
-rw-r--r--src/udev/udev.h4
4 files changed, 24 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 3c590094d3..43db5a529e 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 71ea6ad25b..437ca6025c 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 ee81b2d713..26d65edd47 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 82cd2ad6d0..63de30c02d 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;