forked from AuroraMiddleware/gtk
meson: Consolidate function checks
Put all the function checks in one place. Remove functions we don't actually use, and add ones that we have #ifdefs for in in the code. Also add enough includes to make these checks actually work. Fixes: #5070
This commit is contained in:
parent
19c362f638
commit
9f64202a60
27
meson.build
27
meson.build
@ -187,23 +187,28 @@ endforeach
|
|||||||
libm = cc.find_library('m', required: false)
|
libm = cc.find_library('m', required: false)
|
||||||
|
|
||||||
check_functions = [
|
check_functions = [
|
||||||
'dcgettext',
|
|
||||||
'getpagesize',
|
'getpagesize',
|
||||||
'getresuid',
|
'getresuid',
|
||||||
'lstat',
|
'madvise',
|
||||||
'memfd_create',
|
'memfd_create',
|
||||||
|
'mkostemp',
|
||||||
|
'mlock',
|
||||||
'mmap',
|
'mmap',
|
||||||
'posix_fallocate',
|
'posix_fallocate',
|
||||||
'_lock_file',
|
|
||||||
'flockfile',
|
|
||||||
'mkstemp',
|
|
||||||
'mallinfo2',
|
|
||||||
'sincos',
|
'sincos',
|
||||||
'sincosf',
|
'sincosf',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach func : check_functions
|
foreach func : check_functions
|
||||||
if cc.has_function(func, dependencies: libm)
|
if cc.has_function(func,
|
||||||
|
args: '-D_GNU_SOURCE',
|
||||||
|
prefix:
|
||||||
|
'#include <stdlib.h>\n' +
|
||||||
|
'#include <unistd.h>\n' +
|
||||||
|
'#include <sys/mman.h>\n' +
|
||||||
|
'#include <fcntl.h>\n' +
|
||||||
|
'#include <math.h>',
|
||||||
|
dependencies: libm)
|
||||||
cdata.set('HAVE_' + func.underscorify().to_upper(), 1)
|
cdata.set('HAVE_' + func.underscorify().to_upper(), 1)
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
@ -230,14 +235,6 @@ if cc.compiles(uint128_t_src, name : '__uint128_t available')
|
|||||||
cdata.set('HAVE_UINT128_T', 1)
|
cdata.set('HAVE_UINT128_T', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Check for mlock and madvise
|
|
||||||
if cc.has_function('mlock', prefix: '#include <sys/mman.h>')
|
|
||||||
cdata.set('HAVE_MLOCK', 1)
|
|
||||||
endif
|
|
||||||
if cc.has_function('madvise', prefix: '#include <sys/mman.h>')
|
|
||||||
cdata.set('HAVE_MADVISE', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Disable deprecation checks for all libraries we depend on on stable branches.
|
# Disable deprecation checks for all libraries we depend on on stable branches.
|
||||||
# This is so newer versions of those libraries don't cause more warnings with
|
# This is so newer versions of those libraries don't cause more warnings with
|
||||||
# a stable GTK version.
|
# a stable GTK version.
|
||||||
|
Loading…
Reference in New Issue
Block a user