meson: fix migration/stress compilation with glibc>=2.30
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 28 Aug 2020 11:07:33 +0000 (15:07 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Sep 2020 09:43:16 +0000 (11:43 +0200)
gettid() was introduced with glibc 2.30.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200828110734.1638685-16-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
meson.build
tests/migration/stress.c

index f7cd2b6f73e8fb3140e36286a2773d31be548725..3b73731bab55dbb2d07effc336d3ab47855a8fb3 100644 (file)
@@ -418,6 +418,8 @@ endif
 keyutils = dependency('libkeyutils', required: false,
                       method: 'pkg-config', static: enable_static)
 
+has_gettid = cc.has_function('gettid')
+
 # Create config-host.h
 
 config_host_data.set('CONFIG_SDL', sdl.found())
@@ -428,6 +430,7 @@ config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
+config_host_data.set('CONFIG_GETTID', has_gettid)
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
index 05d85051e3140eb34f7e607322d4ff91fea09873..0c72a420be810f7b62c4c1b48cf69ce0d3ab1e8d 100644 (file)
@@ -29,10 +29,12 @@ const char *argv0;
 
 #define PAGE_SIZE 4096
 
+#ifndef CONFIG_GETTID
 static int gettid(void)
 {
     return syscall(SYS_gettid);
 }
+#endif
 
 static __attribute__((noreturn)) void exit_failure(void)
 {