summaryrefslogtreecommitdiff
path: root/programs/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'programs/platform.h')
-rw-r--r--programs/platform.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/programs/platform.h b/programs/platform.h
index 5934e59cf12d..2b4b9f2d8677 100644
--- a/programs/platform.h
+++ b/programs/platform.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
+ * Copyright (c) 2016-2020, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
@@ -90,7 +90,7 @@ extern "C" {
&& ( defined(__unix__) || defined(__unix) \
|| defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) )
-# if defined(__linux__) || defined(__linux)
+# if defined(__linux__) || defined(__linux) || defined(__CYGWIN__)
# ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200809L /* feature test macro : https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
# endif
@@ -109,16 +109,25 @@ extern "C" {
#endif /* PLATFORM_POSIX_VERSION */
+#if PLATFORM_POSIX_VERSION > 1
+ /* glibc < 2.26 may not expose struct timespec def without this.
+ * See issue #1920. */
+# ifndef _ATFILE_SOURCE
+# define _ATFILE_SOURCE
+# endif
+#endif
+
+
/*-*********************************************
* Detect if isatty() and fileno() are available
************************************************/
#if (defined(__linux__) && (PLATFORM_POSIX_VERSION > 1)) \
|| (PLATFORM_POSIX_VERSION >= 200112L) \
- || defined(__DJGPP__) \
- || defined(__MSYS__)
+ || defined(__DJGPP__)
# include <unistd.h> /* isatty */
+# include <stdio.h> /* fileno */
# define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
-#elif defined(MSDOS) || defined(OS2) || defined(__CYGWIN__)
+#elif defined(MSDOS) || defined(OS2)
# include <io.h> /* _isatty */
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#elif defined(WIN32) || defined(_WIN32)