summaryrefslogtreecommitdiff
path: root/mcon/U/i_ucontext.U
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@golden-gryphon.com>2014-04-27 17:54:01 -0700
committerManoj Srivastava <srivasta@golden-gryphon.com>2014-04-27 17:54:01 -0700
commit8f5e5726134ce5b4bd436b16f367796d851df553 (patch)
tree0ce2ad130721dcf917d7f81fb8495bf0a189d266 /mcon/U/i_ucontext.U
parent02bf7be6fc0f798790ef5b2160bc89a77b909428 (diff)
Imported Upstream version 3.5-36
Diffstat (limited to 'mcon/U/i_ucontext.U')
-rw-r--r--mcon/U/i_ucontext.U96
1 files changed, 96 insertions, 0 deletions
diff --git a/mcon/U/i_ucontext.U b/mcon/U/i_ucontext.U
new file mode 100644
index 0000000..9f4912b
--- /dev/null
+++ b/mcon/U/i_ucontext.U
@@ -0,0 +1,96 @@
+?RCS: $Id: i_ucontext.U 167 2013-05-08 17:58:00Z rmanfredi $
+?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.*
+