summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorVille Syrjälä <[email protected]>2020-12-13 18:53:33 +0200
committerraveit65 <[email protected]>2020-12-26 23:36:11 +0100
commit1b96bc58cb4ce0ce8f90ec26c97437aaed994001 (patch)
treef601dd7d828d6067f3a1ccb2a88cff1026cc1fbe /configure.ac
parent31da9e1847a5da12c9d81386a29c647908974227 (diff)
downloadlibmatemixer-1b96bc58cb4ce0ce8f90ec26c97437aaed994001.tar.bz2
libmatemixer-1b96bc58cb4ce0ce8f90ec26c97437aaed994001.tar.xz
alsa: Add udev support
Instead of polling for new devices once per second ask udev to send us events. Avoids waking up the CPU all the time and wasting power. We keep the timeout source as a fallback when udev support is not enabled, or the udev setup fails for whatever reason. The logic for udev_event_ok() was snooped from pulseaudio.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac29
1 files changed, 28 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3de0a6b..6081590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,11 +184,38 @@ if test "x$enable_alsa" != "xno"; then
fi
fi
+AC_ARG_ENABLE([udev],
+ AS_HELP_STRING([--enable-udev],
+ [Enable UDEV support @<:@default=auto@:>@]),
+ enable_udev=$enableval,
+ enable_udev=auto)
+
+have_udev=no
+if test "x$enable_udev" != "xno" -a \
+ "x$have_alsa" = "xyes"; then
+ PKG_CHECK_MODULES(UDEV, [libudev],
+ have_udev=yes,
+ have_udev=no)
+ if test "x$have_udev" = "xyes"; then
+ AC_DEFINE(HAVE_UDEV, [], [Define if we have UDEV support])
+ else
+ if test "x$enable_udev" = "xyes"; then
+ AC_MSG_ERROR([UDEV support explicitly requested but dependencies not found])
+ else
+ AC_MSG_NOTICE([UDEV dependencies not found, the module will not be built])
+ fi
+ fi
+fi
+
AM_CONDITIONAL(HAVE_ALSA, test "x$have_alsa" = "xyes")
+AM_CONDITIONAL(HAVE_UDEV, test "x$have_udev" = "xyes")
AC_SUBST(HAVE_ALSA)
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)
+AC_SUBST(HAVE_UDEV)
+AC_SUBST(UDEV_CFLAGS)
+AC_SUBST(UDEV_LIBS)
# -----------------------------------------------------------------------
# OSS
@@ -269,6 +296,6 @@ echo "
Build Null module: $have_null
Build PulseAudio module: $have_pulseaudio
- Build ALSA module: $have_alsa
+ Build ALSA module: $have_alsa (udev: $have_udev)
Build OSS module: $have_oss
"