|
@@ -1797,8 +1797,7 @@ malloc = []
|
|
|
if get_option('malloc') == 'system'
|
|
|
has_malloc_trim = \
|
|
|
get_option('malloc_trim').allowed() and \
|
|
|
- cc.links('''#include <malloc.h>
|
|
|
- int main(void) { malloc_trim(0); return 0; }''')
|
|
|
+ cc.has_function('malloc_trim', prefix: '#include <malloc.h>')
|
|
|
else
|
|
|
has_malloc_trim = false
|
|
|
malloc = cc.find_library(get_option('malloc'), required: true)
|
|
@@ -1811,34 +1810,19 @@ if not has_malloc_trim and get_option('malloc_trim').enabled()
|
|
|
endif
|
|
|
endif
|
|
|
|
|
|
-# Check whether the glibc provides statx()
|
|
|
-
|
|
|
gnu_source_prefix = '''
|
|
|
#ifndef _GNU_SOURCE
|
|
|
#define _GNU_SOURCE
|
|
|
#endif
|
|
|
'''
|
|
|
-statx_test = gnu_source_prefix + '''
|
|
|
- #include <sys/stat.h>
|
|
|
- int main(void) {
|
|
|
- struct statx statxbuf;
|
|
|
- statx(0, "", 0, STATX_BASIC_STATS, &statxbuf);
|
|
|
- return 0;
|
|
|
- }'''
|
|
|
|
|
|
-has_statx = cc.links(statx_test)
|
|
|
+# Check whether the glibc provides STATX_BASIC_STATS
|
|
|
|
|
|
-# Check whether statx() provides mount ID information
|
|
|
+has_statx = cc.has_header_symbol('sys/stat.h', 'STATX_BASIC_STATS', prefix: gnu_source_prefix)
|
|
|
|
|
|
-statx_mnt_id_test = gnu_source_prefix + '''
|
|
|
- #include <sys/stat.h>
|
|
|
- int main(void) {
|
|
|
- struct statx statxbuf;
|
|
|
- statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);
|
|
|
- return statxbuf.stx_mnt_id;
|
|
|
- }'''
|
|
|
+# Check whether statx() provides mount ID information
|
|
|
|
|
|
-has_statx_mnt_id = cc.links(statx_mnt_id_test)
|
|
|
+has_statx_mnt_id = cc.has_header_symbol('sys/stat.h', 'STATX_MNT_ID', prefix: gnu_source_prefix)
|
|
|
|
|
|
have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
|
|
|
.require(targetos == 'linux',
|