Skip to content

Commit 3954d1a

Browse files
committed
Move Zend configuration to Zend/zend_config.cmake.h.in
Following extensions configuration headers, this adds all Zend engine related configuration to its own template for easier handling and understanding.
1 parent f02f31a commit 3954d1a

File tree

5 files changed

+105
-98
lines changed

5 files changed

+105
-98
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
590590
)
591591
endif()
592592

593+
configure_file(zend_config.cmake.h.in CMakeFiles/zend_config.h @ONLY)
594+
593595
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
594596
message(STATUS "Creating Zend/zend_config.h")
595597

cmake/Zend/zend_config.cmake.h.in

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* Define to 1 if 'dlsym()' requires a leading underscore in symbol names. */
2+
#cmakedefine DLSYM_NEEDS_UNDERSCORE 1
3+
4+
/* Define to 1 if _controlfp is present and usable. */
5+
#cmakedefine HAVE__CONTROLFP 1
6+
7+
/* Define to 1 if _controlfp_s is present and usable. */
8+
#cmakedefine HAVE__CONTROLFP_S 1
9+
10+
/* Define to 1 if _FPU_SETCW is present and usable. */
11+
#cmakedefine HAVE__FPU_SETCW 1
12+
13+
/* Define to 1 if '__cpuid_count' is available. */
14+
#cmakedefine HAVE_CPUID_COUNT 1
15+
16+
/* Define to 1 if you have the <cpuid.h> header file. */
17+
#cmakedefine HAVE_CPUID_H 1
18+
19+
/* Define to 1 if fpsetprec is present and usable. */
20+
#cmakedefine HAVE_FPSETPREC 1
21+
22+
/* Define to 1 if FPU control word can be manipulated by inline assembler. */
23+
#cmakedefine HAVE_FPU_INLINE_ASM_X86 1
24+
25+
/* Define to 1 if the target system has support for global register variables.
26+
*/
27+
#cmakedefine HAVE_GCC_GLOBAL_REGS 1
28+
29+
/* Define to 1 if you have the 'getpid' function. */
30+
#cmakedefine HAVE_GETPID 1
31+
32+
/* Define to 1 if you have the 'gettid' function. */
33+
#cmakedefine HAVE_GETTID 1
34+
35+
/* Define to 1 if you have the 'kill' function. */
36+
#cmakedefine HAVE_KILL 1
37+
38+
/* Define to 1 if you have the 'mremap' function. */
39+
#cmakedefine HAVE_MREMAP 1
40+
41+
/* Define to 1 if you have the 'pthread_attr_get_np' function. */
42+
#cmakedefine HAVE_PTHREAD_ATTR_GET_NP 1
43+
44+
/* Define to 1 if you have the 'pthread_attr_getstack' function. */
45+
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACK 1
46+
47+
/* Define to 1 if you have the 'pthread_get_stackaddr_np' function. */
48+
#cmakedefine HAVE_PTHREAD_GET_STACKADDR_NP 1
49+
50+
/* Define to 1 if you have the 'pthread_getattr_np' function. */
51+
#cmakedefine HAVE_PTHREAD_GETATTR_NP 1
52+
53+
/* Define to 1 if you have the 'pthread_stackseg_np' function. */
54+
#cmakedefine HAVE_PTHREAD_STACKSEG_NP 1
55+
56+
/* Define to 1 if you have the 'sigaction' function. */
57+
#cmakedefine HAVE_SIGACTION 1
58+
59+
/* Define to 1 if you have the 'sigsetjmp' function. */
60+
#cmakedefine HAVE_SIGSETJMP 1
61+
62+
/* Define to 1 if checking the stack limit is supported. */
63+
#cmakedefine ZEND_CHECK_STACK_LIMIT 1
64+
65+
/* Define to 1 if Zend fiber uses ucontext instead of boost context. */
66+
#cmakedefine ZEND_FIBER_UCONTEXT 1
67+
68+
/* Define to 1 if Zend max execution timers are supported and enabled. */
69+
#cmakedefine ZEND_MAX_EXECUTION_TIMERS 1
70+
71+
/* Number of bytes for the ZEND_MM alignment. */
72+
#cmakedefine ZEND_MM_ALIGNMENT @ZEND_MM_ALIGNMENT@
73+
74+
/* Number of bytes for the logarithmic ZEND_MM alignment. */
75+
#cmakedefine ZEND_MM_ALIGNMENT_LOG2 @ZEND_MM_ALIGNMENT_LOG2@
76+
77+
/* Define to 1 if ZEND_MM needs 8-byte realignment, and to 0 if not. */
78+
#cmakedefine01 ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
79+
80+
/* Define to 1 if Zend signal handling is supported and enabled. */
81+
#cmakedefine ZEND_SIGNALS 1

