common/autoconf/build-performance.m4

Print this page




 159                               [disable using ccache to speed up recompilations @<:@enabled@:>@])],
 160               [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
 161     if test "x$ENABLE_CCACHE" = xyes; then
 162         AC_PATH_PROG(CCACHE, ccache)
 163     else
 164         AC_MSG_CHECKING([for ccache])
 165         AC_MSG_RESULT([explicitly disabled])    
 166         CCACHE=
 167     fi    
 168     AC_SUBST(CCACHE)
 169 
 170     AC_ARG_WITH([ccache-dir],
 171               [AS_HELP_STRING([--with-ccache-dir],
 172                               [where to store ccache files @<:@~/.ccache@:>@])])
 173 
 174     if test "x$with_ccache_dir" != x; then
 175         # When using a non home ccache directory, assume the use is to share ccache files
 176         # with other users. Thus change the umask.
 177         SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
 178     fi
 179     CCACHE_FOUND=""
 180     if test "x$CCACHE" != x; then
 181         BPERF_SETUP_CCACHE_USAGE
 182     fi    
 183 ])
 184 
 185 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
 186 [
 187     if test "x$CCACHE" != x; then
 188         CCACHE_FOUND="true"
 189         # Only use ccache if it is 3.1.4 or later, which supports
 190         # precompiled headers.
 191         AC_MSG_CHECKING([if ccache supports precompiled headers])
 192         HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
 193         if test "x$HAS_GOOD_CCACHE" = x; then
 194             AC_MSG_RESULT([no, disabling ccache])
 195             CCACHE=
 196         else
 197             AC_MSG_RESULT([yes])
 198             AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
 199             PUSHED_FLAGS="$CXXFLAGS"
 200             CXXFLAGS="-fpch-preprocess $CXXFLAGS"
 201             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
 202             CXXFLAGS="$PUSHED_FLAGS"
 203             if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
 204                 AC_MSG_RESULT([yes])
 205             else
 206                 AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
 207                 CCACHE=
 208             fi
 209         fi
 210     fi
 211 
 212     if test "x$CCACHE" != x; then
 213         CCACHE_SLOPPINESS=time_macros
 214         CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
 215         CCACHE_FLAGS=-fpch-preprocess
 216 
 217         if test "x$SET_CCACHE_DIR" != x; then
 218             mkdir -p $CCACHE_DIR > /dev/null 2>&1
 219             chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
 220         fi
 221     fi
 222 ])
 223 
 224 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
 225 [
 226        
 227 ###############################################################################
 228 #
 229 # Can the C/C++ compiler use precompiled headers?
 230 #
 231 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
 232         [disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
 233     [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
 234 
 235 USE_PRECOMPILED_HEADER=1
 236 if test "x$ENABLE_PRECOMPH" = xno; then
 237     USE_PRECOMPILED_HEADER=0
 238 fi
 239 
 240 if test "x$ENABLE_PRECOMPH" = xyes; then

 241     # Check that the compiler actually supports precomp headers.
 242     if test "x$GCC" = xyes; then
 243          AC_MSG_CHECKING([that precompiled headers work])
 244          echo "int alfa();" > conftest.h
 245          $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
 246          if test ! -f conftest.hpp.gch; then
 247              USE_PRECOMPILED_HEADER=0
 248              AC_MSG_RESULT([no])        
 249          else
 250              AC_MSG_RESULT([yes])
 251          fi
 252          rm -f conftest.h conftest.hpp.gch
 253     fi
 254 fi
 255 
 256 AC_SUBST(USE_PRECOMPILED_HEADER)
 257 ])
 258 
 259 
 260 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
 261 [
 262 AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
 263         [use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
 264 
 265 if test "x$with_sjavac_server_java" != x; then
 266     SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
 267     FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
 268     if test "x$FOUND_VERSION" = x; then
 269         AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
 270     fi
 271 else
 272     SJAVAC_SERVER_JAVA=""
 273     # Hotspot specific options.
 274     ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
 275     # JRockit specific options.
 276     ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])




 159                               [disable using ccache to speed up recompilations @<:@enabled@:>@])],
 160               [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
 161     if test "x$ENABLE_CCACHE" = xyes; then
 162         AC_PATH_PROG(CCACHE, ccache)
 163     else
 164         AC_MSG_CHECKING([for ccache])
 165         AC_MSG_RESULT([explicitly disabled])    
 166         CCACHE=
 167     fi    
 168     AC_SUBST(CCACHE)
 169 
 170     AC_ARG_WITH([ccache-dir],
 171               [AS_HELP_STRING([--with-ccache-dir],
 172                               [where to store ccache files @<:@~/.ccache@:>@])])
 173 
 174     if test "x$with_ccache_dir" != x; then
 175         # When using a non home ccache directory, assume the use is to share ccache files
 176         # with other users. Thus change the umask.
 177         SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
 178     fi

































 179     if test "x$CCACHE" != x; then
 180         CCACHE_SLOPPINESS=time_macros
 181         CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"

 182 
 183         if test "x$SET_CCACHE_DIR" != x; then
 184             mkdir -p $with_ccache_dir > /dev/null 2>&1
 185             chmod a+rwxs $with_ccache_dir > /dev/null 2>&1
 186         fi
 187     fi
 188 ])
 189 
 190 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
 191 [
 192        
 193 ###############################################################################
 194 #
 195 # Can the C/C++ compiler use precompiled headers?
 196 #
 197 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
 198         [disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
 199     [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
 200 
 201   USE_PRECOMPILED_HEADER=1
 202   if test "x$ENABLE_PRECOMPH" = xno; then
 203     USE_PRECOMPILED_HEADER=0
 204   elif test "x$CCACHE" != x; then
 205     # Disable precompiled header when using ccache as they don't work well together.
 206     USE_PRECOMPILED_HEADER=0
 207   elif test "x$ENABLE_PRECOMPH" = xyes; then
 208     # Check that the compiler actually supports precomp headers.
 209     if test "x$GCC" = xyes; then
 210        AC_MSG_CHECKING([that precompiled headers work])
 211        echo "int alfa();" > conftest.h
 212        $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
 213        if test ! -f conftest.hpp.gch; then
 214          USE_PRECOMPILED_HEADER=0
 215          AC_MSG_RESULT([no])        
 216        else
 217          AC_MSG_RESULT([yes])
 218        fi
 219        rm -f conftest.h conftest.hpp.gch
 220     fi
 221   fi
 222 
 223   AC_SUBST(USE_PRECOMPILED_HEADER)
 224 ])
 225 
 226 
 227 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
 228 [
 229 AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
 230         [use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
 231 
 232 if test "x$with_sjavac_server_java" != x; then
 233     SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
 234     FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
 235     if test "x$FOUND_VERSION" = x; then
 236         AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
 237     fi
 238 else
 239     SJAVAC_SERVER_JAVA=""
 240     # Hotspot specific options.
 241     ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
 242     # JRockit specific options.
 243     ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])