diff --git a/meson.build b/meson.build index 924274de63..686ec6ab84 100644 --- a/meson.build +++ b/meson.build @@ -1064,6 +1064,17 @@ else endif conf.set10('HAVE_XKBCOMMON', have) +want_pcre2 = get_option('pcre2') +if want_pcre2 != 'false' + libpcre2 = dependency('libpcre2-8', + required : want_pcre2 == 'true') + have = libpcre2.found() +else + have = false + libpcre2 = [] +endif +conf.set10('HAVE_PCRE2', have) + want_glib = get_option('glib') if want_glib != 'false' libglib = dependency('glib-2.0', @@ -2693,6 +2704,7 @@ foreach tuple : [ ['gnu-efi', have_gnu_efi], ['kmod'], ['xkbcommon'], + ['pcre2'], ['blkid'], ['dbus'], ['glib'], diff --git a/meson_options.txt b/meson_options.txt index f71755cfa6..eeb3f6c072 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -260,6 +260,8 @@ option('lz4', type : 'combo', choices : ['auto', 'true', 'false'], description : 'lz4 compression support') option('xkbcommon', type : 'combo', choices : ['auto', 'true', 'false'], description : 'xkbcommon keymap support') +option('pcre2', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'regexp matching support using pcre2') option('glib', type : 'combo', choices : ['auto', 'true', 'false'], description : 'libglib support (for tests only)') option('dbus', type : 'combo', choices : ['auto', 'true', 'false'], diff --git a/src/basic/build.h b/src/basic/build.h index ab2a838ce9..0d078efe6f 100644 --- a/src/basic/build.h +++ b/src/basic/build.h @@ -140,6 +140,12 @@ #define _IDN_FEATURE_ "-IDN" #endif +#if HAVE_PCRE2 +#define _PCRE2_FEATURE_ "+PCRE2" +#else +#define _PCRE2_FEATURE_ "-PCRE2" +#endif + #define _CGROUP_HIEARCHY_ "default-hierarchy=" DEFAULT_HIERARCHY_NAME #define SYSTEMD_FEATURES \ @@ -163,4 +169,5 @@ _KMOD_FEATURE_ " " \ _IDN2_FEATURE_ " " \ _IDN_FEATURE_ " " \ + _PCRE2_FEATURE_ " " \ _CGROUP_HIEARCHY_