michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the michael@0: dnl user to upgrade. michael@0: michael@0: AC_DEFUN([MOZ_LLVM_PR8927], michael@0: [ michael@0: AC_MSG_CHECKING(for llvm pr8927) michael@0: ac_have_llvm_pr8927="no" michael@0: AC_LANG_SAVE michael@0: AC_LANG_C michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="-O2" michael@0: AC_TRY_RUN([ michael@0: struct foobar { michael@0: int x; michael@0: }; michael@0: static const struct foobar* foo() { michael@0: static const struct foobar d = { 0 }; michael@0: return &d; michael@0: } michael@0: static const struct foobar* bar() { michael@0: static const struct foobar d = { 0 }; michael@0: return &d; michael@0: } michael@0: __attribute__((noinline)) int zed(const struct foobar *a, michael@0: const struct foobar *b) { michael@0: return a == b; michael@0: } michael@0: int main() { michael@0: return zed(foo(), bar()); michael@0: } michael@0: ], true, michael@0: ac_have_llvm_pr8927="yes", michael@0: true) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: michael@0: AC_LANG_RESTORE michael@0: michael@0: if test "$ac_have_llvm_pr8927" = "yes"; then michael@0: AC_MSG_RESULT(yes) michael@0: echo This compiler would miscompile firefox, please upgrade. michael@0: echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites michael@0: echo for more information. michael@0: exit 1 michael@0: else michael@0: AC_MSG_RESULT(no) michael@0: fi michael@0: ])