@@ -133,31 +133,6 @@ cmake_pop_check_state()
133133# Check types.
134134################################################################################
135135
136- check_type_size("int" SIZEOF_INT)
137- if (NOT SIZEOF_INT)
138- message (FATAL_ERROR "Cannot determine size of int." )
139- endif ()
140-
141- check_type_size("long" SIZEOF_LONG)
142- if (NOT SIZEOF_LONG)
143- message (FATAL_ERROR "Cannot determine size of long." )
144- endif ()
145-
146- check_type_size("long long" SIZEOF_LONG_LONG)
147- if (NOT SIZEOF_LONG_LONG)
148- message (FATAL_ERROR "Cannot determine size of long long." )
149- endif ()
150-
151- check_type_size("size_t" SIZEOF_SIZE_T)
152- if (NOT HAVE_SIZEOF_SIZE_T)
153- message (FATAL_ERROR "Cannot determine size of size_t." )
154- endif ()
155-
156- check_type_size("off_t" SIZEOF_OFF_T)
157- if (NOT SIZEOF_OFF_T)
158- message (FATAL_ERROR "Cannot determine size of off_t." )
159- endif ()
160-
161136check_type_size("gid_t" SIZEOF_GID_T)
162137if (NOT HAVE_SIZEOF_GID_T)
163138 set (
@@ -166,31 +141,46 @@ if(NOT HAVE_SIZEOF_GID_T)
166141 )
167142endif ()
168143
169- check_type_size("uid_t" SIZEOF_UID_T)
170- if (NOT HAVE_SIZEOF_UID_T)
171- set (
172- uid_t int
173- CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
174- )
175- endif ()
144+ check_type_size("int" SIZEOF_INT)
176145
177146check_type_size("intmax_t" SIZEOF_INTMAX_T)
178147if (NOT SIZEOF_INTMAX_T)
179148 set (SIZEOF_INTMAX_T 0 CACHE INTERNAL "Size of intmax_t" )
180149 message (WARNING "Couldn't determine size of intmax_t, setting to 0." )
150+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
151+ # PHP on Windows sets the SIZEOF_INTMAX_T to 0 to skip certain checks,
152+ # otherwise intmax_t and its size is available.
153+ set (SIZEOF_INTMAX_T 0 CACHE INTERNAL "Size of intmax_t" )
181154endif ()
182155
183- check_type_size("ssize_t" SIZEOF_SSIZE_T)
184- if (NOT SIZEOF_SSIZE_T)
185- set (SIZEOF_SSIZE_T 8 CACHE INTERNAL "Size of ssize_t" )
186- message (WARNING "Couldn't determine size of ssize_t, setting to 8." )
187- endif ()
156+ check_type_size("long" SIZEOF_LONG)
157+ check_type_size("long long" SIZEOF_LONG_LONG)
158+ check_type_size("off_t" SIZEOF_OFF_T)
188159
189160check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
190161set (HAVE_PTRDIFF_T 1 CACHE INTERNAL "Whether ptrdiff_t is available" )
191162if (NOT SIZEOF_PTRDIFF_T)
192- set (SIZEOF_PTRDIFF_T 8 CACHE INTERNAL "Size of ptrdiff_t" )
193- message (WARNING "Couldn't determine size of ptrdiff_t, setting to 8." )
163+ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
164+ set (SIZEOF_PTRDIFF_T 4 CACHE INTERNAL "Size of ptrdiff_t" )
165+ else
166+ set (SIZEOF_PTRDIFF_T 8 CACHE INTERNAL "Size of ptrdiff_t" )
167+ endif ()
168+
169+ message (
170+ WARNING
171+ "Couldn't determine the ptrdiff_t size, setting it to ${SIZEOF_PTRDIFF_T} ."
172+ )
173+ endif ()
174+
175+ check_type_size("size_t" SIZEOF_SIZE_T)
176+ check_type_size("ssize_t" SIZEOF_SSIZE_T)
177+
178+ check_type_size("uid_t" SIZEOF_UID_T)
179+ if (NOT HAVE_SIZEOF_UID_T)
180+ set (
181+ uid_t int
182+ CACHE INTERNAL "Define as 'int' if <sys/types.h> doesn't define."
183+ )
194184endif ()
195185
196186# Check for socklen_t type.
0 commit comments