xref: /freebsd/contrib/xz/src/liblzma/api/lzma/version.h (revision 3494f7c0)
1 /**
2  * \file        lzma/version.h
3  * \brief       Version number
4  * \note        Never include this file directly. Use <lzma.h> instead.
5  */
6 
7 /*
8  * Author: Lasse Collin
9  *
10  * This file has been put into the public domain.
11  * You can do whatever you want with this file.
12  */
13 
14 #ifndef LZMA_H_INTERNAL
15 #	error Never include this file directly. Use <lzma.h> instead.
16 #endif
17 
18 
19 /** \brief Major version number of the liblzma release. */
20 #define LZMA_VERSION_MAJOR 5
21 
22 /** \brief Minor version number of the liblzma release. */
23 #define LZMA_VERSION_MINOR 4
24 
25 /** \brief Patch version number of the liblzma release. */
26 #define LZMA_VERSION_PATCH 5
27 
28 /**
29  * \brief Version stability marker
30  *
31  * This will always be one of three values:
32  *   - LZMA_VERSION_STABILITY_ALPHA
33  *   - LZMA_VERSION_STABILITY_BETA
34  *   - LZMA_VERSION_STABILITY_STABLE
35  */
36 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
37 
38 /** \brief Commit version number of the liblzma release */
39 #ifndef LZMA_VERSION_COMMIT
40 #	define LZMA_VERSION_COMMIT ""
41 #endif
42 
43 
44 /*
45  * Map symbolic stability levels to integers.
46  */
47 #define LZMA_VERSION_STABILITY_ALPHA 0
48 #define LZMA_VERSION_STABILITY_BETA 1
49 #define LZMA_VERSION_STABILITY_STABLE 2
50 
51 
52 /**
53  * \brief       Compile-time version number
54  *
55  * The version number is of format xyyyzzzs where
56  *  - x = major
57  *  - yyy = minor
58  *  - zzz = revision
59  *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
60  *
61  * The same xyyyzzz triplet is never reused with different stability levels.
62  * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
63  * or 5.1.0 stable.
64  *
65  * \note        The version number of liblzma has nothing to with
66  *              the version number of Igor Pavlov's LZMA SDK.
67  */
68 #define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
69 		+ LZMA_VERSION_MINOR * UINT32_C(10000) \
70 		+ LZMA_VERSION_PATCH * UINT32_C(10) \
71 		+ LZMA_VERSION_STABILITY)
72 
73 
74 /*
75  * Macros to construct the compile-time version string
76  */
77 #if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
78 #	define LZMA_VERSION_STABILITY_STRING "alpha"
79 #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
80 #	define LZMA_VERSION_STABILITY_STRING "beta"
81 #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
82 #	define LZMA_VERSION_STABILITY_STRING ""
83 #else
84 #	error Incorrect LZMA_VERSION_STABILITY
85 #endif
86 
87 #define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
88 		#major "." #minor "." #patch stability commit
89 
90 #define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
91 		LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
92 
93 
94 /**
95  * \brief       Compile-time version as a string
96  *
97  * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
98  * versions don't have any "stable" suffix). In future, a snapshot built
99  * from source code repository may include an additional suffix, for example
100  * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
101  * in LZMA_VERSION macro.
102  */
103 #define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
104 		LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
105 		LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
106 		LZMA_VERSION_COMMIT)
107 
108 
109 /* #ifndef is needed for use with windres (MinGW-w64 or Cygwin). */
110 #ifndef LZMA_H_INTERNAL_RC
111 
112 /**
113  * \brief       Run-time version number as an integer
114  *
115  * This allows an application to compare if it was built against the same,
116  * older, or newer version of liblzma that is currently running.
117  *
118  * \return The value of LZMA_VERSION macro at the compile time of liblzma
119  */
120 extern LZMA_API(uint32_t) lzma_version_number(void)
121 		lzma_nothrow lzma_attr_const;
122 
123 
124 /**
125  * \brief       Run-time version as a string
126  *
127  * This function may be useful to display which version of liblzma an
128  * application is currently using.
129  *
130  * \return      Run-time version of liblzma
131  */
132 extern LZMA_API(const char *) lzma_version_string(void)
133 		lzma_nothrow lzma_attr_const;
134 
135 #endif
136