@@ -135,31 +135,6 @@ cmake_pop_check_state()
135135# Check types.
136136################################################################################
137137
138- check_type_size("int" SIZEOF_INT)
139- if (NOT SIZEOF_INT)
140- message (FATAL_ERROR "Cannot determine size of int." )
141- endif ()
142-
143- check_type_size("long" SIZEOF_LONG)
144- if (NOT SIZEOF_LONG)
145- message (FATAL_ERROR "Cannot determine size of long." )
146- endif ()
147-
148- check_type_size("long long" SIZEOF_LONG_LONG)
149- if (NOT SIZEOF_LONG_LONG)
150- message (FATAL_ERROR "Cannot determine size of long long." )
151- endif ()
152-
153- check_type_size("size_t" SIZEOF_SIZE_T)
154- if (NOT HAVE_SIZEOF_SIZE_T)
155- message (FATAL_ERROR "Cannot determine size of size_t." )
156- endif ()
157-
158- check_type_size("off_t" SIZEOF_OFF_T)
159- if (NOT SIZEOF_OFF_T)
160- message (FATAL_ERROR "Cannot determine size of off_t." )
161- endif ()
162-
163138check_type_size("gid_t" SIZEOF_GID_T)
164139if (NOT HAVE_SIZEOF_GID_T)
165140 set (
@@ -168,31 +143,46 @@ if(NOT HAVE_SIZEOF_GID_T)
168143 )
169144endif ()
170145
171- check_type_size("uid_t" SIZEOF_UID_T)
172- if (NOT HAVE_SIZEOF_UID_T)
173- set (
174- uid_t int
175- CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
176- )
177- endif ()
146+ check_type_size("int" SIZEOF_INT)
178147
179148check_type_size("intmax_t" SIZEOF_INTMAX_T)
180149if (NOT SIZEOF_INTMAX_T)
181150 set (SIZEOF_INTMAX_T 0 CACHE INTERNAL "Size of intmax_t" )
182151 message (WARNING "Couldn't determine size of intmax_t, setting to 0." )
152+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
153+ # PHP on Windows sets the SIZEOF_INTMAX_T to 0 to skip certain checks,
154+ # otherwise intmax_t and its size is available.
155+ set (SIZEOF_INTMAX_T 0 CACHE INTERNAL "Size of intmax_t" )
183156endif ()
184157
185- check_type_size("ssize_t" SIZEOF_SSIZE_T)
186- if (NOT SIZEOF_SSIZE_T)
187- set (SIZEOF_SSIZE_T 8 CACHE INTERNAL "Size of ssize_t" )
188- message (WARNING "Couldn't determine size of ssize_t, setting to 8." )
189- endif ()
158+ check_type_size("long" SIZEOF_LONG)
159+ check_type_size("long long" SIZEOF_LONG_LONG)
160+ check_type_size("off_t" SIZEOF_OFF_T)
190161
191162check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
192163set (HAVE_PTRDIFF_T 1 CACHE INTERNAL "Whether ptrdiff_t is available" )
193164if (NOT SIZEOF_PTRDIFF_T)
194- set (SIZEOF_PTRDIFF_T 8 CACHE INTERNAL "Size of ptrdiff_t" )
195- message (WARNING "Couldn't determine size of ptrdiff_t, setting to 8." )
165+ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
166+ set (SIZEOF_PTRDIFF_T 4 CACHE INTERNAL "Size of ptrdiff_t" )
167+ else
168+ set (SIZEOF_PTRDIFF_T 8 CACHE INTERNAL "Size of ptrdiff_t" )
169+ endif ()
170+
171+ message (
172+ WARNING
173+ "Couldn't determine the ptrdiff_t size, setting it to ${SIZEOF_PTRDIFF_T} ."
174+ )
175+ endif ()
176+
177+ check_type_size("size_t" SIZEOF_SIZE_T)
178+ check_type_size("ssize_t" SIZEOF_SSIZE_T)
179+
180+ check_type_size("uid_t" SIZEOF_UID_T)
181+ if (NOT HAVE_SIZEOF_UID_T)
182+ set (
183+ uid_t int
184+ CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
185+ )
196186endif ()
197187
198188# Check for socklen_t type.
0 commit comments