From cca662bdc6f952d9a619249ab4820642221dbb1f Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Wed, 14 Apr 2010 16:53:16 +0200 Subject: [PATCH] restrict from applying gcc only flags testings of gcc's optimization variables against other compilers can't be trusted as they might just propagate them to linker, without throwing an error to autoconf. In the suncc case, the linker will fail later. --- configure.ac | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 7234e3aa37..f11fa0bc4f 100644 --- a/configure.ac +++ b/configure.ac @@ -878,6 +878,18 @@ AS_IF([test "${enable_debug}" != "no"], [ AC_DEFINE(NDEBUG) ]) +dnl Set up version & compiler variables for various hacks +if test "$GCC" = "yes"; then + AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1`", [compiler]) +else + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) + if test "$SUNCC" = "yes"; then + AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -V 2>&1 | head -n 1`", [compiler]) + else + AC_DEFINE_UNQUOTED(VLC_COMPILER, "unknown", [compiler]) + fi +fi + dnl dnl Profiling dnl @@ -930,7 +942,6 @@ AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [ AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS]) ]) - dnl dnl Enable/disable optimizations dnl @@ -1509,21 +1520,23 @@ dnl AC_ARG_WITH(tuning, [AS_HELP_STRING([--with-tuning=ARCH], [tune compilation for an architecture (default varies)])]) -if test -n "${with_tuning}"; then - if test "${with_tuning}" != "no"; then - CFLAGS_TUNING="-mtune=${with_tuning}" - fi -else - if test "${SYS}" = "darwin" -a "${host_cpu}" = "i686"; then - CFLAGS_TUNING="-march=prescott -mtune=generic" - elif test "${SYS}" = "darwin" -a "${host_cpu}" = "x86_64"; then - CFLAGS_TUNING="-march=core2 -mtune=core2" - elif test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "i486" -o "${host_cpu}" = "i386"; then - CFLAGS_TUNING="-mtune=pentium2" - elif test "${host_cpu}" = "x86_64"; then - CFLAGS_TUNING="-mtune=athlon64" - elif test "${host_cpu}" = "powerpc"; then - CFLAGS_TUNING="-mtune=G4"; +if test "$SUNCC" != "yes"; then + if test -n "${with_tuning}"; then + if test "${with_tuning}" != "no"; then + CFLAGS_TUNING="-mtune=${with_tuning}" + fi + else + if test "${SYS}" = "darwin" -a "${host_cpu}" = "i686"; then + CFLAGS_TUNING="-march=prescott -mtune=generic" + elif test "${SYS}" = "darwin" -a "${host_cpu}" = "x86_64"; then + CFLAGS_TUNING="-march=core2 -mtune=core2" + elif test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "i486" -o "${host_cpu}" = "i386"; then + CFLAGS_TUNING="-mtune=pentium2" + elif test "${host_cpu}" = "x86_64"; then + CFLAGS_TUNING="-mtune=athlon64" + elif test "${host_cpu}" = "powerpc"; then + CFLAGS_TUNING="-mtune=G4"; + fi fi fi -- 2.11.4.GIT