1 AC_DEFUN([AX_CHECK_GL],
2 [AC_REQUIRE([AC_PATH_X])dnl
3 AC_REQUIRE([ACX_PTHREAD])dnl
6 # There isn't a reliable way to know we should use the Apple OpenGL framework
7 # without a configure option. A Mac OS X user may have installed an
8 # alternative GL implementation (e.g., Mesa), which may or may not depend on X.
10 AC_ARG_WITH([apple-opengl-framework],
11 [AC_HELP_STRING([--with-apple-opengl-framework],
12 [use Apple OpenGL framework (Mac OS X only)])])
13 if test "X$with_apple_opengl_framework" = "Xyes"; then
14 AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
15 [Use the Apple OpenGL framework.])
16 GL_CFLAGS="-framework OpenGL"
18 GL_CFLAGS="${PTHREAD_CFLAGS}"
19 GL_LIBS="${PTHREAD_LIBS} -lm"
22 # Use x_includes and x_libraries if they have been set (presumably by
25 if test "X$no_x" != "Xyes"; then
26 if test -n "$x_includes"; then
27 GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
29 if test -n "$x_libraries"; then
30 GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
36 AC_CHECK_HEADERS([windows.h])
38 AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
39 [ax_cv_check_gl_libgl="no"
40 ax_save_CPPFLAGS="${CPPFLAGS}"
41 CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
42 ax_save_LIBS="${LIBS}"
44 ax_check_libs="-lopengl32 -lGL"
45 for ax_lib in ${ax_check_libs}; do
46 if test "X$CC" = "Xcl"; then
47 ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
49 ax_try_lib="${ax_lib}"
51 LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
53 # if HAVE_WINDOWS_H && defined(_WIN32)
59 [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
62 CPPFLAGS=${ax_save_CPPFLAGS}])
64 if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
69 GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"