summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-13 02:01:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-13 02:01:22 +0000
commita995195d78bb41d25a149492964c02ae85eda01c (patch)
treed30fad9dc64971594717122ad944b02df7205158 /configure.in
parentca48cc4ad51afe64c8cc14ca5b3be31eee408d93 (diff)
configure.in: enum_over_int
* configure.in (enum_over_int): check if enum over int is allowed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in26
1 files changed, 26 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 532f6bb2b5..30276a6180 100644
--- a/configure.in
+++ b/configure.in
@@ -1775,6 +1775,32 @@ if test "$rb_cv_function_name_string" != no; then
AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])
fi
+AC_CACHE_CHECK(if enum over int is allowed, rb_cv_enum_over_int, [
+ rb_cv_enum_over_int=no
+ if test "x$ac_cv_type_long_long" = xyes; then
+ type="unsigned long long" max="ULONG_LONG_MAX"
+ else
+ type="unsigned long" max="ULONG_MAX"
+ fi
+ RUBY_WERROR_FLAG([
+ AC_COMPILE_IFELSE([
+ AC_LANG_BOOL_COMPILE_TRY([
+ @%:@include <limits.h>
+ enum {conftest_max = $max};
+ ], [
+ (conftest_max == $max) &&
+ (sizeof(conftest_max) == sizeof($type))
+ ]
+ )],
+ [rb_cv_enum_over_int=yes],
+ [rb_cv_enum_over_int=no]
+ )
+ ])
+])
+if test $rb_cv_enum_over_int = yes; then
+ AC_DEFINE(ENUM_OVER_INT, 1)
+fi
+
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
@%:@include <errno.h>])