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