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