Skip to content

ENT-14716: Added PCRE2 declarations check to configure.ac - #300

Open
aleksandrychev wants to merge 1 commit into
NorthernTechHQ:masterfrom
aleksandrychev:ENT-14716_pcre2_min_version
Open

aleksandrychev wants to merge 1 commit into
NorthernTechHQ:masterfrom
aleksandrychev:ENT-14716_pcre2_min_version

Conversation

@aleksandrychev

@aleksandrychev aleksandrychev commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Ticket: ENT-14716

Merge together:
#300
cfengine/core#6472

libutils/buffer.c uses PCRE2_SUBSTITUTE_MATCHED and PCRE2_SUBSTITUTE_LITERAL, which were added in PCRE2 10.34. libntech's configure only checked that PCRE2 exists, so with an older PCRE2 (RHEL 8 ships 10.32) it passed and the build failed later:

buffer.c:646:62: error: 'PCRE2_SUBSTITUTE_MATCHED' undeclared
buffer.c:671:27: error: 'PCRE2_SUBSTITUTE_LITERAL' undeclared

Change: next to the existing PCRE2 checks, configure now runs AC_CHECK_DECLS([PCRE2_SUBSTITUTE_MATCHED, PCRE2_SUBSTITUTE_LITERAL], ...) and fails early if either is missing. They are macros, not functions, so it uses AC_CHECK_DECLS rather than AC_CHECK_FUNCS, as libntech already does for SSL_CTX_clear_options:

checking whether PCRE2_SUBSTITUTE_MATCHED is declared... no
configure: error: This release of CFEngine requires PCRE2 with PCRE2_SUBSTITUTE_MATCHED and PCRE2_SUBSTITUTE_LITERAL (10.34+)

core's ci/dependencies.sh (cfengine/core#6472) reads the declaration list from this AC_CHECK_DECLS line. It uses the list to decide whether the system PCRE2 is good enough or whether to build a newer one, following this review comment: "If libntech needs a particular version of pcre2 then libntech should specify that and we should use that specification here."

Testing (Rocky Linux 8 container, system PCRE2 10.32):

cfengine/core#6472 depends on this change.

🤖 Generated with Claude Code

larsewi
larsewi previously approved these changes Nov 4, 2026

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you know which feature was missing, then that would be a better check to do for autoconf. E.g., AC_CHECK_FUNCS

@aleksandrychev aleksandrychev changed the title ENT-14716: Added PCRE2 minimum version check to configure.ac ENT-14716: Added PCRE2 declarations check to configure.ac Nov 4, 2026
libutils/buffer.c uses PCRE2_SUBSTITUTE_MATCHED and
PCRE2_SUBSTITUTE_LITERAL (PCRE2 10.34+). configure only checked that
PCRE2 exists, so with an older PCRE2 (RHEL 8 ships 10.32) the build
failed later in buffer.c. Added AC_CHECK_DECLS for both so configure
fails early.

Ticket: ENT-14716
Changelog: none
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
@aleksandrychev
aleksandrychev force-pushed the ENT-14716_pcre2_min_version branch from 9bf32cf to 29af16a Compare November 4, 2026 17:50
Comment thread configure.ac
)]
)
dnl libutils/buffer.c uses these substitute options (PCRE2 10.34+).
dnl core's ci/dependencies.sh reads this line to check the system PCRE2 has them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove mention of core

Comment thread configure.ac
dnl libutils/buffer.c uses these substitute options (PCRE2 10.34+).
dnl core's ci/dependencies.sh reads this line to check the system PCRE2 has them.
AC_CHECK_DECLS([PCRE2_SUBSTITUTE_MATCHED, PCRE2_SUBSTITUTE_LITERAL], [],
[AC_MSG_ERROR(This release of CFEngine requires PCRE2 with PCRE2_SUBSTITUTE_MATCHED and PCRE2_SUBSTITUTE_LITERAL (10.34+))],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just libntech, so change "this release of CFEngine" to just "libntech".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants