Skip to content

Commit

Permalink
Use llvm-config to populate CPPFLAGS and LDFLAGS.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrprice committed May 12, 2015
1 parent 171d998 commit 595cf30
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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],
Expand Down

0 comments on commit 595cf30

Please sign in to comment.