[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using LLVM with Autotools
From: |
Mike Miller |
Subject: |
Re: Using LLVM with Autotools |
Date: |
Fri, 25 Mar 2016 09:20:19 -0700 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Thu, Mar 24, 2016 at 16:39:48 +0000, Russell Wallace wrote:
> In this case I'm the one who has to write configure.ac and Makefile.am so I
> need to find out what the answers need to be. But I see what you're saying,
> that it's at least theoretically possible to do the whole job on the
> ./configure command line. That would make said command line a bit long and
> unwieldy, having to invoke the full path to llvm-config twice (once to get
> compiler flags, once to get linker flags). Is there a way to abbreviate
> this, by putting something into configure.ac or Makefile.am or otherwise?
In Octave, we do something like the following (simplified for clarity):
AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
LLVM_CPPFLAGS="-I`$LLVM_CONFIG --includedir`"
LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
LLVM_LIBS=`$LLVM_CONFIG --libs`
(and AC_SUBST for each of these of course).
Full example starts at line 829 here:
http://hg.savannah.gnu.org/hgweb/octave/file/@/configure.ac#l829
This allows the user to select the version of LLVM with
./configure LLVM_CONFIG=/usr/bin/llvm-config-3.7
and the rest of the flags fall from that. I suppose you could simplify
further with something like an AC_ARG_WITH option to allow the user to
./configure --with-llvm=3.7
and use that answer to choose which version of LLVM you look for.
--
mike