$OpenBSD: patch-storage_perfschema_CMakeLists_txt,v 1.1 2020/06/28 21:35:41 sthen Exp $

Add support for OpenBSD's getthrid()

Index: storage/perfschema/CMakeLists.txt
--- storage/perfschema/CMakeLists.txt.orig
+++ storage/perfschema/CMakeLists.txt
@@ -298,6 +298,16 @@ int main(int ac, char **av)
 }"
 HAVE_SYS_GETTID)
 
+# Check for getthrid()
+CHECK_C_SOURCE_COMPILES("
+#include <unistd.h>
+int main(int ac, char **av)
+{
+  unsigned long long tid = getthrid();
+  return (tid != 0 ? 0 : 1);
+}"
+HAVE_GETTHRID)
+
 # Check for pthread_getthreadid_np()
 CHECK_C_SOURCE_COMPILES("
 #include <pthread_np.h>
