Question

Is there a way to check (preferably at compile-time or at configure-time) whether the Boost.Locale library is compiled with support for particular backend (i.e. ICU)?

Was it helpful?

Solution

Boost.Locale provides this:

std::vector<std::string> boost::locale::localization_backend_manager::get_all_backends() const

This will list all the backends available. E.g.,

localization_backend_manager lbm = localization_backend_manager::global();
auto s = lbm.get_all_backends();
for_each(s.begin(), s.end(), [](string& x){ cout << x << endl; });

will print

icu
winapi
std

If Boost.Locale wasn't built with ICU support, it will list only the two last lines.

You can use this in a configure script and compile a .cpp that accepts a backend as a parameter and checks whether it is supported.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top