?RCS: $Id: d_sigsetjmp.U,v 3.0.1.1 1997/02/28 15:44:33 ram Exp $
?RCS:
?RCS: Copyright (c) 1996,1998 Andy Dougherty
?RCS: Copyright (c) 1991-1993, 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 3.0.
?RCS:
?RCS: You may distribute under the terms of either the GNU General Public
?RCS: License or the Artistic License, as specified in the README file.
?RCS:
?RCS: $Log: d_sigsetjmp.U,v $
?RCS: Revision 3.0.1.1  1997/02/28  15:44:33  ram
?RCS: patch61: created
?RCS:
?MAKE:d_sigsetjmp: Compile Setvar cat rm_try run i_stdlib
?MAKE:	-pick add $@ %<
?S:d_sigsetjmp:
?S:	This variable conditionally defines the HAS_SIGSETJMP symbol,
?S:	which indicates that the sigsetjmp() routine is available to
?S:	call setjmp() and optionally save the process's signal mask.
?S:.
?C:HAS_SIGSETJMP:
?C:	This variable indicates to the C program that the sigsetjmp()
?C:	routine is available to save the calling process's registers
?C:	and stack environment for later use by siglongjmp(), and
?C:	to optionally save the process's signal mask.  See
?C:	Sigjmp_buf, Sigsetjmp, and Siglongjmp.
?C:.
?C:Sigjmp_buf:
?C:	This is the buffer type to be used with Sigsetjmp and Siglongjmp.
?C:.
?C:Sigsetjmp:
?C:	This macro is used in the same way as sigsetjmp(), but will invoke
?C:	traditional setjmp() if sigsetjmp isn't available.
?C:	See HAS_SIGSETJMP.
?C:.
?C:Siglongjmp:
?C:	This macro is used in the same way as siglongjmp(), but will invoke
?C:	traditional longjmp() if siglongjmp isn't available.
?C:	See HAS_SIGSETJMP.
?C:.
?H:?%<:#$d_sigsetjmp HAS_SIGSETJMP	/**/
?H:?%<:#ifdef HAS_SIGSETJMP
?H:?%<:#define Sigjmp_buf sigjmp_buf
?H:?%<:#define Sigsetjmp(buf,save_mask) sigsetjmp((buf),(save_mask))
?H:?%<:#define Siglongjmp(buf,retval) siglongjmp((buf),(retval))
?H:?%<:#else
?H:?%<:#define Sigjmp_buf jmp_buf
?H:?%<:#define Sigsetjmp(buf,save_mask) setjmp((buf))
?H:?%<:#define Siglongjmp(buf,retval) longjmp((buf),(retval))
?H:?%<:#endif
?H:.
?W:%<:Sigjmp_buf Sigsetjmp Siglongjmp
?F:!try
?LINT:set d_sigsetjmp
: see if sigsetjmp exists
?X: We can't check for these symbols with Inlibc because sigsetjmp
?X: is (sometimes? always?) a macro under GCC
echo " "
case "$d_sigsetjmp" in
'')
	$cat >try.c <<EOP
#include <setjmp.h>
#$i_stdlib I_STDLIB
#ifdef I_STDLIB
#include <stdlib.h>
#endif
sigjmp_buf env;
int set = 1;
int main()
{
	if (sigsetjmp(env,1))
		exit(set);
	set = 0;
	siglongjmp(env, 1);
	exit(1);
}
EOP
	set try
	if eval $compile; then
		if $run ./try >/dev/null 2>&1; then
			echo "POSIX sigsetjmp found." >&4
			val="$define"
		else
			$cat >&4 <<EOM
Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
I'll ignore them.
EOM
			val="$undef"
		fi
	else
		echo "sigsetjmp not found." >&4
		val="$undef"
	fi
	;;
*) val="$d_sigsetjmp"
	case "$d_sigsetjmp" in
	$define) echo "POSIX sigsetjmp found." >&4;;
	$undef) echo "sigsetjmp not found." >&4;;
	esac
	;;
esac
set d_sigsetjmp
eval $setvar
$rm_try

