|
|
1 //! @file a68g-platform.h 2 //! @author J. Marcel van der Veer 3 4 //! @section Copyright 5 //! 6 //! This file is part of Algol68G - an Algol 68 compiler-interpreter. 7 //! Copyright 2001-2026 J. Marcel van der Veer [algol68g@algol68genie.nl]. 8 9 //! @section License 10 //! 11 //! This program is free software; you can redistribute it and/or modify it 12 //! under the terms of the GNU General Public License as published by the 13 //! Free Software Foundation; either version 3 of the License, or 14 //! (at your option) any later version. 15 //! 16 //! This program is distributed in the hope that it will be useful, but 17 //! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 18 //! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 19 //! more details. You should have received a copy of the GNU General Public 20 //! License along with this program. If not, see [http://www.gnu.org/licenses/]. 21 22 //! @section Synopsis 23 //! 24 //! Platform dependent definitions. 25 26 #if !defined (__A68G_PLATFORM_H__) 27 #define __A68G_PLATFORM_H__ 28 29 #if defined (BUILD_WIN32) 30 #include "a68g-config.win32.h" 31 #if !defined (HAVE_GCC) 32 #define HAVE_GCC 33 #endif 34 #undef C_COMPILER 35 #undef HAVE_CLANG 36 #elif defined (BUILD_WIN64) 37 #include "a68g-config.win64.h" 38 #if !defined (HAVE_GCC) 39 #define HAVE_GCC 40 #endif 41 #undef C_COMPILER 42 #undef HAVE_CLANG 43 #elif defined (__clang__) 44 #include "a68g-config.h" 45 #if !defined (HAVE_CLANG) 46 #define HAVE_CLANG 47 #endif 48 #if !defined (C_COMPILER) 49 #define C_COMPILER "clang" 50 #endif 51 #undef HAVE_GCC 52 #undef HAVE_GNU_MPFR 53 #elif defined (__GNUC__) 54 #include "a68g-config.h" 55 #if !defined (HAVE_GCC) 56 #define HAVE_GCC 57 #endif 58 #if !defined (C_COMPILER) 59 #define C_COMPILER "gcc" 60 #endif 61 #undef HAVE_CLANG 62 #else 63 #error "a68g: abend: a68g requires either gcc or clang" 64 #endif 65 66 #if defined (BUILD_LINUX) 67 #define BUILD_UNIX 68 #elif defined (BUILD_BSD) 69 #define BUILD_UNIX 70 #elif defined (BUILD_CYGWIN) 71 #define BUILD_UNIX 72 #elif defined (BUILD_HAIKU) 73 #define BUILD_UNIX 74 #endif 75 76 #if defined (BUILD_WIN32) 77 #define BUILD_WINDOWS 78 #elif defined (BUILD_WIN64) 79 #define BUILD_WINDOWS 80 #endif 81 82 #if (defined (BUILD_LINUX) || defined (BUILD_BSD)) 83 84 // Autoconf macros may impose outdated feature test macros. 85 // For instance AX_WITH CURSES may define _DEFAULT_SOURCE and _XOPEN_SOURCE 600. 86 // Here we correct, post hoc. 87 88 // _GNU_SOURCE includes ISO C89, ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions. 89 90 #if defined (_GNU_SOURCE) 91 #undef _GNU_SOURCE 92 #endif 93 94 // _BSD_SOURCE is deprecated, and caused header files to expose BSD-derived definitions. 95 96 #if defined (_BSD_SOURCE) 97 #undef _BSD_SOURCE 98 #endif 99 100 // _DEFAULT_SOURCE includes most features, apart from X/Open, LFS and GNU extensions. 101 102 #if defined (_DEFAULT_SOURCE) 103 #undef _DEFAULT_SOURCE 104 #endif 105 106 // _XOPEN_SOURCE includes functionality described in the X/Open Portability Guide. 107 // A68G defines _XOPEN_SOURCE 700 which is a superset of _POSIX_C_SOURCE 200809L. 108 109 #if defined (_XOPEN_SOURCE) 110 #undef _XOPEN_SOURCE 111 #endif 112 113 #define _XOPEN_SOURCE 700 114 115 #endif 116 117 // Decide on A68G "LEVEL". 118 // LEVEL 3 uses INT*8 and REAL*16 data types, when available in hardware. 119 // LEVEL 2 builds generic A68G with INT*4 and REAL*8 data types. 120 // LEVEL 1 is reserved for (possible) restrictive builds. 121 122 #if defined (BUILD_WINDOWS) 123 #define A68G_LEVEL 3 124 #elif defined (HAVE_LONG_TYPES) 125 #define A68G_LEVEL 3 126 #else 127 #define A68G_LEVEL 2 128 #endif 129 130 #undef HAVE_LARGE_STORAGE // Default. 131 #if (A68G_LEVEL >= 3) 132 #if defined (SIZEOF_SIZE_T) 133 #if (SIZEOF_SIZE_T >= 8) 134 #define HAVE_LARGE_STORAGE 135 #endif 136 #elif defined (BUILD_WIN64) 137 #define HAVE_LARGE_STORAGE 138 #endif 139 #endif 140 141 // GNU MPFR 142 #if (A68G_LEVEL < 3) 143 #undef HAVE_GNU_MPFR 144 #endif 145 146 // R mathlib 147 148 #if defined (HAVE_R_MATHLIB) 149 #if !defined (MATHLIB_STANDALONE) 150 #define MATHLIB_STANDALONE 151 #endif 152 #endif 153 154 // Imported libraries 155 156 #if defined (__cplusplus) 157 #undef __cplusplus 158 #endif 159 160 #endif
© 2001-2026 J.M. van der Veer
jmvdveer@algol68genie.nl