aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-06-09 15:21:56 +0200
committerlaforge <laforge@osmocom.org>2023-06-09 15:06:34 +0000
commitbb20d4e70386470eebfd66e9bc074820fc81d76f (patch)
tree8a52fb4f9d30b8d2349b9c3c17ddc7b23ac3ab4a /include/osmocom/core
parent8d42394c89abdad60d603da42ebeb9ea66cfe716 (diff)
Added generation of include/osmocom/core/socket_compat.h
This file is required to compile header files on machines that do not have sys/socket.h. Change-Id: Ia3eafc992221900bbbf1760f669725bf9da92105
Diffstat (limited to 'include/osmocom/core')
-rw-r--r--include/osmocom/core/Makefile.am7
-rw-r--r--include/osmocom/core/socket_compat.h.tpl10
2 files changed, 17 insertions, 0 deletions
diff --git a/include/osmocom/core/Makefile.am b/include/osmocom/core/Makefile.am
index 1d394cd3..e1b52d51 100644
--- a/include/osmocom/core/Makefile.am
+++ b/include/osmocom/core/Makefile.am
@@ -62,6 +62,7 @@ osmocore_HEADERS = \
sockaddr_str.h \
time_cc.h \
use_count.h \
+ socket_compat.h \
$(NULL)
if ENABLE_PLUGIN
@@ -93,3 +94,9 @@ bit%gen.h: bitXXgen.h.tpl
crc%gen.h: crcXXgen.h.tpl
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)sed -e's/XX/$*/g' $< > $@
+
+socket_compat.h: socket_compat.h.tpl
+ $(AM_V_GEN)$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN)sed -e's/XX/$(HAVE_SYS_SOCKET_H)/g' $< > $@
+
+EXTRA_DIST = socket_compat.h.tpl
diff --git a/include/osmocom/core/socket_compat.h.tpl b/include/osmocom/core/socket_compat.h.tpl
new file mode 100644
index 00000000..43bee9ee
--- /dev/null
+++ b/include/osmocom/core/socket_compat.h.tpl
@@ -0,0 +1,10 @@
+#define HAVE_STRUCT_SOCKADDR_STORAGE XX
+
+#if HAVE_STRUCT_SOCKADDR_STORAGE
+ #include <sys/socket.h>
+#else
+struct sockaddr_storage {
+ unsigned short ss_family;
+ char __data[128 - sizeof(unsigned short)];
+};
+#endif