summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2001-12-06 22:37:05 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2001-12-06 22:37:05 +0000
commit39e4c5afe8a4f4953e3a2905a51aeaa41a91b598 (patch)
tree7d812e03b85bc90d73bdc4656c9952f43e74ec2f /acinclude.m4
parent964ebaf18c4a16ecc650a21a9d95df18a3c32c37 (diff)
downloadglib-39e4c5afe8a4f4953e3a2905a51aeaa41a91b598.tar.gz
The following patch corrects some function attributes. (#61780)
The following patch corrects some function attributes. (#61780) * glib/ghash.h (g_int_equal, g_int_hash): These are not const. * glib/glibintl.h (_glib_gettext): Add G_GNUC_FORMAT(1). * glib/gmacros.h: Use reserved symbols in function attribute macros. The following patch avoids manual printf()-format parsing if a C99-conforming vsnprintf() is available. (#55106) * acinclude.m4 (AC_FUNC_VSNPRINTF_C99): New macro to test for a C99 conforming vsnprintf. * configure.in: Use AC_FUNC_VSNPRINTF_C99. * glib/gmessages.c (g_printf_string_upper_bound): Use C99 vsnprintf().
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m444
1 files changed, 44 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 583b7b8fc..b529e17e4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -235,3 +235,47 @@ strdup __argz_count __argz_stringify __argz_next])
< $srcdir/po/POTFILES.in > po/POTFILES
])
+dnl @synopsis AC_FUNC_VSNPRINTF_C99
+dnl
+dnl Check whether there is a vsnprintf() function with C99 semantics installed.
+dnl
+AC_DEFUN([AC_FUNC_VSNPRINTF_C99],
+[AC_CACHE_CHECK(for C99 vsnprintf,
+ ac_cv_func_vsnprintf_c99,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <stdarg.h>
+
+int
+doit(char * s, ...)
+{
+ char buffer[32];
+ va_list args;
+ int r;
+
+ va_start(args, s);
+ r = vsnprintf(buffer, 5, s, args);
+ va_end(args);
+
+ if (r != 7)
+ exit(1);
+
+ exit(0);
+}
+
+int
+main(void)
+{
+ doit("1234567");
+ exit(1);
+}], ac_cv_func_vsnprintf_c99=yes, ac_cv_func_vsnprintf_c99=no, ac_cv_func_vsnprintf_c99=no)])
+dnl Note that the default is to be pessimistic in the case of cross compilation.
+dnl If you know that the target has a C99 vsnprintf(), you can get around this
+dnl by setting ac_func_vsnprintf_c99 to yes, as described in the Autoconf manual.
+if test $ac_cv_func_vsnprintf_c99 = yes; then
+ AC_DEFINE(HAVE_C99_VSNPRINTF, 1,
+ [Define if you have a version of the vsnprintf function
+ with semantics as specified by the ISO C99 standard.])
+fi
+])# AC_FUNC_VSNPRINTF_C99
+