GNU libmicrohttpd 0.9.71
mhd_options.h
Go to the documentation of this file.
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2016 Karlson2k (Evgeny Grin)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
31#ifndef MHD_OPTIONS_H
32#define MHD_OPTIONS_H 1
33
34#include "MHD_config.h"
35
42#define _(String) (String)
43
44
45#ifndef _MHD_EXTERN
46#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \
47 (defined(DLL_EXPORT) || defined(MHD_W32DLL))
48#define _MHD_EXTERN __declspec(dllexport) extern
49#else /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
50#define _MHD_EXTERN extern
51#endif /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
52#endif /* ! _MHD_EXTERN */
53
54/* Some platforms (FreeBSD, Solaris, W32) allow to override
55 default FD_SETSIZE by defining it before including
56 headers. */
57#ifdef FD_SETSIZE
58/* FD_SETSIZE defined in command line or in MHD_config.h */
59#elif defined(_WIN32) || defined(__CYGWIN__)
60/* Platform with WinSock and without overridden FD_SETSIZE */
61#define FD_SETSIZE 2048 /* Override default small value (64) */
62#else /* !FD_SETSIZE && !W32 */
63/* System default value of FD_SETSIZE is used */
64#define _MHD_FD_SETSIZE_IS_DEFAULT 1
65#endif /* !FD_SETSIZE && !W32 */
66
67#if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_FREEBSD_SENDFILE) || \
68 defined(HAVE_DARWIN_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE)
69/* Have any supported sendfile() function. */
70#define _MHD_HAVE_SENDFILE
71#endif /* HAVE_LINUX_SENDFILE || HAVE_FREEBSD_SENDFILE ||
72 HAVE_DARWIN_SENDFILE || HAVE_SOLARIS_SENDFILE */
73#if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE)
74#define MHD_LINUX_SOLARIS_SENDFILE 1
75#endif /* HAVE_LINUX_SENDFILE || HAVE_SOLARIS_SENDFILE */
76
77#if OS390
78#define _OPEN_THREADS
79#define _OPEN_SYS_SOCK_IPV6
80#define _OPEN_MSGQ_EXT
81#define _LP64
82#endif
83
84#if defined(_WIN32) && ! defined(__CYGWIN__)
85/* Declare POSIX-compatible names */
86#define _CRT_DECLARE_NONSTDC_NAMES 1
87/* Do not warn about POSIX name usage */
88#define _CRT_NONSTDC_NO_WARNINGS 1
89#ifndef _WIN32_WINNT
90#define _WIN32_WINNT 0x0501
91#else /* _WIN32_WINNT */
92#if _WIN32_WINNT < 0x0501
93#error "Headers for Windows XP or later are required"
94#endif /* _WIN32_WINNT < 0x0501 */
95#endif /* _WIN32_WINNT */
96#ifndef WIN32_LEAN_AND_MEAN
97/* Do not include unneeded parts of W32 headers. */
98#define WIN32_LEAN_AND_MEAN 1
99#endif /* !WIN32_LEAN_AND_MEAN */
100#endif /* _WIN32 && ! __CYGWIN__ */
101
102#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
103#define RESTRICT __restrict__
104#endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */
105
106#if LINUX + 0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && \
107 ! defined(_LARGEFILE64_SOURCE)
108/* On Linux, special macro is required to enable definitions of some xxx64 functions */
109#define _LARGEFILE64_SOURCE 1
110#endif
111
112#ifdef HAVE_C11_GMTIME_S
113/* Special macro is required to enable C11 definition of gmtime_s() function */
114#define __STDC_WANT_LIB_EXT1__ 1
115#endif /* HAVE_C11_GMTIME_S */
116
117#if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE)
118#error \
119 MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time.
120#endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */
121
122/* Define MHD_FAVOR_FAST_CODE to force fast code path or
123 define MHD_FAVOR_SMALL_CODE to choose compact code path */
124#if ! defined(MHD_FAVOR_FAST_CODE) && ! defined(MHD_FAVOR_SMALL_CODE)
125/* Try to detect user preferences */
126/* Defined by GCC and many compatible compilers */
127#if defined(__OPTIMIZE_SIZE__)
128#define MHD_FAVOR_SMALL_CODE 1
129#elif defined(__OPTIMIZE__)
130#define MHD_FAVOR_FAST_CODE 1
131#endif /* __OPTIMIZE__ */
132#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
133
134#if ! defined(MHD_FAVOR_FAST_CODE) && ! defined(MHD_FAVOR_SMALL_CODE)
135/* Use faster code by default */
136#define MHD_FAVOR_FAST_CODE 1
137#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
138
139#endif /* MHD_OPTIONS_H */