You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.h.in 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. #ifndef RSPAMD_CONFIG_H_IN
  2. #define RSPAMD_CONFIG_H_IN
  3. #cmakedefine BUILD_STATIC 1
  4. #cmakedefine CURL_FOUND 1
  5. #cmakedefine DEBUG_MODE 1
  6. #cmakedefine GIT_VERSION 1
  7. #cmakedefine GLIB_COMPAT 1
  8. #cmakedefine GLIB_HASH_COMPAT 1
  9. #cmakedefine GLIB_RE_COMPAT 1
  10. #cmakedefine GLIB_UNISCRIPT_COMPAT 1
  11. #cmakedefine HAVE_AIO_H 1
  12. #cmakedefine HAVE_ARPA_INET_H 1
  13. #cmakedefine HAVE_ASM_PAUSE 1
  14. #cmakedefine HAVE_ATOMIC_BUILTINS 1
  15. #cmakedefine HAVE_CLOCK_GETCPUCLOCKID 1
  16. #cmakedefine HAVE_CLOCK_GETTIME 1
  17. #cmakedefine HAVE_CLOCK_PROCESS_CPUTIME_ID 1
  18. #cmakedefine HAVE_CLOCK_VIRTUAL 1
  19. #cmakedefine HAVE_COMPATIBLE_QUEUE_H 1
  20. #cmakedefine HAVE_CPUID_H 1
  21. #cmakedefine HAVE_CTYPE_H 1
  22. #cmakedefine HAVE_DIRENT_H 1
  23. #cmakedefine HAVE_DIRFD 1
  24. #cmakedefine HAVE_ENDIAN_H 1
  25. #cmakedefine HAVE_EXP2L 1
  26. #cmakedefine HAVE_EXPL 1
  27. #cmakedefine HAVE_EXPLICIT_BZERO 1
  28. #cmakedefine HAVE_FADVISE 1
  29. #cmakedefine HAVE_FALLOCATE 1
  30. #cmakedefine HAVE_FCNTL_H 1
  31. #cmakedefine HAVE_FDATASYNC 1
  32. #cmakedefine HAVE_FETCH_H 1
  33. #cmakedefine HAVE_FLOCK 1
  34. #cmakedefine HAVE_FPATHCONF 1
  35. #cmakedefine HAVE_GETPAGESIZE 1
  36. #cmakedefine HAVE_GET_CPUID 1
  37. #cmakedefine HAVE_GLOB_H 1
  38. #cmakedefine HAVE_GRP_H 1
  39. #cmakedefine HAVE_INET_PTON 1
  40. #cmakedefine HAVE_INTTYPES_H 1
  41. #cmakedefine HAVE_IPV6_V6ONLY 1
  42. #cmakedefine HAVE_LIBAIO_H 1
  43. #cmakedefine HAVE_LIBEVENT2 1
  44. #cmakedefine HAVE_LIBGEN_H 1
  45. #cmakedefine HAVE_LIBUTIL_H 1
  46. #cmakedefine HAVE_LOCALE_H 1
  47. #cmakedefine HAVE_MACHINE_ENDIAN_H 1
  48. #cmakedefine HAVE_MATH_H 1
  49. #cmakedefine HAVE_MAXPATHLEN 1
  50. #cmakedefine HAVE_MEMSET_S 1
  51. #cmakedefine HAVE_MKSTEMP 1
  52. #cmakedefine HAVE_MMAP_ANON 1
  53. #cmakedefine HAVE_MMAP_NOCORE 1
  54. #cmakedefine HAVE_MMAP_SHARED 1
  55. #cmakedefine HAVE_NANOSLEEP 1
  56. #cmakedefine HAVE_NETDB_H 1
  57. #cmakedefine HAVE_NETINET_IN_H 1
  58. #cmakedefine HAVE_NETINET_TCP_H 1
  59. #cmakedefine HAVE_NFTW 1
  60. #cmakedefine HAVE_OASYNC 1
  61. #cmakedefine HAVE_ONOFOLLOW 1
  62. #cmakedefine HAVE_OCLOEXEC 1
  63. #cmakedefine HAVE_OPENSSL 1
  64. #cmakedefine HAVE_O_DIRECT 1
  65. #cmakedefine HAVE_PATH_MAX 1
  66. #cmakedefine HAVE_PCRE_JIT 1
  67. #cmakedefine HAVE_PCRE_JIT_FAST 1
  68. #cmakedefine HAVE_PIDFILE 1
  69. #cmakedefine HAVE_PIDFILE_FILENO 1
  70. #cmakedefine HAVE_POLL_H 1
  71. #cmakedefine HAVE_POSIX_FALLOCATE 1
  72. #cmakedefine HAVE_PTHREAD_PROCESS_SHARED 1
  73. #cmakedefine HAVE_PWD_H 1
  74. #cmakedefine HAVE_RDTSC 1
  75. #cmakedefine HAVE_READPASSPHRASE_H 1
  76. #cmakedefine HAVE_RUSAGE_SELF 1
  77. #cmakedefine HAVE_SA_SIGINFO 1
  78. #cmakedefine HAVE_SANE_SHMEM 1
  79. #cmakedefine HAVE_SANE_TZSET 1
  80. #cmakedefine HAVE_SCHED_YEILD 1
  81. #cmakedefine HAVE_SC_NPROCESSORS_ONLN 1
  82. #cmakedefine HAVE_SEARCH_H 1
  83. #cmakedefine HAVE_SENDFILE 1
  84. #cmakedefine HAVE_SETITIMER 1
  85. #cmakedefine HAVE_SETPROCTITLE 1
  86. #cmakedefine HAVE_SETSIG 1
  87. #cmakedefine HAVE_SIGALTSTACK 1
  88. #cmakedefine HAVE_SIGINFO_H 1
  89. #cmakedefine HAVE_SOCK_SEQPACKET 1
  90. #cmakedefine HAVE_SSL_TLSEXT_HOSTNAME 1
  91. #cmakedefine HAVE_STDBOOL_H 1
  92. #cmakedefine HAVE_STDINT_H 1
  93. #cmakedefine HAVE_STDIO_H 1
  94. #cmakedefine HAVE_STDLIB_H 1
  95. #cmakedefine HAVE_STRINGS_H 1
  96. #cmakedefine HAVE_STRING_H 1
  97. #cmakedefine HAVE_STROPS_H 1
  98. #cmakedefine HAVE_SYSEXITS_H 1
  99. #cmakedefine HAVE_SYSLOG_H 1
  100. #cmakedefine HAVE_SYS_CDEFS_H 1
  101. #cmakedefine HAVE_SYS_ENDIAN_H 1
  102. #cmakedefine HAVE_SYS_EVENTFD_H 1
  103. #cmakedefine HAVE_SYS_FILE_H 1
  104. #cmakedefine HAVE_SYS_IOCTL_H 1
  105. #cmakedefine HAVE_SYS_MMAN_H 1
  106. #cmakedefine HAVE_SYS_PARAM_H 1
  107. #cmakedefine HAVE_SYS_QUEUE_H 1
  108. #cmakedefine HAVE_SYS_RESOURCE_H 1
  109. #cmakedefine HAVE_SYS_SENDFILE_H 1
  110. #cmakedefine HAVE_SYS_SOCKET_H 1
  111. #cmakedefine HAVE_SYS_STAT_H 1
  112. #cmakedefine HAVE_SYS_TIMEB_H 1
  113. #cmakedefine HAVE_SYS_TIME_H 1
  114. #cmakedefine HAVE_SYS_TYPES_H 1
  115. #cmakedefine HAVE_SYS_UCONTEXT_H 1
  116. #cmakedefine HAVE_SYS_UIO_H 1
  117. #cmakedefine HAVE_SYS_UN_H 1
  118. #cmakedefine HAVE_SYS_UTSNAME_H 1
  119. #cmakedefine HAVE_SYS_WAIT_H 1
  120. #cmakedefine HAVE_TANH 1
  121. #cmakedefine HAVE_TANHL 1
  122. #cmakedefine HAVE_TERMIOS_H 1
  123. #cmakedefine HAVE_TIME_H 1
  124. #cmakedefine HAVE_UCONTEXT_H 1
  125. #cmakedefine HAVE_UNISTD_H 1
  126. #cmakedefine HAVE_VFORK 1
  127. #cmakedefine HAVE_WAIT4 1
  128. #cmakedefine HAVE_WAITPID 1
  129. #cmakedefine HAVE_WEAK_SYMBOLS 1
  130. #cmakedefine LIBEVENT_EVHTTP 1
  131. #cmakedefine PARAM_H_HAS_BITSET 1
  132. #cmakedefine WITH_DB 1
  133. #cmakedefine WITH_FANN 1
  134. #cmakedefine USABLE_GD 1
  135. #cmakedefine WITH_GPERF_TOOLS 1
  136. #cmakedefine WITH_HIREDIS 1
  137. #cmakedefine WITH_HYPERSCAN 1
  138. #cmakedefine WITH_JEMALLOC 1
  139. #cmakedefine WITH_JUDY 1
  140. #cmakedefine WITH_LUA 1
  141. #cmakedefine WITH_LUAJIT 1
  142. #cmakedefine WITH_PCRE2 1
  143. #cmakedefine WITH_PROFILER 1
  144. #cmakedefine WITH_SNOWBALL 1
  145. #cmakedefine WITH_SQLITE 1
  146. #cmakedefine WITH_SYSTEM_HIREDIS 1
  147. #cmakedefine WITH_TORCH 1
  148. #cmakedefine WITH_LIBUNWIND 1
  149. #cmakedefine WITH_LUA_TRACE 1
  150. #cmakedefine DISABLE_PTHREAD_MUTEX 1
  151. #ifdef HAVE_LIBEVENT2
  152. #define HAVE_EVUTIL_RNG_INIT 1
  153. #endif
  154. /* Detect endianness */
  155. #ifdef HAVE_ENDIAN_H
  156. #include <endian.h>
  157. #elif defined(HAVE_SYS_ENDIAN_H)
  158. #include <sys/endian.h>
  159. #elif defined(HAVE_MACHINE_ENDIAN_H)
  160. #include <machine/endian.h>
  161. #elif defined(__sun)
  162. #include <sys/byteorder.h>
  163. #ifndef LITTLE_ENDIAN
  164. #define LITTLE_ENDIAN 1234
  165. #endif
  166. #ifndef BIG_ENDIAN
  167. #define BIG_ENDIAN 4321
  168. #endif
  169. #ifdef _LITTLE_ENDIAN
  170. #define BYTE_ORDER LITTLE_ENDIAN
  171. #else
  172. #define BYTE_ORDER BIG_ENDIAN
  173. #endif
  174. #endif
  175. #ifndef BYTE_ORDER
  176. #ifndef LITTLE_ENDIAN
  177. #define LITTLE_ENDIAN 1234
  178. #endif
  179. #ifndef BIG_ENDIAN
  180. #define BIG_ENDIAN 4321
  181. #endif
  182. #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
  183. defined(__BIG_ENDIAN__) || \
  184. defined(__ARMEB__) || \
  185. defined(__THUMBEB__) || \
  186. defined(__AARCH64EB__) || \
  187. defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
  188. #define BYTE_ORDER BIG_ENDIAN
  189. #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
  190. defined(__LITTLE_ENDIAN__) || \
  191. defined(__ARMEL__) || \
  192. defined(__THUMBEL__) || \
  193. defined(__AARCH64EL__) || \
  194. defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
  195. #define BYTE_ORDER LITTLE_ENDIAN
  196. #else
  197. #error "I don't know what architecture this is!"
  198. #endif
  199. #endif /* BYTE_ORDER */
  200. #define RSPAMD_CONFDIR "${CONFDIR}"
  201. #define RSPAMD_LOCAL_CONFDIR "${LOCAL_CONFDIR}"
  202. #define RSPAMD_RUNDIR "${RUNDIR}"
  203. #define RSPAMD_LOGDIR "${LOGDIR}"
  204. #define RSPAMD_DBDIR "${DBDIR}"
  205. #define RSPAMD_EXAMPLESDIR "${EXAMPLESDIR}"
  206. #define RSPAMD_PLUGINSDIR "${PLUGINSDIR}"
  207. #define RSPAMD_LUALIBDIR "${LUALIBDIR}"
  208. #define RSPAMD_RULESDIR "${RULESDIR}"
  209. #define RSPAMD_WWWDIR "${WWWDIR}"
  210. #define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}"
  211. #define RSPAMD_LIBDIR "${RSPAMD_LIBDIR}"
  212. #define RSPAMD_VERSION_MAJOR "${RSPAMD_VERSION_MAJOR}"
  213. #define RSPAMD_VERSION_MINOR "${RSPAMD_VERSION_MINOR}"
  214. #define RSPAMD_VERSION_PATCH "${RSPAMD_VERSION_PATCH}"
  215. #define RSPAMD_VERSION_MAJOR_NUM ${RSPAMD_VERSION_MAJOR_NUM}
  216. #define RSPAMD_VERSION_MINOR_NUM ${RSPAMD_VERSION_MINOR_NUM}
  217. #define RSPAMD_VERSION_PATCH_NUM ${RSPAMD_VERSION_PATCH_NUM}
  218. #define RSPAMD_VERSION_BRANCH "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}"
  219. #if defined(GIT_VERSION) && GIT_VERSION == 1
  220. # define RVERSION "${RSPAMD_VERSION}"
  221. # define RSPAMD_VERSION_FULL "${RSPAMD_VERSION}_${RSPAMD_ID}"
  222. # define RID "${RSPAMD_ID}"
  223. # define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}${RSPAMD_ID}ULL
  224. #else
  225. # define RSPAMD_VERSION_FULL "${RSPAMD_VERSION}"
  226. # define RVERSION "${RSPAMD_VERSION}"
  227. # define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}0000000ULL
  228. # define RID "release"
  229. #endif
  230. #define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}"
  231. #define MODULES_NUM ${RSPAMD_MODULES_NUM}
  232. #define BUILDROOT "${CMAKE_BINARY_DIR}"
  233. /* sys/types */
  234. #ifdef HAVE_SYS_TYPES_H
  235. #include <sys/types.h>
  236. #endif
  237. /* cdefs */
  238. #ifdef HAVE_SYS_CDEFS_H
  239. #include <sys/cdefs.h>
  240. #endif
  241. /* sys/param */
  242. #ifdef HAVE_SYS_PARAM_H
  243. #include <sys/param.h>
  244. #endif
  245. /* stdint */
  246. #ifdef HAVE_STDINT_H
  247. #include <stdint.h>
  248. #elif defined(HAVE_INTTYPES_H)
  249. #include <inttypes.h>
  250. #endif
  251. /* stdbool */
  252. #ifdef HAVE_STDBOOL_H
  253. #include <stdbool.h>
  254. #endif
  255. /* stdlib */
  256. #ifdef HAVE_STDLIB_H
  257. #include <stdlib.h>
  258. #endif
  259. /* stdio */
  260. #ifdef HAVE_STDIO_H
  261. #include <stdio.h>
  262. #endif
  263. /* time */
  264. #ifdef HAVE_TIME_H
  265. #include <time.h>
  266. #endif
  267. #ifdef HAVE_STDLIB_H
  268. #include <stdlib.h>
  269. #endif
  270. /* string */
  271. #ifdef HAVE_STRING_H
  272. #include <string.h>
  273. #endif
  274. #ifdef HAVE_STRINGS_H
  275. #include <strings.h>
  276. #endif
  277. #include <errno.h>
  278. #include <glib.h>
  279. #include <gmodule.h>
  280. #ifdef GLIB_RE_COMPAT
  281. #include "gregex.h"
  282. #endif
  283. #ifdef GLIB_UNISCRIPT_COMPAT
  284. #include "guniscript.h"
  285. #endif
  286. #ifdef GLIB_COMPAT
  287. #include "gchecksum.h"
  288. #endif
  289. #if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)
  290. typedef off_t goffset;
  291. #endif
  292. #ifndef PARAM_H_HAS_BITSET
  293. /* Bit map related macros. */
  294. #ifndef NBBY
  295. # define NBBY 8 /* number of bits in a byte */
  296. #endif
  297. #define setbit(a, \
  298. i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY))
  299. #define clrbit(a, \
  300. i) (((unsigned char *)(a))[(i) / NBBY] &= ~(1 << ((i) % NBBY)))
  301. #define isset(a,i) \
  302. (((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY)))
  303. #define isclr(a,i) \
  304. ((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0)
  305. #endif
  306. #ifdef _MSC_VER
  307. # define RSPAMD_PACKED(name) \
  308. __pragma(pack(push, 1)) struct name __pragma(pack(pop))
  309. #elif defined(__GNUC__)
  310. # define RSPAMD_PACKED(name) struct __attribute__((packed)) name
  311. #else
  312. # define RSPAMD_PACKED(name) struct name
  313. #endif
  314. #ifndef RSPAMD_ALIGNED
  315. #if defined(_MSC_VER)
  316. # define RSPAMD_ALIGNED(x) __declspec(align(x))
  317. # define RSPAMD_OPTIMIZE(x)
  318. # define RSPAMD_ALWAYS_INLINE
  319. #elif defined(__GNUC__)
  320. # define RSPAMD_ALIGNED(x) __attribute__((aligned(x)))
  321. # define RSPAMD_ALWAYS_INLINE __attribute__((always_inline))
  322. #ifndef __clang__
  323. # define RSPAMD_OPTIMIZE(x) __attribute__((__optimize__ (x)))
  324. #else
  325. # define RSPAMD_OPTIMIZE(x)
  326. #endif
  327. #else
  328. # define RSPAMD_ALIGNED(x)
  329. # define RSPAMD_OPTIMIZE(x)
  330. # define RSPAMD_ALWAYS_INLINE
  331. #endif
  332. #endif
  333. #ifndef BITSPERBYTE
  334. # define BITSPERBYTE (NBBY * sizeof (char))
  335. #endif
  336. #ifndef NBYTES
  337. # define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
  338. #endif
  339. extern uint64_t ottery_rand_uint64(void);
  340. #define UCL_RANDOM_FUNCTION ottery_rand_uint64()
  341. /* Disable slab allocator if jemalloc is already in the system */
  342. #if defined(WITH_JEMALLOC) || defined(__FreeBSD__) || \
  343. (defined(__NetBSD__) && __NetBSD_Version__ >= 500000000)
  344. #if 0
  345. #define g_slice_alloc(sz) g_malloc(sz)
  346. #define g_slice_alloc0(sz) g_malloc0(sz)
  347. #define g_slice_free1(sz, p) g_free(p)
  348. #endif
  349. #endif
  350. #ifdef __cplusplus
  351. #define RSPAMD_CONSTRUCTOR(f) \
  352. static void f(void); \
  353. struct f##_t_ { f##_t_(void) { f(); } }; static f##_t_ f##_; \
  354. static void f(void)
  355. #elif defined(_MSC_VER)
  356. #pragma section(".CRT$XCU",read)
  357. #define INITIALIZER2_(f,p) \
  358. static void f(void); \
  359. __declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \
  360. __pragma(comment(linker,"/include:" p #f "_")) \
  361. static void f(void)
  362. #ifdef _WIN64
  363. #define RSPAMD_CONSTRUCTOR(f) INITIALIZER2_(f,"")
  364. #else
  365. #define RSPAMD_CONSTRUCTOR(f) INITIALIZER2_(f,"_")
  366. #endif
  367. #else
  368. #define RSPAMD_CONSTRUCTOR(f) \
  369. static void f(void) __attribute__((constructor)); \
  370. static void f(void)
  371. #endif
  372. #endif