config.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef CONFIG_H
  2. #define CONFIG_H
  3. /* ============================================================
  4. * Platform options
  5. * ============================================================ */
  6. #ifdef __APPLE__
  7. # define __DARWIN_C_SOURCE
  8. #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__)
  9. # define _XOPEN_SOURCE 700
  10. # define __BSD_VISIBLE 1
  11. # define HAVE_NETINET_IN_H
  12. #elif defined(__QNX__)
  13. # define _XOPEN_SOURCE 600
  14. # define __BSD_VISIBLE 1
  15. # define HAVE_NETINET_IN_H
  16. #else
  17. # define _XOPEN_SOURCE 700
  18. # define _DEFAULT_SOURCE 1
  19. # define _POSIX_C_SOURCE 200809L
  20. #endif
  21. #ifndef _GNU_SOURCE
  22. # define _GNU_SOURCE
  23. #endif
  24. #define OPENSSL_LOAD_CONF
  25. /* ============================================================
  26. * Compatibility defines
  27. * ============================================================ */
  28. #if defined(_MSC_VER) && _MSC_VER < 1900
  29. # define snprintf sprintf_s
  30. # define EPROTO ECONNABORTED
  31. # ifndef ECONNABORTED
  32. # define ECONNABORTED WSAECONNABORTED
  33. # endif
  34. # ifndef ENOTCONN
  35. # define ENOTCONN WSAENOTCONN
  36. # endif
  37. # ifndef ECONNREFUSED
  38. # define ECONNREFUSED WSAECONNREFUSED
  39. # endif
  40. #endif
  41. #ifdef WIN32
  42. # ifndef strcasecmp
  43. # define strcasecmp strcmpi
  44. # endif
  45. # define strtok_r strtok_s
  46. # define strerror_r(e, b, l) strerror_s(b, l, e)
  47. #endif
  48. #define uthash_malloc(sz) mosquitto_malloc(sz)
  49. #define uthash_free(ptr,sz) mosquitto_free(ptr)
  50. #ifdef WITH_TLS
  51. # include <openssl/opensslconf.h>
  52. # if defined(WITH_TLS_PSK) && !defined(OPENSSL_NO_PSK)
  53. # define FINAL_WITH_TLS_PSK
  54. # endif
  55. #endif
  56. #ifdef __COVERITY__
  57. # include <stdint.h>
  58. /* These are "wrong", but we don't use them so it doesn't matter */
  59. # define _Float32 uint32_t
  60. # define _Float32x uint32_t
  61. # define _Float64 uint64_t
  62. # define _Float64x uint64_t
  63. # define _Float128 uint64_t
  64. #endif
  65. #define UNUSED(A) (void)(A)
  66. /* Android Bionic libpthread implementation doesn't have pthread_cancel */
  67. #ifndef ANDROID
  68. # define HAVE_PTHREAD_CANCEL
  69. #endif
  70. #ifdef WITH_CJSON
  71. # include <cjson/cJSON.h>
  72. # define CJSON_VERSION_FULL (CJSON_VERSION_MAJOR*1000000+CJSON_VERSION_MINOR*1000+CJSON_VERSION_PATCH)
  73. #endif
  74. #endif