summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--toxcore/ccompat.h6
2 files changed, 18 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56773dbb..bd22e8d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,6 +62,18 @@ if(APPLE)
62 include(MacRpath) 62 include(MacRpath)
63endif() 63endif()
64 64
65if(UNIX)
66 if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
67 set(LINUX TRUE)
68 elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
69 set(OPENBSD TRUE)
70 elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
71 set(NETBSD TRUE)
72 elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD")
73 set(FREEBSD TRUE)
74 endif()
75endif()
76
65enable_testing() 77enable_testing()
66 78
67set(CMAKE_MACOSX_RPATH ON) 79set(CMAKE_MACOSX_RPATH ON)
@@ -184,10 +196,10 @@ if(ASAN)
184else() 196else()
185 # Forbid undefined symbols in shared libraries. This is incompatible with 197 # Forbid undefined symbols in shared libraries. This is incompatible with
186 # asan, so it's in the else branch here. 198 # asan, so it's in the else branch here.
187 if(APPLE) 199 if(LINUX)
188 add_dllflag("-undefined error")
189 else()
190 add_dllflag("-Wl,-z,defs") 200 add_dllflag("-Wl,-z,defs")
201 else()
202 add_dllflag("-undefined error")
191 endif() 203 endif()
192endif() 204endif()
193 205
diff --git a/toxcore/ccompat.h b/toxcore/ccompat.h
index b70850d2..f4aa1d89 100644
--- a/toxcore/ccompat.h
+++ b/toxcore/ccompat.h
@@ -22,13 +22,13 @@
22// Emulation using alloca. 22// Emulation using alloca.
23#ifdef _WIN32 23#ifdef _WIN32
24#include <malloc.h> 24#include <malloc.h>
25#elif defined(__FreeBSD__) 25#elif defined(__linux__)
26#include <alloca.h>
27#else
26#include <stdlib.h> 28#include <stdlib.h>
27#if !defined(alloca) && defined(__GNUC__) 29#if !defined(alloca) && defined(__GNUC__)
28#define alloca __builtin_alloca 30#define alloca __builtin_alloca
29#endif 31#endif
30#else
31#include <alloca.h>
32#endif 32#endif
33 33
34#define VLA(type, name, size) \ 34#define VLA(type, name, size) \