source-dirs.m4 revision 504:78bb27faf889
1# 2# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22# or visit www.oracle.com if you need additional information or have any 23# questions. 24# 25 26AC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS], 27[ 28 29# Where are the sources. Any of these can be overridden 30# using --with-override-corba and the likes. 31LANGTOOLS_TOPDIR="$SRC_ROOT/langtools" 32CORBA_TOPDIR="$SRC_ROOT/corba" 33JAXP_TOPDIR="$SRC_ROOT/jaxp" 34JAXWS_TOPDIR="$SRC_ROOT/jaxws" 35HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" 36JDK_TOPDIR="$SRC_ROOT/jdk" 37AC_SUBST(LANGTOOLS_TOPDIR) 38AC_SUBST(CORBA_TOPDIR) 39AC_SUBST(JAXP_TOPDIR) 40AC_SUBST(JAXWS_TOPDIR) 41AC_SUBST(HOTSPOT_TOPDIR) 42AC_SUBST(JDK_TOPDIR) 43]) 44 45 46AC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS], 47[ 48 49############################################################################### 50# 51# Pickup additional source for a component from outside of the source root 52# or override source for a component. 53# 54AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root], 55 [for each and every source directory, look in this additional source root for 56 the same directory; if it exists and have files in it, include it in the build])]) 57 58AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root], 59 [for each and every source directory, look in this override source root for 60 the same directory; if it exists, use that directory instead and 61 ignore the directory in the original source root])]) 62 63AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides], 64 [use the subdirs 'adds' and 'overrides' in the specified directory as 65 add-source-root and override-source-root])]) 66 67if test "x$with_adds_and_overrides" != x; then 68 with_add_source_root="$with_adds_and_overrides/adds" 69 with_override_source_root="$with_adds_and_overrides/overrides" 70fi 71 72if test "x$with_add_source_root" != x; then 73 if ! test -d $with_add_source_root; then 74 AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root]) 75 fi 76 CURDIR="$PWD" 77 cd "$with_add_source_root" 78 ADD_SRC_ROOT="`pwd`" 79 cd "$CURDIR" 80 # Verify that the addon source root does not have any root makefiles. 81 # If it does, then it is usually an error, prevent this. 82 if test -f $with_add_source_root/langtools/makefiles/Makefile || \ 83 test -f $with_add_source_root/langtools/make/Makefile; then 84 AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.]) 85 fi 86 if test -f $with_add_source_root/corba/makefiles/Makefile || \ 87 test -f $with_add_source_root/corba/make/Makefile; then 88 AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.]) 89 fi 90 if test -f $with_add_source_root/jaxp/makefiles/Makefile || \ 91 test -f $with_add_source_root/jaxp/make/Makefile; then 92 AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.]) 93 fi 94 if test -f $with_add_source_root/jaxws/makefiles/Makefile || \ 95 test -f $with_add_source_root/jaxws/make/Makefile; then 96 AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.]) 97 fi 98 if test -f $with_add_source_root/hotspot/makefiles/Makefile || \ 99 test -f $with_add_source_root/hotspot/make/Makefile; then 100 AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.]) 101 fi 102 if test -f $with_add_source_root/jdk/makefiles/Makefile || \ 103 test -f $with_add_source_root/jdk/make/Makefile; then 104 AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.]) 105 fi 106fi 107AC_SUBST(ADD_SRC_ROOT) 108 109if test "x$with_override_source_root" != x; then 110 if ! test -d $with_override_source_root; then 111 AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root]) 112 fi 113 CURDIR="$PWD" 114 cd "$with_override_source_root" 115 OVERRIDE_SRC_ROOT="`pwd`" 116 cd "$CURDIR" 117 if test -f $with_override_source_root/langtools/makefiles/Makefile || \ 118 test -f $with_override_source_root/langtools/make/Makefile; then 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.]) 120 fi 121 if test -f $with_override_source_root/corba/makefiles/Makefile || \ 122 test -f $with_override_source_root/corba/make/Makefile; then 123 AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.]) 124 fi 125 if test -f $with_override_source_root/jaxp/makefiles/Makefile || \ 126 test -f $with_override_source_root/jaxp/make/Makefile; then 127 AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.]) 128 fi 129 if test -f $with_override_source_root/jaxws/makefiles/Makefile || \ 130 test -f $with_override_source_root/jaxws/make/Makefile; then 131 AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.]) 132 fi 133 if test -f $with_override_source_root/hotspot/makefiles/Makefile || \ 134 test -f $with_override_source_root/hotspot/make/Makefile; then 135 AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.]) 136 fi 137 if test -f $with_override_source_root/jdk/makefiles/Makefile || \ 138 test -f $with_override_source_root/jdk/make/Makefile; then 139 AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.]) 140 fi 141fi 142AC_SUBST(OVERRIDE_SRC_ROOT) 143 144############################################################################### 145# 146# Override a repo completely, this is used for example when you have 3 small 147# development sandboxes of the langtools sources and want to avoid having 3 full 148# OpenJDK sources checked out on disk. 149# 150# Assuming that the 3 langtools sandboxes are located here: 151# /home/fredrik/sandbox1/langtools 152# /home/fredrik/sandbox2/langtools 153# /home/fredrik/sandbox3/langtools 154# 155# From the source root you create build subdirs manually: 156# mkdir -p build1 build2 build3 157# in each build directory run: 158# (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make) 159# (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make) 160# (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make) 161# 162 163AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools], 164 [use this langtools dir for the build])]) 165 166AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba], 167 [use this corba dir for the build])]) 168 169AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp], 170 [use this jaxp dir for the build])]) 171 172AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws], 173 [use this jaxws dir for the build])]) 174 175AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot], 176 [use this hotspot dir for the build])]) 177 178AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk], 179 [use this jdk dir for the build])]) 180 181if test "x$with_override_langtools" != x; then 182 CURDIR="$PWD" 183 cd "$with_override_langtools" 184 LANGTOOLS_TOPDIR="`pwd`" 185 cd "$CURDIR" 186 if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then 187 AC_MSG_ERROR([You have to override langtools with a full langtools repo!]) 188 fi 189 AC_MSG_CHECKING([if langtools should be overridden]) 190 AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR]) 191fi 192if test "x$with_override_corba" != x; then 193 CURDIR="$PWD" 194 cd "$with_override_corba" 195 CORBA_TOPDIR="`pwd`" 196 cd "$CURDIR" 197 if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then 198 AC_MSG_ERROR([You have to override corba with a full corba repo!]) 199 fi 200 AC_MSG_CHECKING([if corba should be overridden]) 201 AC_MSG_RESULT([yes with $CORBA_TOPDIR]) 202fi 203if test "x$with_override_jaxp" != x; then 204 CURDIR="$PWD" 205 cd "$with_override_jaxp" 206 JAXP_TOPDIR="`pwd`" 207 cd "$CURDIR" 208 if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then 209 AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!]) 210 fi 211 AC_MSG_CHECKING([if jaxp should be overridden]) 212 AC_MSG_RESULT([yes with $JAXP_TOPDIR]) 213fi 214if test "x$with_override_jaxws" != x; then 215 CURDIR="$PWD" 216 cd "$with_override_jaxws" 217 JAXWS_TOPDIR="`pwd`" 218 cd "$CURDIR" 219 if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then 220 AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!]) 221 fi 222 AC_MSG_CHECKING([if jaxws should be overridden]) 223 AC_MSG_RESULT([yes with $JAXWS_TOPDIR]) 224fi 225if test "x$with_override_hotspot" != x; then 226 CURDIR="$PWD" 227 cd "$with_override_hotspot" 228 HOTSPOT_TOPDIR="`pwd`" 229 cd "$CURDIR" 230 if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \ 231 ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then 232 AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!]) 233 fi 234 AC_MSG_CHECKING([if hotspot should be overridden]) 235 AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR]) 236fi 237if test "x$with_override_jdk" != x; then 238 CURDIR="$PWD" 239 cd "$with_override_jdk" 240 JDK_TOPDIR="`pwd`" 241 cd "$CURDIR" 242 if ! test -f $JDK_TOPDIR/makefiles/Makefile; then 243 AC_MSG_ERROR([You have to override JDK with a full JDK repo!]) 244 fi 245 AC_MSG_CHECKING([if JDK should be overridden]) 246 AC_MSG_RESULT([yes with $JDK_TOPDIR]) 247fi 248 249]) 250 251AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS], 252[ 253BUILD_OUTPUT="$OUTPUT_ROOT" 254AC_SUBST(BUILD_OUTPUT) 255 256HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist" 257BUILD_HOTSPOT=true 258AC_SUBST(HOTSPOT_DIST) 259AC_SUBST(BUILD_HOTSPOT) 260AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot], 261 [import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])]) 262if test "x$with_import_hotspot" != x; then 263 CURDIR="$PWD" 264 cd "$with_import_hotspot" 265 HOTSPOT_DIST="`pwd`" 266 cd "$CURDIR" 267 if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then 268 AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!]) 269 fi 270 AC_MSG_CHECKING([if hotspot should be imported]) 271 AC_MSG_RESULT([yes from $HOTSPOT_DIST]) 272 BUILD_HOTSPOT=false 273fi 274 275JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk" 276]) 277