autotools: reset PCRE CFLAGS/LIBS with both PCRE and PCRE2 present #2580
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit b381ef3 ("autotools: indicate if PCRE or PCRE2 is being used") fixed a case where both pcre and pcre2 library are detected and put a preference on using pcre2.
Although the commit fix this corner case, there is still a latent problem with trying to link/include both library. This is caused by the fact that in the Makefile.inc for src and lib, we include both PCRE_CFLAGS and PCRE2_CFLAGS and PCRE_LIBS and PCRE2_LIBS for each tool/lib.
To handle this and not bloat the Makefile with additional condition, simply reset the PCRE_CFLAGS and PCRE_LIBS in case where we detect both library and we prefer to use pcre2.
Fixes: b381ef3 ("autotools: indicate if PCRE or PCRE2 is being used")