Sat, 03 Jan 2015 20:18:00 +0100
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.
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_ANDROID_NDK],
6 [
8 MOZ_ARG_WITH_STRING(android-ndk,
9 [ --with-android-ndk=DIR
10 location where the Android NDK can be found],
11 android_ndk=$withval)
13 MOZ_ARG_WITH_STRING(android-toolchain,
14 [ --with-android-toolchain=DIR
15 location of the android toolchain],
16 android_toolchain=$withval)
18 MOZ_ARG_WITH_STRING(android-gnu-compiler-version,
19 [ --with-android-gnu-compiler-version=VER
20 gnu compiler version to use],
21 android_gnu_compiler_version=$withval)
23 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
24 [ --enable-android-libstdcxx
25 use GNU libstdc++ instead of STLPort],
26 MOZ_ANDROID_LIBSTDCXX=1,
27 MOZ_ANDROID_LIBSTDCXX= )
29 define([MIN_ANDROID_VERSION], [9])
30 android_version=MIN_ANDROID_VERSION
32 MOZ_ARG_WITH_STRING(android-version,
33 [ --with-android-version=VER
34 android platform version, default] MIN_ANDROID_VERSION,
35 android_version=$withval)
37 if test $android_version -lt MIN_ANDROID_VERSION ; then
38 AC_MSG_ERROR([--with-android-version must be at least MIN_ANDROID_VERSION.])
39 fi
41 case "$target" in
42 arm-linux*-android*|*-linuxandroid*)
43 android_tool_prefix="arm-linux-androideabi"
44 ;;
45 i?86-*android*)
46 android_tool_prefix="i686-linux-android"
47 ;;
48 mipsel-*android*)
49 android_tool_prefix="mipsel-linux-android"
50 ;;
51 *)
52 android_tool_prefix="$target_os"
53 ;;
54 esac
56 case "$target" in
57 *-android*|*-linuxandroid*)
58 if test -z "$android_ndk" ; then
59 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
60 fi
62 if test -z "$android_toolchain" ; then
63 AC_MSG_CHECKING([for android toolchain directory])
65 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
67 for version in $android_gnu_compiler_version 4.7 4.6 4.4.3 ; do
68 case "$target_cpu" in
69 arm)
70 target_name=arm-linux-androideabi-$version
71 ;;
72 i?86)
73 target_name=x86-$version
74 ;;
75 mipsel)
76 target_name=mipsel-linux-android-$version
77 ;;
78 *)
79 AC_MSG_ERROR([target cpu is not supported])
80 ;;
81 esac
82 case "$host_cpu" in
83 i*86)
84 android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
85 ;;
86 x86_64)
87 android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86_64
88 if ! test -d "$android_toolchain" ; then
89 android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
90 fi
91 ;;
92 *)
93 AC_MSG_ERROR([No known toolchain for your host cpu])
94 ;;
95 esac
96 if test -d "$android_toolchain" ; then
97 android_gnu_compiler_version=$version
98 break
99 elif test -n "$android_gnu_compiler_version" ; then
100 AC_MSG_ERROR([not found. Your --with-android-gnu-compiler-version may be wrong.])
101 fi
102 done
104 if test -z "$android_gnu_compiler_version" ; then
105 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
106 else
107 AC_MSG_RESULT([$android_toolchain])
108 fi
109 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-android-toolchain=$android_toolchain"
110 fi
112 NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-android-version=$android_version"
114 AC_MSG_CHECKING([for android platform directory])
116 case "$target_cpu" in
117 arm)
118 target_name=arm
119 ;;
120 i?86)
121 target_name=x86
122 ;;
123 mipsel)
124 target_name=mips
125 ;;
126 esac
128 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
130 if test -d "$android_platform" ; then
131 AC_MSG_RESULT([$android_platform])
132 else
133 AC_MSG_ERROR([not found. Please check your NDK. With the current configuration, it should be in $android_platform])
134 fi
136 dnl Old NDK support. If minimum requirement is changed to NDK r8b,
137 dnl please remove this.
138 case "$target_cpu" in
139 i?86)
140 if ! test -e "$android_toolchain"/bin/"$android_tool_prefix"-gcc; then
141 dnl Old NDK toolchain name
142 android_tool_prefix="i686-android-linux"
143 fi
144 ;;
145 esac
147 dnl set up compilers
148 TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
149 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
150 if test -z "$CC"; then
151 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
152 fi
153 if test -z "$CXX"; then
154 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
155 fi
156 if test -z "$CPP"; then
157 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
158 fi
159 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
160 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
161 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
162 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
163 OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
165 CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
166 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
167 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS"
168 ASFLAGS="-idirafter $android_platform/usr/include -DANDROID $ASFLAGS"
170 dnl Add -llog by default, since we use it all over the place.
171 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
172 dnl undefined symbol (present on the hardware, just not in the
173 dnl NDK.)
174 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
175 dnl prevent cross compile section from using these flags as host flags
176 if test -z "$HOST_CPPFLAGS" ; then
177 HOST_CPPFLAGS=" "
178 fi
179 if test -z "$HOST_CFLAGS" ; then
180 HOST_CFLAGS=" "
181 fi
182 if test -z "$HOST_CXXFLAGS" ; then
183 HOST_CXXFLAGS=" "
184 fi
185 if test -z "$HOST_LDFLAGS" ; then
186 HOST_LDFLAGS=" "
187 fi
189 ANDROID_NDK="${android_ndk}"
190 ANDROID_TOOLCHAIN="${android_toolchain}"
191 ANDROID_PLATFORM="${android_platform}"
193 AC_DEFINE(ANDROID)
194 AC_SUBST(ANDROID_NDK)
195 AC_SUBST(ANDROID_TOOLCHAIN)
196 AC_SUBST(ANDROID_PLATFORM)
198 ;;
199 esac
201 ])
203 AC_DEFUN([MOZ_ANDROID_STLPORT],
204 [
206 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
207 case "${CPU_ARCH}-${MOZ_ARCH}" in
208 arm-armv7*)
209 ANDROID_CPU_ARCH=armeabi-v7a
210 ;;
211 arm-*)
212 ANDROID_CPU_ARCH=armeabi
213 ;;
214 x86-*)
215 ANDROID_CPU_ARCH=x86
216 ;;
217 mips-*) # When target_cpu is mipsel, CPU_ARCH is mips
218 ANDROID_CPU_ARCH=mips
219 ;;
220 esac
222 AC_SUBST(ANDROID_CPU_ARCH)
224 if test -z "$STLPORT_CPPFLAGS$STLPORT_LDFLAGS$STLPORT_LIBS"; then
225 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
226 if test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/libgnustl_static.a"; then
227 # android-ndk-r8b
228 STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/ -lgnustl_static"
229 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/include/backward"
230 elif test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libgnustl_static.a"; then
231 # android-ndk-r7, android-ndk-r7b, android-ndk-r8
232 STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/ -lgnustl_static"
233 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include"
234 elif test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a"; then
235 # android-ndk-r5c, android-ndk-r6, android-ndk-r6b
236 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include"
237 STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/ -lstdc++"
238 else
239 AC_MSG_ERROR([Couldn't find path to gnu-libstdc++ in the android ndk])
240 fi
241 else
242 STLPORT_CPPFLAGS="-isystem $_topsrcdir/build/stlport/stlport -isystem $android_ndk/sources/cxx-stl/system/include"
243 STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a -static-libstdc++"
244 fi
245 fi
246 CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
247 fi
248 AC_SUBST([MOZ_ANDROID_LIBSTDCXX])
249 AC_SUBST([STLPORT_LIBS])
251 ])
253 AC_DEFUN([MOZ_ANDROID_SDK],
254 [
256 MOZ_ARG_WITH_STRING(android-sdk,
257 [ --with-android-sdk=DIR
258 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
259 android_sdk=$withval)
261 android_sdk_root=${withval%/platforms/android-*}
263 case "$target" in
264 *-android*|*-linuxandroid*)
265 if test -z "$android_sdk" ; then
266 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
267 else
268 if ! test -e "$android_sdk"/source.properties ; then
269 AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
270 fi
272 # Get the api level from "$android_sdk"/source.properties.
273 ANDROID_TARGET_SDK=`$AWK -F = changequote(<<, >>)'<<$>>1 == "AndroidVersion.ApiLevel" {print <<$>>2}'changequote([, ]) "$android_sdk"/source.properties`
275 if test -z "$ANDROID_TARGET_SDK" ; then
276 AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
277 fi
279 AC_DEFINE_UNQUOTED(ANDROID_TARGET_SDK,$ANDROID_TARGET_SDK)
280 AC_SUBST(ANDROID_TARGET_SDK)
282 if ! test "$ANDROID_TARGET_SDK" -eq "$ANDROID_TARGET_SDK" ; then
283 AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $ANDROID_TARGET_SDK)])
284 fi
286 if test $ANDROID_TARGET_SDK -lt $1 ; then
287 AC_MSG_ERROR([The given Android SDK provides API level $ANDROID_TARGET_SDK ($1 or higher required).])
288 fi
289 fi
291 android_tools="$android_sdk_root"/tools
292 android_platform_tools="$android_sdk_root"/platform-tools
293 if test ! -d "$android_platform_tools" ; then
294 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
295 fi
297 dnl The build tools got moved around to different directories in SDK
298 dnl Tools r22. Try to locate them. This is awful, but, from
299 dnl http://stackoverflow.com/a/4495368, the following sorts versions
300 dnl of the form x.y.z.a.b from newest to oldest:
301 dnl sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr
302 dnl We want to favour the newer versions that start with 'android-';
303 dnl that's what the sed is about.
304 dnl We might iterate over directories that aren't build-tools at all;
305 dnl we use the presence of aapt as a marker.
306 AC_MSG_CHECKING([for android build-tools directory])
307 android_build_tools=""
308 for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
309 tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
310 if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
311 android_build_tools="$tools_directory"
312 break
313 fi
314 done
315 if test -z "$android_build_tools" ; then
316 android_build_tools="$android_platform_tools" # SDK Tools < r22
317 fi
319 if test -d "$android_build_tools" -a -f "$android_build_tools/aapt"; then
320 AC_MSG_RESULT([$android_build_tools])
321 else
322 AC_MSG_ERROR([not found. Please check your SDK for the subdirectory of build-tools. With the current configuration, it should be in $android_sdk_root/build_tools])
323 fi
325 ANDROID_SDK="${android_sdk}"
326 ANDROID_SDK_ROOT="${android_sdk_root}"
327 if test -e "${ANDROID_SDK_ROOT}/extras/android/compatibility/v4/android-support-v4.jar" ; then
328 ANDROID_COMPAT_LIB="${ANDROID_SDK_ROOT}/extras/android/compatibility/v4/android-support-v4.jar"
329 else
330 ANDROID_COMPAT_LIB="${ANDROID_SDK_ROOT}/extras/android/support/v4/android-support-v4.jar";
331 fi
332 ANDROID_TOOLS="${android_tools}"
333 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
334 ANDROID_BUILD_TOOLS="${android_build_tools}"
335 AC_SUBST(ANDROID_SDK_ROOT)
336 AC_SUBST(ANDROID_SDK)
337 AC_SUBST(ANDROID_COMPAT_LIB)
338 if ! test -e $ANDROID_COMPAT_LIB ; then
339 AC_MSG_ERROR([You must download the Android support library when targeting Android. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
340 fi
342 dnl Google has a history of moving the Android tools around. We don't
343 dnl care where they are, so let's try to find them anywhere we can.
344 ALL_ANDROID_TOOLS_PATHS="$ANDROID_TOOLS:$ANDROID_BUILD_TOOLS:$ANDROID_PLATFORM_TOOLS"
345 MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ALL_ANDROID_TOOLS_PATHS])
346 MOZ_PATH_PROG(DX, dx, :, [$ALL_ANDROID_TOOLS_PATHS])
347 MOZ_PATH_PROG(AAPT, aapt, :, [$ALL_ANDROID_TOOLS_PATHS])
348 MOZ_PATH_PROG(AIDL, aidl, :, [$ALL_ANDROID_TOOLS_PATHS])
349 MOZ_PATH_PROG(ADB, adb, :, [$ALL_ANDROID_TOOLS_PATHS])
351 if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
352 AC_MSG_ERROR([The program zipalign was not found. Use --with-android-sdk={android-sdk-dir}.])
353 fi
354 if test -z "$DX" -o "$DX" = ":"; then
355 AC_MSG_ERROR([The program dx was not found. Use --with-android-sdk={android-sdk-dir}.])
356 fi
357 if test -z "$AAPT" -o "$AAPT" = ":"; then
358 AC_MSG_ERROR([The program aapt was not found. Use --with-android-sdk={android-sdk-dir}.])
359 fi
360 if test -z "$AIDL" -o "$AIDL" = ":"; then
361 AC_MSG_ERROR([The program aidl was not found. Use --with-android-sdk={android-sdk-dir}.])
362 fi
363 if test -z "$ADB" -o "$ADB" = ":"; then
364 AC_MSG_ERROR([The program adb was not found. Use --with-android-sdk={android-sdk-dir}.])
365 fi
366 ;;
367 esac
369 ])