[Mesa-dev] [PATCH v3 09/25] configure.ac: Move LLVM helpers and pkg-config checks
Tobias Droste
tdroste at gmx.de
Tue Oct 11 23:02:36 UTC 2016
Move the helpers and needed pkg-config checks to the new LLVM version
function.
No functional change.
Signed-off-by: Tobias Droste <tdroste at gmx.de>
---
configure.ac | 183 +++++++++++++++++++++++++++++------------------------------
1 file changed, 91 insertions(+), 92 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0f19a4f..a6208c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -864,6 +864,54 @@ 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'
+}
+
llvm_get_version() {
if test -z "${LLVM_CONFIG}"; then
if test -n "$llvm_prefix"; then
@@ -909,6 +957,49 @@ llvm_get_version() {
fi
}
+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
+}
+
+llvm_add_default_components() {
+ driver_name=$1
+
+ # Required default components
+ llvm_add_component "engine" $driver_name
+ llvm_add_component "bitwriter" $driver_name
+ llvm_add_component "mcjit" $driver_name
+ llvm_add_component "mcdisassembler" $driver_name
+
+ # Optional default components
+ if $LLVM_CONFIG --components | grep -iqw inteljitevents ; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
+ fi
+}
+
+llvm_add_component() {
+ new_llvm_component=$1
+ driver_name=$2
+
+ if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
+ #else
+ # AC_MSG_ERROR([LLVM component '$new_llvm_component' not enabled in your LLVM build. Required by $driver_name.])
+ fi
+}
+
+llvm_add_target() {
+ new_llvm_target=$1
+ driver_name=$2
+
+ if $LLVM_CONFIG --targets-built | grep -iqw $new_llvm_target ; then
+ llvm_add_component $new_llvm_target $driver_name
+ else
+ AC_MSG_ERROR([LLVM target '$new_llvm_target' not enabled in your LLVM build. Required by $driver_name.])
+ fi
+}
+
dnl Options for APIs
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
@@ -2020,15 +2111,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
@@ -2198,89 +2280,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
-}
-
-llvm_add_default_components() {
- driver_name=$1
-
- # Required default components
- llvm_add_component "engine" $driver_name
- llvm_add_component "bitwriter" $driver_name
- llvm_add_component "mcjit" $driver_name
- llvm_add_component "mcdisassembler" $driver_name
-
- # Optional default components
- if $LLVM_CONFIG --components | grep -iqw inteljitevents ; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
- fi
-}
-
-llvm_add_component() {
- new_llvm_component=$1
- driver_name=$2
-
- if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
- #else
- # AC_MSG_ERROR([LLVM component '$new_llvm_component' not enabled in your LLVM build. Required by $driver_name.])
- fi
-}
-
-llvm_add_target() {
- new_llvm_target=$1
- driver_name=$2
-
- if $LLVM_CONFIG --targets-built | grep -iqw $new_llvm_target ; then
- llvm_add_component $new_llvm_target $driver_name
- else
- AC_MSG_ERROR([LLVM target '$new_llvm_target' not enabled in your LLVM build. Required by $driver_name.])
- fi
-}
-
if test -z "$with_gallium_drivers"; then
enable_gallium_llvm=no
fi
--
2.10.0
More information about the mesa-dev
mailing list