|
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/. |
|
4 |
|
5 dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the |
|
6 dnl user to upgrade. |
|
7 |
|
8 AC_DEFUN([MOZ_LLVM_PR8927], |
|
9 [ |
|
10 AC_MSG_CHECKING(for llvm pr8927) |
|
11 ac_have_llvm_pr8927="no" |
|
12 AC_LANG_SAVE |
|
13 AC_LANG_C |
|
14 |
|
15 _SAVE_CFLAGS=$CFLAGS |
|
16 CFLAGS="-O2" |
|
17 AC_TRY_RUN([ |
|
18 struct foobar { |
|
19 int x; |
|
20 }; |
|
21 static const struct foobar* foo() { |
|
22 static const struct foobar d = { 0 }; |
|
23 return &d; |
|
24 } |
|
25 static const struct foobar* bar() { |
|
26 static const struct foobar d = { 0 }; |
|
27 return &d; |
|
28 } |
|
29 __attribute__((noinline)) int zed(const struct foobar *a, |
|
30 const struct foobar *b) { |
|
31 return a == b; |
|
32 } |
|
33 int main() { |
|
34 return zed(foo(), bar()); |
|
35 } |
|
36 ], true, |
|
37 ac_have_llvm_pr8927="yes", |
|
38 true) |
|
39 CFLAGS="$_SAVE_CFLAGS" |
|
40 |
|
41 AC_LANG_RESTORE |
|
42 |
|
43 if test "$ac_have_llvm_pr8927" = "yes"; then |
|
44 AC_MSG_RESULT(yes) |
|
45 echo This compiler would miscompile firefox, please upgrade. |
|
46 echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites |
|
47 echo for more information. |
|
48 exit 1 |
|
49 else |
|
50 AC_MSG_RESULT(no) |
|
51 fi |
|
52 ]) |