1 | dnl Available from the GNU Autoconf Macro Archive at:
|
---|
2 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_gl.html
|
---|
3 | dnl
|
---|
4 | AC_DEFUN([AX_CHECK_GL],
|
---|
5 | [AC_REQUIRE([AC_PATH_X])dnl
|
---|
6 | AC_REQUIRE([ACX_PTHREAD])dnl
|
---|
7 |
|
---|
8 | #
|
---|
9 | # There isn't a reliable way to know we should use the Apple OpenGL framework
|
---|
10 | # without a configure option. A Mac OS X user may have installed an
|
---|
11 | # alternative GL implementation (e.g., Mesa), which may or may not depend on X.
|
---|
12 | #
|
---|
13 | AC_ARG_WITH([apple-opengl-framework],
|
---|
14 | [AC_HELP_STRING([--with-apple-opengl-framework],
|
---|
15 | [use Apple OpenGL framework (Mac OS X only)])])
|
---|
16 | if test "X$with_apple_opengl_framework" = "Xyes"; then
|
---|
17 | AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
|
---|
18 | [Use the Apple OpenGL framework.])
|
---|
19 | GL_LIBS="-framework OpenGL"
|
---|
20 | else
|
---|
21 | AC_LANG_PUSH(C)
|
---|
22 |
|
---|
23 | AX_LANG_COMPILER_MS
|
---|
24 | if test X$ax_compiler_ms = Xno; then
|
---|
25 | GL_CFLAGS="${PTHREAD_CFLAGS}"
|
---|
26 | GL_CXXFLAGS="${PTHREAD_CXXFLAGS}"
|
---|
27 | GL_LIBS="${PTHREAD_LIBS} -lm"
|
---|
28 | fi
|
---|
29 |
|
---|
30 | #
|
---|
31 | # Use x_includes and x_libraries if they have been set (presumably by
|
---|
32 | # AC_PATH_X).
|
---|
33 | #
|
---|
34 | if test "X$no_x" != "Xyes"; then
|
---|
35 | if test -n "$x_includes"; then
|
---|
36 | GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
|
---|
37 | GL_CXXFLAGS="-I${x_includes} ${GL_CXXFLAGS}"
|
---|
38 | fi
|
---|
39 | if test -n "$x_libraries"; then
|
---|
40 | GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
|
---|
41 | fi
|
---|
42 | fi
|
---|
43 |
|
---|
44 | AC_CHECK_HEADERS([windows.h])
|
---|
45 |
|
---|
46 | AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
|
---|
47 | [ax_cv_check_gl_libgl="no"
|
---|
48 | ax_save_CPPFLAGS="${CPPFLAGS}"
|
---|
49 | CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
|
---|
50 | CXXFLAGS="${GL_CXXFLAGS} ${CXXFLAGS}"
|
---|
51 | ax_save_LIBS="${LIBS}"
|
---|
52 | LIBS=""
|
---|
53 | ax_check_libs="-lopengl32 -lGL"
|
---|
54 | for ax_lib in ${ax_check_libs}; do
|
---|
55 | if test X$ax_compiler_ms = Xyes; then
|
---|
56 | ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
|
---|
57 | else
|
---|
58 | ax_try_lib="${ax_lib}"
|
---|
59 | fi
|
---|
60 | LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
|
---|
61 | AC_LINK_IFELSE(
|
---|
62 | [AC_LANG_PROGRAM([[
|
---|
63 | # if HAVE_WINDOWS_H && defined(_WIN32)
|
---|
64 | # include <windows.h>
|
---|
65 | # endif
|
---|
66 | # include <GL/gl.h>]],
|
---|
67 | [[glBegin(0)]])],
|
---|
68 | [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
|
---|
69 | done
|
---|
70 | LIBS=${ax_save_LIBS}
|
---|
71 | CPPFLAGS=${ax_save_CPPFLAGS}])
|
---|
72 |
|
---|
73 | if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
|
---|
74 | no_gl="yes"
|
---|
75 | GL_CFLAGS=""
|
---|
76 | GL_CXXFLAGS=""
|
---|
77 | GL_LIBS=""
|
---|
78 | else
|
---|
79 | GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
|
---|
80 | fi
|
---|
81 | AC_LANG_POP(C)
|
---|
82 | fi
|
---|
83 |
|
---|
84 | AC_SUBST([GL_CFLAGS])
|
---|
85 | AC_SUBST([GL_CXXFLAGS])
|
---|
86 | AC_SUBST([GL_LIBS])
|
---|
87 | ])dnl
|
---|