[PATCH] Allow configuring without systemd-only dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some dependencies (intltool, m4, dbus, pkg-config, PAM) are only
required or useful for systemd, not for udev.  Leave these required by
default, but allow them to be made optional if the right flag is used to
./configure.

Signed-Off-By: Bryan Kadzban <bryan@xxxxxxxxxxxxxxxxxxxxx>

-----

This is necessary for anyone who wants to build udev only.  It's not
sufficient, but without this or something like it, ./configure fails
hard.  This change touches *only* configure; if the dependencies are
made optional in a ./configure run, and they don't exist on the system
(or in some cases, even if they do) make will fail hard.

I'm not attached to the --with-X flag's name; coming up with a better
one would be fine.

Unfortunately there's no "use intltool if it's present, otherwise don't
bother" variant of IT_PROG_INTLTOOL.  If that's wanted, I could hack it
together with another invocation of AC_PATH_PROG, but this is slightly
simpler.
diff --git a/configure.ac b/configure.ac
index 70f3e96..446fb95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,8 +44,15 @@ AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
 LT_PREREQ(2.2)
 LT_INIT
 
+AC_ARG_WITH([require-systemd-deps],
+            [AS_HELP_STRING([--without-require-systemd-deps],
+                            [make systemd configure dependencies optional @<:@default: required@:>@])],
+            [with_require_systemd_deps=$withval], [with_require_systemd_deps=yes])
+
 # i18n stuff for the PolicyKit policy files
+AS_IF([test "x$with_require_systemd_deps" = "xyes"], [
 IT_PROG_INTLTOOL([0.40.0])
+])
 
 GETTEXT_PACKAGE=systemd
 AC_SUBST(GETTEXT_PACKAGE)
@@ -61,7 +68,9 @@ AC_PROG_CC_C99
 AM_PROG_CC_C_O
 AC_PROG_GCC_TRADITIONAL
 
+AS_IF([test "x$with_require_systemd_deps" = "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 +84,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$with_require_systemd_deps" = "xyes" ; then
         AC_MSG_ERROR([*** gperf not found])
 fi
 
@@ -132,6 +141,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$with_require_systemd_deps" = "xyes"], [
 save_LIBS="$LIBS"
 LIBS=
 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
@@ -139,11 +149,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$with_require_systemd_deps" = "xyes"], [
 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2])
+])
 PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
 PKG_CHECK_MODULES(BLKID,[blkid >= 2.20])
 
@@ -648,22 +661,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$with_require_systemd_deps" = "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$with_require_systemd_deps" = "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$with_require_systemd_deps" = "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$with_require_systemd_deps" = "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]),
@@ -677,7 +690,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$with_require_systemd_deps" = "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]),

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux