From a79c30b8f42761129540b52e0d418331fce3620e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Wed, 27 May 2020 22:41:19 -0700 Subject: [PATCH] Check if feature macro is defined before define it Zephyr's native posix port define _POSIX_C_SOURCE with a higher value during the build, so when mbedTLS defines it with a different value breaks the build. As Zephyr is already defining a higher value is guaranteed that mbedTLS required features will be available. So, just define it in case it was not defined before. [taken from Zephyr mbedtls module: https://github.com/zephyrproject-rtos/mbedtls/commit/76dcd6eecae4c1b556a52b1b9ef66e75fc538bc5] Signed-off-by: Flavio Ceolin Signed-off-by: David Brown --- library/net_sockets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/net_sockets.c b/library/net_sockets.c index ad1ac13fb..8f79b7401 100644 --- a/library/net_sockets.c +++ b/library/net_sockets.c @@ -20,8 +20,12 @@ /* Enable definition of getaddrinfo() even when compiling with -std=c99. Must * be set before config.h, which pulls in glibc's features.h indirectly. * Harmless on other platforms. */ +#ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L +#endif +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 /* sockaddr_storage */ +#endif #include "common.h"