[Mesa-dev] [PATCH 1/2] Add target attribute check to configure
Marc Dietrich
marvin24 at gmx.de
Fri Jan 16 04:42:54 PST 2015
The target attribute allows for function or file specific compiler target
specification. This will be useful when compiling with LTO enabled.
Signed-off-by: Marc Dietrich <marvin24 at gmx.de>
---
configure.ac | 2 ++
m4/ax_gcc_func_attribute.m4 | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/configure.ac b/configure.ac
index c72fe92..233a04c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,8 +153,10 @@ AX_GCC_FUNC_ATTRIBUTE([flatten])
AX_GCC_FUNC_ATTRIBUTE([format])
AX_GCC_FUNC_ATTRIBUTE([malloc])
AX_GCC_FUNC_ATTRIBUTE([packed])
+AX_GCC_FUNC_ATTRIBUTE([target])
AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
+AM_CONDITIONAL([HAVE_TARGET_ATTRIBUTE], test "x${ax_cv_have_func_attribute_target}" = xyes)
dnl Make sure the pkg-config macros are defined
m4_ifndef([PKG_PROG_PKG_CONFIG],
diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4
index 4e0ecbb..00c8794 100644
--- a/m4/ax_gcc_func_attribute.m4
+++ b/m4/ax_gcc_func_attribute.m4
@@ -175,6 +175,15 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
[pure], [
int foo( void ) __attribute__(($1));
],
+ [target], [
+ #if defined(__i386__) || defined(__x86_64__)
+ __attribute__(($1("sse4.1"))) int foo ( void ) { return 0; }
+ #elif defined(__powerpc__) || defined(__ppc64__)
+ __attribute__(($1("altivec"))) int foo ( void ) { return 0; }
+ #else
+ #error unsupported architecture
+ #endif
+ ],
[unused], [
int foo( void ) __attribute__(($1));
],
--
2.2.1
More information about the mesa-dev
mailing list