blob: 72cc724856f205816e01a35469e3f2c69aae49a5 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// (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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017# if defined(NDNBOOST_HAS_UNISTD_H)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070018# 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)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070022# define NDNBOOST_HAS_NL_TYPES_H
Jeff Thompsonf7d49942013-08-01 16:47:40 -070023# endif
24
25 // POSIX version 6 requires <stdint.h>
26# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070027# define NDNBOOST_HAS_STDINT_H
Jeff Thompsonf7d49942013-08-01 16:47:40 -070028# endif
29
30 // POSIX version 2 requires <dirent.h>
31# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032# define NDNBOOST_HAS_DIRENT_H
Jeff Thompsonf7d49942013-08-01 16:47:40 -070033# endif
34
35 // POSIX version 3 requires <signal.h> to have sigaction:
36# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070037# define NDNBOOST_HAS_SIGACTION
Jeff Thompsonf7d49942013-08-01 16:47:40 -070038# 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.
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(NDNBOOST_HAS_WINTHREADS) && !defined(NDNBOOST_HAS_MPTASKS)
46# define NDNBOOST_HAS_PTHREADS
Jeff Thompsonf7d49942013-08-01 16:47:40 -070047# endif
48
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049 // NDNBOOST_HAS_NANOSLEEP:
Jeff Thompsonf7d49942013-08-01 16:47:40 -070050 // 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))
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053# define NDNBOOST_HAS_NANOSLEEP
Jeff Thompsonf7d49942013-08-01 16:47:40 -070054# endif
55
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056 // NDNBOOST_HAS_CLOCK_GETTIME:
Jeff Thompsonf7d49942013-08-01 16:47:40 -070057 // 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))
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061# define NDNBOOST_HAS_CLOCK_GETTIME
Jeff Thompsonf7d49942013-08-01 16:47:40 -070062# endif
63
Jeff Thompson3d613fd2013-10-15 15:39:04 -070064 // NDNBOOST_HAS_SCHED_YIELD:
Jeff Thompsonf7d49942013-08-01 16:47:40 -070065 // 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))
Jeff Thompson3d613fd2013-10-15 15:39:04 -070070# define NDNBOOST_HAS_SCHED_YIELD
Jeff Thompsonf7d49942013-08-01 16:47:40 -070071# endif
72
Jeff Thompson3d613fd2013-10-15 15:39:04 -070073 // NDNBOOST_HAS_GETTIMEOFDAY:
74 // NDNBOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
Jeff Thompsonf7d49942013-08-01 16:47:40 -070075 // These are predicated on _XOPEN_VERSION, and appears to be first released
76 // in issue 4, version 2 (_XOPEN_VERSION > 500).
77 // Likewise for the functions log1p and expm1.
78# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070079# define NDNBOOST_HAS_GETTIMEOFDAY
Jeff Thompsonf7d49942013-08-01 16:47:40 -070080# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070081# define NDNBOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
Jeff Thompsonf7d49942013-08-01 16:47:40 -070082# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070083# ifndef NDNBOOST_HAS_LOG1P
84# define NDNBOOST_HAS_LOG1P
Jeff Thompsonf7d49942013-08-01 16:47:40 -070085# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070086# ifndef NDNBOOST_HAS_EXPM1
87# define NDNBOOST_HAS_EXPM1
Jeff Thompsonf7d49942013-08-01 16:47:40 -070088# endif
89# endif
90
91# endif
92
93
94
95