aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
blob: bcef245a47a6746c992955fd88ad925162666572 (plain) (blame)
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
project('bindfs', 'c',
  version: '1.18.2',
  default_options: [
    'c_std=gnu11',          # wie configure.ac für FUSE3
    'warning_level=2'
  ]
)

# --- config.h erzeugen (Ersatz für AC_CONFIG_HEADERS + Checks) ---
cc = meson.get_compiler('c')
conf = configuration_data()

# Entspricht PACKAGE_STRING aus configure.ac
conf.set('PACKAGE_STRING', '"@0@ @1@"'.format(meson.project_name(), meson.project_version()))

# Header-/Funktions-Checks wie in configure.ac
if cc.has_header('sys/file.h')
  conf.set('HAVE_SYS_FILE_H', 1)
endif

# utimensat / lutimes / futimesat
if cc.has_function('utimensat', prefix: '''
  #include <fcntl.h>
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <unistd.h>
''')
  conf.set('HAVE_UTIMENSAT', 1)
endif

if cc.has_function('lutimes', prefix: '#include <sys/time.h>')
  conf.set('HAVE_LUTIMES', 1)
endif

if cc.has_function('futimesat', prefix: '''
  #include <sys/time.h>
  #include <fcntl.h>
''')
  conf.set('HAVE_FUTIMESAT', 1)
endif

# xattr-Funktionen
foreach f : ['setxattr','getxattr','listxattr','removexattr',
             'lsetxattr','lgetxattr','llistxattr','lremovexattr']
  if cc.has_function(f, prefix: '#include <sys/xattr.h>')
    conf.set('HAVE_@0@'.format(f.to_upper()), 1)
  endif
endforeach

# struct stat ... tv_nsec vorhanden?
have_stat_nsec = cc.compiles('''
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>
  int main(void){ struct stat st; st.st_mtim.tv_nsec = 123; return 0; }
''')
if have_stat_nsec
  conf.set('HAVE_STAT_NANOSEC', 1)
endif

# config.h in der Build-Root erzeugen
configure_file(output: 'config.h', configuration: conf)

# Dependencies
fuse3_dep = dependency('fuse3', version: '>=3.4.0', required: true)
#threads   = dependency('threads')
dl_dep    = cc.find_library('dl', required: true)
iconv_dep = dependency('iconv', required: false)  # Android: yes; Linux: ja nach System

# Entspricht my_CPPFLAGS in configure.ac
add_project_arguments(
  [
    '-D_REENTRANT',
    '-D_FILE_OFFSET_BITS=64',
    '-D_XOPEN_SOURCE=700',
    '-D__BSD_VISIBLE=1',
    '-D_BSD_SOURCE',
    '-D_DEFAULT_SOURCE',
    # Autotools bei FUSE3:
    '-DHAVE_FUSE_3=1',
    '-DFUSE_USE_VERSION=34',  # genau wie CHECK_FUSE3 in configure.ac
  ],
  language: 'c'
)

add_project_arguments(['-include', 'sys/stat.h'], language: 'c') # required for S_ISDIR

# Entspricht my_CFLAGS / my_LDFLAGS
add_project_arguments(['-Wall','-Wextra','-Wpedantic','-fno-common'], language: 'c')

add_project_arguments(['-pthread'], language: 'c')
add_project_link_arguments(['-pthread'], language: 'c')

subdir('src')