/usr/include/sys/feature_tests.h


    1 /*
    2  * Copyright (c) 1993-1999, by Sun Microsystems, Inc.
    3  * All Rights Reserved
    4  */
    5 
    6 /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SMI	*/
    7 /*	The copyright notice above does not evidence any   	*/
    8 /*	actual or intended publication of such source code.	*/
    9 
   10 #ifndef _SYS_FEATURE_TESTS_H
   11 #define	_SYS_FEATURE_TESTS_H
   12 
   13 #pragma ident	"@(#)feature_tests.h	1.18	99/07/26 SMI"
   14 
   15 #include <sys/isa_defs.h>
   16 
   17 #ifdef	__cplusplus
   18 extern "C" {
   19 #endif
   20 
   21 /*
   22  * 	Values of _POSIX_C_SOURCE
   23  *
   24  *		undefined	not a POSIX compilation
   25  *			1	POSIX.1-1990 compilation
   26  *			2	POSIX.2-1992 compilation
   27  *		  199309L	POSIX.1b-1993 compilation (Real Time)
   28  *		  199506L	POSIX.1c-1995 compilation (POSIX Threads)
   29  */
   30 #if	defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
   31 #define	_POSIX_C_SOURCE	1
   32 #endif
   33 
   34 /*
   35  * Large file interfaces:
   36  *
   37  *	_LARGEFILE_SOURCE
   38  *		1		large file-related additions to POSIX
   39  *				interfaces requested (fseeko, etc.)
   40  *	_LARGEFILE64_SOURCE
   41  *		1		transitional large-file-related interfaces
   42  *				requested (seek64, stat64, etc.)
   43  *
   44  * The corresponding announcement macros are respectively:
   45  *	_LFS_LARGEFILE
   46  *	_LFS64_LARGEFILE
   47  * (These are set in <unistd.h>.)
   48  *
   49  * Requesting _LARGEFILE64_SOURCE implies requesting _LARGEFILE_SOURCE as
   50  * well.
   51  *
   52  * The large file interfaces are made visible regardless of the initial values
   53  * of the feature test macros under certain circumstances:
   54  *    -	If no explicit standards-conformant environment is requested (neither
   55  *	of _POSIX_SOURCE nor _XOPEN_SOURCE is defined and the value of
   56  *	__STDC__ does not imply standards conformance).
   57  *    -	Extended system interfaces are explicitly requested (__EXTENSIONS__
   58  * 	is defined).
   59  *    -	Access to in-kernel interfaces is requested (_KERNEL or _KMEMUSER is
   60  *	defined).  (Note that this dependency is an artifact of the current
   61  *	kernel implementation and may change in future releases.)
   62  */
   63 #if 	((__STDC__ - 0 == 0) && \
   64 		!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
   65 		defined(_KERNEL) || defined(_KMEMUSER) || \
   66 		defined(__EXTENSIONS__)
   67 #undef	_LARGEFILE64_SOURCE
   68 #define	_LARGEFILE64_SOURCE	1
   69 #endif
   70 #if	_LARGEFILE64_SOURCE - 0 == 1
   71 #undef	_LARGEFILE_SOURCE
   72 #define	_LARGEFILE_SOURCE	1
   73 #endif
   74 
   75 /*
   76  * Large file compilation environment control:
   77  *
   78  * The setting of _FILE_OFFSET_BITS controls the size of various file-related
   79  * types and governs the mapping between file-related source function symbol
   80  * names and the corresponding binary entry points.
   81  *
   82  * In the 32-bit environment, the default value is 32; if not set, set it to
   83  * the default here, to simplify tests in other headers.
   84  *
   85  * In the 64-bit compilation environment, the only value allowed is 64.
   86  */
   87 #if defined(_LP64)
   88 #ifndef _FILE_OFFSET_BITS
   89 #define	_FILE_OFFSET_BITS	64
   90 #endif
   91 #if	_FILE_OFFSET_BITS - 0 != 64
   92 #error	"invalid _FILE_OFFSET_BITS value specified"
   93 #endif
   94 #else	/* _LP64 */
   95 #ifndef	_FILE_OFFSET_BITS
   96 #define	_FILE_OFFSET_BITS	32
   97 #endif
   98 #if	_FILE_OFFSET_BITS - 0 != 32 && _FILE_OFFSET_BITS - 0 != 64
   99 #error	"invalid _FILE_OFFSET_BITS value specified"
  100 #endif
  101 #endif	/* _LP64 */
  102 
  103 /*
  104  * UNIX 95 implementation
  105  *
  106  * As specified in the following X/Open specifications:
  107  *
  108  *   System Interfaces and Headers, Issue 4, Version 2
  109  *   Commands and Utilities, Issue 4, Version 2
  110  *   Networking Services, Issue 4
  111  *   X/Open Curses, Issue 4
  112  *
  113  * application writers wishing to use any functions specified
  114  * as X/Open UNIX Extension must define _XOPEN_SOURCE and
  115  * _XOPEN_SOURCE_EXTENDED=1.  The Sun internal macro _XPG4_2
  116  * should not be used in its place as unexpected results may
  117  * occur.
  118  */
  119 #if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
  120 #define	_XPG4_2
  121 #endif
  122 
  123 /*
  124  * UNIX 98 implementation
  125  *
  126  * As specified in the following X/Open specfications:
  127  *
  128  *   System Interfaces and Headers, Issue 5
  129  *   Commands and Utilities, Issue 5
  130  *   Networking Services, Issue 5
  131  *   X/Open Curses, Issue 4, Version 2
  132  *
  133  * application writers wishing to utilize UNIX 98 functionality
  134  * must define _XOPEN_SOURCE=500.  This turns on UNIX 95 functionality
  135  * which is a subset of UNIX 98, and also turns on POSIX Realtime and
  136  * POSIX Threads functionality.
  137  */
  138 #if (_XOPEN_SOURCE - 0 == 500)
  139 #define	_XPG5
  140 #define	_XPG4_2
  141 #undef	_POSIX_C_SOURCE
  142 #define	_POSIX_C_SOURCE			199506L
  143 #define	_POSIX_PTHREAD_SEMANTICS	1
  144 #endif
  145 
  146 /*
  147  * _XOPEN_VERSION defined with the value of 3 indicates an XPG3
  148  * application.  _XOPEN_VERSION defined with the value of 4
  149  * indicates an XPG4 or XPG4v2 application.  _XOPEN_VERSION defined
  150  * with a value of 500 indicates a XSH5 (UNIX 98) application. The
  151  * appropriate version of XPG is indicated by use of the following
  152  * macros:
  153  *
  154  * _XOPEN_SOURCE				XPG, Issue 3
  155  * _XOPEN_SOURCE && _XOPEN_VERSION = 4		XPG, Issue 4
  156  * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1	XPG, Issue 4, Version 2 (XPG4v2)
  157  * _XOPEN_SOURCE = 500				XPG, Issue 5
  158  *
  159  * Defining both _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED = 1 will
  160  * automatically define _XOPEN_VERSION = 4.
  161  */
  162 #ifndef	_XOPEN_VERSION
  163 #ifdef	_XPG5
  164 #define	_XOPEN_VERSION 500
  165 #else
  166 #ifdef	_XPG4_2
  167 #define	_XOPEN_VERSION	4
  168 #else
  169 #define	_XOPEN_VERSION	3
  170 #endif
  171 #endif
  172 #endif
  173 
  174 /*
  175  * The following macro indicates header support for the ANSI C++
  176  * standard.  The ISO/IEC designation for this is ISO/IEC FDIS 14882.
  177  */
  178 #define	_ISO_CPP_14882_1998
  179 
  180 #ifdef	__cplusplus
  181 }
  182 #endif
  183 
  184 #endif	/* _SYS_FEATURE_TESTS_H */