1
dnl This Source Code Form is subject to the terms of the Mozilla Public
2
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
AC_DEFUN([MOZ_ARCH_OPTS],
8
dnl ========================================================
9
dnl = ARM toolchain tweaks
10
dnl ========================================================
12
MOZ_THUMB=toolchain-default
13
MOZ_THUMB_INTERWORK=toolchain-default
14
MOZ_FPU=toolchain-default
15
MOZ_FLOAT_ABI=toolchain-default
16
MOZ_SOFT_FLOAT=toolchain-default
18
MOZ_ARG_WITH_STRING(arch,
19
[ --with-arch=[[type|toolchain-default]]
20
Use specific CPU features (-march=type). Resets
21
thumb, fpu, float-abi, etc. defaults when set],
22
if test -z "$GNU_CC"; then
23
AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
27
if test -z "$MOZ_ARCH"; then
29
case "${CPU_ARCH}-${OS_TARGET}" in
37
MOZ_ARCH=toolchain-default
41
if test -n "$MOZ_PLATFORM_MAEMO"; then
46
if test "$MOZ_PLATFORM_MAEMO" = 6; then
53
if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
57
MOZ_ARG_WITH_STRING(thumb,
58
[ --with-thumb[[=yes|no|toolchain-default]]]
59
[ Use Thumb instruction set (-mthumb)],
60
if test -z "$GNU_CC"; then
61
AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
65
MOZ_ARG_WITH_STRING(thumb-interwork,
66
[ --with-thumb-interwork[[=yes|no|toolchain-default]]
67
Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
68
if test -z "$GNU_CC"; then
69
AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
71
MOZ_THUMB_INTERWORK=$withval)
73
MOZ_ARG_WITH_STRING(fpu,
74
[ --with-fpu=[[type|toolchain-default]]
75
Use specific FPU type (-mfpu=type)],
76
if test -z "$GNU_CC"; then
77
AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
81
MOZ_ARG_WITH_STRING(float-abi,
82
[ --with-float-abi=[[type|toolchain-default]]
83
Use specific arm float ABI (-mfloat-abi=type)],
84
if test -z "$GNU_CC"; then
85
AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
87
MOZ_FLOAT_ABI=$withval)
89
MOZ_ARG_WITH_STRING(soft-float,
90
[ --with-soft-float[[=yes|no|toolchain-default]]
91
Use soft float library (-msoft-float)],
92
if test -z "$GNU_CC"; then
93
AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
95
MOZ_SOFT_FLOAT=$withval)
102
arch_flag="-march=$MOZ_ARCH"
116
_SAVE_CFLAGS="$CFLAGS"
118
AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
121
CFLAGS="$_SAVE_CFLAGS"
126
if test "$MOZ_THUMB2" = 1; then
127
AC_DEFINE(MOZ_THUMB2)
130
case "$MOZ_THUMB_INTERWORK" in
132
thumb_interwork_flag="-mthumb-interwork"
135
thumb_interwork_flag="-mno-thumb-interwork"
137
*) # toolchain-default
138
thumb_interwork_flag=""
143
toolchain-default|"")
147
fpu_flag="-mfpu=$MOZ_FPU"
151
case "$MOZ_FLOAT_ABI" in
152
toolchain-default|"")
156
float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
160
case "$MOZ_SOFT_FLOAT" in
162
soft_float_flag="-msoft-float"
165
soft_float_flag="-mno-soft-float"
167
*) # toolchain-default
172
dnl Use echo to avoid accumulating space characters
173
all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
174
if test -n "$all_flags"; then
175
_SAVE_CFLAGS="$CFLAGS"
177
AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
178
AC_TRY_COMPILE([],[return 0;],
179
AC_MSG_RESULT([yes]),
182
CFLAGS="$_SAVE_CFLAGS $all_flags"
183
CXXFLAGS="$CXXFLAGS $all_flags"
184
ASFLAGS="$ASFLAGS $all_flags"
185
if test -n "$thumb_flag"; then
186
LDFLAGS="$LDFLAGS $thumb_flag"
192
if test "$CPU_ARCH" = "arm"; then
193
AC_MSG_CHECKING(for ARM SIMD support in compiler)
194
# We try to link so that this also fails when
197
[asm("uqadd8 r1, r1, r2");],
198
result="yes", result="no")
199
AC_MSG_RESULT("$result")
200
if test "$result" = "yes"; then
201
AC_DEFINE(HAVE_ARM_SIMD)
205
AC_MSG_CHECKING(for ARM NEON support in compiler)
206
# We try to link so that this also fails when
209
[asm(".fpu neon\n vadd.i8 d0, d0, d0");],
210
result="yes", result="no")
211
AC_MSG_RESULT("$result")
212
if test "$result" = "yes"; then
213
AC_DEFINE(HAVE_ARM_NEON)
218
AC_SUBST(HAVE_ARM_SIMD)
219
AC_SUBST(HAVE_ARM_NEON)
221
if test -n "$MOZ_ARCH"; then
222
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
223
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb=$MOZ_THUMB"
224
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb-interwork=$MOZ_THUMB_INTERWORK"
225
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-fpu=$MOZ_FPU"
226
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-float-abi=$MOZ_FLOAT_ABI"
227
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-soft-float=$MOZ_SOFT_FLOAT"