Changeset 154007 in webkit


Ignore:
Timestamp:
Aug 13, 2013 9:56:04 AM (11 years ago)
Author:
zandobersek@gmail.com
Message:

[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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r153979 r154007  
     12013-08-13  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [Autotools] Don't compare $CC, $CXX to exact compiler names
     4        https://bugs.webkit.org/show_bug.cgi?id=119683
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Instead of comparing $CC and $CXX to exact compiler names (like 'gcc', 'clang++' etc.),
     9        use the compiler version checks to also specify the broader compiler collection of which
     10        the used compiler is a member of. This avoids failures in some border-line cases where
     11        the user would still use either a GCC or a Clang compiler but provide it through a symbolic
     12        link that was specified via the CC/CXX environment variables.
     13
     14        * Source/autotools/CheckSystemAndBasicDependencies.m4: Store the detected C/C++ compiler collection
     15        in c_compiler/cxx_compiler. Throw an error if no supported compiler was found.
     16        * Source/autotools/SetupCompilerFlags.m4: Test for a specific compiler by checking against
     17        c_compiler/cxx_compiler rather than CC/CXX values.
     18
    1192013-08-12  Zan Dobersek  <zdobersek@igalia.com>
    220
  • trunk/Source/autotools/CheckSystemAndBasicDependencies.m4

    r148248 r154007  
    8080
    8181# Check that an appropriate C compiler is available.
     82c_compiler="unknown"
    8283AC_LANG_PUSH([C])
    8384AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
    84 #if !(defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7) \
    85     && !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
    86 #error Unsupported compiler
     85#if !(defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7)
     86#error Not a supported GCC compiler
    8787#endif
    88 ],[])],[],[AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C compilation])])
     88])], [c_compiler="gcc"], [])
     89AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
     90#if !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
     91#error Not a supported Clang compiler
     92#endif
     93])], [c_compiler="clang"], [])
    8994AC_LANG_POP([C])
    9095
     96if test "$c_compiler" = "unknown"; then
     97    AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C compilation])
     98fi
     99
    91100# Check that an appropriate C++ compiler is available.
     101cxx_compiler="unknown"
    92102AC_LANG_PUSH([C++])
    93103AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
    94 #if !(defined(__GNUG__) && defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7) \
    95     && !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
    96 #error Unsupported compiler
     104#if !(defined(__GNUG__) && defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 7)
     105#error Not a supported G++ compiler
    97106#endif
    98 ],[])],[],[AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C++ compilation])])
     107])], [cxx_compiler="g++"], [])
     108AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
     109#if !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 0)
     110#error Not a supported Clang++ compiler
     111#endif
     112])], [cxx_compiler="clang++"], [])
    99113AC_LANG_POP([C++])
     114
     115if test "$cxx_compiler" = "unknown"; then
     116    AC_MSG_ERROR([Compiler GCC >= 4.7 or Clang >= 3.0 is required for C++ compilation])
     117fi
    100118
    101119# C/C++ Language Features
  • trunk/Source/autotools/SetupCompilerFlags.m4

    r150445 r154007  
    55
    66# Clang requires suppression of unused arguments warnings.
    7 if test "$CC" = "clang"; then
     7if test "$c_compiler" = "clang"; then
    88    CFLAGS="$CFLAGS -Qunused-arguments"
    99fi
     
    1212# -Wno-c++11-extensions, currently only usable with Clang, suppresses warnings of C++11 extensions in use.
    1313# Suppress unused arguments warnings for C++ files as well.
    14 if test "$CXX" = "clang++"; then
     14if test "$cxx_compiler" = "clang++"; then
    1515    CXXFLAGS="$CXXFLAGS -stdlib=libstdc++ -Wno-c++11-extensions -Qunused-arguments"
    1616fi
Note: See TracChangeset for help on using the changeset viewer.