[LLVMdev] Automake and llvm-config

Julian v. Bock jvb at wongr.net
Fri May 8 05:31:45 PDT 2009


>>>>> "AV" == Andrii Vasyliev <andrii.vasyliev at gmail.com> writes:

AV> Hello, I'm using autotools to build my little lang.  So I want to
AV> have something like this in my Makefile.am:

AV> mylang_SOURCES = mylang.cpp mylang_LDADD = mylib.a `llvm-config
AV> --cppflags --ldflags --libs core jit native ipo`

AV> But automake complains: tools/Makefile.am:8: linker flags such as
AV> `--cppflags' belong in `mylang_LDFLAGS

You can use AC_SUBST in configure.ac to set the flags at configure
time. I use something like this:

AC_SUBST(LLVM_CPPFLAGS, $(llvm-config --cppflags))
AC_SUBST(LLVM_LDADD, $(llvm-config --ldflags --libs core jit native | tr '\n' ' '))

and in Makefile.am:

foo_LDADD = $(LLVM_LDADD) ...

Julian v. Bock

More information about the llvm-dev mailing list