Add support for custom handler tracking.
diff --git a/asio/include/asio/detail/handler_tracking.hpp b/asio/include/asio/detail/handler_tracking.hpp
index 14e8177..4c3bdd7 100644
--- a/asio/include/asio/detail/handler_tracking.hpp
+++ b/asio/include/asio/detail/handler_tracking.hpp
@@ -17,7 +17,9 @@
 
 #include "asio/detail/config.hpp"
 
-#if defined(ASIO_ENABLE_HANDLER_TRACKING)
+#if defined(ASIO_CUSTOM_HANDLER_TRACKING)
+# include ASIO_CUSTOM_HANDLER_TRACKING
+#elif defined(ASIO_ENABLE_HANDLER_TRACKING)
 # include "asio/error_code.hpp"
 # include "asio/detail/cstdint.hpp"
 # include "asio/detail/static_mutex.hpp"
@@ -29,7 +31,19 @@
 namespace asio {
 namespace detail {
 
-#if defined(ASIO_ENABLE_HANDLER_TRACKING)
+#if defined(ASIO_CUSTOM_HANDLER_TRACKING)
+
+// The user-specified header must define the following macros:
+// - ASIO_INHERIT_TRACKED_HANDLER
+// - ASIO_ALSO_INHERIT_TRACKED_HANDLER
+// - ASIO_HANDLER_TRACKING_INIT
+// - ASIO_HANDLER_CREATION(args)
+// - ASIO_HANDLER_COMPLETION(args)
+// - ASIO_HANDLER_INVOCATION_BEGIN(args)
+// - ASIO_HANDLER_INVOCATION_END
+// - ASIO_HANDLER_OPERATION(args)
+
+#elif defined(ASIO_ENABLE_HANDLER_TRACKING)
 
 class handler_tracking
 {
diff --git a/asio/include/asio/detail/impl/handler_tracking.ipp b/asio/include/asio/detail/impl/handler_tracking.ipp
index 29fbe51..a06040e 100644
--- a/asio/include/asio/detail/impl/handler_tracking.ipp
+++ b/asio/include/asio/detail/impl/handler_tracking.ipp
@@ -17,7 +17,11 @@
 
 #include "asio/detail/config.hpp"
 
-#if defined(ASIO_ENABLE_HANDLER_TRACKING)
+#if defined(ASIO_CUSTOM_HANDLER_TRACKING)
+
+// The handler tracking implementation is provided by the user-specified header.
+
+#elif defined(ASIO_ENABLE_HANDLER_TRACKING)
 
 #include <cstdarg>
 #include <cstdio>