[Mesa-dev] [PATCH v2 1/6] configure.ac: Move LLVM related stuff to the top
Tobias Droste
tdroste at gmx.de
Tue Oct 11 01:44:52 UTC 2016
This moves the LLVM related stuff to the top of the fileto make it
available to all later checks.
It's below the low level system checks without dependecies or heavy
logic.
WARNING: This just moves stuff, but breaks the build due to the new
ordering!!!
Signed-off-by: Tobias Droste <tdroste at gmx.de>
---
configure.ac | 341 ++++++++++++++++++++++++++++++-----------------------------
1 file changed, 172 insertions(+), 169 deletions(-)
diff --git a/configure.ac b/configure.ac
index b414edd..a2a7ed1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -861,6 +861,177 @@ fi
AC_SUBST([SELINUX_CFLAGS])
AC_SUBST([SELINUX_LIBS])
+dnl
+dnl LLVM
+dnl
+AC_ARG_ENABLE([llvm-shared-libs],
+ [AS_HELP_STRING([--enable-llvm-shared-libs],
+ [link with LLVM shared libraries @<:@default=enabled@:>@])],
+ [enable_llvm_shared_libs="$enableval"],
+ [enable_llvm_shared_libs=yes])
+
+AC_ARG_WITH([llvm-prefix],
+ [AS_HELP_STRING([--with-llvm-prefix],
+ [Prefix for LLVM installations in non-standard locations])],
+ [llvm_prefix="$withval"],
+ [llvm_prefix=''])
+
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
+if test "x$have_libelf" = xno; then
+ LIBELF_LIBS=''
+ LIBELF_CFLAGS=''
+ AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
+ AC_SUBST([LIBELF_LIBS])
+ AC_SUBST([LIBELF_CFLAGS])
+fi
+
+# Call this inside ` ` to get the return value.
+# $1 is the llvm-config command with arguments.
+strip_unwanted_llvm_flags() {
+ # Use \> (marks the end of the word)
+ echo `$1` | sed \
+ -e 's/-march=\S*//g' \
+ -e 's/-mtune=\S*//g' \
+ -e 's/-mcpu=\S*//g' \
+ -e 's/-DNDEBUG\>//g' \
+ -e 's/-D_GNU_SOURCE\>//g' \
+ -e 's/-pedantic\>//g' \
+ -e 's/-Wcovered-switch-default\>//g' \
+ -e 's/-O.\>//g' \
+ -e 's/-g\>//g' \
+ -e 's/-Wall\>//g' \
+ -e 's/-Wcast-qual\>//g' \
+ -e 's/-Woverloaded-virtual\>//g' \
+ -e 's/-fcolor-diagnostics\>//g' \
+ -e 's/-fdata-sections\>//g' \
+ -e 's/-ffunction-sections\>//g' \
+ -e 's/-fno-exceptions\>//g' \
+ -e 's/-fomit-frame-pointer\>//g' \
+ -e 's/-fvisibility-inlines-hidden\>//g' \
+ -e 's/-fPIC\>//g' \
+ -e 's/-fstack-protector-strong\>//g'
+}
+
+if test -z "${LLVM_CONFIG}"; then
+ if test -n "$llvm_prefix"; then
+ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
+ else
+ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+ fi
+fi
+
+if test "x$LLVM_CONFIG" != xno; then
+ LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
+ LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+ LLVM_BINDIR=`$LLVM_CONFIG --bindir`
+ LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+ LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
+ LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
+ LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+ LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+
+ AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
+ [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+ AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
+ [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+
+ LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
+ if test -z "$LLVM_VERSION_PATCH"; then
+ LLVM_VERSION_PATCH=0
+ fi
+
+ if test -n "${LLVM_VERSION_MAJOR}"; then
+ LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+ else
+ LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+ fi
+
+ LLVM_REQUIRED_VERSION_MAJOR="3"
+ LLVM_REQUIRED_VERSION_MINOR="3"
+ if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+ AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
+ fi
+
+ LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
+
+ if $LLVM_CONFIG --components | grep -q inteljitevents ; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
+ fi
+
+ if test "x$enable_opencl" = xyes; then
+ llvm_check_version_for "3" "6" "0" "opencl"
+
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
+ fi
+ DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
+ MESA_LLVM=1
+
+ dnl Check for Clang internal headers
+ if test "x$enable_opencl" = xyes; then
+ if test -z "$CLANG_LIBDIR"; then
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+ AS_IF([test ! -f "$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
+ LLVM_VERSION_INT=0
+fi
+
+AC_SUBST([MESA_LLVM])
+AC_SUBST([LLVM_BINDIR])
+AC_SUBST([LLVM_CFLAGS])
+AC_SUBST([LLVM_CPPFLAGS])
+AC_SUBST([LLVM_CXXFLAGS])
+AC_SUBST([LLVM_LIBDIR])
+AC_SUBST([LLVM_LIBS])
+AC_SUBST([LLVM_LDFLAGS])
+AC_SUBST([LLVM_INCLUDEDIR])
+AC_SUBST([LLVM_VERSION])
+
+llvm_check_version_for() {
+ if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
+ AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
+ fi
+}
+
+radeon_llvm_check() {
+ if test ${LLVM_VERSION_INT} -lt 307; then
+ amdgpu_llvm_target_name='r600'
+ else
+ amdgpu_llvm_target_name='amdgpu'
+ fi
+ llvm_check_version_for $2 $3 $4 $1
+ if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
+ AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
+ fi
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
+ NEED_RADEON_LLVM=yes
+ if test "x$have_libelf" != xyes; then
+ AC_MSG_ERROR([$1 requires libelf when using llvm])
+ fi
+}
+
+radeon_gallium_llvm_check() {
+ if test "x$enable_gallium_llvm" != "xyes"; then
+ AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+ fi
+ radeon_llvm_check $*
+}
+
+swr_llvm_check() {
+ gallium_require_llvm $1
+ if test ${LLVM_VERSION_INT} -lt 306; then
+ AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
+ fi
+ if test "x$enable_gallium_llvm" != "xyes"; then
+ AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+ fi
+}
+
dnl Options for APIs
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
@@ -1202,8 +1373,6 @@ if test "x$enable_gallium_osmesa" = xyes; then
fi
fi
-AC_SUBST([MESA_LLVM])
-
# SHA1 hashing
AC_ARG_WITH([sha1],
[AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
@@ -1972,15 +2141,6 @@ AC_ARG_WITH([clang-libdir],
[CLANG_LIBDIR=''])
PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
-PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
-
-if test "x$have_libelf" = xno; then
- LIBELF_LIBS=''
- LIBELF_CFLAGS=''
- AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
- AC_SUBST([LIBELF_LIBS])
- AC_SUBST([LIBELF_CFLAGS])
-fi
if test "x$enable_opencl" = xyes; then
if test -z "$with_gallium_drivers"; then
@@ -2018,23 +2178,13 @@ fi
AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
AC_SUBST([OPENCL_LIBNAME])
+AC_SUBST([CLANG_RESOURCE_DIR])
dnl
dnl Gallium configuration
dnl
AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
-AC_SUBST([LLVM_BINDIR])
-AC_SUBST([LLVM_CFLAGS])
-AC_SUBST([LLVM_CPPFLAGS])
-AC_SUBST([LLVM_CXXFLAGS])
-AC_SUBST([LLVM_LIBDIR])
-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*)
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
@@ -2150,54 +2300,6 @@ AC_ARG_ENABLE([gallium-llvm],
[enable_gallium_llvm="$enableval"],
[enable_gallium_llvm=auto])
-AC_ARG_ENABLE([llvm-shared-libs],
- [AS_HELP_STRING([--enable-llvm-shared-libs],
- [link with LLVM shared libraries @<:@default=enabled@:>@])],
- [enable_llvm_shared_libs="$enableval"],
- [enable_llvm_shared_libs=yes])
-
-AC_ARG_WITH([llvm-prefix],
- [AS_HELP_STRING([--with-llvm-prefix],
- [Prefix for LLVM installations in non-standard locations])],
- [llvm_prefix="$withval"],
- [llvm_prefix=''])
-
-
-# Call this inside ` ` to get the return value.
-# $1 is the llvm-config command with arguments.
-strip_unwanted_llvm_flags() {
- # Use \> (marks the end of the word)
- echo `$1` | sed \
- -e 's/-march=\S*//g' \
- -e 's/-mtune=\S*//g' \
- -e 's/-mcpu=\S*//g' \
- -e 's/-DNDEBUG\>//g' \
- -e 's/-D_GNU_SOURCE\>//g' \
- -e 's/-pedantic\>//g' \
- -e 's/-Wcovered-switch-default\>//g' \
- -e 's/-O.\>//g' \
- -e 's/-g\>//g' \
- -e 's/-Wall\>//g' \
- -e 's/-Wcast-qual\>//g' \
- -e 's/-Woverloaded-virtual\>//g' \
- -e 's/-fcolor-diagnostics\>//g' \
- -e 's/-fdata-sections\>//g' \
- -e 's/-ffunction-sections\>//g' \
- -e 's/-fno-exceptions\>//g' \
- -e 's/-fomit-frame-pointer\>//g' \
- -e 's/-fvisibility-inlines-hidden\>//g' \
- -e 's/-fPIC\>//g' \
- -e 's/-fstack-protector-strong\>//g'
-}
-
-llvm_check_version_for() {
- if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
- AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
- fi
-}
-
-
-
if test -z "$with_gallium_drivers"; then
enable_gallium_llvm=no
fi
@@ -2207,72 +2309,7 @@ if test "x$enable_gallium_llvm" = xauto; then
esac
fi
if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; then
- if test -n "$llvm_prefix"; then
- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
- else
- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
- fi
-
- if test "x$LLVM_CONFIG" != xno; then
- LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
- LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
- LLVM_BINDIR=`$LLVM_CONFIG --bindir`
- LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
- LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
- LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
- LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
- LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
-
- AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
- [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
- AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
- [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
-
- LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
- if test -z "$LLVM_VERSION_PATCH"; then
- LLVM_VERSION_PATCH=0
- fi
-
- if test -n "${LLVM_VERSION_MAJOR}"; then
- LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
- else
- LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
- fi
-
- LLVM_REQUIRED_VERSION_MAJOR="3"
- LLVM_REQUIRED_VERSION_MINOR="3"
- if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
- AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
- fi
-
- LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
-
- if $LLVM_CONFIG --components | grep -q inteljitevents ; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
- fi
-
- if test "x$enable_opencl" = xyes; then
- llvm_check_version_for "3" "6" "0" "opencl"
- LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
- LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
- fi
- DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
- MESA_LLVM=1
-
- dnl Check for Clang internal headers
- if test "x$enable_opencl" = xyes; then
- if test -z "$CLANG_LIBDIR"; then
- CLANG_LIBDIR=${LLVM_LIBDIR}
- fi
- CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
- AS_IF([test ! -f "$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
- LLVM_VERSION_INT=0
- fi
else
MESA_LLVM=0
LLVM_VERSION_INT=0
@@ -2370,40 +2407,6 @@ require_egl_drm() {
fi
}
-radeon_llvm_check() {
- if test ${LLVM_VERSION_INT} -lt 307; then
- amdgpu_llvm_target_name='r600'
- else
- amdgpu_llvm_target_name='amdgpu'
- fi
- llvm_check_version_for $2 $3 $4 $1
- if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
- AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
- fi
- LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
- NEED_RADEON_LLVM=yes
- if test "x$have_libelf" != xyes; then
- AC_MSG_ERROR([$1 requires libelf when using llvm])
- fi
-}
-
-radeon_gallium_llvm_check() {
- if test "x$enable_gallium_llvm" != "xyes"; then
- AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
- fi
- radeon_llvm_check $*
-}
-
-swr_llvm_check() {
- gallium_require_llvm $1
- if test ${LLVM_VERSION_INT} -lt 306; then
- AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
- fi
- if test "x$enable_gallium_llvm" != "xyes"; then
- AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
- fi
-}
-
swr_require_cxx_feature_flags() {
feature_name="$1"
preprocessor_test="$2"
--
2.10.0
More information about the mesa-dev
mailing list