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
41269847Speter#define APR_COPYRIGHT "Copyright (c) 2000-2014 The Apache Software " \
42253734Speter                      "Foundation or its licensors, as applicable."
43253734Speter
44251875Speter/* The numeric compile-time version constants. These constants are the
45251875Speter * authoritative version numbers for APR.
46251875Speter */
47251875Speter
48251875Speter/** major version
49251875Speter * Major API changes that could cause compatibility problems for older
50251875Speter * programs such as structure size changes.  No binary compatibility is
51251875Speter * possible across a change in the major version.
52251875Speter */
53251875Speter#define APR_MAJOR_VERSION       1
54251875Speter
55251875Speter/** minor version
56251875Speter * Minor API changes that do not cause binary compatibility problems.
57251875Speter * Reset to 0 when upgrading APR_MAJOR_VERSION
58251875Speter */
59269847Speter#define APR_MINOR_VERSION       5
60251875Speter
61251875Speter/** patch level
62251875Speter * The Patch Level never includes API changes, simply bug fixes.
63251875Speter * Reset to 0 when upgrading APR_MINOR_VERSION
64251875Speter */
65269847Speter#define APR_PATCH_VERSION       1
66251875Speter
67251875Speter/**
68251875Speter * The symbol APR_IS_DEV_VERSION is only defined for internal,
69251875Speter * "development" copies of APR.  It is undefined for released versions
70251875Speter * of APR.
71251875Speter */
72251875Speter/* #define APR_IS_DEV_VERSION */
73251875Speter
74251875Speter/**
75251875Speter * Check at compile time if the APR version is at least a certain
76251875Speter * level.
77251875Speter * @param major The major version component of the version checked
78251875Speter * for (e.g., the "1" of "1.3.0").
79251875Speter * @param minor The minor version component of the version checked
80251875Speter * for (e.g., the "3" of "1.3.0").
81251875Speter * @param patch The patch level component of the version checked
82251875Speter * for (e.g., the "0" of "1.3.0").
83251875Speter * @remark This macro is available with APR versions starting with
84251875Speter * 1.3.0.
85251875Speter */
86251875Speter#define APR_VERSION_AT_LEAST(major,minor,patch)                    \
87251875Speter(((major) < APR_MAJOR_VERSION)                                     \
88251875Speter || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
89251875Speter || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
90251875Speter
91251875Speter#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
92251875Speter/** Internal: string form of the "is dev" flag */
93253734Speter#ifndef APR_IS_DEV_STRING
94251875Speter#define APR_IS_DEV_STRING "-dev"
95253734Speter#endif
96251875Speter#else
97251875Speter#define APR_IS_DEV_STRING ""
98251875Speter#endif
99251875Speter
100251875Speter/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
101251875Speter#ifndef APR_STRINGIFY
102251875Speter/** Properly quote a value as a string in the C preprocessor */
103251875Speter#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
104251875Speter/** Helper macro for APR_STRINGIFY */
105251875Speter#define APR_STRINGIFY_HELPER(n) #n
106251875Speter#endif
107251875Speter
108251875Speter/** The formatted string of APR's version */
109251875Speter#define APR_VERSION_STRING \
110251875Speter     APR_STRINGIFY(APR_MAJOR_VERSION) "." \
111251875Speter     APR_STRINGIFY(APR_MINOR_VERSION) "." \
112251875Speter     APR_STRINGIFY(APR_PATCH_VERSION) \
113251875Speter     APR_IS_DEV_STRING
114251875Speter
115251875Speter/** An alternative formatted string of APR's version */
116251875Speter/* macro for Win32 .rc files using numeric csv representation */
117251875Speter#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
118251875Speter                             ##APR_MINOR_VERSION ##, \
119251875Speter                             ##APR_PATCH_VERSION
120251875Speter
121251875Speter
122251875Speter#ifndef APR_VERSION_ONLY
123251875Speter
124251875Speter/* The C language API to access the version at run time,
125251875Speter * as opposed to compile time.  APR_VERSION_ONLY may be defined
126251875Speter * externally when preprocessing apr_version.h to obtain strictly
127251875Speter * the C Preprocessor macro declarations.
128251875Speter */
129251875Speter
130251875Speter#include "apr.h"
131251875Speter
132251875Speter#ifdef __cplusplus
133251875Speterextern "C" {
134251875Speter#endif
135251875Speter
136251875Speter/**
137251875Speter * The numeric version information is broken out into fields within this
138251875Speter * structure.
139251875Speter */
140251875Spetertypedef struct {
141251875Speter    int major;      /**< major number */
142251875Speter    int minor;      /**< minor number */
143251875Speter    int patch;      /**< patch number */
144251875Speter    int is_dev;     /**< is development (1 or 0) */
145251875Speter} apr_version_t;
146251875Speter
147251875Speter/**
148251875Speter * Return APR's version information information in a numeric form.
149251875Speter *
150251875Speter *  @param pvsn Pointer to a version structure for returning the version
151251875Speter *              information.
152251875Speter */
153251875SpeterAPR_DECLARE(void) apr_version(apr_version_t *pvsn);
154251875Speter
155251875Speter/** Return APR's version information as a string. */
156251875SpeterAPR_DECLARE(const char *) apr_version_string(void);
157251875Speter
158251875Speter#ifdef __cplusplus
159251875Speter}
160251875Speter#endif
161251875Speter
162251875Speter#endif /* ndef APR_VERSION_ONLY */
163251875Speter
164251875Speter#endif /* ndef APR_VERSION_H */
165