Disable udev automatically if devmapper doesn't support it.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@203
36d66b0a-2a48-0410-832c-
cd162a569da5
AC_ARG_ENABLE([udev],AS_HELP_STRING([--disable-udev],[disable udev support]),[], enable_udev=yes)
AC_ARG_ENABLE([udev],AS_HELP_STRING([--disable-udev],[disable udev support]),[], enable_udev=yes)
+dnl Try to use pkg-config for devmapper, but fallback to old detection
-AC_CHECK_LIB(devmapper, dm_task_set_name,,[AC_MSG_ERROR('You need the device-mapper library')])
-AC_CHECK_LIB(devmapper, dm_task_set_message,,
- [AC_MSG_ERROR([The device-mapper library on your system is too old.])])
+if AC_RUN_LOG([pkg-config --exists --print-errors devmapper]); then
+ PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.03])
+ LIBS="$LIBS $DEVMAPPER_LIBS"
+else
+ AC_CHECK_LIB(devmapper, dm_task_set_name,,
+ [AC_MSG_ERROR('You need the device-mapper library')])
+ AC_CHECK_LIB(devmapper, dm_task_set_message,,
+ [AC_MSG_ERROR([The device-mapper library on your system is too old.])])
+ DEVMAPPER_LIBS=$LIBS
+fi
AC_CHECK_FUNCS([dm_task_set_cookie], [have_cookie=yes], [have_cookie=no])
if test "x$enable_udev" = xyes; then
if test "x$have_cookie" = xno; then
AC_CHECK_FUNCS([dm_task_set_cookie], [have_cookie=yes], [have_cookie=no])
if test "x$enable_udev" = xyes; then
if test "x$have_cookie" = xno; then
- AC_MSG_ERROR([The device-mapper library on your system has no udev support, consider --disable-udev.])
+ AC_MSG_WARN([The device-mapper library on your system has no udev support, udev support disabled.])
+ else
+ AC_DEFINE(USE_UDEV, 1, [Try to use udev synchronisation?])
- AC_DEFINE(USE_UDEV, 1, [Try to use udev synchronisation?])
LIBS=$saved_LIBS
if test "x$enable_selinux" != xno; then
AC_CHECK_LIB(sepol, sepol_bool_set)
LIBS=$saved_LIBS
if test "x$enable_selinux" != xno; then
AC_CHECK_LIB(sepol, sepol_bool_set)