Skip to content

Commit db8c5c8

Browse files
committed
Put iconv constiness into CFLAGS
Avoids AC_DEFINE weirdness on Windows.
1 parent dbf9265 commit db8c5c8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

ext/iconv/config.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ int main(void) {
8383
AS_VAR_IF([php_cv_iconv_errno], [yes],,
8484
[AC_MSG_FAILURE([The iconv check failed, 'errno' is missing.])])
8585

86+
dnl iconv on some platforms (NetBSD pre-10, Solaris) may have a non-standard
87+
dnl const input parameter; libiconv may imitate this on those platforms.
8688
AC_CACHE_CHECK([if iconv input parameter is const (non-standard)], [php_cv_iconv_const],
8789
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8890
#include <iconv.h>
@@ -91,8 +93,6 @@ size_t iconv(iconv_t cd, const char **src, size_t *srcleft, char **dst, size_t *
9193
])],
9294
[php_cv_iconv_const=const],
9395
[php_cv_iconv_const=])])
94-
AC_DEFINE_UNQUOTED([ICONV_CONST], [$php_cv_iconv_const],
95-
[Define to const if iconv's input is const.])
9696

9797
AC_CACHE_CHECK([if iconv supports //IGNORE], [php_cv_iconv_ignore],
9898
[AC_RUN_IFELSE([AC_LANG_SOURCE([
@@ -131,7 +131,7 @@ int main(void) {
131131
PHP_NEW_EXTENSION([iconv],
132132
[iconv.c],
133133
[$ext_shared],,
134-
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
134+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DICONV_CONST=$php_cv_iconv_const])
135135
PHP_SUBST([ICONV_SHARED_LIBADD])
136136
PHP_INSTALL_HEADERS([ext/iconv], [php_iconv.h])
137137
fi

ext/iconv/config.w32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ if (PHP_ICONV != "no") {
1111

1212
AC_DEFINE("HAVE_ICONV", 1, "Define to 1 if the PHP extension 'iconv' is available.");
1313
AC_DEFINE("HAVE_LIBICONV", 1, "Define to 1 if you have the 'libiconv' function.");
14-
AC_DEFINE("ICONV_CONST", "", "Define to const if iconv's input is const.", false);
1514
AC_DEFINE("ICONV_ALIASED_LIBICONV", 1, "Define to 1 if 'iconv()' is aliased to 'libiconv()'.");
1615
AC_DEFINE("PHP_ICONV_IMPL", "\"libiconv\"", "The iconv implementation.");
17-
ADD_FLAG("CFLAGS_ICONV", "/D PHP_ICONV_EXPORTS ");
16+
ADD_FLAG("CFLAGS_ICONV", "/D PHP_ICONV_EXPORTS /D ICONV_CONST ");
1817
if (!PHP_ICONV_SHARED) {
1918
ADD_DEF_FILE("ext\\iconv\\php_iconv.def");
2019
}

0 commit comments

Comments
 (0)