Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 17 | # if defined(NDNBOOST_HAS_UNISTD_H) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 22 | # define NDNBOOST_HAS_NL_TYPES_H |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 23 | # endif |
| 24 | |
| 25 | // POSIX version 6 requires <stdint.h> |
| 26 | # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 27 | # define NDNBOOST_HAS_STDINT_H |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 28 | # endif |
| 29 | |
| 30 | // POSIX version 2 requires <dirent.h> |
| 31 | # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 32 | # define NDNBOOST_HAS_DIRENT_H |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 33 | # endif |
| 34 | |
| 35 | // POSIX version 3 requires <signal.h> to have sigaction: |
| 36 | # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 37 | # define NDNBOOST_HAS_SIGACTION |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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. |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 45 | # if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(NDNBOOST_HAS_WINTHREADS) && !defined(NDNBOOST_HAS_MPTASKS) |
| 46 | # define NDNBOOST_HAS_PTHREADS |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 47 | # endif |
| 48 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 49 | // NDNBOOST_HAS_NANOSLEEP: |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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)) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 53 | # define NDNBOOST_HAS_NANOSLEEP |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 54 | # endif |
| 55 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 56 | // NDNBOOST_HAS_CLOCK_GETTIME: |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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)) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 61 | # define NDNBOOST_HAS_CLOCK_GETTIME |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 62 | # endif |
| 63 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 64 | // NDNBOOST_HAS_SCHED_YIELD: |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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)) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 70 | # define NDNBOOST_HAS_SCHED_YIELD |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 71 | # endif |
| 72 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 73 | // NDNBOOST_HAS_GETTIMEOFDAY: |
| 74 | // NDNBOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 75 | // 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 79 | # define NDNBOOST_HAS_GETTIMEOFDAY |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 80 | # if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 81 | # define NDNBOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 82 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 83 | # ifndef NDNBOOST_HAS_LOG1P |
| 84 | # define NDNBOOST_HAS_LOG1P |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 85 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 86 | # ifndef NDNBOOST_HAS_EXPM1 |
| 87 | # define NDNBOOST_HAS_EXPM1 |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 88 | # endif |
| 89 | # endif |
| 90 | |
| 91 | # endif |
| 92 | |
| 93 | |
| 94 | |
| 95 | |