build/autoconf/llvm-pr8927.m4

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial