Skip to contentSkip to conversation

configure: Don't permit SDL or GTK on OSX

PATCH Applied Peter Maydell 3 participants 4 messages Aug 14, 2015 – Aug 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Don't permit SDL or GTK on OSX

The cocoa GUI frontend assumes it is the only GUI (it redefines main() so it always gets control before the rest of QEMU), so it does not play well with other UIs like SDL or GTK. (Mostly people building QEMU on OSX don't have the necessary dependencies available for configure to build those other front ends, so mostly this problem goes unnoticed.)

Make configure automatically disable the SDL and GTK front ends if the cocoa front end is enabled. (We were sort of attempting to do this for SDL before, but not in a way that worked very well.)

---
In an ideal world, we'd fix the Cocoa UI front end to play nicely with others, but in the meantime, let's at least give a helpful message to users if they try to select combinations of configure options that won't work.

 configure | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
configure +16 -4
index cd219d8..826858e 100755
@@ -956,7 +956,6 @@ for opt do
   ;;
   --enable-cocoa)
       cocoa="yes" ;
-      sdl="no" ;
       audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
   ;;
   --disable-system) softmmu="no"
@@ -1711,6 +1710,21 @@ else
 fi
 
 ##########################################
+# cocoa implies not SDL or GTK
+# (the cocoa UI code currently assumes it is always the active UI
+# and doesn't interact well with other UI frontend code)
+if test "$cocoa" = "yes"; then
+    if test "$sdl" = "yes"; then
+        error_exit "Cocoa and SDL UIs cannot both be enabled at once"
+    fi
+    if test "$gtk" = "yes"; then
+        error_exit "Cocoa and GTK UIs cannot both be enabled at once"
+    fi
+    gtk=no
+    sdl=no
+fi
+
+##########################################
 # L2TPV3 probe
 
 cat > $TMPC <<EOF
@@ -2287,9 +2301,7 @@ EOF
     if test "$_sdlversion" -lt 121 ; then
       sdl_too_old=yes
     else
-      if test "$cocoa" = "no" ; then
-        sdl=yes
-      fi
+      sdl=yes
     fi
 
     # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Peter Maydell

The cocoa GUI frontend assumes it is the only GUI (it redefines main() so it always gets control before the rest of QEMU), so it does not play well with other UIs like SDL or GTK. (Mostly people building QEMU on OSX don't have the necessary dependencies available for configure to build those other front ends, so mostly this problem goes unnoticed.)

Make configure automatically disable the SDL and GTK front ends if the cocoa front end is enabled. (We were sort of attempting to do this for SDL before, but not in a way that worked very well.)

Quoted 8 lines

---
In an ideal world, we'd fix the Cocoa UI front end to play nicely with others, but in the meantime, let's at least give a helpful message to users if they try to select combinations of configure options that won't work.

 configure | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
Quoted 50 lines
configure +16 -4
index cd219d8..826858e 100755
@@ -956,7 +956,6 @@ for opt do
   ;;
   --enable-cocoa)
       cocoa="yes" ;
-      sdl="no" ;
       audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
   ;;
   --disable-system) softmmu="no"
@@ -1711,6 +1710,21 @@ else
 fi
 
 ##########################################
+# cocoa implies not SDL or GTK
+# (the cocoa UI code currently assumes it is always the active UI
+# and doesn't interact well with other UI frontend code)
+if test "$cocoa" = "yes"; then
+    if test "$sdl" = "yes"; then
+        error_exit "Cocoa and SDL UIs cannot both be enabled at once"
+    fi
+    if test "$gtk" = "yes"; then
+        error_exit "Cocoa and GTK UIs cannot both be enabled at once"
+    fi
+    gtk=no
+    sdl=no
+fi
+
+##########################################
 # L2TPV3 probe
 
 cat > $TMPC <<EOF
@@ -2287,9 +2301,7 @@ EOF
     if test "$_sdlversion" -lt 121 ; then
       sdl_too_old=yes
     else
-      if test "$cocoa" = "no" ; then
-        sdl=yes
-      fi
+      sdl=yes
     fi
 
     # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Signature · 1 line
1.9.1

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 69 lines · Peter Maydell

The cocoa GUI frontend assumes it is the only GUI (it redefines main() so it always gets control before the rest of QEMU), so it does not play well with other UIs like SDL or GTK. (Mostly people building QEMU on OSX don't have the necessary dependencies available for configure to build those other front ends, so mostly this problem goes unnoticed.)

Make configure automatically disable the SDL and GTK front ends if the cocoa front end is enabled. (We were sort of attempting to do this for SDL before, but not in a way that worked very well.)

---
In an ideal world, we'd fix the Cocoa UI front end to play nicely with others, but in the meantime, let's at least give a helpful message to users if they try to select combinations of configure options that won't work.

configure | 20 ++++++++++++++++----

1 file changed, 16 insertions(+), 4 deletions(-)
configure +0 -1
index cd219d8..826858e 100755
@@ -956,7 +956,6 @@ for opt do
  ;;
  --enable-cocoa)
      cocoa="yes" ;
-      sdl="no" ;
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
  ;;
  --disable-system) softmmu="no"
@@ -1711,6 +1710,21 @@ else

fi

##########################################

configure +15 -0
+# cocoa implies not SDL or GTK
+# (the cocoa UI code currently assumes it is always the active UI
+# and doesn't interact well with other UI frontend code)
+if test "$cocoa" = "yes"; then
+    if test "$sdl" = "yes"; then
+        error_exit "Cocoa and SDL UIs cannot both be enabled at once"
+    fi
+    if test "$gtk" = "yes"; then
+        error_exit "Cocoa and GTK UIs cannot both be enabled at once"
+    fi
+    gtk=no
+    sdl=no
+fi
+
+##########################################

# L2TPV3 probe

cat > $TMPC <<EOF

configure +1 -3
@@ -2287,9 +2301,7 @@ EOF
    if test "$_sdlversion" -lt 121 ; then
      sdl_too_old=yes
    else
-      if test "$cocoa" = "no" ; then
-        sdl=yes
-      fi
+      sdl=yes
    fi
 
    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Signature · 1 line
1.9.1

Works on Mac OS 10.6.

author Applied
#3 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

The cocoa GUI frontend assumes it is the only GUI (it redefines main() so it always gets control before the rest of QEMU), so it does not play well with other UIs like SDL or GTK. (Mostly people building QEMU on OSX don't have the necessary dependencies available for configure to build those other front ends, so mostly this problem goes unnoticed.)

Quoted 5 lines

Make configure automatically disable the SDL and GTK front ends if the cocoa front end is enabled. (We were sort of attempting to do this for SDL before, but not in a way that worked very well.)

Applied to master, thanks.

-- PMM