diff mbox series

[v2,3/4] configure: Let SDL support be optional on OpenBSD

Message ID 20190124011554.25418-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series sdl: Let it be optional (in particular, on OpenBSD) | expand

Commit Message

Philippe Mathieu-Daudé Jan. 24, 2019, 1:15 a.m. UTC
Currently if we try to build QEMU on OpenBSD with SDL disabled, we get:

  $ ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 --disable-sdl

  ERROR: sdl not found or disabled, can not use sdl audio driver

Since SDL is not a requirement for OpenBSD, let it be optional.
If it is not found, or the user explicitly disable it, remove it
from the audio_drv_list.
If no audio backends are available, QEMU will fall back to the
null driver.
Instead of displaying nothing when audio_drv_list ends up empty,
display "none".

This does not change the default behavior:

  $ ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7
  SDL support       yes (1.2.15)
  Audio drivers     sdl

  WARNING: Use of SDL 1.2 is deprecated and will be removed in
  WARNING: future releases. Please switch to using SDL 2.0

  GEN     config-host.h
  ...

but allows to build without SDL:

  $ ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 --disable-sdl
  WARN: sdl not found or disabled, can not use sdl audio driver
  SDL support       no
  Audio drivers     none
  GEN     config-host.h
  ...

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Gerd Hoffmann Jan. 24, 2019, 11:23 a.m. UTC | #1
>      sdl)
>      if test "$sdl" = "no"; then
> -        error_exit "sdl not found or disabled, can not use sdl audio driver"
> +        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
> +        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')

Busy tackling that in a separate patch series (audio: rework driver
probing)

>      fi
>      ;;
>  
> @@ -3408,6 +3409,9 @@ for drv in $audio_drv_list; do
>      ;;
>      esac
>  done
> +if test -z "$audio_drv_list"; then
> +    audio_drv_list="none"
> +fi

Not needed, "none" is used as fallback even without this.

The other tree patches look fine to me, I'll go queue them up.

cheers,
  Gerd
Peter Maydell Jan. 24, 2019, 11:44 a.m. UTC | #2
On Thu, 24 Jan 2019 at 01:16, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> --- a/configure
> +++ b/configure
> @@ -3379,7 +3379,8 @@ for drv in $audio_drv_list; do
>
>      sdl)
>      if test "$sdl" = "no"; then
> -        error_exit "sdl not found or disabled, can not use sdl audio driver"
> +        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
> +        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')

"WARNING:" is what configure mostly uses (though sometimes
also "warning:" and in one case "WARN:")...

thanks
-- PMM
Philippe Mathieu-Daudé Jan. 24, 2019, 1:38 p.m. UTC | #3
On 1/24/19 12:44 PM, Peter Maydell wrote:
> On Thu, 24 Jan 2019 at 01:16, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>> --- a/configure
>> +++ b/configure
>> @@ -3379,7 +3379,8 @@ for drv in $audio_drv_list; do
>>
>>      sdl)
>>      if test "$sdl" = "no"; then
>> -        error_exit "sdl not found or disabled, can not use sdl audio driver"
>> +        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
>> +        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')
> 
> "WARNING:" is what configure mostly uses (though sometimes
> also "warning:" and in one case "WARN:")...

Indeed, which makes me wonder why I used "WARN".

I'll fix, thanks.

Phil.
Philippe Mathieu-Daudé Jan. 24, 2019, 1:51 p.m. UTC | #4
On 1/24/19 12:23 PM, Gerd Hoffmann wrote:
>>      sdl)
>>      if test "$sdl" = "no"; then
>> -        error_exit "sdl not found or disabled, can not use sdl audio driver"
>> +        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
>> +        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')
> 
> Busy tackling that in a separate patch series (audio: rework driver
> probing)

But we need the Milkymist TMU fixes to build without SDL,
I still get this error when building the series you mentioned using
--disable-sdl on OpenBSD:

    LINK    lm32-softmmu/qemu-system-lm32
  hw/lm32/milkymist.o: In function `milkymist_tmu2_create':
  hw/lm32/milkymist-hw.h:114: undefined reference to `XOpenDisplay'
  hw/lm32/milkymist-hw.h:140: undefined reference to `XFree'
  hw/lm32/milkymist-hw.h:141: undefined reference to `XCloseDisplay'
  hw/lm32/milkymist-hw.h:130: undefined reference to `XCloseDisplay'
  ../hw/display/milkymist-tmu2.o: In function `tmu2_glx_init':
  hw/display/milkymist-tmu2.c:112: undefined reference to `XOpenDisplay'
  hw/display/milkymist-tmu2.c:123: undefined reference to `XFree'
  collect2: error: ld returned 1 exit status
  gmake[1]: *** [Makefile:199: qemu-system-lm32] Error 1

> 
>>      fi
>>      ;;
>>  
>> @@ -3408,6 +3409,9 @@ for drv in $audio_drv_list; do
>>      ;;
>>      esac
>>  done
>> +if test -z "$audio_drv_list"; then
>> +    audio_drv_list="none"
>> +fi
> 
> Not needed, "none" is used as fallback even without this.

It is not needed indeed, but I find it clearer when looking at the
./configure output, rather than having an empty list:

  SDL support       no
  Audio drivers
  GEN     config-host.h

vs:

  SDL support       no
  Audio drivers     none
  GEN     config-host.h

Maybe my error was to not clarify that this change is purely cosmetic.

Your call anyway.

> 
> The other tree patches look fine to me, I'll go queue them up.

Thanks! I'll wait for Michael Walle feedbacks before respining rebased
on your work, also fixing "WARN".

> 
> cheers,
>   Gerd
>
Gerd Hoffmann Jan. 24, 2019, 3:33 p.m. UTC | #5
On Thu, Jan 24, 2019 at 02:51:08PM +0100, Philippe Mathieu-Daudé wrote:
> On 1/24/19 12:23 PM, Gerd Hoffmann wrote:
> >>      sdl)
> >>      if test "$sdl" = "no"; then
> >> -        error_exit "sdl not found or disabled, can not use sdl audio driver"
> >> +        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
> >> +        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')
> > 
> > Busy tackling that in a separate patch series (audio: rework driver
> > probing)
> 
> But we need the Milkymist TMU fixes to build without SDL,
> I still get this error when building the series you mentioned using
> --disable-sdl on OpenBSD:

Yep.  Try https://git.kraxel.org/cgit/qemu/log/?h=sirius/drop-sdl1

That is the audio series and the first two patches of this series plus
Daniel's sdl1 removal patch rebased.  Looks good so far, need to run
some more build tests though.

cheers,
  Gerd
diff mbox series

Patch

diff --git a/configure b/configure
index d50defceb7..fa444e9921 100755
--- a/configure
+++ b/configure
@@ -3379,7 +3379,8 @@  for drv in $audio_drv_list; do
 
     sdl)
     if test "$sdl" = "no"; then
-        error_exit "sdl not found or disabled, can not use sdl audio driver"
+        echo "WARN: sdl not found or disabled, can not use sdl audio driver"
+        audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/sdl *//g')
     fi
     ;;
 
@@ -3408,6 +3409,9 @@  for drv in $audio_drv_list; do
     ;;
     esac
 done
+if test -z "$audio_drv_list"; then
+    audio_drv_list="none"
+fi
 
 ##########################################
 # BrlAPI probe