common/autoconf/basics.m4

Print this page




  26 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
  27 # If so, then append $1 to $2\
  28 # Also set JVM_ARG_OK to true/false depending on outcome.
  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 # This will make sure the given variable points to a full and proper
  47 # path. This means:
  48 # 1) There will be no spaces in the path. On posix platforms,
  49 #    spaces in the path will result in an error. On Windows,
  50 #    the path will be rewritten using short-style to be space-free.
  51 # 2) The path will be absolute, and it will be in unix-style (on
  52 #     cygwin).
  53 # $1: The name of the variable to fix
  54 AC_DEFUN([BASIC_FIXUP_PATH],
  55 [
  56   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  57     BASIC_FIXUP_PATH_CYGWIN($1)
  58   elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  59     BASIC_FIXUP_PATH_MSYS($1)
  60   else
  61     # We're on a posix platform. Hooray! :)
  62     path="[$]$1"
  63     has_space=`$ECHO "$path" | $GREP " "`
  64     if test "x$has_space" != x; then
  65       AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])


 334 BASIC_FIXUP_PATH(CURDIR)
 335 
 336 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
 337     # Add extra search paths on solaris for utilities like ar and as etc...
 338     PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
 339 fi
 340 
 341 # You can force the sys-root if the sys-root encoded into the cross compiler tools
 342 # is not correct.
 343 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
 344   [pass this sys-root to the compilers and tools (for cross-compiling)])])
 345 
 346 if test "x$with_sys_root" != x; then
 347   SYS_ROOT=$with_sys_root
 348 else
 349   SYS_ROOT=/
 350 fi
 351 AC_SUBST(SYS_ROOT)
 352 
 353 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
 354   [search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir])



 355 
 356 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
 357   [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
 358   [
 359     if test "x$with_sys_root" != x; then
 360       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
 361     fi
 362     if test "x$with_tools_dir" != x; then
 363       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time])
 364     fi
 365     TOOLS_DIR=$with_devkit/bin
 366     if test -d "$with_devkit/$host_alias/libc"; then
 367       SYS_ROOT=$with_devkit/$host_alias/libc
 368     elif test -d "$with_devkit/$host/sys-root"; then
 369       SYS_ROOT=$with_devkit/$host/sys-root
 370     fi
 371   ])
 372 
 373 ])
 374 
 375 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 376 [
 377 
 378 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 379         [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 380         [ CONF_NAME=${with_conf_name} ])
 381 
 382 # Test from where we are running configure, in or outside of src root.
 383 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
 384         || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
 385         || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
 386     # We are running configure from the src root.
 387     # Create a default ./build/target-variant-debuglevel output root.
 388     if test "x${CONF_NAME}" = x; then
 389         CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
 390     fi
 391     OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
 392     $MKDIR -p "$OUTPUT_ROOT"




  26 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
  27 # If so, then append $1 to $2\
  28 # Also set JVM_ARG_OK to true/false depending on outcome.
  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 " "`
  74     if test "x$has_space" != x; then
  75       AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])


 344 BASIC_FIXUP_PATH(CURDIR)
 345 
 346 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
 347     # Add extra search paths on solaris for utilities like ar and as etc...
 348     PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
 349 fi
 350 
 351 # You can force the sys-root if the sys-root encoded into the cross compiler tools
 352 # is not correct.
 353 AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
 354   [pass this sys-root to the compilers and tools (for cross-compiling)])])
 355 
 356 if test "x$with_sys_root" != x; then
 357   SYS_ROOT=$with_sys_root
 358 else
 359   SYS_ROOT=/
 360 fi
 361 AC_SUBST(SYS_ROOT)
 362 
 363 AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
 364   [search this directory for compilers and tools (for cross-compiling)])], 
 365   [TOOLS_DIR=$with_tools_dir
 366    BASIC_FIXUP_PATH([TOOLS_DIR])
 367   ])
 368 
 369 AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
 370   [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
 371   [
 372     if test "x$with_sys_root" != x; then
 373       AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
 374     fi
 375     BASIC_FIXUP_PATH([with_devkit])
 376     BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin)


 377     if test -d "$with_devkit/$host_alias/libc"; then
 378       SYS_ROOT=$with_devkit/$host_alias/libc
 379     elif test -d "$with_devkit/$host/sys-root"; then
 380       SYS_ROOT=$with_devkit/$host/sys-root
 381     fi
 382   ])

 383 ])
 384 
 385 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 386 [
 387 
 388 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 389         [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 390         [ CONF_NAME=${with_conf_name} ])
 391 
 392 # Test from where we are running configure, in or outside of src root.
 393 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
 394         || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
 395         || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
 396     # We are running configure from the src root.
 397     # Create a default ./build/target-variant-debuglevel output root.
 398     if test "x${CONF_NAME}" = x; then
 399         CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
 400     fi
 401     OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
 402     $MKDIR -p "$OUTPUT_ROOT"