[LLVMdev] [PATCH] llvm-config: add svn revision to --version

Frits van Bommel fvbommel at wxs.nl
Mon May 18 07:05:01 PDT 2009

Benjamin Kramer wrote:
> At the moment llvm-config outputs "2.6svn" if llvm is build from trunk
> $ llvm-config --version
> 2.6svn
> Some external projects (built out-of-tree) need to know which revision 
> of llvm is installed. LDC currently asks llvm-config --src-root for the 
> source directory and then parses svn info's output to get the revision 
> number. This requires the user to keep the llvm source tree around even 
> if it is not needed to build ldc.

Not technically true; it's not *required*. However, if this isn't done you need 
to set it manually in the cmake configuration...

> The attached patch modifies the llvm build system (both autotools and 
> cmake) to write the revision into PACKAGE_VERSION:
> $ llvm-config --version
> 2.6-71981

I don't think that's enough for LDC; we want to be able to compare the version 
with #if, so we need it to produce something like '#define LLVM_REV 71981' (i.e. 
a raw integer, not a string).

More information about the llvm-dev mailing list