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