test/configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 17 Oct 2013 23:02:29 -0700
changeset 7828 1451063c8ecd
parent 7794 7995e0920bf9
child 7981 6d538bc1b395
permissions -rw-r--r--
Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
     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 -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 GLLIB=""
   139 GLESLIB=""
   140 if test x$have_opengles = xyes; then
   141     CFLAGS="$CFLAGS -DHAVE_OPENGLES"
   142     GLESLIB="$XPATH -lGLESv1_CM"
   143 fi
   144 if test x$have_opengl = xyes; then
   145     CFLAGS="$CFLAGS -DHAVE_OPENGL"
   146     GLLIB="$XPATH $SYS_GL_LIBS"
   147 fi
   148 
   149 AC_SUBST(GLLIB)
   150 AC_SUBST(GLESLIB)
   151 AC_SUBST(XLIB)
   152 
   153 dnl Check for SDL_ttf
   154 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
   155 if test x$have_SDL_ttf = xyes; then
   156     CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
   157     SDL_TTF_LIB="-lSDL2_ttf"
   158 fi
   159 AC_SUBST(SDL_TTF_LIB)
   160 
   161 dnl Finally create all the generated files
   162 AC_OUTPUT([Makefile])