source: NonGTP/Boost/boost/config/posix_features.hpp @ 857

Revision 857, 3.5 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1//  (C) Copyright John Maddock 2001 - 2003.
2//  Use, modification and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6
7//  See http://www.boost.org for most recent version.
8
9// All POSIX feature tests go in this file,
10// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well
11// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's
12// may be present but none-functional unless _POSIX_C_SOURCE and
13// _XOPEN_SOURCE have been defined to the right value (it's up
14// to the user to do this *before* including any header, although
15// in most cases the compiler will do this for you).
16
17#  if defined(BOOST_HAS_UNISTD_H)
18#     include <unistd.h>
19
20      // XOpen has <nl_types.h>, but is this the correct version check?
21#     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3)
22#        define BOOST_HAS_NL_TYPES_H
23#     endif
24
25      // POSIX version 6 requires <stdint.h>
26#     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
27#        define BOOST_HAS_STDINT_H
28#     endif
29
30      // POSIX version 2 requires <dirent.h>
31#     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
32#        define BOOST_HAS_DIRENT_H
33#     endif
34
35      // POSIX version 3 requires <signal.h> to have sigaction:
36#     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
37#        define BOOST_HAS_SIGACTION
38#     endif
39      // POSIX defines _POSIX_THREADS > 0 for pthread support,
40      // however some platforms define _POSIX_THREADS without
41      // a value, hence the (_POSIX_THREADS+0 >= 0) check.
42      // Strictly speaking this may catch platforms with a
43      // non-functioning stub <pthreads.h>, but such occurrences should
44      // occur very rarely if at all.
45#     if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS)
46#        define BOOST_HAS_PTHREADS
47#     endif
48
49      // BOOST_HAS_NANOSLEEP:
50      // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME:
51#     if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \
52             || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
53#        define BOOST_HAS_NANOSLEEP
54#     endif
55
56      // BOOST_HAS_CLOCK_GETTIME:
57      // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME
58      // but at least one platform - linux - defines that flag without
59      // defining clock_gettime):
60#     if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0))
61#        define BOOST_HAS_CLOCK_GETTIME
62#     endif
63
64      // BOOST_HAS_SCHED_YIELD:
65      // This is predicated on _POSIX_PRIORITY_SCHEDULING or
66      // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME.
67#     if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\
68            || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
69            || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
70#        define BOOST_HAS_SCHED_YIELD
71#     endif
72
73      // BOOST_HAS_GETTIMEOFDAY:
74      // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
75      // These are predicated on _XOPEN_VERSION, and appears to be first released
76      // in issue 4, version 2 (_XOPEN_VERSION > 500).
77#     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
78#        define BOOST_HAS_GETTIMEOFDAY
79#        if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
80#           define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
81#        endif
82#     endif
83
84#  endif
85
86
87
Note: See TracBrowser for help on using the repository browser.