summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-12-07 16:56:27 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-12-07 17:28:36 +1100
commit4d75f099fbb83303f67792fbdcd742cac6c9b3e1 (patch)
tree84bd80c935b37cb98acf24d55c2dbfcd6e6a18f8
parent5095e87610c4b1f748d15a3840000c3bb8d2a191 (diff)
Add build system support for altivec
This change to the libtwin build system detects altivec support, and sets cflags and a #define HAVE_ALTIVEC if found. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac32
2 files changed, 33 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 0adae5e..6b5cbfa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = @WARN_CFLAGS@
+AM_CFLAGS = @WARN_CFLAGS@ @ALTIVEC_CFLAGS@
EXTRA_PROGRAMS =
diff --git a/configure.ac b/configure.ac
index e5970a7..9f10821 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,37 @@ fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
+# Altivec support
+AC_ARG_ENABLE(altivec,
+ AC_HELP_STRING([--enable-altivec],
+ [Enable altivec support (default=detect)]),
+ twin_altivec="$enableval")
+
+if test x$twin_altivec = x
+then
+ AC_MSG_CHECKING([for altivec support])
+ CFLAGS_save="$CFLAGS"
+ CFLAGS="$CFLAGS -maltivec"
+ AC_TRY_COMPILE([#include <altivec.h>],
+ [vector unsigned int v = vec_splat_u32(0)],
+ twin_altivec=yes,
+ twin_altivec=no)
+ CFLAGS="$CFLAGS_save"
+ AC_MSG_RESULT($twin_altivec)
+fi
+
+ALTIVEC_CFLAGS=""
+AH_TEMPLATE(HAVE_ALTIVEC,
+ [Define if the C compiler supports altivec extensions])
+
+if test x$twin_altivec = xyes
+then
+ AC_DEFINE([HAVE_ALTIVEC])
+ ALTIVEC_CFLAGS="-maltivec"
+fi
+AC_SUBST(ALTIVEC_CFLAGS)
+
+
# TWIN_DEP_*FLAGS define all flags required by dependencies of libtwin
TWIN_DEP_LDFLAGS="$X_LIBS $PNG_LIBS -lm"
TWIN_DEPCFLAGS="$X_CFLAGS $PNG_CFLAGS"
@@ -124,6 +155,7 @@ AC_MSG_NOTICE([fbdev support: $twin_fb])
AC_MSG_NOTICE([png support: $twin_png])
AC_MSG_NOTICE([twin_ttf tool: $twin_ttf])
AC_MSG_NOTICE([linux mouse: $twin_mouse])
+AC_MSG_NOTICE([altivec: $twin_altivec])
AC_OUTPUT([Makefile
libtwin.pc])