common/autoconf/source-dirs.m4

changeset 0
75a576e87639
child 1133
50aaf272884f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/autoconf/source-dirs.m4	Wed Apr 27 01:39:08 2016 +0800
     1.3 @@ -0,0 +1,283 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +AC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS],
    1.30 +[
    1.31 +  # Where are the sources. Any of these can be overridden
    1.32 +  # using --with-override-corba and the likes.
    1.33 +  LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
    1.34 +  CORBA_TOPDIR="$SRC_ROOT/corba"
    1.35 +  JAXP_TOPDIR="$SRC_ROOT/jaxp"
    1.36 +  JAXWS_TOPDIR="$SRC_ROOT/jaxws"
    1.37 +  HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
    1.38 +  NASHORN_TOPDIR="$SRC_ROOT/nashorn"
    1.39 +  JDK_TOPDIR="$SRC_ROOT/jdk"
    1.40 +  AC_SUBST(LANGTOOLS_TOPDIR)
    1.41 +  AC_SUBST(CORBA_TOPDIR)
    1.42 +  AC_SUBST(JAXP_TOPDIR)
    1.43 +  AC_SUBST(JAXWS_TOPDIR)
    1.44 +  AC_SUBST(HOTSPOT_TOPDIR)
    1.45 +  AC_SUBST(NASHORN_TOPDIR)
    1.46 +  AC_SUBST(JDK_TOPDIR)
    1.47 +])
    1.48 +
    1.49 +
    1.50 +AC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
    1.51 +[
    1.52 +
    1.53 +  ###############################################################################
    1.54 +  #
    1.55 +  # Pickup additional source for a component from outside of the source root
    1.56 +  # or override source for a component.
    1.57 +  #
    1.58 +  AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
    1.59 +      [for each and every source directory, look in this additional source root for
    1.60 +      the same directory; if it exists and have files in it, include it in the build])])
    1.61 +
    1.62 +  AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
    1.63 +      [for each and every source directory, look in this override source root for
    1.64 +      the same directory; if it exists, use that directory instead and
    1.65 +      ignore the directory in the original source root])])
    1.66 +
    1.67 +  AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
    1.68 +      [use the subdirs 'adds' and 'overrides' in the specified directory as
    1.69 +      add-source-root and override-source-root])])
    1.70 +
    1.71 +  if test "x$with_adds_and_overrides" != x; then
    1.72 +    with_add_source_root="$with_adds_and_overrides/adds"
    1.73 +    with_override_source_root="$with_adds_and_overrides/overrides"
    1.74 +  fi
    1.75 +
    1.76 +  if test "x$with_add_source_root" != x; then
    1.77 +    if ! test -d $with_add_source_root; then
    1.78 +      AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
    1.79 +    fi
    1.80 +    CURDIR="$PWD"
    1.81 +    cd "$with_add_source_root"
    1.82 +    ADD_SRC_ROOT="`pwd`"
    1.83 +    cd "$CURDIR"
    1.84 +    # Verify that the addon source root does not have any root makefiles.
    1.85 +    # If it does, then it is usually an error, prevent this.
    1.86 +    if test -f $with_add_source_root/langtools/make/Makefile; then
    1.87 +      AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
    1.88 +    fi
    1.89 +    if test -f $with_add_source_root/corba/make/Makefile; then
    1.90 +      AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
    1.91 +    fi
    1.92 +    if test -f $with_add_source_root/jaxp/make/Makefile; then
    1.93 +      AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
    1.94 +    fi
    1.95 +    if test -f $with_add_source_root/jaxws/make/Makefile; then
    1.96 +      AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
    1.97 +    fi
    1.98 +    if test -f $with_add_source_root/hotspot/make/Makefile; then
    1.99 +      AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
   1.100 +    fi
   1.101 +    if test -f $with_add_source_root/nashorn/make/Makefile; then
   1.102 +      AC_MSG_ERROR([Your add source root seems to contain a full nashorn repo! An add source root should only contain additional sources.])
   1.103 +    fi
   1.104 +    if test -f $with_add_source_root/jdk/make/Makefile; then
   1.105 +      AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
   1.106 +    fi
   1.107 +  fi
   1.108 +  AC_SUBST(ADD_SRC_ROOT)
   1.109 +
   1.110 +  if test "x$with_override_source_root" != x; then
   1.111 +    if ! test -d $with_override_source_root; then
   1.112 +      AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
   1.113 +    fi
   1.114 +    CURDIR="$PWD"
   1.115 +    cd "$with_override_source_root"
   1.116 +    OVERRIDE_SRC_ROOT="`pwd`"
   1.117 +    cd "$CURDIR"
   1.118 +    if test -f $with_override_source_root/langtools/make/Makefile; then
   1.119 +      AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
   1.120 +    fi
   1.121 +    if test -f $with_override_source_root/corba/make/Makefile; then
   1.122 +      AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
   1.123 +    fi
   1.124 +    if test -f $with_override_source_root/jaxp/make/Makefile; then
   1.125 +      AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
   1.126 +    fi
   1.127 +    if test -f $with_override_source_root/jaxws/make/Makefile; then
   1.128 +      AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
   1.129 +    fi
   1.130 +    if test -f $with_override_source_root/hotspot/make/Makefile; then
   1.131 +      AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
   1.132 +    fi
   1.133 +    if test -f $with_override_source_root/nashorn/make/Makefile; then
   1.134 +      AC_MSG_ERROR([Your override source root seems to contain a full nashorn repo! An override source root should only contain sources that override.])
   1.135 +    fi
   1.136 +    if test -f $with_override_source_root/jdk/make/Makefile; then
   1.137 +      AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
   1.138 +    fi
   1.139 +  fi
   1.140 +  AC_SUBST(OVERRIDE_SRC_ROOT)
   1.141 +
   1.142 +  ###############################################################################
   1.143 +  #
   1.144 +  # Override a repo completely, this is used for example when you have 3 small
   1.145 +  # development sandboxes of the langtools sources and want to avoid having 3 full
   1.146 +  # OpenJDK sources checked out on disk.
   1.147 +  #
   1.148 +  # Assuming that the 3 langtools sandboxes are located here:
   1.149 +  # /home/fredrik/sandbox1/langtools
   1.150 +  # /home/fredrik/sandbox2/langtools
   1.151 +  # /home/fredrik/sandbox3/langtools
   1.152 +  #
   1.153 +  # From the source root you create build subdirs manually:
   1.154 +  #     mkdir -p build1 build2 build3
   1.155 +  # in each build directory run:
   1.156 +  #     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
   1.157 +  #     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
   1.158 +  #     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
   1.159 +  #
   1.160 +
   1.161 +  AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
   1.162 +      [use this langtools dir for the build])])
   1.163 +
   1.164 +  AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
   1.165 +      [use this corba dir for the build])])
   1.166 +
   1.167 +  AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
   1.168 +      [use this jaxp dir for the build])])
   1.169 +
   1.170 +  AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
   1.171 +      [use this jaxws dir for the build])])
   1.172 +
   1.173 +  AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
   1.174 +      [use this hotspot dir for the build])])
   1.175 +
   1.176 +  AC_ARG_WITH(override-nashorn, [AS_HELP_STRING([--with-override-nashorn],
   1.177 +      [use this nashorn dir for the build])])
   1.178 +
   1.179 +  AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
   1.180 +      [use this jdk dir for the build])])
   1.181 +
   1.182 +  if test "x$with_override_langtools" != x; then
   1.183 +    CURDIR="$PWD"
   1.184 +    cd "$with_override_langtools"
   1.185 +    LANGTOOLS_TOPDIR="`pwd`"
   1.186 +    cd "$CURDIR"
   1.187 +    if ! test -f $LANGTOOLS_TOPDIR/make/Makefile; then
   1.188 +      AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
   1.189 +    fi
   1.190 +    AC_MSG_CHECKING([if langtools should be overridden])
   1.191 +    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
   1.192 +  fi
   1.193 +  if test "x$with_override_corba" != x; then
   1.194 +    CURDIR="$PWD"
   1.195 +    cd "$with_override_corba"
   1.196 +    CORBA_TOPDIR="`pwd`"
   1.197 +    cd "$CURDIR"
   1.198 +    if ! test -f $CORBA_TOPDIR/make/Makefile; then
   1.199 +      AC_MSG_ERROR([You have to override corba with a full corba repo!])
   1.200 +    fi
   1.201 +    AC_MSG_CHECKING([if corba should be overridden])
   1.202 +    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
   1.203 +  fi
   1.204 +  if test "x$with_override_jaxp" != x; then
   1.205 +    CURDIR="$PWD"
   1.206 +    cd "$with_override_jaxp"
   1.207 +    JAXP_TOPDIR="`pwd`"
   1.208 +    cd "$CURDIR"
   1.209 +    if ! test -f $JAXP_TOPDIR/make/Makefile; then
   1.210 +      AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
   1.211 +    fi
   1.212 +    AC_MSG_CHECKING([if jaxp should be overridden])
   1.213 +    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
   1.214 +  fi
   1.215 +  if test "x$with_override_jaxws" != x; then
   1.216 +    CURDIR="$PWD"
   1.217 +    cd "$with_override_jaxws"
   1.218 +    JAXWS_TOPDIR="`pwd`"
   1.219 +    cd "$CURDIR"
   1.220 +    if ! test -f $JAXWS_TOPDIR/make/Makefile; then
   1.221 +      AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
   1.222 +    fi
   1.223 +    AC_MSG_CHECKING([if jaxws should be overridden])
   1.224 +    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
   1.225 +  fi
   1.226 +  if test "x$with_override_hotspot" != x; then
   1.227 +    CURDIR="$PWD"
   1.228 +    cd "$with_override_hotspot"
   1.229 +    HOTSPOT_TOPDIR="`pwd`"
   1.230 +    cd "$CURDIR"
   1.231 +    if ! test -f $HOTSPOT_TOPDIR/make/Makefile; then
   1.232 +      AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
   1.233 +    fi
   1.234 +    AC_MSG_CHECKING([if hotspot should be overridden])
   1.235 +    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
   1.236 +  fi
   1.237 +  if test "x$with_override_nashorn" != x; then
   1.238 +    CURDIR="$PWD"
   1.239 +    cd "$with_override_nashorn"
   1.240 +    NASHORN_TOPDIR="`pwd`"
   1.241 +    cd "$CURDIR"
   1.242 +    if ! test -f $NASHORN_TOPDIR/make/Makefile; then
   1.243 +      AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!])
   1.244 +    fi
   1.245 +    AC_MSG_CHECKING([if nashorn should be overridden])
   1.246 +    AC_MSG_RESULT([yes with $NASHORN_TOPDIR])
   1.247 +  fi
   1.248 +  if test "x$with_override_jdk" != x; then
   1.249 +    CURDIR="$PWD"
   1.250 +    cd "$with_override_jdk"
   1.251 +    JDK_TOPDIR="`pwd`"
   1.252 +    cd "$CURDIR"
   1.253 +    if ! test -f $JDK_TOPDIR/make/Makefile; then
   1.254 +      AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
   1.255 +    fi
   1.256 +    AC_MSG_CHECKING([if JDK should be overridden])
   1.257 +    AC_MSG_RESULT([yes with $JDK_TOPDIR])
   1.258 +  fi
   1.259 +])
   1.260 +
   1.261 +AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
   1.262 +[
   1.263 +  BUILD_OUTPUT="$OUTPUT_ROOT"
   1.264 +  AC_SUBST(BUILD_OUTPUT)
   1.265 +
   1.266 +  HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
   1.267 +  BUILD_HOTSPOT=true
   1.268 +  AC_SUBST(HOTSPOT_DIST)
   1.269 +  AC_SUBST(BUILD_HOTSPOT)
   1.270 +  AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot],
   1.271 +  [import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])])
   1.272 +  if test "x$with_import_hotspot" != x; then
   1.273 +    CURDIR="$PWD"
   1.274 +    cd "$with_import_hotspot"
   1.275 +    HOTSPOT_DIST="`pwd`"
   1.276 +    cd "$CURDIR"
   1.277 +    if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then
   1.278 +      AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!])
   1.279 +    fi
   1.280 +    AC_MSG_CHECKING([if hotspot should be imported])
   1.281 +    AC_MSG_RESULT([yes from $HOTSPOT_DIST])
   1.282 +    BUILD_HOTSPOT=false
   1.283 +  fi
   1.284 +
   1.285 +  JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
   1.286 +])

mercurial