2
dnl Check for OpenGL development environment and GLU >= 1.2
4
AC_DEFUN([FTGL_CHECK_GL],
6
AC_REQUIRE([AC_PROG_CC])
7
AC_REQUIRE([AC_PATH_X])
8
AC_REQUIRE([AC_PATH_XTRA])
10
AC_ARG_WITH([--with-gl-inc],
11
AC_HELP_STRING([--with-gl-inc=DIR],[Directory where GL/gl.h is installed]))
12
AC_ARG_WITH([--with-gl-lib],
13
AC_HELP_STRING([--with-gl-lib=DIR],[Directory where OpenGL libraries are installed]))
14
AC_ARG_WITH([--with-glu-lib],
15
AC_HELP_STRING([--with-glu-lib=DIR],[Directory where OpenGL GLU library is installed]))
20
GL_SAVE_CPPFLAGS="$CPPFLAGS"
23
if test "x$no_x" != xyes ; then
25
GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu $X_EXTRA_LIBS"
28
if test "x$with_gl_inc" != "xnone" ; then
29
if test -d "$with_gl_inc" ; then
30
GL_CFLAGS="-I$with_gl_inc"
32
GL_CFLAGS="$with_gl_inc"
39
AC_CHECK_HEADER([GL/gl.h], [AC_DEFINE([HAVE_GL_GL_H], 1, [Define to 1 if you have the <GL/gl.h header])], [
40
AC_CHECK_HEADER([OpenGL/gl.h], [AC_DEFINE([HAVE_OPENGL_GL_H], 1, [Define to 1 if you have the <OpenGL/gl.h header])], [
41
AC_MSG_ERROR([GL/gl.h or OpenGL/gl.h is needed, please specify its location with --with-gl-inc. If this still fails, please contact henryj@paradise.net.nz, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
45
dnl check whether the OpenGL framework is available
46
AC_MSG_CHECKING([for OpenGL framework (Darwin-specific)])
49
LIBS="$LIBS -Xlinker -framework -Xlinker OpenGL"
50
# -Xlinker is used because libtool is busted prior to 1.6 wrt frameworks
51
AC_TRY_LINK([#include <OpenGL/gl.h>], [glBegin(GL_POINTS)],
52
[GL_DYLIB="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
53
FRAMEWORK_OPENGL="-Xlinker -framework -Xlinker OpenGL -dylib_file $GL_DYLIB: $GL_DYLIB"
54
ac_cv_search_glBegin="$FRAMEWORK_OPENGL"
57
if test x"$FRAMEWORK_OPENGL" != "x"; then
58
with_gl_lib="$FRAMEWORK_OPENGL"
60
AC_SUBST(FRAMEWORK_OPENGL)
63
AC_MSG_CHECKING([for GL library])
66
[*-mingw32], [GL_GL_LIBS="-lopengl32"
67
GL_GLU_LIBS="-lglu32"],
72
if test "x$with_gl_lib" != "x" ; then
73
if test -d "$with_gl_lib" ; then
74
LIBS="-L$with_gl_lib $GL_GL_LIBS"
81
AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes],[
82
dnl This is done here so that we can check for the Win32 version of the
83
dnl GL library, which may not use cdecl calling convention.
84
AC_TRY_LINK([#include <GL/gl.h>],[glBegin(GL_POINTS)],[HAVE_GL=yes],[HAVE_GL=no])]
87
if test "x$HAVE_GL" = xno ; then
88
if test "x$GL_X_LIBS" != x ; then
89
LIBS="$GL_GL_LIBS $GL_X_LIBS"
90
AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
93
if test "x$HAVE_GL" = xyes ; then
98
AC_MSG_ERROR([GL library could not be found, please specify its location with --with-gl-lib. If this still fails, please contact henryj@paradise.net.nz, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
101
AC_CHECK_HEADER([GL/glu.h], [AC_DEFINE([HAVE_GL_GLU_H], 1, [Define to 1 if you have the <GL/glu.h header])], [
102
AC_CHECK_HEADER([OpenGL/glu.h], [AC_DEFINE([HAVE_OPENGL_GLU_H], 1, [Define to 1 if you have the <OpenGL/glu.h header])], [
103
AC_MSG_ERROR([GL/glu.h or OpenGL/glu.h is needed, please specify its location with --with-gl-inc. If this still fails, please contact henryj@paradise.net.nz, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
106
AC_MSG_CHECKING([for GLU version >= 1.2])
111
#ifdef HAVE_OPENGL_GLU_H
112
# include <OpenGL/glu.h>
115
#if !defined(GLU_VERSION_1_2)
119
[AC_MSG_RESULT([yes])],
121
AC_MSG_ERROR([GLU >= 1.2 is needed to compile this library])
124
if test "x$FRAMEWORK_OPENGL" = "x" ; then
126
AC_MSG_CHECKING([for GLU library])
127
if test "x$with_glu_lib" != "x" ; then
128
if test -d "$with_glu_lib" ; then
129
LIBS="$GL_LIBS -L$with_glu_lib $GL_GLU_LIBS"
131
LIBS="$GL_LIBS $with_glu_lib"
134
LIBS="$GL_LIBS $GL_GLU_LIBS"
136
AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [
137
dnl This is done here so that we can check for the Win32 version of the
138
dnl GL library, which may not use cdecl calling convention.
139
AC_TRY_LINK([#include <GL/glu.h>],[gluNewTess()],[HAVE_GLU=yes],[HAVE_GLU=no])]
141
if test "x$HAVE_GLU" = xno ; then
142
if test "x$GL_X_LIBS" != x ; then
143
LIBS="$GL_GLU_LIBS $GL_LIBS $GL_X_LIBS"
144
AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
147
if test "x$HAVE_GLU" = xyes ; then
152
AC_MSG_ERROR([GLU library could not be found, please specify its location with --with-gl-lib. If this still fails, please contact henryj@paradise.net.nz, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
160
CPPFLAGS="$GL_SAVE_CPPFLAGS"