From 010403eb8a5a27de729410b2d0443dbf0f527a54 Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Wed, 22 Aug 2012 21:11:47 +0200 Subject: [PATCH 1/2] build: ...and now fix build without GLES2 Defining *_la_CPPFLAGS var in "if...endif" block breaks generation of Makefile.in - automake assumes it's defined unconditionally and uses it for building objects. So we need to define it properly in both cases. Signed-off-by: Marcin Slusarz --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index e83c246..2a5a00f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -270,6 +270,8 @@ libkmscon_static_la_SOURCES = \ src/static_misc.c \ external/htable.h \ external/htable.c +libkmscon_static_la_CPPFLAGS = \ + $(AM_CPPFLAGS) if KMSCON_HAVE_GLES2 nodist_libkmscon_static_la_SOURCES = \ @@ -278,8 +280,7 @@ nodist_libkmscon_static_la_SOURCES = \ src/static_gl_shader.c \ src/static_shaders.c -libkmscon_static_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ +libkmscon_static_la_CPPFLAGS += \ $(GLES2_CFLAGS) endif From ce2b110c110a61e35e2bc7c17f1c9cd4a44dc25f Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Wed, 22 Aug 2012 21:45:00 +0200 Subject: [PATCH 2/2] 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 --- configure.ac | 10 +++++++++- src/uterm_video_drm.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3ea4ce3..2070159 100644 --- a/configure.ac +++ b/configure.ac @@ -362,7 +362,15 @@ 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 ]]) +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 have gbm_bo_get_stride])]) + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" +fi # # xkbcommon keyboard backend diff --git a/src/uterm_video_drm.c b/src/uterm_video_drm.c index 74ac7fd..d5a0501 100644 --- a/src/uterm_video_drm.c +++ b/src/uterm_video_drm.c @@ -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 +#if defined(HAVE_GBM_BO_GET_STRIDE) && HAVE_GBM_BO_GET_STRIDE stride = gbm_bo_get_stride(rb->bo); #else stride = gbm_bo_get_pitch(rb->bo);