ua_config.h.in 2.6 KB

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