apr_version.h revision 259065
16197Stamao/* Licensed to the Apache Software Foundation (ASF) under one or more
212158Sstsmirno * contributor license agreements.  See the NOTICE file distributed with
312158Sstsmirno * this work for additional information regarding copyright ownership.
412158Sstsmirno * The ASF licenses this file to You under the Apache License, Version 2.0
512158Sstsmirno * (the "License"); you may not use this file except in compliance with
612158Sstsmirno * the License.  You may obtain a copy of the License at
712158Sstsmirno *
812158Sstsmirno *     http://www.apache.org/licenses/LICENSE-2.0
912158Sstsmirno *
1012158Sstsmirno * Unless required by applicable law or agreed to in writing, software
1112158Sstsmirno * distributed under the License is distributed on an "AS IS" BASIS,
1212158Sstsmirno * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312158Sstsmirno * See the License for the specific language governing permissions and
1412158Sstsmirno * limitations under the License.
1512158Sstsmirno */
1612158Sstsmirno
1712158Sstsmirno#ifndef APR_VERSION_H
1812158Sstsmirno#define APR_VERSION_H
1912158Sstsmirno
2012158Sstsmirno/**
2112158Sstsmirno * @file apr_version.h
2212158Sstsmirno * @brief APR Versioning Interface
236197Stamao *
246197Stamao * APR's Version
256197Stamao *
266197Stamao * There are several different mechanisms for accessing the version. There
276197Stamao * is a string form, and a set of numbers; in addition, there are constants
2811510Sdfazunen * which can be compiled into your application, and you can query the library
296197Stamao * being used for its actual version.
306197Stamao *
3111833Sctornqvi * Note that it is possible for an application to detect that it has been
3210551Schegar * compiled against a different version of APR by use of the compile-time
338013Sykantser * constants and the use of the run-time query function.
346197Stamao *
356197Stamao * APR version numbering follows the guidelines specified in:
366197Stamao *
3711833Sctornqvi *     http://apr.apache.org/versioning.html
3811833Sctornqvi */
396197Stamao
406197Stamao
416197Stamao#define APR_COPYRIGHT "Copyright (c) 2013 The Apache Software " \
426197Stamao                      "Foundation or its licensors, as applicable."
436197Stamao
446197Stamao/* The numeric compile-time version constants. These constants are the
456197Stamao * authoritative version numbers for APR.
466197Stamao */
476197Stamao
486197Stamao/** major version
496197Stamao * Major API changes that could cause compatibility problems for older
506197Stamao * programs such as structure size changes.  No binary compatibility is
516197Stamao * possible across a change in the major version.
526197Stamao */
536197Stamao#define APR_MAJOR_VERSION       1
546197Stamao
556197Stamao/** minor version
566197Stamao * Minor API changes that do not cause binary compatibility problems.
576197Stamao * Reset to 0 when upgrading APR_MAJOR_VERSION
586197Stamao */
596197Stamao#define APR_MINOR_VERSION       4
606197Stamao
616197Stamao/** patch level
626197Stamao * The Patch Level never includes API changes, simply bug fixes.
636197Stamao * Reset to 0 when upgrading APR_MINOR_VERSION
646197Stamao */
656197Stamao#define APR_PATCH_VERSION       8
666197Stamao
676197Stamao/**
686197Stamao * The symbol APR_IS_DEV_VERSION is only defined for internal,
696197Stamao * "development" copies of APR.  It is undefined for released versions
706197Stamao * of APR.
716197Stamao */
726197Stamao/* #define APR_IS_DEV_VERSION */
736197Stamao
746197Stamao/**
756197Stamao * Check at compile time if the APR version is at least a certain
766197Stamao * level.
776197Stamao * @param major The major version component of the version checked
786197Stamao * for (e.g., the "1" of "1.3.0").
796197Stamao * @param minor The minor version component of the version checked
806197Stamao * for (e.g., the "3" of "1.3.0").
816197Stamao * @param patch The patch level component of the version checked
826197Stamao * for (e.g., the "0" of "1.3.0").
836197Stamao * @remark This macro is available with APR versions starting with
846197Stamao * 1.3.0.
856197Stamao */
866197Stamao#define APR_VERSION_AT_LEAST(major,minor,patch)                    \
876197Stamao(((major) < APR_MAJOR_VERSION)                                     \
886197Stamao || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
896197Stamao || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
906197Stamao
916197Stamao#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
926197Stamao/** Internal: string form of the "is dev" flag */
936197Stamao#ifndef APR_IS_DEV_STRING
946197Stamao#define APR_IS_DEV_STRING "-dev"
956197Stamao#endif
966197Stamao#else
976197Stamao#define APR_IS_DEV_STRING ""
986197Stamao#endif
996197Stamao
1006197Stamao/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
1016197Stamao#ifndef APR_STRINGIFY
1026197Stamao/** Properly quote a value as a string in the C preprocessor */
1036197Stamao#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
1046197Stamao/** Helper macro for APR_STRINGIFY */
1056197Stamao#define APR_STRINGIFY_HELPER(n) #n
1066197Stamao#endif
1076197Stamao
1086197Stamao/** The formatted string of APR's version */
1096197Stamao#define APR_VERSION_STRING \
1106197Stamao     APR_STRINGIFY(APR_MAJOR_VERSION) "." \
1116197Stamao     APR_STRINGIFY(APR_MINOR_VERSION) "." \
1126197Stamao     APR_STRINGIFY(APR_PATCH_VERSION) \
1136197Stamao     APR_IS_DEV_STRING
1146197Stamao
1156197Stamao/** An alternative formatted string of APR's version */
1166197Stamao/* macro for Win32 .rc files using numeric csv representation */
1176197Stamao#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
1186197Stamao                             ##APR_MINOR_VERSION ##, \
1196197Stamao                             ##APR_PATCH_VERSION
1206197Stamao
1216197Stamao
1226197Stamao#ifndef APR_VERSION_ONLY
1236197Stamao
1246197Stamao/* The C language API to access the version at run time,
1256197Stamao * as opposed to compile time.  APR_VERSION_ONLY may be defined
1266197Stamao * externally when preprocessing apr_version.h to obtain strictly
1276197Stamao * the C Preprocessor macro declarations.
1286197Stamao */
1296197Stamao
1306197Stamao#include "apr.h"
1316197Stamao
1326197Stamao#ifdef __cplusplus
1336197Stamaoextern "C" {
1346197Stamao#endif
1356197Stamao
1366197Stamao/**
1376197Stamao * The numeric version information is broken out into fields within this
1386197Stamao * structure.
1396197Stamao */
1406197Stamaotypedef struct {
1416197Stamao    int major;      /**< major number */
1426197Stamao    int minor;      /**< minor number */
1436197Stamao    int patch;      /**< patch number */
1446197Stamao    int is_dev;     /**< is development (1 or 0) */
1456197Stamao} apr_version_t;
1466197Stamao
1476197Stamao/**
1486197Stamao * Return APR's version information information in a numeric form.
1496197Stamao *
1506197Stamao *  @param pvsn Pointer to a version structure for returning the version
1516197Stamao *              information.
1526197Stamao */
1536197StamaoAPR_DECLARE(void) apr_version(apr_version_t *pvsn);
1546197Stamao
1556197Stamao/** Return APR's version information as a string. */
1566197StamaoAPR_DECLARE(const char *) apr_version_string(void);
1576197Stamao
1586197Stamao#ifdef __cplusplus
1596197Stamao}
1606197Stamao#endif
1619095Ssangheki
1626197Stamao#endif /* ndef APR_VERSION_ONLY */
1636197Stamao
1646197Stamao#endif /* ndef APR_VERSION_H */
1656197Stamao