Skip to content

Commit

Permalink
Fixed Altivec support on Mac OS X.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 17, 2005
1 parent ac89c74 commit 872e1ac
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 24 deletions.
76 changes: 52 additions & 24 deletions configure.in
Expand Up @@ -1922,42 +1922,70 @@ CheckUSBHID()
dnl Check for altivec instruction support using gas syntax
CheckAltivec()
{
dnl FIXME: Theoretically, you might not have altivec.h, we should check
dnl FIXME: that seperately, but I think all major platforms have it
dnl FIXME: at the moment... --ryan.
have_altivec_h_hdr=no
AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)

save_CFLAGS="${CFLAGS}"
have_gcc_altivec=no
AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -maltivec"
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)

if test x$have_altivec_h_hdr = xyes; then
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
else
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi

if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
CFLAGS="${CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
if test x$have_altivec_h_hdr = xyes; then
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
else
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi
fi

if test x$have_gcc_altivec = xno; then
CFLAGS="${save_CFLAGS}"
else
if test x$have_altivec_h_hdr = xyes; then
CFLAGS="${CFLAGS} -DHAVE_ALTIVEC_H"
fi
fi
}

Expand Down
2 changes: 2 additions & 0 deletions src/video/SDL_blit_A.c
Expand Up @@ -422,7 +422,9 @@ static void BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo *info)
#endif

#ifdef USE_ALTIVEC_BLITTERS
#ifdef HAVE_ALTIVEC_H
#include <altivec.h>
#endif
#include <assert.h>

#if ((defined MACOSX) && (__GNUC__ < 4))
Expand Down
2 changes: 2 additions & 0 deletions src/video/SDL_blit_N.c
Expand Up @@ -36,7 +36,9 @@ static char rcsid =
/* Functions to blit from N-bit surfaces to other surfaces */

#ifdef USE_ALTIVEC_BLITTERS
#ifdef HAVE_ALTIVEC_H
#include <altivec.h>
#endif
#include <assert.h>
#include <stdlib.h>
#ifdef MACOSX
Expand Down

0 comments on commit 872e1ac

Please sign in to comment.