From 5e4dfd3d4e87e0464d599ecef06aa8fe78420a9b Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 28 Oct 2015 13:56:40 -0400 Subject: configure: disallow ccache during compile tests If the user is using ccache during the configuration step, it may interfere with some of the configuration tests, particularly the "Is ccache interfering with macro analysis" step, which is a bit of a poetic problem. 1) Disallow ccache from reading from the cache during configure, but don't disable it entirely to allow us to see if it causes other problems. 2) Force off CCACHE_CPP2 during the ccache test to get a deterministic answer over whether or not we need to enable that feature later. Signed-off-by: John Snow Message-Id: <1446055000-29150-1-git-send-email-jsnow@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 7a1d08d..9c726eb 100755 --- a/configure +++ b/configure @@ -8,6 +8,9 @@ CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS +# Don't allow CCACHE, if present, to use cached results of compile tests! +export CCACHE_RECACHE=yes + # Temporary directory used for files created while # configure runs. Since it is in the build directory # we can safely blow away any previous version of it @@ -4412,6 +4415,7 @@ fi # check if ccache is interfering with # semantic analysis of macros +unset CCACHE_CPP2 ccache_cpp2=no cat > $TMPC << EOF static const int Z = 1; -- cgit v1.1 From b553a0428014636bce4951098e97c60dc18a83ed Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 3 Nov 2015 15:43:42 -0500 Subject: configure: disable FORTIFY_SOURCE under clang Some versions of clang may have difficulty compiling glibc headers when -D_FORTIFY_SOURCE is used. For example, Clang++ 3.5.0-9.fc22 cannot compile glibc's stdio headers when -D_FORTIFY_SOURCE=2 is used. This manifests currently as build failures with clang and any arm target. According to LLVM dev Richard Smith, clang does not target or support FORTIFY_SOURCE + glibc, and it should not be relied on. "It's still an unsupported combination, and while it might compile, some of the checks are unlikely to work because they require a frontend inliner to be useful" See: http://lists.llvm.org/pipermail/cfe-dev/2015-November/045846.html Conclusion: disable fortify-source if we appear to be using clang instead of testing for compile success or failure, which may be incidental or not indicative of proper support of the feature. Signed-off-by: John Snow Message-Id: <1446583422-10153-1-git-send-email-jsnow@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index 9c726eb..a1ac1c7 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ rdma="" gprof="no" debug_tcg="no" debug="no" +fortify_source="" strip_opt="yes" tcg_interpreter="no" bigendian="no" @@ -879,6 +880,7 @@ for opt do debug_tcg="yes" debug="yes" strip_opt="no" + fortify_source="no" ;; --enable-sparse) sparse="yes" ;; @@ -4439,6 +4441,19 @@ if ! compile_object "-Werror"; then ccache_cpp2=yes fi +################################################# +# clang does not support glibc + FORTIFY_SOURCE. + +if test "$fortify_source" != "no"; then + if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then + fortify_source="no"; + elif echo | $cxx -dM -E - | grep __clang__ > /dev/null 2>&1 ; then + fortify_source="no"; + else + fortify_source="yes" + fi +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -4446,7 +4461,7 @@ fi if test "$gcov" = "yes" ; then CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" -elif test "$debug" = "no" ; then +elif test "$fortify_source" = "yes" ; then CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" fi -- cgit v1.1