1dnl Process this file with autoconf to produce a configure script. 2AC_INIT 3AC_CONFIG_SRCDIR([loopwave.c]) 4 5dnl Detect the canonical build and host environments 6AC_CONFIG_AUX_DIR([../build-scripts]) 7AC_CANONICAL_HOST 8 9dnl Check for tools 10AC_PROG_CC 11 12dnl Check for compiler environment 13AC_C_CONST 14 15dnl We only care about this for building testnative at the moment, so these 16dnl values shouldn't be considered absolute truth. 17dnl (Haiku, for example, sets none of these.) 18ISUNIX="false" 19ISWINDOWS="false" 20ISMACOSX="false" 21 22dnl Figure out which math library to use 23case "$host" in 24 *-*-cygwin* | *-*-mingw*) 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 dnl Use the new libOpenGL if present. 84 AC_CHECK_LIB(OpenGL, glBegin, 85 [SYS_GL_LIBS="-lOpenGL"],[SYS_GL_LIBS="-lGL"]) 86 ;; 87esac 88AC_SUBST(EXE) 89AC_SUBST(MATHLIB) 90AC_SUBST(ISMACOSX) 91AC_SUBST(ISWINDOWS) 92AC_SUBST(ISUNIX) 93 94dnl Check for SDL 95SDL_VERSION=2.0.18 96AM_PATH_SDL2($SDL_VERSION, 97 :, 98 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 99) 100CFLAGS="$CFLAGS $SDL_CFLAGS" 101LIBS="$LIBS -lSDL2_test $SDL_LIBS" 102 103dnl Check for X11 path, needed for OpenGL on some systems 104AC_PATH_X 105if test x$have_x = xyes; then 106 if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then 107 : 108 else 109 CFLAGS="$CFLAGS -I$ac_x_includes" 110 fi 111 if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then 112 : 113 else 114 if test "x$ac_x_libraries" = x; then 115 XPATH="" 116 XLIB="-lX11" 117 else 118 XPATH="-L$ac_x_libraries" 119 XLIB="-L$ac_x_libraries -lX11" 120 fi 121 fi 122fi 123 124dnl Check for OpenGL 125AC_MSG_CHECKING(for OpenGL support) 126have_opengl=no 127AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 128 #include "SDL_opengl.h" 129 #ifndef SDL_VIDEO_OPENGL 130 #error SDL_VIDEO_OPENGL 131 #endif 132]],[])], [have_opengl=yes],[]) 133AC_MSG_RESULT($have_opengl) 134 135dnl Check for OpenGL ES 136AC_MSG_CHECKING(for OpenGL ES support) 137have_opengles=no 138AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 139 #include "SDL_opengles.h" 140 #ifndef SDL_VIDEO_OPENGL_ES 141 #error SDL_VIDEO_OPENGL_ES 142 #endif 143]],[])] ,[have_opengles=yes],[]) 144AC_MSG_RESULT($have_opengles) 145 146dnl Check for OpenGL ES2 147AC_MSG_CHECKING(for OpenGL ES2 support) 148have_opengles2=no 149AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 150 #include "SDL_opengles2.h" 151 #ifndef SDL_VIDEO_OPENGL_ES2 152 #error SDL_VIDEO_OPENGL_ES2 153 #endif 154]],[])], [have_opengles2=yes],[]) 155AC_MSG_RESULT($have_opengles2) 156 157GLLIB="" 158GLESLIB="" 159GLES2LIB="" 160OPENGLES1_TARGETS="UNUSED" 161OPENGLES2_TARGETS="UNUSED" 162OPENGL_TARGETS="UNUSED" 163if test x$have_opengles = xyes; then 164 CFLAGS="$CFLAGS -DHAVE_OPENGLES" 165 GLESLIB="$XPATH -lGLESv1_CM" 166 OPENGLES1_TARGETS="TARGETS" 167fi 168if test x$have_opengles2 = xyes; then 169 CFLAGS="$CFLAGS -DHAVE_OPENGLES2" 170 #GLES2LIB="$XPATH -lGLESv2" 171 OPENGLES2_TARGETS="TARGETS" 172fi 173if test x$have_opengl = xyes; then 174 CFLAGS="$CFLAGS -DHAVE_OPENGL" 175 GLLIB="$XPATH $SYS_GL_LIBS" 176 OPENGL_TARGETS="TARGETS" 177fi 178 179AC_SUBST(OPENGLES1_TARGETS) 180AC_SUBST(OPENGLES2_TARGETS) 181AC_SUBST(OPENGL_TARGETS) 182AC_SUBST(GLLIB) 183AC_SUBST(GLESLIB) 184AC_SUBST(GLES2LIB) 185AC_SUBST(XLIB) 186 187dnl Check for SDL_ttf 188AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes) 189if test x$have_SDL_ttf = xyes; then 190 CFLAGS="$CFLAGS -DHAVE_SDL_TTF" 191 SDL_TTF_LIB="-lSDL2_ttf" 192fi 193AC_SUBST(SDL_TTF_LIB) 194 195dnl Really, SDL2_test should be linking against libunwind (if it found 196dnl libunwind.h when configured), but SDL2_test is a static library, so 197dnl there's no way for it to link against it. We could make SDL2 depend on 198dnl it, but we don't want all SDL2 build to suddenly gain an extra dependency, 199dnl so just assume that if it's here now, SDL2_test was probably built with it. 200PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no) 201if test x$have_libunwind = xyes ; then 202 LIBS="$LIBS $LIBUNWIND_LIBS" 203fi 204 205dnl Finally create all the generated files 206AC_CONFIG_FILES([Makefile]) 207AC_OUTPUT 208