From 0b23a1ee7ec753db76d0d33d2e66c4f11d4f310e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 19 Mar 2022 06:30:36 -0400 Subject: [PATCH] build: fix kFreeBSD build (#3566) Define _GNU_SOURCE and link against libdl for dlopen. Link to freebsd-glue for cmake builds. This was previously fixed for Makefile builds in c5d2bf12f7565e143b6becd2560428e602485d06 --- CMakeLists.txt | 5 +++++ Makefile.am | 4 ++++ configure.ac | 1 + 3 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 628812d5..4c50cc56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,6 +269,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "GNU") src/unix/hurd.c) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") + list(APPEND uv_defines _GNU_SOURCE) + list(APPEND uv_libraries dl freebsd-glue) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) list(APPEND uv_libraries dl rt) diff --git a/Makefile.am b/Makefile.am index 895dba51..32fccede 100644 --- a/Makefile.am +++ b/Makefile.am @@ -464,6 +464,10 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ src/unix/hurd.c endif +if KFREEBSD +libuv_la_CFLAGS += -D_GNU_SOURCE +endif + if LINUX uvinclude_HEADERS += include/uv/linux.h libuv_la_CFLAGS += -D_GNU_SOURCE diff --git a/configure.ac b/configure.ac index 1c2a026a..a9012d40 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false]) AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])]) AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])]) AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[*freebsd*], [true], [false])]) +AM_CONDITIONAL([KFREEBSD], [AS_CASE([$host_os],[kfreebsd*], [true], [false])]) AM_CONDITIONAL([HAIKU], [AS_CASE([$host_os],[haiku], [true], [false])]) AM_CONDITIONAL([HURD], [AS_CASE([$host_os],[gnu*], [true], [false])]) AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])])