?RCS: $Id: d_sigsetjmp.U 1 2006-08-24 12:32:52Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1996, Andy Dougherty
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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 Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.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: Setvar cat +cc +ccflags +ldflags libs rm
?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:!set
?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 >set.c <<'EOP'
#include <setjmp.h>
sigjmp_buf env;
int set = 1;
int main()
{
	if (sigsetjmp(env,1))
		exit(set);
	set = 0;
	siglongjmp(env, 1);
	exit(1);
}
EOP
	if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then
		if ./set >/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 -f set.c set

