common/autoconf/build-performance.m4
changeset 22332 fba4c66089bb
parent 20363 fa7663fc5d50
child 22467 b16a5ae55d50
equal deleted inserted replaced
22331:f65a493da643 22332:fba4c66089bb
    23 # questions.
    23 # questions.
    24 #
    24 #
    25 
    25 
    26 AC_DEFUN([BPERF_CHECK_CORES],
    26 AC_DEFUN([BPERF_CHECK_CORES],
    27 [
    27 [
    28     AC_MSG_CHECKING([for number of cores])
    28   AC_MSG_CHECKING([for number of cores])
    29     NUM_CORES=1
    29   NUM_CORES=1
    30     FOUND_CORES=no
    30   FOUND_CORES=no
    31     
    31 
    32     if test -f /proc/cpuinfo; then
    32   if test -f /proc/cpuinfo; then
    33         # Looks like a Linux (or cygwin) system
    33     # Looks like a Linux (or cygwin) system
    34         NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
    34     NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
    35         FOUND_CORES=yes
    35     FOUND_CORES=yes
    36     elif test -x /usr/sbin/psrinfo; then
    36   elif test -x /usr/sbin/psrinfo; then
    37         # Looks like a Solaris system
    37     # Looks like a Solaris system
    38         NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
    38     NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
    39         FOUND_CORES=yes
    39     FOUND_CORES=yes
    40     elif test -x /usr/sbin/system_profiler; then
    40   elif test -x /usr/sbin/system_profiler; then
    41         # Looks like a MacOSX system
    41     # Looks like a MacOSX system
    42         NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
    42     NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
    43         FOUND_CORES=yes
    43     FOUND_CORES=yes
    44     elif test -n "$NUMBER_OF_PROCESSORS"; then
    44   elif test -n "$NUMBER_OF_PROCESSORS"; then
    45         # On windows, look in the env
    45     # On windows, look in the env
    46         NUM_CORES=$NUMBER_OF_PROCESSORS
    46     NUM_CORES=$NUMBER_OF_PROCESSORS
    47         FOUND_CORES=yes
    47     FOUND_CORES=yes
    48     fi
    48   fi
    49 
    49 
    50     if test "x$FOUND_CORES" = xyes; then
    50   if test "x$FOUND_CORES" = xyes; then
    51         AC_MSG_RESULT([$NUM_CORES])
    51     AC_MSG_RESULT([$NUM_CORES])
    52     else
    52   else
    53         AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
    53     AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
    54         AC_MSG_WARN([This will disable all parallelism from build!])
    54     AC_MSG_WARN([This will disable all parallelism from build!])
    55     fi 
    55   fi
    56 
       
    57 ])
    56 ])
    58 
    57 
    59 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
    58 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
    60 [
    59 [
    61     AC_MSG_CHECKING([for memory size])
    60   AC_MSG_CHECKING([for memory size])
    62     # Default to 1024 MB
    61   # Default to 1024 MB
    63     MEMORY_SIZE=1024
    62   MEMORY_SIZE=1024
    64     FOUND_MEM=no
    63   FOUND_MEM=no
    65     
    64 
    66     if test -f /proc/meminfo; then
    65   if test -f /proc/meminfo; then
    67         # Looks like a Linux (or cygwin) system
    66     # Looks like a Linux (or cygwin) system
    68         MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
    67     MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
    69         MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
    68     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
    70         FOUND_MEM=yes
    69     FOUND_MEM=yes
    71     elif test -x /usr/sbin/prtconf; then
    70   elif test -x /usr/sbin/prtconf; then
    72         # Looks like a Solaris system
    71     # Looks like a Solaris system
    73         MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
    72     MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
    74         FOUND_MEM=yes
    73     FOUND_MEM=yes
    75     elif test -x /usr/sbin/system_profiler; then
    74   elif test -x /usr/sbin/system_profiler; then
    76         # Looks like a MacOSX system
    75     # Looks like a MacOSX system
    77         MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
    76     MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
    78         MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
    77     MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
    79         FOUND_MEM=yes
    78     FOUND_MEM=yes
    80     elif test "x$OPENJDK_BUILD_OS" = xwindows; then
    79   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
    81         # Windows, but without cygwin
    80     # Windows, but without cygwin
    82         MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
    81     MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
    83         MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
    82     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
    84         FOUND_MEM=yes    
    83     FOUND_MEM=yes
    85     fi
    84   fi
    86 
    85 
    87     if test "x$FOUND_MEM" = xyes; then
    86   if test "x$FOUND_MEM" = xyes; then
    88         AC_MSG_RESULT([$MEMORY_SIZE MB])
    87     AC_MSG_RESULT([$MEMORY_SIZE MB])
    89     else
    88   else
    90         AC_MSG_RESULT([could not detect memory size, defaulting to 1024 MB])
    89     AC_MSG_RESULT([could not detect memory size, defaulting to 1024 MB])
    91         AC_MSG_WARN([This might seriously impact build performance!])
    90     AC_MSG_WARN([This might seriously impact build performance!])
    92     fi 
    91   fi
    93 ])
    92 ])
    94 
    93 
    95 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
    94 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
    96 [
    95 [
    97   # How many cores do we have on this build system?
    96   # How many cores do we have on this build system?
    98   AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
    97   AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
    99     [number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
    98       [number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
   100   if test "x$with_num_cores" = x; then
    99   if test "x$with_num_cores" = x; then
   101     # The number of cores were not specified, try to probe them.
   100     # The number of cores were not specified, try to probe them.
   102     BPERF_CHECK_CORES
   101     BPERF_CHECK_CORES
   103   else
   102   else
   104     NUM_CORES=$with_num_cores
   103     NUM_CORES=$with_num_cores
   108 
   107 
   109 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_MEMORY],
   108 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_MEMORY],
   110 [
   109 [
   111   # How much memory do we have on this build system?
   110   # How much memory do we have on this build system?
   112   AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
   111   AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
   113     [memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
   112       [memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
   114   if test "x$with_memory_size" = x; then
   113   if test "x$with_memory_size" = x; then
   115     # The memory size was not specified, try to probe it.
   114     # The memory size was not specified, try to probe it.
   116     BPERF_CHECK_MEMORY_SIZE
   115     BPERF_CHECK_MEMORY_SIZE
   117   else
   116   else
   118     MEMORY_SIZE=$with_memory_size
   117     MEMORY_SIZE=$with_memory_size
   120   AC_SUBST(MEMORY_SIZE)
   119   AC_SUBST(MEMORY_SIZE)
   121 ])
   120 ])
   122 
   121 
   123 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
   122 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
   124 [
   123 [
   125   # Provide a decent default number of parallel jobs for make depending on 
   124   # Provide a decent default number of parallel jobs for make depending on
   126   # number of cores, amount of memory and machine architecture.
   125   # number of cores, amount of memory and machine architecture.
   127   AC_ARG_WITH(jobs, [AS_HELP_STRING([--with-jobs],
   126   AC_ARG_WITH(jobs, [AS_HELP_STRING([--with-jobs],
   128     [number of parallel jobs to let make run @<:@calculated based on cores and memory@:>@])])
   127       [number of parallel jobs to let make run @<:@calculated based on cores and memory@:>@])])
   129   if test "x$with_jobs" = x; then
   128   if test "x$with_jobs" = x; then
   130     # Number of jobs was not specified, calculate.
   129     # Number of jobs was not specified, calculate.
   131     AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
   130     AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
   132     # Approximate memory in GB, rounding up a bit.
   131     # Approximate memory in GB, rounding up a bit.
   133     memory_gb=`expr $MEMORY_SIZE / 1100`
   132     memory_gb=`expr $MEMORY_SIZE / 1100`
   155   AC_SUBST(JOBS)
   154   AC_SUBST(JOBS)
   156 ])
   155 ])
   157 
   156 
   158 AC_DEFUN([BPERF_SETUP_CCACHE],
   157 AC_DEFUN([BPERF_SETUP_CCACHE],
   159 [
   158 [
   160     AC_ARG_ENABLE([ccache],
   159   AC_ARG_ENABLE([ccache],
   161 	      [AS_HELP_STRING([--disable-ccache],
   160       [AS_HELP_STRING([--disable-ccache],
   162 	      		      [disable using ccache to speed up recompilations @<:@enabled@:>@])],
   161       [disable using ccache to speed up recompilations @<:@enabled@:>@])],
   163               [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
   162       [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
   164     if test "x$ENABLE_CCACHE" = xyes; then
   163   if test "x$ENABLE_CCACHE" = xyes; then
   165         OLD_PATH="$PATH"
   164     OLD_PATH="$PATH"
   166         if test "x$TOOLS_DIR" != x; then
   165     if test "x$TOOLS_DIR" != x; then
   167           PATH=$TOOLS_DIR:$PATH
   166       PATH=$TOOLS_DIR:$PATH
   168         fi
   167     fi
   169         AC_PATH_PROG(CCACHE, ccache)
   168     AC_PATH_PROG(CCACHE, ccache)
   170         PATH="$OLD_PATH"
   169     PATH="$OLD_PATH"
       
   170   else
       
   171     AC_MSG_CHECKING([for ccache])
       
   172     AC_MSG_RESULT([explicitly disabled])
       
   173     CCACHE=
       
   174   fi
       
   175   AC_SUBST(CCACHE)
       
   176 
       
   177   AC_ARG_WITH([ccache-dir],
       
   178       [AS_HELP_STRING([--with-ccache-dir],
       
   179       [where to store ccache files @<:@~/.ccache@:>@])])
       
   180 
       
   181   if test "x$with_ccache_dir" != x; then
       
   182     # When using a non home ccache directory, assume the use is to share ccache files
       
   183     # with other users. Thus change the umask.
       
   184     SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
       
   185   fi
       
   186   CCACHE_FOUND=""
       
   187   if test "x$CCACHE" != x; then
       
   188     BPERF_SETUP_CCACHE_USAGE
       
   189   fi
       
   190 ])
       
   191 
       
   192 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
       
   193 [
       
   194   if test "x$CCACHE" != x; then
       
   195     CCACHE_FOUND="true"
       
   196     # Only use ccache if it is 3.1.4 or later, which supports
       
   197     # precompiled headers.
       
   198     AC_MSG_CHECKING([if ccache supports precompiled headers])
       
   199     HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
       
   200     if test "x$HAS_GOOD_CCACHE" = x; then
       
   201       AC_MSG_RESULT([no, disabling ccache])
       
   202       CCACHE=
   171     else
   203     else
   172         AC_MSG_CHECKING([for ccache])
   204       AC_MSG_RESULT([yes])
   173         AC_MSG_RESULT([explicitly disabled])    
   205       AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
       
   206       PUSHED_FLAGS="$CXXFLAGS"
       
   207       CXXFLAGS="-fpch-preprocess $CXXFLAGS"
       
   208       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
       
   209       CXXFLAGS="$PUSHED_FLAGS"
       
   210       if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
       
   211         AC_MSG_RESULT([yes])
       
   212       else
       
   213         AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
   174         CCACHE=
   214         CCACHE=
   175     fi    
   215       fi
   176     AC_SUBST(CCACHE)
   216     fi
   177 
   217   fi
   178     AC_ARG_WITH([ccache-dir],
   218 
   179 	      [AS_HELP_STRING([--with-ccache-dir],
   219   if test "x$CCACHE" != x; then
   180 	      		      [where to store ccache files @<:@~/.ccache@:>@])])
   220     CCACHE_SLOPPINESS=time_macros
   181 
   221     CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
   182     if test "x$with_ccache_dir" != x; then
   222     CCACHE_FLAGS=-fpch-preprocess
   183         # When using a non home ccache directory, assume the use is to share ccache files
   223 
   184         # with other users. Thus change the umask.
   224     if test "x$SET_CCACHE_DIR" != x; then
   185         SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
   225       mkdir -p $CCACHE_DIR > /dev/null 2>&1
   186     fi
   226       chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
   187     CCACHE_FOUND=""
   227     fi
   188     if test "x$CCACHE" != x; then
   228   fi
   189         BPERF_SETUP_CCACHE_USAGE
       
   190     fi    
       
   191 ])
       
   192 
       
   193 AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
       
   194 [
       
   195     if test "x$CCACHE" != x; then
       
   196         CCACHE_FOUND="true"
       
   197         # Only use ccache if it is 3.1.4 or later, which supports
       
   198         # precompiled headers.
       
   199         AC_MSG_CHECKING([if ccache supports precompiled headers])
       
   200         HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
       
   201         if test "x$HAS_GOOD_CCACHE" = x; then
       
   202             AC_MSG_RESULT([no, disabling ccache])
       
   203             CCACHE=
       
   204         else
       
   205             AC_MSG_RESULT([yes])
       
   206             AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
       
   207             PUSHED_FLAGS="$CXXFLAGS"
       
   208             CXXFLAGS="-fpch-preprocess $CXXFLAGS"
       
   209             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
       
   210             CXXFLAGS="$PUSHED_FLAGS"
       
   211             if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
       
   212                 AC_MSG_RESULT([yes])
       
   213             else
       
   214                 AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
       
   215                 CCACHE=
       
   216             fi
       
   217         fi
       
   218     fi
       
   219 
       
   220     if test "x$CCACHE" != x; then
       
   221         CCACHE_SLOPPINESS=time_macros
       
   222         CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
       
   223         CCACHE_FLAGS=-fpch-preprocess
       
   224 
       
   225         if test "x$SET_CCACHE_DIR" != x; then
       
   226             mkdir -p $CCACHE_DIR > /dev/null 2>&1
       
   227 	    chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
       
   228         fi
       
   229     fi
       
   230 ])
   229 ])
   231 
   230 
   232 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
   231 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
   233 [
   232 [
   234        
   233 
   235 ###############################################################################
   234   ###############################################################################
   236 #
   235   #
   237 # Can the C/C++ compiler use precompiled headers?
   236   # Can the C/C++ compiler use precompiled headers?
   238 #
   237   #
   239 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
   238   AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
   240 	[disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
   239       [disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
   241     [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
   240       [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
   242 
   241 
   243 USE_PRECOMPILED_HEADER=1
   242   USE_PRECOMPILED_HEADER=1
   244 if test "x$ENABLE_PRECOMPH" = xno; then
   243   if test "x$ENABLE_PRECOMPH" = xno; then
   245     USE_PRECOMPILED_HEADER=0
   244     USE_PRECOMPILED_HEADER=0
   246 fi
   245   fi
   247 
   246 
   248 if test "x$ENABLE_PRECOMPH" = xyes; then
   247   if test "x$ENABLE_PRECOMPH" = xyes; then
   249     # Check that the compiler actually supports precomp headers.
   248     # Check that the compiler actually supports precomp headers.
   250     if test "x$GCC" = xyes; then
   249     if test "x$GCC" = xyes; then
   251          AC_MSG_CHECKING([that precompiled headers work])
   250       AC_MSG_CHECKING([that precompiled headers work])
   252          echo "int alfa();" > conftest.h
   251       echo "int alfa();" > conftest.h
   253          $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
   252       $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
   254          if test ! -f conftest.hpp.gch; then
   253       if test ! -f conftest.hpp.gch; then
   255              USE_PRECOMPILED_HEADER=0
   254         USE_PRECOMPILED_HEADER=0
   256              AC_MSG_RESULT([no])        
   255         AC_MSG_RESULT([no])
   257          else
   256       else
   258              AC_MSG_RESULT([yes])
   257         AC_MSG_RESULT([yes])
   259          fi
   258       fi
   260          rm -f conftest.h conftest.hpp.gch
   259       rm -f conftest.h conftest.hpp.gch
   261     fi
   260     fi
   262 fi
   261   fi
   263 
   262 
   264 AC_SUBST(USE_PRECOMPILED_HEADER)
   263   AC_SUBST(USE_PRECOMPILED_HEADER)
   265 ])
   264 ])
   266 
   265 
   267 
   266 
   268 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
   267 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
   269 [
   268 [
   270 AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
   269   AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
   271 	[use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
   270       [use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
   272 
   271 
   273 if test "x$with_sjavac_server_java" != x; then
   272   if test "x$with_sjavac_server_java" != x; then
   274     SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
   273     SJAVAC_SERVER_JAVA="$with_sjavac_server_java"
   275     FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
   274     FOUND_VERSION=`$SJAVAC_SERVER_JAVA -version 2>&1 | grep " version \""`
   276     if test "x$FOUND_VERSION" = x; then
   275     if test "x$FOUND_VERSION" = x; then
   277         AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
   276       AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
   278     fi
   277     fi
   279 else
   278   else
   280     SJAVAC_SERVER_JAVA=""
   279     SJAVAC_SERVER_JAVA=""
   281     # Hotspot specific options.
   280     # Hotspot specific options.
   282     ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
   281     ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
   283     # JRockit specific options.
   282     # JRockit specific options.
   284     ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])
   283     ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])
   285     SJAVAC_SERVER_JAVA="$JAVA $SJAVAC_SERVER_JAVA"
   284     SJAVAC_SERVER_JAVA="$JAVA $SJAVAC_SERVER_JAVA"
   286 fi                    
   285   fi
   287 AC_SUBST(SJAVAC_SERVER_JAVA)
   286   AC_SUBST(SJAVAC_SERVER_JAVA)
   288 
   287 
   289 if test "$MEMORY_SIZE" -gt "2500"; then
   288   if test "$MEMORY_SIZE" -gt "2500"; then
   290     ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   289     ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   291     if test "$JVM_ARG_OK" = true; then
   290     if test "$JVM_ARG_OK" = true; then
   292         JVM_64BIT=true
   291       JVM_64BIT=true
   293 	JVM_ARG_OK=false
   292       JVM_ARG_OK=false
   294     fi
   293     fi
   295     fi
   294   fi
   296 
   295 
   297 if test "$JVM_64BIT" = true; then
   296   if test "$JVM_64BIT" = true; then
   298     if test "$MEMORY_SIZE" -gt "17000"; then
   297     if test "$MEMORY_SIZE" -gt "17000"; then
   299         ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   298       ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   300     fi
   299     fi
   301     if test "$MEMORY_SIZE" -gt "10000" && test "$JVM_ARG_OK" = false; then
   300     if test "$MEMORY_SIZE" -gt "10000" && test "$JVM_ARG_OK" = false; then
   302         ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   301       ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   303     fi
   302     fi
   304     if test "$MEMORY_SIZE" -gt "5000" && test "$JVM_ARG_OK" = false; then
   303     if test "$MEMORY_SIZE" -gt "5000" && test "$JVM_ARG_OK" = false; then
   305         ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   304       ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   306     fi
   305     fi
   307     if test "$MEMORY_SIZE" -gt "3800" && test "$JVM_ARG_OK" = false; then
   306     if test "$MEMORY_SIZE" -gt "3800" && test "$JVM_ARG_OK" = false; then
   308         ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   307       ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   309     fi
   308     fi
   310 fi
   309   fi
   311 if test "$MEMORY_SIZE" -gt "2500" && test "$JVM_ARG_OK" = false; then
   310   if test "$MEMORY_SIZE" -gt "2500" && test "$JVM_ARG_OK" = false; then
   312     ADD_JVM_ARG_IF_OK([-Xms1000M -Xmx1500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   311     ADD_JVM_ARG_IF_OK([-Xms1000M -Xmx1500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   313 fi
   312   fi
   314 if test "$MEMORY_SIZE" -gt "1000" && test "$JVM_ARG_OK" = false; then
   313   if test "$MEMORY_SIZE" -gt "1000" && test "$JVM_ARG_OK" = false; then
   315     ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   314     ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   316 fi
   315   fi
   317 if test "$JVM_ARG_OK" = false; then
   316   if test "$JVM_ARG_OK" = false; then
   318     ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   317     ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
   319 fi
   318   fi
   320 
   319 
   321 AC_MSG_CHECKING([whether to use sjavac])
   320   AC_MSG_CHECKING([whether to use sjavac])
   322 AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
   321   AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
   323 	[use sjavac to do fast incremental compiles @<:@disabled@:>@])],
   322       [use sjavac to do fast incremental compiles @<:@disabled@:>@])],
   324 	[ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC='no'])
   323       [ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC='no'])
   325 AC_MSG_RESULT([$ENABLE_SJAVAC])
   324   AC_MSG_RESULT([$ENABLE_SJAVAC])
   326 AC_SUBST(ENABLE_SJAVAC)
   325   AC_SUBST(ENABLE_SJAVAC)
   327 
   326 
   328 if test "x$ENABLE_SJAVAC" = xyes; then
   327   if test "x$ENABLE_SJAVAC" = xyes; then
   329     SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
   328     SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers"
   330 else
   329   else
   331     SJAVAC_SERVER_DIR=
   330     SJAVAC_SERVER_DIR=
   332 fi
   331   fi
   333 AC_SUBST(SJAVAC_SERVER_DIR)
   332   AC_SUBST(SJAVAC_SERVER_DIR)
   334 
   333 ])
   335 ])