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 /* The numeric compile-time version constants. These constants are the 00042 * authoritative version numbers for APR. 00043 */ 00044 00045 /** major version 00046 * Major API changes that could cause compatibility problems for older 00047 * programs such as structure size changes. No binary compatibility is 00048 * possible across a change in the major version. 00049 */ 00050 #define APR_MAJOR_VERSION 1 00051 00052 /** minor version 00053 * Minor API changes that do not cause binary compatibility problems. 00054 * Reset to 0 when upgrading APR_MAJOR_VERSION 00055 */ 00056 #define APR_MINOR_VERSION 3 00057 00058 /** patch level 00059 * The Patch Level never includes API changes, simply bug fixes. 00060 * Reset to 0 when upgrading APR_MINOR_VERSION 00061 */ 00062 #define APR_PATCH_VERSION 3 00063 00064 /** 00065 * The symbol APR_IS_DEV_VERSION is only defined for internal, 00066 * "development" copies of APR. It is undefined for released versions 00067 * of APR. 00068 */ 00069 /* #undef APR_IS_DEV_VERSION */ 00070 00071 /** 00072 * Check at compile time if the APR version is at least a certain 00073 * level. 00074 * @param major The major version component of the version checked 00075 * for (e.g., the "1" of "1.3.0"). 00076 * @param minor The minor version component of the version checked 00077 * for (e.g., the "3" of "1.3.0"). 00078 * @param patch The patch level component of the version checked 00079 * for (e.g., the "0" of "1.3.0"). 00080 * @remark This macro is available with APR versions starting with 00081 * 1.3.0. 00082 */ 00083 #define APR_VERSION_AT_LEAST(major,minor,patch) \ 00084 (((major) < APR_MAJOR_VERSION) \ 00085 || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \ 00086 || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION)) 00087 00088 #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN) 00089 /** Internal: string form of the "is dev" flag */ 00090 #define APR_IS_DEV_STRING "-dev" 00091 #else 00092 #define APR_IS_DEV_STRING "" 00093 #endif 00094 00095 /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */ 00096 #ifndef APR_STRINGIFY 00097 /** Properly quote a value as a string in the C preprocessor */ 00098 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n) 00099 /** Helper macro for APR_STRINGIFY */ 00100 #define APR_STRINGIFY_HELPER(n) #n 00101 #endif 00102 00103 /** The formatted string of APR's version */ 00104 #define APR_VERSION_STRING \ 00105 APR_STRINGIFY(APR_MAJOR_VERSION) "." \ 00106 APR_STRINGIFY(APR_MINOR_VERSION) "." \ 00107 APR_STRINGIFY(APR_PATCH_VERSION) \ 00108 APR_IS_DEV_STRING 00109 00110 /** An alternative formatted string of APR's version */ 00111 /* macro for Win32 .rc files using numeric csv representation */ 00112 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \ 00113 ##APR_MINOR_VERSION ##, \ 00114 ##APR_PATCH_VERSION 00115 00116 00117 #ifndef APR_VERSION_ONLY 00118 00119 /* The C language API to access the version at run time, 00120 * as opposed to compile time. APR_VERSION_ONLY may be defined 00121 * externally when preprocessing apr_version.h to obtain strictly 00122 * the C Preprocessor macro declarations. 00123 */ 00124 00125 #include "apr.h" 00126 00127 #ifdef __cplusplus 00128 extern "C" { 00129 #endif 00130 00131 /** 00132 * The numeric version information is broken out into fields within this 00133 * structure. 00134 */ 00135 typedef struct { 00136 int major; /**< major number */ 00137 int minor; /**< minor number */ 00138 int patch; /**< patch number */ 00139 int is_dev; /**< is development (1 or 0) */ 00140 } apr_version_t; 00141 00142 /** 00143 * Return APR's version information information in a numeric form. 00144 * 00145 * @param pvsn Pointer to a version structure for returning the version 00146 * information. 00147 */ 00148 APR_DECLARE(void) apr_version(apr_version_t *pvsn); 00149 00150 /** Return APR's version information as a string. */ 00151 APR_DECLARE(const char *) apr_version_string(void); 00152 00153 #ifdef __cplusplus 00154 } 00155 #endif 00156 00157 #endif /* ndef APR_VERSION_ONLY */ 00158 00159 #endif /* ndef APR_VERSION_H */