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 <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-08-26 19:11:22 +02:00
parent fb7b08388e
commit e1de236db1
2 changed files with 14 additions and 8 deletions

View file

@ -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

View file

@ -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],