From 90f91153173992335661c2a347f1558a301e5185 Mon Sep 17 00:00:00 2001 From: "Ben \"root\" Anderson" Date: Sat, 26 Oct 2013 18:03:46 -0500 Subject: [PATCH] OpenGL detection overhaul. 1) Fix some bad quoting 2) More consistent formatting 3) Add GLU detection 4) Rewrite GLEW detection from scratch and move it to opengl.m4 where it belongs. --- autoconf/m4/opengl.m4 | 34 +++++++++++++++++++++++++++++----- configure.ac | 17 ----------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/autoconf/m4/opengl.m4 b/autoconf/m4/opengl.m4 index 9337b977cb..7ab304f914 100644 --- a/autoconf/m4/opengl.m4 +++ b/autoconf/m4/opengl.m4 @@ -8,14 +8,38 @@ AC_DEFUN([SM_OPENGL], GL_LIBS="" - AX_CHECK_LIB_USING_HEADER(GL, 'glBegin(GL_POINTS)', GL/gl.h, [GL_LIBS="-lGL"]) + AX_CHECK_LIB_USING_HEADER(GL, glBegin(GL_POINTS), GL/gl.h, [GL_LIBS="-lGL"]) if test "$GL_LIBS" = ""; then - AX_CHECK_LIB_USING_HEADER(opengl32, 'glBegin(GL_POINTS)', GL/gl.h, [GL_LIBS="-lopengl32"]) - fi - if test "$GL_LIBS" = ""; then - AC_MSG_ERROR("No usable OpenGL library found.") + AX_CHECK_LIB_USING_HEADER(opengl32, glBegin(GL_POINTS), GL/gl.h, [GL_LIBS="-lopengl32"]) fi + if test "$GL_LIBS" = ""; then + AC_MSG_ERROR("No usable OpenGL library found.") + fi + + AX_CHECK_LIB_USING_HEADER(GLU, gluGetString(GLU_VERSION), GL/glu.h, [GLU_LIBS="-lGLU"]) + + if test "$GLU_LIBS" = ""; then + AX_CHECK_LIB_USING_HEADER(glu32, gluGetString(GLU_VERSION), GL/glu.h, [GLU_LIBS="-lglu32"]) + fi + + if test "$GLU_LIBS" = ""; then + AC_MSG_ERROR("No usable GLU library found.") + fi + + AX_CHECK_LIB_USING_HEADER(GLEW, glewInit(), GL/glew.h, [GLEW_LIBS="$LIBS -lGLEW"]) + + if test "$GLEW_LIBS" = ""; then + AX_CHECK_LIB_USING_HEADER(glew32, glewInit(), GL/glew.h, [GLEW_LIBS="$LIBS -lglew32"]) + fi + + if test "$GLEW_LIBS" = ""; then + AC_MSG_ERROR("No usable version of GLEW found.") + fi + + AC_CHECK_DECL(GLEW_VERSION_2_1, , AC_MSG_ERROR("GLEW 1.3.5 or newer is required."), [#include ]) + + GL_LIBS="$GL_LIBS $GLU_LIBS $GLEW_LIBS" AC_SUBST(GL_LIBS) ]) \ No newline at end of file diff --git a/configure.ac b/configure.ac index ff542c4093..67c8343f8d 100644 --- a/configure.ac +++ b/configure.ac @@ -348,23 +348,6 @@ AC_CHECK_DECL(strtof, , AC_DEFINE([NEED_STRTOF],1,[Need strtof]), [#include ]) -have_glew="no" -AX_CHECK_LIB_USING_HEADER(GLEW, 'glewInit()', GL/glew.h, - have_glew="yes" - LIBS="$LIBS -lGLEW", - , - [$LIBS]) - -test $have_glew = "no" && { AX_CHECK_LIB_USING_HEADER(glew32, 'glewInit()', GL/glew.h, - have_glew="yes" - LIBS="$LIBS -lglew32", - , - [$LIBS]) } - -test $have_glew = "no" && AC_MSG_ERROR("Could not find GLEW.") - -AC_CHECK_DECL(GLEW_VERSION_2_1, , AC_MSG_ERROR("GLEW 1.3.5 or newer is required."), [#include ]) - AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[Build test programs]), enable_tests=$enableval, enable_tests=no) AM_CONDITIONAL(BUILD_TESTS, test "$enable_tests" = "yes" )