Link -lsocket and -lnsl for socket functions on Solaris.

Also, added some #defines to make symbols visible that are in BSD but not
in UNIX. Solaris needs these, since it's fairly strict with its symbol
visibility in system headers.
This commit is contained in:
iphydf 2018-07-19 14:56:34 +00:00
parent 7c05b3a85e
commit bf79fdbb43
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
3 changed files with 24 additions and 0 deletions

View File

@ -309,11 +309,22 @@ if(CMAKE_THREAD_LIBS_INIT)
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT})
endif()
if(NSL_LIBRARIES)
set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${NSL_LIBRARIES})
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lnsl)
endif()
if(RT_LIBRARIES)
set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${RT_LIBRARIES})
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lrt)
endif()
if(SOCKET_LIBRARIES)
set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${SOCKET_LIBRARIES})
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lsocket)
endif()
if(WIN32)
set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ws2_32 iphlpapi)
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lws2_32 -liphlpapi)

View File

@ -8,7 +8,9 @@ include(ModulePackage)
find_package(Threads REQUIRED)
find_library(NSL_LIBRARIES nsl )
find_library(RT_LIBRARIES rt )
find_library(SOCKET_LIBRARIES socket )
# For toxcore.
pkg_use_module(LIBSODIUM libsodium )

View File

@ -29,6 +29,12 @@
#define _DARWIN_C_SOURCE
#endif
// For Solaris.
#ifdef __sun
#define __EXTENSIONS__ 1
#endif
// For Linux (and some BSDs).
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 700
#endif
@ -85,6 +91,11 @@
#include <sys/types.h>
#include <unistd.h>
#ifdef __sun
#include <stropts.h>
#include <sys/filio.h>
#endif
#define TOX_EWOULDBLOCK EWOULDBLOCK
#else