From b48809d53c11abd84845c7e67c99b192b4b72f9f Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Thu, 21 Apr 2005 17:37:40 +0000 Subject: - Updated doc/README.opengl - Better extension handling: Distributing own, mangled, glext.h (now myglext.h). Resolving glXgetProcAddress[ARB] during runtime now (original patch by Robert Osfield). Should compile now virtually anywhere. - Test for existence / working GLU (original patch by Alien). - Windows often were opened with the wrong visual ID depending on the single/double buffering flag. Fixed. CVS patchset: 7478 CVS date: 2005/04/21 17:37:40 --- m4/opengl.m4 | 72 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 30 deletions(-) (limited to 'm4') diff --git a/m4/opengl.m4 b/m4/opengl.m4 index fdc30751e..82534be91 100644 --- a/m4/opengl.m4 +++ b/m4/opengl.m4 @@ -1,5 +1,5 @@ dnl -dnl Check for OpenGL & [Glut | GLU] +dnl Check for OpenGL & GLU dnl dnl AM_PATH_OPENGL([ACTION IF FOUND [, ACTION IF NOT FOUND]]) dnl @@ -10,46 +10,58 @@ AC_DEFUN([AM_PATH_OPENGL], [ [enableopengl=$enableval], [enableopengl="yes"] ) + AC_ARG_ENABLE(glu, AC_HELP_STRING([--disable-glu], [build OpenGL plugin without GLU (no verbose errors)]), + [enableglu=$enableval], + [enableglu="yes"] + ) if test x$enableopengl = "xyes"; then AC_CHECK_LIB(GL, glBegin, - [AC_CHECK_HEADER(GL/gl.h, - [ac_have_opengl="yes" - OPENGL_LIBS="-lGL" - dnl check for glut - AC_CHECK_LIB(glut, glutInit, - [ac_have_glut="yes" - GLUT_LIBS="-lglut" - AC_DEFINE(HAVE_GLUT,1,[Define this if you have GLut support available]) - AC_DEFINE(HAVE_OPENGL,1,[Define this if you have OpenGL support available]) - ], - [ac_have_glut="no" - dnl fallback, check for GLU - AC_CHECK_LIB(GLU, gluPerspective, - [ac_have_glu="yes" - GLU_LIBS="-lGLU -lm" - AC_DEFINE(HAVE_GLU,1,[Define this if you have GLU support available]) + [AC_CHECK_LIB(m, tan, + [AC_CHECK_HEADER(GL/gl.h, + [ac_have_opengl="yes" + OPENGL_LIBS="-lGL -lm" AC_DEFINE(HAVE_OPENGL,1,[Define this if you have OpenGL support available]) - ], - [ac_have_glu="no"], - [$X_LIBS $X_PRE_LIBS $OPENGL_LIBS -lGLU -lm $X_EXTRA_LIBS] - ) - ], - [$X_LIBS $X_PRE_LIBS -lglut $X_EXTRA_LIBS] - ) - ] - )], - [], - [$X_LIBS $X_PRE_LIBS -lGL $X_EXTRA_LIBS] + dnl + dnl need to check with some test if this linking with -lGLU actually works... + dnl check for GLU + dnl + if test x$enableglu = "xyes"; then + AC_CHECK_LIB(GLU, gluPerspective, + [AC_CHECK_HEADER(GL/glu.h, + [AC_MSG_CHECKING([if GLU is sane]) + ac_save_LIBS="$LIBS" + LIBS="$X_LIBS $XPRE_LIBS $OPENGL_LIBS -lGLU $X_EXTRA_LIBS" + AC_TRY_LINK([#include +#include ], + [ gluPerspective(45.0f,1.33f,1.0f,1000.0f); glBegin(GL_POINTS); glEnd(); return 0 ], + [ ac_have_glu="yes" + GLU_LIBS="-lGLU" + AC_DEFINE(HAVE_GLU,1,[Define this if you have GLU support available]) + AC_MSG_RESULT(yes)], + [ AC_MSG_RESULT(no) + echo "*** GLU doesn't link with GL; GLU is disabled ***"]) + LIBS="$ac_save_LIBS"] + )], + [], + [$X_LIBS $X_PRE_LIBS $OPENGL_LIBS -lGLU $X_EXTRA_LIBS] + ) + fi + ] + )], + [], + [$X_LIBS $X_PRE_LIBS -lGL -lm $X_EXTRA_LIBS] + )], + [], + [$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS] ) - if test x$ac_have_opengl = "xyes" -a x$ac_have_glut = "xyes" -o x$ac_have_opengl = "xyes" -a x$ac_have_glu = "xyes"; then + if test x$ac_have_opengl = "xyes"; then ac_use_opengl=yes fi fi AC_SUBST(OPENGL_CFLAGS) AC_SUBST(OPENGL_LIBS) - AC_SUBST(GLUT_LIBS) AC_SUBST(GLU_LIBS) AM_CONDITIONAL(HAVE_OPENGL, [test x$ac_use_opengl = "xyes"]) -- cgit v1.2.3