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


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


 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 devkit for compilers, tools and resources])],
 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 DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
 493         # places for backwards compatiblity.
 494         if test "x$DEVKIT_SYSROOT" != x; then
 495           SYSROOT="$DEVKIT_SYSROOT"
 496         elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
 497           SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
 498         elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
 499           SYSROOT="$DEVKIT_ROOT/$host/sys-root"
 500         fi
 501       ]
 502   )
 503 
 504   # You can force the sysroot if the sysroot encoded into the compiler tools
 505   # is not correct.
 506   AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
 507       [alias for --with-sysroot for backwards compatability])],
 508       [SYSROOT=$with_sys_root]
 509   )
 510 
 511   AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
 512       [use this directory as sysroot)])],
 513       [SYSROOT=$with_sysroot]
 514   )


 515 
 516   AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
 517       [alias for --with-toolchain-path for backwards compatibility])],
 518       [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
 519   )
 520 
 521   AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
 522       [prepend these directories when searching for toolchain binaries (compilers etc)])],
 523       [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
 524   )
 525 
 526   AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
 527       [prepend these directories to the default path])],
 528       [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
 529   )
 530 
 531   # Prepend the extra path to the global path
 532   BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
 533 
 534   if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
 535     # Add extra search paths on solaris for utilities like ar and as etc...
 536     PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
 537   fi
 538 
 539   AC_MSG_CHECKING([for sysroot])
 540   AC_MSG_RESULT([$SYSROOT])
 541   AC_MSG_CHECKING([for toolchain path])
 542   AC_MSG_RESULT([$TOOLCHAIN_PATH])
 543   AC_MSG_CHECKING([for extra path])
 544   AC_MSG_RESULT([$EXTRA_PATH])
 545 ])
 546 
 547 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 548 [
 549 
 550   AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 551       [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 552       [ CONF_NAME=${with_conf_name} ])
 553 
 554   # Test from where we are running configure, in or outside of src root.
 555   AC_MSG_CHECKING([where to store configuration])
 556   if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
 557       || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
 558       || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
 559     # We are running configure from the src root.
 560     # Create a default ./build/target-variant-debuglevel output root.
 561     if test "x${CONF_NAME}" = x; then
 562       AC_MSG_RESULT([in default location])
 563       CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
 564     else


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