Support FreeBSD in the default configuration

FreeBSD support is basically just very small changes related to
some different includes and one define to not hide non-standard defines
like B115200.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
This commit is contained in:
Arne Schwabe 2024-09-12 13:43:38 +02:00
parent 73fcf72792
commit d85f0a98f5
3 changed files with 8 additions and 1 deletions

View File

@ -11,7 +11,7 @@ set (LWIP_DEFINITIONS LWIP_DEBUG=1)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app)
else() else()
message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app")

View File

@ -41,6 +41,8 @@
#define LWIP_UNIX_MACH #define LWIP_UNIX_MACH
#elif defined __OpenBSD__ #elif defined __OpenBSD__
#define LWIP_UNIX_OPENBSD #define LWIP_UNIX_OPENBSD
#elif defined __FreeBSD__
#define LWIP_UNIX_FREEBSD
#elif defined __FreeBSD_kernel__ && __GLIBC__ #elif defined __FreeBSD_kernel__ && __GLIBC__
#define LWIP_UNIX_KFREEBSD #define LWIP_UNIX_KFREEBSD
#elif defined __CYGWIN__ #elif defined __CYGWIN__

View File

@ -1,7 +1,10 @@
/* Author: Magnus Ivarsson <magnus.ivarsson@volvo.com> */ /* Author: Magnus Ivarsson <magnus.ivarsson@volvo.com> */
/* to get rid of implicit function declarations */ /* to get rid of implicit function declarations */
#ifndef __FreeBSD__
/* defining this on FreeBSD hides non-standard defines that sio.c depends on */
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#endif
#define _GNU_SOURCE #define _GNU_SOURCE
/* build with Darwin C extensions not part of POSIX, i.e. FASYNC, SIGIO. /* build with Darwin C extensions not part of POSIX, i.e. FASYNC, SIGIO.
@ -37,6 +40,8 @@
#include <stdio.h> #include <stdio.h>
#if defined(LWIP_UNIX_OPENBSD) || defined(LWIP_UNIX_MACH) #if defined(LWIP_UNIX_OPENBSD) || defined(LWIP_UNIX_MACH)
#include <util.h> #include <util.h>
#elif defined(LWIP_UNIX_FREEBSD)
#include <libutil.h>
#endif #endif
#include <termios.h> #include <termios.h>
#include <stdio.h> #include <stdio.h>