aboutsummaryrefslogtreecommitdiffstats
path: root/erts/aclocal.m4
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-10-25 10:11:24 +0200
committerBjörn Gustavsson <[email protected]>2011-11-25 10:59:38 +0100
commit6e7de55f346e632b3f29835f7678a7ecfb464d99 (patch)
treecfac2279475fe6417ee7f9788bc6a49fdc67f8a3 /erts/aclocal.m4
parent743eae551552a51703fc5d44a0ce5f634f33740d (diff)
downloadotp-6e7de55f346e632b3f29835f7678a7ecfb464d99.tar.gz
otp-6e7de55f346e632b3f29835f7678a7ecfb464d99.tar.bz2
otp-6e7de55f346e632b3f29835f7678a7ecfb464d99.zip
configure: Define NO_JUMP_TABLE if all we have is llvm-gcc
Commit dd24ca1cb76d attempts to fix the problem that LLVM-based compilers (such as llvm-gcc-4.2 and clang) miscompiles beam_emu.c. The idea was to force the use of gcc-4.2 if the default compiler was LLVM-based. Since that fix, Apple released Xcode 4.2 that does not include any version of gcc, only llvm-gcc-4.2 and clang. We could require gcc in order to be the system, but it would be nice if Erlang/OTP could be built out-of-box on MacOS X, albeit with reduced performance. Therefore, make sure that we set NO_JUMP_TABLE (use a switch statement instead of computed gotos in beam_emu.c) if no compiler that correctly handles computed gotos can be found. We know that clang based on the upcoming LLVM 3.0 will work, but older LLVM-based compilers will not, so we can test the version of clang. llvm-gcc has been discontinued in LLVM 3.0, so if the compiler is LLVM-based but not clang, we can assume that it does not handles computed gotos correctly.
Diffstat (limited to 'erts/aclocal.m4')
-rw-r--r--erts/aclocal.m411
1 files changed, 9 insertions, 2 deletions
diff --git a/erts/aclocal.m4 b/erts/aclocal.m4
index bd228a2d1f..ea5cc67fbe 100644
--- a/erts/aclocal.m4
+++ b/erts/aclocal.m4
@@ -125,8 +125,10 @@ AC_DEFUN(LM_FIND_EMU_CC,
ac_cv_prog_emu_cc,
[
AC_TRY_COMPILE([],[
-#ifdef __llvm__
-#error "llvm is currently unable to compile beam_emu.c"
+#if defined(__clang_major__) && __clang_major__ >= 3
+ /* clang 3.x or later is fine */
+#elif defined(__llvm__)
+#error "this version of llvm is unable to correctly compile beam_emu.c"
#endif
__label__ lbl1;
__label__ lbl2;
@@ -168,6 +170,11 @@ if test $ac_cv_prog_emu_cc != no; then
CFLAGS=""
CPPFLAGS=""
AC_TRY_COMPILE([],[
+#if defined(__clang_major__) && __clang_major__ >= 3
+ /* clang 3.x or later is fine */
+#elif defined(__llvm__)
+#error "this version of llvm is unable to correctly compile beam_emu.c"
+#endif
__label__ lbl1;
__label__ lbl2;
int x = magic();