source-dirs.m4 revision 457:3156dff953b1
194742Sobrien#
294742Sobrien# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
394742Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
495253Sru#
594742Sobrien# This code is free software; you can redistribute it and/or modify it
696991Srwatson# under the terms of the GNU General Public License version 2 only, as
796991Srwatson# published by the Free Software Foundation.  Oracle designates this
896991Srwatson# particular file as subject to the "Classpath" exception as provided
9102773Srwatson# by Oracle in the LICENSE file that accompanied this code.
10102773Srwatson#
1194854Ssos# This code is distributed in the hope that it will be useful, but WITHOUT
1294917Simp# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1394917Simp# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1494917Simp# version 2 for more details (a copy is included in the LICENSE file that
1594917Simp# accompanied this code).
16117751Smarkm#
17117751Smarkm# You should have received a copy of the GNU General Public License version
18116149Smarkm# 2 along with this work; if not, write to the Free Software Foundation,
19116149Smarkm# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20116149Smarkm#
21116149Smarkm# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2294847Sjhb# or visit www.oracle.com if you need additional information or have any
2394847Sjhb# questions.
2494847Sjhb#
2594855Sscottl
2694855SscottlAC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS],
2794902Sbenno[
2894915Sken
2999607Smjacob# Where are the sources. Any of these can be overridden
3094915Sken# using --with-override-corba and the likes.
3194915SkenLANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
3294915SkenCORBA_TOPDIR="$SRC_ROOT/corba"
3394915SkenJAXP_TOPDIR="$SRC_ROOT/jaxp"
3494915SkenJAXWS_TOPDIR="$SRC_ROOT/jaxws"
35105411SnjlHOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
3694915SkenJDK_TOPDIR="$SRC_ROOT/jdk"
3794915SkenAC_SUBST(LANGTOOLS_TOPDIR)
3894915SkenAC_SUBST(CORBA_TOPDIR)
3999607SmjacobAC_SUBST(JAXP_TOPDIR)
40106734SmjacobAC_SUBST(JAXWS_TOPDIR)
4197611SbillfAC_SUBST(HOTSPOT_TOPDIR)
4294918SgshapiroAC_SUBST(JDK_TOPDIR)
4394918Sgshapiro])
4494918Sgshapiro
4594918Sgshapiro
4694918SgshapiroAC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
47118316Smbr[
4894955Smurray
4995054Snectar###############################################################################
50125080Scperciva#
51106187Sdes# Pickup additional source for a component from outside of the source root
52106187Sdes# or override source for a component. 
5395455Sdes#
5498750SdesAC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
5599606Sdes    [for each and every source directory, look in this additional source root for
5699606Sdes     the same directory; if it exists and have files in it, include it in the build])])                             
5799606Sdes                             
5896268SgadAC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
5996268Sgad    [for each and every source directory, look in this override source root for
60116233Sgad     the same directory; if it exists, use that directory instead and
6196268Sgad     ignore the directory in the original source root])])
6296301Sgrog
6396332SpeterAC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
6496332Speter    [use the subdirs 'adds' and 'overrides' in the specified directory as
6596332Speter     add-source-root and override-source-root])])
6696332Speter
6796332Speterif test "x$with_adds_and_overrides" != x; then
68100314Sru    with_add_source_root="$with_adds_and_overrides/adds"
69100314Sru    with_override_source_root="$with_adds_and_overrides/overrides"
7096451Srufi
7197611Sbillf
7298333Sanholtif test "x$with_add_source_root" != x; then
7398986Sjmallett    if ! test -d $with_add_source_root; then
74111061Sjmallett       AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
7599732Sjoerg    fi
7699732Sjoerg    CURDIR="$PWD"
77113692Snectar    cd "$with_add_source_root"
78113692Snectar    ADD_SRC_ROOT="`pwd`"
79115825Sfanf    cd "$CURDIR"
80115866Sroberto    # Verify that the addon source root does not have any root makefiles.
81117645Sdwmalone    # If it does, then it is usually an error, prevent this.
82118204Sbp    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
83118204Sbp       test -f $with_add_source_root/langtools/make/Makefile; then
84118204Sbp        AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
85118204Sbp    fi
86115822Sdougb    if test -f $with_add_source_root/corba/makefiles/Makefile || \
87115822Sdougb       test -f $with_add_source_root/corba/make/Makefile; then
88115822Sdougb        AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
89115822Sdougb    fi
90115822Sdougb    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
91115822Sdougb       test -f $with_add_source_root/jaxp/make/Makefile; then
92115822Sdougb        AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
93115822Sdougb    fi
94115822Sdougb    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
95115822Sdougb       test -f $with_add_source_root/jaxws/make/Makefile; then
96115822Sdougb        AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
97115822Sdougb    fi
98115822Sdougb    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
99115822Sdougb       test -f $with_add_source_root/hotspot/make/Makefile; then
100115822Sdougb        AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
101115822Sdougb    fi
102115822Sdougb    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
103115822Sdougb       test -f $with_add_source_root/jdk/make/Makefile; then
104115822Sdougb        AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
105115822Sdougb    fi
106115822Sdougbfi
107115822SdougbAC_SUBST(ADD_SRC_ROOT)
108115822Sdougb
109115822Sdougbif test "x$with_override_source_root" != x; then
110115895Sguido    if ! test -d $with_override_source_root; then
111115822Sdougb       AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
112115895Sguido    fi
113115895Sguido    CURDIR="$PWD"
114115895Sguido    cd "$with_override_source_root"
115115822Sdougb    OVERRIDE_SRC_ROOT="`pwd`"
116115822Sdougb    cd "$CURDIR"
117115822Sdougb    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
118115822Sdougb       test -f $with_override_source_root/langtools/make/Makefile; then
119115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
120115822Sdougb    fi
121115822Sdougb    if test -f $with_override_source_root/corba/makefiles/Makefile || \
122115822Sdougb       test -f $with_override_source_root/corba/make/Makefile; then
123115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
124115822Sdougb    fi
125115822Sdougb    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
126115822Sdougb       test -f $with_override_source_root/jaxp/make/Makefile; then
127115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
128115822Sdougb    fi
129115822Sdougb    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
130115822Sdougb       test -f $with_override_source_root/jaxws/make/Makefile; then
131115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
132115822Sdougb    fi
133115822Sdougb    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
134115822Sdougb       test -f $with_override_source_root/hotspot/make/Makefile; then
135115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
136115822Sdougb    fi
137115822Sdougb    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
138115822Sdougb       test -f $with_override_source_root/jdk/make/Makefile; then
139115822Sdougb        AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
140115822Sdougb    fi
141115822Sdougbfi
142115822SdougbAC_SUBST(OVERRIDE_SRC_ROOT)
143115822Sdougb
144115822Sdougb###############################################################################
145115895Sguido#
146115895Sguido# Override a repo completely, this is used for example when you have 3 small
147115895Sguido# development sandboxes of the langtools sources and want to avoid having 3 full
148115895Sguido# OpenJDK sources checked out on disk.
149115822Sdougb#
150115822Sdougb# Assuming that the 3 langtools sandboxes are located here:
151115822Sdougb# /home/fredrik/sandbox1/langtools
152115822Sdougb# /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[
253LANGTOOLS_OUTPUTDIR="$OUTPUT_ROOT/langtools"
254CORBA_OUTPUTDIR="$OUTPUT_ROOT/corba"
255JAXP_OUTPUTDIR="$OUTPUT_ROOT/jaxp"
256JAXWS_OUTPUTDIR="$OUTPUT_ROOT/jaxws"
257HOTSPOT_OUTPUTDIR="$OUTPUT_ROOT/hotspot"
258JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
259IMAGES_OUTPUTDIR="$OUTPUT_ROOT/images"
260
261AC_SUBST(LANGTOOLS_OUTPUTDIR)
262AC_SUBST(CORBA_OUTPUTDIR)
263AC_SUBST(JAXP_OUTPUTDIR)
264AC_SUBST(JAXWS_OUTPUTDIR)
265AC_SUBST(HOTSPOT_OUTPUTDIR)
266AC_SUBST(JDK_OUTPUTDIR)
267AC_SUBST(IMAGES_OUTPUTDIR)
268
269LANGTOOLS_DIST="$OUTPUT_ROOT/langtools/dist"
270CORBA_DIST="$OUTPUT_ROOT/corba/dist"
271JAXP_DIST="$OUTPUT_ROOT/jaxp/dist"
272JAXWS_DIST="$OUTPUT_ROOT/jaxws/dist"
273HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
274
275AC_SUBST(LANGTOOLS_DIST)
276AC_SUBST(CORBA_DIST)
277AC_SUBST(JAXP_DIST)
278AC_SUBST(JAXWS_DIST)
279AC_SUBST(HOTSPOT_DIST)
280])
281