0002-meson.build-check-for-pthread.h.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 96bbf3a3af45d86f790afdf91a6686c37421e92b Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 15 Nov 2020 10:57:37 +0100
  4. Subject: [PATCH] meson.build: check for pthread.h
  5. Check for pthread.h otherwise the build will fail with some toolchains
  6. that have libphtread.so but not pthread.h:
  7. Run-time dependency threads found: YES
  8. ../src/hb-mutex.hh:53:10: fatal error: pthread.h: No such file or directory
  9. #include <pthread.h>
  10. ^~~~~~~~~~~
  11. Moreover, fix detection of pthread fallback
  12. Fixes:
  13. - http://autobuild.buildroot.org/results/70c98e89b1d5e5b651d1f6928dc53f465103f57a
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. ---
  16. meson.build | 6 ++++--
  17. 1 file changed, 4 insertions(+), 2 deletions(-)
  18. diff --git a/meson.build b/meson.build
  19. index bf3925db..6d263d48 100644
  20. --- a/meson.build
  21. +++ b/meson.build
  22. @@ -284,13 +284,15 @@ endif
  23. # threads
  24. thread_dep = null_dep
  25. if host_machine.system() != 'windows'
  26. - thread_dep = dependency('threads', required: false)
  27. + if cpp.has_header('pthread.h')
  28. + thread_dep = dependency('threads', required: false)
  29. + endif
  30. if thread_dep.found()
  31. conf.set('HAVE_PTHREAD', 1)
  32. else
  33. check_headers += ['sched.h']
  34. - check_funcs += ['sched_yield', {'link_with': 'rt'}]
  35. + check_funcs += [['sched_yield', {'link_with': 'rt'}]]
  36. endif
  37. endif
  38. --
  39. 2.29.2