|
1 # |
|
2 # Copyright (c) 2011, 2018, 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 |
|
26 AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], |
|
27 [ |
|
28 # Option used to tell the compiler whether to create 32- or 64-bit executables |
|
29 if test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
30 COMPILER_TARGET_BITS_FLAG="-q" |
|
31 else |
|
32 COMPILER_TARGET_BITS_FLAG="-m" |
|
33 fi |
|
34 AC_SUBST(COMPILER_TARGET_BITS_FLAG) |
|
35 |
|
36 # FIXME: figure out if we should select AR flags depending on OS or toolchain. |
|
37 if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
38 ARFLAGS="-r" |
|
39 elif test "x$OPENJDK_TARGET_OS" = xaix; then |
|
40 ARFLAGS="-X64" |
|
41 elif test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
42 # lib.exe is used as AR to create static libraries. |
|
43 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" |
|
44 else |
|
45 ARFLAGS="" |
|
46 fi |
|
47 AC_SUBST(ARFLAGS) |
|
48 |
|
49 ## Setup strip. |
|
50 # FIXME: should this really be per platform, or should it be per toolchain type? |
|
51 # strip is not provided by clang or solstudio; so guessing platform makes most sense. |
|
52 # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD. |
|
53 if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
54 STRIPFLAGS="-g" |
|
55 elif test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
56 STRIPFLAGS="-x" |
|
57 elif test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
58 STRIPFLAGS="-S" |
|
59 elif test "x$OPENJDK_TARGET_OS" = xaix; then |
|
60 STRIPFLAGS="-X32_64" |
|
61 fi |
|
62 |
|
63 if test "x$OPENJDK_TARGET_OS" != xwindows; then |
|
64 POST_STRIP_CMD="$STRIP $STRIPFLAGS" |
|
65 fi |
|
66 AC_SUBST(POST_STRIP_CMD) |
|
67 |
|
68 if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
69 # FIXME: break out into MCSFLAGS |
|
70 POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\"" |
|
71 fi |
|
72 AC_SUBST(POST_MCS_CMD) |
|
73 |
|
74 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
75 CC_OUT_OPTION=-Fo |
|
76 EXE_OUT_OPTION=-out: |
|
77 LD_OUT_OPTION=-out: |
|
78 AR_OUT_OPTION=-out: |
|
79 else |
|
80 # The option used to specify the target .o,.a or .so file. |
|
81 # When compiling, how to specify the to be created object file. |
|
82 CC_OUT_OPTION='-o$(SPACE)' |
|
83 # When linking, how to specify the to be created executable. |
|
84 EXE_OUT_OPTION='-o$(SPACE)' |
|
85 # When linking, how to specify the to be created dynamically linkable library. |
|
86 LD_OUT_OPTION='-o$(SPACE)' |
|
87 # When archiving, how to specify the to be create static archive for object files. |
|
88 AR_OUT_OPTION='rcs$(SPACE)' |
|
89 fi |
|
90 AC_SUBST(CC_OUT_OPTION) |
|
91 AC_SUBST(EXE_OUT_OPTION) |
|
92 AC_SUBST(LD_OUT_OPTION) |
|
93 AC_SUBST(AR_OUT_OPTION) |
|
94 |
|
95 # On Windows, we need to set RC flags. |
|
96 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
97 RC_FLAGS="-nologo -l 0x409 -r" |
|
98 if test "x$VARIANT" = xOPT; then |
|
99 RC_FLAGS="$RC_FLAGS -d NDEBUG" |
|
100 fi |
|
101 |
|
102 # The version variables used to create RC_FLAGS may be overridden |
|
103 # in a custom configure script, or possibly the command line. |
|
104 # Let those variables be expanded at make time in spec.gmk. |
|
105 # The \$ are escaped to the shell, and the $(...) variables |
|
106 # are evaluated by make. |
|
107 RC_FLAGS="$RC_FLAGS \ |
|
108 -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ |
|
109 -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ |
|
110 -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ |
|
111 -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ |
|
112 -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ |
|
113 -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ |
|
114 -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" |
|
115 fi |
|
116 AC_SUBST(RC_FLAGS) |
|
117 |
|
118 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
119 # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX. |
|
120 CCXXFLAGS="$CCXXFLAGS -nologo" |
|
121 fi |
|
122 ]) |
|
123 |
|
124 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], |
|
125 [ |
|
126 ############################################################################### |
|
127 # |
|
128 # How to compile shared libraries. |
|
129 # |
|
130 |
|
131 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
132 PICFLAG="-fPIC" |
|
133 C_FLAG_REORDER='' |
|
134 CXX_FLAG_REORDER='' |
|
135 |
|
136 if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
137 # Linking is different on MacOSX |
|
138 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" |
|
139 SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' |
|
140 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" |
|
141 SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' |
|
142 SET_SHARED_LIBRARY_MAPFILE='' |
|
143 else |
|
144 # Default works for linux, might work on other platforms as well. |
|
145 SHARED_LIBRARY_FLAGS='-shared' |
|
146 SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' |
|
147 SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN" |
|
148 SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1' |
|
149 SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1' |
|
150 fi |
|
151 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
152 PICFLAG="-KPIC" |
|
153 C_FLAG_REORDER='-xF' |
|
154 CXX_FLAG_REORDER='-xF' |
|
155 SHARED_LIBRARY_FLAGS="-G" |
|
156 SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1' |
|
157 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" |
|
158 SET_SHARED_LIBRARY_NAME='' |
|
159 SET_SHARED_LIBRARY_MAPFILE='-M[$]1' |
|
160 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
161 PICFLAG="-qpic=large" |
|
162 C_FLAG_REORDER='' |
|
163 CXX_FLAG_REORDER='' |
|
164 SHARED_LIBRARY_FLAGS="-qmkshrobj" |
|
165 SET_EXECUTABLE_ORIGIN="" |
|
166 SET_SHARED_LIBRARY_ORIGIN='' |
|
167 SET_SHARED_LIBRARY_NAME='' |
|
168 SET_SHARED_LIBRARY_MAPFILE='' |
|
169 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
170 PICFLAG="" |
|
171 C_FLAG_REORDER='' |
|
172 CXX_FLAG_REORDER='' |
|
173 SHARED_LIBRARY_FLAGS="-LD" |
|
174 SET_EXECUTABLE_ORIGIN='' |
|
175 SET_SHARED_LIBRARY_ORIGIN='' |
|
176 SET_SHARED_LIBRARY_NAME='' |
|
177 SET_SHARED_LIBRARY_MAPFILE='' |
|
178 fi |
|
179 |
|
180 AC_SUBST(C_FLAG_REORDER) |
|
181 AC_SUBST(CXX_FLAG_REORDER) |
|
182 AC_SUBST(SHARED_LIBRARY_FLAGS) |
|
183 AC_SUBST(SET_EXECUTABLE_ORIGIN) |
|
184 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) |
|
185 AC_SUBST(SET_SHARED_LIBRARY_NAME) |
|
186 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) |
|
187 |
|
188 if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
189 CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__" |
|
190 CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__" |
|
191 CFLAGS_JDKLIB_EXTRA='-xstrconst' |
|
192 fi |
|
193 # The (cross) compiler is now configured, we can now test capabilities |
|
194 # of the target platform. |
|
195 ]) |
|
196 |
|
197 # Documentation on common flags used for solstudio in HIGHEST. |
|
198 # |
|
199 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be |
|
200 # done with care, there are some assumptions below that need to |
|
201 # be understood about the use of pointers, and IEEE behavior. |
|
202 # |
|
203 # -fns: Use non-standard floating point mode (not IEEE 754) |
|
204 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754) |
|
205 # -fsingle: Use single precision floating point with 'float' |
|
206 # -xalias_level=basic: Assume memory references via basic pointer types do not alias |
|
207 # (Source with excessing pointer casting and data access with mixed |
|
208 # pointer types are not recommended) |
|
209 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions |
|
210 # (If you expect perfect errno behavior, do not use this) |
|
211 # -xdepend: Loop data dependency optimizations (need -xO3 or higher) |
|
212 # -xrestrict: Pointer parameters to functions do not overlap |
|
213 # (Similar to -xalias_level=basic usage, but less obvious sometimes. |
|
214 # If you pass in multiple pointers to the same data, do not use this) |
|
215 # -xlibmil: Inline some library routines |
|
216 # (If you expect perfect errno behavior, do not use this) |
|
217 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED) |
|
218 # (If you expect perfect errno behavior, do not use this) |
|
219 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |
|
220 |
|
221 # FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore. |
|
222 # Bug? |
|
223 #if test "x$OPENJDK_TARGET_CPU" = xsparc; then |
|
224 # CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s" |
|
225 # CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s" |
|
226 #fi |
|
227 |
|
228 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], |
|
229 [ |
|
230 |
|
231 ############################################################################### |
|
232 # |
|
233 # Setup the opt flags for different compilers |
|
234 # and different operating systems. |
|
235 # |
|
236 |
|
237 # FIXME: this was indirectly the old default, but just inherited. |
|
238 # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
239 # C_FLAG_DEPS="-MMD -MF" |
|
240 # fi |
|
241 |
|
242 # Generate make dependency files |
|
243 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
244 C_FLAG_DEPS="-MMD -MF" |
|
245 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
246 C_FLAG_DEPS="-xMMD -xMF" |
|
247 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
248 C_FLAG_DEPS="-qmakedep=gcc -MF" |
|
249 fi |
|
250 CXX_FLAG_DEPS="$C_FLAG_DEPS" |
|
251 AC_SUBST(C_FLAG_DEPS) |
|
252 AC_SUBST(CXX_FLAG_DEPS) |
|
253 |
|
254 # Debug symbols |
|
255 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
256 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then |
|
257 CFLAGS_DEBUG_SYMBOLS="-g1" |
|
258 CXXFLAGS_DEBUG_SYMBOLS="-g1" |
|
259 else |
|
260 CFLAGS_DEBUG_SYMBOLS="-g" |
|
261 CXXFLAGS_DEBUG_SYMBOLS="-g" |
|
262 fi |
|
263 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
264 CFLAGS_DEBUG_SYMBOLS="-g -xs" |
|
265 CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs" |
|
266 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
267 CFLAGS_DEBUG_SYMBOLS="-g" |
|
268 CXXFLAGS_DEBUG_SYMBOLS="-g" |
|
269 fi |
|
270 AC_SUBST(CFLAGS_DEBUG_SYMBOLS) |
|
271 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS) |
|
272 |
|
273 # Optimization levels |
|
274 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
275 CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xalias_level=basic -xbuiltin=%all -xdepend -xrestrict -xlibmil" |
|
276 |
|
277 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then |
|
278 # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global? |
|
279 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr" |
|
280 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr" |
|
281 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr" |
|
282 C_O_FLAG_NONE="-xregs=no%frameptr" |
|
283 CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr" |
|
284 CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr" |
|
285 CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr" |
|
286 CXX_O_FLAG_NONE="-xregs=no%frameptr" |
|
287 if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then |
|
288 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium" |
|
289 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium" |
|
290 fi |
|
291 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
|
292 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" |
|
293 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
|
294 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
|
295 C_O_FLAG_NONE="" |
|
296 CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" |
|
297 CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" |
|
298 CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" |
|
299 CXX_O_FLAG_NONE="" |
|
300 fi |
|
301 else |
|
302 # The remaining toolchains share opt flags between CC and CXX; |
|
303 # setup for C and duplicate afterwards. |
|
304 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
305 if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
306 # On MacOSX we optimize for size, something |
|
307 # we should do for all platforms? |
|
308 C_O_FLAG_HIGHEST="-Os" |
|
309 C_O_FLAG_HI="-Os" |
|
310 C_O_FLAG_NORM="-Os" |
|
311 C_O_FLAG_NONE="" |
|
312 else |
|
313 C_O_FLAG_HIGHEST="-O3" |
|
314 C_O_FLAG_HI="-O3" |
|
315 C_O_FLAG_NORM="-O2" |
|
316 C_O_FLAG_NONE="-O0" |
|
317 fi |
|
318 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
319 C_O_FLAG_HIGHEST="-O3" |
|
320 C_O_FLAG_HI="-O3 -qstrict" |
|
321 C_O_FLAG_NORM="-O2" |
|
322 C_O_FLAG_NONE="" |
|
323 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
324 C_O_FLAG_HIGHEST="-O2" |
|
325 C_O_FLAG_HI="-O1" |
|
326 C_O_FLAG_NORM="-O1" |
|
327 C_O_FLAG_NONE="-Od" |
|
328 fi |
|
329 CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" |
|
330 CXX_O_FLAG_HI="$C_O_FLAG_HI" |
|
331 CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
|
332 CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
|
333 fi |
|
334 |
|
335 AC_SUBST(C_O_FLAG_HIGHEST) |
|
336 AC_SUBST(C_O_FLAG_HI) |
|
337 AC_SUBST(C_O_FLAG_NORM) |
|
338 AC_SUBST(C_O_FLAG_NONE) |
|
339 AC_SUBST(CXX_O_FLAG_HIGHEST) |
|
340 AC_SUBST(CXX_O_FLAG_HI) |
|
341 AC_SUBST(CXX_O_FLAG_NORM) |
|
342 AC_SUBST(CXX_O_FLAG_NONE) |
|
343 ]) |
|
344 |
|
345 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], |
|
346 [ |
|
347 # Special extras... |
|
348 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
349 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
|
350 CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl" |
|
351 CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl" |
|
352 fi |
|
353 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
354 LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall" |
|
355 CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" |
|
356 CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" |
|
357 elif test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
358 $2CXXSTD_CXXFLAG="-std=gnu++98" |
|
359 FLAGS_CXX_COMPILER_CHECK_ARGUMENTS([[$]$2CXXSTD_CXXFLAG -Werror], |
|
360 [], [$2CXXSTD_CXXFLAG=""]) |
|
361 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}" |
|
362 $2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}" |
|
363 AC_SUBST($2CXXSTD_CXXFLAG) |
|
364 fi |
|
365 |
|
366 if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then |
|
367 AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags]) |
|
368 fi |
|
369 |
|
370 if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then |
|
371 AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags]) |
|
372 fi |
|
373 |
|
374 if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then |
|
375 AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags]) |
|
376 fi |
|
377 |
|
378 AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags], |
|
379 [extra flags to be used when compiling jdk c-files])]) |
|
380 |
|
381 AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags], |
|
382 [extra flags to be used when compiling jdk c++-files])]) |
|
383 |
|
384 AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags], |
|
385 [extra flags to be used when linking jdk])]) |
|
386 |
|
387 CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags" |
|
388 CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags" |
|
389 LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" |
|
390 |
|
391 # Hotspot needs these set in their legacy form |
|
392 LEGACY_EXTRA_CFLAGS=$with_extra_cflags |
|
393 LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags |
|
394 LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags |
|
395 |
|
396 AC_SUBST(LEGACY_EXTRA_CFLAGS) |
|
397 AC_SUBST(LEGACY_EXTRA_CXXFLAGS) |
|
398 AC_SUBST(LEGACY_EXTRA_LDFLAGS) |
|
399 |
|
400 ############################################################################### |
|
401 # |
|
402 # Now setup the CFLAGS and LDFLAGS for the JDK build. |
|
403 # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. |
|
404 # |
|
405 |
|
406 # Setup compiler/platform specific flags to CFLAGS_JDK, |
|
407 # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?) |
|
408 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
409 # these options are used for both C and C++ compiles |
|
410 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \ |
|
411 -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" |
|
412 case $OPENJDK_TARGET_CPU_ARCH in |
|
413 arm ) |
|
414 # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing |
|
415 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
|
416 ;; |
|
417 ppc ) |
|
418 # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing |
|
419 ;; |
|
420 * ) |
|
421 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer" |
|
422 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
|
423 ;; |
|
424 esac |
|
425 TOOLCHAIN_CHECK_COMPILER_VERSION(6, FLAGS_SETUP_GCC6_COMPILER_FLAGS) |
|
426 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
427 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" |
|
428 if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then |
|
429 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" |
|
430 CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" |
|
431 fi |
|
432 |
|
433 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" |
|
434 CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" |
|
435 elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
436 CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" |
|
437 CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" |
|
438 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
439 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ |
|
440 -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ |
|
441 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ |
|
442 -DWIN32 -DIAL" |
|
443 if test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
|
444 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" |
|
445 else |
|
446 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" |
|
447 fi |
|
448 fi |
|
449 |
|
450 ############################################################################### |
|
451 |
|
452 # Adjust flags according to debug level. |
|
453 case $DEBUG_LEVEL in |
|
454 fastdebug ) |
|
455 CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS" |
|
456 CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS" |
|
457 C_O_FLAG_HI="$C_O_FLAG_NORM" |
|
458 C_O_FLAG_NORM="$C_O_FLAG_NORM" |
|
459 CXX_O_FLAG_HI="$CXX_O_FLAG_NORM" |
|
460 CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM" |
|
461 JAVAC_FLAGS="$JAVAC_FLAGS -g" |
|
462 ;; |
|
463 slowdebug ) |
|
464 CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS" |
|
465 CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS" |
|
466 C_O_FLAG_HI="$C_O_FLAG_NONE" |
|
467 C_O_FLAG_NORM="$C_O_FLAG_NONE" |
|
468 CXX_O_FLAG_HI="$CXX_O_FLAG_NONE" |
|
469 CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" |
|
470 JAVAC_FLAGS="$JAVAC_FLAGS -g" |
|
471 ;; |
|
472 esac |
|
473 |
|
474 # Setup LP64 |
|
475 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" |
|
476 |
|
477 # Set some common defines. These works for all compilers, but assume |
|
478 # -D is universally accepted. |
|
479 |
|
480 # Setup endianness |
|
481 if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then |
|
482 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
|
483 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
|
484 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
|
485 # Note: -Dmacro is the same as #define macro 1 |
|
486 # -Dmacro= is the same as #define macro |
|
487 if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
488 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" |
|
489 else |
|
490 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" |
|
491 fi |
|
492 else |
|
493 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" |
|
494 fi |
|
495 |
|
496 # Setup target OS define. Use OS target name but in upper case. |
|
497 OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
|
498 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE" |
|
499 |
|
500 # Setup target CPU |
|
501 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" |
|
502 |
|
503 # Setup debug/release defines |
|
504 if test "x$DEBUG_LEVEL" = xrelease; then |
|
505 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" |
|
506 if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
507 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED" |
|
508 fi |
|
509 else |
|
510 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" |
|
511 fi |
|
512 |
|
513 # Setup release name |
|
514 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'" |
|
515 |
|
516 |
|
517 # Set some additional per-OS defines. |
|
518 if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
519 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" |
|
520 elif test "x$OPENJDK_TARGET_OS" = xaix; then |
|
521 # FIXME: PPC64 should not be here. |
|
522 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DPPC64" |
|
523 elif test "x$OPENJDK_TARGET_OS" = xbsd; then |
|
524 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE" |
|
525 fi |
|
526 |
|
527 # Additional macosx handling |
|
528 if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
529 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
530 # FIXME: This needs to be exported in spec.gmk due to closed legacy code. |
|
531 # FIXME: clean this up, and/or move it elsewhere. |
|
532 |
|
533 # Setting these parameters makes it an error to link to macosx APIs that are |
|
534 # newer than the given OS version and makes the linked binaries compatible |
|
535 # even if built on a newer version of the OS. |
|
536 # The expected format is X.Y.Z |
|
537 MACOSX_VERSION_MIN=10.7.0 |
|
538 AC_SUBST(MACOSX_VERSION_MIN) |
|
539 |
|
540 # The macro takes the version with no dots, ex: 1070 |
|
541 # Let the flags variables get resolved in make for easier override on make |
|
542 # command line. |
|
543 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
|
544 LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
|
545 fi |
|
546 fi |
|
547 |
|
548 # Setup some hard coded includes |
|
549 CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ |
|
550 -I${JDK_OUTPUTDIR}/include \ |
|
551 -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ |
|
552 -I${JDK_TOPDIR}/src/share/javavm/export \ |
|
553 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \ |
|
554 -I${JDK_TOPDIR}/src/share/native/common \ |
|
555 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" |
|
556 |
|
557 # The shared libraries are compiled using the picflag. |
|
558 CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" |
|
559 CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " |
|
560 |
|
561 # Executable flags |
|
562 CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" |
|
563 CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" |
|
564 |
|
565 AC_SUBST(CFLAGS_JDKLIB) |
|
566 AC_SUBST(CFLAGS_JDKEXE) |
|
567 AC_SUBST(CXXFLAGS_JDKLIB) |
|
568 AC_SUBST(CXXFLAGS_JDKEXE) |
|
569 |
|
570 # Setup LDFLAGS et al. |
|
571 # |
|
572 # Now this is odd. The JDK native libraries have to link against libjvm.so |
|
573 # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. |
|
574 # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library |
|
575 # is identical for client and server? Yes. Which is picked at runtime (client or server)? |
|
576 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following |
|
577 # libraries will link to whatever is in memory. Yuck. |
|
578 # |
|
579 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. |
|
580 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
581 LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no" |
|
582 if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then |
|
583 LDFLAGS_JDK="$LDFLAGS_JDK -safeseh" |
|
584 fi |
|
585 # TODO: make -debug optional "--disable-full-debug-symbols" |
|
586 LDFLAGS_JDK="$LDFLAGS_JDK -debug" |
|
587 LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib" |
|
588 LDFLAGS_JDKLIB_SUFFIX="" |
|
589 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
|
590 LDFLAGS_STACK_SIZE=1048576 |
|
591 else |
|
592 LDFLAGS_STACK_SIZE=327680 |
|
593 fi |
|
594 LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE" |
|
595 else |
|
596 if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
597 # If this is a --hash-style=gnu system, use --hash-style=both, why? |
|
598 # We have previously set HAS_GNU_HASH if this is the case |
|
599 if test -n "$HAS_GNU_HASH"; then |
|
600 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both " |
|
601 fi |
|
602 if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
603 # And since we now know that the linker is gnu, then add -z defs, to forbid |
|
604 # undefined symbols in object files. |
|
605 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs" |
|
606 if test "x$DEBUG_LEVEL" = "xrelease"; then |
|
607 # When building release libraries, tell the linker optimize them. |
|
608 # Should this be supplied to the OSS linker as well? |
|
609 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1" |
|
610 fi |
|
611 fi |
|
612 fi |
|
613 |
|
614 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
615 LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext" |
|
616 LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" |
|
617 fi |
|
618 |
|
619 LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \ |
|
620 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}" |
|
621 |
|
622 # On some platforms (mac) the linker warns about non existing -L dirs. |
|
623 # Add server first if available. Linking aginst client does not always produce the same results. |
|
624 # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1. |
|
625 # Default to server for other variants. |
|
626 if test "x$JVM_VARIANT_SERVER" = xtrue; then |
|
627 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
|
628 elif test "x$JVM_VARIANT_CLIENT" = xtrue; then |
|
629 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client" |
|
630 elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then |
|
631 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal" |
|
632 else |
|
633 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
|
634 fi |
|
635 |
|
636 LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm" |
|
637 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
638 LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc" |
|
639 fi |
|
640 |
|
641 LDFLAGS_JDKEXE="${LDFLAGS_JDK}" |
|
642 if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
643 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" |
|
644 fi |
|
645 fi |
|
646 AC_SUBST(LDFLAGS_JDKLIB) |
|
647 AC_SUBST(LDFLAGS_JDKEXE) |
|
648 AC_SUBST(LDFLAGS_JDKLIB_SUFFIX) |
|
649 AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) |
|
650 AC_SUBST(LDFLAGS_CXX_JDK) |
|
651 ]) |
|
652 |
|
653 |
|
654 # FLAGS_C_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], |
|
655 # [RUN-IF-FALSE]) |
|
656 # ------------------------------------------------------------ |
|
657 # Check that the C compiler supports an argument |
|
658 AC_DEFUN([FLAGS_C_COMPILER_CHECK_ARGUMENTS], |
|
659 [ |
|
660 AC_MSG_CHECKING([if the C compiler supports "$1"]) |
|
661 supports=yes |
|
662 |
|
663 saved_cflags="$CFLAGS" |
|
664 CFLAGS="$CFLAGS $1" |
|
665 AC_LANG_PUSH([C]) |
|
666 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], |
|
667 [supports=no]) |
|
668 AC_LANG_POP([C]) |
|
669 CFLAGS="$saved_cflags" |
|
670 |
|
671 AC_MSG_RESULT([$supports]) |
|
672 if test "x$supports" = "xyes" ; then |
|
673 m4_ifval([$2], [$2], [:]) |
|
674 else |
|
675 m4_ifval([$3], [$3], [:]) |
|
676 fi |
|
677 ]) |
|
678 |
|
679 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], |
|
680 # [RUN-IF-FALSE]) |
|
681 # ------------------------------------------------------------ |
|
682 # Check that the C++ compiler supports an argument |
|
683 AC_DEFUN([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS], |
|
684 [ |
|
685 AC_MSG_CHECKING([if the C++ compiler supports "$1"]) |
|
686 supports=yes |
|
687 |
|
688 saved_cxxflags="$CXXFLAGS" |
|
689 CXXFLAGS="$CXXFLAG $1" |
|
690 AC_LANG_PUSH([C++]) |
|
691 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], |
|
692 [supports=no]) |
|
693 AC_LANG_POP([C++]) |
|
694 CXXFLAGS="$saved_cxxflags" |
|
695 |
|
696 AC_MSG_RESULT([$supports]) |
|
697 if test "x$supports" = "xyes" ; then |
|
698 m4_ifval([$2], [$2], [:]) |
|
699 else |
|
700 m4_ifval([$3], [$3], [:]) |
|
701 fi |
|
702 ]) |
|
703 |
|
704 # FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], |
|
705 # [RUN-IF-FALSE]) |
|
706 # ------------------------------------------------------------ |
|
707 # Check that the C and C++ compilers support an argument |
|
708 AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS], |
|
709 [ |
|
710 FLAGS_C_COMPILER_CHECK_ARGUMENTS([$1], |
|
711 [C_COMP_SUPPORTS="yes"], |
|
712 [C_COMP_SUPPORTS="no"]) |
|
713 FLAGS_CXX_COMPILER_CHECK_ARGUMENTS([$1], |
|
714 [CXX_COMP_SUPPORTS="yes"], |
|
715 [CXX_COMP_SUPPORTS="no"]) |
|
716 |
|
717 AC_MSG_CHECKING([if both compilers support "$1"]) |
|
718 supports=no |
|
719 if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi |
|
720 |
|
721 AC_MSG_RESULT([$supports]) |
|
722 if test "x$supports" = "xyes" ; then |
|
723 m4_ifval([$2], [$2], [:]) |
|
724 else |
|
725 m4_ifval([$3], [$3], [:]) |
|
726 fi |
|
727 ]) |
|
728 |
|
729 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC], |
|
730 [ |
|
731 # Some Zero and Shark settings. |
|
732 # ZERO_ARCHFLAG tells the compiler which mode to build for |
|
733 case "${OPENJDK_TARGET_CPU}" in |
|
734 s390) |
|
735 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31" |
|
736 ;; |
|
737 *) |
|
738 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" |
|
739 esac |
|
740 FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""]) |
|
741 AC_SUBST(ZERO_ARCHFLAG) |
|
742 |
|
743 # Check that the compiler supports -mX (or -qX on AIX) flags |
|
744 # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does |
|
745 FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}], |
|
746 [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true], |
|
747 [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false]) |
|
748 AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG) |
|
749 ]) |
|
750 |
|
751 AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS], |
|
752 [ |
|
753 # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code |
|
754 # runs afoul of the more aggressive versions of these optimisations. |
|
755 # Notably, value range propagation now assumes that the this pointer of C++ |
|
756 # member functions is non-null. |
|
757 NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks" |
|
758 FLAGS_COMPILER_CHECK_ARGUMENTS([$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror], |
|
759 [], [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""]) |
|
760 AC_SUBST([NO_DELETE_NULL_POINTER_CHECKS_CFLAG]) |
|
761 NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse" |
|
762 FLAGS_COMPILER_CHECK_ARGUMENTS([$NO_LIFETIME_DSE_CFLAG -Werror], |
|
763 [], [NO_LIFETIME_DSE_CFLAG=""]) |
|
764 CFLAGS_JDK="${CFLAGS_JDK} ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}" |
|
765 AC_SUBST([NO_LIFETIME_DSE_CFLAG]) |
|
766 ]) |
|
767 |