From 0ca3f612e7f813897f0b322bde7276f4c1eb64e4 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Tue, 30 Mar 1999 14:25:50 +0000 Subject: [PATCH] Added a check for the right format to printf and scanf long longs. It is 1999-03-30 Sebastian Wilhelmi * configure.in: Added a check for the right format to printf and scanf long longs. It is %qi instead of %lli on FreeBSD for whatever reason. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-12 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ configure.in | 23 +++++++++++++++++++++-- 9 files changed, 69 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20c6f470d..ab240023e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 20c6f470d..ab240023e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +1999-03-30 Sebastian Wilhelmi + + * configure.in: Added a check for the right format to printf and + scanf long longs. It is %qi instead of %lli on FreeBSD for + whatever reason. + 1999-03-28 Raja R Harinath * Makefile.am (glibconfig.h): Make sure `glibconfig.h' exists diff --git a/configure.in b/configure.in index 12c2ea156..8eb451c87 100644 --- a/configure.in +++ b/configure.in @@ -199,6 +199,25 @@ AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(long long) +if test x$ac_cv_sizeof_long_long = x8; then + # long long is a 64 bit integer. + AC_MSG_CHECKING(for format to printf and scanf a gint64) + AC_CACHE_VAL(glib_cv_long_long_format,[ + AC_TRY_RUN([#include + int main() + { + long long b, a = -0x3AFAFAFAFAFAFAFALL; + char buffer[1000]; + sprintf (buffer, "%llu", a); + sscanf (buffer, "%llu", &b); + exit (b!=a); + } + ], + glib_cv_long_long_format=ll, + glib_cv_long_long_format=q)]) + AC_MSG_RESULT(%${glib_cv_long_long_format}i) +fi + dnl long doubles were not used, and a portability problem dnl AC_C_LONG_DOUBLE AC_C_CONST @@ -1128,8 +1147,8 @@ $ac_cv_sizeof_long) ;; $ac_cv_sizeof_long_long) gint64='long long' - gint64_format='"lli"' - guint64_format='"llu"' + gint64_format='"'$glib_cv_long_long_format'i"' + guint64_format='"'$glib_cv_long_long_format'u"' glib_extension='G_GNUC_EXTENSION ' glib_warning_guard=" #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8