Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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(LIBSMBIOS_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 LIBSMBIOS_HAS_NL_TYPES_H
00023 #     endif
00024 
00025       // POSIX version 6 requires <stdint.h>
00026 #     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
00027 #        define LIBSMBIOS_HAS_STDINT_H
00028 #     endif
00029 
00030       // POSIX version 2 requires <dirent.h>
00031 #     if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
00032 #        define LIBSMBIOS_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 LIBSMBIOS_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(LIBSMBIOS_HAS_WINTHREADS) && !defined(LIBSMBIOS_HAS_MPTASKS)
00046 #        define LIBSMBIOS_HAS_PTHREADS
00047 #     endif
00048 
00049       // LIBSMBIOS_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 LIBSMBIOS_HAS_NANOSLEEP
00054 #     endif
00055 
00056       // LIBSMBIOS_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 LIBSMBIOS_HAS_CLOCK_GETTIME
00062 #     endif
00063 
00064       // LIBSMBIOS_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 LIBSMBIOS_HAS_SCHED_YIELD
00071 #     endif
00072 
00073       // LIBSMBIOS_HAS_GETTIMEOFDAY:
00074       // LIBSMBIOS_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 #     if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
00078 #        define LIBSMBIOS_HAS_GETTIMEOFDAY
00079 #        if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
00080 #           define LIBSMBIOS_HAS_PTHREAD_MUTEXATTR_SETTYPE
00081 #        endif
00082 #     endif
00083 
00084 #  endif
00085 
00086 
00087 

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5