[PATCH weston 3/3] build: make libdrm a hard build-time dependency

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 6 12:09:29 UTC 2017


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Libdrm provides headers that are useful even without libdrm.so itself,
particularly drm_fourcc.h. Therefore promote libdrm as a hard build-time
dependency of libweston core so that we can always rely on libdrm
headers.

This does not affect any runtime dependencies. Specifically, no runtime
dependency to libdrm.so is added in any build configuration.

Currently only gl-renderer is using drm_fourcc.h. Now we can drop the
GL_RENDERER check from configure.ac and just use LIBDRM_CFLAGS.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 Makefile.am  |  2 +-
 configure.ac | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ff927c1..8ecc90c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -324,7 +324,7 @@ gl_renderer_la_LIBADD =				\
 gl_renderer_la_CFLAGS =				\
 	$(COMPOSITOR_CFLAGS)			\
 	$(EGL_CFLAGS)				\
-	$(GL_RENDERER_CFLAGS)			\
+	$(LIBDRM_CFLAGS)			\
 	$(AM_CFLAGS)
 gl_renderer_la_SOURCES =			\
 	libweston/gl-renderer.h			\
diff --git a/configure.ac b/configure.ac
index 39c0531..2da3e05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,15 @@ AC_CHECK_HEADERS([execinfo.h])
 
 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
 
+# check for libdrm as a build-time dependency only
+# libdrm 2.4.30 introduced drm_fourcc.h.
+PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.30], have_libdrm=yes, have_libdrm=no)
+AS_IF([test "x$have_libdrm" != "xyes"],
+      [AC_MSG_ERROR([libdrm is a hard build-time dependency for libweston core,
+                     but a sufficient version was not found. However, libdrm
+                     is not a runtime dependency unless you have features
+                     enabled that require it.])])
+
 COMPOSITOR_MODULES="wayland-server >= $WAYLAND_PREREQ_VERSION pixman-1 >= 0.25.2"
 
 AC_CONFIG_FILES([doc/doxygen/tools.doxygen doc/doxygen/tooldev.doxygen])
@@ -133,7 +142,6 @@ if test x$enable_egl = xyes; then
 	AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
 	PKG_CHECK_MODULES(EGL, [egl glesv2])
         PKG_CHECK_MODULES([EGL_TESTS], [egl glesv2 wayland-client wayland-egl])
-	PKG_CHECK_MODULES([GL_RENDERER], [libdrm])
 fi
 
 AC_ARG_ENABLE(xkbcommon,
@@ -177,8 +185,6 @@ if test x$enable_xwayland = xyes; then
   fi
 fi
 
-PKG_CHECK_MODULES(LIBDRM, [libdrm], have_libdrm=yes, have_libdrm=no)
-
 AC_ARG_ENABLE(x11-compositor, [  --enable-x11-compositor],,
 	      enable_x11_compositor=yes)
 AM_CONDITIONAL(ENABLE_X11_COMPOSITOR, test x$enable_x11_compositor = xyes)
-- 
2.10.2



More information about the wayland-devel mailing list