build/autoconf/arch.m4

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 AC_DEFUN([MOZ_ARCH_OPTS],
michael@0 6 [
michael@0 7
michael@0 8 dnl ========================================================
michael@0 9 dnl = ARM toolchain tweaks
michael@0 10 dnl ========================================================
michael@0 11
michael@0 12 MOZ_THUMB=toolchain-default
michael@0 13 MOZ_THUMB_INTERWORK=toolchain-default
michael@0 14 MOZ_FPU=toolchain-default
michael@0 15 MOZ_FLOAT_ABI=toolchain-default
michael@0 16 MOZ_SOFT_FLOAT=toolchain-default
michael@0 17 MOZ_ALIGN=toolchain-default
michael@0 18
michael@0 19 MOZ_ARG_WITH_STRING(arch,
michael@0 20 [ --with-arch=[[type|toolchain-default]]
michael@0 21 Use specific CPU features (-march=type). Resets
michael@0 22 thumb, fpu, float-abi, etc. defaults when set],
michael@0 23 if test -z "$GNU_CC"; then
michael@0 24 AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
michael@0 25 fi
michael@0 26 MOZ_ARCH=$withval)
michael@0 27
michael@0 28 if test -z "$MOZ_ARCH"; then
michael@0 29 dnl Defaults
michael@0 30 case "${CPU_ARCH}-${OS_TARGET}" in
michael@0 31 arm-Android)
michael@0 32 MOZ_THUMB=yes
michael@0 33 MOZ_ARCH=armv7-a
michael@0 34 MOZ_FPU=vfp
michael@0 35 MOZ_FLOAT_ABI=softfp
michael@0 36 MOZ_ALIGN=no
michael@0 37 ;;
michael@0 38 arm-Darwin)
michael@0 39 MOZ_ARCH=toolchain-default
michael@0 40 MOZ_THUMB=yes
michael@0 41 ;;
michael@0 42 esac
michael@0 43 fi
michael@0 44
michael@0 45 if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
michael@0 46 MOZ_FPU=vfp
michael@0 47 fi
michael@0 48
michael@0 49 MOZ_ARG_WITH_STRING(thumb,
michael@0 50 [ --with-thumb[[=yes|no|toolchain-default]]]
michael@0 51 [ Use Thumb instruction set (-mthumb)],
michael@0 52 if test -z "$GNU_CC"; then
michael@0 53 AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
michael@0 54 fi
michael@0 55 MOZ_THUMB=$withval)
michael@0 56
michael@0 57 MOZ_ARG_WITH_STRING(thumb-interwork,
michael@0 58 [ --with-thumb-interwork[[=yes|no|toolchain-default]]
michael@0 59 Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
michael@0 60 if test -z "$GNU_CC"; then
michael@0 61 AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
michael@0 62 fi
michael@0 63 MOZ_THUMB_INTERWORK=$withval)
michael@0 64
michael@0 65 MOZ_ARG_WITH_STRING(fpu,
michael@0 66 [ --with-fpu=[[type|toolchain-default]]
michael@0 67 Use specific FPU type (-mfpu=type)],
michael@0 68 if test -z "$GNU_CC"; then
michael@0 69 AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
michael@0 70 fi
michael@0 71 MOZ_FPU=$withval)
michael@0 72
michael@0 73 MOZ_ARG_WITH_STRING(float-abi,
michael@0 74 [ --with-float-abi=[[type|toolchain-default]]
michael@0 75 Use specific arm float ABI (-mfloat-abi=type)],
michael@0 76 if test -z "$GNU_CC"; then
michael@0 77 AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
michael@0 78 fi
michael@0 79 MOZ_FLOAT_ABI=$withval)
michael@0 80
michael@0 81 MOZ_ARG_WITH_STRING(soft-float,
michael@0 82 [ --with-soft-float[[=yes|no|toolchain-default]]
michael@0 83 Use soft float library (-msoft-float)],
michael@0 84 if test -z "$GNU_CC"; then
michael@0 85 AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
michael@0 86 fi
michael@0 87 MOZ_SOFT_FLOAT=$withval)
michael@0 88
michael@0 89 case "$MOZ_ARCH" in
michael@0 90 toolchain-default|"")
michael@0 91 arch_flag=""
michael@0 92 ;;
michael@0 93 *)
michael@0 94 arch_flag="-march=$MOZ_ARCH"
michael@0 95 ;;
michael@0 96 esac
michael@0 97
michael@0 98 case "$MOZ_THUMB" in
michael@0 99 yes)
michael@0 100 MOZ_THUMB2=1
michael@0 101 thumb_flag="-mthumb"
michael@0 102 ;;
michael@0 103 no)
michael@0 104 MOZ_THUMB2=
michael@0 105 thumb_flag="-marm"
michael@0 106 ;;
michael@0 107 *)
michael@0 108 _SAVE_CFLAGS="$CFLAGS"
michael@0 109 CFLAGS="$arch_flag"
michael@0 110 AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
michael@0 111 MOZ_THUMB2=1,
michael@0 112 MOZ_THUMB2=)
michael@0 113 CFLAGS="$_SAVE_CFLAGS"
michael@0 114 thumb_flag=""
michael@0 115 ;;
michael@0 116 esac
michael@0 117
michael@0 118 if test "$MOZ_THUMB2" = 1; then
michael@0 119 AC_DEFINE(MOZ_THUMB2)
michael@0 120 fi
michael@0 121
michael@0 122 case "$MOZ_THUMB_INTERWORK" in
michael@0 123 yes)
michael@0 124 thumb_interwork_flag="-mthumb-interwork"
michael@0 125 ;;
michael@0 126 no)
michael@0 127 thumb_interwork_flag="-mno-thumb-interwork"
michael@0 128 ;;
michael@0 129 *) # toolchain-default
michael@0 130 thumb_interwork_flag=""
michael@0 131 ;;
michael@0 132 esac
michael@0 133
michael@0 134 case "$MOZ_FPU" in
michael@0 135 toolchain-default|"")
michael@0 136 fpu_flag=""
michael@0 137 ;;
michael@0 138 *)
michael@0 139 fpu_flag="-mfpu=$MOZ_FPU"
michael@0 140 ;;
michael@0 141 esac
michael@0 142
michael@0 143 case "$MOZ_FLOAT_ABI" in
michael@0 144 toolchain-default|"")
michael@0 145 float_abi_flag=""
michael@0 146 ;;
michael@0 147 *)
michael@0 148 float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
michael@0 149 ;;
michael@0 150 esac
michael@0 151
michael@0 152 case "$MOZ_SOFT_FLOAT" in
michael@0 153 yes)
michael@0 154 soft_float_flag="-msoft-float"
michael@0 155 ;;
michael@0 156 no)
michael@0 157 soft_float_flag="-mno-soft-float"
michael@0 158 ;;
michael@0 159 *) # toolchain-default
michael@0 160 soft_float_flag=""
michael@0 161 ;;
michael@0 162 esac
michael@0 163
michael@0 164 case "$MOZ_ALIGN" in
michael@0 165 no)
michael@0 166 align_flag="-mno-unaligned-access"
michael@0 167 ;;
michael@0 168 yes)
michael@0 169 align_flag="-munaligned-access"
michael@0 170 ;;
michael@0 171 *)
michael@0 172 align_flag=""
michael@0 173 ;;
michael@0 174 esac
michael@0 175
michael@0 176 if test -n "$align_flag"; then
michael@0 177 _SAVE_CFLAGS="$CFLAGS"
michael@0 178 CFLAGS="$CFLAGS $align_flag"
michael@0 179 AC_MSG_CHECKING(whether alignment flag ($align_flag) is supported)
michael@0 180 AC_TRY_COMPILE([],[],,align_flag="")
michael@0 181 CFLAGS="$_SAVE_CFLAGS"
michael@0 182 fi
michael@0 183
michael@0 184 dnl Use echo to avoid accumulating space characters
michael@0 185 all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag $align_flag`
michael@0 186 if test -n "$all_flags"; then
michael@0 187 _SAVE_CFLAGS="$CFLAGS"
michael@0 188 CFLAGS="$all_flags"
michael@0 189 AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
michael@0 190 AC_TRY_COMPILE([],[return 0;],
michael@0 191 AC_MSG_RESULT([yes]),
michael@0 192 AC_MSG_ERROR([no]))
michael@0 193
michael@0 194 CFLAGS="$_SAVE_CFLAGS $all_flags"
michael@0 195 CXXFLAGS="$CXXFLAGS $all_flags"
michael@0 196 ASFLAGS="$ASFLAGS $all_flags"
michael@0 197 if test -n "$thumb_flag"; then
michael@0 198 LDFLAGS="$LDFLAGS $thumb_flag"
michael@0 199 fi
michael@0 200 fi
michael@0 201
michael@0 202 AC_SUBST(MOZ_THUMB2)
michael@0 203
michael@0 204 if test "$CPU_ARCH" = "arm"; then
michael@0 205 AC_MSG_CHECKING(for ARM SIMD support in compiler)
michael@0 206 # We try to link so that this also fails when
michael@0 207 # building with LTO.
michael@0 208 AC_TRY_LINK([],
michael@0 209 [asm("uqadd8 r1, r1, r2");],
michael@0 210 result="yes", result="no")
michael@0 211 AC_MSG_RESULT("$result")
michael@0 212 if test "$result" = "yes"; then
michael@0 213 AC_DEFINE(HAVE_ARM_SIMD)
michael@0 214 HAVE_ARM_SIMD=1
michael@0 215 fi
michael@0 216
michael@0 217 AC_MSG_CHECKING(ARM version support in compiler)
michael@0 218 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
michael@0 219 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]][[0-9]]*\).*/\1/p'`
michael@0 220 AC_MSG_RESULT("$ARM_ARCH")
michael@0 221
michael@0 222 AC_MSG_CHECKING(for ARM NEON support in compiler)
michael@0 223 # We try to link so that this also fails when
michael@0 224 # building with LTO.
michael@0 225 AC_TRY_LINK([],
michael@0 226 [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
michael@0 227 result="yes", result="no")
michael@0 228 AC_MSG_RESULT("$result")
michael@0 229 if test "$result" = "yes"; then
michael@0 230 AC_DEFINE(HAVE_ARM_NEON)
michael@0 231 HAVE_ARM_NEON=1
michael@0 232
michael@0 233 dnl We don't need to build NEON support if we're targetting a non-NEON device.
michael@0 234 dnl This matches media/webrtc/trunk/webrtc/build/common.gypi.
michael@0 235 if test -n "$ARM_ARCH"; then
michael@0 236 if test "$ARM_ARCH" -lt 7; then
michael@0 237 BUILD_ARM_NEON=
michael@0 238 else
michael@0 239 AC_DEFINE(BUILD_ARM_NEON)
michael@0 240 BUILD_ARM_NEON=1
michael@0 241 fi
michael@0 242 fi
michael@0 243 fi
michael@0 244
michael@0 245 fi # CPU_ARCH = arm
michael@0 246
michael@0 247 AC_SUBST(HAVE_ARM_SIMD)
michael@0 248 AC_SUBST(HAVE_ARM_NEON)
michael@0 249 AC_SUBST(BUILD_ARM_NEON)
michael@0 250 AC_SUBST(ARM_ARCH)
michael@0 251
michael@0 252 if test -n "$MOZ_ARCH"; then
michael@0 253 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
michael@0 254 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb=$MOZ_THUMB"
michael@0 255 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb-interwork=$MOZ_THUMB_INTERWORK"
michael@0 256 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-fpu=$MOZ_FPU"
michael@0 257 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-float-abi=$MOZ_FLOAT_ABI"
michael@0 258 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-soft-float=$MOZ_SOFT_FLOAT"
michael@0 259 fi
michael@0 260
michael@0 261 ])

mercurial