summaryrefslogtreecommitdiff
path: root/cmake/pcre.cmake
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-10-22 13:03:41 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-22 13:03:41 +0200
commit9d2e2d753323a934604d25144b9d1ecaf34b47d8 (patch)
tree051a721f7ea77c2278d09323e36088abe22aa66a /cmake/pcre.cmake
parentd11af09865299033d5eef64531704f6ab8af5304 (diff)
parent2eb3c5e5420a724945a4cba914df25aa1e3744ce (diff)
downloadmariadb-git-9d2e2d753323a934604d25144b9d1ecaf34b47d8.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'cmake/pcre.cmake')
-rw-r--r--cmake/pcre.cmake16
1 files changed, 14 insertions, 2 deletions
diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake
index 894bde38974..4c113929866 100644
--- a/cmake/pcre.cmake
+++ b/cmake/pcre.cmake
@@ -1,11 +1,23 @@
+INCLUDE (CheckCSourceRuns)
+
SET(WITH_PCRE "auto" CACHE STRING
"Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
MACRO (CHECK_PCRE)
IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
- CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE)
+ CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE_STACK_GUARD)
+ IF(NOT CMAKE_CROSSCOMPILING)
+ SET(CMAKE_REQUIRED_LIBRARIES "pcre")
+ CHECK_C_SOURCE_RUNS("
+ #include <pcre.h>
+ int main() {
+ return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
+ }" PCRE_STACK_SIZE_OK)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ ENDIF()
ENDIF()
- IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled")
+ IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
+ WITH_PCRE STREQUAL "bundled")
IF (WITH_PCRE STREQUAL "system")
MESSAGE(FATAL_ERROR "system pcre is not found or unusable")
ENDIF()