From f4aed04efd355ec3c54cb7dd4b98a1f9ea68f30e Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 27 Mar 2006 08:01:27 +0000 Subject: [PATCH] * Reworked the OpenGL headers and Glut features detection (what did you expect). --- caca/driver_gl.c | 18 ++++++++++-------- configure.ac | 18 +++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/caca/driver_gl.c b/caca/driver_gl.c index f26f574..6c46b65 100644 --- a/caca/driver_gl.c +++ b/caca/driver_gl.c @@ -21,15 +21,17 @@ #if defined(USE_GL) -#ifndef USE_GLUTCHECKLOOP -#include -#include -#include +#ifdef HAVE_OPENGL_GL_H +# include +# include #else -/* glutCheckLoop tested only under MacOSX, so using its default headers path */ -#include -#include -#define glutMainLoopEvent glutCheckLoop +# include +# include +# include +#endif + +#ifdef HAVE_GLUTCHECKLOOP +# define glutMainLoopEvent glutCheckLoop #endif #include diff --git a/configure.ac b/configure.ac index ecc17e7..ca02028 100644 --- a/configure.ac +++ b/configure.ac @@ -146,19 +146,19 @@ fi if test "${enable_gl}" != "no"; then ac_cv_my_have_gl="no" - AC_CHECK_HEADERS(GL/gl.h, + AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h, [AC_CHECK_HEADERS(GL/glut.h, [AC_CHECK_LIB(glut, glutMainLoopEvent, - [ac_cv_my_have_gl="yes" - AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver) - CACA_LIBS="${CACA_LIBS} -lGL -lglut" - CACA_DRIVERS="${CACA_DRIVERS} gl"])] + [ac_cv_my_have_gl="yes"])] [AC_CHECK_LIB(glut, glutCheckLoop, [ac_cv_my_have_gl="yes" - AC_DEFINE(USE_GLUTCHECKLOOP, 1, Define to 1 to activate the glut3 glutCheckLoop call) - CACA_LIBS="${CACA_LIBS} -lGL -lglut" - CACA_DRIVERS="${CACA_DRIVERS} gl"])])]) - if test "${ac_cv_my_have_gl}" = "no" -a "${enable_gl}" = "yes"; then + AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the `glutCheckLoop' function.)])]) + break]) + if test "${ac_cv_my_have_gl}" = "yes"; then + AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver) + CACA_LIBS="${CACA_LIBS} -lGL -lglut" + CACA_DRIVERS="${CACA_DRIVERS} gl" + elif test "${enable_gl}" = "yes"; then AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files]) fi fi