[php-src] Issue #14284: Can't cross-compile with external libcrypt
| From: | orlitzky | Date: | Tue, 21 May 2024 00:23:42 +0000 |
| Subject: | [php-src] Issue #14284: Can't cross-compile with external libcrypt | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246936@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14284
Author: orlitzky
### Description
At https://bugs.gentoo.org/931884 we have a bug report
that boils down to the external libcrypt (
./configure --with-external-libcrypt) checks
running e.g.
```m4
AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
...
]])
],[
ac_cv_crypt_ext_des=yes
],[
ac_cv_crypt_ext_des=no
],[
ac_cv_crypt_ext_des=no
])
])
```
where the last case is executed for cross-compiles and forces the feature to undetected (which, in
this case, is fatal). We have a few options to work around this within Gentoo, but I thought it was
worth asking about upstream approach more generally. AC_RUN_IFELSE is used in a few
places, and I think it would be better if the cross-compile branch were kept consistent to whatever
extent that's possible.
For another example, take ext/iconv/config.m4:
```m4
AC_MSG_CHECKING([if iconv supports errno])
AC_RUN_IFELSE(...
[
AC_MSG_RESULT(yes, cross-compiling)
])
```
Or ext/pcre/config0.m4:
```m4
AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [
AC_RUN_IFELSE(...
[
AC_CANONICAL_HOST
case $host_cpu in
arm*|i[[34567]]86|x86_64|mips*|powerpc*|sparc)
ac_cv_have_pcre2_jit=yes
;;
*)
ac_cv_have_pcre2_jit=no
;;
esac
])
```
This is important to me because I'm planning on making --with-external-gd the
default soon, and I myself am guilty of writing a test that disables certain formats when
cross-compiling because they cannot be detected with AC_RUN_IFELSE. This bug report has
given me second thoughts about doing that.
ping @remicollet
### PHP Version
git HEAD
### Operating System
_No response_