source-dirs.m4 revision 793:64f52ef175a4
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"
36NASHORN_TOPDIR="$SRC_ROOT/nashorn"
37JDK_TOPDIR="$SRC_ROOT/jdk"
38AC_SUBST(LANGTOOLS_TOPDIR)
39AC_SUBST(CORBA_TOPDIR)
40AC_SUBST(JAXP_TOPDIR)
41AC_SUBST(JAXWS_TOPDIR)
42AC_SUBST(HOTSPOT_TOPDIR)
43AC_SUBST(NASHORN_TOPDIR)
44AC_SUBST(JDK_TOPDIR)
45])
46
47
48AC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
49[
50
51###############################################################################
52#
53# Pickup additional source for a component from outside of the source root
54# or override source for a component. 
55#
56AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
57    [for each and every source directory, look in this additional source root for
58     the same directory; if it exists and have files in it, include it in the build])])                             
59                             
60AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
61    [for each and every source directory, look in this override source root for
62     the same directory; if it exists, use that directory instead and
63     ignore the directory in the original source root])])
64
65AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
66    [use the subdirs 'adds' and 'overrides' in the specified directory as
67     add-source-root and override-source-root])])
68
69if test "x$with_adds_and_overrides" != x; then
70    with_add_source_root="$with_adds_and_overrides/adds"
71    with_override_source_root="$with_adds_and_overrides/overrides"
72fi
73
74if test "x$with_add_source_root" != x; then
75    if ! test -d $with_add_source_root; then
76       AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
77    fi
78    CURDIR="$PWD"
79    cd "$with_add_source_root"
80    ADD_SRC_ROOT="`pwd`"
81    cd "$CURDIR"
82    # Verify that the addon source root does not have any root makefiles.
83    # If it does, then it is usually an error, prevent this.
84    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
85       test -f $with_add_source_root/langtools/make/Makefile; then
86        AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
87    fi
88    if test -f $with_add_source_root/corba/makefiles/Makefile || \
89       test -f $with_add_source_root/corba/make/Makefile; then
90        AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
91    fi
92    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
93       test -f $with_add_source_root/jaxp/make/Makefile; then
94        AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
95    fi
96    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
97       test -f $with_add_source_root/jaxws/make/Makefile; then
98        AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
99    fi
100    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
101       test -f $with_add_source_root/hotspot/make/Makefile; then
102        AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
103    fi
104    if test -f $with_add_source_root/nashorn/makefiles/Makefile || \
105       test -f $with_add_source_root/nashorn/make/Makefile; then
106        AC_MSG_ERROR([Your add source root seems to contain a full nashorn repo! An add source root should only contain additional sources.])
107    fi
108    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
109       test -f $with_add_source_root/jdk/make/Makefile; then
110        AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
111    fi
112fi
113AC_SUBST(ADD_SRC_ROOT)
114
115if test "x$with_override_source_root" != x; then
116    if ! test -d $with_override_source_root; then
117       AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
118    fi
119    CURDIR="$PWD"
120    cd "$with_override_source_root"
121    OVERRIDE_SRC_ROOT="`pwd`"
122    cd "$CURDIR"
123    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
124       test -f $with_override_source_root/langtools/make/Makefile; then
125        AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
126    fi
127    if test -f $with_override_source_root/corba/makefiles/Makefile || \
128       test -f $with_override_source_root/corba/make/Makefile; then
129        AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
130    fi
131    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
132       test -f $with_override_source_root/jaxp/make/Makefile; then
133        AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
134    fi
135    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
136       test -f $with_override_source_root/jaxws/make/Makefile; then
137        AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
138    fi
139    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
140       test -f $with_override_source_root/hotspot/make/Makefile; then
141        AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
142    fi
143    if test -f $with_override_source_root/nashorn/makefiles/Makefile || \
144       test -f $with_override_source_root/nashorn/make/Makefile; then
145        AC_MSG_ERROR([Your override source root seems to contain a full nashorn repo! An override source root should only contain sources that override.])
146    fi
147    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
148       test -f $with_override_source_root/jdk/make/Makefile; then
149        AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
150    fi
151fi
152AC_SUBST(OVERRIDE_SRC_ROOT)
153
154###############################################################################
155#
156# Override a repo completely, this is used for example when you have 3 small
157# development sandboxes of the langtools sources and want to avoid having 3 full
158# OpenJDK sources checked out on disk.
159#
160# Assuming that the 3 langtools sandboxes are located here:
161# /home/fredrik/sandbox1/langtools
162# /home/fredrik/sandbox2/langtools
163# /home/fredrik/sandbox3/langtools
164#
165# From the source root you create build subdirs manually:
166#     mkdir -p build1 build2 build3 
167# in each build directory run:
168#     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
169#     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
170#     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
171#
172
173AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
174    [use this langtools dir for the build])])
175
176AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
177    [use this corba dir for the build])])
178
179AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
180	[use this jaxp dir for the build])])
181
182AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
183	[use this jaxws dir for the build])])
184
185AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
186	[use this hotspot dir for the build])])
187
188AC_ARG_WITH(override-nashorn, [AS_HELP_STRING([--with-override-nashorn],
189	[use this nashorn dir for the build])])
190
191AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
192	[use this jdk dir for the build])])
193
194if test "x$with_override_langtools" != x; then
195    CURDIR="$PWD"
196    cd "$with_override_langtools"
197    LANGTOOLS_TOPDIR="`pwd`"
198    cd "$CURDIR"
199    if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then
200        AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
201    fi
202    AC_MSG_CHECKING([if langtools should be overridden])
203    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
204fi    
205if test "x$with_override_corba" != x; then
206    CURDIR="$PWD"
207    cd "$with_override_corba"
208    CORBA_TOPDIR="`pwd`"
209    cd "$CURDIR"
210    if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then
211        AC_MSG_ERROR([You have to override corba with a full corba repo!])
212    fi
213    AC_MSG_CHECKING([if corba should be overridden])
214    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
215fi    
216if test "x$with_override_jaxp" != x; then
217    CURDIR="$PWD"
218    cd "$with_override_jaxp"
219    JAXP_TOPDIR="`pwd`"
220    cd "$CURDIR"
221    if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then
222        AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
223    fi
224    AC_MSG_CHECKING([if jaxp should be overridden])
225    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
226fi    
227if test "x$with_override_jaxws" != x; then
228    CURDIR="$PWD"
229    cd "$with_override_jaxws"
230    JAXWS_TOPDIR="`pwd`"
231    cd "$CURDIR"
232    if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then
233        AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
234    fi
235    AC_MSG_CHECKING([if jaxws should be overridden])
236    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
237fi    
238if test "x$with_override_hotspot" != x; then
239    CURDIR="$PWD"
240    cd "$with_override_hotspot"
241    HOTSPOT_TOPDIR="`pwd`"
242    cd "$CURDIR"
243    if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \
244       ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then
245        AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
246    fi
247    AC_MSG_CHECKING([if hotspot should be overridden])
248    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
249fi
250if test "x$with_override_nashorn" != x; then
251    CURDIR="$PWD"
252    cd "$with_override_nashorn"
253    NASHORN_TOPDIR="`pwd`"
254    cd "$CURDIR"
255    if ! test -f $NASHORN_TOPDIR/makefiles/Makefile; then
256        AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!])
257    fi
258    AC_MSG_CHECKING([if nashorn should be overridden])
259    AC_MSG_RESULT([yes with $NASHORN_TOPDIR])
260fi
261if test "x$with_override_jdk" != x; then
262    CURDIR="$PWD"
263    cd "$with_override_jdk"
264    JDK_TOPDIR="`pwd`"
265    cd "$CURDIR"
266    if ! test -f $JDK_TOPDIR/makefiles/Makefile; then
267        AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
268    fi
269    AC_MSG_CHECKING([if JDK should be overridden])
270    AC_MSG_RESULT([yes with $JDK_TOPDIR])
271fi    
272
273])
274
275AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
276[
277BUILD_OUTPUT="$OUTPUT_ROOT"
278AC_SUBST(BUILD_OUTPUT)
279
280HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
281BUILD_HOTSPOT=true
282AC_SUBST(HOTSPOT_DIST)
283AC_SUBST(BUILD_HOTSPOT)
284AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot],
285	[import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])])
286if test "x$with_import_hotspot" != x; then
287    CURDIR="$PWD"
288    cd "$with_import_hotspot"
289    HOTSPOT_DIST="`pwd`"
290    cd "$CURDIR"
291    if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then
292        AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!])
293    fi
294    AC_MSG_CHECKING([if hotspot should be imported])
295    AC_MSG_RESULT([yes from $HOTSPOT_DIST])
296    BUILD_HOTSPOT=false
297fi
298
299JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
300])
301