GNU libmicrohttpd  0.9.59
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 
46 #ifndef _MHD_EXTERN
47 #if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \
48  (defined(DLL_EXPORT) || defined(MHD_W32DLL))
49 #define _MHD_EXTERN __declspec(dllexport) extern
50 #else /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
51 #define _MHD_EXTERN extern
52 #endif /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
53 #endif /* ! _MHD_EXTERN */
54 
55 /* Some platforms (FreeBSD, Solaris, W32) allow to override
56  default FD_SETSIZE by defining it before including
57  headers. */
58 #ifdef FD_SETSIZE
59 /* FD_SETSIZE defined in command line or in MHD_config.h */
60 #elif defined(_WIN32) || defined(__CYGWIN__)
61 /* Platform with WinSock and without overridden FD_SETSIZE */
62 #define FD_SETSIZE 2048 /* Override default small value (64) */
63 #else /* !FD_SETSIZE && !W32 */
64 /* System default value of FD_SETSIZE is used */
65 #define _MHD_FD_SETSIZE_IS_DEFAULT 1
66 #endif /* !FD_SETSIZE && !W32 */
67 
68 #if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_FREEBSD_SENDFILE) || \
69  defined(HAVE_DARWIN_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE)
70 /* Have any supported sendfile() function. */
71 #define _MHD_HAVE_SENDFILE
72 #endif /* HAVE_LINUX_SENDFILE || HAVE_FREEBSD_SENDFILE ||
73  HAVE_DARWIN_SENDFILE || HAVE_SOLARIS_SENDFILE */
74 #if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE)
75 #define MHD_LINUX_SOLARIS_SENDFILE 1
76 #endif /* HAVE_LINUX_SENDFILE || HAVE_SOLARIS_SENDFILE */
77 
78 #if OS390
79 #define _OPEN_THREADS
80 #define _OPEN_SYS_SOCK_IPV6
81 #define _OPEN_MSGQ_EXT
82 #define _LP64
83 #endif
84 
85 #if defined(_WIN32) && ! defined(__CYGWIN__)
86 #ifndef _WIN32_WINNT
87 #define _WIN32_WINNT 0x0501
88 #else /* _WIN32_WINNT */
89 #if _WIN32_WINNT < 0x0501
90 #error "Headers for Windows XP or later are required"
91 #endif /* _WIN32_WINNT < 0x0501 */
92 #endif /* _WIN32_WINNT */
93 #ifndef WIN32_LEAN_AND_MEAN
94 /* Do not include unneeded parts of W32 headers. */
95 #define WIN32_LEAN_AND_MEAN 1
96 #endif /* !WIN32_LEAN_AND_MEAN */
97 #endif /* _WIN32 && ! __CYGWIN__ */
98 
99 #if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
100 #define RESTRICT __restrict__
101 #endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */
102 
103 #if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE)
104 /* On Linux, special macro is required to enable definitions of some xxx64 functions */
105 #define _LARGEFILE64_SOURCE 1
106 #endif
107 
108 #ifdef HAVE_C11_GMTIME_S
109 /* Special macro is required to enable C11 definition of gmtime_s() function */
110 #define __STDC_WANT_LIB_EXT1__ 1
111 #endif /* HAVE_C11_GMTIME_S */
112 
113 #if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE)
114 #error MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time.
115 #endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */
116 
117 /* Define MHD_FAVOR_FAST_CODE to force fast code path or
118  define MHD_FAVOR_SMALL_CODE to choose compact code path */
119 #if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE)
120 /* Try to detect user preferences */
121 /* Defined by GCC and many compatible compilers */
122 #if defined(__OPTIMIZE_SIZE__)
123 #define MHD_FAVOR_SMALL_CODE 1
124 #elif defined(__OPTIMIZE__)
125 #define MHD_FAVOR_FAST_CODE 1
126 #endif /* __OPTIMIZE__ */
127 #endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
128 
129 #if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE)
130 /* Use faster code by default */
131 #define MHD_FAVOR_FAST_CODE 1
132 #endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
133 
134 #endif /* MHD_OPTIONS_H */