< prev index next >

common/autoconf/basics.m4

Print this page




  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 " "`


 425     PATH_SEP=";"
 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   # Xcode version will be validated later
 469   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)])],
 471       [XCODE_PATH=$with_xcode_path]
 472   )
 473 
 474   AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
 475       [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
 476       [
 477         if test "x$with_sys_root" != x; then
 478           AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
 479         fi
 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 ])
 489 
 490 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 491 [
 492 
 493   AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 494       [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 495       [ CONF_NAME=${with_conf_name} ])
 496 
 497   # Test from where we are running configure, in or outside of src root.
 498   AC_MSG_CHECKING([where to store configuration])
 499   if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
 500       || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
 501       || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
 502     # We are running configure from the src root.
 503     # Create a default ./build/target-variant-debuglevel output root.
 504     if test "x${CONF_NAME}" = x; then
 505       AC_MSG_RESULT([in default location])
 506       CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
 507     else


 637   if test "x$MAKE" != x; then
 638     # User has supplied a make, test it.
 639     if test ! -f "$MAKE"; then
 640       AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.])
 641     fi
 642     BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE])
 643     if test "x$FOUND_MAKE" = x; then
 644       AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
 645     fi
 646   else
 647     # Try our hardest to locate a correct version of GNU make
 648     AC_PATH_PROGS(CHECK_GMAKE, gmake)
 649     BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
 650 
 651     if test "x$FOUND_MAKE" = x; then
 652       AC_PATH_PROGS(CHECK_MAKE, make)
 653       BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
 654     fi
 655 
 656     if test "x$FOUND_MAKE" = x; then
 657       if test "x$TOOLS_DIR" != x; then
 658         # We have a tools-dir, check that as well before giving up.
 659         OLD_PATH=$PATH
 660         PATH=$TOOLS_DIR:$PATH
 661         AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
 662         BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
 663         if test "x$FOUND_MAKE" = x; then
 664           AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
 665           BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])
 666         fi
 667         PATH=$OLD_PATH
 668       fi
 669     fi
 670 
 671     if test "x$FOUND_MAKE" = x; then
 672       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.])
 673     fi
 674   fi
 675 
 676   MAKE=$FOUND_MAKE
 677   AC_SUBST(MAKE)
 678   AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
 679 ])
 680 




  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 # 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
  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 " "`


 439     PATH_SEP=";"
 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 
 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)
 536 
 537   if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
 538     # Add extra search paths on solaris for utilities like ar and as etc...
 539     PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
 540   fi
 541 
 542   # Xcode version will be validated later
 543   AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
 544       [explicit path to Xcode 4 (generally for building on 10.9 and later)])],
 545       [XCODE_PATH=$with_xcode_path]
 546   )
 547 
 548   AC_MSG_CHECKING([for sysroot])
 549   AC_MSG_RESULT([$SYSROOT])
 550   AC_MSG_CHECKING([for toolchain path])
 551   AC_MSG_RESULT([$TOOLCHAIN_PATH])
 552   AC_MSG_CHECKING([for extra path])
 553   AC_MSG_RESULT([$EXTRA_PATH])








 554 ])
 555 
 556 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 557 [
 558 
 559   AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 560       [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 561       [ CONF_NAME=${with_conf_name} ])
 562 
 563   # Test from where we are running configure, in or outside of src root.
 564   AC_MSG_CHECKING([where to store configuration])
 565   if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
 566       || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
 567       || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
 568     # We are running configure from the src root.
 569     # Create a default ./build/target-variant-debuglevel output root.
 570     if test "x${CONF_NAME}" = x; then
 571       AC_MSG_RESULT([in default location])
 572       CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
 573     else


 703   if test "x$MAKE" != x; then
 704     # User has supplied a make, test it.
 705     if test ! -f "$MAKE"; then
 706       AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.])
 707     fi
 708     BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE])
 709     if test "x$FOUND_MAKE" = x; then
 710       AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
 711     fi
 712   else
 713     # Try our hardest to locate a correct version of GNU make
 714     AC_PATH_PROGS(CHECK_GMAKE, gmake)
 715     BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
 716 
 717     if test "x$FOUND_MAKE" = x; then
 718       AC_PATH_PROGS(CHECK_MAKE, make)
 719       BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
 720     fi
 721 
 722     if test "x$FOUND_MAKE" = x; then
 723       if test "x$TOOLCHAIN_PATH" != x; then
 724         # We have a toolchain path, check that as well before giving up.
 725         OLD_PATH=$PATH
 726         PATH=$TOOLCHAIN_PATH:$PATH
 727         AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
 728         BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
 729         if test "x$FOUND_MAKE" = x; then
 730           AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
 731           BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])
 732         fi
 733         PATH=$OLD_PATH
 734       fi
 735     fi
 736 
 737     if test "x$FOUND_MAKE" = x; then
 738       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.])
 739     fi
 740   fi
 741 
 742   MAKE=$FOUND_MAKE
 743   AC_SUBST(MAKE)
 744   AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
 745 ])
 746 


< prev index next >