test/configure.in
author Gabriel Jacobo <gabomdq@gmail.com>
Tue, 19 Nov 2013 10:56:38 -0300
changeset 8014 0a4b6dec7de5
parent 7981 6d538bc1b395
child 8021 f96e12e0ade9
permissions -rw-r--r--
Adds testgles2

Source code copied from: https://github.com/fantasydr/sdl-2.0-gles (thanks!)

Minor fixes, configure script changes done by me.
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@0
     3
slouken@1550
     4
dnl Detect the canonical build and host environments
slouken@1380
     5
AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
slouken@1550
     6
AC_CANONICAL_HOST
slouken@0
     7
slouken@0
     8
dnl Check for tools
slouken@0
     9
slouken@0
    10
AC_PROG_CC
slouken@0
    11
slouken@0
    12
dnl Check for compiler environment
slouken@0
    13
slouken@0
    14
AC_C_CONST
slouken@0
    15
icculus@6390
    16
dnl We only care about this for building testnative at the moment, so these
icculus@6390
    17
dnl  values shouldn't be considered absolute truth.
icculus@7981
    18
dnl  (Haiku, for example, sets none of these.)
icculus@6390
    19
ISUNIX="false"
icculus@6390
    20
ISWINDOWS="false"
icculus@6390
    21
ISMACOSX="false"
icculus@6390
    22
slouken@0
    23
dnl Figure out which math library to use
slouken@1550
    24
case "$host" in
slouken@0
    25
    *-*-cygwin* | *-*-mingw32*)
icculus@6390
    26
        ISWINDOWS="true"
slouken@1380
    27
        EXE=".exe"
slouken@0
    28
        MATHLIB=""
slouken@0
    29
        SYS_GL_LIBS="-lopengl32"
slouken@0
    30
        ;;
icculus@7981
    31
    *-*-haiku*)
slouken@1380
    32
        EXE=""
slouken@0
    33
        MATHLIB=""
slouken@0
    34
        SYS_GL_LIBS="-lGL"
slouken@0
    35
        ;;
patmandin@991
    36
    *-*-darwin* )
icculus@6390
    37
        ISMACOSX="true"
slouken@1380
    38
        EXE=""
slouken@0
    39
        MATHLIB=""
icculus@3623
    40
        SYS_GL_LIBS="-Wl,-framework,OpenGL"
slouken@0
    41
        ;;
slouken@0
    42
    *-*-aix*)
icculus@6390
    43
        ISUNIX="true"
slouken@1380
    44
        EXE=""
slouken@0
    45
        if test x$ac_cv_prog_gcc = xyes; then
slouken@0
    46
            CFLAGS="-mthreads"
patmandin@978
    47
        fi
slouken@0
    48
        SYS_GL_LIBS=""
slouken@0
    49
        ;;
patmandin@991
    50
    *-*-mint*)
slouken@1380
    51
        EXE=""
patmandin@991
    52
        MATHLIB=""
patmandin@991
    53
        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
patmandin@991
    54
        if test "x$OSMESA_CONFIG" = "xyes"; then
patmandin@991
    55
            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
patmandin@991
    56
            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
patmandin@991
    57
            CFLAGS="$CFLAGS $OSMESA_CFLAGS"
patmandin@991
    58
            SYS_GL_LIBS="$OSMESA_LIBS"
patmandin@991
    59
        else
patmandin@991
    60
            SYS_GL_LIBS="-lOSMesa"
patmandin@991
    61
        fi
slouken@3087
    62
        ;;
slouken@3087
    63
    *-*-qnx*)
slouken@3087
    64
        EXE=""
slouken@3087
    65
        MATHLIB=""
slouken@3087
    66
        SYS_GL_LIBS="-lGLES_CM"
slouken@3087
    67
        ;;
slouken@0
    68
    *)
icculus@6390
    69
        dnl Oh well, call it Unix...
icculus@6390
    70
        ISUNIX="true"
slouken@1380
    71
        EXE=""
slouken@0
    72
        MATHLIB="-lm"
slouken@1380
    73
        SYS_GL_LIBS="-lGL"
slouken@0
    74
        ;;
slouken@0
    75
esac
slouken@1380
    76
AC_SUBST(EXE)
slouken@0
    77
AC_SUBST(MATHLIB)
icculus@6390
    78
AC_SUBST(ISMACOSX)
icculus@6390
    79
AC_SUBST(ISWINDOWS)
icculus@6390
    80
AC_SUBST(ISUNIX)
slouken@0
    81
slouken@0
    82
dnl Check for SDL
slouken@6250
    83
SDL_VERSION=2.0.0
slouken@6272
    84
AM_PATH_SDL2($SDL_VERSION,
slouken@0
    85
            :,
slouken@0
    86
	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@0
    87
)
slouken@0
    88
CFLAGS="$CFLAGS $SDL_CFLAGS"
slouken@7828
    89
LIBS="$LIBS -lSDL2_test $SDL_LIBS"
slouken@0
    90
slouken@2138
    91
dnl Check for X11 path, needed for OpenGL on some systems
slouken@2138
    92
AC_PATH_X
slouken@2138
    93
if test x$have_x = xyes; then
gabomdq@7794
    94
    if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
slouken@2138
    95
        :
slouken@2138
    96
    else
slouken@2138
    97
        CFLAGS="$CFLAGS -I$ac_x_includes"
slouken@2138
    98
    fi
gabomdq@7703
    99
    if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
slouken@2138
   100
        :
slouken@2138
   101
    else
gabomdq@7704
   102
        if test "x$ac_x_libraries" = x; then
gabomdq@7794
   103
            XPATH=""
gabomdq@7704
   104
            XLIB="-lX11"
gabomdq@7704
   105
        else
gabomdq@7794
   106
            XPATH="-L$ac_x_libraries"
gabomdq@7704
   107
            XLIB="-L$ac_x_libraries -lX11"
gabomdq@7704
   108
        fi
slouken@2138
   109
    fi
slouken@2138
   110
fi
slouken@2138
   111
slouken@0
   112
dnl Check for OpenGL
slouken@0
   113
AC_MSG_CHECKING(for OpenGL support)
slouken@0
   114
have_opengl=no
slouken@0
   115
AC_TRY_COMPILE([
slouken@292
   116
 #include "SDL_opengl.h"
slouken@0
   117
],[
slouken@0
   118
],[
slouken@0
   119
have_opengl=yes
slouken@0
   120
])
slouken@0
   121
AC_MSG_RESULT($have_opengl)
slouken@3087
   122
slouken@3087
   123
dnl Check for OpenGL ES
slouken@3087
   124
AC_MSG_CHECKING(for OpenGL ES support)
slouken@3087
   125
have_opengles=no
slouken@3087
   126
AC_TRY_COMPILE([
slouken@6188
   127
 #if defined (__IPHONEOS__)
slouken@3087
   128
    #include <OpenGLES/ES1/gl.h>
slouken@3087
   129
 #else
slouken@6188
   130
    #include <GLES/gl.h>
slouken@3087
   131
 #endif /* __QNXNTO__ */
slouken@3087
   132
],[
slouken@3087
   133
],[
slouken@3087
   134
have_opengles=yes
slouken@3087
   135
])
slouken@3087
   136
AC_MSG_RESULT($have_opengles)
slouken@3090
   137
gabomdq@8014
   138
dnl Check for OpenGL ES2
gabomdq@8014
   139
AC_MSG_CHECKING(for OpenGL ES2 support)
gabomdq@8014
   140
have_opengles2=no
gabomdq@8014
   141
AC_TRY_COMPILE([
gabomdq@8014
   142
 #if defined (__IPHONEOS__)
gabomdq@8014
   143
    #include <OpenGLES/ES2/gl.h>
gabomdq@8014
   144
    #include <OpenGLES/ES2/glext.h>
gabomdq@8014
   145
 #else
gabomdq@8014
   146
    #include <GLES2/gl2.h>
gabomdq@8014
   147
    #include <GLES2/gl2ext.h>
gabomdq@8014
   148
 #endif
gabomdq@8014
   149
],[
gabomdq@8014
   150
],[
gabomdq@8014
   151
have_opengles2=yes
gabomdq@8014
   152
])
gabomdq@8014
   153
AC_MSG_RESULT($have_opengles2)
gabomdq@8014
   154
slouken@6188
   155
GLLIB=""
gabomdq@7794
   156
GLESLIB=""
gabomdq@8014
   157
GLES2LIB=""
slouken@6188
   158
if test x$have_opengles = xyes; then
slouken@6188
   159
    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
gabomdq@7794
   160
    GLESLIB="$XPATH -lGLESv1_CM"
gabomdq@7794
   161
fi
gabomdq@8014
   162
if test x$have_opengles2 = xyes; then
gabomdq@8014
   163
    CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
gabomdq@8014
   164
    GLES2LIB="$XPATH -lGLESv2"
gabomdq@8014
   165
fi
gabomdq@7794
   166
if test x$have_opengl = xyes; then
slouken@3090
   167
    CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@3090
   168
    GLLIB="$XPATH $SYS_GL_LIBS"
slouken@3087
   169
fi
slouken@3087
   170
slouken@1380
   171
AC_SUBST(GLLIB)
gabomdq@7794
   172
AC_SUBST(GLESLIB)
gabomdq@8014
   173
AC_SUBST(GLES2LIB)
slouken@7495
   174
AC_SUBST(XLIB)
slouken@0
   175
slouken@3280
   176
dnl Check for SDL_ttf
slouken@6598
   177
AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
slouken@3280
   178
if test x$have_SDL_ttf = xyes; then
slouken@3280
   179
    CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
slouken@6598
   180
    SDL_TTF_LIB="-lSDL2_ttf"
slouken@3280
   181
fi
slouken@3280
   182
AC_SUBST(SDL_TTF_LIB)
slouken@3280
   183
slouken@1380
   184
dnl Finally create all the generated files
slouken@0
   185
AC_OUTPUT([Makefile])