OPTION(ENABLE_CLANG_PLUGIN "Enable clang static analysing plugin [default: OFF]" OFF)
OPTION(ENABLE_HYPERSCAN "Enable hyperscan for fast regexp processing [default: OFF]" OFF)
OPTION(ENABLE_FANN "Enable fann for neural network plugin [default: OFF]" OFF)
+OPTION(ENABLE_PCRE2 "Enable pcre2 instead of pcre [default: OFF]" OFF)
INCLUDE(FindArch.cmake)
TARGET_ARCHITECTURE(ARCH)
MESSAGE(STATUS "Hyperscan support is possible only for x86_64 architecture")
SET(ENABLE_HYPERSCAN "OFF")
ENDIF()
+
+IF(ENABLE_PCRE2 MATCHES "ON")
+ SET(WITH_PCRE2 1)
+ # For utf8 API
+ LIST(APPEND CMAKE_REQUIRED_DEFINITIONS "-DPCRE2_CODE_UNIT_WIDTH=8")
+ENDIF()
# Build optimized code for following CPU (default i386)
#SET(CPU_TUNE "i686")
ProcessPackage(GLIB2 LIBRARY glib-2.0 INCLUDE glib.h INCLUDE_SUFFIXES include/glib
ROOT ${GLIB_ROOT_DIR} MODULES glib-2.0>=2.28)
-ProcessPackage(PCRE LIBRARY pcre INCLUDE pcre.h INCLUDE_SUFFIXES include/pcre
- ROOT ${PCRE_ROOT_DIR} MODULES pcre libpcre pcre3 libpcre3)
+
+IF(ENABLE_PCRE2 MATCHES "ON")
+ ProcessPackage(PCRE LIBRARY pcre2 INCLUDE pcre2.h INCLUDE_SUFFIXES include/pcre2
+ ROOT ${PCRE_ROOT_DIR} MODULES pcre2 libpcre2 libpcre2-8)
+ELSE()
+ ProcessPackage(PCRE LIBRARY pcre INCLUDE pcre.h INCLUDE_SUFFIXES include/pcre
+ ROOT ${PCRE_ROOT_DIR} MODULES pcre libpcre pcre3 libpcre3)
+ENDIF()
ProcessPackage(GMIME LIBRARY gmime-2.6 gmime-2.4 gmime-2.2 gmime-2 INCLUDE gmime.h INCLUDE_SUFFIXES include/gmime
ROOT ${GMIME_ROOT_DIR} MODULES gmime-2.6 gmime-2.4 gmime-2.0)
ProcessPackage(LIBEVENT LIBRARY event INCLUDE event.h INCLUDE_SUFFIXES include/event
SET(GMIME24 1)
ENDIF()
-LIST(APPEND CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE}")
-IF(PCRE_LIBRARY_PATH)
- SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};-L${PCRE_LIBRARY_PATH};-lpcre")
-ELSE(PCRE_LIBRARY_PATH)
- SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};-lpcre")
-ENDIF(PCRE_LIBRARY_PATH)
-
IF(ENABLE_HIREDIS MATCHES "ON")
ADD_SUBDIRECTORY(contrib/hiredis)
SET(WITH_HIREDIS 1)
CHECK_SYMBOL_EXISTS(sched_yield "sched.h" HAVE_SCHED_YIELD)
CHECK_SYMBOL_EXISTS(__get_cpuid "cpuid.h" HAVE_GET_CPUID)
CHECK_SYMBOL_EXISTS(nftw "sys/types.h;ftw.h" HAVE_NFTW)
-CHECK_SYMBOL_EXISTS(PCRE_CONFIG_JIT "pcre.h" HAVE_PCRE_JIT)
+IF(ENABLE_PCRE2 MATCHES "ON")
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE}")
+ CHECK_SYMBOL_EXISTS(PCRE2_CONFIG_JIT "pcre2.h" HAVE_PCRE_JIT)
+ELSE()
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE}")
+ CHECK_SYMBOL_EXISTS(PCRE_CONFIG_JIT "pcre.h" HAVE_PCRE_JIT)
+ENDIF()
CHECK_SYMBOL_EXISTS(SOCK_SEQPACKET "sys/types.h;sys/socket.h" HAVE_SOCK_SEQPACKET)
CHECK_SYMBOL_EXISTS(I_SETSIG "sys/types.h;sys/ioctl.h" HAVE_SETSIG)
CHECK_SYMBOL_EXISTS(O_ASYNC "sys/types.h;sys/fcntl.h" HAVE_OASYNC)
CHECK_SYMBOL_EXISTS(O_NOFOLLOW "sys/types.h;sys/fcntl.h" HAVE_ONOFOLLOW)
+IF(ENABLE_PCRE2 MATCHES "ON")
+ IF(HAVE_PCRE_JIT)
+ SET(HAVE_PCRE_JIT_FAST 1)
+ ENDIF()
+ELSE()
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE}")
+ IF(PCRE_LIBRARY_PATH)
+ SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};-L${PCRE_LIBRARY_PATH};${PCRE_LIBRARY}")
+ ELSE(PCRE_LIBRARY_PATH)
+ SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};-lpcre")
+ ENDIF(PCRE_LIBRARY_PATH)
# Some PCRE implementations are lacking of pcre_jit_exec fast path
SET(_PCRE_FAST_TEST "
#include \"pcre.h\"
return rc;
}
")
-
CHECK_C_SOURCE_COMPILES("${_PCRE_FAST_TEST}" HAVE_PCRE_JIT_FAST)
IF(HAVE_PCRE_JIT_FAST)
MESSAGE(STATUS "pcre_jit_exec is supported")
ELSE(HAVE_PCRE_JIT_FAST)
MESSAGE(STATUS "pcre_jit_exec is -NOT- supported")
ENDIF(HAVE_PCRE_JIT_FAST)
+ENDIF()
FILE(WRITE ${CMAKE_BINARY_DIR}/pthread_setpshared.c "
#include <pthread.h>