png++  0.2.9
config.hpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008   Alex Shulgin
00003  *
00004  * This file is part of png++ the C++ wrapper for libpng.  PNG++ is free
00005  * software; the exact copying conditions are as follows:
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright notice,
00011  * this list of conditions and the following disclaimer.
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  * notice, this list of conditions and the following disclaimer in the
00015  * documentation and/or other materials provided with the distribution.
00016  *
00017  * 3. The name of the author may not be used to endorse or promote products
00018  * derived from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00021  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00022  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00023  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00025  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 #ifndef PNGPP_CONFIG_HPP_INCLUDED
00032 #define PNGPP_CONFIG_HPP_INCLUDED
00033 
00034 #include <stdlib.h>
00035 
00036 // Endianness test
00037 #if defined(__GLIBC__)
00038 
00039 #include <endian.h>
00040 
00041 #elif defined(_WIN32)
00042 
00043 #define __LITTLE_ENDIAN 1234
00044 #define __BIG_ENDIAN    4321
00045 #define __BYTE_ORDER __LITTLE_ENDIAN
00046 
00047 #elif defined(__APPLE__)
00048 
00049 #include <machine/endian.h>
00050 #include <sys/_endian.h>
00051 
00052 #elif defined(__FreeBSD__)
00053 
00054 #include <machine/endian.h>
00055 #include <sys/endian.h>
00056 
00057 #elif defined(__sun)
00058 
00059 #include <sys/isa_defs.h>
00060 
00061 #else
00062 
00063 #error Byte-order could not be detected.
00064 
00065 #endif
00066 
00067 // Determine C++11 features
00068 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
00069 
00070 #define PNGPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00071 // gcc c++11 support list
00072 // http://gcc.gnu.org/projects/cxx0x.html
00073 
00074 // gcc supports static_assert since 4.3
00075 #if (PNGPP_GCC_VERSION >= 40300)
00076 #define PNGPP_HAS_STATIC_ASSERT
00077 #endif
00078 
00079 // gcc supports std::move since 4.6
00080 #if (PNGPP_GCC_VERSION >= 40600)
00081 #define PNGPP_HAS_STD_MOVE
00082 #endif
00083 
00084 #undef PNGPP_GCC_VERSION
00085 
00086 #elif defined(_MSC_VER)
00087 
00088 // MS Visual C++ compiler supports static_assert and std::move since VS2010
00089 // http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx
00090 #if (_MSC_VER >= 1600)
00091 #define PNGPP_HAS_STATIC_ASSERT
00092 #define PNGPP_HAS_STD_MOVE
00093 #endif
00094 
00095 #endif
00096 
00097 
00098 #endif // PNGPP_CONFIG_HPP_INCLUDED