diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-15 00:06:56 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-15 00:06:56 -0700 |
commit | 0328b6de4a92676b4ad4616095ce19a4f51d1c4d (patch) | |
tree | fba6da827e1383b3ff6ee4b738d2ac74a5956dde /configure.ac | |
parent | 823751606a90e3850551b43e707d58bbf58033dc (diff) | |
download | emacs-0328b6de4a92676b4ad4616095ce19a4f51d1c4d.tar.gz |
Port better to POSIX hosts lacking _setjmp.
* configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols.
(_setjmp, _longjmp): Remove.
* src/lisp.h: Include <setjmp.h> here, since we use its symbols here.
All instances of '#include <setjmp.h>' removed, if the
only reason for the instance was because "lisp.h" was included.
(sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
and _longjmp with the new symbols. Emacs already uses _setjmp if
available, so this change affects only POSIXish hosts that have
sigsetjmp but not _setjmp, such as some versions of Solaris and
Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.)
* src/image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
(png_load_body) [HAVE_PNG]:
(PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
(PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
since PNG requires jmp_buf. This is the only exception to the
general rule that we now use sys_setjmp and sys_longjmp.
This exception is OK since this code does not change the signal
mask or longjmp out of a signal handler.
Fixes: debbugs:12446
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 382e62a97a1..f810c839587 100644 --- a/configure.ac +++ b/configure.ac @@ -3774,13 +3774,24 @@ AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp], _longjmp (j, 1);]])], [emacs_cv_func__setjmp=yes], [emacs_cv_func__setjmp=no])]) -if test $emacs_cv_func__setjmp = no; then - AC_DEFINE([_setjmp], [setjmp], - [Define to setjmp if _setjmp and _longjmp do not work. See _longjmp.]) - AC_DEFINE([_longjmp], [longjmp], - [Define to longjmp if _setjmp and _longjmp do not work. - Because longjmp may alter signal masks, callers of _longjmp - should not assume that it leaves signal masks alone.]) +if test $emacs_cv_func__setjmp = yes; then + AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.]) +else + AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <setjmp.h> + ]], + [[sigjmp_buf j; + if (! sigsetjmp (j, 1)) + siglongjmp (j, 1);]])], + [emacs_cv_func_sigsetjmp=yes], + [emacs_cv_func_sigsetjmp=no])]) + if test $emacs_cv_func_sigsetjmp = yes; then + AC_DEFINE([HAVE_SIGSETJMP], 1, + [Define to 1 if sigsetjmp and siglongjmp work. + The value of this symbol is irrelevant if HAVE__SETJMP is defined.]) + fi fi case $opsys in |