diff options
author | rmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d> | 2012-11-10 22:02:51 +0000 |
---|---|---|
committer | rmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d> | 2012-11-10 22:02:51 +0000 |
commit | 0cc141edfd2785c4c356fb7a18eaf4790452c211 (patch) | |
tree | ab0bd68e523d098394b77460d780af889006ff17 | |
parent | db730258627bf215431b11d8d682dd58d4bd1585 (diff) |
Added checks for <sys/ucontext.h> as well.
git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@154 2592e710-e01b-42a5-8df0-11608a6cc53d
-rw-r--r-- | mcon/U/i_ucontext.U | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/mcon/U/i_ucontext.U b/mcon/U/i_ucontext.U index 569e5fe..a819d9e 100644 --- a/mcon/U/i_ucontext.U +++ b/mcon/U/i_ucontext.U @@ -8,20 +8,89 @@ ?RCS: that same Artistic Licence; a copy of which may be found at the root ?RCS: of the source tree for dist 4.0. ?RCS: -?MAKE:i_ucontext: Inhdr +?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. +?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:. -?LINT:set i_ucontext +?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.* + |