posix_features.hpp
Go to the documentation of this file.
00001 //  (C) Copyright John Maddock 2001 - 2003. 
00002 //  Use, modification and distribution are subject to the 
00003 //  Boost Software License, Version 1.0. (See accompanying file 
00004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 
00007 //  See http://www.boost.org for most recent version.
00008 
00009 // All POSIX feature tests go in this file,
00010 // Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well
00011 // _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's
00012 // may be present but none-functional unless _POSIX_C_SOURCE and
00013 // _XOPEN_SOURCE have been defined to the right value (it's up
00014 // to the user to do this *before* including any header, although
00015 // in most cases the compiler will do this for you).
00016 
00017 #  if defined(BOOST_HAS_UNISTD_H)
00018 #     include <unistd.h>
00019 
00020       // XOpen has <nl_types.h>, but is this the correct version check?
00021 #     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3)
00022 #        define BOOST_HAS_NL_TYPES_H
00023 #     endif
00024 
00025       // POSIX version 6 requires <stdint.h>
00026 #     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
00027 #        define BOOST_HAS_STDINT_H
00028 #     endif
00029 
00030       // POSIX version 2 requires <dirent.h>
00031 #     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
00032 #        define BOOST_HAS_DIRENT_H
00033 #     endif
00034 
00035       // POSIX version 3 requires <signal.h> to have sigaction:
00036 #     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
00037 #        define BOOST_HAS_SIGACTION
00038 #     endif
00039       // POSIX defines _POSIX_THREADS > 0 for pthread support,
00040       // however some platforms define _POSIX_THREADS without
00041       // a value, hence the (_POSIX_THREADS+0 >= 0) check.
00042       // Strictly speaking this may catch platforms with a
00043       // non-functioning stub <pthreads.h>, but such occurrences should
00044       // occur very rarely if at all.
00045 #     if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS)
00046 #        define BOOST_HAS_PTHREADS
00047 #     endif
00048 
00049       // BOOST_HAS_NANOSLEEP:
00050       // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME:
00051 #     if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \
00052              || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
00053 #        define BOOST_HAS_NANOSLEEP
00054 #     endif
00055 
00056       // BOOST_HAS_CLOCK_GETTIME:
00057       // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME
00058       // but at least one platform - linux - defines that flag without
00059       // defining clock_gettime):
00060 #     if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0))
00061 #        define BOOST_HAS_CLOCK_GETTIME
00062 #     endif
00063 
00064       // BOOST_HAS_SCHED_YIELD:
00065       // This is predicated on _POSIX_PRIORITY_SCHEDULING or
00066       // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME.
00067 #     if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\
00068             || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
00069             || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
00070 #        define BOOST_HAS_SCHED_YIELD
00071 #     endif
00072 
00073       // BOOST_HAS_GETTIMEOFDAY:
00074       // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
00075       // These are predicated on _XOPEN_VERSION, and appears to be first released
00076       // in issue 4, version 2 (_XOPEN_VERSION > 500).
00077       // Likewise for the functions log1p and expm1.
00078 #     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
00079 #        define BOOST_HAS_GETTIMEOFDAY
00080 #        if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
00081 #           define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
00082 #        endif
00083 #        ifndef BOOST_HAS_LOG1P
00084 #           define BOOST_HAS_LOG1P
00085 #        endif
00086 #        ifndef BOOST_HAS_EXPM1
00087 #           define BOOST_HAS_EXPM1
00088 #        endif
00089 #     endif
00090 
00091 #  endif
00092 
00093 
00094 
00095 


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29