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.

This commit is contained in:
Ben "root" Anderson
2013-10-26 18:03:46 -05:00
parent 2aabd327b3
commit 90f9115317
2 changed files with 29 additions and 22 deletions
+29 -5
View File
@@ -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/glew.h>])
GL_LIBS="$GL_LIBS $GLU_LIBS $GLEW_LIBS"
AC_SUBST(GL_LIBS)
])
-17
View File
@@ -348,23 +348,6 @@ AC_CHECK_DECL(strtof, , AC_DEFINE([NEED_STRTOF],1,[Need strtof]), [#include <std
AC_CHECK_DECLS([SIGPWR, SIGUSR1],,,[#include <signal.h>])
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 <GL/glew.h>])
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" )