fmt: test for fmt::runtime() & require v8.0.0 or later

This commit is contained in:
Moritz Bunkus 2024-04-23 23:01:53 +02:00
parent 1d48a6235d
commit bb6aa513a2
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
4 changed files with 11 additions and 29 deletions

View File

@ -22,6 +22,11 @@
being copied when very large values were present in source files, or in
error messages when very large values were used as command-line parameters.
## Build system changes
* Release v8.0.0 of the `fmt` library is now required. If not found, the
bundled copy will be used.
# Version 83.0 "Circle Of Friends" 2024-03-10

View File

@ -124,7 +124,7 @@ distribution instead of relying on the bundled versions.
These libraries are:
- [fmt](http://fmtlib.net/) — a small, safe and fast formatting
library. Version 6.1.0 or later is required.
library. Version 8.0.0 or later is required.
- [libEBML v1.4.4](http://dl.matroska.org/downloads/libebml/) or later
and [libMatroska v1.7.1](http://dl.matroska.org/downloads/libmatroska/)

View File

@ -15,28 +15,15 @@ AC_CACHE_CHECK([fmt],[ac_cv_fmt],[
#include <fmt/format.h>
#include <fmt/ostream.h>
#if !defined(FMT_VERSION) || (FMT_VERSION < 60100)
#error fmtlib is too old, need 6.1.0 or later
#if !defined(FMT_VERSION) || (FMT_VERSION < 80000)
#error fmtlib is too old, need 8.0.0 or later
#endif
]], [[
fmt::format("{0:02}", fmt::to_string(4254));
fmt::format("{0}", fmt::to_string(4254));
std::string moo{"'{0}' says the cow"};
fmt::format(fmt::runtime(moo), "moo");
]])],[ac_cv_fmt=yes],[ac_cv_fmt=no])
AC_CACHE_VAL(ac_cv_fmt_v8, [
if test $ac_cv_fmt=yes; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <fmt/format.h>
#include <fmt/ostream.h>
#if !defined(FMT_VERSION) || (FMT_VERSION < 80000)
#error fmt is older than v8
#endif
]], [[
fmt::format("{0:02}", fmt::to_string(4254));
]])],[ac_cv_fmt_v8=yes],[ac_cv_fmt_v8=no])
fi
])
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
@ -48,10 +35,6 @@ if test x"$ac_cv_fmt" = xyes; then
else
AC_MSG_NOTICE([Using the internal version of fmt])
FMT_INTERNAL=yes
ac_cv_fmt_v8=yes
fi
if test $ac_cv_fmt_v8 = yes; then
AC_DEFINE([HAVE_FMT_V8],[1],[Define if the fmt library is v8 or newer])
fi
AC_SUBST(FMT_INTERNAL)

View File

@ -33,12 +33,6 @@
#include <stdint.h>
#if !defined(HAVE_FMT_V8) || !HAVE_FMT_V8
// Don't support user-defined literals in fmt as they aren't used by
// MKVToolNix and produce a compiler warning in -Wpedantic with fmt < v8
# define FMT_USE_USER_DEFINED_LITERALS 0
#endif
#include <fmt/format.h>
#include <fmt/ostream.h>