source-dirs.m4 revision 910:a667caba1e84
1343181Sdim#
2343181Sdim# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3353358Sdim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4353358Sdim#
5353358Sdim# This code is free software; you can redistribute it and/or modify it
6343181Sdim# under the terms of the GNU General Public License version 2 only, as
7343181Sdim# published by the Free Software Foundation.  Oracle designates this
8343181Sdim# particular file as subject to the "Classpath" exception as provided
9343181Sdim# by Oracle in the LICENSE file that accompanied this code.
10343181Sdim#
11343181Sdim# This code is distributed in the hope that it will be useful, but WITHOUT
12343181Sdim# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13343181Sdim# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14343181Sdim# version 2 for more details (a copy is included in the LICENSE file that
15343181Sdim# accompanied this code).
16343181Sdim#
17343181Sdim# You should have received a copy of the GNU General Public License version
18343181Sdim# 2 along with this work; if not, write to the Free Software Foundation,
19343181Sdim# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20343181Sdim#
21343181Sdim# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22343181Sdim# or visit www.oracle.com if you need additional information or have any
23343181Sdim# questions.
24343181Sdim#
25343181Sdim
26343181SdimAC_DEFUN_ONCE([SRCDIRS_SETUP_TOPDIRS],
27343181Sdim[
28343181Sdim  # Where are the sources. Any of these can be overridden
29343181Sdim  # using --with-override-corba and the likes.
30343181Sdim  LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
31343181Sdim  CORBA_TOPDIR="$SRC_ROOT/corba"
32343181Sdim  JAXP_TOPDIR="$SRC_ROOT/jaxp"
33343181Sdim  JAXWS_TOPDIR="$SRC_ROOT/jaxws"
34343181Sdim  HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
35343181Sdim  NASHORN_TOPDIR="$SRC_ROOT/nashorn"
36343181Sdim  JDK_TOPDIR="$SRC_ROOT/jdk"
37343181Sdim  AC_SUBST(LANGTOOLS_TOPDIR)
38343181Sdim  AC_SUBST(CORBA_TOPDIR)
39343181Sdim  AC_SUBST(JAXP_TOPDIR)
40343181Sdim  AC_SUBST(JAXWS_TOPDIR)
41343181Sdim  AC_SUBST(HOTSPOT_TOPDIR)
42343181Sdim  AC_SUBST(NASHORN_TOPDIR)
43343181Sdim  AC_SUBST(JDK_TOPDIR)
44343181Sdim])
45343181Sdim
46343181Sdim
47343181SdimAC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
48343181Sdim[
49343181Sdim
50343181Sdim  ###############################################################################
51343181Sdim  #
52343181Sdim  # Pickup additional source for a component from outside of the source root
53343181Sdim  # or override source for a component.
54343181Sdim  #
55343181Sdim  AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
56343181Sdim      [for each and every source directory, look in this additional source root for
57343181Sdim      the same directory; if it exists and have files in it, include it in the build])])
58343181Sdim
59343181Sdim  AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
60343181Sdim      [for each and every source directory, look in this override source root for
61343181Sdim      the same directory; if it exists, use that directory instead and
62343181Sdim      ignore the directory in the original source root])])
63343181Sdim
64343181Sdim  AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
65343181Sdim      [use the subdirs 'adds' and 'overrides' in the specified directory as
66343181Sdim      add-source-root and override-source-root])])
67343181Sdim
68343181Sdim  if test "x$with_adds_and_overrides" != x; then
69343181Sdim    with_add_source_root="$with_adds_and_overrides/adds"
70343181Sdim    with_override_source_root="$with_adds_and_overrides/overrides"
71343181Sdim  fi
72343181Sdim
73343181Sdim  if test "x$with_add_source_root" != x; then
74343181Sdim    if ! test -d $with_add_source_root; then
75343181Sdim      AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
76343181Sdim    fi
77343181Sdim    CURDIR="$PWD"
78343181Sdim    cd "$with_add_source_root"
79343181Sdim    ADD_SRC_ROOT="`pwd`"
80343181Sdim    cd "$CURDIR"
81343181Sdim    # Verify that the addon source root does not have any root makefiles.
82343181Sdim    # If it does, then it is usually an error, prevent this.
83343181Sdim    if test -f $with_add_source_root/langtools/make/Makefile; then
84343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
85343181Sdim    fi
86343181Sdim    if test -f $with_add_source_root/corba/make/Makefile; then
87343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
88343181Sdim    fi
89343181Sdim    if test -f $with_add_source_root/jaxp/make/Makefile; then
90343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
91343181Sdim    fi
92343181Sdim    if test -f $with_add_source_root/jaxws/make/Makefile; then
93343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
94343181Sdim    fi
95343181Sdim    if test -f $with_add_source_root/hotspot/make/Makefile; then
96343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
97343181Sdim    fi
98343181Sdim    if test -f $with_add_source_root/nashorn/make/Makefile; then
99343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full nashorn repo! An add source root should only contain additional sources.])
100343181Sdim    fi
101343181Sdim    if test -f $with_add_source_root/jdk/make/Makefile; then
102343181Sdim      AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
103343181Sdim    fi
104343181Sdim  fi
105343181Sdim  AC_SUBST(ADD_SRC_ROOT)
106343181Sdim
107343181Sdim  if test "x$with_override_source_root" != x; then
108343181Sdim    if ! test -d $with_override_source_root; then
109343181Sdim      AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
110343181Sdim    fi
111343181Sdim    CURDIR="$PWD"
112343181Sdim    cd "$with_override_source_root"
113343181Sdim    OVERRIDE_SRC_ROOT="`pwd`"
114343181Sdim    cd "$CURDIR"
115343181Sdim    if test -f $with_override_source_root/langtools/make/Makefile; then
116343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
117343181Sdim    fi
118343181Sdim    if test -f $with_override_source_root/corba/make/Makefile; then
119343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
120343181Sdim    fi
121343181Sdim    if test -f $with_override_source_root/jaxp/make/Makefile; then
122343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
123343181Sdim    fi
124343181Sdim    if test -f $with_override_source_root/jaxws/make/Makefile; then
125343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
126343181Sdim    fi
127343181Sdim    if test -f $with_override_source_root/hotspot/make/Makefile; then
128343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
129343181Sdim    fi
130343181Sdim    if test -f $with_override_source_root/nashorn/make/Makefile; then
131343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full nashorn repo! An override source root should only contain sources that override.])
132343181Sdim    fi
133343181Sdim    if test -f $with_override_source_root/jdk/make/Makefile; then
134343181Sdim      AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
135343181Sdim    fi
136343181Sdim  fi
137343181Sdim  AC_SUBST(OVERRIDE_SRC_ROOT)
138343181Sdim
139343181Sdim  ###############################################################################
140343181Sdim  #
141343181Sdim  # Override a repo completely, this is used for example when you have 3 small
142343181Sdim  # development sandboxes of the langtools sources and want to avoid having 3 full
143343181Sdim  # OpenJDK sources checked out on disk.
144343181Sdim  #
145343181Sdim  # Assuming that the 3 langtools sandboxes are located here:
146343181Sdim  # /home/fredrik/sandbox1/langtools
147343181Sdim  # /home/fredrik/sandbox2/langtools
148353358Sdim  # /home/fredrik/sandbox3/langtools
149343181Sdim  #
150343181Sdim  # From the source root you create build subdirs manually:
151353358Sdim  #     mkdir -p build1 build2 build3
152343181Sdim  # in each build directory run:
153343181Sdim  #     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
154353358Sdim  #     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
155343181Sdim  #     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
156343181Sdim  #
157343181Sdim
158353358Sdim  AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
159343181Sdim      [use this langtools dir for the build])])
160343181Sdim
161343181Sdim  AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
162343181Sdim      [use this corba dir for the build])])
163343181Sdim
164353358Sdim  AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
165353358Sdim      [use this jaxp dir for the build])])
166353358Sdim
167343181Sdim  AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
168343181Sdim      [use this jaxws dir for the build])])
169343181Sdim
170343181Sdim  AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
171343181Sdim      [use this hotspot dir for the build])])
172343181Sdim
173343181Sdim  AC_ARG_WITH(override-nashorn, [AS_HELP_STRING([--with-override-nashorn],
174343181Sdim      [use this nashorn dir for the build])])
175343181Sdim
176343181Sdim  AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
177343181Sdim      [use this jdk dir for the build])])
178343181Sdim
179343181Sdim  if test "x$with_override_langtools" != x; then
180343181Sdim    CURDIR="$PWD"
181343181Sdim    cd "$with_override_langtools"
182343181Sdim    LANGTOOLS_TOPDIR="`pwd`"
183343181Sdim    cd "$CURDIR"
184343181Sdim    if ! test -f $LANGTOOLS_TOPDIR/make/Makefile; then
185343181Sdim      AC_MSG_ERROR([You have to override langtools with a full langtools repo!])
186343181Sdim    fi
187343181Sdim    AC_MSG_CHECKING([if langtools should be overridden])
188343181Sdim    AC_MSG_RESULT([yes with $LANGTOOLS_TOPDIR])
189343181Sdim  fi
190343181Sdim  if test "x$with_override_corba" != x; then
191343181Sdim    CURDIR="$PWD"
192343181Sdim    cd "$with_override_corba"
193343181Sdim    CORBA_TOPDIR="`pwd`"
194343181Sdim    cd "$CURDIR"
195343181Sdim    if ! test -f $CORBA_TOPDIR/make/Makefile; then
196343181Sdim      AC_MSG_ERROR([You have to override corba with a full corba repo!])
197343181Sdim    fi
198343181Sdim    AC_MSG_CHECKING([if corba should be overridden])
199343181Sdim    AC_MSG_RESULT([yes with $CORBA_TOPDIR])
200343181Sdim  fi
201343181Sdim  if test "x$with_override_jaxp" != x; then
202343181Sdim    CURDIR="$PWD"
203343181Sdim    cd "$with_override_jaxp"
204343181Sdim    JAXP_TOPDIR="`pwd`"
205343181Sdim    cd "$CURDIR"
206343181Sdim    if ! test -f $JAXP_TOPDIR/make/Makefile; then
207343181Sdim      AC_MSG_ERROR([You have to override jaxp with a full jaxp repo!])
208343181Sdim    fi
209343181Sdim    AC_MSG_CHECKING([if jaxp should be overridden])
210343181Sdim    AC_MSG_RESULT([yes with $JAXP_TOPDIR])
211343181Sdim  fi
212343181Sdim  if test "x$with_override_jaxws" != x; then
213343181Sdim    CURDIR="$PWD"
214343181Sdim    cd "$with_override_jaxws"
215343181Sdim    JAXWS_TOPDIR="`pwd`"
216343181Sdim    cd "$CURDIR"
217343181Sdim    if ! test -f $JAXWS_TOPDIR/make/Makefile; then
218343181Sdim      AC_MSG_ERROR([You have to override jaxws with a full jaxws repo!])
219343181Sdim    fi
220343181Sdim    AC_MSG_CHECKING([if jaxws should be overridden])
221343181Sdim    AC_MSG_RESULT([yes with $JAXWS_TOPDIR])
222343181Sdim  fi
223343181Sdim  if test "x$with_override_hotspot" != x; then
224343181Sdim    CURDIR="$PWD"
225343181Sdim    cd "$with_override_hotspot"
226343181Sdim    HOTSPOT_TOPDIR="`pwd`"
227343181Sdim    cd "$CURDIR"
228343181Sdim    if ! test -f $HOTSPOT_TOPDIR/make/Makefile; then
229343181Sdim      AC_MSG_ERROR([You have to override hotspot with a full hotspot repo!])
230343181Sdim    fi
231343181Sdim    AC_MSG_CHECKING([if hotspot should be overridden])
232343181Sdim    AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
233343181Sdim  fi
234343181Sdim  if test "x$with_override_nashorn" != x; then
235343181Sdim    CURDIR="$PWD"
236343181Sdim    cd "$with_override_nashorn"
237343181Sdim    NASHORN_TOPDIR="`pwd`"
238343181Sdim    cd "$CURDIR"
239343181Sdim    if ! test -f $NASHORN_TOPDIR/make/Makefile; then
240343181Sdim      AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!])
241343181Sdim    fi
242343181Sdim    AC_MSG_CHECKING([if nashorn should be overridden])
243343181Sdim    AC_MSG_RESULT([yes with $NASHORN_TOPDIR])
244343181Sdim  fi
245343181Sdim  if test "x$with_override_jdk" != x; then
246343181Sdim    CURDIR="$PWD"
247343181Sdim    cd "$with_override_jdk"
248343181Sdim    JDK_TOPDIR="`pwd`"
249343181Sdim    cd "$CURDIR"
250343181Sdim    if ! test -f $JDK_TOPDIR/make/Makefile; then
251343181Sdim      AC_MSG_ERROR([You have to override JDK with a full JDK repo!])
252343181Sdim    fi
253343181Sdim    AC_MSG_CHECKING([if JDK should be overridden])
254343181Sdim    AC_MSG_RESULT([yes with $JDK_TOPDIR])
255343181Sdim  fi
256343181Sdim])
257343181Sdim
258343181SdimAC_DEFUN_ONCE([SRCDIRS_SETUP_OUTPUT_DIRS],
259343181Sdim[
260343181Sdim  BUILD_OUTPUT="$OUTPUT_ROOT"
261343181Sdim  AC_SUBST(BUILD_OUTPUT)
262343181Sdim
263343181Sdim  HOTSPOT_DIST="$OUTPUT_ROOT/hotspot/dist"
264343181Sdim  BUILD_HOTSPOT=true
265343181Sdim  AC_SUBST(HOTSPOT_DIST)
266343181Sdim  AC_SUBST(BUILD_HOTSPOT)
267343181Sdim  AC_ARG_WITH(import-hotspot, [AS_HELP_STRING([--with-import-hotspot],
268343181Sdim  [import hotspot binaries from this jdk image or hotspot build dist dir instead of building from source])])
269343181Sdim  if test "x$with_import_hotspot" != x; then
270343181Sdim    CURDIR="$PWD"
271343181Sdim    cd "$with_import_hotspot"
272343181Sdim    HOTSPOT_DIST="`pwd`"
273343181Sdim    cd "$CURDIR"
274343181Sdim    if ! (test -d $HOTSPOT_DIST/lib && test -d $HOTSPOT_DIST/jre/lib); then
275343181Sdim      AC_MSG_ERROR([You have to import hotspot from a full jdk image or hotspot build dist dir!])
276343181Sdim    fi
277343181Sdim    AC_MSG_CHECKING([if hotspot should be imported])
278343181Sdim    AC_MSG_RESULT([yes from $HOTSPOT_DIST])
279343181Sdim    BUILD_HOTSPOT=false
280343181Sdim  fi
281343181Sdim
282343181Sdim  JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
283343181Sdim])
284343181Sdim