apr_version.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #ifndef APR_VERSION_H
  17. #define APR_VERSION_H
  18. /**
  19. * @file apr_version.h
  20. * @brief APR Versioning Interface
  21. *
  22. * APR's Version
  23. *
  24. * There are several different mechanisms for accessing the version. There
  25. * is a string form, and a set of numbers; in addition, there are constants
  26. * which can be compiled into your application, and you can query the library
  27. * being used for its actual version.
  28. *
  29. * Note that it is possible for an application to detect that it has been
  30. * compiled against a different version of APR by use of the compile-time
  31. * constants and the use of the run-time query function.
  32. *
  33. * APR version numbering follows the guidelines specified in:
  34. *
  35. * http://apr.apache.org/versioning.html
  36. */
  37. #define APR_COPYRIGHT "Copyright (c) 2000-2019 The Apache Software " \
  38. "Foundation or its licensors, as applicable."
  39. /* The numeric compile-time version constants. These constants are the
  40. * authoritative version numbers for APR.
  41. */
  42. /** major version
  43. * Major API changes that could cause compatibility problems for older
  44. * programs such as structure size changes. No binary compatibility is
  45. * possible across a change in the major version.
  46. */
  47. #define APR_MAJOR_VERSION 1
  48. /** minor version
  49. * Minor API changes that do not cause binary compatibility problems.
  50. * Reset to 0 when upgrading APR_MAJOR_VERSION
  51. */
  52. #define APR_MINOR_VERSION 7
  53. /** patch level
  54. * The Patch Level never includes API changes, simply bug fixes.
  55. * Reset to 0 when upgrading APR_MINOR_VERSION
  56. */
  57. #define APR_PATCH_VERSION 0
  58. /**
  59. * The symbol APR_IS_DEV_VERSION is only defined for internal,
  60. * "development" copies of APR. It is undefined for released versions
  61. * of APR.
  62. */
  63. /* #undef APR_IS_DEV_VERSION */
  64. /**
  65. * Check at compile time if the APR version is at least a certain
  66. * level.
  67. * @param major The major version component of the version checked
  68. * for (e.g., the "1" of "1.3.0").
  69. * @param minor The minor version component of the version checked
  70. * for (e.g., the "3" of "1.3.0").
  71. * @param patch The patch level component of the version checked
  72. * for (e.g., the "0" of "1.3.0").
  73. * @remark This macro is available with APR versions starting with
  74. * 1.3.0.
  75. */
  76. #define APR_VERSION_AT_LEAST(major,minor,patch) \
  77. (((major) < APR_MAJOR_VERSION) \
  78. || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
  79. || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
  80. #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
  81. /** Internal: string form of the "is dev" flag */
  82. #ifndef APR_IS_DEV_STRING
  83. #define APR_IS_DEV_STRING "-dev"
  84. #endif
  85. #else
  86. #define APR_IS_DEV_STRING ""
  87. #endif
  88. /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
  89. #ifndef APR_STRINGIFY
  90. /** Properly quote a value as a string in the C preprocessor */
  91. #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  92. /** Helper macro for APR_STRINGIFY */
  93. #define APR_STRINGIFY_HELPER(n) #n
  94. #endif
  95. /** The formatted string of APR's version */
  96. #define APR_VERSION_STRING \
  97. APR_STRINGIFY(APR_MAJOR_VERSION) "." \
  98. APR_STRINGIFY(APR_MINOR_VERSION) "." \
  99. APR_STRINGIFY(APR_PATCH_VERSION) \
  100. APR_IS_DEV_STRING
  101. /** An alternative formatted string of APR's version */
  102. /* macro for Win32 .rc files using numeric csv representation */
  103. #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
  104. ##APR_MINOR_VERSION ##, \
  105. ##APR_PATCH_VERSION
  106. #ifndef APR_VERSION_ONLY
  107. /* The C language API to access the version at run time,
  108. * as opposed to compile time. APR_VERSION_ONLY may be defined
  109. * externally when preprocessing apr_version.h to obtain strictly
  110. * the C Preprocessor macro declarations.
  111. */
  112. #include "apr.h"
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif
  116. /**
  117. * The numeric version information is broken out into fields within this
  118. * structure.
  119. */
  120. typedef struct {
  121. int major; /**< major number */
  122. int minor; /**< minor number */
  123. int patch; /**< patch number */
  124. int is_dev; /**< is development (1 or 0) */
  125. } apr_version_t;
  126. /**
  127. * Return APR's version information information in a numeric form.
  128. *
  129. * @param pvsn Pointer to a version structure for returning the version
  130. * information.
  131. */
  132. APR_DECLARE(void) apr_version(apr_version_t *pvsn);
  133. /** Return APR's version information as a string. */
  134. APR_DECLARE(const char *) apr_version_string(void);
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* ndef APR_VERSION_ONLY */
  139. #endif /* ndef APR_VERSION_H */