libsmbios_c library
|
00001 // (C) Copyright John Maddock 2001 - 2003. 00002 // (C) Copyright Jens Maurer 2001 - 2003. 00003 // Use, modification and distribution are subject to the 00004 // Boost Software License, Version 1.0. (See accompanying file 00005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00006 00007 // See http://www.boost.org for most recent version. 00008 00009 // linux specific config options: 00010 00011 #define LIBSMBIOS_PLATFORM "linux" 00012 #define LIBSMBIOS_PLATFORM_LINUX 00013 00014 // don't want to enable this just yet. 00015 // // we can assume gettext on linux 00016 // #define LIBSMBIOS_HAS_GETTEXT 00017 00018 // make sure we have __GLIBC_PREREQ if available at all 00019 #include <cstdlib> 00020 00021 // If we are on IA64 we will need to macro define inb_p and outb_p 00022 #if defined(__ia64__) 00023 # define outb_p outb 00024 # define inb_p inb 00025 #endif 00026 00027 // Enable 64-bit file access 00028 #ifndef FSEEK 00029 #define FSEEK(fh, pos, whence) fseeko(fh, static_cast<off_t>(pos), whence) 00030 #endif 00031 00032 // 00033 // <stdint.h> added to glibc 2.1.1 00034 // We can only test for 2.1 though: 00035 // 00036 #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 00037 // <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines 00038 // int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h> 00039 // only when using GCC. 00040 # if defined __GNUC__ 00041 # define LIBSMBIOS_HAS_STDINT_H 00042 # endif 00043 #endif 00044 00045 #if defined(__LIBCOMO__) 00046 // 00047 // como on linux doesn't have std:: c functions: 00048 // NOTE: versions of libcomo prior to beta28 have octal version numbering, 00049 // e.g. version 25 is 21 (dec) 00050 // 00051 # if __LIBCOMO_VERSION__ <= 20 00052 # define LIBSMBIOS_NO_STDC_NAMESPACE 00053 # endif 00054 00055 # if __LIBCOMO_VERSION__ <= 21 00056 # define LIBSMBIOS_NO_SWPRINTF 00057 # endif 00058 00059 #endif 00060 00061 // 00062 // If glibc is past version 2 then we definitely have 00063 // gettimeofday, earlier versions may or may not have it: 00064 // 00065 #if defined(__GLIBC__) && (__GLIBC__ >= 2) 00066 # define LIBSMBIOS_HAS_GETTIMEOFDAY 00067 #endif 00068 00069 #ifdef __USE_POSIX199309 00070 # define LIBSMBIOS_HAS_NANOSLEEP 00071 #endif 00072 00073 #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) 00074 // __GLIBC_PREREQ is available since 2.1.2 00075 00076 // swprintf is available since glibc 2.2.0 00077 # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) 00078 # define LIBSMBIOS_NO_SWPRINTF 00079 # endif 00080 #else 00081 # define LIBSMBIOS_NO_SWPRINTF 00082 #endif 00083 00084 // boilerplate code: 00085 #define LIBSMBIOS_HAS_UNISTD_H 00086 #include <smbios/config/posix_features.hpp> 00087 00088 #ifndef __GNUC__ 00089 // 00090 // if the compiler is not gcc we still need to be able to parse 00091 // the GNU system headers, some of which (mainly <stdint.h>) 00092 // use GNU specific extensions: 00093 // 00094 # ifndef __extension__ 00095 # define __extension__ 00096 # endif 00097 # ifndef __const__ 00098 # define __const__ const 00099 # endif 00100 # ifndef __volatile__ 00101 # define __volatile__ volatile 00102 # endif 00103 # ifndef __signed__ 00104 # define __signed__ signed 00105 # endif 00106 # ifndef __typeof__ 00107 # define __typeof__ typeof 00108 # endif 00109 # ifndef __inline__ 00110 # define __inline__ inline 00111 # endif 00112 #endif 00113 00114