diff options
-rw-r--r-- | lib/igt_aux.h | 5 | ||||
-rw-r--r-- | meson.build | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h index 24711aa2..04d22904 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -33,6 +33,7 @@ #include <stddef.h> #include <sys/time.h> #include <sys/types.h> +#include <unistd.h> #ifdef __linux__ # include <sys/syscall.h> #endif @@ -41,7 +42,9 @@ /* signal interrupt helpers */ #ifdef __linux__ -# define gettid() (pid_t)(syscall(__NR_gettid)) +# ifndef HAVE_GETTID +# define gettid() (pid_t)(syscall(__NR_gettid)) +# endif #endif #define sigev_notify_thread_id _sigev_un._tid diff --git a/meson.build b/meson.build index be6dff9d..3d466d52 100644 --- a/meson.build +++ b/meson.build @@ -223,6 +223,9 @@ if cc.has_header('cpuid.h') # FIXME: Do we need the example link test from configure.ac? config.set('HAVE_CPUID_H', 1) endif +if cc.has_header_symbol('unistd.h', 'gettid', args : '-D_GNU_SOURCE') + config.set('HAVE_GETTID', 1) +endif if cc.has_member('struct sysinfo', 'totalram', prefix : '#include <sys/sysinfo.h>') |