cmake/ext/pdo_odbc/CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,11 @@ elseif(EXT_PDO_ODBC_TYPE STREQUAL "unixODBC")
157157
set(ODBC_TYPE "odbc")
158158
endif()
159159

160-
block()
161-
if(EXT_PDO_ODBC_TYPE STREQUAL "generic" AND EXT_PDO_ODBC_LIBRARY)
162-
set(type "${EXT_PDO_ODBC_TYPE}-${EXT_PDO_ODBC_LIBRARY}")
163-
else()
164-
set(type "${EXT_PDO_ODBC_TYPE}")
165-
endif()
166-
167-
set(PDO_ODBC_TYPE "${type}")
168-
endblock()
160+
if(EXT_PDO_ODBC_TYPE STREQUAL "generic" AND EXT_PDO_ODBC_LIBRARY)
161+
set(PDO_ODBC_TYPE "${EXT_PDO_ODBC_TYPE}-${EXT_PDO_ODBC_LIBRARY}")
162+
else()
163+
set(PDO_ODBC_TYPE "${EXT_PDO_ODBC_TYPE}")
164+
endif()
169165

170166
if(EXT_PDO_ODBC_ROOT AND NOT ODBC_ROOT)
171167
set(ODBC_ROOT ${EXT_PDO_ODBC_ROOT})

cmake/main/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,19 +362,23 @@ function(_php_main_create_files)
362362
message(STATUS "Creating main/php_version.h")
363363
configure_file(main/php_version.h.in main/php_version.h @ONLY)
364364

365-
# Append extensions config.h contents.
366-
set(extensionsConfigH "")
365+
# Add Zend engine configuration.
366+
file(READ ${CMAKE_CURRENT_BINARY_DIR}/Zend/CMakeFiles/zend_config.h config)
367+
string(STRIP "${config}" ZEND_CONFIGURATION)
368+
369+
# Add extensions configuration.
370+
set(config "")
367371
get_cmake_property(extensions PHP_EXTENSIONS)
372+
list(SORT extensions COMPARE NATURAL)
368373
foreach(extension IN LISTS extensions)
369374
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ext/${extension}/config.h)
370375
file(READ ${CMAKE_CURRENT_BINARY_DIR}/ext/${extension}/config.h content)
371376
if(content)
372-
string(APPEND extensionsConfigH "\n${content}")
377+
string(APPEND config "\n${content}")
373378
endif()
374379
endif()
375380
endforeach()
376-
string(STRIP "${extensionsConfigH}" extensionsConfigH)
377-
set(PHP_EXTENSIONS_CONFIGURATION "${extensionsConfigH}")
381+
string(STRIP "${config}" PHP_EXTENSIONS_CONFIGURATION)
378382

379383
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
380384
set(PHP_CONFIG_H_WINDOWS 1)

cmake/main/php_config.cmake.h.in

Lines changed: 8 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
and to string "0" if they are not. */
5959
#define DEFAULT_SHORT_OPEN_TAG "@DEFAULT_SHORT_OPEN_TAG@"
6060

61-
/* Define to 1 if 'dlsym()' requires a leading underscore in symbol names. */
62-
#cmakedefine DLSYM_NEEDS_UNDERSCORE 1
63-
6461
/* Define to 1 if 'TIOCGWINSZ' requires <sys/ioctl.h>. */
6562
#cmakedefine GWINSZ_IN_SYS_IOCTL 1
6663

@@ -124,12 +121,6 @@
124121
/* Define to 1 if you have the 'copy_file_range' function. */
125122
#cmakedefine HAVE_COPY_FILE_RANGE 1
126123

