build: initialize ARCH variable in tests-m*32/Makefile.am files properly

* configure.ac (arch_m32): Set to sparc on sparc64, powerpc on
powerpc64, arm on aarch64, i386 on x86_64 and x32, $arch in other cases.
(arch_mx32): Set to x32 on x86_64, $arch in other cases.
(AC_SUBST): Add arch_m32 and arch_mx32.
* bootstrap: Substitute @arch@ with @arch_m32@ in tests-m32/Makefile.am.
Substitute @arch@ with @arch_mx32@ in tests-mx32/Makefile.am.
This commit is contained in:
2015-12-08 00:13:38 +00:00
parent 08a178366a
commit 1e04e57a7a
2 changed files with 16 additions and 3 deletions

View File

@ -1,10 +1,10 @@
#!/bin/sh -eu
for m in -m32 -mx32; do
tests=tests$m
for m in m32 mx32; do
tests=tests-$m
rm -rf $tests
mkdir $tests
sed "s/^AM_CFLAGS[[:space:]]*=.*/& $m/" \
sed "s/@arch@/@arch_$m@/;s/^AM_CFLAGS[[:space:]]*=.*/& -$m/" \
tests/Makefile.am > $tests/Makefile.am
for f in tests/*; do
case "${f##*/}" in

View File

@ -16,6 +16,8 @@ AC_USE_SYSTEM_EXTENSIONS
AC_PROG_RANLIB
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
case "$host_cpu" in
bfin)
arch=bfin
@ -35,6 +37,7 @@ m68k)
;;
sparc64*)
arch=sparc64
arch_m32=sparc
AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
;;
sparc*)
@ -60,6 +63,7 @@ powerpc*)
# error 32 bit
#endif], [], arch=powerpc64, arch=powerpc)
if test "$arch" = "powerpc64"; then
arch_m32=powerpc
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
@ -69,6 +73,7 @@ arm*)
;;
aarch64*)
arch=aarch64
arch_m32=arm
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
avr32*)
@ -100,11 +105,13 @@ sh*)
AC_DEFINE([SH], 1, [Define for the SH architecture.])
;;
x86?64*)
arch_m32=i386
AC_TRY_COMPILE(
[#ifndef __ILP32__
# error not x32
#endif], [], arch=x32, arch=x86_64)
if test "$arch" = "x86_64"; then
arch_mx32=x32
AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
else
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
@ -148,7 +155,13 @@ xtensa*)
esac
AC_MSG_RESULT($arch)
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
arch_mx32=$arch
AC_SUBST(arch)
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
if test "$arch" = mips; then
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],