Title: [154007] trunk
Revision
154007
Author
[email protected]
Date
2013-08-13 09:56:04 -0700 (Tue, 13 Aug 2013)

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

Modified Paths

Diff

Modified: trunk/ChangeLog (154006 => 154007)


--- trunk/ChangeLog	2013-08-13 16:19:31 UTC (rev 154006)
+++ trunk/ChangeLog	2013-08-13 16:56:04 UTC (rev 154007)
@@ -1,3 +1,21 @@
+2013-08-13  Zan Dobersek  <[email protected]>
+
+        [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  <[email protected]>
 
         [Autotools] Adjust the help string for the configure's --enable-optimizations flag

Modified: trunk/Source/autotools/CheckSystemAndBasicDependencies.m4 (154006 => 154007)


--- trunk/Source/autotools/CheckSystemAndBasicDependencies.m4	2013-08-13 16:19:31 UTC (rev 154006)
+++ trunk/Source/autotools/CheckSystemAndBasicDependencies.m4	2013-08-13 16:56:04 UTC (rev 154007)
@@ -79,25 +79,43 @@
 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

Modified: trunk/Source/autotools/SetupCompilerFlags.m4 (154006 => 154007)


--- trunk/Source/autotools/SetupCompilerFlags.m4	2013-08-13 16:19:31 UTC (rev 154006)
+++ trunk/Source/autotools/SetupCompilerFlags.m4	2013-08-13 16:56:04 UTC (rev 154007)
@@ -4,14 +4,14 @@
 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
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to