Commit c1aaaea0 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

[Autotools] Don't compare $CC, $CXX to exact compiler names

https://bugs.webkit.org/show_bug.cgi?id=119683

Reviewed by Gustavo Noronha Silva.

Instead of comparing $CC and $CXX to exact compiler names (like 'gcc', 'clang++' etc.),
use the compiler version checks to also specify the broader compiler collection of which
the used compiler is a member of. This avoids failures in some border-line cases where
the user would still use either a GCC or a Clang compiler but provide it through a symbolic
link that was specified via the CC/CXX environment variables.

* Source/autotools/CheckSystemAndBasicDependencies.m4: Store the detected C/C++ compiler collection
in c_compiler/cxx_compiler. Throw an error if no supported compiler was found.
* Source/autotools/SetupCompilerFlags.m4: Test for a specific compiler by checking against
c_compiler/cxx_compiler rather than CC/CXX values.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 85ee948c
2013-08-13 Zan Dobersek <zdobersek@igalia.com>
[Autotools] Don't compare $CC, $CXX to exact compiler names
https://bugs.webkit.org/show_bug.cgi?id=119683
Reviewed by Gustavo Noronha Silva.
Instead of comparing $CC and $CXX to exact compiler names (like 'gcc', 'clang++' etc.),
use the compiler version checks to also specify the broader compiler collection of which
the used compiler is a member of. This avoids failures in some border-line cases where
the user would still use either a GCC or a Clang compiler but provide it through a symbolic
link that was specified via the CC/CXX environment variables.
* Source/autotools/CheckSystemAndBasicDependencies.m4: Store the detected C/C++ compiler collection
in c_compiler/cxx_compiler. Throw an error if no supported compiler was found.
* Source/autotools/SetupCompilerFlags.m4: Test for a specific compiler by checking against
c_compiler/cxx_compiler rather than CC/CXX values.
2013-08-12 Zan Dobersek <zdobersek@igalia.com>
[Autotools] Adjust the help string for the configure's --enable-optimizations flag
......
......@@ -79,25 +79,43 @@ AC_PROG_INSTALL
AC_SYS_LARGEFILE
# Check that an appropriate C compiler is available.
c_compiler="unknown"
AC_LANG_PUSH([C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#if !(defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7) \
&& !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
#error Unsupported compiler
#if !(defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7)
#error Not a supported GCC compiler
#endif
],[])],[],[AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C compilation])])
])], [c_compiler="gcc"], [])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#if !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
#error Not a supported Clang compiler
#endif
])], [c_compiler="clang"], [])
AC_LANG_POP([C])
if test "$c_compiler" = "unknown"; then
AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C compilation])
fi
# Check that an appropriate C++ compiler is available.
cxx_compiler="unknown"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#if !(defined(__GNUG__) && defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7) \
&& !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
#error Unsupported compiler
#if !(defined(__GNUG__) && defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7)
#error Not a supported G++ compiler
#endif
],[])],[],[AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C++ compilation])])
])], [cxx_compiler="g++"], [])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#if !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
#error Not a supported Clang++ compiler
#endif
])], [cxx_compiler="clang++"], [])
AC_LANG_POP([C++])
if test "$cxx_compiler" = "unknown"; then
AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C++ compilation])
fi
# C/C++ Language Features
AC_C_CONST
AC_C_INLINE
......
......@@ -4,14 +4,14 @@ CFLAGS="$CFLAGS -std=c99"
CXXFLAGS="$CXXFLAGS -std=c++11 -Wno-c++11-compat"
# Clang requires suppression of unused arguments warnings.
if test "$CC" = "clang"; then
if test "$c_compiler" = "clang"; then
CFLAGS="$CFLAGS -Qunused-arguments"
fi
# libstdc++ is at the moment the only option as the C++ standard library when compiling with Clang.
# -Wno-c++11-extensions, currently only usable with Clang, suppresses warnings of C++11 extensions in use.
# Suppress unused arguments warnings for C++ files as well.
if test "$CXX" = "clang++"; then
if test "$cxx_compiler" = "clang++"; then
CXXFLAGS="$CXXFLAGS -stdlib=libstdc++ -Wno-c++11-extensions -Qunused-arguments"
fi
......
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