1 # 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 AC_PREREQ([2.61]) 27 AC_INIT(openjdk, version-0.1, build-infra-dev@openjdk.java.net) 28 29 AC_CONFIG_AUX_DIR([build-aux]) 30 31 m4_include([build-aux/pkg.m4]) 32 m4_include([builddeps.m4]) 33 m4_include([platform.m4]) 34 m4_include([cores.m4]) 35 m4_include([help.m4]) 36 37 # Save the command line. Do this very early, before it is lost by calling autoconf macros. 38 CONFIGURE_COMMAND_LINE="$@" 39 AC_SUBST(CONFIGURE_COMMAND_LINE) 40 41 # Locate the directory of this script. 42 SCRIPT="[$]0" 43 REMOVE_SYMBOLIC_LINKS(SCRIPT) 44 AUTOCONF_DIR=`dirname [$]0` 45 46 # Start with tools that do not need have cross compilation support 47 # and can be expected to be found in the default PATH. These tools are 48 # used by configure. Nor are these tools expected to be found in the 49 # devkit from the builddeps server either, since they are 50 # needed to download the devkit. 51 AC_PROG_AWK 52 CHECK_NONEMPTY(AWK) 53 AC_PATH_PROG(CAT, cat) 54 CHECK_NONEMPTY(CAT) 55 AC_PATH_PROG(CHMOD, chmod) 56 CHECK_NONEMPTY(CHMOD) 57 AC_PATH_PROG(CP, cp) 58 CHECK_NONEMPTY(CP) 59 AC_PATH_PROG(CPIO, cpio) 60 CHECK_NONEMPTY(CPIO) 61 AC_PATH_PROG(CUT, cut) 62 CHECK_NONEMPTY(CUT) 63 AC_PATH_PROG(DATE, date) 64 CHECK_NONEMPTY(DATE) 65 AC_PATH_PROG(DF, df) 66 CHECK_NONEMPTY(DF) 67 AC_PATH_PROG(DIFF, diff) 68 CHECK_NONEMPTY(DIFF) 69 # Warning echo is really, really unportable!!!!! Different 70 # behaviour in bash and dash and in a lot of other shells! 71 # Use printf for serious work! 72 AC_PATH_PROG(ECHO, echo) 73 CHECK_NONEMPTY(ECHO) 74 AC_PROG_EGREP 75 CHECK_NONEMPTY(EGREP) 76 AC_PROG_FGREP 77 CHECK_NONEMPTY(FGREP) 78 79 AC_PATH_PROG(FIND, find) 80 CHECK_NONEMPTY(FIND) 81 CHECK_FIND_DELETE 82 AC_SUBST(FIND_DELETE) 83 84 AC_PROG_GREP 85 CHECK_NONEMPTY(GREP) 86 AC_PATH_PROG(HEAD, head) 87 CHECK_NONEMPTY(HEAD) 88 AC_PATH_PROG(LN, ln) 89 CHECK_NONEMPTY(LN) 90 AC_PATH_PROG(LS, ls) 91 CHECK_NONEMPTY(LS) 92 AC_PATH_PROGS(MAKE, [gmake make]) 93 CHECK_NONEMPTY(MAKE) 94 MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'` 95 if test "x$MAKE_VERSION" = x; then 96 AC_ERROR([You must use GNU make 3.81 or newer! Please put it in the path.]) 97 fi 98 AC_PATH_PROG(MKDIR, mkdir) 99 CHECK_NONEMPTY(MKDIR) 100 AC_PATH_PROG(MV, mv) 101 CHECK_NONEMPTY(MV) 102 AC_PATH_PROGS(NAWK, [nawk gawk awk]) 103 CHECK_NONEMPTY(NAWK) 104 AC_PATH_PROG(PRINTF, printf) 105 CHECK_NONEMPTY(PRINTF) 106 AC_PATH_PROG(THEPWDCMD, pwd) 107 AC_PATH_PROG(RM, rm) 108 CHECK_NONEMPTY(RM) 109 RM="$RM -f" 110 AC_PROG_SED 111 CHECK_NONEMPTY(SED) 112 AC_PATH_PROG(SH, sh) 113 CHECK_NONEMPTY(SH) 114 AC_PATH_PROG(SORT, sort) 115 CHECK_NONEMPTY(SORT) 116 AC_PATH_PROG(TAR, tar) 117 CHECK_NONEMPTY(TAR) 118 AC_PATH_PROG(TAIL, tail) 119 CHECK_NONEMPTY(TAIL) 120 AC_PATH_PROG(TEE, tee) 121 CHECK_NONEMPTY(TEE) 122 AC_PATH_PROG(TR, tr) 123 CHECK_NONEMPTY(TR) 124 AC_PATH_PROG(TOUCH, touch) 125 CHECK_NONEMPTY(TOUCH) 126 AC_PATH_PROG(WC, wc) 127 CHECK_NONEMPTY(WC) 128 AC_PATH_PROG(XARGS, xargs) 129 CHECK_NONEMPTY(XARGS) 130 AC_PATH_PROG(ZIP, zip) 131 CHECK_NONEMPTY(ZIP) 132 AC_PATH_PROG(UNZIP, unzip) 133 CHECK_NONEMPTY(UNZIP) 134 AC_PATH_PROG(LDD, ldd) 135 if test "x$LDD" = "x"; then 136 # List shared lib dependencies is used for 137 # debug output and checking for forbidden dependencies. 138 # We can build without it. 139 LDD="true" 140 fi 141 AC_PATH_PROG(OTOOL, otool) 142 if test "x$OTOOL" = "x"; then 143 OTOOL="true" 144 fi 145 AC_PATH_PROG(READELF, readelf) 146 AC_PATH_PROG(EXPR, expr) 147 CHECK_NONEMPTY(EXPR) 148 AC_PATH_PROG(FILE, file) 149 CHECK_NONEMPTY(FILE) 150 # Figure out the build and host system. 151 AC_CANONICAL_BUILD 152 AC_CANONICAL_HOST 153 154 AC_ARG_WITH(data-model, [AS_HELP_STRING([--with-data-model], 155 [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-data-model=32 @<:@guessed@:>@])]) 156 157 if test "x$with_data_model" != x && \ 158 test "x$with_data_model" != x32 && \ 159 test "x$with_data_model" != x64 ; then 160 AC_ERROR([The data model can only be 32 or 64!]) 161 fi 162 # Translate the standard cpu-vendor-kernel-os quadruplets into 163 # the new HOST_.... and BUILD_... and the legacy names used by 164 # the openjdk build. 165 # It uses $host_os $host_cpu $build_os $build_cpu and $with_data_model 166 EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS 167 # Now the following vars are defined. 168 # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows 169 # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince 170 # HOST_OS_API=posix,winapi 171 # 172 # HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64 173 # HOST_CPU_ARCH=x86,sparc,pcc,arm 174 # HOST_CPU_BITS=32,64 175 # HOST_CPU_ENDIAN=big,little 176 # 177 # There is also a: 178 # LEGACY_HOST_CPU1=i586,amd64,.... # used to set the old var ARCH 179 # LEGACY_HOST_CPU2=i386,amd64,.... # used to set the old var LIBARCH 180 # LEGACY_HOST_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris 181 # There was also a BUILDARCH that had i486,amd64,... but we do not use that 182 # in the new build. 183 # LEGACY_HOST_OS_API=solaris,windows # used to select source roots 184 185 DATE_WHEN_CONFIGURED=`LANG=C date` 186 AC_SUBST(DATE_WHEN_CONFIGURED) 187 188 # How many cores do we have on this build system? 189 AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores], 190 [number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])]) 191 if test "x$with_num_cores" = x; then 192 # The number of cores were not specified, try to probe them. 193 CHECK_CORES 194 else 195 NUM_CORES=$with_num_cores 196 CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2` 197 fi 198 AC_SUBST(NUM_CORES) 199 AC_SUBST(CONCURRENT_BUILD_JOBS) 200 201 # How many cores do we have on this build system? 202 AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size], 203 [memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])]) 204 if test "x$with_memory_size" = x; then 205 # The memory size was not specified, try to probe it. 206 CHECK_MEMORY_SIZE 207 else 208 MEMORY_SIZE=$with_memory_size 209 fi 210 AC_SUBST(MEMORY_SIZE) 211 212 # Where is the source? It is located two levels above the configure script. 213 CURDIR="$PWD" 214 cd "$AUTOCONF_DIR/../.." 215 SRC_ROOT="`pwd`" 216 AC_SUBST(SRC_ROOT) 217 cd "$CURDIR" 218 219 # For cygwin we need cygpath first, since it is used everywhere. 220 AC_PATH_PROG(CYGPATH, cygpath) 221 PATH_SEP=":" 222 if test "x$BUILD_OS" = "xwindows"; then 223 if test "x$CYGPATH" = x; then 224 AC_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) 225 fi 226 PATH_SEP=";" 227 fi 228 AC_SUBST(PATH_SEP) 229 230 SPACESAFE(SRC_ROOT,[the path to the source root]) 231 SPACESAFE(CURDIR,[the path to the current directory]) 232 233 if test "x$BUILD_OS" = "xsolaris"; then 234 # Also search in /usr/ccs/bin for utilities like ar and as. 235 PATH="/usr/ccs/bin:$PATH" 236 fi 237 238 ############################################################################### 239 # 240 # OpenJDK or closed 241 # 242 AC_ARG_ENABLE([openjdk], [AS_HELP_STRING([--enable-openjdk], 243 [build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,) 244 245 if test "x$enable_openjdk" = "xyes"; then 246 OPENJDK=true 247 elif test "x$enable_openjdk" = "xno"; then 248 OPENJDK=false 249 elif test -d "$SRC_ROOT/jdk/src/closed"; then 250 OPENJDK=false 251 else 252 OPENJDK=true 253 fi 254 255 if test "x$OPENJDK" = "xtrue"; then 256 SET_OPENJDK=OPENJDK=true 257 fi 258 259 AC_SUBST(SET_OPENJDK) 260 261 ############################################################################### 262 # 263 # JIGSAW or not. The JIGSAW variable is used during the intermediate 264 # stage when we are building both the old style JDK and the new style modularized JDK. 265 # When the modularized JDK is finalized, this option will go away. 266 # 267 AC_ARG_ENABLE([jigsaw], [AS_HELP_STRING([--enable-jigsaw], 268 [build Jigsaw images (not yet available) @<:@disabled@:>@])],,) 269 270 if test "x$enable_jigsaw" = "xyes"; then 271 JIGSAW=true 272 else 273 JIGSAW=false 274 fi 275 AC_SUBST(JIGSAW) 276 277 ############################################################################### 278 # 279 # Check which variant of the JDK that we want to build. 280 # Currently we have: 281 # normal: standard edition 282 # embedded: cut down to a smaller footprint 283 # 284 # Effectively the JDK variant gives a name to a specific set of 285 # modules to compile into the JDK. In the future, these modules 286 # might even be Jigsaw modules. 287 # 288 AC_MSG_CHECKING([which variant of the JDK to build]) 289 AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant], 290 [JDK variant to build (normal, embedded) @<:@normal@:>@])]) 291 292 if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then 293 JAVASE_EMBEDDED="" 294 MINIMIZE_RAM_USAGE="" 295 JDK_VARIANT="normal" 296 elif test "x$with_jdk_variant" = xembedded; then 297 JAVASE_EMBEDDED="JAVASE_EMBEDDED:=true" 298 MINIMIZE_RAM_USAGE="MINIMIZE_RAM_USAGE:=true" 299 JDK_VARIANT="embedded" 300 else 301 AC_ERROR([The available JDK variants are: normal, embedded]) 302 fi 303 304 AC_SUBST(JAVASE_EMBEDDED) 305 AC_SUBST(MINIMIZE_RAM_USAGE) 306 AC_SUBST(JDK_VARIANT) 307 308 AC_MSG_RESULT([$JDK_VARIANT]) 309 310 ############################################################################### 311 # 312 # Should we build a JDK/JVM with head support (ie a graphical ui)? 313 # We always build headless support. 314 # 315 AC_MSG_CHECKING([headful support]) 316 AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful], 317 [build headful support (graphical UI support) @<:@enabled@:>@])], 318 [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes]) 319 320 SUPPORT_HEADLESS=yes 321 BUILD_HEADLESS="BUILD_HEADLESS:=true" 322 323 if test "x$SUPPORT_HEADFUL" = xyes; then 324 # We are building both headful and headless. 325 BUILD_HEADLESS_ONLY="" 326 headful_msg="inlude support for both headful and headless" 327 fi 328 329 if test "x$SUPPORT_HEADFUL" = xno; then 330 # Thus we are building headless only. 331 BUILD_HEADLESS="BUILD_HEADLESS:=true" 332 BUILD_HEADLESS_ONLY="BUILD_HEADLESS_ONLY:=true" 333 headful_msg="headless only" 334 fi 335 336 AC_MSG_RESULT([$headful_msg]) 337 338 AC_SUBST(SUPPORT_HEADLESS) 339 AC_SUBST(SUPPORT_HEADFUL) 340 AC_SUBST(BUILD_HEADLESS) 341 AC_SUBST(BUILD_HEADLESS_ONLY) 342 343 ############################################################################### 344 # 345 # Check which variants of the JVM that we want to build. 346 # Currently we have: 347 # server: normal interpreter and a tiered C1/C2 compiler 348 # client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms) 349 # kernel: kernel footprint JVM that passes the TCK without major performance problems, 350 # ie normal interpreter and C1, only the serial GC, kernel jvmti etc 351 # zero: no machine code interpreter, no compiler 352 # zeroshark: zero interpreter and shark/llvm compiler backend 353 AC_MSG_CHECKING([which variants of the JVM that should be built]) 354 AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants], 355 [JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])]) 356 357 if test "x$with_jvm_variants" = x; then 358 if test "x$JDK_VARIANT" = xembedded; then 359 with_jvm_variants="kernel" 360 elif test "x$HOST_CPU_BITS" = x64; then 361 with_jvm_variants="server" 362 else 363 # Yes, on 32-bit machines, the same source (almost) is compiled twice 364 # to generate two libjvm.so files. Fun, fun. 365 with_jvm_variants="client,server" 366 fi 367 fi 368 369 JVM_VARIANTS=",$with_jvm_variants," 370 TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` 371 372 if test "x$TEST_VARIANTS" != "x,"; then 373 AC_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark]) 374 fi 375 AC_MSG_RESULT([$with_jvm_variants]) 376 377 JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` 378 JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 379 JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'` 380 JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` 381 JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` 382 383 if test "x$JVM_VARIANT_CLIENT" = xtrue; then 384 if test "x$HOST_CPU_BITS" = x64; then 385 AC_ERROR([You cannot build a client JVM for a 64-bit machine.]) 386 fi 387 fi 388 if test "x$JVM_VARIANT_KERNEL" = xtrue; then 389 if test "x$HOST_CPU_BITS" = x64; then 390 AC_ERROR([You cannot build a kernel JVM for a 64-bit machine.]) 391 fi 392 fi 393 394 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/'` 395 # Replace the commas with AND for use in the build directory name. 396 ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'` 397 if test "x$COUNT_VARIANTS" != "x,1"; then 398 AC_MSG_NOTICE([NOTE! Longer build time since we are building more than one version of the libjvm! $with_jvm_variants]) 399 fi 400 401 AC_SUBST(JVM_VARIANTS) 402 AC_SUBST(JVM_VARIANT_SERVER) 403 AC_SUBST(JVM_VARIANT_CLIENT) 404 AC_SUBST(JVM_VARIANT_KERNEL) 405 AC_SUBST(JVM_VARIANT_ZERO) 406 AC_SUBST(JVM_VARIANT_ZEROSHARK) 407 408 ############################################################################### 409 # 410 # Set the debug level 411 # release: no debug information, all optimizations, no asserts. 412 # fastdebug: debug information (-g), all optimizations, all asserts 413 # slowdebug: debug information (-g), no optimizations, all asserts 414 # 415 DEBUG_LEVEL="release" 416 AC_MSG_CHECKING([which debug level to use]) 417 AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], 418 [set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])], 419 [ 420 ENABLE_DEBUG="${enableval}" 421 DEBUG_LEVEL="fastdebug" 422 ], [ENABLE_DEBUG="no"]) 423 424 AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level], 425 [set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])], 426 [ 427 DEBUG_LEVEL="${withval}" 428 if test "x$ENABLE_DEBUG" = xyes; then 429 AC_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.]) 430 fi 431 ]) 432 AC_MSG_RESULT([$DEBUG_LEVEL]) 433 434 if test "x$DEBUG_LEVEL" != xrelease && \ 435 test "x$DEBUG_LEVEL" != xfastdebug && \ 436 test "x$DEBUG_LEVEL" != xslowdebug; then 437 AC_ERROR([Allowed debug levels are: release, fastdebug and slowdebug]) 438 fi 439 440 case $DEBUG_LEVEL in 441 release ) 442 VARIANT="OPT" 443 FASTDEBUG="false" 444 DEBUG_CLASSFILES="false" 445 BUILD_VARIANT_RELEASE="" 446 ;; 447 fastdebug ) 448 VARIANT="DBG" 449 FASTDEBUG="true" 450 DEBUG_CLASSFILES="true" 451 BUILD_VARIANT_RELEASE="-fastdebug" 452 ;; 453 slowdebug ) 454 VARIANT="DBG" 455 FASTDEBUG="false" 456 DEBUG_CLASSFILES="true" 457 BUILD_VARIANT_RELEASE="-debug" 458 ;; 459 esac 460 461 AC_SUBST(DEBUG_LEVEL) 462 AC_SUBST(VARIANT) 463 AC_SUBST(FASTDEBUG) 464 AC_SUBST(DEBUG_CLASSFILES) 465 AC_SUBST(BUILD_VARIANT_RELEASE) 466 467 # Source the version numbers 468 . $AUTOCONF_DIR/version.numbers 469 if test "x$OPENJDK" = "xfalse"; then 470 . $AUTOCONF_DIR/closed.version.numbers 471 fi 472 # Now set the JDK version, milestone, build number etc. 473 AC_SUBST(JDK_MAJOR_VERSION) 474 AC_SUBST(JDK_MINOR_VERSION) 475 AC_SUBST(JDK_MICRO_VERSION) 476 AC_SUBST(JDK_UPDATE_VERSION) 477 AC_SUBST(JDK_BUILD_NUMBER) 478 AC_SUBST(MILESTONE) 479 AC_SUBST(LAUNCHER_NAME) 480 AC_SUBST(PRODUCT_NAME) 481 AC_SUBST(PRODUCT_SUFFIX) 482 AC_SUBST(JDK_RC_PLATFORM_NAME) 483 AC_SUBST(COMPANY_NAME) 484 485 COPYRIGHT_YEAR=`date +'%Y'` 486 AC_SUBST(COPYRIGHT_YEAR) 487 488 RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX" 489 AC_SUBST(RUNTIME_NAME) 490 491 if test "x$JDK_UPDATE_VERSION" != x; then 492 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}" 493 else 494 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}" 495 fi 496 AC_SUBST(JDK_VERSION) 497 498 if test "x$MILESTONE" != x; then 499 RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}" 500 else 501 RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}" 502 fi 503 AC_SUBST(RELEASE) 504 505 if test "x$JDK_BUILD_NUMBER" != x; then 506 FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}" 507 else 508 JDK_BUILD_NUMBER=b00 509 BUILD_DATE=`date '+%Y_%m_%d_%H_%M'` 510 # Avoid [:alnum:] since it depends on the locale. 511 CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'` 512 USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'` 513 FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}" 514 fi 515 AC_SUBST(FULL_VERSION) 516 COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'` 517 AC_SUBST(COOKED_BUILD_NUMBER) 518 519 # Test from where we are running configure, in or outside of src root. 520 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 521 # We are running configure from the src root. 522 # Create a default ./build/host-variant-debuglevel output root. 523 OUTPUT_ROOT="$SRC_ROOT/build/${HOST_OS}-${HOST_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" 524 mkdir -p "$OUTPUT_ROOT" 525 if test ! -d "$OUTPUT_ROOT"; then 526 AC_ERROR([Could not create build directory $OUTPUT_ROOT]) 527 fi 528 else 529 # We are running configure from outside of the src dir. 530 # Then use the current directory as output dir! 531 OUTPUT_ROOT="$CURDIR" 532 fi 533 534 SPACESAFE(OUTPUT_ROOT,[the path to the output root]) 535 536 # Save the arguments given to us 537 echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments 538 539 # Check if the VS env variables were setup prior to running configure. 540 # If not, then find vcvarsall.bat and run it automatically, and integrate 541 # the set env variables into the spec file. 542 SETUPDEVENV="# No special vars" 543 if test "x$BUILD_OS" = "xwindows"; then 544 # If vcvarsall.bat has been run, then VCINSTALLDIR is set. 545 if test "x$VCINSTALLDIR" != x; then 546 # No further setup is needed. The build will happen from this kind 547 # of shell. 548 SETUPDEVENV="# This spec file expects that you are running bash from within a VS command prompt." 549 # Make sure to remind you, if you forget to run make from a cygwin bash shell 550 # that is spawned "bash -l" from a VS command prompt. 551 CHECK_FOR_VCINSTALLDIR=yes 552 AC_MSG_CHECKING([if you are running from within a VS command prompt]) 553 AC_MSG_RESULT([yes]) 554 else 555 # Ah, we have not yet run vcvarsall.bat/vsvars32.bat/vsvars64.bat. Lets do that. First find it. 556 if test "x$VS100COMNTOOLS" != x; then 557 VARSBAT=`find "$VS100COMNTOOLS/../.." -name vcvarsall.bat` 558 SEARCH_ROOT="$VS100COMNTOOLS" 559 else 560 VARSBAT=`find "$PROGRAMFILES" -name vcvarsall.bat` 561 SEARCH_ROOT="$PROGRAMFILES" 562 fi 563 VCPATH=`dirname "$VARSBAT"` 564 VCPATH=`cygpath -w "$VCPATH"` 565 if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then 566 AC_MSG_CHECKING([if we can find the VS installation]) 567 AC_MSG_RESULT([no]) 568 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.]) 569 fi 570 case "$LEGACY_HOST_CPU1" in 571 i?86) 572 VARSBAT_ARCH=x86 573 ;; 574 *) 575 VARSBAT_ARCH=$LEGACY_HOST_CPU1 576 ;; 577 esac 578 # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat 579 cd $OUTPUT_ROOT 580 $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH" 581 cd $CURDIR 582 if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then 583 AC_MSG_CHECKING([if we can extract the needed env variables]) 584 AC_MSG_RESULT([no]) 585 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.]) 586 fi 587 # Now set all paths and other env variables. This will allow the rest of 588 # the configure script to find and run the compiler in the proper way. 589 . $OUTPUT_ROOT/localdevenv.sh 590 AC_MSG_CHECKING([if we can find the VS installation]) 591 if test "x$VCINSTALLDIR" != x; then 592 AC_MSG_RESULT([$VCINSTALLDIR]) 593 else 594 AC_MSG_RESULT([no]) 595 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.]) 596 fi 597 CHECK_FOR_VCINSTALLDIR=no 598 SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk" 599 600 AC_MSG_CHECKING([for msvcr100.dll]) 601 AC_ARG_WITH(msvcr100dll, [AS_HELP_STRING([--with-msvcr100dll], 602 [copy this msvcr100.dll into the built JDK])]) 603 if test "x$with_msvcr100dll" != x; then 604 MSVCR100DLL="$with_msvcr100dll" 605 else 606 if test "x$HOST_CPU_BITS" = x64; then 607 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x64 | head --lines 1` 608 else 609 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1` 610 if test "x$MSVCR100DLL" = x; then 611 MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | head --lines 1` 612 fi 613 fi 614 fi 615 if test "x$MSVCR100DLL" = x; then 616 AC_MSG_RESULT([no]) 617 AC_ERROR([Could not find msvcr100.dll !]) 618 fi 619 AC_MSG_RESULT([$MSVCR100DLL]) 620 SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll]) 621 fi 622 fi 623 AC_SUBST(SETUPDEVENV) 624 AC_SUBST(CHECK_FOR_VCINSTALLDIR) 625 AC_SUBST(MSVCR100DLL) 626 627 # Most of the probed defines are put into config.h 628 AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in]) 629 # The spec.gmk file contains all variables for the make system. 630 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in]) 631 # The generated Makefile knows where the spec.gmk is and where the source is. 632 # You can run make from the OUTPUT_ROOT. If you have only 633 # one configured host, then you can also run make from the SRC_ROOT, 634 # since it will go look for a single spec.gmk file. Or perhaps it 635 # should instead make all configured hosts it can find? 636 AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in]) 637 638 AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk) 639 AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT) 640 641 # Where are the sources. Any of these can be overridden 642 # using --with-override-corba and the likes. 643 LANGTOOLS_TOPDIR="$SRC_ROOT/langtools" 644 CORBA_TOPDIR="$SRC_ROOT/corba" 645 JAXP_TOPDIR="$SRC_ROOT/jaxp" 646 JAXWS_TOPDIR="$SRC_ROOT/jaxws" 647 HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" 648 JDK_TOPDIR="$SRC_ROOT/jdk" 649 AC_SUBST(LANGTOOLS_TOPDIR) 650 AC_SUBST(CORBA_TOPDIR) 651 AC_SUBST(JAXP_TOPDIR) 652 AC_SUBST(JAXWS_TOPDIR) 653 AC_SUBST(HOTSPOT_TOPDIR) 654 AC_SUBST(JDK_TOPDIR) 655 656 # Check if pkg-config is available. 657 PKG_PROG_PKG_CONFIG 658 659 AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf], 660 [use this configuration file for the builddeps])]) 661 662 AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server], 663 [download and use build dependencies from this server url, e.g. --with-builddeps-server=ftp://example.com/dir])]) 664 665 AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir], 666 [store downloaded build dependencies here @<:@d/localhome/builddeps@:>@])], 667 [], 668 [with_builddeps_dir=/localhome/builddeps]) 669 670 AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group], 671 [chgrp the downloaded build dependencies to this group])]) 672 673 AC_ARG_ENABLE([list-builddeps], [AS_HELP_STRING([--enable-list-builddeps], 674 [list all build dependencies known to the configure script])], 675 [LIST_BUILDDEPS="${enableval}"], [LIST_BUILDDEPS='no']) 676 677 if test "x$LIST_BUILDDEPS" = xyes; then 678 echo 679 echo List of build dependencies known to the configure script, 680 echo that can be used in builddeps.conf files: 681 cat $SRC_ROOT/configure.ac | grep BDEPS_CHECK_MODUL | grep -v configure.ac | cut -f 2 -d ',' | tr -d ' ' | sort 682 echo 683 exit 1 684 fi 685 686 # If builddeps server or conf file is given. Setup buildeps usage. 687 BDEPS_SCAN_FOR_BUILDDEPS 688 689 ############################################################################### 690 # 691 # Configure the development tool paths and potential sysroot. 692 # 693 AC_LANG(C++) 694 DEVKIT= 695 SYS_ROOT=/ 696 AC_SUBST(SYS_ROOT) 697 698 # The option used to specify the target .o,.a or .so file. 699 # When compiling, how to specify the to be created object file. 700 CC_OUT_OPTION='-o$(SPACE)' 701 # When linking, how to specify the to be created executable. 702 EXE_OUT_OPTION='-o$(SPACE)' 703 # When linking, how to specify the to be created dynamically linkable library. 704 LD_OUT_OPTION='-o$(SPACE)' 705 # When archiving, how to specify the to be create static archive for object files. 706 AR_OUT_OPTION='rcs$(SPACE)' 707 AC_SUBST(CC_OUT_OPTION) 708 AC_SUBST(EXE_OUT_OPTION) 709 AC_SUBST(LD_OUT_OPTION) 710 AC_SUBST(AR_OUT_OPTION) 711 712 # If --build AND --host is set, then the configure script will find any 713 # cross compilation tools in the PATH. Cross compilation tools 714 # follows the cross compilation standard where they are prefixed with ${host}. 715 # For example the binary i686-sun-solaris2.10-gcc 716 # will cross compile for i686-sun-solaris2.10 717 # If neither of build and host is not set, then build=host and the 718 # default compiler found in the path will be used. 719 # Setting only --host, does not seem to be really supported. 720 # Please set both --build and --host if you want to cross compile. 721 722 DEFINE_CROSS_COMPILE_ARCH="" 723 HOSTCC="" 724 HOSTCXX="" 725 AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) 726 AC_SUBST(HOST_CC) 727 AC_SUBST(HOST_CXX) 728 AC_MSG_CHECKING([if this is a cross compile]) 729 if test "x$build_var" != "x$host_var"; then 730 AC_MSG_RESULT([yes, from $build_var to $host_var]) 731 # We have detected a cross compile! 732 DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$LEGACY_HOST_CPU1" 733 # Now we to find a C/C++ compiler that can build executables for the build 734 # platform. We can't use the AC_PROG_CC macro, since it can only be used 735 # once. 736 AC_PATH_PROGS(HOSTCC, [cl cc gcc]) 737 WHICHCMD(HOSTCC) 738 AC_PATH_PROGS(HOSTCXX, [cl CC g++]) 739 WHICHCMD(HOSTCXX) 740 # Building for the build platform should be easy. Therefore 741 # we do not need any linkers or assemblers etc. 742 else 743 AC_MSG_RESULT([no]) 744 fi 745 746 # You can force the sys-root if the sys-root encoded into the cross compiler tools 747 # is not correct. 748 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], 749 [pass this sys-root to the compilers and linker (useful if the sys-root encoded in 750 the cross compiler tools is incorrect)])]) 751 752 if test "x$with_sys_root" != x; then 753 SYS_ROOT=$with_sys_root 754 fi 755 756 # If a devkit is found on the builddeps server, then prepend its path to the 757 # PATH variable. If there are cross compilers available in the devkit, these 758 # will be found by AC_PROG_CC et al. 759 BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx, 760 [# Found devkit 761 PATH="$DEVKIT/bin:$PATH" 762 SYS_ROOT="$DEVKIT/${rewritten_host}/sys-root" 763 if test "x$x_includes" = "xNONE"; then 764 x_includes="$SYS_ROOT/usr/include/X11" 765 fi 766 if test "x$x_libraries" = "xNONE"; then 767 x_libraries="$SYS_ROOT/usr/lib" 768 fi 769 ], 770 []) 771 772 if test "x$SYS_ROOT" != "x/" ; then 773 CFLAGS="--sysroot=$SYS_ROOT $CFLAGS" 774 CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS" 775 OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 776 OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 777 CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS" 778 LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS" 779 fi 780 781 # Store the CFLAGS etal passed to the configure script. 782 ORG_CFLAGS="$CFLAGS" 783 ORG_CXXFLAGS="$CXXFLAGS" 784 ORG_OBJCFLAGS="$OBJCFLAGS" 785 786 # gcc is almost always present, but on Windows we 787 # prefer cl.exe and on Solaris we prefer CC. 788 # Thus test for them in this order. 789 AC_PROG_CC([cl cc gcc]) 790 if test "x$CC" = x; then 791 help_on_build_dependency devkit 792 AC_ERROR([Could not find a compiler. $HELP_MSG]) 793 fi 794 if test "x$CC" = xcc && test "x$BUILD_OS" = xmacosx; then 795 # Do not use cc on MacOSX use gcc instead. 796 CC="gcc" 797 fi 798 WHICHCMD(CC) 799 800 AC_PROG_CXX([cl CC g++]) 801 if test "x$CXX" = xCC && test "x$BUILD_OS" = xmacosx; then 802 # The found CC, even though it seems to be a g++ derivate, cannot compile 803 # c++ code. Override. 804 CXX="g++" 805 fi 806 WHICHCMD(CXX) 807 808 if test "x$CXX" = x || test "x$CC" = x; then 809 help_on_build_dependency devkit 810 AC_ERROR([Could not find the needed compilers! $HELP_MSG ]) 811 fi 812 813 if test "x$BUILD_OS" != xwindows; then 814 AC_PROG_OBJC 815 WHICHCMD(OBJC) 816 else 817 OBJC= 818 fi 819 820 # Restore the flags to the user specified values. 821 # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" 822 CFLAGS="$ORG_CFLAGS" 823 CXXFLAGS="$ORG_CXXFLAGS" 824 OBJCFLAGS="$ORG_OBJCFLAGS" 825 826 # If we are not cross compiling, use the same compilers for 827 # building the build platform executables. 828 if test "x$DEFINE_CROSS_COMPILE_ARCH" = x; then 829 HOSTCC="$CC" 830 HOSTCXX="$CXX" 831 fi 832 833 AC_CHECK_TOOL(LD, ld) 834 WHICHCMD(LD) 835 LDEXE="$LD" 836 LDCXX="$LD" 837 LDEXECXX="$LD" 838 # LDEXE is the linker to use, when creating executables. 839 AC_SUBST(LDEXE) 840 # Linking C++ libraries. 841 AC_SUBST(LDCXX) 842 # Linking C++ executables. 843 AC_SUBST(LDEXECXX) 844 845 AC_CHECK_TOOL(AR, ar) 846 WHICHCMD(AR) 847 if test "x$BUILD_OS" = xmacosx; then 848 ARFLAGS="-r" 849 else 850 ARFLAGS="" 851 fi 852 AC_SUBST(ARFLAGS) 853 854 COMPILER_NAME=gcc 855 COMPILER_TYPE=CC 856 AS_IF([test "x$BUILD_OS" = xwindows], [ 857 # For now, assume that we are always compiling using cl.exe. 858 CC_OUT_OPTION=-Fo 859 EXE_OUT_OPTION=-Fe 860 LD_OUT_OPTION=-out: 861 AR_OUT_OPTION=-out: 862 # On Windows, reject /usr/bin/link, which is a cygwin 863 # program for something completely different. 864 AC_CHECK_PROG([WINLD], [link],[link],,, [/usr/bin/link]) 865 # Since we must ignore the first found link, WINLD will contain 866 # the full path to the link.exe program. 867 WHICHCMD_SPACESAFE([WINLD]) 868 LD="$WINLD" 869 # However creating executables can only be done with cl.exe. 870 LDEXE="$CC" 871 LDCXX="$WINLD" 872 LDEXECXX="$CC" 873 874 AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt]) 875 WHICHCMD_SPACESAFE([MT]) 876 # The resource compiler 877 AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc]) 878 WHICHCMD_SPACESAFE([RC]) 879 880 RC_FLAGS="/l 0x409 /r" 881 AS_IF([test "x$VARIANT" = xOPT], [ 882 RC_FLAGS="$RC_FLAGS -d NDEBUG" 883 ]) 884 JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION 885 AS_IF([test "x$JDK_UPDATE_VERSION" = x], [ 886 JDK_UPDATE_VERSION_NOTNULL=0 887 ]) 888 RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\"" 889 RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\"" 890 RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\"" 891 RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\"" 892 RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\"" 893 RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\"" 894 RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\"" 895 896 # lib.exe is used to create static libraries. 897 AC_CHECK_PROG([WINAR], [lib],[lib],,,) 898 WHICHCMD_SPACESAFE([WINAR]) 899 AR="$WINAR" 900 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" 901 902 AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) 903 WHICHCMD_SPACESAFE([DUMPBIN]) 904 905 COMPILER_TYPE=CL 906 CFLAGS="$CFLAGS -nologo" 907 LDFLAGS="$LDFLAGS -nologo -dll -opt:ref -incremental:no " 908 if test "x$LEGACY_HOST_CPU1" = xi586; then 909 LDFLAGS="$LDFLAGS -safeseh" 910 fi 911 if test "x$DEBUG_LEVEL" != xrelease; then 912 LDFLAGS="$LDFLAGS -debug" 913 fi 914 ]) 915 AC_SUBST(RC_FLAGS) 916 AC_SUBST(COMPILER_TYPE) 917 918 AC_PROG_CPP 919 WHICHCMD(CPP) 920 921 AC_PROG_CXXCPP 922 WHICHCMD(CXXCPP) 923 924 # Find the right assembler. 925 if test "x$BUILD_OS" = xsolaris; then 926 AC_PATH_PROG(AS, as) 927 WHICHCMD(AS) 928 ASFLAGS=" " 929 else 930 AS="$CC -c" 931 ASFLAGS=" " 932 fi 933 AC_SUBST(AS) 934 AC_SUBST(ASFLAGS) 935 936 if test "x$HOST_CPU_BITS" = x32 && test "x$HOST_OS" = macosx; then 937 # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned. 938 # While waiting for a better solution, the current workaround is to use -mstackrealign. 939 CFLAGS="$CFLAGS -mstackrealign" 940 AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign]) 941 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], 942 [ 943 AC_MSG_RESULT([yes]) 944 ], 945 [ 946 AC_MSG_RESULT([no]) 947 AC_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.]) 948 ]) 949 fi 950 951 if test "x$BUILD_OS" = xsolaris; then 952 AC_PATH_PROG(NM, nm) 953 WHICHCMD(NM) 954 AC_PATH_PROG(STRIP, strip) 955 WHICHCMD(STRIP) 956 AC_PATH_PROG(MCS, mcs) 957 WHICHCMD(MCS) 958 else 959 AC_CHECK_TOOL(NM, nm) 960 WHICHCMD(NM) 961 AC_CHECK_TOOL(STRIP, strip) 962 WHICHCMD(STRIP) 963 fi 964 965 # When using cygwin, we need a wrapper binary that renames 966 # /cygdrive/c/ arguments into c:/ arguments and peeks into 967 # @files and rewrites these too! This wrapper binary is 968 # called uncygdrive.exe. 969 UNCYGDRIVE= 970 if test "x$BUILD_OS" = xwindows; then 971 AC_MSG_CHECKING([if uncygdrive can be created]) 972 UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c` 973 rm -f $OUTPUT_ROOT/uncygdrive* 974 UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe` 975 cd $OUTPUT_ROOT 976 $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1 977 cd $CURDIR 978 979 if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then 980 AC_MSG_RESULT([no]) 981 cat $OUTPUT_ROOT/uncygdrive1.log 982 AC_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe]) 983 fi 984 AC_MSG_RESULT([$UNCYGDRIVE]) 985 AC_MSG_CHECKING([if uncygdrive.exe works]) 986 cd $OUTPUT_ROOT 987 $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 988 cd $CURDIR 989 if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then 990 AC_MSG_RESULT([no]) 991 cat $OUTPUT_ROOT/uncygdrive2.log 992 AC_ERROR([Uncygdrive did not work!]) 993 fi 994 AC_MSG_RESULT([yes]) 995 rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj 996 fi 997 998 AC_SUBST(UNCYGDRIVE) 999 1000 TESTFOR_PROG_CCACHE 1001 1002 # Used on GNU/Linux systems, can be empty... 1003 #AC_PATH_PROG(ELFDUMP, elfdump) 1004 1005 # Setup default logging of stdout and stderr to build.log in the output root. 1006 BUILD_LOG='$(OUTPUT_ROOT)/build.log' 1007 if test -x $SRC_ROOT/common/bin/logger.sh ; then 1008 BUILD_LOG_WRAPPER='$(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)' 1009 else 1010 BUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)' 1011 fi 1012 AC_SUBST(BUILD_LOG) 1013 AC_SUBST(BUILD_LOG_WRAPPER) 1014 1015 ############################################################################### 1016 # 1017 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 1018 # (The JVM can use 32 or 64 bit Java pointers but that decision 1019 # is made at runtime.) 1020 # 1021 AC_CHECK_SIZEOF([int *], [1111]) 1022 if test "x$ac_cv_sizeof_int_p" = x0; then 1023 # The test failed, lets pick the assumed value. 1024 ARCH_DATA_MODEL=$HOST_CPU_BITS 1025 else 1026 ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p` 1027 fi 1028 1029 if test "x$ARCH_DATA_MODEL" = x64; then 1030 A_LP64="LP64:=" 1031 ADD_LP64="-D_LP64=1" 1032 fi 1033 AC_MSG_CHECKING([for host address size]) 1034 AC_MSG_RESULT([$ARCH_DATA_MODEL bits]) 1035 AC_SUBST(LP64,$A_LP64) 1036 AC_SUBST(ARCH_DATA_MODEL) 1037 1038 if test "x$ARCH_DATA_MODEL" != "x$HOST_CPU_BITS"; then 1039 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)]) 1040 fi 1041 1042 ############################################################################### 1043 # 1044 # Can the C/C++ compiler use precompiled headers? 1045 # 1046 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers], 1047 [use precompiled headers when compiling C++ @<:@enabled@:>@])], 1048 [ENABLE_PRECOMPH=${enable_precompiled-headers}], [ENABLE_PRECOMPH=yes]) 1049 1050 USE_PRECOMPILED_HEADER=1 1051 if test "x$ENABLE_PRECOMPH" = xno; then 1052 USE_PRECOMPILED_HEADER=0 1053 fi 1054 1055 if test "x$ENABLE_PRECOMPH" = xyes; then 1056 # Check that the compiler actually supports precomp headers. 1057 if test "x$GCC" = xyes; then 1058 AC_MSG_CHECKING([that precompiled headers work]) 1059 echo "int alfa();" > conftest.h 1060 $CXX -x c++-header conftest.h -o conftest.hpp.gch 1061 if test ! -f conftest.hpp.gch; then 1062 echo Precompiled header is not working! 1063 USE_PRECOMPILED_HEADER=0 1064 AC_MSG_RESULT([no]) 1065 else 1066 AC_MSG_RESULT([yes]) 1067 fi 1068 rm -f conftest.h 1069 fi 1070 fi 1071 1072 AC_SUBST(USE_PRECOMPILED_HEADER) 1073 1074 ############################################################################### 1075 # 1076 # How to compile shared libraries. 1077 # 1078 1079 if test "x$GCC" = xyes; then 1080 COMPILER_NAME=gcc 1081 PICFLAG="-fPIC" 1082 LIBRARY_PREFIX=lib 1083 SHARED_LIBRARY='lib$1.so' 1084 STATIC_LIBRARY='lib$1.a' 1085 SHARED_LIBRARY_FLAGS="-shared" 1086 SHARED_LIBRARY_SUFFIX='.so' 1087 STATIC_LIBRARY_SUFFIX='.a' 1088 OBJ_SUFFIX='.o' 1089 EXE_SUFFIX='' 1090 SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1' 1091 SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$(JDK_TOPDIR)/$1' 1092 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN/$1' 1093 LD="$CC" 1094 LDEXE="$CC" 1095 LDCXX="$CXX" 1096 LDEXECXX="$CXX" 1097 1098 # Linking is different on MacOSX 1099 if test "x$BUILD_OS" = xmacosx; then 1100 # Might change in the future to clang. 1101 COMPILER_NAME=gcc 1102 SHARED_LIBRARY='lib$1.dylib' 1103 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" 1104 SHARED_LIBRARY_SUFFIX='.dylib' 1105 EXE_SUFFIX='' 1106 SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1' 1107 SET_SHARED_LIBRARY_MAPFILE='' 1108 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' 1109 fi 1110 else 1111 if test "x$BUILD_OS" = xsolaris; then 1112 # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler 1113 COMPILER_NAME=ossc 1114 PICFLAG="-KPIC" 1115 LIBRARY_PREFIX=lib 1116 SHARED_LIBRARY='lib$1.so' 1117 STATIC_LIBRARY='lib$1.a' 1118 SHARED_LIBRARY_FLAGS="-G" 1119 SHARED_LIBRARY_SUFFIX='.so' 1120 STATIC_LIBRARY_SUFFIX='.a' 1121 OBJ_SUFFIX='.o' 1122 EXE_SUFFIX='' 1123 SET_SHARED_LIBRARY_NAME='' 1124 SET_SHARED_LIBRARY_MAPFILE='-M $(JDK_TOPDIR)/$1' 1125 SET_SHARED_LIBRARY_ORIGIN='-R \$$$$ORIGIN/$1' 1126 CFLAGS_JDKLIB_EXTRA='-xstrconst -D__solaris__' 1127 fi 1128 if test "x$BUILD_OS" = xwindows; then 1129 # If it is not gcc, then assume it is the MS Visual Studio compiler 1130 COMPILER_NAME=cl 1131 PICFLAG="" 1132 LIBRARY_PREFIX= 1133 SHARED_LIBRARY='$1.dll' 1134 STATIC_LIBRARY='$1.lib' 1135 SHARED_LIBRARY_FLAGS="-LD" 1136 SHARED_LIBRARY_SUFFIX='.dll' 1137 STATIC_LIBRARY_SUFFIX='.lib' 1138 OBJ_SUFFIX='.obj' 1139 EXE_SUFFIX='.exe' 1140 SET_SHARED_LIBRARY_NAME='' 1141 SET_SHARED_LIBRARY_MAPFILE='' 1142 SET_SHARED_LIBRARY_ORIGIN='' 1143 fi 1144 fi 1145 1146 AC_SUBST(OBJ_SUFFIX) 1147 AC_SUBST(SHARED_LIBRARY) 1148 AC_SUBST(STATIC_LIBRARY) 1149 AC_SUBST(LIBRARY_PREFIX) 1150 AC_SUBST(SHARED_LIBRARY_SUFFIX) 1151 AC_SUBST(STATIC_LIBRARY_SUFFIX) 1152 AC_SUBST(EXE_SUFFIX) 1153 AC_SUBST(SHARED_LIBRARY_FLAGS) 1154 AC_SUBST(SET_SHARED_LIBRARY_NAME) 1155 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) 1156 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) 1157 1158 # The (cross) compiler is now configured, we can now test capabilities 1159 # of the host platform. 1160 1161 ############################################################################### 1162 # 1163 # Is the host little of big endian? 1164 # 1165 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal"]) 1166 1167 if test "x$ENDIAN" = xuniversal; then 1168 AC_ERROR([It seems like someone needs to decide how we are to deal with universal binaries on the MacOSX?]) 1169 fi 1170 if test "x$ENDIAN" = xunknown; then 1171 ENDIAN="$HOST_CPU_ENDIAN" 1172 fi 1173 if test "x$ENDIAN" != "x$HOST_CPU_ENDIAN"; then 1174 AC_WARN([The tested endian in the host ($ENDIAN) differs from the endian expected to be found in the host ($HOST_CPU_ENDIAN)]) 1175 ENDIAN="$HOST_CPU_ENDIAN" 1176 fi 1177 AC_SUBST(ENDIAN) 1178 1179 ############################################################################### 1180 # 1181 # We need a Boot JDK to bootstrap the build. 1182 # 1183 BOOT_JDK_FOUND=no 1184 AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk], 1185 [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])]) 1186 1187 if test "x$with_boot_jdk" != x; then 1188 BOOT_JDK=$with_boot_jdk 1189 BOOT_JDK_FOUND=yes 1190 fi 1191 if test "x$BOOT_JDK_FOUND" = xno; then 1192 BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no]) 1193 fi 1194 1195 if test "x$BOOT_JDK_FOUND" = xno; then 1196 if test "x$JAVA_HOME" != x; then 1197 if test ! -d "$JAVA_HOME"; then 1198 AC_ERROR([Your JAVA_HOME points to a non-existing directory!]) 1199 fi 1200 # Aha, the user has set a JAVA_HOME 1201 # let us use that as the Boot JDK. 1202 BOOT_JDK=$JAVA_HOME 1203 BOOT_JDK_FOUND=yes 1204 # To be on the safe side, lets check that it is a JDK. 1205 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then 1206 JAVAC=$BOOT_JDK/bin/javac 1207 JAVA=$BOOT_JDK/bin/java 1208 BOOT_JDK_FOUND=yes 1209 else 1210 AC_ERROR([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK.]) 1211 fi 1212 fi 1213 fi 1214 1215 if test "x$BOOT_JDK_FOUND" = xno; then 1216 AC_PATH_PROG(JAVAC_CHECK, javac) 1217 AC_PATH_PROG(JAVA_CHECK, java) 1218 BINARY="$JAVAC_CHECK" 1219 if test "x$JAVAC_CHECK" = x; then 1220 BINARY="$JAVA_CHECK" 1221 fi 1222 if test "x$BINARY" != x; then 1223 # So there is a java(c) binary, it might be part of a JDK. 1224 # Lets find the JDK/JRE directory by following symbolic links. 1225 # Linux/GNU systems often have links from /usr/bin/java to 1226 # /etc/alternatives/java to the real JDK binary. 1227 WHICHCMD_SPACESAFE(BINARY,[path to javac]) 1228 REMOVE_SYMBOLIC_LINKS(BINARY) 1229 BOOT_JDK=`dirname $BINARY` 1230 BOOT_JDK=`cd $BOOT_JDK/..; pwd` 1231 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then 1232 JAVAC=$BOOT_JDK/bin/javac 1233 JAVA=$BOOT_JDK/bin/java 1234 BOOT_JDK_FOUND=yes 1235 fi 1236 fi 1237 fi 1238 1239 if test "x$BOOT_JDK_FOUND" = xno; then 1240 # Try the MacOSX way. 1241 if test -x /usr/libexec/java_home; then 1242 BOOT_JDK=`/usr/libexec/java_home` 1243 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then 1244 JAVAC=$BOOT_JDK/bin/javac 1245 JAVA=$BOOT_JDK/bin/java 1246 BOOT_JDK_FOUND=yes 1247 fi 1248 fi 1249 fi 1250 1251 if test "x$BOOT_JDK_FOUND" = xno; then 1252 AC_PATH_PROG(JAVA_CHECK, java) 1253 if test "x$JAVA_CHECK" != x; then 1254 # There is a java in the path. But apparently we have not found a javac 1255 # in the path, since that would have been tested earlier. 1256 if test "x$HOST_OS" = xwindows; then 1257 # Now if this is a windows platform. The default installation of a JDK 1258 # actually puts the JRE in the path and keeps the JDK out of the path! 1259 # Go look in the default installation location. 1260 BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1` 1261 if test -d "$BOOT_JDK"; then 1262 BOOT_JDK_FOUND=yes 1263 fi 1264 fi 1265 if test "x$BOOT_JDK_FOUND" = xno; then 1266 help_on_build_dependency openjdk 1267 AC_ERROR([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG]) 1268 fi 1269 else 1270 help_on_build_dependency openjdk 1271 AC_ERROR([Could not find a JDK. $HELP_MSG]) 1272 fi 1273 fi 1274 1275 WIN_FIX_PATH(BOOT_JDK) 1276 1277 # Now see if we can find the rt.jar, or its nearest equivalent. 1278 BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar" 1279 SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)]) 1280 1281 BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar" 1282 SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)]) 1283 1284 if test ! -f $BOOT_RTJAR; then 1285 # On MacOSX it is called classes.jar 1286 BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar 1287 if test ! -f $BOOT_RTJAR; then 1288 AC_ERROR([Cannot find the rt.jar or its equivalent!]) 1289 fi 1290 # Remove the .. 1291 BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}" 1292 # The tools.jar is part of classes.jar 1293 BOOT_TOOLSJAR="$BOOT_RTJAR" 1294 fi 1295 1296 AC_SUBST(BOOT_JDK) 1297 AC_SUBST(BOOT_RTJAR) 1298 AC_SUBST(BOOT_TOOLSJAR) 1299 AC_MSG_CHECKING([for Boot JDK]) 1300 AC_MSG_RESULT([$BOOT_JDK]) 1301 AC_MSG_CHECKING([for Boot rt.jar]) 1302 AC_MSG_RESULT([$BOOT_RTJAR]) 1303 AC_MSG_CHECKING([for Boot tools.jar]) 1304 AC_MSG_RESULT([$BOOT_TOOLSJAR]) 1305 1306 # Use the java tool from the Boot JDK. 1307 AC_MSG_CHECKING([for java in Boot JDK]) 1308 JAVA=$BOOT_JDK/bin/java 1309 if test ! -x $JAVA; then 1310 AC_ERROR([Could not find a working java]) 1311 fi 1312 BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1` 1313 AC_MSG_RESULT([yes $BOOT_JDK_VERSION]) 1314 AC_SUBST(JAVA) 1315 1316 # Extra M4 quote needed to protect [] in grep expression. 1317 [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`] 1318 if test "x$FOUND_VERSION_78" = x; then 1319 help_on_build_dependency openjdk 1320 AC_ERROR([Your bootjdk must be version 7 or 8. $HELP_MSG]) 1321 fi 1322 1323 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility. 1324 BOOT_JDK_SOURCETARGET="-source 7 -target 7" 1325 AC_SUBST(BOOT_JDK_SOURCETARGET) 1326 1327 # Use the javac tool from the Boot JDK. 1328 AC_MSG_CHECKING([for javac in Boot JDK]) 1329 JAVAC=$BOOT_JDK/bin/javac 1330 if test ! -x $JAVAC; then 1331 AC_ERROR([Could not find a working javac]) 1332 fi 1333 AC_MSG_RESULT(yes) 1334 AC_SUBST(JAVAC) 1335 AC_SUBST(JAVAC_FLAGS) 1336 1337 # Use the javac tool from the Boot JDK. 1338 AC_MSG_CHECKING([for javah in Boot JDK]) 1339 JAVAH=$BOOT_JDK/bin/javah 1340 if test ! -x $JAVAH; then 1341 AC_ERROR([Could not find a working javah]) 1342 fi 1343 AC_MSG_RESULT(yes) 1344 AC_SUBST(JAVAH) 1345 1346 # Use the jar tool from the Boot JDK. 1347 AC_MSG_CHECKING([for jar in Boot JDK]) 1348 JAR=$BOOT_JDK/bin/jar 1349 if test ! -x $JAR; then 1350 AC_ERROR([Could not find a working jar]) 1351 fi 1352 AC_SUBST(JAR) 1353 AC_MSG_RESULT(yes) 1354 1355 # Use the rmic tool from the Boot JDK. 1356 AC_MSG_CHECKING([for rmic in Boot JDK]) 1357 RMIC=$BOOT_JDK/bin/rmic 1358 if test ! -x $RMIC; then 1359 AC_ERROR([Could not find a working rmic]) 1360 fi 1361 AC_SUBST(RMIC) 1362 AC_MSG_RESULT(yes) 1363 1364 ############################################################################### 1365 # 1366 # Pickup additional source for a component from outside of the source root 1367 # or override source for a component. 1368 # 1369 AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root], 1370 [for each and every source directory, look in this additional source root for 1371 the same directory; if it exists and have files in it, include it in the build])]) 1372 1373 AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root], 1374 [for each and every source directory, look in this override source root for 1375 the same directory; if it exists, use that directory instead and 1376 ignore the directory in the original source root])]) 1377 1378 AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides], 1379 [use the subdirs 'adds' and 'overrides' in the specified directory as 1380 add-source-root and override-source-root])]) 1381 1382 if test "x$with_adds_and_overrides" != x; then 1383 with_add_source_root="$with_adds_and_overrides/adds" 1384 with_override_source_root="$with_adds_and_overrides/overrides" 1385 fi 1386 1387 if test "x$with_add_source_root" != x; then 1388 if ! test -d $with_add_source_root; then 1389 AC_ERROR([Trying to use a non-existant add-source-root $with_add_source_root]) 1390 fi 1391 CURDIR="$PWD" 1392 cd "$with_add_source_root" 1393 ADD_SRC_ROOT="`pwd`" 1394 cd "$CURDIR" 1395 # Verify that the addon source root does not have any root makefiles. 1396 # If it does, then it is usually an error, prevent this. 1397 if test -f $with_add_source_root/langtools/makefiles/Makefile || \ 1398 test -f $with_add_source_root/langtools/make/Makefile; then 1399 AC_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.]) 1400 fi 1401 if test -f $with_add_source_root/corba/makefiles/Makefile || \ 1402 test -f $with_add_source_root/corba/make/Makefile; then 1403 AC_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.]) 1404 fi 1405 if test -f $with_add_source_root/jaxp/makefiles/Makefile || \ 1406 test -f $with_add_source_root/jaxp/make/Makefile; then 1407 AC_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.]) 1408 fi 1409 if test -f $with_add_source_root/jaxws/makefiles/Makefile || \ 1410 test -f $with_add_source_root/jaxws/make/Makefile; then 1411 AC_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.]) 1412 fi 1413 if test -f $with_add_source_root/hotspot/makefiles/Makefile || \ 1414 test -f $with_add_source_root/hotspot/make/Makefile; then 1415 AC_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.]) 1416 fi 1417 if test -f $with_add_source_root/jdk/makefiles/Makefile || \ 1418 test -f $with_add_source_root/jdk/make/Makefile; then 1419 AC_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.]) 1420 fi 1421 fi 1422 AC_SUBST(ADD_SRC_ROOT) 1423 1424 if test "x$with_override_source_root" != x; then 1425 if ! test -d $with_override_source_root; then 1426 AC_ERROR([Trying to use a non-existant override-source-root $with_override_source_root]) 1427 fi 1428 CURDIR="$PWD" 1429 cd "$with_override_source_root" 1430 OVERRIDE_SRC_ROOT="`pwd`" 1431 cd "$CURDIR" 1432 if test -f $with_override_source_root/langtools/makefiles/Makefile || \ 1433 test -f $with_override_source_root/langtools/make/Makefile; then 1434 AC_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.]) 1435 fi 1436 if test -f $with_override_source_root/corba/makefiles/Makefile || \ 1437 test -f $with_override_source_root/corba/make/Makefile; then 1438 AC_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.]) 1439 fi 1440 if test -f $with_override_source_root/jaxp/makefiles/Makefile || \ 1441 test -f $with_override_source_root/jaxp/make/Makefile; then 1442 AC_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.]) 1443 fi 1444 if test -f $with_override_source_root/jaxws/makefiles/Makefile || \ 1445 test -f $with_override_source_root/jaxws/make/Makefile; then 1446 AC_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.]) 1447 fi 1448 if test -f $with_override_source_root/hotspot/makefiles/Makefile || \ 1449 test -f $with_override_source_root/hotspot/make/Makefile; then 1450 AC_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.]) 1451 fi 1452 if test -f $with_override_source_root/jdk/makefiles/Makefile || \ 1453 test -f $with_override_source_root/jdk/make/Makefile; then 1454 AC_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.]) 1455 fi 1456 fi 1457 AC_SUBST(OVERRIDE_SRC_ROOT) 1458 1459 ############################################################################### 1460 # 1461 # Override a repo completely, this is used for example when you have 3 small 1462 # development sandboxes of the langtools sources and want to avoid having 3 full 1463 # OpenJDK sources checked out on disk. 1464 # 1465 # Assuming that the 3 langtools sandboxes are located here: 1466 # /home/fredrik/sandbox1/langtools 1467 # /home/fredrik/sandbox2/langtools 1468 # /home/fredrik/sandbox3/langtools 1469 # 1470 # From the source root you create build subdirs manually: 1471 # mkdir -p build1 build2 build3 1472 # in each build directory run: 1473 # (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make) 1474 # (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make) 1475 # (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make) 1476 # 1477 1478 AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools], 1479 [use this langtools dir for the build])]) 1480 1481 AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba], 1482 [use this corba dir for the build])]) 1483 1484 AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp], 1485 [use this jaxp dir for the build])]) 1486 1487 AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws], 1488 [use this jaxws dir for the build])]) 1489 1490 AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot], 1491 [use this hotspot dir for the build])]) 1492 1493 AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk], 1494 [use this jdk dir for the build])]) 1495 1496 if test "x$with_override_langtools" != x; then 1497 CURDIR="$PWD" 1498 cd "$with_override_langtools" 1499 LANGTOOLS_TOPDIR="`pwd`" 1500 cd "$CURDIR" 1501 if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then 1502 AC_ERROR([You have to override langtools with a full langtools repo!]) 1503 fi 1504 AC_MSG_CHECKING([if langtools should be overridden]) 1505 AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR]) 1506 fi 1507 if test "x$with_override_corba" != x; then 1508 CURDIR="$PWD" 1509 cd "$with_override_corba" 1510 CORBA_TOPDIR="`pwd`" 1511 cd "$CURDIR" 1512 if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then 1513 AC_ERROR([You have to override corba with a full corba repo!]) 1514 fi 1515 AC_MSG_CHECKING([if corba should be overridden]) 1516 AC_MSG_RESULT([yes with $CORBA_TOPDIR]) 1517 fi 1518 if test "x$with_override_jaxp" != x; then 1519 CURDIR="$PWD" 1520 cd "$with_override_jaxp" 1521 JAXP_TOPDIR="`pwd`" 1522 cd "$CURDIR" 1523 if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then 1524 AC_ERROR([You have to override jaxp with a full jaxp repo!]) 1525 fi 1526 AC_MSG_CHECKING([if jaxp should be overridden]) 1527 AC_MSG_RESULT([yes with $JAXP_TOPDIR]) 1528 fi 1529 if test "x$with_override_jaxws" != x; then 1530 CURDIR="$PWD" 1531 cd "$with_override_jaxws" 1532 JAXWS_TOPDIR="`pwd`" 1533 cd "$CURDIR" 1534 if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then 1535 AC_ERROR([You have to override jaxws with a full jaxws repo!]) 1536 fi 1537 AC_MSG_CHECKING([if jaxws should be overridden]) 1538 AC_MSG_RESULT([yes with $JAXWS_TOPDIR]) 1539 fi 1540 if test "x$with_override_hotspot" != x; then 1541 CURDIR="$PWD" 1542 cd "$with_override_hotspot" 1543 HOTSPOT_TOPDIR="`pwd`" 1544 cd "$CURDIR" 1545 if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \ 1546 ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then 1547 AC_ERROR([You have to override hotspot with a full hotspot repo!]) 1548 fi 1549 AC_MSG_CHECKING([if hotspot should be overridden]) 1550 AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR]) 1551 fi 1552 if test "x$with_override_jdk" != x; then 1553 CURDIR="$PWD" 1554 cd "$with_override_jdk" 1555 JDK_TOPDIR="`pwd`" 1556 cd "$CURDIR" 1557 if ! test -f $JDK_TOPDIR/makefiles/Makefile; then 1558 AC_ERROR([You have to override JDK with a full JDK repo!]) 1559 fi 1560 AC_MSG_CHECKING([if JDK should be overridden]) 1561 AC_MSG_RESULT([yes with $JDK_TOPDIR]) 1562 fi 1563 1564 ############################################################################### 1565 # 1566 # Specify options for anything that is run with the Boot JDK. 1567 # 1568 AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs], 1569 [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values, 1570 e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])]) 1571 1572 if test "x$with_boot_jdk_jvmargs" = x; then 1573 # Not all JVM:s accept the same arguments on the command line. 1574 # OpenJDK specific increase in thread stack for JDK build, 1575 # well more specifically, when running javac. 1576 if test "x$BUILD_NUM_BITS" = x32; then 1577 STACK_SIZE=768 1578 else 1579 # Running Javac on a JVM on a 64-bit machine, the stack takes more space 1580 # since 64-bit pointers are pushed on the stach. Apparently, we need 1581 # to increase the stack space when javacing the JDK.... 1582 STACK_SIZE=1536 1583 fi 1584 1585 # Minimum amount of heap memory. 1586 ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA]) 1587 if test "x$HOST_OS" = "xmacosx"; then 1588 # Why does macosx need more heap? Its the huge JDK batch. 1589 ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA]) 1590 else 1591 ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA]) 1592 fi 1593 # When is adding -client something that speeds up the JVM? 1594 # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) 1595 ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA]) 1596 ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA]) 1597 ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA]) 1598 # Disable special log output when a debug build is used as Boot JDK... 1599 ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) 1600 fi 1601 1602 AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs) 1603 1604 AC_ARG_WITH(server-java, [AS_HELP_STRING([--with-server-java], 1605 [use this java binary for running the javac background server and other long running java tasks in the build process, 1606 e.g. ---with-server-java="/opt/jrockit/bin/java -server"])]) 1607 1608 if test "x$with_server_java" != x; then 1609 SERVER_JAVA="$with_server_java" 1610 FOUND_VERSION=`$SERVER_JAVA -version 2>&1 | grep " version \""` 1611 if test "x$FOUND_VERSION" = x; then 1612 AC_ERROR([Could not execute server java: $SERVER_JAVA]) 1613 fi 1614 else 1615 SERVER_JAVA="" 1616 # Hotspot specific options. 1617 ADD_JVM_ARG_IF_OK([-XX:+UseParallelOldGC],SERVER_JAVA,[$JAVA]) 1618 ADD_JVM_ARG_IF_OK([-verbosegc],SERVER_JAVA,[$JAVA]) 1619 # JRockit specific options. 1620 ADD_JVM_ARG_IF_OK([-Xverbose:gc],SERVER_JAVA,[$JAVA]) 1621 SERVER_JAVA="$JAVA $SERVER_JAVA" 1622 fi 1623 AC_SUBST(SERVER_JAVA) 1624 1625 AC_MSG_CHECKING([whether to use shared server for javac]) 1626 AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--enable-javac-server], 1627 [enable the shared javac server during the build process @<:@disabled@:>@])], 1628 [ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER='no']) 1629 AC_MSG_RESULT([$ENABLE_JAVAC_SERVER]) 1630 if test "x$ENABLE_JAVAC_SERVER" = xyes; then 1631 JAVAC_USE_REMOTE=true 1632 JAVAC_SERVERS="$OUTPUT_ROOT/javacservers" 1633 else 1634 JAVAC_USE_REMOTE=false 1635 JAVAC_SERVERS= 1636 fi 1637 AC_SUBST(JAVAC_USE_REMOTE) 1638 AC_SUBST(JAVAC_SERVERS) 1639 1640 AC_ARG_WITH(javac-server-cores, [AS_HELP_STRING([--with-javac-server-cores], 1641 [use at most this number of concurrent threads on the javac server @<:@probed@:>@])]) 1642 if test "x$with_javac_server_cores" != x; then 1643 JAVAC_SERVER_CORES="$with_javac_server_cores" 1644 else 1645 if test "$NUM_CORES" -gt 16; then 1646 # We set this arbitrary limit because we want to limit the heap 1647 # size of the javac server. 1648 # In the future we will make the javac compilers in the server 1649 # share more and more state, thus enabling us to use more and 1650 # more concurrent threads in the server. 1651 JAVAC_SERVER_CORES="16" 1652 else 1653 JAVAC_SERVER_CORES="$NUM_CORES" 1654 fi 1655 1656 if test "$MEMORY_SIZE" -gt "17000"; then 1657 MAX_HEAP_MEM=10000 1658 ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA]) 1659 ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SERVER_JAVA,[$SERVER_JAVA]) 1660 ADD_JVM_ARG_IF_OK([-Xmn2G],SERVER_JAVA,[$SERVER_JAVA]) 1661 elif test "$MEMORY_SIZE" -gt "10000"; then 1662 MAX_HEAP_MEM=6000 1663 ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA]) 1664 ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SERVER_JAVA,[$SERVER_JAVA]) 1665 ADD_JVM_ARG_IF_OK([-Xmn1G],SERVER_JAVA,[$SERVER_JAVA]) 1666 elif test "$MEMORY_SIZE" -gt "5000"; then 1667 MAX_HEAP_MEM=3000 1668 ADD_JVM_ARG_IF_OK([-d64],SERVER_JAVA,[$SERVER_JAVA]) 1669 ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SERVER_JAVA,[$SERVER_JAVA]) 1670 ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA]) 1671 elif test "$MEMORY_SIZE" -gt "3800"; then 1672 MAX_HEAP_MEM=2500 1673 ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SERVER_JAVA,[$SERVER_JAVA]) 1674 ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA]) 1675 elif test "$MEMORY_SIZE" -gt "1900"; then 1676 MAX_HEAP_MEM=1200 1677 ADD_JVM_ARG_IF_OK([-Xms700M -Xmx1200M],SERVER_JAVA,[$SERVER_JAVA]) 1678 ADD_JVM_ARG_IF_OK([-Xmn256M],SERVER_JAVA,[$SERVER_JAVA]) 1679 elif test "$MEMORY_SIZE" -gt "1000"; then 1680 MAX_HEAP_MEM=900 1681 ADD_JVM_ARG_IF_OK([-Xms400M -Xmx900M],SERVER_JAVA,[$SERVER_JAVA]) 1682 ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA]) 1683 else 1684 MAX_HEAP_MEM=512 1685 ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SERVER_JAVA,[$SERVER_JAVA]) 1686 ADD_JVM_ARG_IF_OK([-Xmn128M],SERVER_JAVA,[$SERVER_JAVA]) 1687 fi 1688 1689 MAX_COMPILERS_IN_HEAP=`expr $MAX_HEAP_MEM / 501` 1690 if test "$JAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then 1691 AC_MSG_CHECKING([if number of server cores must be reduced]) 1692 JAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP" 1693 AC_MSG_RESULT([yes, to $JAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB]) 1694 fi 1695 fi 1696 AC_SUBST(JAVAC_SERVER_CORES) 1697 1698 AC_MSG_CHECKING([whether to track dependencies between Java packages]) 1699 AC_ARG_ENABLE([javac-deps], [AS_HELP_STRING([--enable-javac-deps], 1700 [enable the dependency tracking between Java packages @<:@disabled@:>@])], 1701 [ENABLE_JAVAC_DEPS="${enableval}"], [ENABLE_JAVAC_DEPS='no']) 1702 AC_MSG_RESULT([$ENABLE_JAVAC_DEPS]) 1703 if test "x$ENABLE_JAVAC_DEPS" = xyes; then 1704 JAVAC_USE_DEPS=true 1705 else 1706 JAVAC_USE_DEPS=false 1707 fi 1708 AC_SUBST(JAVAC_USE_DEPS) 1709 1710 AC_MSG_CHECKING([whether to use multiple cores for javac compilation]) 1711 AC_ARG_ENABLE([javac-multi-core], [AS_HELP_STRING([--enable-javac-multi-core], 1712 [compile Java packages concurrently @<:@disabled@:>@])], 1713 [ENABLE_JAVAC_MULTICORE="${enableval}"], [ENABLE_JAVAC_MULTICORE='no']) 1714 AC_MSG_RESULT([$ENABLE_JAVAC_MULTICORE]) 1715 if test "x$ENABLE_JAVAC_MULTICORE" = xyes; then 1716 JAVAC_USE_MODE=MULTI_CORE_CONCURRENT 1717 else 1718 JAVAC_USE_MODE=SINGLE_THREADED_BATCH 1719 if test "x$ENABLE_JAVAC_DEPS" = xyes; then 1720 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.]) 1721 AC_MSG_WARN([Disabling dependency tracking for you now.]) 1722 JAVAC_USE_DEPS=false 1723 fi 1724 if test "x$ENABLE_JAVAC_SERVER" = xyes; then 1725 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.]) 1726 AC_MSG_WARN([Disabling javac server for you now.]) 1727 JAVAC_USE_REMOTE=false 1728 fi 1729 fi 1730 AC_SUBST(JAVAC_USE_MODE) 1731 1732 ############################################################################### 1733 # 1734 # OS specific settings that we never will need to probe. 1735 # 1736 if test "x$HOST_OS" = xlinux; then 1737 AC_MSG_CHECKING([what is not needed on Linux?]) 1738 PULSE_NOT_NEEDED=yes 1739 AC_MSG_RESULT([pulse]) 1740 fi 1741 1742 if test "x$HOST_OS" = xsolaris; then 1743 AC_MSG_CHECKING([what is not needed on Solaris?]) 1744 ALSA_NOT_NEEDED=yes 1745 PULSE_NOT_NEEDED=yes 1746 AC_MSG_RESULT([alsa pulse]) 1747 fi 1748 1749 if test "x$HOST_OS" = xwindows; then 1750 AC_MSG_CHECKING([what is not needed on Windows?]) 1751 CUPS_NOT_NEEDED=yes 1752 ALSA_NOT_NEEDED=yes 1753 PULSE_NOT_NEEDED=yes 1754 X11_NOT_NEEDED=yes 1755 AC_MSG_RESULT([alsa cups pulse x11]) 1756 fi 1757 1758 if test "x$HOST_OS" = xmacosx; then 1759 AC_MSG_CHECKING([what is not needed on MacOSX?]) 1760 ALSA_NOT_NEEDED=yes 1761 PULSE_NOT_NEEDED=yes 1762 X11_NOT_NEEDED=yes 1763 FREETYPE2_NOT_NEEDED=yes 1764 # If the java runtime framework is disabled, then we need X11. 1765 # This will be adjusted below. 1766 AC_MSG_RESULT([alsa pulse x11]) 1767 fi 1768 1769 if test "x$HOST_OS" = xbsd; then 1770 AC_MSG_CHECKING([what is not needed on bsd?]) 1771 ALSA_NOT_NEEDED=yes 1772 AC_MSG_RESULT([alsa]) 1773 fi 1774 1775 ############################################################################### 1776 # 1777 # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM 1778 # that uses this API. 1779 # 1780 AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support], 1781 [disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])], 1782 [MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"]) 1783 1784 USE_MACOSX_RUNTIME_SUPPORT=no 1785 AC_MSG_CHECKING([for explicit Java runtime support in the OS]) 1786 if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then 1787 if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then 1788 MACOSX_RUNTIME_SUPPORT=yes 1789 USE_MACOSX_RUNTIME_SUPPORT=yes 1790 AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11]) 1791 else 1792 AC_MSG_RESULT([yes, but explicitly disabled.]) 1793 fi 1794 else 1795 AC_MSG_RESULT([no]) 1796 fi 1797 1798 if test "x$HOST_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then 1799 AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?]) 1800 X11_NOT_NEEDED= 1801 FREETYPE2_NOT_NEEDED= 1802 AC_MSG_RESULT([alsa pulse]) 1803 fi 1804 1805 ############################################################################### 1806 # 1807 # Check for X Windows 1808 # 1809 AC_PATH_XTRA 1810 1811 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then 1812 help_on_build_dependency x11 1813 AC_ERROR([Could not find X11 libraries. $HELP_MSG]) 1814 fi 1815 1816 AC_SUBST(X_CFLAGS) 1817 AC_SUBST(X_LIBS) 1818 1819 # Some of the old makefiles require a setting of OPENWIN_HOME 1820 # Since the X11R6 directory has disappeared on later Linuxes, 1821 # we need to probe for it. 1822 if test "x$HOST_OS" = xlinux; then 1823 if test -d "$SYS_ROOT/usr/X11R6"; then 1824 OPENWIN_HOME="$SYS_ROOT/usr/X11R6" 1825 fi 1826 if test -d "$SYS_ROOT/usr/include/X11"; then 1827 OPENWIN_HOME="$SYS_ROOT/usr" 1828 fi 1829 fi 1830 if test "x$HOST_OS" = xsolaris; then 1831 OPENWIN_HOME="/usr/openwin" 1832 fi 1833 AC_SUBST(OPENWIN_HOME) 1834 1835 AC_LANG_PUSH(C) 1836 OLD_CFLAGS="$CFLAGS" 1837 CFLAGS="$CFLAGS $X_CFLAGS" 1838 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h], 1839 [X11_A_OK=yes], 1840 [X11_A_OK=no]) 1841 CFLAGS="$OLD_CFLAGS" 1842 AC_LANG_POP(C) 1843 1844 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then 1845 help_on_build_dependency x11 1846 AC_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG]) 1847 fi 1848 1849 ############################################################################### 1850 # 1851 # The common unix printing system cups is used to print from java. 1852 # 1853 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups], 1854 [specify prefix directory for the cups package 1855 (expecting the libraries under PATH/lib and the headers under PATH/include)])]) 1856 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include], 1857 [specify directory for the cups include files])]) 1858 AC_ARG_WITH(cups-lib, [AS_HELP_STRING([--with-cups-lib], 1859 [specify directory for the cups library])]) 1860 1861 if test "x$CUPS_NOT_NEEDED" = xyes; then 1862 if test "x$with_cups" != x || test "x$with_cups-include" != x || test "x$with_cups-lib" != x; then 1863 AC_MSG_WARN([cups not used, so --with-cups is ignored]) 1864 fi 1865 CUPS_CFLAGS= 1866 CUPS_LIBS= 1867 else 1868 CUPS_FOUND=no 1869 1870 if test "x$with_cups" = xno || test "x$with_cups-include" = xno || test "x$with_cups-lib" = xno; then 1871 AC_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.]) 1872 fi 1873 1874 if test "x$with_cups" != x; then 1875 CUPS_LIBS="-L$with_cups/lib -lcups" 1876 CUPS_CFLAGS="-I$with_cups/include" 1877 CUPS_FOUND=yes 1878 fi 1879 if test "x$with_cups-include" != x; then 1880 CUPS_CFLAGS="-I$with_cups-include" 1881 CUPS_FOUND=yes 1882 fi 1883 if test "x$with_cups-lib" != x; then 1884 CUPS_LIBS="-L$with_cups-lib -lcups" 1885 CUPS_FOUND=yes 1886 fi 1887 if test "x$CUPS_FOUND" = xno; then 1888 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes]) 1889 fi 1890 if test "x$CUPS_FOUND" = xno; then 1891 # Are the cups headers installed in the default /usr/include location? 1892 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], 1893 [CUPS_FOUND=yes 1894 CUPS_CFLAGS= 1895 CUPS_LIBS="-lcups" 1896 DEFAULT_CUPS=yes]) 1897 fi 1898 if test "x$CUPS_FOUND" = xno; then 1899 # Getting nervous now? Lets poke around for standard Solaris third-party 1900 # package installation locations. 1901 AC_MSG_CHECKING([for cups headers and libs]) 1902 if test -s /opt/sfw/cups/include/cups/cups.h; then 1903 # An SFW package seems to be installed! 1904 CUPS_FOUND=yes 1905 CUPS_CFLAGS="-I/opt/sfw/cups/include" 1906 CUPS_LIBS="-L/opt/sfw/cups/lib -lcups" 1907 elif test -s /opt/csw/include/cups/cups.h; then 1908 # A CSW package seems to be installed! 1909 CUPS_FOUND=yes 1910 CUPS_CFLAGS="-I/opt/csw/include" 1911 CUPS_LIBS="-L/opt/csw/lib -lcups" 1912 fi 1913 AC_MSG_RESULT([$CUPS_FOUND]) 1914 fi 1915 if test "x$CUPS_FOUND" = xno; then 1916 help_on_build_dependency cups 1917 AC_ERROR([Could not find cups! $HELP_MSG ]) 1918 fi 1919 fi 1920 1921 AC_SUBST(CUPS_CFLAGS) 1922 AC_SUBST(CUPS_LIBS) 1923 1924 ############################################################################### 1925 # 1926 # The ubiquitous freetype2 library is used to render fonts. 1927 # 1928 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype], 1929 [specify prefix directory for the freetype2 package 1930 (expecting the libraries under PATH/lib and the headers under PATH/include)])]) 1931 1932 # If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree 1933 USING_SYSTEM_FT_LIB=false 1934 1935 if test "x$FREETYPE2_NOT_NEEDED" = xyes; then 1936 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then 1937 AC_MSG_WARN([freetype not used, so --with-freetype is ignored]) 1938 fi 1939 FREETYPE2_CFLAGS= 1940 FREETYPE2_LIBS= 1941 FREETYPE2_LIB_PATH= 1942 else 1943 FREETYPE2_FOUND=no 1944 1945 if test "x$with_freetype" != x; then 1946 SPACESAFE(with_freetype,[the path to freetype]) 1947 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype" 1948 if test "x$HOST_OS" = xwindows; then 1949 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib" 1950 fi 1951 FREETYPE2_LIB_PATH="$with_freetype/lib" 1952 FREETYPE2_CFLAGS="-I$with_freetype/include" 1953 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then 1954 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include" 1955 fi 1956 FREETYPE2_FOUND=yes 1957 if test "x$FREETYPE2_FOUND" = xyes; then 1958 # Verify that the directories exist 1959 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then 1960 AC_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include]) 1961 fi 1962 # List the contents of the lib. 1963 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null` 1964 if test "x$FREETYPELIB" = x; then 1965 AC_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib]) 1966 fi 1967 # Check one h-file 1968 if ! test -s "$with_freetype/include/ft2build.h"; then 1969 AC_ERROR([Could not find $with_freetype/include/ft2build.h]) 1970 fi 1971 fi 1972 fi 1973 if test "x$FREETYPE2_FOUND" = xno; then 1974 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) 1975 USING_SYSTEM_FT_LIB=true 1976 fi 1977 if test "x$FREETYPE2_FOUND" = xno; then 1978 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) 1979 USING_SYSTEM_FT_LIB=true 1980 fi 1981 if test "x$FREETYPE2_FOUND" = xno; then 1982 AC_MSG_CHECKING([for freetype in some standard locations]) 1983 1984 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then 1985 DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include" 1986 DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype" 1987 fi 1988 if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then 1989 DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2" 1990 DEFAULT_FREETYPE_LIBS="-lfreetype" 1991 fi 1992 1993 PREV_CXXCFLAGS="$CXXFLAGS" 1994 PREV_LDFLAGS="$LDFLAGS" 1995 CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS" 1996 LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS" 1997 AC_LINK_IFELSE([AC_LANG_SOURCE([[#include<ft2build.h> 1998 #include FT_FREETYPE_H 1999 int main() { return 0; } 2000 ]])], 2001 [ 2002 # Yes, the default cflags and libs did the trick. 2003 FREETYPE2_FOUND=yes 2004 FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS" 2005 FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS" 2006 ], 2007 [ 2008 FREETYPE2_FOUND=no 2009 ]) 2010 CXXCFLAGS="$PREV_CXXFLAGS" 2011 LDFLAGS="$PREV_LDFLAGS" 2012 AC_MSG_RESULT([$FREETYPE2_FOUND]) 2013 USING_SYSTEM_FT_LIB=true 2014 fi 2015 if test "x$FREETYPE2_FOUND" = xno; then 2016 help_on_build_dependency freetype2 2017 AC_ERROR([Could not find freetype2! $HELP_MSG ]) 2018 fi 2019 fi 2020 2021 AC_SUBST(USING_SYSTEM_FT_LIB) 2022 AC_SUBST(FREETYPE2_LIB_PATH) 2023 AC_SUBST(FREETYPE2_CFLAGS) 2024 AC_SUBST(FREETYPE2_LIBS) 2025 2026 ############################################################################### 2027 # 2028 # Check for alsa headers and libraries. Used on Linux/GNU systems. 2029 # 2030 AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa], 2031 [specify prefix directory for the alsa package 2032 (expecting the libraries under PATH/lib and the headers under PATH/include)])]) 2033 AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include], 2034 [specify directory for the alsa include files])]) 2035 AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib], 2036 [specify directory for the alsa library])]) 2037 2038 if test "x$ALSA_NOT_NEEDED" = xyes; then 2039 if test "x$with_alsa" != x || test "x$with_alsa-include" != x || test "x$with_alsa-lib" != x; then 2040 AC_MSG_WARN([alsa not used, so --with-alsa is ignored]) 2041 fi 2042 ALSA_CFLAGS= 2043 ALSA_LIBS= 2044 else 2045 ALSA_FOUND=no 2046 2047 if test "x$with_alsa" = xno || test "x$with_alsa-include" = xno || test "x$with_alsa-lib" = xno; then 2048 AC_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.]) 2049 fi 2050 2051 if test "x$with_alsa" != x; then 2052 ALSA_LIBS="-L$with_alsa/lib -lalsa" 2053 ALSA_CFLAGS="-I$with_alsa/include" 2054 ALSA_FOUND=yes 2055 fi 2056 if test "x$with_alsa-include" != x; then 2057 ALSA_CFLAGS="-I$with_alsa/include" 2058 ALSA_FOUND=yes 2059 fi 2060 if test "x$with_alsa-lib" != x; then 2061 ALSA_LIBS="-L$with_alsa/lib -lalsa" 2062 ALSA_FOUND=yes 2063 fi 2064 if test "x$ALSA_FOUND" = xno; then 2065 BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no]) 2066 fi 2067 if test "x$ALSA_FOUND" = xno; then 2068 PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no]) 2069 fi 2070 if test "x$ALSA_FOUND" = xno; then 2071 AC_CHECK_HEADERS([alsa/asoundlib.h], 2072 [ALSA_FOUND=yes 2073 ALSA_CFLAGS=-Iignoreme 2074 ALSA_LIBS=-lasound 2075 DEFAULT_ALSA=yes], 2076 [ALSA_FOUND=no]) 2077 fi 2078 if test "x$ALSA_FOUND" = xno; then 2079 help_on_build_dependency alsa 2080 AC_ERROR([Could not find alsa! $HELP_MSG ]) 2081 fi 2082 fi 2083 2084 AC_SUBST(ALSA_CFLAGS) 2085 AC_SUBST(ALSA_LIBS) 2086 2087 ############################################################################### 2088 # 2089 # Check for pulse audio headers and libraries. 2090 # 2091 PULSE_FOUND=no 2092 AC_ARG_WITH(pulse, [AS_HELP_STRING([--with-pulse], 2093 [specify prefix directory for the pulseaudio package 2094 (expecting the libraries under PATH/lib and the headers under PATH/include)])]) 2095 AC_ARG_WITH(pulse-include, [AS_HELP_STRING([--with-pulse-include], 2096 [specify directory for the pulseaudio include files])]) 2097 AC_ARG_WITH(pulse-lib, [AS_HELP_STRING([--with-pulse-lib], 2098 [specify directory for the pulseaudio library])]) 2099 2100 if test "x$with_pulse" != x; then 2101 PULSE_LIBS="-L$with_pulse/lib -lfreetype" 2102 PULSE_CFLAGS="-I$with_pulse/include" 2103 PULSE_FOUND=yes 2104 fi 2105 if test "x$with_pulse-include" != x; then 2106 PULSE_CFLAGS="-I$with_pulse/include" 2107 PULSE_FOUND=yes 2108 fi 2109 if test "x$with_pulse-lib" != x; then 2110 PULSE_LIBS="-L$with_pulse/lib -lfreetype" 2111 PULSE_FOUND=yes 2112 fi 2113 if test "x$PULSE_FOUND" = xno; then 2114 BDEPS_CHECK_MODULE(PULSE, pulse, xxx, [PULSE_FOUND=yes], [PULSE_FOUND=no]) 2115 fi 2116 if test "x$PULSE_FOUND" = xno; then 2117 PKG_CHECK_MODULES(LIBPULSE,[libpulse >= 0.9.11],[PULSE_FOUND=yes],[PULSE_FOUND=no]) 2118 fi 2119 if test "x$PULSE_FOUND" = xno; then 2120 AC_CHECK_HEADERS([pulse/pulseaudio.h], 2121 [PULSE_FOUND=yes 2122 PULSE_CFLAGS=-Iignoreme 2123 PULSE_LIBS= 2124 DEFAULT_PULSE=yes], 2125 [PULSE_FOUND=no]) 2126 fi 2127 2128 if test "x$PULSE_FOUND" = xno && test "x$PULSE_NOT_NEEDED" != xyes; then 2129 help_on_build_dependency pulse 2130 AC_ERROR([Could not find pulse audio libraries. $HELP_MSG ]) 2131 fi 2132 2133 AC_SUBST(PULSE_CFLAGS) 2134 AC_SUBST(PULSE_LIBS) 2135 2136 ############################################################################### 2137 # 2138 # Check for the jpeg library 2139 # 2140 2141 USE_EXTERNAL_LIBJPEG=true 2142 AC_CHECK_LIB(jpeg, main, [], 2143 [ USE_EXTERNAL_LIBJPEG=false 2144 AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source]) 2145 ]) 2146 AC_SUBST(USE_EXTERNAL_LIBJPEG) 2147 2148 ############################################################################### 2149 # 2150 # Check for the gif library 2151 # 2152 2153 USE_EXTERNAL_LIBJPEG=true 2154 AC_CHECK_LIB(gif, main, [], 2155 [ USE_EXTERNAL_LIBGIF=false 2156 AC_MSG_NOTICE([Will use gif decoder bundled with the OpenJDK source]) 2157 ]) 2158 AC_SUBST(USE_EXTERNAL_LIBGIF) 2159 2160 ############################################################################### 2161 # 2162 # Check for the zlib library 2163 # 2164 2165 USE_EXTERNAL_LIBZ=true 2166 AC_CHECK_LIB(z, main, [], 2167 [ USE_EXTERNAL_LIBZ=false 2168 AC_MSG_NOTICE([Will use zlib bundled with the OpenJDK source]) 2169 ]) 2170 AC_SUBST(USE_EXTERNAL_LIBZ) 2171 2172 ############################################################################### 2173 # 2174 # Check if altzone exists in time.h 2175 # 2176 2177 AC_TRY_LINK([#include <time.h>], [return (int)altzone;], 2178 has_altzone=yes, 2179 has_altzone=no) 2180 if test "x$has_altzone" = xyes; then 2181 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h]) 2182 fi 2183 2184 ############################################################################### 2185 # 2186 # Check the maths library 2187 # 2188 2189 AC_CHECK_LIB(m, main, [], 2190 [ 2191 AC_MSG_NOTICE([Maths library was not found]) 2192 ]) 2193 AC_SUBST(LIBM) 2194 2195 ############################################################################### 2196 # 2197 # Should we run the painfully slow javadoc tool? 2198 # 2199 AC_MSG_CHECKING([whether to build documentation]) 2200 AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs], 2201 [enable generation of Javadoc documentation @<:@disabled@:>@])], 2202 [ENABLE_DOCS="${enableval}"], [ENABLE_DOCS='no']) 2203 AC_MSG_RESULT([$ENABLE_DOCS]) 2204 AC_SUBST(ENABLE_DOCS) 2205 GENERATE_DOCS=false 2206 if test "x$ENABLE_DOCS" = xyes; then 2207 GENERATE_DOCS=true 2208 fi 2209 AC_SUBST(GENERATE_DOCS) 2210 2211 ############################################################################### 2212 # 2213 # Should we compile nimbus swing L&F? We can probably remove this option 2214 # since nimbus is officially part of javax now. 2215 # 2216 AC_MSG_CHECKING([whether to build nimbus L&F]) 2217 AC_ARG_ENABLE([nimbus], [AS_HELP_STRING([--disable-nimbus], 2218 [disable Nimbus L&F @<:@enabled@:>@])], 2219 [ENABLE_NIMBUS="${enableval}"], [ENABLE_NIMBUS='yes']) 2220 AC_MSG_RESULT([$ENABLE_NIMBUS]) 2221 DISABLE_NIMBUS= 2222 if test "x$ENABLE_NIMBUS" = xno; then 2223 DISABLE_NIMBUS=true 2224 fi 2225 AC_SUBST(DISABLE_NIMBUS) 2226 2227 ############################################################################### 2228 # 2229 # Setup the opt flags for different compilers 2230 # and different operating systems. 2231 # 2232 case $COMPILER_TYPE in 2233 CC ) 2234 D_FLAG="-g" 2235 case $COMPILER_NAME in 2236 gcc ) 2237 case $PLATFORM in 2238 macosx ) 2239 # On MacOSX we optimize for size, something 2240 # we should do for all platforms? 2241 C_O_FLAG_HI="-O3" 2242 C_O_FLAG_NORM="-Os" 2243 C_O_FLAG_NONE="-O0" 2244 ;; 2245 *) 2246 C_O_FLAG_HI="-O3" 2247 C_O_FLAG_NORM="-O2" 2248 C_O_FLAG_NONE="-O0" 2249 ;; 2250 esac 2251 CXX_O_FLAG_HI="$C_O_FLAG_HI" 2252 CXX_O_FLAG_NORM="$C_O_FLAG_NORM" 2253 CXX_O_FLAG_NONE="$C_O_FLAG_NONE" 2254 ;; 2255 ossc ) 2256 case $LEGACY_HOST_CPU1 in 2257 i586) 2258 C_O_FLAG_HI="-xO4 -Wu,-O4~yz" 2259 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz" 2260 C_O_FLAG_NONE="" 2261 CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz" 2262 CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz" 2263 CXX_O_FLAG_NONE="" 2264 ;; 2265 sparc) 2266 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" 2267 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" 2268 C_O_FLAG_NONE="" 2269 CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" 2270 CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" 2271 CXX_O_FLAG_NONE="" 2272 ;; 2273 esac 2274 esac 2275 ;; 2276 CL ) 2277 D_FLAG= 2278 C_O_FLAG_HI="-O2" 2279 C_O_FLAG_NORM="-O1" 2280 C_O_FLAG_NONE="-Od" 2281 CXX_O_FLAG_HI="$C_O_FLAG_HI" 2282 CXX_O_FLAG_NORM="$C_O_FLAG_NORM" 2283 CXX_O_FLAG_NONE="$C_O_FLAG_NONE" 2284 ;; 2285 esac 2286 2287 AC_SUBST(C_O_FLAG_HI) 2288 AC_SUBST(C_O_FLAG_NORM) 2289 AC_SUBST(C_O_FLAG_NONE) 2290 AC_SUBST(CXX_O_FLAG_HI) 2291 AC_SUBST(CXX_O_FLAG_NORM) 2292 AC_SUBST(CXX_O_FLAG_NONE) 2293 2294 ############################################################################### 2295 # 2296 # Setup legacy vars/targets and new vars to deal with different debug levels. 2297 # 2298 case $DEBUG_LEVEL in 2299 release ) 2300 HOTSPOT_DEBUG_LEVEL="product" 2301 HOTSPOT_EXPORT="product" 2302 ;; 2303 fastdebug ) 2304 HOTSPOT_DEBUG_LEVEL="fastdebug" 2305 HOTSPOT_EXPORT="fastdebug" 2306 CFLAGS="$CFLAGS $D_FLAG" 2307 JAVAC_FLAGS="$JAVAC_FLAGS -g" 2308 ;; 2309 slowdebug ) 2310 HOTSPOT_DEBUG_LEVEL="jvmg" 2311 HOTSPOT_EXPORT="debug" 2312 CFLAGS="$CFLAGS $D_FLAG" 2313 C_O_FLAG_HI="$C_O_FLAG_NONE" 2314 C_O_FLAG_NORM="$C_O_FLAG_NONE" 2315 CXX_O_FLAG_HI="$CXX_O_FLAG_NONE" 2316 CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" 2317 JAVAC_FLAGS="$JAVAC_FLAGS -g" 2318 ;; 2319 esac 2320 2321 ############################################################################### 2322 # 2323 # Generate the legacy makefile targets for hotspot. 2324 # The hotspot api for selecting the build artifacts, really, needs to be improved. 2325 # 2326 HOTSPOT_TARGET="" 2327 2328 if test "x$JVM_VARIANT_SERVER" = xtrue; then 2329 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} " 2330 fi 2331 2332 if test "x$JVM_VARIANT_CLIENT" = xtrue; then 2333 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " 2334 fi 2335 2336 if test "x$JVM_VARIANT_KERNEL" = xtrue; then 2337 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel " 2338 fi 2339 2340 if test "x$JVM_VARIANT_ZERO" = xtrue; then 2341 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero " 2342 fi 2343 2344 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 2345 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark " 2346 fi 2347 2348 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT" 2349 2350 ############################################################################### 2351 # 2352 # Setup all directories for the subrepoes and the arguments to the sub makes. 2353 # 2354 LANGTOOLS_OUTPUTDIR="$OUTPUT_ROOT/langtools" 2355 LANGTOOLS_DIST="$OUTPUT_ROOT/langtools/dist" 2356 LANGTOOLS_MAKE_ARGS="" 2357 AC_SUBST(LANGTOOLS_OUTPUTDIR) 2358 AC_SUBST(LANGTOOLS_DIST) 2359 AC_SUBST(LANGTOOLS_MAKE_ARGS) 2360 2361 CORBA_OUTPUTDIR="$OUTPUT_ROOT/corba" 2362 CORBA_DIST="$OUTPUT_ROOT/corba/dist" 2363 CORBA_MAKE_ARGS="" 2364 AC_SUBST(CORBA_OUTPUTDIR) 2365 AC_SUBST(CORBA_DIST) 2366 AC_SUBST(CORBA_MAKE_ARGS) 2367 2368 JAXP_OUTPUTDIR="$OUTPUT_ROOT/jaxp" 2369 JAXP_DIST="$OUTPUT_ROOT/jaxp/dist" 2370 JAXP_MAKE_ARGS="" 2371 AC_SUBST(JAXP_OUTPUTDIR) 2372 AC_SUBST(JAXP_DIST) 2373 AC_SUBST(JAXP_MAKE_ARGS) 2374 2375 JAXWS_OUTPUTDIR="$OUTPUT_ROOT/jaxws" 2376 JAXWS_DIST="$OUTPUT_ROOT/jaxws/dist" 2377 JAXWS_MAKE_ARGS="" 2378 AC_SUBST(JAXWS_OUTPUTDIR) 2379 AC_SUBST(JAXWS_DIST) 2380 AC_SUBST(JAXWS_MAKE_ARGS) 2381 2382 HOTSPOT_OUTPUTDIR="$OUTPUT_ROOT/hotspot" 2383 HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist" 2384 HOTSPOT_MAKE_ARGS="ALT_OUTPUTDIR=$HOTSPOT_OUTPUTDIR ALT_EXPORT_PATH=$HOTSPOT_DIST $HOTSPOT_TARGET" 2385 AC_SUBST(HOTSPOT_OUTPUTDIR) 2386 AC_SUBST(HOTSPOT_DIST) 2387 AC_SUBST(HOTSPOT_MAKE_ARGS) 2388 2389 JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk" 2390 JDK_MAKE_ARGS="ALT_OUTPUTDIR=\"$OUTPUT_ROOT/jdk\"" 2391 AC_SUBST(JDK_OUTPUTDIR) 2392 AC_SUBST(JDK_MAKE_ARGS) 2393 2394 IMAGES_OUTPUTDIR=$OUTPUT_ROOT/images 2395 IMAGES_MAKE_ARGS="ALT_OUTPUTDIR=$OUTPUT_ROOT/jdk \ 2396 SHARE_SRC=$JDK_TOPDIR/src/share \ 2397 PLATFORM_SRC=$JDK_TOPDIR/src/$LEGACY_HOST_OS_API \ 2398 TEMPDIR=$IMAGES_OUTPUTDIR/tmp \ 2399 ABS_TEMPDIR=$IMAGES_OUTPUTDIR/tmp " 2400 AC_SUBST(IMAGES_OUTPUTDIR) 2401 AC_SUBST(IMAGES_MAKE_ARGS) 2402 2403 ############################################################################### 2404 # 2405 # Now setup the CFLAGS and LDFLAGS for the JDK build. 2406 # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. 2407 # 2408 case $COMPILER_NAME in 2409 gcc ) 2410 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer \ 2411 -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" 2412 CFLAGS_JDK="$CFLAGS_JDK -fno-strict-aliasing" 2413 ;; 2414 ossc ) 2415 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa REQUIRED -v -mt -norunpath -xnolib" 2416 CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt REQUIRED -features=no%except -DCC_NOEX" 2417 ;; 2418 cl ) 2419 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ 2420 -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ 2421 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ 2422 -DWIN32 -DIAL" 2423 case $LEGACY_HOST_CPU1 in 2424 i?86 ) 2425 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" 2426 ;; 2427 amd64 ) 2428 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" 2429 ;; 2430 esac 2431 ;; 2432 esac 2433 2434 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" 2435 2436 # The package path is used only on macosx? 2437 PACKAGE_PATH=/opt/local 2438 AC_SUBST(PACKAGE_PATH) 2439 2440 # Sometimes we use a cpu dir (.../lib/amd64/server) 2441 # Sometimes not (.../lib/server) 2442 LIBARCHDIR="$LEGACY_HOST_CPU2/" 2443 if test "x$ENDIAN" = xlittle; then 2444 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" 2445 else 2446 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" 2447 fi 2448 if test "x$HOST_OS" = xlinux; then 2449 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX" 2450 fi 2451 if test "x$HOST_OS" = xwindows; then 2452 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS" 2453 fi 2454 if test "x$HOST_OS" = xsolaris; then 2455 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS" 2456 fi 2457 if test "x$HOST_OS" = xmacosx; then 2458 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE" 2459 LIBARCHDIR="" 2460 fi 2461 if test "x$HOST_OS" = xbsd; then 2462 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" 2463 fi 2464 if test "x$DEBUG_LEVEL" = xrelease; then 2465 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" 2466 else 2467 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" 2468 fi 2469 2470 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$LEGACY_HOST_CPU1\"' -D$LEGACY_HOST_CPU1" 2471 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'" 2472 2473 CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ 2474 -I${JDK_OUTPUTDIR}/include \ 2475 -I${JDK_OUTPUTDIR}/include/$PLATFORM \ 2476 -I${JDK_TOPDIR}/src/share/javavm/export \ 2477 -I${JDK_TOPDIR}/src/$LEGACY_HOST_OS_API/javavm/export \ 2478 -I${JDK_TOPDIR}/src/share/native/common \ 2479 -I${JDK_TOPDIR}/src/$LEGACY_HOST_OS_API/native/common" 2480 2481 # The shared libraries are compiled using the picflag. 2482 CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" 2483 CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG" 2484 2485 # Executable flags 2486 CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" 2487 CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" 2488 2489 # Now this is odd. The JDK native libraries have to link against libjvm.so 2490 # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. 2491 # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library 2492 # is identical for client and server? Yes. Which is picked at runtime (client or server)? 2493 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following 2494 # libraries will link to whatever is in memory. Yuck. 2495 # 2496 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. 2497 if test "x$COMPILER_TYPE" = xCL; then 2498 LDFLAGS_JDKLIB="$LDFLAGS -libpath:${JDK_OUTPUTDIR}/lib jvm.lib java.lib" 2499 LDFLAGS_JDKLIB_SUFFIX="" 2500 if test "x$HOST_CPU_BITS" = "x64"; then 2501 LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj64/jli.lib" 2502 else 2503 LDFLAGS_JDKEXE="$CFLAGS ${JDK_OUTPUTDIR}/tmp/java/jli/obj/jli.lib" 2504 fi 2505 LDFLAGS_JDKEXE_SUFFIX="" 2506 else 2507 # If this is a --hash-style=gnu system, use --hash-style=both, why? 2508 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` 2509 if test -n "$HAS_GNU_HASH"; then 2510 # And since we now know that the linker is gnu, then add -z defs, to forbid 2511 # undefined symbols in object files. 2512 LDFLAGS="$LDFLAGS -Xlinker --hash-style=both -Xlinker -z -Xlinker defs" 2513 if test "x$DEBUG_LEVEL" == "xrelease"; then 2514 # When building release libraries, tell the linker optimize them. 2515 # Should this be supplied to the OSS linker as well? 2516 LDFLAGS="$LDFLAGS -Xlinker -O1" 2517 fi 2518 fi 2519 2520 LDFLAGS_JDKLIB="$LDFLAGS $SHARED_LIBRARY_FLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}server \ 2521 -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}client \ 2522 -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}" 2523 LDFLAGS_JDKLIB_SUFFIX="-ljvm -ljava" 2524 if test "x$COMPILER_NAME" = xossc; then 2525 LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc" 2526 fi 2527 2528 # Only the jli library is explicitly linked when the launchers are built. 2529 # The libjvm is then dynamically loaded/linked by the launcher. 2530 LDFLAGS_JDKEXE="$LDFLAGS -L${JDK_OUTPUTDIR}/lib/${LIBARCHDIR}jli" 2531 LDFLAGS_JDKEXE_SUFFIX="-ljli" 2532 fi 2533 2534 2535 AC_SUBST(CFLAGS_JDKLIB) 2536 AC_SUBST(CFLAGS_JDKEXE) 2537 2538 AC_SUBST(CXXFLAGS_JDKLIB) 2539 AC_SUBST(CXXFLAGS_JDKEXE) 2540 2541 AC_SUBST(LDFLAGS_JDKLIB) 2542 AC_SUBST(LDFLAGS_JDKEXE) 2543 AC_SUBST(LDFLAGS_JDKLIB_SUFFIX) 2544 AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) 2545 2546 2547 ############################################################################### 2548 # 2549 # statically link libstdc++ before C++ ABI is stablized on Linux unless 2550 # dynamic build is configured on command line. 2551 # 2552 AC_ARG_ENABLE([static-link-stdc++], [AS_HELP_STRING([--disable-static-link-stdc++], 2553 [disable static linking of the C++ runtime on Linux @<:@enabled@:>@])],, 2554 [ 2555 enable_static_link_stdc__=yes 2556 ]) 2557 2558 if test "x$HOST_OS" = xlinux; then 2559 # Test if -lstdc++ works. 2560 AC_MSG_CHECKING([if dynamic link of stdc++ is possible]) 2561 AC_LANG_PUSH(C++) 2562 OLD_CXXFLAGS="$CXXFLAGS" 2563 CXXFLAGS="$CXXFLAGS -lstdc++" 2564 AC_TRY_LINK([], [return 0;], 2565 has_dynamic_libstdcxx=yes, 2566 has_dynamic_libstdcxx=no) 2567 CXXFLAGS="$OLD_CXXFLAGS" 2568 AC_LANG_POP(C++) 2569 AC_MSG_RESULT([$has_dynamic_libstdcxx]) 2570 2571 # Test if stdc++ can be linked statically. 2572 AC_MSG_CHECKING([if static link of stdc++ is possible]) 2573 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic" 2574 AC_LANG_PUSH(C++) 2575 OLD_LIBS="$LIBS" 2576 OLD_CXX="$CXX" 2577 LIBS="$STATIC_STDCXX_FLAGS" 2578 CXX="$CC" 2579 AC_TRY_LINK([], [return 0;], 2580 has_static_libstdcxx=yes, 2581 has_static_libstdcxx=no) 2582 LIBS="$OLD_LIBS" 2583 CXX="$OLD_CXX" 2584 AC_LANG_POP(C++) 2585 AC_MSG_RESULT([$has_static_libstdcxx]) 2586 2587 if test "x$has_static_libcxx" = xno && test "x$has_dynamic_libcxx" = xno; then 2588 AC_ERROR([I cannot link to stdc++! Neither dynamically nor statically.]) 2589 fi 2590 2591 if test "x$enable_static_link_stdc__" = xyes && test "x$has_static_libstdcxx" = xno; then 2592 AC_MSG_NOTICE([Static linking of libstdc++ was not possible reverting to dynamic linking.]) 2593 enable_static_link_stdc__=no 2594 fi 2595 2596 if test "x$enable_static_link_stdc__" = xno && test "x$has_dynamic_libstdcxx" = xno; then 2597 AC_MSG_NOTICE([Dynamic linking of libstdc++ was not possible reverting to static linking.]) 2598 enable_static_link_stdc__=yes 2599 fi 2600 2601 AC_MSG_CHECKING([how to link with libstdc++]) 2602 if test "x$enable_static_link_stdc__" = xyes; then 2603 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS" 2604 LDCXX="$CC" 2605 AC_MSG_RESULT([static]) 2606 else 2607 LIBCXX="$LIBCXX -lstdc++" 2608 LDCXX="$CXX" 2609 AC_MSG_RESULT([dynamic]) 2610 fi 2611 fi 2612 2613 ############################################################################### 2614 # 2615 # Could someone enlighten this configure script with a comment about libCrun? 2616 # The LEGACY_HOST_CPU3 is the setting for ISA_DIR. 2617 # 2618 if test "x$HOST_OS" = xsolaris; then 2619 LIBCXX="$LIBCXX /usr/lib${LEGACY_HOST_CPU3}/libCrun.so.1" 2620 fi 2621 2622 AC_SUBST(LIBCXX) 2623 2624 ############################################################################### 2625 # 2626 # Misc 2627 # 2628 2629 # Control wether Hotspot runs Queens test after build. 2630 AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build], 2631 [enable running of Queens test after Hotspot build (not yet available) @<:@disabled@:>@])],, 2632 [enable_hotspot_test_in_build=no]) 2633 if test "x$enable_hotspot_test_in_build" = "xyes"; then 2634 TEST_IN_BUILD=true 2635 else 2636 TEST_IN_BUILD=false 2637 fi 2638 AC_SUBST(TEST_IN_BUILD) 2639 2640 ############################################################################### 2641 # 2642 # A helpful message at the end of the configure run. 2643 # 2644 if test "x$CCACHE_FOUND" = x && test "x$GCC" = xyes; then 2645 help_on_build_dependency ccache 2646 2647 printf "\nTip of the day:\nYou should really install ccache version 3.1.4 or newer.\n" 2648 printf "It gives a tremendous speedup for C++ recompilations with precompiled headers!\n" 2649 fi 2650 2651 if test "x$CCACHE_FOUND" != x && test "x$HAS_GOOD_CCACHE" = x; then 2652 printf "You have a ccache installed, but it is a version prior to 3.1.4. Try upgrading.\n" 2653 fi 2654 2655 AC_OUTPUT