1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Peter Rajnoha 2015-11-11 15:15:34 +01:00
parent f82e0210b7
commit b8779e706e
5 changed files with 54 additions and 1 deletions

2
aclocal.m4 vendored
View File

@ -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 <scott@netsplit.com>.
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# 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

44
configure vendored
View File

@ -12007,6 +12007,50 @@ fi
$as_echo "#define UDEV_SYNC_SUPPORT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_device_get_is_initialized in -ludev" >&5
$as_echo_n "checking for udev_device_get_is_initialized in -ludev... " >&6; }
if ${ac_cv_lib_udev_udev_device_get_is_initialized+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ludev $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char udev_device_get_is_initialized ();
int
main ()
{
return udev_device_get_is_initialized ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_udev_udev_device_get_is_initialized=yes
else
ac_cv_lib_udev_udev_device_get_is_initialized=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_device_get_is_initialized" >&5
$as_echo "$ac_cv_lib_udev_udev_device_get_is_initialized" >&6; }
if test "x$ac_cv_lib_udev_udev_device_get_is_initialized" = xyes; then :
$as_echo "#define HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED 1" >>confdefs.h
fi
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable installation of udev rules required for synchronisation" >&5

View File

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

View File

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

View File

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