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