Skip to contentSkip to conversation

master - configure: check for udev_device_get_is_initialized is available

PATCH Peter Rajnoha 1 participant 1 message Nov 11, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b8779e706e1019a8e8212d81bde0cc7e42be5426
Commit:        b8779e706e1019a8e8212d81bde0cc7e42be5426
Parent:        f82e0210b7cb9f3926ef5051ca34a4ad383ba271
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Wed Nov 11 15:15:34 2015 +0100
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Wed Nov 11 15:15:50 2015 +0100

configure: check for udev_device_get_is_initialized is available

The udev_device_get_is_initialized is available since libudev version
165. Older versions are still used somewhere (e.g. RHEL6). So better check for this fn and use it only if it's available.

---
 aclocal.m4             |    2 +-
 configure              |   44 ++++++++++++++++++++++++++++++++++++++++++++
 configure.in           |    4 ++++
 include/configure.h.in |    3 +++
 lib/device/dev-ext.c   |    2 ++
 5 files changed, 54 insertions(+), 1 deletions(-)
aclocal.m4 +1 -1
index 67b2d59..05e0ad5 100644
@@ -15,7 +15,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 # 
-# Copyright (c) 2004 Scott James Remnant <[email protected]>.
+# Copyright ?? 2004 Scott James Remnant <[email protected]>.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
configure +44 -0

50 lines not on this page · raw message

configure.in +4 -0
index 68bd341..8e04782 100644
@@ -1334,6 +1334,10 @@ if test "$UDEV_SYNC" = yes; then
 	pkg_config_init
 	PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
 	AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
+
+	AC_CHECK_LIB(udev, udev_device_get_is_initialized, AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1,
+	  [Define to 1 if udev_device_get_is_initialized is available.]))
+	LIBS=$ac_check_lib_save_LIBS
 fi
 
 dnl -- Enable udev rules
include/configure.h.in +3 -0
index cb7771f..1681af0 100644
@@ -258,6 +258,9 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
+/* Define to 1 if udev_device_get_is_initialized is available. */
+#undef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
+
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
lib/device/dev-ext.c +2 -0
index 22e9a6d..e8cc012 100644
@@ -60,11 +60,13 @@ static struct dev_ext *_dev_ext_get_udev(struct device *dev)
 	if (!(udev_device = udev_device_new_from_devnum(udev, 'b', dev->dev)))
 		return_NULL;
 
+#ifdef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
 	if (!udev_device_get_is_initialized(udev_device)) {
 		/* Timeout or some other udev db inconsistency! */
 		log_error("Udev database has incomplete information about device %s.", dev_name(dev));
 		return NULL;
 	}
+#endif
 
 	dev->ext.handle = (void *) udev_device;
 	return &dev->ext;