Skip to content

zend build making sigjmp_buf and api check as mandatory. #14942

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 2 commits into from
Jul 17, 2024

Conversation

devnexen
Copy link
Member

all unixes support it since long time, the few which don't do not meet the requirements to build php anyway (minix, dietlibc, ...).

@devnexen
Copy link
Member Author

note that it has the "side effect" to enable it also for platforms which implement those as macro (e.g. linux/glibc).

@devnexen devnexen requested a review from arnaud-lb July 14, 2024 09:48
@petk
Copy link
Member

petk commented Jul 15, 2024

If this is a required function/macro, wouldn't then this be sufficient?

AC_CHECK_FUNC([sigsetjmp],,
  [AC_CHECK_DECL([sigsetjmp],,
    [AC_MSG_ERROR([sigsetjmp check failed. Please, check config.log])],
    [#include <setjmp.h>])])

@devnexen
Copy link
Member Author

Unfortunately not really it seems, because it detects only when sigsetjmp is a real function but on linux/glibc it s a macro.

@petk
Copy link
Member

petk commented Jul 16, 2024

Unfortunately not really it seems, because it detects only when sigsetjmp is a real function but on linux/glibc it s a macro.

The AC_CHECK_DECL checks if there is macro defined in setjmp.h. It doesn't detect it?

@devnexen
Copy link
Member Author

I did make distclean and ./buildconf -f after applying your patch.

configure:78927: result: no
configure:78935: checking for sigsetjmp
configure:78935: cc -o conftest -g -O2 -ffp-contract=off -fvisibility=hidden  -D_GNU_SOURCE  conftest.c  >&5
/usr/bin/ld: /tmp/ccb7B2ZG.o: in function `main':
/home/dcarlier/Contribs/php-src/conftest.c:319:(.text.startup+0xb): undefined reference to `sigsetjmp'
collect2: error: ld returned 1 exit status

@petk
Copy link
Member

petk commented Jul 16, 2024

Yes, this one checks if linker sees a function sigsetjmp. And the next check is for declaraction or macro check "checking whether sigsetjmp is declared".

@devnexen
Copy link
Member Author

devnexen commented Jul 16, 2024

what do you make of it ?

ac_cv_func_sigsetjmp=no

even tough it should work since it does not rely anymore on HAVE_SIGSETJMP

@petk
Copy link
Member

petk commented Jul 16, 2024

This first it checks if linker sees a function. Some systems probably had it as a function. And if function is not found, it checks for declaration or macro. If macro is still not found, then error is thrown above. Otherwise it just passes the checks without defining the HAVE_SIGSETJMP.

@devnexen
Copy link
Member Author

Ok I ll apply your simpler solution then, thx

@devnexen devnexen force-pushed the setsigjmp_mandatory branch from f665b25 to 9d2b35d Compare July 16, 2024 05:02
Zend/Zend.m4 Outdated
Comment on lines 154 to 157
dnl
dnl ZEND_CHECK_SIGSETJMP
dnl
dnl Check for sigsetjmp.
dnl
Copy link
Member

@petk petk Jul 16, 2024

Choose a reason for hiding this comment

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

Suggested change
dnl
dnl ZEND_CHECK_SIGSETJMP
dnl
dnl Check for sigsetjmp.
dnl
dnl Check for sigsetjmp. If sigsetjmp is defined as a macro, use AC_CHECK_DECL
dnl as a fallback since AC_CHECK_FUNC cannot detect macros.

Zend/Zend.m4 Outdated
dnl
AC_CHECK_FUNC([sigsetjmp],,
[AC_CHECK_DECL([sigsetjmp],,
[AC_MSG_ERROR([sigsetjmp check failed. Please, check config.log])],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[AC_MSG_ERROR([sigsetjmp check failed. Please, check config.log])],
[AC_MSG_ERROR([Required sigsetjmp not found. Please, check config.log.])],

@petk
Copy link
Member

petk commented Jul 16, 2024

I've only quickly glanced over platforms a bit and it really seems that POSIX sigsetjmp is present on all current *nix platforms out there. Otherwise from the entirety point of view (Windows included) checking for this function/macro might still make sense. For example, if Autotools build system is one day still used and adjusted also for Windows or if Msys2/Mingw is used for the build sigsetjmp might not be there.

@devnexen devnexen force-pushed the setsigjmp_mandatory branch from 9d2b35d to c4a60c6 Compare July 16, 2024 17:24
Zend/Zend.m4 Outdated
[AC_DEFINE([HAVE_SIGSETJMP], [1])],,
[#include <setjmp.h>])])
dnl
dnl ZEND_CHECK_SIGSETJMP
Copy link
Member

Choose a reason for hiding this comment

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

I think that you are not actually defining a ZEND_CHECK_SIGSETJMP macro here

#ifdef HAVE_SIGSETJMP
#ifndef ZEND_WIN32
Copy link
Member

Choose a reason for hiding this comment

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

If we keep the autoconf check, we may keep the #ifdef HAVE_SIGSETJMP here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

that s the thing, with this PR this constant is no longer defined as it is implicitly required on unix.

Copy link
Member

Choose a reason for hiding this comment

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

is the autoconf check still useful?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would say yes, so it s detected at configure time rather than build's e.g. if a linux/dietlibc user.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, I missed that you replaced AC_DEFINE with AC_MSG_ERROR. Makes sense now

devnexen added 2 commits July 17, 2024 20:22
all unixes support it since long time, the few which don't do not meet
the requirements to build php anyway (minix, dietlibc, ...).
@devnexen devnexen force-pushed the setsigjmp_mandatory branch from c4a60c6 to 2f64954 Compare July 17, 2024 19:25
Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

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

LGTM!

@devnexen devnexen merged commit 8d59715 into php:master Jul 17, 2024
11 checks passed
petk added a commit that referenced this pull request Jul 18, 2024
This adds notice in the UPGRADING.INTERNALS file and removes redundant
undefinition from Windows config header.

Follow-up of GH-14942.
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.

3 participants