[gtk+] meson: simplify cups version check in printbackends
- From: Tim-Philipp Müller <tpm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] meson: simplify cups version check in printbackends
- Date: Wed, 3 May 2017 17:45:55 +0000 (UTC)
commit 88900814cd4e4beafedbf8f52959d87e965014f5
Author: Tim-Philipp Müller <tim centricular com>
Date: Wed May 3 18:40:56 2017 +0100
meson: simplify cups version check in printbackends
Using cc.compute_int() instead of cc.get_define() for now
as there seems to be some issue with get_define() (#1726).
modules/printbackends/meson.build | 62 +++++++++++--------------------------
1 files changed, 18 insertions(+), 44 deletions(-)
---
diff --git a/modules/printbackends/meson.build b/modules/printbackends/meson.build
index c9f9706..a348fda 100644
--- a/modules/printbackends/meson.build
+++ b/modules/printbackends/meson.build
@@ -9,53 +9,27 @@ if enable_cups != 'no'
# 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')
- # No cc.compute_int() yet: https://github.com/mesonbuild/meson/issues/435
- cups_major_version = 0
- cups_minor_version = -1
- foreach check_ver : [1,2,3]
- if cups_major_version == 0
- if cc.compiles('''#include <cups/cups.h>
- #if CUPS_VERSION_MAJOR != @0@
- #error "Not this version"
- #endif'''.format(check_ver),
- name : 'Check CUPS major version @0@'.format(check_ver))
- cups_major_version = check_ver
- endif
+ # 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 > 1 or cups_minor_version >= 2
+ if cups_major_version > 1 or cups_minor_version >= 6
+ cdata.set('HAVE_CUPS_API_1_6', 1)
endif
- endforeach
- foreach check_ver : [0,1,2,3,4,5,6,7,8,9]
- if cups_major_version > 0 and cups_minor_version == -1
- if cc.compiles('''#include <cups/cups.h>
- #if CUPS_VERSION_MINOR != @0@
- #error "Not this version"
- #endif'''.format(check_ver),
- name : 'Check CUPS minor version @0@'.format(check_ver))
- cups_minor_version = check_ver
- endif
- endif
- endforeach
- if cups_major_version > 0 and cups_minor_version >= 0
- message('Found CUPS version: @0@.@1@'.format(cups_major_version, cups_minor_version))
- if cups_major_version > 1 or cups_minor_version >= 2
- if cups_major_version > 1 or cups_minor_version >= 6
- cdata.set('HAVE_CUPS_API_1_6', 1)
- endif
-
- if cc.compiles('#include <cups/http.h> \n http_t http; char *s = http.authstring;')
- cdata.set('HAVE_HTTP_AUTHSTRING', 1,
- description :'Define if cups http_t authstring field is accessible')
- endif
- libcups = cc.find_library('cups', required : want_cups)
- if libcups.found() and cc.has_function('httpGetAuthString', dependencies : libcups)
- cdata.set('HAVE_HTTPGETAUTHSTRING', 1)
- endif
- print_backends += ['cups']
- elif want_cups
- error('Need CUPS version >= 1.2')
+ if cc.compiles('#include <cups/http.h> \n http_t http; char *s = http.authstring;')
+ cdata.set('HAVE_HTTP_AUTHSTRING', 1,
+ description :'Define if cups http_t authstring field is accessible')
endif
- else
- error('Could not determine CUPS version from header files.')
+ libcups = cc.find_library('cups', required : want_cups)
+ if libcups.found() and cc.has_function('httpGetAuthString', dependencies : libcups)
+ cdata.set('HAVE_HTTPGETAUTHSTRING', 1)
+ endif
+
+ print_backends += ['cups']
+ elif want_cups
+ error('Need CUPS version >= 1.2')
endif
elif want_cups
error('Cannot find CUPS headers in default prefix.')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]