forked from libfuse/sshfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
144 lines (125 loc) · 3.58 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
project('sshfs', 'c', version: '3.7.3',
meson_version: '>= 0.40',
default_options: [ 'buildtype=debugoptimized' ])
add_global_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H',
'-Wall', '-Wextra', '-Wno-sign-compare',
'-Wmissing-declarations', '-Wwrite-strings',
language: 'c')
# Some (stupid) GCC versions warn about unused return values even when they are
# casted to void. This makes -Wunused-result pretty useless, since there is no
# way to suppress the warning when we really *want* to ignore the value.
cc = meson.get_compiler('c')
code = '''
__attribute__((warn_unused_result)) int get_4() {
return 4;
}
int main(void) {
(void) get_4();
return 0;
}'''
if not cc.compiles(code, args: [ '-O0', '-Werror=unused-result' ])
message('Compiler warns about unused result even when casting to void')
add_global_arguments('-Wno-unused-result', language: 'c')
endif
rst2man = find_program('rst2man', 'rst2man.py', required: false)
cfg = configuration_data()
cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
include_dirs = [ include_directories('.') ]
sshfs_sources = [
'sshfs.c',
'cache.c',
'fdpass.c',
'setproctitle.c',
]
if target_machine.system() == 'darwin'
cfg.set_quoted('IDMAP_DEFAULT', 'user')
sshfs_sources += [ 'compat/fuse_opt.c', 'compat/darwin_compat.c' ]
include_dirs += [ include_directories('compat') ]
else
cfg.set_quoted('IDMAP_DEFAULT', 'none')
endif
check_headers = [
'poll.h',
'sys/un.h',
'sys/pstat.h',
'vis.h',
]
foreach h : check_headers
if cc.has_header(h)
cfg.set('HAVE_' + h.underscorify().to_upper(), 1)
endif
endforeach
check_members = [
[
'struct msghdr',
'msg_accrights',
'''\
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
'''
],
[
'struct msghdr',
'msg_control',
'''\
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
'''
],
]
foreach m : check_members
if cc.has_member(m.get(0), m.get(1), prefix : m.get(2))
cfg.set('HAVE_' + m.get(0).underscorify().to_upper() + '_HAS_' + m.get(1).underscorify().to_upper(), 1)
endif
endforeach
check_functions = [
'sendmsg',
'recvmsg',
'setproctitle',
'strnvis',
'vsnprintf',
]
foreach f : check_functions
if cc.has_function(f)
cfg.set('HAVE_' + f.underscorify().to_upper(), 1)
endif
endforeach
if cc.links(
'''
#include <stdio.h>
extern char *__progname;
int main(void) {
printf("%s", __progname);
return 0;
}''',
name : '__progname'
)
cfg.set('HAVE___PROGNAME', 1)
endif
if target_machine.system() == 'linux'
cfg.set('SPT_TYPE', 'SPT_REUSEARGV')
endif
configure_file(output: 'config.h',
configuration : cfg)
sshfs_deps = [ dependency('fuse3', version: '>= 3.1.0'),
dependency('glib-2.0'),
dependency('gthread-2.0') ]
executable('sshfs', sshfs_sources,
include_directories: include_dirs,
dependencies: sshfs_deps,
c_args: ['-DFUSE_USE_VERSION=31'],
install: true,
install_dir: get_option('bindir'))
if rst2man.found()
custom_target('manpages', input: [ 'sshfs.rst' ], output: [ 'sshfs.1' ],
command: [rst2man, '@INPUT@', '@OUTPUT@'], install: true,
install_dir: join_paths(get_option('mandir'), 'man1'))
else
message('rst2man not found, not building manual page.')
endif
meson.add_install_script('utils/install_helper.sh',
get_option('sbindir'),
get_option('bindir'))
subdir('test')