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 /* The numeric compile-time version constants. These constants are the
42  * authoritative version numbers for APR.
43  */
44 
45 /** major version
46  * Major API changes that could cause compatibility problems for older
47  * programs such as structure size changes.  No binary compatibility is
48  * possible across a change in the major version.
49  */
50 #define APR_MAJOR_VERSION       1
51 
52 /** minor version
53  * Minor API changes that do not cause binary compatibility problems.
54  * Reset to 0 when upgrading APR_MAJOR_VERSION
55  */
56 #define APR_MINOR_VERSION       2
57 
58 /** patch level
59  * The Patch Level never includes API changes, simply bug fixes.
60  * Reset to 0 when upgrading APR_MINOR_VERSION
61  */
62 #define APR_PATCH_VERSION       8
63 
64 /**
65  * The symbol APR_IS_DEV_VERSION is only defined for internal,
66  * "development" copies of APR.  It is undefined for released versions
67  * of APR.
68  */
69 /* #define APR_IS_DEV_VERSION */
70 
71 
72 #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
73 /** Internal: string form of the "is dev" flag */
74 #define APR_IS_DEV_STRING "-dev"
75 #else
76 #define APR_IS_DEV_STRING ""
77 #endif
78 
79 /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
80 #ifndef APR_STRINGIFY
81 /** Properly quote a value as a string in the C preprocessor */
82 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
83 /** Helper macro for APR_STRINGIFY */
84 #define APR_STRINGIFY_HELPER(n) #n
85 #endif
86 
87 /** The formatted string of APR's version */
88 #define APR_VERSION_STRING \
89      APR_STRINGIFY(APR_MAJOR_VERSION) "." \
90      APR_STRINGIFY(APR_MINOR_VERSION) "." \
91      APR_STRINGIFY(APR_PATCH_VERSION) \
92      APR_IS_DEV_STRING
93 
94 /** An alternative formatted string of APR's version */
95 /* macro for Win32 .rc files using numeric csv representation */
96 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
97                              ##APR_MINOR_VERSION ##, \
98                              ##APR_PATCH_VERSION
99 
100 
101 #ifndef APR_VERSION_ONLY
102 
103 /* The C language API to access the version at run time,
104  * as opposed to compile time.  APR_VERSION_ONLY may be defined
105  * externally when preprocessing apr_version.h to obtain strictly
106  * the C Preprocessor macro declarations.
107  */
108 
109 #include "apr.h"
110 
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 
115 /**
116  * The numeric version information is broken out into fields within this
117  * structure.
118  */
119 typedef struct {
120     int major;      /**< major number */
121     int minor;      /**< minor number */
122     int patch;      /**< patch number */
123     int is_dev;     /**< is development (1 or 0) */
124 } apr_version_t;
125 
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 
134 /** Return APR's version information as a string. */
135 APR_DECLARE(const char *) apr_version_string(void);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* ndef APR_VERSION_ONLY */
142 
143 #endif /* ndef APR_VERSION_H */
144