blob: 8de1d97fe34eff302b266bd8c0f3aae9e17b2e33 (
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
|
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 2012 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:
?MAKE:i_ucontext i_sys_ucontext: Inhdr cat echo n c rm \
+cc +ccflags +ldflags
?MAKE: -pick add $@ %<
?S:i_ucontext:
?S: This variable conditionally defines the I_UCONTEXT symbol, and indicates
?S: whether a C program may include <ucontext.h> to get ucontext_t.
?S:.
?S:i_sys_ucontext:
?S: This variable conditionally defines the I_SYS_UCONTEXT symbol, and
?S: indicates whether a C program may include <sys/ucontext.h> to get
?S: ucontext_t.
?S:.
?C:I_UCONTEXT:
?C: This symbol, if defined, indicates to the C program that it should
?C: include <ucontext.h> to get at the user thread context. A portable
?C: program must also check I_SYS_UCONTEXT for <sys/ucontex.h> inclusion,
?C: especially on OSX.
?C:.
?C:I_SYS_UCONTEXT:
?C: This symbol, if defined, indicates to the C program that it should
?C: include <sys/ucontext.h> to get at the user thread context. A portable
?C: program must also check I_UCONTEXT for <ucontex.h> inclusion.
?C:.
?H:#$i_ucontext I_UCONTEXT /**/
?H:#$i_sys_ucontext I_SYS_UCONTEXT /**/
?H:.
?T:working
: see if this is a ucontext.h system
set ucontext.h i_ucontext
eval $inhdr
: see if this is a sys/ucontext.h system
set sys/ucontext.h i_sys_ucontext
eval $inhdr
: when both ucontext.h and sys/ucontext.h are available, check which one works
case "$i_ucontext$i_sys_ucontext" in
"$define$define")
echo " "
$cat >try.c <<'EOC'
#ifdef I_UCONTEXT
#include <ucontext.h>
#endif
#ifdef I_SYS_UCONTEXT
#include <sys/ucontext.h>
#endif
int main(void)
{
static ucontext_t u;
return (int) sizeof(u) & 0xff;
}
EOC
$echo $n "Checking whether including <ucontext.h> alone works...$c" >&4
working=
if $cc $ccflags -DI_UCONTEXT -o try try.c $ldflags >/dev/null 2>&1; then
working="$define"
fi
case "$working" in
"$define")
echo " yes." >&4
i_sys_ucontext="$undef"
;;
*)
echo "no." >&4
echo " "
$echo $n "Checking whether including <sys/ucontext.h> works...$c" >&4
working=
if $cc $ccflags -DI_SYS_UCONTEXT \
-o try try.c $ldflags >/dev/null 2>&1
then
working="$define"
fi
case "$working" in
"$define")
echo " yes, ignoring <ucontext.h>." >&4
i_ucontext="$undef"
;;
*) echo " no, we'll include both then." >&4;;
esac
;;
esac
;;
esac
$rm -f try.*
|