From 6ee00c24a53a1be664d81093f586d5805076c4b8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Mar 2006 09:18:10 +0000 Subject: [PATCH] Improved DirectFB install detection --- SDL.spec.in | 4 +- configure.in | 51 ++++++++++++++++--------- src/video/directfb/SDL_DirectFB_video.c | 2 +- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/SDL.spec.in b/SDL.spec.in index 2339a3457..b1683cc72 100644 --- a/SDL.spec.in +++ b/SDL.spec.in @@ -36,9 +36,9 @@ to develop SDL applications. %build %ifos linux -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 +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga %else -%configure --disable-debug --enable-dlopen +%configure %endif make diff --git a/configure.in b/configure.in index 6426cb756..bf7bd9f10 100644 --- a/configure.in +++ b/configure.in @@ -1012,31 +1012,46 @@ dnl Find DirectFB CheckDirectFB() { AC_ARG_ENABLE(video-directfb, -AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]), - , enable_video_directfb=no) +AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=yes]]), + , enable_video_directfb=yes) if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then video_directfb=no - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG = xno ; then - AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.]) - else - AC_MSG_CHECKING(for DirectFB support) + DIRECTFB_REQUIRED_VERSION=0.9.15 - if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then - AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.]) - fi + AC_PATH_PROG(DIRECTFBCONFIG, directfb-config) + if test x$DIRECTFBCONFIG = x -o x$DIRECTFBCONFIG = x'"$DIRECTFBCONFIG"'; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno ; then + AC_MSG_WARN([*** directfb-config or pkg-config are required to detect the DirectFB video driver.]) + else + AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) - DIRECTFB_REQUIRED_VERSION=0.9.15 + if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.]) + fi - if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then - DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` - DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` + if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then + DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` + DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` + video_directfb=yes + fi + AC_MSG_RESULT($video_directfb) + fi + else + AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) + set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` + NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + set -- `directfb-config --version | sed 's/\./ /g'` + HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + if test $HAVE_VERSION -ge $NEED_VERSION; then + DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` + DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` video_directfb=yes fi + AC_MSG_RESULT($video_directfb) fi - AC_MSG_RESULT($video_directfb) if test x$video_directfb = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB) SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" @@ -1102,7 +1117,7 @@ dnl Find the SVGAlib includes and libraries CheckSVGA() { AC_ARG_ENABLE(video-svga, -AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]), +AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=yes]]), , enable_video_svga=yes) if test x$enable_video = xyes -a x$enable_video_svga = xyes; then AC_MSG_CHECKING(for SVGAlib (1.4.0+) support) @@ -1132,8 +1147,8 @@ dnl Find the VGL includes and libraries CheckVGL() { AC_ARG_ENABLE(video-vgl, -AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]), - , enable_video_vgl=no) +AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=yes]]), + , enable_video_vgl=yes) if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then AC_MSG_CHECKING(for libVGL support) video_vgl=no diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index dfe22c3fb..63d6814a0 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -1082,7 +1082,7 @@ void DirectFB_VideoQuit(_THIS) { struct DirectFBEnumRect *rect = enumlist; - if (this->screen->hwdata) + if (this->screen && this->screen->hwdata) { IDirectFBSurface *surface = this->screen->hwdata->surface; IDirectFBPalette *palette = this->screen->hwdata->palette;