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