]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
drm: reduce minimum build requirements
authorLucian Muresan <lucianm@users.sourceforge.net>
Tue, 1 Feb 2011 19:05:45 +0000 (14:05 -0500)
committerRay Strode <rstrode@redhat.com>
Tue, 1 Feb 2011 19:33:23 +0000 (14:33 -0500)
This patch adds the respective configure options to make it possible to
disable libdrm_intel, libdrm_radeon, libdrm_nouveau, and libkms
independently from each other.

https://bugs.freedesktop.org/show_bug.cgi?id=29804

configure.ac
scripts/plymouth-populate-initrd.in
src/plugins/renderers/Makefile.am
src/plugins/renderers/drm/Makefile.am
src/plugins/renderers/drm/plugin.c

index 5bcf38a6612fa924965a89b7b5f4c65791477b77..2209df1a08b72ebd0ad2bc8f99ebe676725c810a 100644 (file)
@@ -56,59 +56,159 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.12.0 ])
 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_ARG_ENABLE(libdrm_intel, AS_HELP_STRING([--enable-libdrm_intel],[enable building with libdrm_intel support]),enable_libdrm_intel=$enableval,enable_libdrm_intel=yes)
+AM_CONDITIONAL(ENABLE_LIBDRM_INTEL,  [test "$enable_libdrm_intel" = yes])
+
+if test x$enable_libdrm_intel = xyes; then
+  PKG_CHECK_MODULES(DRM_INTEL, [libdrm libdrm_intel])
+  OLD_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $DRM_INTEL_CFLAGS"
+  AC_MSG_CHECKING([if i915_drm.h is in include path])
   AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
   [[
     #include <stdint.h>
     #include <stdlib.h>
     #include "i915_drm.h"
+  ]],[[]]),[found_drm_intel_kernel_headers=yes],[found_drm_intel_kernel_headers=no])
+
+  if test "$found_drm_intel_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"
+    ]],[[]]),[found_drm_intel_kernel_headers=yes],[found_drm_intel_kernel_headers=no])
+
+    if test "$found_drm_intel_kernel_headers" = "yes"; then
+      AC_MSG_RESULT([yes])
+      DRM_INTEL_CFLAGS="$DRM_INTEL_CFLAGS $MORE_DRM_CFLAGS"
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([Could not find i915_drm.h])
+    fi
+  fi
+
+  AC_SUBST(DRM_INTEL_CFLAGS)
+  AC_SUBST(DRM_INTEL_LIBS)
+  AC_DEFINE(PLY_ENABLE_LIBDRM_INTEL, 1, [Enable support for libdrm_intel driver])
+fi
+
+AC_ARG_ENABLE(libdrm_radeon, AS_HELP_STRING([--enable-libdrm_radeon],[enable building with libdrm_radeon support]),enable_libdrm_radeon=$enableval,enable_libdrm_radeon=yes)
+AM_CONDITIONAL(ENABLE_LIBDRM_RADEON,  [test "$enable_libdrm_radeon" = yes])
+
+if test x$enable_libdrm_radeon = xyes; then
+  PKG_CHECK_MODULES(DRM_RADEON, [libdrm libdrm_radeon])
+  OLD_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $DRM_RADEON_CFLAGS"
+  AC_MSG_CHECKING([if radeon_drm.h is in include path])
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
+  [[
+    #include <stdint.h>
+    #include <stdlib.h>
     #include "radeon_drm.h"
+  ]],[[]]),[found_drm_radeon_kernel_headers=yes],[found_drm_radeon_kernel_headers=no])
+
+  if test "$found_drm_radeon_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_RADEON_CFLAGS"
+    AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
+    [[
+      #include <stdint.h>
+      #include <stdlib.h>
+      #include "radeon_drm.h"
+    ]],[[]]),[found_drm_radeon_kernel_headers=yes],[found_drm_radeon_kernel_headers=no])
+
+    if test "$found_drm_radeon_kernel_headers" = "yes"; then
+      AC_MSG_RESULT([yes])
+      DRM_RADEON_CFLAGS="$DRM_RADEON_CFLAGS $MORE_DRM_CFLAGS"
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([Could not find radeon_drm.h])
+    fi
+  fi
+
+  AC_SUBST(DRM_RADEON_CFLAGS)
+  AC_SUBST(DRM_RADEON_LIBS)
+  AC_DEFINE(PLY_ENABLE_LIBDRM_RADEON, 1, [Enable support for libdrm_radeon driver])
+fi
+
+AC_ARG_ENABLE(libdrm_nouveau, AS_HELP_STRING([--enable-libdrm_nouveau],[enable building with libdrm_nouveau support]),enable_libdrm_nouveau=$enableval,enable_libdrm_nouveau=yes)
+AM_CONDITIONAL(ENABLE_LIBDRM_NOUVEAU,  [test "$enable_libdrm_nouveau" = yes])
+
+if test x$enable_libdrm_nouveau = xyes; then
+  PKG_CHECK_MODULES(DRM_NOUVEAU, [libdrm libdrm_nouveau])
+  OLD_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $DRM_NOUVEAU_CFLAGS"
+  AC_MSG_CHECKING([if nouveau_drm.h is in include path])
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
+  [[
+    #include <stdint.h>
+    #include <stdlib.h>
     #include "nouveau_drm.h"
-  ]],[[]]),[found_drm_kernel_headers=yes],[found_drm_kernel_headers=no])
+  ]],[[]]),[found_drm_nouveau_kernel_headers=yes],[found_drm_nouveau_kernel_headers=no])
 
