Autotools: Fix iconv shared build with external library (#15686)

When building iconv as shared and with external library (for example, libiconv):

    ./configure --with-iconv=shared,/path/to/libiconv

the iconv couldn't be found due to a linker error.

Autoconf places LDFLAGS before the conftest.c file in the test compile
command and LIBS after it. GCC also requires this:

    gcc -L... conftest.c -liconv

Similar issue discovered at
https://github.com/remicollet/php-xpass/pull/1
This commit is contained in:
Peter Kokot 2024-09-01 22:06:37 +02:00 committed by GitHub
parent fde34bc1e8
commit de6658531f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

2
NEWS
View File

@ -10,6 +10,8 @@ PHP NEWS
. Fixed bug GH-15330 (Do not scan generator frames more than once). (Arnaud)
. Fixed bug GH-15644 (Asymmetric visibility doesn't work with hooks). (ilutov)
. Implemented lazy objects RFC. (Arnaud)
. Fixed bug GH-15686 (Building shared iconv with external iconv library).
(Peter Kokot, zeriyoshi)
- DOM:
. Fixed bug GH-13988 (Storing DOMElement consume 4 times more memory in

View File

@ -8,9 +8,9 @@ if test "$PHP_ICONV" != "no"; then
PHP_SETUP_ICONV([ICONV_SHARED_LIBADD],,
[AC_MSG_FAILURE([The iconv not found.])])
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
save_CFLAGS=$CFLAGS
LDFLAGS="$ICONV_SHARED_LIBADD $LDFLAGS"
LIBS="$LIBS $ICONV_SHARED_LIBADD"
CFLAGS="$INCLUDES $CFLAGS"
AC_CACHE_CHECK([for iconv implementation], [php_cv_iconv_implementation], [
@ -111,7 +111,7 @@ int main(void) {
[AC_DEFINE([ICONV_BROKEN_IGNORE], [1],
[Define to 1 if iconv has broken IGNORE.])])
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
AC_DEFINE([HAVE_ICONV], [1],