1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([README])
5 dnl Detect the canonical build and host environments
6 AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
12 dnl Check for compiler environment
15 dnl We only care about this for building testnative at the moment, so these
16 dnl values shouldn't be considered absolute truth.
17 dnl (Haiku, for example, sets none of these.)
22 dnl Figure out which math library to use
24 *-*-cygwin* | *-*-mingw32*)
28 SYS_GL_LIBS="-lopengl32"
39 SYS_GL_LIBS="-Wl,-framework,OpenGL"
44 if test x$ac_cv_c_compiler_gnu = xyes; then
52 AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
53 if test "x$OSMESA_CONFIG" = "xyes"; then
54 OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
55 OSMESA_LIBS=`$OSMESA_CONFIG --libs`
56 CFLAGS="$CFLAGS $OSMESA_CFLAGS"
57 SYS_GL_LIBS="$OSMESA_LIBS"
59 SYS_GL_LIBS="-lOSMesa"
65 SYS_GL_LIBS="-lGLES_CM"
68 dnl This should really be .js, but we need to specify extra flags when compiling to js
79 dnl Oh well, call it Unix...
94 AM_PATH_SDL2($SDL_VERSION,
96 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
98 CFLAGS="$CFLAGS $SDL_CFLAGS"
99 LIBS="$LIBS -lSDL2_test $SDL_LIBS"
101 dnl Check for X11 path, needed for OpenGL on some systems
103 if test x$have_x = xyes; then
104 if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
107 CFLAGS="$CFLAGS -I$ac_x_includes"
109 if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
112 if test "x$ac_x_libraries" = x; then
116 XPATH="-L$ac_x_libraries"
117 XLIB="-L$ac_x_libraries -lX11"
123 AC_MSG_CHECKING(for OpenGL support)
126 #include "SDL_opengl.h"
127 #ifndef SDL_VIDEO_OPENGL
128 #error SDL_VIDEO_OPENGL
134 AC_MSG_RESULT($have_opengl)
136 dnl Check for OpenGL ES
137 AC_MSG_CHECKING(for OpenGL ES support)
140 #include "SDL_opengles.h"
141 #ifndef SDL_VIDEO_OPENGL_ES
142 #error SDL_VIDEO_OPENGL_ES
148 AC_MSG_RESULT($have_opengles)
150 dnl Check for OpenGL ES2
151 AC_MSG_CHECKING(for OpenGL ES2 support)
154 #include "SDL_opengles2.h"
155 #ifndef SDL_VIDEO_OPENGL_ES2
156 #error SDL_VIDEO_OPENGL_ES2
162 AC_MSG_RESULT($have_opengles2)
167 OPENGLES1_TARGETS="UNUSED"
168 OPENGLES2_TARGETS="UNUSED"
169 OPENGL_TARGETS="UNUSED"
170 if test x$have_opengles = xyes; then
171 CFLAGS="$CFLAGS -DHAVE_OPENGLES"
172 GLESLIB="$XPATH -lGLESv1_CM"
173 OPENGLES1_TARGETS="TARGETS"
175 if test x$have_opengles2 = xyes; then
176 CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
177 #GLES2LIB="$XPATH -lGLESv2"
178 OPENGLES2_TARGETS="TARGETS"
180 if test x$have_opengl = xyes; then
181 CFLAGS="$CFLAGS -DHAVE_OPENGL"
182 GLLIB="$XPATH $SYS_GL_LIBS"
183 OPENGL_TARGETS="TARGETS"
186 AC_SUBST(OPENGLES1_TARGETS)
187 AC_SUBST(OPENGLES2_TARGETS)
188 AC_SUBST(OPENGL_TARGETS)
194 dnl Check for SDL_ttf
195 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
196 if test x$have_SDL_ttf = xyes; then
197 CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
198 SDL_TTF_LIB="-lSDL2_ttf"
200 AC_SUBST(SDL_TTF_LIB)
202 dnl Finally create all the generated files
203 AC_CONFIG_FILES([Makefile])