summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-11 11:49:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-11 11:49:54 +0000
commitfe9f1e8cf8a1d49c7d4d6baff2f1797ff89e7956 (patch)
tree81fe28f3a9a4ba55599c1c929e5e0b8d6967f1c2 /configure.in
parent8a7d063c1f46fb47d12119e6c2b6dcbfcbc1d909 (diff)
* include/ruby/ruby.h (PRI_LL_PREFIX): format type specifier for
LONG_LONG may vary on platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in44
1 files changed, 31 insertions, 13 deletions
diff --git a/configure.in b/configure.in
index 3adba3c69e..3346a91194 100644
--- a/configure.in
+++ b/configure.in
@@ -582,6 +582,36 @@ RUBY_CHECK_SIZEOF(float)
RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
+AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
+AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),
+ [rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
+ for pri in $2; do
+ RUBY_WERROR_FLAG(AC_TRY_COMPILE(
+ [@%:@include <stdio.h>
+ @%:@include <stddef.h>
+ @%:@ifdef __GNUC__
+ @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
+ decl __attribute__((format(printf, string_index, first_to_check)))
+ @%:@else
+ @%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
+ @%:@endif
+ PRINTF_ARGS(void test_sprintf(const char*, ...), 1, 2);],
+ [printf("%]${pri}[d", (]$1[)42);
+ test_sprintf("%]${pri}[d", (]$1[)42);],
+ [rb_cv_pri_prefix_]AS_TR_SH($1)[=[$pri]; break]))
+ done)
+if test "[$rb_cv_pri_prefix_]AS_TR_SH($1)" != NONE; then
+ AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX],
+ "[$rb_cv_pri_prefix_]AS_TR_SH($1)")
+fi
+])
+
+if test "x$ac_cv_type_long_long" = xyes; then
+ RUBY_CHECK_PRINTF_PREFIX(long long, ll I64, LL)
+elif test "x$ac_cv_type___int64" = xyes; then
+ RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
+fi
+
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1], [n=[$1]], [n=[$2]], [$4])
@@ -623,7 +653,7 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
AC_DEFINE_UNQUOTED(PRI_[$3]_PREFIX,
- ["`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//;s/[^L].*//;y/L/l/']`"])
+ [PRI_`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//']`_PREFIX])
])
RUBY_REPLACE_TYPE(pid_t, int, PIDT)
RUBY_REPLACE_TYPE(uid_t, int, UIDT)
@@ -1081,18 +1111,6 @@ RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [
#include <stdio.h>
])
-AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
-AC_CACHE_CHECK([printf prefix for $1], rb_cv_pri_prefix_[$1],
- RUBY_WERROR_FLAG(AC_TRY_COMPILE(
- [@%:@include <stdio.h>],
- [printf("%]$2[d", sizeof(long));],
- [rb_cv_pri_prefix_[$1]=[$2]],
- [rb_cv_pri_prefix_[$1]=[NONE]])))
-if test "$rb_cv_pri_prefix_[$1]" != NONE; then
- AC_DEFINE_UNQUOTED([PRI_]AS_TR_CPP(m4_bpatsubst([$1],[_t$]))[_PREFIX], "$rb_cv_pri_prefix_[$1]")
-fi
-])
-
AC_TYPE_SIZE_T
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>])