127-
/* Define to 1 if '__cpuid_count' is available. */
128-
#cmakedefine HAVE_CPUID_COUNT 1
129-
130-
/* Define to 1 if you have the <cpuid.h> header file. */
131-
#cmakedefine HAVE_CPUID_H 1
132-
133124
/* Define to 1 if you have the 'ctime_r' function. */
134125
#cmakedefine HAVE_CTIME_R 1
135126

@@ -175,12 +166,6 @@
175166
/* Define to 1 if PHP-FPM has ACL support. */
176167
#cmakedefine HAVE_FPM_ACL 1
177168

178-
/* Define to 1 if fpsetprec is present and usable. */
179-
#cmakedefine HAVE_FPSETPREC 1
180-
181-
/* Define to 1 if FPU control word can be manipulated by inline assembler. */
182-
#cmakedefine HAVE_FPU_INLINE_ASM_X86 1
183-
184169
/* Define to 1 if you have the 'ftok' function. */
185170
#cmakedefine HAVE_FTOK 1
186171

@@ -205,10 +190,6 @@
205190
/* Define to 1 if you have the 'gai_strerror' function. */
206191
#cmakedefine HAVE_GAI_STRERROR 1
207192

208-
/* Define to 1 if the target system has support for global register variables.
209-
*/
210-
#cmakedefine HAVE_GCC_GLOBAL_REGS 1
211-
212193
/* Define to 1 if GCOV code coverage is enabled. */
213194
#cmakedefine HAVE_GCOV 1
214195

@@ -233,9 +214,6 @@
233214
/* Define to 1 if you have the 'getlogin' function. */
234215
#cmakedefine HAVE_GETLOGIN 1
235216

236-
/* Define to 1 if you have the 'getpid' function. */
237-
#cmakedefine HAVE_GETPID 1
238-
239217
/* Define to 1 if you have the 'getprotobyname' function. */
240218
#cmakedefine HAVE_GETPROTOBYNAME 1
241219

@@ -263,9 +241,6 @@
263241
/* Define to 1 if you have the 'getsid' function. */
264242
#cmakedefine HAVE_GETSID 1
265243

266-
/* Define to 1 if you have the 'gettid' function. */
267-
#cmakedefine HAVE_GETTID 1
268-
269244
/* Define to 1 if you have the 'gettimeofday' function. */
270245
#cmakedefine HAVE_GETTIMEOFDAY 1
271246

@@ -302,9 +277,6 @@
302277
/* Define to 1 if IPv6 is enabled and supported. */
303278
#cmakedefine HAVE_IPV6 1
304279

305-
/* Define to 1 if you have the 'kill' function. */
306-
#cmakedefine HAVE_KILL 1
307-
308280
/* Define to 1 if system has a working 'kqueue' function. */
309281
#cmakedefine HAVE_KQUEUE 1
310282

@@ -362,9 +334,6 @@
362334
/* Define to 1 if you have the 'mmap' function. */
363335
#cmakedefine HAVE_MMAP 1
364336

365-
/* Define to 1 if you have the 'mremap' function. */
366-
#cmakedefine HAVE_MREMAP 1
367-
368337
/* Define to 1 if you have the 'nanosleep' function. */
369338
#cmakedefine HAVE_NANOSLEEP 1
370339

@@ -413,24 +382,9 @@
413382
/* Define if the PS_STRINGS exists. */
414383
#cmakedefine HAVE_PS_STRINGS
415384

416-
/* Define to 1 if you have the 'pthread_attr_getstack' function. */
417-
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACK 1
418-
419-
/* Define to 1 if you have the 'pthread_attr_get_np' function. */
420-
#cmakedefine HAVE_PTHREAD_ATTR_GET_NP 1
421-
422-
/* Define to 1 if you have the 'pthread_getattr_np' function. */
423-
#cmakedefine HAVE_PTHREAD_GETATTR_NP 1
424-
425-
/* Define to 1 if you have the 'pthread_get_stackaddr_np' function. */
426-
#cmakedefine HAVE_PTHREAD_GET_STACKADDR_NP 1
427-
428385
/* Define to 1 if you have the 'pthread_jit_write_protect_np' function. */
429386
#cmakedefine HAVE_PTHREAD_JIT_WRITE_PROTECT_NP 1
430387

