changeset 32168:c026f1657647

Simplify DirectFB check.
author diego
date Wed, 15 Sep 2010 17:22:04 +0000
parents 41c11d96b5db
children e55fdf5b1dd7
files configure libvo/vo_dfbmga.c libvo/vo_directfb2.c
diffstat 3 files changed, 14 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Sep 15 15:58:48 2010 +0000
+++ b/configure	Wed Sep 15 17:22:04 2010 +0000
@@ -4258,44 +4258,19 @@
 echocheck "DirectFB"
 if test "$_directfb" = auto ; then
   _directfb=no
+  cat > $TMPC << EOF
+#include <directfb.h>
+#include <directfb_version.h>
+#if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 15)
+#error "DirectFB version too old."
+#endif
+int main(void) { DirectFBInit(0, 0); return 0; }
+EOF
   for _inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do
-    function_check directfb.h 'DirectFBInit(0, 0)' $_inc_tmp -ldirectfb &&
+    cc_check $_inc_tmp -ldirectfb &&
       _directfb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break
   done
 fi
-
-dfb_version() {
-  expr $1 \* 65536 + $2 \* 256 + $3
-}
-
-if test "$_directfb" = yes; then
-  cat > $TMPC << EOF
-#include <directfb_version.h>
-int
-dfb_ver = DIRECTFB_MAJOR_VERSION.DIRECTFB_MINOR_VERSION.DIRECTFB_MICRO_VERSION
-;
-EOF
-  if $_cc -E $TMPC $extra_cflags > "$TMPEXE"; then
-    _directfb_version=$(sed -n 's/^dfb_ver[^0-9]*\(.*\)/\1/p' "$TMPEXE" | tr -d '()')
-    _dfb_major=$(echo $_directfb_version | cut -d . -f 1)
-    _dfb_minor=$(echo $_directfb_version | cut -d . -f 2)
-    _dfb_micro=$(echo $_directfb_version | cut -d . -f 3)
-    _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)
-    if test "$_dfb_version" -ge $(dfb_version 0 9 15); then
-      def_directfb_version="#define DIRECTFBVERSION $_dfb_version"
-      res_comment="$_directfb_version"
-    else
-      def_directfb_version='#undef DIRECTFBVERSION'
-      _directfb=no
-      res_comment="version >=0.9.15 required"
-    fi
-  else
-    _directfb=no
-    res_comment="failed to get version"
-  fi
-fi
-echores "$_directfb"
-
 if test "$_directfb" = yes ; then
   def_directfb='#define CONFIG_DIRECTFB 1'
   vomodules="directfb dfbmga $vomodules"
@@ -4304,6 +4279,7 @@
   def_directfb='#undef CONFIG_DIRECTFB'
   novomodules="directfb dfbmga $novomodules"
 fi
+echores "$_directfb"
 
 
 echocheck "X11 headers presence"
@@ -8810,7 +8786,6 @@
 $def_dga2
 $def_direct3d
 $def_directfb
-$def_directfb_version
 $def_directx
 $def_dvb
 $def_dvbin
--- a/libvo/vo_dfbmga.c	Wed Sep 15 15:58:48 2010 +0000
+++ b/libvo/vo_dfbmga.c	Wed Sep 15 17:22:04 2010 +0000
@@ -23,8 +23,10 @@
 
 /* directfb includes */
 #include <directfb.h>
+#include <directfb_version.h>
 
 #define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
+#define DIRECTFBVERSION DFB_VERSION(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
 
 /* other things */
 #include <stdio.h>
--- a/libvo/vo_directfb2.c	Wed Sep 15 15:58:48 2010 +0000
+++ b/libvo/vo_directfb2.c	Wed Sep 15 17:22:04 2010 +0000
@@ -25,8 +25,10 @@
 // directfb includes
 
 #include <directfb.h>
+#include <directfb_version.h>
 
 #define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
+#define DIRECTFBVERSION DFB_VERSION(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
 
 // other things