Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: d_sigsetjmp.U,v 3.0.1.1 1997/02/28 15:44:33 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1996,1998 Andy Dougherty | |
4 | ?RCS: Copyright (c) 1991-1993, 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 3.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: Compile Setvar cat 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:!try | |
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 | |
63 | echo " " | |
64 | case "$d_sigsetjmp" in | |
65 | '') | |
66 | $cat >try.c <<'EOP' | |
67 | #include <setjmp.h> | |
68 | sigjmp_buf env; | |
69 | int set = 1; | |
70 | int main() | |
71 | { | |
72 | if (sigsetjmp(env,1)) | |
73 | exit(set); | |
74 | set = 0; | |
75 | siglongjmp(env, 1); | |
76 | exit(1); | |
77 | } | |
78 | EOP | |
79 | set try | |
80 | if eval $compile; then | |
81 | if ./try >/dev/null 2>&1; then | |
82 | echo "POSIX sigsetjmp found." >&4 | |
83 | val="$define" | |
84 | else | |
85 | $cat >&4 <<EOM | |
86 | Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!! | |
87 | I'll ignore them. | |
88 | EOM | |
89 | val="$undef" | |
90 | fi | |
91 | else | |
92 | echo "sigsetjmp not found." >&4 | |
93 | val="$undef" | |
94 | fi | |
95 | ;; | |
96 | *) val="$d_sigsetjmp" | |
97 | case "$d_sigsetjmp" in | |
98 | $define) echo "POSIX sigsetjmp found." >&4;; | |
99 | $undef) echo "sigsetjmp not found." >&4;; | |
100 | esac | |
101 | ;; | |
102 | esac | |
103 | set d_sigsetjmp | |
104 | eval $setvar | |
105 | $rm -f try.c try | |
106 |