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.

     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 dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the
     6 dnl user to upgrade.
     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
    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"
    41 AC_LANG_RESTORE
    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 ])

mercurial