-  if test "$found_drm_kernel_headers" = "yes"; then
+  if test "$found_drm_nouveau_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])
+    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 "nouveau_drm.h"
+    ]],[[]]),[found_drm_nouveau_kernel_headers=yes],[found_drm_nouveau_kernel_headers=no])
+
+    if test "$found_drm_nouveau_kernel_headers" = "yes"; then
+      AC_MSG_RESULT([yes])
+      DRM_NOUVEAU_CFLAGS="$DRM_NOUVEAU_CFLAGS $MORE_DRM_CFLAGS"
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([Could not find nouveau_drm.h])
+    fi
   fi
+
+  AC_SUBST(DRM_NOUVEAU_CFLAGS)
+  AC_SUBST(DRM_NOUVEAU_LIBS)
+  AC_DEFINE(PLY_ENABLE_LIBDRM_NOUVEAU, 1, [Enable support for libdrm_nouveau driver])
 fi
-CFLAGS="$OLD_CFLAGS"
-AC_SUBST(DRM_CFLAGS)
-AC_SUBST(DRM_LIBS)
 
 AC_ARG_ENABLE(libkms, AS_HELP_STRING([--enable-libkms],[enable building with libkms support]),enable_libkms=$enableval,enable_libkms=yes)
 AM_CONDITIONAL(ENABLE_LIBKMS,  [test "$enable_libkms" = yes])
 
 if test x$enable_libkms = xyes; then
-  PKG_CHECK_MODULES(LIBKMS, [libkms])
+  PKG_CHECK_MODULES(LIBKMS, [libdrm libkms])
   AC_SUBST(LIBKMS_CFLAGS)
   AC_SUBST(LIBKMS_LIBS)
   AC_DEFINE(PLY_ENABLE_LIBKMS, 1, [Enable support for libkms abstraction over drm drivers])
 fi
 
+DRM_CFLAGS="$DRM_INTEL_CFLAGS $DRM_RADEON_CFLAGS $DRM_NOUVEAU_CFLAGS $LIBKMS_CFLAG"
+DRM_LIBS="$DRM_INTEL_LIBS $DRM_RADEON_LIBS $DRM_NOUVEAU_LIBS $LIBKMS_LIBS"
+AC_SUBST(DRM_CFLAGS)
+AC_SUBST(DRM_LIBS)
+
+AM_CONDITIONAL(ENABLE_DRM_RENDERER,
+               [test x$enable_libdrm_intel = xyes   \
+                  -o x$enable_libdrm_radeon = xyes  \
+                  -o x$enable_libdrm_nouveau = xyes \
+                  -o x$enable_libkms = xyes])
+
 AC_ARG_ENABLE(tracing, AS_HELP_STRING([--enable-tracing],[enable verbose tracing code]),enable_tracing=$enableval,enable_tracing=yes)
 
 if test x$enable_tracing = xyes; then
index 4c0168f00f79d7bfb086fd27091459850b1a1700..6a689073bc72106a83e7506bf1338d77c3082539 100755 (executable)
@@ -99,7 +99,7 @@ fi
 
 inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR
 
-inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
+[ -f "${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
 inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR
 
 if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
index 5a449a7998402302de341f0f2dd0887946ce0cdb..a81f48dc77f618b2bbe79763d9fcec96b823ff7c 100644 (file)
@@ -1,2 +1,3 @@
-SUBDIRS = frame-buffer drm x11
+SUBDIRS = frame-buffer x11 drm
+
 MAINTAINERCLEANFILES = Makefile.in
index 7d2ef600b6aad12ad624b93be598bfc4e2c62237..8434d0ec2af6aeec141d06b4fe3e6100e3d94a0a 100644 (file)
@@ -1,3 +1,4 @@
+if ENABLE_DRM_RENDERER
 INCLUDES = -I$(top_srcdir)                                                    \
            -I$(srcdir)/../../../libply                                        \
            -I$(srcdir)/../../../libply-splash-core                            \
@@ -16,19 +17,29 @@ drm_la_LIBADD = $(PLYMOUTH_LIBS) $(DRM_LIBS)                                  \
                          ../../../libply/libply.la                            \
                          ../../../libply-splash-core/libply-splash-core.la
 drm_la_SOURCES = $(srcdir)/plugin.c                                           \
-                $(srcdir)/ply-renderer-driver.h                              \
-                $(srcdir)/ply-renderer-i915-driver.h                         \
-                $(srcdir)/ply-renderer-i915-driver.c                         \
-                $(srcdir)/ply-renderer-radeon-driver.h                       \
-                $(srcdir)/ply-renderer-radeon-driver.c                       \
-                $(srcdir)/ply-renderer-nouveau-driver.h                      \
-                $(srcdir)/ply-renderer-nouveau-driver.c
+                 $(srcdir)/ply-renderer-driver.h
+if ENABLE_LIBDRM_INTEL
+drm_la_SOURCES += $(srcdir)/ply-renderer-i915-driver.h                        \
+                  $(srcdir)/ply-renderer-i915-driver.c
+endif
+
+if ENABLE_LIBDRM_RADEON
+drm_la_SOURCES += $(srcdir)/ply-renderer-radeon-driver.h                      \
+                  $(srcdir)/ply-renderer-radeon-driver.c
+endif
+
+if ENABLE_LIBDRM_NOUVEAU
+drm_la_SOURCES += $(srcdir)/ply-renderer-nouveau-driver.h                     \
+                  $(srcdir)/ply-renderer-nouveau-driver.c
+endif
 
 if ENABLE_LIBKMS
 drm_la_LIBADD += $(LIBKMS_LIBS)
 drm_la_CFLAGS += $(LIBKMS_CFLAGS)
 drm_la_SOURCES += $(srcdir)/ply-renderer-libkms-driver.h                      \
-                 $(srcdir)/ply-renderer-libkms-driver.c
+                  $(srcdir)/ply-renderer-libkms-driver.c
+endif
+
 endif
 
 MAINTAINERCLEANFILES = Makefile.in
index 29b195242ed42a0aaf616e94f3221638841f8c96..6b852baba2d7824a8a6f89da3004c16edd7852b8 100644 (file)
 #include "ply-renderer.h"
 #include "ply-renderer-plugin.h"
 #include "ply-renderer-driver.h"
+#ifdef PLY_ENABLE_LIBDRM_INTEL
 #include "ply-renderer-i915-driver.h"
+#endif
+#ifdef PLY_ENABLE_LIBDRM_RADEON
 #include "ply-renderer-radeon-driver.h"
+#endif
+#ifdef PLY_ENABLE_LIBDRM_NOUVEAU
 #include "ply-renderer-nouveau-driver.h"
+#endif
 
 #ifdef PLY_ENABLE_LIBKMS
 #include "ply-renderer-libkms-driver.h"
@@ -501,22 +507,28 @@ load_driver (ply_renderer_backend_t *backend)
       free (driver_name);
       return false;
     }
-
-  if (strcmp (driver_name, "i915") == 0)
+  backend->driver_interface = NULL;
+#ifdef PLY_ENABLE_LIBDRM_INTEL
+  if (backend->driver_interface == NULL && strcmp (driver_name, "i915") == 0)
     {
       backend->driver_interface = ply_renderer_i915_driver_get_interface ();
       backend->driver_supports_mapping_console = true;
     }
-  else if (strcmp (driver_name, "radeon") == 0)
+#endif
+#ifdef PLY_ENABLE_LIBDRM_RADEON
+  if (backend->driver_interface == NULL && strcmp (driver_name, "radeon") == 0)
     {
       backend->driver_interface = ply_renderer_radeon_driver_get_interface ();
       backend->driver_supports_mapping_console = false;
     }
-  else if (strcmp (driver_name, "nouveau") == 0)
+#endif
+#ifdef PLY_ENABLE_LIBDRM_NOUVEAU
+  if (backend->driver_interface == NULL && strcmp (driver_name, "nouveau") == 0)
     {
       backend->driver_interface = ply_renderer_nouveau_driver_get_interface ();
       backend->driver_supports_mapping_console = false;
     }
+#endif
 
   free (driver_name);