summaryrefslogtreecommitdiff
path: root/mcon/U/d_bsdjmp.U
blob: 071ad35fe7946df31eaf31d7da8400b462795d1c (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
?RCS: $Id: d_bsdjmp.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?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: $Log: d_bsdjmp.U,v $
?RCS: Revision 3.0.1.2  1997/02/28  15:31:10  ram
?RCS: patch61: added ?F: metalint hint
?RCS:
?RCS: Revision 3.0.1.1  1994/10/29  16:09:09  ram
?RCS: patch36: call ./usg explicitly instead of relying on PATH
?RCS:
?RCS: Revision 3.0  1993/08/18  12:05:45  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_bsdjmp: Guess Setvar cat +cc libs rm
?MAKE:	-pick add $@ %<
?S:d_bsdjmp:
?S:	This variable conditionally defines USE_BSDJMP if BSD _setjmp and
?S:	_longjmp routines are available to do non-local gotos without saving
?S:	or restoring the signal mask flag.
?S:.
?C:USE_BSDJMP (BSDJMP):
?C:	This symbol, if defined, indicates that the BSD _setjmp and _longjmp
?C:	routines are available to do non-local gotos wihtout saving or restoring
?C:	the signal mask flag.
?C:.
?H:#$d_bsdjmp USE_BSDJMP		/**/
?H:.
?F:!set
?LINT:set d_bsdjmp
: see if _setjmp and _longjmp exists
echo " "
case "$d_bsdjmp" in
'')
	$cat >set.c <<EOP
#include <setjmp.h>
jmp_buf env;
int set = 1;
int main()
{
	if (_setjmp(env))
		exit(set);
	set = 0;
	_longjmp(env, 1);
	exit(1);
}
EOP
	if $cc -o set set.c $libs >/dev/null 2>&1; then
		if ./set >/dev/null 2>&1; then
			echo "Good! You have BSD _setjmp and _longjmp routines." >&4
			val="$define"
		else
			$cat <<EOM
Uh-Oh! You have BSD _setjmp and _longjmp, but they do not work properly!!
EOM
			val="$undef"
		fi
	else
		if ./usg; then
			echo "You do not have _setjmp and _longjmp, but that's fine." >&4
		else
			cat <<EOM
It sounds strange for a BSD system to miss _setjmp and _longjmp, but that's ok.
EOM
		fi
		val="$undef"
	fi
	;;
*) val="$d_bsdjmp"
	case "$d_bsdjmp" in
	$define) echo "Good! You have BSD _setjmp and _longjmp routines." >&4;;
	$undef) echo "You do not have _setjmp and _longjmp, but that's fine." >&4;;
	esac
	;;
esac
set d_bsdjmp
eval $setvar
$rm -f set.c set