158 ]) |
158 ]) |
159 |
159 |
160 AC_DEFUN([BPERF_SETUP_CCACHE], |
160 AC_DEFUN([BPERF_SETUP_CCACHE], |
161 [ |
161 [ |
162 AC_ARG_ENABLE([ccache], |
162 AC_ARG_ENABLE([ccache], |
163 [AS_HELP_STRING([--disable-ccache], |
163 [AS_HELP_STRING([--enable-ccache], |
164 [disable using ccache to speed up recompilations @<:@enabled@:>@])], |
164 [enable using ccache to speed up recompilations @<:@disabled@:>@])]) |
165 [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes]) |
165 |
166 if test "x$ENABLE_CCACHE" = xyes; then |
166 CCACHE= |
|
167 AC_MSG_CHECKING([is ccache enabled]) |
|
168 ENABLE_CCACHE=$enable_ccache |
|
169 if test "x$enable_ccache" = xyes; then |
|
170 AC_MSG_RESULT([yes]) |
167 OLD_PATH="$PATH" |
171 OLD_PATH="$PATH" |
168 if test "x$TOOLS_DIR" != x; then |
172 if test "x$TOOLS_DIR" != x; then |
169 PATH=$TOOLS_DIR:$PATH |
173 PATH=$TOOLS_DIR:$PATH |
170 fi |
174 fi |
171 AC_PATH_PROG(CCACHE, ccache) |
175 BASIC_REQUIRE_PROG(CCACHE, ccache) |
|
176 CCACHE_STATUS="enabled" |
172 PATH="$OLD_PATH" |
177 PATH="$OLD_PATH" |
173 else |
178 elif test "x$enable_ccache" = xno; then |
174 AC_MSG_CHECKING([for ccache]) |
179 AC_MSG_RESULT([no, explicitly disabled]) |
175 AC_MSG_RESULT([explicitly disabled]) |
180 elif test "x$enable_ccache" = x; then |
176 CCACHE= |
181 AC_MSG_RESULT([no]) |
|
182 else |
|
183 AC_MSG_RESULT([unknown]) |
|
184 AC_MSG_ERROR([--enable-ccache does not accept any parameters]) |
177 fi |
185 fi |
178 AC_SUBST(CCACHE) |
186 AC_SUBST(CCACHE) |
179 |
187 |
180 AC_ARG_WITH([ccache-dir], |
188 AC_ARG_WITH([ccache-dir], |
181 [AS_HELP_STRING([--with-ccache-dir], |
189 [AS_HELP_STRING([--with-ccache-dir], |
183 |
191 |
184 if test "x$with_ccache_dir" != x; then |
192 if test "x$with_ccache_dir" != x; then |
185 # When using a non home ccache directory, assume the use is to share ccache files |
193 # When using a non home ccache directory, assume the use is to share ccache files |
186 # with other users. Thus change the umask. |
194 # with other users. Thus change the umask. |
187 SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002" |
195 SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002" |
188 fi |
196 if test "x$CCACHE" = x; then |
189 CCACHE_FOUND="" |
197 AC_MSG_WARN([--with-ccache-dir has no meaning when ccache is not enabled]) |
|
198 fi |
|
199 fi |
|
200 |
190 if test "x$CCACHE" != x; then |
201 if test "x$CCACHE" != x; then |
191 BPERF_SETUP_CCACHE_USAGE |
202 BPERF_SETUP_CCACHE_USAGE |
192 fi |
203 fi |
193 ]) |
204 ]) |
194 |
205 |
195 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE], |
206 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE], |
196 [ |
207 [ |
197 if test "x$CCACHE" != x; then |
208 if test "x$CCACHE" != x; then |
198 CCACHE_FOUND="true" |
|
199 # Only use ccache if it is 3.1.4 or later, which supports |
209 # Only use ccache if it is 3.1.4 or later, which supports |
200 # precompiled headers. |
210 # precompiled headers. |
201 AC_MSG_CHECKING([if ccache supports precompiled headers]) |
211 AC_MSG_CHECKING([if ccache supports precompiled headers]) |
202 HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null` |
212 HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null` |
203 if test "x$HAS_GOOD_CCACHE" = x; then |
213 if test "x$HAS_GOOD_CCACHE" = x; then |
204 AC_MSG_RESULT([no, disabling ccache]) |
214 AC_MSG_RESULT([no, disabling ccache]) |
205 CCACHE= |
215 CCACHE= |
|
216 CCACHE_STATUS="disabled" |
206 else |
217 else |
207 AC_MSG_RESULT([yes]) |
218 AC_MSG_RESULT([yes]) |
208 AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers]) |
219 AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers]) |
209 PUSHED_FLAGS="$CXXFLAGS" |
220 PUSHED_FLAGS="$CXXFLAGS" |
210 CXXFLAGS="-fpch-preprocess $CXXFLAGS" |
221 CXXFLAGS="-fpch-preprocess $CXXFLAGS" |