summaryrefslogtreecommitdiff
path: root/header_checks
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-08-12 15:26:29 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-10-02 17:22:50 +0200
commit46d464e5bfc10398461a33a2256c1c58d509dd1a (patch)
tree8c1a9272c05f14033a4430bc122632461bd73608 /header_checks
parent70ecf1056bb4be5a68b63044f938ccc2fe0a58c0 (diff)
here comes meson
a new shiny buildtool that currently completes in the total of ~ 4 min.. 1 min. conf time 2:30 min. build time Where autotools takes: 1:50 min. conf time 3:40 min. build time. meson was taken because it went quite good for enlightenment, and is a traction gaining system that is also used by other mayor projects. Additionally, the DSL that is defined my meson makes the configuration of the builds a lot easier to read. Further informations can be gathered from the README.meson Right now, bindings & windows support are missing. It is highly recommented to use meson 0.48 due to optimizations in meson that reduced the time the meson call would need. Co-authored-by: Mike Blumenkrantz <zmike@samsung.com> Differential Revision: https://phab.enlightenment.org/D7012 Depends on D7011
Diffstat (limited to 'header_checks')
-rw-r--r--header_checks/meson.build177
1 files changed, 177 insertions, 0 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build
new file mode 100644
index 0000000000..e54e17943c
--- /dev/null
+++ b/header_checks/meson.build
@@ -0,0 +1,177 @@
1header_checks = [
2 'alloca.h',
3 'asm/hwcap.h',
4 'bsd/string.h',
5 'dirent.h',
6 'execinfo.h',
7 'mcheck.h',
8 'netinet/in.h',
9 'netinet/ssl.h',
10 'netinet/tcp.h',
11 'netinet/udp.h',
12 'net/if.h',
13 'stdlib.h',
14 'mman.h',
15 'sys/auxv.h',
16 'sys/inotify.h',
17 'sys/ioctl.h',
18 'sys/mman.h',
19 'sys/types.h',
20 'sys/socket.h',
21 'sys/filio.h',
22 'arpa/inet.h',
23 'sys/epoll.h',
24 'sys/un.h',
25 'sys/wait.h',
26 'sys/resource.h',
27 'sys/times.h',
28 'dirent.h',
29 'longinfo.h',
30 'exotic.h',
31 'ieeefp.h',
32 'node/uv.h',
33 'sys/timerfd.h',
34 'features.h',
35 'langinfo.h',
36 'locale.h',
37 'uv.h',
38 'ws2tcpip.h'
39]
40
41function_checks = [
42# function name | headers that are needed | libraries to include | Defines that are needed
43 ['alloca', ['alloca.h']],
44 ['backtrace', ['execinfo.h']],
45 ['backtrace_symbols', ['execinfo.h']],
46 ['clock_gettime', ['time.h']],
47 ['dirfd', ['dirent.h sys/types.h']],
48 ['fchmod', ['sys/stat.h']],
49 ['fcntl', ['fcntl.h']],
50 ['fork', ['unistd.h']],
51 ['fpathconf', ['unistd.h']],
52 ['geteuid', ['unistd.h']],
53 ['getpagesize', ['unistd.h']],
54 ['getpwent', ['sys/types.h', 'pwd.h']],
55 ['getuid', ['unistd.h']],
56 ['getxattr', ['sys/types.h', 'sys/xattr.h']],
57 ['iconv', ['iconv.h']],
58 ['listxattr', ['sys/types.h', 'sys/xattr.h']],
59 ['mallinfo', ['malloc.h']],
60 ['malloc_info', ['malloc.h']],
61 ['malloc_usable_size', ['malloc.h']],
62 ['mkdirat', ['sys/stat.h']],
63 ['mmap', ['sys/mman.h']],
64 ['mtrace', ['mcheck.h']],
65 ['prctl', ['sys/prctl.h']],
66 ['realpath', ['stdlib.h']],
67 ['setxattr', ['sys/types.h', 'sys/xattr.h']],
68 ['siglongjmp', ['setjmp.h']],
69 ['strerror_r', ['string.h']],
70 ['gettimeofday', ['sys/time.h']],
71 ['execvp', ['unistd.h']],
72 ['pause', ['unistd.h']],
73 ['isfinite', ['math.h']],
74#FIXME strlcpy is detected by meson but drops at compilation time
75# ['strlcpy', ['string.h']],
76 ['siginfo_t', ['signal.h']],
77 ['strerror_r', ['string.h']],
78 ['pthread_getcpuclockid', ['pthread.h', 'time.h']],
79 ['timerfd_create', ['sys/timerfd.h']],
80 ['kevent', ['sys/types.h', 'sys/event.h', 'sys/time.h']],
81#from here on we specify the dependencies
82 ['dlopen', ['dlfcn.h'], ['dl']],
83 ['dlsym', ['dlfcn.h'], ['dl']],
84 ['lround', ['math.h'], ['m']],
85 ['shm_open', ['sys/mman.h', 'sys/stat.h', 'fcntl.h'], ['rt']],
86#from here on we specify arguments
87 ['splice', ['fcntl.h'], [], '-D_GNU_SOURCE=1'],
88 ['sched_getcpu', ['sched.h'], [], '-D_GNU_SOURCE=1'],
89 ['dladdr', ['dlfcn.h'], ['dl'], '-D_GNU_SOURCE=1']
90]
91
92strerror_r_char_p = cc.compiles('''#define _GNU_SOURCE
93 #include <string.h>
94 int func (void)
95 {
96 char error_string[256];
97 char *ptr = strerror_r (-2, error_string, 256);
98 char c = *strerror_r (-2, error_string, 256);
99 return c != 0 && ptr != (void*) 0L;
100 }
101 ''',
102 name : 'strerror_r() returns char *')
103
104if strerror_r_char_p
105 config_h.set('STRERROR_R_CHAR_P', '1')
106endif
107
108#for later use, a bunch of librarie findings
109m = cc.find_library('m')
110#just keep this here as required false, if it is not inplace the library rt will just be linked as NOP
111dl = cc.find_library('dl', required: false)
112rt = cc.find_library('rt', required: false)
113
114thread_dep = dependency('threads')
115
116#check for the headers
117foreach header : header_checks
118 if cc.has_header(header)
119 config_h.set10('HAVE_'+header.underscorify().to_upper(), true)
120 endif
121endforeach
122
123foreach function : function_checks
124 function_name = function[0]
125 headers_to_search = function[1]
126 dependencies = []
127 args = []
128
129 # if there is a library, make sure they exist
130 if function.length() > 2
131 foreach library : function[2]
132 lib = cc.find_library(library, required : false)
133 if lib.found() == true
134 dependencies += lib
135 endif
136 endforeach
137 endif
138
139 #check if there are args
140 if function.length() > 3
141 args = function[3]
142 endif
143
144 # Only check the header if the dependencies are ready
145 foreach header : headers_to_search
146 if cc.has_header_symbol(header, function_name,
147 dependencies : dependencies,
148 args : args)
149 config_h.set10('HAVE_'+function_name.to_upper(), true)
150 endif
151 endforeach
152endforeach
153
154# The next checks are manually for now due to the fact that some names are not within the default pattern
155if (cc.has_header_symbol('sys/stat.h', 'fstatat'))
156 config_h.set10('HAVE_ATFILE_SOURCE', true)
157endif
158
159if (cc.has_header('sys/mman.h'))
160 config_h.set10('HAVE_MMAN_H', true)
161endif
162
163config_h.set('VMAJ', version_major)
164config_h.set('VMIN', version_minor)
165config_h.set('VMIC', version_micro)
166config_h.set('VREV', '0')
167
168#jpeg detection ... life is a bit more complex there
169
170jpeg = dependency('libjpeg', required: false)
171if jpeg.found() == false
172 jpeg = cc.find_library('jpeg')
173endif
174
175if config_h.has('HAVE_KEVENT')
176 config_h.set('HAVE_NOTIFY_KEVENT', '1')
177endif \ No newline at end of file