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