Skip to content

Commit aef0b9b

Browse files
committed
Autotools: Fix iconv shared build with external library
When building: ./configure --with-iconv=shared,/path/to/libiconv the iconv couldn't be found due to linker error Autoconf places LDFLAGS before the conftest.c file in the test compile command and LIBS after it. GCC also requires this. Similar issue discovered at remicollet/php-xpass#1
1 parent 1a126c5 commit aef0b9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/iconv/config.m4

Lines changed: 3 additions & 3 deletions
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)