michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2011-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ******************************************************************************* michael@0: * file name: uposixdefs.h michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2011jul25 michael@0: * created by: Markus W. Scherer michael@0: * michael@0: * Common definitions for implementation files working with POSIX functions. michael@0: * *Important*: #include this file before any other header files! michael@0: */ michael@0: michael@0: #ifndef __UPOSIXDEFS_H__ michael@0: #define __UPOSIXDEFS_H__ michael@0: michael@0: /* michael@0: * Define _XOPEN_SOURCE for access to POSIX functions. michael@0: * michael@0: * We cannot use U_PLATFORM from platform.h/utypes.h because michael@0: * "The Open Group Base Specifications" michael@0: * chapter "2.2 The Compilation Environment" says: michael@0: * "In the compilation of an application that #defines a feature test macro michael@0: * specified by IEEE Std 1003.1-2001, michael@0: * no header defined by IEEE Std 1003.1-2001 shall be included prior to michael@0: * the definition of the feature test macro." michael@0: */ michael@0: #ifdef _XOPEN_SOURCE michael@0: /* Use the predefined value. */ michael@0: #else michael@0: /* michael@0: * Version 6.0: michael@0: * The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition) michael@0: * also known as michael@0: * SUSv3 = Open Group Single UNIX Specification, Version 3 (UNIX03) michael@0: * michael@0: * Note: This definition used to be in C source code (e.g., putil.c) michael@0: * and define _XOPEN_SOURCE to different values depending on __STDC_VERSION__. michael@0: * In C++ source code (e.g., putil.cpp), __STDC_VERSION__ is not defined at all. michael@0: */ michael@0: # define _XOPEN_SOURCE 600 michael@0: #endif michael@0: michael@0: /* michael@0: * Make sure things like readlink and such functions work. michael@0: * Poorly upgraded Solaris machines can't have this defined. michael@0: * Cleanly installed Solaris can use this #define. michael@0: * michael@0: * z/OS needs this definition for timeval and to get usleep. michael@0: */ michael@0: #if !defined(_XOPEN_SOURCE_EXTENDED) michael@0: # define _XOPEN_SOURCE_EXTENDED 1 michael@0: #endif michael@0: michael@0: /* michael@0: * There is an issue with turning on _XOPEN_SOURCE_EXTENDED on certain platforms. michael@0: * A compatibility issue exists between turning on _XOPEN_SOURCE_EXTENDED and using michael@0: * standard C++ string class. As a result, standard C++ string class needs to be michael@0: * turned off for the follwing platforms: michael@0: * -AIX/VACPP michael@0: * -Solaris/GCC michael@0: */ michael@0: #if (U_PLATFORM == U_PF_AIX && !defined(__GNUC__)) || (U_PLATFORM == U_PF_SOLARIS && defined(__GNUC__)) michael@0: # if _XOPEN_SOURCE_EXTENDED && !defined(U_HAVE_STD_STRING) michael@0: # define U_HAVE_STD_STRING 0 michael@0: # endif michael@0: #endif michael@0: michael@0: #endif /* __UPOSIXDEFS_H__ */