]> icculus.org git repositories - mikachu/openbox.git/blob - m4/gl.m4
omg wrong branch!
[mikachu/openbox.git] / m4 / gl.m4
1 # X11_DEVEL()
2 #
3 # Check for the presence of the X Window System headers and libraries.
4 # Sets the CPPFLAGS and LIBS variables as appropriate.
5 AC_DEFUN([GL_OPTION],
6 [
7   AC_REQUIRE([X11_DEVEL])
8
9   AC_ARG_ENABLE(gl, [  --enable-gl             enable support for OpenGL rendering default=no],
10                 ,[enable_gl="no"])
11
12   # Store these
13   OLDLIBS=$LIBS
14   OLDCPPFLAGS=$CPPFLAGS
15
16   if test "$enable_gl" = "yes"; then
17     AC_CHECK_LIB([GL], [glXGetConfig],
18                  ,
19                  [
20                    enable_gl="no"
21                    AC_MSG_WARN([Disabling GL rendering support])
22                  ])
23   fi
24
25   if test "$enable_gl" = "yes"; then
26     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
27     LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
28
29     AC_MSG_CHECKING([if we can compile with GL])
30     AC_TRY_LINK(
31     [
32       #include <GL/gl.h>
33     ],
34     [
35       GLfloat f = 0.0;
36       glVertex3f(f, f, f);
37     ],
38     [
39       AC_MSG_RESULT([yes])
40     ],
41     [
42       AC_MSG_RESULT([no])
43       AC_MSG_WARN([Disabling GL rendering support])
44       enable_gl="no"
45     ])
46
47     GL_CFLAGS=""
48     GL_LIBS="-lGL"
49     AC_SUBST(GL_CFLAGS)
50     AC_SUBST(GL_LIBS)
51   fi
52
53   CPPFLAGS=$OLDCPPFLAGS
54   LIBS=$OLDLIBS
55
56   AC_MSG_CHECKING([if GL support is enabled])
57   if test "$enable_gl" = "yes"; then
58     AC_MSG_RESULT([yes])
59
60     AC_DEFINE(USE_GL)
61   else
62     AC_MSG_RESULT([no])
63   fi
64   AM_CONDITIONAL([USE_GL], [test "$enable_gl" = "yes"])
65 ])