Skip to content

Commit 05f2be5

Browse files
committed
Check if fseeko and realpath exist
1 parent 79c6862 commit 05f2be5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

meson.build

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,33 @@ glib_dep = dependency('glib-2.0', version: glib_req, required: false)
2828

2929
thread_dep = dependency('threads', required: false)
3030

31-
# Generate config.h
31+
# Check if functions exist
3232

3333
config = configuration_data()
34+
35+
functions = {
36+
'fseeko': 'stdio.h',
37+
'realpath': 'stdlib.h',
38+
}
39+
40+
foreach function, include_file : functions
41+
exists = cc.has_function(
42+
function,
43+
args: '-D_GNU_SOURCE',
44+
prefix: '#include <@0@>'.format(include_file),
45+
)
46+
config.set('HAVE_' + function.to_upper(), exists)
47+
endforeach
48+
49+
# Generate config.h
50+
3451
config.set('FST_WRITER_PARALLEL', thread_dep.found())
3552
config.set('HAVE_LIBPTHREAD', thread_dep.found())
3653

3754
configure_file(output: 'config.h', configuration: config)
3855
config_inc = include_directories('.')
3956

40-
add_project_arguments('-DFST_INCLUDE_CONFIG', language : 'c')
57+
add_project_arguments('-DFST_INCLUDE_CONFIG', language: 'c')
4158

4259
subdir('src')
4360
subdir('tests')

0 commit comments

Comments
 (0)