SST  7.0.0
StructuralSimulationToolkit
lt_system.h
1 /* lt_system.h -- system portability abstraction layer
2 
3  Copyright (C) 2004, 2007, 2010-2015 Free Software Foundation, Inc.
4  Written by Gary V. Vaughan, 2004
5 
6  NOTE: The canonical source of this file is maintained with the
7  GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 
9 GNU Libltdl is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13 
14 As a special exception to the GNU Lesser General Public License,
15 if you distribute this file as part of a program or library that
16 is built using GNU Libtool, you may include this file under the
17 same distribution terms that you use for the rest of that program.
18 
19 GNU Libltdl is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License for more details.
23 
24 You should have received a copy of the GNU Lesser General Public
25 License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 or obtained by writing to the Free Software Foundation, Inc.,
28 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 */
30 
31 #if !defined LT_SYSTEM_H
32 #define LT_SYSTEM_H 1
33 
34 #include <stddef.h>
35 #include <stdlib.h>
36 #include <sys/types.h>
37 
38 /* Some systems do not define EXIT_*, even with STDC_HEADERS. */
39 #if !defined EXIT_SUCCESS
40 # define EXIT_SUCCESS 0
41 #endif
42 #if !defined EXIT_FAILURE
43 # define EXIT_FAILURE 1
44 #endif
45 
46 /* Just pick a big number... */
47 #define LT_FILENAME_MAX 2048
48 
49 
50 /* Saves on those hard to debug '\0' typos.... */
51 #define LT_EOS_CHAR '\0'
52 
53 /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations,
54  so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at
55  the end of C declarations. */
56 #if defined __cplusplus
57 # define LT_BEGIN_C_DECLS extern "C" {
58 # define LT_END_C_DECLS }
59 #else
60 # define LT_BEGIN_C_DECLS /* empty */
61 # define LT_END_C_DECLS /* empty */
62 #endif
63 
64 /* LT_STMT_START/END are used to create macros that expand to a
65  a single compound statement in a portable way. */
66 #if defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __cplusplus
67 # define LT_STMT_START (void)(
68 # define LT_STMT_END )
69 #else
70 # if (defined sun || defined __sun__)
71 # define LT_STMT_START if (1)
72 # define LT_STMT_END else (void)0
73 # else
74 # define LT_STMT_START do
75 # define LT_STMT_END while (0)
76 # endif
77 #endif
78 
79 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
80 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
81 /* DATA imports from DLLs on WIN32 can't be const, because runtime
82  relocations are performed -- see ld's documentation on pseudo-relocs. */
83 # define LT_DLSYM_CONST
84 #elif defined __osf__
85 /* This system does not cope well with relocations in const data. */
86 # define LT_DLSYM_CONST
87 #else
88 # define LT_DLSYM_CONST const
89 #endif
90 
91 /* Canonicalise Windows and Cygwin recognition macros.
92  To match the values set by recent Cygwin compilers, make sure that if
93  __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
94 #if defined __CYGWIN32__ && !defined __CYGWIN__
95 # define __CYGWIN__ __CYGWIN32__
96 #endif
97 #if defined __CYGWIN__
98 # if defined __WINDOWS__
99 # undef __WINDOWS__
100 # endif
101 #elif defined _WIN32
102 # define __WINDOWS__ _WIN32
103 #elif defined WIN32
104 # define __WINDOWS__ WIN32
105 #endif
106 #if defined __CYGWIN__ && defined __WINDOWS__
107 # undef __WINDOWS__
108 #endif
109 
110 
111 /* DLL building support on win32 hosts; mostly to workaround their
112  ridiculous implementation of data symbol exporting. */
113 #if !defined LT_SCOPE
114 # if defined __WINDOWS__ || defined __CYGWIN__
115 # if defined DLL_EXPORT /* defined by libtool (if required) */
116 # define LT_SCOPE extern __declspec(dllexport)
117 # endif
118 # if defined LIBLTDL_DLL_IMPORT /* define if linking with this dll */
119  /* note: cygwin/mingw compilers can rely instead on auto-import */
120 # define LT_SCOPE extern __declspec(dllimport)
121 # endif
122 # endif
123 # if !defined LT_SCOPE /* static linking or !__WINDOWS__ */
124 # define LT_SCOPE extern
125 # endif
126 #endif
127 
128 #if defined __WINDOWS__
129 /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
130  separator when it is set. */
131 # define LT_DIRSEP_CHAR '\\'
132 # define LT_PATHSEP_CHAR ';'
133 #else
134 # define LT_PATHSEP_CHAR ':'
135 #endif
136 
137 #if defined _MSC_VER /* Visual Studio */
138 # define R_OK 4
139 #endif
140 
141 /* fopen() mode flags for reading a text file */
142 #undef LT_READTEXT_MODE
143 #if defined __WINDOWS__ || defined __CYGWIN__
144 # define LT_READTEXT_MODE "rt"
145 #else
146 # define LT_READTEXT_MODE "r"
147 #endif
148 
149 /* The extra indirection to the LT__STR and LT__CONC macros is required so
150  that if the arguments to LT_STR() (or LT_CONC()) are themselves macros,
151  they will be expanded before being quoted. */
152 #ifndef LT_STR
153 # define LT__STR(arg) #arg
154 # define LT_STR(arg) LT__STR(arg)
155 #endif
156 
157 #ifndef LT_CONC
158 # define LT__CONC(a, b) a##b
159 # define LT_CONC(a, b) LT__CONC(a, b)
160 #endif
161 #ifndef LT_CONC3
162 # define LT__CONC3(a, b, c) a##b##c
163 # define LT_CONC3(a, b, c) LT__CONC3(a, b, c)
164 #endif
165 
166 #endif /*!defined LT_SYSTEM_H*/