Fix ICU detection.

See: https://svn.boost.org/trac/boost/ticket/12152.
This commit is contained in:
jzmaddock
2016-06-09 18:02:31 +01:00
parent 9059bfb5c6
commit e3228b61eb
2 changed files with 16 additions and 7 deletions

View File

@ -115,11 +115,6 @@ if ! $(disable-icu)
}
actions regex_simple_run_action
{
$(>) > $(<)
}
rule regex-run-simple ( sources + : args * : input-files * : requirements * : target-name )
{
exe $(target-name)_exe : $(sources) : $(requirements) ;
@ -129,7 +124,7 @@ rule regex-run-simple ( sources + : args * : input-files * : requirements * : ta
alias $(target-name) : $(target-name).output ;
}
regex-run-simple has_icu_test.cpp : : : $(ICU_OPTS) : has_icu ;
unit-test has_icu : has_icu_test.cpp : $(ICU_OPTS) ;
explicit has_icu ;
alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;

View File

@ -21,6 +21,11 @@
#error "Mixing ICU with a static runtime doesn't work"
#endif
void print_error(UErrorCode err, const char* func)
{
std::cerr << "Error from function " << func << " with error: " << ::u_errorName(err) << std::endl;
}
int main()
{
// To detect possible binary mismatches between the installed ICU build, and whatever
@ -31,8 +36,17 @@ int main()
UErrorCode err = U_ZERO_ERROR;
UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
std::cout << (int)c << std::endl;
if(err > 0) return err;
if(err > 0)
{
print_error(err, "u_charFromName");
return err;
}
U_NAMESPACE_QUALIFIER Locale l;
boost::scoped_ptr<U_NAMESPACE_QUALIFIER Collator> p_col(U_NAMESPACE_QUALIFIER Collator::createInstance(l, err));
if(err > 0)
{
print_error(err, "Collator::createInstance");
return err;
}
return err > 0 ? err : 0;
}