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