jdk-options.m4 revision 1864:835bd2b64b75
1194676Sthompsa#
2194676Sthompsa# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3194676Sthompsa# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4194676Sthompsa#
5194676Sthompsa# This code is free software; you can redistribute it and/or modify it
6194676Sthompsa# under the terms of the GNU General Public License version 2 only, as
7194676Sthompsa# published by the Free Software Foundation.  Oracle designates this
8194676Sthompsa# particular file as subject to the "Classpath" exception as provided
9194676Sthompsa# by Oracle in the LICENSE file that accompanied this code.
10194676Sthompsa#
11194676Sthompsa# This code is distributed in the hope that it will be useful, but WITHOUT
12194676Sthompsa# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13194676Sthompsa# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14194676Sthompsa# version 2 for more details (a copy is included in the LICENSE file that
15194676Sthompsa# accompanied this code).
16194676Sthompsa#
17194676Sthompsa# You should have received a copy of the GNU General Public License version
18194676Sthompsa# 2 along with this work; if not, write to the Free Software Foundation,
19194676Sthompsa# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20194676Sthompsa#
21194676Sthompsa# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22194676Sthompsa# or visit www.oracle.com if you need additional information or have any
23194676Sthompsa# questions.
24194676Sthompsa#
25194676Sthompsa
26194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
27194676Sthompsa[
28194676Sthompsa  ###############################################################################
29194676Sthompsa  #
30248236Shselasky  # Check which variant of the JDK that we want to build.
31248236Shselasky  # Currently we have:
32195560Sthompsa  #    normal:   standard edition
33195560Sthompsa  # but the custom make system may add other variants
34248236Shselasky  #
35195560Sthompsa  # Effectively the JDK variant gives a name to a specific set of
36301957Shselasky  # modules to compile into the JDK. In the future, these modules
37301957Shselasky  # might even be Jigsaw modules.
38266664Shselasky  #
39266664Shselasky  AC_MSG_CHECKING([which variant of the JDK to build])
40194676Sthompsa  AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
41194676Sthompsa      [JDK variant to build (normal) @<:@normal@:>@])])
42194676Sthompsa
43194676Sthompsa  if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
44194676Sthompsa    JDK_VARIANT="normal"
45194676Sthompsa  else
46194676Sthompsa    AC_MSG_ERROR([The available JDK variants are: normal])
47194676Sthompsa  fi
48194676Sthompsa
49194676Sthompsa  AC_SUBST(JDK_VARIANT)
50194676Sthompsa
51194676Sthompsa  AC_MSG_RESULT([$JDK_VARIANT])
52194676Sthompsa])
53194676Sthompsa
54194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_JVM_INTERPRETER],
55362224Skevans[
56194676Sthompsa###############################################################################
57270133Shselasky#
58194676Sthompsa# Check which interpreter of the JVM we want to build.
59194676Sthompsa# Currently we have:
60194676Sthompsa#    template: Template interpreter (the default)
61194676Sthompsa#    cpp     : C++ interpreter
62270133ShselaskyAC_MSG_CHECKING([which interpreter of the JVM to build])
63270133ShselaskyAC_ARG_WITH([jvm-interpreter], [AS_HELP_STRING([--with-jvm-interpreter],
64270133Shselasky	[JVM interpreter to build (template, cpp) @<:@template@:>@])])
65270133Shselasky
66270133Shselaskyif test "x$with_jvm_interpreter" = x; then
67270133Shselasky     with_jvm_interpreter="template"
68270133Shselaskyfi
69194676Sthompsa
70194676SthompsaJVM_INTERPRETER="$with_jvm_interpreter"
71194676Sthompsa
72194676Sthompsaif test "x$JVM_INTERPRETER" != xtemplate && test "x$JVM_INTERPRETER" != xcpp; then
73194676Sthompsa   AC_MSG_ERROR([The available JVM interpreters are: template, cpp])
74194676Sthompsafi
75194676Sthompsa
76194676SthompsaAC_SUBST(JVM_INTERPRETER)
77194676Sthompsa
78194676SthompsaAC_MSG_RESULT([$with_jvm_interpreter])
79194676Sthompsa])
80194676Sthompsa
81194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
82227404Shselasky[
83227404Shselasky
84227404Shselasky  ###############################################################################
85194676Sthompsa  #
86194676Sthompsa  # Check which variants of the JVM that we want to build.
87227404Shselasky  # Currently we have:
88227404Shselasky  #    server: normal interpreter and a tiered C1/C2 compiler
89227404Shselasky  #    client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms)
90227404Shselasky  #    minimal1: reduced form of client with optional VM services and features stripped out
91227404Shselasky  #    kernel: kernel footprint JVM that passes the TCK without major performance problems,
92227404Shselasky  #             ie normal interpreter and C1, only the serial GC, kernel jvmti etc
93227404Shselasky  #    zero: no machine code interpreter, no compiler
94194676Sthompsa  #    zeroshark: zero interpreter and shark/llvm compiler backend
95194676Sthompsa#    core: interpreter only, no compiler (only works on some platforms)
96194676Sthompsa  AC_MSG_CHECKING([which variants of the JVM to build])
97194676Sthompsa  AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
98194676Sthompsa	[JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark, core) @<:@server@:>@])])
99194676Sthompsa
100227404Shselasky  if test "x$with_jvm_variants" = x; then
101227404Shselasky    with_jvm_variants="server"
102227404Shselasky  fi
103227404Shselasky
104194676Sthompsa  JVM_VARIANTS=",$with_jvm_variants,"
105301968Shselasky  TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//'  -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//' -e 's/core,//'`
106301968Shselasky
107301968Shselasky  if test "x$TEST_VARIANTS" != "x,"; then
108301968Shselasky     AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark, core])
109194676Sthompsa  fi
110194676Sthompsa  AC_MSG_RESULT([$with_jvm_variants])
111194676Sthompsa
112194676Sthompsa  JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
113194676Sthompsa  JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'`
114194676Sthompsa  JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'`
115194676Sthompsa  JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
116194676Sthompsa  JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
117194676Sthompsa  JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
118194676Sthompsa  JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'`
119194676Sthompsa
120194676Sthompsa  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
121194676Sthompsa    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
122194676Sthompsa      AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
123194676Sthompsa    fi
124194676Sthompsa  fi
125194676Sthompsa  if test "x$JVM_VARIANT_KERNEL" = xtrue; then
126194676Sthompsa    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
127194676Sthompsa      AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
128194676Sthompsa    fi
129194676Sthompsa  fi
130194676Sthompsa  if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
131194676Sthompsa    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
132194676Sthompsa      AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.])
133194676Sthompsa    fi
134194676Sthompsa  fi
135194676Sthompsa
136194676Sthompsa  # Replace the commas with AND for use in the build directory name.
137194676Sthompsa  ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'`
138277245Shselasky  COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/' -e 's/core,/1/'`
139277245Shselasky  if test "x$COUNT_VARIANTS" != "x,1"; then
140194676Sthompsa    BUILDING_MULTIPLE_JVM_VARIANTS=yes
141194676Sthompsa  else
142194676Sthompsa    BUILDING_MULTIPLE_JVM_VARIANTS=no
143194676Sthompsa  fi
144194676Sthompsa
145194676Sthompsa  AC_SUBST(JVM_VARIANTS)
146194676Sthompsa  AC_SUBST(JVM_VARIANT_SERVER)
147194676Sthompsa  AC_SUBST(JVM_VARIANT_CLIENT)
148194676Sthompsa  AC_SUBST(JVM_VARIANT_MINIMAL1)
149194676Sthompsa  AC_SUBST(JVM_VARIANT_KERNEL)
150194676Sthompsa  AC_SUBST(JVM_VARIANT_ZERO)
151194676Sthompsa  AC_SUBST(JVM_VARIANT_ZEROSHARK)
152194676Sthompsa  AC_SUBST(JVM_VARIANT_CORE)
153194676Sthompsa
154194676Sthompsa  INCLUDE_SA=true
155194676Sthompsa  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
156194676Sthompsa    INCLUDE_SA=false
157194676Sthompsa  fi
158194676Sthompsa  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
159194676Sthompsa    INCLUDE_SA=false
160194676Sthompsa  fi
161194676Sthompsa  if test "x$OPENJDK_TARGET_OS" = xaix ; then
162194676Sthompsa    INCLUDE_SA=false
163194676Sthompsa  fi
164194676Sthompsa  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
165194676Sthompsa    INCLUDE_SA=false
166194676Sthompsa  fi
167194676Sthompsa  AC_SUBST(INCLUDE_SA)
168194676Sthompsa
169194676Sthompsa  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
170194676Sthompsa    MACOSX_UNIVERSAL="true"
171194676Sthompsa  fi
172194676Sthompsa
173301968Shselasky  AC_SUBST(MACOSX_UNIVERSAL)
174301968Shselasky])
175301968Shselasky
176301968ShselaskyAC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
177301968Shselasky[
178301968Shselasky  ###############################################################################
179301968Shselasky  #
180362224Skevans  # Set the debug level
181362224Skevans  #    release: no debug information, all optimizations, no asserts.
182362224Skevans  #    optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'.
183362224Skevans  #    fastdebug: debug information (-g), all optimizations, all asserts
184362224Skevans  #    slowdebug: debug information (-g), no optimizations, all asserts
185362224Skevans  #
186362224Skevans  DEBUG_LEVEL="release"
187362224Skevans  AC_MSG_CHECKING([which debug level to use])
188362224Skevans  AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
189362224Skevans      [set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
190362224Skevans      [
191362224Skevans        ENABLE_DEBUG="${enableval}"
192362224Skevans        DEBUG_LEVEL="fastdebug"
193362224Skevans      ], [ENABLE_DEBUG="no"])
194362224Skevans
195194676Sthompsa  AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
196194676Sthompsa      [set the debug level (release, fastdebug, slowdebug, optimized (HotSpot build only)) @<:@release@:>@])],
197194676Sthompsa      [
198194676Sthompsa        DEBUG_LEVEL="${withval}"
199194676Sthompsa        if test "x$ENABLE_DEBUG" = xyes; then
200194676Sthompsa          AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
201194676Sthompsa        fi
202194676Sthompsa      ])
203194676Sthompsa  AC_MSG_RESULT([$DEBUG_LEVEL])
204194676Sthompsa
205194676Sthompsa  if test "x$DEBUG_LEVEL" != xrelease && \
206194676Sthompsa      test "x$DEBUG_LEVEL" != xoptimized && \
207194676Sthompsa      test "x$DEBUG_LEVEL" != xfastdebug && \
208194676Sthompsa      test "x$DEBUG_LEVEL" != xslowdebug; then
209194676Sthompsa    AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
210194676Sthompsa  fi
211194676Sthompsa
212224903Shselasky
213224903Shselasky  ###############################################################################
214224903Shselasky  #
215224903Shselasky  # Setup legacy vars/targets and new vars to deal with different debug levels.
216224903Shselasky  #
217224903Shselasky
218224903Shselasky  case $DEBUG_LEVEL in
219224903Shselasky    release )
220194676Sthompsa      VARIANT="OPT"
221194676Sthompsa      FASTDEBUG="false"
222194676Sthompsa      DEBUG_CLASSFILES="false"
223194676Sthompsa      BUILD_VARIANT_RELEASE=""
224194676Sthompsa      HOTSPOT_DEBUG_LEVEL="product"
225194676Sthompsa      HOTSPOT_EXPORT="product"
226194676Sthompsa      ;;
227194676Sthompsa    fastdebug )
228194676Sthompsa      VARIANT="DBG"
229194676Sthompsa      FASTDEBUG="true"
230194676Sthompsa      DEBUG_CLASSFILES="true"
231194676Sthompsa      BUILD_VARIANT_RELEASE="-fastdebug"
232194676Sthompsa      HOTSPOT_DEBUG_LEVEL="fastdebug"
233194676Sthompsa      HOTSPOT_EXPORT="fastdebug"
234194676Sthompsa      ;;
235194676Sthompsa    slowdebug )
236263191Seadler      VARIANT="DBG"
237263191Seadler      FASTDEBUG="false"
238263191Seadler      DEBUG_CLASSFILES="true"
239263191Seadler      BUILD_VARIANT_RELEASE="-debug"
240263191Seadler      HOTSPOT_DEBUG_LEVEL="debug"
241263191Seadler      HOTSPOT_EXPORT="debug"
242263191Seadler      ;;
243263191Seadler    optimized )
244263191Seadler      VARIANT="OPT"
245263191Seadler      FASTDEBUG="false"
246263191Seadler      DEBUG_CLASSFILES="false"
247263191Seadler      BUILD_VARIANT_RELEASE="-optimized"
248263191Seadler      HOTSPOT_DEBUG_LEVEL="optimized"
249194676Sthompsa      HOTSPOT_EXPORT="optimized"
250194676Sthompsa      ;;
251194676Sthompsa  esac
252194676Sthompsa
253194676Sthompsa  # The debug level 'optimized' is a little special because it is currently only
254194676Sthompsa  # applicable to the HotSpot build where it means to build a completely
255302080Shselasky  # optimized version of the VM without any debugging code (like for the
256302080Shselasky  # 'release' debug level which is called 'product' in the HotSpot build) but
257302080Shselasky  # with the exception that it can contain additional code which is otherwise
258302080Shselasky  # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
259302080Shselasky  # test new and/or experimental features which are not intended for customer
260302080Shselasky  # shipment. Because these new features need to be tested and benchmarked in
261302080Shselasky  # real world scenarios, we want to build the containing JDK at the 'release'
262302080Shselasky  # debug level.
263302080Shselasky  if test "x$DEBUG_LEVEL" = xoptimized; then
264302080Shselasky    DEBUG_LEVEL="release"
265302080Shselasky  fi
266302080Shselasky
267195957Salfred  #####
268195560Sthompsa  # Generate the legacy makefile targets for hotspot.
269195957Salfred  # The hotspot api for selecting the build artifacts, really, needs to be improved.
270195957Salfred  # JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to
271195957Salfred  # determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc
272208020Sthompsa  # But until then ...
273302171Shselasky  HOTSPOT_TARGET=""
274195957Salfred
275195957Salfred  if test "x$JVM_VARIANT_SERVER" = xtrue; then
276195560Sthompsa    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
277195560Sthompsa  fi
278195560Sthompsa
279195560Sthompsa  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
280301956Shselasky    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
281301956Shselasky  fi
282301956Shselasky
283301956Shselasky  if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
284301956Shselasky    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 "
285301956Shselasky  fi
286301956Shselasky
287301956Shselasky  if test "x$JVM_VARIANT_KERNEL" = xtrue; then
288301956Shselasky    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
289195957Salfred  fi
290195957Salfred
291208020Sthompsa  if test "x$JVM_VARIANT_ZERO" = xtrue; then
292195957Salfred    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
293194676Sthompsa  fi
294194676Sthompsa
295302171Shselasky  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
296194676Sthompsa    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
297194676Sthompsa  fi
298194676Sthompsa
299194676Sthompsa  if test "x$JVM_VARIANT_CORE" = xtrue; then
300194676Sthompsa    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core "
301194676Sthompsa  fi
302194676Sthompsa
303194676Sthompsa  HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
304194676Sthompsa
305194676Sthompsa  # On Macosx universal binaries are produced, but they only contain
306194676Sthompsa  # 64 bit intel. This invalidates control of which jvms are built
307194676Sthompsa  # from configure, but only server is valid anyway. Fix this
308194676Sthompsa  # when hotspot makefiles are rewritten.
309194676Sthompsa  if test "x$MACOSX_UNIVERSAL" = xtrue; then
310194676Sthompsa    HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT}
311194676Sthompsa  fi
312194676Sthompsa
313194676Sthompsa  #####
314194676Sthompsa
315194676Sthompsa  AC_SUBST(DEBUG_LEVEL)
316194676Sthompsa  AC_SUBST(VARIANT)
317194676Sthompsa  AC_SUBST(FASTDEBUG)
318194676Sthompsa  AC_SUBST(DEBUG_CLASSFILES)
319194676Sthompsa  AC_SUBST(BUILD_VARIANT_RELEASE)
320194676Sthompsa])
321194676Sthompsa
322194676Sthompsa
323195957Salfred###############################################################################
324194676Sthompsa#
325194676Sthompsa# Should we build only OpenJDK even if closed sources are present?
326194676Sthompsa#
327227404ShselaskyAC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
328227404Shselasky[
329227404Shselasky  AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
330227404Shselasky      [suppress building custom source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
331227404Shselasky
332227404Shselasky  AC_MSG_CHECKING([for presence of closed sources])
333227404Shselasky  if test -d "$SRC_ROOT/jdk/src/closed"; then
334227404Shselasky    CLOSED_SOURCE_PRESENT=yes
335194676Sthompsa  else
336194676Sthompsa    CLOSED_SOURCE_PRESENT=no
337194676Sthompsa  fi
338194676Sthompsa  AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
339194676Sthompsa
340194676Sthompsa  AC_MSG_CHECKING([if closed source is suppressed (openjdk-only)])
341194676Sthompsa  SUPPRESS_CLOSED_SOURCE="$enable_openjdk_only"
342194676Sthompsa  AC_MSG_RESULT([$SUPPRESS_CLOSED_SOURCE])
343194676Sthompsa
344194676Sthompsa  if test "x$CLOSED_SOURCE_PRESENT" = xno; then
345194676Sthompsa    OPENJDK=true
346195957Salfred    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
347194676Sthompsa      AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense])
348194676Sthompsa    fi
349194676Sthompsa  else
350194676Sthompsa    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
351194676Sthompsa      OPENJDK=true
352194676Sthompsa    else
353194676Sthompsa      OPENJDK=false
354194676Sthompsa    fi
355194676Sthompsa  fi
356194676Sthompsa
357194676Sthompsa  if test "x$OPENJDK" = "xtrue"; then
358194676Sthompsa    SET_OPENJDK="OPENJDK=true"
359194676Sthompsa  fi
360194676Sthompsa
361194676Sthompsa  AC_SUBST(SET_OPENJDK)
362194676Sthompsa
363194676Sthompsa  # custom-make-dir is deprecated. Please use your custom-hook.m4 to override
364194676Sthompsa  # the IncludeCustomExtension macro.
365195957Salfred  BASIC_DEPRECATED_ARG_WITH(custom-make-dir)
366194676Sthompsa])
367194676Sthompsa
368194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
369227404Shselasky[
370227404Shselasky
371227404Shselasky  ###############################################################################
372227404Shselasky  #
373227404Shselasky  # Should we build a JDK/JVM with headful support (ie a graphical ui)?
374227404Shselasky  # We always build headless support.
375227404Shselasky  #
376227404Shselasky  AC_MSG_CHECKING([headful support])
377227404Shselasky  AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
378227404Shselasky      [disable building headful support (graphical UI support) @<:@enabled@:>@])],
379227404Shselasky      [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
380227404Shselasky
381227404Shselasky  SUPPORT_HEADLESS=yes
382227404Shselasky  BUILD_HEADLESS="BUILD_HEADLESS:=true"
383227404Shselasky
384227404Shselasky  if test "x$SUPPORT_HEADFUL" = xyes; then
385227404Shselasky    # We are building both headful and headless.
386227404Shselasky    headful_msg="include support for both headful and headless"
387227404Shselasky  fi
388227404Shselasky
389227404Shselasky  if test "x$SUPPORT_HEADFUL" = xno; then
390227404Shselasky    # Thus we are building headless only.
391227404Shselasky    BUILD_HEADLESS="BUILD_HEADLESS:=true"
392227404Shselasky    headful_msg="headless only"
393301968Shselasky  fi
394301968Shselasky
395301968Shselasky  AC_MSG_RESULT([$headful_msg])
396301968Shselasky
397301968Shselasky  AC_SUBST(SUPPORT_HEADLESS)
398301968Shselasky  AC_SUBST(SUPPORT_HEADFUL)
399301968Shselasky  AC_SUBST(BUILD_HEADLESS)
400227404Shselasky
401227404Shselasky  # Control wether Hotspot runs Queens test after build.
402227404Shselasky  AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
403227404Shselasky      [run the Queens test after Hotspot build @<:@disabled@:>@])],,
404227404Shselasky      [enable_hotspot_test_in_build=no])
405227404Shselasky  if test "x$enable_hotspot_test_in_build" = "xyes"; then
406227404Shselasky    TEST_IN_BUILD=true
407328142Skevans  else
408227404Shselasky    TEST_IN_BUILD=false
409227404Shselasky  fi
410301968Shselasky  AC_SUBST(TEST_IN_BUILD)
411301968Shselasky
412301968Shselasky  ###############################################################################
413301968Shselasky  #
414301968Shselasky  # Choose cacerts source file
415301968Shselasky  #
416301968Shselasky  AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
417301968Shselasky      [specify alternative cacerts file])])
418301968Shselasky  if test "x$with_cacerts_file" != x; then
419301968Shselasky    CACERTS_FILE=$with_cacerts_file
420301968Shselasky  fi
421301968Shselasky  AC_SUBST(CACERTS_FILE)
422301968Shselasky
423301968Shselasky  ###############################################################################
424301968Shselasky  #
425194676Sthompsa  # Enable or disable unlimited crypto
426194676Sthompsa  #
427194676Sthompsa  AC_ARG_ENABLE(unlimited-crypto, [AS_HELP_STRING([--enable-unlimited-crypto],
428194676Sthompsa      [Enable unlimited crypto policy @<:@disabled@:>@])],,
429194676Sthompsa      [enable_unlimited_crypto=no])
430194676Sthompsa  if test "x$enable_unlimited_crypto" = "xyes"; then
431194676Sthompsa    UNLIMITED_CRYPTO=true
432194676Sthompsa  else
433199055Sthompsa    UNLIMITED_CRYPTO=false
434199055Sthompsa  fi
435194676Sthompsa  AC_SUBST(UNLIMITED_CRYPTO)
436199055Sthompsa
437199055Sthompsa  ###############################################################################
438194676Sthompsa  #
439194676Sthompsa  # Compress jars
440194676Sthompsa  #
441194676Sthompsa  COMPRESS_JARS=false
442194676Sthompsa
443194676Sthompsa  AC_SUBST(COMPRESS_JARS)
444194676Sthompsa
445194676Sthompsa  # Setup default copyright year. Mostly overridden when building close to a new year.
446234684Shselasky  AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
447195957Salfred      [Set copyright year value for build @<:@current year@:>@])])
448199055Sthompsa  if test "x$with_copyright_year" = xyes; then
449194676Sthompsa    AC_MSG_ERROR([Copyright year must have a value])
450194676Sthompsa  elif test "x$with_copyright_year" != x; then
451194676Sthompsa    COPYRIGHT_YEAR="$with_copyright_year"
452194676Sthompsa  else
453194676Sthompsa    COPYRIGHT_YEAR=`date +'%Y'`
454195957Salfred  fi
455194676Sthompsa  AC_SUBST(COPYRIGHT_YEAR)
456194676Sthompsa])
457194676Sthompsa
458194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
459194676Sthompsa[
460194676Sthompsa  HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
461194676Sthompsa  AC_SUBST(HOTSPOT_MAKE_ARGS)
462301956Shselasky
463213853Shselasky  # The name of the Service Agent jar.
464225659Shselasky  SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
465194676Sthompsa  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
466194676Sthompsa    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
467362224Skevans  fi
468194676Sthompsa  AC_SUBST(SALIB_NAME)
469194676Sthompsa])
470194676Sthompsa
471194676Sthompsa###############################################################################
472194676Sthompsa#
473194676Sthompsa# Enable or disable the elliptic curve crypto implementation
474301964Shselasky#
475251495SemasteAC_DEFUN_ONCE([JDKOPT_DETECT_INTREE_EC],
476250342Semaste[
477194676Sthompsa  AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
478224903Shselasky
479195957Salfred  if test -d "${SRC_ROOT}/jdk/src/jdk.crypto.ec/share/native/libsunec/impl"; then
480195957Salfred    ENABLE_INTREE_EC=yes
481234193Shselasky    AC_MSG_RESULT([yes])
482194676Sthompsa  else
483194676Sthompsa    ENABLE_INTREE_EC=no
484194676Sthompsa    AC_MSG_RESULT([no])
485194676Sthompsa  fi
486194676Sthompsa
487194676Sthompsa  AC_SUBST(ENABLE_INTREE_EC)
488194676Sthompsa])
489194676Sthompsa
490194676Sthompsa
491194676SthompsaAC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
492199055Sthompsa[
493213848Shselasky  #
494194676Sthompsa  # NATIVE_DEBUG_SYMBOLS
495213853Shselasky  # This must be done after the toolchain is setup, since we're looking at objcopy.
496213853Shselasky  #
497213853Shselasky  AC_MSG_CHECKING([what type of native debug symbols to use])
498194676Sthompsa  AC_ARG_WITH([native-debug-symbols],
499194676Sthompsa      [AS_HELP_STRING([--with-native-debug-symbols],
500301966Shselasky      [set the native debug symbol configuration (none, internal, external, zipped) @<:@zipped@:>@])],
501194676Sthompsa      [],
502194676Sthompsa      [with_native_debug_symbols="zipped"])
503194676Sthompsa  NATIVE_DEBUG_SYMBOLS=$with_native_debug_symbols
504194676Sthompsa  AC_MSG_RESULT([$NATIVE_DEBUG_SYMBOLS])
505194676Sthompsa
506194676Sthompsa  if test "x$NATIVE_DEBUG_SYMBOLS" = xzipped; then
507194676Sthompsa
508194676Sthompsa    if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
509194676Sthompsa      if test "x$OBJCOPY" = x; then
510301968Shselasky        # enabling of enable-debug-symbols and can't find objcopy
511301968Shselasky        # this is an error
512235128Shselasky        AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
513199055Sthompsa      fi
514199055Sthompsa    fi
515227404Shselasky
516227404Shselasky    ENABLE_DEBUG_SYMBOLS=true
517227404Shselasky    ZIP_DEBUGINFO_FILES=true
518227404Shselasky    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
519301968Shselasky    # will basically do slowdebug builds when DEBUG_BINARIES is set for
520301968Shselasky    # fastdebug builds
521301968Shselasky    DEBUG_BINARIES=false
522301968Shselasky    STRIP_POLICY=min_strip
523301968Shselasky  elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
524301968Shselasky    ENABLE_DEBUG_SYMBOLS=false
525301968Shselasky    ZIP_DEBUGINFO_FILES=false
526194676Sthompsa    DEBUG_BINARIES=false
527195957Salfred    STRIP_POLICY=no_strip
528194676Sthompsa  elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
529194676Sthompsa    ENABLE_DEBUG_SYMBOLS=false  # -g option only
530194676Sthompsa    ZIP_DEBUGINFO_FILES=false
531194676Sthompsa    # Fastdebug builds with this setting will essentially be slowdebug
532194676Sthompsa    # in hotspot.
533199055Sthompsa    DEBUG_BINARIES=true
534199055Sthompsa    STRIP_POLICY=no_strip
535199055Sthompsa    STRIP=""
536199055Sthompsa  elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
537199055Sthompsa
538199055Sthompsa    if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
539199055Sthompsa      if test "x$OBJCOPY" = x; then
540199055Sthompsa        # enabling of enable-debug-symbols and can't find objcopy
541199055Sthompsa        # this is an error
542199055Sthompsa        AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
543194676Sthompsa      fi
544194676Sthompsa    fi
545194676Sthompsa
546194676Sthompsa    ENABLE_DEBUG_SYMBOLS=true
547194676Sthompsa    ZIP_DEBUGINFO_FILES=false
548194676Sthompsa    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
549194676Sthompsa    # will basically do slowdebug builds when DEBUG_BINARIES is set for
550194676Sthompsa    # fastdebug builds
551194676Sthompsa    DEBUG_BINARIES=false
552194676Sthompsa    STRIP_POLICY=min_strip
553194676Sthompsa  else
554260315Shselasky    AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
555260315Shselasky  fi
556194676Sthompsa
557194676Sthompsa  # --enable-debug-symbols is deprecated.
558194676Sthompsa  # Please use --with-native-debug-symbols=[internal,external,zipped] .
559194676Sthompsa  BASIC_DEPRECATED_ARG_ENABLE(debug-symbols, debug_symbols,
560194676Sthompsa        [Please use --with-native-debug-symbols=[[internal,external,zipped]] .])
561250335Semaste
562194676Sthompsa  # --enable-zip-debug-info is deprecated.
563194676Sthompsa  # Please use --with-native-debug-symbols=zipped .
564194676Sthompsa  BASIC_DEPRECATED_ARG_ENABLE(zip-debug-info, zip_debug_info,
565199055Sthompsa                              [Please use --with-native-debug-symbols=zipped .])
566199055Sthompsa
567199055Sthompsa  AC_SUBST(NATIVE_DEBUG_SYMBOLS)
568194676Sthompsa  AC_SUBST(DEBUG_BINARIES)
569199055Sthompsa  AC_SUBST(STRIP_POLICY)
570199055Sthompsa  AC_SUBST(ENABLE_DEBUG_SYMBOLS)
571199055Sthompsa  AC_SUBST(ZIP_DEBUGINFO_FILES)
572199055Sthompsa])
573199055Sthompsa
574302080Shselasky################################################################################
575302080Shselasky#
576302080Shselasky# Gcov coverage data for hotspot
577302080Shselasky#
578302080ShselaskyAC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
579302080Shselasky[
580302080Shselasky  AC_ARG_ENABLE(native-coverage, [AS_HELP_STRING([--enable-native-coverage],
581302080Shselasky      [enable native compilation with code coverage data@<:@disabled@:>@])])
582302125Shselasky  GCOV_ENABLED="false"
583302125Shselasky  if test "x$enable_native_coverage" = "xyes"; then
584302125Shselasky    if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
585302125Shselasky      AC_MSG_CHECKING([if native coverage is enabled])
586302125Shselasky      AC_MSG_RESULT([yes])
587302125Shselasky      GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
588302125Shselasky      GCOV_LDFLAGS="-fprofile-arcs"
589194676Sthompsa      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
590194676Sthompsa      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
591194676Sthompsa      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
592194676Sthompsa      CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
593194676Sthompsa      CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
594194676Sthompsa      CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
595194676Sthompsa      CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
596194676Sthompsa      LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
597194676Sthompsa      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
598      GCOV_ENABLED="true"
599    else
600      AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc])
601    fi
602  elif test "x$enable_native_coverage" = "xno"; then
603    AC_MSG_CHECKING([if native coverage is enabled])
604    AC_MSG_RESULT([no])
605  elif test "x$enable_native_coverage" != "x"; then
606    AC_MSG_ERROR([--enable-native-coverage can only be assigned "yes" or "no"])
607  fi
608
609  AC_SUBST(GCOV_ENABLED)
610])
611
612################################################################################
613#
614# Static build support.  When enabled will generate static 
615# libraries instead of shared libraries for all JDK libs.
616#
617AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
618[
619  AC_ARG_ENABLE([static-build], [AS_HELP_STRING([--enable-static-build],
620    [enable static library build @<:@disabled@:>@])])
621  STATIC_BUILD=false
622  if test "x$enable_static_build" = "xyes"; then
623    AC_MSG_CHECKING([if static build is enabled])
624    AC_MSG_RESULT([yes])
625    if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then
626      AC_MSG_ERROR([--enable-static-build is only supported for macosx builds])
627    fi
628    STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
629    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $STATIC_BUILD_CFLAGS"
630    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $STATIC_BUILD_CFLAGS"
631    CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
632    CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
633    STATIC_BUILD=true
634  elif test "x$enable_static_build" = "xno"; then
635    AC_MSG_CHECKING([if static build is enabled])
636    AC_MSG_RESULT([no])
637  elif test "x$enable_static_build" != "x"; then
638    AC_MSG_ERROR([--enable-static-build can only be assigned "yes" or "no"])
639  fi
640
641  AC_SUBST(STATIC_BUILD)
642])
643
644
645