File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11#[=============================================================================[
22Check whether write(2) can successfully write to stdout.
3-
43On Windows, _write() (and its deprecated alias write()) can also write to stdout
5- but this PHP code uses this for POSIX targets only.
4+ but PHP code uses this for POSIX targets only.
65
76Result/cache variables:
87
9- * PHP_WRITE_STDOUT - Whether 'write()' can write to stdout.
8+ * PHP_WRITE_STDOUT
109#]=============================================================================]
1110
1211include (CheckIncludeFiles)
1312include (CheckSourceRuns)
1413include (CMakePushCheckState)
1514
16- # On Windows below check succeeds, however PHP implementation has it disabled.
1715if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
1816 set (PHP_WRITE_STDOUT FALSE )
1917 return ()
@@ -49,12 +47,17 @@ cmake_push_check_state(RESET)
4947 # include <unistd.h>
5048 #endif
5149
50+ #ifdef _WIN32
51+ # include <io.h>
52+ # undef write
53+ # define write _write
54+ #endif
55+
5256 #define TEXT "This is the test message -- "
5357
5458 int main(void)
5559 {
5660 int n;
57-
5861 n = write(1, TEXT, sizeof(TEXT)-1);
5962 return (!(n == sizeof(TEXT)-1));
6063 }
Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
8686 set (HAVE_IF_NAMETOINDEX FALSE )
8787 set (HAVE_IFADDRS_H FALSE )
8888 set (HAVE_IMMINTRIN_H TRUE )
89- set (HAVE_IO_H TRUE )
9089 set (HAVE_ISSETUGID FALSE )
9190 set (HAVE_KILL FALSE )
9291 set (HAVE_LANGINFO_H FALSE )
Original file line number Diff line number Diff line change 1- /* Define to 1 if you have the <io.h> header file. */
2- #cmakedefine HAVE_IO_H 1
3-
41/* Define to 1 if you have the <timelib_config.h> header file. */
52#cmakedefine HAVE_TIMELIB_CONFIG_H 1
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ project(
3636)
3737
3838include (CheckCompilerFlag)
39- include (CheckIncludeFiles)
4039
4140if (NOT TIMELIB_TARGET)
4241 set (TIMELIB_TARGET timelib)
@@ -92,7 +91,9 @@ if(_timelib_HAVE_FWRAPV)
9291 )
9392endif ()
9493
95- check_include_files(io.h HAVE_IO_H)
94+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
95+ set (HAVE_IO_H TRUE )
96+ endif ()
9697
9798cmake_path(
9899 RELATIVE_PATH
You can’t perform that action at this time.
0 commit comments