diff --git a/ports/unix/port/include/arch/cc.h b/ports/unix/port/include/arch/cc.h index 3e77e65..477da85 100644 --- a/ports/unix/port/include/arch/cc.h +++ b/ports/unix/port/include/arch/cc.h @@ -62,6 +62,14 @@ typedef __kernel_fd_set fd_set; #endif +#if defined(LWIP_UNIX_MACH) +/* sys/types.h and signal.h bring in Darwin byte order macros. pull the + header here and disable LwIP's version so that apps still can get + the macros via LwIP headers and use system headers */ +#include +#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS +#endif + struct sio_status_s; typedef struct sio_status_s sio_status_t; #define sio_fd_t sio_status_t* diff --git a/ports/unix/port/netif/sio.c b/ports/unix/port/netif/sio.c index 686b2cb..8653fc9 100644 --- a/ports/unix/port/netif/sio.c +++ b/ports/unix/port/netif/sio.c @@ -4,6 +4,14 @@ #define _XOPEN_SOURCE 600 #define _GNU_SOURCE +/* build with Darwin C extensions not part of POSIX, i.e. FASYNC, SIGIO. + we can't use LWIP_UNIX_MACH because extensions need to be turned + on before any system headers (which are pulled in through cc.h) + are included */ +#if defined(__APPLE__) +#define _DARWIN_C_SOURCE +#endif + #include "netif/sio.h" #include "netif/fifo.h" #include "lwip/debug.h" diff --git a/ports/unix/port/netif/unixif.c b/ports/unix/port/netif/unixif.c index c945383..db833f2 100644 --- a/ports/unix/port/netif/unixif.c +++ b/ports/unix/port/netif/unixif.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include