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