Mesa (main): meson: Fixes timespec_get detect code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 9 18:00:21 UTC 2022


Module: Mesa
Branch: main
Commit: a6dd77149ad0e9a2ceef8708304a8bc385e0cb42
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6dd77149ad0e9a2ceef8708304a8bc385e0cb42

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Sun Mar 27 07:43:49 2022 +0800

meson: Fixes timespec_get detect code

Add functions_to_detect dictionary to records the paths to include

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15497>

---

 meson.build | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index dcac6374e9b..d76cbe11236 100644
--- a/meson.build
+++ b/meson.build
@@ -1434,9 +1434,21 @@ foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h', '
   endif
 endforeach
 
-foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r',
-             'flock', 'strtok_r', 'getrandom', 'qsort_r', 'qsort_s']
-  if cc.has_function(f)
+functions_to_detect = {
+  'strtof': '',
+  'mkostemp': '',
+  'timespec_get': '#include <time.h>',
+  'memfd_create': '',
+  'random_r': '',
+  'flock': '',
+  'strtok_r': '',
+  'getrandom': '',
+  'qsort_r': '',
+  'qsort_s': '',
+}
+
+foreach f, prefix: functions_to_detect
+  if cc.has_function(f, prefix: prefix)
     pre_args += '-DHAVE_ at 0@'.format(f.to_upper())
   endif
 endforeach



More information about the mesa-commit mailing list