Skip to content

Commit 9c1fa7d

Browse files
committed
README: Fix non-existent iconv in macOS instruction
Follows-up 22e444c (GH-18670). There is currently no formula called "iconv". [1][2] ``` $ brew install iconv Warning: No available formula with the name "iconv". Did you mean icon or cconv? ``` There package is called "libiconv". [3] Once installed, `./configure` still fails due to a discovery issue. ``` $ ./configure --enable-debug … checking for libiconv... no configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR> ``` In 2020, as part of the switch from Intel to ARM, Homebrew adopted /opt as the standard location instead of /usr/local. [4][5] Rather than complicating the README with a mandatory `--with-iconv` path (or --without-iconv) for macOS users, improve the discovery to support Homebrew's new location. [1]: https://brew.sh/ [2]: https://github.com/Homebrew/homebrew-core/. [3]: https://formulae.brew.sh/formula/libiconv [4]: https://apple.stackexchange.com/a/437622/33762 [5]: https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon
1 parent 359f442 commit 9c1fa7d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-de
5555
On MacOS, you can install these using `brew`:
5656

5757
```shell
58-
brew install autoconf bison re2c iconv libxml2 sqlite
58+
brew install autoconf bison re2c libiconv libxml2 sqlite
5959
```
6060

6161
or with `MacPorts`:

build/php.m4

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,17 @@ AC_DEFUN([PHP_SETUP_ICONV], [
17961796
17971797
dnl Check external libs for iconv funcs.
17981798
AS_VAR_IF([found_iconv], [no], [
1799-
for i in $PHP_ICONV /usr/local /usr; do
1799+
1800+
dnl Find /opt/homebrew/opt/libiconv on macOS
1801+
dnl See: https://github.com/php/php-src/pull/19475
1802+
php_brew_prefix=no
1803+
AC_CHECK_PROG([BREW], [brew], [brew])
1804+
if test -n "$BREW"; then
1805+
AC_MSG_CHECKING([for homebrew prefix])
1806+
php_brew_prefix=$($BREW --prefix 2> /dev/null)
1807+
fi
1808+
1809+
for i in $PHP_ICONV $php_brew_prefix/opt/libiconv /usr/local /usr; do
18001810
if test -r $i/include/gnu-libiconv/iconv.h; then
18011811
ICONV_DIR=$i
18021812
ICONV_INCLUDE_DIR=$i/include/gnu-libiconv

0 commit comments

Comments
 (0)