diff options
author | Tom Stellard <[email protected]> | 2012-06-15 16:52:16 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-06-22 16:59:24 -0400 |
commit | ea76f0331011337cc4b7caac8f25947501a5aef9 (patch) | |
tree | 271475eae4324c6518788a48e99e0fbc953380d0 | |
parent | 82d25963a838cfebdeb9b080169979329ee850ea (diff) |
clover: Add --with-clang-libdir option and verify CLANG_RESOURCE_DIR
$CLANG_RESOURCE_DIR is the directory that contains all resources
needed by clang to compile programs. When clover uses clang to
compile kernels it needs to specify a resource dir, so that clang
can find its internal headers (e.g. stddef.h).
clang defines $CLANG_RESOURCE_DIR as $CLANG_LIBDIR/clang/$CLANG_VERSION
This patch adds the --with-clang-libdir option in order to accommodate
clang intalls to non-standard locations, and it also adds a check
to the configure script to verify that $CLANG_RESOURCE_DIR/include
contains the necessary header files.
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/Makefile.am | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index b78eb155557..46265a2218f 100644 --- a/configure.ac +++ b/configure.ac @@ -1610,6 +1610,12 @@ AC_ARG_WITH([libclc-path], [LIBCLC_PATH="$withval"], [LIBCLC_PATH=""]) +AC_ARG_WITH([clang-libdir], + [AS_HELP_STRING([--with-clang-libdir], + [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])], + [CLANG_LIBDIR="$withval"], + [CLANG_LIBDIR=""]) + AC_SUBST([LIBCLC_PATH]) if test "x$enable_opencl" = xyes; then @@ -1696,6 +1702,7 @@ AC_SUBST([LLVM_LIBS]) AC_SUBST([LLVM_LDFLAGS]) AC_SUBST([LLVM_INCLUDEDIR]) AC_SUBST([LLVM_VERSION]) +AC_SUBST([CLANG_RESOURCE_DIR]) case "x$enable_opengl$enable_gles1$enable_gles2" in x*yes*) @@ -1870,6 +1877,16 @@ if test "x$enable_gallium_llvm" = xyes; then LLVM_LIBDIR=`$LLVM_CONFIG --libdir` DEFINES="${DEFINES} -DHAVE_LLVM=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/0x0\10\2/g'`" MESA_LLVM=1 + + dnl Check for Clang interanl headers + if test "x$enable_opencl" = xyes; then + if test "x$CLANG_LIBDIR" = x; then + CLANG_LIBDIR=${LLVM_LIBDIR} + fi + CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION} + AC_CHECK_FILE("$CLANG_RESOURCE_DIR/include/stddef.h",, + AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])) + fi else MESA_LLVM=0 fi diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index 818ced622d4..5241a6d84a6 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -24,7 +24,7 @@ libclllvm_la_CXXFLAGS = \ $(LLVM_CPPFLAGS) \ $(DEFINES) \ -DLIBCLC_PATH=\"$(LIBCLC_PATH)/\" \ - -DCLANG_RESOURCE_DIR=\"$(LLVM_LIBDIR)/clang/$(LLVM_VERSION)/\" + -DCLANG_RESOURCE_DIR=\"$(CLANG_RESOURCE_DIR)\" libclllvm_la_SOURCES = \ llvm/invocation.cpp |