Skip to contentSkip to conversation

add configure check for working alsa

PATCH In review Bernhard Fischer 2 participants 3 messages Jan 4, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add configure check for working alsa

Hi,

This patchlet adds a check to configure that makes sure that we have a working alsa setup.

Previously, if --enable-alsa was given but the user forgot to install the alsa libs proper, the build failed later on due to eventually missing libs. The patch makes sure that the user can spot that alsa support was turned off after configuration completed.

thanks,

configure renamed from qemu_trunk.orig/configure +11 -0
diff --exclude='*.diff' -rduNp ../qemu_trunk.orig/configure ./configure
@@ -509,6 +509,17 @@ fi # sdl compile test
 fi # cross compilation
 fi # -z $sdl
 
+##########################################
+# sound support libraries
+# alsa
+if test "$alsa" = "yes" ; then
+  cat > $TMPC << EOF
+#include <alsa/asoundlib.h>
+int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
+EOF
+  $cc -o $TMPE $TMPC -lasound 2> /dev/null || alsa="no"
+fi # alsa
+
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
   build_docs="yes"
#1 lore raw
Quoted 9 lines · Bernhard Fischer

Hi,

This patchlet adds a check to configure that makes sure that we have a working alsa setup.

Previously, if --enable-alsa was given but the user forgot to install the alsa libs proper, the build failed later on due to eventually missing libs. The patch makes sure that the user can spot that alsa support was turned off after configuration completed.

This is wrong. If the user requests alsa we should honour that request, or fail trying. We should never quietly ignore an explicit user decision.

Making configure fail early with an error is acceptable (as it the current link failure). Ignoring --enable-alsa is not.

Paul

#2 lore raw
Quoted 11 lines · Paul Brook
Quoted 9 lines · Bernhard Fischer

Hi,

This patchlet adds a check to configure that makes sure that we have a working alsa setup.

Previously, if --enable-alsa was given but the user forgot to install the alsa libs proper, the build failed later on due to eventually missing libs. The patch makes sure that the user can spot that alsa support was turned off after configuration completed.

Quoted 5 lines

This is wrong. If the user requests alsa we should honour that request, or fail trying. We should never quietly ignore an explicit user decision.

Making configure fail early with an error is acceptable (as it the current link failure). Ignoring --enable-alsa is not.

Fair enough. Updated variant prints an error if the compile-check failed.

configure renamed from qemu_trunk.orig/configure +19 -0
@@ -509,6 +536,25 @@ fi # sdl compile test
 fi # cross compilation
 fi # -z $sdl
 
+##########################################
+# sound support libraries
+# alsa
+if test "$alsa" = "yes" ; then
+  cat > $TMPC << EOF
+#include <alsa/asoundlib.h>
+int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
+EOF
+  if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
+    :
+  else
+    echo
+    echo "Error: Could not find alsa"
+    echo "Make sure to have the alsa libs and headers installed."
+    echo
+    exit 1
+  fi
+fi # alsa
+
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
   build_docs="yes"