common/autoconf/basics.m4

changeset 2215
7a73b8b4ac8a
parent 2214
fda76d0c4b84
child 2219
cb1203f48728
equal deleted inserted replaced
2214:fda76d0c4b84 2215:7a73b8b4ac8a
44 ]) 44 ])
45 45
46 # Appends a string to a path variable, only adding the : when needed. 46 # Appends a string to a path variable, only adding the : when needed.
47 AC_DEFUN([BASIC_APPEND_TO_PATH], 47 AC_DEFUN([BASIC_APPEND_TO_PATH],
48 [ 48 [
49 if test "x[$]$1" = x; then 49 if test "x$2" != x; then
50 $1="$2" 50 if test "x[$]$1" = x; then
51 else 51 $1="$2"
52 $1="[$]$1:$2" 52 else
53 $1="[$]$1:$2"
54 fi
55 fi
56 ])
57
58 # Prepends 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
53 fi 67 fi
54 ]) 68 ])
55 69
56 # This will make sure the given variable points to a full and proper 70 # This will make sure the given variable points to a full and proper
57 # path. This means: 71 # path. This means:
440 # SRC_ROOT is a traditional alias for TOPDIR. 454 # SRC_ROOT is a traditional alias for TOPDIR.
441 SRC_ROOT=$TOPDIR 455 SRC_ROOT=$TOPDIR
442 456
443 # Locate the directory of this script. 457 # Locate the directory of this script.
444 AUTOCONF_DIR=$TOPDIR/common/autoconf 458 AUTOCONF_DIR=$TOPDIR/common/autoconf
459 ])
460
461 AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
462 [
463 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
464 [use this devkit for compilers, tools and resources])],
465 [
466 BASIC_FIXUP_PATH([with_devkit])
467 DEVKIT_ROOT="$with_devkit"
468 # Check for a meta data info file in the root of the devkit
469 if test -f "$DEVKIT_ROOT/devkit.info"; then
470 # This potentially sets the following:
471 # DEVKIT_NAME: A descriptive name of the devkit
472 # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path
473 # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path
474 # DEVKIT_SYSROOT: Corresponds to --with-sysroot
475 . $DEVKIT_ROOT/devkit.info
476 fi
477
478 AC_MSG_CHECKING([for devkit])
479 if test "x$DEVKIT_NAME" != x; then
480 AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
481 else
482 AC_MSG_RESULT([$DEVKIT_ROOT])
483 fi
484
485 if test "x$DEVKIT_EXTRA_PATH" != x; then
486 BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
487 fi
488
489 # Fallback default of just /bin if DEVKIT_PATH is not defined
490 if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
491 DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
492 fi
493 BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
494
495 # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
496 # places for backwards compatiblity.
497 if test "x$DEVKIT_SYSROOT" != x; then
498 SYSROOT="$DEVKIT_SYSROOT"
499 elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
500 SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
501 elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
502 SYSROOT="$DEVKIT_ROOT/$host/sys-root"
503 fi
504 ]
505 )
506
507 # You can force the sysroot if the sysroot encoded into the compiler tools
508 # is not correct.
509 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
510 [alias for --with-sysroot for backwards compatability])],
511 [SYSROOT=$with_sys_root]
512 )
513
514 AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
515 [use this directory as sysroot)])],
516 [SYSROOT=$with_sysroot]
517 )
518
519 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
520 [alias for --with-toolchain-path for backwards compatibility])],
521 [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
522 )
523
524 AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
525 [prepend these directories when searching for toolchain binaries (compilers etc)])],
526 [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
527 )
528
529 AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
530 [prepend these directories to the default path])],
531 [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
532 )
533
534 # Prepend the extra path to the global path
535 BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
445 536
446 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then 537 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
447 # Add extra search paths on solaris for utilities like ar and as etc... 538 # 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" 539 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
449 fi 540 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 541
468 # Xcode version will be validated later 542 # Xcode version will be validated later
469 AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path], 543 AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
470 [explicit path to Xcode 4 (generally for building on 10.9 and later)])], 544 [explicit path to Xcode 4 (generally for building on 10.9 and later)])],
471 [XCODE_PATH=$with_xcode_path] 545 [XCODE_PATH=$with_xcode_path]
472 ) 546 )
473 547
474 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], 548 AC_MSG_CHECKING([for sysroot])
475 [use this directory as base for tools-dir and sys-root (for cross-compiling)])], 549 AC_MSG_RESULT([$SYSROOT])
476 [ 550 AC_MSG_CHECKING([for toolchain path])
477 if test "x$with_sys_root" != x; then 551 AC_MSG_RESULT([$TOOLCHAIN_PATH])
478 AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) 552 AC_MSG_CHECKING([for extra path])
479 fi 553 AC_MSG_RESULT([$EXTRA_PATH])
480 BASIC_FIXUP_PATH([with_devkit])
481 BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)
482 if test -d "$with_devkit/$host_alias/libc"; then
483 SYS_ROOT=$with_devkit/$host_alias/libc
484 elif test -d "$with_devkit/$host/sys-root"; then
485 SYS_ROOT=$with_devkit/$host/sys-root
486 fi
487 ])
488 ]) 554 ])
489 555
490 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], 556 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
491 [ 557 [
492 558
652 AC_PATH_PROGS(CHECK_MAKE, make) 718 AC_PATH_PROGS(CHECK_MAKE, make)
653 BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) 719 BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
654 fi 720 fi
655 721
656 if test "x$FOUND_MAKE" = x; then 722 if test "x$FOUND_MAKE" = x; then
657 if test "x$TOOLS_DIR" != x; then 723 if test "x$TOOLCHAIN_PATH" != x; then
658 # We have a tools-dir, check that as well before giving up. 724 # We have a toolchain path, check that as well before giving up.
659 OLD_PATH=$PATH 725 OLD_PATH=$PATH
660 PATH=$TOOLS_DIR:$PATH 726 PATH=$TOOLCHAIN_PATH:$PATH
661 AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) 727 AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
662 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) 728 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
663 if test "x$FOUND_MAKE" = x; then 729 if test "x$FOUND_MAKE" = x; then
664 AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) 730 AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
665 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) 731 BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])

mercurial