2009-02-16 17:50:18 +01:00
|
|
|
#ifndef RSPAMD_CONFIG_H_IN
|
|
|
|
#define RSPAMD_CONFIG_H_IN
|
|
|
|
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine BUILD_STATIC 1
|
|
|
|
#cmakedefine CURL_FOUND 1
|
|
|
|
#cmakedefine DEBUG_MODE 1
|
2015-12-18 15:24:01 +01:00
|
|
|
#cmakedefine GIT_VERSION 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine GLIB_COMPAT 1
|
|
|
|
#cmakedefine GLIB_HASH_COMPAT 1
|
|
|
|
#cmakedefine GLIB_RE_COMPAT 1
|
|
|
|
#cmakedefine GLIB_UNISCRIPT_COMPAT 1
|
|
|
|
#cmakedefine HAVE_AIO_H 1
|
|
|
|
#cmakedefine HAVE_ARPA_INET_H 1
|
|
|
|
#cmakedefine HAVE_ASM_PAUSE 1
|
|
|
|
#cmakedefine HAVE_ATOMIC_BUILTINS 1
|
2018-08-26 15:16:33 +02:00
|
|
|
#cmakedefine HAVE_CLOCK_GETCPUCLOCKID 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_CLOCK_GETTIME 1
|
|
|
|
#cmakedefine HAVE_CLOCK_PROCESS_CPUTIME_ID 1
|
|
|
|
#cmakedefine HAVE_CLOCK_VIRTUAL 1
|
|
|
|
#cmakedefine HAVE_COMPATIBLE_QUEUE_H 1
|
|
|
|
#cmakedefine HAVE_CPUID_H 1
|
|
|
|
#cmakedefine HAVE_CTYPE_H 1
|
|
|
|
#cmakedefine HAVE_DIRENT_H 1
|
2016-10-19 15:54:42 +02:00
|
|
|
#cmakedefine HAVE_DIRFD 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_ENDIAN_H 1
|
|
|
|
#cmakedefine HAVE_EXP2L 1
|
|
|
|
#cmakedefine HAVE_EXPL 1
|
|
|
|
#cmakedefine HAVE_EXPLICIT_BZERO 1
|
|
|
|
#cmakedefine HAVE_FADVISE 1
|
|
|
|
#cmakedefine HAVE_FALLOCATE 1
|
2009-02-16 17:50:18 +01:00
|
|
|
#cmakedefine HAVE_FCNTL_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_FDATASYNC 1
|
|
|
|
#cmakedefine HAVE_FETCH_H 1
|
|
|
|
#cmakedefine HAVE_FLOCK 1
|
2016-10-19 15:54:42 +02:00
|
|
|
#cmakedefine HAVE_FPATHCONF 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_GETPAGESIZE 1
|
|
|
|
#cmakedefine HAVE_GET_CPUID 1
|
|
|
|
#cmakedefine HAVE_GLOB_H 1
|
|
|
|
#cmakedefine HAVE_GRP_H 1
|
|
|
|
#cmakedefine HAVE_INET_PTON 1
|
|
|
|
#cmakedefine HAVE_INTTYPES_H 1
|
|
|
|
#cmakedefine HAVE_IPV6_V6ONLY 1
|
|
|
|
#cmakedefine HAVE_LIBAIO_H 1
|
2016-09-11 23:03:57 +02:00
|
|
|
#cmakedefine HAVE_LIBEVENT2 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_LIBGEN_H 1
|
|
|
|
#cmakedefine HAVE_LIBUTIL_H 1
|
|
|
|
#cmakedefine HAVE_LOCALE_H 1
|
|
|
|
#cmakedefine HAVE_MACHINE_ENDIAN_H 1
|
2009-02-16 17:50:18 +01:00
|
|
|
#cmakedefine HAVE_MATH_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_MAXPATHLEN 1
|
|
|
|
#cmakedefine HAVE_MEMSET_S 1
|
|
|
|
#cmakedefine HAVE_MKSTEMP 1
|
|
|
|
#cmakedefine HAVE_MMAP_ANON 1
|
|
|
|
#cmakedefine HAVE_MMAP_NOCORE 1
|
|
|
|
#cmakedefine HAVE_MMAP_SHARED 1
|
|
|
|
#cmakedefine HAVE_NANOSLEEP 1
|
|
|
|
#cmakedefine HAVE_NETDB_H 1
|
|
|
|
#cmakedefine HAVE_NETINET_IN_H 1
|
2017-08-07 09:26:32 +02:00
|
|
|
#cmakedefine HAVE_NETINET_TCP_H 1
|
2015-12-11 18:35:58 +01:00
|
|
|
#cmakedefine HAVE_NFTW 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_OASYNC 1
|
2016-02-03 00:42:42 +01:00
|
|
|
#cmakedefine HAVE_ONOFOLLOW 1
|
2017-07-25 09:41:27 +02:00
|
|
|
#cmakedefine HAVE_OCLOEXEC 1
|
|
|
|
#cmakedefine HAVE_OPENSSL 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_O_DIRECT 1
|
|
|
|
#cmakedefine HAVE_PATH_MAX 1
|
|
|
|
#cmakedefine HAVE_PCRE_JIT 1
|
|
|
|
#cmakedefine HAVE_PCRE_JIT_FAST 1
|
|
|
|
#cmakedefine HAVE_PIDFILE 1
|
|
|
|
#cmakedefine HAVE_PIDFILE_FILENO 1
|
|
|
|
#cmakedefine HAVE_POLL_H 1
|
|
|
|
#cmakedefine HAVE_POSIX_FALLOCATE 1
|
|
|
|
#cmakedefine HAVE_PTHREAD_PROCESS_SHARED 1
|
|
|
|
#cmakedefine HAVE_PWD_H 1
|
2017-10-27 15:09:40 +02:00
|
|
|
#cmakedefine HAVE_RDTSC 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_READPASSPHRASE_H 1
|
2018-08-26 15:16:33 +02:00
|
|
|
#cmakedefine HAVE_RUSAGE_SELF 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_SA_SIGINFO 1
|
2016-06-29 15:51:50 +02:00
|
|
|
#cmakedefine HAVE_SANE_SHMEM 1
|
2018-02-18 18:08:48 +01:00
|
|
|
#cmakedefine HAVE_SANE_TZSET 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_SCHED_YEILD 1
|
|
|
|
#cmakedefine HAVE_SC_NPROCESSORS_ONLN 1
|
|
|
|
#cmakedefine HAVE_SEARCH_H 1
|
|
|
|
#cmakedefine HAVE_SENDFILE 1
|
|
|
|
#cmakedefine HAVE_SETITIMER 1
|
|
|
|
#cmakedefine HAVE_SETPROCTITLE 1
|
|
|
|
#cmakedefine HAVE_SETSIG 1
|
2018-06-18 18:41:47 +02:00
|
|
|
#cmakedefine HAVE_SIGALTSTACK 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_SIGINFO_H 1
|
|
|
|
#cmakedefine HAVE_SOCK_SEQPACKET 1
|
2016-06-13 11:04:21 +02:00
|
|
|
#cmakedefine HAVE_SSL_TLSEXT_HOSTNAME 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_STDBOOL_H 1
|
|
|
|
#cmakedefine HAVE_STDINT_H 1
|
2009-02-16 17:50:18 +01:00
|
|
|
#cmakedefine HAVE_STDIO_H 1
|
|
|
|
#cmakedefine HAVE_STDLIB_H 1
|
|
|
|
#cmakedefine HAVE_STRINGS_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_STRING_H 1
|
|
|
|
#cmakedefine HAVE_STROPS_H 1
|
2009-02-16 17:50:18 +01:00
|
|
|
#cmakedefine HAVE_SYSEXITS_H 1
|
|
|
|
#cmakedefine HAVE_SYSLOG_H 1
|
2009-02-17 13:04:24 +01:00
|
|
|
#cmakedefine HAVE_SYS_CDEFS_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_SYS_ENDIAN_H 1
|
|
|
|
#cmakedefine HAVE_SYS_EVENTFD_H 1
|
|
|
|
#cmakedefine HAVE_SYS_FILE_H 1
|
|
|
|
#cmakedefine HAVE_SYS_IOCTL_H 1
|
|
|
|
#cmakedefine HAVE_SYS_MMAN_H 1
|
|
|
|
#cmakedefine HAVE_SYS_PARAM_H 1
|
|
|
|
#cmakedefine HAVE_SYS_QUEUE_H 1
|
|
|
|
#cmakedefine HAVE_SYS_RESOURCE_H 1
|
|
|
|
#cmakedefine HAVE_SYS_SENDFILE_H 1
|
|
|
|
#cmakedefine HAVE_SYS_SOCKET_H 1
|
|
|
|
#cmakedefine HAVE_SYS_STAT_H 1
|
|
|
|
#cmakedefine HAVE_SYS_TIMEB_H 1
|
|
|
|
#cmakedefine HAVE_SYS_TIME_H 1
|
|
|
|
#cmakedefine HAVE_SYS_TYPES_H 1
|
2018-08-26 15:26:22 +02:00
|
|
|
#cmakedefine HAVE_SYS_UCONTEXT_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_SYS_UIO_H 1
|
|
|
|
#cmakedefine HAVE_SYS_UN_H 1
|
|
|
|
#cmakedefine HAVE_SYS_UTSNAME_H 1
|
|
|
|
#cmakedefine HAVE_SYS_WAIT_H 1
|
|
|
|
#cmakedefine HAVE_TANH 1
|
|
|
|
#cmakedefine HAVE_TANHL 1
|
|
|
|
#cmakedefine HAVE_TERMIOS_H 1
|
|
|
|
#cmakedefine HAVE_TIME_H 1
|
2018-07-09 11:45:43 +02:00
|
|
|
#cmakedefine HAVE_UCONTEXT_H 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine HAVE_UNISTD_H 1
|
|
|
|
#cmakedefine HAVE_VFORK 1
|
|
|
|
#cmakedefine HAVE_WAIT4 1
|
|
|
|
#cmakedefine HAVE_WAITPID 1
|
|
|
|
#cmakedefine HAVE_WEAK_SYMBOLS 1
|
2013-06-20 13:21:38 +02:00
|
|
|
#cmakedefine LIBEVENT_EVHTTP 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine PARAM_H_HAS_BITSET 1
|
|
|
|
#cmakedefine WITH_DB 1
|
2015-12-21 13:28:41 +01:00
|
|
|
#cmakedefine WITH_FANN 1
|
2016-12-09 17:02:31 +01:00
|
|
|
#cmakedefine USABLE_GD 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine WITH_GPERF_TOOLS 1
|
2015-05-19 14:43:26 +02:00
|
|
|
#cmakedefine WITH_HIREDIS 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine WITH_HYPERSCAN 1
|
2016-04-11 12:23:47 +02:00
|
|
|
#cmakedefine WITH_JEMALLOC 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine WITH_JUDY 1
|
|
|
|
#cmakedefine WITH_LUA 1
|
2016-05-09 11:11:33 +02:00
|
|
|
#cmakedefine WITH_LUAJIT 1
|
2016-02-09 12:26:16 +01:00
|
|
|
#cmakedefine WITH_PCRE2 1
|
2015-12-07 15:29:25 +01:00
|
|
|
#cmakedefine WITH_PROFILER 1
|
|
|
|
#cmakedefine WITH_SNOWBALL 1
|
|
|
|
#cmakedefine WITH_SQLITE 1
|
|
|
|
#cmakedefine WITH_SYSTEM_HIREDIS 1
|
2017-08-07 09:14:04 +02:00
|
|
|
#cmakedefine WITH_TORCH 1
|
2018-06-18 18:41:47 +02:00
|
|
|
#cmakedefine WITH_LIBUNWIND 1
|
2018-08-09 15:27:33 +02:00
|
|
|
#cmakedefine WITH_LUA_TRACE 1
|
2015-05-19 14:43:26 +02:00
|
|
|
|
2016-04-15 19:12:50 +02:00
|
|
|
#cmakedefine DISABLE_PTHREAD_MUTEX 1
|
|
|
|
|
2016-09-11 23:03:57 +02:00
|
|
|
#ifdef HAVE_LIBEVENT2
|
|
|
|
#define HAVE_EVUTIL_RNG_INIT 1
|
|
|
|
#endif
|
|
|
|
|
2017-06-27 09:44:19 +02:00
|
|
|
/* Detect endianness */
|
2015-12-11 17:30:52 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_ENDIAN_H
|
2011-10-17 13:19:38 +02:00
|
|
|
#include <endian.h>
|
2015-12-11 17:30:52 +01:00
|
|
|
#elif defined(HAVE_SYS_ENDIAN_H)
|
2011-10-17 13:19:38 +02:00
|
|
|
#include <sys/endian.h>
|
2015-12-11 17:30:52 +01:00
|
|
|
#elif defined(HAVE_MACHINE_ENDIAN_H)
|
2011-10-17 13:19:38 +02:00
|
|
|
#include <machine/endian.h>
|
2018-02-01 14:27:15 +01:00
|
|
|
#elif defined(__sun)
|
|
|
|
#include <sys/byteorder.h>
|
2018-04-29 22:22:22 +02:00
|
|
|
#ifndef LITTLE_ENDIAN
|
|
|
|
#define LITTLE_ENDIAN 1234
|
|
|
|
#endif
|
|
|
|
#ifndef BIG_ENDIAN
|
|
|
|
#define BIG_ENDIAN 4321
|
|
|
|
#endif
|
2018-02-01 14:27:15 +01:00
|
|
|
#ifdef _LITTLE_ENDIAN
|
|
|
|
#define BYTE_ORDER LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#define BYTE_ORDER BIG_ENDIAN
|
|
|
|
#endif
|
2015-12-11 17:30:52 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef BYTE_ORDER
|
|
|
|
|
|
|
|
#ifndef LITTLE_ENDIAN
|
2015-08-18 14:17:16 +02:00
|
|
|
#define LITTLE_ENDIAN 1234
|
2015-12-11 17:30:52 +01:00
|
|
|
#endif
|
|
|
|
#ifndef BIG_ENDIAN
|
2015-08-18 14:17:16 +02:00
|
|
|
#define BIG_ENDIAN 4321
|
2015-12-11 17:30:52 +01:00
|
|
|
#endif
|
2015-08-18 14:17:16 +02:00
|
|
|
|
2015-12-11 17:30:52 +01:00
|
|
|
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
|
|
|
|
defined(__BIG_ENDIAN__) || \
|
|
|
|
defined(__ARMEB__) || \
|
|
|
|
defined(__THUMBEB__) || \
|
|
|
|
defined(__AARCH64EB__) || \
|
|
|
|
defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
|
|
|
|
#define BYTE_ORDER BIG_ENDIAN
|
|
|
|
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
|
|
|
|
defined(__LITTLE_ENDIAN__) || \
|
|
|
|
defined(__ARMEL__) || \
|
|
|
|
defined(__THUMBEL__) || \
|
|
|
|
defined(__AARCH64EL__) || \
|
|
|
|
defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
|
|
|
|
#define BYTE_ORDER LITTLE_ENDIAN
|
|
|
|
#else
|
|
|
|
#error "I don't know what architecture this is!"
|
|
|
|
#endif
|
2015-08-18 14:17:16 +02:00
|
|
|
|
2015-12-11 17:30:52 +01:00
|
|
|
#endif /* BYTE_ORDER */
|
2015-02-03 23:03:22 +01:00
|
|
|
|
2013-11-19 17:17:13 +01:00
|
|
|
#define RSPAMD_CONFDIR "${CONFDIR}"
|
2016-03-10 18:35:49 +01:00
|
|
|
#define RSPAMD_LOCAL_CONFDIR "${LOCAL_CONFDIR}"
|
2013-11-19 17:17:13 +01:00
|
|
|
#define RSPAMD_RUNDIR "${RUNDIR}"
|
|
|
|
#define RSPAMD_LOGDIR "${LOGDIR}"
|
|
|
|
#define RSPAMD_DBDIR "${DBDIR}"
|
|
|
|
#define RSPAMD_EXAMPLESDIR "${EXAMPLESDIR}"
|
|
|
|
#define RSPAMD_PLUGINSDIR "${PLUGINSDIR}"
|
2017-05-18 17:32:26 +02:00
|
|
|
#define RSPAMD_LUALIBDIR "${LUALIBDIR}"
|
2015-08-07 15:39:45 +02:00
|
|
|
#define RSPAMD_RULESDIR "${RULESDIR}"
|
2014-04-24 19:15:33 +02:00
|
|
|
#define RSPAMD_WWWDIR "${WWWDIR}"
|
2013-11-19 17:17:13 +01:00
|
|
|
#define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
2017-07-21 12:14:25 +02:00
|
|
|
#define RSPAMD_LIBDIR "${RSPAMD_LIBDIR}"
|
2013-06-12 16:59:12 +02:00
|
|
|
|
2016-03-01 13:27:02 +01:00
|
|
|
#define RSPAMD_VERSION_MAJOR "${RSPAMD_VERSION_MAJOR}"
|
|
|
|
#define RSPAMD_VERSION_MINOR "${RSPAMD_VERSION_MINOR}"
|
|
|
|
#define RSPAMD_VERSION_PATCH "${RSPAMD_VERSION_PATCH}"
|
|
|
|
|
|
|
|
#define RSPAMD_VERSION_MAJOR_NUM ${RSPAMD_VERSION_MAJOR_NUM}
|
|
|
|
#define RSPAMD_VERSION_MINOR_NUM ${RSPAMD_VERSION_MINOR_NUM}
|
|
|
|
#define RSPAMD_VERSION_PATCH_NUM ${RSPAMD_VERSION_PATCH_NUM}
|
|
|
|
|
|
|
|
#define RSPAMD_VERSION_BRANCH "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}"
|
2015-12-18 15:24:01 +01:00
|
|
|
|
2016-02-12 14:34:17 +01:00
|
|
|
#if defined(GIT_VERSION) && GIT_VERSION == 1
|
2015-12-18 15:24:01 +01:00
|
|
|
# define RVERSION "${RSPAMD_VERSION}"
|
2016-03-01 13:27:02 +01:00
|
|
|
# define RSPAMD_VERSION_FULL "${RSPAMD_VERSION}_${RSPAMD_ID}"
|
2015-12-18 15:24:01 +01:00
|
|
|
# define RID "${RSPAMD_ID}"
|
2016-02-12 14:34:17 +01:00
|
|
|
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}${RSPAMD_ID}ULL
|
2015-12-18 15:24:01 +01:00
|
|
|
#else
|
2016-03-01 13:27:02 +01:00
|
|
|
# define RSPAMD_VERSION_FULL "${RSPAMD_VERSION}"
|
2015-12-18 15:24:01 +01:00
|
|
|
# define RVERSION "${RSPAMD_VERSION}"
|
2016-02-12 14:34:17 +01:00
|
|
|
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}0000000ULL
|
2015-12-18 15:24:01 +01:00
|
|
|
# define RID "release"
|
|
|
|
#endif
|
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
#define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}"
|
|
|
|
|
|
|
|
#define MODULES_NUM ${RSPAMD_MODULES_NUM}
|
|
|
|
|
2015-02-28 01:11:56 +01:00
|
|
|
#define BUILDROOT "${CMAKE_BINARY_DIR}"
|
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
/* sys/types */
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2008-08-14 15:14:02 +02:00
|
|
|
#include <sys/types.h>
|
2009-02-16 17:50:18 +01:00
|
|
|
#endif
|
|
|
|
|
2009-02-17 13:04:24 +01:00
|
|
|
/* cdefs */
|
|
|
|
#ifdef HAVE_SYS_CDEFS_H
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* sys/param */
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
/* stdint */
|
|
|
|
#ifdef HAVE_STDINT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#elif defined(HAVE_INTTYPES_H)
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* stdbool */
|
|
|
|
#ifdef HAVE_STDBOOL_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* stdlib */
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* stdio */
|
|
|
|
#ifdef HAVE_STDIO_H
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* time */
|
|
|
|
#ifdef HAVE_TIME_H
|
|
|
|
#include <time.h>
|
|
|
|
#endif
|
|
|
|
|
2015-10-08 14:15:15 +02:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
2009-02-16 17:50:18 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* string */
|
2010-06-23 12:45:33 +02:00
|
|
|
#ifdef HAVE_STRING_H
|
2009-02-16 17:50:18 +01:00
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2015-12-11 17:30:52 +01:00
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
#include <errno.h>
|
2015-10-08 14:15:15 +02:00
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
#include <glib.h>
|
2016-02-12 19:23:26 +01:00
|
|
|
#include <gmodule.h>
|
2011-07-29 18:35:00 +02:00
|
|
|
|
|
|
|
#ifdef GLIB_RE_COMPAT
|
|
|
|
#include "gregex.h"
|
|
|
|
#endif
|
|
|
|
#ifdef GLIB_UNISCRIPT_COMPAT
|
|
|
|
#include "guniscript.h"
|
|
|
|
#endif
|
|
|
|
#ifdef GLIB_COMPAT
|
|
|
|
#include "gchecksum.h"
|
|
|
|
#endif
|
|
|
|
|
2013-03-27 12:53:05 +01:00
|
|
|
#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)
|
|
|
|
typedef off_t goffset;
|
|
|
|
#endif
|
|
|
|
|
2015-06-02 12:54:32 +02:00
|
|
|
#ifndef PARAM_H_HAS_BITSET
|
|
|
|
/* Bit map related macros. */
|
2015-10-15 12:28:41 +02:00
|
|
|
#ifndef NBBY
|
|
|
|
# define NBBY 8 /* number of bits in a byte */
|
|
|
|
#endif
|
2015-06-02 12:54:32 +02:00
|
|
|
#define setbit(a, \
|
|
|
|
i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY))
|
|
|
|
#define clrbit(a, \
|
|
|
|
i) (((unsigned char *)(a))[(i) / NBBY] &= ~(1 << ((i) % NBBY)))
|
|
|
|
#define isset(a,i) \
|
|
|
|
(((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY)))
|
|
|
|
#define isclr(a,i) \
|
|
|
|
((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0)
|
|
|
|
#endif
|
|
|
|
|
2015-10-16 13:50:56 +02:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# define RSPAMD_PACKED(name) \
|
|
|
|
__pragma(pack(push, 1)) struct name __pragma(pack(pop))
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
# define RSPAMD_PACKED(name) struct __attribute__((packed)) name
|
|
|
|
#else
|
|
|
|
# define RSPAMD_PACKED(name) struct name
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef RSPAMD_ALIGNED
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
# define RSPAMD_ALIGNED(x) __declspec(align(x))
|
2017-04-07 15:42:58 +02:00
|
|
|
# define RSPAMD_OPTIMIZE(x)
|
|
|
|
# define RSPAMD_ALWAYS_INLINE
|
2015-10-16 13:50:56 +02:00
|
|
|
#elif defined(__GNUC__)
|
|
|
|
# define RSPAMD_ALIGNED(x) __attribute__((aligned(x)))
|
2017-04-07 15:42:58 +02:00
|
|
|
# define RSPAMD_ALWAYS_INLINE __attribute__((always_inline))
|
2016-05-12 13:45:37 +02:00
|
|
|
#ifndef __clang__
|
2016-05-12 10:48:29 +02:00
|
|
|
# define RSPAMD_OPTIMIZE(x) __attribute__((__optimize__ (x)))
|
2015-10-16 13:50:56 +02:00
|
|
|
#else
|
2016-05-12 13:45:37 +02:00
|
|
|
# define RSPAMD_OPTIMIZE(x)
|
|
|
|
#endif
|
|
|
|
#else
|
2015-10-16 13:50:56 +02:00
|
|
|
# define RSPAMD_ALIGNED(x)
|
2016-05-12 10:48:29 +02:00
|
|
|
# define RSPAMD_OPTIMIZE(x)
|
2017-04-07 15:42:58 +02:00
|
|
|
# define RSPAMD_ALWAYS_INLINE
|
2015-10-16 13:50:56 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-06-02 12:54:32 +02:00
|
|
|
#ifndef BITSPERBYTE
|
|
|
|
# define BITSPERBYTE (NBBY * sizeof (char))
|
|
|
|
#endif
|
|
|
|
#ifndef NBYTES
|
|
|
|
# define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
|
|
|
|
#endif
|
|
|
|
|
2015-08-18 14:17:16 +02:00
|
|
|
extern uint64_t ottery_rand_uint64(void);
|
|
|
|
#define UCL_RANDOM_FUNCTION ottery_rand_uint64()
|
2009-02-16 17:50:18 +01:00
|
|
|
|
2016-04-11 12:23:47 +02:00
|
|
|
/* Disable slab allocator if jemalloc is already in the system */
|
|
|
|
#if defined(WITH_JEMALLOC) || defined(__FreeBSD__) || \
|
|
|
|
(defined(__NetBSD__) && __NetBSD_Version__ >= 500000000)
|
2016-04-11 18:16:22 +02:00
|
|
|
#if 0
|
2016-04-11 12:23:47 +02:00
|
|
|
#define g_slice_alloc(sz) g_malloc(sz)
|
|
|
|
#define g_slice_alloc0(sz) g_malloc0(sz)
|
|
|
|
#define g_slice_free1(sz, p) g_free(p)
|
|
|
|
#endif
|
2016-04-11 18:16:22 +02:00
|
|
|
#endif
|
2016-04-11 12:23:47 +02:00
|
|
|
|
2018-01-20 13:09:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define RSPAMD_CONSTRUCTOR(f) \
|
|
|
|
static void f(void); \
|
|
|
|
struct f##_t_ { f##_t_(void) { f(); } }; static f##_t_ f##_; \
|
|
|
|
static void f(void)
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
#pragma section(".CRT$XCU",read)
|
|
|
|
#define INITIALIZER2_(f,p) \
|
|
|
|
static void f(void); \
|
|
|
|
__declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \
|
|
|
|
__pragma(comment(linker,"/include:" p #f "_")) \
|
|
|
|
static void f(void)
|
|
|
|
#ifdef _WIN64
|
|
|
|
#define RSPAMD_CONSTRUCTOR(f) INITIALIZER2_(f,"")
|
|
|
|
#else
|
|
|
|
#define RSPAMD_CONSTRUCTOR(f) INITIALIZER2_(f,"_")
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define RSPAMD_CONSTRUCTOR(f) \
|
|
|
|
static void f(void) __attribute__((constructor)); \
|
|
|
|
static void f(void)
|
|
|
|
#endif
|
|
|
|
|
2009-02-16 17:50:18 +01:00
|
|
|
#endif
|