test/configure.in
author Gabriel Jacobo <gabomdq@gmail.com>
Wed, 28 Aug 2013 10:41:25 -0300
changeset 7703 982abfefd19d
parent 7495 c4ba5e5c2765
child 7704 3182291fc65f
permissions -rw-r--r--
Fixes test building
     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  (BeOS, 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     *-*-beos* | *-*-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  $SDL_LIBS -lSDL2_test"
    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; 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         XPATH="-L$ac_x_libraries"
   103         XLIB="-lX11"
   104     fi
   105 fi
   106 
   107 dnl Check for OpenGL
   108 AC_MSG_CHECKING(for OpenGL support)
   109 have_opengl=no
   110 AC_TRY_COMPILE([
   111  #include "SDL_opengl.h"
   112 ],[
   113 ],[
   114 have_opengl=yes
   115 ])
   116 AC_MSG_RESULT($have_opengl)
   117 
   118 dnl Check for OpenGL ES
   119 AC_MSG_CHECKING(for OpenGL ES support)
   120 have_opengles=no
   121 AC_TRY_COMPILE([
   122  #if defined (__IPHONEOS__)
   123     #include <OpenGLES/ES1/gl.h>
   124  #else
   125     #include <GLES/gl.h>
   126  #endif /* __QNXNTO__ */
   127 ],[
   128 ],[
   129 have_opengles=yes
   130 ])
   131 AC_MSG_RESULT($have_opengles)
   132 
   133 GLLIB=""
   134 if test x$have_opengles = xyes; then
   135     CFLAGS="$CFLAGS -DHAVE_OPENGLES"
   136     GLLIB="$XPATH -lGLESv1_CM"
   137 elif test x$have_opengl = xyes; then
   138     CFLAGS="$CFLAGS -DHAVE_OPENGL"
   139     GLLIB="$XPATH $SYS_GL_LIBS"
   140 else
   141     GLLIB=""
   142 fi
   143 
   144 AC_SUBST(GLLIB)
   145 AC_SUBST(XLIB)
   146 
   147 dnl Check for SDL_ttf
   148 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
   149 if test x$have_SDL_ttf = xyes; then
   150     CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
   151     SDL_TTF_LIB="-lSDL2_ttf"
   152 fi
   153 AC_SUBST(SDL_TTF_LIB)
   154 
   155 dnl Finally create all the generated files
   156 AC_OUTPUT([Makefile])