common/autoconf/builddeps.m4
author adlertz
Fri, 24 Jan 2014 13:06:52 +0100
changeset 22804 401135897b65
parent 20363 fa7663fc5d50
permissions -rw-r--r--
8031498: Cleanup and re-factorize PhaseChaitin::build_ifg_physical Summary: Created sub-functions, added data structures, improved naming and removed unnecessary code Reviewed-by: kvn, roland, rbackman
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
    26
AC_DEFUN_ONCE([BDEPS_SCAN_FOR_BUILDDEPS],
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    27
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    28
  define(LIST_OF_BUILD_DEPENDENCIES,)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    29
  if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    30
    if test "x$with_builddeps_conf" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    31
      AC_MSG_CHECKING([for supplied builddeps configuration file])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    32
      builddepsfile=$with_builddeps_conf
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    33
      if test -s $builddepsfile; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    34
        . $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    35
        AC_MSG_RESULT([loaded!])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    36
      else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    37
        AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    38
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    39
    else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    40
      AC_MSG_CHECKING([for builddeps.conf files in sources...])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    41
      builddepsfile=`mktemp`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    42
      touch $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    43
      # Put all found confs into a single file.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    44
      find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    45
      # Source the file to acquire the variables
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    46
      if test -s $builddepsfile; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    47
        . $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    48
        AC_MSG_RESULT([found at least one!])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    49
      else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    50
        AC_MSG_ERROR([Could not find any builddeps.conf at all!])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    51
      fi
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    52
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    53
    # Create build and target names that use _ instead of "-" and ".".
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    54
    # This is necessary to use them in variable names.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    55
    build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    56
    target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    57
    # Extract rewrite information for build and target
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    58
    eval rewritten_build=\${REWRITE_${build_var}}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    59
    if test "x$rewritten_build" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    60
      rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    61
      echo Build stays the same $rewritten_build
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    62
    else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    63
      echo Rewriting build for builddeps into $rewritten_build
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    64
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    65
    eval rewritten_target=\${REWRITE_${target_var}}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    66
    if test "x$rewritten_target" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    67
      rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    68
      echo Target stays the same $rewritten_target
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    69
    else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    70
      echo Rewriting target for builddeps into $rewritten_target
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    71
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    72
    rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    73
    rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    74
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    75
  AC_CHECK_PROGS(BDEPS_UNZIP, [7z unzip])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    76
  if test "x$BDEPS_UNZIP" = x7z; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    77
    BDEPS_UNZIP="7z x"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    78
  fi
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    79
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    80
  AC_CHECK_PROGS(BDEPS_FTP, [wget lftp ftp])
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    81
])
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    82
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    83
AC_DEFUN([BDEPS_FTPGET],
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    84
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    85
  # $1 is the ftp://abuilddeps.server.com/libs/cups.zip
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    86
  # $2 is the local file name for the downloaded file.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    87
  VALID_TOOL=no
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    88
  if test "x$BDEPS_FTP" = xwget; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    89
    VALID_TOOL=yes
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    90
    wget -O $2 $1
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    91
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    92
  if test "x$BDEPS_FTP" = xlftp; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    93
    VALID_TOOL=yes
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    94
    lftp -c "get $1 -o $2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    95
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    96
  if test "x$BDEPS_FTP" = xftp; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    97
    VALID_TOOL=yes
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    98
    FTPSERVER=`echo $1 | cut -f 3 -d '/'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    99
    FTPPATH=`echo $1 | cut -f 4- -d '/'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   100
    FTPUSERPWD=${FTPSERVER%%@*}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   101
    if test "x$FTPSERVER" != "x$FTPUSERPWD"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   102
      FTPUSER=${userpwd%%:*}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   103
      FTPPWD=${userpwd#*@}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   104
      FTPSERVER=${FTPSERVER#*@}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   105
    else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   106
      FTPUSER=ftp
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   107
      FTPPWD=ftp
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   108
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   109
    # the "pass" command does not work on some
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   110
    # ftp clients (read ftp.exe) but if it works,
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   111
    # passive mode is better!
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   112
    ( \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   113
        echo "user $FTPUSER $FTPPWD"        ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   114
        echo "pass"                         ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   115
        echo "bin"                          ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   116
        echo "get $FTPPATH $2"              ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   117
    ) | ftp -in $FTPSERVER
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   118
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   119
  if test "x$VALID_TOOL" != xyes; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   120
    AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   121
  fi
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   122
])
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   123
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   124
AC_DEFUN([BDEPS_CHECK_MODULE],
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   125
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   126
  define([LIST_OF_BUILD_DEPENDENCIES],LIST_OF_BUILD_DEPENDENCIES[$2=$3'\n'])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   127
  if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   128
    # Source the builddeps file again, to make sure it uses the latest variables!
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   129
    . $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   130
    # Look for a target and build machine specific resource!
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   131
    eval resource=\${builddep_$2_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   132
    if test "x$resource" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   133
      # Ok, lets instead look for a target specific resource
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   134
      eval resource=\${builddep_$2_TARGET_${rewritten_target_var}}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   135
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   136
    if test "x$resource" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   137
      # Ok, lets instead look for a build specific resource
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   138
      eval resource=\${builddep_$2_BUILD_${rewritten_build_var}}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   139
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   140
    if test "x$resource" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   141
      # Ok, lets instead look for a generic resource
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   142
      # (The $2 comes from M4 and not the shell, thus no need for eval here.)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   143
      resource=${builddep_$2}
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   144
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   145
    if test "x$resource" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   146
      AC_MSG_NOTICE([Using builddeps $resource for $2])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   147
      # If the resource in the builddeps.conf file is an existing directory,
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   148
      # for example /java/linux/cups
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   149
      if test -d ${resource}; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   150
        depdir=${resource}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   151
      else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   152
        BDEPS_FETCH($2, $resource, $with_builddeps_server, $with_builddeps_dir, depdir)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   153
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   154
      # Source the builddeps file again, because in the previous command, the depdir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   155
      # was updated to point at the current build dependency install directory.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   156
      . $builddepsfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   157
      # Now extract variables from the builddeps.conf files.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   158
      theroot=${builddep_$2_ROOT}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   159
      thecflags=${builddep_$2_CFLAGS}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   160
      thelibs=${builddep_$2_LIBS}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   161
      if test "x$depdir" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   162
        AC_MSG_ERROR([Could not download build dependency $2])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   163
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   164
      $1=$depdir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   165
      if test "x$theroot" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   166
        $1="$theroot"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   167
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   168
      if test "x$thecflags" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   169
        $1_CFLAGS="$thecflags"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   170
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   171
      if test "x$thelibs" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   172
        $1_LIBS="$thelibs"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   173
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   174
      m4_default([$4], [:])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   175
      m4_ifvaln([$5], [else $5])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   176
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   177
    m4_ifvaln([$5], [else $5])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   178
  fi
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   179
])
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   180
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   181
AC_DEFUN([BDEPS_FETCH],
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   182
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   183
  # $1 is for example mymodule
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   184
  # $2 is for example libs/general/libmymod_1_2_3.zip
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   185
  # $3 is for example ftp://mybuilddeps.myserver.com/builddeps
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   186
  # $4 is for example /localhome/builddeps
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   187
  # $5 is the name of the variable into which we store the depdir, eg MYMOD
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   188
  # Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   189
  # unzip into the directory: /localhome/builddeps/libmymod_1_2_3
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   190
  filename=`basename $2`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   191
  filebase=`echo $filename | sed 's/\.[[^\.]]*$//'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   192
  filebase=${filename%%.*}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   193
  extension=${filename#*.}
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   194
  installdir=$4/$filebase
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   195
  if test ! -f $installdir/$filename.unpacked; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   196
    AC_MSG_NOTICE([Downloading build dependency $1 from $3/$2 and installing into $installdir])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   197
    if test ! -d $installdir; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   198
      mkdir -p $installdir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   199
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   200
    if test ! -d $installdir; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   201
      AC_MSG_ERROR([Could not create directory $installdir])
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   202
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   203
    tmpfile=`mktemp $installdir/$1.XXXXXXXXX`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   204
    touch $tmpfile
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   205
    if test ! -f $tmpfile; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   206
      AC_MSG_ERROR([Could not create files in directory $installdir])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   207
    fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   208
    BDEPS_FTPGET([$3/$2] , [$tmpfile])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   209
    mv $tmpfile $installdir/$filename
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   210
    if test ! -s $installdir/$filename; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   211
      AC_MSG_ERROR([Could not download $3/$2])
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   212
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   213
    case "$extension" in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   214
      zip)  echo "Unzipping $installdir/$filename..."
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   215
        (cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   216
        ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   217
      tar.gz) echo "Untaring $installdir/$filename..."
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   218
        (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   219
        ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   220
      tgz) echo "Untaring $installdir/$filename..."
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   221
        (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   222
        ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   223
      *) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   224
        ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   225
    esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   226
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   227
  if test -f $installdir/$filename.unpacked; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   228
    $5=$installdir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   229
  fi
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   230
])
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   231
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   232
AC_DEFUN_ONCE([BDEPS_CONFIGURE_BUILDDEPS],
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   233
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   234
  AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   235
      [use this configuration file for the builddeps])])
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   236
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   237
  AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   238
      [download and use build dependencies from this server url])])
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   239
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   240
  AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   241
      [store downloaded build dependencies here @<:@/localhome/builddeps@:>@])],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   242
      [],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   243
      [with_builddeps_dir=/localhome/builddeps])
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   244
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   245
  AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   246
      [chgrp the downloaded build dependencies to this group])])
13132
bd88bb8dd3af 7181504: Update of latest build-infra Makefiles
erikj
parents: 12801
diff changeset
   247
])