annotate common/autoconf/build-performance.m4 @ 43388:509c3ebb5c97

8004842: Unify values of boolean make variables set in configure to true/false Reviewed-by: erikj
author ihse
date Fri, 03 Feb 2017 15:19:38 +0100
parents 8c12153445ae
children 676afd13dea5
rev   line source
erikj@13133 1 #
ihse@35747 2 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
erikj@13133 26 AC_DEFUN([BPERF_CHECK_CORES],
erikj@13133 27 [
ihse@20363 28 AC_MSG_CHECKING([for number of cores])
ihse@20363 29 NUM_CORES=1
ihse@20363 30 FOUND_CORES=no
erikj@13133 31
ihse@20363 32 if test -f /proc/cpuinfo; then
ihse@20363 33 # Looks like a Linux (or cygwin) system
ihse@20363 34 NUM_CORES=`cat /proc/cpuinfo | grep -c processor`
ihse@20363 35 FOUND_CORES=yes
ihse@20363 36 elif test -x /usr/sbin/psrinfo; then
ihse@20363 37 # Looks like a Solaris system
ihse@20363 38 NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
ihse@20363 39 FOUND_CORES=yes
erikj@35035 40 elif test -x /usr/sbin/sysctl; then
ihse@20363 41 # Looks like a MacOSX system
erikj@35035 42 NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
ihse@20363 43 FOUND_CORES=yes
kvn@22467 44 elif test "x$OPENJDK_BUILD_OS" = xaix ; then
kvn@22467 45 NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
kvn@22467 46 FOUND_CORES=yes
ihse@20363 47 elif test -n "$NUMBER_OF_PROCESSORS"; then
ihse@20363 48 # On windows, look in the env
ihse@20363 49 NUM_CORES=$NUMBER_OF_PROCESSORS
ihse@20363 50 FOUND_CORES=yes
ihse@20363 51 fi
erikj@13133 52
ihse@20363 53 if test "x$FOUND_CORES" = xyes; then
ihse@20363 54 AC_MSG_RESULT([$NUM_CORES])
ihse@20363 55 else
ihse@20363 56 AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
ihse@20363 57 AC_MSG_WARN([This will disable all parallelism from build!])
ihse@20363 58 fi
erikj@13133 59 ])
erikj@13133 60
erikj@13133 61 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
erikj@13133 62 [
ihse@20363 63 AC_MSG_CHECKING([for memory size])
ihse@20363 64 # Default to 1024 MB
ihse@20363 65 MEMORY_SIZE=1024
ihse@20363 66 FOUND_MEM=no
erikj@13133 67
ihse@20363 68 if test -f /proc/meminfo; then
ihse@20363 69 # Looks like a Linux (or cygwin) system
ihse@20363 70 MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
ihse@20363 71 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
ihse@20363 72 FOUND_MEM=yes
ihse@20363 73 elif test -x /usr/sbin/prtconf; then
kvn@22467 74 # Looks like a Solaris or AIX system
ihse@35747 75 MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
ihse@20363 76 FOUND_MEM=yes
erikj@35035 77 elif test -x /usr/sbin/sysctl; then
ihse@20363 78 # Looks like a MacOSX system
erikj@35035 79 MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
erikj@35035 80 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
ihse@20363 81 FOUND_MEM=yes
ihse@20363 82 elif test "x$OPENJDK_BUILD_OS" = xwindows; then
ihse@20363 83 # Windows, but without cygwin
ihse@20363 84 MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
ihse@20363 85 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
ihse@20363 86 FOUND_MEM=yes
ihse@20363 87 fi
ihse@20363 88
ihse@20363 89 if test "x$FOUND_MEM" = xyes; then
ihse@20363 90 AC_MSG_RESULT([$MEMORY_SIZE MB])
ihse@20363 91 else
mduigou@23985 92 AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
ihse@20363 93 AC_MSG_WARN([This might seriously impact build performance!])
ihse@20363 94 fi
erikj@13133 95 ])
erikj@13133 96
erikj@13133 97 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
erikj@13133 98 [
erikj@15790 99 # How many cores do we have on this build system?
erikj@15790 100 AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
ihse@20363 101 [number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
erikj@15790 102 if test "x$with_num_cores" = x; then
erikj@13133 103 # The number of cores were not specified, try to probe them.
erikj@13133 104 BPERF_CHECK_CORES
erikj@15790 105 else
erikj@13133 106 NUM_CORES=$with_num_cores
erikj@15790 107 fi
erikj@15790 108 AC_SUBST(NUM_CORES)
erikj@13133 109 ])
erikj@13133 110
erikj@13133 111 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_MEMORY],
erikj@13133 112 [
erikj@15790 113 # How much memory do we have on this build system?
erikj@15790 114 AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
ihse@20363 115 [memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
erikj@15790 116 if test "x$with_memory_size" = x; then
erikj@13133 117 # The memory size was not specified, try to probe it.
erikj@13133 118 BPERF_CHECK_MEMORY_SIZE
erikj@15790 119 else
erikj@13133 120 MEMORY_SIZE=$with_memory_size
erikj@15790 121 fi
erikj@15790 122 AC_SUBST(MEMORY_SIZE)
erikj@15790 123 ])
erikj@15790 124
erikj@15790 125 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
erikj@15790 126 [
ihse@20363 127 # Provide a decent default number of parallel jobs for make depending on
erikj@15790 128 # number of cores, amount of memory and machine architecture.
erikj@15790 129 AC_ARG_WITH(jobs, [AS_HELP_STRING([--with-jobs],
ihse@20363 130 [number of parallel jobs to let make run @<:@calculated based on cores and memory@:>@])])
erikj@15790 131 if test "x$with_jobs" = x; then
erikj@15790 132 # Number of jobs was not specified, calculate.
erikj@15790 133 AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
erikj@26131 134 # Approximate memory in GB.
erikj@26131 135 memory_gb=`expr $MEMORY_SIZE / 1024`
erikj@15790 136 # Pick the lowest of memory in gb and number of cores.
erikj@15790 137 if test "$memory_gb" -lt "$NUM_CORES"; then
erikj@15790 138 JOBS="$memory_gb"
erikj@15790 139 else
erikj@15790 140 JOBS="$NUM_CORES"
erikj@15790 141 fi
erikj@17660 142 if test "$JOBS" -eq "0"; then
erikj@17660 143 JOBS=1
erikj@17660 144 fi
erikj@15790 145 AC_MSG_RESULT([$JOBS])
erikj@15790 146 else
erikj@15790 147 JOBS=$with_jobs
erikj@15790 148 fi
erikj@15790 149 AC_SUBST(JOBS)
erikj@13133 150 ])
erikj@13133 151
ehelin@34594 152 AC_DEFUN_ONCE([BPERF_SETUP_TEST_JOBS],
ehelin@34594 153 [
ehelin@34594 154 # The number of test jobs will be chosen automatically if TEST_JOBS is 0
ehelin@34594 155 AC_ARG_WITH(test-jobs, [AS_HELP_STRING([--with-test-jobs],
ehelin@34594 156 [number of parallel tests jobs to run @<:@based on build jobs@:>@])])
ehelin@34594 157 if test "x$with_test_jobs" = x; then
ehelin@34594 158 TEST_JOBS=0
ehelin@34594 159 else
ehelin@34594 160 TEST_JOBS=$with_test_jobs
ehelin@34594 161 fi
ehelin@34594 162 AC_SUBST(TEST_JOBS)
ehelin@34594 163 ])
ehelin@34594 164
erikj@13133 165 AC_DEFUN([BPERF_SETUP_CCACHE],
erikj@13133 166 [
ihse@20363 167 AC_ARG_ENABLE([ccache],
ihse@22474 168 [AS_HELP_STRING([--enable-ccache],
ihse@22474 169 [enable using ccache to speed up recompilations @<:@disabled@:>@])])
ihse@22474 170
erikj@28812 171 CCACHE_STATUS=
ihse@22474 172 AC_MSG_CHECKING([is ccache enabled])
ihse@22474 173 if test "x$enable_ccache" = xyes; then
erikj@28812 174 if test "x$TOOLCHAIN_TYPE" = "xgcc" -o "x$TOOLCHAIN_TYPE" = "xclang"; then
erikj@28812 175 AC_MSG_RESULT([yes])
erikj@28812 176 OLD_PATH="$PATH"
erikj@28812 177 if test "x$TOOLCHAIN_PATH" != x; then
erikj@28812 178 PATH=$TOOLCHAIN_PATH:$PATH
erikj@28812 179 fi
erikj@28812 180 BASIC_REQUIRE_PROGS(CCACHE, ccache)
erikj@28812 181 PATH="$OLD_PATH"
erikj@28812 182 CCACHE_VERSION=[`$CCACHE --version | head -n1 | $SED 's/[A-Za-z ]*//'`]
erikj@28812 183 CCACHE_STATUS="Active ($CCACHE_VERSION)"
erikj@28812 184 else
erikj@28812 185 AC_MSG_RESULT([no])
erikj@28812 186 AC_MSG_WARN([ccache is not supported with toolchain type $TOOLCHAIN_TYPE])
ihse@20363 187 fi
ihse@22474 188 elif test "x$enable_ccache" = xno; then
ihse@22474 189 AC_MSG_RESULT([no, explicitly disabled])
erikj@28812 190 CCACHE_STATUS="Disabled"
ihse@22474 191 elif test "x$enable_ccache" = x; then
ihse@22474 192 AC_MSG_RESULT([no])
ihse@20363 193 else
ihse@22474 194 AC_MSG_RESULT([unknown])
ihse@22474 195 AC_MSG_ERROR([--enable-ccache does not accept any parameters])
ihse@20363 196 fi
ihse@20363 197 AC_SUBST(CCACHE)
erikj@13133 198
ihse@20363 199 AC_ARG_WITH([ccache-dir],
ihse@20363 200 [AS_HELP_STRING([--with-ccache-dir],
ihse@20363 201 [where to store ccache files @<:@~/.ccache@:>@])])
erikj@13133 202
ihse@20363 203 if test "x$with_ccache_dir" != x; then
ihse@20363 204 # When using a non home ccache directory, assume the use is to share ccache files
ihse@20363 205 # with other users. Thus change the umask.
ihse@20363 206 SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
ihse@22474 207 if test "x$CCACHE" = x; then
ihse@22474 208 AC_MSG_WARN([--with-ccache-dir has no meaning when ccache is not enabled])
ihse@22474 209 fi
ihse@20363 210 fi
ihse@22474 211
ihse@20363 212 if test "x$CCACHE" != x; then
ihse@20363 213 BPERF_SETUP_CCACHE_USAGE
ihse@20363 214 fi
erikj@13133 215 ])
erikj@13133 216
erikj@13133 217 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
erikj@13133 218 [
ihse@20363 219 if test "x$CCACHE" != x; then
ihse@42298 220 if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
ihse@42298 221 HAS_BAD_CCACHE=[`$ECHO $CCACHE_VERSION | \
ihse@42298 222 $GREP -e '^1\.' -e '^2\.' -e '^3\.0\.' -e '^3\.1\.'`]
ihse@42298 223 if test "x$HAS_BAD_CCACHE" != "x"; then
ihse@42298 224 AC_MSG_ERROR([On macosx, ccache 3.2 or later is required, found $CCACHE_VERSION])
ihse@42298 225 fi
ihse@42298 226 fi
ihse@43388 227 if test "x$USE_PRECOMPILED_HEADER" = "xtrue"; then
erikj@28812 228 HAS_BAD_CCACHE=[`$ECHO $CCACHE_VERSION | \
srl@29175 229 $GREP -e '^1.*' -e '^2.*' -e '^3\.0.*' -e '^3\.1\.[0123]$'`]
erikj@28812 230 if test "x$HAS_BAD_CCACHE" != "x"; then
erikj@28812 231 AC_MSG_ERROR([Precompiled headers requires ccache 3.1.4 or later, found $CCACHE_VERSION])
erikj@28812 232 fi
ihse@20363 233 AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
erikj@28812 234 CCACHE_PRECOMP_FLAG="-fpch-preprocess"
ihse@20363 235 PUSHED_FLAGS="$CXXFLAGS"
erikj@28812 236 CXXFLAGS="$CCACHE_PRECOMP_FLAG $CXXFLAGS"
ihse@20363 237 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
ihse@20363 238 CXXFLAGS="$PUSHED_FLAGS"
ihse@20363 239 if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
ihse@20363 240 AC_MSG_RESULT([yes])
erikj@28812 241 CFLAGS_CCACHE="$CCACHE_PRECOMP_FLAG"
erikj@28812 242 AC_SUBST(CFLAGS_CCACHE)
erikj@28812 243 CCACHE_SLOPPINESS=pch_defines,time_macros
ihse@20363 244 else
erikj@28812 245 AC_MSG_RESULT([no])
erikj@28812 246 AC_MSG_ERROR([Cannot use ccache with precompiled headers without compiler support for $CCACHE_PRECOMP_FLAG])
ihse@20363 247 fi
erikj@13133 248 fi
erikj@13133 249
erikj@28812 250 CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR \
erikj@28812 251 CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS CCACHE_BASEDIR=$TOPDIR $CCACHE"
erikj@13133 252
ihse@20363 253 if test "x$SET_CCACHE_DIR" != x; then
ihse@20363 254 mkdir -p $CCACHE_DIR > /dev/null 2>&1
ihse@20363 255 chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
erikj@13133 256 fi
ihse@20363 257 fi
erikj@13133 258 ])
erikj@13133 259
erikj@34103 260 ################################################################################
erikj@34103 261 #
erikj@34867 262 # Runs icecc-create-env once and prints the error if it fails
erikj@34867 263 #
erikj@34867 264 # $1: arguments to icecc-create-env
erikj@34867 265 # $2: log file
erikj@34867 266 #
erikj@34867 267 AC_DEFUN([BPERF_RUN_ICECC_CREATE_ENV],
erikj@34867 268 [
ihse@35747 269 ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
ihse@35747 270 && ${ICECC_CREATE_ENV} $1 > $2 2>&1 )
erikj@34867 271 if test "$?" != "0"; then
erikj@34867 272 AC_MSG_NOTICE([icecc-create-env output:])
erikj@34867 273 cat $2
erikj@34867 274 AC_MSG_ERROR([Failed to create icecc compiler environment])
erikj@34867 275 fi
erikj@34867 276 ])
erikj@34867 277
erikj@34867 278 ################################################################################
erikj@34867 279 #
erikj@34103 280 # Optionally enable distributed compilation of native code using icecc/icecream
erikj@34103 281 #
erikj@34103 282 AC_DEFUN([BPERF_SETUP_ICECC],
erikj@34103 283 [
erikj@34103 284 AC_ARG_ENABLE([icecc], [AS_HELP_STRING([--enable-icecc],
erikj@34103 285 [enable distribted compilation of native code using icecc/icecream @<:@disabled@:>@])])
erikj@34103 286
erikj@34103 287 if test "x${enable_icecc}" = "xyes"; then
erikj@34103 288 BASIC_REQUIRE_PROGS(ICECC_CMD, icecc)
erikj@34103 289 old_path="$PATH"
erikj@34103 290
erikj@34103 291 # Look for icecc-create-env in some known places
erikj@34103 292 PATH="$PATH:/usr/lib/icecc:/usr/lib64/icecc"
erikj@34103 293 BASIC_REQUIRE_PROGS(ICECC_CREATE_ENV, icecc-create-env)
erikj@34103 294 # Use icecc-create-env to create a minimal compilation environment that can
erikj@34103 295 # be sent to the other hosts in the icecream cluster.
erikj@34103 296 icecc_create_env_log="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env.log"
erikj@34103 297 ${MKDIR} -p ${CONFIGURESUPPORT_OUTPUTDIR}/icecc
erikj@34867 298 # Older versions of icecc does not have the --gcc parameter
erikj@34867 299 if ${ICECC_CREATE_ENV} | $GREP -q -e --gcc; then
erikj@34867 300 icecc_gcc_arg="--gcc"
erikj@34867 301 fi
erikj@34103 302 if test "x${TOOLCHAIN_TYPE}" = "xgcc"; then
erikj@34867 303 BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${CC} ${CXX}], \
erikj@34867 304 ${icecc_create_env_log})
erikj@34103 305 elif test "x$TOOLCHAIN_TYPE" = "xclang"; then
erikj@34103 306 # For clang, the icecc compilerwrapper is needed. It usually resides next
erikj@34103 307 # to icecc-create-env.
erikj@34103 308 BASIC_REQUIRE_PROGS(ICECC_WRAPPER, compilerwrapper)
erikj@34867 309 BPERF_RUN_ICECC_CREATE_ENV([--clang ${CC} ${ICECC_WRAPPER}], ${icecc_create_env_log})
erikj@34103 310 else
erikj@34103 311 AC_MSG_ERROR([Can only create icecc compiler packages for toolchain types gcc and clang])
erikj@34103 312 fi
erikj@34103 313 PATH="$old_path"
erikj@34103 314 # The bundle with the compiler gets a name based on checksums. Parse log file
erikj@34103 315 # to find it.
erikj@34103 316 ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
erikj@34103 317 ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
erikj@34867 318 if test ! -f ${ICECC_ENV_BUNDLE}; then
erikj@34867 319 AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
erikj@34867 320 fi
erikj@34867 321 AC_MSG_CHECKING([for icecc build environment for target compiler])
erikj@34103 322 AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
erikj@34103 323 ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${CC} ICECC_CXX=${CXX} ${ICECC_CMD}"
erikj@34103 324
erikj@34103 325 if test "x${COMPILE_TYPE}" = "xcross"; then
erikj@34103 326 # If cross compiling, create a separate env package for the build compiler
erikj@34103 327 # Assume "gcc" or "cc" is gcc and "clang" is clang. Otherwise bail.
erikj@34867 328 icecc_create_env_log_build="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env_build.log"
erikj@34103 329 if test "x${BUILD_CC##*/}" = "xgcc" || test "x${BUILD_CC##*/}" = "xcc"; then
erikj@34867 330 BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${BUILD_CC} ${BUILD_CXX}], \
erikj@34867 331 ${icecc_create_env_log_build})
erikj@34103 332 elif test "x${BUILD_CC##*/}" = "xclang"; then
erikj@34867 333 BPERF_RUN_ICECC_CREATE_ENV([--clang ${BUILD_CC} ${ICECC_WRAPPER}], ${icecc_create_env_log_build})
erikj@34103 334 else
erikj@34103 335 AC_MSG_ERROR([Cannot create icecc compiler package for ${BUILD_CC}])
erikj@34103 336 fi
erikj@34867 337 ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log_build}`"
erikj@34103 338 ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
erikj@34867 339 if test ! -f ${ICECC_ENV_BUNDLE}; then
erikj@34867 340 AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
erikj@34867 341 fi
erikj@34867 342 AC_MSG_CHECKING([for icecc build environment for build compiler])
erikj@34103 343 AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
erikj@34103 344 BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
erikj@34103 345 ICECC_CXX=${BUILD_CXX} ${ICECC_CMD}"
erikj@34103 346 else
erikj@34103 347 BUILD_ICECC="${ICECC}"
erikj@34103 348 fi
erikj@34103 349 AC_SUBST(ICECC)
erikj@34103 350 AC_SUBST(BUILD_ICECC)
erikj@34103 351 fi
erikj@34103 352 ])
erikj@34103 353
erikj@13133 354 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
erikj@13133 355 [
erikj@13133 356
ihse@20363 357 ###############################################################################
ihse@20363 358 #
ihse@20363 359 # Can the C/C++ compiler use precompiled headers?
ihse@20363 360 #
ihse@20363 361 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
ihse@20363 362 [disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
ihse@20363 363 [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
ihse@20363 364
ihse@43388 365 USE_PRECOMPILED_HEADER=true
erikj@34103 366 AC_MSG_CHECKING([If precompiled header is enabled])
ihse@20363 367 if test "x$ENABLE_PRECOMPH" = xno; then
erikj@34103 368 AC_MSG_RESULT([no, forced])
ihse@43388 369 USE_PRECOMPILED_HEADER=false
erikj@34103 370 elif test "x$ICECC" != "x"; then
erikj@34103 371 AC_MSG_RESULT([no, does not work effectively with icecc])
ihse@43388 372 USE_PRECOMPILED_HEADER=false
erikj@37402 373 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
erikj@37402 374 AC_MSG_RESULT([no, does not work with Solaris Studio])
ihse@43388 375 USE_PRECOMPILED_HEADER=false
simonis@39191 376 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
simonis@39191 377 AC_MSG_RESULT([no, does not work with xlc])
ihse@43388 378 USE_PRECOMPILED_HEADER=false
erikj@34103 379 else
erikj@34103 380 AC_MSG_RESULT([yes])
ihse@20363 381 fi
erikj@13133 382
ihse@20363 383 if test "x$ENABLE_PRECOMPH" = xyes; then
erikj@13133 384 # Check that the compiler actually supports precomp headers.
ihse@22721 385 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@20363 386 AC_MSG_CHECKING([that precompiled headers work])
ihse@20363 387 echo "int alfa();" > conftest.h
ihse@20363 388 $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
ihse@20363 389 if test ! -f conftest.hpp.gch; then
ihse@43388 390 USE_PRECOMPILED_HEADER=false
ihse@20363 391 AC_MSG_RESULT([no])
ihse@20363 392 else
ihse@20363 393 AC_MSG_RESULT([yes])
ihse@20363 394 fi
erikj@38843 395 $RM conftest.h conftest.hpp.gch
erikj@13133 396 fi
ihse@20363 397 fi
erikj@13133 398
ihse@20363 399 AC_SUBST(USE_PRECOMPILED_HEADER)
erikj@13133 400 ])
erikj@13133 401
erikj@13133 402
erikj@13133 403 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
erikj@13133 404 [
ihse@20363 405 AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
ihse@20363 406 [use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
erikj@13133 407
ihse@20363 408 if test "x$with_sjavac_server_java" != x; then
ohair@13697 409 SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
ohair@13697 410 FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
erikj@13133 411 if test "x$FOUND_VERSION" = x; then
ihse@20363 412 AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
erikj@13133 413 fi
ihse@20363 414 else
erikj@26131 415 SJAVAC_SERVER_JAVA="$JAVA"
ihse@20363 416 fi
ihse@20363 417 AC_SUBST(SJAVAC_SERVER_JAVA)
erikj@13133 418
erikj@26131 419 if test "$MEMORY_SIZE" -gt "3000"; then
erikj@26907 420 ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
erikj@17592 421 if test "$JVM_ARG_OK" = true; then
ihse@20363 422 JVM_64BIT=true
ihse@20363 423 JVM_ARG_OK=false
erikj@17592 424 fi
ihse@20363 425 fi
erikj@13133 426
erikj@26131 427 MX_VALUE=`expr $MEMORY_SIZE / 2`
ihse@20363 428 if test "$JVM_64BIT" = true; then
erikj@26131 429 # Set ms lower than mx since more than one instance of the server might
erikj@26131 430 # get launched at the same time before they figure out which instance won.
erikj@26131 431 MS_VALUE=512
erikj@26131 432 if test "$MX_VALUE" -gt "2048"; then
erikj@26131 433 MX_VALUE=2048
erikj@17592 434 fi
erikj@26131 435 else
erikj@26131 436 MS_VALUE=256
erikj@26131 437 if test "$MX_VALUE" -gt "1500"; then
erikj@26131 438 MX_VALUE=1500
erikj@13133 439 fi
ihse@20363 440 fi
erikj@26131 441 if test "$MX_VALUE" -lt "512"; then
erikj@26131 442 MX_VALUE=512
ihse@20363 443 fi
erikj@26907 444 ADD_JVM_ARG_IF_OK([-Xms${MS_VALUE}M -Xmx${MX_VALUE}M],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
erikj@26907 445 AC_SUBST(SJAVAC_SERVER_JAVA_FLAGS)
erikj@13133 446
ihse@20363 447 AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
ihse@20363 448 [use sjavac to do fast incremental compiles @<:@disabled@:>@])],
erikj@33055 449 [ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC="no"])
erikj@26131 450 if test "x$JVM_ARG_OK" = "xfalse"; then
erikj@26131 451 AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac])
erikj@33055 452 ENABLE_SJAVAC="no"
erikj@26131 453 fi
erikj@26131 454 AC_MSG_CHECKING([whether to use sjavac])
ihse@20363 455 AC_MSG_RESULT([$ENABLE_SJAVAC])
ihse@20363 456 AC_SUBST(ENABLE_SJAVAC)
erikj@33055 457
erikj@34104 458 AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--disable-javac-server],
erikj@34104 459 [disable javac server @<:@enabled@:>@])],
erikj@34104 460 [ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER="yes"])
erikj@33055 461 if test "x$JVM_ARG_OK" = "xfalse"; then
erikj@33055 462 AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling javac server])
erikj@33055 463 ENABLE_JAVAC_SERVER="no"
erikj@33055 464 fi
erikj@33055 465 AC_MSG_CHECKING([whether to use javac server])
erikj@33055 466 AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
erikj@33055 467 AC_SUBST(ENABLE_JAVAC_SERVER)
erikj@34101 468
omajid@37036 469 if test "x$ENABLE_JAVAC_SERVER" = "xyes" || test "x$ENABLE_SJAVAC" = "xyes"; then
erikj@34101 470 # When using a server javac, the small client instances do not need much
erikj@34101 471 # resources.
erikj@34101 472 JAVA_FLAGS_JAVAC="$JAVA_FLAGS_SMALL"
erikj@34101 473 fi
erikj@13133 474 ])