1207753Smm/**
2207753Smm * \file        lzma/version.h
3207753Smm * \brief       Version number
4207753Smm */
5207753Smm
6207753Smm/*
7207753Smm * Author: Lasse Collin
8207753Smm *
9207753Smm * This file has been put into the public domain.
10207753Smm * You can do whatever you want with this file.
11207753Smm *
12207753Smm * See ../lzma.h for information about liblzma as a whole.
13207753Smm */
14207753Smm
15207753Smm#ifndef LZMA_H_INTERNAL
16207753Smm#	error Never include this file directly. Use <lzma.h> instead.
17207753Smm#endif
18207753Smm
19207753Smm
20207753Smm/*
21207753Smm * Version number split into components
22207753Smm */
23215187Smm#define LZMA_VERSION_MAJOR 5
24215187Smm#define LZMA_VERSION_MINOR 0
25263286Sdelphij#define LZMA_VERSION_PATCH 5
26215187Smm#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
27207753Smm
28207753Smm#ifndef LZMA_VERSION_COMMIT
29207753Smm#	define LZMA_VERSION_COMMIT ""
30207753Smm#endif
31207753Smm
32207753Smm
33207753Smm/*
34207753Smm * Map symbolic stability levels to integers.
35207753Smm */
36207753Smm#define LZMA_VERSION_STABILITY_ALPHA 0
37207753Smm#define LZMA_VERSION_STABILITY_BETA 1
38207753Smm#define LZMA_VERSION_STABILITY_STABLE 2
39207753Smm
40207753Smm
41207753Smm/**
42207753Smm * \brief       Compile-time version number
43207753Smm *
44207753Smm * The version number is of format xyyyzzzs where
45207753Smm *  - x = major
46207753Smm *  - yyy = minor
47207753Smm *  - zzz = revision
48207753Smm *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
49207753Smm *
50207753Smm * The same xyyyzzz triplet is never reused with different stability levels.
51207753Smm * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
52207753Smm * or 5.1.0 stable.
53207753Smm *
54207753Smm * \note        The version number of liblzma has nothing to with
55207753Smm *              the version number of Igor Pavlov's LZMA SDK.
56207753Smm */
57207753Smm#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
58207753Smm		+ LZMA_VERSION_MINOR * UINT32_C(10000) \
59207753Smm		+ LZMA_VERSION_PATCH * UINT32_C(10) \
60207753Smm		+ LZMA_VERSION_STABILITY)
61207753Smm
62207753Smm
63207753Smm/*
64207753Smm * Macros to construct the compile-time version string
65207753Smm */
66207753Smm#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
67207753Smm#	define LZMA_VERSION_STABILITY_STRING "alpha"
68207753Smm#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
69207753Smm#	define LZMA_VERSION_STABILITY_STRING "beta"
70207753Smm#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
71207753Smm#	define LZMA_VERSION_STABILITY_STRING ""
72207753Smm#else
73207753Smm#	error Incorrect LZMA_VERSION_STABILITY
74207753Smm#endif
75207753Smm
76207753Smm#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
77207753Smm		#major "." #minor "." #patch stability commit
78207753Smm
79207753Smm#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
80207753Smm		LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
81207753Smm
82207753Smm
83207753Smm/**
84207753Smm * \brief       Compile-time version as a string
85207753Smm *
86207753Smm * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
87207753Smm * versions don't have any "stable" suffix). In future, a snapshot built
88207753Smm * from source code repository may include an additional suffix, for example
89207753Smm * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
90207753Smm * in LZMA_VERSION macro.
91207753Smm */
92207753Smm#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
93207753Smm		LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
94207753Smm		LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
95207753Smm		LZMA_VERSION_COMMIT)
96207753Smm
97207753Smm
98207753Smm/* #ifndef is needed for use with windres (MinGW or Cygwin). */
99207753Smm#ifndef LZMA_H_INTERNAL_RC
100207753Smm
101207753Smm/**
102207753Smm * \brief       Run-time version number as an integer
103207753Smm *
104207753Smm * Return the value of LZMA_VERSION macro at the compile time of liblzma.
105207753Smm * This allows the application to compare if it was built against the same,
106207753Smm * older, or newer version of liblzma that is currently running.
107207753Smm */
108207753Smmextern LZMA_API(uint32_t) lzma_version_number(void)
109207753Smm		lzma_nothrow lzma_attr_const;
110207753Smm
111207753Smm
112207753Smm/**
113207753Smm * \brief       Run-time version as a string
114207753Smm *
115207753Smm * This function may be useful if you want to display which version of
116207753Smm * liblzma your application is currently using.
117207753Smm */
118207753Smmextern LZMA_API(const char *) lzma_version_string(void)
119207753Smm		lzma_nothrow lzma_attr_const;
120207753Smm
121207753Smm#endif
122