NetSurf
config.h
Go to the documentation of this file.
1/*
2 * Copyright 2003-7 John M Bell <jmb202@ecs.soton.ac.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef NETSURF_UTILS_CONFIG_H_
20#define NETSURF_UTILS_CONFIG_H_
21
22#include <stddef.h>
23
24#if defined(__NetBSD__)
25#include <sys/param.h>
26#if (defined(__NetBSD_Version__) && __NetBSD_Prereq__(8,0,0))
27#define NetBSD_v8
28#endif
29#endif
30
31#if defined(__GLIBC__)
32#if __GLIBC_PREREQ(2, 38)
33#define NS_NEW_GLIBC
34#endif
35#endif
36
37/* Try to detect which features the target OS supports */
38
39#if (defined(_GNU_SOURCE) && \
40 !defined(__APPLE__) || \
41 defined(__amigaos4__) || \
42 defined(__HAIKU__) || \
43 (defined(_POSIX_C_SOURCE) && ((_POSIX_C_SOURCE - 0) >= 200809L)) && \
44 !defined(__riscos__))
45#define HAVE_STRNDUP
46#else
47#undef HAVE_STRNDUP
48char *strndup(const char *s, size_t n);
49#endif
50
51#if ((defined(_GNU_SOURCE) || \
52 defined(NS_NEW_GLIBC) || \
53 defined(__APPLE__) || \
54 defined(__HAIKU__) || \
55 defined(__NetBSD__) || \
56 defined(__OpenBSD__)) && \
57 !defined(__serenity__))
58#define HAVE_STRCASESTR
59#else
60#undef HAVE_STRCASESTR
61char *strcasestr(const char *haystack, const char *needle);
62#endif
63
64/* Although these platforms might have strftime or strptime they
65 * appear not to support the time_t seconds format specifier.
66 */
67#if (defined(_WIN32) || \
68 defined(__riscos__) || \
69 defined(__HAIKU__) || \
70 defined(__BEOS__) || \
71 defined(__amigaos4__) || \
72 defined(__AMIGA__) || \
73 defined(__MINT__))
74#undef HAVE_STRPTIME
75#undef HAVE_STRFTIME
76#else
77#define HAVE_STRPTIME
78#define HAVE_STRFTIME
79#endif
80
81/* For some reason, UnixLib defines this unconditionally. Assume we're using
82 * UnixLib if building for RISC OS.
83 */
84#if ((defined(_GNU_SOURCE) && !defined(__APPLE__)) || \
85 defined(NS_NEW_GLIBC) || \
86 defined(__riscos__) || \
87 defined(NetBSD_v8))
88#define HAVE_STRCHRNUL
89#else
90#undef HAVE_STRCHRNUL
91char *strchrnul(const char *s, int c);
92#endif
93
94/*
95 * amigaos3 declares this but does not have it in its actual library
96 */
97#define HAVE_STRTOULL
98#if !defined(__amigaos4__) && defined(__AMIGA__)
99#undef HAVE_STRTOULL
100#endif
101
102#define HAVE_SYS_SELECT
103#define HAVE_POSIX_INET_HEADERS
104#if (defined(_WIN32))
105#undef HAVE_SYS_SELECT
106#undef HAVE_POSIX_INET_HEADERS
107#endif
108
109#define HAVE_INETATON
110#if (defined(_WIN32) || \
111 defined(__serenity__))
112#undef HAVE_INETATON
113#endif
114
115#define HAVE_INETPTON
116#if (defined(_WIN32))
117#undef HAVE_INETPTON
118#endif
119
120#define HAVE_UTSNAME
121#if (defined(_WIN32))
122#undef HAVE_UTSNAME
123#endif
124
125#define HAVE_REALPATH
126#if (defined(_WIN32))
127#undef HAVE_REALPATH
128char *realpath(const char *path, char *resolved_path);
129#endif
130
131#define HAVE_MKDIR
132#if (defined(_WIN32))
133#undef HAVE_MKDIR
134#endif
135
136#define HAVE_SIGPIPE
137#if (defined(_WIN32))
138#undef HAVE_SIGPIPE
139#endif
140
141#define HAVE_STDOUT
142#if (defined(_WIN32))
143#undef HAVE_STDOUT
144#endif
145
146#define HAVE_MMAP
147#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
148#undef HAVE_MMAP
149#endif
150
151#define HAVE_SCANDIR
152#if (defined(_WIN32) || \
153 defined(__serenity__))
154#undef HAVE_SCANDIR
155#endif
156
157#define HAVE_DIRFD
158#define HAVE_UNLINKAT
159#define HAVE_FSTATAT
160#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
161#undef HAVE_DIRFD
162#undef HAVE_UNLINKAT
163#undef HAVE_FSTATAT
164#endif
165
166#define HAVE_REGEX
167#if (defined(__serenity__))
168#undef HAVE_REGEX
169#endif
170
171/* execinfo available for backtrace */
172#if ((defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__)) || \
173 defined(__APPLE__))
174#define HAVE_EXECINFO
175#endif
176
177/* This section toggles build options on and off.
178 * Simply undefine a symbol to turn the relevant feature off.
179 *
180 * IF ADDING A FEATURE HERE, ADD IT TO Docs/Doxyfile's "PREDEFINED" DEFINITION AS WELL.
181 */
182
183/* Platform specific features */
184#if defined(riscos)
185 /* Theme auto-install */
186 #define WITH_THEME_INSTALL
187#elif defined(__HAIKU__) || defined(__BEOS__)
188 /* for intptr_t */
189 #include <inttypes.h>
190 #if defined(__HAIKU__)
191 /*not yet: #define WITH_MMAP*/
192 #endif
193 #if defined(__BEOS__)
194 /* Not even BONE has it. */
195 #define NO_IPV6 1
196 #endif
197#else
198 /* We're likely to have a working mmap() */
199 #define WITH_MMAP
200#endif
201
202/* IPv6 */
203#if (defined(__amigaos4__) || \
204 defined(__AMIGA__) || \
205 defined(nsatari) || \
206 defined(__serenity__))
207 #define NO_IPV6
208#endif
209
210#endif
char * strcasestr(const char *haystack, const char *needle)
Case insensitive strstr implementation.
Definition: utils.c:310
char * strndup(const char *s, size_t n)
Duplicate up to n characters of a string.
Definition: utils.c:332
char * strchrnul(const char *s, int c)
Find the first occurrence of C in S or the final NUL byte.
Definition: utils.c:443
char * realpath(const char *f, char *buf)
Definition: gui.cpp:230
Netsurf additional integer type formatting macros.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821