configure.in (3649B)
1 dnl Process this file with autoconf to produce a configure script. 2 AC_INIT([sdlvisualtest], [0.01], [apoorvupreti@gmail.com]) 3 4 dnl Detect the canonical build and host environments 5 AC_CONFIG_AUX_DIRS($srcdir/../build-scripts) 6 AC_CANONICAL_HOST 7 8 dnl Check for tools 9 10 AC_PROG_CC 11 12 dnl Check for compiler environment 13 14 AC_C_CONST 15 16 dnl We only care about this for building testnative at the moment, so these 17 dnl values shouldn't be considered absolute truth. 18 dnl (Haiku, for example, sets none of these.) 19 ISUNIX="false" 20 ISWINDOWS="false" 21 ISMACOSX="false" 22 23 dnl Figure out which math or extra library to use 24 case "$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 ;; 83 esac 84 AC_SUBST(EXE) 85 AC_SUBST(MATHLIB) 86 AC_SUBST(EXTRALIB) 87 AC_SUBST(ISMACOSX) 88 AC_SUBST(ISWINDOWS) 89 AC_SUBST(ISUNIX) 90 91 dnl Check for SDL 92 SDL_VERSION=2.0.0 93 AM_PATH_SDL2($SDL_VERSION, 94 :, 95 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 96 ) 97 CFLAGS="$CFLAGS $SDL_CFLAGS" 98 LIBS="$LIBS -lSDL2_test $SDL_LIBS $EXTRALIB" 99 100 dnl Check for X11 path, needed for OpenGL on some systems 101 AC_PATH_X 102 if 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 113 fi 114 115 dnl Check for OpenGL 116 AC_MSG_CHECKING(for OpenGL support) 117 have_opengl=no 118 AC_TRY_COMPILE([ 119 #include "SDL_opengl.h" 120 ],[ 121 ],[ 122 have_opengl=yes 123 ]) 124 AC_MSG_RESULT($have_opengl) 125 126 dnl Check for OpenGL ES 127 AC_MSG_CHECKING(for OpenGL ES support) 128 have_opengles=no 129 AC_TRY_COMPILE([ 130 #if defined (__IPHONEOS__) 131 #include <OpenGLES/ES1/gl.h> 132 #else 133 #include <GLES/gl.h> 134 #endif /* __QNXNTO__ */ 135 ],[ 136 ],[ 137 have_opengles=yes 138 ]) 139 AC_MSG_RESULT($have_opengles) 140 141 GLLIB="" 142 if test x$have_opengles = xyes; then 143 CFLAGS="$CFLAGS -DHAVE_OPENGLES" 144 GLLIB="$XPATH -lGLESv1_CM" 145 elif test x$have_opengl = xyes; then 146 CFLAGS="$CFLAGS -DHAVE_OPENGL" 147 GLLIB="$XPATH $SYS_GL_LIBS" 148 else 149 GLLIB="" 150 fi 151 152 AC_SUBST(GLLIB) 153 154 dnl Check for SDL_ttf 155 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) 156 if test x$have_SDL_ttf = xyes; then 157 CFLAGS="$CFLAGS -DHAVE_SDL_TTF" 158 SDL_TTF_LIB="-lSDL2_ttf" 159 fi 160 AC_SUBST(SDL_TTF_LIB) 161 162 dnl Finally create all the generated files 163 dnl AC_OUTPUT([Makefile]) 164 AC_CONFIG_HEADERS([config.h]) 165 AC_CONFIG_FILES([Makefile]) 166 AC_OUTPUT()