mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
meson: small cleanup for printf checks
Instead of duplicating checks add a use_system_printf meson variable and macro and use them everywhere.
This commit is contained in:
parent
271e283881
commit
26f7104d79
@ -319,7 +319,7 @@ g_vasprintf (gchar **string,
|
|||||||
gint len;
|
gint len;
|
||||||
g_return_val_if_fail (string != NULL, -1);
|
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);
|
len = _g_gnulib_vasprintf (string, format, args);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#ifndef __G_PRINTFINT_H__
|
#ifndef __G_PRINTFINT_H__
|
||||||
#define __G_PRINTFINT_H__
|
#define __G_PRINTFINT_H__
|
||||||
|
|
||||||
#ifdef HAVE_GOOD_PRINTF
|
#ifdef USE_SYSTEM_PRINTF
|
||||||
|
|
||||||
#define _g_printf printf
|
#define _g_printf printf
|
||||||
#define _g_fprintf fprintf
|
#define _g_fprintf fprintf
|
||||||
|
@ -12,7 +12,7 @@ endif
|
|||||||
# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
|
# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
|
||||||
# on a meson version where those are fixed, revert the commit that
|
# on a meson version where those are fixed, revert the commit that
|
||||||
# introduced this workaround.
|
# introduced this workaround.
|
||||||
if have_good_vsnprintf and have_good_snprintf and have_good_printf
|
if use_system_printf
|
||||||
gnulib_lib = []
|
gnulib_lib = []
|
||||||
gnulib_objects = []
|
gnulib_objects = []
|
||||||
gnulib_libm_dependency = []
|
gnulib_libm_dependency = []
|
||||||
|
15
meson.build
15
meson.build
@ -913,17 +913,16 @@ else
|
|||||||
glib_conf.set('EXEEXT', '')
|
glib_conf.set('EXEEXT', '')
|
||||||
endif
|
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
|
||||||
# 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('HAVE_GOOD_PRINTF', 1)
|
glib_conf.set('USE_SYSTEM_PRINTF', use_system_printf)
|
||||||
else
|
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)
|
glib_conf.set('HAVE_VASPRINTF', 1)
|
||||||
endif
|
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
|
# Check for nl_langinfo and CODESET
|
||||||
if cc.links('''#include <langinfo.h>
|
if cc.links('''#include <langinfo.h>
|
||||||
int main (int argc, char ** argv) {
|
int main (int argc, char ** argv) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user