--- configure
+++ configure
@@ -47098,7 +47098,7 @@
 
   if test "$iconv_avail" != "no"; then
     if test -z "$ICONV_DIR"; then
-      for i in /usr/local /usr; do
+      for i in $ICONV_IN_LIBC_DIR $with_iconv_dir; do
         if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then
           PHP_ICONV_PREFIX="$i"
           break
