Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / libltdl / libltdl / lt_system.h
CommitLineData
8d138742
CE
1/* lt_system.h -- system portability abstraction layer
2
3 Copyright (C) 2004, 2007 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
9GNU Libltdl is free software; you can redistribute it and/or
10modify it under the terms of the GNU Lesser General Public
11License as published by the Free Software Foundation; either
12version 2 of the License, or (at your option) any later version.
13
14As a special exception to the GNU Lesser General Public License,
15if you distribute this file as part of a program or library that
16is built using GNU Libtool, you may include this file under the
17same distribution terms that you use for the rest of that program.
18
19GNU Libltdl is distributed in the hope that it will be useful,
20but WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22GNU Lesser General Public License for more details.
23
24You should have received a copy of the GNU Lesser General Public
25License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27or obtained by writing to the Free Software Foundation, Inc.,
2851 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 which 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/* Canonicalise Windows and Cygwin recognition macros.
80 To match the values set by recent Cygwin compilers, make sure that if
81 __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
82#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
83# define __CYGWIN__ __CYGWIN32__
84#endif
85#if defined(__CYGWIN__)
86# if defined(__WINDOWS__)
87# undef __WINDOWS__
88# endif
89#elif defined(_WIN32)
90# define __WINDOWS__ _WIN32
91#elif defined(WIN32)
92# define __WINDOWS__ WIN32
93#endif
94#if defined(__CYGWIN__) && defined(__WINDOWS__)
95# undef __WINDOWS__
96#endif
97
98
99/* DLL building support on win32 hosts; mostly to workaround their
100 ridiculous implementation of data symbol exporting. */
101#if !defined(LT_SCOPE)
102# if defined(__WINDOWS__) || defined(__CYGWIN__)
103# if defined(DLL_EXPORT) /* defined by libtool (if required) */
104# define LT_SCOPE extern __declspec(dllexport)
105# endif
106# if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */
107 /* note: cygwin/mingw compilers can rely instead on auto-import */
108# define LT_SCOPE extern __declspec(dllimport)
109# endif
110# endif
111# if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */
112# define LT_SCOPE extern
113# endif
114#endif
115
116#if defined(__WINDOWS__)
117/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
118 separator when it is set. */
119# define LT_DIRSEP_CHAR '\\'
120# define LT_PATHSEP_CHAR ';'
121#else
122# define LT_PATHSEP_CHAR ':'
123#endif
124
125#if defined(_MSC_VER) /* Visual Studio */
126# define R_OK 4
127#endif
128
129/* fopen() mode flags for reading a text file */
130#undef LT_READTEXT_MODE
131#if defined(__WINDOWS__) || defined(__CYGWIN__)
132# define LT_READTEXT_MODE "rt"
133#else
134# define LT_READTEXT_MODE "r"
135#endif
136
137/* The extra indirection to the LT__STR and LT__CONC macros is required so
138 that if the arguments to LT_STR() (or LT_CONC()) are themselves macros,
139 they will be expanded before being quoted. */
140#ifndef LT_STR
141# define LT__STR(arg) #arg
142# define LT_STR(arg) LT__STR(arg)
143#endif
144
145#ifndef LT_CONC
146# define LT__CONC(a, b) a##b
147# define LT_CONC(a, b) LT__CONC(a, b)
148#endif
149#ifndef LT_CONC3
150# define LT__CONC3(a, b, c) a##b##c
151# define LT_CONC3(a, b, c) LT__CONC3(a, b, c)
152#endif
153
154#endif /*!defined(LT_SYSTEM_H)*/