meson: cups: use cups-config for looking up cups

We were looking for the cups headers and the cups lib in the default locations
which for example breaks with OpenBSD where the cups headers are under /usr/local/include/

Instead just use the "cups" dependency type from meson which internally uses cups-config.

See #1967

Ported to master from !963
This commit is contained in:
Christoph Reiter 2019-07-01 21:52:06 +02:00
parent 4d4e02c9d0
commit 72814c54a8

View File

@ -17,24 +17,8 @@ print_backends = ['file']
# Checks to see if we should compile with CUPS backend for GTK
enable_cups = enabled_print_backends.contains('cups')
if enable_cups
#cups_config = find_program('cups-config', required : true)
#if cups_config.found()
# FIXME: eek, see configure.ac (we're just not going to support non-standar prefix for now)
#endif
if cc.has_header('cups/cups.h')
# TODO: include_directories from cups-config
cups_major_version = cc.compute_int('CUPS_VERSION_MAJOR', prefix : '#include <cups/cups.h>')
cups_minor_version = cc.compute_int('CUPS_VERSION_MINOR', prefix : '#include <cups/cups.h>')
message('Found CUPS version: @0@.@1@'.format(cups_major_version, cups_minor_version))
if cups_major_version < 2
cups_error = 'Need CUPS version >= 2.0'
else
libcups = cc.find_library('cups', required : true)
print_backends += ['cups']
endif
else
error('Cannot find CUPS headers in default prefix.')
endif
cups_dep = dependency('cups', version : '>=2.0', required: true)
print_backends += ['cups']
endif
# Checks to see if we should compile with cloudprint backend for GTK
@ -93,7 +77,7 @@ if print_backends.contains('cups')
'gtkcupsutils.c',
'gtkcupssecretsutils.c',
c_args: printbackends_args,
dependencies: [libgtk_dep, libcups, colord_dep],
dependencies: [libgtk_dep, cups_dep, colord_dep],
install_dir: printbackends_install_dir,
install : true)
endif