apr_version.h revision 251875
1251875Speter/* Licensed to the Apache Software Foundation (ASF) under one or more
2251875Speter * contributor license agreements.  See the NOTICE file distributed with
3251875Speter * this work for additional information regarding copyright ownership.
4251875Speter * The ASF licenses this file to You under the Apache License, Version 2.0
5251875Speter * (the "License"); you may not use this file except in compliance with
6251875Speter * the License.  You may obtain a copy of the License at
7251875Speter *
8251875Speter *     http://www.apache.org/licenses/LICENSE-2.0
9251875Speter *
10251875Speter * Unless required by applicable law or agreed to in writing, software
11251875Speter * distributed under the License is distributed on an "AS IS" BASIS,
12251875Speter * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13251875Speter * See the License for the specific language governing permissions and
14251875Speter * limitations under the License.
15251875Speter */
16251875Speter
17251875Speter#ifndef APR_VERSION_H
18251875Speter#define APR_VERSION_H
19251875Speter
20251875Speter/**
21251875Speter * @file apr_version.h
22251875Speter * @brief APR Versioning Interface
23251875Speter *
24251875Speter * APR's Version
25251875Speter *
26251875Speter * There are several different mechanisms for accessing the version. There
27251875Speter * is a string form, and a set of numbers; in addition, there are constants
28251875Speter * which can be compiled into your application, and you can query the library
29251875Speter * being used for its actual version.
30251875Speter *
31251875Speter * Note that it is possible for an application to detect that it has been
32251875Speter * compiled against a different version of APR by use of the compile-time
33251875Speter * constants and the use of the run-time query function.
34251875Speter *
35251875Speter * APR version numbering follows the guidelines specified in:
36251875Speter *
37251875Speter *     http://apr.apache.org/versioning.html
38251875Speter */
39251875Speter
40251875Speter
41251875Speter/* The numeric compile-time version constants. These constants are the
42251875Speter * authoritative version numbers for APR.
43251875Speter */
44251875Speter
45251875Speter/** major version
46251875Speter * Major API changes that could cause compatibility problems for older
47251875Speter * programs such as structure size changes.  No binary compatibility is
48251875Speter * possible across a change in the major version.
49251875Speter */
50251875Speter#define APR_MAJOR_VERSION       1
51251875Speter
52251875Speter/** minor version
53251875Speter * Minor API changes that do not cause binary compatibility problems.
54251875Speter * Reset to 0 when upgrading APR_MAJOR_VERSION
55251875Speter */
56251875Speter#define APR_MINOR_VERSION       4
57251875Speter
58251875Speter/** patch level
59251875Speter * The Patch Level never includes API changes, simply bug fixes.
60251875Speter * Reset to 0 when upgrading APR_MINOR_VERSION
61251875Speter */
62251875Speter#define APR_PATCH_VERSION       6
63251875Speter
64251875Speter/**
65251875Speter * The symbol APR_IS_DEV_VERSION is only defined for internal,
66251875Speter * "development" copies of APR.  It is undefined for released versions
67251875Speter * of APR.
68251875Speter */
69251875Speter/* #define APR_IS_DEV_VERSION */
70251875Speter
71251875Speter/**
72251875Speter * Check at compile time if the APR version is at least a certain
73251875Speter * level.
74251875Speter * @param major The major version component of the version checked
75251875Speter * for (e.g., the "1" of "1.3.0").
76251875Speter * @param minor The minor version component of the version checked
77251875Speter * for (e.g., the "3" of "1.3.0").
78251875Speter * @param patch The patch level component of the version checked
79251875Speter * for (e.g., the "0" of "1.3.0").
80251875Speter * @remark This macro is available with APR versions starting with
81251875Speter * 1.3.0.
82251875Speter */
83251875Speter#define APR_VERSION_AT_LEAST(major,minor,patch)                    \
84251875Speter(((major) < APR_MAJOR_VERSION)                                     \
85251875Speter || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
86251875Speter || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
87251875Speter
88251875Speter#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
89251875Speter/** Internal: string form of the "is dev" flag */
90251875Speter#define APR_IS_DEV_STRING "-dev"
91251875Speter#else
92251875Speter#define APR_IS_DEV_STRING ""
93251875Speter#endif
94251875Speter
95251875Speter/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
96251875Speter#ifndef APR_STRINGIFY
97251875Speter/** Properly quote a value as a string in the C preprocessor */
98251875Speter#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
99251875Speter/** Helper macro for APR_STRINGIFY */
100251875Speter#define APR_STRINGIFY_HELPER(n) #n
101251875Speter#endif
102251875Speter
103251875Speter/** The formatted string of APR's version */
104251875Speter#define APR_VERSION_STRING \
105251875Speter     APR_STRINGIFY(APR_MAJOR_VERSION) "." \
106251875Speter     APR_STRINGIFY(APR_MINOR_VERSION) "." \
107251875Speter     APR_STRINGIFY(APR_PATCH_VERSION) \
108251875Speter     APR_IS_DEV_STRING
109251875Speter
110251875Speter/** An alternative formatted string of APR's version */
111251875Speter/* macro for Win32 .rc files using numeric csv representation */
112251875Speter#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
113251875Speter                             ##APR_MINOR_VERSION ##, \
114251875Speter                             ##APR_PATCH_VERSION
115251875Speter
116251875Speter
117251875Speter#ifndef APR_VERSION_ONLY
118251875Speter
119251875Speter/* The C language API to access the version at run time,
120251875Speter * as opposed to compile time.  APR_VERSION_ONLY may be defined
121251875Speter * externally when preprocessing apr_version.h to obtain strictly
122251875Speter * the C Preprocessor macro declarations.
123251875Speter */
124251875Speter
125251875Speter#include "apr.h"
126251875Speter
127251875Speter#ifdef __cplusplus
128251875Speterextern "C" {
129251875Speter#endif
130251875Speter
131251875Speter/**
132251875Speter * The numeric version information is broken out into fields within this
133251875Speter * structure.
134251875Speter */
135251875Spetertypedef struct {
136251875Speter    int major;      /**< major number */
137251875Speter    int minor;      /**< minor number */
138251875Speter    int patch;      /**< patch number */
139251875Speter    int is_dev;     /**< is development (1 or 0) */
140251875Speter} apr_version_t;
141251875Speter
142251875Speter/**
143251875Speter * Return APR's version information information in a numeric form.
144251875Speter *
145251875Speter *  @param pvsn Pointer to a version structure for returning the version
146251875Speter *              information.
147251875Speter */
148251875SpeterAPR_DECLARE(void) apr_version(apr_version_t *pvsn);
149251875Speter
150251875Speter/** Return APR's version information as a string. */
151251875SpeterAPR_DECLARE(const char *) apr_version_string(void);
152251875Speter
153251875Speter#ifdef __cplusplus
154251875Speter}
155251875Speter#endif
156251875Speter
157251875Speter#endif /* ndef APR_VERSION_ONLY */
158251875Speter
159251875Speter#endif /* ndef APR_VERSION_H */
160