Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --with-regex=PATH build option #1974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yadij
Copy link
Contributor

@yadij yadij commented Dec 29, 2024

A simple way to build with custom libregex paths instead of
forcing users to manually set build environment flags.

Currently only supports (re)implementations of GNU libregex.

@yadij
Copy link
Contributor Author

yadij commented Dec 29, 2024

FTR: this build option is required to simplify MinGW cross-building of Squid for Windows.
It may be of use for other OS packagers wanting to link against non-default GNU libregex code.

@yadij yadij added the feature maintainer needs documentation updates for merge label Dec 29, 2024
dnl Look for libregex with regcomp() API
SQUID_AUTO_LIB(regex,[GNU Regex],[LIBREGEX])
SQUID_CHECK_LIB_WORKS(regex,[
PKG_CHECK_MODULES([LIBREGEX],[libregex],[:],[:])
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm.. what if the local install doesn't have a pkg-config file? For instance, my install of gnurx doesn't have one

Copy link
Contributor

@rousskov rousskov Dec 29, 2024

Choose a reason for hiding this comment

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

@kinkie, AFAICT, without pkg-config file, this PKG_CHECK_MODULES() call does nothing (but reporting) because its action-if-not-found is set to "do nothing" (i.e. :). The code below will add spaces to CPPFLAGS and LIBS (unless those LIBREGEX_FOO variables were set externally, I guess).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absent a relevant .pc file or when environment variables are preset this line has no effect.

This line exists solely for auto-detecting the cases when a libregex does provide a .pc file.

Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

@yadij, before posting new master/v7 PRs, please cooperate on merging PRs (authored by others) that are awaiting your actions for weeks and even months.

@@ -2387,8 +2383,16 @@ AS_IF([test "x$enable_zph_qos" = "xyes"],[
[Enable support for QOS netfilter mark preservation])
])

AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
AC_SUBST(REGEXLIB)
dnl Look for libregex with regcomp() API
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not see any regcomp() checks in added code; have I overlooked them?

AFAICT, removed code was checking for regexec(). If feasible, let's preserve that logic (in this PR). Otherwise, please adjust PR description to explain why we are changing what API we check.

dnl Look for libregex with regcomp() API
SQUID_AUTO_LIB(regex,[GNU Regex],[LIBREGEX])
SQUID_CHECK_LIB_WORKS(regex,[
PKG_CHECK_MODULES([LIBREGEX],[libregex],[:],[:])
Copy link
Contributor

@rousskov rousskov Dec 29, 2024

Choose a reason for hiding this comment

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

@kinkie, AFAICT, without pkg-config file, this PKG_CHECK_MODULES() call does nothing (but reporting) because its action-if-not-found is set to "do nothing" (i.e. :). The code below will add spaces to CPPFLAGS and LIBS (unless those LIBREGEX_FOO variables were set externally, I guess).

Comment on lines +2391 to +2393
LIBS="$LIBREGEX_PATH $LIBREGEX_LIBS $LIBS"
AC_CHECK_HEADERS([regex.h],[
LIBREGEX_LIBS="$LIBREGEX_PATH -lregex"
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks odd that we are using LIBREGEX_LIBS to adjust LIBS and then modifying LIBREGEX_LIBS (while keeping the old value in LIBS). Why do we utilize this use-then-modify trick here?

And why does this linking-related LIBREGEX_LIBS manipulation depend on a C++ header presence (while other regex checks/adjustments do not)?

@rousskov rousskov added the S-waiting-for-author author action is expected (and usually required) label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature maintainer needs documentation updates for merge S-waiting-for-author author action is expected (and usually required)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants