From e1de236db1de03fbd1384040dfe0ecb0223fc2f0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 26 Aug 2014 19:11:22 +0200 Subject: [PATCH] build: add configure option not to install udev rules Previously, user could only change the udev base directory, but not disabling installation entirely. Support this now with: ./configure --with-udev-dir=no or ./configure --without-udev-dir Also, just passing '--with-udev-dir' equals '--with-udev-dir=yes'. Treat 'yes' equal to the default '/lib/udev'. Also, check that the path is an absolute path starting with a '/'. Signed-off-by: Thomas Haller --- callouts/Makefile.am | 4 +++- configure.ac | 18 +++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/callouts/Makefile.am b/callouts/Makefile.am index 1e7001c34e..1d1eb3c764 100644 --- a/callouts/Makefile.am +++ b/callouts/Makefile.am @@ -69,8 +69,10 @@ libtest_dispatcher_envp_la_LIBADD = \ $(DBUS_LIBS) -udevrulesdir = $(UDEV_BASE_DIR)/rules.d +if WITH_UDEV_DIR +udevrulesdir = $(UDEV_DIR)/rules.d udevrules_DATA = 77-nm-olpc-mesh.rules +endif dbusactivationdir = $(datadir)/dbus-1/system-services dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in diff --git a/configure.ac b/configure.ac index a082c8e20c..d6ffd106c4 100644 --- a/configure.ac +++ b/configure.ac @@ -284,14 +284,18 @@ if (test "${enable_qt}" = "yes"); then fi AM_CONDITIONAL(WITH_QT, test "${enable_qt}" = "yes") - -AC_ARG_WITH(udev-dir, AS_HELP_STRING([--with-udev-dir=DIR], [where the udev base directory is])) -if test -n "$with_udev_dir" ; then - UDEV_BASE_DIR="$with_udev_dir" -else - UDEV_BASE_DIR="/lib/udev" +AC_ARG_WITH(udev-dir, AS_HELP_STRING([--with-udev-dir=DIR], [Absolute path of the udev base directory. Set to 'no' not to install the udev rules]), [], [with_udev_dir="yes"]) +if (test "$with_udev_dir" != 'no'); then + if (test "$with_udev_dir" != 'yes' && echo -n "$with_udev_dir" | grep -v -q '^/'); then + AC_MSG_ERROR([--with-udev-dir must be an absolute path or 'yes' or 'no'. Instead it is '$with_udev_dir']) + fi + if (test "$with_udev_dir" = 'yes'); then + with_udev_dir="/lib/udev" + fi + UDEV_DIR="$with_udev_dir" + AC_SUBST(UDEV_DIR) fi -AC_SUBST(UDEV_BASE_DIR) +AM_CONDITIONAL(WITH_UDEV_DIR, test "$with_udev_dir" != 'no') # systemd unit support AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],