svn_version.h revision 289166
1/**
2 * @copyright
3 * ====================================================================
4 *    Licensed to the Apache Software Foundation (ASF) under one
5 *    or more contributor license agreements.  See the NOTICE file
6 *    distributed with this work for additional information
7 *    regarding copyright ownership.  The ASF licenses this file
8 *    to you under the Apache License, Version 2.0 (the
9 *    "License"); you may not use this file except in compliance
10 *    with the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 *    Unless required by applicable law or agreed to in writing,
15 *    software distributed under the License is distributed on an
16 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 *    KIND, either express or implied.  See the License for the
18 *    specific language governing permissions and limitations
19 *    under the License.
20 * ====================================================================
21 * @endcopyright
22 *
23 * @file svn_version.h
24 * @brief Version information.
25 */
26
27#ifndef SVN_VERSION_H
28#define SVN_VERSION_H
29
30/* Hack to prevent the resource compiler from including
31   apr and other headers. */
32#ifndef SVN_WIN32_RESOURCE_COMPILATION
33#include <apr_general.h>
34#include <apr_tables.h>
35
36#include "svn_types.h"
37#endif
38
39#ifdef __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42
43
44/* Symbols that define the version number. */
45
46/* Version numbers: <major>.<minor>.<micro>
47 *
48 * The version numbers in this file follow the rules established by:
49 *
50 *   http://apr.apache.org/versioning.html
51 */
52
53/** Major version number.
54 *
55 * Modify when incompatible changes are made to published interfaces.
56 */
57#define SVN_VER_MAJOR      1
58
59/** Minor version number.
60 *
61 * Modify when new functionality is added or new interfaces are
62 * defined, but all changes are backward compatible.
63 */
64#define SVN_VER_MINOR      8
65
66/**
67 * Patch number.
68 *
69 * Modify for every released patch.
70 *
71 * @since New in 1.1.
72 */
73#define SVN_VER_PATCH      14
74
75
76/** @deprecated Provided for backward compatibility with the 1.0 API. */
77#define SVN_VER_MICRO      SVN_VER_PATCH
78
79/** @deprecated Provided for backward compatibility with the 1.0 API. */
80#define SVN_VER_LIBRARY    SVN_VER_MAJOR
81
82
83/** Version tag: a string describing the version.
84 *
85 * This tag remains " (dev build)" in the repository so that we can
86 * always see from "svn --version" that the software has been built
87 * from the repository rather than a "blessed" distribution.
88 *
89 * When rolling a tarball, we automatically replace this text with " (r1234)"
90 * (where 1234 is the last revision on the branch prior to the release)
91 * for final releases; in prereleases, it becomes " (Alpha 1)",
92 * " (Beta 1)", etc., as appropriate.
93 *
94 * Always change this at the same time as SVN_VER_NUMTAG.
95 */
96#define SVN_VER_TAG        " (r1692801)"
97
98
99/** Number tag: a string describing the version.
100 *
101 * This tag is used to generate a version number string to identify
102 * the client and server in HTTP requests, for example. It must not
103 * contain any spaces. This value remains "-dev" in the repository.
104 *
105 * When rolling a tarball, we automatically replace this text with ""
106 * for final releases; in prereleases, it becomes "-alpha1, "-beta1",
107 * etc., as appropriate.
108 *
109 * Always change this at the same time as SVN_VER_TAG.
110 */
111#define SVN_VER_NUMTAG     ""
112
113
114/** Revision number: The repository revision number of this release.
115 *
116 * This constant is used to generate the build number part of the Windows
117 * file version. Its value remains 0 in the repository.
118 *
119 * When rolling a tarball, we automatically replace it with what we
120 * guess to be the correct revision number.
121 */
122#define SVN_VER_REVISION   1692801
123
124
125/* Version strings composed from the above definitions. */
126
127/** Version number */
128#define SVN_VER_NUM        APR_STRINGIFY(SVN_VER_MAJOR) \
129                           "." APR_STRINGIFY(SVN_VER_MINOR) \
130                           "." APR_STRINGIFY(SVN_VER_PATCH)
131
132/** Version number with tag (contains no whitespace) */
133#define SVN_VER_NUMBER     SVN_VER_NUM SVN_VER_NUMTAG
134
135/** Complete version string */
136#define SVN_VERSION        SVN_VER_NUMBER SVN_VER_TAG
137
138
139
140/* Version queries and compatibility checks */
141
142/**
143 * Version information. Each library contains a function called
144 * svn_<i>libname</i>_version() that returns a pointer to a statically
145 * allocated object of this type.
146 *
147 * @since New in 1.1.
148 */
149struct svn_version_t
150{
151  int major;                    /**< Major version number */
152  int minor;                    /**< Minor version number */
153  int patch;                    /**< Patch number */
154
155  /**
156   * The version tag (#SVN_VER_NUMTAG). Must always point to a
157   * statically allocated string.
158   */
159  const char *tag;
160};
161
162/**
163 * Define a static svn_version_t object.
164 *
165 * @since New in 1.1.
166 */
167#define SVN_VERSION_DEFINE(name) \
168  static const svn_version_t name = \
169    { \
170      SVN_VER_MAJOR, \
171      SVN_VER_MINOR, \
172      SVN_VER_PATCH, \
173      SVN_VER_NUMTAG \
174    } \
175
176/**
177 * Generate the implementation of a version query function.
178 *
179 * @since New in 1.1.
180 */
181#define SVN_VERSION_BODY \
182  SVN_VERSION_DEFINE(versioninfo);              \
183  return &versioninfo
184
185/**
186 * Check library version compatibility. Return #TRUE if the client's
187 * version, given in @a my_version, is compatible with the library
188 * version, provided in @a lib_version.
189 *
190 * This function checks for version compatibility as per our
191 * guarantees, but requires an exact match when linking to an
192 * unreleased library. A development client is always compatible with
193 * a previous released library.
194 *
195 * @since New in 1.1.
196 */
197svn_boolean_t
198svn_ver_compatible(const svn_version_t *my_version,
199                   const svn_version_t *lib_version);
200
201/**
202 * Check if @a my_version and @a lib_version encode the same version number.
203 *
204 * @since New in 1.2.
205 */
206svn_boolean_t
207svn_ver_equal(const svn_version_t *my_version,
208              const svn_version_t *lib_version);
209
210
211/**
212 * An entry in the compatibility checklist.
213 * @see svn_ver_check_list()
214 *
215 * @since New in 1.1.
216 */
217typedef struct svn_version_checklist_t
218{
219  const char *label;            /**< Entry label */
220
221  /** Version query function for this entry */
222  const svn_version_t *(*version_query)(void);
223} svn_version_checklist_t;
224
225
226/**
227 * Perform a series of version compatibility checks. Checks if @a
228 * my_version is compatible with each entry in @a checklist. @a
229 * checklist must end with an entry whose label is @c NULL.
230 *
231 * @see svn_ver_compatible()
232 *
233 * @since New in 1.1.
234 */
235svn_error_t *
236svn_ver_check_list(const svn_version_t *my_version,
237                   const svn_version_checklist_t *checklist);
238
239
240/**
241 * Type of function returning library version.
242 *
243 * @since New in 1.6.
244 */
245typedef const svn_version_t *(*svn_version_func_t)(void);
246
247
248/* libsvn_subr doesn't have an svn_subr header, so put the prototype here. */
249/**
250 * Get libsvn_subr version information.
251 *
252 * @since New in 1.1.
253 */
254const svn_version_t *
255svn_subr_version(void);
256
257
258/**
259 * Extended version information, including info about the running system.
260 *
261 * @since New in 1.8.
262 */
263typedef struct svn_version_extended_t svn_version_extended_t;
264
265/**
266 * Return version information for the running program.  If @a verbose
267 * is #TRUE, collect extra information that may be expensive to
268 * retrieve (for example, the OS release name, list of shared
269 * libraries, etc.).  Use @a pool for all allocations.
270 *
271 * @since New in 1.8.
272 */
273const svn_version_extended_t *
274svn_version_extended(svn_boolean_t verbose,
275                     apr_pool_t *pool);
276
277
278/**
279 * Accessor for svn_version_extended_t.
280 *
281 * @return The date when the libsvn_subr library was compiled, in the
282 * format defined by the C standard macro @c __DATE__.
283 *
284 * @since New in 1.8.
285 */
286const char *
287svn_version_ext_build_date(const svn_version_extended_t *ext_info);
288
289/**
290 * Accessor for svn_version_extended_t.
291 *
292 * @return The time when the libsvn_subr library was compiled, in the
293 * format defined by the C standard macro @c __TIME__.
294 *
295 * @since New in 1.8.
296 */
297const char *
298svn_version_ext_build_time(const svn_version_extended_t *ext_info);
299
300/**
301 * Accessor for svn_version_extended_t.
302 *
303 * @return The canonical host triplet (arch-vendor-osname) of the
304 * system where libsvn_subr was compiled.
305 *
306 * @note On Unix-like systems (includng Mac OS X), this string is the
307 * same as the output of the config.guess script.
308 *
309 * @since New in 1.8.
310 */
311const char *
312svn_version_ext_build_host(const svn_version_extended_t *ext_info);
313
314/**
315 * Accessor for svn_version_extended_t.
316 *
317 * @return The localized copyright notice.
318 *
319 * @since New in 1.8.
320 */
321const char *
322svn_version_ext_copyright(const svn_version_extended_t *ext_info);
323
324/**
325 * Accessor for svn_version_extended_t.
326 *
327 * @return The canonical host triplet (arch-vendor-osname) of the
328 * system where the current process is running.
329 *
330 * @note This string may not be the same as the output of config.guess
331 * on the same system.
332 *
333 * @since New in 1.8.
334 */
335const char *
336svn_version_ext_runtime_host(const svn_version_extended_t *ext_info);
337
338/**
339 * Accessor for svn_version_extended_t.
340 *
341 * @return The "commercial" release name of the running operating
342 * system, if available.  Not to be confused with, e.g., the output of
343 * "uname -v" or "uname -r".  The returned value may be @c NULL.
344 *
345 * @since New in 1.8.
346 */
347const char *
348svn_version_ext_runtime_osname(const svn_version_extended_t *ext_info);
349
350/**
351 * Dependent library information.
352 * Describes the name and versions of known dependencies
353 * used by libsvn_subr.
354 *
355 * @since New in 1.8.
356 */
357typedef struct svn_version_ext_linked_lib_t
358{
359  const char *name;             /**< Library name */
360  const char *compiled_version; /**< Compile-time version string */
361  const char *runtime_version;  /**< Run-time version string (optional) */
362} svn_version_ext_linked_lib_t;
363
364/**
365 * Accessor for svn_version_extended_t.
366 *
367 * @return Array of svn_version_ext_linked_lib_t describing dependent
368 * libraries.  The returned value may be @c NULL.
369 *
370 * @since New in 1.8.
371 */
372const apr_array_header_t *
373svn_version_ext_linked_libs(const svn_version_extended_t *ext_info);
374
375
376/**
377 * Loaded shared library information.
378 * Describes the name and, where available, version of the shared libraries
379 * loaded by the running program.
380 *
381 * @since New in 1.8.
382 */
383typedef struct svn_version_ext_loaded_lib_t
384{
385  const char *name;             /**< Library name */
386  const char *version;          /**< Library version (optional) */
387} svn_version_ext_loaded_lib_t;
388
389
390/**
391 * Accessor for svn_version_extended_t.
392 *
393 * @return Array of svn_version_ext_loaded_lib_t describing loaded
394 * shared libraries.  The returned value may be @c NULL.
395 *
396 * @note On Mac OS X, the loaded frameworks, private frameworks and
397 * system libraries will not be listed.
398 *
399 * @since New in 1.8.
400 */
401const apr_array_header_t *
402svn_version_ext_loaded_libs(const svn_version_extended_t *ext_info);
403
404
405#ifdef __cplusplus
406}
407#endif /* __cplusplus */
408
409#endif /* SVN_VERSION_H */
410