[PATCH v2][UPower] build: detect udev rules dir

Tom Gundersen teg at jklm.no
Wed Mar 20 09:31:21 PDT 2013


Udev rules may live in either /lib/udev/rules.d or /usr/lib/udev/rules.d depending on the distro.
Remove the heuristic for deciding the dir, use pkgconfig to detect the location and allow it to be
set manually.

v2: fix specifying --with-udevrulesdir
---
 configure.ac      | 12 +++++-------
 rules/Makefile.am |  1 -
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 56db585..f97ff37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,13 +82,11 @@ AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
 
 GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
 
-# udev rules go in /lib, not /usr/lib
-if test "$prefix" = "/usr" -o "$prefix" = "/usr/local" ; then
-  slashlibdir=/lib
-else
-  slashlibdir=$prefix/lib
-fi
-AC_SUBST(slashlibdir)
+AC_ARG_WITH([udevrulesdir],
+            AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]),
+            [],
+            [with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)"/rules.d"])
+AC_SUBST([udevrulesdir], [$with_udevrulesdir])
 
 # History/Db dir
 AC_ARG_WITH([historydir],
diff --git a/rules/Makefile.am b/rules/Makefile.am
index 1564b40..a66490a 100644
--- a/rules/Makefile.am
+++ b/rules/Makefile.am
@@ -1,6 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-udevrulesdir = $(slashlibdir)/udev/rules.d
 udevrules_DATA =						\
 	95-upower-battery-recall-dell.rules			\
 	95-upower-battery-recall-fujitsu.rules			\
-- 
1.8.2



More information about the devkit-devel mailing list