diff --git a/ChangeLog b/ChangeLog index b754cc473..030db9172 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b754cc473..030db9172 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,10 @@ 2000-09-28 Sebastian Wilhelmi + * configure.in, tests/type-test.c: Some platforms support 64 bit + 'long long', but you can not printf or scanf them. In that case, + don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program + to reflect that. + * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. diff --git a/configure.in b/configure.in index 29d8d5b78..d5360b27f 100644 --- a/configure.in +++ b/configure.in @@ -236,19 +236,25 @@ 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,[ + for format in ll q; do AC_TRY_RUN([#include int main() { long long b, a = -0x3AFAFAFAFAFAFAFALL; char buffer[1000]; - sprintf (buffer, "%llu", a); - sscanf (buffer, "%llu", &b); + sprintf (buffer, "%${format}u", a); + sscanf (buffer, "%${format}u", &b); exit (b!=a); } ], - glib_cv_long_long_format=ll, - glib_cv_long_long_format=q)]) + glib_cv_long_long_format=${format} + break) + done]) + if test -n "$glib_cv_long_long_format"; then AC_MSG_RESULT(%${glib_cv_long_long_format}i) + else + AC_MSG_RESULT(none) + fi fi dnl long doubles were not used, and a portability problem @@ -1244,12 +1250,15 @@ _______EOF ${glib_extension}typedef signed $gint64 gint64; ${glib_extension}typedef unsigned $gint64 guint64; +#define G_GINT64_CONSTANT(val) $gint64_constant +_______EOF + if test -n "$gint64_format"; then + cat >>$outfile <<_______EOF #define G_GINT64_FORMAT $gint64_format #define G_GUINT64_FORMAT $guint64_format -#define G_GINT64_CONSTANT(val) $gint64_constant - _______EOF fi + fi case x$glib_size_t in x2) echo "typedef gint16 gssize;" >> $outfile @@ -1476,8 +1485,10 @@ $ac_cv_sizeof_long) ;; $ac_cv_sizeof_long_long) gint64='long long' + if test -n "$glib_cv_long_long_format"; then gint64_format='"'$glib_cv_long_long_format'i"' guint64_format='"'$glib_cv_long_long_format'u"' + fi glib_extension='G_GNUC_EXTENSION ' gint64_constant='(G_GNUC_EXTENSION (val##LL))' ;; diff --git a/tests/type-test.c b/tests/type-test.c index 281c853ca..ade1b86a5 100644 --- a/tests/type-test.c +++ b/tests/type-test.c @@ -113,7 +113,7 @@ main (int argc, g_assert (gu16t1 == gu16t2); g_assert (gu32t1 == gu32t2); -#ifdef G_HAVE_GINT64 +#if defined (G_HAVE_GINT64) && defined (G_GINT64_FORMAT) gi64t1 = G_GINT64_CONSTANT (-0x3AFAFAFAFAFAFAFA); gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA); #define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"