The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / deps / libeio / wscript @ 1a126ed1
History | View | Annotate | Download (2.92 KB)
1 |
import Options |
---|---|
2 |
|
3 |
def set_options(opt): |
4 |
pass |
5 |
#opt.tool_options('compiler_cc') |
6 |
|
7 |
def configure(conf): |
8 |
print "--- libeio ---" |
9 |
#conf.check_tool('compiler_cc') |
10 |
|
11 |
conf.check_cc(lib="pthread", header_name="pthread.h", function_name="pthread_create", mandatory=True) |
12 |
|
13 |
platform_string = "__" + Options.platform |
14 |
if Options.platform == "linux2": |
15 |
platform_string = "__linux" |
16 |
conf.define(platform_string, 1) |
17 |
|
18 |
conf.check_cc(msg="Checking for futimes(2)", define_name="HAVE_FUTIMES", fragment=""" |
19 |
#include <sys/types.h> |
20 |
#include <sys/time.h> |
21 |
#include <utime.h> |
22 |
struct timeval tv[2]; |
23 |
int res; |
24 |
int fd; |
25 |
int main(void) |
26 |
{ |
27 |
res = futimes (fd, tv); |
28 |
return 0; |
29 |
} |
30 |
""") |
31 |
|
32 |
conf.check_cc(msg="Checking for readahead(2)", define_name="HAVE_READAHEAD", fragment=""" |
33 |
#include <fcntl.h> |
34 |
int main(void) |
35 |
{ |
36 |
int fd = 0; |
37 |
size_t count = 2; |
38 |
ssize_t res; |
39 |
res = readahead (fd, 0, count); |
40 |
return 0; |
41 |
} |
42 |
""") |
43 |
|
44 |
conf.check_cc(msg="Checking for fdatasync(2)", define_name="HAVE_FDATASYNC", fragment=""" |
45 |
#include <unistd.h> |
46 |
int main(void) |
47 |
{ |
48 |
int fd = 0; |
49 |
fdatasync (fd); |
50 |
return 0; |
51 |
} |
52 |
""") |
53 |
|
54 |
conf.check_cc(msg="Checking for pread(2) and pwrite(2)", define_name="HAVE_PREADWRITE", fragment=""" |
55 |
#include <unistd.h> |
56 |
int main(void) |
57 |
{ |
58 |
int fd = 0; |
59 |
size_t count = 1; |
60 |
char buf; |
61 |
off_t offset = 1; |
62 |
ssize_t res; |
63 |
res = pread (fd, &buf, count, offset); |
64 |
res = pwrite (fd, &buf, count, offset); |
65 |
return 0; |
66 |
} |
67 |
""") |
68 |
|
69 |
conf.check_cc(msg="Checking for sendfile(2)" , defines=[platform_string + "=1"] , define_name="HAVE_SENDFILE" , fragment=""" |
70 |
# include <sys/types.h> |
71 |
#if __linux |
72 |
# include <sys/sendfile.h> |
73 |
#elif __freebsd |
74 |
# include <sys/socket.h> |
75 |
# include <sys/uio.h> |
76 |
#elif __hpux |
77 |
# include <sys/socket.h> |
78 |
#else |
79 |
# error unsupported architecture |
80 |
#endif |
81 |
int main(void) |
82 |
{ |
83 |
int fd = 0; |
84 |
off_t offset = 1; |
85 |
size_t count = 2; |
86 |
ssize_t res; |
87 |
#if __linux |
88 |
res = sendfile (fd, fd, offset, count); |
89 |
#elif __freebsd |
90 |
res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
91 |
#elif __hpux |
92 |
res = sendfile (fd, fd, offset, count, 0, 0); |
93 |
#endif |
94 |
return 0; |
95 |
} |
96 |
""") |
97 |
|
98 |
conf.check_cc(msg="Checking for sync_file_range(2) ", fragment=""" |
99 |
#include <fcntl.h> |
100 |
int main(void) |
101 |
{ |
102 |
int fd = 0; |
103 |
off64_t offset = 1; |
104 |
off64_t nbytes = 1; |
105 |
unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|SYNC_FILE_RANGE_WAIT_AFTER; |
106 |
ssize_t res; |
107 |
res = sync_file_range (fd, offset, nbytes, flags); |
108 |
return 0; |
109 |
} |
110 |
""", define_name="HAVE_SYNC_FILE_RANGE") |
111 |
|
112 |
conf.write_config_header('config.h') |
113 |
|
114 |
def build(bld): |
115 |
libeio = bld.new_task_gen("cc", "staticlib") |
116 |
libeio.source = "eio.c" |
117 |
libeio.target = 'eio' |
118 |
libeio.name = 'eio' |
119 |
libeio.includes = '. ../..' |
120 |
|