version.h 3.8 KB

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