]> git.sur5r.net Git - openldap/blob - include/ldap_cdefs.h
Fix bad merge of dnl multimaster
[openldap] / include / ldap_cdefs.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11 /* LDAP C Defines */
12
13 #ifndef _LDAP_CDEFS_H
14 #define _LDAP_CDEFS_H
15
16 #if defined(__cplusplus) || defined(c_plusplus)
17 #       define LDAP_BEGIN_DECL  extern "C" {
18 #       define LDAP_END_DECL    }
19 #else
20 #       define LDAP_BEGIN_DECL  /* begin declarations */
21 #       define LDAP_END_DECL    /* end declarations */
22 #endif
23
24 #if !defined(LDAP_NO_PROTOTYPES) && ( defined(LDAP_NEEDS_PROTOTYPES) || \
25         defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
26
27         /* ANSI C or C++ */
28 #       define LDAP_P(protos)   protos
29 #       define LDAP_CONCAT1(x,y)        x ## y
30 #       define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
31 #       define LDAP_STRING(x)   #x /* stringify without expanding x */
32 #       define LDAP_XSTRING(x)  LDAP_STRING(x) /* expand x, then stringify */
33
34 #ifndef LDAP_CONST
35 #       define LDAP_CONST       const
36 #endif
37
38 #else /* no prototypes */
39
40         /* traditional C */
41 #       define LDAP_P(protos)   ()
42 #       define LDAP_CONCAT(x,y) x/**/y
43 #       define LDAP_STRING(x)   "x"
44
45 #ifndef LDAP_CONST
46 #       define LDAP_CONST       /* no const */
47 #endif
48
49 #endif /* no prototypes */
50
51 #if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
52 #       define LDAP_GCCATTR(attrs)      __attribute__(attrs)
53 #else
54 #       define LDAP_GCCATTR(attrs)
55 #endif
56
57
58 /* Support for NT dynamic libraries. */
59
60 /* LBER library */
61 #if defined(LBER_DECL) && defined(_WIN32)
62 #       define LBER_F(type)             extern __declspec(LBER_DECL) type
63 #       define LBER_V(type)             extern __declspec(LBER_DECL) type
64 #else
65 #       define LBER_F(type)             extern type
66 #       define LBER_V(type)             extern type
67 #endif
68
69 /* LDAP library */
70 #if defined(LDAP_DECL) && defined(_WIN32)
71 #       define LDAP_F(type)             extern __declspec(LDAP_DECL) type
72 #       define LDAP_V(type)             extern __declspec(LDAP_DECL) type
73 #else
74 #       define LDAP_F(type)             extern type
75 #       define LDAP_V(type)             extern type
76 #endif
77
78 /*
79  * C library. Mingw32 links with the C run-time library by default,
80  * so the explicit definition of CSTATIC will keep dllimport from
81  * being defined.
82  */
83 #if (defined(__MINGW32__) && !defined(CSTATIC) || \
84      defined(_WIN32) && defined(_DLL))
85 #       define LDAP_LIBC_F(type)        extern __declspec(dllimport) type
86 #       define LDAP_LIBC_V(type)        extern __declspec(dllimport) type
87 #else
88 #       define LDAP_LIBC_F(type)        extern type
89 #       define LDAP_LIBC_V(type)        extern type
90 #endif
91
92 /* AVL library */
93 #if defined(LDAP_AVL_DECL) && defined(_WIN32)
94 #       define LDAP_AVL_F(type) extern __declspec(LDAP_AVL_DECL) type
95 #       define LDAP_AVL_V(type) extern __declspec(LDAP_AVL_DECL) type
96 #else
97 #       define LDAP_AVL_F(type) extern type
98 #       define LDAP_AVL_V(type) extern type
99 #endif
100
101 /* LDBM library */
102 #if defined(LDAP_LDBM_DECL) && defined(_WIN32)
103 #       define LDAP_LDBM_F(type)        extern __declspec(LDAP_LDBM_DECL) type
104 #       define LDAP_LDBM_V(type)        extern __declspec(LDAP_LDBM_DECL) type
105 #else
106 #       define LDAP_LDBM_F(type)        extern type
107 #       define LDAP_LDBM_V(type)        extern type
108 #endif
109
110 /* LDIF library */
111 #if defined(LDAP_LDIF_DECL) && defined(_WIN32)
112 #       define LDAP_LDIF_F(type)        extern __declspec(LDAP_LDIF_DECL) type
113 #       define LDAP_LDIF_V(type)        extern __declspec(LDAP_LDIF_DECL) type
114 #else
115 #       define LDAP_LDIF_F(type)        extern type
116 #       define LDAP_LDIF_V(type)        extern type
117 #endif
118
119 /* LUNICODE library */
120 #if defined(LDAP_LUNICODE_DECL) && defined(_WIN32)
121 #       define LDAP_LUNICODE_F(type)    extern __declspec(LDAP_LUNICODE_DECL) type
122 #       define LDAP_LUNICODE_V(type)    extern __declspec(LDAP_LUNICODE_DECL) type
123 #else
124 #       define LDAP_LUNICODE_F(type)    extern type
125 #       define LDAP_LUNICODE_V(type)    extern type
126 #endif
127
128 /* LUTIL library */
129 #if defined(LDAP_LUTIL_DECL) && defined(_WIN32)
130 #       define LDAP_LUTIL_F(type)       extern __declspec(LDAP_LUTIL_DECL) type
131 #       define LDAP_LUTIL_V(type)       extern __declspec(LDAP_LUTIL_DECL) type
132 #else
133 #       define LDAP_LUTIL_F(type)       extern type
134 #       define LDAP_LUTIL_V(type)       extern type
135 #endif
136
137 /* SLAPD (as a module exporting symbols) */
138 #if defined(LDAP_SLAPD_DECL) && defined(_WIN32)
139 #       define LDAP_SLAPD_F(type)       extern __declspec(LDAP_SLAPD_DECL) type
140 #       define LDAP_SLAPD_V(type)       extern __declspec(LDAP_SLAPD_DECL) type
141 #else
142 #       define LDAP_SLAPD_F(type)       extern type
143 #       define LDAP_SLAPD_V(type)       extern type
144 #endif
145
146 #endif /* _LDAP_CDEFS_H */