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