From 31a958f7e095b076edd809f6af621dc6754d29fb Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 9 Apr 2010 15:33:28 -0400 Subject: [PATCH] [configure] Add some heuristics to find drm headers On my system, some headers seem to be stuffed in /usr/include/libdrm and other headers seem to be stuffed in /usr/include/drm . I think the ultimate upstream goal is for everything to be in /usr/include/libdrm but my system seems to be in some transition state. My pkgconfig files only point me to one of the directories, so add some heuristics to find the other one. --- configure.ac | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac index 2b8ccbd8..2ece104e 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,45 @@ AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) PKG_CHECK_MODULES(DRM, [libdrm libdrm_intel libdrm_radeon libdrm_nouveau]) + +OLD_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $DRM_CFLAGS" +AC_MSG_CHECKING([if i915_drm.h, radeon_drm.h and nouveau_drm.h are in include path]) +AC_COMPILE_IFELSE(AC_LANG_PROGRAM( +[[ + #include + #include + #include "i915_drm.h" + #include "radeon_drm.h" + #include "nouveau_drm.h" +]],[[]]),[found_drm_kernel_headers=yes],[found_drm_kernel_headers=no]) + +if test "$found_drm_kernel_headers" = "yes"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([if we can find them anyway]) + + MORE_DRM_CFLAGS="-I`$PKG_CONFIG --variable includedir libdrm`/drm" + CFLAGS="$CFLAGS $MORE_DRM_CFLAGS" + AC_COMPILE_IFELSE(AC_LANG_PROGRAM( + [[ + #include + #include + #include "i915_drm.h" + #include "radeon_drm.h" + #include "nouveau_drm.h" + ]],[[]]),[found_drm_kernel_headers=yes],[found_drm_kernel_headers=no]) + + if test "$found_drm_kernel_headers" = "yes"; then + AC_MSG_RESULT([yes]) + DRM_CFLAGS="$DRM_CFLAGS $MORE_DRM_CFLAGS" + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not find i915_drm.h, radeon_drm.h and/or nouveau_drm.h]) + fi +fi +CFLAGS="$OLD_CFLAGS" AC_SUBST(DRM_CFLAGS) AC_SUBST(DRM_LIBS) -- 2.47.3