ua_config.h.in 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #endif
  53. /* Force non-little endian manually by setting the following. */
  54. // #define UA_NON_LITTLEENDIAN_ARCHITECTURE
  55. // #define htole16(x) {...}(x)
  56. // #define htole32(x) {...}(x)
  57. // #define htole64(x) {...}(x)
  58. // #define le16toh(x) {...}(x)
  59. // #define le32toh(x) {...}(x)
  60. // #define le64toh(x) {...}(x)
  61. /* Mixed Endian */
  62. #ifdef __ARM_ARCH_4T__
  63. # define UA_MIXED_ENDIAN
  64. # define UA_NON_LITTLEENDIAN_ARCHITECTURE
  65. #endif
  66. /* Inline Functions */
  67. #ifdef _MSC_VER
  68. # define UA_INLINE __inline
  69. #else
  70. # define UA_INLINE inline
  71. #endif
  72. /* Define non-aliasing pointers */
  73. #ifdef _MSC_VER
  74. # define UA_RESTRICT __restrict
  75. #elif defined(__GNUC__)
  76. # define UA_RESTRICT __restrict__
  77. #else
  78. # define UA_RESTRICT restrict
  79. #endif
  80. /* Function attributes */
  81. #ifdef __GNUC__
  82. # define UA_FUNC_ATTR_MALLOC __attribute__((malloc))
  83. # define UA_FUNC_ATTR_PURE __attribute__ ((pure))
  84. # define UA_FUNC_ATTR_CONST __attribute__((const))
  85. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  86. #else
  87. # define UA_FUNC_ATTR_MALLOC
  88. # define UA_FUNC_ATTR_PURE
  89. # define UA_FUNC_ATTR_CONST
  90. # define UA_FUNC_ATTR_WARN_UNUSED_RESULT
  91. #endif
  92. #include <stddef.h>
  93. #ifdef UA_ENABLE_EMBEDDED_LIBC
  94. void *memcpy(void *UA_RESTRICT dest, const void *UA_RESTRICT src, size_t n);
  95. void *memset(void *dest, int c, size_t n);
  96. size_t strlen(const char *s);
  97. int memcmp(const void *vl, const void *vr, size_t n);
  98. #else
  99. # include <string.h>
  100. #endif
  101. #endif /* UA_CONFIG_H_ */