* configure.in: Use sigsetjmp by default so jumping out of signal

handlers properly restores the signal mask and SS_ONSTACK flag.
  [ruby-core:54175] [Bug #8254]

* configure.in: Manually check for presence of sigsetjmp. It is not a
  function on some systems, so AC_CHECK_FUNCS cannot be used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2013-04-21 12:35:23 +00:00
parent 595825dc57
commit c032cf6efe
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,12 @@
Sun Apr 21 21:35:00 2013 Charlie Somerville <charlie@charliesomerville.com>
* configure.in: Use sigsetjmp by default so jumping out of signal
handlers properly restores the signal mask and SS_ONSTACK flag.
[ruby-core:54175] [Bug #8254]
* configure.in: Manually check for presence of sigsetjmp. It is not a
function on some systems, so AC_CHECK_FUNCS cannot be used.
Sun Apr 21 08:00:55 2013 Tanaka Akira <akr@fsij.org> Sun Apr 21 08:00:55 2013 Tanaka Akira <akr@fsij.org>
* test/csv/test_features.rb, test/logger/test_logger.rb * test/csv/test_features.rb, test/logger/test_logger.rb

View File

@ -1696,13 +1696,20 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot ge
setrgid setegid setregid setresgid issetugid pause lchown lchmod\ setrgid setegid setregid setresgid issetugid pause lchown lchmod\
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\ getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
getpriority getrlimit setrlimit sysconf close getpwnam_r getgrnam_r\ getpriority getrlimit setrlimit sysconf close getpwnam_r getgrnam_r\
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\ dlopen sigprocmask sigaction _setjmp _longjmp\
getsid setsid telldir seekdir fchmod cosh sinh tanh log2 round llabs\ getsid setsid telldir seekdir fchmod cosh sinh tanh log2 round llabs\
setuid setgid daemon select_large_fdset setenv unsetenv\ setuid setgid daemon select_large_fdset setenv unsetenv\
mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\ mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
pread sendfile shutdown sigaltstack dl_iterate_phdr\ pread sendfile shutdown sigaltstack dl_iterate_phdr\
dup dup3 pipe2 posix_memalign memalign ioctl) dup dup3 pipe2 posix_memalign memalign ioctl)
AC_CACHE_CHECK(for sigsetjmp as a macro or function, ac_cv_func_sigsetjmp,
[AC_TRY_COMPILE([
#include <setjmp.h>
], [sigjmp_buf env; sigsetjmp(env,1);],
ac_cv_func_sigsetjmp=yes,
ac_cv_func_sigsetjmp=no)])
AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value, AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value,
[AC_TRY_COMPILE([ [AC_TRY_COMPILE([
#include <stdlib.h> #include <stdlib.h>
@ -1738,12 +1745,12 @@ if test ${setjmp_prefix+set}; then
if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp = no; then if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp = no; then
AC_MSG_ERROR(${setjmp_prefix}setjmp is not available) AC_MSG_ERROR(${setjmp_prefix}setjmp is not available)
fi fi
elif test "$ac_cv_func_sigsetjmp" = yes; then
AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig])
elif test "$ac_cv_func___builtin_setjmp" = yes; then elif test "$ac_cv_func___builtin_setjmp" = yes; then
setjmp_prefix=__builtin_ setjmp_prefix=__builtin_
elif test "$ac_cv_func__setjmp" = yes; then elif test "$ac_cv_func__setjmp" = yes; then
setjmp_prefix=_ setjmp_prefix=_
elif test "$ac_cv_func_sigsetjmp" = yes; then
AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig])
else else
setjmp_prefix= setjmp_prefix=
fi fi
@ -1753,7 +1760,7 @@ else
unset setjmp_sigmask unset setjmp_sigmask
fi fi
AC_MSG_RESULT(${setjmp_prefix}setjmp) AC_MSG_RESULT(${setjmp_prefix}setjmp)
AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,0})]) AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,1})])
AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)]) AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf) AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)