Skip to content
Permalink
Browse files

configure, darwin: favor -faltivec over -maltivec. don't -faltivec fo…

…r others.
  • Loading branch information
sezero committed Sep 7, 2019
1 parent 920620e commit c9fdcf5b0034eb0825f51c4d893b2ccc0245c77d
Showing with 72 additions and 98 deletions.
  1. +34 −67 configure
  2. +38 −31 configure.in
101 configure
{ $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
$as_echo "$have_gcc_altivec" >&6; }
fi
CFLAGS="$save_CFLAGS"

if test x$have_gcc_altivec = xno; then
{ $as_echo "$as_me:$LINENO: checking for Altivec with GCC altivec.h and -faltivec option" >&5
$as_echo_n "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; }
altivec_CFLAGS="-faltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
if test x$have_gcc_altivec = xyes; then
cat >>confdefs.h <<\_ACEOF
#define SDL_ALTIVEC_BLITTERS 1
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */

#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}

int
main ()
{


;
return 0;
}
if test x$have_altivec_h_hdr = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ALTIVEC_H 1
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then

have_gcc_altivec=yes
have_altivec_h_hdr=yes
fi
EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
fi
fi
}

CheckAltivecApple()
{
# Check whether --enable-altivec was given.
if test "${enable_altivec+set}" = set; then
enableval=$enable_altivec;
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5


enable_altivec=yes
fi

rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
$as_echo "$have_gcc_altivec" >&6; }
fi
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_altivec=no
altivec_CFLAGS="-faltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"

if test x$have_gcc_altivec = xno; then
{ $as_echo "$as_me:$LINENO: checking for Altivec with GCC -faltivec option" >&5
{ $as_echo "$as_me:$LINENO: checking for Altivec with GCC -faltivec option" >&5
$as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */

vector unsigned int vzero() {
return vec_splat_u32(0);
}
vector unsigned int vzero() {
return vec_splat_u32(0);
}

int
main ()
test ! -s conftest.err
} && test -s conftest.$ac_objext; then

have_gcc_altivec=yes
have_gcc_altivec=yes

else
$as_echo "$as_me: failed program was:" >&5
fi

rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
{ $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
$as_echo "$have_gcc_altivec" >&6; }
fi

CFLAGS="$save_CFLAGS"

if test x$have_gcc_altivec = xyes; then
cat >>confdefs.h <<\_ACEOF
#define SDL_ALTIVEC_BLITTERS 1
_ACEOF

if test x$have_altivec_h_hdr = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ALTIVEC_H 1
_ACEOF

fi
EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
else
CheckAltivec
fi
fi
}
CheckMacGL
CheckOpenGLX11
CheckPTHREAD
CheckAltivec
CheckAltivecApple

# Need this or things might misbuild on a G3.
EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
@@ -844,36 +844,6 @@ AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[defau
])
AC_MSG_RESULT($have_gcc_altivec)
fi

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

if test x$have_gcc_altivec = xyes; then
@@ -886,6 +856,43 @@ AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[defau
fi
}

dnl Check for altivec instruction support - APPLE extensions
CheckAltivecApple()
{
AC_ARG_ENABLE(altivec,
AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[default=yes]]]),
, enable_altivec=yes)
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_altivec=no
altivec_CFLAGS="-faltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"

dnl -faltivec doesn't need altivec.h and actually
dnl emits a warning if included..
AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)

CFLAGS="$save_CFLAGS"

if test x$have_gcc_altivec = xyes; then
AC_DEFINE(SDL_ALTIVEC_BLITTERS)
EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
else
dnl Check standart gcc altivec options
CheckAltivec
fi
fi
}

dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
@@ -2785,7 +2792,7 @@ case "$host" in
CheckMacGL
CheckOpenGLX11
CheckPTHREAD
CheckAltivec
CheckAltivecApple

# Need this or things might misbuild on a G3.
EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"

0 comments on commit c9fdcf5

Please sign in to comment.