Add a new ./configure arg (--disable-systemd) that causes the build system to build, test, and install only udev. Allows udev to be built on a system with many fewer of the build-time dependencies present. Signed-Off-By: Bryan Kadzban <bryan@xxxxxxxxxxxxxxxxxxxxx> ---- Possible points of discussion: Should this flag be called --disable-systemd, as I did? (That follows the autoconf docs, which say --disable-* should only ever turn stuff off, and --enable-* should only ever turn stuff on.) Or are the autoconf docs irrelevant, and this should be called --enable-udev-only or something, instead? The flag name isn't terribly important to me. (Note that the flag is set to *enable* systemd by default. Disabling it is probably not to be done lightly, and a bunch of other stuff needs to be turned off as well for this to actually build.) Also, a few notes on usage. First, to fully avoid installing systemd stuff, a bunch of directories need to be set to the empty string at "make install" time, or they'll be created and left empty. ("pkgdatadir= polkitpolicydir= bashcompletiondir= pkgsysconfdir= userunitdir= tmpfilesdir= sysctldir= systemunitdir= pkgincludedir= systemgeneratordir=" is the full list.) Second, "make check" fails in the po/ directory if systemd was not enabled at configure time, because intltool was skipped. The udev tests all succeed though, so "make SUBDIRS=. check" works. Third, "make distdir" also require systemd to be enabled, otherwise some of the .policy.in files don't make it into the directory (and so "dist-xz" won't put them into the generated tarball). But that's not likely to be an issue, considering who does the releases. Last, on the changes to configure.ac. The intltool and m4 path checks are not needed anymore if only udev is being built. Neither is gperf, so skip the "no gperf found" error message in that case. No need to check pkg-config for dbus-1. cap_init and sys/capability.h are no longer required either, so skip them as well. Finally, none of the --with-{dbus,pam}*dir args need a default value for a udev-only build.
diff --git a/Makefile.am b/Makefile.am index 597711e..4712c11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -202,6 +202,13 @@ endif endif # ------------------------------------------------------------------------------ +if !ENABLE_SYSTEMD +# stubs +bin_PROGRAMS = +rootlibexec_PROGRAMS = +endif + +if ENABLE_SYSTEMD rootbin_PROGRAMS = \ systemctl \ systemd-notify \ @@ -442,6 +449,8 @@ EXTRA_DIST += \ units/systemd-ask-password-plymouth.service.in endif +endif # ENABLE_SYSTEMD + dist_doc_DATA = \ README \ NEWS \ @@ -453,6 +462,7 @@ dist_doc_DATA = \ @INTLTOOL_POLICY_RULE@ # ------------------------------------------------------------------------------ +if ENABLE_SYSTEMD MANPAGES = \ man/systemd.1 \ man/systemctl.1 \ @@ -510,13 +520,19 @@ MANPAGES_ALIAS = \ man/systemd-modules-load.8 \ man/systemd-sysctl.8 \ man/systemd-journald.8 +else +MANPAGES = +MANPAGES_ALIAS = +endif +if ENABLE_SYSTEMD man/reboot.8: man/halt.8 man/poweroff.8: man/halt.8 man/init.1: man/systemd.1 man/systemd-modules-load.8: man/systemd-modules-load.service.8 man/systemd-sysctl.8: man/systemd-sysctl.service.8 man/systemd-journald.8: man/systemd-journald.service.8 +endif XML_FILES = \ ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}} @@ -595,6 +611,7 @@ libsystemd_shared_la_SOURCES = \ src/shared/hwclock.c \ src/shared/hwclock.h +if ENABLE_SYSTEMD #------------------------------------------------------------------------------- noinst_LTLIBRARIES += \ libsystemd-dbus.la @@ -627,6 +644,7 @@ libsystemd_units_la_SOURCES = \ libsystemd_units_la_CFLAGS = \ $(AM_CFLAGS) \ $(DBUS_CFLAGS) +endif # ------------------------------------------------------------------------------ noinst_LTLIBRARIES += \ @@ -651,6 +669,7 @@ libsystemd_label_la_CFLAGS = \ libsystemd_label_la_LIBADD = \ $(SELINUX_LIBS) +if ENABLE_SYSTEMD # ------------------------------------------------------------------------------ noinst_LTLIBRARIES += \ libsystemd-logs.la @@ -692,6 +711,8 @@ libsystemd_audit_la_SOURCES = \ libsystemd_audit_la_LIBADD = \ libsystemd-capability.la +endif # ENABLE_SYSTEMD + # ------------------------------------------------------------------------------ if HAVE_ACL noinst_LTLIBRARIES += \ @@ -709,6 +730,7 @@ libsystemd_acl_la_LIBADD = \ $(ACL_LIBS) endif +if ENABLE_SYSTEMD # ------------------------------------------------------------------------------ noinst_LTLIBRARIES += \ libsystemd-core.la @@ -1355,6 +1377,8 @@ EXTRA_DIST += \ src/libsystemd-daemon/libsystemd-daemon.pc.in \ src/libsystemd-daemon/libsystemd-daemon.sym +endif # ENABLE_SYSTEMD + # ------------------------------------------------------------------------------ if ENABLE_GTK_DOC SUBDIRS += \ @@ -1443,8 +1467,12 @@ udev-confdirs: INSTALL_DATA_HOOKS += udev-confdirs +if ENABLE_SYSTEMD +SYSTEMD_UDEV_RULES = rules/99-systemd.rules +endif + dist_udevrules_DATA += \ - rules/99-systemd.rules \ + $(SYSTEMD_UDEV_RULES) \ rules/42-usb-hid-pm.rules \ rules/50-udev-default.rules \ rules/60-persistent-storage-tape.rules \ @@ -1471,9 +1499,10 @@ EXTRA_DIST += \ src/udev/udev.pc.in CLEANFILES += \ - rules/99-systemd.rules \ + $(SYSTEMD_UDEV_RULES) \ src/udev/udev.pc +if ENABLE_SYSTEMD EXTRA_DIST += \ units/systemd-udev.service.in \ units/systemd-udev-trigger.service.in \ @@ -1493,6 +1522,7 @@ systemd-install-hook: ln -sf ../systemd-udev-trigger.service $(DESTDIR)$(systemunitdir)/sysinit.target.wants/systemd-udev-trigger.service INSTALL_DATA_HOOKS += systemd-install-hook +endif bin_PROGRAMS += \ udevadm @@ -2017,6 +2047,7 @@ dist_udevrules_DATA += \ udevlibexec_PROGRAMS += \ mtd_probe +if ENABLE_SYSTEMD # ------------------------------------------------------------------------------ libsystemd_id128_la_SOURCES = \ src/libsystemd-id128/sd-id128.c @@ -2984,6 +3015,8 @@ CLEANFILES += \ src/login/71-seat.rules \ src/login/73-seat-late.rules endif + +endif # ENABLE_SYSTEMD # ------------------------------------------------------------------------------ SED_PROCESS = \ @@ -3113,6 +3146,8 @@ DBUS_PREPROCESS = $(CPP) -P $(DBUS_CFLAGS) -imacros dbus/dbus-protocol.h CLEANFILES += \ $(dbusinterface_DATA) +if ENABLE_SYSTEMD + systemd-install-data-hook: $(MKDIR_P) -m 0755 \ $(DESTDIR)$(tmpfilesdir) \ @@ -3321,11 +3356,17 @@ if TARGET_MAGEIA $(LN_S) $(systemunitdir)/display-manager.service display-manager.service ) endif +endif # ENABLE_SYSTEMD + install-exec-hook: $(INSTALL_EXEC_HOOKS) uninstall-hook: $(UNINSTALL_EXEC_HOOKS) -install-data-hook: systemd-install-data-hook $(INSTALL_DATA_HOOKS) +if ENABLE_SYSTEMD +SYSTEMD_INSTALL_DATA_HOOK = systemd-install-data-hook +endif + +install-data-hook: $(SYSTEMD_INSTALL_DATA_HOOK) $(INSTALL_DATA_HOOKS) distclean-local: $(DISTCLEAN_LOCAL_HOOKS) diff --git a/configure.ac b/configure.ac index a4f9fea..bf825bd 100644 --- a/configure.ac +++ b/configure.ac @@ -44,8 +44,23 @@ AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" || LT_PREREQ(2.2) LT_INIT +dnl Figure out if we want a udev-only build early. Inverted logic to match +dnl autoconf expectations (passing --enable-foo should only ever turn something +dnl on, never turn something off). +AC_ARG_ENABLE([systemd], + [AS_HELP_STRING([--disable-systemd], + [build udevd only, not systemd @<:@default: systemd enabled@:>@])], + [enable_systemd=$enableval], [enable_systemd=yes]) + +dnl Anything other than --disable-systemd means "yes, build systemd as well" +AS_IF([test "x$enable_systemd" != "xno"], [enable_systemd=yes]) + +AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x$enable_systemd" = "xyes"]) + # i18n stuff for the PolicyKit policy files +AS_IF([test "x$enable_systemd" = "xyes"], [ IT_PROG_INTLTOOL([0.40.0]) +]) GETTEXT_PACKAGE=systemd AC_SUBST(GETTEXT_PACKAGE) @@ -61,7 +76,9 @@ AC_PROG_CC_C99 AM_PROG_CC_C_O AC_PROG_GCC_TRADITIONAL +AS_IF([test "x$enable_systemd" = "xyes"], [ AC_PATH_PROG([M4], [m4]) +]) # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line m4_ifdef([GTK_DOC_CHECK], [ @@ -75,7 +92,7 @@ GOBJECT_INTROSPECTION_CHECK([1.31.1]) AC_CHECK_TOOL(OBJCOPY, objcopy) AC_CHECK_TOOL(STRINGS, strings) AC_CHECK_TOOL(GPERF, gperf) -if test -z "$GPERF" ; then +if test -z "$GPERF" && test "x$enable_systemd" = "xyes" ; then AC_MSG_ERROR([*** gperf not found]) fi @@ -132,6 +149,7 @@ AC_SUBST([GCLDFLAGS], $with_ldflags) AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])]) AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])]) +AS_IF([test "x$enable_systemd" = "xyes"], [ save_LIBS="$LIBS" LIBS= AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])]) @@ -139,11 +157,14 @@ AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers n CAP_LIBS="$LIBS" LIBS="$save_LIBS" AC_SUBST(CAP_LIBS) +]) # This makes sure pkg.m4 is available. m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) +AS_IF([test "x$enable_systemd" = "xyes"], [ PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2]) +]) PKG_CHECK_MODULES(KMOD, [libkmod >= 5]) PKG_CHECK_MODULES(BLKID,[blkid >= 2.20]) @@ -655,22 +676,22 @@ AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes") AC_ARG_WITH([dbuspolicydir], AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]), [], - [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d]) + [AS_IF([test "x$enable_systemd" = "xyes"], [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])]) AC_ARG_WITH([dbussessionservicedir], AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]), [], - [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`]) + [AS_IF([test "x$enable_systemd" = "xyes"], [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])]) AC_ARG_WITH([dbussystemservicedir], AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]), [], - [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services]) + [AS_IF([test "x$enable_systemd" = "xyes"], [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])]) AC_ARG_WITH([dbusinterfacedir], AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]), [], - [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces]) + [AS_IF([test "x$enable_systemd" = "xyes"], [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])]) AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), @@ -684,7 +705,7 @@ AC_ARG_WITH([rootlibdir], AC_ARG_WITH([pamlibdir], AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), [], - [with_pamlibdir=${with_rootlibdir}/security]) + [AS_IF([test "x$enable_systemd" = "xyes"], [with_pamlibdir=${with_rootlibdir}/security])]) AC_ARG_ENABLE([split-usr], AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),