[LLVMdev] llvm-config prototype (was: Getting Started with LLVM)

Eric Kidd emk.lists at gmail.com
Sat Mar 18 14:25:32 PST 2006


On Mar 16, 2006, at 2:16 AM, Chris Lattner wrote:
> On Wed, 15 Mar 2006, Eric Kidd wrote:
>> OK! Would something like the following interface be a reasonable  
>> first approach?
>>
>>  llvm-config (--cxxflags | --ldflags | --libs) (all | jit)
>>    --cxxflags: Flags to use when compiling C++ source code.
>>    --ldflags: Linker flags to use when linking against LLVM.
>>    --libs: Libraries needed to link the current configuration.
>>    all: Link all LLVM libraries for the current platform.
>>    jit: Link the libraries needed by the standard JIT/interpreter  
>> configuration.
>
> Sounds great.

OK! I've implemented a simple version of llvm-config, just to give us  
something concrete to talk about. :-) I'll send you the patch in a  
separate, off-list message. If anybody else would like a copy, just ask.

llvm-config supports the following options:

   --version              LLVM version.
   --prefix               Installation prefix.
   --bindir               Directory containing LLVM executables.
   --includedir           Directory containing LLVM headers.
   --libdir               Directory containing LLVM libraries.
   --cxxflags             C++ compiler flags for file which include  
LLVM headers.
   --ldflags              Linker flags.
   --libs <COMPONENT>...  Libraries needed to link against LLVM  
components.

Right now, the only useful component is the JIT:

   jit                    LLVM JIT compiler.

I get this set of dependencies using:

   LLVMLIBS := JIT
   SUB_JITOBJS=$(LLVMUsedLibs)

It's very easy to dump a Makefile variable to the llvm-config script,  
so the only obstacle to adding more configurations is modularizing  
the code which processes LLVMLIBS.

> I would be quite happy to have a hard-coded list of library  
> dependencies, even if it means that we need to manually maintain  
> them.  This will force us to realize and think about what  
> dependencies there are between libraries.

This is a good idea.  I'm not quite sure how to process a dependency  
list using /bin/sh, but maybe inspiration will strike me. :-)

If there's any changes you'd like me to make to this patch, please  
let me know! This is just a minimalist version to spur further  
discussion.

Cheers,
Eric




More information about the llvm-dev mailing list