Skip to contentSkip to conversation

configure: add support for audio-{drv,card}-list

PATCH RESEND In review Carlo Marcelo Arenas Belon 3 participants 7 messages Jul 30, 2008 – Jul 31, 2008 KVM

lore
Share & tools
lore
#0 lore raw

cover configure: add support for audio-{drv,card}-list

This is a rebased version of the original patch series presented to fix issues to configure the different audio options in kvm and that is still present in kvm-72 as shown by recent reports.

The following series adds support for the audio option lists from qemu's configure that were added in kvm-71 to support selecting which interface will be used to enable audio in the host from the guest (oss, alsa, sdl, esd, fmod, or pulseaudio) and which audio devices emulation to enable for the guest (ac97, adlib, cs2431a or gus).

PATCH 1/2 : configure: include audio list options for --help output PATCH 2/2 : configure: passthrough for audio-{drv,card}-list

Carlo

#1 lore raw

PATCH 1/2 configure: include audio list options for --help output

Reflects in kvm's configure the qemu options used to enable support for the different libraries used for audio support propagation and the list of audio devices emulated.

This list of options replaces the individual options that were used before kvm-71 with a functional equivalent feature but will require build or script instructions to replace calls to from --enable-{adlib,ac97,gus} or --enable-{coreaudio,alsa,esd,fmod,dsound} with their equivalent flags.

---
 configure |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
configure +3 -2
index 72337c9..2558e0e 100755
@@ -30,10 +30,11 @@ usage() {
 
 EOF
     cd qemu
-    ./configure --help | egrep "enable-|disable-" \
+    ./configure --help | egrep "enable-|disable-|audio-|Available" \
 	| grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
 	| sed -e "s/^  /    /g" \
-	| sed -e"s/  enable/enable/g" | sed -e "s/  disable/disable/g"
+	| sed -e "s/  enable/enable/g" | sed -e "s/  disable/disable/g" \
+	| sed -e "s/  set/set/g" | sed -e "s/  Available/Available/g"
     exit 1
 }
 
Signature · 1 line
1.5.4.5
#2 lore raw

PATCH 2/2 configure: passthrough for audio-{drv,card} and logic cleanup

In reply to Carlo Marcelo Arenas Belon

Avoids reformatting for the options that are send verbatim to qemu's configure and add a passthrough for qemu options that use a space separated list of options like the list for audio drivers enabled or the list for audio devices emulated.

---
 configure |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
configure +13 -4
index 2558e0e..fc05767 100755
@@ -10,6 +10,8 @@ qemu_cflags=
 qemu_ldflags=
 qemu_opts=
 cross_prefix=
+audio_drv_list=
+audio_card_list=
 arch=`uname -m`
 target_exec=
 
@@ -39,7 +41,8 @@ EOF
 }
 
 while [[ "$1" = -* ]]; do
-    opt="$1"; shift
+    optorig="$1"; shift
+    opt="$optorig"
     arg=
     if [[ "$opt" = *=* ]]; then
 	arg="${opt#*=}"
@@ -67,16 +70,21 @@ while [[ "$1" = -* ]]; do
 	--cross-prefix)
 	    cross_prefix="$arg"
             ;;
+	--audio-drv-list)
+	    audio_drv_list="$arg"
+	    ;;
+	--audio-card-list)
+	    audio_card_list="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
 	*)
-	    qemu_opts="$qemu_opts $opt"
+	    qemu_opts="$qemu_opts $optorig"
 	    ;;
     esac
 done
 
-
 #set kenel directory
 libkvm_kerneldir=$(readlink -f kernel)
 
@@ -114,11 +122,12 @@ fi
     --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
     --kernel-path="$libkvm_kerneldir" \
     --prefix="$prefix" \
+    ${audio_drv_list:+"--audio-drv-list=$audio_drv_list"} \
+    ${audio_card_list:+"--audio-card-list=$audio_card_list"} \
     ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
     ${cross_prefix:+"--cpu=$arch"} $qemu_opts
 ) || usage
 
-
 cat <<EOF > config.mak
 ARCH=$arch
 PREFIX=$prefix
Signature · 1 line
1.5.4.5
#3 lore raw

Re: [PATCH 2/2] configure: passthrough for audio-{drv,card} and logic cleanup

This patch fails to achieve the intended aim since the values assigned to audio-*-list are hard-reset in several places in qemu/configure, both for initial variable 'declaration' and when setting sane defaults in the absence of command-line over-rides.

