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/* Try to detect which features the target OS supports */
32
33#if (defined(_GNU_SOURCE) && \
34 !defined(__APPLE__) || \
35 defined(__amigaos4__) || \
36 defined(__HAIKU__) || \
37 (defined(_POSIX_C_SOURCE) && ((_POSIX_C_SOURCE - 0) >= 200809L)) && \
38 !defined(__riscos__))
39#define HAVE_STRNDUP
40#else
41#undef HAVE_STRNDUP
42char *strndup(const char *s, size_t n);
43#endif
44
45#if ((defined(_GNU_SOURCE) || \
46 defined(__APPLE__) || \
47 defined(__HAIKU__) || \
48 defined(__NetBSD__) || \
49 defined(__OpenBSD__)) && \
50 !defined(__serenity__))
51#define HAVE_STRCASESTR
52#else
53#undef HAVE_STRCASESTR
54char *strcasestr(const char *haystack, const char *needle);
55#endif
56
57/* Although these platforms might have strftime or strptime they
58 * appear not to support the time_t seconds format specifier.
59 */
60#if (defined(_WIN32) || \
61 defined(__riscos__) || \
62 defined(__HAIKU__) || \
63 defined(__BEOS__) || \
64 defined(__amigaos4__) || \
65 defined(__AMIGA__) || \
66 defined(__MINT__))
67#undef HAVE_STRPTIME
68#undef HAVE_STRFTIME
69#else
70#define HAVE_STRPTIME
71#define HAVE_STRFTIME
72#endif
73
74/* For some reason, UnixLib defines this unconditionally. Assume we're using
75 * UnixLib if building for RISC OS.
76 */
77#if ((defined(_GNU_SOURCE) && !defined(__APPLE__)) || \
78 defined(__riscos__) || \
79 defined(NetBSD_v8))
80#define HAVE_STRCHRNUL
81#else
82#undef HAVE_STRCHRNUL
83char *strchrnul(const char *s, int c);
84#endif
85
86/*
87 * amigaos3 declares this but does not have it in its actual library
88 */
89#define HAVE_STRTOULL
90#if !defined(__amigaos4__) && defined(__AMIGA__)
91#undef HAVE_STRTOULL
92#endif
93
94#define HAVE_SYS_SELECT
95#define HAVE_POSIX_INET_HEADERS
96#if (defined(_WIN32))
97#undef HAVE_SYS_SELECT
98#undef HAVE_POSIX_INET_HEADERS
99#endif
100
101#define HAVE_INETATON
102#if (defined(_WIN32) || \
103 defined(__serenity__))
104#undef HAVE_INETATON
105#endif
106
107#define HAVE_INETPTON
108#if (defined(_WIN32))
109#undef HAVE_INETPTON
110#endif
111
112#define HAVE_UTSNAME
113#if (defined(_WIN32))
114#undef HAVE_UTSNAME
115#endif
116
117#define HAVE_REALPATH
118#if (defined(_WIN32))
119#undef HAVE_REALPATH
120char *realpath(const char *path, char *resolved_path);
121#endif
122
123#define HAVE_MKDIR
124#if (defined(_WIN32))
125#undef HAVE_MKDIR
126#endif
127
128#define HAVE_SIGPIPE
129#if (defined(_WIN32))
130#undef HAVE_SIGPIPE
131#endif
132
133#define HAVE_STDOUT
134#if (defined(_WIN32))
135#undef HAVE_STDOUT
136#endif
137
138#define HAVE_MMAP
139#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
140#undef HAVE_MMAP
141#endif
142
143#define HAVE_SCANDIR
144#if (defined(_WIN32) || \
145 defined(__serenity__))
146#undef HAVE_SCANDIR
147#endif
148
149#define HAVE_DIRFD
150#define HAVE_UNLINKAT
151#define HAVE_FSTATAT
152#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
153#undef HAVE_DIRFD
154#undef HAVE_UNLINKAT
155#undef HAVE_FSTATAT
156#endif
157
158#define HAVE_REGEX
159#if (defined(__serenity__))
160#undef HAVE_REGEX
161#endif
162
163/* execinfo available for backtrace */
164#if ((defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__)) || \
165 defined(__APPLE__))
166#define HAVE_EXECINFO
167#endif
168
169/* This section toggles build options on and off.
170 * Simply undefine a symbol to turn the relevant feature off.
171 *
172 * IF ADDING A FEATURE HERE, ADD IT TO Docs/Doxyfile's "PREDEFINED" DEFINITION AS WELL.
173 */
174
175/* Platform specific features */
176#if defined(riscos)
177 /* Theme auto-install */
178 #define WITH_THEME_INSTALL
179#elif defined(__HAIKU__) || defined(__BEOS__)
180 /* for intptr_t */
181 #include <inttypes.h>
182 #if defined(__HAIKU__)
183 /*not yet: #define WITH_MMAP*/
184 #endif
185 #if defined(__BEOS__)
186 /* Not even BONE has it. */
187 #define NO_IPV6 1
188 #endif
189#else
190 /* We're likely to have a working mmap() */
191 #define WITH_MMAP
192#endif
193
194/* IPv6 */
195#if (defined(__amigaos4__) || \
196 defined(__AMIGA__) || \
197 defined(nsatari) || \
198 defined(__serenity__))
199 #define NO_IPV6
200#endif
201
202#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