upload apache
[bottlenecks.git] / rubbos / app / apache2 / include / ap_config.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef AP_CONFIG_H
18 #define AP_CONFIG_H
19
20 #include "apr.h"
21 #include "apr_hooks.h"
22 #include "apr_optional_hooks.h"
23
24 /**
25  * @file ap_config.h
26  * @brief Symbol export macros and hook functions
27  */
28
29 /* Although this file doesn't declare any hooks, declare the hook group here */
30 /** @defgroup hooks Apache Hooks */
31
32 #ifdef DOXYGEN
33 /* define these just so doxygen documents them */
34
35 /**
36  * AP_DECLARE_STATIC is defined when including Apache's Core headers,
37  * to provide static linkage when the dynamic library may be unavailable.
38  *
39  * @see AP_DECLARE_EXPORT
40  *
41  * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
42  * including Apache's Core headers, to import and link the symbols from the 
43  * dynamic Apache Core library and assure appropriate indirection and calling 
44  * conventions at compile time.
45  */
46 # define AP_DECLARE_STATIC
47 /**
48  * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
49  * library, so that all public symbols are exported.
50  *
51  * @see AP_DECLARE_STATIC
52  */
53 # define AP_DECLARE_EXPORT
54
55 #endif /* def DOXYGEN */
56
57 #if !defined(WIN32)
58 /**
59  * Apache Core dso functions are declared with AP_DECLARE(), so they may
60  * use the most appropriate calling convention.  Hook functions and other
61  * Core functions with variable arguments must use AP_DECLARE_NONSTD().
62  * @code
63  * AP_DECLARE(rettype) ap_func(args)
64  * @endcode
65  */
66 #define AP_DECLARE(type)            type
67
68 /**
69  * Apache Core dso variable argument and hook functions are declared with 
70  * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
71  * @see AP_DECLARE
72  * @code
73  * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
74  * @endcode
75  */
76 #define AP_DECLARE_NONSTD(type)     type
77
78 /**
79  * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
80  * This assures the appropriate indirection is invoked at compile time.
81  *
82  * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
83  * declarations within headers to properly import the variable.
84  * @code
85  * AP_DECLARE_DATA type apr_variable
86  * @endcode
87  */
88 #define AP_DECLARE_DATA
89
90 #elif defined(AP_DECLARE_STATIC)
91 #define AP_DECLARE(type)            type __stdcall
92 #define AP_DECLARE_NONSTD(type)     type
93 #define AP_DECLARE_DATA
94 #elif defined(AP_DECLARE_EXPORT)
95 #define AP_DECLARE(type)            __declspec(dllexport) type __stdcall
96 #define AP_DECLARE_NONSTD(type)     __declspec(dllexport) type
97 #define AP_DECLARE_DATA             __declspec(dllexport)
98 #else
99 #define AP_DECLARE(type)            __declspec(dllimport) type __stdcall
100 #define AP_DECLARE_NONSTD(type)     __declspec(dllimport) type
101 #define AP_DECLARE_DATA             __declspec(dllimport)
102 #endif
103
104 #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
105 /**
106  * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
107  *
108  * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols 
109  * declared with AP_MODULE_DECLARE_DATA are always exported.
110  * @code
111  * module AP_MODULE_DECLARE_DATA mod_tag
112  * @endcode
113  */
114 #if defined(WIN32)
115 #define AP_MODULE_DECLARE(type)            type __stdcall
116 #else
117 #define AP_MODULE_DECLARE(type)            type
118 #endif
119 #define AP_MODULE_DECLARE_NONSTD(type)     type
120 #define AP_MODULE_DECLARE_DATA
121 #else
122 /**
123  * AP_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
124  * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
125  *
126  * The old SHARED_MODULE compile-time symbol is now the default behavior, 
127  * so it is no longer referenced anywhere with Apache 2.0.
128  */
129 #define AP_MODULE_DECLARE_EXPORT
130 #define AP_MODULE_DECLARE(type)          __declspec(dllexport) type __stdcall
131 #define AP_MODULE_DECLARE_NONSTD(type)   __declspec(dllexport) type
132 #define AP_MODULE_DECLARE_DATA           __declspec(dllexport)
133 #endif
134
135 /**
136  * Declare a hook function
137  * @param ret The return type of the hook
138  * @param name The hook's name (as a literal)
139  * @param args The arguments the hook function takes, in brackets.
140  */
141 #define AP_DECLARE_HOOK(ret,name,args) \
142         APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
143
144 /** @internal */
145 #define AP_IMPLEMENT_HOOK_BASE(name) \
146         APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
147
148 /**
149  * Implement an Apache core hook that has no return code, and
150  * therefore runs all of the registered functions. The implementation
151  * is called ap_run_<i>name</i>.
152  *
153  * @param name The name of the hook
154  * @param args_decl The declaration of the arguments for the hook, for example
155  * "(int x,void *y)"
156  * @param args_use The arguments for the hook as used in a call, for example
157  * "(x,y)"
158  * @note If IMPLEMENTing a hook that is not linked into the Apache core,
159  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
160  */
161 #define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
162         APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
163
164 /**
165  * Implement an Apache core hook that runs until one of the functions
166  * returns something other than ok or decline. That return value is
167  * then returned from the hook runner. If the hooks run to completion,
168  * then ok is returned. Note that if no hook runs it would probably be
169  * more correct to return decline, but this currently does not do
170  * so. The implementation is called ap_run_<i>name</i>.
171  *
172  * @param ret The return type of the hook (and the hook runner)
173  * @param name The name of the hook
174  * @param args_decl The declaration of the arguments for the hook, for example
175  * "(int x,void *y)"
176  * @param args_use The arguments for the hook as used in a call, for example
177  * "(x,y)"
178  * @param ok The "ok" return value
179  * @param decline The "decline" return value
180  * @return ok, decline or an error.
181  * @note If IMPLEMENTing a hook that is not linked into the Apache core,
182  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
183  */
184 #define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
185         APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
186                                             args_use,ok,decline)
187
188 /**
189  * Implement a hook that runs until a function returns something other than 
190  * decline. If all functions return decline, the hook runner returns decline. 
191  * The implementation is called ap_run_<i>name</i>.
192  *
193  * @param ret The return type of the hook (and the hook runner)
194  * @param name The name of the hook
195  * @param args_decl The declaration of the arguments for the hook, for example
196  * "(int x,void *y)"
197  * @param args_use The arguments for the hook as used in a call, for example
198  * "(x,y)"
199  * @param decline The "decline" return value
200  * @return decline or an error.
201  * @note If IMPLEMENTing a hook that is not linked into the Apache core
202  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
203  */
204 #define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
205         APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
206                                               args_use,decline)
207
208 /* Note that the other optional hook implementations are straightforward but
209  * have not yet been needed
210  */
211
212 /**
213  * Implement an optional hook. This is exactly the same as a standard hook
214  * implementation, except the hook is optional.
215  * @see AP_IMPLEMENT_HOOK_RUN_ALL
216  */
217 #define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
218                                            decline) \
219         APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
220                                             args_use,ok,decline)
221
222 /**
223  * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
224  * function.
225  */
226 #define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
227         APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
228
229 #include "os.h"
230 #if !defined(WIN32) && !defined(NETWARE)
231 #include "ap_config_auto.h"
232 #include "ap_config_layout.h"
233 #endif
234 #if defined(NETWARE)
235 #define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
236 #endif
237
238 /* TODO - We need to put OS detection back to make all the following work */
239
240 #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \
241     || defined (UW) || defined(LYNXOS) || defined(TPF)
242 /* These systems don't do well with any lingering close code; I don't know
243  * why -- manoj */
244 #define NO_LINGCLOSE
245 #endif
246
247 /* If APR has OTHER_CHILD logic, use reliable piped logs. */
248 #if APR_HAS_OTHER_CHILD
249 #define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
250 #endif
251
252 #if APR_CHARSET_EBCDIC && !defined(APACHE_XLATE)
253 #define APACHE_XLATE
254 #endif
255
256 #endif /* AP_CONFIG_H */