aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorK.Kosako <kkosako0@gmail.com>2021-08-05 17:08:08 +0900
committerK.Kosako <kkosako0@gmail.com>2021-08-05 17:08:08 +0900
commit980fbf9828fd0112ac0d4a15735990d2f6dd6acd (patch)
tree636a57897ffde9c510b19e0cda346d669ad0622a /CMakeLists.txt
parent7ef2e6cc2ed265e8ace6e290e959415d690d60f1 (diff)
downloadoniguruma-980fbf9828fd0112ac0d4a15735990d2f6dd6acd.zip
oniguruma-980fbf9828fd0112ac0d4a15735990d2f6dd6acd.tar.gz
oniguruma-980fbf9828fd0112ac0d4a15735990d2f6dd6acd.tar.bz2
fix #239: CMake build fails to detect alloca on some platforms such as FreeBSD
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d353990..34142b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,6 @@ include(CheckSymbolExists)
include(CheckTypeSize)
include(TestBigEndian)
-check_function_exists(alloca HAVE_ALLOCA)
check_include_files(alloca.h HAVE_ALLOCA_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(sys/times.h HAVE_SYS_TIMES_H)
@@ -38,6 +37,12 @@ check_type_size(long SIZEOF_LONG)
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("void*" SIZEOF_VOIDP)
+if(HAVE_ALLOCA_H)
+ check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA)
+else()
+ check_symbol_exists(alloca "stdlib.h;malloc.h" HAVE_ALLOCA)
+endif()
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/oniguruma.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc @ONLY)