14582aba2STrond Norbye/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2f603fdb6STrond Norbye#ifndef CONFIG_H
3f603fdb6STrond Norbye#define CONFIG_H 1
4530646daSTrond Norbye
5ce9a18d0STrond Norbye#include <event.h>
6464d6f0bSTrond Norbye#include <platform/platform.h>
7ce9a18d0STrond Norbye
8bd1ef70eSTrond Norbye#cmakedefine HAVE_ATOMIC ${HAVE_ATOMIC}
9bd1ef70eSTrond Norbye
10ed0d0834STrond Norbye#if (!defined(_EVENT_NUMERIC_VERSION) || _EVENT_NUMERIC_VERSION < 0x02000000) && !defined(WIN32)
11ce9a18d0STrond Norbyetypedef int evutil_socket_t;
12ce9a18d0STrond Norbye#endif
13ce9a18d0STrond Norbye
1400999f69STrond Norbye#ifdef WIN32
15f603fdb6STrond Norbye#include <winsock2.h>
16f603fdb6STrond Norbye#include <ws2tcpip.h>
17f603fdb6STrond Norbye#include <windows.h>
18f603fdb6STrond Norbye
19f603fdb6STrond Norbye#define PATH_MAX 1024
20f603fdb6STrond Norbye
21f603fdb6STrond Norbye/* @todo investigate this one.. */
22f603fdb6STrond Norbye
2300999f69STrond Norbye#define SOCKETPAIR_AF AF_INET
2400999f69STrond Norbye#define get_socket_error() WSAGetLastError()
25f603fdb6STrond Norbye
26f603fdb6STrond Norbyetypedef int in_port_t;
27f603fdb6STrond Norbyetypedef HANDLE pid_t;
2800999f69STrond Norbye
29f603fdb6STrond Norbye#define snprintf _snprintf
30f603fdb6STrond Norbye#define strtoull(a, b, c) _strtoui64(a, b, c)
31f603fdb6STrond Norbye#define strtoll(a, b, c) _strtoi64(a, b, c)
32f603fdb6STrond Norbye/* to stop the stupid compiler to whine about this.. */
33f603fdb6STrond Norbye#ifndef __cplusplus
34f603fdb6STrond Norbye#define strdup(a) _strdup(a)
35f603fdb6STrond Norbye#define putenv(a) _putenv(a)
3610714d5bSTrond Norbye#endif
3710714d5bSTrond Norbye
386c0d8016STrond Norbye#define EX_OSERR EXIT_FAILURE
396c0d8016STrond Norbye#define EX_USAGE EXIT_FAILURE
40b5775a46STrond Norbye
414582aba2STrond Norbye#else
424582aba2STrond Norbye
43f603fdb6STrond Norbye#if !defined(__cplusplus) && !defined(linux) && !defined(__GNUC__)
44f603fdb6STrond Norbyetypedef unsigned long long uint64_t;
45f603fdb6STrond Norbyetypedef long long int64_t;
46b5775a46STrond Norbye#endif
47b5775a46STrond Norbye
48f603fdb6STrond Norbye#define closesocket(a) close(a)
49f603fdb6STrond Norbye#define SOCKET int
50f603fdb6STrond Norbye#define SOCKETPAIR_AF AF_UNIX
51f603fdb6STrond Norbye#define SOCKET_ERROR -1
52f603fdb6STrond Norbye#define INVALID_SOCKET -1
53f603fdb6STrond Norbye#define get_socket_error() errno
544582aba2STrond Norbye
55f603fdb6STrond Norbye/* some POSIX systems need the following definition
56f603fdb6STrond Norbye * to get mlockall flags out of sys/mman.h.  */
57f603fdb6STrond Norbye#ifndef _P1003_1B_VISIBLE
58f603fdb6STrond Norbye#define _P1003_1B_VISIBLE
59e9aa1517STrond Norbye#endif
60f603fdb6STrond Norbye/* need this to get IOV_MAX on some platforms. */
61f603fdb6STrond Norbye#ifndef __need_IOV_MAX
62f603fdb6STrond Norbye#define __need_IOV_MAX
634882a618STrond Norbye#endif
644882a618STrond Norbye
65f603fdb6STrond Norbye#ifndef _POSIX_PTHREAD_SEMANTICS
66f603fdb6STrond Norbye#define _POSIX_PTHREAD_SEMANTICS
6758df6f95STrond Norbye#endif
6858df6f95STrond Norbye
69f603fdb6STrond Norbye#ifdef __sun
70f603fdb6STrond Norbye#include <priv.h>
71f603fdb6STrond Norbye#define HAVE_DROP_PRIVILEGES 1
7258df6f95STrond Norbye#endif
7358df6f95STrond Norbye
74f603fdb6STrond Norbye#define HAVE_SIGIGNORE 1
7558df6f95STrond Norbye
7658df6f95STrond Norbye
77f603fdb6STrond Norbye#include <sys/wait.h>
78f603fdb6STrond Norbye#include <sys/socket.h>
79f603fdb6STrond Norbye#include <netinet/in.h>
80f603fdb6STrond Norbye#include <netdb.h>
81f603fdb6STrond Norbye#include <unistd.h>
8258df6f95STrond Norbye#include <sys/stat.h>
8358df6f95STrond Norbye#include <sys/un.h>
8458df6f95STrond Norbye#include <sys/resource.h>
8558df6f95STrond Norbye#include <sys/uio.h>
8658df6f95STrond Norbye#include <netinet/tcp.h>
87f603fdb6STrond Norbye#include <arpa/inet.h>
88f603fdb6STrond Norbye#include <sys/mman.h>
89f603fdb6STrond Norbye#include <sys/time.h>
90f603fdb6STrond Norbye#include <signal.h>
916c0d8016STrond Norbye#include <sysexits.h>
92f603fdb6STrond Norbye
93f603fdb6STrond Norbye/* @todo trondn fixme!! */
94f603fdb6STrond Norbye#if !defined(__cplusplus) && !defined(PRIu64)
95f603fdb6STrond Norbye#define PRIu64 "lu"
9658df6f95STrond Norbye#endif
9758df6f95STrond Norbye
98f603fdb6STrond Norbye#if !defined(__cplusplus) && !defined(PRIu32)
99f603fdb6STrond Norbye#define PRIu32 "u"
10058df6f95STrond Norbye#endif
10158df6f95STrond Norbye
10258df6f95STrond Norbye
10358df6f95STrond Norbye#endif
10458df6f95STrond Norbye
105f603fdb6STrond Norbye/* Common section */
106f603fdb6STrond Norbye#include <stdlib.h>
107f603fdb6STrond Norbye#include <inttypes.h>
108f603fdb6STrond Norbye#include <sys/types.h>
109f603fdb6STrond Norbye
110f603fdb6STrond Norbye#ifndef __cplusplus
1116c0d8016STrond Norbye#include <stdbool.h>
11258df6f95STrond Norbye#endif
11358df6f95STrond Norbye
11458df6f95STrond Norbye#ifndef IOV_MAX
11558df6f95STrond Norbye# define IOV_MAX 1024
11658df6f95STrond Norbye#endif
117bf89b927STrond Norbye#define SASL_ENABLED
118f603fdb6STrond Norbye
1196ded21baSTrond Norbye#define MEMCACHED_VERSION "${MEMCACHED_VERSION}"
120493f0889STrond Norbye#define PRODUCT_VERSION "${PRODUCT_VERSION}"
121bf89b927STrond Norbye
1224582aba2STrond Norbye#endif
123