Add a configure check for the pch flags as clang doesn't support -fpch-deps

Originally committed to SVN as r6918.
This commit is contained in:
Thomas Goyne 2012-06-23 17:22:08 +00:00
parent 4129051684
commit e4e80b4d3d
3 changed files with 25 additions and 1 deletions

View File

@ -147,7 +147,7 @@ OBJCXXFLAGS := $(CXXFLAGS)
#################### ####################
ifeq (yes, $(PRECOMPILED_HEADER)) ifeq (yes, $(PRECOMPILED_HEADER))
ifdef PRECOMPILED_HEADER_NAME ifdef PRECOMPILED_HEADER_NAME
CXXFLAGS += -include $(PRECOMPILED_HEADER_NAME) -Winvalid-pch -fpch-deps -fpch-preprocess CXXFLAGS += -include $(PRECOMPILED_HEADER_NAME) $(PCHFLAGS)
# This hack is required until we can use the 'private' keyword (gmake 3.82) to avoid all the # This hack is required until we can use the 'private' keyword (gmake 3.82) to avoid all the
# per-object CXXFLAGS being triggered by the ($OBJ) line. # per-object CXXFLAGS being triggered by the ($OBJ) line.
CXXFLAGS_GNU_MAKE_SUCKS := $(CXXFLAGS) CXXFLAGS_GNU_MAKE_SUCKS := $(CXXFLAGS)

View File

@ -532,6 +532,9 @@ AC_MSG_CHECKING([whether to use precompiled headers])
AC_ARG_ENABLE(gcc-prec, AS_HELP_STRING([--disable-gcc-prec],[disable GCC precompiled headers])) AC_ARG_ENABLE(gcc-prec, AS_HELP_STRING([--disable-gcc-prec],[disable GCC precompiled headers]))
AC_MSG_RESULT([${enable_gcc_prec:=yes}]) AC_MSG_RESULT([${enable_gcc_prec:=yes}])
AC_SUBST(enable_gcc_prec) AC_SUBST(enable_gcc_prec)
AC_PCH_FLAG([-Winvalid-pch])
AC_PCH_FLAG([-fpch-deps])
AC_PCH_FLAG([-fpch-preprocess])
########### ###########
# Profiling # Profiling

View File

@ -28,3 +28,24 @@ AC_DEFUN([AC_CXX_FLAG], [{
]) ])
AC_LANG_POP(C++) AC_LANG_POP(C++)
}]) }])
AC_DEFUN([AC_PCH_FLAG], [{
AC_LANG_PUSH(C++)
ac_cxx_flag_save="$CXXFLAGS"
ac_cxx_werror_flag_save="$ac_cxx_werror_flag"
ac_cxx_werror_flag=yes
CXXFLAGS="$CXXFLAGS -Werror $1"
AC_MSG_CHECKING([[whether $CXX supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[
PCHFLAGS="$PCHFLAGS $1"
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
$2
])
CXXFLAGS="$ac_cxx_flag_save"
ac_cxx_werror_flag="$ac_cxx_werror_flag_save"
AC_LANG_POP(C++)
}])