Home | History | Annotate | Download | only in test
      1 dnl Process this file with autoconf to produce a configure script.
      2 AC_INIT(README)
      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 library to use
     24 case "$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         ;;
     75 esac
     76 AC_SUBST(EXE)
     77 AC_SUBST(MATHLIB)
     78 AC_SUBST(ISMACOSX)
     79 AC_SUBST(ISWINDOWS)
     80 AC_SUBST(ISUNIX)
     81 
     82 dnl Check for SDL
     83 SDL_VERSION=2.0.0
     84 AM_PATH_SDL2($SDL_VERSION,
     85             :,
     86 	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
     87 )
     88 CFLAGS="$CFLAGS $SDL_CFLAGS"
     89 LIBS="$LIBS -lSDL2_test $SDL_LIBS"
     90 
     91 dnl Check for X11 path, needed for OpenGL on some systems
     92 AC_PATH_X
     93 if 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
    110 fi
    111 
    112 dnl Check for OpenGL
    113 AC_MSG_CHECKING(for OpenGL support)
    114 have_opengl=no
    115 AC_TRY_COMPILE([
    116  #include "SDL_opengl.h"
    117 ],[
    118 ],[
    119 have_opengl=yes
    120 ])
    121 AC_MSG_RESULT($have_opengl)
    122 
    123 dnl Check for OpenGL ES
    124 AC_MSG_CHECKING(for OpenGL ES support)
    125 have_opengles=no
    126 AC_TRY_COMPILE([
    127  #if defined (__IPHONEOS__)
    128     #include <OpenGLES/ES1/gl.h>
    129  #else
    130     #include <GLES/gl.h>
    131  #endif /* __QNXNTO__ */
    132 ],[
    133 ],[
    134 have_opengles=yes
    135 ])
    136 AC_MSG_RESULT($have_opengles)
    137 
    138 dnl Check for OpenGL ES2
    139 AC_MSG_CHECKING(for OpenGL ES2 support)
    140 have_opengles2=no
    141 AC_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 ],[
    151 have_opengles2=yes
    152 ])
    153 AC_MSG_RESULT($have_opengles2)
    154 
    155 GLLIB=""
    156 GLESLIB=""
    157 GLES2LIB=""
    158 if test x$have_opengles = xyes; then
    159     CFLAGS="$CFLAGS -DHAVE_OPENGLES"
    160     GLESLIB="$XPATH -lGLESv1_CM"
    161 fi
    162 if test x$have_opengles2 = xyes; then
    163     CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
    164     #GLES2LIB="$XPATH -lGLESv2"
    165 fi
    166 if test x$have_opengl = xyes; then
    167     CFLAGS="$CFLAGS -DHAVE_OPENGL"
    168     GLLIB="$XPATH $SYS_GL_LIBS"
    169 fi
    170 
    171 AC_SUBST(GLLIB)
    172 AC_SUBST(GLESLIB)
    173 AC_SUBST(GLES2LIB)
    174 AC_SUBST(XLIB)
    175 
    176 dnl Check for SDL_ttf
    177 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
    178 if test x$have_SDL_ttf = xyes; then
    179     CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
    180     SDL_TTF_LIB="-lSDL2_ttf"
    181 fi
    182 AC_SUBST(SDL_TTF_LIB)
    183 
    184 dnl Finally create all the generated files
    185 AC_OUTPUT([Makefile])
    186