source-dirs.m4 revision 837:174a54ce39c4
1110940Strhodes#
2110940Strhodes# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3110940Strhodes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4110940Strhodes#
5110940Strhodes# This code is free software; you can redistribute it and/or modify it
6110940Strhodes# under the terms of the GNU General Public License version 2 only, as
7110940Strhodes# published by the Free Software Foundation.  Oracle designates this
8110940Strhodes# particular file as subject to the "Classpath" exception as provided
9110940Strhodes# by Oracle in the LICENSE file that accompanied this code.
10110940Strhodes#
11217464Smarius# This code is distributed in the hope that it will be useful, but WITHOUT
12110940Strhodes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13110940Strhodes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14110940Strhodes# version 2 for more details (a copy is included in the LICENSE file that
15110940Strhodes# accompanied this code).
16110940Strhodes#
17110940Strhodes# You should have received a copy of the GNU General Public License version
18110940Strhodes# 2 along with this work; if not, write to the Free Software Foundation,
19110940Strhodes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20110940Strhodes#
21110940Strhodes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22110940Strhodes# or visit www.oracle.com if you need additional information or have any
23110940Strhodes# questions.
24110940Strhodes#
25110940Strhodes
26110940StrhodesAC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS],
27110940Strhodes[
28110940Strhodes  # Where are the sources. Any of these can be overridden
29110940Strhodes  # using --with-override-corba and the likes.
30110940Strhodes  LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
31110940Strhodes  CORBA_TOPDIR="$SRC_ROOT/corba"
32110940Strhodes  JAXP_TOPDIR="$SRC_ROOT/jaxp"
33110940Strhodes  JAXWS_TOPDIR="$SRC_ROOT/jaxws"
34110940Strhodes  HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
35110940Strhodes  NASHORN_TOPDIR="$SRC_ROOT/nashorn"
36110940Strhodes  JDK_TOPDIR="$SRC_ROOT/jdk"
37110940Strhodes  AC_SUBST(LANGTOOLS_TOPDIR)
38110940Strhodes  AC_SUBST(CORBA_TOPDIR)
39110940Strhodes  AC_SUBST(JAXP_TOPDIR)
40110940Strhodes  AC_SUBST(JAXWS_TOPDIR)
41110940Strhodes  AC_SUBST(HOTSPOT_TOPDIR)
42110940Strhodes  AC_SUBST(NASHORN_TOPDIR)
43110940Strhodes  AC_SUBST(JDK_TOPDIR)
44110940Strhodes])
45110940Strhodes
46111190Sru
47111190SruAC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
48216580Syongari[
49216580Syongari
50179105Syongari  ###############################################################################
51179105Syongari  #
52193882Syongari  # Pickup additional source for a component from outside of the source root
53193882Syongari  # or override source for a component.
54184872Syongari  #
55184872Syongari  AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
56111190Sru      [for each and every source directory, look in this additional source root for
57111190Sru      the same directory; if it exists and have files in it, include it in the build])])
58124299Sbrueffer
59124299Sbrueffer  AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
60157650Sbrueffer      [for each and every source directory, look in this override source root for
61157650Sbrueffer      the same directory; if it exists, use that directory instead and
62124299Sbrueffer      ignore the directory in the original source root])])
63124299Sbrueffer
64111190Sru  AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
65111190Sru      [use the subdirs 'adds' and 'overrides' in the specified directory as
66194247Smarius      add-source-root and override-source-root])])
67194247Smarius
68111190Sru  if test "x$with_adds_and_overrides" != x; then
69111190Sru    with_add_source_root="$with_adds_and_overrides/adds"
70111190Sru    with_override_source_root="$with_adds_and_overrides/overrides"
71111190Sru  fi
72181620Skevlo
73181620Skevlo  if test "x$with_add_source_root" != x; then
74111190Sru    if ! test -d $with_add_source_root; then
75123869Strhodes      AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
76116166Stmm    fi
77116166Stmm    CURDIR="$PWD"
78116166Stmm    cd "$with_add_source_root"
79116166Stmm    ADD_SRC_ROOT="`pwd`"
80179342Syongari    cd "$CURDIR"
81179342Syongari    # Verify that the addon source root does not have any root makefiles.
82124299Sbrueffer    # If it does, then it is usually an error, prevent this.
83124299Sbrueffer    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
84165144Syongari      test -f $with_add_source_root/langtools/make/Makefile; then
85165144Syongari      AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
86170590Syongari    fi
87170590Syongari    if test -f $with_add_source_root/corba/makefiles/Makefile || \
88124299Sbrueffer      test -f $with_add_source_root/corba/make/Makefile; then
89124299Sbrueffer      AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
90146422Sbrueffer    fi
91146422Sbrueffer    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
92111190Sru      test -f $with_add_source_root/jaxp/make/Makefile; then
93111190Sru      AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
94124299Sbrueffer    fi
95124299Sbrueffer    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
96111190Sru      test -f $with_add_source_root/jaxws/make/Makefile; then
97111190Sru      AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
98122791Sakiyama    fi
99122791Sakiyama    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
100111190Sru      test -f $with_add_source_root/hotspot/make/Makefile; then
101111190Sru      AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
102206631Syongari    fi
103206631Syongari    if test -f $with_add_source_root/nashorn/makefiles/Makefile || \
104111190Sru      test -f $with_add_source_root/nashorn/make/Makefile; then
105111190Sru      AC_MSG_ERROR([Your add source root seems to contain a full nashorn repo! An add source root should only contain additional sources.])
106124299Sbrueffer    fi
107124299Sbrueffer    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
108111190Sru      test -f $with_add_source_root/jdk/make/Makefile; then
109111190Sru      AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
110160648Syongari    fi
111160648Syongari  fi
112111190Sru  AC_SUBST(ADD_SRC_ROOT)
113111190Sru
114111190Sru  if test "x$with_override_source_root" != x; then
115111190Sru    if ! test -d $with_override_source_root; then
116126341Sbrueffer      AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
117126341Sbrueffer    fi
118135124Sbrueffer    CURDIR="$PWD"
119135124Sbrueffer    cd "$with_override_source_root"
120111190Sru    OVERRIDE_SRC_ROOT="`pwd`"
121111190Sru    cd "$CURDIR"
122216831Syongari    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
123216831Syongari      test -f $with_override_source_root/langtools/make/Makefile; then
124111190Sru      AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
125111190Sru    fi
126111190Sru    if test -f $with_override_source_root/corba/makefiles/Makefile || \
127111190Sru      test -f $with_override_source_root/corba/make/Makefile; then
128110940Strhodes      AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
129110940Strhodes    fi
130110940Strhodes    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
131110940Strhodes      test -f $with_override_source_root/jaxp/make/Makefile; then
132110940Strhodes      AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
133110940Strhodes    fi
134111021Strhodes    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
135110940Strhodes      test -f $with_override_source_root/jaxws/make/Makefile; then
136110940Strhodes      AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
137110940Strhodes    fi
138110940Strhodes    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
139216580Syongari      test -f $with_override_source_root/hotspot/make/Makefile; then
140179105Syongari      AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
141193882Syongari    fi
142184872Syongari    if test -f $with_override_source_root/nashorn/makefiles/Makefile || \
143110947Strhodes      test -f $with_override_source_root/nashorn/make/Makefile; then
144110940Strhodes      AC_MSG_ERROR([Your override source root seems to contain a full nashorn repo! An override source root should only contain sources that override.])
145124299Sbrueffer    fi
146157650Sbrueffer    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
147124299Sbrueffer      test -f $with_override_source_root/jdk/make/Makefile; then
148110940Strhodes      AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
149194247Smarius    fi
150110940Strhodes  fi
151110940Strhodes  AC_SUBST(OVERRIDE_SRC_ROOT)
152181620Skevlo
153110940Strhodes  ###############################################################################
154116166Stmm  #
155116166Stmm  # Override a repo completely, this is used for example when you have 3 small
156179342Syongari  # development sandboxes of the langtools sources and want to avoid having 3 full
157124299Sbrueffer  # OpenJDK sources checked out on disk.
158165159Sbrueffer  #
159110947Strhodes  # Assuming that the 3 langtools sandboxes are located here:
160170590Syongari  # /home/fredrik/sandbox1/langtools
161124299Sbrueffer  # /home/fredrik/sandbox2/langtools
162146422Sbrueffer  # /home/fredrik/sandbox3/langtools
163110940Strhodes  #
164124299Sbrueffer  # From the source root you create build subdirs manually:
165217464Smarius  #     mkdir -p build1 build2 build3
166110940Strhodes  # in each build directory run:
167122791Sakiyama  #     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
168110940Strhodes  #     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
169206631Syongari  #     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
170110940Strhodes  #
171124299Sbrueffer
172110940Strhodes  AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
173160648Syongari      [use this langtools dir for the build])])
174110940Strhodes
175110940Strhodes  AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
176126341Sbrueffer      [use this corba dir for the build])])
177135124Sbrueffer
178110940Strhodes  AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
179216831Syongari      [use this jaxp dir for the build])])
180110940Strhodes
181111190Sru  AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
182110940Strhodes      [use this jaxws dir for the build])])
183110940Strhodes
184110940Strhodes  AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
185110940Strhodes      [use this hotspot dir for the build])])
186110940Strhodes
187110940Strhodes  AC_ARG_WITH(override-nashorn, [AS_HELP_STRING([--with-override-nashorn],
188110940Strhodes      [use this nashorn dir for the build])])
189110940Strhodes
190110940Strhodes  AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
191110940Strhodes      [use this jdk dir for the build])])
192
193  if test "x$with_override_langtools" != x; then
194    CURDIR="$PWD"
195    cd "$with_override_langtools"
196    LANGTOOLS_TOPDIR="`pwd`"
197    cd "$CURDIR"
198    if ! test -f $LANGTOOLS_TOPDIR/makefiles/Makefile; then
199      AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
200    fi
201    AC_MSG_CHECKING([if langtools should be overridden])
202    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
203  fi
204  if test "x$with_override_corba" != x; then
205    CURDIR="$PWD"
206    cd "$with_override_corba"
207    CORBA_TOPDIR="`pwd`"
208    cd "$CURDIR"
209    if ! test -f $CORBA_TOPDIR/makefiles/Makefile; then
210      AC_MSG_ERROR([You have to override corba with a full corba repo!])
211    fi
212    AC_MSG_CHECKING([if corba should be overridden])
213    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
214  fi
215  if test "x$with_override_jaxp" != x; then
216    CURDIR="$PWD"
217    cd "$with_override_jaxp"
218    JAXP_TOPDIR="`pwd`"
219    cd "$CURDIR"
220    if ! test -f $JAXP_TOPDIR/makefiles/Makefile; then
221      AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
222    fi
223    AC_MSG_CHECKING([if jaxp should be overridden])
224    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
225  fi
226  if test "x$with_override_jaxws" != x; then
227    CURDIR="$PWD"
228    cd "$with_override_jaxws"
229    JAXWS_TOPDIR="`pwd`"
230    cd "$CURDIR"
231    if ! test -f $JAXWS_TOPDIR/makefiles/Makefile; then
232      AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
233    fi
234    AC_MSG_CHECKING([if jaxws should be overridden])
235    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
236  fi
237  if test "x$with_override_hotspot" != x; then
238    CURDIR="$PWD"
239    cd "$with_override_hotspot"
240    HOTSPOT_TOPDIR="`pwd`"
241    cd "$CURDIR"
242    if ! test -f $HOTSPOT_TOPDIR/make/Makefile && \
243        ! test -f $HOTSPOT_TOPDIR/makefiles/Makefile; then
244      AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
245    fi
246    AC_MSG_CHECKING([if hotspot should be overridden])
247    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
248  fi
249  if test "x$with_override_nashorn" != x; then
250    CURDIR="$PWD"
251    cd "$with_override_nashorn"
252    NASHORN_TOPDIR="`pwd`"
253    cd "$CURDIR"
254    if ! test -f $NASHORN_TOPDIR/makefiles/Makefile; then
255      AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!])
256    fi
257    AC_MSG_CHECKING([if nashorn should be overridden])
258    AC_MSG_RESULT([yes with $NASHORN_TOPDIR])
259  fi
260  if test "x$with_override_jdk" != x; then
261    CURDIR="$PWD"
262    cd "$with_override_jdk"
263    JDK_TOPDIR="`pwd`"
264    cd "$CURDIR"
265    if ! test -f $JDK_TOPDIR/makefiles/Makefile; then
266      AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
267    fi
268    AC_MSG_CHECKING([if JDK should be overridden])
269    AC_MSG_RESULT([yes with $JDK_TOPDIR])
270  fi
271])
272
273AC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
274[
275  BUILD_OUTPUT="$OUTPUT_ROOT"
276  AC_SUBST(BUILD_OUTPUT)
277
278  HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
279  BUILD_HOTSPOT=true
280  AC_SUBST(HOTSPOT_DIST)
281  AC_SUBST(BUILD_HOTSPOT)
282  AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot],
283  [import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])])
284  if test "x$with_import_hotspot" != x; then
285    CURDIR="$PWD"
286    cd "$with_import_hotspot"
287    HOTSPOT_DIST="`pwd`"
288    cd "$CURDIR"
289    if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then
290      AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!])
291    fi
292    AC_MSG_CHECKING([if hotspot should be imported])
293    AC_MSG_RESULT([yes from $HOTSPOT_DIST])
294    BUILD_HOTSPOT=false
295  fi
296
297  JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
298])
299