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