diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 10:30:04 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 11:12:13 +0100 |
| commit | ce6d624af223a855a83664106957d4453dd56fcd (patch) | |
| tree | c1fff540e70b150f993ae208bb5da7e84d3d9fb2 /src | |
| parent | 69ecdad5a494957afcf2447cc6edac6934f2b1b6 (diff) | |
| download | libgit2-ce6d624af223a855a83664106957d4453dd56fcd.tar.gz | |
regex: optionally use PCRE2
Use PCRE2 and its POSIX compatibility layer if requested by the user.
Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as
installed on Debian and Ubuntu systems is broken, so we do not opt-in to
it by default to avoid breaking users on those platforms.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/features.h.in | 1 | ||||
| -rw-r--r-- | src/posix_regex.h | 4 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 852a2af24..cd4c68800 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -307,6 +307,18 @@ ENDIF() IF(REGEX STREQUAL "regcomp_l") ADD_FEATURE_INFO(regex ON "using system regcomp_l") SET(GIT_REGEX_REGCOMP_L 1) +ELSEIF(REGEX STREQUAL "pcre2") + FIND_PACKAGE(PCRE2) + + IF(NOT PCRE2_FOUND) + MESSAGE(FATAL_ERROR "PCRE2 support was requested but not found") + ENDIF() + + ADD_FEATURE_INFO(regex ON "using system PCRE2") + SET(GIT_REGEX_PCRE2 1) + + LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS}) + LIST(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES}) ELSEIF(REGEX STREQUAL "pcre") ADD_FEATURE_INFO(regex ON "using system PCRE") SET(GIT_REGEX_PCRE 1) diff --git a/src/features.h.in b/src/features.h.in index 5468ceeb0..4090fadb5 100644 --- a/src/features.h.in +++ b/src/features.h.in @@ -19,6 +19,7 @@ #cmakedefine GIT_REGEX_REGCOMP_L #cmakedefine GIT_REGEX_REGCOMP #cmakedefine GIT_REGEX_PCRE +#cmakedefine GIT_REGEX_PCRE2 #cmakedefine GIT_REGEX_BUILTIN 1 #cmakedefine GIT_SSH 1 diff --git a/src/posix_regex.h b/src/posix_regex.h index e76f69c8f..421ffeba1 100644 --- a/src/posix_regex.h +++ b/src/posix_regex.h @@ -37,7 +37,9 @@ #else -# ifdef GIT_REGEX_PCRE +# if defined(GIT_REGEX_PCRE2) +# include <pcre2posix.h> +# elif defined(GIT_REGEX_PCRE) # include <pcreposix.h> # else # include <regex.h> |
