From 53ed647b224c98f74a3198215f9fa2fd1a359eb9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Mar 2009 11:10:40 +0100 Subject: configure.ac: fail when ALSA is enabled but not found This patch adds a small autoconf M4 library which deals with auto-detected features. The default for those features is "auto", which is like the old default: if the library is present on the system, enable the feature, disable otherwise. If the user explicitly enables that feature (--enable-alsa), and the library is not present, configure must fail, because it cannot fulfill the request. --- m4/mpd_auto.m4 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 m4/mpd_auto.m4 (limited to 'm4') diff --git a/m4/mpd_auto.m4 b/m4/mpd_auto.m4 new file mode 100644 index 00000000..635f4156 --- /dev/null +++ b/m4/mpd_auto.m4 @@ -0,0 +1,40 @@ +AC_DEFUN([MPD_AUTO_ENABLED], [ + var="enable_$1" + feature="$2" + + if eval "test x`echo '$'$var` = xauto"; then + AC_MSG_NOTICE([auto-detected $feature]) + eval "$var=yes" + fi +]) + +AC_DEFUN([MPD_AUTO_DISABLED], [ + var="enable_$1" + feature="$2" + msg="$3" + + if eval "test x`echo '$'$var` = xauto"; then + AC_MSG_WARN([$msg -- disabling $feature]) + eval "$var=no" + else + AC_MSG_ERROR([$msg]) + fi +]) + +AC_DEFUN([MPD_AUTO_RESULT], [ + name="$1" + var="enable_$1" + found="found_$name" + feature="$2" + msg="$3" + + if eval "test x`echo '$'$var` = xno"; then + eval "$found=no" + fi + + if eval "test x`echo '$'$found` = xyes"; then + MPD_AUTO_ENABLED([$name], [$feature]) + else + MPD_AUTO_DISABLED([$name], [$feature], [$msg]) + fi +]) -- cgit v1.2.3