[virglrenderer-devel] [PATCH 4/4] configure: check for -lgbm

Michal Privoznik mprivozn at redhat.com
Thu Feb 11 12:51:14 UTC 2016


We use the library unconditionally, however not check it in
configure phase. Let's produce an error there and not at
compilation phase.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 configure.ac    | 7 +++++++
 src/Makefile.am | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 53d9ef4..98d33b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,13 @@ LIBDRM_REQUIRED=2.4.50
 
 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
 PKG_CHECK_MODULES([EPOXY], [epoxy])
+save_LIBS="$LIBS"
+save_CFLAGS="$CFLAGS"
+AC_CHECK_LIB([gbm], [gbm_create_device], [], [AC_MSG_ERROR([gbm library is required for the build])])
+GBM_LIBS="-lgbm"
+LIBS="$save_LIBS"
+CFLAGS="$save_CFLAGS"
+AC_SUBST([GBM_LIBS])
 
 AC_SUBST([DEFINES])
 AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index 8f6538a..b87e221 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,6 @@
 SUBDIRS := gallium/auxiliary
-AM_LDFLAGS = -lgbm -lm -ldl \
+AM_LDFLAGS = -lm -ldl \
+	$(GBM_LIBS) \
 	$(EPOXY_LIBS) \
 	$(CODE_COVERAGE_LDFLAGS)
 
-- 
2.4.10



More information about the virglrenderer-devel mailing list