libm = cc.find_library('m', required: false)
check_functions = [
- 'dcgettext',
'getpagesize',
'getresuid',
- 'lstat',
+ 'madvise',
'memfd_create',
+ 'mkostemp',
+ 'mlock',
'mmap',
'posix_fallocate',
- '_lock_file',
- 'flockfile',
- 'mkstemp',
- 'mallinfo2',
'sincos',
'sincosf',
]
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)
endif
endforeach
cdata.set('HAVE_UINT128_T', 1)
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.
# This is so newer versions of those libraries don't cause more warnings with
# a stable GTK version.