?RCS: $Id: alignbytes.U,v 3.0.1.2 1994/10/29 16:02:28 ram Exp $
?RCS:
?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: $Log: alignbytes.U,v $
?RCS: Revision 3.0.1.2  1994/10/29  16:02:28  ram
?RCS: patch36: added ?F: line for metalint file checking
?RCS:
?RCS: Revision 3.0.1.1  1994/05/06  14:25:20  ram
?RCS: patch23: avoid ALIGNBYTES, since it conflicts on NetBSD
?RCS:
?RCS: Revision 3.0  1993/08/18  12:05:23  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:alignbytes: Myread Compile cat rm_try multiarch run test nvtype
?MAKE:	-pick add $@ %<
?S:alignbytes:
?S:	This variable holds the number of bytes required to align a
?S:	double-- or a long double when applicable. Usual values are
?S:	2, 4 and 8.  The default is eight, for safety.
?S:.
?X: This used to be called ALIGNBYTES, but that conflicts with
?X: <machines/param.h> in NetBSD.
?C:MEM_ALIGNBYTES (ALIGNBYTES):
?C:	This symbol contains the number of bytes required to align a
?C:	double, or a long double when applicable. Usual values are 2,
?C:	4 and 8. The default is eight, for safety.  For cross-compiling
?C:	or multiarch support, Configure will set a minimum of 8.
?C:.
?H:?%<:#define MEM_ALIGNBYTES $alignbytes
?H:.
?F:!try
: check for alignment requirements
echo " "
case "$alignbytes" in
    '') echo "Checking alignment constraints..." >&4
	$cat >try.c <<EOCP
#include <stdio.h>
struct foobar {
    char foo;
    $nvtype bar;
} try_algn;
int main()
{
    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
    return(0);
}
EOCP
	set try
	if eval $compile_ok; then
	    dflt=`$run ./try`
	else
	    dflt='8'
	    echo "(I can't seem to compile the test program...)"
	fi
	case "$multiarch" in
	    *$define*)
		: The usual safe value is 8, but Darwin with -Duselongdouble
		: needs 16.  Hence, we will take 8 as a minimum, but allow
		: Configure to pick a larger value if needed.
		if $test "$dflt" -lt 8; then
		    dflt='8'
		    echo "Setting alignment to 8 for multiarch support.">&4
		fi
		;;
	esac
	;;
    *) dflt="$alignbytes"
	;;
esac
rp="Doubles must be aligned on a how-many-byte boundary?"
. ./myread
alignbytes="$ans"
$rm_try

