1 /*
2   Copyright 2021 David Robillard <d@drobilla.net>
3 
4   Permission to use, copy, modify, and/or distribute this software for any
5   purpose with or without fee is hereby granted, provided that the above
6   copyright notice and this permission notice appear in all copies.
7 
8   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16 
17 /*
18   Configuration header that defines reasonable defaults at compile time.
19 
20   This allows compile-time configuration from the command line (typically via
21   the build system) while still allowing the source to be built without any
22   configuration.  The build system can define LILV_NO_DEFAULT_CONFIG to disable
23   defaults, in which case it must define things like HAVE_FEATURE to enable
24   features.  The design here ensures that compiler warnings or
25   include-what-you-use will catch any mistakes.
26 */
27 
28 #ifndef LILV_CONFIG_H
29 #define LILV_CONFIG_H
30 
31 // Define version unconditionally so a warning will catch a mismatch
32 #define LILV_VERSION "0.24.12"
33 
34 #if !defined(LILV_NO_DEFAULT_CONFIG)
35 
36 // We need unistd.h to check _POSIX_VERSION
37 #  ifndef LILV_NO_POSIX
38 #    ifdef __has_include
39 #      if __has_include(<unistd.h>)
40 #        include <unistd.h>
41 #      endif
42 #    elif defined(__unix__)
43 #      include <unistd.h>
44 #    endif
45 #  endif
46 
47 // POSIX.1-2001: fileno()
48 #  ifndef HAVE_FILENO
49 #    if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
50 #      define HAVE_FILENO
51 #    endif
52 #  endif
53 
54 // Classic UNIX: flock()
55 #  ifndef HAVE_FLOCK
56 #    if defined(__unix__)
57 #      define HAVE_FLOCK
58 #    endif
59 #  endif
60 
61 // POSIX.1-2001: lstat()
62 #  ifndef HAVE_LSTAT
63 #    if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
64 #      define HAVE_LSTAT
65 #    endif
66 #  endif
67 
68 #endif // !defined(LILV_NO_DEFAULT_CONFIG)
69 
70 /*
71   Make corresponding USE_FEATURE defines based on the HAVE_FEATURE defines from
72   above or the command line.  The code checks for these using #if (not #ifdef),
73   so there will be an undefined warning if it checks for an unknown feature,
74   and this header is always required by any code that checks for features, even
75   if the build system defines them all.
76 */
77 
78 #ifdef HAVE_FILENO
79 #  define USE_FILENO 1
80 #else
81 #  define USE_FILENO 0
82 #endif
83 
84 #ifdef HAVE_FLOCK
85 #  define USE_FLOCK 1
86 #else
87 #  define USE_FLOCK 0
88 #endif
89 
90 #ifdef HAVE_LSTAT
91 #  define USE_LSTAT 1
92 #else
93 #  define USE_LSTAT 0
94 #endif
95 
96 /*
97   Define required values.  These are always used as a fallback, even with
98   LILV_NO_DEFAULT_CONFIG, since they must be defined for the build to work.
99 */
100 
101 // Separator between entries in variables like PATH
102 #ifndef LILV_PATH_SEP
103 #  ifdef _WIN32
104 #    define LILV_PATH_SEP ";"
105 #  else
106 #    define LILV_PATH_SEP ":"
107 #  endif
108 #endif
109 
110 // Separator between directories in a path
111 #ifndef LILV_DIR_SEP
112 #  ifdef _WIN32
113 #    define LILV_DIR_SEP "\\"
114 #  else
115 #    define LILV_DIR_SEP "/"
116 #  endif
117 #endif
118 
119 // Default value for LV2_PATH environment variable
120 #ifndef LILV_DEFAULT_LV2_PATH
121 #  ifdef _WIN32
122 #    define LILV_DEFAULT_LV2_PATH "%APPDATA%\\LV2;%COMMONPROGRAMFILES%\\LV2"
123 #  else
124 #    define LILV_DEFAULT_LV2_PATH "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2"
125 #  endif
126 #endif
127 
128 #endif // LILV_CONFIG_H
129