summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-02 12:50:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-02 12:50:07 +0000
commita0237409fa813fca2c485a26e2fa52a1314fa494 (patch)
tree95e44ac878d4f36f2178017dcc97b7881f8136ae /configure.in
parentfb59efb97d6a9242afad8e61fea54ac7c13ad03f (diff)
configure.in: fix for clang 5.1 __builtin_longjmp
* configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in clang 5.1 uses `void**`, not `jmp_buf`. [Bug #9692] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in23
1 files changed, 16 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index 71b3da9613..9462d95f25 100644
--- a/configure.in
+++ b/configure.in
@@ -2074,18 +2074,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>
@%:@include <stdio.h>
jmp_buf jb;
- void t(void) {__builtin_longjmp(jb, 1);}],
+ void t(void) {__builtin_longjmp($cast jb, 1);}],
[
void (*volatile f)(void) = t;
- if (!__builtin_setjmp(jb)) printf("%d\n", f != 0);
+ if (!__builtin_setjmp($cast jb)) printf("%d\n", f != 0);
],
- [ac_cv_func___builtin_setjmp=yes],
+ [ac_cv_func___builtin_setjmp="yes with cast ($cast)"],
[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
@@ -2103,11 +2110,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
@@ -2128,9 +2137,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.