From f54e8c9ba0a0b4e78a1038a3d3a9644288c6cb4c Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 23 May 2003 05:30:00 +0000 Subject: add --enable-gl support, and put the flags/libs in the appropriate makefiles --- m4/gl.m4 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 m4/gl.m4 (limited to 'm4') diff --git a/m4/gl.m4 b/m4/gl.m4 new file mode 100644 index 00000000..e3592712 --- /dev/null +++ b/m4/gl.m4 @@ -0,0 +1,65 @@ +# X11_DEVEL() +# +# Check for the presence of the X Window System headers and libraries. +# Sets the CPPFLAGS and LIBS variables as appropriate. +AC_DEFUN([GL_OPTION], +[ + AC_REQUIRE([X11_DEVEL]) + + AC_ARG_ENABLE(gl, [ --enable-gl enable support for OpenGL rendering default=no], + ,[enable_gl="no"]) + + # Store these + OLDLIBS=$LIBS + OLDCPPFLAGS=$CPPFLAGS + + if test "$enable_gl" = "yes"; then + AC_CHECK_LIB([GL], [glXGetConfig], + , + [ + enable_gl="no" + AC_MSG_WARN([Disabling GL rendering support]) + ]) + fi + + if test "$enable_gl" = "yes"; then + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS" + + AC_MSG_CHECKING([if we can compile with GL]) + AC_TRY_LINK( + [ + #include + ], + [ + GLfloat f = 0.0; + glVertex3f(f, f, f); + ], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + AC_MSG_WARN([Disabling GL rendering support]) + enable_gl="no" + ]) + + GL_CFLAGS="" + GL_LIBS="-lGL" + AC_SUBST(GL_CFLAGS) + AC_SUBST(GL_LIBS) + fi + + CPPFLAGS=$OLDCPPFLAGS + LIBS=$OLDLIBS + + AC_MSG_CHECKING([if GL support is enabled]) + if test "$enable_gl" = "yes"; then + AC_MSG_RESULT([yes]) + + AC_DEFINE(USE_GL) + else + AC_MSG_RESULT([no]) + fi + AM_CONDITIONAL([USE_GL], [test "$enable_gl" = "yes"]) +]) -- cgit v1.2.3