Commit | Line | Data |
85e6fe83 |
1 | ?RCS: $Id: alignbytes.U,v 3.0 1993/08/18 12:05:23 ram Exp $ |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi |
4 | ?RCS: |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, |
6 | ?RCS: as specified in the README file that comes with the distribution. |
7 | ?RCS: You may reuse parts of this distribution only within the terms of |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root |
9 | ?RCS: of the source tree for dist 3.0. |
10 | ?RCS: |
11 | ?RCS: $Log: alignbytes.U,v $ |
12 | ?RCS: Revision 3.0 1993/08/18 12:05:23 ram |
13 | ?RCS: Baseline for dist 3.0 netwide release. |
14 | ?RCS: |
15 | ?MAKE:memalignbytes: Myread cat cc ccflags rm |
16 | ?MAKE: -pick add $@ %< |
17 | ?S:memalignbytes: |
18 | ?S: This variable holds the number of bytes required to align a |
19 | ?S: double. Usual values are 2, 4 and 8. |
20 | ?S:. |
21 | ?X: This used to be called ALIGNBYTES, but that conflicts with |
22 | ?X: <machines/param.h> in NetBSD. |
23 | ?C:MEM_ALIGNBYTES (ALIGNBYTES): |
24 | ?C: This symbol contains the number of bytes required to align a |
25 | ?C: double. Usual values are 2, 4 and 8. |
26 | ?C:. |
27 | ?H:#define MEM_ALIGNBYTES $memalignbytes /**/ |
28 | ?H:. |
29 | : check for alignment requirements |
30 | echo " " |
31 | case "$memalignbytes" in |
32 | '') echo "Checking alignment constraints..." >&4 |
33 | $cat >try.c <<'EOCP' |
34 | struct foobar { |
35 | char foo; |
36 | double bar; |
37 | } try; |
38 | main() |
39 | { |
40 | printf("%d\n", (char *)&try.bar - (char *)&try.foo); |
41 | } |
42 | EOCP |
43 | if $cc $ccflags try.c -o try >/dev/null 2>&1; then |
44 | dflt=`./try` |
45 | else |
46 | dflt='8' |
47 | echo"(I can't seem to compile the test program...)" |
48 | fi |
49 | ;; |
50 | *) dflt="$memalignbytes" |
51 | ;; |
52 | esac |
53 | rp="Doubles must be aligned on a how-many-byte boundary?" |
54 | . ./myread |
55 | memalignbytes="$ans" |
56 | $rm -f try.c try |
57 | |