test/configure.in
author Gabriel Jacobo <gabomdq@gmail.com>
Wed, 28 Aug 2013 12:43:29 -0300
changeset 7704 3182291fc65f
parent 7703 982abfefd19d
child 7794 7995e0920bf9
permissions -rw-r--r--
[Linux] Test config script: Add the X11 library search path if it is not empty

If ac_x_libraries is empty it means that the library's found in the default path,
so we skip adding it to the XLIB variable as it screws up the search path.
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"
gabomdq@7703
    89
LIBS="$LIBS  $SDL_LIBS -lSDL2_test"
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@7703
    94
    if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone; 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
slouken@2138
   102
        XPATH="-L$ac_x_libraries"
gabomdq@7704
   103
        if test "x$ac_x_libraries" = x; then
gabomdq@7704
   104
            XLIB="-lX11"
gabomdq@7704
   105
        else
gabomdq@7704
   106
            XLIB="-L$ac_x_libraries -lX11"
gabomdq@7704
   107
        fi
slouken@2138
   108
    fi
slouken@2138
   109
fi
slouken@2138
   110
slouken@0
   111
dnl Check for OpenGL
slouken@0
   112
AC_MSG_CHECKING(for OpenGL support)
slouken@0
   113
have_opengl=no
slouken@0
   114
AC_TRY_COMPILE([
slouken@292
   115
 #include "SDL_opengl.h"
slouken@0
   116
],[
slouken@0
   117
],[
slouken@0
   118
have_opengl=yes
slouken@0
   119
])
slouken@0
   120
AC_MSG_RESULT($have_opengl)
slouken@3087
   121
slouken@3087
   122
dnl Check for OpenGL ES
slouken@3087
   123
AC_MSG_CHECKING(for OpenGL ES support)
slouken@3087
   124
have_opengles=no
slouken@3087
   125
AC_TRY_COMPILE([
slouken@6188
   126
 #if defined (__IPHONEOS__)
slouken@3087
   127
    #include <OpenGLES/ES1/gl.h>
slouken@3087
   128
 #else
slouken@6188
   129
    #include <GLES/gl.h>
slouken@3087
   130
 #endif /* __QNXNTO__ */
slouken@3087
   131
],[
slouken@3087
   132
],[
slouken@3087
   133
have_opengles=yes
slouken@3087
   134
])
slouken@3087
   135
AC_MSG_RESULT($have_opengles)
slouken@3090
   136
slouken@6188
   137
GLLIB=""
slouken@6188
   138
if test x$have_opengles = xyes; then
slouken@6188
   139
    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
slouken@6188
   140
    GLLIB="$XPATH -lGLESv1_CM"
slouken@6188
   141
elif test x$have_opengl = xyes; then
slouken@3090
   142
    CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@3090
   143
    GLLIB="$XPATH $SYS_GL_LIBS"
slouken@3087
   144
else
slouken@3087
   145
    GLLIB=""
slouken@3087
   146
fi
slouken@3087
   147
slouken@1380
   148
AC_SUBST(GLLIB)
slouken@7495
   149
AC_SUBST(XLIB)
slouken@0
   150
slouken@3280
   151
dnl Check for SDL_ttf
slouken@6598
   152
AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
slouken@3280
   153
if test x$have_SDL_ttf = xyes; then
slouken@3280
   154
    CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
slouken@6598
   155
    SDL_TTF_LIB="-lSDL2_ttf"
slouken@3280
   156
fi
slouken@3280
   157
AC_SUBST(SDL_TTF_LIB)
slouken@3280
   158
slouken@1380
   159
dnl Finally create all the generated files
slouken@0
   160
AC_OUTPUT([Makefile])