source-dirs.m4 revision 476:2ba6f4da4bf3
1193323Sed#
2193323Sed# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3193323Sed# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4193323Sed#
5193323Sed# This code is free software; you can redistribute it and/or modify it
6193323Sed# under the terms of the GNU General Public License version 2 only, as
7193323Sed# published by the Free Software Foundation.  Oracle designates this
8193323Sed# particular file as subject to the "Classpath" exception as provided
9193323Sed# by Oracle in the LICENSE file that accompanied this code.
10193323Sed#
11193323Sed# This code is distributed in the hope that it will be useful, but WITHOUT
12193323Sed# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13193323Sed# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14193323Sed# version 2 for more details (a copy is included in the LICENSE file that
15193323Sed# accompanied this code).
16193323Sed#
17193323Sed# You should have received a copy of the GNU General Public License version
18193323Sed# 2 along with this work; if not, write to the Free Software Foundation,
19193323Sed# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20193323Sed#
21193323Sed# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22193323Sed# or visit www.oracle.com if you need additional information or have any
23193323Sed# questions.
24193323Sed#
25193323Sed
26193323SedAC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS],
27193323Sed[
28193323Sed
29249423Sdim# Where are the sources. Any of these can be overridden
30193323Sed# using --with-override-corba and the likes.
31193323SedLANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
32249423SdimCORBA_TOPDIR="$SRC_ROOT/corba"
33249423SdimJAXP_TOPDIR="$SRC_ROOT/jaxp"
34249423SdimJAXWS_TOPDIR="$SRC_ROOT/jaxws"
35210299SedHOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
36193323SedJDK_TOPDIR="$SRC_ROOT/jdk"
37193323SedAC_SUBST(LANGTOOLS_TOPDIR)
38193323SedAC_SUBST(CORBA_TOPDIR)
39193323SedAC_SUBST(JAXP_TOPDIR)
40193323SedAC_SUBST(JAXWS_TOPDIR)
41198892SrdivackyAC_SUBST(HOTSPOT_TOPDIR)
42193323SedAC_SUBST(JDK_TOPDIR)
43193323Sed])
44193323Sed
45193323Sed
46193323SedAC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
47193323Sed[
48224145Sdim
49224145Sdim###############################################################################
50193323Sed#
51193323Sed# Pickup additional source for a component from outside of the source root
52193323Sed# or override source for a component. 
53193323Sed#
54193323SedAC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
55193323Sed    [for each and every source directory, look in this additional source root for
56193323Sed     the same directory; if it exists and have files in it, include it in the build])])                             
57193323Sed                             
58193323SedAC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
59193323Sed    [for each and every source directory, look in this override source root for
60193323Sed     the same directory; if it exists, use that directory instead and
61193323Sed     ignore the directory in the original source root])])
62193323Sed
63193323SedAC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
64226633Sdim    [use the subdirs 'adds' and 'overrides' in the specified directory as
65193323Sed     add-source-root and override-source-root])])
66198090Srdivacky
67198090Srdivackyif test "x$with_adds_and_overrides" != x; then
68193323Sed    with_add_source_root="$with_adds_and_overrides/adds"
69198090Srdivacky    with_override_source_root="$with_adds_and_overrides/overrides"
70198090Srdivackyfi
71193323Sed
72193323Sedif test "x$with_add_source_root" != x; then
73193323Sed    if ! test -d $with_add_source_root; then
74193323Sed       AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
75193323Sed    fi
76193323Sed    CURDIR="$PWD"
77193323Sed    cd "$with_add_source_root"
78193323Sed    ADD_SRC_ROOT="`pwd`"
79193323Sed    cd "$CURDIR"
80193323Sed    # Verify that the addon source root does not have any root makefiles.
81193323Sed    # If it does, then it is usually an error, prevent this.
82193323Sed    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
83193323Sed       test -f $with_add_source_root/langtools/make/Makefile; then
84193323Sed        AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
85193323Sed    fi
86193323Sed    if test -f $with_add_source_root/corba/makefiles/Makefile || \
87193323Sed       test -f $with_add_source_root/corba/make/Makefile; then
88198892Srdivacky        AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
89193323Sed    fi
90193323Sed    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
91193323Sed       test -f $with_add_source_root/jaxp/make/Makefile; then
92193323Sed        AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
93193323Sed    fi
94193323Sed    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
95193323Sed       test -f $with_add_source_root/jaxws/make/Makefile; then
96193323Sed        AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
97193323Sed    fi
98193323Sed    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
99198090Srdivacky       test -f $with_add_source_root/hotspot/make/Makefile; then
100193323Sed        AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
101193323Sed    fi
102193323Sed    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
103193323Sed       test -f $with_add_source_root/jdk/make/Makefile; then
104193323Sed        AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
105193323Sed    fi
106193323Sedfi
107193323SedAC_SUBST(ADD_SRC_ROOT)
108193323Sed
109193323Sedif test "x$with_override_source_root" != x; then
110193323Sed    if ! test -d $with_override_source_root; then
111193323Sed       AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
112226633Sdim    fi
113193323Sed    CURDIR="$PWD"
114193323Sed    cd "$with_override_source_root"
115193323Sed    OVERRIDE_SRC_ROOT="`pwd`"
116226633Sdim    cd "$CURDIR"
117226633Sdim    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
118193323Sed       test -f $with_override_source_root/langtools/make/Makefile; then
119234353Sdim        AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
120193323Sed    fi
121193323Sed    if test -f $with_override_source_root/corba/makefiles/Makefile || \
122193323Sed       test -f $with_override_source_root/corba/make/Makefile; then
123193323Sed        AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
124193323Sed    fi
125193323Sed    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
126193323Sed       test -f $with_override_source_root/jaxp/make/Makefile; then
127193323Sed        AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
128193323Sed    fi
129193323Sed    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
130193323Sed       test -f $with_override_source_root/jaxws/make/Makefile; then
131193323Sed        AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
132193323Sed    fi
133193323Sed    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
134193323Sed       test -f $with_override_source_root/hotspot/make/Makefile; then
135193323Sed        AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
136193323Sed    fi
137193323Sed    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
138193323Sed       test -f $with_override_source_root/jdk/make/Makefile; then
139193323Sed        AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
140193323Sed    fi
141193323Sedfi
142193323SedAC_SUBST(OVERRIDE_SRC_ROOT)
143226633Sdim
144226633Sdim###############################################################################
145226633Sdim#
146226633Sdim# Override a repo completely, this is used for example when you have 3 small
147226633Sdim# development sandboxes of the langtools sources and want to avoid having 3 full
148226633Sdim# OpenJDK sources checked out on disk.
149226633Sdim#
150226633Sdim# Assuming that the 3 langtools sandboxes are located here:
151226633Sdim# /home/fredrik/sandbox1/langtools
152226633Sdim# /home/fredrik/sandbox2/langtools
153226633Sdim# /home/fredrik/sandbox3/langtools
154226633Sdim#
155226633Sdim# From the source root you create build subdirs manually:
156193323Sed#     mkdir -p build1 build2 build3 
157193323Sed# in each build directory run:
158193323Sed#     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
159193323Sed#     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
160193323Sed#     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
161193323Sed#
162193323Sed
163193323SedAC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
164193323Sed    [use this langtools dir for the build])])
165193323Sed
166193323SedAC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
167193323Sed    [use this corba dir for the build])])
168193323Sed
169193323SedAC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
170193323Sed	[use this jaxp dir for the build])])
171193323Sed
172193323SedAC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
173193323Sed	[use this jaxws dir for the build])])
174210299Sed
175210299SedAC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
176193323Sed	[use this hotspot dir for the build])])
177207618Srdivacky
178193323SedAC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
179224145Sdim	[use this jdk dir for the build])])
180193323Sed
181193323Sedif test "x$with_override_langtools" != x; then
182193323Sed    CURDIR="$PWD"
183193323Sed    cd "$with_override_langtools"
184193323Sed    LANGTOOLS_TOPDIR="`pwd`"
185193323Sed    cd "$CURDIR"
186226633Sdim    if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then
187193323Sed        AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
188193323Sed    fi
189193323Sed    AC_MSG_CHECKING([if langtools should be overridden])
190193323Sed    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
191193323Sedfi    
192193323Sedif test "x$with_override_corba" != x; then
193193323Sed    CURDIR="$PWD"
194193323Sed    cd "$with_override_corba"
195193323Sed    CORBA_TOPDIR="`pwd`"
196193323Sed    cd "$CURDIR"
197193323Sed    if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then
198193323Sed        AC_MSG_ERROR([You have to override corba with a full corba repo!])
199193323Sed    fi
200193323Sed    AC_MSG_CHECKING([if corba should be overridden])
201193323Sed    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
202193323Sedfi    
203193323Sedif test "x$with_override_jaxp" != x; then
204226633Sdim    CURDIR="$PWD"
205193323Sed    cd "$with_override_jaxp"
206193323Sed    JAXP_TOPDIR="`pwd`"
207193323Sed    cd "$CURDIR"
208224145Sdim    if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then
209193323Sed        AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
210210299Sed    fi
211193323Sed    AC_MSG_CHECKING([if jaxp should be overridden])
212193323Sed    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
213193323Sedfi    
214193323Sedif test "x$with_override_jaxws" != x; then
215224145Sdim    CURDIR="$PWD"
216193323Sed    cd "$with_override_jaxws"
217226633Sdim    JAXWS_TOPDIR="`pwd`"
218224145Sdim    cd "$CURDIR"
219193323Sed    if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then
220224145Sdim        AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
221224145Sdim    fi
222193323Sed    AC_MSG_CHECKING([if jaxws should be overridden])
223193323Sed    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
224193323Sedfi    
225224145Sdimif test "x$with_override_hotspot" != x; then
226224145Sdim    CURDIR="$PWD"
227193323Sed    cd "$with_override_hotspot"
228193323Sed    HOTSPOT_TOPDIR="`pwd`"
229224145Sdim    cd "$CURDIR"
230226633Sdim    if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \
231224145Sdim       ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then
232224145Sdim        AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
233193323Sed    fi
234193323Sed    AC_MSG_CHECKING([if hotspot should be overridden])
235193323Sed    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
236193323Sedfi    
237193323Sedif test "x$with_override_jdk" != x; then
238193323Sed    CURDIR="$PWD"
239193323Sed    cd "$with_override_jdk"
240193323Sed    JDK_TOPDIR="`pwd`"
241193323Sed    cd "$CURDIR"
242193323Sed    if ! test -f $JDK_TOPDIR/makefiles/Makefile; then
243193323Sed        AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
244193323Sed    fi
245193323Sed    AC_MSG_CHECKING([if JDK should be overridden])
246193323Sed    AC_MSG_RESULT([yes with $JDK_TOPDIR])
247198090Srdivackyfi    
248193323Sed
249198090Srdivacky])
250193323Sed
251198090SrdivackyAC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
252198090Srdivacky[
253198090SrdivackyBUILD_OUTPUT="$OUTPUT_ROOT"
254198090SrdivackyAC_SUBST(BUILD_OUTPUT)
255226633Sdim
256193323SedJDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
257193323Sed])
258226633Sdim