1 /*
2 * Copyright (c) 2021 Calvin Rose
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
21 */
22 
23 /* Feature test macros */
24 
25 #ifndef JANET_FEATURES_H_defined
26 #define JANET_FEATURES_H_defined
27 
28 #if defined(__NetBSD__) || defined(__APPLE__) || defined(__OpenBSD__) \
29     || defined(__bsdi__) || defined(__DragonFly__)
30 /* Use BSD source on any BSD systems, include OSX */
31 # define _BSD_SOURCE
32 #else
33 /* Use POSIX feature flags */
34 # ifndef _POSIX_C_SOURCE
35 # define _POSIX_C_SOURCE 200809L
36 # endif
37 #endif
38 
39 #if defined(WIN32) || defined(_WIN32)
40 #define WIN32_LEAN_AND_MEAN
41 #endif
42 
43 /* Needed for realpath on linux */
44 #if !defined(_XOPEN_SOURCE) && (defined(__linux__) || defined(__EMSCRIPTEN__))
45 #define _XOPEN_SOURCE 500
46 #endif
47 
48 /* Needed for timegm and other extensions when building with -std=c99.
49  * It also defines realpath, etc, which would normally require
50  * _XOPEN_SOURCE >= 500. */
51 #if !defined(_NETBSD_SOURCE) && defined(__NetBSD__)
52 #define _NETBSD_SOURCE
53 #endif
54 
55 #endif
56