Rewrite shm buffer file allocation v2

We had duplicated code in many places, using hardcoded paths for
temporary files into more than one path. Some cases did not bother with
O_CLOEXEC, and all hardcoded paths that might not exist.

Add an OS helper function for creating a unique anonymous file with
close-on-exec semantics. The helper uses $XDG_RUNTIME_DIR as the
directory for a file.

This patch unifies the buffer file creation in both Weston and the
clients.

As simple clients are better not linking to libshared, as it would
require e.g. Cairo, they pull the OS compatibility code directly.

Android does not have mkostemp(), so a configure test is added for it,
and a fallback used if it is not available.

Changes in v2:
	remove all the alternate possible directory definitions and use
	XDG_RUNTIME_DIR only, and fail is it is not set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/shared/os-compatibility.h b/shared/os-compatibility.h
index 6ada7b6..b2021f1 100644
--- a/shared/os-compatibility.h
+++ b/shared/os-compatibility.h
@@ -23,6 +23,10 @@
 #ifndef OS_COMPATIBILITY_H
 #define OS_COMPATIBILITY_H
 
+#include <sys/types.h>
+
+#include "../config.h"
+
 #ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
 #else
@@ -39,4 +43,7 @@
 int
 os_epoll_create_cloexec(void);
 
+int
+os_create_anonymous_file(off_t size);
+
 #endif /* OS_COMPATIBILITY_H */