summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-25 15:03:42 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-25 15:03:42 +0000
commit6f6a076086f85942bb5eb22a4fda275a25dbe59f (patch)
tree83ee779d5bd7f4d9b3f4c083e5270998130f6690 /configure.in
parenta4f174ac302ec6f8b52091a27ddb6aaab5319e23 (diff)
merge revision(s) r45503,r45504,r45508,r45509,r47275: [Backport #9692]
* configure.in (ac_cv_func___builtin_setjmp): gcc 4.9 disallows a variable as the second argument of __builtin_longjmp(). [ruby-core:61800] [Bug #9692] * configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in clang 5.1 uses `void**`, not `jmp_buf`. [Bug #9692] * configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in Apple LLVM 5.1 (LLVM 3.4svn) uses `void**`, not `jmp_buf`. [Bug #9692] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in28
1 files changed, 21 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index 6801a07b57..dc55f55b3a 100644
--- a/configure.in
+++ b/configure.in
@@ -2022,13 +2022,25 @@ AC_CACHE_CHECK(for sigsetjmp as a macro or function, ac_cv_func_sigsetjmp,
ac_cv_func_sigsetjmp=yes,
ac_cv_func_sigsetjmp=no)])
+if test x"${ac_cv_func___builtin_setjmp}" = xyes; then
+ unset ac_cv_func___builtin_setjmp
+fi
AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
+[
+for cast in "" "(void *)"; do
+RUBY_WERROR_FLAG(
[AC_TRY_LINK([@%:@include <setjmp.h>
- jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
- [__builtin_setjmp(jb);],
- [ac_cv_func___builtin_setjmp=yes],
+ @%:@include <stdio.h>
+ jmp_buf jb;
+ void t(void) {__builtin_longjmp($cast jb, 1);}],
+ [
+ void (*volatile f)(void) = t;
+ if (!__builtin_setjmp($cast jb)) printf("%d\n", f != 0);
+ ],
+ [ac_cv_func___builtin_setjmp="yes with cast ($cast)"; break],
[ac_cv_func___builtin_setjmp=no])
])
+done])
# we don't use _setjmp if _longjmp doesn't exist.
test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
@@ -2046,11 +2058,13 @@ AC_ARG_WITH(setjmp-type,
[setjmpex], [ setjmp_prefix= setjmp_suffix=ex],
[''], [ unset setjmp_prefix],
[ AC_MSG_ERROR(invalid setjmp type: $withval)])], [unset setjmp_prefix])
+setjmp_cast=
if test ${setjmp_prefix+set}; then
if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp${setjmp_suffix} = no; then
AC_MSG_ERROR(${setjmp_prefix}setjmp${setjmp_suffix} is not available)
fi
-elif test "$ac_cv_func___builtin_setjmp" = yes; then
+elif { AS_CASE("$ac_cv_func___builtin_setjmp", [yes*], [true], [false]); }; then
+ setjmp_cast=`expr "$ac_cv_func___builtin_setjmp" : "yes with cast (\(.*\))"`
setjmp_prefix=__builtin_
setjmp_suffix=
elif test "$ac_cv_header_setjmpex_h:$ac_cv_func__setjmpex" = yes:yes; then
@@ -2071,9 +2085,9 @@ if test x$setjmp_prefix = xsig; then
else
unset setjmp_sigmask
fi
-AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix})
-AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}(env${setjmp_sigmask+,0})])
-AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
+AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+($setjmp_cast)})
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask+,0})])
+AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp($setjmp_cast(env),val)])
AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
# End of setjmp check.