Commit e0c0ea96 authored by Sam Hocevar's avatar Sam Hocevar

* configure.ac: reworked the AltiVec checks.

parent fab0ba86
...@@ -1112,43 +1112,58 @@ if test "${ac_cv_altivec_inline}" != "no"; then ...@@ -1112,43 +1112,58 @@ if test "${ac_cv_altivec_inline}" != "no"; then
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}" ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
fi fi
dnl Check for <altivec.h>, gcc 4.x needs -maltivec for it dnl The AltiVec C extensions
AC_CACHE_CHECK([if \$CC accepts -maltivec], dnl
[ac_cv_c_maltivec], dnl There are several possible cases:
[CFLAGS="${CFLAGS_save} -maltivec" dnl - OS X PPC, gcc 4.x: use -mpim-altivec, don't need <altivec.h>
AC_TRY_COMPILE([],,ac_cv_c_maltivec=yes, ac_cv_c_maltivec=no)]) dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
if test "${ac_cv_c_maltivec}" != "no"; then dnl - Linux PPC, gcc 4.x: need <altivec.h> which itself requires -maltivec
CPPFLAGS="${CPPFLAGS_save} -maltivec" dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
fi dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
AC_CHECK_HEADERS(altivec.h) dnl - Others: test should fail
CPPFLAGS="${CPPFLAGS_save}"
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions], AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
[ac_cv_c_altivec], [ac_cv_c_altivec],
[# Linux/PPC test (no flags) [# OS X/PPC test (gcc 4.x)
CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -maltivec -mabi=altivec" CFLAGS="${CFLAGS_save} -mpim-altivec"
AC_TRY_COMPILE([#ifdef HAVE_ALTIVEC_H AC_TRY_COMPILE([],
#include <altivec.h>
#endif],
[vec_ld(0, (unsigned char *)0);], [vec_ld(0, (unsigned char *)0);],
[ac_cv_c_altivec="" [ac_cv_c_altivec="-mpim-altivec"],
ac_cv_c_altivec_abi="-maltivec -mabi=altivec"], [# OS X/PPC test (gcc 3.x)
[# Darwin test
CFLAGS="${CFLAGS_save} -faltivec" CFLAGS="${CFLAGS_save} -faltivec"
AC_TRY_COMPILE([], AC_TRY_COMPILE([],
[vec_ld(0, (unsigned char *)0);], [vec_ld(0, (unsigned char *)0);],
[ac_cv_c_altivec="-faltivec"], [ac_cv_c_altivec="-faltivec"],
[# Linux/PPC test (old GCC versions) dnl Below this are the Linux tests
CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec" [# Linux/PPC test (gcc 4.x)
AC_TRY_COMPILE([#ifdef HAVE_ALTIVEC_H CFLAGS="${CFLAGS_save} -maltivec"
#include <altivec.h> AC_TRY_COMPILE([#include <altivec.h>],
#endif], [vec_ld(0, (unsigned char *)0);],
[ac_cv_c_altivec="-maltivec"],
[# Linux/PPC test (gcc 3.3)
CFLAGS="${CFLAGS_save} -maltivec -mabi=altivec"
AC_TRY_COMPILE([#include <altivec.h>],
[vec_ld(0, (unsigned char *)0);],
[ac_cv_c_altivec=""
ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
[# Linux/PPC test (gcc 3.3)
CFLAGS="${CFLAGS_save} -fvec"
AC_TRY_COMPILE([#include <altivec.h>],
[vec_ld(0, (unsigned char *)0);], [vec_ld(0, (unsigned char *)0);],
[ac_cv_c_altivec="-fvec"], [ac_cv_c_altivec="-fvec"],
[ac_cv_c_altivec=no]) [ac_cv_c_altivec=no])
]) ])
]) ])
CFLAGS="${CFLAGS_save}"]) ])
])
CFLAGS="${CFLAGS_save}"
])
if test "${ac_cv_c_maltivec}" != "no"; then
CPPFLAGS="${CPPFLAGS_save} -maltivec"
fi
AC_CHECK_HEADERS(altivec.h)
CPPFLAGS="${CPPFLAGS_save}"
if test "${ac_cv_c_altivec}" != "no"; then if test "${ac_cv_c_altivec}" != "no"; then
AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.) AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
VLC_ADD_CFLAGS([vlc],[${ac_cv_c_altivec}]) VLC_ADD_CFLAGS([vlc],[${ac_cv_c_altivec}])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment