فهرست منبع

Detect and use -fcolor-diagnostics if available (clang)

Bryan Drewery 13 سال پیش
والد
کامیت
06e0657c75
3فایلهای تغییر یافته به همراه71 افزوده شده و 0 حذف شده
  1. 1 0
      build/autotools/configure.ac
  2. 30 0
      build/autotools/includes/acinclude.m4
  3. 40 0
      configure

+ 1 - 0
build/autotools/configure.ac

@@ -30,6 +30,7 @@ AC_CACHE_SAVE
 # Speedup compile
 EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
+CHECK_CC_COLOR_DIAGNOSTICS
 
 EGG_CHECK_DEPMODE
 

+ 30 - 0
build/autotools/includes/acinclude.m4

@@ -213,6 +213,36 @@ fi
 AC_SUBST(STATIC)dnl
 ])
 
+dnl CHECK_CC_COLOR_DIAGNOSTICS()
+dnl
+dnl See if the compiler supports -fcolor-diagnostics (Clang).
+dnl
+AC_DEFUN([CHECK_CC_COLOR_DIAGNOSTICS],
+[
+  if test -n "$GXX" && test -z "$no_color_diagnostics"; then
+    AC_CACHE_CHECK([whether the compiler understands -fcolor-diagnostics], egg_cv_var_cc_color_diagnostics, [
+      ac_old_CXXFLAGS="$CXXFLAGS"
+      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
+       AC_COMPILE_IFELSE([[
+         int main ()
+         {
+           return(0);
+         }
+       ]], [
+         egg_cv_var_cc_color_diagnostics="yes"
+       ], [
+         egg_cv_var_cc_color_diagnostics="no"
+       ])
+      CXXFLAGS="$ac_old_CXXFLAGS"
+    ])
+
+    if test "$egg_cv_var_cc_color_diagnostics" = "yes"; then
+      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
+    fi
+  fi
+])
+
+
 dnl EGG_PROG_HEAD_1()
 dnl
 AC_DEFUN([EGG_PROG_HEAD_1],

+ 40 - 0
configure

@@ -3680,6 +3680,46 @@ $as_echo "$egg_cv_var_ccpipe" >&6; }
   fi
 
 
+  if test -n "$GXX" && test -z "$no_color_diagnostics"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fcolor-diagnostics" >&5
+$as_echo_n "checking whether the compiler understands -fcolor-diagnostics... " >&6; }
+if ${egg_cv_var_cc_color_diagnostics+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      ac_old_CXXFLAGS="$CXXFLAGS"
+      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
+       cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end build/confdefs.h.  */
+
+         int main ()
+         {
+           return(0);
+         }
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+         egg_cv_var_cc_color_diagnostics="yes"
+
+else
+
+         egg_cv_var_cc_color_diagnostics="no"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CXXFLAGS="$ac_old_CXXFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_var_cc_color_diagnostics" >&5
+$as_echo "$egg_cv_var_cc_color_diagnostics" >&6; }
+
+    if test "$egg_cv_var_cc_color_diagnostics" = "yes"; then
+      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
+    fi
+  fi
+
+
 
 CCDEPMODE=gcc
 num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`