blob: a9ddd47760148989b7d1592e4fce7895fccae621 [file] [log] [blame]
diff --git a/configure.ac b/configure.ac
index 50f8e013..d61ca8f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
[[#include <time.h>]])
AC_CHECK_HEADERS([execinfo.h])
+AC_CHECK_HEADERS([error.h])
+
AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
# check for libdrm as a build-time dependency only
diff --git a/libweston/weston-error.h b/libweston/weston-error.h
new file mode 100644
index 0000000..2089d02
--- /dev/null
+++ b/libweston/weston-error.h
@@ -0,0 +1,19 @@
+#ifndef _WESTON_ERROR_H
+#define _WESTON_ERROR_H
+
+#if defined(HAVE_ERROR_H)
+#include <error.h>
+#else
+#include <err.h>
+#include <string.h>
+#define _weston_error(S, E, F, ...) do { \
+ if (E) \
+ err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
+ else \
+ err(S, F, ##__VA_ARGS__); \
+} while(0)
+
+#define error _weston_error
+#endif
+
+#endif
diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
index bf73e0d6..90644394 100644
--- a/libweston/weston-launch.c
+++ b/libweston/weston-launch.c
@@ -33,7 +33,6 @@
#include <poll.h>
#include <errno.h>
-#include <error.h>
#include <getopt.h>
#include <sys/types.h>
@@ -59,6 +58,7 @@
#endif
#include "weston-launch.h"
+#include "weston-error.h"
#define DRM_MAJOR 226