Based on the following upstream commits:

https://github.com/php/php-src/commit/9a8e7b571896f39f83cb000fdb7c466b6d328d52
https://github.com/php/php-src/pull/3701
https://github.com/php/php-src/commit/2bd299f7318492fd7e5cafffa562d76ba60e69d4

--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2201,49 +2201,16 @@ dnl
 dnl Common setup macro for ICU
 dnl
 AC_DEFUN([PHP_SETUP_ICU],[
-  PHP_ARG_WITH(icu-dir,,
-  [  --with-icu-dir=DIR      Specify where ICU libraries and headers can be found], DEFAULT, no)
+  PKG_CHECK_MODULES([ICU], [icu-io >= 50.1])
 
-  if test "$PHP_ICU_DIR" = "no"; then
-    PHP_ICU_DIR=DEFAULT
-  fi
-
-  if test "$PHP_ICU_DIR" = "DEFAULT"; then
-    dnl Try to find icu-config
-    AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
-  else
-    ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
-  fi
-
-  AC_MSG_CHECKING([for location of ICU headers and libraries])
-
-  dnl Trust icu-config to know better what the install prefix is..
-  icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
-  if test "$?" != "0" || test -z "$icu_install_prefix"; then
-    AC_MSG_RESULT([not found])
-    AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
-  else
-    AC_MSG_RESULT([$icu_install_prefix])
-
-    dnl Check ICU version
-    AC_MSG_CHECKING([for ICU 4.0 or greater])
-    icu_version_full=`$ICU_CONFIG --version`
-    ac_IFS=$IFS
-    IFS="."
-    set $icu_version_full
-    IFS=$ac_IFS
-    icu_version=`expr [$]1 \* 1000 + [$]2`
-    AC_MSG_RESULT([found $icu_version_full])
+  PHP_EVAL_INCLINE($ICU_CFLAGS)
+  PHP_EVAL_LIBLINE($ICU_LIBS, $1)
 
-    if test "$icu_version" -lt "4000"; then
-      AC_MSG_ERROR([ICU version 4.0 or later is required])
-    fi
+  ICU_CFLAGS="$ICU_CFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
+  ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
 
-    ICU_VERSION=$icu_version
-    ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
-    ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
-    PHP_EVAL_INCLINE($ICU_INCS)
-    PHP_EVAL_LIBLINE($ICU_LIBS, $1)
+  if test "$PKG_CONFIG icu-io --atleast-version=60"; then
+    ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
   fi
 ])
 
--- a/ext/intl/config.m4
+++ b/ext/intl/config.m4
@@ -9,18 +9,10 @@ if test "$PHP_INTL" != "no"; then
   PHP_SETUP_ICU(INTL_SHARED_LIBADD)
   PHP_SUBST(INTL_SHARED_LIBADD)
   PHP_REQUIRE_CXX()
-  if test "$icu_version" -ge "4002"; then
-    icu_spoof_src=" spoofchecker/spoofchecker_class.c \
-    spoofchecker/spoofchecker.c\
-    spoofchecker/spoofchecker_create.c\
-    spoofchecker/spoofchecker_main.c"
-  else
-    icu_spoof_src=""
-  fi
+  INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
   PHP_NEW_EXTENSION(intl, php_intl.c \
     intl_error.c \
     intl_convert.c \
-	intl_convertcpp.cpp \
     collator/collator.c \
     collator/collator_class.c \
     collator/collator_sort.c \
@@ -32,8 +24,6 @@ if test "$PHP_INTL" != "no"; then
     collator/collator_is_numeric.c \
     collator/collator_error.c \
     common/common_error.c \
-	common/common_enum.cpp \
-	common/common_date.cpp \
     converter/converter.c \
     formatter/formatter.c \
     formatter/formatter_main.c \
@@ -53,17 +43,12 @@ if test "$PHP_INTL" != "no"; then
     dateformat/dateformat_attr.c \
     dateformat/dateformat_data.c \
     dateformat/dateformat_format.c \
-    dateformat/dateformat_format_object.cpp \
     dateformat/dateformat_parse.c \
-    dateformat/dateformat_create.cpp \
-    dateformat/dateformat_attrcpp.cpp \
-    dateformat/dateformat_helpers.cpp \
     msgformat/msgformat.c \
     msgformat/msgformat_attr.c \
     msgformat/msgformat_class.c \
     msgformat/msgformat_data.c  \
     msgformat/msgformat_format.c \
-    msgformat/msgformat_helpers.cpp \
     msgformat/msgformat_parse.c \
     grapheme/grapheme_string.c \
     grapheme/grapheme_util.c \
@@ -73,6 +58,20 @@ if test "$PHP_INTL" != "no"; then
     transliterator/transliterator.c \
     transliterator/transliterator_class.c \
     transliterator/transliterator_methods.c \
+    idn/idn.c \
+    spoofchecker/spoofchecker_class.c \
+    spoofchecker/spoofchecker.c\
+    spoofchecker/spoofchecker_create.c\
+    spoofchecker/spoofchecker_main.c, $ext_shared,,$INTL_COMMON_FLAGS,cxx)
+
+  PHP_INTL_CPP_SOURCES="intl_convertcpp.cpp \
+    common/common_enum.cpp \
+    common/common_date.cpp \
+    dateformat/dateformat_format_object.cpp \
+    dateformat/dateformat_create.cpp \
+    dateformat/dateformat_attrcpp.cpp \
+    dateformat/dateformat_helpers.cpp \
+    msgformat/msgformat_helpers.cpp \
     timezone/timezone_class.cpp \
     timezone/timezone_methods.cpp \
     calendar/calendar_class.cpp \
@@ -83,9 +82,15 @@ if test "$PHP_INTL" != "no"; then
     breakiterator/breakiterator_methods.cpp \
     breakiterator/rulebasedbreakiterator_methods.cpp \
     breakiterator/codepointiterator_internal.cpp \
-    breakiterator/codepointiterator_methods.cpp \
-    idn/idn.c \
-    $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings)
+    breakiterator/codepointiterator_methods.cpp"
+
+  PHP_INTL_CPP_FLAGS="$ICU_CXXFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
+  if test "$ext_shared" = "no"; then
+    PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS)
+  else
+    PHP_ADD_SOURCES_X(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS, shared_objects_intl, yes)
+  fi
+
   PHP_ADD_BUILD_DIR($ext_builddir/collator)
   PHP_ADD_BUILD_DIR($ext_builddir/converter)
   PHP_ADD_BUILD_DIR($ext_builddir/common)
