[PATCH v2 vmmouse] Fetch the udev dir from udev.pc instead of guessing based on prefix

Peter Hutterer peter.hutterer at who-t.net
Sat Aug 4 15:12:15 PDT 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- add DISTCHECK_CONFIGURE_FLAGS

Aside from that, my previous comment still stands:
This technically changes behaviour since before building into a prefix of
/foo would install the rules in /foo/udev/rules.d. For such setups, I think
it'd be better to set up the udev pkgconfig file correctly.

 Makefile.am       |    3 ++-
 configure.ac      |   17 ++++-------------
 tools/Makefile.am |    1 -
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f1ad5af..ce2d86c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,8 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 # Ensure xorg.conf.d snippets are installed below $(prefix) for distcheck
-DISTCHECK_CONFIGURE_FLAGS = --with-xorg-conf-dir='$${datadir}/X11/xorg.conf.d'
+DISTCHECK_CONFIGURE_FLAGS = --with-xorg-conf-dir='$${datadir}/X11/xorg.conf.d' \
+                            --with-udev-rules-dir='$${libdir}/udev/rules.d'
 
 SUBDIRS = shared src tools fdi man
 MAINTAINERCLEANFILES = ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index d2fb0b6..2e1e021 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,19 +92,10 @@ AC_ARG_WITH(hal-fdi-dir,
 HAL_FDI_DIR=${halfdidir}
 AC_SUBST(HAL_FDI_DIR)
 
-case $host_os in
-  linux*)
-    if test "x$prefix" = "xNONE" -o "x$prefix" = "x/usr" -o "x$prefix" = "x/usr/local" ; then
-      slashlibdir=/lib
-    else
-      slashlibdir=$prefix/lib
-    fi
-    UDEV_RULES_DIR=$slashlibdir/udev/rules.d
-    ;;
-  *)
-    UDEV_RULES_DIR=no
-    ;;
-esac
+
+PKG_CHECK_MODULES(UDEV, udev,
+                  [UDEV_RULES_DIR="`$PKG_CONFIG --variable=udevdir udev`/rules.d"],
+                  [UDEV_RULES_DIR=no])
 
 AC_ARG_WITH(udev-rules-dir,
 	    AC_HELP_STRING([--with-udev-rules-dir=DIR],
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 23493cd..ea7ba66 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -43,7 +43,6 @@ dist_conf_DATA = 50-vmmouse.conf
 endif
 
 if HAS_UDEV_RULES_DIR
-
 udevdir=$(UDEV_RULES_DIR)
 udev_DATA = 69-xorg-vmmouse.rules
 
-- 
1.7.10.4



More information about the xorg-devel mailing list