Make blkid optional

Embedded systems may not want to include util-linux when they do
not intend to use blkid functionality

Modified from original author's commit to not install
60-persistent-storage.rules if blkid is disabled

systemd commit f553b3b1074151200187df916427a1468186435e
Original author: Anders Olofsson <Anders.Olofsson@axis.com>

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Ian Stakenvicius 2013-01-25 13:34:21 -05:00 committed by Anthony G. Basile
parent 34bcd6cd8c
commit a9ef3ca764
5 changed files with 28 additions and 4 deletions

View File

@ -41,8 +41,6 @@ if test -z "$GPERF" ; then
AC_MSG_ERROR([*** gperf not found]) AC_MSG_ERROR([*** gperf not found])
fi fi
PKG_CHECK_MODULES(BLKID,[blkid >= 2.20])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
[arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \ [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \
@ -160,6 +158,18 @@ AC_SUBST([typelibsdir], [${libdir}/girepository-1.0])
GOBJECT_INTROSPECTION_CHECK([1.31.1]) GOBJECT_INTROSPECTION_CHECK([1.31.1])
AM_CONDITIONAL([HAVE_INTROSPECTION], [test "$enable_introspection" = "yes"]) AM_CONDITIONAL([HAVE_INTROSPECTION], [test "$enable_introspection" = "yes"])
# ------------------------------------------------------------------------------
have_blkid=no
AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [Disable optional 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_blkd" = xyes; then
AC_MSG_ERROR([*** blkid support requested but not found])
fi
fi
AM_CONDITIONAL(HAVE_SELINUX, [test "x$have_blkid" = "xyes"])
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
have_selinux=no have_selinux=no
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support])) AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))

View File

@ -8,7 +8,6 @@ dist_udevrules_DATA = \
60-persistent-serial.rules \ 60-persistent-serial.rules \
60-persistent-input.rules \ 60-persistent-input.rules \
60-persistent-alsa.rules \ 60-persistent-alsa.rules \
60-persistent-storage.rules \
60-persistent-v4l.rules \ 60-persistent-v4l.rules \
61-accelerometer.rules \ 61-accelerometer.rules \
64-btrfs.rules \ 64-btrfs.rules \
@ -19,6 +18,11 @@ dist_udevrules_DATA = \
80-net-name-slot.rules \ 80-net-name-slot.rules \
95-udev-late.rules 95-udev-late.rules
if HAVE_BLKID
dist_udevrules_DATA += \
60-persistent-storage.rules
endif
if HAVE_MODULES if HAVE_MODULES
dist_udevrules_DATA += \ dist_udevrules_DATA += \
80-drivers.rules 80-drivers.rules

View File

@ -46,7 +46,6 @@ libudev_core_la_SOURCES = \
udev-rules.c \ udev-rules.c \
udev-ctrl.c \ udev-ctrl.c \
udev-builtin.c \ udev-builtin.c \
udev-builtin-blkid.c \
udev-builtin-btrfs.c \ udev-builtin-btrfs.c \
udev-builtin-firmware.c \ udev-builtin-firmware.c \
udev-builtin-hwdb.c \ udev-builtin-hwdb.c \
@ -75,6 +74,11 @@ libudev_core_la_LIBADD = \
$(BLKID_LIBS) \ $(BLKID_LIBS) \
$(SELINUX_LIBS) $(SELINUX_LIBS)
if HAVE_BLKID
libudev_core_la_SOURCES += \
udev-builtin-blkid.c
endif
if HAVE_MODULES if HAVE_MODULES
libudev_core_la_SOURCES += \ libudev_core_la_SOURCES += \
udev-builtin-kmod.c udev-builtin-kmod.c

View File

@ -30,7 +30,9 @@
static bool initialized; static bool initialized;
static const struct udev_builtin *builtins[] = { static const struct udev_builtin *builtins[] = {
#ifdef HAVE_BLKID
[UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
#endif
[UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
[UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
[UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,

View File

@ -136,7 +136,9 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg);
/* built-in commands */ /* built-in commands */
enum udev_builtin_cmd { enum udev_builtin_cmd {
#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,
@ -158,7 +160,9 @@ struct udev_builtin {
bool (*validate)(struct udev *udev); bool (*validate)(struct udev *udev);
bool run_once; bool run_once;
}; };
#ifdef HAVE_BLKID
extern const struct udev_builtin udev_builtin_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_btrfs;
extern const struct udev_builtin udev_builtin_firmware; extern const struct udev_builtin udev_builtin_firmware;
extern const struct udev_builtin udev_builtin_hwdb; extern const struct udev_builtin udev_builtin_hwdb;