ua_config.h.in 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef UA_CONFIG_H_
  2. #define UA_CONFIG_H_
  3. #ifndef _XOPEN_SOURCE
  4. # define _XOPEN_SOURCE 500
  5. #endif
  6. #define UA_LOGLEVEL ${UA_LOGLEVEL}
  7. #cmakedefine UA_MULTITHREADING
  8. #cmakedefine ENABLE_METHODCALLS
  9. #cmakedefine ENABLE_SUBSCRIPTIONS
  10. #cmakedefine ENABLE_TYPEINTROSPECTION
  11. /* Function Export */
  12. #ifdef _WIN32
  13. # ifdef UA_DYNAMIC_LINKING
  14. # ifdef __GNUC__
  15. # define UA_EXPORT __attribute__ ((dllexport))
  16. # else
  17. # define UA_EXPORT __declspec(dllexport)
  18. # endif
  19. # else
  20. # ifdef __GNUC__
  21. # define UA_EXPORT __attribute__ ((dllexport))
  22. # else
  23. # define UA_EXPORT __declspec(dllimport)
  24. # endif
  25. # endif
  26. #else
  27. # if __GNUC__ || __clang__
  28. # define UA_EXPORT __attribute__ ((visibility ("default")))
  29. # else
  30. # define UA_EXPORT
  31. # endif
  32. #endif
  33. /* Endianness */
  34. #if defined(__linux__) || defined(__APPLE__)
  35. # ifndef __QNX__
  36. # if defined(__APPLE__) || defined(__MACH__)
  37. # include <machine/endian.h>
  38. # else
  39. # include <endian.h>
  40. # endif
  41. # endif
  42. # if ( __BYTE_ORDER != __LITTLE_ENDIAN )
  43. # define UA_NON_LITTLEENDIAN_ARCHITECTURE
  44. # endif
  45. #endif
  46. /* Force non-little endian manually by setting the following. */
  47. // #define UA_NON_LITTLEENDIAN_ARCHITECTURE
  48. // #define htole16(x) {...}(x)
  49. // #define htole32(x) {...}(x)
  50. // #define htole64(x) {...}(x)
  51. // #define le16toh(x) {...}(x)
  52. // #define le32toh(x) {...}(x)
  53. // #define le64toh(x) {...}(x)
  54. /* Mixed Endian */
  55. #ifdef __ARM_ARCH_4T__
  56. # define UA_MIXED_ENDIAN
  57. # define UA_NON_LITTLEENDIAN_ARCHITECTURE
  58. #endif
  59. /* Aligned Memory Access */
  60. #if defined(__arm__) && !defined(__ARM_FEATURE_UNALIGNED)
  61. # define UA_ALIGNED_MEMORY_ACCESS
  62. #endif
  63. /* Inline Functions */
  64. #ifdef _MSC_VER
  65. # define UA_INLINE __inline
  66. #else
  67. # define UA_INLINE inline
  68. #endif
  69. /* Define non-aliasing pointers */
  70. #ifdef _MSC_VER
  71. # define UA_RESTRICT __restrict
  72. #elif defined(__GNUC__)
  73. # define UA_RESTRICT __restrict__
  74. #else
  75. # define UA_RESTRICT restrict
  76. #endif
  77. /* Function attributes */
  78. #ifdef __GNUC__
  79. # define UA_FUNC_ATTR_MALLOC __attribute__((malloc))
  80. # define UA_FUNC_ATTR_PURE __attribute__ ((pure))
  81. # define UA_FUNC_ATTR_CONST __attribute__((const))
  82. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  83. #else
  84. # define UA_FUNC_ATTR_MALLOC
  85. # define UA_FUNC_ATTR_PURE
  86. # define UA_FUNC_ATTR_CONST
  87. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT
  88. #endif
  89. #endif /* UA_CONFIG_H_ */