1 /******************************************************************************* 2 * syspovconfig.h 3 * 4 * This file contains most unix-specific defines for compiling the VFE. 5 * 6 * --------------------------------------------------------------------------- 7 * Persistence of Vision Ray Tracer ('POV-Ray') version 3.7. 8 * Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd. 9 * 10 * POV-Ray is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Affero General Public License as 12 * published by the Free Software Foundation, either version 3 of the 13 * License, or (at your option) any later version. 14 * 15 * POV-Ray is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Affero General Public License for more details. 19 * 20 * You should have received a copy of the GNU Affero General Public License 21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 * --------------------------------------------------------------------------- 23 * POV-Ray is based on the popular DKB raytracer version 2.12. 24 * DKBTrace was originally written by David K. Buck. 25 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins. 26 * --------------------------------------------------------------------------- 27 * $File: //depot/povray/smp/vfe/unix/syspovconfig.h $ 28 * $Revision: #17 $ 29 * $Change: 6133 $ 30 * $DateTime: 2013/11/25 15:28:53 $ 31 * $Author: clipka $ 32 *******************************************************************************/ 33 34 #ifndef __SYSPOVCONFIG_H__ 35 #define __SYSPOVCONFIG_H__ 36 37 #define _FILE_OFFSET_BITS 64 38 39 #define fseek64(stream,offset,whence) fseeko(stream,offset,whence) 40 41 #ifdef HAVE_CONFIG_H 42 # include "config.h" 43 #else 44 # error "!!!!! config.h is required !!!!!" 45 #endif 46 47 48 #include <algorithm> 49 #include <stdarg.h> 50 #include <math.h> 51 52 #include "../vfeconf.h" 53 54 55 using std::max; 56 using std::min; 57 58 #ifndef STD_TYPES_DECLARED 59 #define STD_TYPES_DECLARED 60 61 // the following types are used extensively throughout the POV source and hence are 62 // included and named here for reasons of clarity and convenience. 63 64 #include <exception> 65 #include <stdexcept> 66 #include <string> 67 #include <vector> 68 #include <list> 69 70 #include <boost/version.hpp> 71 #if BOOST_VERSION < 106500 72 // Pulling in smart pointers is easy with Boost versions prior to 1.65.0, with the 73 // `boost/tr1/*.hpp` set of headers simply pulling in whatever is available (C++11, TR1 or 74 // boost's own implementation) and making it available in the `std::tr1` namespace. 75 #include <boost/tr1/memory.hpp> 76 #define POV_TR1_NAMESPACE std::tr1 77 #else 78 // With `boost/tr1/*.hpp` unavailable, we're currently blindly relying on the compiler to 79 // be compliant with C++11. 80 #include <memory> 81 #define POV_TR1_NAMESPACE std 82 #endif 83 84 // when we say 'string' we mean std::string 85 using std::string; 86 87 // and vector is a std::vector 88 using std::vector; 89 90 // yup, list too 91 using std::list; 92 93 // runtime_error is the base of our Exception class, plus is referred 94 // to in a few other places. 95 using std::runtime_error; 96 97 // these may actually be the boost implementations, depending on what boost/tr1/memory.hpp has pulled in 98 // (NOTE: If you're running into a compile error here, you're probably trying to compile POV-Ray 99 // with Boost 1.65.0 or later and a non-C++11-compliant compiler. We currently do not support such a 100 // combination.) 101 using POV_TR1_NAMESPACE::shared_ptr; 102 using POV_TR1_NAMESPACE::weak_ptr; 103 104 #endif // STD_POV_TYPES_DECLARED 105 106 // After Stroustrop in _The C++ Programming Language, 3rd Ed_ p. 88 107 #ifndef NULL 108 const int NULL=0; 109 #endif 110 111 #define POV_LONG long long 112 113 #define DELETE_FILE(name) unlink(name) 114 115 #if defined (PATH_MAX) 116 # define FILE_NAME_LENGTH PATH_MAX 117 #elif defined (_POSIX_PATH_MAX) 118 # define FILE_NAME_LENGTH _POSIX_PATH_MAX 119 #else 120 # define FILE_NAME_LENGTH 200 121 #endif 122 #define MAX_PATH FILE_NAME_LENGTH // FIXME: remove later 123 124 #define DEFAULT_OUTPUT_FORMAT kPOVList_FileType_PNG 125 #define DEFAULT_DISPLAY_GAMMA_TYPE kPOVList_GammaType_SRGB 126 #define DEFAULT_DISPLAY_GAMMA 2.2 127 #define DEFAULT_FILE_GAMMA_TYPE kPOVList_GammaType_SRGB 128 #define DEFAULT_FILE_GAMMA 2.2 129 130 #define METADATA_PLATFORM_STRING BUILD_ARCH 131 #define METADATA_COMPILER_STRING COMPILER_VERSION 132 133 #define DECLARE_THREAD_LOCAL_PTR(ptrType, ptrName) __thread ptrType *ptrName 134 #define IMPLEMENT_THREAD_LOCAL_PTR(ptrType, ptrName, ignore) __thread ptrType *ptrName 135 #define GET_THREAD_LOCAL_PTR(ptrName) (ptrName) 136 #define SET_THREAD_LOCAL_PTR(ptrName, ptrValue) (ptrName = ptrValue) 137 138 #if defined(_AIX) 139 // IBM AIX detected. 140 // Not officially supported yet; comment-out the following line to try with default POSIX settings. 141 #error IBM AIX detected, but not explicitly supported yet; proceed at your own risk. 142 #elif defined(__hpux) 143 // Hewlett-Packard HP-UX detected. 144 // Not officially supported yet; comment-out the following line to try with default POSIX settings. 145 #error Hewlett-Packard HP-UX detected, but not explicitly supported yet; proceed at your own risk. 146 #elif defined(__linux__) 147 // GNU/Linux detected. 148 #elif defined(__APPLE__) && defined(__MACH__) 149 // Apple Mac OS X detected. 150 #include <unistd.h> 151 #define lseek64(handle,offset,whence) lseek(handle,offset,whence) 152 #elif defined(__sun) && defined(__SVR4) 153 // Sun/Oracle Solaris detected. 154 // Not officially supported yet; comment-out the following line to try with default POSIX settings. 155 #error Sun/Oracle Solaris detected, but not explicitly supported yet; proceed at your own risk. 156 #elif defined(__CYGWIN__) 157 // Cygwin detected. 158 // Not officially supported yet; comment-out the following line to try with default POSIX settings. 159 #error Cygwin detected, but not explicitly supported yet; proceed at your own risk. 160 #elif defined(__unix__) 161 // Some Unix other than the above detected. 162 #include <sys/param.h> 163 #if defined(BSD) 164 // BSD-style Unix detected. 165 #include <sys/wait.h> // for WEXITSTATUS 166 #define lseek64(handle,offset,whence) lseek(handle,offset,whence) 167 #else 168 // Not officially supported yet; comment-out the following line to try with default POSIX settings. 169 #error Unix detected, but flavor not identified; proceed at your own risk. 170 #endif 171 #else 172 // Doesn't look like a Unix at all. 173 // Comment-out the following line to try with default POSIX settings. 174 #error No Unix detected; proceed at your own risk. 175 #endif 176 177 #endif 178