Skip to content

Commit de66585

Browse files
authored
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 remicollet/php-xpass#1
1 parent fde34bc commit de66585

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PHP NEWS
1010
. Fixed bug GH-15330 (Do not scan generator frames more than once). (Arnaud)
1111
. Fixed bug GH-15644 (Asymmetric visibility doesn't work with hooks). (ilutov)
1212
. Implemented lazy objects RFC. (Arnaud)
13+
. Fixed bug GH-15686 (Building shared iconv with external iconv library).
14+
(Peter Kokot, zeriyoshi)
1315

1416
- DOM:
1517
. Fixed bug GH-13988 (Storing DOMElement consume 4 times more memory in

ext/iconv/config.m4

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ if test "$PHP_ICONV" != "no"; then
88
PHP_SETUP_ICONV([ICONV_SHARED_LIBADD],,
99
[AC_MSG_FAILURE([The iconv not found.])])
1010

11-
save_LDFLAGS=$LDFLAGS
11+
save_LIBS=$LIBS
1212
save_CFLAGS=$CFLAGS
13-
LDFLAGS="$ICONV_SHARED_LIBADD $LDFLAGS"
13+
LIBS="$LIBS $ICONV_SHARED_LIBADD"
1414
CFLAGS="$INCLUDES $CFLAGS"
1515

1616
AC_CACHE_CHECK([for iconv implementation], [php_cv_iconv_implementation], [
@@ -111,7 +111,7 @@ int main(void) {
111111
[AC_DEFINE([ICONV_BROKEN_IGNORE], [1],
112112
[Define to 1 if iconv has broken IGNORE.])])
113113

114-
LDFLAGS=$save_LDFLAGS
114+
LIBS=$save_LIBS
115115
CFLAGS=$save_CFLAGS
116116

117117
AC_DEFINE([HAVE_ICONV], [1],

0 commit comments

Comments
 (0)