Bug 1037316 part 1 - Return the same object when updating animations; r=dbaron
[gecko.git] / memory / jemalloc / 0001-Use-a-configure-test-to-detect-whether-to-use-a-cons.patch
blobcec109f34ebe63c3d9b7789138401a87b81c9304
1 diff --git a/configure b/configure
2 --- a/configure
3 +++ b/configure
4 @@ -1905,83 +1905,16 @@ fi
5 # interfere with the next link command; also delete a directory that is
6 # left behind by Apple's compiler. We do this before executing the actions.
7 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
8 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
9 as_fn_set_status $ac_retval
11 } # ac_fn_c_try_link
13 -# ac_fn_c_check_func LINENO FUNC VAR
14 -# ----------------------------------
15 -# Tests whether FUNC exists, setting the cache variable VAR accordingly
16 -ac_fn_c_check_func ()
18 - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
19 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
20 -$as_echo_n "checking for $2... " >&6; }
21 -if eval \${$3+:} false; then :
22 - $as_echo_n "(cached) " >&6
23 -else
24 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
25 -/* end confdefs.h. */
26 -/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
27 - For example, HP-UX 11i <limits.h> declares gettimeofday. */
28 -#define $2 innocuous_$2
30 -/* System header to define __stub macros and hopefully few prototypes,
31 - which can conflict with char $2 (); below.
32 - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
33 - <limits.h> exists even on freestanding compilers. */
35 -#ifdef __STDC__
36 -# include <limits.h>
37 -#else
38 -# include <assert.h>
39 -#endif
41 -#undef $2
43 -/* Override any GCC internal prototype to avoid an error.
44 - Use char because int might match the return type of a GCC
45 - builtin and then its argument prototype would still apply. */
46 -#ifdef __cplusplus
47 -extern "C"
48 -#endif
49 -char $2 ();
50 -/* The GNU C library defines this for functions which it implements
51 - to always fail with ENOSYS. Some functions are actually named
52 - something starting with __ and the normal name is an alias. */
53 -#if defined __stub_$2 || defined __stub___$2
54 -choke me
55 -#endif
57 -int
58 -main ()
60 -return $2 ();
61 - ;
62 - return 0;
64 -_ACEOF
65 -if ac_fn_c_try_link "$LINENO"; then :
66 - eval "$3=yes"
67 -else
68 - eval "$3=no"
69 -fi
70 -rm -f core conftest.err conftest.$ac_objext \
71 - conftest$ac_exeext conftest.$ac_ext
72 -fi
73 -eval ac_res=\$$3
74 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
75 -$as_echo "$ac_res" >&6; }
76 - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
78 -} # ac_fn_c_check_func
80 # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
81 # -------------------------------------------------------
82 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
83 # the include files in INCLUDES and setting the cache variable VAR
84 # accordingly.
85 ac_fn_c_check_header_mongrel ()
87 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
88 @@ -2059,16 +1992,83 @@ fi
89 eval ac_res=\$$3
90 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
91 $as_echo "$ac_res" >&6; }
93 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
95 } # ac_fn_c_check_header_mongrel
97 +# ac_fn_c_check_func LINENO FUNC VAR
98 +# ----------------------------------
99 +# Tests whether FUNC exists, setting the cache variable VAR accordingly
100 +ac_fn_c_check_func ()
102 + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
103 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
104 +$as_echo_n "checking for $2... " >&6; }
105 +if eval \${$3+:} false; then :
106 + $as_echo_n "(cached) " >&6
107 +else
108 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
109 +/* end confdefs.h. */
110 +/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
111 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
112 +#define $2 innocuous_$2
114 +/* System header to define __stub macros and hopefully few prototypes,
115 + which can conflict with char $2 (); below.
116 + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
117 + <limits.h> exists even on freestanding compilers. */
119 +#ifdef __STDC__
120 +# include <limits.h>
121 +#else
122 +# include <assert.h>
123 +#endif
125 +#undef $2
127 +/* Override any GCC internal prototype to avoid an error.
128 + Use char because int might match the return type of a GCC
129 + builtin and then its argument prototype would still apply. */
130 +#ifdef __cplusplus
131 +extern "C"
132 +#endif
133 +char $2 ();
134 +/* The GNU C library defines this for functions which it implements
135 + to always fail with ENOSYS. Some functions are actually named
136 + something starting with __ and the normal name is an alias. */
137 +#if defined __stub_$2 || defined __stub___$2
138 +choke me
139 +#endif
141 +int
142 +main ()
144 +return $2 ();
146 + return 0;
148 +_ACEOF
149 +if ac_fn_c_try_link "$LINENO"; then :
150 + eval "$3=yes"
151 +else
152 + eval "$3=no"
154 +rm -f core conftest.err conftest.$ac_objext \
155 + conftest$ac_exeext conftest.$ac_ext
157 +eval ac_res=\$$3
158 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
159 +$as_echo "$ac_res" >&6; }
160 + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
162 +} # ac_fn_c_check_func
164 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
165 # -------------------------------------------
166 # Tests whether TYPE exists after having included INCLUDES, setting cache
167 # variable VAR accordingly.
168 ac_fn_c_check_type ()
170 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
171 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
172 @@ -4817,17 +4817,16 @@ esac
173 AR=$ac_ct_AR
175 else
176 AR="$ac_cv_prog_AR"
180 default_munmap="1"
181 -JEMALLOC_USABLE_SIZE_CONST="const"
182 case "${host}" in
183 *-*-darwin*)
184 CFLAGS="$CFLAGS"
185 abi="macho"
186 $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
188 RPATH=""
189 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
190 @@ -4850,17 +4849,16 @@ case "${host}" in
191 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
192 abi="elf"
193 $as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
195 $as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h
197 $as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
199 - JEMALLOC_USABLE_SIZE_CONST=""
200 default_munmap="0"
202 *-*-netbsd*)
203 { $as_echo "$as_me:${as_lineno-$LINENO}: checking ABI" >&5
204 $as_echo_n "checking ABI... " >&6; }
205 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
206 /* end confdefs.h. */
207 #ifdef __ELF__
208 @@ -4930,16 +4928,60 @@ rm -f core conftest.err conftest.$ac_obj
209 PIC_CFLAGS=""
212 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported operating system: ${host}" >&5
213 $as_echo "Unsupported operating system: ${host}" >&6; }
214 abi="elf"
216 esac
218 +JEMALLOC_USABLE_SIZE_CONST=const
219 +for ac_header in malloc.h
220 +do :
221 + ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default"
222 +if test "x$ac_cv_header_malloc_h" = xyes; then :
223 + cat >>confdefs.h <<_ACEOF
224 +#define HAVE_MALLOC_H 1
225 +_ACEOF
227 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc_usable_size definition can use const argument" >&5
228 +$as_echo_n "checking whether malloc_usable_size definition can use const argument... " >&6; }
229 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
230 +/* end confdefs.h. */
231 +#include <malloc.h>
232 + #include <stddef.h>
233 + size_t malloc_usable_size(const void *ptr);
235 +int
236 +main ()
240 + return 0;
242 +_ACEOF
243 +if ac_fn_c_try_compile "$LINENO"; then :
245 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
246 +$as_echo "yes" >&6; }
248 +else
250 + JEMALLOC_USABLE_SIZE_CONST=
251 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
252 +$as_echo "no" >&6; }
255 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
259 +done
261 cat >>confdefs.h <<_ACEOF
262 #define JEMALLOC_USABLE_SIZE_CONST $JEMALLOC_USABLE_SIZE_CONST
263 _ACEOF
269 diff --git a/configure.ac b/configure.ac
270 --- a/configure.ac
271 +++ b/configure.ac
272 @@ -253,17 +253,16 @@ AC_PROG_AR
273 dnl Platform-specific settings. abi and RPATH can probably be determined
274 dnl programmatically, but doing so is error-prone, which makes it generally
275 dnl not worth the trouble.
276 dnl
277 dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
278 dnl definitions need to be seen before any headers are included, which is a pain
279 dnl to make happen otherwise.
280 default_munmap="1"
281 -JEMALLOC_USABLE_SIZE_CONST="const"
282 case "${host}" in
283 *-*-darwin*)
284 CFLAGS="$CFLAGS"
285 abi="macho"
286 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
287 RPATH=""
288 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
289 so="dylib"
290 @@ -281,17 +280,16 @@ case "${host}" in
292 *-*-linux*)
293 CFLAGS="$CFLAGS"
294 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
295 abi="elf"
296 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
297 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
298 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
299 - JEMALLOC_USABLE_SIZE_CONST=""
300 default_munmap="0"
302 *-*-netbsd*)
303 AC_MSG_CHECKING([ABI])
304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
305 [[#ifdef __ELF__
306 /* ELF */
307 #else
308 @@ -346,16 +344,32 @@ case "${host}" in
309 SOREV="${so}"
310 PIC_CFLAGS=""
313 AC_MSG_RESULT([Unsupported operating system: ${host}])
314 abi="elf"
316 esac
318 +JEMALLOC_USABLE_SIZE_CONST=const
319 +AC_CHECK_HEADERS([malloc.h], [
320 + AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
321 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
322 + [#include <malloc.h>
323 + #include <stddef.h>
324 + size_t malloc_usable_size(const void *ptr);
325 + ],
326 + [])],[
327 + AC_MSG_RESULT([yes])
328 + ],[
329 + JEMALLOC_USABLE_SIZE_CONST=
330 + AC_MSG_RESULT([no])
331 + ])
333 AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
334 AC_SUBST([abi])
335 AC_SUBST([RPATH])
336 AC_SUBST([LD_PRELOAD_VAR])
337 AC_SUBST([so])
338 AC_SUBST([importlib])
339 AC_SUBST([o])
340 AC_SUBST([a])