The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
?RCS: $Id: d_bsdjmp.U,v 3.0.1.2 1997/02/28 15:31:10 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, 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 3.0.
?RCS:
?RCS: $Log: d_bsdjmp.U,v $
?RCS: Revision 3.0.1.2  1997/02/28  15:31:10  ram
?RCS: patch61: added ?F: metalint hint
?RCS:
?RCS: Revision 3.0.1.1  1994/10/29  16:09:09  ram
?RCS: patch36: call ./usg explicitely instead of relying on PATH
?RCS:
?RCS: Revision 3.0  1993/08/18  12:05:45  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_bsdjmp: Guess Setvar cat +cc libs rm
?MAKE:	-pick add $@ %<
?S:d_bsdjmp:
?S:	This variable conditionally defines USE_BSDJMP if BSD _setjmp and
?S:	_longjmp routines are available to do non-local gotos without saving
?S:	or restoring the signal mask flag.
?S:.
?C:USE_BSDJMP (BSDJMP):
?C:	This symbol, if defined, indicates that the BSD _setjmp and _longjmp
?C:	routines are available to do non-local gotos wihtout saving or restoring
?C:	the signal mask flag.
?C:.
?H:#$d_bsdjmp USE_BSDJMP		/**/
?H:.
?F:!set
?LINT:set d_bsdjmp
: see if _setjmp and _longjmp exists
?X: We can't check for these symbols with Inlibc because of the leading "_"
echo " "
case "$d_bsdjmp" in
'')
	$cat >set.c <<EOP
#include <setjmp.h>
jmp_buf env;
int set = 1;
main()
{
	if (_setjmp(env))
		exit(set);
	set = 0;
	_longjmp(env, 1);
	exit(1);
}
EOP
	if $cc set.c -o set $libs >/dev/null 2>&1; then
		if ./set >/dev/null 2>&1; then
			echo "Good! You have BSD _setjmp and _longjmp routines." >&4
			val="$define"
		else
			$cat <<EOM
Uh-Oh! You have BSD _setjmp and _longjmp, but they do not work properly!!
EOM
			val="$undef"
		fi
	else
		if ./usg; then
			echo "You do not have _setjmp and _longjmp, but that's fine." >&4
		else
			cat <<EOM
It sounds strange for a BSD system to miss _setjmp and _longjmp, but that's ok.
EOM
		fi
		val="$undef"
	fi
	;;
*) val="$d_bsdjmp"
	case "$d_bsdjmp" in
	$define) echo "Good! You have BSD _setjmp and _longjmp routines." >&4;;
	$undef) echo "You do not have _setjmp and _longjmp, but that's fine." >&4;;
	esac
	;;
esac
set d_bsdjmp
eval $setvar
$rm -f set.c set