Skip to contentSkip to conversation

configure: proper OpenGL/GLX probe

PATCH In review Michael Walle 1 participant 3 messages Nov 30, 2012 – Dec 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configure: proper OpenGL/GLX probe

Probe for GL and GLX symbols and X11 library. This fixes a build error where the header files are available but the libraries are not.

---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
index 994f731..fedde51 100755
@@ -2323,14 +2323,14 @@ fi
 ##########################################
 # opengl probe, used by milkymist-tmu2
 if test "$opengl" != "no" ; then
-  opengl_libs="-lGL"
+  opengl_libs="-lGL -lX11"
   cat > $TMPC << EOF
 #include <X11/Xlib.h>
 #include <GL/gl.h>
 #include <GL/glx.h>
-int main(void) { return GL_VERSION != 0; }
+int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
 EOF
-  if compile_prog "" "-lGL" ; then
+  if compile_prog "" "-lGL -lX11" ; then
     opengl=yes
   else
     if test "$opengl" = "yes" ; then
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 2/2 configure: rename OpenGL feature to GLX

As the probe now actually checks for the availability of GLX, rename it accordingly. The only user of this feature is the milkymist-tmu2 model.

---
 configure             |   30 +++++++++++++++---------------
 hw/lm32/Makefile.objs |    2 +-
 hw/milkymist-hw.h     |    4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)
configure +15 -15
index fedde51..57fd70f 100755
@@ -215,7 +215,7 @@ rbd=""
 smartcard=""
 smartcard_nss=""
 usb_redir=""
-opengl=""
+glx=""
 zlib="yes"
 guest_agent="yes"
 want_tools="yes"
@@ -829,9 +829,9 @@ for opt do
   ;;
   --enable-vhost-net) vhost_net="yes"
   ;;
-  --disable-opengl) opengl="no"
+  --disable-glx) glx="no"
   ;;
-  --enable-opengl) opengl="yes"
+  --enable-glx) glx="yes"
   ;;
   --disable-rbd) rbd="no"
   ;;
@@ -2321,9 +2321,9 @@ EOF
 fi
 
 ##########################################
-# opengl probe, used by milkymist-tmu2
-if test "$opengl" != "no" ; then
-  opengl_libs="-lGL -lX11"
+# GLX probe, used by milkymist-tmu2
+if test "$glx" != "no" ; then
+  glx_libs="-lGL -lX11"
   cat > $TMPC << EOF
 #include <X11/Xlib.h>
 #include <GL/gl.h>
@@ -2331,13 +2331,13 @@ if test "$opengl" != "no" ; then
 int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
 EOF
   if compile_prog "" "-lGL -lX11" ; then
-    opengl=yes
+    glx=yes
   else
-    if test "$opengl" = "yes" ; then
-      feature_not_found "opengl"
+    if test "$glx" = "yes" ; then
+      feature_not_found "glx"
     fi
-    opengl_libs=
-    opengl=no
+    glx_libs=
+    glx=no
   fi
 fi
 
@@ -3244,7 +3244,7 @@ echo "rbd support       $rbd"
 echo "xfsctl support    $xfs"
 echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
-echo "OpenGL support    $opengl"
+echo "GLX support       $glx"
 echo "libiscsi support  $libiscsi"
 echo "build guest agent $guest_agent"
 echo "seccomp support   $seccomp"
@@ -3540,8 +3540,8 @@ if test "$usb_redir" = "yes" ; then
   echo "CONFIG_USB_REDIR=y" >> $config_host_mak
 fi
 
-if test "$opengl" = "yes" ; then
-  echo "CONFIG_OPENGL=y" >> $config_host_mak
+if test "$glx" = "yes" ; then
+  echo "CONFIG_GLX=y" >> $config_host_mak
 fi
 
 if test "$libiscsi" = "yes" ; then
@@ -3801,7 +3801,7 @@ case "$target_arch2" in
     target_nptl="yes"
   ;;
   lm32)
-    target_libs_softmmu="$opengl_libs"
+    target_libs_softmmu="$glx_libs"
   ;;
   m68k)
     bflt="yes"
hw/lm32/Makefile.objs +1 -1
index 4e1843c..c813eb2 100644
@@ -15,7 +15,7 @@ obj-y += milkymist-minimac2.o
 obj-y += milkymist-pfpu.o
 obj-y += milkymist-softusb.o
 obj-y += milkymist-sysctl.o
-obj-$(CONFIG_OPENGL) += milkymist-tmu2.o
+obj-$(CONFIG_GLX) += milkymist-tmu2.o
 obj-y += milkymist-uart.o
 obj-y += milkymist-vgafb.o
 obj-y += framebuffer.o
hw/milkymist-hw.h +2 -2
index 96b2a7f..19dc7f8 100644
@@ -86,7 +86,7 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
     return dev;
 }
 
-#ifdef CONFIG_OPENGL
+#ifdef CONFIG_GLX
 #include <X11/Xlib.h>
 #include <GL/glx.h>
 static const int glx_fbconfig_attr[] = {
@@ -100,7 +100,7 @@ static const int glx_fbconfig_attr[] = {
 static inline DeviceState *milkymist_tmu2_create(hwaddr base,
         qemu_irq irq)
 {
-#ifdef CONFIG_OPENGL
+#ifdef CONFIG_GLX
     DeviceState *dev;
     Display *d;
     GLXFBConfig *configs;
Signature · 1 line
1.7.2.5
#2 lore raw
In reply to Michael Walle

Am Freitag 30 November 2012, 23:24:11 schrieben Sie:

Quoted 20 lines

Probe for GL and GLX symbols and X11 library. This fixes a build error where the header files are available but the libraries are not.

---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure +1 -1
index 994f731..fedde51 100755
@@ -2323,14 +2323,14 @@ fi
 ##########################################
 # opengl probe, used by milkymist-tmu2
 if test "$opengl" != "no" ; then
-  opengl_libs="-lGL"
+  opengl_libs="-lGL -lX11"
   cat > $TMPC << EOF
 #include <X11/Xlib.h>

configure fi · line 2336

Quoted 10 lines
configure +2 -2
 #include <GL/gl.h>
 #include <GL/glx.h>
-int main(void) { return GL_VERSION != 0; }
+int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
 EOF
-  if compile_prog "" "-lGL" ; then
+  if compile_prog "" "-lGL -lX11" ; then
     opengl=yes
   else
     if test "$opengl" = "yes" ; then

ping, could anyone pick these? blue?

malc, can you ack these patches?

Signature · 1 line
michael