ua_config.h.in 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef UA_CONFIG_H_
  2. #define UA_CONFIG_H_
  3. #ifndef _XOPEN_SOURCE
  4. # define _XOPEN_SOURCE 500
  5. # define _BSD_SOURCE
  6. #endif
  7. #define UA_LOGLEVEL ${UA_LOGLEVEL}
  8. #cmakedefine UA_ENABLE_MULTITHREADING
  9. #cmakedefine UA_ENABLE_METHODCALLS
  10. #cmakedefine UA_ENABLE_SUBSCRIPTIONS
  11. #cmakedefine UA_ENABLE_TYPENAMES
  12. #cmakedefine UA_ENABLE_EMBEDDED_LIBC
  13. #cmakedefine UA_ENABLE_GENERATE_NAMESPACE0
  14. #cmakedefine UA_ENABLE_EXTERNAL_NAMESPACES
  15. #cmakedefine UA_ENABLE_NODEMANAGEMENT
  16. #cmakedefine UA_ENABLE_NONSTANDARD_UDP
  17. #cmakedefine UA_ENABLE_NONSTANDARD_STATELESS
  18. /* Function Export */
  19. #ifdef _WIN32
  20. # ifdef UA_DYNAMIC_LINKING
  21. # ifdef __GNUC__
  22. # define UA_EXPORT __attribute__ ((dllexport))
  23. # else
  24. # define UA_EXPORT __declspec(dllexport)
  25. # endif
  26. # else
  27. # ifdef __GNUC__
  28. # define UA_EXPORT __attribute__ ((dllexport))
  29. # else
  30. # define UA_EXPORT __declspec(dllimport)
  31. # endif
  32. # endif
  33. #else
  34. # if __GNUC__ || __clang__
  35. # define UA_EXPORT __attribute__ ((visibility ("default")))
  36. # else
  37. # define UA_EXPORT
  38. # endif
  39. #endif
  40. /* Endianness */
  41. #if defined(__linux__) || defined(__APPLE__)
  42. # ifndef __QNX__
  43. # if defined(__APPLE__) || defined(__MACH__)
  44. # include <machine/endian.h>
  45. # else
  46. # include <endian.h>
  47. # endif
  48. # endif
  49. # if ( __BYTE_ORDER != __LITTLE_ENDIAN )
  50. # define UA_NON_LITTLEENDIAN_ARCHITECTURE
  51. # endif
  52. #elif _WIN32
  53. # define htole16(x) (x)
  54. # define htole32(x) (x)
  55. # define htole64(x) (x)
  56. # define le16toh(x) (x)
  57. # define le32toh(x) (x)
  58. # define le64toh(x) (x)
  59. #endif
  60. /* Force non-little endian manually by setting the following. */
  61. // #define UA_NON_LITTLEENDIAN_ARCHITECTURE
  62. // #define htole16(x) {...}(x)
  63. // #define htole32(x) {...}(x)
  64. // #define htole64(x) {...}(x)
  65. // #define le16toh(x) {...}(x)
  66. // #define le32toh(x) {...}(x)
  67. // #define le64toh(x) {...}(x)
  68. /* Mixed Endian */
  69. #ifdef __ARM_ARCH_4T__
  70. # define UA_MIXED_ENDIAN
  71. # define UA_NON_LITTLEENDIAN_ARCHITECTURE
  72. #endif
  73. /* Inline Functions */
  74. #ifdef _MSC_VER
  75. # define UA_INLINE __inline
  76. #else
  77. # define UA_INLINE inline
  78. #endif
  79. /* Define non-aliasing pointers */
  80. #ifdef _MSC_VER
  81. # define UA_RESTRICT __restrict
  82. #elif defined(__GNUC__)
  83. # define UA_RESTRICT __restrict__
  84. #else
  85. # define UA_RESTRICT restrict
  86. #endif
  87. /* Function attributes */
  88. #ifdef __GNUC__
  89. # define UA_FUNC_ATTR_MALLOC __attribute__((malloc))
  90. # define UA_FUNC_ATTR_PURE __attribute__ ((pure))
  91. # define UA_FUNC_ATTR_CONST __attribute__((const))
  92. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  93. #else
  94. # define UA_FUNC_ATTR_MALLOC
  95. # define UA_FUNC_ATTR_PURE
  96. # define UA_FUNC_ATTR_CONST
  97. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT
  98. #endif
  99. #include <stddef.h>
  100. #ifdef UA_ENABLE_EMBEDDED_LIBC
  101. void *memcpy(void *UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n);
  102. void *memset(void *dest, int c, size_t n);
  103. size_t strlen(const char *s);
  104. int memcmp(const void *vl, const void *vr, size_t n);
  105. #else
  106. # include <string.h>
  107. #endif
  108. #endif /* UA_CONFIG_H_ */