GNU libmicrohttpd  0.9.72
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 defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
78 # ifndef MHD_USE_THREADS
79 # define MHD_USE_THREADS 1
80 # endif
81 #endif /* MHD_USE_POSIX_THREADS || MHD_USE_W32_THREADS */
82 
83 #if OS390
84 #define _OPEN_THREADS
85 #define _OPEN_SYS_SOCK_IPV6
86 #define _OPEN_MSGQ_EXT
87 #define _LP64
88 #endif
89 
90 #if defined(_WIN32) && ! defined(__CYGWIN__)
91 /* Declare POSIX-compatible names */
92 #define _CRT_DECLARE_NONSTDC_NAMES 1
93 /* Do not warn about POSIX name usage */
94 #define _CRT_NONSTDC_NO_WARNINGS 1
95 #ifndef _WIN32_WINNT
96 #define _WIN32_WINNT 0x0600
97 #else /* _WIN32_WINNT */
98 #if _WIN32_WINNT < 0x0501
99 #error "Headers for Windows XP or later are required"
100 #endif /* _WIN32_WINNT < 0x0501 */
101 #endif /* _WIN32_WINNT */
102 #ifndef WIN32_LEAN_AND_MEAN
103 /* Do not include unneeded parts of W32 headers. */
104 #define WIN32_LEAN_AND_MEAN 1
105 #endif /* !WIN32_LEAN_AND_MEAN */
106 #endif /* _WIN32 && ! __CYGWIN__ */
107 
108 #if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
109 #define RESTRICT __restrict__
110 #endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */
111 
112 #if LINUX + 0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && \
113  ! defined(_LARGEFILE64_SOURCE)
114 /* On Linux, special macro is required to enable definitions of some xxx64 functions */
115 #define _LARGEFILE64_SOURCE 1
116 #endif
117 
118 #ifdef HAVE_C11_GMTIME_S
119 /* Special macro is required to enable C11 definition of gmtime_s() function */
120 #define __STDC_WANT_LIB_EXT1__ 1
121 #endif /* HAVE_C11_GMTIME_S */
122 
123 #if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE)
124 #error \
125  MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time.
126 #endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */
127 
128 /* Define MHD_FAVOR_FAST_CODE to force fast code path or
129  define MHD_FAVOR_SMALL_CODE to choose compact code path */
130 #if ! defined(MHD_FAVOR_FAST_CODE) && ! defined(MHD_FAVOR_SMALL_CODE)
131 /* Try to detect user preferences */
132 /* Defined by GCC and many compatible compilers */
133 #if defined(__OPTIMIZE_SIZE__)
134 #define MHD_FAVOR_SMALL_CODE 1
135 #elif defined(__OPTIMIZE__)
136 #define MHD_FAVOR_FAST_CODE 1
137 #endif /* __OPTIMIZE__ */
138 #endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
139 
140 #if ! defined(MHD_FAVOR_FAST_CODE) && ! defined(MHD_FAVOR_SMALL_CODE)
141 /* Use faster code by default */
142 #define MHD_FAVOR_FAST_CODE 1
143 #endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
144 
145 #endif /* MHD_OPTIONS_H */