aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-02-13 09:36:59 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-02-13 09:40:29 -0500
commit4959d9c251ce603b8e32e7532559ad2a7867b6ab (patch)
tree28b21dbe61b1676f3c9b73514f934a77717776d6 /include
parent4527a13debf7ca4c6c193bf2e82351bf3e9e3ea8 (diff)
downloadstasis-4959d9c251ce603b8e32e7532559ad2a7867b6ab.tar.gz
Compatibility changes
Diffstat (limited to 'include')
-rw-r--r--include/config.h.in8
-rw-r--r--include/omc.h1
-rw-r--r--include/os_darwin.h26
-rw-r--r--include/os_linux.h10
-rw-r--r--include/relocation.h6
5 files changed, 49 insertions, 2 deletions
diff --git a/include/config.h.in b/include/config.h.in
index 460ac04..fe6beb2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -8,12 +8,14 @@
#elif defined(__linux__)
#define OMC_OS_LINUX
+#include "os_linux.h"
#elif defined(unix) || defined(__unix__) || defined(__unix)
#define OMC_OS_UNIX
-#elif defined(__APPLE__) && defined(__MACH__)
+#elif defined(__APPLE__)
#define OMC_OS_DARWIN
+#include "os_darwin.h"
#else
#define OMC_OS_UNKNOWN
@@ -21,4 +23,6 @@
#endif // OS detection
-#endif // OMC_CONFIG_H \ No newline at end of file
+
+
+#endif // OMC_CONFIG_H
diff --git a/include/omc.h b/include/omc.h
index bb49dd1..7eb6c6e 100644
--- a/include/omc.h
+++ b/include/omc.h
@@ -18,6 +18,7 @@
#include "config.h"
#include "template.h"
+
#include "utils.h"
#include "copy.h"
#include "ini.h"
diff --git a/include/os_darwin.h b/include/os_darwin.h
new file mode 100644
index 0000000..390968c
--- /dev/null
+++ b/include/os_darwin.h
@@ -0,0 +1,26 @@
+#ifndef OMC_OS_DARWIN_H
+#define OMC_OS_DARWIN_H
+
+#include <sys/mount.h>
+
+#ifndef __DARWIN_64_BIT_INO_T
+#define statvfs statfs
+
+#ifndef ST_RDONLY
+#define ST_RDONLY MNT_RDONLY
+#endif
+
+#define ST_NOEXEC MNT_NOEXEC
+#define f_flag f_flags
+#endif // __DARWIN_64_BIT_INO_T
+
+#include <limits.h>
+
+#ifndef PATH_MAX
+#include <sys/syslimits.h>
+#endif
+
+extern char **environ;
+#define __environ environ
+
+#endif
diff --git a/include/os_linux.h b/include/os_linux.h
new file mode 100644
index 0000000..8c3aed7
--- /dev/null
+++ b/include/os_linux.h
@@ -0,0 +1,10 @@
+#ifndef OMC_OS_LINUX_H
+#define OMC_OS_LINUX_H
+
+#include <limits.h>
+
+#ifndef PATH_MAX
+#include <linux/limits.h>
+#endif
+
+#endif
diff --git a/include/relocation.h b/include/relocation.h
index 2ccf762..ea9da9f 100644
--- a/include/relocation.h
+++ b/include/relocation.h
@@ -4,10 +4,16 @@
#ifndef OMC_RELOCATION_H
#define OMC_RELOCATION_H
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(OMC_OS_DARWIN)
+#include <limits.h>
+# else
#include <linux/limits.h>
+#endif
#include <unistd.h>
void replace_text(char *original, const char *target, const char *replacement);