summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-02-12 22:03:13 -0700
committerJens Axboe <axboe@kernel.dk>2020-02-12 22:03:13 -0700
commit71690566b9138ac6f7bad3a278f9d3d28e8525d4 (patch)
treecdc52888236cffbf5b9545ba2ff4961a5f31eb0a /configure
parentd0a15ca057fa3d256fd36978728d9d6daedbd919 (diff)
downloadliburing-71690566b9138ac6f7bad3a278f9d3d28e8525d4.tar.gz
liburing-71690566b9138ac6f7bad3a278f9d3d28e8525d4.tar.bz2
Auto-generate compat.h
The previous fix for __kernel_timespec only works within the liburing repo, as that's the only place we have the defines we need. Instead of relying on that, auto-generate compat.h so it suits the given build environment. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure47
1 files changed, 47 insertions, 0 deletions
diff --git a/configure b/configure
index c6cfe8e..95cf8cd 100755
--- a/configure
+++ b/configure
@@ -259,3 +259,50 @@ if test "$open_how" = "yes"; then
fi
echo "CC=$cc" >> $config_host_mak
+
+# generate compat.h
+compat_h="src/include/liburing/compat.h"
+cat > $compat_h << EOF
+/* SPDX-License-Identifier: MIT */
+#ifndef LIBURING_COMPAT_H
+#define LIBURING_COMPAT_H
+
+EOF
+
+if test "$__kernel_rwf_t" != "yes"; then
+cat > $compat_h << EOF
+typedef int __kernel_rwf_t;
+
+EOF
+fi
+if test "$__kernel_timespec" != "yes"; then
+cat >> $compat_h << EOF
+struct __kernel_timespec {
+ int64_t tv_sec;
+ long long tv_nsec;
+};
+
+EOF
+else
+cat >> $compat_h << EOF
+#include <linux/time_types.h>
+
+EOF
+fi
+if test "$open_how" != "yes"; then
+cat >> $compat_h << EOF
+#include <inttypes.h>
+
+struct open_how {
+ uint64_t flags;
+ uint16_t mode;
+ uint16_t __padding[3];
+ uint64_t resolve;
+};
+
+EOF
+fi
+
+cat >> $compat_h << EOF
+#endif
+EOF