From 192b74901859643cfd5f56c52fd43435082abfde Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Sat, 4 Aug 2018 18:03:33 +1000 Subject: [PATCH] Use a better check for Solaris (SunOS 5.x) The __sun__ macro is not always defined by Oracle Solaris Studio, but __sun is, as it is in GCC and Clang. By itself, __sun__ also matches the very obsolete SunOS 4.x BSD-based operating system, hence the need for __SVR4 as well. See https://web.archive.org/web/20180221212835/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system for more information on operating system macro checks. --- src/system.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system.h b/src/system.h index fdefc1e..dc21bba 100644 --- a/src/system.h +++ b/src/system.h @@ -45,11 +45,11 @@ #if ! defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 700 # undef _XOPEN_SOURCE -# if ! defined(__sun__) -# define _XOPEN_SOURCE 700 // Use SUSv4 where possible +# if defined(__sun) && defined(__SVR4) +# define _XOPEN_SOURCE 600 // Use SUSv3 on SunOS 5.x +# define __EXTENSIONS__ 1 // ... with Solaris extensions # else -# define _XOPEN_SOURCE 600 // Except on SunOS 5.x -# define __EXTENSIONS__ 1 // ... but use Solaris extensions +# define _XOPEN_SOURCE 700 // Use SUSv4 everywhere else # endif #endif