From e00f753d87153b526844946e15e4d5377a191a41 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 24 Feb 2014 13:29:26 +0100 Subject: [PATCH] 8035495: Improvements in autoconf integration Reviewed-by: mduigou, tbell --- common/autoconf/Makefile.in | 4 +- common/autoconf/autogen.sh | 42 ++-- common/autoconf/basics.m4 | 32 +-- common/autoconf/compare.sh.in | 4 +- common/autoconf/configure | 23 +- common/autoconf/configure.ac | 2 +- common/autoconf/generated-configure.sh | 278 +++++++++++++------------ common/autoconf/spec.gmk.in | 11 +- configure | 9 +- 9 files changed, 230 insertions(+), 175 deletions(-) diff --git a/common/autoconf/Makefile.in b/common/autoconf/Makefile.in index 000a9e73aa..6e47fe9eb1 100644 --- a/common/autoconf/Makefile.in +++ b/common/autoconf/Makefile.in @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -24,4 +24,4 @@ # This Makefile was generated by configure @DATE_WHEN_CONFIGURED@ # GENERATED FILE, DO NOT EDIT SPEC:=@OUTPUT_ROOT@/spec.gmk -include @SRC_ROOT@/Makefile +include @TOPDIR@/Makefile diff --git a/common/autoconf/autogen.sh b/common/autoconf/autogen.sh index 162f27833c..d1d8a0df16 100644 --- a/common/autoconf/autogen.sh +++ b/common/autoconf/autogen.sh @@ -22,6 +22,23 @@ # questions. # +generate_configure_script() { + # First create a header + cat > $1 << EOT +#!/bin/bash +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +EOT + # Then replace "magic" variables in configure.ac and append the output + # from autoconf. $2 is either cat (just a no-op) or a filter. + cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \ + eval $2 | ${AUTOCONF} -W all -I$script_dir - >> $1 + rm -rf autom4te.cache +} + script_dir=`dirname $0` # Create a timestamp as seconds since epoch @@ -36,7 +53,8 @@ else fi if test "x$CUSTOM_CONFIG_DIR" = "x"; then - custom_script_dir="$script_dir/../../closed/autoconf" + topdir=`cd $script_dir/../.. >/dev/null && pwd` + custom_script_dir="$topdir/closed/autoconf" else custom_script_dir=$CUSTOM_CONFIG_DIR fi @@ -45,25 +63,23 @@ custom_hook=$custom_script_dir/custom-hook.m4 AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`" -echo "Autoconf found: ${AUTOCONF}" - if test "x${AUTOCONF}" = x; then - echo You need autoconf installed to be able to regenerate the configure script - echo Error: Cannot find autoconf 1>&2 + echo "You need autoconf installed to be able to regenerate the configure script" + echo "Error: Cannot find autoconf" 1>&2 exit 1 fi -echo Generating generated-configure.sh with ${AUTOCONF} -cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh -rm -rf autom4te.cache +autoconf_version=`$AUTOCONF --version | head -1` +echo "Using autoconf at ${AUTOCONF} [$autoconf_version]" + +echo "Generating generated-configure.sh" +generate_configure_script "$script_dir/generated-configure.sh" 'cat' if test -e $custom_hook; then - echo Generating custom generated-configure.sh # We have custom sources available; also generate configure script # with custom hooks compiled in. - cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \ - sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh - rm -rf autom4te.cache + echo "Generating custom generated-configure.sh" + generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"' else - echo No custom hook found: $custom_hook + echo "(No custom hook found at $custom_hook)" fi diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 16e33447c3..092c959693 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -418,14 +418,21 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], # Setup basic configuration paths, and platform-specific stuff related to PATHs. AC_DEFUN_ONCE([BASIC_SETUP_PATHS], [ - # Locate the directory of this script. - SCRIPT="[$]0" - AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L` + # We get the top-level directory from the supporting wrappers. + AC_MSG_CHECKING([for top-level directory]) + AC_MSG_RESULT([$TOPDIR]) + BASIC_FIXUP_PATH(TOPDIR) + AC_SUBST(TOPDIR) - # Where is the source? It is located two levels above the configure script. + # SRC_ROOT is a traditional alias for TOPDIR. + SRC_ROOT=$TOPDIR + + # Locate the directory of this script. + AUTOCONF_DIR=$TOPDIR/common/autoconf + + # Save the current directory this script was started from CURDIR="$PWD" - cd "$AUTOCONF_DIR/../.." - SRC_ROOT="`$THEPWDCMD -L`" + BASIC_FIXUP_PATH(CURDIR) if test "x$OPENJDK_TARGET_OS" = "xwindows"; then PATH_SEP=";" @@ -433,13 +440,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], else PATH_SEP=":" fi - - AC_SUBST(SRC_ROOT) AC_SUBST(PATH_SEP) - cd "$CURDIR" - - BASIC_FIXUP_PATH(SRC_ROOT) - BASIC_FIXUP_PATH(CURDIR) if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then # Add extra search paths on solaris for utilities like ar and as etc... @@ -487,13 +488,17 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], [ CONF_NAME=${with_conf_name} ]) # Test from where we are running configure, in or outside of src root. + AC_MSG_CHECKING([where to store configuration]) if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \ || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \ || test "x$CURDIR" = "x$SRC_ROOT/make" ; then # We are running configure from the src root. # Create a default ./build/target-variant-debuglevel output root. if test "x${CONF_NAME}" = x; then + AC_MSG_RESULT([in default location]) CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" + else + AC_MSG_RESULT([in build directory with custom name]) fi OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" $MKDIR -p "$OUTPUT_ROOT" @@ -509,6 +514,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` fi OUTPUT_ROOT="$CURDIR" + AC_MSG_RESULT([in current directory]) # WARNING: This might be a bad thing to do. You need to be sure you want to # have a configuration in this directory. Do some sanity checks! diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in index eea3039c51..6eec8fa88c 100644 --- a/common/autoconf/compare.sh.in +++ b/common/autoconf/compare.sh.in @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -64,7 +64,7 @@ UNIQ="@UNIQ@" UNPACK200="@FIXPATH@ @BOOT_JDK@/bin/unpack200" UNZIP="@UNZIP@" -SRC_ROOT="@SRC_ROOT@" +SRC_ROOT="@TOPDIR@" if [ "$OPENJDK_TARGET_OS" = "windows" ]; then PATH="@VS_PATH@" diff --git a/common/autoconf/configure b/common/autoconf/configure index 1376f48874..d64b9354d4 100644 --- a/common/autoconf/configure +++ b/common/autoconf/configure @@ -22,18 +22,25 @@ # questions. # -if test "x$BASH_VERSION" = x; then - echo This script needs bash to run. - echo It is recommended to use the configure script in the source tree root instead. +if test "x$1" != xCHECKME; then + echo "This script cannot be run directly." + echo "Use the 'configure' script in the top-level directory instead." exit 1 fi -conf_script_dir=`dirname $0` +# Now the next argument is the absolute top-level directory path. +# The TOPDIR variable is passed on to configure.ac. +TOPDIR="$2" +# Remove these two arguments to get to the user supplied arguments +shift +shift + +conf_script_dir="$TOPDIR/common/autoconf" if [ "$CUSTOM_CONFIG_DIR" = "" ]; then - conf_custom_script_dir="$conf_script_dir/../../closed/autoconf" + conf_custom_script_dir="$TOPDIR/closed/autoconf" else - conf_custom_script_dir=$CUSTOM_CONFIG_DIR + conf_custom_script_dir="$CUSTOM_CONFIG_DIR" fi ### @@ -226,10 +233,10 @@ conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arg ### if test -e $conf_custom_script_dir/generated-configure.sh; then # Custom source configure available; run that instead - echo Running custom generated-configure.sh + echo "Running custom generated-configure.sh" conf_script_to_run=$conf_custom_script_dir/generated-configure.sh else - echo Running generated-configure.sh + echo "Running generated-configure.sh" conf_script_to_run=$conf_script_dir/generated-configure.sh fi diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 2a7d125c2f..29b678a8ed 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -33,7 +33,7 @@ AC_PREREQ([2.69]) AC_INIT(OpenJDK, jdk8, build-dev@openjdk.java.net,,http://openjdk.java.net) -AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_AUX_DIR([common/autoconf/build-aux]) m4_include([build-aux/pkg.m4]) # Include these first... diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 9e09ce14cd..b0852185ce 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -1,3 +1,9 @@ +#!/bin/bash +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for OpenJDK jdk8. @@ -877,7 +883,7 @@ BUILD_LOG_PREVIOUS BUILD_LOG SYS_ROOT PATH_SEP -SRC_ROOT +TOPDIR ZERO_ARCHDEF DEFINE_CROSS_COMPILE_ARCH LP64 @@ -3156,7 +3162,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= -for ac_dir in build-aux "$srcdir"/build-aux; do +for ac_dir in common/autoconf/build-aux "$srcdir"/common/autoconf/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -3172,7 +3178,7 @@ for ac_dir in build-aux "$srcdir"/build-aux; do fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in common/autoconf/build-aux \"$srcdir\"/common/autoconf/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -3274,7 +3280,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Include these first... # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -4214,7 +4220,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1393240361 +DATE_WHEN_GENERATED=1393244882 ############################################################################### # @@ -13863,121 +13869,17 @@ $as_echo "$COMPILE_TYPE" >&6; } # Continue setting up basic stuff. Most remaining code require fundamental tools. - # Locate the directory of this script. - SCRIPT="$0" - AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L` - - # Where is the source? It is located two levels above the configure script. - CURDIR="$PWD" - cd "$AUTOCONF_DIR/../.." - SRC_ROOT="`$THEPWDCMD -L`" - - if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - PATH_SEP=";" - - SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m` - if test $SRC_ROOT_LENGTH -gt 100; then - as_fn_error $? "Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported" "$LINENO" 5 - fi - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin release" >&5 -$as_echo_n "checking cygwin release... " >&6; } - CYGWIN_VERSION=`$UNAME -r` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_VERSION" >&5 -$as_echo "$CYGWIN_VERSION" >&6; } - WINDOWS_ENV_VENDOR='cygwin' - WINDOWS_ENV_VERSION="$CYGWIN_VERSION" - - CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.` - if test "x$CYGWIN_VERSION_OK" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&5 -$as_echo "$as_me: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&6;} - as_fn_error $? "Cannot continue" "$LINENO" 5 - fi - if test "x$CYGPATH" = x; then - as_fn_error $? "Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5 -$as_echo_n "checking cygwin root directory as unix-style path... " >&6; } - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"` - # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. - CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5 -$as_echo "$CYGWIN_ROOT_PATH" >&6; } - WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH" - test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/` - if test "x$test_cygdrive_prefix" = x; then - as_fn_error $? "Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c." "$LINENO" 5 - fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking msys release" >&5 -$as_echo_n "checking msys release... " >&6; } - MSYS_VERSION=`$UNAME -r` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSYS_VERSION" >&5 -$as_echo "$MSYS_VERSION" >&6; } - - WINDOWS_ENV_VENDOR='msys' - WINDOWS_ENV_VERSION="$MSYS_VERSION" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking msys root directory as unix-style path" >&5 -$as_echo_n "checking msys root directory as unix-style path... " >&6; } - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"` - - windows_path="$MSYS_ROOT_PATH" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - unix_path=`$CYGPATH -u "$windows_path"` - MSYS_ROOT_PATH="$unix_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` - MSYS_ROOT_PATH="$unix_path" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSYS_ROOT_PATH" >&5 -$as_echo "$MSYS_ROOT_PATH" >&6; } - WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH" - else - as_fn_error $? "Unknown Windows environment. Neither cygwin nor msys was detected." "$LINENO" 5 - fi - - # Test if windows or unix (cygwin/msys) find is first in path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking what kind of 'find' is first on the PATH" >&5 -$as_echo_n "checking what kind of 'find' is first on the PATH... " >&6; } - FIND_BINARY_OUTPUT=`find --version 2>&1` - if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unix style" >&5 -$as_echo "unix style" >&6; } - elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows" >&5 -$as_echo "Windows" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools." >&5 -$as_echo "$as_me: Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools." >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: This will not work. Please correct and make sure /usr/bin (or similar) is first in path." >&5 -$as_echo "$as_me: This will not work. Please correct and make sure /usr/bin (or similar) is first in path." >&6;} - as_fn_error $? "Cannot continue" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 -$as_echo "unknown" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: It seems that your find utility is non-standard." >&5 -$as_echo "$as_me: WARNING: It seems that your find utility is non-standard." >&2;} - fi - - else - PATH_SEP=":" - fi - - - - cd "$CURDIR" - + # We get the top-level directory from the supporting wrappers. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for top-level directory" >&5 +$as_echo_n "checking for top-level directory... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOPDIR" >&5 +$as_echo "$TOPDIR" >&6; } if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. - path="$SRC_ROOT" + path="$TOPDIR" new_path=`$CYGPATH -u "$path"` # Cygwin tries to hide some aspects of the Windows file system, such that binaries are @@ -13989,9 +13891,9 @@ $as_echo "$as_me: WARNING: It seems that your find utility is non-standard." >&2 # It is also a way to make sure we got the proper file name for the real test later on. test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` if test "x$test_shortpath" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of SRC_ROOT, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of SRC_ROOT, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of SRC_ROOT" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of TOPDIR, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of TOPDIR" "$LINENO" 5 fi # Call helper function which possibly converts this using DOS-style short mode. @@ -14029,14 +13931,14 @@ $as_echo "$as_me: The path of SRC_ROOT, which resolves as \"$path\", is invalid. if test "x$path" != "x$new_path"; then - SRC_ROOT="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting SRC_ROOT to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting SRC_ROOT to \"$new_path\"" >&6;} + TOPDIR="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting TOPDIR to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting TOPDIR to \"$new_path\"" >&6;} fi elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - path="$SRC_ROOT" + path="$TOPDIR" has_colon=`$ECHO $path | $GREP ^.:` new_path="$path" if test "x$has_colon" = x; then @@ -14067,9 +13969,9 @@ $as_echo "$as_me: Rewriting SRC_ROOT to \"$new_path\"" >&6;} fi if test "x$path" != "x$new_path"; then - SRC_ROOT="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting SRC_ROOT to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting SRC_ROOT to \"$new_path\"" >&6;} + TOPDIR="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting TOPDIR to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting TOPDIR to \"$new_path\"" >&6;} fi # Save the first 10 bytes of this path to the storage, so fixpath can work. @@ -14077,24 +13979,34 @@ $as_echo "$as_me: Rewriting SRC_ROOT to \"$new_path\"" >&6;} else # We're on a posix platform. Hooray! :) - path="$SRC_ROOT" + path="$TOPDIR" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of SRC_ROOT, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of SRC_ROOT, which resolves as \"$path\", is invalid." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of TOPDIR, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." >&6;} as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 fi # Use eval to expand a potential ~ eval path="$path" if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of SRC_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5 + as_fn_error $? "The path of TOPDIR, which resolves as \"$path\", is not found." "$LINENO" 5 fi - SRC_ROOT="`cd "$path"; $THEPWDCMD -L`" + TOPDIR="`cd "$path"; $THEPWDCMD -L`" fi + + # SRC_ROOT is a traditional alias for TOPDIR. + SRC_ROOT=$TOPDIR + + # Locate the directory of this script. + AUTOCONF_DIR=$TOPDIR/common/autoconf + + # Save the current directory this script was started from + CURDIR="$PWD" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to @@ -14217,6 +14129,103 @@ $as_echo "$as_me: The path of CURDIR, which resolves as \"$path\", is invalid." fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + PATH_SEP=";" + + SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m` + if test $SRC_ROOT_LENGTH -gt 100; then + as_fn_error $? "Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported" "$LINENO" 5 + fi + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin release" >&5 +$as_echo_n "checking cygwin release... " >&6; } + CYGWIN_VERSION=`$UNAME -r` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_VERSION" >&5 +$as_echo "$CYGWIN_VERSION" >&6; } + WINDOWS_ENV_VENDOR='cygwin' + WINDOWS_ENV_VERSION="$CYGWIN_VERSION" + + CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.` + if test "x$CYGWIN_VERSION_OK" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&5 +$as_echo "$as_me: Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade." >&6;} + as_fn_error $? "Cannot continue" "$LINENO" 5 + fi + if test "x$CYGPATH" = x; then + as_fn_error $? "Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5 +$as_echo_n "checking cygwin root directory as unix-style path... " >&6; } + # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away + cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"` + # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. + CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5 +$as_echo "$CYGWIN_ROOT_PATH" >&6; } + WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH" + test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + as_fn_error $? "Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c." "$LINENO" 5 + fi + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking msys release" >&5 +$as_echo_n "checking msys release... " >&6; } + MSYS_VERSION=`$UNAME -r` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSYS_VERSION" >&5 +$as_echo "$MSYS_VERSION" >&6; } + + WINDOWS_ENV_VENDOR='msys' + WINDOWS_ENV_VERSION="$MSYS_VERSION" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking msys root directory as unix-style path" >&5 +$as_echo_n "checking msys root directory as unix-style path... " >&6; } + # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away + MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"` + + windows_path="$MSYS_ROOT_PATH" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + MSYS_ROOT_PATH="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + MSYS_ROOT_PATH="$unix_path" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSYS_ROOT_PATH" >&5 +$as_echo "$MSYS_ROOT_PATH" >&6; } + WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH" + else + as_fn_error $? "Unknown Windows environment. Neither cygwin nor msys was detected." "$LINENO" 5 + fi + + # Test if windows or unix (cygwin/msys) find is first in path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what kind of 'find' is first on the PATH" >&5 +$as_echo_n "checking what kind of 'find' is first on the PATH... " >&6; } + FIND_BINARY_OUTPUT=`find --version 2>&1` + if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unix style" >&5 +$as_echo "unix style" >&6; } + elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows" >&5 +$as_echo "Windows" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools." >&5 +$as_echo "$as_me: Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: This will not work. Please correct and make sure /usr/bin (or similar) is first in path." >&5 +$as_echo "$as_me: This will not work. Please correct and make sure /usr/bin (or similar) is first in path." >&6;} + as_fn_error $? "Cannot continue" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 +$as_echo "unknown" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: It seems that your find utility is non-standard." >&5 +$as_echo "$as_me: WARNING: It seems that your find utility is non-standard." >&2;} + fi + + else + PATH_SEP=":" + fi + + if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then # Add extra search paths on solaris for utilities like ar and as etc... PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" @@ -14765,13 +14774,20 @@ fi # Test from where we are running configure, in or outside of src root. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to store configuration" >&5 +$as_echo_n "checking where to store configuration... " >&6; } if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \ || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \ || test "x$CURDIR" = "x$SRC_ROOT/make" ; then # We are running configure from the src root. # Create a default ./build/target-variant-debuglevel output root. if test "x${CONF_NAME}" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: in default location" >&5 +$as_echo "in default location" >&6; } CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: in build directory with custom name" >&5 +$as_echo "in build directory with custom name" >&6; } fi OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" $MKDIR -p "$OUTPUT_ROOT" @@ -14787,6 +14803,8 @@ fi CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` fi OUTPUT_ROOT="$CURDIR" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: in current directory" >&5 +$as_echo "in current directory" >&6; } # WARNING: This might be a bad thing to do. You need to be sure you want to # have a configuration in this directory. Do some sanity checks! diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index eef7263423..d09fb0ea1c 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -70,8 +70,8 @@ ifeq (,$(findstring -R,$(MAKE))) endif # Specify where the common include directory for makefiles is. -ifeq (,$(findstring -I @SRC_ROOT@/make/common,$(MAKE))) - MAKE:=$(MAKE) -I @SRC_ROOT@/make/common +ifeq (,$(findstring -I @TOPDIR@/make/common,$(MAKE))) + MAKE:=$(MAKE) -I @TOPDIR@/make/common endif # The "human readable" name of this configuration @@ -136,10 +136,13 @@ endif SYS_ROOT:=@SYS_ROOT@ # Paths to the source code -SRC_ROOT:=@SRC_ROOT@ ADD_SRC_ROOT:=@ADD_SRC_ROOT@ OVERRIDE_SRC_ROOT:=@OVERRIDE_SRC_ROOT@ -TOPDIR:=@SRC_ROOT@ + +# The top-level directory of the forest (SRC_ROOT is a traditional alias) +TOPDIR:=@TOPDIR@ +SRC_ROOT:=@TOPDIR@ + OUTPUT_ROOT:=@OUTPUT_ROOT@ JDK_TOPDIR:=@JDK_TOPDIR@ LANGTOOLS_TOPDIR:=@LANGTOOLS_TOPDIR@ diff --git a/configure b/configure index dbb1da1367..4ab8846d57 100644 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,5 +25,10 @@ # This is a thin wrapper which will call the real configure script, and # make sure that is called using bash. +# Get an absolute path to this script, since that determines the top-level directory. this_script_dir=`dirname $0` -bash $this_script_dir/common/autoconf/configure "$@" +this_script_dir=`cd $this_script_dir > /dev/null && pwd` + +# Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c. +# This trick is needed to get autoconf to co-operate properly. +bash -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@"