visualtest/configure.in
changeset 7924 fcb86d323770
child 7981 6d538bc1b395
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/visualtest/configure.in	Sun Nov 10 00:32:23 2013 -0500
     1.3 @@ -0,0 +1,166 @@
     1.4 +dnl Process this file with autoconf to produce a configure script.
     1.5 +AC_INIT([sdlvisualtest], [0.01], [apoorvupreti@gmail.com])
     1.6 +
     1.7 +dnl Detect the canonical build and host environments
     1.8 +AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
     1.9 +AC_CANONICAL_HOST
    1.10 +
    1.11 +dnl Check for tools
    1.12 +
    1.13 +AC_PROG_CC
    1.14 +
    1.15 +dnl Check for compiler environment
    1.16 +
    1.17 +AC_C_CONST
    1.18 +
    1.19 +dnl We only care about this for building testnative at the moment, so these
    1.20 +dnl  values shouldn't be considered absolute truth.
    1.21 +dnl  (BeOS, for example, sets none of these.)
    1.22 +ISUNIX="false"
    1.23 +ISWINDOWS="false"
    1.24 +ISMACOSX="false"
    1.25 +
    1.26 +dnl Figure out which math or extra library to use
    1.27 +case "$host" in
    1.28 +    *-*-cygwin* | *-*-mingw32*)
    1.29 +        ISWINDOWS="true"
    1.30 +        EXE=".exe"
    1.31 +        MATHLIB=""
    1.32 +        EXTRALIB="-lshlwapi"
    1.33 +        SYS_GL_LIBS="-lopengl32"
    1.34 +        ;;
    1.35 +    *-*-beos* | *-*-haiku*)
    1.36 +        EXE=""
    1.37 +        MATHLIB=""
    1.38 +        EXTRALIB=""
    1.39 +        SYS_GL_LIBS="-lGL"
    1.40 +        ;;
    1.41 +    *-*-darwin* )
    1.42 +        ISMACOSX="true"
    1.43 +        EXE=""
    1.44 +        MATHLIB=""
    1.45 +        EXTRALIB=""
    1.46 +
    1.47 +        ;;
    1.48 +    *-*-aix*)
    1.49 +        ISUNIX="true"
    1.50 +        EXE=""
    1.51 +        if test x$ac_cv_prog_gcc = xyes; then
    1.52 +            CFLAGS="-mthreads"
    1.53 +        fi
    1.54 +        MATHLIB=""
    1.55 +        EXTRALIB=""
    1.56 +        SYS_GL_LIBS=""
    1.57 +        ;;
    1.58 +    *-*-mint*)
    1.59 +        EXE=""
    1.60 +        MATHLIB=""
    1.61 +        EXTRALIB=""
    1.62 +        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
    1.63 +        if test "x$OSMESA_CONFIG" = "xyes"; then
    1.64 +            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
    1.65 +            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
    1.66 +            CFLAGS="$CFLAGS $OSMESA_CFLAGS"
    1.67 +            SYS_GL_LIBS="$OSMESA_LIBS"
    1.68 +        else
    1.69 +            SYS_GL_LIBS="-lOSMesa"
    1.70 +        fi
    1.71 +        ;;
    1.72 +    *-*-qnx*)
    1.73 +        EXE=""
    1.74 +        MATHLIB=""
    1.75 +        EXTRALIB=""
    1.76 +        SYS_GL_LIBS="-lGLES_CM"
    1.77 +        ;;
    1.78 +    *)
    1.79 +        dnl Oh well, call it Unix...
    1.80 +        ISUNIX="true"
    1.81 +        EXE=""
    1.82 +        MATHLIB="-lm"
    1.83 +        EXTRALIB=""
    1.84 +        SYS_GL_LIBS="-lGL"
    1.85 +        ;;
    1.86 +esac
    1.87 +AC_SUBST(EXE)
    1.88 +AC_SUBST(MATHLIB)
    1.89 +AC_SUBST(EXTRALIB)
    1.90 +AC_SUBST(ISMACOSX)
    1.91 +AC_SUBST(ISWINDOWS)
    1.92 +AC_SUBST(ISUNIX)
    1.93 +
    1.94 +dnl Check for SDL
    1.95 +SDL_VERSION=2.0.0
    1.96 +AM_PATH_SDL2($SDL_VERSION,
    1.97 +            :,
    1.98 +	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    1.99 +)
   1.100 +CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.101 +LIBS="$LIBS -lSDL2_test $SDL_LIBS $EXTRALIB"
   1.102 +
   1.103 +dnl Check for X11 path, needed for OpenGL on some systems
   1.104 +AC_PATH_X
   1.105 +if test x$have_x = xyes; then
   1.106 +    if test x$ac_x_includes = xno || test x$ac_x_includes = x; then
   1.107 +        :
   1.108 +    else
   1.109 +        CFLAGS="$CFLAGS -I$ac_x_includes"
   1.110 +    fi
   1.111 +    if test x$ac_x_libraries = xno || test x$ac_x_libraries = x; then
   1.112 +        :
   1.113 +    else
   1.114 +        XPATH="-L$ac_x_libraries"
   1.115 +    fi
   1.116 +fi
   1.117 +
   1.118 +dnl Check for OpenGL
   1.119 +AC_MSG_CHECKING(for OpenGL support)
   1.120 +have_opengl=no
   1.121 +AC_TRY_COMPILE([
   1.122 + #include "SDL_opengl.h"
   1.123 +],[
   1.124 +],[
   1.125 +have_opengl=yes
   1.126 +])
   1.127 +AC_MSG_RESULT($have_opengl)
   1.128 +
   1.129 +dnl Check for OpenGL ES
   1.130 +AC_MSG_CHECKING(for OpenGL ES support)
   1.131 +have_opengles=no
   1.132 +AC_TRY_COMPILE([
   1.133 + #if defined (__IPHONEOS__)
   1.134 +    #include <OpenGLES/ES1/gl.h>
   1.135 + #else
   1.136 +    #include <GLES/gl.h>
   1.137 + #endif /* __QNXNTO__ */
   1.138 +],[
   1.139 +],[
   1.140 +have_opengles=yes
   1.141 +])
   1.142 +AC_MSG_RESULT($have_opengles)
   1.143 +
   1.144 +GLLIB=""
   1.145 +if test x$have_opengles = xyes; then
   1.146 +    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
   1.147 +    GLLIB="$XPATH -lGLESv1_CM"
   1.148 +elif test x$have_opengl = xyes; then
   1.149 +    CFLAGS="$CFLAGS -DHAVE_OPENGL"
   1.150 +    GLLIB="$XPATH $SYS_GL_LIBS"
   1.151 +else
   1.152 +    GLLIB=""
   1.153 +fi
   1.154 +
   1.155 +AC_SUBST(GLLIB)
   1.156 +
   1.157 +dnl Check for SDL_ttf
   1.158 +AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
   1.159 +if test x$have_SDL_ttf = xyes; then
   1.160 +    CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
   1.161 +    SDL_TTF_LIB="-lSDL2_ttf"
   1.162 +fi
   1.163 +AC_SUBST(SDL_TTF_LIB)
   1.164 +
   1.165 +dnl Finally create all the generated files
   1.166 +dnl AC_OUTPUT([Makefile])
   1.167 +AC_CONFIG_HEADERS([config.h])
   1.168 +AC_CONFIG_FILES([Makefile])
   1.169 +AC_OUTPUT()