mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
701c0541af
fmt v8 currently contains a bug that causes compilation to fail if `FMT_USE_USER_DEFINED_LITERALS` is defined to 0. This is a regression from earlier versions. A bug has been filed against fmt: https://github.com/fmtlib/fmt/issues/2384 MKVToolNix defined this to 0 as earlier fmt versions caused warnings in their code dealing with user-defined literals with `-Wpedantic`. Luckily those warnings do not occur with v8 anymore. The fix is to test in `configure` if the fmt version we're compiling with is v8 or older, and only to define `FMT_USE_USER_DEFINED_LITERALS` to 0 for earlier versions. Fixes #3151.
58 lines
1.2 KiB
Plaintext
58 lines
1.2 KiB
Plaintext
dnl
|
|
dnl Check for the fmt library
|
|
dnl
|
|
|
|
|
|
AC_CACHE_CHECK([fmt],[ac_cv_fmt],[
|
|
AC_LANG_PUSH(C++)
|
|
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
|
ac_save_LIBS="$LIBS"
|
|
CXXFLAGS="$STD_CXX $CXXFLAGS"
|
|
LIBS="$LIBS -lfmt"
|
|
|
|
AC_TRY_COMPILE([
|
|
#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
|
|
#endif
|
|
],[
|
|
fmt::format("{0:02}", fmt::to_string(4254));
|
|
],[ac_cv_fmt=yes],[ac_cv_fmt=no])
|
|
|
|
AC_CACHE_VAL(ac_cv_fmt_v8, [
|
|
if test $ac_cv_fmt=yes; then
|
|
AC_TRY_COMPILE([
|
|
#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"
|
|
|
|
AC_LANG_POP
|
|
])
|
|
|
|
if test x"$ac_cv_fmt" = xyes; then
|
|
FMT_INTERNAL=no
|
|
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)
|