If qemu/configure is to be left alone ./configure will have to insert the options into $qemuopt in a way that will allow the quotes surrounding the arguments to be correctly interpreted by the shell.

#4 lore raw

Re: [PATCH 2/2] configure: passthrough for audio-{drv,card} and logic cleanup

Quoted 4 lines · TJ

This patch fails to achieve the intended aim since the values assigned to audio-*-list are hard-reset in several places in qemu/configure, both for initial variable 'declaration' and when setting sane defaults in the absence of command-line over-rides.

Not really sure which patch you are referring to as there is none on this email, but the one I sent originally in this thread with this subject and that I got back from the list and that is in the mail archive seem to work correctly as shown below :

  kvm-72 $ ./configure | grep Audio
  Audio drivers     oss
  kvm-72 $ ./configure --audio-drv-list="alsa" | grep Audio
  Audio drivers     alsa
  kvm-72 $ ./configure --audio-drv-list="sdl oss alsa" | grep Audio
  Audio drivers     sdl oss alsa

in case your copy got somehow mangled I am sending it again attached so it will be easier to apply by doing something like :

 $ tar -xzf kvm-72.tar.gz
 $ cd kvm-72
 $ patch -p1 < kvm-72-configure-audio-list.patch

Carlo

Quoted 1 line

From 0e457bd68805df64b120a70c44fd62860b759f3c Mon Sep 17 00:00:00 2001

From: Carlo Marcelo Arenas Belon <[email protected]>
Date: Tue, 15 Jul 2008 22:52:42 -0700
Subject: [PATCH 2/2] configure: passthrough for audio-{drv,card}-list and logic cleanup

Avoids reformatting for the options that are send verbatim to qemu's configure and add a passthrough for qemu options that use a space separated list of options like the list for audio drivers enabled or the list for audio devices emulated.

---
 configure |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
configure +13 -4
index 2558e0e..fc05767 100755
@@ -10,6 +10,8 @@ qemu_cflags=
 qemu_ldflags=
 qemu_opts=
 cross_prefix=
+audio_drv_list=
+audio_card_list=
 arch=`uname -m`
 target_exec=
 
@@ -39,7 +41,8 @@ EOF
 }
 
 while [[ "$1" = -* ]]; do
-    opt="$1"; shift
+    optorig="$1"; shift
+    opt="$optorig"
     arg=
     if [[ "$opt" = *=* ]]; then
 	arg="${opt#*=}"
@@ -67,16 +70,21 @@ while [[ "$1" = -* ]]; do
 	--cross-prefix)
 	    cross_prefix="$arg"
             ;;
+	--audio-drv-list)
+	    audio_drv_list="$arg"
+	    ;;
+	--audio-card-list)
+	    audio_card_list="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
 	*)
-	    qemu_opts="$qemu_opts $opt"
+	    qemu_opts="$qemu_opts $optorig"
 	    ;;
     esac
 done
 
-
 #set kenel directory
 libkvm_kerneldir=$(readlink -f kernel)
 
@@ -114,11 +122,12 @@ fi
     --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
     --kernel-path="$libkvm_kerneldir" \
     --prefix="$prefix" \
+    ${audio_drv_list:+"--audio-drv-list=$audio_drv_list"} \
+    ${audio_card_list:+"--audio-card-list=$audio_card_list"} \
     ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
     ${cross_prefix:+"--cpu=$arch"} $qemu_opts
 ) || usage
 
-
 cat <<EOF > config.mak
 ARCH=$arch
 PREFIX=$prefix
Signature · 1 line
1.5.4.5
#5 lore raw

Re: [PATCH 2/2] configure: passthrough for audio-{drv,card} and logic cleanup

Quoted 67 lines · Carlo Marcelo Arenas Belon

Not really sure which patch you are referring to as there is none on this email, but the one I sent originally in this thread with this subject and that I got back from the list and that is in the mail archive seem to work correctly as shown below :

  kvm-72 $ ./configure | grep Audio
  Audio drivers     oss
  kvm-72 $ ./configure --audio-drv-list="alsa" | grep Audio
  Audio drivers     alsa
  kvm-72 $ ./configure --audio-drv-list="sdl oss alsa" | grep Audio
  Audio drivers     sdl oss alsa

