aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/mhd_options.h96
-rw-r--r--src/include/platform.h70
-rw-r--r--src/microhttpd/Makefile.am1
-rw-r--r--src/microhttpd/mhd_str.c2
-rw-r--r--w32/common/libmicrohttpd-files.vcxproj1
-rw-r--r--w32/common/libmicrohttpd-filters.vcxproj3
6 files changed, 103 insertions, 70 deletions
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h
new file mode 100644
index 00000000..3541c4b8
--- /dev/null
+++ b/src/include/mhd_options.h
@@ -0,0 +1,96 @@
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
20/**
21 * @file microhttpd/mhd_options.h
22 * @brief additional automatic macros for MHD_config.h
23 * @author Karlson2k (Evgeny Grin)
24 *
25 * This file includes MHD_config.h and adds automatic macros based on values
26 * in MHD_config.h, compiler built-in macros and commandline-defined macros
27 * (but not based on values defined in other headers). Works also as a guard
28 * to prevent double inclusion of MHD_config.h
29 */
30
31#ifndef MHD_OPTIONS_H
32#define MHD_OPTIONS_H 1
33
34#include "MHD_config.h"
35
36
37#ifndef _MHD_EXTERN
38#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \
39 (defined(DLL_EXPORT) || defined(MHD_W32DLL))
40#define _MHD_EXTERN __declspec(dllexport) extern
41#else /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
42#define _MHD_EXTERN extern
43#endif /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */
44#endif /* ! _MHD_EXTERN */
45
46/* Some platforms (FreeBSD, Solaris, W32) allow to override
47 default FD_SETSIZE by defining it before including
48 headers. */
49#ifdef FD_SETSIZE
50/* FD_SETSIZE defined in command line or in MHD_config.h */
51/* Use function to retrieve system default FD_SETSIZE value. */
52#define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value()
53#elif defined(_WIN32) && !defined(__CYGWIN__)
54/* Platform with WinSock and without overridden FD_SETSIZE */
55#define FD_SETSIZE 2048 /* Override default small value */
56/* Use function to retrieve system default FD_SETSIZE value. */
57#define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value()
58#else /* !FD_SETSIZE && !WinSock*/
59/* System default value of FD_SETSIZE is used */
60#define _MHD_SYS_DEFAULT_FD_SETSIZE FD_SETSIZE
61#define _MHD_FD_SETSIZE_IS_DEFAULT 1
62#endif /* !FD_SETSIZE && !WinSock*/
63
64#define _XOPEN_SOURCE_EXTENDED 1
65#if OS390
66#define _OPEN_THREADS
67#define _OPEN_SYS_SOCK_IPV6
68#define _OPEN_MSGQ_EXT
69#define _LP64
70#endif
71
72#if defined(_WIN32)
73#ifndef _WIN32_WINNT
74#define _WIN32_WINNT 0x0501
75#else /* _WIN32_WINNT */
76#if _WIN32_WINNT < 0x0501
77#error "Headers for Windows XP or later are required"
78#endif /* _WIN32_WINNT < 0x0501 */
79#endif /* _WIN32_WINNT */
80#ifndef WIN32_LEAN_AND_MEAN
81/* Do not include unneeded parts of W32 headers. */
82#define WIN32_LEAN_AND_MEAN 1
83#endif /* !WIN32_LEAN_AND_MEAN */
84#endif /* _WIN32 */
85
86#if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE)
87/* On Linux, special macro is required to enable definitions of some xxx64 functions */
88#define _LARGEFILE64_SOURCE 1
89#endif
90
91#ifdef HAVE_C11_GMTIME_S
92/* Special macro is required to enable C11 definition of gmtime_s() function */
93#define __STDC_WANT_LIB_EXT1__ 1
94#endif /* HAVE_C11_GMTIME_S */
95
96#endif /* MHD_OPTIONS_H */
diff --git a/src/include/platform.h b/src/include/platform.h
index 60369149..ed09fc71 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -34,75 +34,7 @@
34#ifndef MHD_PLATFORM_H 34#ifndef MHD_PLATFORM_H
35#define MHD_PLATFORM_H 35#define MHD_PLATFORM_H
36 36
37#ifndef HAVE_USED_MHD_CONFIG_H 37#include "mhd_options.h"
38#define HAVE_USED_MHD_CONFIG_H
39#include "MHD_config.h"
40#endif
41
42#ifndef BUILDING_MHD_LIB
43#ifdef _MHD_EXTERN
44#undef _MHD_EXTERN
45#endif /* _MHD_EXTERN */
46#if defined(_WIN32) && defined(MHD_W32LIB)
47#define _MHD_EXTERN extern
48#elif defined (_WIN32) && defined(MHD_W32DLL)
49#define _MHD_EXTERN __declspec(dllimport)
50#else
51#define _MHD_EXTERN extern
52#endif
53#elif !defined(_MHD_EXTERN) /* && BUILDING_MHD_LIB */
54#if defined(_WIN32) && defined(MHD_W32LIB)
55#define _MHD_EXTERN extern
56#elif defined (_WIN32) && defined(MHD_W32DLL)
57#define _MHD_EXTERN extern __declspec(dllexport)
58#else
59#define _MHD_EXTERN extern
60#endif
61#endif /* BUILDING_MHD_LIB */
62
63
64#ifdef FD_SETSIZE
65/* FD_SETSIZE defined in command line or in MHD_config.h */
66/* Some platforms (FreeBSD, Solaris, W32) allow to override
67 default FD_SETSIZE by defining it before including
68 headers. */
69#define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value()
70#elif defined(_WIN32) && !defined(__CYGWIN__)
71/* Platform with WinSock and without overridden FD_SETSIZE */
72#define FD_SETSIZE 2048 /* Override default small value */
73#define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value()
74#else /* !FD_SETSIZE && !WinSock*/
75#define _MHD_SYS_DEFAULT_FD_SETSIZE FD_SETSIZE
76#define _MHD_FD_SETSIZE_IS_DEFAULT 1
77#endif /* FD_SETSIZE */
78
79#define _XOPEN_SOURCE_EXTENDED 1
80#if OS390
81#define _OPEN_THREADS
82#define _OPEN_SYS_SOCK_IPV6
83#define _OPEN_MSGQ_EXT
84#define _LP64
85#endif
86
87#if defined(_WIN32)
88#ifndef _WIN32_WINNT
89#define _WIN32_WINNT 0x0501
90#else /* _WIN32_WINNT */
91#if _WIN32_WINNT < 0x0501
92#error "Headers for Windows XP or later are required"
93#endif /* _WIN32_WINNT < 0x0501 */
94#endif /* _WIN32_WINNT */
95#ifndef WIN32_LEAN_AND_MEAN
96#define WIN32_LEAN_AND_MEAN 1
97#endif /* !WIN32_LEAN_AND_MEAN */
98#endif /* _WIN32 */
99
100#if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE)
101#define _LARGEFILE64_SOURCE 1
102#endif
103#ifdef HAVE_C11_GMTIME_S
104#define __STDC_WANT_LIB_EXT1__ 1
105#endif /* HAVE_C11_GMTIME_S */
106 38
107#include <stdio.h> 39#include <stdio.h>
108#include <stdlib.h> 40#include <stdlib.h>
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index b7ad13d9..5f6423b3 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -62,6 +62,7 @@ libmicrohttpd_la_SOURCES = \
62 daemon.c \ 62 daemon.c \
63 internal.c internal.h \ 63 internal.c internal.h \
64 memorypool.c memorypool.h \ 64 memorypool.c memorypool.h \
65 mhd_options.h \
65 mhd_mono_clock.c mhd_mono_clock.h \ 66 mhd_mono_clock.c mhd_mono_clock.h \
66 mhd_limits.h mhd_byteorder.h \ 67 mhd_limits.h mhd_byteorder.h \
67 sysfdsetsize.c sysfdsetsize.h \ 68 sysfdsetsize.c sysfdsetsize.h \
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index b6d400dc..c0f1d271 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -25,7 +25,7 @@
25 25
26#include "mhd_str.h" 26#include "mhd_str.h"
27 27
28#include "MHD_config.h" 28#include "mhd_options.h"
29 29
30#ifdef HAVE_STDBOOL_H 30#ifdef HAVE_STDBOOL_H
31#include <stdbool.h> 31#include <stdbool.h>
diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj
index 7c451823..4535f006 100644
--- a/w32/common/libmicrohttpd-files.vcxproj
+++ b/w32/common/libmicrohttpd-files.vcxproj
@@ -21,6 +21,7 @@
21 <ItemGroup> 21 <ItemGroup>
22 <ClInclude Include="$(MhdSrc)include\autoinit_funcs.h" /> 22 <ClInclude Include="$(MhdSrc)include\autoinit_funcs.h" />
23 <ClInclude Include="$(MhdSrc)include\microhttpd.h" /> 23 <ClInclude Include="$(MhdSrc)include\microhttpd.h" />
24 <ClInclude Include="$(MhdSrc)include\mhd_options.h" />
24 <ClInclude Include="$(MhdSrc)include\platform.h" /> 25 <ClInclude Include="$(MhdSrc)include\platform.h" />
25 <ClInclude Include="$(MhdSrc)include\platform_interface.h" /> 26 <ClInclude Include="$(MhdSrc)include\platform_interface.h" />
26 <ClInclude Include="$(MhdSrc)include\w32functions.h" /> 27 <ClInclude Include="$(MhdSrc)include\w32functions.h" />
diff --git a/w32/common/libmicrohttpd-filters.vcxproj b/w32/common/libmicrohttpd-filters.vcxproj
index 27ee4804..d43683ce 100644
--- a/w32/common/libmicrohttpd-filters.vcxproj
+++ b/w32/common/libmicrohttpd-filters.vcxproj
@@ -38,6 +38,9 @@
38 <ClInclude Include="$(MhdSrc)include\w32functions.h"> 38 <ClInclude Include="$(MhdSrc)include\w32functions.h">
39 <Filter>Header Files</Filter> 39 <Filter>Header Files</Filter>
40 </ClInclude> 40 </ClInclude>
41 <ClInclude Include="$(MhdSrc)include\mhd_options.h">
42 <Filter>Header Files</Filter>
43 </ClInclude>
41 <ClInclude Include="$(MhdW32Common)MHD_config.h"> 44 <ClInclude Include="$(MhdW32Common)MHD_config.h">
42 <Filter>Header Files</Filter> 45 <Filter>Header Files</Filter>
43 </ClInclude> 46 </ClInclude>