Skip to content

Commit 6517caa

Browse files
committed
Simplify gid_t/uid_t cache variables
Instead of defining cache variable with unreliable name, this sets regular CMake variable with code for the configuration header for gid_t/uid_t on POSIX systems (although this could be even further improved in modern code by only checking for Windows target system directly in the C code).
1 parent 0e2a909 commit 6517caa

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,9 @@ cmake_pop_check_state()
276276

277277
check_type_size("gid_t" SIZEOF_GID_T)
278278
if(NOT HAVE_SIZEOF_GID_T)
279-
set(
280-
gid_t
281-
int
282-
CACHE INTERNAL
283-
"Define as 'int' if not defined in <sys/types.h>."
284-
)
279+
set(PHP_GID_T_CODE "#define gid_t int")
280+
else()
281+
set(PHP_GID_T_CODE "/* #undef gid_t */")
285282
endif()
286283

287284
check_type_size("int" SIZEOF_INT)
@@ -335,12 +332,9 @@ endif()
335332

336333
check_type_size("uid_t" SIZEOF_UID_T)
337334
if(NOT HAVE_SIZEOF_UID_T)
338-
set(
339-
uid_t
340-
int
341-
CACHE INTERNAL
342-
"Define as 'int' if not defined in <sys/types.h>."
343-
)
335+
set(PHP_UID_T_CODE "#define uid_t int")
336+
else()
337+
set(PHP_UID_T_CODE "/* #undef uid_t */")
344338
endif()
345339

346340
# Check for socklen_t type.

cmake/main/cmake/php_config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,10 @@
681681
# endif
682682
#else
683683
/* Define to 'int' if <sys/types.h> doesn't define. */
684-
# cmakedefine gid_t @gid_t@
684+
@PHP_GID_T_CODE@
685685

686686
/* Define to 'int' if <sys/types.h> doesn't define. */
687-
# cmakedefine uid_t @uid_t@
687+
@PHP_UID_T_CODE@
688688

689689
# include <stdlib.h>
690690

0 commit comments

Comments
 (0)