1 From ad1d2161c811cff25d1684c33611f300adb753bc 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] make error() portable
6 error() is not posix but gnu extension so may not be available on all
7 kind of systemsi e.g. musl.
9 Upstream-Status: Submitted
11 Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 libweston/weston-error.h | 20 ++++++++++++++++++++
16 libweston/weston-launch.c | 2 +-
17 3 files changed, 23 insertions(+), 1 deletion(-)
18 create mode 100644 libweston/weston-error.h
20 diff --git a/configure.ac b/configure.ac
21 index 7aebbdb..dc9c802 100644
24 @@ -109,6 +109,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
25 [[#include <time.h>]])
26 AC_CHECK_HEADERS([execinfo.h])
28 +AC_CHECK_HEADERS([error.h])
30 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
32 # check for libdrm as a build-time dependency only
33 diff --git a/libweston/weston-error.h b/libweston/weston-error.h
35 index 0000000..2089d02
37 +++ b/libweston/weston-error.h
39 +#ifndef _WESTON_ERROR_H
40 +#define _WESTON_ERROR_H
42 +#if defined(HAVE_ERROR_H)
47 +#define _weston_error(S, E, F, ...) do { \
49 + err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
51 + err(S, F, ##__VA_ARGS__); \
54 +#define error _weston_error
59 diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
60 index 1adcf21..166bf3b 100644
61 --- a/libweston/weston-launch.c
62 +++ b/libweston/weston-launch.c
70 #include <sys/types.h>
74 #include "weston-launch.h"
75 +#include "weston-error.h"