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