Skip to content

Commit 63e550f

Browse files
committed
Fix builtin checks for Windows
This is mostly backported fix specific for PHP-8.3 branch where on Windows definining PHP_HAVE_BUILTIN_* macros to 0, fails the build. This was properly fixed and resolved in PHP-8.4. The cache variable in PHP/CheckBuiltin module speeds up build with MSVC.
1 parent 912f2d4 commit 63e550f

File tree

2 files changed

+36
-43
lines changed

2 files changed

+36
-43
lines changed

cmake/cmake/modules/PHP/CheckBuiltin.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ function(php_check_builtin builtin result)
7373
set(call "${builtin}();")
7474
endif()
7575

76+
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
77+
set(${result} FALSE CACHE INTERNAL "Test ${result}")
78+
endif()
79+
7680
cmake_push_check_state(RESET)
7781
set(CMAKE_REQUIRED_QUIET TRUE)
7882

cmake/main/cmake/php_config.h.in

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -559,64 +559,53 @@
559559
/* Define to 1 if the compiler supports AVX-512 VBMI, and to 0 if not. */
560560
#cmakedefine01 PHP_HAVE_AVX512_VBMI_SUPPORTS
561561

562-
/* Define to 1 if the compiler supports '__builtin_clz', and to 0 if not. */
563-
#cmakedefine01 PHP_HAVE_BUILTIN_CLZ
562+
/* Define to 1 if the compiler supports '__builtin_clz'. */
563+
#cmakedefine PHP_HAVE_BUILTIN_CLZ 1
564564

565-
/* Define to 1 if the compiler supports '__builtin_clzl', and to 0 if not. */
566-
#cmakedefine01 PHP_HAVE_BUILTIN_CLZL
565+
/* Define to 1 if the compiler supports '__builtin_clzl'. */
566+
#cmakedefine PHP_HAVE_BUILTIN_CLZL 1
567567

568-
/* Define to 1 if the compiler supports '__builtin_clzll', and to 0 if not. */
569-
#cmakedefine01 PHP_HAVE_BUILTIN_CLZLL
568+
/* Define to 1 if the compiler supports '__builtin_clzll'. */
569+
#cmakedefine PHP_HAVE_BUILTIN_CLZLL 1
570570

571-
/* Define to 1 if the compiler supports '__builtin_cpu_init', and to 0 if not.
572-
*/
573-
#cmakedefine01 PHP_HAVE_BUILTIN_CPU_INIT
571+
/* Define to 1 if the compiler supports '__builtin_cpu_init'. */
572+
#cmakedefine PHP_HAVE_BUILTIN_CPU_INIT 1
574573

575-
/* Define to 1 if the compiler supports '__builtin_cpu_supports', and to 0 if
576-
not. */
577-
#cmakedefine01 PHP_HAVE_BUILTIN_CPU_SUPPORTS
574+
/* Define to 1 if the compiler supports '__builtin_cpu_supports'. */
575+
#cmakedefine PHP_HAVE_BUILTIN_CPU_SUPPORTS 1
578576

579-
/* Define to 1 if the compiler supports '__builtin_ctzl', and to 0 if not. */
580-
#cmakedefine01 PHP_HAVE_BUILTIN_CTZL
577+
/* Define to 1 if the compiler supports '__builtin_ctzl'. */
578+
#cmakedefine PHP_HAVE_BUILTIN_CTZL
581579

582-
/* Define to 1 if the compiler supports '__builtin_ctzll', and to 0 if not. */
583-
#cmakedefine01 PHP_HAVE_BUILTIN_CTZLL
580+
/* Define to 1 if the compiler supports '__builtin_ctzll'. */
581+
#cmakedefine PHP_HAVE_BUILTIN_CTZLL 1
584582

585-
/* Define to 1 if the compiler supports '__builtin_expect', and to 0 if not.
586-
*/
587-
#cmakedefine01 PHP_HAVE_BUILTIN_EXPECT
583+
/* Define to 1 if the compiler supports '__builtin_expect'. */
584+
#cmakedefine PHP_HAVE_BUILTIN_EXPECT 1
588585

589-
/* Define to 1 if the compiler supports '__builtin_frame_address', and to 0 if
590-
not. */
591-
#cmakedefine01 PHP_HAVE_BUILTIN_FRAME_ADDRESS
586+
/* Define to 1 if the compiler supports '__builtin_frame_address'. */
587+
#cmakedefine PHP_HAVE_BUILTIN_FRAME_ADDRESS 1
592588

593-
/* Define to 1 if the compiler supports '__builtin_saddll_overflow', and to 0
594-
if not */
595-
#cmakedefine01 PHP_HAVE_BUILTIN_SADDLL_OVERFLOW
589+
/* Define to 1 if the compiler supports '__builtin_saddll_overflow'. */
590+
#cmakedefine PHP_HAVE_BUILTIN_SADDLL_OVERFLOW 1
596591

597-
/* Define to 1 if the compiler supports '__builtin_saddl_overflow', and to 0
598-
if not. */
599-
#cmakedefine01 PHP_HAVE_BUILTIN_SADDL_OVERFLOW
592+
/* Define to 1 if the compiler supports '__builtin_saddl_overflow'. */
593+
#cmakedefine PHP_HAVE_BUILTIN_SADDL_OVERFLOW 1
600594

601-
/* Define to 1 if the compiler supports '__builtin_smulll_overflow', and to 0
602-
if not. */
603-
#cmakedefine01 PHP_HAVE_BUILTIN_SMULLL_OVERFLOW
595+
/* Define to 1 if the compiler supports '__builtin_smulll_overflow'. */
596+
#cmakedefine PHP_HAVE_BUILTIN_SMULLL_OVERFLOW 1
604597

605-
/* Define to 1 if the compiler supports '__builtin_smull_overflow', and to 0
606-
if not. */
607-
#cmakedefine01 PHP_HAVE_BUILTIN_SMULL_OVERFLOW
598+
/* Define to 1 if the compiler supports '__builtin_smull_overflow'. */
599+
#cmakedefine PHP_HAVE_BUILTIN_SMULL_OVERFLOW 1
608600

609-
/* Define to 1 if the compiler supports '__builtin_ssubll_overflow', and to 0
610-
if not. */
611-
#cmakedefine01 PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW
601+
/* Define to 1 if the compiler supports '__builtin_ssubll_overflow'. */
602+
#cmakedefine PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW 1
612603

613-
/* Define to 1 if the compiler supports '__builtin_ssubl_overflow', and to 0
614-
if not. */
615-
#cmakedefine01 PHP_HAVE_BUILTIN_SSUBL_OVERFLOW
604+
/* Define to 1 if the compiler supports '__builtin_ssubl_overflow'. */
605+
#cmakedefine PHP_HAVE_BUILTIN_SSUBL_OVERFLOW 1
616606

617-
/* Define to 1 if the compiler supports '__builtin_usub_overflow', and to 0 if
618-
not. */
619-
#cmakedefine01 PHP_HAVE_BUILTIN_USUB_OVERFLOW
607+
/* Define to 1 if the compiler supports '__builtin_usub_overflow'. */
608+
#cmakedefine PHP_HAVE_BUILTIN_USUB_OVERFLOW 1
620609

621610
/* Define to 1 if you have HP-UX 10.x.-style reentrant time functions. */
622611
#cmakedefine PHP_HPUX_TIME_R 1

0 commit comments

Comments
 (0)