Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */



  26 
  27 #ifndef _SYS_FEATURE_TESTS_H
  28 #define _SYS_FEATURE_TESTS_H
  29 
  30 #include <sys/ccompile.h>
  31 #include <sys/isa_defs.h>
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 /*
  38  * Values of _POSIX_C_SOURCE
  39  *
  40  *              undefined   not a POSIX compilation
  41  *              1           POSIX.1-1990 compilation
  42  *              2           POSIX.2-1992 compilation
  43  *              199309L     POSIX.1b-1993 compilation (Real Time)
  44  *              199506L     POSIX.1c-1995 compilation (POSIX Threads)
  45  *              200112L     POSIX.1-2001 compilation (Austin Group Revision)

  46  */
  47 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
  48 #define _POSIX_C_SOURCE 1
  49 #endif
  50 
  51 /*
  52  * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, and _STDC_C99
  53  * are Sun implementation specific macros created in order to compress
  54  * common standards specified feature test macros for easier reading.
  55  * These macros should not be used by the application developer as
  56  * unexpected results may occur. Instead, the user should reference
  57  * standards(5) for correct usage of the standards feature test macros.
  58  *
  59  * __XOPEN_OR_POSIX     Used in cases where a symbol is defined by both
  60  *                      X/Open or POSIX or in the negative, when neither
  61  *                      X/Open or POSIX defines a symbol.
  62  *
  63  * _STRICT_STDC         __STDC__ is specified by the C Standards and defined
  64  *                      by the compiler. For Sun compilers the value of
  65  *                      __STDC__ is either 1, 0, or not defined based on the
  66  *                      compilation mode (see cc(1)). When the value of
  67  *                      __STDC__ is 1 and in the absence of any other feature
  68  *                      test macros, the namespace available to the application
  69  *                      is limited to only those symbols defined by the C
  70  *                      Standard. _STRICT_STDC provides a more readable means
  71  *                      of identifying symbols defined by the standard, or in
  72  *                      the negative, symbols that are extensions to the C
  73  *                      Standard. See additional comments for GNU C differences.
  74  *
  75  * _STDC_C99            __STDC_VERSION__ is specified by the C standards and
  76  *                      defined by the compiler and indicates the version of
  77  *                      the C standard. A value of 199901L indicates a
  78  *                      compiler that complies with ISO/IEC 9899:1999, other-
  79  *                      wise known as the C99 standard.




  80  */
  81 
  82 #if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
  83 #define __XOPEN_OR_POSIX
  84 #endif
  85 
  86 /*
  87  * ISO/IEC 9899:1990 and it's revision, ISO/IEC 9899:1999 specify the
  88  * following predefined macro name:
  89  *
  90  * __STDC__     The integer constant 1, intended to indicate a conforming
  91  *              implementation.
  92  *
  93  * Furthermore, a strictly conforming program shall use only those features
  94  * of the language and library specified in these standards. A conforming
  95  * implementation shall accept any strictly conforming program.
  96  *
  97  * Based on these requirements, Sun's C compiler defines __STDC__ to 1 for
  98  * strictly conforming environments and __STDC__ to 0 for environments that
  99  * use ANSI C semantics but allow extensions to the C standard. For non-ANSI


 127  * interpretations to peacefully co-exist, we use the following Sun
 128  * implementation _STRICT_STDC_ macro:
 129  */
 130 
 131 #if (__STDC__ - 0 == 1 && !defined(__GNUC__)) || \
 132         (defined(__GNUC__) && defined(__STRICT_ANSI__))
 133 #define _STRICT_STDC
 134 #else
 135 #undef  _STRICT_STDC
 136 #endif
 137 
 138 /*
 139  * Compiler complies with ISO/IEC 9899:1999
 140  */
 141 
 142 #if __STDC_VERSION__ - 0 >= 199901L
 143 #define _STDC_C99
 144 #endif
 145 
 146 /*








 147  * Large file interfaces:
 148  *
 149  *      _LARGEFILE_SOURCE
 150  *              1               large file-related additions to POSIX
 151  *                              interfaces requested (fseeko, etc.)
 152  *      _LARGEFILE64_SOURCE
 153  *              1               transitional large-file-related interfaces
 154  *                              requested (seek64, stat64, etc.)
 155  *
 156  * The corresponding announcement macros are respectively:
 157  *      _LFS_LARGEFILE
 158  *      _LFS64_LARGEFILE
 159  * (These are set in <unistd.h>.)
 160  *
 161  * Requesting _LARGEFILE64_SOURCE implies requesting _LARGEFILE_SOURCE as
 162  * well.
 163  *
 164  * The large file interfaces are made visible regardless of the initial values
 165  * of the feature test macros under certain circumstances:
 166  *    - If no explicit standards-conforming environment is requested (neither


 205 #else   /* _LP64 */
 206 #ifndef _FILE_OFFSET_BITS
 207 #define _FILE_OFFSET_BITS       32
 208 #endif
 209 #if     _FILE_OFFSET_BITS - 0 != 32 && _FILE_OFFSET_BITS - 0 != 64
 210 #error  "invalid _FILE_OFFSET_BITS value specified"
 211 #endif
 212 #endif  /* _LP64 */
 213 
 214 /*
 215  * Use of _XOPEN_SOURCE
 216  *
 217  * The following X/Open specifications are supported:
 218  *
 219  * X/Open Portability Guide, Issue 3 (XPG3)
 220  * X/Open CAE Specification, Issue 4 (XPG4)
 221  * X/Open CAE Specification, Issue 4, Version 2 (XPG4v2)
 222  * X/Open CAE Specification, Issue 5 (XPG5)
 223  * Open Group Technical Standard, Issue 6 (XPG6), also referred to as
 224  *    IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002.


 225  *
 226  * XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1).
 227  * XPG5 is also referred to as UNIX 98 or the Single Unix Specification,
 228  *     Version 2 (SUSv2)
 229  * XPG6 is the result of a merge of the X/Open and POSIX specifications
 230  *     and as such is also referred to as IEEE Std. 1003.1-2001 in
 231  *     addition to UNIX 03 and SUSv3.

 232  *
 233  * When writing a conforming X/Open application, as per the specification
 234  * requirements, the appropriate feature test macros must be defined at
 235  * compile time. These are as follows. For more info, see standards(5).
 236  *
 237  * Feature Test Macro                                Specification
 238  * ------------------------------------------------  -------------
 239  * _XOPEN_SOURCE                                         XPG3
 240  * _XOPEN_SOURCE && _XOPEN_VERSION = 4                   XPG4
 241  * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1           XPG4v2
 242  * _XOPEN_SOURCE = 500                                   XPG5
 243  * _XOPEN_SOURCE = 600  (or POSIX_C_SOURCE=200112L)      XPG6

 244  *
 245  * In order to simplify the guards within the headers, the following
 246  * implementation private test macros have been created. Applications
 247  * must NOT use these private test macros as unexpected results will
 248  * occur.
 249  *
 250  * Note that in general, the use of these private macros is cumulative.
 251  * For example, the use of _XPG3 with no other restrictions on the X/Open
 252  * namespace will make the symbols visible for XPG3 through XPG6
 253  * compilation environments. The use of _XPG4_2 with no other X/Open
 254  * namespace restrictions indicates that the symbols were introduced in
 255  * XPG4v2 and are therefore visible for XPG4v2 through XPG6 compilation
 256  * environments, but not for XPG3 or XPG4 compilation environments.
 257  *
 258  * _XPG3    X/Open Portability Guide, Issue 3 (XPG3)
 259  * _XPG4    X/Open CAE Specification, Issue 4 (XPG4)
 260  * _XPG4_2  X/Open CAE Specification, Issue 4, Version 2 (XPG4v2/UNIX 95/SUS)
 261  * _XPG5    X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2)
 262  * _XPG6    Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3)

 263  */
 264 
 265 /* X/Open Portability Guide, Issue 3 */
 266 #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
 267         (_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)
 268 #define _XPG3
 269 /* X/Open CAE Specification, Issue 4 */
 270 #elif   (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 == 4)
 271 #define _XPG4
 272 #define _XPG3
 273 /* X/Open CAE Specification, Issue 4, Version 2 */
 274 #elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
 275 #define _XPG4_2
 276 #define _XPG4
 277 #define _XPG3
 278 /* X/Open CAE Specification, Issue 5 */
 279 #elif   (_XOPEN_SOURCE - 0 == 500)
 280 #define _XPG5
 281 #define _XPG4_2
 282 #define _XPG4
 283 #define _XPG3
 284 #undef  _POSIX_C_SOURCE
 285 #define _POSIX_C_SOURCE                 199506L
 286 /* Open Group Technical Standard , Issue 6 */
 287 #elif   (_XOPEN_SOURCE - 0 == 600) || (_POSIX_C_SOURCE - 0 == 200112L)
 288 #define _XPG6
 289 #define _XPG5
 290 #define _XPG4_2
 291 #define _XPG4
 292 #define _XPG3
 293 #undef  _POSIX_C_SOURCE
 294 #define _POSIX_C_SOURCE                 200112L
 295 #undef  _XOPEN_SOURCE
 296 #define _XOPEN_SOURCE                   600













 297 #endif
 298 
 299 /*
 300  * _XOPEN_VERSION is defined by the X/Open specifications and is not
 301  * normally defined by the application, except in the case of an XPG4
 302  * application.  On the implementation side, _XOPEN_VERSION defined with
 303  * the value of 3 indicates an XPG3 application. _XOPEN_VERSION defined
 304  * with the value of 4 indicates an XPG4 or XPG4v2 (UNIX 95) application.
 305  * _XOPEN_VERSION  defined with a value of 500 indicates an XPG5 (UNIX 98)
 306  * application and with a value of 600 indicates an XPG6 (UNIX 03)
 307  * application.  The appropriate version is determined by the use of the

 308  * feature test macros described earlier.  The value of _XOPEN_VERSION
 309  * defaults to 3 otherwise indicating support for XPG3 applications.
 310  */
 311 #ifndef _XOPEN_VERSION
 312 #ifdef  _XPG6


 313 #define _XOPEN_VERSION 600
 314 #elif defined(_XPG5)
 315 #define _XOPEN_VERSION 500
 316 #elif   defined(_XPG4_2)
 317 #define _XOPEN_VERSION  4
 318 #else
 319 #define _XOPEN_VERSION  3
 320 #endif
 321 #endif
 322 
 323 /*
 324  * ANSI C and ISO 9899:1990 say the type long long doesn't exist in strictly
 325  * conforming environments.  ISO 9899:1999 says it does.
 326  *
 327  * The presence of _LONGLONG_TYPE says "long long exists" which is therefore
 328  * defined in all but strictly conforming environments that disallow it.
 329  */
 330 #if !defined(_STDC_C99) && defined(_STRICT_STDC) && !defined(__GNUC__)
 331 /*
 332  * Resist attempts to force the definition of long long in this case.




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright 2013 Garrett D'Amore <garrett@damore.org>
  28  */
  29 
  30 #ifndef _SYS_FEATURE_TESTS_H
  31 #define _SYS_FEATURE_TESTS_H
  32 
  33 #include <sys/ccompile.h>
  34 #include <sys/isa_defs.h>
  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 /*
  41  * Values of _POSIX_C_SOURCE
  42  *
  43  *              undefined   not a POSIX compilation
  44  *              1           POSIX.1-1990 compilation
  45  *              2           POSIX.2-1992 compilation
  46  *              199309L     POSIX.1b-1993 compilation (Real Time)
  47  *              199506L     POSIX.1c-1995 compilation (POSIX Threads)
  48  *              200112L     POSIX.1-2001 compilation (Austin Group Revision)
  49  *              200809L     POSIX.1-2008 compilation
  50  */
  51 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
  52 #define _POSIX_C_SOURCE 1
  53 #endif
  54 
  55 /*
  56  * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, _STRICT_SYMBOLS,
  57  * and _STDC_C99 are Sun implementation specific macros created in order to
  58  * compress common standards specified feature test macros for easier reading.
  59  * These macros should not be used by the application developer as
  60  * unexpected results may occur. Instead, the user should reference
  61  * standards(5) for correct usage of the standards feature test macros.
  62  *
  63  * __XOPEN_OR_POSIX     Used in cases where a symbol is defined by both
  64  *                      X/Open or POSIX or in the negative, when neither
  65  *                      X/Open or POSIX defines a symbol.
  66  *
  67  * _STRICT_STDC         __STDC__ is specified by the C Standards and defined
  68  *                      by the compiler. For Sun compilers the value of
  69  *                      __STDC__ is either 1, 0, or not defined based on the
  70  *                      compilation mode (see cc(1)). When the value of
  71  *                      __STDC__ is 1 and in the absence of any other feature
  72  *                      test macros, the namespace available to the application
  73  *                      is limited to only those symbols defined by the C
  74  *                      Standard. _STRICT_STDC provides a more readable means
  75  *                      of identifying symbols defined by the standard, or in
  76  *                      the negative, symbols that are extensions to the C
  77  *                      Standard. See additional comments for GNU C differences.
  78  *
  79  * _STDC_C99            __STDC_VERSION__ is specified by the C standards and
  80  *                      defined by the compiler and indicates the version of
  81  *                      the C standard. A value of 199901L indicates a
  82  *                      compiler that complies with ISO/IEC 9899:1999, other-
  83  *                      wise known as the C99 standard.
  84  *
  85  * _STRICT_SYMBOLS      Used in cases where symbol visibility is restricted
  86  *                      by the standards, and the user has not explicitly
  87  *                      relaxed the strictness via __EXTENSIONS__.
  88  */
  89 
  90 #if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
  91 #define __XOPEN_OR_POSIX
  92 #endif
  93 
  94 /*
  95  * ISO/IEC 9899:1990 and it's revision, ISO/IEC 9899:1999 specify the
  96  * following predefined macro name:
  97  *
  98  * __STDC__     The integer constant 1, intended to indicate a conforming
  99  *              implementation.
 100  *
 101  * Furthermore, a strictly conforming program shall use only those features
 102  * of the language and library specified in these standards. A conforming
 103  * implementation shall accept any strictly conforming program.
 104  *
 105  * Based on these requirements, Sun's C compiler defines __STDC__ to 1 for
 106  * strictly conforming environments and __STDC__ to 0 for environments that
 107  * use ANSI C semantics but allow extensions to the C standard. For non-ANSI


 135  * interpretations to peacefully co-exist, we use the following Sun
 136  * implementation _STRICT_STDC_ macro:
 137  */
 138 
 139 #if (__STDC__ - 0 == 1 && !defined(__GNUC__)) || \
 140         (defined(__GNUC__) && defined(__STRICT_ANSI__))
 141 #define _STRICT_STDC
 142 #else
 143 #undef  _STRICT_STDC
 144 #endif
 145 
 146 /*
 147  * Compiler complies with ISO/IEC 9899:1999
 148  */
 149 
 150 #if __STDC_VERSION__ - 0 >= 199901L
 151 #define _STDC_C99
 152 #endif
 153 
 154 /*
 155  * Use strict symbol visibility.
 156  */
 157 #if (defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)) && \
 158         !defined(__EXTENSIONS__)
 159 #define _STRICT_SYMBOLS
 160 #endif
 161 
 162 /*
 163  * Large file interfaces:
 164  *
 165  *      _LARGEFILE_SOURCE
 166  *              1               large file-related additions to POSIX
 167  *                              interfaces requested (fseeko, etc.)
 168  *      _LARGEFILE64_SOURCE
 169  *              1               transitional large-file-related interfaces
 170  *                              requested (seek64, stat64, etc.)
 171  *
 172  * The corresponding announcement macros are respectively:
 173  *      _LFS_LARGEFILE
 174  *      _LFS64_LARGEFILE
 175  * (These are set in <unistd.h>.)
 176  *
 177  * Requesting _LARGEFILE64_SOURCE implies requesting _LARGEFILE_SOURCE as
 178  * well.
 179  *
 180  * The large file interfaces are made visible regardless of the initial values
 181  * of the feature test macros under certain circumstances:
 182  *    - If no explicit standards-conforming environment is requested (neither


 221 #else   /* _LP64 */
 222 #ifndef _FILE_OFFSET_BITS
 223 #define _FILE_OFFSET_BITS       32
 224 #endif
 225 #if     _FILE_OFFSET_BITS - 0 != 32 && _FILE_OFFSET_BITS - 0 != 64
 226 #error  "invalid _FILE_OFFSET_BITS value specified"
 227 #endif
 228 #endif  /* _LP64 */
 229 
 230 /*
 231  * Use of _XOPEN_SOURCE
 232  *
 233  * The following X/Open specifications are supported:
 234  *
 235  * X/Open Portability Guide, Issue 3 (XPG3)
 236  * X/Open CAE Specification, Issue 4 (XPG4)
 237  * X/Open CAE Specification, Issue 4, Version 2 (XPG4v2)
 238  * X/Open CAE Specification, Issue 5 (XPG5)
 239  * Open Group Technical Standard, Issue 6 (XPG6), also referred to as
 240  *    IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002.
 241  * Open Group Technical Standard, Issue 7 (XPG7), also referred to as
 242  *    IEEE Std. 1003.1-2008 and ISO/IEC 9945:2009.
 243  *
 244  * XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1).
 245  * XPG5 is also referred to as UNIX 98 or the Single Unix Specification,
 246  *     Version 2 (SUSv2)
 247  * XPG6 is the result of a merge of the X/Open and POSIX specifications
 248  *     and as such is also referred to as IEEE Std. 1003.1-2001 in
 249  *     addition to UNIX 03 and SUSv3.
 250  * XPG7 is also referred to as UNIX 08 and SUSv4.
 251  *
 252  * When writing a conforming X/Open application, as per the specification
 253  * requirements, the appropriate feature test macros must be defined at
 254  * compile time. These are as follows. For more info, see standards(5).
 255  *
 256  * Feature Test Macro                                Specification
 257  * ------------------------------------------------  -------------
 258  * _XOPEN_SOURCE                                         XPG3
 259  * _XOPEN_SOURCE && _XOPEN_VERSION = 4                   XPG4
 260  * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1           XPG4v2
 261  * _XOPEN_SOURCE = 500                                   XPG5
 262  * _XOPEN_SOURCE = 600  (or POSIX_C_SOURCE=200112L)      XPG6
 263  * _XOPEN_SOURCE = 700  (or POSIX_C_SOURCE=200809L)      XPG7
 264  *
 265  * In order to simplify the guards within the headers, the following
 266  * implementation private test macros have been created. Applications
 267  * must NOT use these private test macros as unexpected results will
 268  * occur.
 269  *
 270  * Note that in general, the use of these private macros is cumulative.
 271  * For example, the use of _XPG3 with no other restrictions on the X/Open
 272  * namespace will make the symbols visible for XPG3 through XPG6
 273  * compilation environments. The use of _XPG4_2 with no other X/Open
 274  * namespace restrictions indicates that the symbols were introduced in
 275  * XPG4v2 and are therefore visible for XPG4v2 through XPG6 compilation
 276  * environments, but not for XPG3 or XPG4 compilation environments.
 277  *
 278  * _XPG3    X/Open Portability Guide, Issue 3 (XPG3)
 279  * _XPG4    X/Open CAE Specification, Issue 4 (XPG4)
 280  * _XPG4_2  X/Open CAE Specification, Issue 4, Version 2 (XPG4v2/UNIX 95/SUS)
 281  * _XPG5    X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2)
 282  * _XPG6    Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3)
 283  * _XPG7    Open Group Technical Standard, Issue 7 (XPG7/UNIX 08/SUSv4)
 284  */
 285 
 286 /* X/Open Portability Guide, Issue 3 */
 287 #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
 288         (_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)
 289 #define _XPG3
 290 /* X/Open CAE Specification, Issue 4 */
 291 #elif   (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 == 4)
 292 #define _XPG4
 293 #define _XPG3
 294 /* X/Open CAE Specification, Issue 4, Version 2 */
 295 #elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
 296 #define _XPG4_2
 297 #define _XPG4
 298 #define _XPG3
 299 /* X/Open CAE Specification, Issue 5 */
 300 #elif   (_XOPEN_SOURCE - 0 == 500)
 301 #define _XPG5
 302 #define _XPG4_2
 303 #define _XPG4
 304 #define _XPG3
 305 #undef  _POSIX_C_SOURCE
 306 #define _POSIX_C_SOURCE                 199506L
 307 /* Open Group Technical Standard , Issue 6 */
 308 #elif   (_XOPEN_SOURCE - 0 == 600) || (_POSIX_C_SOURCE - 0 == 200112L)
 309 #define _XPG6
 310 #define _XPG5
 311 #define _XPG4_2
 312 #define _XPG4
 313 #define _XPG3
 314 #undef  _POSIX_C_SOURCE
 315 #define _POSIX_C_SOURCE                 200112L
 316 #undef  _XOPEN_SOURCE
 317 #define _XOPEN_SOURCE                   600
 318 
 319 /* Open Group Technical Standard, Issue 7 */
 320 #elif   (_XOPEN_SOURCE - 0 == 700) || (_POSIX_C_SOURCE - 0 == 200809L)
 321 #define _XPG7
 322 #define _XPG6
 323 #define _XPG5
 324 #define _XPG4_2
 325 #define _XPG4
 326 #define _XPG3
 327 #undef  _POSIX_C_SOURCE
 328 #define _POSIX_C_SOURCE                 200809L
 329 #undef  _XOPEN_SOURCE
 330 #define _XOPEN_SOURCE                   700
 331 #endif
 332 
 333 /*
 334  * _XOPEN_VERSION is defined by the X/Open specifications and is not
 335  * normally defined by the application, except in the case of an XPG4
 336  * application.  On the implementation side, _XOPEN_VERSION defined with
 337  * the value of 3 indicates an XPG3 application. _XOPEN_VERSION defined
 338  * with the value of 4 indicates an XPG4 or XPG4v2 (UNIX 95) application.
 339  * _XOPEN_VERSION  defined with a value of 500 indicates an XPG5 (UNIX 98)
 340  * application and with a value of 600 indicates an XPG6 (UNIX 03)
 341  * application and with a value of 700 indicates an XPG7 (UNIX 08).
 342  * The appropriate version is determined by the use of the
 343  * feature test macros described earlier.  The value of _XOPEN_VERSION
 344  * defaults to 3 otherwise indicating support for XPG3 applications.
 345  */
 346 #ifndef _XOPEN_VERSION
 347 #if     defined(_XPG7)
 348 #define _XOPEN_VERSION 700
 349 #elif   defined(_XPG6)
 350 #define _XOPEN_VERSION 600
 351 #elif defined(_XPG5)
 352 #define _XOPEN_VERSION 500
 353 #elif   defined(_XPG4_2)
 354 #define _XOPEN_VERSION  4
 355 #else
 356 #define _XOPEN_VERSION  3
 357 #endif
 358 #endif
 359 
 360 /*
 361  * ANSI C and ISO 9899:1990 say the type long long doesn't exist in strictly
 362  * conforming environments.  ISO 9899:1999 says it does.
 363  *
 364  * The presence of _LONGLONG_TYPE says "long long exists" which is therefore
 365  * defined in all but strictly conforming environments that disallow it.
 366  */
 367 #if !defined(_STDC_C99) && defined(_STRICT_STDC) && !defined(__GNUC__)
 368 /*
 369  * Resist attempts to force the definition of long long in this case.