Bläddra i källkod

Switch to using CXX_FLAG_CHECK for -fcolor-diagnostics [clang]

Bryan Drewery 12 år sedan
förälder
incheckning
9e9d8f5bcd
3 ändrade filer med 40 tillägg och 53 borttagningar
  1. 1 1
      build/autotools/configure.ac
  2. 0 30
      build/autotools/includes/acinclude.m4
  3. 39 22
      configure

+ 1 - 1
build/autotools/configure.ac

@@ -30,7 +30,7 @@ AC_CACHE_SAVE
 # Speedup compile
 EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
-CHECK_CC_COLOR_DIAGNOSTICS
+CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
 CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotector])
 
 EGG_CHECK_DEPMODE

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

@@ -243,36 +243,6 @@ 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([AC_LANG_SOURCE([
-         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],

+ 39 - 22
configure

@@ -3680,43 +3680,60 @@ $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 "$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 :
+if ${egg_cv_prog_cc_colordiagnostics+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-      ac_old_CXXFLAGS="$CXXFLAGS"
-      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
-       cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+    ac_saved_flags="$CXXFLAGS"
+    CXXFLAGS="-Werror -fcolor-diagnostics"
+    cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end build/confdefs.h.  */
 
-         int main ()
-         {
-           return(0);
-         }
+int
+main ()
+{
 
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-
-         egg_cv_var_cc_color_diagnostics="yes"
-
+  egg_cv_prog_cc_colordiagnostics="yes"
 else
-
-         egg_cv_var_cc_color_diagnostics="no"
-
+  egg_cv_prog_cc_colordiagnostics="no"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-      CXXFLAGS="$ac_old_CXXFLAGS"
+    CXXFLAGS="$ac_saved_flags"
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
 
 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_colordiagnostics" >&5
+$as_echo "$egg_cv_prog_cc_colordiagnostics" >&6; }
 
-    if test "$egg_cv_var_cc_color_diagnostics" = "yes"; then
-      CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
-    fi
+  if [ "$egg_cv_prog_cc_colordiagnostics" = "yes" ]; then
+    CXXFLAGS="$CXXFLAGS -fcolor-diagnostics"
+  elif [ -n "" ]; then
+      cat << 'EOF' >&2
+configure: error:
+
+  Your OS or C++ compiler does not support -fcolor-diagnostics.
+  This compile flag is required.
+
+EOF
+    exit 1
   fi