meson build: improve function checking
authorJohn Marshall <jtm.home@gmail.com>
Mon, 11 Jun 2018 08:40:45 +0000 (09:40 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sat, 25 May 2019 16:13:31 +0000 (18:13 +0200)
meson.build

index fbca8255025c854982ddf0857c355f726497837f..ab1d042d969e11268a67368391eee4482c49caa8 100644 (file)
@@ -245,11 +245,12 @@ endforeach
 # Check functions
 # general
 check_functions = [
-  ['HAVE_GETTIMEOFDAY', 'gettimeofday'],
-  ['HAVE_SRANDOM',      'srandom'     ],
+  ['HAVE_GETTIMEOFDAY', 'gettimeofday', '<sys/time.h>'],
+  ['HAVE_RINT',         'rint'        , '<math.h>'],  
+  ['HAVE_SRANDOM',      'srandom'     , '<stdlib.h>'],
 ]
 foreach func: check_functions
-  if cc.has_function(func[1])
+  if cc.has_function(func[1], prefix: '#include ' + func[2])
     conf.set(func[0], 1, description: 
       'Define to 1 if the @0@() function is available'.format(func[1]))
   endif