Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | // (C) Copyright John Maddock 2001 - 2003. |
| 2 | // (C) Copyright Jens Maurer 2001 - 2003. |
| 3 | // Use, modification and distribution are subject to the |
| 4 | // Boost Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | |
| 7 | // See http://www.boost.org for most recent version. |
| 8 | |
| 9 | // linux specific config options: |
| 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | #define NDNBOOST_PLATFORM "linux" |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 12 | |
| 13 | // make sure we have __GLIBC_PREREQ if available at all |
| 14 | #ifdef __cplusplus |
| 15 | #include <cstdlib> |
| 16 | #else |
| 17 | #include <stdlib.h> |
| 18 | #endif |
| 19 | |
| 20 | // |
| 21 | // <stdint.h> added to glibc 2.1.1 |
| 22 | // We can only test for 2.1 though: |
| 23 | // |
| 24 | #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) |
| 25 | // <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines |
| 26 | // int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h> |
| 27 | // only when using GCC. |
| 28 | # if defined __GNUC__ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 29 | # define NDNBOOST_HAS_STDINT_H |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 30 | # endif |
| 31 | #endif |
| 32 | |
| 33 | #if defined(__LIBCOMO__) |
| 34 | // |
| 35 | // como on linux doesn't have std:: c functions: |
| 36 | // NOTE: versions of libcomo prior to beta28 have octal version numbering, |
| 37 | // e.g. version 25 is 21 (dec) |
| 38 | // |
| 39 | # if __LIBCOMO_VERSION__ <= 20 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 40 | # define NDNBOOST_NO_STDC_NAMESPACE |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 41 | # endif |
| 42 | |
| 43 | # if __LIBCOMO_VERSION__ <= 21 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 44 | # define NDNBOOST_NO_SWPRINTF |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 45 | # endif |
| 46 | |
| 47 | #endif |
| 48 | |
| 49 | // |
| 50 | // If glibc is past version 2 then we definitely have |
| 51 | // gettimeofday, earlier versions may or may not have it: |
| 52 | // |
| 53 | #if defined(__GLIBC__) && (__GLIBC__ >= 2) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 54 | # define NDNBOOST_HAS_GETTIMEOFDAY |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 55 | #endif |
| 56 | |
| 57 | #ifdef __USE_POSIX199309 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 58 | # define NDNBOOST_HAS_NANOSLEEP |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 59 | #endif |
| 60 | |
| 61 | #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) |
| 62 | // __GLIBC_PREREQ is available since 2.1.2 |
| 63 | |
| 64 | // swprintf is available since glibc 2.2.0 |
| 65 | # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 66 | # define NDNBOOST_NO_SWPRINTF |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 67 | # endif |
| 68 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 69 | # define NDNBOOST_NO_SWPRINTF |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 70 | #endif |
| 71 | |
| 72 | // boilerplate code: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 73 | #define NDNBOOST_HAS_UNISTD_H |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 74 | #include <ndnboost/config/posix_features.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 75 | #define NDNBOOST_HAS_PTHREAD_YIELD |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 76 | |
| 77 | #ifndef __GNUC__ |
| 78 | // |
| 79 | // if the compiler is not gcc we still need to be able to parse |
| 80 | // the GNU system headers, some of which (mainly <stdint.h>) |
| 81 | // use GNU specific extensions: |
| 82 | // |
| 83 | # ifndef __extension__ |
| 84 | # define __extension__ |
| 85 | # endif |
| 86 | # ifndef __const__ |
| 87 | # define __const__ const |
| 88 | # endif |
| 89 | # ifndef __volatile__ |
| 90 | # define __volatile__ volatile |
| 91 | # endif |
| 92 | # ifndef __signed__ |
| 93 | # define __signed__ signed |
| 94 | # endif |
| 95 | # ifndef __typeof__ |
| 96 | # define __typeof__ typeof |
| 97 | # endif |
| 98 | # ifndef __inline__ |
| 99 | # define __inline__ inline |
| 100 | # endif |
| 101 | #endif |
| 102 | |
| 103 | |