M drmgamma.c => drmgamma.c +4 -1
@@ 185,7 185,10 @@ main(int argc, char *argv[])
if (fd < 0)
return error("Cannot open '%s': %s.", devnode, strerror(errno));
- if (!drmIsMaster(fd)) {
+#if HAVE_DRM_IS_MASTER
+ if (!drmIsMaster(fd))
+#endif /* HAVE_DRM_IS_MASTER */
+ {
if (drmSetMaster(fd)) {
close(fd);
return error("Could not become DRM master: %s.", strerror(errno));
M meson.build => meson.build +10 -1
@@ 8,7 8,16 @@ project('drmgamma', 'c',
version: '1',
)
+libdrm_dep = dependency('libdrm')
+
+cc = meson.get_compiler('c')
+if cc.has_function('drmIsMaster', dependencies: libdrm_dep)
+ add_project_arguments('-DHAVE_DRM_IS_MASTER=1', language: 'c')
+else
+ add_project_arguments('-DHAVE_DRM_IS_MASTER=0', language: 'c')
+endif
+
executable('drmgamma',
'drmgamma.c',
- dependencies: dependency('libdrm'),
+ dependencies: libdrm_dep,
)