build: improve gbm_bo_get_stride check

There were 3 problems with previous version:
- it didn't take into account libgbm cflags (fatal error: gbm.h: No such file or directory)
- it was vulnerable to gbm.h include bugs (gbm.h:259:50: error: unknown type name 'size_t')
- it was checked even when libgbm was not detected
Fix it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
Marcin Slusarz 2012-08-22 21:45:00 +02:00 committed by David Herrmann
parent 6a61caab9a
commit 569868ed62
2 changed files with 14 additions and 2 deletions

View File

@ -362,7 +362,19 @@ AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
AC_CHECK_DECLS([gbm_bo_get_stride], [], [], [[#include <gbm.h>]])
if test x$have_gbm = xyes ; then
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
CFLAGS=$GBM_CFLAGS
LIBS=$GBM_LIBS
AC_CHECK_LIB([gbm],
[gbm_bo_get_stride],
[AC_DEFINE([HAVE_GBM_BO_GET_STRIDE],
[1],
[Define to 1 if your libgbm provides gbm_bo_get_stride])])
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
fi
#
# xkbcommon keyboard backend

View File

@ -83,7 +83,7 @@ static int init_rb(struct uterm_display *disp, struct drm_rb *rb)
return -EFAULT;
}
#if defined(HAVE_DECL_GBM_BO_GET_STRIDE) && HAVE_DECL_GBM_BO_GET_STRIDE
#ifdef HAVE_GBM_BO_GET_STRIDE
stride = gbm_bo_get_stride(rb->bo);
#else
stride = gbm_bo_get_pitch(rb->bo);