431-
/* Define to 1 if you have the 'pthread_stackseg_np' function. */
432-
#cmakedefine HAVE_PTHREAD_STACKSEG_NP 1
433-
434388
/* Define to 1 if you have the 'ptrace' function. */
435389
#cmakedefine HAVE_PTRACE 1
436390

@@ -482,15 +436,9 @@
482436
/* Define to 1 if you have the 'shutdown' function. */
483437
#cmakedefine HAVE_SHUTDOWN 1
484438

485-
/* Define to 1 if you have the 'sigaction' function. */
486-
#cmakedefine HAVE_SIGACTION 1
487-
488439
/* Define to 1 if you have the 'sigprocmask' function. */
489440
#cmakedefine HAVE_SIGPROCMASK 1
490441

491-
/* Define to 1 if you have the 'sigsetjmp' function. */
492-
#cmakedefine HAVE_SIGSETJMP 1
493-
494442
/* Define to 1 if 'sa_len' is a member of 'struct sockaddr'. */
495443
#cmakedefine HAVE_SOCKADDR_SA_LEN 1
496444

@@ -705,15 +653,6 @@
705653
/* Define to 1 if you have the <wmmintrin.h> header file. */
706654
#cmakedefine HAVE_WMMINTRIN_H 1
707655

708-
/* Define to 1 if _controlfp is present and usable. */
709-
#cmakedefine HAVE__CONTROLFP 1
710-
711-
/* Define to 1 if _controlfp_s is present and usable. */
712-
#cmakedefine HAVE__CONTROLFP_S 1
713-
714-
/* Define to 1 if _FPU_SETCW is present and usable. */
715-
#cmakedefine HAVE__FPU_SETCW 1
716-
717656
/* Define to 1 if 'major', 'minor', and 'makedev' are declared in <mkdev.h>.
718657
*/
719658
#cmakedefine MAJOR_IN_MKDEV 1
@@ -893,43 +832,28 @@
893832
/* Define if processor uses big-endian word. */
894833
#cmakedefine WORDS_BIGENDIAN
895834

896-
/* Define to 1 if checking the stack limit is supported. */
897-
#cmakedefine ZEND_CHECK_STACK_LIMIT 1
898-
899835
/* Define to 1 if debugging is enabled, and to 0 if not.
900836
TODO: This is still not good enough because multi-config generators would
901837
then need separate php_config.h files for each build type. */
902838
#ifndef ZEND_DEBUG
903839
# define ZEND_DEBUG $<IF:$<CONFIG:Debug,DebugAssertions>,1,0>
904840
#endif
905841

906-
/* Define to 1 if Zend fiber uses ucontext instead of boost context. */
907-
#cmakedefine ZEND_FIBER_UCONTEXT 1
908-
909-
/* Define to 1 if Zend max execution timers are supported and enabled. */
910-
#cmakedefine ZEND_MAX_EXECUTION_TIMERS 1
911-
912-
/* Number of bytes for the ZEND_MM alignment. */
913-
#cmakedefine ZEND_MM_ALIGNMENT @ZEND_MM_ALIGNMENT@
914-
915-
/* Number of bytes for the logarithmic ZEND_MM alignment. */
916-
#cmakedefine ZEND_MM_ALIGNMENT_LOG2 @ZEND_MM_ALIGNMENT_LOG2@
917-
918-
/* Define to 1 if ZEND_MM needs 8-byte realignment, and to 0 if not. */
919-
#cmakedefine01 ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
920-
921-
/* Define to 1 if Zend signal handling is supported and enabled. */
922-
#cmakedefine ZEND_SIGNALS 1
923-
924842
/* Define to 1 if thread safety (ZTS) is enabled. */
925843
#cmakedefine ZTS 1
926844

927845
/* Define to 1 when using musl libc. */
928846
#cmakedefine __MUSL__ 1
929847

930-
/*************************************************************************
848+
/*****************************************************************************
849+
Zend engine configuration
850+
****************************************************************************/
851+
852+
@ZEND_CONFIGURATION@
853+
854+
/*****************************************************************************
931855
PHP extensions configuration
932-
************************************************************************/
856+
****************************************************************************/
933857

934858
@PHP_EXTENSIONS_CONFIGURATION@
935859

0 commit comments

Comments
 (0)