[gdk-pixbuf] build: Check for lrint() and round()



commit 480e4834115a10b3f81615527803c5601ff18c77
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Aug 4 15:20:23 2017 +0800

    build: Check for lrint() and round()
    
    Instead of hardcoding their availability on non-MSVC (and thus
    assuming that they are not available on MSVC), check for them and build
    accordingly, since MSVC 2013+ provides them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785767

 meson.build |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8d61e6c..0db2c02 100644
--- a/meson.build
+++ b/meson.build
@@ -71,6 +71,19 @@ foreach h: check_headers
   endif
 endforeach
 
+# Look for the math library first, since we use it to test for round() and lrint()
+mathlib_dep = cc.find_library('m', required: false)
+
+# XXX: Remove the checks for round() and lrint() once GDK-Pixbuf is declared C99
+if cc.has_function('round', dependencies: mathlib_dep)
+  gdk_pixbuf_conf.set('HAVE_ROUND', 1)
+endif
+
+if cc.has_function('lrint', dependencies: mathlib_dep)
+  gdk_pixbuf_conf.set('HAVE_LRINT', 1)
+endif
+
+
 # We use links() because sigsetjmp() is often a macro hidden behind other macros
 gdk_pixbuf_conf.set('HAVE_SIGSETJMP',
                     cc.links('''#define _POSIX_SOURCE
@@ -81,12 +94,6 @@ gdk_pixbuf_conf.set('HAVE_SIGSETJMP',
                                   return 0;
                                 }''', name: 'sigsetjmp'))
 
-# XXX: Remove once we declare gdk-pixbuf C99-only
-if cc.get_id() != 'msvc'
-  gdk_pixbuf_conf.set('HAVE_ROUND', 1)
-  gdk_pixbuf_conf.set('HAVE_LRINT', 1)
-endif
-
 # Common compiler and linker flags
 common_cflags = []
 common_ldflags = []
@@ -173,7 +180,6 @@ if host_machine.system() == 'darwin'
 endif
 
 # Dependencies
-mathlib_dep = cc.find_library('m', required: false)
 gobject_dep = dependency('gobject-2.0', version: glib_req_version)
 gmodule_dep = dependency('gmodule-no-export-2.0')
 gio_dep = dependency('gio-2.0')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]