common/autoconf/basics.m4
author ohair
Tue, 18 Sep 2012 11:29:16 -0700
changeset 13697 5262b00bc10c
parent 13133 701e61c32ece
child 14111 2a82ecb35fc7
permissions -rw-r--r--
7197849: Update new build-infra makefiles Reviewed-by: ihse, erikj, ohrstrom, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    26
AC_DEFUN([ADD_JVM_ARG_IF_OK],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    27
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    28
    # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    29
    # If so, then append $1 to $2
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    30
    FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    31
    FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    32
    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    33
        $2="[$]$2 $1"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    34
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    35
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    36
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    37
AC_DEFUN([SET_FULL_PATH],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    38
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    39
    # Translate "gcc -E" into "`which gcc` -E" ie
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    40
    # extract the full path to the binary and at the
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    41
    # same time maintain any arguments passed to it.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    42
    # The command MUST exist in the path, or else!
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    43
    tmp="[$]$1"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    44
    car="${tmp%% *}"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    45
    tmp="[$]$1 EOL"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    46
    cdr="${tmp#* }"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    47
    # On windows we want paths without spaces.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    48
    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    49
        SET_FULL_PATH_SPACESAFE(car)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    50
    else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    51
        # "which" is not portable, but is used here
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    52
        # because we know that the command exists!
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    53
        car=`which $car`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    54
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    55
    if test "x$cdr" != xEOL; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    56
        $1="$car ${cdr% *}"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    57
    else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    58
        $1="$car"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    59
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    60
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    61
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    62
AC_DEFUN([SPACESAFE],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    63
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    64
    # Fail with message $2 if var $1 contains a path with no spaces in it.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    65
    # Unless on Windows, where we can rewrite the path.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    66
    HAS_SPACE=`echo "[$]$1" | grep " "`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    67
    if test "x$HAS_SPACE" != x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    68
        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    69
            # First convert it to DOS-style, short mode (no spaces)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    70
            $1=`$CYGPATH -s -m -a "[$]$1"`
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    71
            # Now it's case insensitive; let's make it lowercase to improve readability
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    72
            $1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    73
            # Now convert it back to Unix-stile (cygpath)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    74
            $1=`$CYGPATH -u "[$]$1"`
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    75
        else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    76
            AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    77
        fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    78
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    79
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    80
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    81
AC_DEFUN([SET_FULL_PATH_SPACESAFE],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    82
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    83
    # Translate long cygdrive or C:\sdfsf path
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    84
    # into a short mixed mode path that has no
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    85
    # spaces in it.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    86
    tmp="[$]$1"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    87
    
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    88
    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    89
        tmp=`$CYGPATH -u "[$]$1"`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    90
        tmp=`which "$tmp"`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    91
        # If file exists with .exe appended, that's the real filename
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    92
        # and cygpath needs that to convert to short style path.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    93
        if test -f "${tmp}.exe"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    94
           tmp="${tmp}.exe"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    95
        elif test -f "${tmp}.cmd"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    96
           tmp="${tmp}.cmd"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    97
        fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    98
        # Convert to C:/ mixed style path without spaces.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    99
         tmp=`$CYGPATH -s -m "$tmp"`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   100
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   101
    $1="$tmp"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   102
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   103
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   104
AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   105
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   106
    if test "x$OPENJDK_BUILD_OS" != xwindows; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   107
        # Follow a chain of symbolic links. Use readlink
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   108
        # where it exists, else fall back to horribly
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   109
        # complicated shell code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   110
        AC_PATH_PROG(READLINK, readlink)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   111
        if test "x$READLINK_TESTED" != yes; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   112
            # On MacOSX there is a readlink tool with a different
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   113
            # purpose than the GNU readlink tool. Check the found readlink.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   114
            ISGNU=`$READLINK --help 2>&1 | grep GNU`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   115
            if test "x$ISGNU" = x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   116
                 # A readlink that we do not know how to use.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   117
                 # Are there other non-GNU readlinks out there?
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   118
                 READLINK_TESTED=yes
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   119
                 READLINK=
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   120
            fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   121
        fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   122
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   123
        if test "x$READLINK" != x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   124
            $1=`$READLINK -f [$]$1`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   125
        else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   126
            STARTDIR=$PWD
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   127
            COUNTER=0
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   128
            DIR=`dirname [$]$1`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   129
            FIL=`basename [$]$1`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   130
            while test $COUNTER -lt 20; do
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   131
                ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   132
                if test "x$ISLINK" == x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   133
                    # This is not a symbolic link! We are done!
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   134
                    break
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   135
                fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   136
                # The link might be relative! We have to use cd to travel safely.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   137
                cd $DIR
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   138
                cd `dirname $ISLINK`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   139
                DIR=`pwd`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   140
                FIL=`basename $ISLINK`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   141
                let COUNTER=COUNTER+1
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   142
            done
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   143
            cd $STARTDIR
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   144
            $1=$DIR/$FIL
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   145
        fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   146
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   147
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   148
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   149
AC_DEFUN_ONCE([BASIC_INIT],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   150
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   151
# Save the original command line. This is passed to us by the wrapper configure script.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   152
AC_SUBST(CONFIGURE_COMMAND_LINE)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   153
DATE_WHEN_CONFIGURED=`LANG=C date`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   154
AC_SUBST(DATE_WHEN_CONFIGURED)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   155
])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   156
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   157
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   158
AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   159
[
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   160
# Locate the directory of this script.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   161
SCRIPT="[$]0"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   162
REMOVE_SYMBOLIC_LINKS(SCRIPT)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   163
AUTOCONF_DIR=`dirname [$]0`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   164
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   165
# Where is the source? It is located two levels above the configure script.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   166
CURDIR="$PWD"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   167
cd "$AUTOCONF_DIR/../.."
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   168
SRC_ROOT="`pwd`"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   169
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   170
    SRC_ROOT_LENGTH=`pwd|wc -m`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   171
    if test $SRC_ROOT_LENGTH -gt 100; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   172
        AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   173
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   174
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   175
AC_SUBST(SRC_ROOT)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   176
cd "$CURDIR"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   177
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   178
SPACESAFE(SRC_ROOT,[the path to the source root])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   179
SPACESAFE(CURDIR,[the path to the current directory])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   180
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   181
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   182
    # Add extra search paths on solaris for utilities like ar and as etc...
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   183
    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   184
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   185
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   186
# For cygwin we need cygpath first, since it is used everywhere.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   187
AC_PATH_PROG(CYGPATH, cygpath)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   188
PATH_SEP=":"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   189
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   190
    if test "x$CYGPATH" = x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   191
        AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   192
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   193
    PATH_SEP=";"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   194
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   195
AC_SUBST(PATH_SEP)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   196
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   197
# You can force the sys-root if the sys-root encoded into the cross compiler tools
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   198
# is not correct.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   199
AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   200
  [pass this sys-root to the compilers and linker (useful if the sys-root encoded in
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   201
   the cross compiler tools is incorrect)])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   202
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   203
if test "x$with_sys_root" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   204
  SYS_ROOT=$with_sys_root
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   205
else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   206
  SYS_ROOT=/
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   207
fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   208
AC_SUBST(SYS_ROOT)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   209
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   210
AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   211
  [search this directory for (cross-compiling) compilers and tools])], [TOOLS_DIR=$with_tools_dir])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   212
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   213
AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   214
  [use this directory as base for tools-dir and sys-root (for cross-compiling)])],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   215
  [
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   216
    if test "x$with_sys_root" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   217
      AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   218
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   219
    if test "x$with_tools_dir" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   220
      AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   221
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   222
    TOOLS_DIR=$with_devkit/bin
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   223
    SYS_ROOT=$with_devkit/$host_alias/libc
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   224
  ])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   225
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   226
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   227
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   228
AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   229
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   230
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   231
AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   232
	[use this as the name of the configuration, overriding the generated default])],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   233
        [ CONF_NAME=${with_conf_name} ])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   234
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   235
# Test from where we are running configure, in or outside of src root.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   236
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
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   237
    # We are running configure from the src root.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   238
    # Create a default ./build/target-variant-debuglevel output root.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   239
    if test "x${CONF_NAME}" = x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   240
        CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   241
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   242
    OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   243
    mkdir -p "$OUTPUT_ROOT"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   244
    if test ! -d "$OUTPUT_ROOT"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   245
        AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   246
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   247
else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   248
    # We are running configure from outside of the src dir.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   249
    # Then use the current directory as output dir!
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   250
    # If configuration is situated in normal build directory, just use the build
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   251
    # directory name as configuration name, otherwise use the complete path.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   252
    if test "x${CONF_NAME}" = x; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   253
        CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   254
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   255
    OUTPUT_ROOT="$CURDIR"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   256
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   257
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   258
SPACESAFE(OUTPUT_ROOT,[the path to the output root])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   259
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   260
AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   261
AC_SUBST(CONF_NAME, $CONF_NAME)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   262
AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   263
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   264
# Most of the probed defines are put into config.h
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   265
AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   266
# The spec.gmk file contains all variables for the make system.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   267
AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   268
# The hotspot-spec.gmk file contains legacy variables for the hotspot make system.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   269
AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   270
# The bootcycle-spec.gmk file contains support for boot cycle builds.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   271
AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   272
# The compare.sh is used to compare the build output to other builds.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   273
AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   274
# Spec.sh is currently used by compare-objects.sh
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   275
AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   276
# The generated Makefile knows where the spec.gmk is and where the source is.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   277
# You can run make from the OUTPUT_ROOT, or from the top-level Makefile
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   278
# which will look for generated configurations
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   279
AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   280
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   281
# Save the arguments given to us
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   282
echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   283
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   284
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   285
AC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   286
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   287
# Setup default logging of stdout and stderr to build.log in the output root.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   288
BUILD_LOG='$(OUTPUT_ROOT)/build.log'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   289
BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   290
BUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   291
AC_SUBST(BUILD_LOG)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   292
AC_SUBST(BUILD_LOG_PREVIOUS)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   293
AC_SUBST(BUILD_LOG_WRAPPER)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   294
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   295
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   296
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   297
#%%% Simple tools %%%
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   298
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   299
# Check if we have found a usable version of make
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   300
# $1: the path to a potential make binary (or empty)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   301
# $2: the description on how we found this
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   302
AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   303
[
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   304
  MAKE_CANDIDATE="$1"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   305
  DESCRIPTION="$2"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   306
  if test "x$MAKE_CANDIDATE" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   307
    AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   308
    SET_FULL_PATH(MAKE_CANDIDATE)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   309
    MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   310
    IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   311
    if test "x$IS_GNU_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   312
      AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   313
    else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   314
      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'`
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   315
      if test "x$IS_MODERN_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   316
        AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   317
      else 
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   318
        FOUND_MAKE=$MAKE_CANDIDATE
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   319
      fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   320
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   321
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   322
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   323
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   324
# Goes looking for a usable version of GNU make.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   325
AC_DEFUN([BASIC_CHECK_GNU_MAKE],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   326
[
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   327
  # We need to find a recent version of GNU make. Especially on Solaris, this can be tricky.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   328
  if test "x$MAKE" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   329
    # User has supplied a make, test it.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   330
    if test ! -f "$MAKE"; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   331
      AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   332
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   333
    BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   334
    if test "x$FOUND_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   335
      AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   336
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   337
  else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   338
    # Try our hardest to locate a correct version of GNU make
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   339
    AC_PATH_PROGS(CHECK_GMAKE, gmake)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   340
    BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   341
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   342
    if test "x$FOUND_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   343
      AC_PATH_PROGS(CHECK_MAKE, make)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   344
      BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   345
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   346
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   347
    if test "x$FOUND_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   348
      if test "x$TOOLS_DIR" != x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   349
        # We have a tools-dir, check that as well before giving up.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   350
        OLD_PATH=$PATH
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   351
        PATH=$TOOLS_DIR:$PATH
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   352
        AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   353
        BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   354
        if test "x$FOUND_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   355
          AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   356
          BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   357
        fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   358
        PATH=$OLD_PATH
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   359
      fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   360
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   361
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   362
    if test "x$FOUND_MAKE" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   363
      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.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   364
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   365
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   366
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   367
  MAKE=$FOUND_MAKE
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   368
  AC_SUBST(MAKE)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   369
  AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   370
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   371
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   372
AC_DEFUN([BASIC_CHECK_FIND_DELETE],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   373
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   374
    # Test if find supports -delete
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   375
    AC_MSG_CHECKING([if find supports -delete])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   376
    FIND_DELETE="-delete"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   377
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   378
    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   379
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   380
    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   381
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   382
    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   383
    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   384
        # No, it does not.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   385
        rm $DELETEDIR/TestIfFindSupportsDelete
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   386
        FIND_DELETE="-exec rm \{\} \+"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   387
        AC_MSG_RESULT([no])    
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   388
    else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   389
        AC_MSG_RESULT([yes])    
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   390
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   391
    rmdir $DELETEDIR
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   392
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   393
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   394
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   395
# $1: variable to check
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   396
# $2: executable name to print in warning (optional)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   397
AC_DEFUN([CHECK_NONEMPTY],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   398
[
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   399
    if test "x[$]$1" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   400
        if test "x$2" = x; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   401
          PROG_NAME=translit($1,A-Z,a-z)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   402
        else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   403
          PROG_NAME=$2
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   404
        fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   405
        AC_MSG_NOTICE([Could not find $PROG_NAME!])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   406
        AC_MSG_ERROR([Cannot continue])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   407
    fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   408
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   409
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   410
# Does AC_PATH_PROG followed by CHECK_NONEMPTY.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   411
# Arguments as AC_PATH_PROG:
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   412
# $1: variable to set
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   413
# $2: executable name to look for
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   414
AC_DEFUN([BASIC_REQUIRE_PROG],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   415
[
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   416
    AC_PATH_PROGS($1, $2)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   417
    CHECK_NONEMPTY($1, $2)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   418
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   419
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   420
AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   421
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   422
# Start with tools that do not need have cross compilation support
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   423
# and can be expected to be found in the default PATH. These tools are
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   424
# used by configure. Nor are these tools expected to be found in the
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   425
# devkit from the builddeps server either, since they are
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   426
# needed to download the devkit.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   427
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   428
# First are all the simple required tools.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   429
BASIC_REQUIRE_PROG(BASENAME, basename)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   430
BASIC_REQUIRE_PROG(CAT, cat)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   431
BASIC_REQUIRE_PROG(CHMOD, chmod)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   432
BASIC_REQUIRE_PROG(CMP, cmp)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   433
BASIC_REQUIRE_PROG(CP, cp)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   434
BASIC_REQUIRE_PROG(CPIO, cpio)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   435
BASIC_REQUIRE_PROG(CUT, cut)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   436
BASIC_REQUIRE_PROG(DATE, date)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   437
BASIC_REQUIRE_PROG(DF, df)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   438
BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   439
BASIC_REQUIRE_PROG(ECHO, echo)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   440
BASIC_REQUIRE_PROG(EXPR, expr)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   441
BASIC_REQUIRE_PROG(FILE, file)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   442
BASIC_REQUIRE_PROG(FIND, find)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   443
BASIC_REQUIRE_PROG(HEAD, head)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   444
BASIC_REQUIRE_PROG(LN, ln)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   445
BASIC_REQUIRE_PROG(LS, ls)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   446
BASIC_REQUIRE_PROG(MKDIR, mkdir)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   447
BASIC_REQUIRE_PROG(MV, mv)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   448
BASIC_REQUIRE_PROG(PRINTF, printf)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   449
BASIC_REQUIRE_PROG(SH, sh)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   450
BASIC_REQUIRE_PROG(SORT, sort)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   451
BASIC_REQUIRE_PROG(TAIL, tail)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   452
BASIC_REQUIRE_PROG(TAR, tar)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   453
BASIC_REQUIRE_PROG(TEE, tee)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   454
BASIC_REQUIRE_PROG(TOUCH, touch)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   455
BASIC_REQUIRE_PROG(TR, tr)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   456
BASIC_REQUIRE_PROG(UNIQ, uniq)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   457
BASIC_REQUIRE_PROG(UNZIP, unzip)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   458
BASIC_REQUIRE_PROG(WC, wc)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   459
BASIC_REQUIRE_PROG(XARGS, xargs)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   460
BASIC_REQUIRE_PROG(ZIP, zip)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   461
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   462
# Then required tools that require some special treatment.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   463
AC_PROG_AWK
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   464
CHECK_NONEMPTY(AWK)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   465
AC_PROG_GREP
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   466
CHECK_NONEMPTY(GREP)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   467
AC_PROG_EGREP
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   468
CHECK_NONEMPTY(EGREP)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   469
AC_PROG_FGREP
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   470
CHECK_NONEMPTY(FGREP)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   471
AC_PROG_SED
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   472
CHECK_NONEMPTY(SED)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   473
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   474
AC_PATH_PROGS(NAWK, [nawk gawk awk])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   475
CHECK_NONEMPTY(NAWK)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   476
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   477
BASIC_CHECK_GNU_MAKE
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   478
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   479
BASIC_REQUIRE_PROG(RM, rm)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   480
RM="$RM -f"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   481
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   482
BASIC_CHECK_FIND_DELETE
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   483
AC_SUBST(FIND_DELETE)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   484
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   485
# Non-required basic tools
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   486
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   487
AC_PATH_PROG(THEPWDCMD, pwd)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   488
AC_PATH_PROG(LDD, ldd)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   489
if test "x$LDD" = "x"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   490
    # List shared lib dependencies is used for
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   491
    # debug output and checking for forbidden dependencies.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   492
    # We can build without it.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   493
    LDD="true"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   494
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   495
AC_PATH_PROG(OTOOL, otool)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   496
if test "x$OTOOL" = "x"; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   497
   OTOOL="true"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   498
fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   499
AC_PATH_PROGS(READELF, [readelf greadelf])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   500
AC_PATH_PROGS(OBJDUMP, [objdump gobjdump])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   501
AC_PATH_PROG(HG, hg)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   502
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   503
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   504
AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   505
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   506
# When using cygwin, we need a wrapper binary that renames
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   507
# /cygdrive/c/ arguments into c:/ arguments and peeks into
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   508
# @files and rewrites these too! This wrapper binary is
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   509
# called uncygdrive.exe.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   510
UNCYGDRIVE=
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   511
if test "x$OPENJDK_BUILD_OS" = xwindows; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   512
    AC_MSG_CHECKING([if uncygdrive can be created])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   513
    UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   514
    rm -f $OUTPUT_ROOT/uncygdrive*
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   515
    UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   516
    cd $OUTPUT_ROOT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   517
    $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   518
    cd $CURDIR
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   519
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   520
    if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then 
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   521
        AC_MSG_RESULT([no])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   522
        cat $OUTPUT_ROOT/uncygdrive1.log
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   523
        AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   524
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   525
    AC_MSG_RESULT([$UNCYGDRIVE])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   526
    AC_MSG_CHECKING([if uncygdrive.exe works])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   527
    cd $OUTPUT_ROOT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   528
    $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   529
    cd $CURDIR
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   530
    if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then 
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   531
        AC_MSG_RESULT([no])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   532
        cat $OUTPUT_ROOT/uncygdrive2.log
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   533
        AC_MSG_ERROR([Uncygdrive did not work!])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   534
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   535
    AC_MSG_RESULT([yes])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   536
    rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   537
    # The path to uncygdrive to use should be Unix-style
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   538
    UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   539
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   540
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   541
AC_SUBST(UNCYGDRIVE)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   542
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   543
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   544
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   545
# Check if build directory is on local disk.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   546
# Argument 1: directory to test
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   547
# Argument 2: what to do if it is on local disk
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   548
# Argument 3: what to do otherwise (remote disk or failure)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   549
AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   550
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   551
	# df -l lists only local disks; if the given directory is not found then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   552
	# a non-zero exit code is given
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   553
	if $DF -l $1 > /dev/null 2>&1; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   554
          $2
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   555
        else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   556
          $3
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   557
        fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   558
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   559
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   560
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   561
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   562
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   563
AC_MSG_CHECKING([if build directory is on local disk])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   564
BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   565
  [OUTPUT_DIR_IS_LOCAL="yes"],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   566
  [OUTPUT_DIR_IS_LOCAL="no"])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   567
AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   568
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   569
# Check if the user has any old-style ALT_ variables set.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   570
FOUND_ALT_VARIABLES=`env | grep ^ALT_`
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   571
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   572
# Before generating output files, test if they exist. If they do, this is a reconfigure.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   573
# Since we can't properly handle the dependencies for this, warn the user about the situation
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   574
if test -e $OUTPUT_ROOT/spec.gmk; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   575
  IS_RECONFIGURE=yes
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   576
else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   577
  IS_RECONFIGURE=no
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   578
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   579
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   580
if test -e $SRC_ROOT/build/.hide-configure-performance-hints; then
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   581
  HIDE_PERFORMANCE_HINTS=yes
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   582
else
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   583
  HIDE_PERFORMANCE_HINTS=no
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   584
  # Hide it the next time around...
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   585
  $TOUCH $SRC_ROOT/build/.hide-configure-performance-hints > /dev/null 2>&1
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   586
fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   587
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   588
])