Apache Portable Runtime
apr_version.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_VERSION_H
00018 #define APR_VERSION_H
00019 
00020 /**
00021  * @file apr_version.h
00022  * @brief APR Versioning Interface
00023  * 
00024  * APR's Version
00025  *
00026  * There are several different mechanisms for accessing the version. There
00027  * is a string form, and a set of numbers; in addition, there are constants
00028  * which can be compiled into your application, and you can query the library
00029  * being used for its actual version.
00030  *
00031  * Note that it is possible for an application to detect that it has been
00032  * compiled against a different version of APR by use of the compile-time
00033  * constants and the use of the run-time query function.
00034  *
00035  * APR version numbering follows the guidelines specified in:
00036  *
00037  *     http://apr.apache.org/versioning.html
00038  */
00039 
00040 
00041 #define APR_COPYRIGHT "Copyright (c) 2000-2014 The Apache Software " \
00042                       "Foundation or its licensors, as applicable."
00043 
00044 /* The numeric compile-time version constants. These constants are the
00045  * authoritative version numbers for APR. 
00046  */
00047 
00048 /** major version 
00049  * Major API changes that could cause compatibility problems for older
00050  * programs such as structure size changes.  No binary compatibility is
00051  * possible across a change in the major version.
00052  */
00053 #define APR_MAJOR_VERSION       1
00054 
00055 /** minor version
00056  * Minor API changes that do not cause binary compatibility problems.
00057  * Reset to 0 when upgrading APR_MAJOR_VERSION
00058  */
00059 #define APR_MINOR_VERSION       5
00060 
00061 /** patch level 
00062  * The Patch Level never includes API changes, simply bug fixes.
00063  * Reset to 0 when upgrading APR_MINOR_VERSION
00064  */
00065 #define APR_PATCH_VERSION       1
00066 
00067 /** 
00068  * The symbol APR_IS_DEV_VERSION is only defined for internal,
00069  * "development" copies of APR.  It is undefined for released versions
00070  * of APR.
00071  */
00072 /* #define APR_IS_DEV_VERSION */
00073 
00074 /**
00075  * Check at compile time if the APR version is at least a certain
00076  * level.
00077  * @param major The major version component of the version checked
00078  * for (e.g., the "1" of "1.3.0").
00079  * @param minor The minor version component of the version checked
00080  * for (e.g., the "3" of "1.3.0").
00081  * @param patch The patch level component of the version checked
00082  * for (e.g., the "0" of "1.3.0").
00083  * @remark This macro is available with APR versions starting with
00084  * 1.3.0.
00085  */
00086 #define APR_VERSION_AT_LEAST(major,minor,patch)                    \
00087 (((major) < APR_MAJOR_VERSION)                                     \
00088  || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
00089  || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
00090 
00091 #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
00092 /** Internal: string form of the "is dev" flag */
00093 #ifndef APR_IS_DEV_STRING
00094 #define APR_IS_DEV_STRING "-dev"
00095 #endif
00096 #else
00097 #define APR_IS_DEV_STRING ""
00098 #endif
00099 
00100 /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
00101 #ifndef APR_STRINGIFY
00102 /** Properly quote a value as a string in the C preprocessor */
00103 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
00104 /** Helper macro for APR_STRINGIFY */
00105 #define APR_STRINGIFY_HELPER(n) #n
00106 #endif
00107 
00108 /** The formatted string of APR's version */
00109 #define APR_VERSION_STRING \
00110      APR_STRINGIFY(APR_MAJOR_VERSION) "." \
00111      APR_STRINGIFY(APR_MINOR_VERSION) "." \
00112      APR_STRINGIFY(APR_PATCH_VERSION) \
00113      APR_IS_DEV_STRING
00114 
00115 /** An alternative formatted string of APR's version */
00116 /* macro for Win32 .rc files using numeric csv representation */
00117 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
00118                              ##APR_MINOR_VERSION ##, \
00119                              ##APR_PATCH_VERSION
00120 
00121 
00122 #ifndef APR_VERSION_ONLY
00123 
00124 /* The C language API to access the version at run time, 
00125  * as opposed to compile time.  APR_VERSION_ONLY may be defined 
00126  * externally when preprocessing apr_version.h to obtain strictly 
00127  * the C Preprocessor macro declarations.
00128  */
00129 
00130 #include "apr.h"
00131 
00132 #ifdef __cplusplus
00133 extern "C" {
00134 #endif
00135 
00136 /** 
00137  * The numeric version information is broken out into fields within this 
00138  * structure. 
00139  */
00140 typedef struct {
00141     int major;      /**< major number */
00142     int minor;      /**< minor number */
00143     int patch;      /**< patch number */
00144     int is_dev;     /**< is development (1 or 0) */
00145 } apr_version_t;
00146 
00147 /**
00148  * Return APR's version information information in a numeric form.
00149  *
00150  *  @param pvsn Pointer to a version structure for returning the version
00151  *              information.
00152  */
00153 APR_DECLARE(void) apr_version(apr_version_t *pvsn);
00154 
00155 /** Return APR's version information as a string. */
00156 APR_DECLARE(const char *) apr_version_string(void);
00157 
00158 #ifdef __cplusplus
00159 }
00160 #endif
00161 
00162 #endif /* ndef APR_VERSION_ONLY */
00163 
00164 #endif /* ndef APR_VERSION_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines