Skip to contentSkip to conversation

configure: don't warn GTK if disabled

PATCH In review Peter Xu 4 participants 6 messages Apr 9, 2018 – Apr 10, 2018

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 configure: don't warn GTK if disabled

We don't need to detect GTK ABI if GTK is disabled in general. Otherwise we could get this warning (when host is installed with GTK ABI version 2) even when configure with "--disable-gtk":

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

CC Paolo Bonzini <[email protected]>
CC Gerd Hoffmann <[email protected]>
CC Peter Maydell <[email protected]>
CC Fam Zheng <[email protected]>
CC "Philippe Mathieu-Daudé" <[email protected]>
---
 configure | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
configure +11 -12
index 4d0e92c96c..ce67ad050e 100755
@@ -2537,19 +2537,18 @@ fi
 ##########################################
 # GTK probe
 
-if test "$gtkabi" = ""; then
-    # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
-    # Use 2.0 as a fallback if that is available.
-    if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
-        gtkabi=3.0
-    elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
-        gtkabi=2.0
-    else
-        gtkabi=3.0
-    fi
-fi
-
 if test "$gtk" != "no"; then
+    if test "$gtkabi" = ""; then
+        # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
+        # Use 2.0 as a fallback if that is available.
+        if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
+            gtkabi=3.0
+        elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
+            gtkabi=2.0
+        else
+            gtkabi=3.0
+        fi
+    fi
     gtkpackage="gtk+-$gtkabi"
     gtkx11package="gtk+-x11-$gtkabi"
     if test "$gtkabi" = "3.0" ; then
Signature · 1 line
2.14.3
#1 lore raw
Quoted 39 lines · Peter Xu

We don't need to detect GTK ABI if GTK is disabled in general. Otherwise we could get this warning (when host is installed with GTK ABI version 2) even when configure with "--disable-gtk":

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

CC Paolo Bonzini <[email protected]>
CC Gerd Hoffmann <[email protected]>
CC Peter Maydell <[email protected]>
CC Fam Zheng <[email protected]>
CC "Philippe Mathieu-Daudé" <[email protected]>
---
 configure | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
configure +1 -12
index 4d0e92c96c..ce67ad050e 100755
@@ -2537,19 +2537,18 @@ fi
 ##########################################
 # GTK probe
 
-if test "$gtkabi" = ""; then
-    # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
-    # Use 2.0 as a fallback if that is available.
-    if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
-        gtkabi=3.0
-    elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
-        gtkabi=2.0
-    else
-        gtkabi=3.0
-    fi
-fi
-
 if test "$gtk" != "no"; then
+    if test "$gtkabi" = ""; then

configure fi · line 2551

Quoted 10 lines
configure +10 -0
+        # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
+        # Use 2.0 as a fallback if that is available.
+        if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
+            gtkabi=3.0
+        elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
+            gtkabi=2.0
+        else
+            gtkabi=3.0
+        fi
+    fi

Feels to me that since we've deprecated 2.0, we could just *never* auto
detect - just do test -z "$gtkabi" && gtkabi=3.0

Anyone who wants gtk2 should have to use an explicit --with-gtkabi=2.0

configure fi · line 2554

Quoted 3 lines
configure +0 -0
     gtkpackage="gtk+-$gtkabi"
     gtkx11package="gtk+-x11-$gtkabi"
     if test "$gtkabi" = "3.0" ; then

BTW, this same problem you're fixing exists for SDL too I expect

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 4 lines · Daniel P. Berrangé

Feels to me that since we've deprecated 2.0, we could just *never* auto
detect - just do test -z "$gtkabi" && gtkabi=3.0

Anyone who wants gtk2 should have to use an explicit --with-gtkabi=2.0

I think if we still work with gtk2 then we should go ahead and warn-but-use it.

thanks
-- PMM

#3 lore raw
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Daniel P. Berrangé

Feels to me that since we've deprecated 2.0, we could just *never* auto
detect - just do test -z "$gtkabi" && gtkabi=3.0

Anyone who wants gtk2 should have to use an explicit --with-gtkabi=2.0

I think if we still work with gtk2 then we should go ahead and warn-but-use it.

Both are valid choices of course. Since we have Peter (Xu)'s patch, I think we should go for that and revisit in 2.13 whether to remove GTK+ 2.0 support altogether, require an explicit configure argument, or leave things as they are.

Paolo

author
#4 lore raw
Quoted 7 lines · Paolo Bonzini
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Daniel P. Berrangé

Feels to me that since we've deprecated 2.0, we could just *never* auto
detect - just do test -z "$gtkabi" && gtkabi=3.0

Anyone who wants gtk2 should have to use an explicit --with-gtkabi=2.0

Quoted 7 lines
Quoted 2 lines

I think if we still work with gtk2 then we should go ahead and warn-but-use it.

Both are valid choices of course. Since we have Peter (Xu)'s patch, I think we should go for that and revisit in 2.13 whether to remove GTK+ 2.0 support altogether, require an explicit configure argument, or leave things as they are.

Thanks all. Please anyone let me know if a repost is needed. Otherwise I'll keep it as is and I can try to post a similar one for SDL.

Signature · 1 line
Peter Xu
Reviewed-by on v1 1/1
#5 lore raw
In reply to Peter Xu
Quoted 7 lines · Peter Xu

We don't need to detect GTK ABI if GTK is disabled in general. Otherwise we could get this warning (when host is installed with GTK ABI version 2) even when configure with "--disable-gtk":

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

Quoted 7 lines
CC Paolo Bonzini <[email protected]>
CC Gerd Hoffmann <[email protected]>
CC Peter Maydell <[email protected]>
CC Fam Zheng <[email protected]>
CC "Philippe Mathieu-Daudé" <[email protected]>

---

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|