erikj@459: # erikj@459: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. erikj@459: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. erikj@459: # erikj@459: # This code is free software; you can redistribute it and/or modify it erikj@459: # under the terms of the GNU General Public License version 2 only, as erikj@459: # published by the Free Software Foundation. Oracle designates this erikj@459: # particular file as subject to the "Classpath" exception as provided erikj@459: # by Oracle in the LICENSE file that accompanied this code. erikj@459: # erikj@459: # This code is distributed in the hope that it will be useful, but WITHOUT erikj@459: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or erikj@459: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License erikj@459: # version 2 for more details (a copy is included in the LICENSE file that erikj@459: # accompanied this code). erikj@459: # erikj@459: # You should have received a copy of the GNU General Public License version erikj@459: # 2 along with this work; if not, write to the Free Software Foundation, erikj@459: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. erikj@459: # erikj@459: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA erikj@459: # or visit www.oracle.com if you need additional information or have any erikj@459: # questions. erikj@459: # erikj@459: erikj@459: AC_DEFUN([ADD_JVM_ARG_IF_OK], erikj@459: [ erikj@459: # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3) erikj@459: # If so, then append $1 to $2 erikj@459: FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn` erikj@459: FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""` erikj@459: if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then erikj@459: $2="[$]$2 $1" erikj@459: fi erikj@459: ]) erikj@459: ohair@478: AC_DEFUN([SET_FULL_PATH], erikj@459: [ erikj@459: # Translate "gcc -E" into "`which gcc` -E" ie erikj@459: # extract the full path to the binary and at the erikj@459: # same time maintain any arguments passed to it. erikj@459: # The command MUST exist in the path, or else! erikj@459: tmp="[$]$1" erikj@459: car="${tmp%% *}" erikj@459: tmp="[$]$1 EOL" erikj@459: cdr="${tmp#* }" erikj@459: # On windows we want paths without spaces. erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then ohair@478: SET_FULL_PATH_SPACESAFE(car) erikj@459: else erikj@459: # "which" is not portable, but is used here erikj@459: # because we know that the command exists! erikj@459: car=`which $car` erikj@459: fi erikj@459: if test "x$cdr" != xEOL; then erikj@459: $1="$car ${cdr% *}" erikj@459: else erikj@459: $1="$car" erikj@459: fi erikj@459: ]) erikj@459: erikj@459: AC_DEFUN([SPACESAFE], erikj@459: [ erikj@459: # Fail with message $2 if var $1 contains a path with no spaces in it. erikj@459: # Unless on Windows, where we can rewrite the path. erikj@459: HAS_SPACE=`echo "[$]$1" | grep " "` erikj@459: if test "x$HAS_SPACE" != x; then erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then ohair@478: # First convert it to DOS-style, short mode (no spaces) erikj@459: $1=`$CYGPATH -s -m -a "[$]$1"` ohair@478: # Now it's case insensitive; let's make it lowercase to improve readability ohair@478: $1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'` ohair@478: # Now convert it back to Unix-stile (cygpath) ohair@478: $1=`$CYGPATH -u "[$]$1"` erikj@459: else erikj@459: AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"]) erikj@459: fi erikj@459: fi erikj@459: ]) erikj@459: ohair@478: AC_DEFUN([SET_FULL_PATH_SPACESAFE], erikj@459: [ erikj@459: # Translate long cygdrive or C:\sdfsf path erikj@459: # into a short mixed mode path that has no erikj@459: # spaces in it. erikj@459: tmp="[$]$1" erikj@459: erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then erikj@459: tmp=`$CYGPATH -u "[$]$1"` erikj@459: tmp=`which "$tmp"` erikj@459: # If file exists with .exe appended, that's the real filename erikj@459: # and cygpath needs that to convert to short style path. erikj@459: if test -f "${tmp}.exe"; then erikj@459: tmp="${tmp}.exe" erikj@459: elif test -f "${tmp}.cmd"; then erikj@459: tmp="${tmp}.cmd" erikj@459: fi erikj@459: # Convert to C:/ mixed style path without spaces. erikj@459: tmp=`$CYGPATH -s -m "$tmp"` erikj@459: fi erikj@459: $1="$tmp" erikj@459: ]) erikj@459: erikj@459: AC_DEFUN([REMOVE_SYMBOLIC_LINKS], erikj@459: [ erikj@459: if test "x$OPENJDK_BUILD_OS" != xwindows; then erikj@459: # Follow a chain of symbolic links. Use readlink erikj@459: # where it exists, else fall back to horribly erikj@459: # complicated shell code. erikj@459: AC_PATH_PROG(READLINK, readlink) erikj@459: if test "x$READLINK_TESTED" != yes; then erikj@459: # On MacOSX there is a readlink tool with a different erikj@459: # purpose than the GNU readlink tool. Check the found readlink. erikj@459: ISGNU=`$READLINK --help 2>&1 | grep GNU` erikj@459: if test "x$ISGNU" = x; then erikj@459: # A readlink that we do not know how to use. erikj@459: # Are there other non-GNU readlinks out there? erikj@459: READLINK_TESTED=yes erikj@459: READLINK= erikj@459: fi erikj@459: fi erikj@459: erikj@459: if test "x$READLINK" != x; then erikj@459: $1=`$READLINK -f [$]$1` erikj@459: else erikj@459: STARTDIR=$PWD erikj@459: COUNTER=0 erikj@459: DIR=`dirname [$]$1` erikj@459: FIL=`basename [$]$1` erikj@459: while test $COUNTER -lt 20; do erikj@459: ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'` erikj@459: if test "x$ISLINK" == x; then erikj@459: # This is not a symbolic link! We are done! erikj@459: break erikj@459: fi erikj@459: # The link might be relative! We have to use cd to travel safely. erikj@459: cd $DIR erikj@459: cd `dirname $ISLINK` erikj@459: DIR=`pwd` erikj@459: FIL=`basename $ISLINK` erikj@459: let COUNTER=COUNTER+1 erikj@459: done erikj@459: cd $STARTDIR erikj@459: $1=$DIR/$FIL erikj@459: fi erikj@459: fi erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_INIT], erikj@459: [ erikj@459: # Save the original command line. This is passed to us by the wrapper configure script. erikj@459: AC_SUBST(CONFIGURE_COMMAND_LINE) erikj@459: DATE_WHEN_CONFIGURED=`LANG=C date` erikj@459: AC_SUBST(DATE_WHEN_CONFIGURED) ohair@478: ]) erikj@459: ohair@478: # Setup basic configuration paths, and platform-specific stuff related to PATHs. ohair@478: AC_DEFUN_ONCE([BASIC_SETUP_PATHS], ohair@478: [ erikj@459: # Locate the directory of this script. erikj@459: SCRIPT="[$]0" ohair@478: REMOVE_SYMBOLIC_LINKS(SCRIPT) erikj@459: AUTOCONF_DIR=`dirname [$]0` erikj@459: erikj@459: # Where is the source? It is located two levels above the configure script. erikj@459: CURDIR="$PWD" erikj@459: cd "$AUTOCONF_DIR/../.." erikj@459: SRC_ROOT="`pwd`" erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then erikj@459: SRC_ROOT_LENGTH=`pwd|wc -m` erikj@459: if test $SRC_ROOT_LENGTH -gt 100; then erikj@459: AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) erikj@459: fi erikj@459: fi erikj@459: AC_SUBST(SRC_ROOT) erikj@459: cd "$CURDIR" erikj@459: erikj@459: SPACESAFE(SRC_ROOT,[the path to the source root]) erikj@459: SPACESAFE(CURDIR,[the path to the current directory]) erikj@459: erikj@459: if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then erikj@459: # Add extra search paths on solaris for utilities like ar and as etc... erikj@459: PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" erikj@459: fi erikj@459: erikj@459: # For cygwin we need cygpath first, since it is used everywhere. erikj@459: AC_PATH_PROG(CYGPATH, cygpath) erikj@459: PATH_SEP=":" erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then erikj@459: if test "x$CYGPATH" = x; then erikj@459: AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) erikj@459: fi erikj@459: PATH_SEP=";" erikj@459: fi erikj@459: AC_SUBST(PATH_SEP) ohair@478: ohair@478: # You can force the sys-root if the sys-root encoded into the cross compiler tools ohair@478: # is not correct. ohair@478: AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], ohair@478: [pass this sys-root to the compilers and linker (useful if the sys-root encoded in ohair@478: the cross compiler tools is incorrect)])]) ohair@478: ohair@478: if test "x$with_sys_root" != x; then ohair@478: SYS_ROOT=$with_sys_root ohair@478: else ohair@478: SYS_ROOT=/ ohair@478: fi ohair@478: AC_SUBST(SYS_ROOT) ohair@478: ohair@478: AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], ohair@478: [search this directory for (cross-compiling) compilers and tools])], [TOOLS_DIR=$with_tools_dir]) ohair@478: ohair@478: AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], ohair@478: [use this directory as base for tools-dir and sys-root (for cross-compiling)])], ohair@478: [ ohair@478: if test "x$with_sys_root" != x; then ohair@478: AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) ohair@478: fi ohair@478: if test "x$with_tools_dir" != x; then ohair@478: AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time]) ohair@478: fi ohair@478: TOOLS_DIR=$with_devkit/bin ohair@478: SYS_ROOT=$with_devkit/$host_alias/libc ohair@478: ]) ohair@478: erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], erikj@459: [ erikj@459: erikj@459: AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], erikj@459: [use this as the name of the configuration, overriding the generated default])], erikj@459: [ CONF_NAME=${with_conf_name} ]) erikj@459: erikj@459: # Test from where we are running configure, in or outside of src root. erikj@459: 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/common/makefiles" ; then erikj@459: # We are running configure from the src root. erikj@459: # Create a default ./build/target-variant-debuglevel output root. erikj@459: if test "x${CONF_NAME}" = x; then erikj@459: CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}" erikj@459: fi erikj@459: OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" erikj@459: mkdir -p "$OUTPUT_ROOT" erikj@459: if test ! -d "$OUTPUT_ROOT"; then erikj@459: AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT]) erikj@459: fi erikj@459: else erikj@459: # We are running configure from outside of the src dir. erikj@459: # Then use the current directory as output dir! erikj@459: # If configuration is situated in normal build directory, just use the build erikj@459: # directory name as configuration name, otherwise use the complete path. erikj@459: if test "x${CONF_NAME}" = x; then erikj@459: CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` erikj@459: fi erikj@459: OUTPUT_ROOT="$CURDIR" erikj@459: fi erikj@459: erikj@459: SPACESAFE(OUTPUT_ROOT,[the path to the output root]) erikj@459: erikj@459: AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk) erikj@459: AC_SUBST(CONF_NAME, $CONF_NAME) erikj@459: AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT) erikj@459: erikj@459: # Most of the probed defines are put into config.h erikj@459: AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in]) erikj@459: # The spec.gmk file contains all variables for the make system. erikj@459: AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in]) ohair@478: # The hotspot-spec.gmk file contains legacy variables for the hotspot make system. ohair@478: AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in]) ohair@478: # The bootcycle-spec.gmk file contains support for boot cycle builds. ohair@478: AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in]) ohair@478: # The compare.sh is used to compare the build output to other builds. ohair@478: AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in]) ohair@478: # Spec.sh is currently used by compare-objects.sh erikj@459: AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in]) erikj@459: # The generated Makefile knows where the spec.gmk is and where the source is. erikj@459: # You can run make from the OUTPUT_ROOT, or from the top-level Makefile erikj@459: # which will look for generated configurations erikj@459: AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in]) erikj@459: erikj@459: # Save the arguments given to us erikj@459: echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_SETUP_LOGGING], erikj@459: [ erikj@459: # Setup default logging of stdout and stderr to build.log in the output root. erikj@459: BUILD_LOG='$(OUTPUT_ROOT)/build.log' erikj@459: BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old' erikj@459: BUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)' erikj@459: AC_SUBST(BUILD_LOG) erikj@459: AC_SUBST(BUILD_LOG_PREVIOUS) erikj@459: AC_SUBST(BUILD_LOG_WRAPPER) erikj@459: ]) erikj@459: erikj@459: erikj@459: #%%% Simple tools %%% erikj@459: ohair@478: # Check if we have found a usable version of make ohair@478: # $1: the path to a potential make binary (or empty) ohair@478: # $2: the description on how we found this ohair@478: AC_DEFUN([BASIC_CHECK_MAKE_VERSION], ohair@478: [ ohair@478: MAKE_CANDIDATE="$1" ohair@478: DESCRIPTION="$2" ohair@478: if test "x$MAKE_CANDIDATE" != x; then ohair@478: AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION]) ohair@478: SET_FULL_PATH(MAKE_CANDIDATE) ohair@478: MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1` ohair@478: IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'` ohair@478: if test "x$IS_GNU_MAKE" = x; then ohair@478: AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) ohair@478: else ohair@478: IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'` ohair@478: if test "x$IS_MODERN_MAKE" = x; then ohair@478: AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) ohair@478: else ohair@478: FOUND_MAKE=$MAKE_CANDIDATE ohair@478: fi ohair@478: fi ohair@478: fi ohair@478: ]) ohair@478: ohair@478: # Goes looking for a usable version of GNU make. ohair@478: AC_DEFUN([BASIC_CHECK_GNU_MAKE], ohair@478: [ ohair@478: # We need to find a recent version of GNU make. Especially on Solaris, this can be tricky. ohair@478: if test "x$MAKE" != x; then ohair@478: # User has supplied a make, test it. ohair@478: if test ! -f "$MAKE"; then ohair@478: AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.]) ohair@478: fi ohair@478: BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=]) ohair@478: if test "x$FOUND_MAKE" = x; then ohair@478: AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.]) ohair@478: fi ohair@478: else ohair@478: # Try our hardest to locate a correct version of GNU make ohair@478: AC_PATH_PROGS(CHECK_GMAKE, gmake) ohair@478: BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) ohair@478: ohair@478: if test "x$FOUND_MAKE" = x; then ohair@478: AC_PATH_PROGS(CHECK_MAKE, make) ohair@478: BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) ohair@478: fi ohair@478: ohair@478: if test "x$FOUND_MAKE" = x; then ohair@478: if test "x$TOOLS_DIR" != x; then ohair@478: # We have a tools-dir, check that as well before giving up. ohair@478: OLD_PATH=$PATH ohair@478: PATH=$TOOLS_DIR:$PATH ohair@478: AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) ohair@478: BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) ohair@478: if test "x$FOUND_MAKE" = x; then ohair@478: AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) ohair@478: BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) ohair@478: fi ohair@478: PATH=$OLD_PATH ohair@478: fi ohair@478: fi ohair@478: ohair@478: if test "x$FOUND_MAKE" = x; then ohair@478: 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.]) ohair@478: fi ohair@478: fi ohair@478: ohair@478: MAKE=$FOUND_MAKE ohair@478: AC_SUBST(MAKE) ohair@478: AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)]) ohair@478: ]) ohair@478: erikj@459: AC_DEFUN([BASIC_CHECK_FIND_DELETE], erikj@459: [ erikj@459: # Test if find supports -delete erikj@459: AC_MSG_CHECKING([if find supports -delete]) erikj@459: FIND_DELETE="-delete" erikj@459: erikj@459: DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?) erikj@459: erikj@459: echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete erikj@459: erikj@459: TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1` erikj@459: if test -f $DELETEDIR/TestIfFindSupportsDelete; then erikj@459: # No, it does not. erikj@459: rm $DELETEDIR/TestIfFindSupportsDelete erikj@459: FIND_DELETE="-exec rm \{\} \+" erikj@459: AC_MSG_RESULT([no]) erikj@459: else erikj@459: AC_MSG_RESULT([yes]) erikj@459: fi erikj@459: rmdir $DELETEDIR erikj@459: ]) erikj@459: ohair@478: # Test that variable $1 denoting a program is not empty. If empty, exit with an error. ohair@478: # $1: variable to check ohair@478: # $2: executable name to print in warning (optional) erikj@459: AC_DEFUN([CHECK_NONEMPTY], erikj@459: [ ohair@478: if test "x[$]$1" = x; then ohair@478: if test "x$2" = x; then ohair@478: PROG_NAME=translit($1,A-Z,a-z) ohair@478: else ohair@478: PROG_NAME=$2 ohair@478: fi ohair@478: AC_MSG_NOTICE([Could not find $PROG_NAME!]) ohair@478: AC_MSG_ERROR([Cannot continue]) ohair@478: fi ohair@478: ]) ohair@478: ohair@478: # Does AC_PATH_PROG followed by CHECK_NONEMPTY. ohair@478: # Arguments as AC_PATH_PROG: ohair@478: # $1: variable to set ohair@478: # $2: executable name to look for ohair@478: AC_DEFUN([BASIC_REQUIRE_PROG], ohair@478: [ ohair@478: AC_PATH_PROGS($1, $2) ohair@478: CHECK_NONEMPTY($1, $2) erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_SETUP_TOOLS], erikj@459: [ erikj@459: # Start with tools that do not need have cross compilation support erikj@459: # and can be expected to be found in the default PATH. These tools are erikj@459: # used by configure. Nor are these tools expected to be found in the erikj@459: # devkit from the builddeps server either, since they are ohair@478: # needed to download the devkit. ohair@478: ohair@478: # First are all the simple required tools. ohair@478: BASIC_REQUIRE_PROG(BASENAME, basename) ohair@478: BASIC_REQUIRE_PROG(CAT, cat) ohair@478: BASIC_REQUIRE_PROG(CHMOD, chmod) ohair@478: BASIC_REQUIRE_PROG(CMP, cmp) ohair@478: BASIC_REQUIRE_PROG(CP, cp) ohair@478: BASIC_REQUIRE_PROG(CPIO, cpio) ohair@478: BASIC_REQUIRE_PROG(CUT, cut) ohair@478: BASIC_REQUIRE_PROG(DATE, date) ohair@478: BASIC_REQUIRE_PROG(DF, df) ohair@478: BASIC_REQUIRE_PROG(DIFF, [gdiff diff]) ohair@478: BASIC_REQUIRE_PROG(ECHO, echo) ohair@478: BASIC_REQUIRE_PROG(EXPR, expr) ohair@478: BASIC_REQUIRE_PROG(FILE, file) ohair@478: BASIC_REQUIRE_PROG(FIND, find) ohair@478: BASIC_REQUIRE_PROG(HEAD, head) ohair@478: BASIC_REQUIRE_PROG(LN, ln) ohair@478: BASIC_REQUIRE_PROG(LS, ls) ohair@478: BASIC_REQUIRE_PROG(MKDIR, mkdir) ohair@478: BASIC_REQUIRE_PROG(MV, mv) ohair@478: BASIC_REQUIRE_PROG(PRINTF, printf) ohair@478: BASIC_REQUIRE_PROG(SH, sh) ohair@478: BASIC_REQUIRE_PROG(SORT, sort) ohair@478: BASIC_REQUIRE_PROG(TAIL, tail) ohair@478: BASIC_REQUIRE_PROG(TAR, tar) ohair@478: BASIC_REQUIRE_PROG(TEE, tee) ohair@478: BASIC_REQUIRE_PROG(TOUCH, touch) ohair@478: BASIC_REQUIRE_PROG(TR, tr) ohair@478: BASIC_REQUIRE_PROG(UNIQ, uniq) ohair@478: BASIC_REQUIRE_PROG(UNZIP, unzip) ohair@478: BASIC_REQUIRE_PROG(WC, wc) ohair@478: BASIC_REQUIRE_PROG(XARGS, xargs) ohair@478: BASIC_REQUIRE_PROG(ZIP, zip) ohair@478: ohair@478: # Then required tools that require some special treatment. erikj@459: AC_PROG_AWK erikj@459: CHECK_NONEMPTY(AWK) ohair@478: AC_PROG_GREP ohair@478: CHECK_NONEMPTY(GREP) erikj@459: AC_PROG_EGREP erikj@459: CHECK_NONEMPTY(EGREP) erikj@459: AC_PROG_FGREP erikj@459: CHECK_NONEMPTY(FGREP) ohair@478: AC_PROG_SED ohair@478: CHECK_NONEMPTY(SED) erikj@459: ohair@478: AC_PATH_PROGS(NAWK, [nawk gawk awk]) ohair@478: CHECK_NONEMPTY(NAWK) ohair@478: ohair@478: BASIC_CHECK_GNU_MAKE ohair@478: ohair@478: BASIC_REQUIRE_PROG(RM, rm) ohair@478: RM="$RM -f" ohair@478: erikj@459: BASIC_CHECK_FIND_DELETE erikj@459: AC_SUBST(FIND_DELETE) erikj@459: ohair@478: # Non-required basic tools ohair@478: erikj@459: AC_PATH_PROG(THEPWDCMD, pwd) erikj@459: AC_PATH_PROG(LDD, ldd) erikj@459: if test "x$LDD" = "x"; then erikj@459: # List shared lib dependencies is used for erikj@459: # debug output and checking for forbidden dependencies. erikj@459: # We can build without it. erikj@459: LDD="true" erikj@459: fi erikj@459: AC_PATH_PROG(OTOOL, otool) erikj@459: if test "x$OTOOL" = "x"; then erikj@459: OTOOL="true" erikj@459: fi ohair@478: AC_PATH_PROGS(READELF, [readelf greadelf]) ohair@478: AC_PATH_PROGS(OBJDUMP, [objdump gobjdump]) erikj@459: AC_PATH_PROG(HG, hg) erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE], erikj@459: [ erikj@459: # When using cygwin, we need a wrapper binary that renames erikj@459: # /cygdrive/c/ arguments into c:/ arguments and peeks into erikj@459: # @files and rewrites these too! This wrapper binary is erikj@459: # called uncygdrive.exe. erikj@459: UNCYGDRIVE= erikj@459: if test "x$OPENJDK_BUILD_OS" = xwindows; then erikj@459: AC_MSG_CHECKING([if uncygdrive can be created]) erikj@459: UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c` erikj@459: rm -f $OUTPUT_ROOT/uncygdrive* erikj@459: UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe` erikj@459: cd $OUTPUT_ROOT erikj@459: $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1 erikj@459: cd $CURDIR erikj@459: erikj@459: if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then erikj@459: AC_MSG_RESULT([no]) erikj@459: cat $OUTPUT_ROOT/uncygdrive1.log erikj@459: AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe]) erikj@459: fi erikj@459: AC_MSG_RESULT([$UNCYGDRIVE]) erikj@459: AC_MSG_CHECKING([if uncygdrive.exe works]) erikj@459: cd $OUTPUT_ROOT erikj@459: $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 erikj@459: cd $CURDIR erikj@459: if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then erikj@459: AC_MSG_RESULT([no]) erikj@459: cat $OUTPUT_ROOT/uncygdrive2.log erikj@459: AC_MSG_ERROR([Uncygdrive did not work!]) erikj@459: fi erikj@459: AC_MSG_RESULT([yes]) erikj@459: rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj ohair@478: # The path to uncygdrive to use should be Unix-style ohair@478: UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe" erikj@459: fi erikj@459: erikj@459: AC_SUBST(UNCYGDRIVE) erikj@459: ]) erikj@459: erikj@459: erikj@459: # Check if build directory is on local disk. erikj@459: # Argument 1: directory to test erikj@459: # Argument 2: what to do if it is on local disk erikj@459: # Argument 3: what to do otherwise (remote disk or failure) erikj@459: AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK], erikj@459: [ erikj@459: # df -l lists only local disks; if the given directory is not found then erikj@459: # a non-zero exit code is given erikj@459: if $DF -l $1 > /dev/null 2>&1; then erikj@459: $2 erikj@459: else erikj@459: $3 erikj@459: fi erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES], erikj@459: [ erikj@459: erikj@459: AC_MSG_CHECKING([if build directory is on local disk]) erikj@459: BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT, erikj@459: [OUTPUT_DIR_IS_LOCAL="yes"], erikj@459: [OUTPUT_DIR_IS_LOCAL="no"]) erikj@459: AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL) erikj@459: erikj@459: # Check if the user has any old-style ALT_ variables set. erikj@459: FOUND_ALT_VARIABLES=`env | grep ^ALT_` erikj@459: erikj@459: # Before generating output files, test if they exist. If they do, this is a reconfigure. erikj@459: # Since we can't properly handle the dependencies for this, warn the user about the situation erikj@459: if test -e $OUTPUT_ROOT/spec.gmk; then erikj@459: IS_RECONFIGURE=yes erikj@459: else erikj@459: IS_RECONFIGURE=no erikj@459: fi erikj@459: erikj@459: if test -e $SRC_ROOT/build/.hide-configure-performance-hints; then erikj@459: HIDE_PERFORMANCE_HINTS=yes erikj@459: else erikj@459: HIDE_PERFORMANCE_HINTS=no erikj@459: # Hide it the next time around... erikj@459: $TOUCH $SRC_ROOT/build/.hide-configure-performance-hints > /dev/null 2>&1 erikj@459: fi erikj@459: erikj@459: ])