diff --git a/.github/actions/apt-x64/action.yml b/.github/actions/apt-x64/action.yml index bc2aa00df20b1..08249336af7f0 100644 --- a/.github/actions/apt-x64/action.yml +++ b/.github/actions/apt-x64/action.yml @@ -61,6 +61,8 @@ runs: unixodbc-dev \ llvm \ clang \ + libc++-dev \ + libc++abi-dev \ libc-client-dev \ dovecot-core \ dovecot-pop3d \ diff --git a/build/php.m4 b/build/php.m4 index 142ddf08fd98b..e087574d63a8d 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -742,7 +742,15 @@ AC_DEFUN([PHP_REQUIRE_CXX],[ if test -z "$php_cxx_done"; then AC_PROG_CXX AC_PROG_CXXCPP - PHP_ADD_LIBRARY(stdc++) + case "$CXX" in + *clang++*) + PHP_ADD_LIBRARY(c++) + PHP_ADD_LIBRARY(c++abi) + ;; + *) + PHP_ADD_LIBRARY(stdc++) + ;; + esac php_cxx_done=yes fi ]) diff --git a/build/php_cxx_compile_stdcxx.m4 b/build/php_cxx_compile_stdcxx.m4 index 8f723266b2c4f..89b1647b6095a 100644 --- a/build/php_cxx_compile_stdcxx.m4 +++ b/build/php_cxx_compile_stdcxx.m4 @@ -40,6 +40,11 @@ AC_DEFUN([PHP_CXX_COMPILE_STDCXX], [dnl dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + case "$CXX" in + *clang++*) + switch="${switch} -stdlib=libc++" + ;; + esac cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, diff --git a/configure.ac b/configure.ac index 278dbd110d248..39e70a82e1b86 100644 --- a/configure.ac +++ b/configure.ac @@ -1647,7 +1647,7 @@ int main(void) { CFLAGS="$OLD_CFLAGS" if test "$php_cv_ubsan_no_function" = yes; then CFLAGS="$CFLAGS -fno-sanitize=function" - CXXFLAGS="$CFLAGS -fno-sanitize=function" + CXXFLAGS="$CFLAGS -fno-sanitize=function,vptr" fi ], [AC_MSG_ERROR([UndefinedBehaviorSanitizer is not available])]) fi diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 78396dc416926..a771df2fe111b 100644 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -85,6 +85,9 @@ if test "$PHP_INTL" != "no"; then AS_IF([$PKG_CONFIG icu-uc --atleast-version=74],[ AC_MSG_RESULT([yes]) PHP_CXX_COMPILE_STDCXX(17, mandatory, PHP_INTL_STDCXX) + case $CXX in + *clang++*) ICU_CXXFLAGS="$ICU_CXXFLAGS -stdlib=libc++" PHP_ADD_LIBRARY(c++) PHP_ADD_LIBRARY(c++abi) + esac ],[ AC_MSG_RESULT([no]) PHP_CXX_COMPILE_STDCXX(11, mandatory, PHP_INTL_STDCXX) @@ -94,6 +97,7 @@ if test "$PHP_INTL" != "no"; then case $host_alias in *cygwin*) PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L" esac + if test "$ext_shared" = "no"; then PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS) else