summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/config.hpp11
-rw-r--r--host/include/uhd/utils/byteswap.ipp6
2 files changed, 14 insertions, 3 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 2360174a4..dacd3a96b 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -101,4 +101,15 @@
#define UHD_DEPRECATED
#endif
+// Platform defines for conditional parts of headers:
+// Taken from boost/config/select_platform_config.hpp,
+// however, we define macros, not strings for platforms.
+#if defined(linux) || defined(__linux) || defined(__linux__)
+ #define UHD_PLATFORM_LINUX
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define UHD_PLATFORM_WIN32
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ #define UHD_PLATFORM_MACOS
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp
index 11c82a4ec..a070a7cf5 100644
--- a/host/include/uhd/utils/byteswap.ipp
+++ b/host/include/uhd/utils/byteswap.ipp
@@ -21,7 +21,7 @@
/***********************************************************************
* Platform-specific implementation details for byteswap below:
**********************************************************************/
-#ifdef BOOST_MSVC //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
+#if defined(UHD_PLATFORM_WIN32) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
#include <stdlib.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -50,7 +50,7 @@
return __builtin_bswap64(x);
}
-#elif defined(__FreeBSD__) || defined(__MACOSX__) || defined(__APPLE__)
+#elif defined(UHD_PLATFORM_MACOS)
#include <libkern/OSByteOrder.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -65,7 +65,7 @@
return OSSwapInt64(x);
}
-#elif defined(linux) || defined(__linux)
+#elif defined(UHD_PLATFORM_LINUX)
#include <byteswap.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){