summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'configure.cmake')
-rw-r--r--configure.cmake63
1 files changed, 52 insertions, 11 deletions
diff --git a/configure.cmake b/configure.cmake
index 1dba83ea235..0057c7fb100 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -175,7 +175,6 @@ CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
-CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
@@ -188,7 +187,9 @@ CHECK_INCLUDE_FILES (grp.h HAVE_GRP_H)
CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (langinfo.h HAVE_LANGINFO_H)
+CHECK_INCLUDE_FILES (link.h HAVE_LINK_H)
CHECK_INCLUDE_FILES (linux/unistd.h HAVE_LINUX_UNISTD_H)
+CHECK_INCLUDE_FILES (linux/falloc.h HAVE_LINUX_FALLOC_H)
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
@@ -198,6 +199,7 @@ CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H)
CHECK_INCLUDE_FILES (port.h HAVE_PORT_H)
CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H)
+CHECK_INCLUDE_FILES (sys/poll.h HAVE_SYS_POLL_H)
CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
@@ -227,6 +229,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
+CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H)
@@ -249,7 +252,10 @@ CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H)
CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H)
+CHECK_INCLUDE_FILES (sys/statvfs.h HAVE_SYS_STATVFS_H)
+SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DPACKAGE=test) # bfd.h is picky
+CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
SET(NON_DISTRIBUTABLE_WARNING 1)
@@ -269,8 +275,8 @@ ENDIF()
FIND_PACKAGE (Threads)
FUNCTION(MY_CHECK_PTHREAD_ONCE_INIT)
- CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
- IF(NOT HAVE_WERROR_FLAG)
+ MY_CHECK_C_COMPILER_FLAG("-Werror")
+ IF(NOT HAVE_C__Werror)
RETURN()
ENDIF()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
@@ -314,6 +320,7 @@ ENDIF()
#
# Tests for functions
#
+CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (aio_read HAVE_AIO_READ)
@@ -358,6 +365,7 @@ 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 (getifaddrs HAVE_GETIFADDRS)
CHECK_FUNCTION_EXISTS (getrusage HAVE_GETRUSAGE)
CHECK_FUNCTION_EXISTS (getwd HAVE_GETWD)
CHECK_FUNCTION_EXISTS (gmtime_r HAVE_GMTIME_R)
@@ -384,6 +392,7 @@ CHECK_FUNCTION_EXISTS (perror HAVE_PERROR)
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
CHECK_FUNCTION_EXISTS (port_create HAVE_PORT_CREATE)
CHECK_FUNCTION_EXISTS (posix_fallocate HAVE_POSIX_FALLOCATE)
+CHECK_FUNCTION_EXISTS (fallocate HAVE_FALLOCATE)
CHECK_FUNCTION_EXISTS (pread HAVE_PREAD)
CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE)
CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE)
@@ -845,6 +854,17 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
}
" HAVE_FAKE_PAUSE_INSTRUCTION)
ENDIF()
+ IF (NOT HAVE_PAUSE_INSTRUCTION)
+ CHECK_C_SOURCE_COMPILES("
+ #include <sys/platform/ppc.h>
+ int main()
+ {
+ __ppc_set_ppr_low();
+ __ppc_set_ppr_med();
+ return 0;
+ }
+ " HAVE_HMT_PRIORITY_INSTRUCTION)
+ ENDIF()
ENDIF()
CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
@@ -922,6 +942,14 @@ CHECK_C_SOURCE_COMPILES("
HAVE_WEAK_SYMBOL
)
+CHECK_C_SOURCE_COMPILES("
+ void foo(int *x) { }
+ int main() {
+ int a __attribute__((cleanup(foo)));
+ return 0;
+ }"
+ HAVE_ATTRIBUTE_CLEANUP
+)
CHECK_CXX_SOURCE_COMPILES("
#include <new>
@@ -967,8 +995,6 @@ MARK_AS_ADVANCED(NO_ALARM)
IF(WITH_ATOMIC_OPS STREQUAL "up")
SET(MY_ATOMIC_MODE_DUMMY 1 CACHE BOOL "Assume single-CPU mode, no concurrency")
-ELSEIF(WITH_ATOMIC_OPS STREQUAL "rwlocks")
- SET(MY_ATOMIC_MODE_RWLOCKS 1 CACHE BOOL "Use pthread rwlocks for atomic ops")
ELSEIF(WITH_ATOMIC_OPS STREQUAL "smp")
ELSEIF(NOT WITH_ATOMIC_OPS)
CHECK_CXX_SOURCE_COMPILES("
@@ -1007,12 +1033,8 @@ ELSE()
MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!")
ENDIF()
-SET(WITH_ATOMIC_OPS "${WITH_ATOMIC_OPS}" CACHE STRING
- "Implement atomic operations using pthread rwlocks (rwlocks); or atomic CPU
-instructions for multi-processor (smp) or uniprocessor (up)
-configuration. By default gcc built-in sync functions are used,
-if available and 'smp' configuration otherwise.")
-MARK_AS_ADVANCED(WITH_ATOMIC_OPS MY_ATOMIC_MODE_RWLOCK MY_ATOMIC_MODE_DUMMY)
+SET(WITH_ATOMIC_OPS "${WITH_ATOMIC_OPS}" CACHE STRING "Implement atomic operations using atomic CPU instructions for multi-processor (smp) or uniprocessor (up) configuration. By default gcc built-in sync functions are used, if available and 'smp' configuration otherwise.")
+MARK_AS_ADVANCED(WITH_ATOMIC_OPS MY_ATOMIC_MODE_DUMMY)
IF(WITH_VALGRIND)
SET(HAVE_valgrind 1)
@@ -1079,5 +1101,24 @@ CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
IF(NOT HAVE_UCONTEXT_H)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H)
ENDIF()
+
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC)
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC)
+
+IF(NOT MSVC)
+ CHECK_C_SOURCE_COMPILES(
+ "
+ #define _GNU_SOURCE
+ #include <fcntl.h>
+ #include <linux/falloc.h>
+ int main()
+ {
+ /* Ignore the return value for now. Check if the flags exist.
+ The return value is checked at runtime. */
+ fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
+
+ return(0);
+ }"
+ HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
+ )
+ENDIF()