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