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

Autotools: Add PHP_PUSH and PHP_POP #14939

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

petk
Copy link
Member

@petk petk commented Jul 12, 2024

There is common use case where CPPFLAGS, CFLAGS, LIBS and LDFLAGS variables need to be adjusted during some check test and then must be restored back to their initial values. This adds two new macros PHP_PUSH and PHP_POP that store mentioned variables current values to temporary variables and then after the test restore them back.

This is similar implementation to AX_SAVE_FLAGS, AX_RESTORE_FLAGS, AX_SAVE_FLAGS_WITH_PREFIX and AX_RESTORE_FLAGS_WITH_PREFIX from the Autoconf Archive collection.

Usage:

PHP_PUSH([foo])
CFLAGS="$CFLAGS $LIBFOO_CFLAGS"
LIBS="$LIBS $LIBFOO_LIBS"
dnl Check for some libfoo feature.
PHP_POP([foo])

Instead of doing something like this all the time:

CFLAGS_SAVE=$CFLAGS
LIBS_SAVE=$LIBS
CFLAGS="$CFLAGS $LIBFOO_CFLAGS"
LIBS="$LIBS $LIBFOO_LIBS"
dnl Check for some libfoo feature.
CFLAGS=$CFLAGS_SAVE
LIBS=$LIBS_SAVE

Initial example is added to PHP-FPM SAPI.

Note: This might be also targeted for PHP after 8.4...

There is common use case where CPPFLAGS, CFLAGS, LIBS and LDFLAGS
variables need to be adjusted during some check test and then must be
restored back to their initial values. This adds two new macros PHP_PUSH
and PHP_POP that store mentioned variables current values to temporary
variables and then after the test restore them back.

This is similar implementation to AX_SAVE_FLAGS, AX_RESTORE_FLAGS,
AX_SAVE_FLAGS_WITH_PREFIX and AX_RESTORE_FLAGS_WITH_PREFIX from the
Autoconf Archive collection.

Usage:

    PHP_PUSH([foo])
    CFLAGS="$CFLAGS $LIBFOO_CFLAGS"
    LIBS="$LIBS $LIBFOO_LIBS"
    dnl Check for some libfoo feature.
    PHP_POP([foo])

Initial example is added to PHP-FPM SAPI.
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

Makes sense

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

Successfully merging this pull request may close these issues.

None yet

2 participants