source-dirs.m4 revision 837:174a54ce39c4
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  # Where are the sources. Any of these can be overridden
29  # using --with-override-corba and the likes.
30  LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
31  CORBA_TOPDIR="$SRC_ROOT/corba"
32  JAXP_TOPDIR="$SRC_ROOT/jaxp"
33  JAXWS_TOPDIR="$SRC_ROOT/jaxws"
34  HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
35  NASHORN_TOPDIR="$SRC_ROOT/nashorn"
36  JDK_TOPDIR="$SRC_ROOT/jdk"
37  AC_SUBST(LANGTOOLS_TOPDIR)
38  AC_SUBST(CORBA_TOPDIR)
39  AC_SUBST(JAXP_TOPDIR)
40  AC_SUBST(JAXWS_TOPDIR)
41  AC_SUBST(HOTSPOT_TOPDIR)
42  AC_SUBST(NASHORN_TOPDIR)
43  AC_SUBST(JDK_TOPDIR)
44])
45
46
47AC_DEFUN_ONCE([SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS],
48[
49
50  ###############################################################################
51  #
52  # Pickup additional source for a component from outside of the source root
53  # or override source for a component.
54  #
55  AC_ARG_WITH(add-source-root, [AS_HELP_STRING([--with-add-source-root],
56      [for each and every source directory, look in this additional source root for
57      the same directory; if it exists and have files in it, include it in the build])])
58
59  AC_ARG_WITH(override-source-root, [AS_HELP_STRING([--with-override-source-root],
60      [for each and every source directory, look in this override source root for
61      the same directory; if it exists, use that directory instead and
62      ignore the directory in the original source root])])
63
64  AC_ARG_WITH(adds-and-overrides, [AS_HELP_STRING([--with-adds-and-overrides],
65      [use the subdirs 'adds' and 'overrides' in the specified directory as
66      add-source-root and override-source-root])])
67
68  if test "x$with_adds_and_overrides" != x; then
69    with_add_source_root="$with_adds_and_overrides/adds"
70    with_override_source_root="$with_adds_and_overrides/overrides"
71  fi
72
73  if test "x$with_add_source_root" != x; then
74    if ! test -d $with_add_source_root; then
75      AC_MSG_ERROR([Trying to use a non-existant add-source-root $with_add_source_root])
76    fi
77    CURDIR="$PWD"
78    cd "$with_add_source_root"
79    ADD_SRC_ROOT="`pwd`"
80    cd "$CURDIR"
81    # Verify that the addon source root does not have any root makefiles.
82    # If it does, then it is usually an error, prevent this.
83    if test -f $with_add_source_root/langtools/makefiles/Makefile || \
84      test -f $with_add_source_root/langtools/make/Makefile; then
85      AC_MSG_ERROR([Your add source root seems to contain a full langtools repo! An add source root should only contain additional sources.])
86    fi
87    if test -f $with_add_source_root/corba/makefiles/Makefile || \
88      test -f $with_add_source_root/corba/make/Makefile; then
89      AC_MSG_ERROR([Your add source root seems to contain a full corba repo! An add source root should only contain additional sources.])
90    fi
91    if test -f $with_add_source_root/jaxp/makefiles/Makefile || \
92      test -f $with_add_source_root/jaxp/make/Makefile; then
93      AC_MSG_ERROR([Your add source root seems to contain a full jaxp repo! An add source root should only contain additional sources.])
94    fi
95    if test -f $with_add_source_root/jaxws/makefiles/Makefile || \
96      test -f $with_add_source_root/jaxws/make/Makefile; then
97      AC_MSG_ERROR([Your add source root seems to contain a full jaxws repo! An add source root should only contain additional sources.])
98    fi
99    if test -f $with_add_source_root/hotspot/makefiles/Makefile || \
100      test -f $with_add_source_root/hotspot/make/Makefile; then
101      AC_MSG_ERROR([Your add source root seems to contain a full hotspot repo! An add source root should only contain additional sources.])
102    fi
103    if test -f $with_add_source_root/nashorn/makefiles/Makefile || \
104      test -f $with_add_source_root/nashorn/make/Makefile; then
105      AC_MSG_ERROR([Your add source root seems to contain a full nashorn repo! An add source root should only contain additional sources.])
106    fi
107    if test -f $with_add_source_root/jdk/makefiles/Makefile || \
108      test -f $with_add_source_root/jdk/make/Makefile; then
109      AC_MSG_ERROR([Your add source root seems to contain a full JDK repo! An add source root should only contain additional sources.])
110    fi
111  fi
112  AC_SUBST(ADD_SRC_ROOT)
113
114  if test "x$with_override_source_root" != x; then
115    if ! test -d $with_override_source_root; then
116      AC_MSG_ERROR([Trying to use a non-existant override-source-root $with_override_source_root])
117    fi
118    CURDIR="$PWD"
119    cd "$with_override_source_root"
120    OVERRIDE_SRC_ROOT="`pwd`"
121    cd "$CURDIR"
122    if test -f $with_override_source_root/langtools/makefiles/Makefile || \
123      test -f $with_override_source_root/langtools/make/Makefile; then
124      AC_MSG_ERROR([Your override source root seems to contain a full langtools repo! An override source root should only contain sources that override.])
125    fi
126    if test -f $with_override_source_root/corba/makefiles/Makefile || \
127      test -f $with_override_source_root/corba/make/Makefile; then
128      AC_MSG_ERROR([Your override source root seems to contain a full corba repo! An override source root should only contain sources that override.])
129    fi
130    if test -f $with_override_source_root/jaxp/makefiles/Makefile || \
131      test -f $with_override_source_root/jaxp/make/Makefile; then
132      AC_MSG_ERROR([Your override source root seems to contain a full jaxp repo! An override source root should only contain sources that override.])
133    fi
134    if test -f $with_override_source_root/jaxws/makefiles/Makefile || \
135      test -f $with_override_source_root/jaxws/make/Makefile; then
136      AC_MSG_ERROR([Your override source root seems to contain a full jaxws repo! An override source root should only contain sources that override.])
137    fi
138    if test -f $with_override_source_root/hotspot/makefiles/Makefile || \
139      test -f $with_override_source_root/hotspot/make/Makefile; then
140      AC_MSG_ERROR([Your override source root seems to contain a full hotspot repo! An override source root should only contain sources that override.])
141    fi
142    if test -f $with_override_source_root/nashorn/makefiles/Makefile || \
143      test -f $with_override_source_root/nashorn/make/Makefile; then
144      AC_MSG_ERROR([Your override source root seems to contain a full nashorn repo! An override source root should only contain sources that override.])
145    fi
146    if test -f $with_override_source_root/jdk/makefiles/Makefile || \
147      test -f $with_override_source_root/jdk/make/Makefile; then
148      AC_MSG_ERROR([Your override source root seems to contain a full JDK repo! An override source root should only contain sources that override.])
149    fi
150  fi
151  AC_SUBST(OVERRIDE_SRC_ROOT)
152
153  ###############################################################################
154  #
155  # Override a repo completely, this is used for example when you have 3 small
156  # development sandboxes of the langtools sources and want to avoid having 3 full
157  # OpenJDK sources checked out on disk.
158  #
159  # Assuming that the 3 langtools sandboxes are located here:
160  # /home/fredrik/sandbox1/langtools
161  # /home/fredrik/sandbox2/langtools
162  # /home/fredrik/sandbox3/langtools
163  #
164  # From the source root you create build subdirs manually:
165  #     mkdir -p build1 build2 build3
166  # in each build directory run:
167  #     (cd build1 && ../configure --with-override-langtools=/home/fredrik/sandbox1 && make)
168  #     (cd build2 && ../configure --with-override-langtools=/home/fredrik/sandbox2 && make)
169  #     (cd build3 && ../configure --with-override-langtools=/home/fredrik/sandbox3 && make)
170  #
171
172  AC_ARG_WITH(override-langtools, [AS_HELP_STRING([--with-override-langtools],
173      [use this langtools dir for the build])])
174
175  AC_ARG_WITH(override-corba, [AS_HELP_STRING([--with-override-corba],
176      [use this corba dir for the build])])
177
178  AC_ARG_WITH(override-jaxp, [AS_HELP_STRING([--with-override-jaxp],
179      [use this jaxp dir for the build])])
180
181  AC_ARG_WITH(override-jaxws, [AS_HELP_STRING([--with-override-jaxws],
182      [use this jaxws dir for the build])])
183
184  AC_ARG_WITH(override-hotspot, [AS_HELP_STRING([--with-override-hotspot],
185      [use this hotspot dir for the build])])
186
187  AC_ARG_WITH(override-nashorn, [AS_HELP_STRING([--with-override-nashorn],
188      [use this nashorn dir for the build])])
189
190  AC_ARG_WITH(override-jdk, [AS_HELP_STRING([--with-override-jdk],
191      [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