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-2024 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 (__MINGW32__)
30 # if ! defined (BUILD_WIN32)
31 # define BUILD_WIN32
32 # endif
33 # include "a68g-config.win32.h"
34 # if ! defined (HAVE_GCC)
35 # define HAVE_GCC
36 # endif
37 # undef C_COMPILER
38 # undef HAVE_CLANG
39 #elif defined (__clang__)
40 # include "a68g-config.h"
41 # if ! defined (HAVE_CLANG)
42 # define HAVE_CLANG
43 # endif
44 # if ! defined (C_COMPILER)
45 # define C_COMPILER "clang"
46 # endif
47 # undef HAVE_GCC
48 # undef HAVE_GNU_MPFR
49 #elif defined (__GNUC__)
50 # include "a68g-config.h"
51 # if ! defined (HAVE_GCC)
52 # define HAVE_GCC
53 # endif
54 # if ! defined (C_COMPILER)
55 # define C_COMPILER "gcc"
56 # endif
57 # undef HAVE_CLANG
58 #else
59 # error "a68g: abend: a68g requires either gcc or clang"
60 #endif
61
62 // Decide on A68G "LEVEL".
63 // LEVEL 3 uses INT*8, REAL*10 and REAL*16 data types, when available in hardware.
64 // LEVEL 2 builds generic A68G with INT*4 and REAL*8 data types.
65 // LEVEL 1 is reserved for (possible) restrictive builds.
66
67 #if defined (BUILD_WIN32)
68 # define A68_LEVEL 3
69 #elif defined (HAVE_LONG_TYPES)
70 # define A68_LEVEL 3
71 #else
72 # define A68_LEVEL 2
73 #endif
74
75 // R mathlib
76
77 #if defined (HAVE_MATHLIB)
78 # if !defined (MATHLIB_STANDALONE)
79 # define MATHLIB_STANDALONE
80 # endif
81 #endif
82
83 // Imported libraries
84
85 #if defined (__cplusplus)
86 # undef __cplusplus
87 #endif
88
89 #if (defined (BUILD_LINUX) || defined (BUILD_BSD))
90
91 // Autoconf macros may impose outdated feature test macros.
92 // For instance AX_WITH CURSES may define DEFAULT_SOURCE and XOPEN_SOURCE 600.
93 // Here we correct, post hoc.
94
95 // _GNU_SOURCE includes ISO C89, ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions.
96
97 # if defined (_GNU_SOURCE)
98 # undef _GNU_SOURCE
99 # endif
100
101 // _DEFAULT_SOURCE includes most features, apart from X/Open, LFS and GNU extensions.
102
103 # if defined (_DEFAULT_SOURCE)
104 # undef _DEFAULT_SOURCE
105 # endif
106
107 // _XOPEN_SOURCE includes functionality described in the X/Open Portability Guide.
108 // 500 includes previous functionality plus the Single Unix Specification (SUS), version 2.
109 // 600 (revision #6) includes SUS version 3 definitions.
110 // 700 (revision #7) includes SUS version 4 definitions.
111
112 # if defined (_XOPEN_SOURCE)
113 # undef _XOPEN_SOURCE
114 # endif
115
116 # define _XOPEN_SOURCE 700
117
118 #endif
119
120 #endif
© 2002-2024 J.M. van der Veer (jmvdveer@xs4all.nl)
|