jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/33256 )
Change subject: Added generation of include/osmocom/core/socket_compat.h ......................................................................
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 --- M configure.ac M include/osmocom/core/Makefile.am A include/osmocom/core/socket_compat.h.tpl 3 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/33256/1
diff --git a/configure.ac b/configure.ac index 5e17c7a..ef15f22 100644 --- a/configure.ac +++ b/configure.ac @@ -69,6 +69,7 @@ dnl checks for header files AC_HEADER_STDC AC_CHECK_HEADERS(execinfo.h poll.h sys/select.h sys/socket.h sys/signalfd.h sys/eventfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h) +AC_CHECK_DECL(HAVE_SYS_SOCKET_H, AC_SUBST(HAVE_SYS_SOCKET_H, 1), AC_SUBST(HAVE_SYS_SOCKET_H, 0)) # for src/conv.c AC_FUNC_ALLOCA AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DLOPEN="$LIBS";LIBS=""]) diff --git a/include/osmocom/core/Makefile.am b/include/osmocom/core/Makefile.am index 1d394cd..c7d2b32 100644 --- a/include/osmocom/core/Makefile.am +++ b/include/osmocom/core/Makefile.am @@ -62,6 +62,7 @@ sockaddr_str.h \ time_cc.h \ use_count.h \ + socket_compat.h \ $(NULL)
if ENABLE_PLUGIN @@ -93,3 +94,7 @@ 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' $< > $@ diff --git a/include/osmocom/core/socket_compat.h.tpl b/include/osmocom/core/socket_compat.h.tpl new file mode 100644 index 0000000..43bee9e --- /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