1
// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and
2
// distribute this software is granted provided this copyright notice appears
3
// in all copies. This software is provided "as is" without express or implied
4
// warranty, and with no claim as to its suitability for any purpose.
6
// See http://www.boost.org for most recent version.
8
// All POSIX feature tests go in this file,
9
// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well
10
// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's
11
// may be present but none-functional unless _POSIX_C_SOURCE and
12
// _XOPEN_SOURCE have been defined to the right value (it's up
13
// to the user to do this *before* including any header, although
14
// in most cases the compiler will do this for you).
16
# if defined(BOOST_HAS_UNISTD_H)
19
// XOpen has <nl_types.h>, but is this the correct version check?
20
# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3)
21
# define BOOST_HAS_NL_TYPES_H
24
// POSIX version 6 requires <stdint.h>
25
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
26
# define BOOST_HAS_STDINT_H
29
// POSIX version 2 requires <dirent.h>
30
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
31
# define BOOST_HAS_DIRENT_H
34
// POSIX version 3 requires <signal.h> to have sigaction:
35
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
36
# define BOOST_HAS_SIGACTION
38
// POSIX defines _POSIX_THREADS > 0 for pthread support,
39
// however some platforms define _POSIX_THREADS without
40
// a value, hence the (_POSIX_THREADS+0 >= 0) check.
41
// Strictly speaking this may catch platforms with a
42
// non-functioning stub <pthreads.h>, but such occurrences should
43
// occur very rarely if at all.
44
# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS)
45
# define BOOST_HAS_PTHREADS
48
// BOOST_HAS_NANOSLEEP:
49
// This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME:
50
# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \
51
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
52
# define BOOST_HAS_NANOSLEEP
55
// BOOST_HAS_CLOCK_GETTIME:
56
// This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME
57
// but at least one platform - linux - defines that flag without
58
// defining clock_gettime):
59
# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0))
60
# define BOOST_HAS_CLOCK_GETTIME
63
// BOOST_HAS_SCHED_YIELD:
64
// This is predicated on _POSIX_PRIORITY_SCHEDULING or
65
// on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME.
66
# if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\
67
|| (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
68
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
69
# define BOOST_HAS_SCHED_YIELD
72
// BOOST_HAS_GETTIMEOFDAY:
73
// BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
74
// These are predicated on _XOPEN_VERSION, and appears to be first released
75
// in issue 4, version 2 (_XOPEN_VERSION > 500).
76
# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
77
# define BOOST_HAS_GETTIMEOFDAY
78
# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
79
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE