248
249 AC_SUBST(MSVCR_DLL)
250
251 # If --build AND --host is set, then the configure script will find any
252 # cross compilation tools in the PATH. Cross compilation tools
253 # follows the cross compilation standard where they are prefixed with ${host}.
254 # For example the binary i686-sun-solaris2.10-gcc
255 # will cross compile for i686-sun-solaris2.10
256 # If neither of build and host is not set, then build=host and the
257 # default compiler found in the path will be used.
258 # Setting only --host, does not seem to be really supported.
259 # Please set both --build and --host if you want to cross compile.
260
261 if test "x$COMPILE_TYPE" = "xcross"; then
262 # Now we to find a C/C++ compiler that can build executables for the build
263 # platform. We can't use the AC_PROG_CC macro, since it can only be used
264 # once. Also, we need to do this before adding a tools dir to the path,
265 # otherwise we might pick up cross-compilers which don't use standard naming.
266 # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
267 # to wait until they are properly discovered.
268 AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
269 BASIC_FIXUP_EXECUTABLE(BUILD_CC)
270 AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
271 BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
272 AC_PATH_PROG(BUILD_LD, ld)
273 BASIC_FIXUP_EXECUTABLE(BUILD_LD)
274 fi
275 AC_SUBST(BUILD_CC)
276 AC_SUBST(BUILD_CXX)
277 AC_SUBST(BUILD_LD)
278
279 # If a devkit is found on the builddeps server, then prepend its path to the
280 # PATH variable. If there are cross compilers available in the devkit, these
281 # will be found by AC_PROG_CC et al.
282 DEVKIT=
283 BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
284 [
285 # Found devkit
286 PATH="$DEVKIT/bin:$PATH"
287 SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
288 if test "x$x_includes" = "xNONE"; then
289 x_includes="$SYS_ROOT/usr/include/X11"
290 fi
291 if test "x$x_libraries" = "xNONE"; then
292 x_libraries="$SYS_ROOT/usr/lib"
453
454 # Restore the flags to the user specified values.
455 # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
456 CFLAGS="$ORG_CFLAGS"
457 CXXFLAGS="$ORG_CXXFLAGS"
458 OBJCFLAGS="$ORG_OBJCFLAGS"
459
460 LD="$CC"
461 LDEXE="$CC"
462 LDCXX="$CXX"
463 LDEXECXX="$CXX"
464 AC_SUBST(LD)
465 # LDEXE is the linker to use, when creating executables.
466 AC_SUBST(LDEXE)
467 # Linking C++ libraries.
468 AC_SUBST(LDCXX)
469 # Linking C++ executables.
470 AC_SUBST(LDEXECXX)
471
472 if test "x$OPENJDK_TARGET_OS" != xwindows; then
473 AC_CHECK_TOOL(AR, ar)
474 BASIC_FIXUP_EXECUTABLE(AR)
475 fi
476 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
477 ARFLAGS="-r"
478 elif test "x$OPENJDK_TARGET_OS" = xaix; then
479 ARFLAGS="-X64"
480 else
481 ARFLAGS=""
482 fi
483 AC_SUBST(ARFLAGS)
484
485 # For hotspot, we need these in Windows mixed path; other platforms keep them the same
486 HOTSPOT_CXX="$CXX"
487 HOTSPOT_LD="$LD"
488 AC_SUBST(HOTSPOT_CXX)
489 AC_SUBST(HOTSPOT_LD)
490
491 COMPILER_NAME=gcc
492 COMPILER_TYPE=CC
493 AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
581 # building the build platform executables. The cross-compilation
582 # case needed to be done earlier, but this can only be done after
583 # the native tools have been localized.
584 BUILD_CC="$CC"
585 BUILD_CXX="$CXX"
586 BUILD_LD="$LD"
587 fi
588
589 # for solaris we really need solaris tools, and not gnu equivalent
590 # these seems to normally reside in /usr/ccs/bin so add that to path before
591 # starting to probe
592 #
593 # NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH
594 # so that it can be overriden --with-tools-dir
595 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
596 PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
597 fi
598
599 # Find the right assembler.
600 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
601 AC_PATH_PROG(AS, as)
602 BASIC_FIXUP_EXECUTABLE(AS)
603 else
604 AS="$CC -c"
605 fi
606 AC_SUBST(AS)
607
608 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
609 AC_PATH_PROG(NM, nm)
610 BASIC_FIXUP_EXECUTABLE(NM)
611 AC_PATH_PROG(GNM, gnm)
612 BASIC_FIXUP_EXECUTABLE(GNM)
613 AC_PATH_PROG(STRIP, strip)
614 BASIC_FIXUP_EXECUTABLE(STRIP)
615 AC_PATH_PROG(MCS, mcs)
616 BASIC_FIXUP_EXECUTABLE(MCS)
617 elif test "x$OPENJDK_TARGET_OS" != xwindows; then
618 AC_PATH_PROG(OTOOL, otool)
619 if test "x$OTOOL" = "x"; then
620 OTOOL="true"
621 fi
622 AC_CHECK_TOOL(NM, nm)
623 BASIC_FIXUP_EXECUTABLE(NM)
624 GNM="$NM"
625 AC_SUBST(GNM)
626 AC_CHECK_TOOL(STRIP, strip)
627 BASIC_FIXUP_EXECUTABLE(STRIP)
628 fi
629
630 # objcopy is used for moving debug symbols to separate files when
631 # full debug symbols are enabled.
632 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
633 AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
634 # Only call fixup if objcopy was found.
635 if test -n "$OBJCOPY"; then
636 BASIC_FIXUP_EXECUTABLE(OBJCOPY)
637 fi
638 fi
639
640 AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
641 if test "x$OBJDUMP" != x; then
642 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
643 BASIC_FIXUP_EXECUTABLE(OBJDUMP)
644 fi
645
646 TOOLCHAIN_SETUP_JTREG
647
648 # Restore old path without tools dir
649 PATH="$OLD_PATH"
650 ])
651
652
653 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
654 [
655
656 ###############################################################################
657 #
658 # How to compile shared libraries.
659 #
660
1396 # with path specified.
1397 JT_HOME="$with_jtreg"
1398 fi
1399
1400 if test "x$JT_HOME" != x; then
1401 AC_MSG_CHECKING([for jtreg])
1402
1403 # use JT_HOME enviroment var.
1404 BASIC_FIXUP_PATH([JT_HOME])
1405
1406 # jtreg win32 script works for everybody
1407 JTREGEXE="$JT_HOME/bin/jtreg"
1408
1409 if test ! -f "$JTREGEXE"; then
1410 AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
1411 fi
1412
1413 AC_MSG_RESULT($JTREGEXE)
1414 else
1415 # try to find jtreg on path
1416 BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
1417 JT_HOME="`$DIRNAME $JTREGEXE`"
1418 fi
1419 fi
1420
1421 AC_SUBST(JT_HOME)
1422 AC_SUBST(JTREGEXE)
1423 ])
1424
1425 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS],
1426 [
1427 # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
1428 # runs afoul of the more aggressive versions of these optimisations.
1429 # Notably, value range propagation now assumes that the this pointer of C++
1430 # member functions is non-null.
1431 NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
1432 TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
1433 [], [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
1434 AC_SUBST([NO_DELETE_NULL_POINTER_CHECKS_CFLAG])
1435 NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
1436 TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_LIFETIME_DSE_CFLAG -Werror],
|
248
249 AC_SUBST(MSVCR_DLL)
250
251 # If --build AND --host is set, then the configure script will find any
252 # cross compilation tools in the PATH. Cross compilation tools
253 # follows the cross compilation standard where they are prefixed with ${host}.
254 # For example the binary i686-sun-solaris2.10-gcc
255 # will cross compile for i686-sun-solaris2.10
256 # If neither of build and host is not set, then build=host and the
257 # default compiler found in the path will be used.
258 # Setting only --host, does not seem to be really supported.
259 # Please set both --build and --host if you want to cross compile.
260
261 if test "x$COMPILE_TYPE" = "xcross"; then
262 # Now we to find a C/C++ compiler that can build executables for the build
263 # platform. We can't use the AC_PROG_CC macro, since it can only be used
264 # once. Also, we need to do this before adding a tools dir to the path,
265 # otherwise we might pick up cross-compilers which don't use standard naming.
266 # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
267 # to wait until they are properly discovered.
268 BASIC_PATH_PROGS(BUILD_CC, [cl cc gcc])
269 BASIC_FIXUP_EXECUTABLE(BUILD_CC)
270 BASIC_PATH_PROGS(BUILD_CXX, [cl CC g++])
271 BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
272 BASIC_PATH_PROGS(BUILD_LD, ld)
273 BASIC_FIXUP_EXECUTABLE(BUILD_LD)
274 fi
275 AC_SUBST(BUILD_CC)
276 AC_SUBST(BUILD_CXX)
277 AC_SUBST(BUILD_LD)
278
279 # If a devkit is found on the builddeps server, then prepend its path to the
280 # PATH variable. If there are cross compilers available in the devkit, these
281 # will be found by AC_PROG_CC et al.
282 DEVKIT=
283 BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
284 [
285 # Found devkit
286 PATH="$DEVKIT/bin:$PATH"
287 SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
288 if test "x$x_includes" = "xNONE"; then
289 x_includes="$SYS_ROOT/usr/include/X11"
290 fi
291 if test "x$x_libraries" = "xNONE"; then
292 x_libraries="$SYS_ROOT/usr/lib"
453
454 # Restore the flags to the user specified values.
455 # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
456 CFLAGS="$ORG_CFLAGS"
457 CXXFLAGS="$ORG_CXXFLAGS"
458 OBJCFLAGS="$ORG_OBJCFLAGS"
459
460 LD="$CC"
461 LDEXE="$CC"
462 LDCXX="$CXX"
463 LDEXECXX="$CXX"
464 AC_SUBST(LD)
465 # LDEXE is the linker to use, when creating executables.
466 AC_SUBST(LDEXE)
467 # Linking C++ libraries.
468 AC_SUBST(LDCXX)
469 # Linking C++ executables.
470 AC_SUBST(LDEXECXX)
471
472 if test "x$OPENJDK_TARGET_OS" != xwindows; then
473 BASIC_CHECK_TOOLS(AR, ar)
474 BASIC_FIXUP_EXECUTABLE(AR)
475 fi
476 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
477 ARFLAGS="-r"
478 elif test "x$OPENJDK_TARGET_OS" = xaix; then
479 ARFLAGS="-X64"
480 else
481 ARFLAGS=""
482 fi
483 AC_SUBST(ARFLAGS)
484
485 # For hotspot, we need these in Windows mixed path; other platforms keep them the same
486 HOTSPOT_CXX="$CXX"
487 HOTSPOT_LD="$LD"
488 AC_SUBST(HOTSPOT_CXX)
489 AC_SUBST(HOTSPOT_LD)
490
491 COMPILER_NAME=gcc
492 COMPILER_TYPE=CC
493 AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
581 # building the build platform executables. The cross-compilation
582 # case needed to be done earlier, but this can only be done after
583 # the native tools have been localized.
584 BUILD_CC="$CC"
585 BUILD_CXX="$CXX"
586 BUILD_LD="$LD"
587 fi
588
589 # for solaris we really need solaris tools, and not gnu equivalent
590 # these seems to normally reside in /usr/ccs/bin so add that to path before
591 # starting to probe
592 #
593 # NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH
594 # so that it can be overriden --with-tools-dir
595 if test "x$OPENJDK_BUILD_OS" = xsolaris; then
596 PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
597 fi
598
599 # Find the right assembler.
600 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
601 BASIC_PATH_PROGS(AS, as)
602 BASIC_FIXUP_EXECUTABLE(AS)
603 else
604 AS="$CC -c"
605 fi
606 AC_SUBST(AS)
607
608 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
609 BASIC_PATH_PROGS(NM, nm)
610 BASIC_FIXUP_EXECUTABLE(NM)
611 BASIC_PATH_PROGS(GNM, gnm)
612 BASIC_FIXUP_EXECUTABLE(GNM)
613 BASIC_PATH_PROGS(STRIP, strip)
614 BASIC_FIXUP_EXECUTABLE(STRIP)
615 BASIC_PATH_PROGS(MCS, mcs)
616 BASIC_FIXUP_EXECUTABLE(MCS)
617 elif test "x$OPENJDK_TARGET_OS" != xwindows; then
618 AC_PATH_PROG(OTOOL, otool)
619 if test "x$OTOOL" = "x"; then
620 OTOOL="true"
621 fi
622 BASIC_CHECK_TOOLS(NM, nm)
623 BASIC_FIXUP_EXECUTABLE(NM)
624 GNM="$NM"
625 AC_SUBST(GNM)
626 BASIC_CHECK_TOOLS(STRIP, strip)
627 BASIC_FIXUP_EXECUTABLE(STRIP)
628 fi
629
630 # objcopy is used for moving debug symbols to separate files when
631 # full debug symbols are enabled.
632 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
633 BASIC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
634 # Only call fixup if objcopy was found.
635 if test -n "$OBJCOPY"; then
636 BASIC_FIXUP_EXECUTABLE(OBJCOPY)
637 fi
638 fi
639
640 BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
641 if test "x$OBJDUMP" != x; then
642 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
643 BASIC_FIXUP_EXECUTABLE(OBJDUMP)
644 fi
645
646 TOOLCHAIN_SETUP_JTREG
647
648 # Restore old path without tools dir
649 PATH="$OLD_PATH"
650 ])
651
652
653 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
654 [
655
656 ###############################################################################
657 #
658 # How to compile shared libraries.
659 #
660
1396 # with path specified.
1397 JT_HOME="$with_jtreg"
1398 fi
1399
1400 if test "x$JT_HOME" != x; then
1401 AC_MSG_CHECKING([for jtreg])
1402
1403 # use JT_HOME enviroment var.
1404 BASIC_FIXUP_PATH([JT_HOME])
1405
1406 # jtreg win32 script works for everybody
1407 JTREGEXE="$JT_HOME/bin/jtreg"
1408
1409 if test ! -f "$JTREGEXE"; then
1410 AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
1411 fi
1412
1413 AC_MSG_RESULT($JTREGEXE)
1414 else
1415 # try to find jtreg on path
1416 BASIC_REQUIRE_PROGS(JTREGEXE, jtreg)
1417 JT_HOME="`$DIRNAME $JTREGEXE`"
1418 fi
1419 fi
1420
1421 AC_SUBST(JT_HOME)
1422 AC_SUBST(JTREGEXE)
1423 ])
1424
1425 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS],
1426 [
1427 # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
1428 # runs afoul of the more aggressive versions of these optimisations.
1429 # Notably, value range propagation now assumes that the this pointer of C++
1430 # member functions is non-null.
1431 NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
1432 TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
1433 [], [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
1434 AC_SUBST([NO_DELETE_NULL_POINTER_CHECKS_CFLAG])
1435 NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
1436 TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_LIFETIME_DSE_CFLAG -Werror],
|