Skip to content

Autotools: Refactor builtin checks #14835

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

Merged
merged 5 commits into from
Jul 8, 2024
Merged

Autotools: Refactor builtin checks #14835

merged 5 commits into from
Jul 8, 2024

Conversation

petk
Copy link
Member

@petk petk commented Jul 5, 2024

This creates a single M4 macro PHP_CHECK_BUILTIN with passed arguments.

Here are some issues but not so much problematic I think. These PHP_HAVE_BUILTIN_* are defined to 0 or to 1. So all the current checks with #ifdef PHP_HAVE_BUILTIN_* are probably typos in the php-src. I'm not sure if it was intentional to use #ifdef anywhere to explicitly target *nix or Windows with these.

I think it might be easiest to change them to an undefined/1 style (like other Autoconf defined CPP macros) so they don't need to be defined on Windows to 0. Sounds good?

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.

LCTM

@petk
Copy link
Member Author

petk commented Jul 6, 2024

@devnexen I'll append something more here what I had in mind so it's clearer. Basically, what is in this PR at the moment is the state that is currently in the master branch build system. Coming up soon.

@petk petk marked this pull request as draft July 6, 2024 18:17
petk added 2 commits July 6, 2024 20:33
This creates a single M4 macro PHP_CHECK_BUILTIN and deprecates other
PHP_CHECK_BUILTIN_* macros. Checks are wrapped in AC_CACHE_CHECK and
CPP macros PHP_HAVE_BUILTIN_* are defined to 1 if builtin is found and
to 0 if not.
This syncs all PHP_HAVE_BUILTIN_ symbols to be either undefined or
defined (to value 1) and syncs all #if/ifdef/defined usages of them in
the php-src code. This way it is simpler to use them because they don't
need to be defined to value 0 on Windows, for example.
@petk
Copy link
Member Author

petk commented Jul 6, 2024

Ok, so now there are two commits:
1st one changes the M4 macros to a single macro PHP_CHECK_BUILTIN(builtin) that defines the PHP_HAVE_BUILTIN_* symbols to either 0 or 1.

2nd commit changes the PHP_HAVE_BUILTIN_* symbols to be undefined or defined to 1.

I'm still not sure what to do with the previous PHP_CHECK_BUILTIN_* macros. Perhaps they could simply be removed as they don't behave the same anymore.

For the PHP extensions out there I haven't found any extension that uses these PHP_CHECK_BUILTIN_* M4 macros so I think removal of them is pretty safe (it's like these are more php-src internal related checks only).

@petk petk marked this pull request as ready for review July 6, 2024 18:51
@petk petk requested a review from devnexen July 6, 2024 18:54
@petk
Copy link
Member Author

petk commented Jul 6, 2024

Open source extensions out there don't seem to use the macros, so the 3rd commit also removes all PHP_CHECK_BUILTIN_* M4 macros which simplifies things a bit. It is even simpler and safer to not have macro with the same name if it defines symbols differently. Ok, now I'm done here and this is ready for review :D

@petk petk changed the title Autotools: Refactor buitin checks Autotools: Refactor builtin checks Jul 8, 2024
@petk petk merged commit 9e94d2b into php:master Jul 8, 2024
11 checks passed
@petk petk deleted the patch-builtin branch July 8, 2024 19:25
@petk petk mentioned this pull request Aug 4, 2024
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.

2 participants