test/configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 31 Dec 2012 10:26:38 -0800
changeset 6785 c094c438c0a6
parent 6598 81d643a61b54
child 7495 c4ba5e5c2765
permissions -rw-r--r--
Switched the test code over to use the common functions in the test library.
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@6390
    18
dnl  (BeOS, 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
        ;;
slouken@3292
    31
    *-*-beos* | *-*-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@6785
    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
slouken@2138
    94
    if test x$ac_x_includes = xno || 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
slouken@2138
    99
    if test x$ac_x_libraries = xno || test x$ac_x_libraries = x; then
slouken@2138
   100
        :
slouken@2138
   101
    else
slouken@2138
   102
        XPATH="-L$ac_x_libraries"
slouken@2138
   103
    fi
slouken@2138
   104
fi
slouken@2138
   105
slouken@0
   106
dnl Check for OpenGL
slouken@0
   107
AC_MSG_CHECKING(for OpenGL support)
slouken@0
   108
have_opengl=no
slouken@0
   109
AC_TRY_COMPILE([
slouken@292
   110
 #include "SDL_opengl.h"
slouken@0
   111
],[
slouken@0
   112
],[
slouken@0
   113
have_opengl=yes
slouken@0
   114
])
slouken@0
   115
AC_MSG_RESULT($have_opengl)
slouken@3087
   116
slouken@3087
   117
dnl Check for OpenGL ES
slouken@3087
   118
AC_MSG_CHECKING(for OpenGL ES support)
slouken@3087
   119
have_opengles=no
slouken@3087
   120
AC_TRY_COMPILE([
slouken@6188
   121
 #if defined (__IPHONEOS__)
slouken@3087
   122
    #include <OpenGLES/ES1/gl.h>
slouken@3087
   123
 #else
slouken@6188
   124
    #include <GLES/gl.h>
slouken@3087
   125
 #endif /* __QNXNTO__ */
slouken@3087
   126
],[
slouken@3087
   127
],[
slouken@3087
   128
have_opengles=yes
slouken@3087
   129
])
slouken@3087
   130
AC_MSG_RESULT($have_opengles)
slouken@3090
   131
slouken@6188
   132
GLLIB=""
slouken@6188
   133
if test x$have_opengles = xyes; then
slouken@6188
   134
    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
slouken@6188
   135
    GLLIB="$XPATH -lGLESv1_CM"
slouken@6188
   136
elif test x$have_opengl = xyes; then
slouken@3090
   137
    CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@3090
   138
    GLLIB="$XPATH $SYS_GL_LIBS"
slouken@3087
   139
else
slouken@3087
   140
    GLLIB=""
slouken@3087
   141
fi
slouken@3087
   142
slouken@1380
   143
AC_SUBST(GLLIB)
slouken@0
   144
slouken@3280
   145
dnl Check for SDL_ttf
slouken@6598
   146
AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
slouken@3280
   147
if test x$have_SDL_ttf = xyes; then
slouken@3280
   148
    CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
slouken@6598
   149
    SDL_TTF_LIB="-lSDL2_ttf"
slouken@3280
   150
fi
slouken@3280
   151
AC_SUBST(SDL_TTF_LIB)
slouken@3280
   152
slouken@1380
   153
dnl Finally create all the generated files
slouken@0
   154
AC_OUTPUT([Makefile])