Just checking for the sys/sdt.h header isn't enough, as systems like macOS have the header, but it doesn't actually have the DTRACE_PROBE* probes, which leads to compile failures. The contents of sys/sdt.h in the macOS SDK is:
#ifndef _SYS_SDT_H
#define _SYS_SDT_H
/*
* This is a wrapper header that wraps the mach visible sdt.h header so that
* the header file ends up visible where software expects it to be. We also
* do the C/C++ symbol wrapping here, since Mach headers are technically C
* interfaces.
*
* Note: The process of adding USDT probes to code is slightly different
* than documented in the "Solaris Dynamic Tracing Guide".
* The DTRACE_PROBE*() macros are not supported on Mac OS X -- instead see
* "BUILDING CODE CONTAINING USDT PROBES" in the dtrace(1) manpage
*
*/
#include <sys/cdefs.h>
__BEGIN_DECLS
#include <mach/sdt.h>
__END_DECLS
#endif /* _SYS_SDT_H */
The BUILDING CODE CONTAINING USDT PROBES section from the dtrace manpage is available here, and outlines the more involved process of using USDT probes on macOS.