From d3623693949f9bcfe7917f9d059e839a95843519 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 20 Dec 2015 07:48:23 +0100 Subject: configure: add --with-llvm-config --- Makefile.in | 4 +--- README | 8 +++++--- configure | 29 +++++++++++++++-------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Makefile.in b/Makefile.in index 70732b1..b9914e5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -24,7 +24,7 @@ backend=@backend@ libdirsuffix=@libdirsuffix@ libdirreverse=@libdirreverse@ gcc_src_dir=@gcc_src_dir@ -llvm_prefix=@llvm_prefix@ +LLVM_CONFIG=@llvm_config@ LDFLAGS=@LDFLAGS@ LIBBACKTRACE=@backtrace_lib@ @@ -183,8 +183,6 @@ oread-gcc: force #################### For llvm backend ############################## -LLVM_CONFIG=$(llvm_prefix)/bin/llvm-config - GHDL_LLVM_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/grt -aI$(srcdir)/src/ortho -aI$(srcdir)/src/ortho/llvm all.llvm: ghdl1-llvm ghdl_llvm grt-all libs.vhdl.llvm diff --git a/README b/README index ab8b5ee..65c29fc 100644 --- a/README +++ b/README @@ -131,9 +131,11 @@ Building with the llvm backend You need to build and install llvm version 3.5 [do not modify this line as this is read by scripts]. -First configure ghdl and specify where llvm is installed -$ ./configure --with-llvm=PREFIX - where PREFIX/bin/llvm-config is present +First configure ghdl with '--with-llvm-config' +$ ./configure --with-llvm-config + +If llvm-config is not in your path, you can specify it: +$ ./configure --with-llvm-config=LLVM_INSTALL/bin/llvm-config If you want to have stack backtraces on errors (like assert failure or index of out bounds), you need to configure and build libbacktrace from gcc diff --git a/configure b/configure index af0ea29..a935b2d 100755 --- a/configure +++ b/configure @@ -13,14 +13,14 @@ libdirsuffix=lib/ghdl libdirreverse=../.. gcc_src_dir= gcc_version=unknown -llvm_prefix= +llvm_config= backtrace_lib= build= show_help=no progname=$0 -subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_prefix backtrace_lib" +subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config backtrace_lib" # Find srcdir srcdir=`dirname $progname` @@ -68,7 +68,10 @@ for opt do --prefix=*) prefix="$optarg";; --srcdir=*) srcdir="$optarg";; --with-gcc=*) gcc_src_dir="$optarg"; backend=gcc;; - --with-llvm=*) llvm_prefix="$optarg"; backend=llvm;; + --with-llvm=*) echo "--with-llvm is deprecated, use --with-llvm-config"; + llvm_config="$optarg/bin/llvm-config"; backend=llvm;; + --with-llvm-config) llvm_config="llvm-config"; backend=llvm;; + --with-llvm-config=*) llvm_config="$optarg"; backend=llvm;; --with-backtrace-lib=*) backtrace_lib="$optarg";; -h|-help|--help) show_help=yes;; *) echo "$0: unknown option $opt; try $0 --help" @@ -83,13 +86,12 @@ cat </dev/null` + llvm_ver=`"$llvm_config" --version 2>/dev/null` if [ $? != 0 ]; then - echo "cannot run $llvm_cmd" + echo "cannot run $llvm_config" exit 1 fi if ! check_version $llvm_version $llvm_ver; then - echo "Mismatch llvm version $llvm_ver from $llvm_prefix" + echo "Mismatch llvm version $llvm_ver from $llvm_config" echo "Need llvm version $llvm_version" exit 1 fi -- cgit