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_bsdjmp.U
1 ?RCS: $Id: d_bsdjmp.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: $Log: d_bsdjmp.U,v $
12 ?RCS: Revision 3.0.1.2  1997/02/28  15:31:10  ram
13 ?RCS: patch61: added ?F: metalint hint
14 ?RCS:
15 ?RCS: Revision 3.0.1.1  1994/10/29  16:09:09  ram
16 ?RCS: patch36: call ./usg explicitly instead of relying on PATH
17 ?RCS:
18 ?RCS: Revision 3.0  1993/08/18  12:05:45  ram
19 ?RCS: Baseline for dist 3.0 netwide release.
20 ?RCS:
21 ?MAKE:d_bsdjmp: Guess Setvar cat +cc libs rm
22 ?MAKE:  -pick add $@ %<
23 ?S:d_bsdjmp:
24 ?S:     This variable conditionally defines USE_BSDJMP if BSD _setjmp and
25 ?S:     _longjmp routines are available to do non-local gotos without saving
26 ?S:     or restoring the signal mask flag.
27 ?S:.
28 ?C:USE_BSDJMP (BSDJMP):
29 ?C:     This symbol, if defined, indicates that the BSD _setjmp and _longjmp
30 ?C:     routines are available to do non-local gotos wihtout saving or restoring
31 ?C:     the signal mask flag.
32 ?C:.
33 ?H:#$d_bsdjmp USE_BSDJMP                /**/
34 ?H:.
35 ?F:!set
36 ?LINT:set d_bsdjmp
37 : see if _setjmp and _longjmp exists
38 ?X: We can't check for these symbols with Inlibc because of the leading "_"
39 echo " "
40 case "$d_bsdjmp" in
41 '')
42         $cat >set.c <<EOP
43 #include <setjmp.h>
44 jmp_buf env;
45 int set = 1;
46 int main()
47 {
48         if (_setjmp(env))
49                 exit(set);
50         set = 0;
51         _longjmp(env, 1);
52         exit(1);
53 }
54 EOP
55         if $cc -o set set.c $libs >/dev/null 2>&1; then
56                 if ./set >/dev/null 2>&1; then
57                         echo "Good! You have BSD _setjmp and _longjmp routines." >&4
58                         val="$define"
59                 else
60                         $cat <<EOM
61 Uh-Oh! You have BSD _setjmp and _longjmp, but they do not work properly!!
62 EOM
63                         val="$undef"
64                 fi
65         else
66                 if ./usg; then
67                         echo "You do not have _setjmp and _longjmp, but that's fine." >&4
68                 else
69                         cat <<EOM
70 It sounds strange for a BSD system to miss _setjmp and _longjmp, but that's ok.
71 EOM
72                 fi
73                 val="$undef"
74         fi
75         ;;
76 *) val="$d_bsdjmp"
77         case "$d_bsdjmp" in
78         $define) echo "Good! You have BSD _setjmp and _longjmp routines." >&4;;
79         $undef) echo "You do not have _setjmp and _longjmp, but that's fine." >&4;;
80         esac
81         ;;
82 esac
83 set d_bsdjmp
84 eval $setvar
85 $rm -f set.c set
86