test/configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 19 Feb 2015 13:42:56 -0500
changeset 9361 17a2821b451c
parent 9278 8900afb78a19
child 11365 a9bd2625fa01
permissions -rw-r--r--
Some corrections to the SDL2.spec.in (thanks, Simone!).

Fixes Bugzilla #2809.
     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     *-*-emscripten* )
    69         dnl This should really be .js, but we need to specify extra flags when compiling to js
    70         EXE=".bc"
    71         MATHLIB=""
    72         SYS_GL_LIBS=""
    73         ;;
    74     *)
    75         dnl Oh well, call it Unix...
    76         ISUNIX="true"
    77         EXE=""
    78         MATHLIB="-lm"
    79         SYS_GL_LIBS="-lGL"
    80         ;;
    81 esac
    82 AC_SUBST(EXE)
    83 AC_SUBST(MATHLIB)
    84 AC_SUBST(ISMACOSX)
    85 AC_SUBST(ISWINDOWS)
    86 AC_SUBST(ISUNIX)
    87 
    88 dnl Check for SDL
    89 SDL_VERSION=2.0.0
    90 AM_PATH_SDL2($SDL_VERSION,
    91             :,
    92 	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    93 )
    94 CFLAGS="$CFLAGS $SDL_CFLAGS"
    95 LIBS="$LIBS -lSDL2_test $SDL_LIBS"
    96 
    97 dnl Check for X11 path, needed for OpenGL on some systems
    98 AC_PATH_X
    99 if test x$have_x = xyes; then
   100     if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
   101         :
   102     else
   103         CFLAGS="$CFLAGS -I$ac_x_includes"
   104     fi
   105     if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
   106         :
   107     else
   108         if test "x$ac_x_libraries" = x; then
   109             XPATH=""
   110             XLIB="-lX11"
   111         else
   112             XPATH="-L$ac_x_libraries"
   113             XLIB="-L$ac_x_libraries -lX11"
   114         fi
   115     fi
   116 fi
   117 
   118 dnl Check for OpenGL
   119 AC_MSG_CHECKING(for OpenGL support)
   120 have_opengl=no
   121 AC_TRY_COMPILE([
   122  #include "SDL_opengl.h"
   123 ],[
   124 ],[
   125 have_opengl=yes
   126 ])
   127 AC_MSG_RESULT($have_opengl)
   128 
   129 dnl Check for OpenGL ES
   130 AC_MSG_CHECKING(for OpenGL ES support)
   131 have_opengles=no
   132 AC_TRY_COMPILE([
   133  #if defined (__IPHONEOS__)
   134     #include <OpenGLES/ES1/gl.h>
   135  #else
   136     #include <GLES/gl.h>
   137  #endif /* __QNXNTO__ */
   138 ],[
   139 ],[
   140 have_opengles=yes
   141 ])
   142 AC_MSG_RESULT($have_opengles)
   143 
   144 dnl Check for OpenGL ES2
   145 AC_MSG_CHECKING(for OpenGL ES2 support)
   146 have_opengles2=no
   147 AC_TRY_COMPILE([
   148  #if defined (__IPHONEOS__)
   149     #include <OpenGLES/ES2/gl.h>
   150     #include <OpenGLES/ES2/glext.h>
   151  #else
   152     #include <GLES2/gl2.h>
   153     #include <GLES2/gl2ext.h>
   154  #endif
   155 ],[
   156 ],[
   157 have_opengles2=yes
   158 ])
   159 AC_MSG_RESULT($have_opengles2)
   160 
   161 GLLIB=""
   162 GLESLIB=""
   163 GLES2LIB=""
   164 if test x$have_opengles = xyes; then
   165     CFLAGS="$CFLAGS -DHAVE_OPENGLES"
   166     GLESLIB="$XPATH -lGLESv1_CM"
   167 fi
   168 if test x$have_opengles2 = xyes; then
   169     CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
   170     #GLES2LIB="$XPATH -lGLESv2"
   171 fi
   172 if test x$have_opengl = xyes; then
   173     CFLAGS="$CFLAGS -DHAVE_OPENGL"
   174     GLLIB="$XPATH $SYS_GL_LIBS"
   175 fi
   176 
   177 AC_SUBST(GLLIB)
   178 AC_SUBST(GLESLIB)
   179 AC_SUBST(GLES2LIB)
   180 AC_SUBST(XLIB)
   181 
   182 dnl Check for SDL_ttf
   183 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
   184 if test x$have_SDL_ttf = xyes; then
   185     CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
   186     SDL_TTF_LIB="-lSDL2_ttf"
   187 fi
   188 AC_SUBST(SDL_TTF_LIB)
   189 
   190 dnl Finally create all the generated files
   191 AC_OUTPUT([Makefile])