Hi.

Thank you, testers. Attached fix is created with your help.

This patch is proposed for 2.2

Einar
From 6bcecc9812e8a0a0ea05695d563d4edbbed0ea53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Einar=20R=C3=BCnkaru?= <[email protected]>
Date: Mon, 3 Oct 2011 22:22:29 +0300
Subject: [PATCH] Fixed autodetection of OpenGL in configure

$enableval has meaning only in 'action-if-given' part of AC_ARG_ENABLE,
outside it has a random value.
New behaviour:
  --enable-opengl - enables OpenGL unconditionally (no check of libs)
  --disable-opengl - disables Opengl
  omitted - autodetects Opengl
---
 configure.in |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/configure.in b/configure.in
index 6ae29bc..7751f3f 100644
--- a/configure.in
+++ b/configure.in
@@ -438,8 +438,8 @@ AC_ARG_ENABLE(opengl,
 	AC_HELP_STRING([--disable-opengl],
 		[disables hardware accelerated rendering (default=autodetect, requires OpenGL 2.0)]),
 	[ enable_opengl=$enableval ],
-	[ enable_opengl=yes ])
-if test "x$enableval" = "xyes"; then
+	[ enable_opengl=auto ])
+if test "x$enable_opengl" = "xauto"; then
 	AC_CHECK_LIB([GL], [glUseProgram],
 		[OPENGL_LIBS="-lGL"; libGL=yes],
 # On SUSE/OpenSUSE, NVidia places the OpenGL 2.0 capable library in /usr/X11R6/lib
@@ -456,11 +456,17 @@ if test "x$enableval" = "xyes"; then
 		done
 		LIBS="$save_LIBS"
 	)
-fi
-if test "x$libGL" = "xyes"; then
-	enable_opengl=ok
-	OPENGL_LIBS="-lGLU $OPENGL_LIBS"
-	AC_DEFINE(HAVE_GL)
+	if test "x$libGL" = "xyes"; then
+		enable_opengl=ok
+		OPENGL_LIBS="-lGLU $OPENGL_LIBS"
+		AC_DEFINE(HAVE_GL)
+	fi
+else
+	if test "x$enable_opengl" = "xyes"; then
+		enable_opengl=ok
+		OPENGL_LIBS="-lGLU -lGL"
+		AC_DEFINE(HAVE_GL)
+	fi
 fi
 AC_SUBST(OPENGL_LIBS)
 # END OpenGL
-- 
1.7.0.4

Reply via email to