common/autoconf/configure.ac

changeset 425
e1830598f0b7
child 430
afeeed8e5f8c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/autoconf/configure.ac	Tue Apr 10 08:18:28 2012 -0700
     1.3 @@ -0,0 +1,2651 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +AC_PREREQ([2.61])
    1.30 +AC_INIT(openjdk, version-0.1, build-infra-dev@openjdk.java.net)
    1.31 +
    1.32 +AC_CONFIG_AUX_DIR([build-aux])
    1.33 +
    1.34 +m4_include([build-aux/pkg.m4])
    1.35 +m4_include([builddeps.m4])
    1.36 +m4_include([platform.m4])
    1.37 +m4_include([cores.m4])
    1.38 +m4_include([help.m4])
    1.39 +
    1.40 +# Save the command line. Do this very early, before it is lost by calling autoconf macros.
    1.41 +CONFIGURE_COMMAND_LINE="$@"
    1.42 +AC_SUBST(CONFIGURE_COMMAND_LINE)
    1.43 +
    1.44 +# Locate the directory of this script.
    1.45 +SCRIPT="[$]0"
    1.46 +REMOVE_SYMBOLIC_LINKS(SCRIPT)        
    1.47 +AUTOCONF_DIR=`dirname [$]0`
    1.48 +
    1.49 +# Start with tools that do not need have cross compilation support
    1.50 +# and can be expected to be found in the default PATH. These tools are
    1.51 +# used by configure. Nor are these tools expected to be found in the
    1.52 +# devkit from the builddeps server either, since they are
    1.53 +# needed to download the devkit. 
    1.54 +AC_PROG_AWK
    1.55 +CHECK_NONEMPTY(AWK)
    1.56 +AC_PATH_PROG(CAT, cat)
    1.57 +CHECK_NONEMPTY(CAT)
    1.58 +AC_PATH_PROG(CHMOD, chmod)
    1.59 +CHECK_NONEMPTY(CHMOD)
    1.60 +AC_PATH_PROG(CP, cp)
    1.61 +CHECK_NONEMPTY(CP)
    1.62 +AC_PATH_PROG(CPIO, cpio)
    1.63 +CHECK_NONEMPTY(CPIO)
    1.64 +AC_PATH_PROG(CUT, cut)
    1.65 +CHECK_NONEMPTY(CUT)
    1.66 +AC_PATH_PROG(DATE, date)
    1.67 +CHECK_NONEMPTY(DATE)
    1.68 +AC_PATH_PROG(DF, df)
    1.69 +CHECK_NONEMPTY(DF)
    1.70 +AC_PATH_PROG(DIFF, diff)
    1.71 +CHECK_NONEMPTY(DIFF)
    1.72 +# Warning echo is really, really unportable!!!!! Different
    1.73 +# behaviour in bash and dash and in a lot of other shells!
    1.74 +# Use printf for serious work! 
    1.75 +AC_PATH_PROG(ECHO, echo)
    1.76 +CHECK_NONEMPTY(ECHO)
    1.77 +AC_PROG_EGREP
    1.78 +CHECK_NONEMPTY(EGREP)
    1.79 +AC_PROG_FGREP
    1.80 +CHECK_NONEMPTY(FGREP)
    1.81 +
    1.82 +AC_PATH_PROG(FIND, find)
    1.83 +CHECK_NONEMPTY(FIND)
    1.84 +CHECK_FIND_DELETE
    1.85 +AC_SUBST(FIND_DELETE)
    1.86 +
    1.87 +AC_PROG_GREP
    1.88 +CHECK_NONEMPTY(GREP)
    1.89 +AC_PATH_PROG(HEAD, head)
    1.90 +CHECK_NONEMPTY(HEAD)
    1.91 +AC_PATH_PROG(LN, ln)
    1.92 +CHECK_NONEMPTY(LN)
    1.93 +AC_PATH_PROG(LS, ls)
    1.94 +CHECK_NONEMPTY(LS)
    1.95 +AC_PATH_PROGS(MAKE, [gmake make])
    1.96 +CHECK_NONEMPTY(MAKE)
    1.97 +MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'`
    1.98 +if test "x$MAKE_VERSION" = x; then
    1.99 +    AC_ERROR([You must use GNU make 3.81 or newer! Please put it in the path.])
   1.100 +fi
   1.101 +AC_PATH_PROG(MKDIR, mkdir)
   1.102 +CHECK_NONEMPTY(MKDIR)
   1.103 +AC_PATH_PROG(MV, mv)
   1.104 +CHECK_NONEMPTY(MV)
   1.105 +AC_PATH_PROGS(NAWK, [nawk gawk awk])
   1.106 +CHECK_NONEMPTY(NAWK)
   1.107 +AC_PATH_PROG(PRINTF, printf)
   1.108 +CHECK_NONEMPTY(PRINTF)
   1.109 +AC_PATH_PROG(THEPWDCMD, pwd)
   1.110 +AC_PATH_PROG(RM, rm)
   1.111 +CHECK_NONEMPTY(RM)
   1.112 +RM="$RM -f"
   1.113 +AC_PROG_SED
   1.114 +CHECK_NONEMPTY(SED)
   1.115 +AC_PATH_PROG(SH, sh)
   1.116 +CHECK_NONEMPTY(SH)
   1.117 +AC_PATH_PROG(SORT, sort)
   1.118 +CHECK_NONEMPTY(SORT)
   1.119 +AC_PATH_PROG(TAR, tar)
   1.120 +CHECK_NONEMPTY(TAR)
   1.121 +AC_PATH_PROG(TAIL, tail)
   1.122 +CHECK_NONEMPTY(TAIL)
   1.123 +AC_PATH_PROG(TEE, tee)
   1.124 +CHECK_NONEMPTY(TEE)
   1.125 +AC_PATH_PROG(TR, tr)
   1.126 +CHECK_NONEMPTY(TR)
   1.127 +AC_PATH_PROG(TOUCH, touch)
   1.128 +CHECK_NONEMPTY(TOUCH)
   1.129 +AC_PATH_PROG(WC, wc)
   1.130 +CHECK_NONEMPTY(WC)
   1.131 +AC_PATH_PROG(XARGS, xargs)
   1.132 +CHECK_NONEMPTY(XARGS)
   1.133 +AC_PATH_PROG(ZIP, zip)
   1.134 +CHECK_NONEMPTY(ZIP)
   1.135 +AC_PATH_PROG(UNZIP, unzip)
   1.136 +CHECK_NONEMPTY(UNZIP)
   1.137 +AC_PATH_PROG(LDD, ldd)
   1.138 +if test "x$LDD" = "x"; then
   1.139 +    # List shared lib dependencies is used for
   1.140 +    # debug output and checking for forbidden dependencies.
   1.141 +    # We can build without it.
   1.142 +    LDD="true"
   1.143 +fi
   1.144 +AC_PATH_PROG(OTOOL, otool)
   1.145 +if test "x$OTOOL" = "x"; then
   1.146 +   OTOOL="true"
   1.147 +fi
   1.148 +AC_PATH_PROG(READELF, readelf)
   1.149 +AC_PATH_PROG(EXPR, expr)
   1.150 +CHECK_NONEMPTY(EXPR)
   1.151 +AC_PATH_PROG(FILE, file)
   1.152 +CHECK_NONEMPTY(FILE)
   1.153 +# Figure out the build and host system.
   1.154 +AC_CANONICAL_BUILD
   1.155 +AC_CANONICAL_HOST
   1.156 +
   1.157 +AC_ARG_WITH(data-model, [AS_HELP_STRING([--with-data-model],
   1.158 +   [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-data-model=32 @<:@guessed@:>@])])
   1.159 +
   1.160 +if test "x$with_data_model" != x && \
   1.161 +   test "x$with_data_model" != x32 && \
   1.162 +   test "x$with_data_model" != x64 ; then
   1.163 +    AC_ERROR([The data model can only be 32 or 64!])
   1.164 +fi
   1.165 +# Translate the standard cpu-vendor-kernel-os quadruplets into
   1.166 +# the new HOST_.... and BUILD_... and the legacy names used by
   1.167 +# the openjdk build.
   1.168 +# It uses $host_os $host_cpu $build_os $build_cpu and $with_data_model
   1.169 +EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS
   1.170 +# Now the following vars are defined.
   1.171 +# HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows
   1.172 +# HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince
   1.173 +# HOST_OS_API=posix,winapi
   1.174 +#
   1.175 +# HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
   1.176 +# HOST_CPU_ARCH=x86,sparc,pcc,arm
   1.177 +# HOST_CPU_BITS=32,64
   1.178 +# HOST_CPU_ENDIAN=big,little
   1.179 +#
   1.180 +# There is also a:
   1.181 +# LEGACY_HOST_CPU1=i586,amd64,....  # used to set the old var ARCH
   1.182 +# LEGACY_HOST_CPU2=i386,amd64,.... # used to set the old var LIBARCH
   1.183 +# LEGACY_HOST_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris
   1.184 +# There was also a BUILDARCH that had i486,amd64,... but we do not use that
   1.185 +# in the new build.
   1.186 +# LEGACY_HOST_OS_API=solaris,windows # used to select source roots
   1.187 +
   1.188 +DATE_WHEN_CONFIGURED=`LANG=C date`
   1.189 +AC_SUBST(DATE_WHEN_CONFIGURED)
   1.190 +
   1.191 +# How many cores do we have on this build system?
   1.192 +AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
   1.193 +    [number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
   1.194 +if test "x$with_num_cores" = x; then
   1.195 +    # The number of cores were not specified, try to probe them.
   1.196 +    CHECK_CORES
   1.197 +else
   1.198 +    NUM_CORES=$with_num_cores
   1.199 +    CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
   1.200 +fi
   1.201 +AC_SUBST(NUM_CORES)
   1.202 +AC_SUBST(CONCURRENT_BUILD_JOBS)
   1.203 +
   1.204 +# How many cores do we have on this build system?
   1.205 +AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
   1.206 +    [memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
   1.207 +if test "x$with_memory_size" = x; then
   1.208 +    # The memory size was not specified, try to probe it.
   1.209 +    CHECK_MEMORY_SIZE
   1.210 +else
   1.211 +    MEMORY_SIZE=$with_memory_size
   1.212 +fi
   1.213 +AC_SUBST(MEMORY_SIZE)
   1.214 +
   1.215 +# Where is the source? It is located two levels above the configure script.
   1.216 +CURDIR="$PWD"
   1.217 +cd "$AUTOCONF_DIR/../.."
   1.218 +SRC_ROOT="`pwd`"
   1.219 +AC_SUBST(SRC_ROOT)
   1.220 +cd "$CURDIR"
   1.221 +
   1.222 +# For cygwin we need cygpath first, since it is used everywhere.
   1.223 +AC_PATH_PROG(CYGPATH, cygpath)
   1.224 +PATH_SEP=":"
   1.225 +if test "x$BUILD_OS" = "xwindows"; then
   1.226 +    if test "x$CYGPATH" = x; then
   1.227 +        AC_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
   1.228 +    fi
   1.229 +    PATH_SEP=";"
   1.230 +fi
   1.231 +AC_SUBST(PATH_SEP)
   1.232 +
   1.233 +SPACESAFE(SRC_ROOT,[the path to the source root])
   1.234 +SPACESAFE(CURDIR,[the path to the current directory])
   1.235 +
   1.236 +if test "x$BUILD_OS" = "xsolaris"; then
   1.237 +    # Also search in /usr/ccs/bin for utilities like ar and as.
   1.238 +    PATH="/usr/ccs/bin:$PATH"
   1.239 +fi
   1.240 +
   1.241 +###############################################################################
   1.242 +#
   1.243 +# OpenJDK or closed
   1.244 +#
   1.245 +AC_ARG_ENABLE([openjdk], [AS_HELP_STRING([--enable-openjdk],
   1.246 +    [build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,)
   1.247 +
   1.248 +if test "x$enable_openjdk" = "xyes"; then
   1.249 +    OPENJDK=true
   1.250 +elif test "x$enable_openjdk" = "xno"; then
   1.251 +    OPENJDK=false
   1.252 +elif test -d "$SRC_ROOT/jdk/src/closed"; then
   1.253 +    OPENJDK=false
   1.254 +else
   1.255 +    OPENJDK=true
   1.256 +fi
   1.257 +
   1.258 +if test "x$OPENJDK" = "xtrue"; then
   1.259 +    SET_OPENJDK=OPENJDK=true
   1.260 +fi
   1.261 +
   1.262 +AC_SUBST(SET_OPENJDK)
   1.263 +
   1.264 +###############################################################################
   1.265 +#
   1.266 +# JIGSAW or not.  The JIGSAW variable is used during the intermediate
   1.267 +# stage when we are building both the old style JDK and the new style modularized JDK.
   1.268 +# When the modularized JDK is finalized, this option will go away.
   1.269 +#
   1.270 +AC_ARG_ENABLE([jigsaw], [AS_HELP_STRING([--enable-jigsaw],
   1.271 +    [build Jigsaw images (not yet available) @<:@disabled@:>@])],,)
   1.272 +
   1.273 +if test "x$enable_jigsaw" = "xyes"; then
   1.274 +    JIGSAW=true
   1.275 +else
   1.276 +    JIGSAW=false
   1.277 +fi
   1.278 +AC_SUBST(JIGSAW)
   1.279 +
   1.280 +###############################################################################
   1.281 +#
   1.282 +# Check which variant of the JDK that we want to build.
   1.283 +# Currently we have:
   1.284 +#    normal:   standard edition   
   1.285 +#    embedded: cut down to a smaller footprint
   1.286 +#
   1.287 +# Effectively the JDK variant gives a name to a specific set of
   1.288 +# modules to compile into the JDK. In the future, these modules
   1.289 +# might even be Jigsaw modules.
   1.290 +#
   1.291 +AC_MSG_CHECKING([which variant of the JDK to build])
   1.292 +AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
   1.293 +	[JDK variant to build (normal, embedded) @<:@normal@:>@])])
   1.294 +
   1.295 +if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
   1.296 +    JAVASE_EMBEDDED=""
   1.297 +    MINIMIZE_RAM_USAGE=""
   1.298 +    JDK_VARIANT="normal"
   1.299 +elif test "x$with_jdk_variant" = xembedded; then
   1.300 +    JAVASE_EMBEDDED="JAVASE_EMBEDDED:=true"
   1.301 +    MINIMIZE_RAM_USAGE="MINIMIZE_RAM_USAGE:=true"
   1.302 +    JDK_VARIANT="embedded"
   1.303 +else
   1.304 +    AC_ERROR([The available JDK variants are: normal, embedded])
   1.305 +fi
   1.306 +                              
   1.307 +AC_SUBST(JAVASE_EMBEDDED)
   1.308 +AC_SUBST(MINIMIZE_RAM_USAGE)
   1.309 +AC_SUBST(JDK_VARIANT)
   1.310 +
   1.311 +AC_MSG_RESULT([$JDK_VARIANT])
   1.312 +
   1.313 +###############################################################################
   1.314 +#
   1.315 +# Should we build a JDK/JVM with head support (ie a graphical ui)?
   1.316 +# We always build headless support.
   1.317 +#
   1.318 +AC_MSG_CHECKING([headful support])
   1.319 +AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
   1.320 +	[build headful support (graphical UI support) @<:@enabled@:>@])],
   1.321 +    [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
   1.322 +
   1.323 +SUPPORT_HEADLESS=yes
   1.324 +BUILD_HEADLESS="BUILD_HEADLESS:=true"
   1.325 +
   1.326 +if test "x$SUPPORT_HEADFUL" = xyes; then
   1.327 +    # We are building both headful and headless.
   1.328 +    BUILD_HEADLESS_ONLY=""
   1.329 +    headful_msg="inlude support for both headful and headless"
   1.330 +fi
   1.331 +
   1.332 +if test "x$SUPPORT_HEADFUL" = xno; then
   1.333 +    # Thus we are building headless only.
   1.334 +    BUILD_HEADLESS="BUILD_HEADLESS:=true"
   1.335 +    BUILD_HEADLESS_ONLY="BUILD_HEADLESS_ONLY:=true"
   1.336 +    headful_msg="headless only"
   1.337 +fi
   1.338 +
   1.339 +AC_MSG_RESULT([$headful_msg])
   1.340 +
   1.341 +AC_SUBST(SUPPORT_HEADLESS)
   1.342 +AC_SUBST(SUPPORT_HEADFUL)
   1.343 +AC_SUBST(BUILD_HEADLESS)
   1.344 +AC_SUBST(BUILD_HEADLESS_ONLY)
   1.345 +
   1.346 +###############################################################################
   1.347 +#
   1.348 +# Check which variants of the JVM that we want to build.
   1.349 +# Currently we have:
   1.350 +#    server: normal interpreter and a tiered C1/C2 compiler
   1.351 +#    client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms)
   1.352 +#    kernel: kernel footprint JVM that passes the TCK without major performance problems,
   1.353 +#             ie normal interpreter and C1, only the serial GC, kernel jvmti etc
   1.354 +#    zero: no machine code interpreter, no compiler
   1.355 +#    zeroshark: zero interpreter and shark/llvm compiler backend
   1.356 +AC_MSG_CHECKING([which variants of the JVM that should be built])
   1.357 +AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
   1.358 +	[JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
   1.359 +
   1.360 +if test "x$with_jvm_variants" = x; then
   1.361 +    if test "x$JDK_VARIANT" = xembedded; then
   1.362 +        with_jvm_variants="kernel"
   1.363 +    elif test "x$HOST_CPU_BITS" = x64; then
   1.364 +        with_jvm_variants="server"
   1.365 +    else
   1.366 +        # Yes, on 32-bit machines, the same source (almost) is compiled twice
   1.367 +        # to generate two libjvm.so files. Fun, fun.
   1.368 +        with_jvm_variants="client,server"
   1.369 +    fi
   1.370 +fi
   1.371 +
   1.372 +JVM_VARIANTS=",$with_jvm_variants,"
   1.373 +TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
   1.374 +
   1.375 +if test "x$TEST_VARIANTS" != "x,"; then
   1.376 +   AC_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
   1.377 +fi   
   1.378 +AC_MSG_RESULT([$with_jvm_variants])
   1.379 +
   1.380 +JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
   1.381 +JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 
   1.382 +JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
   1.383 +JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
   1.384 +JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
   1.385 +
   1.386 +if test "x$JVM_VARIANT_CLIENT" = xtrue; then
   1.387 +    if test "x$HOST_CPU_BITS" = x64; then
   1.388 +        AC_ERROR([You cannot build a client JVM for a 64-bit machine.])
   1.389 +    fi
   1.390 +fi
   1.391 +if test "x$JVM_VARIANT_KERNEL" = xtrue; then
   1.392 +    if test "x$HOST_CPU_BITS" = x64; then
   1.393 +        AC_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
   1.394 +    fi
   1.395 +fi
   1.396 +
   1.397 +COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'`
   1.398 +# Replace the commas with AND for use in the build directory name.
   1.399 +ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'`
   1.400 +if test "x$COUNT_VARIANTS" != "x,1"; then
   1.401 +    AC_MSG_NOTICE([NOTE! Longer build time since we are building more than one version of the libjvm! $with_jvm_variants])
   1.402 +fi
   1.403 +
   1.404 +AC_SUBST(JVM_VARIANTS)
   1.405 +AC_SUBST(JVM_VARIANT_SERVER)
   1.406 +AC_SUBST(JVM_VARIANT_CLIENT)
   1.407 +AC_SUBST(JVM_VARIANT_KERNEL)
   1.408 +AC_SUBST(JVM_VARIANT_ZERO)
   1.409 +AC_SUBST(JVM_VARIANT_ZEROSHARK)
   1.410 +
   1.411 +###############################################################################
   1.412 +#
   1.413 +# Set the debug level
   1.414 +#    release: no debug information, all optimizations, no asserts.
   1.415 +#    fastdebug: debug information (-g), all optimizations, all asserts
   1.416 +#    slowdebug: debug information (-g), no optimizations, all asserts
   1.417 +#
   1.418 +DEBUG_LEVEL="release"              
   1.419 +AC_MSG_CHECKING([which debug level to use])
   1.420 +AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
   1.421 +	[set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
   1.422 +	[
   1.423 +        ENABLE_DEBUG="${enableval}"
   1.424 +        DEBUG_LEVEL="fastdebug"
   1.425 +    ], [ENABLE_DEBUG="no"])
   1.426 +
   1.427 +AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
   1.428 +	[set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])],
   1.429 +	[
   1.430 +        DEBUG_LEVEL="${withval}"
   1.431 +        if test "x$ENABLE_DEBUG" = xyes; then
   1.432 +			AC_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
   1.433 +        fi
   1.434 +    ])
   1.435 +AC_MSG_RESULT([$DEBUG_LEVEL])
   1.436 +
   1.437 +if test "x$DEBUG_LEVEL" != xrelease && \
   1.438 +   test "x$DEBUG_LEVEL" != xfastdebug && \
   1.439 +   test "x$DEBUG_LEVEL" != xslowdebug; then
   1.440 +   AC_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
   1.441 +fi
   1.442 +
   1.443 +case $DEBUG_LEVEL in
   1.444 +      release )
   1.445 +          VARIANT="OPT"
   1.446 +          FASTDEBUG="false"
   1.447 +          DEBUG_CLASSFILES="false"            
   1.448 +          BUILD_VARIANT_RELEASE=""             
   1.449 +           ;;
   1.450 +      fastdebug )
   1.451 +          VARIANT="DBG"
   1.452 +          FASTDEBUG="true"
   1.453 +          DEBUG_CLASSFILES="true"            
   1.454 +          BUILD_VARIANT_RELEASE="-fastdebug"
   1.455 +           ;;
   1.456 +      slowdebug )
   1.457 +          VARIANT="DBG"
   1.458 +          FASTDEBUG="false"
   1.459 +          DEBUG_CLASSFILES="true"            
   1.460 +          BUILD_VARIANT_RELEASE="-debug"             
   1.461 +           ;;
   1.462 +esac
   1.463 +
   1.464 +AC_SUBST(DEBUG_LEVEL)
   1.465 +AC_SUBST(VARIANT)
   1.466 +AC_SUBST(FASTDEBUG)
   1.467 +AC_SUBST(DEBUG_CLASSFILES)
   1.468 +AC_SUBST(BUILD_VARIANT_RELEASE)
   1.469 +
   1.470 +# Source the version numbers
   1.471 +. $AUTOCONF_DIR/version.numbers
   1.472 +if test "x$OPENJDK" = "xfalse"; then
   1.473 +    . $AUTOCONF_DIR/closed.version.numbers
   1.474 +fi
   1.475 +# Now set the JDK version, milestone, build number etc.
   1.476 +AC_SUBST(JDK_MAJOR_VERSION)
   1.477 +AC_SUBST(JDK_MINOR_VERSION)
   1.478 +AC_SUBST(JDK_MICRO_VERSION)
   1.479 +AC_SUBST(JDK_UPDATE_VERSION)
   1.480 +AC_SUBST(JDK_BUILD_NUMBER)
   1.481 +AC_SUBST(MILESTONE)
   1.482 +AC_SUBST(LAUNCHER_NAME)
   1.483 +AC_SUBST(PRODUCT_NAME)
   1.484 +AC_SUBST(PRODUCT_SUFFIX)
   1.485 +AC_SUBST(JDK_RC_PLATFORM_NAME)
   1.486 +AC_SUBST(COMPANY_NAME)
   1.487 +
   1.488 +COPYRIGHT_YEAR=`date +'%Y'`
   1.489 +AC_SUBST(COPYRIGHT_YEAR)
   1.490 +
   1.491 +RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
   1.492 +AC_SUBST(RUNTIME_NAME)
   1.493 +
   1.494 +if test "x$JDK_UPDATE_VERSION" != x; then
   1.495 +    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
   1.496 +else
   1.497 +    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
   1.498 +fi
   1.499 +AC_SUBST(JDK_VERSION)
   1.500 +
   1.501 +if test "x$MILESTONE" != x; then
   1.502 +    RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
   1.503 +else
   1.504 +    RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
   1.505 +fi
   1.506 +AC_SUBST(RELEASE)
   1.507 +
   1.508 +if test "x$JDK_BUILD_NUMBER" != x; then
   1.509 +    FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
   1.510 +else
   1.511 +    JDK_BUILD_NUMBER=b00
   1.512 +    BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
   1.513 +    # Avoid [:alnum:] since it depends on the locale.
   1.514 +    CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
   1.515 +    USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
   1.516 +    FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}"
   1.517 +fi
   1.518 +AC_SUBST(FULL_VERSION)
   1.519 +COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
   1.520 +AC_SUBST(COOKED_BUILD_NUMBER)
   1.521 +
   1.522 +# Test from where we are running configure, in or outside of src root.
   1.523 +if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
   1.524 +    # We are running configure from the src root.
   1.525 +    # Create a default ./build/host-variant-debuglevel output root.
   1.526 +    OUTPUT_ROOT="$SRC_ROOT/build/${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
   1.527 +    mkdir -p "$OUTPUT_ROOT"
   1.528 +    if test ! -d "$OUTPUT_ROOT"; then
   1.529 +        AC_ERROR([Could not create build directory $OUTPUT_ROOT])
   1.530 +    fi
   1.531 +else
   1.532 +    # We are running configure from outside of the src dir.
   1.533 +    # Then use the current directory as output dir!
   1.534 +    OUTPUT_ROOT="$CURDIR"
   1.535 +fi
   1.536 +
   1.537 +SPACESAFE(OUTPUT_ROOT,[the path to the output root])
   1.538 +
   1.539 +# Save the arguments given to us
   1.540 +echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
   1.541 +
   1.542 +# Check if the VS env variables were setup prior to running configure.
   1.543 +# If not, then find vcvarsall.bat and run it automatically, and integrate
   1.544 +# the set env variables into the spec file.
   1.545 +SETUPDEVENV="# No special vars"
   1.546 +if test "x$BUILD_OS" = "xwindows"; then
   1.547 +    # If vcvarsall.bat has been run, then VCINSTALLDIR is set.
   1.548 +    if test "x$VCINSTALLDIR" != x; then
   1.549 +        # No further setup is needed. The build will happen from this kind
   1.550 +        # of shell.
   1.551 +        SETUPDEVENV="# This spec file expects that you are running bash from within a VS command prompt."
   1.552 +        # Make sure to remind you, if you forget to run make from a cygwin bash shell
   1.553 +        # that is spawned "bash -l" from a VS command prompt.
   1.554 +        CHECK_FOR_VCINSTALLDIR=yes
   1.555 +        AC_MSG_CHECKING([if you are running from within a VS command prompt])
   1.556 +        AC_MSG_RESULT([yes])
   1.557 +    else
   1.558 +        # Ah, we have not yet run vcvarsall.bat/vsvars32.bat/vsvars64.bat. Lets do that. First find it.
   1.559 +        if test "x$VS100COMNTOOLS" != x; then
   1.560 +            VARSBAT=`find "$VS100COMNTOOLS/../.." -name vcvarsall.bat`
   1.561 +	    SEARCH_ROOT="$VS100COMNTOOLS"
   1.562 +        else
   1.563 +            VARSBAT=`find "$PROGRAMFILES" -name vcvarsall.bat`
   1.564 +	    SEARCH_ROOT="$PROGRAMFILES"
   1.565 +        fi
   1.566 +        VCPATH=`dirname "$VARSBAT"`
   1.567 +        VCPATH=`cygpath -w "$VCPATH"`
   1.568 +	if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then
   1.569 +            AC_MSG_CHECKING([if we can find the VS installation])
   1.570 +            AC_MSG_RESULT([no])
   1.571 +            AC_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
   1.572 +        fi
   1.573 +        case "$LEGACY_HOST_CPU1" in
   1.574 +          i?86)
   1.575 +            VARSBAT_ARCH=x86
   1.576 +            ;;
   1.577 +          *)
   1.578 +            VARSBAT_ARCH=$LEGACY_HOST_CPU1
   1.579 +            ;;
   1.580 +        esac
   1.581 +        # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
   1.582 +        cd $OUTPUT_ROOT
   1.583 +        $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
   1.584 +	cd $CURDIR
   1.585 +	if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
   1.586 +            AC_MSG_CHECKING([if we can extract the needed env variables])
   1.587 +            AC_MSG_RESULT([no])
   1.588 +            AC_ERROR([Could not succesfully extract the env variables needed for the VS setup. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
   1.589 +        fi 
   1.590 +        # Now set all paths and other env variables. This will allow the rest of 
   1.591 +        # the configure script to find and run the compiler in the proper way.
   1.592 +        . $OUTPUT_ROOT/localdevenv.sh
   1.593 +        AC_MSG_CHECKING([if we can find the VS installation])
   1.594 +	if test "x$VCINSTALLDIR" != x; then 
   1.595 +            AC_MSG_RESULT([$VCINSTALLDIR])
   1.596 +        else 
   1.597 +            AC_MSG_RESULT([no])
   1.598 +            AC_ERROR([Could not find VS installation. Please install. If you are sure you have installed VS, then please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
   1.599 +        fi
   1.600 +        CHECK_FOR_VCINSTALLDIR=no
   1.601 +	SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk"
   1.602 +
   1.603 +	AC_MSG_CHECKING([for msvcr100.dll])
   1.604 +        AC_ARG_WITH(msvcr100dll, [AS_HELP_STRING([--with-msvcr100dll],
   1.605 +            [copy this msvcr100.dll into the built JDK])])
   1.606 +        if test "x$with_msvcr100dll" != x; then
   1.607 +            MSVCR100DLL="$with_msvcr100dll"
   1.608 +        else
   1.609 +            if test "x$HOST_CPU_BITS" = x64; then
   1.610 +                MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x64 | head --lines 1`
   1.611 +            else
   1.612 +                MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
   1.613 +                if test "x$MSVCR100DLL" = x; then
   1.614 +                    MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | head --lines 1`
   1.615 +                fi
   1.616 +            fi
   1.617 +        fi
   1.618 +	if test "x$MSVCR100DLL" = x; then
   1.619 +           AC_MSG_RESULT([no])
   1.620 +	   AC_ERROR([Could not find msvcr100.dll !])
   1.621 +        fi
   1.622 +        AC_MSG_RESULT([$MSVCR100DLL])
   1.623 +	SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll])
   1.624 +    fi
   1.625 +fi
   1.626 +AC_SUBST(SETUPDEVENV)
   1.627 +AC_SUBST(CHECK_FOR_VCINSTALLDIR)
   1.628 +AC_SUBST(MSVCR100DLL)
   1.629 +
   1.630 +# Most of the probed defines are put into config.h
   1.631 +AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
   1.632 +# The spec.gmk file contains all variables for the make system.
   1.633 +AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
   1.634 +# The generated Makefile knows where the spec.gmk is and where the source is.
   1.635 +# You can run make from the OUTPUT_ROOT. If you have only
   1.636 +# one configured host, then you can also run make from the SRC_ROOT,
   1.637 +# since it will go look for a single spec.gmk file. Or perhaps it
   1.638 +# should instead make all configured hosts it can find?
   1.639 +AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
   1.640 +
   1.641 +AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
   1.642 +AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
   1.643 +
   1.644 +# Where are the sources. Any of these can be overridden
   1.645 +# using --with-override-corba and the likes.
   1.646 +LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
   1.647 +CORBA_TOPDIR="$SRC_ROOT/corba"
   1.648 +JAXP_TOPDIR="$SRC_ROOT/jaxp"
   1.649 +JAXWS_TOPDIR="$SRC_ROOT/jaxws"
   1.650 +HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
   1.651 +JDK_TOPDIR="$SRC_ROOT/jdk"
   1.652 +AC_SUBST(LANGTOOLS_TOPDIR)
   1.653 +AC_SUBST(CORBA_TOPDIR)
   1.654 +AC_SUBST(JAXP_TOPDIR)
   1.655 +AC_SUBST(JAXWS_TOPDIR)
   1.656 +AC_SUBST(HOTSPOT_TOPDIR)
   1.657 +AC_SUBST(JDK_TOPDIR)
   1.658 +
   1.659 +# Check if pkg-config is available.
   1.660 +PKG_PROG_PKG_CONFIG
   1.661 +
   1.662 +AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf],
   1.663 +    [use this configuration file for the builddeps])])
   1.664 +
   1.665 +AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server],
   1.666 +    [download and use build dependencies from this server url, e.g. --with-builddeps-server=ftp://example.com/dir])])
   1.667 +
   1.668 +AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir],
   1.669 +    [store downloaded build dependencies here @<:@d/localhome/builddeps@:>@])],
   1.670 +    [],
   1.671 +    [with_builddeps_dir=/localhome/builddeps])
   1.672 +
   1.673 +AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group],
   1.674 +    [chgrp the downloaded build dependencies to this group])])
   1.675 +
   1.676 +AC_ARG_ENABLE([list-builddeps], [AS_HELP_STRING([--enable-list-builddeps],
   1.677 +	[list all build dependencies known to the configure script])],
   1.678 +	[LIST_BUILDDEPS="${enableval}"], [LIST_BUILDDEPS='no'])
   1.679 +
   1.680 +if test "x$LIST_BUILDDEPS" = xyes; then
   1.681 +    echo
   1.682 +    echo List of build dependencies known to the configure script,
   1.683 +    echo that can be used in builddeps.conf files:
   1.684 +    cat $SRC_ROOT/configure.ac | grep BDEPS_CHECK_MODUL | grep -v configure.ac | cut -f 2 -d ',' | tr -d ' ' | sort
   1.685 +    echo
   1.686 +    exit 1
   1.687 +fi
   1.688 +
   1.689 +# If builddeps server or conf file is given. Setup buildeps usage.
   1.690 +BDEPS_SCAN_FOR_BUILDDEPS
   1.691 +
   1.692 +###############################################################################
   1.693 +#
   1.694 +# Configure the development tool paths and potential sysroot.
   1.695 +#
   1.696 +AC_LANG(C++)
   1.697 +DEVKIT=
   1.698 +SYS_ROOT=/
   1.699 +AC_SUBST(SYS_ROOT)
   1.700 +
   1.701 +# The option used to specify the target .o,.a or .so file.
   1.702 +# When compiling, how to specify the to be created object file.
   1.703 +CC_OUT_OPTION='-o$(SPACE)'
   1.704 +# When linking, how to specify the to be created executable.
   1.705 +EXE_OUT_OPTION='-o$(SPACE)'
   1.706 +# When linking, how to specify the to be created dynamically linkable library.
   1.707 +LD_OUT_OPTION='-o$(SPACE)'
   1.708 +# When archiving, how to specify the to be create static archive for object files.
   1.709 +AR_OUT_OPTION='rcs$(SPACE)'
   1.710 +AC_SUBST(CC_OUT_OPTION)
   1.711 +AC_SUBST(EXE_OUT_OPTION)
   1.712 +AC_SUBST(LD_OUT_OPTION)
   1.713 +AC_SUBST(AR_OUT_OPTION)
   1.714 +
   1.715 +# If --build AND --host is set, then the configure script will find any
   1.716 +# cross compilation tools in the PATH. Cross compilation tools
   1.717 +# follows the cross compilation standard where they are prefixed with ${host}.
   1.718 +# For example the binary i686-sun-solaris2.10-gcc
   1.719 +# will cross compile for i686-sun-solaris2.10
   1.720 +# If neither of build and host is not set, then build=host and the
   1.721 +# default compiler found in the path will be used.
   1.722 +# Setting only --host, does not seem to be really supported.
   1.723 +# Please set both --build and --host if you want to cross compile.
   1.724 +
   1.725 +DEFINE_CROSS_COMPILE_ARCH=""
   1.726 +HOSTCC=""
   1.727 +HOSTCXX=""
   1.728 +AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
   1.729 +AC_SUBST(HOST_CC)
   1.730 +AC_SUBST(HOST_CXX)
   1.731 +AC_MSG_CHECKING([if this is a cross compile])
   1.732 +if test "x$build_var" != "x$host_var"; then
   1.733 +    AC_MSG_RESULT([yes, from $build_var to $host_var])   
   1.734 +    # We have detected a cross compile!
   1.735 +    DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$LEGACY_HOST_CPU1"
   1.736 +    # Now we to find a C/C++ compiler that can build executables for the build
   1.737 +    # platform. We can't use the AC_PROG_CC macro, since it can only be used
   1.738 +    # once.
   1.739 +    AC_PATH_PROGS(HOSTCC, [cl cc gcc])
   1.740 +    WHICHCMD(HOSTCC)
   1.741 +    AC_PATH_PROGS(HOSTCXX, [cl CC g++])
   1.742 +    WHICHCMD(HOSTCXX)
   1.743 +    # Building for the build platform should be easy. Therefore
   1.744 +    # we do not need any linkers or assemblers etc.    
   1.745 +else
   1.746 +    AC_MSG_RESULT([no])
   1.747 +fi
   1.748 +
   1.749 +# You can force the sys-root if the sys-root encoded into the cross compiler tools
   1.750 +# is not correct.
   1.751 +AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
   1.752 +    [pass this sys-root to the compilers and linker (useful if the sys-root encoded in
   1.753 +     the cross compiler tools is incorrect)])])
   1.754 +
   1.755 +if test "x$with_sys_root" != x; then
   1.756 +    SYS_ROOT=$with_sys_root
   1.757 +fi
   1.758 +                     
   1.759 +# If a devkit is found on the builddeps server, then prepend its path to the
   1.760 +# PATH variable. If there are cross compilers available in the devkit, these
   1.761 +# will be found by AC_PROG_CC et al.
   1.762 +BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
   1.763 +                    [# Found devkit
   1.764 +                     PATH="$DEVKIT/bin:$PATH"
   1.765 +                     SYS_ROOT="$DEVKIT/${rewritten_host}/sys-root"
   1.766 +                     if test "x$x_includes" = "xNONE"; then
   1.767 +                         x_includes="$SYS_ROOT/usr/include/X11"
   1.768 +                     fi
   1.769 +                     if test "x$x_libraries" = "xNONE"; then
   1.770 +                         x_libraries="$SYS_ROOT/usr/lib"
   1.771 +                     fi
   1.772 +                    ],
   1.773 +                    [])
   1.774 +
   1.775 +if test "x$SYS_ROOT" != "x/" ; then                    
   1.776 +    CFLAGS="--sysroot=$SYS_ROOT $CFLAGS"
   1.777 +    CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS"
   1.778 +    OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
   1.779 +    OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
   1.780 +    CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS"
   1.781 +    LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS"
   1.782 +fi
   1.783 +
   1.784 +# Store the CFLAGS etal passed to the configure script.
   1.785 +ORG_CFLAGS="$CFLAGS"
   1.786 +ORG_CXXFLAGS="$CXXFLAGS"
   1.787 +ORG_OBJCFLAGS="$OBJCFLAGS"
   1.788 +
   1.789 +# gcc is almost always present, but on Windows we
   1.790 +# prefer cl.exe and on Solaris we prefer CC.
   1.791 +# Thus test for them in this order.
   1.792 +AC_PROG_CC([cl cc gcc])
   1.793 +if test "x$CC" = x; then
   1.794 +    help_on_build_dependency devkit
   1.795 +    AC_ERROR([Could not find a compiler. $HELP_MSG])
   1.796 +fi
   1.797 +if test "x$CC" = xcc && test "x$BUILD_OS" = xmacosx; then
   1.798 +    # Do not use cc on MacOSX use gcc instead.
   1.799 +    CC="gcc"
   1.800 +fi
   1.801 +WHICHCMD(CC)
   1.802 +
   1.803 +AC_PROG_CXX([cl CC g++])
   1.804 +if test "x$CXX" = xCC && test "x$BUILD_OS" = xmacosx; then
   1.805 +    # The found CC, even though it seems to be a g++ derivate, cannot compile
   1.806 +    # c++ code. Override.
   1.807 +    CXX="g++"
   1.808 +fi
   1.809 +WHICHCMD(CXX)
   1.810 +
   1.811 +if test "x$CXX" = x || test "x$CC" = x; then
   1.812 +    help_on_build_dependency devkit
   1.813 +    AC_ERROR([Could not find the needed compilers! $HELP_MSG ])
   1.814 +fi
   1.815 +
   1.816 +if test "x$BUILD_OS" != xwindows; then
   1.817 +    AC_PROG_OBJC
   1.818 +    WHICHCMD(OBJC)
   1.819 +else
   1.820 +    OBJC=
   1.821 +fi
   1.822 +
   1.823 +# Restore the flags to the user specified values.
   1.824 +# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
   1.825 +CFLAGS="$ORG_CFLAGS"
   1.826 +CXXFLAGS="$ORG_CXXFLAGS"
   1.827 +OBJCFLAGS="$ORG_OBJCFLAGS"
   1.828 +
   1.829 +# If we are not cross compiling, use the same compilers for
   1.830 +# building the build platform executables.
   1.831 +if test "x$DEFINE_CROSS_COMPILE_ARCH" = x; then
   1.832 +    HOSTCC="$CC"
   1.833 +    HOSTCXX="$CXX"
   1.834 +fi
   1.835 +
   1.836 +AC_CHECK_TOOL(LD, ld)
   1.837 +WHICHCMD(LD)
   1.838 +LDEXE="$LD"
   1.839 +LDCXX="$LD"
   1.840 +LDEXECXX="$LD"
   1.841 +# LDEXE is the linker to use, when creating executables.
   1.842 +AC_SUBST(LDEXE)
   1.843 +# Linking C++ libraries.
   1.844 +AC_SUBST(LDCXX)
   1.845 +# Linking C++ executables.
   1.846 +AC_SUBST(LDEXECXX)
   1.847 +
   1.848 +AC_CHECK_TOOL(AR, ar)
   1.849 +WHICHCMD(AR)
   1.850 +if test "x$BUILD_OS" = xmacosx; then
   1.851 +    ARFLAGS="-r"
   1.852 +else
   1.853 +    ARFLAGS=""
   1.854 +fi
   1.855 +AC_SUBST(ARFLAGS)
   1.856 +
   1.857 +COMPILER_NAME=gcc
   1.858 +COMPILER_TYPE=CC
   1.859 +AS_IF([test "x$BUILD_OS" = xwindows], [
   1.860 +    # For now, assume that we are always compiling using cl.exe. 
   1.861 +    CC_OUT_OPTION=-Fo
   1.862 +    EXE_OUT_OPTION=-Fe
   1.863 +    LD_OUT_OPTION=-out:
   1.864 +    AR_OUT_OPTION=-out:
   1.865 +    # On Windows, reject /usr/bin/link, which is a cygwin
   1.866 +    # program for something completely different.
   1.867 +    AC_CHECK_PROG([WINLD], [link],[link],,, [/usr/bin/link])
   1.868 +    # Since we must ignore the first found link, WINLD will contain
   1.869 +    # the full path to the link.exe program.
   1.870 +    WHICHCMD_SPACESAFE([WINLD])
   1.871 +    LD="$WINLD"
   1.872 +    # However creating executables can only be done with cl.exe. 
   1.873 +    LDEXE="$CC"
   1.874 +    LDCXX="$WINLD"
   1.875 +    LDEXECXX="$CC"
   1.876 +
   1.877 +    AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
   1.878 +    WHICHCMD_SPACESAFE([MT])
   1.879 +    # The resource compiler
   1.880 +    AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   1.881 +    WHICHCMD_SPACESAFE([RC])
   1.882 +
   1.883 +    RC_FLAGS="/l 0x409 /r"
   1.884 +    AS_IF([test "x$VARIANT" = xOPT], [
   1.885 +        RC_FLAGS="$RC_FLAGS -d NDEBUG"
   1.886 +    ])
   1.887 +    JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION
   1.888 +    AS_IF([test "x$JDK_UPDATE_VERSION" = x], [
   1.889 +        JDK_UPDATE_VERSION_NOTNULL=0
   1.890 +    ])
   1.891 +    RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\""
   1.892 +    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\""
   1.893 +    RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\""
   1.894 +    RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\""
   1.895 +    RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\""
   1.896 +    RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\""
   1.897 +    RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\""
   1.898 +
   1.899 +    # lib.exe is used to create static libraries.
   1.900 +    AC_CHECK_PROG([WINAR], [lib],[lib],,,)
   1.901 +    WHICHCMD_SPACESAFE([WINAR])
   1.902 +    AR="$WINAR"
   1.903 +    ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
   1.904 +
   1.905 +    AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   1.906 +    WHICHCMD_SPACESAFE([DUMPBIN])
   1.907 +
   1.908 +    COMPILER_TYPE=CL
   1.909 +    CFLAGS="$CFLAGS -nologo"
   1.910 +    LDFLAGS="$LDFLAGS -nologo -dll -opt:ref -incremental:no "
   1.911 +    if test "x$LEGACY_HOST_CPU1" = xi586; then 
   1.912 +        LDFLAGS="$LDFLAGS -safeseh"
   1.913 +    fi
   1.914 +    if test "x$DEBUG_LEVEL" != xrelease; then
   1.915 +        LDFLAGS="$LDFLAGS -debug"
   1.916 +    fi
   1.917 +])
   1.918 +AC_SUBST(RC_FLAGS)
   1.919 +AC_SUBST(COMPILER_TYPE)
   1.920 +
   1.921 +AC_PROG_CPP
   1.922 +WHICHCMD(CPP)
   1.923 +
   1.924 +AC_PROG_CXXCPP
   1.925 +WHICHCMD(CXXCPP)
   1.926 +
   1.927 +# Find the right assembler.
   1.928 +if test "x$BUILD_OS" = xsolaris; then
   1.929 +    AC_PATH_PROG(AS, as)
   1.930 +    WHICHCMD(AS)
   1.931 +    ASFLAGS=" "
   1.932 +else
   1.933 +    AS="$CC -c"
   1.934 +    ASFLAGS=" "
   1.935 +fi
   1.936 +AC_SUBST(AS)
   1.937 +AC_SUBST(ASFLAGS)
   1.938 +
   1.939 +if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = macosx; then
   1.940 +    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
   1.941 +    # While waiting for a better solution, the current workaround is to use -mstackrealign.
   1.942 +    CFLAGS="$CFLAGS -mstackrealign"
   1.943 +    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
   1.944 +    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
   1.945 +                   [
   1.946 +		        AC_MSG_RESULT([yes])
   1.947 +                   ],
   1.948 +	           [
   1.949 +		        AC_MSG_RESULT([no])
   1.950 +	                AC_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
   1.951 +	           ])
   1.952 +fi
   1.953 +
   1.954 +if test "x$BUILD_OS" = xsolaris; then
   1.955 +    AC_PATH_PROG(NM, nm)
   1.956 +    WHICHCMD(NM)
   1.957 +    AC_PATH_PROG(STRIP, strip)
   1.958 +    WHICHCMD(STRIP)
   1.959 +    AC_PATH_PROG(MCS, mcs)
   1.960 +    WHICHCMD(MCS)
   1.961 +else
   1.962 +    AC_CHECK_TOOL(NM, nm)
   1.963 +    WHICHCMD(NM)
   1.964 +    AC_CHECK_TOOL(STRIP, strip)
   1.965 +    WHICHCMD(STRIP)
   1.966 +fi
   1.967 +
   1.968 +# When using cygwin, we need a wrapper binary that renames
   1.969 +# /cygdrive/c/ arguments into c:/ arguments and peeks into
   1.970 +# @files and rewrites these too! This wrapper binary is
   1.971 +# called uncygdrive.exe.
   1.972 +UNCYGDRIVE=
   1.973 +if test "x$BUILD_OS" = xwindows; then
   1.974 +    AC_MSG_CHECKING([if uncygdrive can be created])
   1.975 +    UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c`
   1.976 +    rm -f $OUTPUT_ROOT/uncygdrive*
   1.977 +    UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe`
   1.978 +    cd $OUTPUT_ROOT
   1.979 +    $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1
   1.980 +    cd $CURDIR
   1.981 +
   1.982 +    if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then 
   1.983 +        AC_MSG_RESULT([no])
   1.984 +        cat $OUTPUT_ROOT/uncygdrive1.log
   1.985 +        AC_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
   1.986 +    fi
   1.987 +    AC_MSG_RESULT([$UNCYGDRIVE])
   1.988 +    AC_MSG_CHECKING([if uncygdrive.exe works])
   1.989 +    cd $OUTPUT_ROOT
   1.990 +    $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 
   1.991 +    cd $CURDIR
   1.992 +    if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then 
   1.993 +        AC_MSG_RESULT([no])
   1.994 +        cat $OUTPUT_ROOT/uncygdrive2.log
   1.995 +        AC_ERROR([Uncygdrive did not work!])
   1.996 +    fi
   1.997 +    AC_MSG_RESULT([yes])
   1.998 +    rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
   1.999 +fi
  1.1000 +
  1.1001 +AC_SUBST(UNCYGDRIVE)
  1.1002 +
  1.1003 +TESTFOR_PROG_CCACHE
  1.1004 +
  1.1005 +# Used on GNU/Linux systems, can be empty...
  1.1006 +#AC_PATH_PROG(ELFDUMP, elfdump)
  1.1007 +
  1.1008 +# Setup default logging of stdout and stderr to build.log in the output root.
  1.1009 +BUILD_LOG='$(OUTPUT_ROOT)/build.log'
  1.1010 +BUILD_LOG_WRAPPER='$(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
  1.1011 +AC_SUBST(BUILD_LOG)
  1.1012 +AC_SUBST(BUILD_LOG_WRAPPER)
  1.1013 +
  1.1014 +###############################################################################
  1.1015 +#
  1.1016 +# Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
  1.1017 +# (The JVM can use 32 or 64 bit Java pointers but that decision
  1.1018 +# is made at runtime.)
  1.1019 +#
  1.1020 +AC_CHECK_SIZEOF([int *], [1111])
  1.1021 +if test "x$ac_cv_sizeof_int_p" = x0; then 
  1.1022 +    # The test failed, lets pick the assumed value.
  1.1023 +    ARCH_DATA_MODEL=$HOST_CPU_BITS
  1.1024 +else
  1.1025 +    ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p`
  1.1026 +fi
  1.1027 +
  1.1028 +if test "x$ARCH_DATA_MODEL" = x64; then
  1.1029 +    A_LP64="LP64:="
  1.1030 +    ADD_LP64="-D_LP64=1"
  1.1031 +fi
  1.1032 +AC_MSG_CHECKING([for host address size])
  1.1033 +AC_MSG_RESULT([$ARCH_DATA_MODEL bits])
  1.1034 +AC_SUBST(LP64,$A_LP64)
  1.1035 +AC_SUBST(ARCH_DATA_MODEL)
  1.1036 +
  1.1037 +if test "x$ARCH_DATA_MODEL" != "x$HOST_CPU_BITS"; then
  1.1038 +    AC_ERROR([The tested number of bits in the host ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the host ($HOST_CPU_BITS)])
  1.1039 +fi
  1.1040 +
  1.1041 +###############################################################################
  1.1042 +#
  1.1043 +# Can the C/C++ compiler use precompiled headers?
  1.1044 +#
  1.1045 +AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
  1.1046 +	[use precompiled headers when compiling C++ @<:@enabled@:>@])],
  1.1047 +    [ENABLE_PRECOMPH=${enable_precompiled-headers}], [ENABLE_PRECOMPH=yes])
  1.1048 +
  1.1049 +USE_PRECOMPILED_HEADER=1
  1.1050 +if test "x$ENABLE_PRECOMPH" = xno; then
  1.1051 +    USE_PRECOMPILED_HEADER=0
  1.1052 +fi
  1.1053 +
  1.1054 +if test "x$ENABLE_PRECOMPH" = xyes; then
  1.1055 +    # Check that the compiler actually supports precomp headers.
  1.1056 +    if test "x$GCC" = xyes; then
  1.1057 +         AC_MSG_CHECKING([that precompiled headers work])         
  1.1058 +         echo "int alfa();" > conftest.h
  1.1059 +         $CXX -x c++-header conftest.h -o conftest.hpp.gch
  1.1060 +         if test ! -f conftest.hpp.gch; then
  1.1061 +             echo Precompiled header is not working!
  1.1062 +             USE_PRECOMPILED_HEADER=0
  1.1063 +             AC_MSG_RESULT([no])        
  1.1064 +         else
  1.1065 +             AC_MSG_RESULT([yes])
  1.1066 +         fi
  1.1067 +         rm -f conftest.h
  1.1068 +    fi
  1.1069 +fi
  1.1070 +
  1.1071 +AC_SUBST(USE_PRECOMPILED_HEADER)
  1.1072 +
  1.1073 +###############################################################################
  1.1074 +#
  1.1075 +# How to compile shared libraries. 
  1.1076 +#
  1.1077 +
  1.1078 +if test "x$GCC" = xyes; then
  1.1079 +    COMPILER_NAME=gcc
  1.1080 +    PICFLAG="-fPIC"
  1.1081 +    LIBRARY_PREFIX=lib
  1.1082 +    SHARED_LIBRARY='lib$1.so'
  1.1083 +    STATIC_LIBRARY='lib$1.a'
  1.1084 +    SHARED_LIBRARY_FLAGS="-shared"
  1.1085 +    SHARED_LIBRARY_SUFFIX='.so'
  1.1086 +    STATIC_LIBRARY_SUFFIX='.a'
  1.1087 +    OBJ_SUFFIX='.o'
  1.1088 +    EXE_SUFFIX=''
  1.1089 +    SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1'
  1.1090 +    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$(JDK_TOPDIR)/$1'
  1.1091 +    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/$1'
  1.1092 +    LD="$CC"
  1.1093 +    LDEXE="$CC"
  1.1094 +    LDCXX="$CXX"
  1.1095 +    LDEXECXX="$CXX"
  1.1096 +
  1.1097 +    # Linking is different on MacOSX
  1.1098 +    if test "x$BUILD_OS" = xmacosx; then
  1.1099 +        # Might change in the future to clang.
  1.1100 +        COMPILER_NAME=gcc
  1.1101 +        SHARED_LIBRARY='lib$1.dylib'
  1.1102 +        SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
  1.1103 +        SHARED_LIBRARY_SUFFIX='.dylib'
  1.1104 +        EXE_SUFFIX=''
  1.1105 +        SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1' 
  1.1106 +        SET_SHARED_LIBRARY_MAPFILE=''
  1.1107 +        SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
  1.1108 +    fi
  1.1109 +else
  1.1110 +    if test "x$BUILD_OS" = xsolaris; then
  1.1111 +        # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
  1.1112 +        COMPILER_NAME=ossc
  1.1113 +        PICFLAG="-KPIC"
  1.1114 +        LIBRARY_PREFIX=lib
  1.1115 +        SHARED_LIBRARY='lib$1.so'
  1.1116 +        STATIC_LIBRARY='lib$1.a'
  1.1117 +        SHARED_LIBRARY_FLAGS="-G"
  1.1118 +        SHARED_LIBRARY_SUFFIX='.so'
  1.1119 +        STATIC_LIBRARY_SUFFIX='.a'
  1.1120 +        OBJ_SUFFIX='.o'
  1.1121 +        EXE_SUFFIX=''
  1.1122 +        SET_SHARED_LIBRARY_NAME=''
  1.1123 +        SET_SHARED_LIBRARY_MAPFILE='-M $(JDK_TOPDIR)/$1'
  1.1124 +        SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/$1'
  1.1125 +        CFLAGS_JDKLIB_EXTRA='-xstrconst -D__solaris__'
  1.1126 +    fi
  1.1127 +    if test "x$BUILD_OS" = xwindows; then
  1.1128 +        # If it is not gcc, then assume it is the MS Visual Studio compiler
  1.1129 +        COMPILER_NAME=cl
  1.1130 +        PICFLAG=""
  1.1131 +        LIBRARY_PREFIX=
  1.1132 +        SHARED_LIBRARY='$1.dll'
  1.1133 +        STATIC_LIBRARY='$1.lib'
  1.1134 +        SHARED_LIBRARY_FLAGS="-LD"
  1.1135 +        SHARED_LIBRARY_SUFFIX='.dll'
  1.1136 +        STATIC_LIBRARY_SUFFIX='.lib'
  1.1137 +        OBJ_SUFFIX='.obj'
  1.1138 +        EXE_SUFFIX='.exe'
  1.1139 +        SET_SHARED_LIBRARY_NAME=''
  1.1140 +        SET_SHARED_LIBRARY_MAPFILE=''
  1.1141 +        SET_SHARED_LIBRARY_ORIGIN=''
  1.1142 +    fi
  1.1143 +fi
  1.1144 +
  1.1145 +AC_SUBST(OBJ_SUFFIX)
  1.1146 +AC_SUBST(SHARED_LIBRARY)
  1.1147 +AC_SUBST(STATIC_LIBRARY)
  1.1148 +AC_SUBST(LIBRARY_PREFIX)
  1.1149 +AC_SUBST(SHARED_LIBRARY_SUFFIX)
  1.1150 +AC_SUBST(STATIC_LIBRARY_SUFFIX)
  1.1151 +AC_SUBST(EXE_SUFFIX)
  1.1152 +AC_SUBST(SHARED_LIBRARY_FLAGS)
  1.1153 +AC_SUBST(SET_SHARED_LIBRARY_NAME)
  1.1154 +AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
  1.1155 +AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
  1.1156 +
  1.1157 +# The (cross) compiler is now configured, we can now test capabilities
  1.1158 +# of the host platform.
  1.1159 +
  1.1160 +###############################################################################
  1.1161 +#
  1.1162 +# Is the host little of big endian?
  1.1163 +#
  1.1164 +AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal"])
  1.1165 +
  1.1166 +if test "x$ENDIAN" = xuniversal; then
  1.1167 +    AC_ERROR([It seems like someone needs to decide how we are to deal with universal binaries on the MacOSX?])
  1.1168 +fi
  1.1169 +if test "x$ENDIAN" = xunknown; then
  1.1170 +    ENDIAN="$HOST_CPU_ENDIAN"
  1.1171 +fi
  1.1172 +if test "x$ENDIAN" != "x$HOST_CPU_ENDIAN"; then
  1.1173 +    AC_WARN([The tested endian in the host ($ENDIAN) differs from the endian expected to be found in the host ($HOST_CPU_ENDIAN)])
  1.1174 +    ENDIAN="$HOST_CPU_ENDIAN"
  1.1175 +fi
  1.1176 +AC_SUBST(ENDIAN)
  1.1177 +
  1.1178 +###############################################################################
  1.1179 +#
  1.1180 +# We need a Boot JDK to bootstrap the build. 
  1.1181 +#
  1.1182 +BOOT_JDK_FOUND=no
  1.1183 +AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
  1.1184 +    [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
  1.1185 +                    
  1.1186 +if test "x$with_boot_jdk" != x; then
  1.1187 +    BOOT_JDK=$with_boot_jdk
  1.1188 +    BOOT_JDK_FOUND=yes
  1.1189 +fi
  1.1190 +if test "x$BOOT_JDK_FOUND" = xno; then
  1.1191 +    BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
  1.1192 +fi
  1.1193 +
  1.1194 +if test "x$BOOT_JDK_FOUND" = xno; then
  1.1195 +    if test "x$JAVA_HOME" != x; then
  1.1196 +        if test ! -d "$JAVA_HOME"; then
  1.1197 +            AC_ERROR([Your JAVA_HOME points to a non-existing directory!])
  1.1198 +        fi
  1.1199 +        # Aha, the user has set a JAVA_HOME
  1.1200 +        # let us use that as the Boot JDK.
  1.1201 +        BOOT_JDK=$JAVA_HOME
  1.1202 +        BOOT_JDK_FOUND=yes
  1.1203 +        # To be on the safe side, lets check that it is a JDK.
  1.1204 +        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
  1.1205 +            JAVAC=$BOOT_JDK/bin/javac
  1.1206 +            JAVA=$BOOT_JDK/bin/java
  1.1207 +            BOOT_JDK_FOUND=yes
  1.1208 +        else
  1.1209 +            AC_ERROR([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK.])
  1.1210 +        fi            
  1.1211 +    fi
  1.1212 +fi
  1.1213 +
  1.1214 +if test "x$BOOT_JDK_FOUND" = xno; then
  1.1215 +    AC_PATH_PROG(JAVAC_CHECK, javac)
  1.1216 +    AC_PATH_PROG(JAVA_CHECK, java)
  1.1217 +    BINARY="$JAVAC_CHECK"
  1.1218 +    if test "x$JAVAC_CHECK" = x; then
  1.1219 +        BINARY="$JAVA_CHECK"
  1.1220 +    fi
  1.1221 +    if test "x$BINARY" != x; then
  1.1222 +        # So there is a java(c) binary, it might be part of a JDK.
  1.1223 +        # Lets find the JDK/JRE directory by following symbolic links.
  1.1224 +        # Linux/GNU systems often have links from /usr/bin/java to 
  1.1225 +        # /etc/alternatives/java to the real JDK binary.
  1.1226 +	WHICHCMD_SPACESAFE(BINARY,[path to javac])
  1.1227 +        REMOVE_SYMBOLIC_LINKS(BINARY)
  1.1228 +        BOOT_JDK=`dirname $BINARY`
  1.1229 +        BOOT_JDK=`cd $BOOT_JDK/..; pwd`
  1.1230 +        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
  1.1231 +            JAVAC=$BOOT_JDK/bin/javac
  1.1232 +            JAVA=$BOOT_JDK/bin/java
  1.1233 +            BOOT_JDK_FOUND=yes
  1.1234 +        fi
  1.1235 +    fi
  1.1236 +fi
  1.1237 +
  1.1238 +if test "x$BOOT_JDK_FOUND" = xno; then
  1.1239 +    # Try the MacOSX way.
  1.1240 +    if test -x /usr/libexec/java_home; then
  1.1241 +        BOOT_JDK=`/usr/libexec/java_home`
  1.1242 +        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
  1.1243 +            JAVAC=$BOOT_JDK/bin/javac
  1.1244 +            JAVA=$BOOT_JDK/bin/java
  1.1245 +            BOOT_JDK_FOUND=yes
  1.1246 +        fi
  1.1247 +    fi
  1.1248 +fi
  1.1249 +
  1.1250 +if test "x$BOOT_JDK_FOUND" = xno; then
  1.1251 +    AC_PATH_PROG(JAVA_CHECK, java)
  1.1252 +    if test "x$JAVA_CHECK" != x; then
  1.1253 +        # There is a java in the path. But apparently we have not found a javac 
  1.1254 +        # in the path, since that would have been tested earlier.
  1.1255 +        if test "x$HOST_OS" = xwindows; then
  1.1256 +            # Now if this is a windows platform. The default installation of a JDK
  1.1257 +            # actually puts the JRE in the path and keeps the JDK out of the path!
  1.1258 +            # Go look in the default installation location.
  1.1259 +            BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1`
  1.1260 +            if test -d "$BOOT_JDK"; then
  1.1261 +                BOOT_JDK_FOUND=yes
  1.1262 +            fi
  1.1263 +        fi
  1.1264 +        if test "x$BOOT_JDK_FOUND" = xno; then
  1.1265 +            help_on_build_dependency openjdk
  1.1266 +            AC_ERROR([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
  1.1267 +        fi
  1.1268 +    else
  1.1269 +        help_on_build_dependency openjdk
  1.1270 +        AC_ERROR([Could not find a JDK. $HELP_MSG])
  1.1271 +    fi
  1.1272 +fi
  1.1273 +
  1.1274 +WIN_FIX_PATH(BOOT_JDK)
  1.1275 +
  1.1276 +# Now see if we can find the rt.jar, or its nearest equivalent.
  1.1277 +BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
  1.1278 +SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)])
  1.1279 +
  1.1280 +BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
  1.1281 +SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)])
  1.1282 +
  1.1283 +if test ! -f $BOOT_RTJAR; then
  1.1284 +    # On MacOSX it is called classes.jar
  1.1285 +    BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
  1.1286 +    if test ! -f $BOOT_RTJAR; then
  1.1287 +        AC_ERROR([Cannot find the rt.jar or its equivalent!])
  1.1288 +    fi
  1.1289 +    # Remove the .. 
  1.1290 +    BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
  1.1291 +    # The tools.jar is part of classes.jar
  1.1292 +    BOOT_TOOLSJAR="$BOOT_RTJAR"
  1.1293 +fi
  1.1294 +
  1.1295 +AC_SUBST(BOOT_JDK)
  1.1296 +AC_SUBST(BOOT_RTJAR)
  1.1297 +AC_SUBST(BOOT_TOOLSJAR)
  1.1298 +AC_MSG_CHECKING([for Boot JDK])
  1.1299 +AC_MSG_RESULT([$BOOT_JDK])
  1.1300 +AC_MSG_CHECKING([for Boot rt.jar])
  1.1301 +AC_MSG_RESULT([$BOOT_RTJAR])
  1.1302 +AC_MSG_CHECKING([for Boot tools.jar])
  1.1303 +AC_MSG_RESULT([$BOOT_TOOLSJAR])
  1.1304 +
  1.1305 +# Use the java tool from the Boot JDK.
  1.1306 +AC_MSG_CHECKING([for java in Boot JDK])
  1.1307 +JAVA=$BOOT_JDK/bin/java
  1.1308 +if test ! -x $JAVA; then
  1.1309 +    AC_ERROR([Could not find a working java])
  1.1310 +fi
  1.1311 +BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
  1.1312 +AC_MSG_RESULT([yes $BOOT_JDK_VERSION])
  1.1313 +AC_SUBST(JAVA)
  1.1314 +
  1.1315 +# Extra M4 quote needed to protect [] in grep expression.
  1.1316 +[FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
  1.1317 +if test "x$FOUND_VERSION_78" = x; then
  1.1318 +    help_on_build_dependency openjdk
  1.1319 +    AC_ERROR([Your bootjdk must be version 7 or 8. $HELP_MSG])
  1.1320 +fi
  1.1321 +
  1.1322 +# When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
  1.1323 +BOOT_JDK_SOURCETARGET="-source 7 -target 7"
  1.1324 +AC_SUBST(BOOT_JDK_SOURCETARGET)
  1.1325 +
  1.1326 +# Use the javac tool from the Boot JDK.
  1.1327 +AC_MSG_CHECKING([for javac in Boot JDK])
  1.1328 +JAVAC=$BOOT_JDK/bin/javac
  1.1329 +if test ! -x $JAVAC; then
  1.1330 +    AC_ERROR([Could not find a working javac])
  1.1331 +fi
  1.1332 +AC_MSG_RESULT(yes)
  1.1333 +AC_SUBST(JAVAC)
  1.1334 +AC_SUBST(JAVAC_FLAGS)
  1.1335 +
  1.1336 +# Use the javac tool from the Boot JDK.
  1.1337 +AC_MSG_CHECKING([for javah in Boot JDK])
  1.1338 +JAVAH=$BOOT_JDK/bin/javah
  1.1339 +if test ! -x $JAVAH; then
  1.1340 +    AC_ERROR([Could not find a working javah])
  1.1341 +fi
  1.1342 +AC_MSG_RESULT(yes)
  1.1343 +AC_SUBST(JAVAH)
  1.1344 +
  1.1345 +# Use the jar tool from the Boot JDK.
  1.1346 +AC_MSG_CHECKING([for jar in Boot JDK])
  1.1347 +JAR=$BOOT_JDK/bin/jar
  1.1348 +if test ! -x $JAR; then
  1.1349 +    AC_ERROR([Could not find a working jar])
  1.1350 +fi
  1.1351 +AC_SUBST(JAR)
  1.1352 +AC_MSG_RESULT(yes)
  1.1353 +
  1.1354 +# Use the rmic tool from the Boot JDK.
  1.1355 +AC_MSG_CHECKING([for rmic in Boot JDK])
  1.1356 +RMIC=$BOOT_JDK/bin/rmic
  1.1357 +if test ! -x $RMIC; then
  1.1358 +    AC_ERROR([Could not find a working rmic])
  1.1359 +fi
  1.1360 +AC_SUBST(RMIC)
  1.1361 +AC_MSG_RESULT(yes)
  1.1362 +
  1.1363 +###############################################################################
  1.1364 +#
  1.1365 +# Pickup additional source for a component from outside of the source root
  1.1366 +# or override source for a component. 
  1.1367 +#
  1.1368 +AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
  1.1369 +    [for each and every source directory, look in this additional source root for
  1.1370 +     the same directory; if it exists and have files in it, include it in the build])])                             
  1.1371 +                             
  1.1372 +AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
  1.1373 +    [for each and every source directory, look in this override source root for
  1.1374 +     the same directory; if it exists, use that directory instead and
  1.1375 +     ignore the directory in the original source root])])
  1.1376 +
  1.1377 +AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
  1.1378 +    [use the subdirs 'adds' and 'overrides' in the specified directory as
  1.1379 +     add-source-root and override-source-root])])
  1.1380 +
  1.1381 +if test "x$with_adds_and_overrides" != x; then
  1.1382 +    with_add_source_root="$with_adds_and_overrides/adds"
  1.1383 +    with_override_source_root="$with_adds_and_overrides/overrides"
  1.1384 +fi
  1.1385 +
  1.1386 +if test "x$with_add_source_root" != x; then
  1.1387 +    if ! test -d $with_add_source_root; then
  1.1388 +       AC_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
  1.1389 +    fi
  1.1390 +    CURDIR="$PWD"
  1.1391 +    cd "$with_add_source_root"
  1.1392 +    ADD_SRC_ROOT="`pwd`"
  1.1393 +    cd "$CURDIR"
  1.1394 +    # Verify that the addon source root does not have any root makefiles.
  1.1395 +    # If it does, then it is usually an error, prevent this.
  1.1396 +    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
  1.1397 +       test -f $with_add_source_root/langtools/make/Makefile; then
  1.1398 +        AC_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
  1.1399 +    fi
  1.1400 +    if test -f $with_add_source_root/corba/makefiles/Makefile || \
  1.1401 +       test -f $with_add_source_root/corba/make/Makefile; then
  1.1402 +        AC_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
  1.1403 +    fi
  1.1404 +    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
  1.1405 +       test -f $with_add_source_root/jaxp/make/Makefile; then
  1.1406 +        AC_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
  1.1407 +    fi
  1.1408 +    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
  1.1409 +       test -f $with_add_source_root/jaxws/make/Makefile; then
  1.1410 +        AC_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
  1.1411 +    fi
  1.1412 +    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
  1.1413 +       test -f $with_add_source_root/hotspot/make/Makefile; then
  1.1414 +        AC_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
  1.1415 +    fi
  1.1416 +    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
  1.1417 +       test -f $with_add_source_root/jdk/make/Makefile; then
  1.1418 +        AC_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
  1.1419 +    fi
  1.1420 +fi
  1.1421 +AC_SUBST(ADD_SRC_ROOT)
  1.1422 +
  1.1423 +if test "x$with_override_source_root" != x; then
  1.1424 +    if ! test -d $with_override_source_root; then
  1.1425 +       AC_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
  1.1426 +    fi
  1.1427 +    CURDIR="$PWD"
  1.1428 +    cd "$with_override_source_root"
  1.1429 +    OVERRIDE_SRC_ROOT="`pwd`"
  1.1430 +    cd "$CURDIR"
  1.1431 +    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
  1.1432 +       test -f $with_override_source_root/langtools/make/Makefile; then
  1.1433 +        AC_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
  1.1434 +    fi
  1.1435 +    if test -f $with_override_source_root/corba/makefiles/Makefile || \
  1.1436 +       test -f $with_override_source_root/corba/make/Makefile; then
  1.1437 +        AC_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
  1.1438 +    fi
  1.1439 +    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
  1.1440 +       test -f $with_override_source_root/jaxp/make/Makefile; then
  1.1441 +        AC_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
  1.1442 +    fi
  1.1443 +    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
  1.1444 +       test -f $with_override_source_root/jaxws/make/Makefile; then
  1.1445 +        AC_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
  1.1446 +    fi
  1.1447 +    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
  1.1448 +       test -f $with_override_source_root/hotspot/make/Makefile; then
  1.1449 +        AC_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
  1.1450 +    fi
  1.1451 +    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
  1.1452 +       test -f $with_override_source_root/jdk/make/Makefile; then
  1.1453 +        AC_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
  1.1454 +    fi
  1.1455 +fi
  1.1456 +AC_SUBST(OVERRIDE_SRC_ROOT)
  1.1457 +
  1.1458 +###############################################################################
  1.1459 +#
  1.1460 +# Override a repo completely, this is used for example when you have 3 small
  1.1461 +# development sandboxes of the langtools sources and want to avoid having 3 full
  1.1462 +# OpenJDK sources checked out on disk.
  1.1463 +#
  1.1464 +# Assuming that the 3 langtools sandboxes are located here:
  1.1465 +# /home/fredrik/sandbox1/langtools
  1.1466 +# /home/fredrik/sandbox2/langtools
  1.1467 +# /home/fredrik/sandbox3/langtools
  1.1468 +#
  1.1469 +# From the source root you create build subdirs manually:
  1.1470 +#     mkdir -p build1 build2 build3 
  1.1471 +# in each build directory run:
  1.1472 +#     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
  1.1473 +#     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
  1.1474 +#     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
  1.1475 +#
  1.1476 +
  1.1477 +AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
  1.1478 +    [use this langtools dir for the build])])
  1.1479 +
  1.1480 +AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
  1.1481 +    [use this corba dir for the build])])
  1.1482 +
  1.1483 +AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
  1.1484 +	[use this jaxp dir for the build])])
  1.1485 +
  1.1486 +AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
  1.1487 +	[use this jaxws dir for the build])])
  1.1488 +
  1.1489 +AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
  1.1490 +	[use this hotspot dir for the build])])
  1.1491 +
  1.1492 +AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
  1.1493 +	[use this jdk dir for the build])])
  1.1494 +
  1.1495 +if test "x$with_override_langtools" != x; then
  1.1496 +    CURDIR="$PWD"
  1.1497 +    cd "$with_override_langtools"
  1.1498 +    LANGTOOLS_TOPDIR="`pwd`"
  1.1499 +    cd "$CURDIR"
  1.1500 +    if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then
  1.1501 +        AC_ERROR([You have to override langtools with a full langtools repo!])
  1.1502 +    fi
  1.1503 +    AC_MSG_CHECKING([if langtools should be overridden])
  1.1504 +    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
  1.1505 +fi    
  1.1506 +if test "x$with_override_corba" != x; then
  1.1507 +    CURDIR="$PWD"
  1.1508 +    cd "$with_override_corba"
  1.1509 +    CORBA_TOPDIR="`pwd`"
  1.1510 +    cd "$CURDIR"
  1.1511 +    if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then
  1.1512 +        AC_ERROR([You have to override corba with a full corba repo!])
  1.1513 +    fi
  1.1514 +    AC_MSG_CHECKING([if corba should be overridden])
  1.1515 +    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
  1.1516 +fi    
  1.1517 +if test "x$with_override_jaxp" != x; then
  1.1518 +    CURDIR="$PWD"
  1.1519 +    cd "$with_override_jaxp"
  1.1520 +    JAXP_TOPDIR="`pwd`"
  1.1521 +    cd "$CURDIR"
  1.1522 +    if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then
  1.1523 +        AC_ERROR([You have to override jaxp with a full jaxp repo!])
  1.1524 +    fi
  1.1525 +    AC_MSG_CHECKING([if jaxp should be overridden])
  1.1526 +    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
  1.1527 +fi    
  1.1528 +if test "x$with_override_jaxws" != x; then
  1.1529 +    CURDIR="$PWD"
  1.1530 +    cd "$with_override_jaxws"
  1.1531 +    JAXWS_TOPDIR="`pwd`"
  1.1532 +    cd "$CURDIR"
  1.1533 +    if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then
  1.1534 +        AC_ERROR([You have to override jaxws with a full jaxws repo!])
  1.1535 +    fi
  1.1536 +    AC_MSG_CHECKING([if jaxws should be overridden])
  1.1537 +    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
  1.1538 +fi    
  1.1539 +if test "x$with_override_hotspot" != x; then
  1.1540 +    CURDIR="$PWD"
  1.1541 +    cd "$with_override_hotspot"
  1.1542 +    HOTSPOT_TOPDIR="`pwd`"
  1.1543 +    cd "$CURDIR"
  1.1544 +    if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \
  1.1545 +       ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then
  1.1546 +        AC_ERROR([You have to override hotspot with a full hotspot repo!])
  1.1547 +    fi
  1.1548 +    AC_MSG_CHECKING([if hotspot should be overridden])
  1.1549 +    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
  1.1550 +fi    
  1.1551 +if test "x$with_override_jdk" != x; then
  1.1552 +    CURDIR="$PWD"
  1.1553 +    cd "$with_override_jdk"
  1.1554 +    JDK_TOPDIR="`pwd`"
  1.1555 +    cd "$CURDIR"
  1.1556 +    if ! test -f $JDK_TOPDIR/makefiles/Makefile; then
  1.1557 +        AC_ERROR([You have to override JDK with a full JDK repo!])
  1.1558 +    fi
  1.1559 +    AC_MSG_CHECKING([if JDK should be overridden])
  1.1560 +    AC_MSG_RESULT([yes with $JDK_TOPDIR])
  1.1561 +fi    
  1.1562 +
  1.1563 +###############################################################################
  1.1564 +#
  1.1565 +# Specify options for anything that is run with the Boot JDK.
  1.1566 +#
  1.1567 +AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
  1.1568 +	[specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values,
  1.1569 +     e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])])
  1.1570 +
  1.1571 +if test "x$with_boot_jdk_jvmargs" = x; then
  1.1572 +    # Not all JVM:s accept the same arguments on the command line.
  1.1573 +    # OpenJDK specific increase in thread stack for JDK build,
  1.1574 +    # well more specifically, when running javac.
  1.1575 +    if test "x$BUILD_NUM_BITS" = x32; then
  1.1576 +       STACK_SIZE=768
  1.1577 +    else
  1.1578 +       # Running Javac on a JVM on a 64-bit machine, the stack takes more space
  1.1579 +       # since 64-bit pointers are pushed on the stach. Apparently, we need
  1.1580 +       # to increase the stack space when javacing the JDK....
  1.1581 +       STACK_SIZE=1536
  1.1582 +    fi
  1.1583 +
  1.1584 +    # Minimum amount of heap memory.
  1.1585 +    ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA])
  1.1586 +    if test "x$HOST_OS" = "xmacosx"; then
  1.1587 +        # Why does macosx need more heap? Its the huge JDK batch.
  1.1588 +        ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA])
  1.1589 +    else
  1.1590 +        ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA])
  1.1591 +    fi
  1.1592 +    # When is adding -client something that speeds up the JVM?
  1.1593 +    # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA])
  1.1594 +    ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA])
  1.1595 +    ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA])
  1.1596 +    ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA])
  1.1597 +    # Disable special log output when a debug build is used as Boot JDK...
  1.1598 +    ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
  1.1599 +fi
  1.1600 +
  1.1601 +AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs)
  1.1602 +
  1.1603 +AC_ARG_WITH(server-java, [AS_HELP_STRING([--with-server-java],
  1.1604 +	[use this java binary for running the javac background server and other long running java tasks in the build process,
  1.1605 +     e.g. ---with-server-java="/opt/jrockit/bin/java -server"])])
  1.1606 +
  1.1607 +if test "x$with_server_java" != x; then
  1.1608 +    SERVER_JAVA="$with_server_java"
  1.1609 +    FOUND_VERSION=`$SERVER_JAVA -version 2>&1 | grep " version \""`
  1.1610 +    if test "x$FOUND_VERSION" = x; then
  1.1611 +        AC_ERROR([Could not execute server java: $SERVER_JAVA])
  1.1612 +    fi
  1.1613 +else
  1.1614 +    SERVER_JAVA=""
  1.1615 +    # Hotspot specific options.
  1.1616 +    ADD_JVM_ARG_IF_OK([-XX:+UseParallelOldGC],SERVER_JAVA,[$JAVA])
  1.1617 +    ADD_JVM_ARG_IF_OK([-verbosegc],SERVER_JAVA,[$JAVA])
  1.1618 +    # JRockit specific options.
  1.1619 +    ADD_JVM_ARG_IF_OK([-Xverbose:gc],SERVER_JAVA,[$JAVA])
  1.1620 +    SERVER_JAVA="$JAVA $SERVER_JAVA"
  1.1621 +fi                    
  1.1622 +AC_SUBST(SERVER_JAVA)
  1.1623 +
  1.1624 +AC_MSG_CHECKING([whether to use shared server for javac])
  1.1625 +AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--enable-javac-server],
  1.1626 +	[enable the shared javac server during the build process @<:@disabled@:>@])],
  1.1627 +	[ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER='no'])
  1.1628 +AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
  1.1629 +if test "x$ENABLE_JAVAC_SERVER" = xyes; then
  1.1630 +    JAVAC_USE_REMOTE=true
  1.1631 +    JAVAC_SERVERS="$OUTPUT_ROOT/javacservers"
  1.1632 +else
  1.1633 +    JAVAC_USE_REMOTE=false
  1.1634 +    JAVAC_SERVERS=
  1.1635 +fi
  1.1636 +AC_SUBST(JAVAC_USE_REMOTE)
  1.1637 +AC_SUBST(JAVAC_SERVERS)
  1.1638 +
  1.1639 +AC_ARG_WITH(javac-server-cores, [AS_HELP_STRING([--with-javac-server-cores],
  1.1640 +	[use at most this number of concurrent threads on the javac server @<:@probed@:>@])])
  1.1641 +if test "x$with_javac_server_cores" != x; then
  1.1642 +    JAVAC_SERVER_CORES="$with_javac_server_cores"
  1.1643 +else
  1.1644 +    if test "$NUM_CORES" -gt 16; then
  1.1645 +        # We set this arbitrary limit because we want to limit the heap
  1.1646 +        # size of the javac server.
  1.1647 +        # In the future we will make the javac compilers in the server
  1.1648 +        # share more and more state, thus enabling us to use more and
  1.1649 +        # more concurrent threads in the server.
  1.1650 +        JAVAC_SERVER_CORES="16"
  1.1651 +    else
  1.1652 +        JAVAC_SERVER_CORES="$NUM_CORES"
  1.1653 +    fi
  1.1654 +
  1.1655 +    if test "$MEMORY_SIZE" -gt "17000"; then
  1.1656 +        MAX_HEAP_MEM=10000
  1.1657 +        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
  1.1658 +        ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SERVER_JAVA,[$SERVER_JAVA])
  1.1659 +        ADD_JVM_ARG_IF_OK([-Xmn2G],SERVER_JAVA,[$SERVER_JAVA])
  1.1660 +    elif test "$MEMORY_SIZE" -gt "10000"; then
  1.1661 +        MAX_HEAP_MEM=6000
  1.1662 +        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
  1.1663 +        ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SERVER_JAVA,[$SERVER_JAVA])
  1.1664 +        ADD_JVM_ARG_IF_OK([-Xmn1G],SERVER_JAVA,[$SERVER_JAVA])
  1.1665 +    elif test "$MEMORY_SIZE" -gt "5000"; then
  1.1666 +        MAX_HEAP_MEM=3000
  1.1667 +        ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA])
  1.1668 +        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SERVER_JAVA,[$SERVER_JAVA])
  1.1669 +        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
  1.1670 +    elif test "$MEMORY_SIZE" -gt "3800"; then
  1.1671 +        MAX_HEAP_MEM=2500
  1.1672 +        ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SERVER_JAVA,[$SERVER_JAVA])
  1.1673 +        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
  1.1674 +    elif test "$MEMORY_SIZE" -gt "1900"; then
  1.1675 +        MAX_HEAP_MEM=1200
  1.1676 +        ADD_JVM_ARG_IF_OK([-Xms700M -Xmx1200M],SERVER_JAVA,[$SERVER_JAVA])
  1.1677 +        ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA])
  1.1678 +    elif test "$MEMORY_SIZE" -gt "1000"; then
  1.1679 +        MAX_HEAP_MEM=900
  1.1680 +        ADD_JVM_ARG_IF_OK([-Xms400M -Xmx900M],SERVER_JAVA,[$SERVER_JAVA])
  1.1681 +        ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA])
  1.1682 +    else
  1.1683 +        MAX_HEAP_MEM=512
  1.1684 +        ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SERVER_JAVA,[$SERVER_JAVA])
  1.1685 +        ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA])
  1.1686 +    fi
  1.1687 +
  1.1688 +    MAX_COMPILERS_IN_HEAP=`expr $MAX_HEAP_MEM / 501`
  1.1689 +    if test "$JAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
  1.1690 +        AC_MSG_CHECKING([if number of server cores must be reduced])
  1.1691 +        JAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
  1.1692 +        AC_MSG_RESULT([yes, to $JAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB])
  1.1693 +    fi
  1.1694 +fi                    
  1.1695 +AC_SUBST(JAVAC_SERVER_CORES)
  1.1696 +
  1.1697 +AC_MSG_CHECKING([whether to track dependencies between Java packages])
  1.1698 +AC_ARG_ENABLE([javac-deps], [AS_HELP_STRING([--enable-javac-deps],
  1.1699 +	[enable the dependency tracking between Java packages @<:@disabled@:>@])],
  1.1700 +	[ENABLE_JAVAC_DEPS="${enableval}"], [ENABLE_JAVAC_DEPS='no'])
  1.1701 +AC_MSG_RESULT([$ENABLE_JAVAC_DEPS])
  1.1702 +if test "x$ENABLE_JAVAC_DEPS" = xyes; then
  1.1703 +    JAVAC_USE_DEPS=true
  1.1704 +else
  1.1705 +    JAVAC_USE_DEPS=false
  1.1706 +fi
  1.1707 +AC_SUBST(JAVAC_USE_DEPS)
  1.1708 +
  1.1709 +AC_MSG_CHECKING([whether to use multiple cores for javac compilation])
  1.1710 +AC_ARG_ENABLE([javac-multi-core], [AS_HELP_STRING([--enable-javac-multi-core],
  1.1711 +	[compile Java packages concurrently @<:@disabled@:>@])],
  1.1712 +	[ENABLE_JAVAC_MULTICORE="${enableval}"], [ENABLE_JAVAC_MULTICORE='no'])
  1.1713 +AC_MSG_RESULT([$ENABLE_JAVAC_MULTICORE])
  1.1714 +if test "x$ENABLE_JAVAC_MULTICORE" = xyes; then
  1.1715 +    JAVAC_USE_MODE=MULTI_CORE_CONCURRENT
  1.1716 +else
  1.1717 +    JAVAC_USE_MODE=SINGLE_THREADED_BATCH
  1.1718 +    if test "x$ENABLE_JAVAC_DEPS" = xyes; then
  1.1719 +        AC_MSG_WARN([Dependency tracking is not supported with single threaded batch compiles of Java source roots. Please add --disable-javac-deps to your configure options.])
  1.1720 +        AC_MSG_WARN([Disabling dependency tracking for you now.])
  1.1721 +        JAVAC_USE_DEPS=false
  1.1722 +    fi
  1.1723 +    if test "x$ENABLE_JAVAC_SERVER" = xyes; then
  1.1724 +        AC_MSG_WARN([The javac server will not be used since single threaded batch compiles are run within their own JVM. Please add --disable-javac-server to your configure options.])
  1.1725 +        AC_MSG_WARN([Disabling javac server for you now.])
  1.1726 +        JAVAC_USE_REMOTE=false
  1.1727 +    fi
  1.1728 +fi
  1.1729 +AC_SUBST(JAVAC_USE_MODE)
  1.1730 +
  1.1731 +###############################################################################
  1.1732 +#
  1.1733 +# OS specific settings that we never will need to probe.
  1.1734 +#
  1.1735 +if test "x$HOST_OS" = xlinux; then
  1.1736 +    AC_MSG_CHECKING([what is not needed on Linux?])
  1.1737 +    PULSE_NOT_NEEDED=yes
  1.1738 +    AC_MSG_RESULT([pulse])
  1.1739 +fi
  1.1740 +
  1.1741 +if test "x$HOST_OS" = xsolaris; then
  1.1742 +    AC_MSG_CHECKING([what is not needed on Solaris?])
  1.1743 +    ALSA_NOT_NEEDED=yes
  1.1744 +    PULSE_NOT_NEEDED=yes
  1.1745 +    AC_MSG_RESULT([alsa pulse])
  1.1746 +fi
  1.1747 +
  1.1748 +if test "x$HOST_OS" = xwindows; then
  1.1749 +    AC_MSG_CHECKING([what is not needed on Windows?])
  1.1750 +    CUPS_NOT_NEEDED=yes    
  1.1751 +    ALSA_NOT_NEEDED=yes
  1.1752 +    PULSE_NOT_NEEDED=yes
  1.1753 +    X11_NOT_NEEDED=yes
  1.1754 +    AC_MSG_RESULT([alsa cups pulse x11])
  1.1755 +fi
  1.1756 +
  1.1757 +if test "x$HOST_OS" = xmacosx; then
  1.1758 +    AC_MSG_CHECKING([what is not needed on MacOSX?])
  1.1759 +    ALSA_NOT_NEEDED=yes
  1.1760 +    PULSE_NOT_NEEDED=yes
  1.1761 +    X11_NOT_NEEDED=yes
  1.1762 +    FREETYPE2_NOT_NEEDED=yes    
  1.1763 +    # If the java runtime framework is disabled, then we need X11.
  1.1764 +    # This will be adjusted below.
  1.1765 +    AC_MSG_RESULT([alsa pulse x11])
  1.1766 +fi
  1.1767 +
  1.1768 +if test "x$HOST_OS" = xbsd; then
  1.1769 +    AC_MSG_CHECKING([what is not needed on bsd?])
  1.1770 +    ALSA_NOT_NEEDED=yes
  1.1771 +    AC_MSG_RESULT([alsa])    
  1.1772 +fi
  1.1773 +
  1.1774 +###############################################################################
  1.1775 +#
  1.1776 +# Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
  1.1777 +# that uses this API. 
  1.1778 +#
  1.1779 +AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support],
  1.1780 +	[disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])],
  1.1781 +	[MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"])
  1.1782 +
  1.1783 +USE_MACOSX_RUNTIME_SUPPORT=no
  1.1784 +AC_MSG_CHECKING([for explicit Java runtime support in the OS])
  1.1785 +if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
  1.1786 +    if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
  1.1787 +        MACOSX_RUNTIME_SUPPORT=yes
  1.1788 +        USE_MACOSX_RUNTIME_SUPPORT=yes
  1.1789 +        AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11])
  1.1790 +    else
  1.1791 +        AC_MSG_RESULT([yes, but explicitly disabled.])
  1.1792 +    fi
  1.1793 +else
  1.1794 +    AC_MSG_RESULT([no])
  1.1795 +fi
  1.1796 +
  1.1797 +if test "x$HOST_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
  1.1798 +    AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?])
  1.1799 +    X11_NOT_NEEDED=
  1.1800 +    FREETYPE2_NOT_NEEDED=
  1.1801 +    AC_MSG_RESULT([alsa pulse])
  1.1802 +fi
  1.1803 +
  1.1804 +###############################################################################
  1.1805 +#
  1.1806 +# Check for X Windows
  1.1807 +#
  1.1808 +AC_PATH_XTRA
  1.1809 +
  1.1810 +if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then 
  1.1811 +    help_on_build_dependency x11
  1.1812 +    AC_ERROR([Could not find X11 libraries. $HELP_MSG])
  1.1813 +fi
  1.1814 +
  1.1815 +AC_SUBST(X_CFLAGS)
  1.1816 +AC_SUBST(X_LIBS)
  1.1817 +
  1.1818 +# Some of the old makefiles require a setting of OPENWIN_HOME
  1.1819 +# Since the X11R6 directory has disappeared on later Linuxes,
  1.1820 +# we need to probe for it.
  1.1821 +if test "x$HOST_OS" = xlinux; then
  1.1822 +    if test -d "$SYS_ROOT/usr/X11R6"; then
  1.1823 +        OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
  1.1824 +    fi
  1.1825 +    if test -d "$SYS_ROOT/usr/include/X11"; then
  1.1826 +        OPENWIN_HOME="$SYS_ROOT/usr"
  1.1827 +    fi
  1.1828 +fi
  1.1829 +if test "x$HOST_OS" = xsolaris; then
  1.1830 +    OPENWIN_HOME="/usr/openwin"
  1.1831 +fi
  1.1832 +AC_SUBST(OPENWIN_HOME)
  1.1833 +
  1.1834 +AC_LANG_PUSH(C)
  1.1835 +OLD_CFLAGS="$CFLAGS"
  1.1836 +CFLAGS="$CFLAGS $X_CFLAGS"
  1.1837 +AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
  1.1838 +                [X11_A_OK=yes],
  1.1839 +                [X11_A_OK=no])
  1.1840 +CFLAGS="$OLD_CFLAGS"
  1.1841 +AC_LANG_POP(C)
  1.1842 +
  1.1843 +if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then 
  1.1844 +    help_on_build_dependency x11
  1.1845 +    AC_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
  1.1846 +fi
  1.1847 +
  1.1848 +###############################################################################
  1.1849 +#
  1.1850 +# The common unix printing system cups is used to print from java.
  1.1851 +#
  1.1852 +AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
  1.1853 +    [specify prefix directory for the cups package
  1.1854 +	 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
  1.1855 +AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
  1.1856 +	[specify directory for the cups include files])])
  1.1857 +AC_ARG_WITH(cups-lib, [AS_HELP_STRING([--with-cups-lib],
  1.1858 +	[specify directory for the cups library])])
  1.1859 +
  1.1860 +if test "x$CUPS_NOT_NEEDED" = xyes; then
  1.1861 +	if test "x$with_cups" != x || test "x$with_cups-include" != x || test "x$with_cups-lib" != x; then
  1.1862 +		AC_MSG_WARN([cups not used, so --with-cups is ignored])
  1.1863 +	fi
  1.1864 +	CUPS_CFLAGS=
  1.1865 +	CUPS_LIBS=
  1.1866 +else
  1.1867 +	CUPS_FOUND=no
  1.1868 +
  1.1869 +	if test "x$with_cups" = xno || test "x$with_cups-include" = xno || test "x$with_cups-lib" = xno; then
  1.1870 +	    AC_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
  1.1871 +	fi
  1.1872 +
  1.1873 +	if test "x$with_cups" != x; then
  1.1874 +	    CUPS_LIBS="-L$with_cups/lib -lcups"
  1.1875 +	    CUPS_CFLAGS="-I$with_cups/include"
  1.1876 +	    CUPS_FOUND=yes
  1.1877 +	fi
  1.1878 +	if test "x$with_cups-include" != x; then
  1.1879 +	    CUPS_CFLAGS="-I$with_cups-include"
  1.1880 +	    CUPS_FOUND=yes
  1.1881 +	fi
  1.1882 +	if test "x$with_cups-lib" != x; then
  1.1883 +	    CUPS_LIBS="-L$with_cups-lib -lcups"
  1.1884 +	    CUPS_FOUND=yes
  1.1885 +	fi
  1.1886 +	if test "x$CUPS_FOUND" = xno; then
  1.1887 +	    BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
  1.1888 +	fi
  1.1889 +	if test "x$CUPS_FOUND" = xno; then
  1.1890 +	    # Are the cups headers installed in the default /usr/include location?
  1.1891 +	    AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
  1.1892 +	                     [CUPS_FOUND=yes
  1.1893 +	                      CUPS_CFLAGS=
  1.1894 +	                      CUPS_LIBS="-lcups"
  1.1895 +	                      DEFAULT_CUPS=yes])
  1.1896 +	fi
  1.1897 +	if test "x$CUPS_FOUND" = xno; then
  1.1898 +	    # Getting nervous now? Lets poke around for standard Solaris third-party
  1.1899 +	    # package installation locations.
  1.1900 +	    AC_MSG_CHECKING([for cups headers and libs])
  1.1901 +	    if test -s /opt/sfw/cups/include/cups/cups.h; then
  1.1902 +	       # An SFW package seems to be installed!
  1.1903 +	       CUPS_FOUND=yes
  1.1904 +	       CUPS_CFLAGS="-I/opt/sfw/cups/include"
  1.1905 +	       CUPS_LIBS="-L/opt/sfw/cups/lib -lcups"
  1.1906 +	    elif test -s /opt/csw/include/cups/cups.h; then
  1.1907 +	       # A CSW package seems to be installed!
  1.1908 +	       CUPS_FOUND=yes
  1.1909 +	       CUPS_CFLAGS="-I/opt/csw/include"
  1.1910 +	       CUPS_LIBS="-L/opt/csw/lib -lcups"
  1.1911 +	    fi
  1.1912 +	    AC_MSG_RESULT([$CUPS_FOUND])
  1.1913 +	fi
  1.1914 +	if test "x$CUPS_FOUND" = xno; then 
  1.1915 +	    help_on_build_dependency cups
  1.1916 +	    AC_ERROR([Could not find cups! $HELP_MSG ])
  1.1917 +	fi
  1.1918 +fi
  1.1919 +
  1.1920 +AC_SUBST(CUPS_CFLAGS)
  1.1921 +AC_SUBST(CUPS_LIBS)
  1.1922 +
  1.1923 +###############################################################################
  1.1924 +#
  1.1925 +# The ubiquitous freetype2 library is used to render fonts.
  1.1926 +#
  1.1927 +AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
  1.1928 +	[specify prefix directory for the freetype2 package
  1.1929 +     (expecting the libraries under PATH/lib and the headers under PATH/include)])])
  1.1930 +
  1.1931 +# If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
  1.1932 +USING_SYSTEM_FT_LIB=false
  1.1933 +
  1.1934 +if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
  1.1935 +	if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
  1.1936 +		AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
  1.1937 +	fi
  1.1938 +	FREETYPE2_CFLAGS=
  1.1939 +	FREETYPE2_LIBS=
  1.1940 +        FREETYPE2_LIB_PATH=
  1.1941 +else
  1.1942 +	FREETYPE2_FOUND=no
  1.1943 +
  1.1944 +	if test "x$with_freetype" != x; then
  1.1945 +            SPACESAFE(with_freetype,[the path to freetype])
  1.1946 +	    FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
  1.1947 +            if test "x$HOST_OS" = xwindows; then
  1.1948 +                FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
  1.1949 +            fi
  1.1950 +            FREETYPE2_LIB_PATH="$with_freetype/lib"
  1.1951 +	    FREETYPE2_CFLAGS="-I$with_freetype/include"
  1.1952 +            if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
  1.1953 +                FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
  1.1954 +            fi
  1.1955 +	    FREETYPE2_FOUND=yes
  1.1956 +   	    if test "x$FREETYPE2_FOUND" = xyes; then
  1.1957 +	        # Verify that the directories exist 
  1.1958 +                if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
  1.1959 +		   AC_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
  1.1960 +		fi
  1.1961 +	        # List the contents of the lib.
  1.1962 +		FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
  1.1963 +                if test "x$FREETYPELIB" = x; then
  1.1964 +		   AC_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib])
  1.1965 +		fi
  1.1966 +	        # Check one h-file
  1.1967 +                if ! test -s "$with_freetype/include/ft2build.h"; then
  1.1968 +		   AC_ERROR([Could not find $with_freetype/include/ft2build.h])
  1.1969 +		fi
  1.1970 +            fi
  1.1971 +        fi
  1.1972 +	if test "x$FREETYPE2_FOUND" = xno; then
  1.1973 +	    BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
  1.1974 +            USING_SYSTEM_FT_LIB=true
  1.1975 +	fi
  1.1976 +	if test "x$FREETYPE2_FOUND" = xno; then
  1.1977 +	    PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
  1.1978 +            USING_SYSTEM_FT_LIB=true
  1.1979 +	fi
  1.1980 +	if test "x$FREETYPE2_FOUND" = xno; then
  1.1981 +	    AC_MSG_CHECKING([for freetype in some standard locations])
  1.1982 +	
  1.1983 +	    if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
  1.1984 +	        DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
  1.1985 +	        DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
  1.1986 +	    fi
  1.1987 +	    if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
  1.1988 +	        DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
  1.1989 +	        DEFAULT_FREETYPE_LIBS="-lfreetype"
  1.1990 +	    fi
  1.1991 +	
  1.1992 +	    PREV_CXXCFLAGS="$CXXFLAGS"
  1.1993 +	    PREV_LDFLAGS="$LDFLAGS"
  1.1994 +	    CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
  1.1995 +	    LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
  1.1996 +	    AC_LINK_IFELSE([AC_LANG_SOURCE([[#include<ft2build.h>
  1.1997 +	                    #include FT_FREETYPE_H 
  1.1998 +	                   int main() { return 0; }
  1.1999 +	                  ]])],
  1.2000 +	                  [
  1.2001 +	                      # Yes, the default cflags and libs did the trick.
  1.2002 +	                      FREETYPE2_FOUND=yes
  1.2003 +	                      FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
  1.2004 +	                      FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
  1.2005 +	                  ],
  1.2006 +	                  [
  1.2007 +	                      FREETYPE2_FOUND=no
  1.2008 +	                  ])
  1.2009 +            CXXCFLAGS="$PREV_CXXFLAGS"
  1.2010 +	    LDFLAGS="$PREV_LDFLAGS"
  1.2011 +	    AC_MSG_RESULT([$FREETYPE2_FOUND])
  1.2012 +            USING_SYSTEM_FT_LIB=true
  1.2013 +	fi
  1.2014 +	if test "x$FREETYPE2_FOUND" = xno; then
  1.2015 +		help_on_build_dependency freetype2
  1.2016 +		AC_ERROR([Could not find freetype2! $HELP_MSG ])
  1.2017 +	fi    
  1.2018 +fi
  1.2019 +
  1.2020 +AC_SUBST(USING_SYSTEM_FT_LIB)
  1.2021 +AC_SUBST(FREETYPE2_LIB_PATH)
  1.2022 +AC_SUBST(FREETYPE2_CFLAGS)
  1.2023 +AC_SUBST(FREETYPE2_LIBS)
  1.2024 +
  1.2025 +###############################################################################
  1.2026 +#
  1.2027 +# Check for alsa headers and libraries. Used on Linux/GNU systems.
  1.2028 +#
  1.2029 +AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
  1.2030 +	[specify prefix directory for the alsa package
  1.2031 +	 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
  1.2032 +AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
  1.2033 +	[specify directory for the alsa include files])])
  1.2034 +AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
  1.2035 +	[specify directory for the alsa library])])
  1.2036 +
  1.2037 +if test "x$ALSA_NOT_NEEDED" = xyes; then
  1.2038 +	if test "x$with_alsa" != x || test "x$with_alsa-include" != x || test "x$with_alsa-lib" != x; then
  1.2039 +		AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
  1.2040 +	fi
  1.2041 +	ALSA_CFLAGS=
  1.2042 +	ALSA_LIBS=
  1.2043 +else
  1.2044 +	ALSA_FOUND=no
  1.2045 +
  1.2046 +	if test "x$with_alsa" = xno || test "x$with_alsa-include" = xno || test "x$with_alsa-lib" = xno; then
  1.2047 +	    AC_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
  1.2048 +	fi
  1.2049 +
  1.2050 +	if test "x$with_alsa" != x; then
  1.2051 +	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
  1.2052 +	    ALSA_CFLAGS="-I$with_alsa/include"
  1.2053 +	    ALSA_FOUND=yes
  1.2054 +	fi
  1.2055 +	if test "x$with_alsa-include" != x; then
  1.2056 +	    ALSA_CFLAGS="-I$with_alsa/include"
  1.2057 +	    ALSA_FOUND=yes
  1.2058 +	fi
  1.2059 +	if test "x$with_alsa-lib" != x; then
  1.2060 +	    ALSA_LIBS="-L$with_alsa/lib -lalsa"
  1.2061 +	    ALSA_FOUND=yes
  1.2062 +	fi
  1.2063 +	if test "x$ALSA_FOUND" = xno; then
  1.2064 +	    BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
  1.2065 +	fi
  1.2066 +	if test "x$ALSA_FOUND" = xno; then
  1.2067 +	    PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
  1.2068 +	fi
  1.2069 +	if test "x$ALSA_FOUND" = xno; then
  1.2070 +	    AC_CHECK_HEADERS([alsa/asoundlib.h],
  1.2071 +	                     [ALSA_FOUND=yes
  1.2072 +	                      ALSA_CFLAGS=-Iignoreme
  1.2073 +	                      ALSA_LIBS=-lasound
  1.2074 +	                      DEFAULT_ALSA=yes],
  1.2075 +	                     [ALSA_FOUND=no])
  1.2076 +	fi
  1.2077 +	if test "x$ALSA_FOUND" = xno; then 
  1.2078 +	    help_on_build_dependency alsa
  1.2079 +	    AC_ERROR([Could not find alsa! $HELP_MSG ])
  1.2080 +	fi    
  1.2081 +fi
  1.2082 +
  1.2083 +AC_SUBST(ALSA_CFLAGS)
  1.2084 +AC_SUBST(ALSA_LIBS)
  1.2085 +
  1.2086 +###############################################################################
  1.2087 +#
  1.2088 +# Check for pulse audio headers and libraries.
  1.2089 +#
  1.2090 +PULSE_FOUND=no
  1.2091 +AC_ARG_WITH(pulse, [AS_HELP_STRING([--with-pulse],
  1.2092 +	[specify prefix directory for the pulseaudio package
  1.2093 +	 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
  1.2094 +AC_ARG_WITH(pulse-include, [AS_HELP_STRING([--with-pulse-include],
  1.2095 +	[specify directory for the pulseaudio include files])])
  1.2096 +AC_ARG_WITH(pulse-lib, [AS_HELP_STRING([--with-pulse-lib],
  1.2097 +	[specify directory for the pulseaudio library])])
  1.2098 +
  1.2099 +if test "x$with_pulse" != x; then
  1.2100 +    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
  1.2101 +    PULSE_CFLAGS="-I$with_pulse/include"
  1.2102 +    PULSE_FOUND=yes
  1.2103 +fi
  1.2104 +if test "x$with_pulse-include" != x; then
  1.2105 +    PULSE_CFLAGS="-I$with_pulse/include"
  1.2106 +    PULSE_FOUND=yes
  1.2107 +fi
  1.2108 +if test "x$with_pulse-lib" != x; then
  1.2109 +    PULSE_LIBS="-L$with_pulse/lib -lfreetype"
  1.2110 +    PULSE_FOUND=yes
  1.2111 +fi
  1.2112 +if test "x$PULSE_FOUND" = xno; then
  1.2113 +    BDEPS_CHECK_MODULE(PULSE, pulse, xxx, [PULSE_FOUND=yes], [PULSE_FOUND=no])
  1.2114 +fi
  1.2115 +if test "x$PULSE_FOUND" = xno; then
  1.2116 +    PKG_CHECK_MODULES(LIBPULSE,[libpulse >= 0.9.11],[PULSE_FOUND=yes],[PULSE_FOUND=no])
  1.2117 +fi
  1.2118 +if test "x$PULSE_FOUND" = xno; then
  1.2119 +    AC_CHECK_HEADERS([pulse/pulseaudio.h],
  1.2120 +                     [PULSE_FOUND=yes
  1.2121 +                      PULSE_CFLAGS=-Iignoreme
  1.2122 +                      PULSE_LIBS=
  1.2123 +                      DEFAULT_PULSE=yes],
  1.2124 +                     [PULSE_FOUND=no])
  1.2125 +fi
  1.2126 +
  1.2127 +if test "x$PULSE_FOUND" = xno && test "x$PULSE_NOT_NEEDED" != xyes; then 
  1.2128 +    help_on_build_dependency pulse
  1.2129 +    AC_ERROR([Could not find pulse audio libraries. $HELP_MSG ])
  1.2130 +fi    
  1.2131 +
  1.2132 +AC_SUBST(PULSE_CFLAGS)
  1.2133 +AC_SUBST(PULSE_LIBS)
  1.2134 +
  1.2135 +###############################################################################
  1.2136 +#
  1.2137 +# Check for the jpeg library
  1.2138 +#
  1.2139 +
  1.2140 +USE_EXTERNAL_LIBJPEG=true
  1.2141 +AC_CHECK_LIB(jpeg, main, [],
  1.2142 +             [ USE_EXTERNAL_LIBJPEG=false
  1.2143 +               AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
  1.2144 +             ])
  1.2145 +AC_SUBST(USE_EXTERNAL_LIBJPEG)
  1.2146 +        
  1.2147 +###############################################################################
  1.2148 +#
  1.2149 +# Check for the gif library
  1.2150 +#
  1.2151 +
  1.2152 +USE_EXTERNAL_LIBJPEG=true
  1.2153 +AC_CHECK_LIB(gif, main, [],
  1.2154 +             [ USE_EXTERNAL_LIBGIF=false
  1.2155 +               AC_MSG_NOTICE([Will use gif decoder bundled with the OpenJDK source])
  1.2156 +             ])
  1.2157 +AC_SUBST(USE_EXTERNAL_LIBGIF)
  1.2158 +
  1.2159 +###############################################################################
  1.2160 +#
  1.2161 +# Check for the zlib library
  1.2162 +#
  1.2163 +
  1.2164 +USE_EXTERNAL_LIBZ=true
  1.2165 +AC_CHECK_LIB(z, main, [],
  1.2166 +             [ USE_EXTERNAL_LIBZ=false
  1.2167 +               AC_MSG_NOTICE([Will use zlib bundled with the OpenJDK source])
  1.2168 +             ])
  1.2169 +AC_SUBST(USE_EXTERNAL_LIBZ)
  1.2170 +
  1.2171 +###############################################################################
  1.2172 +#
  1.2173 +# Check if altzone exists in time.h
  1.2174 +#
  1.2175 +
  1.2176 +AC_TRY_LINK([#include <time.h>], [return (int)altzone;],
  1.2177 +            has_altzone=yes,
  1.2178 +            has_altzone=no)
  1.2179 +if test "x$has_altzone" = xyes; then
  1.2180 +    AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
  1.2181 +fi
  1.2182 +
  1.2183 +###############################################################################
  1.2184 +#
  1.2185 +# Check the maths library
  1.2186 +#
  1.2187 +
  1.2188 +AC_CHECK_LIB(m, main, [],
  1.2189 +             [ 
  1.2190 +                  AC_MSG_NOTICE([Maths library was not found])
  1.2191 +             ])
  1.2192 +AC_SUBST(LIBM)
  1.2193 +
  1.2194 +###############################################################################
  1.2195 +#
  1.2196 +# Should we run the painfully slow javadoc tool?
  1.2197 +#
  1.2198 +AC_MSG_CHECKING([whether to build documentation])
  1.2199 +AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs],
  1.2200 +	[enable generation of Javadoc documentation @<:@disabled@:>@])],
  1.2201 +	[ENABLE_DOCS="${enableval}"], [ENABLE_DOCS='no'])
  1.2202 +AC_MSG_RESULT([$ENABLE_DOCS])
  1.2203 +AC_SUBST(ENABLE_DOCS)
  1.2204 +GENERATE_DOCS=false
  1.2205 +if test "x$ENABLE_DOCS" = xyes; then
  1.2206 +    GENERATE_DOCS=true
  1.2207 +fi
  1.2208 +AC_SUBST(GENERATE_DOCS)
  1.2209 +
  1.2210 +###############################################################################
  1.2211 +#
  1.2212 +# Should we compile nimbus swing L&F? We can probably remove this option
  1.2213 +# since nimbus is officially part of javax now.
  1.2214 +#
  1.2215 +AC_MSG_CHECKING([whether to build nimbus L&F])
  1.2216 +AC_ARG_ENABLE([nimbus], [AS_HELP_STRING([--disable-nimbus],
  1.2217 +	[disable Nimbus L&F @<:@enabled@:>@])],
  1.2218 +	[ENABLE_NIMBUS="${enableval}"], [ENABLE_NIMBUS='yes'])
  1.2219 +AC_MSG_RESULT([$ENABLE_NIMBUS])
  1.2220 +DISABLE_NIMBUS=
  1.2221 +if test "x$ENABLE_NIMBUS" = xno; then
  1.2222 +    DISABLE_NIMBUS=true
  1.2223 +fi
  1.2224 +AC_SUBST(DISABLE_NIMBUS)
  1.2225 +
  1.2226 +###############################################################################
  1.2227 +#
  1.2228 +# Setup the opt flags for different compilers
  1.2229 +# and different operating systems.
  1.2230 +#
  1.2231 +case $COMPILER_TYPE in
  1.2232 +  CC )
  1.2233 +    D_FLAG="-g"
  1.2234 +    case $COMPILER_NAME in
  1.2235 +      gcc )
  1.2236 +      	case $PLATFORM in
  1.2237 +	  macosx )
  1.2238 +	    # On MacOSX we optimize for size, something
  1.2239 +	    # we should do for all platforms?
  1.2240 +	    C_O_FLAG_HI="-O3"
  1.2241 +	    C_O_FLAG_NORM="-Os"
  1.2242 +	    C_O_FLAG_NONE="-O0"
  1.2243 +	    ;;
  1.2244 +	  *)
  1.2245 +	    C_O_FLAG_HI="-O3"
  1.2246 +	    C_O_FLAG_NORM="-O2"
  1.2247 +	    C_O_FLAG_NONE="-O0"
  1.2248 +	    ;;
  1.2249 +	esac
  1.2250 +        CXX_O_FLAG_HI="$C_O_FLAG_HI"
  1.2251 +        CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
  1.2252 +        CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
  1.2253 +        ;;
  1.2254 +      ossc )
  1.2255 +        case $LEGACY_HOST_CPU1 in
  1.2256 +          i586)
  1.2257 +            C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
  1.2258 +            C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
  1.2259 +            C_O_FLAG_NONE=""
  1.2260 +            CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz"
  1.2261 +            CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz"
  1.2262 +            CXX_O_FLAG_NONE=""
  1.2263 +            ;;
  1.2264 +          sparc)
  1.2265 +            C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
  1.2266 +            C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
  1.2267 +            C_O_FLAG_NONE=""
  1.2268 +            CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
  1.2269 +            CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
  1.2270 +            CXX_O_FLAG_NONE=""
  1.2271 +            ;;
  1.2272 +        esac
  1.2273 +    esac
  1.2274 +    ;;
  1.2275 +  CL )
  1.2276 +    D_FLAG=
  1.2277 +    C_O_FLAG_HI="-O2"
  1.2278 +    C_O_FLAG_NORM="-O1"
  1.2279 +    C_O_FLAG_NONE="-Od"
  1.2280 +    CXX_O_FLAG_HI="$C_O_FLAG_HI"
  1.2281 +    CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
  1.2282 +    CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
  1.2283 +    ;;
  1.2284 +esac
  1.2285 +
  1.2286 +AC_SUBST(C_O_FLAG_HI)
  1.2287 +AC_SUBST(C_O_FLAG_NORM)
  1.2288 +AC_SUBST(C_O_FLAG_NONE)
  1.2289 +AC_SUBST(CXX_O_FLAG_HI)
  1.2290 +AC_SUBST(CXX_O_FLAG_NORM)
  1.2291 +AC_SUBST(CXX_O_FLAG_NONE)
  1.2292 +
  1.2293 +###############################################################################
  1.2294 +#
  1.2295 +# Setup legacy vars/targets and new vars to deal with different debug levels.
  1.2296 +#
  1.2297 +case $DEBUG_LEVEL in
  1.2298 +      release )
  1.2299 +              HOTSPOT_DEBUG_LEVEL="product"
  1.2300 +              HOTSPOT_EXPORT="product"
  1.2301 +              ;;
  1.2302 +      fastdebug ) 
  1.2303 +              HOTSPOT_DEBUG_LEVEL="fastdebug"   
  1.2304 +              HOTSPOT_EXPORT="fastdebug"
  1.2305 +              CFLAGS="$CFLAGS $D_FLAG"
  1.2306 +              JAVAC_FLAGS="$JAVAC_FLAGS -g"
  1.2307 +              ;;
  1.2308 +      slowdebug )
  1.2309 +              HOTSPOT_DEBUG_LEVEL="jvmg"
  1.2310 +              HOTSPOT_EXPORT="debug"
  1.2311 +              CFLAGS="$CFLAGS $D_FLAG"
  1.2312 +	      C_O_FLAG_HI="$C_O_FLAG_NONE"
  1.2313 +	      C_O_FLAG_NORM="$C_O_FLAG_NONE"
  1.2314 +	      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
  1.2315 +	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
  1.2316 +              JAVAC_FLAGS="$JAVAC_FLAGS -g"
  1.2317 +              ;;
  1.2318 +esac              
  1.2319 +
  1.2320 +###############################################################################
  1.2321 +#
  1.2322 +# Generate the legacy makefile targets for hotspot.
  1.2323 +# The hotspot api for selecting the build artifacts, really, needs to be improved.
  1.2324 +#
  1.2325 +HOTSPOT_TARGET=""
  1.2326 +
  1.2327 +if test "x$JVM_VARIANT_SERVER" = xtrue; then
  1.2328 +    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
  1.2329 +fi
  1.2330 +
  1.2331 +if test "x$JVM_VARIANT_CLIENT" = xtrue; then
  1.2332 +    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
  1.2333 +fi
  1.2334 +
  1.2335 +if test "x$JVM_VARIANT_KERNEL" = xtrue; then
  1.2336 +    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
  1.2337 +fi
  1.2338 +
  1.2339 +if test "x$JVM_VARIANT_ZERO" = xtrue; then
  1.2340 +    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
  1.2341 +fi
  1.2342 +
  1.2343 +if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
  1.2344 +    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
  1.2345 +fi
  1.2346 +
  1.2347 +HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
  1.2348 +
  1.2349 +###############################################################################
  1.2350 +#
  1.2351 +# Setup all directories for the subrepoes and the arguments to the sub makes.
  1.2352 +#
  1.2353 +LANGTOOLS_OUTPUTDIR="$OUTPUT_ROOT/langtools"
  1.2354 +LANGTOOLS_DIST="$OUTPUT_ROOT/langtools/dist"
  1.2355 +LANGTOOLS_MAKE_ARGS=""
  1.2356 +AC_SUBST(LANGTOOLS_OUTPUTDIR)
  1.2357 +AC_SUBST(LANGTOOLS_DIST)
  1.2358 +AC_SUBST(LANGTOOLS_MAKE_ARGS)
  1.2359 +
  1.2360 +CORBA_OUTPUTDIR="$OUTPUT_ROOT/corba"
  1.2361 +CORBA_DIST="$OUTPUT_ROOT/corba/dist"
  1.2362 +CORBA_MAKE_ARGS=""
  1.2363 +AC_SUBST(CORBA_OUTPUTDIR)
  1.2364 +AC_SUBST(CORBA_DIST)
  1.2365 +AC_SUBST(CORBA_MAKE_ARGS)
  1.2366 +
  1.2367 +JAXP_OUTPUTDIR="$OUTPUT_ROOT/jaxp"
  1.2368 +JAXP_DIST="$OUTPUT_ROOT/jaxp/dist"
  1.2369 +JAXP_MAKE_ARGS=""
  1.2370 +AC_SUBST(JAXP_OUTPUTDIR)
  1.2371 +AC_SUBST(JAXP_DIST)
  1.2372 +AC_SUBST(JAXP_MAKE_ARGS)
  1.2373 +
  1.2374 +JAXWS_OUTPUTDIR="$OUTPUT_ROOT/jaxws"
  1.2375 +JAXWS_DIST="$OUTPUT_ROOT/jaxws/dist"
  1.2376 +JAXWS_MAKE_ARGS=""
  1.2377 +AC_SUBST(JAXWS_OUTPUTDIR)
  1.2378 +AC_SUBST(JAXWS_DIST)
  1.2379 +AC_SUBST(JAXWS_MAKE_ARGS)
  1.2380 +
  1.2381 +HOTSPOT_OUTPUTDIR="$OUTPUT_ROOT/hotspot"
  1.2382 +HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
  1.2383 +HOTSPOT_MAKE_ARGS="ALT_OUTPUTDIR=$HOTSPOT_OUTPUTDIR ALT_EXPORT_PATH=$HOTSPOT_DIST $HOTSPOT_TARGET"
  1.2384 +AC_SUBST(HOTSPOT_OUTPUTDIR)
  1.2385 +AC_SUBST(HOTSPOT_DIST)
  1.2386 +AC_SUBST(HOTSPOT_MAKE_ARGS)
  1.2387 +
  1.2388 +JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
  1.2389 +JDK_MAKE_ARGS="ALT_OUTPUTDIR=\"$OUTPUT_ROOT/jdk\""
  1.2390 +AC_SUBST(JDK_OUTPUTDIR)
  1.2391 +AC_SUBST(JDK_MAKE_ARGS)
  1.2392 +
  1.2393 +IMAGES_OUTPUTDIR=$OUTPUT_ROOT/images
  1.2394 +IMAGES_MAKE_ARGS="ALT_OUTPUTDIR=$OUTPUT_ROOT/jdk \
  1.2395 +                  SHARE_SRC=$JDK_TOPDIR/src/share \
  1.2396 +                  PLATFORM_SRC=$JDK_TOPDIR/src/$LEGACY_HOST_OS_API \
  1.2397 +                  TEMPDIR=$IMAGES_OUTPUTDIR/tmp \
  1.2398 +                  ABS_TEMPDIR=$IMAGES_OUTPUTDIR/tmp "
  1.2399 +AC_SUBST(IMAGES_OUTPUTDIR)
  1.2400 +AC_SUBST(IMAGES_MAKE_ARGS)
  1.2401 +
  1.2402 +###############################################################################
  1.2403 +#
  1.2404 +# Now setup the CFLAGS and LDFLAGS for the JDK build.
  1.2405 +# Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
  1.2406 +#
  1.2407 +case $COMPILER_NAME in
  1.2408 +      gcc )
  1.2409 +      	  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer \
  1.2410 +                          -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
  1.2411 +          CFLAGS_JDK="$CFLAGS_JDK -fno-strict-aliasing"
  1.2412 +          ;;
  1.2413 +      ossc )
  1.2414 +      	  CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa REQUIRED -v -mt -norunpath -xnolib"
  1.2415 +      	  CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt REQUIRED -features=no%except -DCC_NOEX"
  1.2416 +          ;;
  1.2417 +      cl )
  1.2418 +          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
  1.2419 +               -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
  1.2420 +	       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
  1.2421 +	       -DWIN32 -DIAL"
  1.2422 +          case $LEGACY_HOST_CPU1 in
  1.2423 +              i?86 )
  1.2424 +                  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
  1.2425 +                  ;;
  1.2426 +              amd64 )
  1.2427 +                  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
  1.2428 +                  ;;
  1.2429 +          esac
  1.2430 +          ;;
  1.2431 +esac
  1.2432 +
  1.2433 +CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
  1.2434 +
  1.2435 +# The package path is used only on macosx?
  1.2436 +PACKAGE_PATH=/opt/local
  1.2437 +AC_SUBST(PACKAGE_PATH)
  1.2438 +
  1.2439 +# Sometimes we use a cpu dir (.../lib/amd64/server) 
  1.2440 +# Sometimes not (.../lib/server) 
  1.2441 +LIBARCHDIR="$LEGACY_HOST_CPU2/"
  1.2442 +if test "x$ENDIAN" = xlittle; then
  1.2443 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
  1.2444 +else
  1.2445 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
  1.2446 +fi
  1.2447 +if test "x$HOST_OS" = xlinux; then
  1.2448 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
  1.2449 +fi
  1.2450 +if test "x$HOST_OS" = xwindows; then
  1.2451 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
  1.2452 +fi
  1.2453 +if test "x$HOST_OS" = xsolaris; then
  1.2454 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
  1.2455 +fi
  1.2456 +if test "x$HOST_OS" = xmacosx; then
  1.2457 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
  1.2458 +    LIBARCHDIR=""
  1.2459 +fi
  1.2460 +if test "x$HOST_OS" = xbsd; then
  1.2461 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
  1.2462 +fi
  1.2463 +if test "x$DEBUG_LEVEL" = xrelease; then
  1.2464 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
  1.2465 +else
  1.2466 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
  1.2467 +fi
  1.2468 +
  1.2469 +CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$LEGACY_HOST_CPU1\"' -D$LEGACY_HOST_CPU1"
  1.2470 +CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'"
  1.2471 +
  1.2472 +CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
  1.2473 +        -I${JDK_OUTPUTDIR}/include \
  1.2474 +        -I${JDK_OUTPUTDIR}/include/$PLATFORM \
  1.2475 +        -I${JDK_TOPDIR}/src/share/javavm/export \
  1.2476 +        -I${JDK_TOPDIR}/src/$LEGACY_HOST_OS_API/javavm/export \
  1.2477 +        -I${JDK_TOPDIR}/src/share/native/common \
  1.2478 +        -I${JDK_TOPDIR}/src/$LEGACY_HOST_OS_API/native/common"
  1.2479 +
  1.2480 +# The shared libraries are compiled using the picflag.
  1.2481 +CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
  1.2482 +CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG"
  1.2483 +
  1.2484 +# Executable flags
  1.2485 +CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
  1.2486 +CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
  1.2487 +
  1.2488 +# Now this is odd. The JDK native libraries have to link against libjvm.so
  1.2489 +# On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
  1.2490 +# Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
  1.2491 +# is identical for client and server? Yes. Which is picked at runtime (client or server)?
  1.2492 +# Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
  1.2493 +# libraries will link to whatever is in memory. Yuck. 
  1.2494 +#
  1.2495 +# Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
  1.2496 +if test "x$COMPILER_TYPE" = xCL; then
  1.2497 +    LDFLAGS_JDKLIB="$LDFLAGS -libpath:${JDK_OUTPUTDIR}/lib jvm.lib java.lib"
  1.2498 +    LDFLAGS_JDKLIB_SUFFIX=""
  1.2499 +    if test "x$HOST_CPU_BITS" = "x64"; then
  1.2500 +        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj64/jli.lib"
  1.2501 +    else
  1.2502 +        LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj/jli.lib"
  1.2503 +    fi
  1.2504 +    LDFLAGS_JDKEXE_SUFFIX=""
  1.2505 +else
  1.2506 +    # If this is a --hash-style=gnu system, use --hash-style=both, why?
  1.2507 +    HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
  1.2508 +    if test -n "$HAS_GNU_HASH"; then
  1.2509 +        # And since we now know that the linker is gnu, then add -z defs, to forbid
  1.2510 +        # undefined symbols in object files.
  1.2511 +        LDFLAGS="$LDFLAGS -Xlinker --hash-style=both -Xlinker -z -Xlinker defs"
  1.2512 +        if test "x$DEBUG_LEVEL" == "xrelease"; then
  1.2513 +            # When building release libraries, tell the linker optimize them.
  1.2514 +            # Should this be supplied to the OSS linker as well?
  1.2515 +            LDFLAGS="$LDFLAGS -Xlinker -O1"
  1.2516 +        fi
  1.2517 +    fi
  1.2518 +
  1.2519 +    LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \
  1.2520 +                    -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \
  1.2521 +  	            -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}" 
  1.2522 +    LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava"
  1.2523 +    if test "x$COMPILER_NAME" = xossc; then
  1.2524 +        LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
  1.2525 +    fi
  1.2526 +
  1.2527 +    # Only the jli library is explicitly linked when the launchers are built.
  1.2528 +    # The libjvm is then dynamically loaded/linked by the launcher.
  1.2529 +    LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli"
  1.2530 +    LDFLAGS_JDKEXE_SUFFIX="-ljli"
  1.2531 +fi
  1.2532 +
  1.2533 +                
  1.2534 +AC_SUBST(CFLAGS_JDKLIB)
  1.2535 +AC_SUBST(CFLAGS_JDKEXE)
  1.2536 +
  1.2537 +AC_SUBST(CXXFLAGS_JDKLIB)
  1.2538 +AC_SUBST(CXXFLAGS_JDKEXE)
  1.2539 +
  1.2540 +AC_SUBST(LDFLAGS_JDKLIB)
  1.2541 +AC_SUBST(LDFLAGS_JDKEXE)
  1.2542 +AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
  1.2543 +AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
  1.2544 +
  1.2545 +
  1.2546 +###############################################################################
  1.2547 +#
  1.2548 +# statically link libstdc++ before C++ ABI is stablized on Linux unless 
  1.2549 +# dynamic build is configured on command line.
  1.2550 +#
  1.2551 +AC_ARG_ENABLE([static-link-stdc++], [AS_HELP_STRING([--disable-static-link-stdc++],
  1.2552 +	[disable static linking of the C++ runtime on Linux @<:@enabled@:>@])],,
  1.2553 +	[
  1.2554 +		enable_static_link_stdc__=yes
  1.2555 +    ])
  1.2556 +
  1.2557 +if test "x$HOST_OS" = xlinux; then
  1.2558 +    # Test if -lstdc++ works.
  1.2559 +    AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
  1.2560 +    AC_LANG_PUSH(C++)
  1.2561 +    OLD_CXXFLAGS="$CXXFLAGS"
  1.2562 +    CXXFLAGS="$CXXFLAGS -lstdc++"
  1.2563 +    AC_TRY_LINK([], [return 0;],
  1.2564 +            has_dynamic_libstdcxx=yes,
  1.2565 +            has_dynamic_libstdcxx=no)
  1.2566 +    CXXFLAGS="$OLD_CXXFLAGS"
  1.2567 +    AC_LANG_POP(C++)
  1.2568 +    AC_MSG_RESULT([$has_dynamic_libstdcxx])
  1.2569 +
  1.2570 +    # Test if stdc++ can be linked statically.
  1.2571 +    AC_MSG_CHECKING([if static link of stdc++ is possible])
  1.2572 +    STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
  1.2573 +    AC_LANG_PUSH(C++)
  1.2574 +    OLD_LIBS="$LIBS"
  1.2575 +    OLD_CXX="$CXX"
  1.2576 +    LIBS="$STATIC_STDCXX_FLAGS"
  1.2577 +    CXX="$CC"                       
  1.2578 +    AC_TRY_LINK([], [return 0;],
  1.2579 +            has_static_libstdcxx=yes,
  1.2580 +            has_static_libstdcxx=no)
  1.2581 +    LIBS="$OLD_LIBS"
  1.2582 +    CXX="$OLD_CXX"
  1.2583 +    AC_LANG_POP(C++)
  1.2584 +    AC_MSG_RESULT([$has_static_libstdcxx])
  1.2585 +
  1.2586 +    if test "x$has_static_libcxx" = xno && test "x$has_dynamic_libcxx" = xno; then
  1.2587 +        AC_ERROR([I cannot link to stdc++! Neither dynamically nor statically.])
  1.2588 +    fi
  1.2589 +
  1.2590 +    if test "x$enable_static_link_stdc__" = xyes && test "x$has_static_libstdcxx" = xno; then
  1.2591 +        AC_MSG_NOTICE([Static linking of libstdc++ was not possible reverting to dynamic linking.])
  1.2592 +        enable_static_link_stdc__=no
  1.2593 +    fi
  1.2594 +
  1.2595 +    if test "x$enable_static_link_stdc__" = xno && test "x$has_dynamic_libstdcxx" = xno; then
  1.2596 +        AC_MSG_NOTICE([Dynamic linking of libstdc++ was not possible reverting to static linking.])
  1.2597 +        enable_static_link_stdc__=yes
  1.2598 +    fi
  1.2599 +
  1.2600 +    AC_MSG_CHECKING([how to link with libstdc++])
  1.2601 +    if test "x$enable_static_link_stdc__" = xyes; then
  1.2602 +        LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
  1.2603 +        LDCXX="$CC"
  1.2604 +        AC_MSG_RESULT([static])
  1.2605 +    else
  1.2606 +        LIBCXX="$LIBCXX -lstdc++"
  1.2607 +        LDCXX="$CXX"
  1.2608 +        AC_MSG_RESULT([dynamic])
  1.2609 +    fi
  1.2610 +fi
  1.2611 +
  1.2612 +###############################################################################
  1.2613 +#
  1.2614 +# Could someone enlighten this configure script with a comment about libCrun?
  1.2615 +# The LEGACY_HOST_CPU3 is the setting for ISA_DIR.
  1.2616 +#
  1.2617 +if test "x$HOST_OS" = xsolaris; then
  1.2618 +    LIBCXX="$LIBCXX /usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1"
  1.2619 +fi
  1.2620 +
  1.2621 +AC_SUBST(LIBCXX)
  1.2622 +
  1.2623 +###############################################################################
  1.2624 +#
  1.2625 +# Misc
  1.2626 +#
  1.2627 +
  1.2628 +# Control wether Hotspot runs Queens test after build.
  1.2629 +AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
  1.2630 +	[enable running of Queens test after Hotspot build (not yet available) @<:@disabled@:>@])],,
  1.2631 +    [enable_hotspot_test_in_build=no])
  1.2632 +if test "x$enable_hotspot_test_in_build" = "xyes"; then
  1.2633 +    TEST_IN_BUILD=true
  1.2634 +else
  1.2635 +    TEST_IN_BUILD=false
  1.2636 +fi
  1.2637 +AC_SUBST(TEST_IN_BUILD)
  1.2638 +
  1.2639 +###############################################################################
  1.2640 +#
  1.2641 +# A helpful message at the end of the configure run.
  1.2642 +#
  1.2643 +if test "x$CCACHE_FOUND" = x && test "x$GCC" = xyes; then
  1.2644 +    help_on_build_dependency ccache
  1.2645 +    
  1.2646 +    printf "\nTip of the day:\nYou should really install ccache version 3.1.4 or newer.\n"
  1.2647 +    printf "It gives a tremendous speedup for C++ recompilations with precompiled headers!\n"
  1.2648 +fi    
  1.2649 +
  1.2650 +if test "x$CCACHE_FOUND" != x && test "x$HAS_GOOD_CCACHE" = x; then
  1.2651 +    printf "You have a ccache installed, but it is a version prior to 3.1.4. Try upgrading.\n"
  1.2652 +fi
  1.2653 +
  1.2654 +AC_OUTPUT

mercurial