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