diff --git a/src/mplutils.h b/src/mplutils.h index 8d4ae709e154..06a05337667e 100644 --- a/src/mplutils.h +++ b/src/mplutils.h @@ -18,6 +18,16 @@ typedef unsigned __int8 uint8_t; # undef _XOPEN_SOURCE #endif +// Prevent multiple conflicting definitions of swab from stdlib.h and unistd.h +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#if defined(_XPG3) +#undef _XPG3 +#endif +#endif + #include #if PY_MAJOR_VERSION >= 3 diff --git a/src/numpy_cpp.h b/src/numpy_cpp.h index 887ffe48aee7..d68a637bc117 100644 --- a/src/numpy_cpp.h +++ b/src/numpy_cpp.h @@ -25,6 +25,16 @@ # undef _XOPEN_SOURCE #endif +// Prevent multiple conflicting definitions of swab from stdlib.h and unistd.h +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#if defined(_XPG3) +#undef _XPG3 +#endif +#endif + #include #include