ua_config.h.in 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /* Inline Functions */
  66. #ifdef _MSC_VER
  67. # define UA_INLINE __inline
  68. #else
  69. # define UA_INLINE inline
  70. #endif
  71. /* Define non-aliasing pointers */
  72. #ifdef _MSC_VER
  73. # define UA_RESTRICT __restrict
  74. #elif defined(__GNUC__)
  75. # define UA_RESTRICT __restrict__
  76. #else
  77. # define UA_RESTRICT restrict
  78. #endif
  79. /* Function attributes */
  80. #ifdef __GNUC__
  81. # define UA_FUNC_ATTR_MALLOC __attribute__((malloc))
  82. # define UA_FUNC_ATTR_PURE __attribute__ ((pure))
  83. # define UA_FUNC_ATTR_CONST __attribute__((const))
  84. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  85. #else
  86. # define UA_FUNC_ATTR_MALLOC
  87. # define UA_FUNC_ATTR_PURE
  88. # define UA_FUNC_ATTR_CONST
  89. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT
  90. #endif
  91. #include <stddef.h>
  92. #ifdef UA_ENABLE_EMBEDDED_LIBC
  93. void *memcpy(void *UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n);
  94. void *memset(void *dest, int c, size_t n);
  95. size_t strlen(const char *s);
  96. int memcmp(const void *vl, const void *vr, size_t n);
  97. #else
  98. # include <string.h>
  99. #endif
  100. #endif /* UA_CONFIG_H_ */