summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-08-04 15:20:23 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2017-08-17 15:14:41 +0800
commit480e4834115a10b3f81615527803c5601ff18c77 (patch)
treed6081eed8c293d83970cdae131c15b431d056949
parent0b98f7e234ee68067b37eae917559c57592e7d43 (diff)
downloadgdk-pixbuf-480e4834115a10b3f81615527803c5601ff18c77.tar.gz
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
-rw-r--r--meson.build20
1 files changed, 13 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index 8d61e6cea..0db2c02db 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')