test/configure.in
author Patrice Mandin <patmandin@gmail.com>
Thu, 19 Jan 2006 21:28:52 +0000
changeset 1257 448a9a64537b
parent 991 12b13601a544
child 1367 e440d5c488c1
permissions -rw-r--r--
[PATCH] SDL_GetVideoMode() does not find best mode, part 2

Following commit 1.51, I come accross a problem when SDL must choose between
several video modes that could suit the one asked.

If I ask 320x240 with this list:
768x480 768x240 640x400 640x200 384x480 384x240 320x400 320x200

The smallest selectables modes are 384x240 and 320x400. And SDL choose the later
in this list, but 384x240 is more suitable. So I added a check to compare
the pixel count (surface) of modes, and select the one which has the smallest
pixel count.

In my example, 384x240 has 92160 pixels, and 320x400 has 128000 pixels. So now
SDL will choose 384x240 for the asked 320x240 mode.
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@0
     3
slouken@0
     4
dnl Setup for automake
slouken@796
     5
SDL_VERSION=1.2.7
slouken@0
     6
slouken@0
     7
dnl Detect the canonical host and target build environment
patmandin@978
     8
AC_CANONICAL_SYSTEM
slouken@0
     9
slouken@51
    10
dnl Setup for automake
slouken@51
    11
AM_INIT_AUTOMAKE(SDL_tests, $SDL_VERSION)
slouken@51
    12
slouken@0
    13
dnl Check for tools
slouken@0
    14
slouken@0
    15
AC_PROG_CC
slouken@0
    16
slouken@0
    17
dnl Check for compiler environment
slouken@0
    18
slouken@0
    19
AC_C_CONST
slouken@0
    20
slouken@0
    21
dnl Figure out which math library to use
slouken@0
    22
case "$target" in
slouken@0
    23
    *-*-cygwin* | *-*-mingw32*)
slouken@0
    24
        MATHLIB=""
slouken@0
    25
        SYS_GL_LIBS="-lopengl32"
slouken@0
    26
        ;;
slouken@0
    27
    *-*-beos*)
slouken@0
    28
        MATHLIB=""
slouken@0
    29
        SYS_GL_LIBS="-lGL"
slouken@0
    30
        ;;
patmandin@991
    31
    *-*-darwin* )
slouken@0
    32
        MATHLIB=""
slouken@0
    33
        SYS_GL_LIBS=""
slouken@0
    34
        ;;
slouken@0
    35
    *-*-aix*)
slouken@0
    36
        if test x$ac_cv_prog_gcc = xyes; then
slouken@0
    37
            CFLAGS="-mthreads"
patmandin@978
    38
        fi
slouken@0
    39
        SYS_GL_LIBS=""
slouken@0
    40
        ;;
patmandin@991
    41
    *-*-mint*)
patmandin@991
    42
        MATHLIB=""
patmandin@991
    43
        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
patmandin@991
    44
        if test "x$OSMESA_CONFIG" = "xyes"; then
patmandin@991
    45
            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
patmandin@991
    46
            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
patmandin@991
    47
            CFLAGS="$CFLAGS $OSMESA_CFLAGS"
patmandin@991
    48
            SYS_GL_LIBS="$OSMESA_LIBS"
patmandin@991
    49
        else
patmandin@991
    50
            SYS_GL_LIBS="-lOSMesa"
patmandin@991
    51
        fi
patmandin@991
    52
		;;
slouken@0
    53
    *)
slouken@0
    54
        MATHLIB="-lm"
slouken@0
    55
        AC_PATH_X
slouken@0
    56
        AC_PATH_XTRA
slouken@0
    57
        if test x$have_x = xyes; then
slouken@0
    58
            CFLAGS="$CFLAGS $X_CFLAGS"
slouken@0
    59
            SYS_GL_LIBS="$X_LIBS -lGL"
slouken@0
    60
        else
slouken@0
    61
            SYS_GL_LIBS="-lGL"
slouken@0
    62
        fi
slouken@0
    63
        ;;
slouken@0
    64
esac
slouken@0
    65
AC_SUBST(MATHLIB)
slouken@0
    66
slouken@0
    67
dnl Check for SDL
slouken@0
    68
slouken@0
    69
AM_PATH_SDL($SDL_VERSION,
slouken@0
    70
            :,
slouken@0
    71
	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@0
    72
)
slouken@0
    73
CFLAGS="$CFLAGS $SDL_CFLAGS"
slouken@0
    74
LIBS="$LIBS $SDL_LIBS"
slouken@0
    75
slouken@0
    76
dnl Check for OpenGL
slouken@0
    77
AC_MSG_CHECKING(for OpenGL support)
slouken@0
    78
have_opengl=no
slouken@0
    79
AC_TRY_COMPILE([
slouken@292
    80
 #include "SDL_opengl.h"
slouken@0
    81
],[
slouken@0
    82
],[
slouken@0
    83
have_opengl=yes
slouken@0
    84
])
slouken@0
    85
AC_MSG_RESULT($have_opengl)
slouken@0
    86
if test x$have_opengl = xyes; then
slouken@0
    87
    CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@0
    88
    GL_LIBS="$SYS_GL_LIBS"
slouken@0
    89
else
slouken@0
    90
    GL_LIBS=""
slouken@0
    91
fi
slouken@0
    92
AC_SUBST(GL_LIBS)
slouken@0
    93
slouken@0
    94
# Finally create all the generated files
slouken@0
    95
AC_OUTPUT([Makefile])