ap_config.inc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. * @file ap_config.h
  18. * @brief Symbol export macros and hook functions
  19. *}
  20. {$ifndef AP_CONFIG_H}
  21. {$define AP_CONFIG_H}
  22. //#include "ap_hooks.h"
  23. {* Although this file doesn't declare any hooks, declare the exports group here *}
  24. {**
  25. * @defgroup exports Apache exports
  26. * @ingroup APACHE_CORE
  27. *}
  28. {$ifdef DOXYGEN}
  29. {* define these just so doxygen documents them *}
  30. {**
  31. * AP_DECLARE_STATIC is defined when including Apache's Core headers,
  32. * to provide static linkage when the dynamic library may be unavailable.
  33. *
  34. * @see AP_DECLARE_EXPORT
  35. *
  36. * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
  37. * including Apache's Core headers, to import and link the symbols from the
  38. * dynamic Apache Core library and assure appropriate indirection and calling
  39. * conventions at compile time.
  40. *}
  41. {$define AP_DECLARE_STATIC}
  42. {**
  43. * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
  44. * library, so that all public symbols are exported.
  45. *
  46. * @see AP_DECLARE_STATIC
  47. *}
  48. {$define AP_DECLARE_EXPORT}
  49. {$endif} {* def DOXYGEN *}
  50. (* freepascal: calling conventions are handled individually at the
  51. function/procedure declarations*)
  52. {*
  53. #if !defined(WIN32)
  54. /**
  55. * Apache Core dso functions are declared with AP_DECLARE(), so they may
  56. * use the most appropriate calling convention. Hook functions and other
  57. * Core functions with variable arguments must use AP_DECLARE_NONSTD().
  58. * @code
  59. * AP_DECLARE(rettype) ap_func(args)
  60. * @endcode
  61. */
  62. #define AP_DECLARE(type) type
  63. /**
  64. * Apache Core dso variable argument and hook functions are declared with
  65. * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
  66. * @see AP_DECLARE
  67. * @code
  68. * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
  69. * @endcode
  70. */
  71. #define AP_DECLARE_NONSTD(type) type
  72. /**
  73. * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
  74. * This assures the appropriate indirection is invoked at compile time.
  75. *
  76. * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
  77. * declarations within headers to properly import the variable.
  78. * @code
  79. * AP_DECLARE_DATA type apr_variable
  80. * @endcode
  81. */
  82. #define AP_DECLARE_DATA
  83. #elif defined(AP_DECLARE_STATIC)
  84. #define AP_DECLARE(type) type __stdcall
  85. #define AP_DECLARE_NONSTD(type) type
  86. #define AP_DECLARE_DATA
  87. #elif defined(AP_DECLARE_EXPORT)
  88. #define AP_DECLARE(type) __declspec(dllexport) type __stdcall
  89. #define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
  90. #define AP_DECLARE_DATA __declspec(dllexport)
  91. #else
  92. #define AP_DECLARE(type) __declspec(dllimport) type __stdcall
  93. #define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
  94. #define AP_DECLARE_DATA __declspec(dllimport)
  95. #endif
  96. #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
  97. /**
  98. * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
  99. *
  100. * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
  101. * declared with AP_MODULE_DECLARE_DATA are always exported.
  102. * @code
  103. * module AP_MODULE_DECLARE_DATA mod_tag
  104. * @endcode
  105. */
  106. #if defined(WIN32)
  107. #define AP_MODULE_DECLARE(type) type __stdcall
  108. #else
  109. #define AP_MODULE_DECLARE(type) type
  110. #endif
  111. #define AP_MODULE_DECLARE_NONSTD(type) type
  112. #define AP_MODULE_DECLARE_DATA
  113. #else
  114. /**
  115. * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
  116. * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
  117. *
  118. * The old SHARED_MODULE compile-time symbol is now the default behavior,
  119. * so it is no longer referenced anywhere with Apache 2.0.
  120. */
  121. #define AP_MODULE_DECLARE_EXPORT
  122. #define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
  123. #define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
  124. #define AP_MODULE_DECLARE_DATA __declspec(dllexport)
  125. #endif
  126. #include "os.h"
  127. #if (!defined(WIN32) && !defined(NETWARE)) || defined(__MINGW32__)
  128. #include "ap_config_auto.h"
  129. #endif
  130. #include "ap_config_layout.h"
  131. /* Where the main/parent process's pid is logged */
  132. #ifndef DEFAULT_PIDLOG
  133. #define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
  134. #endif
  135. #if defined(NETWARE)
  136. #define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
  137. #endif
  138. #if defined(AP_ENABLE_DTRACE) && HAVE_SYS_SDT_H
  139. #include <sys/sdt.h>
  140. #else
  141. #undef _DTRACE_VERSION
  142. #endif
  143. #ifdef _DTRACE_VERSION
  144. #include "apache_probes.h"
  145. #else
  146. #include "apache_noprobes.h"
  147. #endif
  148. /* If APR has OTHER_CHILD logic, use reliable piped logs. */
  149. #if APR_HAS_OTHER_CHILD
  150. #define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
  151. #endif
  152. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  153. #define AP_HAVE_C99
  154. #endif
  155. /* Presume that the compiler supports C99-style designated
  156. * initializers if using GCC (but not G++), or for any other compiler
  157. * which claims C99 support. */
  158. #if (defined(__GNUC__) && !defined(__cplusplus)) || defined(AP_HAVE_C99)
  159. #define AP_HAVE_DESIGNATED_INITIALIZER
  160. #endif
  161. #ifndef __has_attribute /* check for supported attributes on clang */
  162. #define __has_attribute(x) 0
  163. #endif
  164. #if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
  165. #define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
  166. #else
  167. #define AP_FN_ATTR_SENTINEL
  168. #endif
  169. #if ( defined(__GNUC__) && \
  170. (__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
  171. || __has_attribute(warn_unused_result)
  172. #define AP_FN_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  173. #else
  174. #define AP_FN_ATTR_WARN_UNUSED_RESULT
  175. #endif
  176. #if ( defined(__GNUC__) && \
  177. (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)) \
  178. || __has_attribute(alloc_size)
  179. #define AP_FN_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
  180. #define AP_FN_ATTR_ALLOC_SIZE2(x,y) __attribute__((alloc_size(x,y)))
  181. #else
  182. #define AP_FN_ATTR_ALLOC_SIZE(x)
  183. #define AP_FN_ATTR_ALLOC_SIZE2(x,y)
  184. #endif
  185. *}
  186. {$endif} {* AP_CONFIG_H *}