Fixed Altivec support on Mac OS X.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 17 Nov 2005 03:43:42 +0000
changeset 1175867f521591e5
parent 1174 8c43aceeed81
child 1176 dd2a8deeb26d
Fixed Altivec support on Mac OS X.
configure.in
src/video/SDL_blit_A.c
src/video/SDL_blit_N.c
     1.1 --- a/configure.in	Thu Nov 17 03:16:01 2005 +0000
     1.2 +++ b/configure.in	Thu Nov 17 03:43:42 2005 +0000
     1.3 @@ -1922,42 +1922,70 @@
     1.4  dnl Check for altivec instruction support using gas syntax
     1.5  CheckAltivec()
     1.6  {
     1.7 -    dnl FIXME: Theoretically, you might not have altivec.h, we should check
     1.8 -    dnl FIXME:  that seperately, but I think all major platforms have it
     1.9 -    dnl FIXME:  at the moment...  --ryan.
    1.10 +    have_altivec_h_hdr=no
    1.11 +    AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
    1.12  
    1.13      save_CFLAGS="${CFLAGS}"
    1.14      have_gcc_altivec=no
    1.15      AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
    1.16      CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -maltivec"
    1.17 -    AC_TRY_COMPILE([
    1.18 -    #include <altivec.h>
    1.19 -    vector unsigned int vzero() {
    1.20 -        return vec_splat_u32(0);
    1.21 -    }
    1.22 -    ],[
    1.23 -    ],[
    1.24 -    have_gcc_altivec=yes
    1.25 -    ])
    1.26 -    AC_MSG_RESULT($have_gcc_altivec)
    1.27 +
    1.28 +    if test x$have_altivec_h_hdr = xyes; then
    1.29 +      AC_TRY_COMPILE([
    1.30 +      #include <altivec.h>
    1.31 +      vector unsigned int vzero() {
    1.32 +          return vec_splat_u32(0);
    1.33 +      }
    1.34 +      ],[
    1.35 +      ],[
    1.36 +      have_gcc_altivec=yes
    1.37 +      ])
    1.38 +      AC_MSG_RESULT($have_gcc_altivec)
    1.39 +    else
    1.40 +      AC_TRY_COMPILE([
    1.41 +      vector unsigned int vzero() {
    1.42 +          return vec_splat_u32(0);
    1.43 +      }
    1.44 +      ],[
    1.45 +      ],[
    1.46 +      have_gcc_altivec=yes
    1.47 +      ])
    1.48 +      AC_MSG_RESULT($have_gcc_altivec)
    1.49 +    fi
    1.50  
    1.51      if test x$have_gcc_altivec = xno; then
    1.52          AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
    1.53 -        CFLAGS="${CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
    1.54 -        AC_TRY_COMPILE([
    1.55 -        #include <altivec.h>
    1.56 -        vector unsigned int vzero() {
    1.57 -            return vec_splat_u32(0);
    1.58 -        }
    1.59 -        ],[
    1.60 -        ],[
    1.61 -        have_gcc_altivec=yes
    1.62 -        ])
    1.63 -        AC_MSG_RESULT($have_gcc_altivec)
    1.64 +        CFLAGS="${save_CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
    1.65 +        if test x$have_altivec_h_hdr = xyes; then
    1.66 +          AC_TRY_COMPILE([
    1.67 +          #include <altivec.h>
    1.68 +          vector unsigned int vzero() {
    1.69 +              return vec_splat_u32(0);
    1.70 +          }
    1.71 +          ],[
    1.72 +          ],[
    1.73 +          have_gcc_altivec=yes
    1.74 +          ])
    1.75 +          AC_MSG_RESULT($have_gcc_altivec)
    1.76 +        else
    1.77 +          AC_TRY_COMPILE([
    1.78 +          vector unsigned int vzero() {
    1.79 +              return vec_splat_u32(0);
    1.80 +          }
    1.81 +          ],[
    1.82 +          ],[
    1.83 +          have_gcc_altivec=yes
    1.84 +          ])
    1.85 +          AC_MSG_RESULT($have_gcc_altivec)
    1.86 +        fi
    1.87      fi
    1.88  
    1.89      if test x$have_gcc_altivec = xno; then
    1.90          CFLAGS="${save_CFLAGS}"
    1.91 +    else
    1.92 +        if test x$have_altivec_h_hdr = xyes; then
    1.93 +          CFLAGS="${CFLAGS} -DHAVE_ALTIVEC_H"
    1.94 +        fi
    1.95      fi
    1.96  }
    1.97  
     2.1 --- a/src/video/SDL_blit_A.c	Thu Nov 17 03:16:01 2005 +0000
     2.2 +++ b/src/video/SDL_blit_A.c	Thu Nov 17 03:43:42 2005 +0000
     2.3 @@ -422,7 +422,9 @@
     2.4  #endif
     2.5  
     2.6  #ifdef USE_ALTIVEC_BLITTERS
     2.7 +#ifdef HAVE_ALTIVEC_H
     2.8  #include <altivec.h>
     2.9 +#endif
    2.10  #include <assert.h>
    2.11  
    2.12  #if ((defined MACOSX) && (__GNUC__ < 4))
     3.1 --- a/src/video/SDL_blit_N.c	Thu Nov 17 03:16:01 2005 +0000
     3.2 +++ b/src/video/SDL_blit_N.c	Thu Nov 17 03:43:42 2005 +0000
     3.3 @@ -36,7 +36,9 @@
     3.4  /* Functions to blit from N-bit surfaces to other surfaces */
     3.5  
     3.6  #ifdef USE_ALTIVEC_BLITTERS
     3.7 +#ifdef HAVE_ALTIVEC_H
     3.8  #include <altivec.h>
     3.9 +#endif
    3.10  #include <assert.h>
    3.11  #include <stdlib.h>
    3.12  #ifdef MACOSX