threads,configure.ac,meson.build: define and use HAVE_TIMESPEC_GET

Tested with Travis and Appveyor.

v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
v3: use check_functions in Scons (Eric)

Cc: Rob Herring <robh@kernel.org>
Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
Fixes: f1a364878431 ("threads: update for late C11 changes")
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v2)
diff --git a/scons/gallium.py b/scons/gallium.py
index 94022df..ef3b2ee 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -355,6 +355,9 @@
         if check_functions(env, ['strtod_l', 'strtof_l']):
             cppdefines += ['HAVE_STRTOD_L']
 
+        if check_functions(env, ['timespec_get']):
+            cppdefines += ['HAVE_TIMESPEC_GET']
+
     if platform == 'windows':
         cppdefines += [
             'WIN32',