Improved DirectFB install detection
authorSam Lantinga <slouken@libsdl.org>
Wed, 22 Mar 2006 09:18:10 +0000
changeset 1588e20dcef5647c
parent 1587 7fd9fc1f2be5
child 1589 34cca785be57
Improved DirectFB install detection
SDL.spec.in
configure.in
src/video/directfb/SDL_DirectFB_video.c
     1.1 --- a/SDL.spec.in	Wed Mar 22 09:13:10 2006 +0000
     1.2 +++ b/SDL.spec.in	Wed Mar 22 09:18:10 2006 +0000
     1.3 @@ -36,9 +36,9 @@
     1.4  
     1.5  %build
     1.6  %ifos linux
     1.7 -CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-svga --disable-video-ggi --disable-video-aalib --disable-debug --enable-dlopen --enable-esd-shared --enable-arts-shared
     1.8 +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
     1.9  %else
    1.10 -%configure --disable-debug --enable-dlopen
    1.11 +%configure
    1.12  %endif
    1.13  make
    1.14  
     2.1 --- a/configure.in	Wed Mar 22 09:13:10 2006 +0000
     2.2 +++ b/configure.in	Wed Mar 22 09:18:10 2006 +0000
     2.3 @@ -1012,31 +1012,46 @@
     2.4  CheckDirectFB()
     2.5  {
     2.6      AC_ARG_ENABLE(video-directfb,
     2.7 -AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
     2.8 -                  , enable_video_directfb=no)
     2.9 +AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=yes]]),
    2.10 +                  , enable_video_directfb=yes)
    2.11      if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
    2.12          video_directfb=no
    2.13  
    2.14 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    2.15 -        if test x$PKG_CONFIG = xno ; then
    2.16 -            AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
    2.17 +        DIRECTFB_REQUIRED_VERSION=0.9.15
    2.18 +
    2.19 +        AC_PATH_PROG(DIRECTFBCONFIG, directfb-config)
    2.20 +        if test x$DIRECTFBCONFIG = x -o x$DIRECTFBCONFIG = x'"$DIRECTFBCONFIG"'; then
    2.21 +            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    2.22 +            if test x$PKG_CONFIG != xno ; then
    2.23 +                AC_MSG_WARN([*** directfb-config or pkg-config are required to detect the DirectFB video driver.])
    2.24 +            else
    2.25 +                AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
    2.26 +
    2.27 +                if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
    2.28 +                    AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
    2.29 +                fi
    2.30 +
    2.31 +                if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
    2.32 +                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
    2.33 +                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
    2.34 +                    video_directfb=yes
    2.35 +                fi
    2.36 +                AC_MSG_RESULT($video_directfb)
    2.37 +            fi
    2.38          else
    2.39 -            AC_MSG_CHECKING(for DirectFB support)
    2.40 -
    2.41 -            if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
    2.42 -                AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
    2.43 -            fi
    2.44 -
    2.45 -            DIRECTFB_REQUIRED_VERSION=0.9.15
    2.46 -
    2.47 -            if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
    2.48 -                DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
    2.49 -                DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
    2.50 +            AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
    2.51 +            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
    2.52 +            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
    2.53 +            set -- `directfb-config --version | sed 's/\./ /g'`
    2.54 +            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
    2.55 +            if test $HAVE_VERSION -ge $NEED_VERSION; then
    2.56 +                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
    2.57 +                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
    2.58                  video_directfb=yes
    2.59              fi
    2.60 +            AC_MSG_RESULT($video_directfb)
    2.61          fi
    2.62  
    2.63 -        AC_MSG_RESULT($video_directfb)
    2.64          if test x$video_directfb = xyes; then
    2.65              AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
    2.66              SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
    2.67 @@ -1102,7 +1117,7 @@
    2.68  CheckSVGA()
    2.69  {
    2.70      AC_ARG_ENABLE(video-svga,
    2.71 -AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
    2.72 +AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=yes]]),
    2.73                    , enable_video_svga=yes)
    2.74      if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
    2.75          AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
    2.76 @@ -1132,8 +1147,8 @@
    2.77  CheckVGL()
    2.78  {
    2.79      AC_ARG_ENABLE(video-vgl,
    2.80 -AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
    2.81 -                  , enable_video_vgl=no)
    2.82 +AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=yes]]),
    2.83 +                  , enable_video_vgl=yes)
    2.84      if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
    2.85          AC_MSG_CHECKING(for libVGL support)
    2.86          video_vgl=no
     3.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Wed Mar 22 09:13:10 2006 +0000
     3.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Wed Mar 22 09:18:10 2006 +0000
     3.3 @@ -1082,7 +1082,7 @@
     3.4  {
     3.5    struct DirectFBEnumRect *rect    = enumlist;
     3.6  
     3.7 -  if (this->screen->hwdata)
     3.8 +  if (this->screen && this->screen->hwdata)
     3.9      {
    3.10        IDirectFBSurface        *surface = this->screen->hwdata->surface;
    3.11        IDirectFBPalette        *palette = this->screen->hwdata->palette;