diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-08-10 16:45:31 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-08-20 17:19:26 +0200 |
commit | 26f7104d792baa279712cf27ce3acfd30a1d74ca (patch) | |
tree | 261ebd788a521c4f2c9e8852cb9aa84a5df35237 | |
parent | 271e283881b96a3c866ae5bb992cbb15708c80da (diff) | |
download | glib-26f7104d792baa279712cf27ce3acfd30a1d74ca.tar.gz |
meson: small cleanup for printf checks
Instead of duplicating checks add a use_system_printf meson variable and
macro and use them everywhere.
-rw-r--r-- | glib/gprintf.c | 2 | ||||
-rw-r--r-- | glib/gprintfint.h | 2 | ||||
-rw-r--r-- | glib/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 15 |
4 files changed, 10 insertions, 11 deletions
diff --git a/glib/gprintf.c b/glib/gprintf.c index 9293c83e6..fc0a02a3b 100644 --- a/glib/gprintf.c +++ b/glib/gprintf.c @@ -319,7 +319,7 @@ g_vasprintf (gchar **string, gint len; g_return_val_if_fail (string != NULL, -1); -#if !defined(HAVE_GOOD_PRINTF) +#if !defined(USE_SYSTEM_PRINTF) len = _g_gnulib_vasprintf (string, format, args); if (len < 0) diff --git a/glib/gprintfint.h b/glib/gprintfint.h index 6bf5fdad5..02bd9482f 100644 --- a/glib/gprintfint.h +++ b/glib/gprintfint.h @@ -25,7 +25,7 @@ #ifndef __G_PRINTFINT_H__ #define __G_PRINTFINT_H__ -#ifdef HAVE_GOOD_PRINTF +#ifdef USE_SYSTEM_PRINTF #define _g_printf printf #define _g_fprintf fprintf diff --git a/glib/meson.build b/glib/meson.build index dac28c06d..91a48f194 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -12,7 +12,7 @@ endif # <https://github.com/mesonbuild/meson/issues/3937>. When we can depend # on a meson version where those are fixed, revert the commit that # introduced this workaround. -if have_good_vsnprintf and have_good_snprintf and have_good_printf +if use_system_printf gnulib_lib = [] gnulib_objects = [] gnulib_libm_dependency = [] diff --git a/meson.build b/meson.build index 88573e400..ed78359e5 100644 --- a/meson.build +++ b/meson.build @@ -913,17 +913,16 @@ else glib_conf.set('EXEEXT', '') endif -if have_good_vsnprintf and have_good_snprintf and have_good_printf - # Our printf is 'good' only if vsnpintf()/snprintf()/printf() supports C99 well enough - glib_conf.set('HAVE_GOOD_PRINTF', 1) -else +# Our printf is 'good' only if vsnpintf()/snprintf()/printf() supports C99 well enough +use_system_printf = have_good_vsnprintf and have_good_snprintf and have_good_printf +glib_conf.set('USE_SYSTEM_PRINTF', use_system_printf) +glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF', use_system_printf) + +if not use_system_printf + # gnulib has vasprintf so override the previous check glib_conf.set('HAVE_VASPRINTF', 1) endif -glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF', - have_good_vsnprintf and have_good_snprintf and have_good_printf) - - # Check for nl_langinfo and CODESET if cc.links('''#include <langinfo.h> int main (int argc, char ** argv) { |