Allow Boost.Math to be used without RTTI.
Fixes #9317.

[SVN r86517]