Upgrade to Wayland/Weston 1.9.0
[AGL/meta-agl.git] / meta-agl / recipes-graphics / wayland / weston / 0001-make-error-portable.patch
1 From c22e90365d89346258394833cbcad03ff32b2e27 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Fri, 29 May 2015 20:56:00 -0700
4 Subject: [PATCH weston] make error() portable
5
6 error() is not posix but gnu extension so may not be available on all
7 kind of systemsi e.g. musl.
8
9 Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 ---
11 Upstream-Status: Submitted
12
13  configure.ac        |  2 ++
14  src/weston-error.h  | 20 ++++++++++++++++++++
15  src/weston-launch.c |  2 +-
16  3 files changed, 23 insertions(+), 1 deletion(-)
17  create mode 100644 src/weston-error.h
18
19 diff --git a/configure.ac b/configure.ac
20 index 263fc22..f52cd62 100644
21 --- a/configure.ac
22 +++ b/configure.ac
23 @@ -57,6 +57,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
24               [[#include <time.h>]])
25  AC_CHECK_HEADERS([execinfo.h])
26  
27 +AC_CHECK_HEADERS([error.h])
28 +
29  AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
30  
31  COMPOSITOR_MODULES="wayland-server >= 1.7.93 pixman-1 >= 0.25.2"
32 diff --git a/src/weston-error.h b/src/weston-error.h
33 new file mode 100644
34 index 0000000..2089d02
35 --- /dev/null
36 +++ b/src/weston-error.h
37 @@ -0,0 +1,20 @@
38 +#ifndef _WESTON_ERROR_H
39 +#define _WESTON_ERROR_H
40 +
41 +#if defined(HAVE_ERROR_H)
42 +#include <error.h>
43 +#else
44 +#include <err.h>
45 +#include <string.h>
46 +#define _weston_error(S, E, F, ...) do { \
47 +       if (E) \
48 +               err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
49 +       else \
50 +               err(S, F, ##__VA_ARGS__); \
51 +} while(0)
52 +
53 +#define error _weston_error
54 +#endif
55 +
56 +#endif
57 +
58 diff --git a/src/weston-launch.c b/src/weston-launch.c
59 index 10c66de..3e6d30a 100644
60 --- a/src/weston-launch.c
61 +++ b/src/weston-launch.c
62 @@ -30,7 +30,6 @@
63  #include <poll.h>
64  #include <errno.h>
65  
66 -#include <error.h>
67  #include <getopt.h>
68  
69  #include <sys/types.h>
70 @@ -56,6 +55,7 @@
71  #endif
72  
73  #include "weston-launch.h"
74 +#include "weston-error.h"
75  
76  #define DRM_MAJOR 226
77  
78 -- 
79 2.1.4
80