ua_config.h.in 2.8 KB

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