in case your copy got somehow mangled I am sending it again attached so it will be easier to apply by doing something like :

 $ tar -xzf kvm-72.tar.gz
 $ cd kvm-72
 $ patch -p1 < kvm-72-configure-audio-list.patch
configure +11 -3
index 2558e0e..fc05767 100755
@@ -10,6 +10,8 @@ qemu_cflags=
 qemu_ldflags=
 qemu_opts=
 cross_prefix=
+audio_drv_list=
+audio_card_list=
 arch=`uname -m`
 target_exec=
 
@@ -39,7 +41,8 @@ EOF
 }
 
 while [[ "$1" = -* ]]; do
-    opt="$1"; shift
+    optorig="$1"; shift
+    opt="$optorig"
     arg=
     if [[ "$opt" = *=* ]]; then
 	arg="${opt#*=}"
@@ -67,16 +70,21 @@ while [[ "$1" = -* ]]; do
 	--cross-prefix)
 	    cross_prefix="$arg"
             ;;
+	--audio-drv-list)
+	    audio_drv_list="$arg"
+	    ;;
+	--audio-card-list)
+	    audio_card_list="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
 	*)
-	    qemu_opts="$qemu_opts $opt"
+	    qemu_opts="$qemu_opts $optorig"
 	    ;;
     esac
 done
 
-
 #set kenel directory
 libkvm_kerneldir=$(readlink -f kernel)
 

configure fi · line 130

Quoted 9 lines
configure +2 -0
@@ -114,11 +122,12 @@ fi
     --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
     --kernel-path="$libkvm_kerneldir" \
     --prefix="$prefix" \
+    ${audio_drv_list:+"--audio-drv-list=$audio_drv_list"} \
+    ${audio_card_list:+"--audio-card-list=$audio_card_list"} \
     ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
     ${cross_prefix:+"--cpu=$arch"} $qemu_opts
 ) || usage
 

Too fragile. It would be best to quote the argument properly so qemu/configure sees the right thing.

I tried playing with printf %q, but only got more annoyed with bash that I usually am. Patches to rewrite ./configure in python are welcome.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw

PATCH 1/1 configure: passthrough for audio-{drv,card} and logic cleanup

In reply to Carlo Marcelo Arenas Belon

This is a revised and tested patch that correctly passes arguments containing spaces to qemu/configure.

Avoids reformatting for the options that are send verbatim to qemu's configure and add a passthrough for qemu options that use a space separated list of options like the list for audio drivers enabled or the list for audio devices emulated.

configure renamed from configure.orig +13 -8
@@ -8,8 +8,10 @@
 want_module=1
 qemu_cflags=
 qemu_ldflags=
-qemu_opts=
+declare -a qemu_opts
 cross_prefix=
+audio_drv_list=
+audio_card_list=
 arch=`uname -m`
 target_exec=
 
@@ -30,15 +32,16 @@
 
 EOF
     cd qemu
-    ./configure --help | egrep "enable-|disable-" \
+    ./configure --help | egrep "enable-|disable-|audio-|Available" \
 	| grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
 	| sed -e "s/^  /    /g" \
-	| sed -e"s/  enable/enable/g" | sed -e "s/  disable/disable/g"
+    | sed -e "s/  enable/enable/g" | sed -e "s/  disable/disable/g" \
+    | sed -e "s/  set/set/g" | sed -e "s/  Available/Available/g"
     exit 1
 }
-
 while [[ "$1" = -* ]]; do
-    opt="$1"; shift
+    optorig="$1"; shift
+    opt="$optorig"
     arg=
     if [[ "$opt" = *=* ]]; then
 	arg="${opt#*=}"
@@ -69,13 +72,15 @@
 	--help)
 	    usage
 	    ;;
+    --audio-*)
+        qemu_opts[${#qemu_opts[@]}]="${opt}=${arg}"
+        ;;
 	*)
-	    qemu_opts="$qemu_opts $opt"
+        qemu_opts[${#qemu_opts[@]}]="${optorig}"
 	    ;;
     esac
 done
 
-
 #set kenel directory
 libkvm_kerneldir=$(readlink -f kernel)
 
@@ -114,7 +119,7 @@
     --kernel-path="$libkvm_kerneldir" \
     --prefix="$prefix" \
     ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
-    ${cross_prefix:+"--cpu=$arch"} $qemu_opts
+    ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}"
 ) || usage
 
 

--