加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
configure.cmake 30.73 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckCXXSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckCCompilerFlag)
INCLUDE (CheckCSourceRuns)
INCLUDE (CheckCXXSourceRuns)
INCLUDE (CheckSymbolExists)
# WITH_PIC options.Not of much use, PIC is taken care of on platforms
# where it makes sense anyway.
IF(UNIX)
IF(APPLE)
# OSX executable are always PIC
SET(WITH_PIC ON)
ELSE()
OPTION(WITH_PIC "Generate PIC objects" OFF)
IF(WITH_PIC)
SET(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
SET(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
ENDIF()
ENDIF()
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX)
## We will be using gcc to generate .so files
## Add C flags (e.g. -m64) to CMAKE_SHARED_LIBRARY_C_FLAGS
## The client library contains C++ code, so add dependency on libstdc++
## See cmake --help-policy CMP0018
SET(CMAKE_SHARED_LIBRARY_C_FLAGS
"${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS} -lstdc++")
ENDIF()
# System type affects version_compile_os variable
IF(NOT SYSTEM_TYPE)
IF(PLATFORM)
SET(SYSTEM_TYPE ${PLATFORM})
ELSE()
SET(SYSTEM_TYPE ${CMAKE_SYSTEM_NAME})
ENDIF()
ENDIF()
# Probobuf 2.6.1 on Sparc. Both gcc and Solaris Studio need this.
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
ADD_DEFINITIONS(-DSOLARIS_64BIT_ENABLED)
ENDIF()
# The default C++ library for SunPro is really old, and not standards compliant.
# http://www.oracle.com/technetwork/server-storage/solaris10/cmp-stlport-libcstd-142559.html
# Use stlport rather than Rogue Wave,
# unless otherwise specified on command line.
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
IF(CMAKE_CXX_FLAGS MATCHES "-std=")
ADD_DEFINITIONS(-D__MATHERR_RENAME_EXCEPTION)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS
"${CMAKE_SHARED_LIBRARY_C_FLAGS} -lc")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS
"${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -lstdc++ -lgcc_s -lCrunG3 -lc")
SET(QUOTED_CMAKE_CXX_LINK_FLAGS "-lstdc++ -lgcc_s -lCrunG3 -lc")
ELSE()
IF(SUNPRO_CXX_LIBRARY)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=${SUNPRO_CXX_LIBRARY}")
IF(SUNPRO_CXX_LIBRARY STREQUAL "stdcxx4")
ADD_DEFINITIONS(-D__MATHERR_RENAME_EXCEPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -template=extdef")
ENDIF()
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
# Check to see if we are using LLVM's libc++ rather than e.g. libstd++
# Can then check HAVE_LLBM_LIBCPP later without including e.g. ciso646.
CHECK_CXX_SOURCE_RUNS("
#include <ciso646>
int main()
{
#ifdef _LIBCPP_VERSION
return 0;
#else
return 1;
#endif
}" HAVE_LLVM_LIBCPP)
MACRO(DIRNAME IN OUT)
GET_FILENAME_COMPONENT(${OUT} ${IN} PATH)
ENDMACRO()
MACRO(FIND_REAL_LIBRARY SOFTLINK_NAME REALNAME)
# We re-distribute libstlport.so/libstdc++.so which are both symlinks.
# There is no 'readlink' on solaris, so we use perl to follow links:
SET(PERLSCRIPT
"my $link= $ARGV[0]; use Cwd qw(abs_path); my $file = abs_path($link); print $file;")
EXECUTE_PROCESS(
COMMAND perl -e "${PERLSCRIPT}" ${SOFTLINK_NAME}
RESULT_VARIABLE result
OUTPUT_VARIABLE real_library
)
SET(REALNAME ${real_library})
ENDMACRO()
MACRO(EXTEND_CXX_LINK_FLAGS LIBRARY_PATH)
# Using the $ORIGIN token with the -R option to locate the libraries
# on a path relative to the executable:
# We need an extra backslash to pass $ORIGIN to the mysql_config script...
SET(QUOTED_CMAKE_CXX_LINK_FLAGS
"${CMAKE_CXX_LINK_FLAGS} -R'\\$ORIGIN/../lib' -R${LIBRARY_PATH}")
SET(CMAKE_CXX_LINK_FLAGS
"${CMAKE_CXX_LINK_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}")
MESSAGE(STATUS "CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS}")
ENDMACRO()
MACRO(EXTEND_C_LINK_FLAGS LIBRARY_PATH)
SET(QUOTED_CMAKE_C_LINK_FLAGS
"${CMAKE_C_LINK_FLAGS} -R'\\$ORIGIN/../lib' -R${LIBRARY_PATH}")
SET(CMAKE_C_LINK_FLAGS
"${CMAKE_C_LINK_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}")
MESSAGE(STATUS "CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS}")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS
"${CMAKE_SHARED_LIBRARY_C_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}")
ENDMACRO()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCC)
DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH)
SET(LIB_SUFFIX "lib")
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
SET(LIB_SUFFIX "lib/sparcv9")
ENDIF()
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
SET(LIB_SUFFIX "lib/amd64")
ENDIF()
FIND_LIBRARY(GPP_LIBRARY_NAME
NAMES "stdc++"
PATHS ${CXX_PATH}/../${LIB_SUFFIX}
NO_DEFAULT_PATH
)
MESSAGE(STATUS "GPP_LIBRARY_NAME ${GPP_LIBRARY_NAME}")
IF(GPP_LIBRARY_NAME)
DIRNAME(${GPP_LIBRARY_NAME} GPP_LIBRARY_PATH)
FIND_REAL_LIBRARY(${GPP_LIBRARY_NAME} real_library)
MESSAGE(STATUS "INSTALL ${GPP_LIBRARY_NAME} ${real_library}")
INSTALL(FILES ${GPP_LIBRARY_NAME} ${real_library}
DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
EXTEND_CXX_LINK_FLAGS(${GPP_LIBRARY_PATH})
EXECUTE_PROCESS(
COMMAND sh -c "elfdump ${real_library} | grep SONAME"
RESULT_VARIABLE result
OUTPUT_VARIABLE sonameline
)
IF(NOT result)
STRING(REGEX MATCH "libstdc.*[^\n]" soname ${sonameline})
MESSAGE(STATUS "INSTALL ${GPP_LIBRARY_PATH}/${soname}")
INSTALL(FILES "${GPP_LIBRARY_PATH}/${soname}"
DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
ENDIF()
ENDIF()
FIND_LIBRARY(GCC_LIBRARY_NAME
NAMES "gcc_s"
PATHS ${CXX_PATH}/../${LIB_SUFFIX}
NO_DEFAULT_PATH
)
IF(GCC_LIBRARY_NAME)
DIRNAME(${GCC_LIBRARY_NAME} GCC_LIBRARY_PATH)
FIND_REAL_LIBRARY(${GCC_LIBRARY_NAME} real_library)
MESSAGE(STATUS "INSTALL ${GCC_LIBRARY_NAME} ${real_library}")
INSTALL(FILES ${GCC_LIBRARY_NAME} ${real_library}
DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
EXTEND_C_LINK_FLAGS(${GCC_LIBRARY_PATH})
ENDIF()
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
CMAKE_C_COMPILER_ID MATCHES "SunPro" AND
CMAKE_CXX_FLAGS MATCHES "stlport4")
DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH)
# Also extract real path to the compiler(which is normally
# in <install_path>/prod/bin) and try to find the
# stlport libs relative to that location as well.
GET_FILENAME_COMPONENT(CXX_REALPATH ${CMAKE_CXX_COMPILER} REALPATH)
# CC -V yields
# CC: Studio 12.5 Sun C++ 5.14 SunOS_sparc Dodona 2016/04/04
# CC: Sun C++ 5.13 SunOS_sparc Beta 2014/03/11
# CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
EXECUTE_PROCESS(
COMMAND ${CMAKE_CXX_COMPILER} "-V"
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr
RESULT_VARIABLE result
)
IF(result)
MESSAGE(FATAL_ERROR "Failed to execute ${CMAKE_CXX_COMPILER} -V")
ENDIF()
STRING(REGEX MATCH "CC: Sun C\\+\\+ 5\\.([0-9]+)" VERSION_STRING ${stderr})
IF (NOT CMAKE_MATCH_1 OR CMAKE_MATCH_1 STREQUAL "")
STRING(REGEX MATCH "CC: Studio 12\\.5 Sun C\\+\\+ 5\\.([0-9]+)"
VERSION_STRING ${stderr})
ENDIF()
SET(CC_MINOR_VERSION ${CMAKE_MATCH_1})
IF(${CC_MINOR_VERSION} EQUAL 14)
MESSAGE(FATAL_ERROR
"Please run cmake with -DCMAKE_CXX_FLAGS=-std=c++03 for ${stderr}")
ENDIF()
IF(${CC_MINOR_VERSION} EQUAL 13)
SET(STLPORT_SUFFIX "lib/compilers/stlport4")
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
SET(STLPORT_SUFFIX "lib/compilers/stlport4/sparcv9")
ENDIF()
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
SET(STLPORT_SUFFIX "lib/compilers/stlport4/amd64")
ENDIF()
ELSE()
SET(STLPORT_SUFFIX "lib/stlport4")
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
SET(STLPORT_SUFFIX "lib/stlport4/v9")
ENDIF()
IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
SET(STLPORT_SUFFIX "lib/stlport4/amd64")
ENDIF()
ENDIF()
FIND_LIBRARY(STL_LIBRARY_NAME
NAMES "stlport"
PATHS ${CXX_PATH}/../${STLPORT_SUFFIX}
${CXX_REALPATH}/../../${STLPORT_SUFFIX}
)
MESSAGE(STATUS "STL_LIBRARY_NAME ${STL_LIBRARY_NAME}")
IF(STL_LIBRARY_NAME)
DIRNAME(${STL_LIBRARY_NAME} STLPORT_PATH)
FIND_REAL_LIBRARY(${STL_LIBRARY_NAME} real_library)
MESSAGE(STATUS "INSTALL ${STL_LIBRARY_NAME} ${real_library}")
INSTALL(FILES ${STL_LIBRARY_NAME} ${real_library}
DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
EXTEND_C_LINK_FLAGS(${STLPORT_PATH})
EXTEND_CXX_LINK_FLAGS(${STLPORT_PATH})
ELSE()
MESSAGE(STATUS "Failed to find the reuired stlport library, print some"
"variables to help debugging and bail out")
MESSAGE(STATUS "CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS "CXX_PATH ${CXX_PATH}")
MESSAGE(STATUS "CXX_REALPATH ${CXX_REALPATH}")
MESSAGE(STATUS "STLPORT_SUFFIX ${STLPORT_SUFFIX}")
MESSAGE(STATUS "PATH: ${CXX_PATH}/../${STLPORT_SUFFIX}")
MESSAGE(STATUS "PATH: ${CXX_REALPATH}/../../${STLPORT_SUFFIX}")
MESSAGE(FATAL_ERROR
"Could not find the required stlport library.")
ENDIF()
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
IF (CMAKE_EXE_LINKER_FLAGS MATCHES " -static "
OR CMAKE_EXE_LINKER_FLAGS MATCHES " -static$")
SET(HAVE_DLOPEN FALSE CACHE "Disable dlopen due to -static flag" FORCE)
SET(WITHOUT_DYNAMIC_PLUGINS TRUE)
ENDIF()
ENDIF()
IF(WITHOUT_DYNAMIC_PLUGINS)
MESSAGE("Dynamic plugins are disabled.")
ENDIF(WITHOUT_DYNAMIC_PLUGINS)
# Large files, common flag
SET(_LARGEFILE_SOURCE 1)
# Same for structs, setting HAVE_STRUCT_<name> instead
FUNCTION(MY_CHECK_STRUCT_SIZE type defbase)
CHECK_TYPE_SIZE("struct ${type}" SIZEOF_${defbase})
IF(SIZEOF_${defbase})
SET(HAVE_STRUCT_${defbase} 1 PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
# Searches function in libraries
# if function is found, sets output parameter result to the name of the library
# if function is found in libc, result will be empty
FUNCTION(MY_SEARCH_LIBS func libs result)
IF(${${result}})
# Library is already found or was predefined
RETURN()
ENDIF()
CHECK_FUNCTION_EXISTS(${func} HAVE_${func}_IN_LIBC)
IF(HAVE_${func}_IN_LIBC)
SET(${result} "" PARENT_SCOPE)
RETURN()
ENDIF()
FOREACH(lib ${libs})
CHECK_LIBRARY_EXISTS(${lib} ${func} "" HAVE_${func}_IN_${lib})
IF(HAVE_${func}_IN_${lib})
SET(${result} ${lib} PARENT_SCOPE)
SET(HAVE_${result} 1 PARENT_SCOPE)
RETURN()
ENDIF()
ENDFOREACH()
ENDFUNCTION()
# Find out which libraries to use.
# Figure out threading library
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
FIND_PACKAGE (Threads)
IF(UNIX)
MY_SEARCH_LIBS(floor m LIBM)
IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF()
MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL)
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
MY_SEARCH_LIBS(setsockopt socket LIBSOCKET)
MY_SEARCH_LIBS(dlopen dl LIBDL)
MY_SEARCH_LIBS(sched_yield rt LIBRT)
IF(NOT LIBRT)
MY_SEARCH_LIBS(clock_gettime rt LIBRT)
ENDIF()
MY_SEARCH_LIBS(timer_create rt LIBRT)
MY_SEARCH_LIBS(atomic_thread_fence atomic LIBATOMIC)
MY_SEARCH_LIBS(backtrace execinfo LIBEXECINFO)
SET(CMAKE_REQUIRED_LIBRARIES
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL}
${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBATOMIC} ${LIBEXECINFO}
)
# Need explicit pthread for gcc -fsanitize=address
IF(CMAKE_C_FLAGS MATCHES "-fsanitize=")
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread)
ENDIF()
LIST(LENGTH CMAKE_REQUIRED_LIBRARIES required_libs_length)
IF(${required_libs_length} GREATER 0)
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
ENDIF()
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
IF(WITH_LIBWRAP)
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} wrap)
CHECK_C_SOURCE_COMPILES(
"
#include <tcpd.h>
int allow_severity = 0;
int deny_severity = 0;
int main()
{
hosts_access(0);
}"
HAVE_LIBWRAP)
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
IF(HAVE_LIBWRAP)
SET(LIBWRAP "wrap")
ELSE()
MESSAGE(FATAL_ERROR
"WITH_LIBWRAP is defined, but can not find a working libwrap. "
"Make sure both the header files (tcpd.h) "
"and the library (libwrap) are installed.")
ENDIF()
ENDIF()
ENDIF()
#
# Tests for header files
#
INCLUDE (CheckIncludeFiles)
CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
CHECK_INCLUDE_FILES (fpu_control.h HAVE_FPU_CONTROL_H)
CHECK_INCLUDE_FILES (grp.h HAVE_GRP_H)
CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILES (langinfo.h HAVE_LANGINFO_H)
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H)
CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) # Used by NDB
CHECK_INCLUDE_FILES (sys/cdefs.h HAVE_SYS_CDEFS_H) # Used by libedit
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILES (sys/mman.h HAVE_SYS_MMAN_H)
CHECK_INCLUDE_FILES (sys/resource.h HAVE_SYS_RESOURCE_H)
CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H)
CHECK_INCLUDE_FILES (termio.h HAVE_TERMIO_H)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H)
CHECK_INCLUDE_FILES (sys/param.h HAVE_SYS_PARAM_H) # Used by NDB/libevent
CHECK_INCLUDE_FILES (fnmatch.h HAVE_FNMATCH_H)
CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H) # Used by libedit
CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_SASL_H) # Used by memcached
# For libevent
CHECK_INCLUDE_FILES(sys/devpoll.h HAVE_DEVPOLL)
IF(HAVE_DEVPOLL)
# Duplicate symbols, but keep it to avoid changing libevent code.
SET(HAVE_SYS_DEVPOLL_H 1)
ENDIF()
CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H)
CHECK_SYMBOL_EXISTS (TAILQ_FOREACH "sys/queue.h" HAVE_TAILQFOREACH)
#
# Tests for functions
#
CHECK_FUNCTION_EXISTS (_aligned_malloc HAVE_ALIGNED_MALLOC)
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS (printstack HAVE_PRINTSTACK)
CHECK_FUNCTION_EXISTS (index HAVE_INDEX)
CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
CHECK_FUNCTION_EXISTS (cuserid HAVE_CUSERID)
CHECK_FUNCTION_EXISTS (directio HAVE_DIRECTIO)
CHECK_FUNCTION_EXISTS (ftruncate HAVE_FTRUNCATE)
CHECK_FUNCTION_EXISTS (compress HAVE_COMPRESS)
CHECK_FUNCTION_EXISTS (crypt HAVE_CRYPT)
CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN)
CHECK_FUNCTION_EXISTS (fchmod HAVE_FCHMOD)
CHECK_FUNCTION_EXISTS (fcntl HAVE_FCNTL)
CHECK_FUNCTION_EXISTS (fdatasync HAVE_FDATASYNC)
CHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_DECL_FDATASYNC)
CHECK_FUNCTION_EXISTS (fedisableexcept HAVE_FEDISABLEEXCEPT)
CHECK_FUNCTION_EXISTS (fseeko HAVE_FSEEKO)
CHECK_FUNCTION_EXISTS (fsync HAVE_FSYNC)
CHECK_FUNCTION_EXISTS (gethostbyaddr_r HAVE_GETHOSTBYADDR_R)
CHECK_FUNCTION_EXISTS (gethrtime HAVE_GETHRTIME)
CHECK_FUNCTION_EXISTS (getnameinfo HAVE_GETNAMEINFO)
CHECK_FUNCTION_EXISTS (getpass HAVE_GETPASS)
CHECK_FUNCTION_EXISTS (getpassphrase HAVE_GETPASSPHRASE)
CHECK_FUNCTION_EXISTS (getpwnam HAVE_GETPWNAM)
CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID)
CHECK_FUNCTION_EXISTS (getrlimit HAVE_GETRLIMIT)
CHECK_FUNCTION_EXISTS (getrusage HAVE_GETRUSAGE)
CHECK_FUNCTION_EXISTS (initgroups HAVE_INITGROUPS)
CHECK_FUNCTION_EXISTS (issetugid HAVE_ISSETUGID)
CHECK_FUNCTION_EXISTS (getuid HAVE_GETUID)
CHECK_FUNCTION_EXISTS (geteuid HAVE_GETEUID)
CHECK_FUNCTION_EXISTS (getgid HAVE_GETGID)
CHECK_FUNCTION_EXISTS (getegid HAVE_GETEGID)
CHECK_FUNCTION_EXISTS (lstat HAVE_LSTAT)
CHECK_FUNCTION_EXISTS (madvise HAVE_MADVISE)
CHECK_FUNCTION_EXISTS (malloc_info HAVE_MALLOC_INFO)
CHECK_FUNCTION_EXISTS (memrchr HAVE_MEMRCHR)
CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK)
CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL)
CHECK_FUNCTION_EXISTS (mmap64 HAVE_MMAP64)
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
CHECK_FUNCTION_EXISTS (posix_fallocate HAVE_POSIX_FALLOCATE)
CHECK_FUNCTION_EXISTS (posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS (pread HAVE_PREAD) # Used by NDB
CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)
CHECK_FUNCTION_EXISTS (readlink HAVE_READLINK)
CHECK_FUNCTION_EXISTS (realpath HAVE_REALPATH)
CHECK_FUNCTION_EXISTS (setfd HAVE_SETFD)
CHECK_FUNCTION_EXISTS (sigaction HAVE_SIGACTION)
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY)
CHECK_FUNCTION_EXISTS (stpncpy HAVE_STPNCPY)
CHECK_FUNCTION_EXISTS (strlcpy HAVE_STRLCPY)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP) # Used by libbinlogevents
CHECK_FUNCTION_EXISTS (strnlen HAVE_STRNLEN)
CHECK_FUNCTION_EXISTS (strlcat HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS (strsignal HAVE_STRSIGNAL)
CHECK_FUNCTION_EXISTS (fgetln HAVE_FGETLN)
CHECK_FUNCTION_EXISTS (strsep HAVE_STRSEP)
CHECK_FUNCTION_EXISTS (tell HAVE_TELL)
CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF)
CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
CHECK_FUNCTION_EXISTS (ntohll HAVE_HTONLL)
CHECK_FUNCTION_EXISTS (clock_gettime DNS_USE_CPU_CLOCK_FOR_ID)
CHECK_FUNCTION_EXISTS (epoll_create HAVE_EPOLL)
# Temperarily Quote event port out as we encounter error in port_getn
# on solaris x86
# CHECK_FUNCTION_EXISTS (port_create HAVE_EVENT_PORTS)
CHECK_FUNCTION_EXISTS (inet_ntop HAVE_INET_NTOP)
CHECK_FUNCTION_EXISTS (kqueue HAVE_WORKING_KQUEUE)
CHECK_SYMBOL_EXISTS (timeradd "sys/time.h" HAVE_TIMERADD)
CHECK_SYMBOL_EXISTS (timerclear "sys/time.h" HAVE_TIMERCLEAR)
CHECK_SYMBOL_EXISTS (timercmp "sys/time.h" HAVE_TIMERCMP)
CHECK_SYMBOL_EXISTS (timerisset "sys/time.h" HAVE_TIMERISSET)
#--------------------------------------------------------------------
# Support for WL#2373 (Use cycle counter for timing)
#--------------------------------------------------------------------
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(sys/times.h HAVE_SYS_TIMES_H)
CHECK_FUNCTION_EXISTS(times HAVE_TIMES)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
#
# Tests for symbols
#
CHECK_SYMBOL_EXISTS(lrand48 "stdlib.h" HAVE_LRAND48)
CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/filio.h" FIONREAD_IN_SYS_FILIO)
CHECK_SYMBOL_EXISTS(SIGEV_THREAD_ID "signal.h;time.h" HAVE_SIGEV_THREAD_ID)
CHECK_SYMBOL_EXISTS(SIGEV_PORT "signal.h;time.h;sys/siginfo.h" HAVE_SIGEV_PORT)
CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2)
# On Solaris, it is only visible in C99 mode
CHECK_SYMBOL_EXISTS(isinf "math.h" HAVE_C_ISINF)
# isinf() prototype not found on Solaris
CHECK_CXX_SOURCE_COMPILES(
"#include <math.h>
int main() {
isinf(0.0);
return 0;
}" HAVE_CXX_ISINF)
IF (HAVE_C_ISINF AND HAVE_CXX_ISINF)
SET(HAVE_ISINF 1 CACHE INTERNAL "isinf visible in C and C++" FORCE)
ELSE()
SET(HAVE_ISINF 0 CACHE INTERNAL "isinf visible in C and C++" FORCE)
ENDIF()
# The results of these four checks are only needed here, not in code.
CHECK_FUNCTION_EXISTS (timer_create HAVE_TIMER_CREATE)
CHECK_FUNCTION_EXISTS (timer_settime HAVE_TIMER_SETTIME)
CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE)
CHECK_SYMBOL_EXISTS(EVFILT_TIMER "sys/types.h;sys/event.h;sys/time.h" HAVE_EVFILT_TIMER)
IF(HAVE_KQUEUE AND HAVE_EVFILT_TIMER)
SET(HAVE_KQUEUE_TIMERS 1 CACHE INTERNAL "Have kqueue timer-related filter")
ELSEIF(HAVE_TIMER_CREATE AND HAVE_TIMER_SETTIME)
IF(HAVE_SIGEV_THREAD_ID OR HAVE_SIGEV_PORT)
SET(HAVE_POSIX_TIMERS 1 CACHE INTERNAL "Have POSIX timer-related functions")
ENDIF()
ENDIF()
IF(NOT HAVE_POSIX_TIMERS AND NOT HAVE_KQUEUE_TIMERS AND NOT WIN32)
MESSAGE(FATAL_ERROR "No mysys timer support detected!")
ENDIF()
#
# Test for endianess
#
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
#
# Tests for type sizes (and presence)
#
INCLUDE (CheckTypeSize)
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h stdio.h sys/types.h time.h)
CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("int" SIZEOF_INT)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
CHECK_TYPE_SIZE("time_t" SIZEOF_TIME_T)
CHECK_TYPE_SIZE("struct timespec" STRUCT_TIMESPEC)
# If finds the size of a type, set SIZEOF_<type> and HAVE_<type>
FUNCTION(MY_CHECK_TYPE_SIZE type defbase)
CHECK_TYPE_SIZE("${type}" SIZEOF_${defbase})
IF(SIZEOF_${defbase})
SET(HAVE_${defbase} 1 PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
# We are only interested in presence for these
MY_CHECK_TYPE_SIZE(uint UINT)
MY_CHECK_TYPE_SIZE(ulong ULONG)
MY_CHECK_TYPE_SIZE(u_int32_t U_INT32_T)
IF(HAVE_IEEEFP_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ieeefp.h)
MY_CHECK_TYPE_SIZE(fp_except FP_EXCEPT)
ENDIF()
SET(CMAKE_EXTRA_INCLUDE_FILES)
# Support for tagging symbols with __attribute__((visibility("hidden")))
MY_CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
#
# Code tests
#
IF(NOT STACK_DIRECTION)
IF(CMAKE_CROSSCOMPILING)
MESSAGE(FATAL_ERROR
"STACK_DIRECTION is not defined. Please specify -DSTACK_DIRECTION=1 "
"or -DSTACK_DIRECTION=-1 when calling cmake.")
ELSE()
TRY_RUN(STACKDIR_RUN_RESULT STACKDIR_COMPILE_RESULT
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/cmake/stack_direction.c
)
# Test program returns 0 (down) or 1 (up).
# Convert to -1 or 1
IF(STACKDIR_RUN_RESULT EQUAL 0)
SET(STACK_DIRECTION -1 CACHE INTERNAL "Stack grows direction")
ELSE()
SET(STACK_DIRECTION 1 CACHE INTERNAL "Stack grows direction")
ENDIF()
MESSAGE(STATUS "Checking stack direction : ${STACK_DIRECTION}")
ENDIF()
ENDIF()
CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
CHECK_SYMBOL_EXISTS(O_NONBLOCK "unistd.h;fcntl.h" HAVE_FCNTL_NONBLOCK)
IF(NOT HAVE_FCNTL_NONBLOCK)
SET(NO_FCNTL_NONBLOCK 1)
ENDIF()
IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} processor)
IF(processor MATCHES "86" OR processor MATCHES "amd64" OR processor MATCHES "x64")
IF(NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
# The loader in some Solaris versions has a bug due to which it refuses to
# start a binary that has been compiled by GCC and uses __asm__("pause")
# with the error:
# $ ./mysqld
# ld.so.1: mysqld: fatal: hardware capability unsupported: 0x2000 [ PAUSE ]
# Killed
# $
# Even though the CPU does have support for the instruction.
# Binaries that have been compiled by GCC and use __asm__("pause")
# on a non-buggy Solaris get flagged with a "uses pause" flag and
# thus they are unusable if copied on buggy Solaris version. To
# circumvent this we explicitly disable __asm__("pause") when
# compiling on Solaris. Subsequently the tests here will enable
# HAVE_FAKE_PAUSE_INSTRUCTION which will use __asm__("rep; nop")
# which currently generates the same code as __asm__("pause") - 0xf3 0x90
# but without flagging the binary as "uses pause".
CHECK_C_SOURCE_RUNS("
int main()
{
__asm__ __volatile__ (\"pause\");
return 0;
}" HAVE_PAUSE_INSTRUCTION)
ENDIF()
ENDIF()
IF (NOT HAVE_PAUSE_INSTRUCTION)
CHECK_C_SOURCE_COMPILES("
int main()
{
__asm__ __volatile__ (\"rep; nop\");
return 0;
}
" HAVE_FAKE_PAUSE_INSTRUCTION)
ENDIF()
IF (NOT HAVE_PAUSE_INSTRUCTION)
CHECK_C_SOURCE_COMPILES("
int main()
{
__asm__ __volatile__ (\"or 1,1,1\");
__asm__ __volatile__ (\"or 2,2,2\");
return 0;
}
" HAVE_HMT_PRIORITY_INSTRUCTION)
ENDIF()
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX AND HAVE_CXXABI_H)
CHECK_CXX_SOURCE_COMPILES("
#include <cxxabi.h>
int main(int argc, char **argv)
{
char *foo= 0; int bar= 0;
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
return 0;
}"
HAVE_ABI_CXA_DEMANGLE)
ENDIF()
CHECK_C_SOURCE_COMPILES("
int main()
{
__builtin_unreachable();
return 0;
}" HAVE_BUILTIN_UNREACHABLE)
CHECK_C_SOURCE_COMPILES("
int main()
{
long l= 0;
__builtin_expect(l, 0);
return 0;
}" HAVE_BUILTIN_EXPECT)
# GCC has __builtin_stpcpy but still calls stpcpy
IF(NOT CMAKE_SYSTEM_NAME MATCHES "SunOS" OR NOT CMAKE_COMPILER_IS_GNUCC)
CHECK_C_SOURCE_COMPILES("
int main()
{
char foo1[1];
char foo2[1];
__builtin_stpcpy(foo1, foo2);
return 0;
}" HAVE_BUILTIN_STPCPY)
ENDIF()
CHECK_CXX_SOURCE_COMPILES("
int main()
{
int foo= -10; int bar= 10;
long long int foo64= -10; long long int bar64= 10;
if (!__atomic_fetch_add(&foo, bar, __ATOMIC_SEQ_CST) || foo)
return -1;
bar= __atomic_exchange_n(&foo, bar, __ATOMIC_SEQ_CST);
if (bar || foo != 10)
return -1;
bar= __atomic_compare_exchange_n(&bar, &foo, 15, 0,
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
if (bar)
return -1;
if (!__atomic_fetch_add(&foo64, bar64, __ATOMIC_SEQ_CST) || foo64)
return -1;
bar64= __atomic_exchange_n(&foo64, bar64, __ATOMIC_SEQ_CST);
if (bar64 || foo64 != 10)
return -1;
bar64= __atomic_compare_exchange_n(&bar64, &foo64, 15, 0,
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
if (bar64)
return -1;
return 0;
}"
HAVE_GCC_ATOMIC_BUILTINS)
CHECK_CXX_SOURCE_COMPILES("
int main()
{
int foo= -10; int bar= 10;
long long int foo64= -10; long long int bar64= 10;
if (!__sync_fetch_and_add(&foo, bar) || foo)
return -1;
bar= __sync_lock_test_and_set(&foo, bar);
if (bar || foo != 10)
return -1;
bar= __sync_val_compare_and_swap(&bar, foo, 15);
if (bar)
return -1;
if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
return -1;
bar64= __sync_lock_test_and_set(&foo64, bar64);
if (bar64 || foo64 != 10)
return -1;
bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
if (bar64)
return -1;
return 0;
}"
HAVE_GCC_SYNC_BUILTINS)
IF(WITH_VALGRIND)
SET(VALGRIND_HEADERS "valgrind/memcheck.h;valgrind/valgrind.h")
CHECK_INCLUDE_FILES("${VALGRIND_HEADERS}" HAVE_VALGRIND_HEADERS)
IF(HAVE_VALGRIND_HEADERS)
SET(HAVE_VALGRIND 1)
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Valgrind header files ${VALGRIND_HEADERS}. Make sure you have them in your include path.")
ENDIF()
ENDIF()
#--------------------------------------------------------------------
# Check for IPv6 support
#--------------------------------------------------------------------
CHECK_INCLUDE_FILE(netinet/in6.h HAVE_NETINET_IN6_H) # Used by libevent
IF(UNIX)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h netinet/in.h sys/socket.h)
IF(HAVE_NETINET_IN6_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} netinet/in6.h)
ENDIF()
ELSEIF(WIN32)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} winsock2.h ws2ipdef.h)
ENDIF()
MY_CHECK_STRUCT_SIZE("sockaddr_in6" SOCKADDR_IN6)
MY_CHECK_STRUCT_SIZE("in6_addr" IN6_ADDR)
IF(HAVE_STRUCT_SOCKADDR_IN6 OR HAVE_STRUCT_IN6_ADDR)
SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
ENDIF()
# Check for sockaddr_storage.ss_family
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_storage"
ss_family "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_STORAGE_SS_FAMILY)
IF(NOT HAVE_SOCKADDR_STORAGE_SS_FAMILY)
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_storage"
__ss_family "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_STORAGE___SS_FAMILY)
IF(HAVE_SOCKADDR_STORAGE___SS_FAMILY)
SET(ss_family __ss_family)
ENDIF()
ENDIF()
#
# Check if struct sockaddr_in::sin_len is available.
#
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in" sin_len
"${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN_SIN_LEN)
#
# Check if struct sockaddr_in6::sin6_len is available.
#
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_len
"${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_LEN)
CHECK_CXX_SOURCE_COMPILES(
"
#include <vector>
template<typename T>
class ct2
{
public:
typedef T type;
void func();
};
template<typename T>
void ct2<T>::func()
{
std::vector<T> vec;
std::vector<T>::iterator itr = vec.begin();
}
int main(int argc, char **argv)
{
ct2<double> o2;
o2.func();
return 0;
}
" HAVE_IMPLICIT_DEPENDENT_NAME_TYPING)
SET(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_FUNCTION_EXISTS(chown HAVE_CHOWN)
CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
IF(HAVE_NUMA_H AND HAVE_NUMAIF_H)
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
CHECK_C_SOURCE_COMPILES(
"
#include <numa.h>
#include <numaif.h>
int main()
{
struct bitmask *all_nodes= numa_all_nodes_ptr;
set_mempolicy(MPOL_DEFAULT, 0, 0);
return all_nodes != NULL;
}"
HAVE_LIBNUMA)
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
ELSE()
SET(HAVE_LIBNUMA 0)
ENDIF()
IF(NOT HAVE_LIBNUMA)
MESSAGE(STATUS "NUMA library missing or required version not available")
ENDIF()
IF(HAVE_LIBNUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON)
ELSE()
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF)
ENDIF()
IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
# Forget it in cache, abort the build.
UNSET(WITH_NUMA CACHE)
MESSAGE(FATAL_ERROR "NUMA library missing or required version not available")
ENDIF()
IF(HAVE_LIBNUMA AND NOT WITH_NUMA)
SET(HAVE_LIBNUMA 0)
MESSAGE(STATUS "Disabling NUMA on user's request")
ENDIF()
# needed for libevent
CHECK_TYPE_SIZE("socklen_t" SIZEOF_SOCKLEN_T)
IF(SIZEOF_SOCKLEN_T)
SET(HAVE_SOCKLEN_T 1)
ENDIF()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化