log4cplus  1.1.0
config.hxx
Go to the documentation of this file.
00001 //  Copyright (C) 2009-2010, Vaclav Haisman. All rights reserved.
00002 //
00003 //  Redistribution and use in source and binary forms, with or without modifica-
00004 //  tion, are permitted provided that the following conditions are met:
00005 //
00006 //  1. Redistributions of  source code must  retain the above copyright  notice,
00007 //     this list of conditions and the following disclaimer.
00008 //
00009 //  2. Redistributions in binary form must reproduce the above copyright notice,
00010 //     this list of conditions and the following disclaimer in the documentation
00011 //     and/or other materials provided with the distribution.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
00014 //  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
00015 //  FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
00016 //  APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
00017 //  INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
00018 //  DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
00019 //  OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
00020 //  ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
00021 //  (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
00022 //  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00023 
00024 #ifndef LOG4CPLUS_CONFIG_HXX
00025 #define LOG4CPLUS_CONFIG_HXX
00026 
00027 #if defined (_WIN32)
00028 #  include <log4cplus/config/win32.h>
00029 #elif (defined(__MWERKS__) && defined(__MACOS__))
00030 #  include <log4cplus/config/macosx.h>
00031 #else
00032 #  include <log4cplus/config/defines.hxx>
00033 #endif
00034 
00035 #if ! defined (UNICODE) && ! defined (LOG4CPLUS_HAVE_VSNPRINTF_S) \
00036     && ! defined (LOG4CPLUS_HAVE__VSNPRINTF_S) \
00037     && ! defined (LOG4CPLUS_HAVE_VSNPRINTF) \
00038     && ! defined (LOG4CPLUS_HAVE__VSNPRINTF)
00039 #  undef LOG4CPLUS_USE_POOR_MANS_SNPRINTF
00040 #  define LOG4CPLUS_USE_POOR_MANS_SNPRINTF
00041 #endif
00042 
00043 # if ! defined (LOG4CPLUS_WORKING_LOCALE) \
00044   && ! defined (LOG4CPLUS_WORKING_C_LOCALE) \
00045   && ! defined (LOG4CPLUS_WITH_ICONV)
00046 # define LOG4CPLUS_POOR_MANS_CHCONV
00047 #endif
00048 
00049 #ifndef LOG4CPLUS_DECLSPEC_EXPORT
00050 #define LOG4CPLUS_DECLSPEC_EXPORT /* empty */
00051 #endif
00052 
00053 #ifndef LOG4CPLUS_DECLSPEC_IMPORT
00054 #define LOG4CPLUS_DECLSPEC_IMPORT /* empty */
00055 #endif
00056 
00057 #ifndef LOG4CPLUS_DECLSPEC_PRIVATE
00058 #define LOG4CPLUS_DECLSPEC_PRIVATE /* empty */
00059 #endif
00060 
00061 #define LOG4CPLUS_PRIVATE LOG4CPLUS_DECLSPEC_PRIVATE
00062 
00063 #if !defined(_WIN32)
00064 #  define LOG4CPLUS_USE_BSD_SOCKETS
00065 #  if !defined(LOG4CPLUS_SINGLE_THREADED)
00066 #    define LOG4CPLUS_USE_PTHREADS
00067 #  endif
00068 #  if defined (INSIDE_LOG4CPLUS)
00069 #    define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
00070 #  else
00071 #    define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
00072 #  endif // defined (INSIDE_LOG4CPLUS)
00073 
00074 #endif // !_WIN32
00075 
00076 #if defined (LOG4CPLUS_INLINES_ARE_EXPORTED) \
00077     && defined (LOG4CPLUS_BUILD_DLL)
00078 #  define LOG4CPLUS_INLINE_EXPORT inline
00079 #else
00080 #  define LOG4CPLUS_INLINE_EXPORT
00081 #endif
00082 
00083 #if defined (UNICODE)
00084 #  if defined (_MSC_VER) && _MSC_VER >= 1400
00085 #    define LOG4CPLUS_FSTREAM_ACCEPTS_WCHAR_T
00086 #  endif
00087 #  if defined (_MSC_VER) && _MSC_VER >= 1600
00088 #    define LOG4CPLUS_HAVE_CODECVT_UTF8_FACET
00089 #    define LOG4CPLUS_HAVE_CODECVT_UTF16_FACET
00090 #  endif
00091 #endif
00092 
00093 // C++11 stuff
00094 
00095 #if ! defined (__has_feature)
00096 
00097 
00098 #  define __has_feature(X) 0
00099 #endif
00100 
00101 #if (defined (_MSC_VER) && _MSC_VER >= 1600) \
00102     || defined (__GXX_EXPERIMENTAL_CXX0X__) \
00103     || __cplusplus >= 201103L
00104 #  define LOG4CPLUS_HAVE_CXX11_SUPPORT
00105 #endif
00106 
00107 #if defined (LOG4CPLUS_HAVE_CXX11_SUPPORT) \
00108     || __has_feature (cxx_rvalue_references)
00109 #  define LOG4CPLUS_HAVE_RVALUE_REFS
00110 #endif
00111 
00112 #if ! defined (UNICODE) && defined (__GNUC__) && __GNUC__ >= 3
00113 #  define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, format_index, first_arg_index) \
00114     __attribute__ ((format (archetype, format_index, first_arg_index)))
00115 #else
00116 #  define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, fmt_index, first_arg_index) \
00117     /* empty */
00118 #endif
00119 
00120 #if defined (__GNUC__) && __GNUC__ >= 3
00121 #  define LOG4CPLUS_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
00122 #  define LOG4CPLUS_ATTRIBUTE_PURE __attribute__ ((__pure__))
00123 #  define LOG4CPLUS_BUILTIN_EXPECT(exp, c) __builtin_expect ((exp), (c))
00124 #else
00125 #  if ! defined (LOG4CPLUS_ATTRIBUTE_NORETURN)
00126 #    define LOG4CPLUS_ATTRIBUTE_NORETURN /* empty */
00127 #  endif
00128 #  define LOG4CPLUS_ATTRIBUTE_PURE /* empty */
00129 #  define LOG4CPLUS_BUILTIN_EXPECT(exp, c) (exp)
00130 #endif
00131 
00132 #define LOG4CPLUS_LIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 1)
00133 #define LOG4CPLUS_UNLIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 0)
00134 
00135 #if defined (_MSC_VER)                                             \
00136     || (defined (__BORLANDC__) && __BORLANDC__ >= 0x0650)          \
00137     || (defined (__COMO__) && __COMO_VERSION__ >= 400) /* ??? */   \
00138     || (defined (__DMC__) && __DMC__ >= 0x700) /* ??? */           \
00139     || (defined (__clang__) && __clang_major__ >= 3)               \
00140     || (defined (__GNUC__) && (__GNUC__ >= 4                       \
00141             || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)))
00142 #  define LOG4CPLUS_HAVE_PRAGMA_ONCE
00143 #  pragma once
00144 #endif
00145 
00146 #include <log4cplus/helpers/thread-config.h>
00147 
00148 #if defined(__cplusplus)
00149 namespace log4cplus
00150 {
00151 
00157 LOG4CPLUS_EXPORT void threadCleanup ();
00158 
00159 } // namespace log4cplus
00160 
00161 #endif
00162 
00163 #endif // LOG4CPLUS_CONFIG_HXX