Add support for non-glibc systems

MaxScale can now be built on systems that use an alternative libc
implementation e.g. musl.
This commit is contained in:
Markus Mäkelä
2017-07-28 14:14:47 +03:00
parent 782b8db2aa
commit 854c4a1ed3
17 changed files with 104 additions and 77 deletions

View File

@ -3,6 +3,7 @@
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFiles)
include(CheckCXXSourceCompiles)
check_include_files(arpa/inet.h HAVE_ARPA_INET)
check_include_files(crypt.h HAVE_CRYPT)
@ -69,11 +70,6 @@ if(NOT HAVE_LIBM)
message(FATAL_ERROR "Could not find libm")
endif()
find_library(HAVE_LIBDL NAMES dl)
if(NOT HAVE_LIBDL)
message(FATAL_ERROR "Could not find libdl")
endif()
find_library(HAVE_LIBRT NAMES rt)
if(NOT HAVE_LIBRT)
message(FATAL_ERROR "Could not find librt")
@ -83,3 +79,17 @@ find_library(HAVE_LIBPTHREAD NAMES pthread)
if(NOT HAVE_LIBPTHREAD)
message(FATAL_ERROR "Could not find libpthread")
endif()
# The XSI version of strerror_r return an int and the GNU version a char*
check_cxx_source_compiles("
#define _GNU_SOURCE 1
#include <string.h>\n
int main(){\n
char errbuf[200];\n
return strerror_r(13, errbuf, sizeof(errbuf)) == errbuf;\n
}\n"
HAVE_GLIBC)
if(HAVE_GLIBC)
add_definitions(-DHAVE_GLIBC=1)
endif()