--- a/boost/math/tools/header_deprecated.hpp
+++ b/boost/math/tools/header_deprecated.hpp
@@ -6,12 +6,22 @@
 #ifndef BOOST_MATH_TOOLS_HEADER_DEPRECATED
 #define BOOST_MATH_TOOLS_HEADER_DEPRECATED
 
-#ifdef _MSC_VER
-// Expands to "This header is deprecated; use expr instead."
-#define BOOST_MATH_HEADER_DEPRECATED(expr) __pragma("This header is deprecated; use " expr " instead.")
-#else // GNU, Clang, Intel, IBM, etc.
+#ifndef BOOST_MATH_STANDALONE
+
+#   include <boost/config/header_deprecated.hpp>
+#   define BOOST_MATH_HEADER_DEPRECATED(expr) BOOST_HEADER_DEPRECATED(expr)
+
+#else
+
+#   ifdef _MSC_VER
 // Expands to "This header is deprecated; use expr instead."
-#define BOOST_MATH_HEADER_DEPRECATED(expr) _Pragma("This header is deprecated; use " expr " instead.")
-#endif
+#       define BOOST_MATH_HEADER_DEPRECATED(expr) __pragma("This header is deprecated; use " expr " instead.")
+#   else // GNU, Clang, Intel, IBM, etc.
+// Expands to "This header is deprecated use expr instead"
+#       define BOOST_MATH_HEADER_DEPRECATED_MESSAGE(expr) _Pragma(#expr)
+#       define BOOST_MATH_HEADER_DEPRECATED(expr) BOOST_MATH_HEADER_DEPRECATED_MESSAGE(message "This header is deprecated use " expr " instead")
+#   endif
+
+#endif // BOOST_MATH_STANDALONE
 
 #endif // BOOST_MATH_TOOLS_HEADER_DEPRECATED