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 *) 75 dnl Oh well, call it Unix... 76 ISUNIX="true" 77 EXE="" 78 MATHLIB="-lm" 79 SYS_GL_LIBS="-lGL" 80 ;; 81esac 82AC_SUBST(EXE) 83AC_SUBST(MATHLIB) 84AC_SUBST(ISMACOSX) 85AC_SUBST(ISWINDOWS) 86AC_SUBST(ISUNIX) 87 88dnl Check for SDL 89SDL_VERSION=2.0.0 90AM_PATH_SDL2($SDL_VERSION, 91 :, 92 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 93) 94CFLAGS="$CFLAGS $SDL_CFLAGS" 95LIBS="$LIBS -lSDL2_test $SDL_LIBS" 96 97dnl Check for X11 path, needed for OpenGL on some systems 98AC_PATH_X 99if test x$have_x = xyes; then 100 if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then 101 : 102 else 103 CFLAGS="$CFLAGS -I$ac_x_includes" 104 fi 105 if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then 106 : 107 else 108 if test "x$ac_x_libraries" = x; then 109 XPATH="" 110 XLIB="-lX11" 111 else 112 XPATH="-L$ac_x_libraries" 113 XLIB="-L$ac_x_libraries -lX11" 114 fi 115 fi 116fi 117 118dnl Check for OpenGL 119AC_MSG_CHECKING(for OpenGL support) 120have_opengl=no 121AC_TRY_COMPILE([ 122 #include "SDL_opengl.h" 123],[ 124],[ 125have_opengl=yes 126]) 127AC_MSG_RESULT($have_opengl) 128 129dnl Check for OpenGL ES 130AC_MSG_CHECKING(for OpenGL ES support) 131have_opengles=no 132AC_TRY_COMPILE([ 133 #if defined (__IPHONEOS__) 134 #include <OpenGLES/ES1/gl.h> 135 #else 136 #include <GLES/gl.h> 137 #endif /* __QNXNTO__ */ 138],[ 139],[ 140have_opengles=yes 141]) 142AC_MSG_RESULT($have_opengles) 143 144dnl Check for OpenGL ES2 145AC_MSG_CHECKING(for OpenGL ES2 support) 146have_opengles2=no 147AC_TRY_COMPILE([ 148 #if defined (__IPHONEOS__) 149 #include <OpenGLES/ES2/gl.h> 150 #include <OpenGLES/ES2/glext.h> 151 #else 152 #include <GLES2/gl2.h> 153 #include <GLES2/gl2ext.h> 154 #endif 155],[ 156],[ 157have_opengles2=yes 158]) 159AC_MSG_RESULT($have_opengles2) 160 161GLLIB="" 162GLESLIB="" 163GLES2LIB="" 164OPENGLES1_TARGETS="UNUSED" 165OPENGLES2_TARGETS="UNUSED" 166OPENGL_TARGETS="UNUSED" 167if test x$have_opengles = xyes; then 168 CFLAGS="$CFLAGS -DHAVE_OPENGLES" 169 GLESLIB="$XPATH -lGLESv1_CM" 170 OPENGLES1_TARGETS="TARGETS" 171fi 172if test x$have_opengles2 = xyes; then 173 CFLAGS="$CFLAGS -DHAVE_OPENGLES2" 174 #GLES2LIB="$XPATH -lGLESv2" 175 OPENGLES2_TARGETS="TARGETS" 176fi 177if test x$have_opengl = xyes; then 178 CFLAGS="$CFLAGS -DHAVE_OPENGL" 179 GLLIB="$XPATH $SYS_GL_LIBS" 180 OPENGL_TARGETS="TARGETS" 181fi 182 183AC_SUBST(OPENGLES1_TARGETS) 184AC_SUBST(OPENGLES2_TARGETS) 185AC_SUBST(OPENGL_TARGETS) 186AC_SUBST(GLLIB) 187AC_SUBST(GLESLIB) 188AC_SUBST(GLES2LIB) 189AC_SUBST(XLIB) 190 191dnl Check for SDL_ttf 192AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) 193if test x$have_SDL_ttf = xyes; then 194 CFLAGS="$CFLAGS -DHAVE_SDL_TTF" 195 SDL_TTF_LIB="-lSDL2_ttf" 196fi 197AC_SUBST(SDL_TTF_LIB) 198 199dnl Finally create all the generated files 200AC_OUTPUT([Makefile]) 201