~aperezdc/drmgamma

f55e28a5f786c097b4f288ad0c85c2aea480af45 — Adrian Perez de Castro 3 years ago 2919a33
Use drmIsMaster() only if available

This allows building against older libdrm versions.
2 files changed, 14 insertions(+), 2 deletions(-)

M drmgamma.c
M meson.build
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,
)