From 595cf308804927d5e5bbe98820a594379a578d33 Mon Sep 17 00:00:00 2001 From: James Price Date: Tue, 12 May 2015 08:35:36 -0700 Subject: [PATCH] Use llvm-config to populate CPPFLAGS and LDFLAGS. --- configure.ac | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index c6e4c0b4..4b4c7932 100644 --- a/configure.ac +++ b/configure.ac @@ -30,17 +30,12 @@ AX_CHECK_COMPILE_FLAG([-std=c++11], [], CXXFLAGS="$CXXFLAGS -std=c++11" CPPFLAGS="$CPPFLAGS -std=c++11" -# Add LLVM required macro definitions -CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" - # --with-llvm option to specify root of LLVM/Clang installation AC_ARG_WITH( llvm, [AS_HELP_STRING([--with-llvm], [directory containing LLVM/Clang installation])], - [CPPFLAGS="$CPPFLAGS -I$withval/include"; - LDFLAGS="$LDFLAGS -L$withval/lib"; - AC_SUBST(clang, $withval/bin/clang) + [AC_SUBST(clang, $withval/bin/clang) AC_SUBST(llvm_config, $withval/bin/llvm-config)]) # Find LLVM/Clang binaries (assume on PATH if --with-llvm not used) @@ -62,6 +57,10 @@ AC_DEFINE_UNQUOTED([LLVM_VERSION], [$llvm_version], [Version of LLVM we are building against]) +# Add flags for LLVM +CPPFLAGS="$CPPFLAGS `$llvm_config --cppflags`" +LDFLAGS="$LDFLAGS `$llvm_config --ldflags`" + # Check for LLVM/Clang headers/libraries AC_CHECK_HEADERS( [llvm/IR/Instruction.h clang/CodeGen/CodeGenAction.h],