1 | AC_DEFUN([AX_CHECK_GLU],
|
---|
2 | [AC_REQUIRE([AX_CHECK_GL])dnl
|
---|
3 | AC_REQUIRE([AC_PROG_CXX])dnl
|
---|
4 | GLU_CFLAGS="${GL_CFLAGS}"
|
---|
5 | GLU_CXXFLAGS="${GL_CXXFLAGS}"
|
---|
6 |
|
---|
7 | ax_save_CPPFLAGS="${CPPFLAGS}"
|
---|
8 | CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
|
---|
9 | CFLAGS="${GL_CXXFLAGS} ${CXXFLAGS}"
|
---|
10 | AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h])
|
---|
11 | CPPFLAGS="${ax_save_CPPFLAGS}"
|
---|
12 |
|
---|
13 | m4_define([AX_CHECK_GLU_PROGRAM],
|
---|
14 | [AC_LANG_PROGRAM([[
|
---|
15 | # if defined(HAVE_WINDOWS_H) && defined(_WIN32)
|
---|
16 | # include <windows.h>
|
---|
17 | # endif
|
---|
18 | # ifdef HAVE_GL_GLU_H
|
---|
19 | # include <GL/glu.h>
|
---|
20 | # elif defined(HAVE_OPENGL_GLU_H)
|
---|
21 | # include <OpenGL/glu.h>
|
---|
22 | # else
|
---|
23 | # error no glu.h
|
---|
24 | # endif]],
|
---|
25 | [[gluBeginCurve(0)]])])
|
---|
26 |
|
---|
27 | AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
|
---|
28 | [ax_cv_check_glu_libglu="no"
|
---|
29 | ax_save_CPPFLAGS="${CPPFLAGS}"
|
---|
30 | CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
|
---|
31 | CXXFLAGS="${GL_CXXFLAGS} ${CXXFLAGS}"
|
---|
32 | ax_save_LIBS="${LIBS}"
|
---|
33 |
|
---|
34 | #
|
---|
35 | # First, check for the possibility that everything we need is already in
|
---|
36 | # GL_LIBS.
|
---|
37 | #
|
---|
38 | LIBS="${GL_LIBS} ${ax_save_LIBS}"
|
---|
39 | #
|
---|
40 | # libGLU typically links with libstdc++ on POSIX platforms.
|
---|
41 | # However, setting the language to C++ means that test program
|
---|
42 | # source is named "conftest.cc"; and Microsoft cl doesn't know what
|
---|
43 | # to do with such a file.
|
---|
44 | #
|
---|
45 | AC_LANG_PUSH([C++])
|
---|
46 | AS_IF([test X$ax_compiler_ms = Xyes],
|
---|
47 | [AC_LANG_PUSH([C])])
|
---|
48 | AC_LINK_IFELSE(
|
---|
49 | [AX_CHECK_GLU_PROGRAM],
|
---|
50 | [ax_cv_check_glu_libglu=yes],
|
---|
51 | [LIBS=""
|
---|
52 | ax_check_libs="-lglu32 -lGLU"
|
---|
53 | for ax_lib in ${ax_check_libs}; do
|
---|
54 | AS_IF([test X$ax_compiler_ms = Xyes],
|
---|
55 | [ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`],
|
---|
56 | [ax_try_lib="${ax_lib}"])
|
---|
57 | LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
|
---|
58 | AC_LINK_IFELSE([AX_CHECK_GLU_PROGRAM],
|
---|
59 | [ax_cv_check_glu_libglu="${ax_try_lib}"; break])
|
---|
60 | done
|
---|
61 | ])
|
---|
62 | AS_IF([test X$ax_compiler_ms = Xyes],
|
---|
63 | [AC_LANG_POP([C])])
|
---|
64 | AC_LANG_POP([C++])
|
---|
65 |
|
---|
66 | LIBS=${ax_save_LIBS}
|
---|
67 | CPPFLAGS=${ax_save_CPPFLAGS}])
|
---|
68 | AS_IF([test "X$ax_cv_check_glu_libglu" = Xno],
|
---|
69 | [no_glu=yes; GLU_CFLAGS=""; GLU_CXXFLAGS=""; GLU_LIBS=""],
|
---|
70 | [AS_IF([test "X$ax_cv_check_glu_libglu" = Xyes],
|
---|
71 | [GLU_LIBS="$GL_LIBS"],
|
---|
72 | [GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"])])
|
---|
73 | AC_SUBST([GLU_CFLAGS])
|
---|
74 | AC_SUBST([GLU_CXXFLAGS])
|
---|
75 | AC_SUBST([GLU_LIBS])
|
---|
76 |
|
---|
77 | #
|
---|
78 | # Some versions of Mac OS X include a broken interpretation of the GLU
|
---|
79 | # tesselation callback function signature.
|
---|
80 | #
|
---|
81 | AS_IF([test "X$ax_cv_check_glu_libglu" != Xno],
|
---|
82 | [AC_CACHE_CHECK([for varargs GLU tesselator callback function type],
|
---|
83 | [ax_cv_varargs_glu_tesscb],
|
---|
84 | [ax_cv_varargs_glu_tesscb=no
|
---|
85 | ax_save_CFLAGS="${CFLAGS}"
|
---|
86 | ax_save_CXXFLAGS="${CXXFLAGS}"
|
---|
87 | CFLAGS="${GL_CFLAGS} ${CFLAGS}"
|
---|
88 | CXXFLAGS="${GL_CXXFLAGS} ${CXXFLAGS}"
|
---|
89 | AC_COMPILE_IFELSE(
|
---|
90 | [AC_LANG_PROGRAM([[
|
---|
91 | # ifdef HAVE_GL_GLU_H
|
---|
92 | # include <GL/glu.h>
|
---|
93 | # else
|
---|
94 | # include <OpenGL/glu.h>
|
---|
95 | # endif]],
|
---|
96 | [[GLvoid (*func)(...); gluTessCallback(0, 0, func)]])],
|
---|
97 | [ax_cv_varargs_glu_tesscb=yes])
|
---|
98 | CFLAGS="$ax_save_CFLAGS"]
|
---|
99 | CXXFLAGS="$ax_save_CXXFLAGS"]))
|
---|
100 | AS_IF([test X$ax_cv_varargs_glu_tesscb = Xyes],
|
---|
101 | [AC_DEFINE([HAVE_VARARGS_GLU_TESSCB], [1],
|
---|
102 | [Use nonstandard varargs form for the GLU tesselator callback])])
|
---|
103 | ])
|
---|
104 | ])
|
---|
105 |
|
---|