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) 2011 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       2
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       0
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       0
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 #define APR_IS_DEV_STRING "-dev"
00094 #else
00095 #define APR_IS_DEV_STRING ""
00096 #endif
00097 
00098 /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
00099 #ifndef APR_STRINGIFY
00100 /** Properly quote a value as a string in the C preprocessor */
00101 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
00102 /** Helper macro for APR_STRINGIFY */
00103 #define APR_STRINGIFY_HELPER(n) #n
00104 #endif
00105 
00106 /** The formatted string of APR's version */
00107 #define APR_VERSION_STRING \
00108      APR_STRINGIFY(APR_MAJOR_VERSION) "." \
00109      APR_STRINGIFY(APR_MINOR_VERSION) "." \
00110      APR_STRINGIFY(APR_PATCH_VERSION) \
00111      APR_IS_DEV_STRING
00112 
00113 /** An alternative formatted string of APR's version */
00114 /* macro for Win32 .rc files using numeric csv representation */
00115 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION, \
00116                                APR_MINOR_VERSION, \
00117                                APR_PATCH_VERSION
00118 
00119 
00120 #ifndef APR_VERSION_ONLY
00121 
00122 /* The C language API to access the version at run time, 
00123  * as opposed to compile time.  APR_VERSION_ONLY may be defined 
00124  * externally when preprocessing apr_version.h to obtain strictly 
00125  * the C Preprocessor macro declarations.
00126  */
00127 
00128 #include "apr.h"
00129 
00130 #ifdef __cplusplus
00131 extern "C" {
00132 #endif
00133 
00134 /** 
00135  * The numeric version information is broken out into fields within this 
00136  * structure. 
00137  */
00138 typedef struct {
00139     int major;      /**< major number */
00140     int minor;      /**< minor number */
00141     int patch;      /**< patch number */
00142     int is_dev;     /**< is development (1 or 0) */
00143 } apr_version_t;
00144 
00145 /**
00146  * Return APR's version information information in a numeric form.
00147  *
00148  *  @param pvsn Pointer to a version structure for returning the version
00149  *              information.
00150  */
00151 APR_DECLARE(void) apr_version(apr_version_t *pvsn);
00152 
00153 /** Return APR's version information as a string. */
00154 APR_DECLARE(const char *) apr_version_string(void);
00155 
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159 
00160 #endif /* ndef APR_VERSION_ONLY */
00161 
00162 #endif /* ndef APR_VERSION_H */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines