File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Expand file tree Collapse file tree 4 files changed +11
-12
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 @@ -88,7 +88,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
8888 set (HAVE_IF_NAMETOINDEX FALSE )
8989 set (HAVE_IFADDRS_H FALSE )
9090 set (HAVE_IMMINTRIN_H TRUE )
91- set (HAVE_IO_H TRUE )
9291 set (HAVE_ISSETUGID FALSE )
9392 set (HAVE_KILL FALSE )
9493 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 @@ -35,8 +35,6 @@ project(
3535 VERSION ${timelib_VERSION}
3636)
3737
38- include (CheckIncludeFiles)
39-
4038if (NOT TIMELIB_TARGET)
4139 set (TIMELIB_TARGET timelib)
4240 add_library (${TIMELIB_TARGET} )
@@ -82,7 +80,9 @@ target_compile_definitions(
8280 HAVE_STRTOLL
8381)
8482
85- check_include_files(io.h HAVE_IO_H)
83+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
84+ set (HAVE_IO_H TRUE )
85+ endif ()
8686
8787cmake_path(
8888 RELATIVE_PATH
You can’t perform that action at this time.
0 commit comments