home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / unixlib / h / features < prev    next >
Encoding:
Text File  |  2004-09-05  |  15.4 KB  |  471 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/unixlib/features.h,v $
  4.  * $Date: 2004/08/08 11:32:41 $
  5.  * $Revision: 1.17 $
  6.  * $State: Exp $
  7.  * $Author: peter $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* The header file <unixlib/features.h> contains test macros for optionally
  12.    turning on/off certain features that the library provides or integrity
  13.    checks.  */
  14.  
  15. /* This file is derived from GNU Libc 2.2.4, features.h  We are attempting
  16.    to closely match the macros defined within it in order to maintain
  17.    a decent level of compatibility.  A desire to do this forces me to
  18.    include the following license:
  19.  
  20.    Copyright (C) 1992,93,94,95,96,97,98,99, 2000 Free Software Foundation, Inc.
  21.    This file is part of the GNU C Library.
  22.  
  23.    The GNU C Library is free software; you can redistribute it and/or
  24.    modify it under the terms of the GNU Library General Public License as
  25.    published by the Free Software Foundation; either version 2 of the
  26.    License, or (at your option) any later version.
  27.  
  28.    The GNU C Library is distributed in the hope that it will be useful,
  29.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  30.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  31.    Library General Public License for more details.
  32.  
  33.    You should have received a copy of the GNU Library General Public
  34.    License along with the GNU C Library; see the file COPYING.LIB.  If not,
  35.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  36.    Boston, MA 02111-1307, USA.  */
  37.  
  38. #ifndef __UNIXLIB_FEATURES_H
  39. #define __UNIXLIB_FEATURES_H 1
  40.  
  41.  
  42. /* These are defined by the user (or the compiler)
  43.    to specify the desired environment:
  44.  
  45.    __STRICT_ANSI__      ISO Standard C.
  46.    _ISOC99_SOURCE       Extensions to ISO C89 from ISO C99.
  47.    _POSIX_SOURCE        IEEE Std 1003.1.
  48.    _POSIX_C_SOURCE      If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
  49.                         if >=199309L, add IEEE Std 1003.1b-1993;
  50.                         if >=199506L, add IEEE Std 1003.1c-1995
  51.    _XOPEN_SOURCE        Includes POSIX and XPG things.  Set to 500 if
  52.                         Single Unix conformance is wanted, to 600 for the
  53.                         upcoming sixth revision.
  54.    _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
  55.    _LARGEFILE_SOURCE    Some more functions for correct standard I/O.
  56.    _LARGEFILE64_SOURCE  Additional functionality from LFS for large files.
  57.    _FILE_OFFSET_BITS=N  Select default filesystem interface.
  58.    _BSD_SOURCE          ISO C, POSIX, and 4.3BSD things.
  59.    _SVID_SOURCE         ISO C, POSIX, and SVID things.
  60.    _GNU_SOURCE          All of the above, plus GNU extensions.
  61.    _REENTRANT           Select additionally reentrant object.
  62.    _THREAD_SAFE         Same as _REENTRANT, often used by other systems.
  63.  
  64.    The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
  65.    If none of these are defined, the default is to have _SVID_SOURCE,
  66.    _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
  67.    199506L.  If more than one of these are defined, they accumulate.
  68.    For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
  69.    together give you ISO C, 1003.1, and 1003.2, but nothing else.
  70.  
  71.    These are defined by this file and are used by the
  72.    header files to decide what to declare or define:
  73.  
  74.    __USE_ISOC99         Define ISO C99 things.
  75.    __USE_POSIX          Define IEEE Std 1003.1 things.
  76.    __USE_POSIX2         Define IEEE Std 1003.2 things.
  77.    __USE_POSIX199309    Define IEEE Std 1003.1, and .1b things.
  78.    __USE_POSIX199506    Define IEEE Std 1003.1, .1b, .1c and .1i things.
  79.    __USE_XOPEN          Define XPG things.
  80.    __USE_XOPEN_EXTENDED Define X/Open Unix things.
  81.    __USE_UNIX98         Define Single Unix V2 things.
  82.    __USE_XOPEN2K        Define XPG6 things.
  83.    __USE_LARGEFILE      Define correct standard I/O things.
  84.    __USE_LARGEFILE64    Define LFS things with separate names.
  85.    __USE_FILE_OFFSET64  Define 64bit interface as default.
  86.    __USE_BSD            Define 4.3BSD things.
  87.    __USE_SVID           Define SVID things.
  88.    __USE_MISC           Define things common to BSD and System V Unix.
  89.    __USE_GNU            Define GNU extensions.
  90.    __USE_REENTRANT      Define reentrant/thread-safe *_r functions.
  91.    __FAVOR_BSD          Favor 4.3BSD things in cases of conflict.
  92.  
  93.    The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
  94.    defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
  95.    only for compatibility.  All new code should use the other symbols
  96.    to test for features.
  97.  
  98.    All macros listed above as possibly being defined by this file are
  99.    explicitly undefined if they are not explicitly defined.
  100.    Feature-test macros that are not defined by the user or compiler
  101.    but are implied by the other feature-test macros defined (or by the
  102.    lack of any definitions) are defined by the file.  */
  103.  
  104.  
  105. /* Undefine everything, so we get a clean slate.  */
  106. #undef  __USE_ISOC99
  107. #undef  __USE_POSIX
  108. #undef  __USE_POSIX2
  109. #undef  __USE_POSIX199309
  110. #undef  __USE_POSIX199506
  111. #undef  __USE_XOPEN
  112. #undef  __USE_XOPEN_EXTENDED
  113. #undef  __USE_UNIX98
  114. #undef  __USE_XOPEN2K
  115. #undef  __USE_LARGEFILE
  116. #undef  __USE_LARGEFILE64
  117. #undef  __USE_FILE_OFFSET64
  118. #undef  __USE_BSD
  119. #undef  __USE_SVID
  120. #undef  __USE_MISC
  121. #undef  __USE_GNU
  122. #undef  __USE_REENTRANT
  123. #undef  __FAVOR_BSD
  124. #undef  __KERNEL_STRICT_NAMES
  125.  
  126. /* This will reduce the number of Norcroft compiler warnings "Undefined macro
  127.    'xxx' in #if - treated as 0".  */
  128. #ifdef __CC_NORCROFT
  129. # ifndef __STDC_VERSION__
  130. #  define __STDC_VERSION__       199409L
  131. # endif
  132. # ifndef _ISOC99_SOURCE
  133. #  define _ISOC99_SOURCE         1
  134. # endif
  135. # ifndef _POSIX_SOURCE
  136. #  define _POSIX_SOURCE          1
  137. # endif
  138. # ifndef _POSIX_C_SOURCE
  139. #  define _POSIX_C_SOURCE        199506L
  140. # endif
  141. # ifndef _XOPEN_SOURCE
  142. #  define _XOPEN_SOURCE          500
  143. # endif
  144. # ifndef _XOPEN_SOURCE_EXTENDED
  145. #  define _XOPEN_SOURCE_EXTENDED 1
  146. # endif
  147. # ifndef _LARGEFILE64_SOURCE
  148. #  define _LARGEFILE64_SOURCE    1
  149. # endif
  150. # ifndef _BSD_SOURCE
  151. #  define _BSD_SOURCE            1
  152. # endif
  153. # ifndef _SVID_SOURCE
  154. #  define _SVID_SOURCE           1
  155. # endif
  156. # ifndef _FILE_OFFSET_BITS
  157. #  define _FILE_OFFSET_BITS      32
  158. # endif
  159. #endif
  160.  
  161. #ifdef __UNIXLIB_INTERNALS
  162. # define __GNU_LIBRARY__
  163. #endif
  164.  
  165. /* A lot of GNU glibc code is depending on this. I don't know if it is
  166.    a good idea to define this here:  */
  167. #undef BSD
  168. #define BSD    199103
  169.  
  170. /* Always use ISO C things.  */
  171. #define    __USE_ANSI    1
  172.  
  173.  
  174. /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX.  */
  175. #if defined _BSD_SOURCE && \
  176.     !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
  177.       defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
  178.       defined _GNU_SOURCE || defined _SVID_SOURCE)
  179. # define __FAVOR_BSD    1
  180. #endif
  181.  
  182. /* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
  183. #ifdef _GNU_SOURCE
  184. # undef  _ISOC99_SOURCE
  185. # define _ISOC99_SOURCE 1
  186. # undef  _POSIX_SOURCE
  187. # define _POSIX_SOURCE  1
  188. # undef  _POSIX_C_SOURCE
  189. # define _POSIX_C_SOURCE        199506L
  190. # undef  _XOPEN_SOURCE
  191. # define _XOPEN_SOURCE  600
  192. # undef  _XOPEN_SOURCE_EXTENDED
  193. # define _XOPEN_SOURCE_EXTENDED 1
  194. # undef  _LARGEFILE64_SOURCE
  195. # define _LARGEFILE64_SOURCE    1
  196. # undef  _BSD_SOURCE
  197. # define _BSD_SOURCE    1
  198. # undef  _SVID_SOURCE
  199. # define _SVID_SOURCE   1
  200. #endif
  201.  
  202. /* If nothing (other than _GNU_SOURCE) is defined,
  203.    define _BSD_SOURCE and _SVID_SOURCE.  */
  204. #if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
  205.      !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
  206.      !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
  207.      !defined _BSD_SOURCE && !defined _SVID_SOURCE)
  208. # define _BSD_SOURCE    1
  209. # define _SVID_SOURCE   1
  210. #endif
  211.  
  212. /* This is to enable the ISO C99 extension.  Also recognize the old macro
  213.    which was used prior to the standard acceptance.  This macro will
  214.    eventually go away and the features enabled by default once the ISO C99
  215.    standard is widely adopted.  */
  216. #if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
  217.      || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
  218. # define __USE_ISOC99   1
  219. #endif
  220.  
  221. /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
  222.    (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined).  */
  223. #if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
  224.      !defined _POSIX_C_SOURCE)
  225. # define _POSIX_SOURCE  1
  226. # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
  227. #  define _POSIX_C_SOURCE       2
  228. # else
  229. #  define _POSIX_C_SOURCE       199506L
  230. # endif
  231. #endif
  232.  
  233. #if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
  234. # define __USE_POSIX    1
  235. #endif
  236.  
  237. #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
  238. # define __USE_POSIX2    1
  239. #endif
  240.  
  241. #if (_POSIX_C_SOURCE - 0) >= 199309L
  242. # define __USE_POSIX199309    1
  243. #endif
  244.  
  245. #if (_POSIX_C_SOURCE - 0) >= 199506L
  246. # define __USE_POSIX199506    1
  247. #endif
  248.  
  249. #if (_POSIX_C_SOURCE - 0) >= 200112L
  250. # define __USE_XOPEN2K        1
  251. #endif
  252.  
  253. #ifdef  _XOPEN_SOURCE
  254. # define __USE_XOPEN    1
  255. # if (_XOPEN_SOURCE - 0) >= 500
  256. #  define __USE_XOPEN_EXTENDED  1
  257. #  define __USE_UNIX98  1
  258. #  undef _LARGEFILE_SOURCE
  259. #  define _LARGEFILE_SOURCE     1
  260. #  if (_XOPEN_SOURCE - 0) >= 600
  261. #   define __USE_XOPEN2K        1
  262. #   undef __USE_ISOC99
  263. #   define __USE_ISOC99         1
  264. #  endif
  265. # else
  266. #  ifdef _XOPEN_SOURCE_EXTENDED
  267. #   define __USE_XOPEN_EXTENDED 1
  268. #  endif
  269. # endif
  270. #endif
  271.  
  272. #ifdef _LARGEFILE_SOURCE
  273. # define __USE_LARGEFILE        1
  274. #endif
  275.  
  276. #ifdef _LARGEFILE64_SOURCE
  277. # define __USE_LARGEFILE64      1
  278. #endif
  279.  
  280. #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
  281. # define __USE_FILE_OFFSET64    1
  282. #endif
  283.  
  284. #if defined _BSD_SOURCE || defined _SVID_SOURCE
  285. # define __USE_MISC     1
  286. #endif
  287.  
  288. #ifdef  _BSD_SOURCE
  289. # define __USE_BSD      1
  290. #endif
  291.  
  292. #ifdef  _SVID_SOURCE
  293. # define __USE_SVID     1
  294. #endif
  295.  
  296. #ifdef  _GNU_SOURCE
  297. # define __USE_GNU      1
  298. #endif
  299.  
  300. #if defined _REENTRANT || defined _THREAD_SAFE
  301. # define __USE_REENTRANT        1
  302. #endif
  303.  
  304. /* We do support the IEC 559 math functionality, real and complex.  */
  305. #define __STDC_IEC_559__                1
  306. #define __STDC_IEC_559_COMPLEX__        1
  307.  
  308. /* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.0.  */
  309. //#define __STDC_ISO_10646__              200009L
  310.  
  311.  
  312. /* Major and minor version number of the UnixLib C library package.  Use
  313.    these macros to test for features in specific releases.  */
  314. #define __ULIBC__       4
  315. #define __ULIBC_MINOR__ 0
  316.  
  317. /* Convenience macros to test the versions of glibc and gcc.
  318.    Use them like this:
  319.    #if __GNUC_PREREQ (2,8)
  320.    ... code requiring gcc 2.8 or later ...
  321.    #endif
  322.    Note - they won't work for gcc1 or glibc1, since the _MINOR macros
  323.    were not defined then.  */
  324. #if defined __GNUC__ && defined __GNUC_MINOR__
  325. # define __GNUC_PREREQ(maj, min) \
  326.     ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  327. #else
  328. # define __GNUC_PREREQ(maj, min) 0
  329. #endif
  330.  
  331. #define __GLIBC_PREREQ(maj, min) \
  332.     ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
  333.  
  334. /* Decide whether a compiler supports the long long datatypes.  */
  335. #if defined __GNUC__ \
  336.     || (defined __PGI && defined __i386__ ) \
  337.     || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
  338.     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
  339. # define __GLIBC_HAVE_LONG_LONG    1
  340. #endif
  341.  
  342. /* This is here only because every header file already includes this one.  */
  343. #ifndef __ASSEMBLER__
  344. # ifndef _SYS_CDEFS_H
  345. #  include <sys/cdefs.h>
  346. # endif
  347.  
  348. /* If we don't have __REDIRECT, prototypes will be missing if
  349.    __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
  350. # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
  351. #  define __USE_LARGEFILE    1
  352. #  define __USE_LARGEFILE64    1
  353. # endif
  354.  
  355. #endif    /* !ASSEMBLER */
  356.  
  357. /* Decide whether we can define 'extern inline' functions in headers.  */
  358. #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
  359.     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
  360. # define __USE_EXTERN_INLINES    1
  361. #endif
  362.  
  363.  
  364. /* This is here only because every header file already includes this one.
  365.    Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
  366.    <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
  367.    that will always return failure (and set errno to ENOSYS).  */
  368. #include <unixlib/stubs.h>
  369.  
  370.  
  371. /* These macros should be kept in sync with clib.unixlib.s.asm_dec.  */
  372.  
  373. /* Define this if alloca() should call abort() if no memory can be
  374.    allocated.  */
  375. #define __ALLOCA_FATAL
  376.  
  377. /* Define if function call references through the dev structure should
  378.    be first checked that their pointer is valid.  */
  379. #undef __PARANOID
  380.  
  381. /* Define if support for dynamic areas on RISC OS 3.5+ should be compiled
  382.    in.  */
  383. #ifndef __DYNAMIC_AREA
  384. #define __DYNAMIC_AREA 1
  385. #endif
  386.  
  387. /* Amount to align the wimpslot or dynamic area. */
  388. #define __DA_WIMPSLOT_ALIGNMENT (32*1024-1)
  389.  
  390. #undef __USEFILEPATH
  391.  
  392. /* Define if library functions should check certain parameters for their
  393.    validness.  Undefining will remove these consistency checks.  */
  394. #ifndef __INTEGRITY_CHECK
  395. #define __INTEGRITY_CHECK 1
  396. #endif
  397.  
  398. /* Define if we want to support POSIX interval timers.  */
  399. #ifndef __FEATURE_ITIMERS
  400. #define __FEATURE_ITIMERS 1
  401. #endif
  402.  
  403. /* Define if we want Unix socket support.  */
  404. #ifndef __FEATURE_SOCKET
  405. #define __FEATURE_SOCKET 1
  406. #endif
  407.  
  408. /* Define if we want support for pipes.  */
  409. #ifndef __FEATURE_PIPEDEV
  410. #define __FEATURE_PIPEDEV 1
  411. #endif
  412.  
  413. /* Define for support of /dev/rs423.  */
  414. #ifndef __FEATURE_DEV_RS423
  415. #define __FEATURE_DEV_RS423 1
  416. #endif
  417.  
  418. /* Don't want any compatibility with Internet 4 */
  419. #undef COMPAT_INET4
  420.  
  421. /* Define for support for pthreads.  */
  422. #ifndef __FEATURE_PTHREADS
  423. #define __FEATURE_PTHREADS 1
  424. #endif
  425.  
  426. /* Default to recognising Image filesystems as directories.  Some programs
  427.    may wish to expose them as files for the purpose of compression
  428.    or direct manipulation of the contents.  Set to one in this case.  */
  429. extern int __feature_imagefs_is_file; /* Note: this is a weak symbol.  */
  430.  
  431. #ifdef __UNIXLIB_INTERNALS
  432.  
  433. /* This is not yet supported by our GCC version but used by glibc 2.2.5.  */
  434. #define __builtin_expect(exp, c)  (exp)
  435.  
  436. /* Gets the __feature_imagefs_is_file value which can be defined by
  437.    the global variable __feature_imagefs_is_file in the user program.
  438.    Returns a copy of __feature_imagefs_is_file_internal (its default
  439.    value is 0) when __feature_imagefs_is_file is not defined.  */
  440. extern int __get_feature_imagefs_is_file (void);
  441. #if 0
  442. /* Currently the code __set_feature_imagefs_is_file commented out because
  443.    we don't need it in UnixLib internally.  */
  444.  
  445. /* Sets the __feature_imagefs_is_file value when it's defined.
  446.    Otherwise __feature_imagefs_is_file_internal gets written.  */
  447. extern void __set_feature_imagefs_is_file (int __feature_imagefs_is_file_value);
  448. #endif
  449.  
  450. #endif  /* __UNIXLIB_INTERNALS */
  451.  
  452. /* When defined, the memory pool will be created in the WimpSlot area
  453.    instead of a dynamic area (on RISC OS versions supporting dynamic
  454.    areas). Its value is unimportant.  */
  455. extern int __dynamic_no_da; /* Note: this is a weak symbol.  */
  456.  
  457. /* When a dynamic area is created as memory pool, __dynamic_da_name can
  458.    be used to specify its name.  When this variable is not defined, the
  459.    dynamic area name will be <program name> + "$Heap".  */
  460. extern const char *__dynamic_da_name; /* Note: this is a weak symbol.  */
  461.  
  462. /* When defined, indicates the maximum size in bytes of the dynamic area
  463.    used for the heap. If undefined, Unixlib defaults to 32MB */
  464. extern int __dynamic_da_max_size; /* Note: this is a weak symbol */
  465.  
  466. #ifndef __SYS_CDEFS_H
  467. # include <sys/cdefs.h>
  468. #endif
  469.  
  470. #endif
  471.