00001 /* Copyright 1999-2005 The Apache Software Foundation or its licensors, as 00002 * applicable. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef AP_CONFIG_H 00018 #define AP_CONFIG_H 00019 00020 #include "apr.h" 00021 #include "apr_hooks.h" 00022 #include "apr_optional_hooks.h" 00023 00024 /** 00025 * @file ap_config.h 00026 * @brief Symbol export macros and hook functions 00027 */ 00028 00029 /* Although this file doesn't declare any hooks, declare the hook group here */ 00030 /** @defgroup hooks Apache Hooks */ 00031 00032 #ifdef DOXYGEN 00033 /* define these just so doxygen documents them */ 00034 00035 /** 00036 * AP_DECLARE_STATIC is defined when including Apache's Core headers, 00037 * to provide static linkage when the dynamic library may be unavailable. 00038 * 00039 * @see AP_DECLARE_EXPORT 00040 * 00041 * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when 00042 * including Apache's Core headers, to import and link the symbols from the 00043 * dynamic Apache Core library and assure appropriate indirection and calling 00044 * conventions at compile time. 00045 */ 00046 # define AP_DECLARE_STATIC 00047 /** 00048 * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic 00049 * library, so that all public symbols are exported. 00050 * 00051 * @see AP_DECLARE_STATIC 00052 */ 00053 # define AP_DECLARE_EXPORT 00054 00055 #endif /* def DOXYGEN */ 00056 00057 #if !defined(WIN32) 00058 /** 00059 * Apache Core dso functions are declared with AP_DECLARE(), so they may 00060 * use the most appropriate calling convention. Hook functions and other 00061 * Core functions with variable arguments must use AP_DECLARE_NONSTD(). 00062 * @code 00063 * AP_DECLARE(rettype) ap_func(args) 00064 * @endcode 00065 */ 00066 #define AP_DECLARE(type) type 00067 00068 /** 00069 * Apache Core dso variable argument and hook functions are declared with 00070 * AP_DECLARE_NONSTD(), as they must use the C language calling convention. 00071 * @see AP_DECLARE 00072 * @code 00073 * AP_DECLARE_NONSTD(rettype) ap_func(args [...]) 00074 * @endcode 00075 */ 00076 #define AP_DECLARE_NONSTD(type) type 00077 00078 /** 00079 * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA. 00080 * This assures the appropriate indirection is invoked at compile time. 00081 * 00082 * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for 00083 * declarations within headers to properly import the variable. 00084 * @code 00085 * AP_DECLARE_DATA type apr_variable 00086 * @endcode 00087 */ 00088 #define AP_DECLARE_DATA 00089 00090 #elif defined(AP_DECLARE_STATIC) 00091 #define AP_DECLARE(type) type __stdcall 00092 #define AP_DECLARE_NONSTD(type) type 00093 #define AP_DECLARE_DATA 00094 #elif defined(AP_DECLARE_EXPORT) 00095 #define AP_DECLARE(type) __declspec(dllexport) type __stdcall 00096 #define AP_DECLARE_NONSTD(type) __declspec(dllexport) type 00097 #define AP_DECLARE_DATA __declspec(dllexport) 00098 #else 00099 #define AP_DECLARE(type) __declspec(dllimport) type __stdcall 00100 #define AP_DECLARE_NONSTD(type) __declspec(dllimport) type 00101 #define AP_DECLARE_DATA __declspec(dllimport) 00102 #endif 00103 00104 #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC) 00105 /** 00106 * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA. 00107 * 00108 * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols 00109 * declared with AP_MODULE_DECLARE_DATA are always exported. 00110 * @code 00111 * module AP_MODULE_DECLARE_DATA mod_tag 00112 * @endcode 00113 */ 00114 #if defined(WIN32) 00115 #define AP_MODULE_DECLARE(type) type __stdcall 00116 #else 00117 #define AP_MODULE_DECLARE(type) type 00118 #endif 00119 #define AP_MODULE_DECLARE_NONSTD(type) type 00120 #define AP_MODULE_DECLARE_DATA 00121 #else 00122 /** 00123 * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the 00124 * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined. 00125 * 00126 * The old SHARED_MODULE compile-time symbol is now the default behavior, 00127 * so it is no longer referenced anywhere with Apache 2.0. 00128 */ 00129 #define AP_MODULE_DECLARE_EXPORT 00130 #define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall 00131 #define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type 00132 #define AP_MODULE_DECLARE_DATA __declspec(dllexport) 00133 #endif 00134 00135 /** 00136 * Declare a hook function 00137 * @param ret The return type of the hook 00138 * @param name The hook's name (as a literal) 00139 * @param args The arguments the hook function takes, in brackets. 00140 */ 00141 #define AP_DECLARE_HOOK(ret,name,args) \ 00142 APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args) 00143 00144 /** @internal */ 00145 #define AP_IMPLEMENT_HOOK_BASE(name) \ 00146 APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name) 00147 00148 /** 00149 * Implement an Apache core hook that has no return code, and 00150 * therefore runs all of the registered functions. The implementation 00151 * is called ap_run_<i>name</i>. 00152 * 00153 * @param name The name of the hook 00154 * @param args_decl The declaration of the arguments for the hook, for example 00155 * "(int x,void *y)" 00156 * @param args_use The arguments for the hook as used in a call, for example 00157 * "(x,y)" 00158 * @note If IMPLEMENTing a hook that is not linked into the Apache core, 00159 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID. 00160 */ 00161 #define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \ 00162 APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use) 00163 00164 /** 00165 * Implement an Apache core hook that runs until one of the functions 00166 * returns something other than ok or decline. That return value is 00167 * then returned from the hook runner. If the hooks run to completion, 00168 * then ok is returned. Note that if no hook runs it would probably be 00169 * more correct to return decline, but this currently does not do 00170 * so. The implementation is called ap_run_<i>name</i>. 00171 * 00172 * @param ret The return type of the hook (and the hook runner) 00173 * @param name The name of the hook 00174 * @param args_decl The declaration of the arguments for the hook, for example 00175 * "(int x,void *y)" 00176 * @param args_use The arguments for the hook as used in a call, for example 00177 * "(x,y)" 00178 * @param ok The "ok" return value 00179 * @param decline The "decline" return value 00180 * @return ok, decline or an error. 00181 * @note If IMPLEMENTing a hook that is not linked into the Apache core, 00182 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL. 00183 */ 00184 #define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \ 00185 APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ 00186 args_use,ok,decline) 00187 00188 /** 00189 * Implement a hook that runs until a function returns something other than 00190 * decline. If all functions return decline, the hook runner returns decline. 00191 * The implementation is called ap_run_<i>name</i>. 00192 * 00193 * @param ret The return type of the hook (and the hook runner) 00194 * @param name The name of the hook 00195 * @param args_decl The declaration of the arguments for the hook, for example 00196 * "(int x,void *y)" 00197 * @param args_use The arguments for the hook as used in a call, for example 00198 * "(x,y)" 00199 * @param decline The "decline" return value 00200 * @return decline or an error. 00201 * @note If IMPLEMENTing a hook that is not linked into the Apache core 00202 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST. 00203 */ 00204 #define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \ 00205 APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \ 00206 args_use,decline) 00207 00208 /* Note that the other optional hook implementations are straightforward but 00209 * have not yet been needed 00210 */ 00211 00212 /** 00213 * Implement an optional hook. This is exactly the same as a standard hook 00214 * implementation, except the hook is optional. 00215 * @see AP_IMPLEMENT_HOOK_RUN_ALL 00216 */ 00217 #define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \ 00218 decline) \ 00219 APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ 00220 args_use,ok,decline) 00221 00222 /** 00223 * Hook an optional hook. Unlike static hooks, this uses a macro instead of a 00224 * function. 00225 */ 00226 #define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \ 00227 APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order) 00228 00229 #include "os.h" 00230 #if !defined(WIN32) && !defined(NETWARE) 00231 #include "ap_config_auto.h" 00232 #include "ap_config_layout.h" 00233 #endif 00234 #if defined(NETWARE) 00235 #define AP_NONBLOCK_WHEN_MULTI_LISTEN 1 00236 #endif 00237 00238 /* TODO - We need to put OS detection back to make all the following work */ 00239 00240 #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \ 00241 || defined (UW) || defined(LYNXOS) || defined(TPF) 00242 /* These systems don't do well with any lingering close code; I don't know 00243 * why -- manoj */ 00244 #define NO_LINGCLOSE 00245 #endif 00246 00247 /* If APR has OTHER_CHILD logic, use reliable piped logs. */ 00248 #if APR_HAS_OTHER_CHILD 00249 #define AP_HAVE_RELIABLE_PIPED_LOGS TRUE 00250 #endif 00251 00252 #if APR_CHARSET_EBCDIC && !defined(APACHE_XLATE) 00253 #define APACHE_XLATE 00254 #endif 00255 00256 #endif /* AP_CONFIG_H */