]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[configure] Add some heuristics to find drm headers
authorRay Strode <rstrode@redhat.com>
Fri, 9 Apr 2010 19:33:28 +0000 (15:33 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 9 Apr 2010 19:33:28 +0000 (15:33 -0400)
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

index 2b8ccbd8d55bc3a779754736d7adcb14d9f02e98..2ece104eb81fd4fe661fdc8a98658c264a022ed6 100644 (file)
@@ -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 <stdint.h>
+  #include <stdlib.h>
+  #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 <stdint.h>
+    #include <stdlib.h>
+    #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)