This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / d_sigsetjmp.U
CommitLineData
d8875586
MBT
1?RCS: $Id: d_sigsetjmp.U 1 2006-08-24 12:32:52Z rmanfredi $
2?RCS:
3?RCS: Copyright (c) 1996, Andy Dougherty
4?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
5?RCS:
6?RCS: You may redistribute only under the terms of the Artistic Licence,
7?RCS: as specified in the README file that comes with the distribution.
8?RCS: You may reuse parts of this distribution only within the terms of
9?RCS: that same Artistic Licence; a copy of which may be found at the root
10?RCS: of the source tree for dist 4.0.
11?RCS:
12?RCS: You may distribute under the terms of either the GNU General Public
13?RCS: License or the Artistic License, as specified in the README file.
14?RCS:
15?RCS: $Log: d_sigsetjmp.U,v $
16?RCS: Revision 3.0.1.1 1997/02/28 15:44:33 ram
17?RCS: patch61: created
18?RCS:
19?MAKE:d_sigsetjmp: Setvar cat +cc +ccflags +ldflags libs rm
20?MAKE: -pick add $@ %<
21?S:d_sigsetjmp:
22?S: This variable conditionally defines the HAS_SIGSETJMP symbol,
23?S: which indicates that the sigsetjmp() routine is available to
24?S: call setjmp() and optionally save the process's signal mask.
25?S:.
26?C:HAS_SIGSETJMP:
27?C: This variable indicates to the C program that the sigsetjmp()
28?C: routine is available to save the calling process's registers
29?C: and stack environment for later use by siglongjmp(), and
30?C: to optionally save the process's signal mask. See
31?C: Sigjmp_buf, Sigsetjmp, and Siglongjmp.
32?C:.
33?C:Sigjmp_buf:
34?C: This is the buffer type to be used with Sigsetjmp and Siglongjmp.
35?C:.
36?C:Sigsetjmp:
37?C: This macro is used in the same way as sigsetjmp(), but will invoke
38?C: traditional setjmp() if sigsetjmp isn't available.
39?C: See HAS_SIGSETJMP.
40?C:.
41?C:Siglongjmp:
42?C: This macro is used in the same way as siglongjmp(), but will invoke
43?C: traditional longjmp() if siglongjmp isn't available.
44?C: See HAS_SIGSETJMP.
45?C:.
46?H:?%<:#$d_sigsetjmp HAS_SIGSETJMP /**/
47?H:?%<:#ifdef HAS_SIGSETJMP
48?H:?%<:#define Sigjmp_buf sigjmp_buf
49?H:?%<:#define Sigsetjmp(buf,save_mask) sigsetjmp((buf),(save_mask))
50?H:?%<:#define Siglongjmp(buf,retval) siglongjmp((buf),(retval))
51?H:?%<:#else
52?H:?%<:#define Sigjmp_buf jmp_buf
53?H:?%<:#define Sigsetjmp(buf,save_mask) setjmp((buf))
54?H:?%<:#define Siglongjmp(buf,retval) longjmp((buf),(retval))
55?H:?%<:#endif
56?H:.
57?W:%<:Sigjmp_buf Sigsetjmp Siglongjmp
58?F:!set
59?LINT:set d_sigsetjmp
60: see if sigsetjmp exists
61?X: We can't check for these symbols with Inlibc because sigsetjmp
62?X: is (sometimes? always?) a macro under GCC
63echo " "
64case "$d_sigsetjmp" in
65'')
66 $cat >set.c <<'EOP'
67#include <setjmp.h>
68sigjmp_buf env;
69int set = 1;
70int main()
71{
72 if (sigsetjmp(env,1))
73 exit(set);
74 set = 0;
75 siglongjmp(env, 1);
76 exit(1);
77}
78EOP
79 if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then
80 if ./set >/dev/null 2>&1; then
81 echo "POSIX sigsetjmp found." >&4
82 val="$define"
83 else
84 $cat >&4 <<EOM
85Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
86I'll ignore them.
87EOM
88 val="$undef"
89 fi
90 else
91 echo "sigsetjmp not found." >&4
92 val="$undef"
93 fi
94 ;;
95*) val="$d_sigsetjmp"
96 case "$d_sigsetjmp" in
97 $define) echo "POSIX sigsetjmp found." >&4;;
98 $undef) echo "sigsetjmp not found." >&4;;
99 esac
100 ;;
101esac
102set d_sigsetjmp
103eval $setvar
104$rm -f set.c set
105