1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(README) 3 4dnl Detect the canonical build and host environments 5AC_CONFIG_AUX_DIRS($srcdir/../build-scripts) 6AC_CANONICAL_HOST 7 8dnl Check for tools 9 10AC_PROG_CC 11 12dnl Check for compiler environment 13 14AC_C_CONST 15 16dnl We only care about this for building testnative at the moment, so these 17dnl values shouldn't be considered absolute truth. 18dnl (Haiku, for example, sets none of these.) 19ISUNIX="false" 20ISWINDOWS="false" 21ISMACOSX="false" 22 23dnl Figure out which math library to use 24case "$host" in 25 *-*-cygwin* | *-*-mingw32*) 26 ISWINDOWS="true" 27 EXE=".exe" 28 MATHLIB="" 29 SYS_GL_LIBS="-lopengl32" 30 ;; 31 *-*-haiku*) 32 EXE="" 33 MATHLIB="" 34 SYS_GL_LIBS="-lGL" 35 ;; 36 *-*-darwin* ) 37 ISMACOSX="true" 38 EXE="" 39 MATHLIB="" 40 SYS_GL_LIBS="-Wl,-framework,OpenGL" 41 ;; 42 *-*-aix*) 43 ISUNIX="true" 44 EXE="" 45 if test x$ac_cv_prog_gcc = xyes; then 46 CFLAGS="-mthreads" 47 fi 48 SYS_GL_LIBS="" 49 ;; 50 *-*-mint*) 51 EXE="" 52 MATHLIB="" 53 AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no) 54 if test "x$OSMESA_CONFIG" = "xyes"; then 55 OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags` 56 OSMESA_LIBS=`$OSMESA_CONFIG --libs` 57 CFLAGS="$CFLAGS $OSMESA_CFLAGS" 58 SYS_GL_LIBS="$OSMESA_LIBS" 59 else 60 SYS_GL_LIBS="-lOSMesa" 61 fi 62 ;; 63 *-*-qnx*) 64 EXE="" 65 MATHLIB="" 66 SYS_GL_LIBS="-lGLES_CM" 67 ;; 68 *-*-emscripten* ) 69 dnl This should really be .js, but we need to specify extra flags when compiling to js 70 EXE=".bc" 71 MATHLIB="" 72 SYS_GL_LIBS="" 73 ;; 74 *-*-riscos* ) 75 EXE=",e1f" 76 MATHLIB="" 77 SYS_GL_LIBS="" 78 ;; 79 *) 80 dnl Oh well, call it Unix... 81 ISUNIX="true" 82 EXE="" 83 MATHLIB="-lm" 84 SYS_GL_LIBS="-lGL" 85 ;; 86esac 87AC_SUBST(EXE) 88AC_SUBST(MATHLIB) 89AC_SUBST(ISMACOSX) 90AC_SUBST(ISWINDOWS) 91AC_SUBST(ISUNIX) 92 93dnl Check for SDL 94SDL_VERSION=2.0.0 95AM_PATH_SDL2($SDL_VERSION, 96 :, 97 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 98) 99CFLAGS="$CFLAGS $SDL_CFLAGS" 100LIBS="$LIBS -lSDL2_test $SDL_LIBS" 101 102dnl Check for X11 path, needed for OpenGL on some systems 103AC_PATH_X 104if test x$have_x = xyes; then 105 if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then 106 : 107 else 108 CFLAGS="$CFLAGS -I$ac_x_includes" 109 fi 110 if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then 111 : 112 else 113 if test "x$ac_x_libraries" = x; then 114 XPATH="" 115 XLIB="-lX11" 116 else 117 XPATH="-L$ac_x_libraries" 118 XLIB="-L$ac_x_libraries -lX11" 119 fi 120 fi 121fi 122 123dnl Check for OpenGL 124AC_MSG_CHECKING(for OpenGL support) 125have_opengl=no 126AC_TRY_COMPILE([ 127 #include "SDL_opengl.h" 128 #ifndef SDL_VIDEO_OPENGL 129 #error SDL_VIDEO_OPENGL 130 #endif 131],[ 132],[ 133have_opengl=yes 134]) 135AC_MSG_RESULT($have_opengl) 136 137dnl Check for OpenGL ES 138AC_MSG_CHECKING(for OpenGL ES support) 139have_opengles=no 140AC_TRY_COMPILE([ 141 #include "SDL_opengles.h" 142 #ifndef SDL_VIDEO_OPENGL_ES 143 #error SDL_VIDEO_OPENGL_ES 144 #endif 145],[ 146],[ 147have_opengles=yes 148]) 149AC_MSG_RESULT($have_opengles) 150 151dnl Check for OpenGL ES2 152AC_MSG_CHECKING(for OpenGL ES2 support) 153have_opengles2=no 154AC_TRY_COMPILE([ 155 #include "SDL_opengles2.h" 156 #ifndef SDL_VIDEO_OPENGL_ES2 157 #error SDL_VIDEO_OPENGL_ES2 158 #endif 159],[ 160],[ 161have_opengles2=yes 162]) 163AC_MSG_RESULT($have_opengles2) 164 165GLLIB="" 166GLESLIB="" 167GLES2LIB="" 168OPENGLES1_TARGETS="UNUSED" 169OPENGLES2_TARGETS="UNUSED" 170OPENGL_TARGETS="UNUSED" 171if test x$have_opengles = xyes; then 172 CFLAGS="$CFLAGS -DHAVE_OPENGLES" 173 GLESLIB="$XPATH -lGLESv1_CM" 174 OPENGLES1_TARGETS="TARGETS" 175fi 176if test x$have_opengles2 = xyes; then 177 CFLAGS="$CFLAGS -DHAVE_OPENGLES2" 178 #GLES2LIB="$XPATH -lGLESv2" 179 OPENGLES2_TARGETS="TARGETS" 180fi 181if test x$have_opengl = xyes; then 182 CFLAGS="$CFLAGS -DHAVE_OPENGL" 183 GLLIB="$XPATH $SYS_GL_LIBS" 184 OPENGL_TARGETS="TARGETS" 185fi 186 187AC_SUBST(OPENGLES1_TARGETS) 188AC_SUBST(OPENGLES2_TARGETS) 189AC_SUBST(OPENGL_TARGETS) 190AC_SUBST(GLLIB) 191AC_SUBST(GLESLIB) 192AC_SUBST(GLES2LIB) 193AC_SUBST(XLIB) 194 195dnl Check for SDL_ttf 196AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) 197if test x$have_SDL_ttf = xyes; then 198 CFLAGS="$CFLAGS -DHAVE_SDL_TTF" 199 SDL_TTF_LIB="-lSDL2_ttf" 200fi 201AC_SUBST(SDL_TTF_LIB) 202 203dnl Finally create all the generated files 204AC_OUTPUT([Makefile]) 205