1 dnl Available from the GNU Autoconf Macro Archive at:
2 dnl http://www.gnu.org/software/ac-archive/htmldoc/mdl_have_opengl.html
4 AC_DEFUN([MDL_HAVE_OPENGL],
6 AC_REQUIRE([AC_PROG_CC])
7 AC_REQUIRE([AC_PATH_X])
8 AC_REQUIRE([AC_PATH_XTRA])
10 AC_CACHE_CHECK([for OpenGL], mdl_cv_have_OpenGL,
12 dnl Check for Mesa first, unless we were asked not to.
13 dnl AC_ARG_WITH(Mesa, AC_HELP_STRING([--with-Mesa],[Prefer the Mesa library over a vendors native OpenGL library (default=yes)]))
15 AC_HELP_STRING([--enable-Mesa],[Prefer the Mesa library
16 over a vendors native OpenGL library (default=yes)]),
17 [use_Mesa=$enableval], [use_Mesa=yes])
19 if test x"$use_Mesa" = xyes; then
20 GL_search_list="MesaGL GL"
21 GLU_search_list="MesaGLU GLU"
22 GLX_search_list="MesaGLX GLX"
24 GL_search_list="GL MesaGL"
25 GLU_search_list="GLU MesaGLU"
26 GLX_search_list="GLX MesaGLX"
32 dnl If we are running under X11 then add in the appropriate libraries.
33 if test x"$no_x" != xyes; then
34 dnl Add everything we need to compile and link X programs to GL_X_CFLAGS
37 GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
39 GL_save_CPPFLAGS="$CPPFLAGS"
46 # Save the "AC_MSG_RESULT file descriptor" to FD 8.
49 # Temporarily turn off AC_MSG_RESULT so that the user gets pretty
51 exec AC_FD_MSG>/dev/null
53 AC_SEARCH_LIBS(glAccum, $GL_search_list, have_GL=yes, have_GL=no)
54 AC_SEARCH_LIBS(gluBeginCurve, $GLU_search_list, have_GLU=yes, have_GLU=no)
55 AC_SEARCH_LIBS(glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no)
56 AC_SEARCH_LIBS(glutInit, glut, have_glut=yes, have_glut=no)
60 # Restore pretty messages.
63 if test -n "$LIBS"; then
64 mdl_cv_have_OpenGL=yes
73 dnl Reset GL_X_LIBS regardless, since it was just a temporary variable
74 dnl and we don't want to be global namespace polluters.
78 CPPFLAGS="$GL_save_CPPFLAGS"
82 dnl bugfix: dont forget to cache this variables, too
83 mdl_cv_GL_CFLAGS="$GL_CFLAGS"
84 mdl_cv_GL_LIBS="$GL_LIBS"
85 mdl_cv_have_GL="$have_GL"
86 mdl_cv_have_GLU="$have_GLU"
87 mdl_cv_have_GLX="$have_GLX"
88 mdl_cv_have_glut="$have_glut"
90 GL_CFLAGS="$mdl_cv_GL_CFLAGS"
91 GL_LIBS="$mdl_cv_GL_LIBS"
92 have_GL="$mdl_cv_have_GL"
93 have_GLU="$mdl_cv_have_GLU"
94 have_GLX="$mdl_cv_have_GLX"
95 have_glut="$mdl_cv_have_glut"
97 dnl endof bugfix -ainan