From e0804ba4455959de401446178df553dc1e2d287a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 28 May 2015 20:57:21 +0200 Subject: Fix llvm link on darwin (set no_compat_unwind). --- configure | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 875a238b8..a5be5d6bb 100755 --- a/configure +++ b/configure @@ -7,6 +7,7 @@ backend=mcode CC=${CC:-gcc} CFLAGS=${CFLAGS:--g} GNATMAKE=${GNATMAKE:-gnatmake} +LDFLAGS= prefix=/usr/local libdirsuffix=lib/ghdl libdirreverse=../.. @@ -18,7 +19,7 @@ build= show_help=no progname=$0 -subst_vars="CC GNATMAKE CFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_prefix" +subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_prefix" # Find srcdir srcdir=`dirname $progname` @@ -86,6 +87,12 @@ if ! $CC -v 2> /dev/null; then exit 1 fi +# Compute build machine +if test x$build = x; then + build=`$CC $CFLAGS -dumpmachine` +fi +echo "Build machine is: $build" + # For mcode, check that gcc emits i386 if test $backend = mcode; then if ! $CC $CFLAGS -dumpmachine | grep -q "[3-6]86"; then @@ -111,18 +118,18 @@ fi # For llvm backend, check llvm-config if test $backend = llvm; then llvm_cmd="$llvm_prefix/bin/llvm-config --version" - if ! $llvm_cmd 2> /dev/null; then + if ! $llvm_cmd > /dev/null 2>&1; then echo "cannot run $llvm_cmd" exit 1 fi + # For llvm, the c++ compiler is for linking so that the standard c++ + # library is included. However, the linker needs the no_compact_unwind + # flag because code generated by gcc is not compatible with compact unwind. + case "$build" in + *darwin*) LDFLAGS="$LDFLAGS -Wl,-no_compact_unwind" ;; + esac fi -# Compute build machine -if test x$build = x; then - build=`$CC $CFLAGS -dumpmachine` -fi -echo "Build machine is: $build" - # Generate config.status rm -f config.status { -- cgit v1.2.3