@@ -172,12 +172,13 @@ if(SIZEOF_INT STREQUAL "")
172172 set (SIZEOF_INT_CODE "#define SIZEOF_INT 0" )
173173endif ()
174174
175- # TODO: PHP on Windows sets the SIZEOF_INTMAX_T to 0 to skip certain checks,
176- # otherwise the intmax_t type and its size are available. Windows-related C code
177- # should probably be rechecked and fixed at some point.
178- check_type_size("intmax_t" SIZEOF_INTMAX_T)
179- if (SIZEOF_INTMAX_T STREQUAL "" OR CMAKE_SYSTEM_NAME STREQUAL "Windows" )
175+ # The intmax_t is always available by C99 standard and its size varies between
176+ # 32-bit and 64-bit target platforms. PHP on Windows sets SIZEOF_INTMAX_T to 0,
177+ # otherwise the type and its size are available on Windows.
178+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
180179 set (SIZEOF_INTMAX_T_CODE "#define SIZEOF_INTMAX_T 0" )
180+ else ()
181+ check_type_size("intmax_t" SIZEOF_INTMAX_T)
181182endif ()
182183
183184check_type_size("long" SIZEOF_LONG)
@@ -195,25 +196,11 @@ if(SIZEOF_OFF_T STREQUAL "")
195196 set (SIZEOF_OFF_T_CODE "#define SIZEOF_OFF_T 0" )
196197endif ()
197198
198- # TODO: The ptrdiff_t is always available by C89 standard and its size varies
199- # between 32-bit and 64-bit target platforms. Checking whether the ptrdiff_t
200- # exists is redundant and is left here as PHP still checks it conditionally in
201- # the intl extension .
199+ # The ptrdiff_t is always available by C89 standard and its size varies between
200+ # 32-bit and 64-bit target platforms. Checking whether the ptrdiff_t exists is
201+ # redundant and is left here as PHP still checks it conditionally in the intl
202+ # extension and main/s{n,p}printf.{c,h} .
202203check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
203- if (SIZEOF_PTRDIFF_T STREQUAL "" )
204- if (CMAKE_SIZEOF_VOID_P EQUAL 4)
205- set (SIZEOF_PTRDIFF_T 4)
206- else ()
207- set (SIZEOF_PTRDIFF_T 8)
208- endif ()
209- set (SIZEOF_PTRDIFF_T_CODE "#define SIZEOF_PTRDIFF_T ${SIZEOF_PTRDIFF_T} " )
210-
211- message (
212- WARNING
213- "Couldn't determine the ptrdiff_t size, setting it to ${SIZEOF_PTRDIFF_T} ."
214- )
215- endif ()
216- set (HAVE_PTRDIFF_T TRUE )
217204
218205check_type_size("size_t" SIZEOF_SIZE_T)
219206if (SIZEOF_SIZE_T STREQUAL "" )
0 commit comments