1 # Since musl doesn't provide error.h we need to check before adding it. If
2 # error.h is present in system only then we include it else we use err.h.
3 # Already there exists a bug report for this upstream [1]. The devs are open to
4 # a custom implementation of error but for now this patch for do it.
6 # [1]: https://github.com/libratbag/libratbag/issues/1253
8 # Closes: https://bugs.gentoo.org/830557
11 @@ -74,8 +74,13 @@ dep_libevdev = dependency('libevdev')
12 dep_glib = dependency('glib-2.0')
13 dep_json_glib = dependency('json-glib-1.0')
14 dep_lm = cc.find_library('m')
15 +error_exists = cc.has_header('error.h')
16 dep_unistring = cc.find_library('unistring')
19 + add_global_arguments('-DHAVE_ERROR_H', language : 'c')
22 if get_option('logind-provider') == 'elogind'
23 dep_logind = dependency('libelogind', version : '>=227')
25 --- a/tools/hidpp10-dump-page.c
26 +++ b/tools/hidpp10-dump-page.c
35 +#define error(status, errno, ...) err(status, __VA_ARGS__)
40 --- a/tools/hidpp20-dump-page.c
41 +++ b/tools/hidpp20-dump-page.c
50 +#define error(status, errno, ...) err(status, __VA_ARGS__)
55 --- a/tools/hidpp20-reset.c
56 +++ b/tools/hidpp20-reset.c
65 +#define error(status, errno, ...) err(status, __VA_ARGS__)