[前][次][番号順一覧][スレッド一覧]

ruby-changes:39768

From: nobu <ko1@a...>
Date: Sun, 13 Sep 2015 11:01:38 +0900 (JST)
Subject: [ruby-changes:39768] nobu:r51849 (trunk): configure.in: enum_over_int

nobu	2015-09-13 11:01:22 +0900 (Sun, 13 Sep 2015)

  New Revision: 51849

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51849

  Log:
    configure.in: enum_over_int
    
    * configure.in (enum_over_int): check if enum over int is allowed.

  Modified files:
    trunk/configure.in
Index: configure.in
===================================================================
--- configure.in	(revision 51848)
+++ configure.in	(revision 51849)
@@ -1775,6 +1775,32 @@ if test "$rb_cv_function_name_string" != https://github.com/ruby/ruby/blob/trunk/configure.in#L1775
     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>])

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]