29 AC_DEFUN([ADD_JVM_ARG_IF_OK], 30 [ 31 $ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD 32 $ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD 33 OUTPUT=`$3 $1 -version 2>&1` 34 FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn` 35 FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""` 36 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then 37 $2="[$]$2 $1" 38 JVM_ARG_OK=true 39 else 40 $ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD 41 $ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD 42 JVM_ARG_OK=false 43 fi 44 ]) 45 46 # Appends a string to a path variable, only adding the : when needed. 47 AC_DEFUN([BASIC_APPEND_TO_PATH], 48 [ 49 if test "x[$]$1" = x; then 50 $1="$2" 51 else 52 $1="[$]$1:$2" 53 fi 54 ]) 55 56 # This will make sure the given variable points to a full and proper 57 # path. This means: 58 # 1) There will be no spaces in the path. On posix platforms, 59 # spaces in the path will result in an error. On Windows, 60 # the path will be rewritten using short-style to be space-free. 61 # 2) The path will be absolute, and it will be in unix-style (on 62 # cygwin). 63 # $1: The name of the variable to fix 64 AC_DEFUN([BASIC_FIXUP_PATH], 65 [ 66 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then 67 BASIC_FIXUP_PATH_CYGWIN($1) 68 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then 69 BASIC_FIXUP_PATH_MSYS($1) 70 else 71 # We're on a posix platform. Hooray! :) 72 path="[$]$1" 73 has_space=`$ECHO "$path" | $GREP " "` 426 BASIC_CHECK_PATHS_WINDOWS 427 else 428 PATH_SEP=":" 429 fi 430 AC_SUBST(PATH_SEP) 431 432 # We get the top-level directory from the supporting wrappers. 433 AC_MSG_CHECKING([for top-level directory]) 434 AC_MSG_RESULT([$TOPDIR]) 435 AC_SUBST(TOPDIR) 436 437 # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. 438 BASIC_FIXUP_PATH(CURDIR) 439 BASIC_FIXUP_PATH(TOPDIR) 440 # SRC_ROOT is a traditional alias for TOPDIR. 441 SRC_ROOT=$TOPDIR 442 443 # Locate the directory of this script. 444 AUTOCONF_DIR=$TOPDIR/common/autoconf 445 446 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then 447 # Add extra search paths on solaris for utilities like ar and as etc... 448 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" 449 fi 450 451 # You can force the sys-root if the sys-root encoded into the cross compiler tools 452 # is not correct. 453 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], 454 [pass this sys-root to the compilers and tools (for cross-compiling)])]) 455 456 if test "x$with_sys_root" != x; then 457 SYS_ROOT=$with_sys_root 458 else 459 SYS_ROOT=/ 460 fi 461 AC_SUBST(SYS_ROOT) 462 463 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], 464 [search this directory for compilers and tools (for cross-compiling)])], 465 [TOOLS_DIR=$with_tools_dir] 466 ) 467 468 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], 469 [use this directory as base for tools-dir and sys-root (for cross-compiling)])], 470 [ 471 if test "x$with_sys_root" != x; then 472 AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) 473 fi 474 BASIC_FIXUP_PATH([with_devkit]) 475 BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin) 476 if test -d "$with_devkit/$host_alias/libc"; then 477 SYS_ROOT=$with_devkit/$host_alias/libc 478 elif test -d "$with_devkit/$host/sys-root"; then 479 SYS_ROOT=$with_devkit/$host/sys-root 480 fi 481 ]) 482 ]) 483 484 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], 485 [ 486 487 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], 488 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], 489 [ CONF_NAME=${with_conf_name} ]) 490 491 # Test from where we are running configure, in or outside of src root. 492 AC_MSG_CHECKING([where to store configuration]) 493 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \ 494 || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \ 495 || test "x$CURDIR" = "x$SRC_ROOT/make" ; then 496 # We are running configure from the src root. 497 # Create a default ./build/target-variant-debuglevel output root. 498 if test "x${CONF_NAME}" = x; then 499 AC_MSG_RESULT([in default location]) 500 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" 501 else 631 if test "x$MAKE" != x; then 632 # User has supplied a make, test it. 633 if test ! -f "$MAKE"; then 634 AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.]) 635 fi 636 BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE]) 637 if test "x$FOUND_MAKE" = x; then 638 AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.]) 639 fi 640 else 641 # Try our hardest to locate a correct version of GNU make 642 AC_PATH_PROGS(CHECK_GMAKE, gmake) 643 BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) 644 645 if test "x$FOUND_MAKE" = x; then 646 AC_PATH_PROGS(CHECK_MAKE, make) 647 BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) 648 fi 649 650 if test "x$FOUND_MAKE" = x; then 651 if test "x$TOOLS_DIR" != x; then 652 # We have a tools-dir, check that as well before giving up. 653 OLD_PATH=$PATH 654 PATH=$TOOLS_DIR:$PATH 655 AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) 656 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) 657 if test "x$FOUND_MAKE" = x; then 658 AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) 659 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) 660 fi 661 PATH=$OLD_PATH 662 fi 663 fi 664 665 if test "x$FOUND_MAKE" = x; then 666 AC_MSG_ERROR([Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.]) 667 fi 668 fi 669 670 MAKE=$FOUND_MAKE 671 AC_SUBST(MAKE) 672 AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)]) 673 ]) 674 | 29 AC_DEFUN([ADD_JVM_ARG_IF_OK], 30 [ 31 $ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD 32 $ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD 33 OUTPUT=`$3 $1 -version 2>&1` 34 FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn` 35 FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""` 36 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then 37 $2="[$]$2 $1" 38 JVM_ARG_OK=true 39 else 40 $ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD 41 $ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD 42 JVM_ARG_OK=false 43 fi 44 ]) 45 46 # Appends a string to a path variable, only adding the : when needed. 47 AC_DEFUN([BASIC_APPEND_TO_PATH], 48 [ 49 if test "x$2" != x; then 50 if test "x[$]$1" = x; then 51 $1="$2" 52 else 53 $1="[$]$1:$2" 54 fi 55 fi 56 ]) 57 58 # Appends a string to a path variable, only adding the : when needed. 59 AC_DEFUN([BASIC_PREPEND_TO_PATH], 60 [ 61 if test "x$2" != x; then 62 if test "x[$]$1" = x; then 63 $1="$2" 64 else 65 $1="$2:[$]$1" 66 fi 67 fi 68 ]) 69 70 # This will make sure the given variable points to a full and proper 71 # path. This means: 72 # 1) There will be no spaces in the path. On posix platforms, 73 # spaces in the path will result in an error. On Windows, 74 # the path will be rewritten using short-style to be space-free. 75 # 2) The path will be absolute, and it will be in unix-style (on 76 # cygwin). 77 # $1: The name of the variable to fix 78 AC_DEFUN([BASIC_FIXUP_PATH], 79 [ 80 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then 81 BASIC_FIXUP_PATH_CYGWIN($1) 82 elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then 83 BASIC_FIXUP_PATH_MSYS($1) 84 else 85 # We're on a posix platform. Hooray! :) 86 path="[$]$1" 87 has_space=`$ECHO "$path" | $GREP " "` 440 BASIC_CHECK_PATHS_WINDOWS 441 else 442 PATH_SEP=":" 443 fi 444 AC_SUBST(PATH_SEP) 445 446 # We get the top-level directory from the supporting wrappers. 447 AC_MSG_CHECKING([for top-level directory]) 448 AC_MSG_RESULT([$TOPDIR]) 449 AC_SUBST(TOPDIR) 450 451 # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. 452 BASIC_FIXUP_PATH(CURDIR) 453 BASIC_FIXUP_PATH(TOPDIR) 454 # SRC_ROOT is a traditional alias for TOPDIR. 455 SRC_ROOT=$TOPDIR 456 457 # Locate the directory of this script. 458 AUTOCONF_DIR=$TOPDIR/common/autoconf 459 460 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], 461 [use this directory as base for tools-dir and sys-root (for cross-compiling)])], 462 [ 463 BASIC_FIXUP_PATH([with_devkit]) 464 DEVKIT_ROOT="$with_devkit" 465 # Check for a meta data info file in the root of the devkit 466 if test -f "$DEVKIT_ROOT/devkit.info"; then 467 # This potentially sets the following: 468 # DEVKIT_NAME: A descriptive name of the devkit 469 # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path 470 # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path 471 # DEVKIT_SYSROOT: Corresponds to --with-sysroot 472 . $DEVKIT_ROOT/devkit.info 473 fi 474 475 AC_MSG_CHECKING([for devkit]) 476 if test "x$DEVKIT_NAME" != x; then 477 AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT]) 478 else 479 AC_MSG_RESULT([$DEVKIT_ROOT]) 480 fi 481 482 if test "x$DEVKIT_EXTRA_PATH" != x; then 483 BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) 484 fi 485 486 # Fallback default of just /bin if DEVKIT_PATH is not defined 487 if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then 488 DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" 489 fi 490 BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH) 491 492 # If a separate sysroot has not been defined, use the one in the devkit 493 if test "x$DEVKIT_SYSROOT" != x; then 494 SYSROOT="$DEVKIT_SYSROOT" 495 elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then 496 SYSROOT="$DEVKIT_ROOT/$host_alias/libc" 497 elif test -d "$DEVKIT_ROOT/$host/sys-root"; then 498 SYSROOT="$DEVKIT_ROOT/$host/sys-root" 499 fi 500 ] 501 ) 502 503 # You can force the sysroot if the sysroot encoded into the cross compiler tools 504 # is not correct. 505 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], 506 [alias for --with-sysroot for backwards compatability])], 507 [SYSROOT=$with_sys_root] 508 ) 509 510 AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot], 511 [use this directory as sysroot)])], 512 [SYSROOT=$with_sysroot] 513 ) 514 515 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], 516 [alias for --with-toolchain-path for backwards compatibility])], 517 [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)] 518 ) 519 520 AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path], 521 [prepend these directories when searching for toolchain binaries (compilers etc)])], 522 [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)] 523 ) 524 525 AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path], 526 [prepend these directories to the default path])], 527 [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)] 528 ) 529 530 # Prepend the extra path to the global path 531 BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH) 532 533 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then 534 # Add extra search paths on solaris for utilities like ar and as etc... 535 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" 536 fi 537 538 AC_MSG_CHECKING([for sysroot]) 539 AC_MSG_RESULT([$SYSROOT]) 540 AC_MSG_CHECKING([for toolchain path]) 541 AC_MSG_RESULT([$TOOLCHAIN_PATH]) 542 AC_MSG_CHECKING([for extra path]) 543 AC_MSG_RESULT([$EXTRA_PATH]) 544 ]) 545 546 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], 547 [ 548 549 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], 550 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], 551 [ CONF_NAME=${with_conf_name} ]) 552 553 # Test from where we are running configure, in or outside of src root. 554 AC_MSG_CHECKING([where to store configuration]) 555 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \ 556 || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \ 557 || test "x$CURDIR" = "x$SRC_ROOT/make" ; then 558 # We are running configure from the src root. 559 # Create a default ./build/target-variant-debuglevel output root. 560 if test "x${CONF_NAME}" = x; then 561 AC_MSG_RESULT([in default location]) 562 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" 563 else 693 if test "x$MAKE" != x; then 694 # User has supplied a make, test it. 695 if test ! -f "$MAKE"; then 696 AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.]) 697 fi 698 BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE]) 699 if test "x$FOUND_MAKE" = x; then 700 AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.]) 701 fi 702 else 703 # Try our hardest to locate a correct version of GNU make 704 AC_PATH_PROGS(CHECK_GMAKE, gmake) 705 BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) 706 707 if test "x$FOUND_MAKE" = x; then 708 AC_PATH_PROGS(CHECK_MAKE, make) 709 BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) 710 fi 711 712 if test "x$FOUND_MAKE" = x; then 713 if test "x$TOOLCHAIN_PATH" != x; then 714 # We have a toolchain path, check that as well before giving up. 715 OLD_PATH=$PATH 716 PATH=$TOOLCHAIN_PATH:$PATH 717 AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) 718 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) 719 if test "x$FOUND_MAKE" = x; then 720 AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) 721 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) 722 fi 723 PATH=$OLD_PATH 724 fi 725 fi 726 727 if test "x$FOUND_MAKE" = x; then 728 AC_MSG_ERROR([Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.]) 729 fi 730 fi 731 732 MAKE=$FOUND_MAKE 733 AC_SUBST(MAKE) 734 AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)]) 735 ]) 736 |