a68g-platform.h
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-2025 J. Marcel van der Veer [algol68g@xs4all.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 // Decide on A68G "LEVEL".
67 // LEVEL 3 uses INT*8, REAL*10 and REAL*16 data types, when available in hardware.
68 // LEVEL 2 builds generic A68G with INT*4 and REAL*8 data types.
69 // LEVEL 1 is reserved for (possible) restrictive builds.
70
71 #if defined (BUILD_WIN32) || defined (BUILD_WIN64)
72 #define A68G_LEVEL 3
73 #elif defined (HAVE_LONG_TYPES)
74 #define A68G_LEVEL 3
75 #else
76 #define A68G_LEVEL 2
77 #endif
78
79 #undef HAVE_LARGE_STORAGE // Default.
80 #if (A68G_LEVEL >= 3)
81 #if defined (SIZEOF_SIZE_T)
82 #if (SIZEOF_SIZE_T >= 8)
83 #define HAVE_LARGE_STORAGE
84 #endif
85 #elif defined (BUILD_WIN64)
86 #define HAVE_LARGE_STORAGE
87 #endif
88 #endif
89
90 // R mathlib
91
92 #if defined (HAVE_MATHLIB)
93 #if !defined (MATHLIB_STANDALONE)
94 #define MATHLIB_STANDALONE
95 #endif
96 #endif
97
98 // Imported libraries
99
100 #if defined (__cplusplus)
101 #undef __cplusplus
102 #endif
103
104 #if (defined (BUILD_LINUX) || defined (BUILD_BSD))
105
106 // Autoconf macros may impose outdated feature test macros.
107 // For instance AX_WITH CURSES may define DEFAULT_SOURCE and XOPEN_SOURCE 600.
108 // Here we correct, post hoc.
109
110 // _GNU_SOURCE includes ISO C89, ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions.
111
112 #if defined (_GNU_SOURCE)
113 #undef _GNU_SOURCE
114 #endif
115
116 // _DEFAULT_SOURCE includes most features, apart from X/Open, LFS and GNU extensions.
117
118 #if defined (_DEFAULT_SOURCE)
119 #undef _DEFAULT_SOURCE
120 #endif
121
122 // _XOPEN_SOURCE includes functionality described in the X/Open Portability Guide.
123 // 500 includes previous functionality plus the Single Unix Specification (SUS), version 2.
124 // 600 (revision #6) includes SUS version 3 definitions.
125 // 700 (revision #7) includes SUS version 4 definitions.
126
127 #if defined (_XOPEN_SOURCE)
128 #undef _XOPEN_SOURCE
129 #endif
130
131 #define _XOPEN_SOURCE 700
132
133 #endif
134
135 #endif
© 2002-2025 J.M. van der Veer (jmvdveer@xs4all.nl)
|