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(__HAIKU__) || \
88 defined(NetBSD_v8))
89#define HAVE_STRCHRNUL
90#else
91#undef HAVE_STRCHRNUL
92char *strchrnul(const char *s, int c);
93#endif
94
95/*
96 * amigaos3 declares this but does not have it in its actual library
97 */
98#define HAVE_STRTOULL
99#if !defined(__amigaos4__) && defined(__AMIGA__)
100#undef HAVE_STRTOULL
101#endif
102
103#define HAVE_SYS_SELECT
104#define HAVE_POSIX_INET_HEADERS
105#if (defined(_WIN32))
106#undef HAVE_SYS_SELECT
107#undef HAVE_POSIX_INET_HEADERS
108#endif
109
110#define HAVE_INETATON
111#if (defined(_WIN32) || \
112 defined(__serenity__))
113#undef HAVE_INETATON
114#endif
115
116#define HAVE_INETPTON
117#if (defined(_WIN32))
118#undef HAVE_INETPTON
119#endif
120
121#define HAVE_UTSNAME
122#if (defined(_WIN32))
123#undef HAVE_UTSNAME
124#endif
125
126#define HAVE_REALPATH
127#if (defined(_WIN32))
128#undef HAVE_REALPATH
129char *realpath(const char *path, char *resolved_path);
130#endif
131
132#define HAVE_MKDIR
133#if (defined(_WIN32))
134#undef HAVE_MKDIR
135#endif
136
137#define HAVE_SIGPIPE
138#if (defined(_WIN32))
139#undef HAVE_SIGPIPE
140#endif
141
142#define HAVE_STDOUT
143#if (defined(_WIN32))
144#undef HAVE_STDOUT
145#endif
146
147#define HAVE_MMAP
148#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
149#undef HAVE_MMAP
150#endif
151
152#define HAVE_SCANDIR
153#if (defined(_WIN32) || \
154 defined(__serenity__))
155#undef HAVE_SCANDIR
156#endif
157
158#define HAVE_DIRFD
159#define HAVE_UNLINKAT
160#define HAVE_FSTATAT
161#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
162#undef HAVE_DIRFD
163#undef HAVE_UNLINKAT
164#undef HAVE_FSTATAT
165#endif
166
167#define HAVE_REGEX
168#if (defined(__serenity__))
169#undef HAVE_REGEX
170#endif
171
172/* execinfo available for backtrace */
173#if ((defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__)) || \
174 defined(__APPLE__))
175#define HAVE_EXECINFO
176#endif
177
178/* This section toggles build options on and off.
179 * Simply undefine a symbol to turn the relevant feature off.
180 *
181 * IF ADDING A FEATURE HERE, ADD IT TO Docs/Doxyfile's "PREDEFINED" DEFINITION AS WELL.
182 */
183
184/* Platform specific features */
185#if defined(riscos)
186 /* Theme auto-install */
187 #define WITH_THEME_INSTALL
188#elif defined(__HAIKU__) || defined(__BEOS__)
189 /* for intptr_t */
190 #include <inttypes.h>
191 #if defined(__HAIKU__)
192 /*not yet: #define WITH_MMAP*/
193 #endif
194 #if defined(__BEOS__)
195 /* Not even BONE has it. */
196 #define NO_IPV6 1
197 #endif
198#else
199 /* We're likely to have a working mmap() */
200 #define WITH_MMAP
201#endif
202
203/* IPv6 */
204#if (defined(__amigaos4__) || \
205 defined(__AMIGA__) || \
206 defined(nsatari) || \
207 defined(__serenity__))
208 #define NO_IPV6
209#endif
210
211#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