1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([sdlvisualtest], [0.01], [apoorvupreti@gmail.com]) 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 or extra library to use 24case "$host" in 25 *-*-cygwin* | *-*-mingw32*) 26 ISWINDOWS="true" 27 EXE=".exe" 28 MATHLIB="" 29 EXTRALIB="-lshlwapi" 30 SYS_GL_LIBS="-lopengl32" 31 ;; 32 *-*-haiku*) 33 EXE="" 34 MATHLIB="" 35 EXTRALIB="" 36 SYS_GL_LIBS="-lGL" 37 ;; 38 *-*-darwin* ) 39 ISMACOSX="true" 40 EXE="" 41 MATHLIB="" 42 EXTRALIB="" 43 44 ;; 45 *-*-aix*) 46 ISUNIX="true" 47 EXE="" 48 if test x$ac_cv_prog_gcc = xyes; then 49 CFLAGS="-mthreads" 50 fi 51 MATHLIB="" 52 EXTRALIB="" 53 SYS_GL_LIBS="" 54 ;; 55 *-*-mint*) 56 EXE="" 57 MATHLIB="" 58 EXTRALIB="" 59 AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no) 60 if test "x$OSMESA_CONFIG" = "xyes"; then 61 OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags` 62 OSMESA_LIBS=`$OSMESA_CONFIG --libs` 63 CFLAGS="$CFLAGS $OSMESA_CFLAGS" 64 SYS_GL_LIBS="$OSMESA_LIBS" 65 else 66 SYS_GL_LIBS="-lOSMesa" 67 fi 68 ;; 69 *-*-qnx*) 70 EXE="" 71 MATHLIB="" 72 EXTRALIB="" 73 SYS_GL_LIBS="-lGLES_CM" 74 ;; 75 *) 76 dnl Oh well, call it Unix... 77 ISUNIX="true" 78 EXE="" 79 MATHLIB="-lm" 80 EXTRALIB="" 81 SYS_GL_LIBS="-lGL" 82 ;; 83esac 84AC_SUBST(EXE) 85AC_SUBST(MATHLIB) 86AC_SUBST(EXTRALIB) 87AC_SUBST(ISMACOSX) 88AC_SUBST(ISWINDOWS) 89AC_SUBST(ISUNIX) 90 91dnl Check for SDL 92SDL_VERSION=2.0.0 93AM_PATH_SDL2($SDL_VERSION, 94 :, 95 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 96) 97CFLAGS="$CFLAGS $SDL_CFLAGS" 98LIBS="$LIBS -lSDL2_test $SDL_LIBS $EXTRALIB" 99 100dnl Check for X11 path, needed for OpenGL on some systems 101AC_PATH_X 102if test x$have_x = xyes; then 103 if test x$ac_x_includes = xno || test x$ac_x_includes = x; then 104 : 105 else 106 CFLAGS="$CFLAGS -I$ac_x_includes" 107 fi 108 if test x$ac_x_libraries = xno || test x$ac_x_libraries = x; then 109 : 110 else 111 XPATH="-L$ac_x_libraries" 112 fi 113fi 114 115dnl Check for OpenGL 116AC_MSG_CHECKING(for OpenGL support) 117have_opengl=no 118AC_TRY_COMPILE([ 119 #include "SDL_opengl.h" 120],[ 121],[ 122have_opengl=yes 123]) 124AC_MSG_RESULT($have_opengl) 125 126dnl Check for OpenGL ES 127AC_MSG_CHECKING(for OpenGL ES support) 128have_opengles=no 129AC_TRY_COMPILE([ 130 #if defined (__IPHONEOS__) 131 #include <OpenGLES/ES1/gl.h> 132 #else 133 #include <GLES/gl.h> 134 #endif /* __QNXNTO__ */ 135],[ 136],[ 137have_opengles=yes 138]) 139AC_MSG_RESULT($have_opengles) 140 141GLLIB="" 142if test x$have_opengles = xyes; then 143 CFLAGS="$CFLAGS -DHAVE_OPENGLES" 144 GLLIB="$XPATH -lGLESv1_CM" 145elif test x$have_opengl = xyes; then 146 CFLAGS="$CFLAGS -DHAVE_OPENGL" 147 GLLIB="$XPATH $SYS_GL_LIBS" 148else 149 GLLIB="" 150fi 151 152AC_SUBST(GLLIB) 153 154dnl Check for SDL_ttf 155AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) 156if test x$have_SDL_ttf = xyes; then 157 CFLAGS="$CFLAGS -DHAVE_SDL_TTF" 158 SDL_TTF_LIB="-lSDL2_ttf" 159fi 160AC_SUBST(SDL_TTF_LIB) 161 162dnl Finally create all the generated files 163dnl AC_OUTPUT([Makefile]) 164AC_CONFIG_HEADERS([config.h]) 165AC_CONFIG_FILES([Makefile]) 166AC_OUTPUT() 167