cleanup altivec checks to be more portable

SVN revision: 17490
This commit is contained in:
Mike Frysinger 2005-10-13 02:38:04 +00:00
parent db7746fa21
commit 28ab394afb
1 changed files with 20 additions and 26 deletions

View File

@ -819,60 +819,54 @@ altivec_cflags=""
AC_MSG_CHECKING(whether to build altivec code)
AC_ARG_ENABLE(cpu-altivec,
[ --enable-cpu-altivec enable altivec code], [
if test x"$enableval" = x"yes" ; then
have_altivec="yes"
AC_MSG_RESULT(yes)
build_cpu_altivec="yes"
else
AC_MSG_RESULT(no)
build_cpu_altivec="yes"
fi
],
[
AC_MSG_RESULT($build_cpu_altivec)
build_cpu_altivec=$enableval
]
)
if test "x$have_altivec" = "xyes"; then
AC_MSG_RESULT($build_cpu_altivec)
if test "x$build_cpu_altivec" = "xyes"; then
AC_CHECK_HEADER(altivec.h,
[
AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
build_cpu_altivec="yes"
AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
build_cpu_altivec="yes"
],
[
PF=$CFLAGS
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
CFLAGS=$CFLAGS" -maltivec"
CPPFLAGS=$CPPFLAGS" -maltivec"
unset ac_cv_header_altivec_h
AC_CHECK_HEADER(altivec.h,
[
AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
build_cpu_altivec="yes"
AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
build_cpu_altivec="yes"
],
[
build_cpu_altivec="no"
]
)
CFLAGS=$PF
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
]
)
fi
if test "x$have_altivec" = "xyes"; then
if test "x$build_cpu_altivec" = "xyes"; then
AC_MSG_CHECKING(whether to use altivec compiler flag)
if test $GCC = yes; then
if echo "int main(){ return 0;}" | gcc -faltivec -E - > /dev/null 2>&1; then
AC_MSG_RESULT(yes)
if test x"$GCC" = x"yes"; then
if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
altivec_cflags="-faltivec"
AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
elif echo "int main(){ return 0;}" | gcc -maltivec -E - > /dev/null 2>&1; then
AC_MSG_RESULT(yes)
elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
altivec_cflags="-maltivec"
AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
AC_MSG_RESULT($altivec_cflags)
CFLAGS="$CFLAGS $altivec_cflags"
fi
#######################################
## C
build_cpu_c="no"