Add patch that contain Mali fixes.
[deb_xorg-server.git] / m4 / xorg-tls.m4
CommitLineData
a09e091a
JB
1dnl Copyright © 2011 Apple Inc.
2dnl
3dnl Permission is hereby granted, free of charge, to any person obtaining a
4dnl copy of this software and associated documentation files (the "Software"),
5dnl to deal in the Software without restriction, including without limitation
6dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
7dnl and/or sell copies of the Software, and to permit persons to whom the
8dnl Software is furnished to do so, subject to the following conditions:
9dnl
10dnl The above copyright notice and this permission notice (including the next
11dnl paragraph) shall be included in all copies or substantial portions of the
12dnl Software.
13dnl
14dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20dnl DEALINGS IN THE SOFTWARE.
21dnl
22dnl Authors: Jeremy Huddleston <jeremyhu@apple.com>
23
24AC_DEFUN([XORG_TLS], [
25 AC_REQUIRE([XORG_STRICT_OPTION])
26 AC_MSG_CHECKING(for thread local storage (TLS) support)
27 AC_CACHE_VAL(ac_cv_tls, [
28 ac_cv_tls=none
29 keywords="__thread __declspec(thread)"
30 for kw in $keywords ; do
31 AC_TRY_COMPILE([int $kw test;], [], ac_cv_tls=$kw ; break ;)
32 done
33 ])
34 AC_MSG_RESULT($ac_cv_tls)
35
36 if test "$ac_cv_tls" != "none"; then
37 AC_MSG_CHECKING(for tls_model attribute support)
38 AC_CACHE_VAL(ac_cv_tls_model, [
39 save_CFLAGS="$CFLAGS"
40 CFLAGS="$CFLAGS $STRICT_CFLAGS"
41 AC_TRY_COMPILE([int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;], [],
42 ac_cv_tls_model=yes, ac_cv_tls_model=no)
43 CFLAGS="$save_CFLAGS"
44 ])
45 AC_MSG_RESULT($ac_cv_tls_model)
46
47 if test "x$ac_cv_tls_model" = "xyes" ; then
48 xorg_tls=$ac_cv_tls' __attribute__((tls_model("initial-exec")))'
49 else
50 xorg_tls=$ac_cv_tls
51 fi
52
53 AC_DEFINE_UNQUOTED([TLS], $xorg_tls, [The compiler supported TLS storage class, prefering initial-exec if tls_model is supported])
54 fi
55])