Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/common/autoconf/flags.m4
+++ new/common/autoconf/flags.m4
1 1 #
2 2 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 #
5 5 # This code is free software; you can redistribute it and/or modify it
6 6 # under the terms of the GNU General Public License version 2 only, as
7 7 # published by the Free Software Foundation. Oracle designates this
8 8 # particular file as subject to the "Classpath" exception as provided
9 9 # by Oracle in the LICENSE file that accompanied this code.
10 10 #
11 11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 14 # version 2 for more details (a copy is included in the LICENSE file that
15 15 # accompanied this code).
16 16 #
17 17 # You should have received a copy of the GNU General Public License version
18 18 # 2 along with this work; if not, write to the Free Software Foundation,
19 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 20 #
21 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 22 # or visit www.oracle.com if you need additional information or have any
23 23 # questions.
24 24 #
25 25
26 26 # Reset the global CFLAGS/LDFLAGS variables and initialize them with the
27 27 # corresponding configure arguments instead
28 28 AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
29 29 [
30 30 if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
31 31 AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
32 32 fi
33 33
34 34 if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
35 35 AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
36 36 fi
37 37
38 38 if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
39 39 AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
40 40 fi
41 41
42 42 AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
43 43 [extra flags to be used when compiling jdk c-files])])
44 44
45 45 AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
46 46 [extra flags to be used when compiling jdk c++-files])])
47 47
48 48 AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
49 49 [extra flags to be used when linking jdk])])
50 50
51 51 EXTRA_CFLAGS="$with_extra_cflags"
52 52 EXTRA_CXXFLAGS="$with_extra_cxxflags"
53 53 EXTRA_LDFLAGS="$with_extra_ldflags"
54 54
55 55 # Hotspot needs these set in their legacy form
56 56 LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $EXTRA_CFLAGS"
57 57 LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $EXTRA_CXXFLAGS"
58 58 LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $EXTRA_LDFLAGS"
59 59
60 60 AC_SUBST(LEGACY_EXTRA_CFLAGS)
61 61 AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
62 62 AC_SUBST(LEGACY_EXTRA_LDFLAGS)
63 63
64 64 AC_SUBST(EXTRA_CFLAGS)
65 65 AC_SUBST(EXTRA_CXXFLAGS)
66 66 AC_SUBST(EXTRA_LDFLAGS)
67 67
68 68 # The global CFLAGS and LDLAGS variables are used by configure tests and
69 69 # should include the extra parameters
70 70 CFLAGS="$EXTRA_CFLAGS"
71 71 CXXFLAGS="$EXTRA_CXXFLAGS"
72 72 LDFLAGS="$EXTRA_LDFLAGS"
73 73 CPPFLAGS=""
74 74 ])
75 75
76 76 # Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
77 77 # that configure can use them while detecting compilers.
78 78 # TOOLCHAIN_TYPE is available here.
79 79 # Param 1 - Optional prefix to all variables. (e.g BUILD_)
80 80 AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
↓ open down ↓ |
80 lines elided |
↑ open up ↑ |
81 81 [
82 82 if test "x[$]$1SYSROOT" != "x"; then
83 83 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
84 84 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
85 85 # Solaris Studio does not have a concept of sysroot. Instead we must
86 86 # make sure the default include and lib dirs are appended to each
87 87 # compile and link command line. Must also add -I-xbuiltin to enable
88 88 # inlining of system functions and intrinsics.
89 89 $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
90 90 $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
91 - -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
92 - -L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
91 + -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
93 92 fi
94 93 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
95 94 $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
96 95 $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
97 96 elif test "x$TOOLCHAIN_TYPE" = xclang; then
98 97 $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
99 98 $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
100 99 fi
101 100 # Propagate the sysroot args to hotspot
102 101 $1LEGACY_EXTRA_CFLAGS="[$]$1LEGACY_EXTRA_CFLAGS [$]$1SYSROOT_CFLAGS"
103 102 $1LEGACY_EXTRA_CXXFLAGS="[$]$1LEGACY_EXTRA_CXXFLAGS [$]$1SYSROOT_CFLAGS"
104 103 $1LEGACY_EXTRA_LDFLAGS="[$]$1LEGACY_EXTRA_LDFLAGS [$]$1SYSROOT_LDFLAGS"
105 104 # The global CFLAGS and LDFLAGS variables need these for configure to function
106 105 $1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
107 106 $1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
108 107 $1CXXFLAGS="[$]$1CXXFLAGS [$]$1SYSROOT_CFLAGS"
109 108 $1LDFLAGS="[$]$1LDFLAGS [$]$1SYSROOT_LDFLAGS"
110 109 fi
111 110
112 111 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
113 112 # We also need -iframework<path>/System/Library/Frameworks
114 113 $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
115 114 $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
116 115 # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
117 116 # set this here so it doesn't have to be peppered throughout the forest
118 117 $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
119 118 $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
120 119 fi
121 120
122 121 AC_SUBST($1SYSROOT_CFLAGS)
123 122 AC_SUBST($1SYSROOT_LDFLAGS)
124 123 ])
125 124
126 125 AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
127 126 [
128 127 # COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output
129 128 # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
130 129 # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
131 130 # commands produced by the link step (currently AIX only)
132 131 if test "x$TOOLCHAIN_TYPE" = xxlc; then
133 132 COMPILER_TARGET_BITS_FLAG="-q"
134 133 COMPILER_COMMAND_FILE_FLAG="-f"
135 134 COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
136 135 else
137 136 COMPILER_TARGET_BITS_FLAG="-m"
138 137 COMPILER_COMMAND_FILE_FLAG="@"
139 138 COMPILER_BINDCMD_FILE_FLAG=""
140 139
141 140 # The solstudio linker does not support @-files.
142 141 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
143 142 COMPILER_COMMAND_FILE_FLAG=
144 143 fi
145 144
146 145 # Check if @file is supported by gcc
147 146 if test "x$TOOLCHAIN_TYPE" = xgcc; then
148 147 AC_MSG_CHECKING([if @file is supported by gcc])
149 148 # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
150 149 $ECHO "" "--version" > command.file
151 150 if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
152 151 AC_MSG_RESULT(yes)
153 152 COMPILER_COMMAND_FILE_FLAG="@"
154 153 else
155 154 AC_MSG_RESULT(no)
156 155 COMPILER_COMMAND_FILE_FLAG=
157 156 fi
158 157 $RM command.file
159 158 fi
160 159 fi
161 160 AC_SUBST(COMPILER_TARGET_BITS_FLAG)
162 161 AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
163 162 AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
164 163
165 164 # FIXME: figure out if we should select AR flags depending on OS or toolchain.
166 165 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
167 166 ARFLAGS="-r"
168 167 elif test "x$OPENJDK_TARGET_OS" = xaix; then
169 168 ARFLAGS="-X64"
170 169 elif test "x$OPENJDK_TARGET_OS" = xwindows; then
171 170 # lib.exe is used as AR to create static libraries.
172 171 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
173 172 else
174 173 ARFLAGS=""
175 174 fi
176 175 AC_SUBST(ARFLAGS)
177 176
178 177 ## Setup strip.
179 178 # FIXME: should this really be per platform, or should it be per toolchain type?
180 179 # strip is not provided by clang or solstudio; so guessing platform makes most sense.
181 180 # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
182 181 if test "x$OPENJDK_TARGET_OS" = xlinux; then
183 182 STRIPFLAGS="-g"
184 183 elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
185 184 STRIPFLAGS="-x"
186 185 elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
187 186 STRIPFLAGS="-S"
188 187 elif test "x$OPENJDK_TARGET_OS" = xaix; then
189 188 STRIPFLAGS="-X32_64"
190 189 fi
191 190
192 191 AC_SUBST(STRIPFLAGS)
193 192
194 193 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
195 194 CC_OUT_OPTION=-Fo
196 195 EXE_OUT_OPTION=-out:
197 196 LD_OUT_OPTION=-out:
198 197 AR_OUT_OPTION=-out:
199 198 else
200 199 # The option used to specify the target .o,.a or .so file.
201 200 # When compiling, how to specify the to be created object file.
202 201 CC_OUT_OPTION='-o$(SPACE)'
203 202 # When linking, how to specify the to be created executable.
204 203 EXE_OUT_OPTION='-o$(SPACE)'
205 204 # When linking, how to specify the to be created dynamically linkable library.
206 205 LD_OUT_OPTION='-o$(SPACE)'
207 206 # When archiving, how to specify the to be create static archive for object files.
208 207 AR_OUT_OPTION='rcs$(SPACE)'
209 208 fi
210 209 AC_SUBST(CC_OUT_OPTION)
211 210 AC_SUBST(EXE_OUT_OPTION)
212 211 AC_SUBST(LD_OUT_OPTION)
213 212 AC_SUBST(AR_OUT_OPTION)
214 213
215 214 # On Windows, we need to set RC flags.
216 215 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
217 216 RC_FLAGS="-nologo -l0x409"
218 217 JVM_RCFLAGS="-nologo"
219 218 if test "x$DEBUG_LEVEL" = xrelease; then
220 219 RC_FLAGS="$RC_FLAGS -DNDEBUG"
221 220 JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
222 221 fi
223 222
224 223 # The version variables used to create RC_FLAGS may be overridden
225 224 # in a custom configure script, or possibly the command line.
226 225 # Let those variables be expanded at make time in spec.gmk.
227 226 # The \$ are escaped to the shell, and the $(...) variables
228 227 # are evaluated by make.
229 228 RC_FLAGS="$RC_FLAGS \
230 229 -D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
231 230 -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
232 231 -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
233 232 -D\"JDK_VER=\$(VERSION_NUMBER)\" \
234 233 -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
235 234 -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
236 235 -D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
237 236
238 237 JVM_RCFLAGS="$JVM_RCFLAGS \
239 238 -D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
240 239 -D\"HS_COMPANY=\$(COMPANY_NAME)\" \
241 240 -D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
242 241 -D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
243 242 -D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
244 243 -D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
245 244 -D\"HS_FNAME=jvm.dll\" \
246 245 -D\"HS_INTERNAL_NAME=jvm\""
247 246 fi
248 247 AC_SUBST(RC_FLAGS)
249 248 AC_SUBST(JVM_RCFLAGS)
250 249
251 250 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
252 251 # silence copyright notice and other headers.
253 252 COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
254 253 fi
255 254 ])
256 255
257 256 AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
258 257 [
259 258 ###############################################################################
260 259 #
261 260 # How to compile shared libraries.
262 261 #
263 262
264 263 if test "x$TOOLCHAIN_TYPE" = xgcc; then
265 264 PICFLAG="-fPIC"
266 265 C_FLAG_REORDER=''
267 266 CXX_FLAG_REORDER=''
268 267
269 268 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
270 269 # Linking is different on MacOSX
271 270 if test "x$STATIC_BUILD" = xtrue; then
272 271 SHARED_LIBRARY_FLAGS ='-undefined dynamic_lookup'
273 272 else
274 273 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
275 274 JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
276 275 fi
277 276 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
278 277 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
279 278 SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
280 279 SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
281 280 else
282 281 # Default works for linux, might work on other platforms as well.
283 282 SHARED_LIBRARY_FLAGS='-shared'
284 283 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
285 284 SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
286 285 SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
287 286 SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
288 287 fi
289 288 elif test "x$TOOLCHAIN_TYPE" = xclang; then
290 289 C_FLAG_REORDER=''
291 290 CXX_FLAG_REORDER=''
292 291
293 292 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
294 293 # Linking is different on MacOSX
295 294 PICFLAG=''
296 295 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
297 296 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
298 297 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
299 298 SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
300 299 SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
301 300
302 301 if test "x$STATIC_BUILD" = xfalse; then
303 302 JVM_CFLAGS="$JVM_CFLAGS -fPIC"
304 303 fi
305 304 else
306 305 # Default works for linux, might work on other platforms as well.
307 306 PICFLAG='-fPIC'
308 307 SHARED_LIBRARY_FLAGS='-shared'
309 308 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
310 309 SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
311 310 SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
312 311 SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
313 312 fi
314 313 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
315 314 PICFLAG="-KPIC"
316 315 C_FLAG_REORDER='-xF'
317 316 CXX_FLAG_REORDER='-xF'
318 317 SHARED_LIBRARY_FLAGS="-G"
319 318 SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
320 319 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
321 320 SET_SHARED_LIBRARY_NAME='-h [$]1'
322 321 SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
323 322 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
324 323 # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
325 324 # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
326 325 # will have to patch this single instruction with a call to some out-of-order code which
327 326 # does the load from the TOC. This is of course slow. But in that case we also would have
328 327 # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
329 328 # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
330 329 # can be patched directly by the linker and does not require a jump to out-of-order code.
331 330 # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
332 331 # instead. This creates a distinct TOC for every compilation unit (and thus requires two
333 332 # loads for accessing a global variable). But there are rumors that this may be seen as a
334 333 # 'performance feature' because of improved code locality of the symbols used in a
335 334 # compilation unit.
336 335 PICFLAG="-qpic"
337 336 JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
338 337 C_FLAG_REORDER=''
339 338 CXX_FLAG_REORDER=''
340 339 SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
341 340 SET_EXECUTABLE_ORIGIN=""
342 341 SET_SHARED_LIBRARY_ORIGIN=''
343 342 SET_SHARED_LIBRARY_NAME=''
344 343 SET_SHARED_LIBRARY_MAPFILE=''
345 344 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
346 345 PICFLAG=""
347 346 C_FLAG_REORDER=''
348 347 CXX_FLAG_REORDER=''
349 348 SHARED_LIBRARY_FLAGS="-dll"
350 349 SET_EXECUTABLE_ORIGIN=''
351 350 SET_SHARED_LIBRARY_ORIGIN=''
352 351 SET_SHARED_LIBRARY_NAME=''
353 352 SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
354 353 fi
355 354
356 355 AC_SUBST(C_FLAG_REORDER)
357 356 AC_SUBST(CXX_FLAG_REORDER)
358 357 AC_SUBST(SET_EXECUTABLE_ORIGIN)
359 358 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
360 359 AC_SUBST(SET_SHARED_LIBRARY_NAME)
361 360 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
362 361 AC_SUBST(SHARED_LIBRARY_FLAGS)
363 362
364 363 # The (cross) compiler is now configured, we can now test capabilities
365 364 # of the target platform.
366 365 ])
367 366
368 367 # Documentation on common flags used for solstudio in HIGHEST.
369 368 #
370 369 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
371 370 # done with care, there are some assumptions below that need to
372 371 # be understood about the use of pointers, and IEEE behavior.
373 372 #
374 373 # -fns: Use non-standard floating point mode (not IEEE 754)
375 374 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
376 375 # -fsingle: Use single precision floating point with 'float'
377 376 # -xalias_level=basic: Assume memory references via basic pointer types do not alias
378 377 # (Source with excessing pointer casting and data access with mixed
379 378 # pointer types are not recommended)
380 379 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
381 380 # (If you expect perfect errno behavior, do not use this)
382 381 # -xdepend: Loop data dependency optimizations (need -xO3 or higher)
383 382 # -xrestrict: Pointer parameters to functions do not overlap
384 383 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
385 384 # If you pass in multiple pointers to the same data, do not use this)
386 385 # -xlibmil: Inline some library routines
387 386 # (If you expect perfect errno behavior, do not use this)
388 387 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
389 388 # (If you expect perfect errno behavior, do not use this)
390 389 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
391 390
392 391 # FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore.
393 392 # Bug?
394 393 #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
395 394 # CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
396 395 # CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
397 396 #fi
398 397
399 398 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
400 399 [
401 400
402 401 ###############################################################################
403 402 #
404 403 # Setup the opt flags for different compilers
405 404 # and different operating systems.
406 405 #
407 406
408 407 # FIXME: this was indirectly the old default, but just inherited.
409 408 # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
410 409 # C_FLAG_DEPS="-MMD -MF"
411 410 # fi
412 411
413 412 # Generate make dependency files
414 413 if test "x$TOOLCHAIN_TYPE" = xgcc; then
415 414 C_FLAG_DEPS="-MMD -MF"
416 415 elif test "x$TOOLCHAIN_TYPE" = xclang; then
417 416 C_FLAG_DEPS="-MMD -MF"
418 417 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
419 418 C_FLAG_DEPS="-xMMD -xMF"
420 419 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
421 420 C_FLAG_DEPS="-qmakedep=gcc -MF"
422 421 fi
423 422 CXX_FLAG_DEPS="$C_FLAG_DEPS"
424 423 AC_SUBST(C_FLAG_DEPS)
425 424 AC_SUBST(CXX_FLAG_DEPS)
426 425
427 426 # Debug symbols
428 427 if test "x$TOOLCHAIN_TYPE" = xgcc; then
429 428 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
430 429 # reduce from default "-g2" option to save space
431 430 CFLAGS_DEBUG_SYMBOLS="-g1"
432 431 CXXFLAGS_DEBUG_SYMBOLS="-g1"
433 432 else
434 433 CFLAGS_DEBUG_SYMBOLS="-g"
435 434 CXXFLAGS_DEBUG_SYMBOLS="-g"
436 435 fi
437 436 elif test "x$TOOLCHAIN_TYPE" = xclang; then
438 437 CFLAGS_DEBUG_SYMBOLS="-g"
439 438 CXXFLAGS_DEBUG_SYMBOLS="-g"
440 439 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
441 440 CFLAGS_DEBUG_SYMBOLS="-g -xs"
442 441 # -g0 enables debug symbols without disabling inlining.
443 442 CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
444 443 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
445 444 CFLAGS_DEBUG_SYMBOLS="-g"
446 445 CXXFLAGS_DEBUG_SYMBOLS="-g"
447 446 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
448 447 CFLAGS_DEBUG_SYMBOLS="-Zi"
449 448 CXXFLAGS_DEBUG_SYMBOLS="-Zi"
450 449 fi
451 450 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
452 451 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
453 452
454 453 # Debug symbols for JVM_CFLAGS
455 454 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
456 455 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
457 456 if test "x$DEBUG_LEVEL" = xslowdebug; then
458 457 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
459 458 else
460 459 # -g0 does not disable inlining, which -g does.
461 460 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
462 461 fi
463 462 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
464 463 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
465 464 else
466 465 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
467 466 fi
468 467 AC_SUBST(JVM_CFLAGS_SYMBOLS)
469 468
470 469 # bounds, memory and behavior checking options
471 470 if test "x$TOOLCHAIN_TYPE" = xgcc; then
472 471 case $DEBUG_LEVEL in
473 472 release )
474 473 # no adjustment
475 474 ;;
476 475 fastdebug )
477 476 # no adjustment
478 477 ;;
479 478 slowdebug )
480 479 # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
481 480 # get's added conditionally on whether we produce debug symbols or not.
482 481 # This is most likely not really correct.
483 482
484 483 # Add runtime stack smashing and undefined behavior checks.
485 484 # Not all versions of gcc support -fstack-protector
486 485 STACK_PROTECTOR_CFLAG="-fstack-protector-all"
487 486 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
488 487
489 488 CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
490 489 CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
491 490 if test "x$STACK_PROTECTOR_CFLAG" != x; then
492 491 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
493 492 fi
494 493 ;;
495 494 esac
496 495 fi
497 496
498 497 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
499 498 if test "x$DEBUG_LEVEL" != xrelease; then
500 499 if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
501 500 JVM_CFLAGS="$JVM_CFLAGS -homeparams"
502 501 fi
503 502 fi
504 503 fi
505 504
506 505 # Optimization levels
507 506 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
508 507 CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
509 508
510 509 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
511 510 # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
512 511 C_O_FLAG_HIGHEST_JVM="-xO4"
513 512 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xalias_level=basic -xregs=no%frameptr"
514 513 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
515 514 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
516 515 C_O_FLAG_DEBUG="-xregs=no%frameptr"
517 516 C_O_FLAG_DEBUG_JVM=""
518 517 C_O_FLAG_NONE="-xregs=no%frameptr"
519 518 CXX_O_FLAG_HIGHEST_JVM="-xO4"
520 519 CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
521 520 CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
522 521 CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
523 522 CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
524 523 CXX_O_FLAG_DEBUG_JVM=""
525 524 CXX_O_FLAG_NONE="-xregs=no%frameptr"
526 525 if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
527 526 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
528 527 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
529 528 fi
530 529 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
531 530 C_O_FLAG_HIGHEST_JVM="-xO4"
532 531 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xalias_level=basic -xprefetch=auto,explicit -xchip=ultra"
533 532 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
534 533 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
535 534 C_O_FLAG_DEBUG=""
536 535 C_O_FLAG_DEBUG_JVM=""
537 536 C_O_FLAG_NONE=""
538 537 CXX_O_FLAG_HIGHEST_JVM="-xO4"
539 538 CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
540 539 CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
541 540 CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
542 541 CXX_O_FLAG_DEBUG=""
543 542 CXX_O_FLAG_DEBUG_JVM=""
544 543 CXX_O_FLAG_NONE=""
545 544 fi
546 545 else
547 546 # The remaining toolchains share opt flags between CC and CXX;
548 547 # setup for C and duplicate afterwards.
549 548 if test "x$TOOLCHAIN_TYPE" = xgcc; then
550 549 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
551 550 # On MacOSX we optimize for size, something
552 551 # we should do for all platforms?
553 552 C_O_FLAG_HIGHEST_JVM="-Os"
554 553 C_O_FLAG_HIGHEST="-Os"
555 554 C_O_FLAG_HI="-Os"
556 555 C_O_FLAG_NORM="-Os"
557 556 C_O_FLAG_SIZE="-Os"
558 557 else
559 558 C_O_FLAG_HIGHEST_JVM="-O3"
560 559 C_O_FLAG_HIGHEST="-O3"
561 560 C_O_FLAG_HI="-O3"
562 561 C_O_FLAG_NORM="-O2"
563 562 C_O_FLAG_SIZE="-Os"
564 563 fi
565 564 C_O_FLAG_DEBUG="-O0"
566 565 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
567 566 C_O_FLAG_DEBUG_JVM=""
568 567 elif test "x$OPENJDK_TARGET_OS" = xlinux; then
569 568 C_O_FLAG_DEBUG_JVM="-O0"
570 569 fi
571 570 C_O_FLAG_NONE="-O0"
572 571 elif test "x$TOOLCHAIN_TYPE" = xclang; then
573 572 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
574 573 # On MacOSX we optimize for size, something
575 574 # we should do for all platforms?
576 575 C_O_FLAG_HIGHEST_JVM="-Os"
577 576 C_O_FLAG_HIGHEST="-Os"
578 577 C_O_FLAG_HI="-Os"
579 578 C_O_FLAG_NORM="-Os"
580 579 C_O_FLAG_SIZE="-Os"
581 580 else
582 581 C_O_FLAG_HIGHEST_JVM="-O3"
583 582 C_O_FLAG_HIGHEST="-O3"
584 583 C_O_FLAG_HI="-O3"
585 584 C_O_FLAG_NORM="-O2"
586 585 C_O_FLAG_SIZE="-Os"
587 586 fi
588 587 C_O_FLAG_DEBUG="-O0"
589 588 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
590 589 C_O_FLAG_DEBUG_JVM=""
591 590 elif test "x$OPENJDK_TARGET_OS" = xlinux; then
592 591 C_O_FLAG_DEBUG_JVM="-O0"
593 592 fi
594 593 C_O_FLAG_NONE="-O0"
595 594 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
596 595 C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
597 596 C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
598 597 C_O_FLAG_HI="-O3 -qinline -qinlglue"
599 598 C_O_FLAG_NORM="-O2"
600 599 C_O_FLAG_DEBUG="-qnoopt"
601 600 # FIXME: Value below not verified.
602 601 C_O_FLAG_DEBUG_JVM=""
603 602 C_O_FLAG_NONE="-qnoopt"
604 603 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
605 604 C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
606 605 C_O_FLAG_HIGHEST="-O2"
607 606 C_O_FLAG_HI="-O1"
608 607 C_O_FLAG_NORM="-O1"
609 608 C_O_FLAG_DEBUG="-Od"
610 609 C_O_FLAG_DEBUG_JVM=""
611 610 C_O_FLAG_NONE="-Od"
612 611 C_O_FLAG_SIZE="-Os"
613 612 fi
614 613 CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
615 614 CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
616 615 CXX_O_FLAG_HI="$C_O_FLAG_HI"
617 616 CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
618 617 CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
619 618 CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
620 619 CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
621 620 CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
622 621 fi
623 622
624 623 # Adjust optimization flags according to debug level.
625 624 case $DEBUG_LEVEL in
626 625 release )
627 626 # no adjustment
628 627 ;;
629 628 fastdebug )
630 629 # Not quite so much optimization
631 630 C_O_FLAG_HI="$C_O_FLAG_NORM"
632 631 CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
633 632 ;;
634 633 slowdebug )
635 634 # Disable optimization
636 635 C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
637 636 C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
638 637 C_O_FLAG_HI="$C_O_FLAG_DEBUG"
639 638 C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
640 639 C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
641 640 CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
642 641 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
643 642 CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
644 643 CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
645 644 CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
646 645 ;;
647 646 esac
648 647
649 648 AC_SUBST(C_O_FLAG_HIGHEST_JVM)
650 649 AC_SUBST(C_O_FLAG_HIGHEST)
651 650 AC_SUBST(C_O_FLAG_HI)
652 651 AC_SUBST(C_O_FLAG_NORM)
653 652 AC_SUBST(C_O_FLAG_DEBUG)
654 653 AC_SUBST(C_O_FLAG_NONE)
655 654 AC_SUBST(C_O_FLAG_SIZE)
656 655 AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
657 656 AC_SUBST(CXX_O_FLAG_HIGHEST)
658 657 AC_SUBST(CXX_O_FLAG_HI)
659 658 AC_SUBST(CXX_O_FLAG_NORM)
660 659 AC_SUBST(CXX_O_FLAG_DEBUG)
661 660 AC_SUBST(CXX_O_FLAG_NONE)
662 661 AC_SUBST(CXX_O_FLAG_SIZE)
663 662 ])
664 663
665 664
666 665 AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
667 666 [
668 667
669 668 FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([TARGET])
670 669 FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([BUILD], [OPENJDK_BUILD_])
671 670
672 671 # Tests are only ever compiled for TARGET
673 672 # Flags for compiling test libraries
674 673 CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
675 674 CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
676 675
677 676 # Flags for compiling test executables
678 677 CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
679 678 CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
680 679
681 680 AC_SUBST(CFLAGS_TESTLIB)
682 681 AC_SUBST(CFLAGS_TESTEXE)
683 682 AC_SUBST(CXXFLAGS_TESTLIB)
684 683 AC_SUBST(CXXFLAGS_TESTEXE)
685 684
686 685 LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
687 686 LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
688 687
689 688 AC_SUBST(LDFLAGS_TESTLIB)
690 689 AC_SUBST(LDFLAGS_TESTEXE)
691 690
692 691 ])
693 692
694 693 ################################################################################
695 694 # $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
696 695 # conditionals against.
697 696 # $2 - Optional prefix for each variable defined.
698 697 AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
699 698 [
700 699 # Special extras...
701 700 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
702 701 if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
703 702 $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
704 703 $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
705 704 fi
706 705 $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
707 706 $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
708 707 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
709 708 $2CFLAGS_JDK="${$2CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
710 709 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
711 710 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
712 711 $2CXXSTD_CXXFLAG="-std=gnu++98"
713 712 FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
714 713 IF_FALSE: [$2CXXSTD_CXXFLAG=""])
715 714 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
716 715 $2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
717 716 AC_SUBST([$2CXXSTD_CXXFLAG])
718 717 fi
719 718 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
720 719 $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
721 720 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
722 721 fi
723 722
724 723 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
725 724 $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
726 725 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
727 726 fi
728 727
729 728 $2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
730 729 $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
731 730 $2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
732 731
733 732 ###############################################################################
734 733 #
735 734 # Now setup the CFLAGS and LDFLAGS for the JDK build.
736 735 # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
737 736 #
738 737
739 738 # Setup compiler/platform specific flags into
740 739 # $2CFLAGS_JDK - C Compiler flags
741 740 # $2CXXFLAGS_JDK - C++ Compiler flags
742 741 # $2COMMON_CCXXFLAGS_JDK - common to C and C++
743 742 if test "x$TOOLCHAIN_TYPE" = xgcc; then
744 743 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
745 744 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT"
746 745 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fcheck-new"
747 746 if test "x$OPENJDK_$1_CPU" = xx86; then
748 747 # Force compatibility with i586 on 32 bit intel platforms.
749 748 $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
750 749 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
751 750 fi
752 751 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
753 752 -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
754 753 case $OPENJDK_$1_CPU_ARCH in
755 754 arm )
756 755 # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
757 756 $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
758 757 ;;
759 758 ppc )
760 759 # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
761 760 $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
762 761 ;;
763 762 * )
764 763 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
765 764 $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
766 765 ;;
767 766 esac
768 767 TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
769 768 elif test "x$TOOLCHAIN_TYPE" = xclang; then
770 769 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
771 770
772 771 # Restrict the debug information created by Clang to avoid
773 772 # too big object files and speed the build up a little bit
774 773 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
775 774 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -flimit-debug-info"
776 775 if test "x$OPENJDK_$1_OS" = xlinux; then
777 776 if test "x$OPENJDK_$1_CPU" = xx86; then
778 777 # Force compatibility with i586 on 32 bit intel platforms.
779 778 $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
780 779 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
781 780 fi
782 781 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-sometimes-uninitialized"
783 782 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
784 783 -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
785 784 case $OPENJDK_$1_CPU_ARCH in
786 785 ppc )
787 786 # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
788 787 $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
789 788 ;;
790 789 * )
791 790 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
792 791 $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
793 792 ;;
794 793 esac
795 794 fi
796 795 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
797 796 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSPARC_WORKS"
798 797 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
799 798 if test "x$OPENJDK_$1_CPU_ARCH" = xx86; then
800 799 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_$1_CPU_LEGACY_LIB"
801 800 fi
802 801
803 802 $2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
804 803 $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
805 804 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
806 805 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
807 806 $2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
808 807 $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
809 808 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
810 809 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK \
811 810 -MD -Zc:wchar_t- -W3 -wd4800 \
812 811 -DWIN32_LEAN_AND_MEAN \
813 812 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
814 813 -D_WINSOCK_DEPRECATED_NO_WARNINGS \
815 814 -DWIN32 -DIAL"
816 815 if test "x$OPENJDK_$1_CPU" = xx86_64; then
817 816 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
818 817 else
819 818 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
820 819 fi
821 820 # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
822 821 # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
823 822 # studio.
824 823 if test "x$TOOLCHAIN_VERSION" = "x2010"; then
825 824 STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
826 825 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
827 826 $2JVM_CFLAGS="[$]$2JVM_CFLAGS $STATIC_CPPLIB_FLAGS"
828 827 fi
829 828 fi
830 829
831 830 ###############################################################################
832 831
833 832 # Adjust flags according to debug level.
834 833 case $DEBUG_LEVEL in
835 834 fastdebug | slowdebug )
836 835 $2CFLAGS_JDK="[$]$2CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
837 836 $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
838 837 JAVAC_FLAGS="$JAVAC_FLAGS -g"
839 838 ;;
840 839 release )
841 840 ;;
842 841 * )
843 842 AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
844 843 ;;
845 844 esac
846 845
847 846 # Set some common defines. These works for all compilers, but assume
848 847 # -D is universally accepted.
849 848
850 849 # Setup endianness
851 850 if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
852 851 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
853 852 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
854 853 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
855 854 # Note: -Dmacro is the same as #define macro 1
856 855 # -Dmacro= is the same as #define macro
857 856 if test "x$OPENJDK_$1_OS" = xsolaris; then
858 857 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
859 858 else
860 859 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
861 860 fi
862 861 else
863 862 # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
864 863 # are defined in the system?
865 864 if test "x$OPENJDK_$1_OS" = xsolaris; then
866 865 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN="
867 866 else
868 867 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
869 868 fi
870 869 fi
871 870
872 871 # Setup target OS define. Use OS target name but in upper case.
873 872 OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
874 873 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE"
875 874
876 875 # Setup target CPU
877 876 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
878 877 $OPENJDK_$1_ADD_LP64 \
879 878 -DARCH='\"$OPENJDK_$1_CPU_LEGACY\"' -D$OPENJDK_$1_CPU_LEGACY"
880 879
881 880 # Setup debug/release defines
882 881 if test "x$DEBUG_LEVEL" = xrelease; then
883 882 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DNDEBUG"
884 883 if test "x$OPENJDK_$1_OS" = xsolaris; then
885 884 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DTRIMMED"
886 885 fi
887 886 else
888 887 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DDEBUG"
889 888 fi
890 889
891 890 # Set some additional per-OS defines.
892 891 if test "x$OPENJDK_$1_OS" = xlinux; then
893 892 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
894 893 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe -fPIC -fno-rtti -fno-exceptions \
895 894 -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
896 895 elif test "x$OPENJDK_$1_OS" = xsolaris; then
897 896 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
898 897 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
899 898 -D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
900 899 elif test "x$OPENJDK_$1_OS" = xmacosx; then
901 900 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
902 901 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
903 902 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
904 903 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fno-rtti -fno-exceptions -fvisibility=hidden \
905 904 -mno-omit-leaf-frame-pointer -mstack-alignment=16 -pipe -fno-strict-aliasing \
906 905 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -mmacosx-version-min=10.7.0 \
907 906 -fno-omit-frame-pointer"
908 907 elif test "x$OPENJDK_$1_OS" = xaix; then
909 908 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DAIX"
910 909 # We may need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
911 910 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qtune=balanced \
912 911 -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
913 912 -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
914 913 elif test "x$OPENJDK_$1_OS" = xbsd; then
915 914 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
916 915 elif test "x$OPENJDK_$1_OS" = xwindows; then
917 916 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
918 917 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -nologo -W3 -MD -MP"
919 918 fi
920 919
921 920 # Set some additional per-CPU defines.
922 921 if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then
923 922 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32"
924 923 elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
925 924 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc"
926 925 elif test "x$OPENJDK_$1_CPU" = xppc64; then
927 926 if test "x$OPENJDK_$1_OS" = xlinux; then
928 927 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
929 928 # fixes `relocation truncated to fit' error for gcc 4.1.
930 929 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mminimal-toc"
931 930 # Use ppc64 instructions, but schedule for power5
932 931 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=powerpc64 -mtune=power5"
933 932 elif test "x$OPENJDK_$1_OS" = xaix; then
934 933 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qarch=ppc64"
935 934 fi
936 935 elif test "x$OPENJDK_$1_CPU" = xppc64le; then
937 936 if test "x$OPENJDK_$1_OS" = xlinux; then
938 937 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
939 938 # Little endian machine uses ELFv2 ABI.
940 939 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DABI_ELFv2"
941 940 # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
942 941 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
943 942 fi
944 943 fi
945 944
946 945 if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
947 946 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DVM_LITTLE_ENDIAN"
948 947 fi
949 948
950 949 if test "x$OPENJDK_$1_CPU_BITS" = x64; then
951 950 if test "x$OPENJDK_$1_OS" != xsolaris && test "x$OPENJDK_$1_OS" != xaix; then
952 951 # Solaris does not have _LP64=1 in the old build.
953 952 # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
954 953 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_LP64=1"
955 954 fi
956 955 fi
957 956
958 957 # Set $2JVM_CFLAGS warning handling
959 958 if test "x$OPENJDK_$1_OS" = xlinux; then
960 959 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wpointer-arith -Wsign-compare -Wunused-function \
961 960 -Wunused-value -Woverloaded-virtual"
962 961
963 962 if test "x$TOOLCHAIN_TYPE" = xgcc; then
964 963 TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
965 964 IF_AT_LEAST: [
966 965 # These flags either do not work or give spurious warnings prior to gcc 4.8.
967 966 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-format-zero-length -Wtype-limits -Wuninitialized"
968 967 ]
969 968 )
970 969 fi
971 970 if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
972 971 # Non-zero builds have stricter warnings
973 972 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wreturn-type -Wundef -Wformat=2"
974 973 else
975 974 if test "x$TOOLCHAIN_TYPE" = xclang; then
976 975 # Some versions of llvm do not like -Wundef
977 976 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-undef"
978 977 fi
979 978 fi
980 979 elif test "x$OPENJDK_$1_OS" = xmacosx; then
981 980 $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-deprecated -Wpointer-arith \
982 981 -Wsign-compare -Wundef -Wunused-function -Wformat=2"
983 982 fi
984 983
985 984 # Additional macosx handling
986 985 if test "x$OPENJDK_$1_OS" = xmacosx; then
987 986 # Setting these parameters makes it an error to link to macosx APIs that are
988 987 # newer than the given OS version and makes the linked binaries compatible
989 988 # even if built on a newer version of the OS.
990 989 # The expected format is X.Y.Z
991 990 MACOSX_VERSION_MIN=10.7.0
992 991 AC_SUBST(MACOSX_VERSION_MIN)
993 992
994 993 # The macro takes the version with no dots, ex: 1070
995 994 # Let the flags variables get resolved in make for easier override on make
996 995 # command line.
997 996 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
998 997 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
999 998 fi
1000 999
1001 1000 # Setup some hard coded includes
1002 1001 $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
1003 1002 -I${JDK_TOPDIR}/src/java.base/share/native/include \
1004 1003 -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
1005 1004 -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
1006 1005 -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
1007 1006 -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava"
1008 1007
1009 1008 # The shared libraries are compiled using the picflag.
1010 1009 $2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
1011 1010 [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK $PICFLAG [$]$2CFLAGS_JDKLIB_EXTRA"
1012 1011 $2CXXFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
1013 1012 [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK $PICFLAG [$]$2CXXFLAGS_JDKLIB_EXTRA"
1014 1013
1015 1014 # Executable flags
1016 1015 $2CFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK"
1017 1016 $2CXXFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK"
1018 1017
1019 1018 AC_SUBST($2CFLAGS_JDKLIB)
1020 1019 AC_SUBST($2CFLAGS_JDKEXE)
1021 1020 AC_SUBST($2CXXFLAGS_JDKLIB)
1022 1021 AC_SUBST($2CXXFLAGS_JDKEXE)
1023 1022
1024 1023 # Setup LDFLAGS et al.
1025 1024 #
1026 1025
1027 1026 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1028 1027 LDFLAGS_MICROSOFT="-nologo -opt:ref"
1029 1028 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
1030 1029 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_MICROSOFT -opt:icf,8 -subsystem:windows -base:0x8000000"
1031 1030 if test "x$OPENJDK_$1_CPU_BITS" = "x32"; then
1032 1031 LDFLAGS_SAFESH="-safeseh"
1033 1032 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SAFESH"
1034 1033 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SAFESH"
1035 1034 # NOTE: Old build added -machine. Probably not needed.
1036 1035 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:I386"
1037 1036 else
1038 1037 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:AMD64"
1039 1038 fi
1040 1039 elif test "x$TOOLCHAIN_TYPE" = xclang; then
1041 1040 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -mno-omit-leaf-frame-pointer -mstack-alignment=16 -stdlib=libstdc++ -fPIC"
1042 1041 if test "x$OPENJDK_$1_OS" = xmacosx; then
1043 1042 # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
1044 1043 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
1045 1044 fi
1046 1045 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
1047 1046 # If this is a --hash-style=gnu system, use --hash-style=both, why?
1048 1047 # We have previously set HAS_GNU_HASH if this is the case
1049 1048 if test -n "$HAS_GNU_HASH"; then
1050 1049 $2LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
1051 1050 $2LDFLAGS_JDK="${$2LDFLAGS_JDK} [$]$2LDFLAGS_HASH_STYLE"
1052 1051 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS [$]$2LDFLAGS_HASH_STYLE"
1053 1052 fi
1054 1053 if test "x$OPENJDK_$1_OS" = xmacosx; then
1055 1054 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
1056 1055 fi
1057 1056 if test "x$OPENJDK_$1_OS" = xlinux; then
1058 1057 # And since we now know that the linker is gnu, then add -z defs, to forbid
1059 1058 # undefined symbols in object files.
1060 1059 LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
1061 1060 $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
1062 1061 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_UNDEF_SYM"
1063 1062 LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack"
1064 1063 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_EXEC_STACK"
1065 1064 if test "x$OPENJDK_$1_CPU" = xx86; then
1066 1065 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -march=i586"
1067 1066 fi
1068 1067 case $DEBUG_LEVEL in
1069 1068 release )
1070 1069 # tell linker to optimize libraries.
1071 1070 # Should this be supplied to the OSS linker as well?
1072 1071 LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
1073 1072 $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
1074 1073 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_DEBUGLEVEL_release"
1075 1074 if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1076 1075 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1077 1076 fi
1078 1077 ;;
1079 1078 slowdebug )
1080 1079 # Hotspot always let the linker optimize
1081 1080 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
1082 1081 if test "x$HAS_LINKER_NOW" = "xtrue"; then
1083 1082 # do relocations at load
1084 1083 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_NOW_FLAG"
1085 1084 $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_NOW_FLAG"
1086 1085 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_NOW_FLAG"
1087 1086 fi
1088 1087 if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1089 1088 # mark relocations read only
1090 1089 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
1091 1090 $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
1092 1091 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1093 1092 fi
1094 1093 ;;
1095 1094 fastdebug )
1096 1095 # Hotspot always let the linker optimize
1097 1096 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
1098 1097 if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1099 1098 # mark relocations read only
1100 1099 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
1101 1100 $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
1102 1101 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1103 1102 fi
1104 1103 ;;
1105 1104 * )
1106 1105 AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
1107 1106 ;;
1108 1107 esac
1109 1108 fi
1110 1109 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
1111 1110 LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
1112 1111 $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
1113 1112 LDFLAGS_CXX_SOLSTUDIO="-norunpath"
1114 1113 $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
1115 1114 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
1116 1115 if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
1117 1116 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -xarch=sparc"
1118 1117 fi
1119 1118 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
1120 1119 LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
1121 1120 $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_XLC"
1122 1121 $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_XLC"
1123 1122 fi
1124 1123
1125 1124 # Customize LDFLAGS for executables
1126 1125
1127 1126 $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDK}"
1128 1127
1129 1128 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1130 1129 if test "x$OPENJDK_$1_CPU_BITS" = "x64"; then
1131 1130 LDFLAGS_STACK_SIZE=1048576
1132 1131 else
1133 1132 LDFLAGS_STACK_SIZE=327680
1134 1133 fi
1135 1134 $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
1136 1135 elif test "x$OPENJDK_$1_OS" = xlinux; then
1137 1136 $2LDFLAGS_JDKEXE="[$]$2LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
1138 1137 fi
1139 1138
1140 1139 $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} ${$2EXTRA_LDFLAGS_JDK}"
1141 1140
1142 1141 # Customize LDFLAGS for libs
1143 1142 $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
1144 1143
1145 1144 $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
1146 1145 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1147 1146 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1148 1147 -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
1149 1148 $2JDKLIB_LIBS=""
1150 1149 else
1151 1150 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1152 1151 -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)"
1153 1152
1154 1153 if test "x$1" = "xTARGET"; then
1155 1154 # On some platforms (mac) the linker warns about non existing -L dirs.
1156 1155 # Add server first if available. Linking aginst client does not always produce the same results.
1157 1156 # Only add client/minimal dir if client/minimal is being built.
1158 1157 # Default to server for other variants.
1159 1158 if HOTSPOT_CHECK_JVM_VARIANT(server); then
1160 1159 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
1161 1160 elif HOTSPOT_CHECK_JVM_VARIANT(client); then
1162 1161 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
1163 1162 elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then
1164 1163 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
1165 1164 else
1166 1165 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
1167 1166 fi
1168 1167 elif test "x$1" = "xBUILD"; then
1169 1168 # When building a buildjdk, it's always only the server variant
1170 1169 $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1171 1170 -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
1172 1171 fi
1173 1172
1174 1173 $2JDKLIB_LIBS="-ljava -ljvm"
1175 1174 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
1176 1175 $2JDKLIB_LIBS="[$]$2JDKLIB_LIBS -lc"
1177 1176 fi
1178 1177
1179 1178 fi
1180 1179
1181 1180 $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
1182 1181
1183 1182 # Set $2JVM_LIBS (per os)
1184 1183 if test "x$OPENJDK_$1_OS" = xlinux; then
1185 1184 $2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
1186 1185 elif test "x$OPENJDK_$1_OS" = xsolaris; then
1187 1186 # FIXME: This hard-coded path is not really proper.
1188 1187 if test "x$OPENJDK_$1_CPU" = xx86_64; then
1189 1188 $2SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
1190 1189 elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
1191 1190 $2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
1192 1191 fi
1193 1192 $2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
1194 1193 -lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt"
1195 1194 elif test "x$OPENJDK_$1_OS" = xmacosx; then
1196 1195 $2JVM_LIBS="[$]$2JVM_LIBS -lm"
1197 1196 elif test "x$OPENJDK_$1_OS" = xaix; then
1198 1197 $2JVM_LIBS="[$]$2JVM_LIBS -Wl,-lC_r -lm -ldl -lpthread"
1199 1198 elif test "x$OPENJDK_$1_OS" = xbsd; then
1200 1199 $2JVM_LIBS="[$]$2JVM_LIBS -lm"
1201 1200 elif test "x$OPENJDK_$1_OS" = xwindows; then
1202 1201 $2JVM_LIBS="[$]$2JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
1203 1202 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
1204 1203 wsock32.lib winmm.lib version.lib psapi.lib"
1205 1204 fi
1206 1205
1207 1206 # Set $2JVM_ASFLAGS
1208 1207 if test "x$OPENJDK_$1_OS" = xlinux; then
1209 1208 if test "x$OPENJDK_$1_CPU" = xx86; then
1210 1209 $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -march=i586"
1211 1210 fi
1212 1211 elif test "x$OPENJDK_$1_OS" = xmacosx; then
1213 1212 $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -x assembler-with-cpp -mno-omit-leaf-frame-pointer -mstack-alignment=16"
1214 1213 fi
1215 1214
1216 1215 $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2EXTRA_LDFLAGS_JDK}"
1217 1216
1218 1217 AC_SUBST($2LDFLAGS_JDKLIB)
1219 1218 AC_SUBST($2LDFLAGS_JDKEXE)
1220 1219 AC_SUBST($2JDKLIB_LIBS)
1221 1220 AC_SUBST($2JDKEXE_LIBS)
1222 1221 AC_SUBST($2LDFLAGS_CXX_JDK)
1223 1222 AC_SUBST($2LDFLAGS_HASH_STYLE)
1224 1223
1225 1224 AC_SUBST($2JVM_CFLAGS)
1226 1225 AC_SUBST($2JVM_LDFLAGS)
1227 1226 AC_SUBST($2JVM_ASFLAGS)
1228 1227 AC_SUBST($2JVM_LIBS)
1229 1228
1230 1229 ])
1231 1230
1232 1231 # FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1233 1232 # IF_FALSE: [RUN-IF-FALSE])
1234 1233 # ------------------------------------------------------------
1235 1234 # Check that the C compiler supports an argument
1236 1235 BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
1237 1236 [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1238 1237 [
1239 1238 AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
1240 1239 supports=yes
1241 1240
1242 1241 saved_cflags="$CFLAGS"
1243 1242 CFLAGS="$CFLAGS ARG_ARGUMENT"
1244 1243 AC_LANG_PUSH([C])
1245 1244 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
1246 1245 [supports=no])
1247 1246 AC_LANG_POP([C])
1248 1247 CFLAGS="$saved_cflags"
1249 1248
1250 1249 AC_MSG_RESULT([$supports])
1251 1250 if test "x$supports" = "xyes" ; then
1252 1251 :
1253 1252 ARG_IF_TRUE
1254 1253 else
1255 1254 :
1256 1255 ARG_IF_FALSE
1257 1256 fi
1258 1257 ])
1259 1258
1260 1259 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1261 1260 # IF_FALSE: [RUN-IF-FALSE])
1262 1261 # ------------------------------------------------------------
1263 1262 # Check that the C++ compiler supports an argument
1264 1263 BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
1265 1264 [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1266 1265 [
1267 1266 AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
1268 1267 supports=yes
1269 1268
1270 1269 saved_cxxflags="$CXXFLAGS"
1271 1270 CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
1272 1271 AC_LANG_PUSH([C++])
1273 1272 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
1274 1273 [supports=no])
1275 1274 AC_LANG_POP([C++])
1276 1275 CXXFLAGS="$saved_cxxflags"
1277 1276
1278 1277 AC_MSG_RESULT([$supports])
1279 1278 if test "x$supports" = "xyes" ; then
1280 1279 :
1281 1280 ARG_IF_TRUE
1282 1281 else
1283 1282 :
1284 1283 ARG_IF_FALSE
1285 1284 fi
1286 1285 ])
1287 1286
1288 1287 # FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1289 1288 # IF_FALSE: [RUN-IF-FALSE])
1290 1289 # ------------------------------------------------------------
1291 1290 # Check that the C and C++ compilers support an argument
1292 1291 BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
1293 1292 [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1294 1293 [
1295 1294 FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
1296 1295 IF_TRUE: [C_COMP_SUPPORTS="yes"],
1297 1296 IF_FALSE: [C_COMP_SUPPORTS="no"])
1298 1297 FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
1299 1298 IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
1300 1299 IF_FALSE: [CXX_COMP_SUPPORTS="no"])
1301 1300
1302 1301 AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
1303 1302 supports=no
1304 1303 if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
1305 1304
1306 1305 AC_MSG_RESULT([$supports])
1307 1306 if test "x$supports" = "xyes" ; then
1308 1307 :
1309 1308 ARG_IF_TRUE
1310 1309 else
1311 1310 :
1312 1311 ARG_IF_FALSE
1313 1312 fi
1314 1313 ])
1315 1314
1316 1315 # FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1317 1316 # IF_FALSE: [RUN-IF-FALSE])
1318 1317 # ------------------------------------------------------------
1319 1318 # Check that the linker support an argument
1320 1319 BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
1321 1320 [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1322 1321 [
1323 1322 AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
1324 1323 supports=yes
1325 1324
1326 1325 saved_ldflags="$LDFLAGS"
1327 1326 LDFLAGS="$LDFLAGS ARG_ARGUMENT"
1328 1327 AC_LANG_PUSH([C])
1329 1328 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
1330 1329 [], [supports=no])
1331 1330 AC_LANG_POP([C])
1332 1331 LDFLAGS="$saved_ldflags"
1333 1332
1334 1333 AC_MSG_RESULT([$supports])
1335 1334 if test "x$supports" = "xyes" ; then
1336 1335 :
1337 1336 ARG_IF_TRUE
1338 1337 else
1339 1338 :
1340 1339 ARG_IF_FALSE
1341 1340 fi
1342 1341 ])
1343 1342
1344 1343 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
1345 1344 [
1346 1345 # Some Zero and Shark settings.
1347 1346 # ZERO_ARCHFLAG tells the compiler which mode to build for
1348 1347 case "${OPENJDK_TARGET_CPU}" in
1349 1348 s390)
1350 1349 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
1351 1350 ;;
1352 1351 *)
1353 1352 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
1354 1353 esac
1355 1354 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
1356 1355 AC_SUBST(ZERO_ARCHFLAG)
1357 1356
1358 1357 # Check that the compiler supports -mX (or -qX on AIX) flags
1359 1358 # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
1360 1359 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
1361 1360 IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
1362 1361 IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
1363 1362 AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
1364 1363
1365 1364 AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
1366 1365 [do not consider native warnings to be an error @<:@enabled@:>@])])
1367 1366
1368 1367 AC_MSG_CHECKING([if native warnings are errors])
1369 1368 if test "x$enable_warnings_as_errors" = "xyes"; then
1370 1369 AC_MSG_RESULT([yes (explicitely set)])
1371 1370 WARNINGS_AS_ERRORS=true
1372 1371 elif test "x$enable_warnings_as_errors" = "xno"; then
1373 1372 AC_MSG_RESULT([no])
1374 1373 WARNINGS_AS_ERRORS=false
1375 1374 elif test "x$enable_warnings_as_errors" = "x"; then
1376 1375 AC_MSG_RESULT([yes (default)])
1377 1376 WARNINGS_AS_ERRORS=true
1378 1377 else
1379 1378 AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
1380 1379 fi
1381 1380
1382 1381 if test "x$WARNINGS_AS_ERRORS" = "xfalse"; then
1383 1382 # Set legacy hotspot variable
1384 1383 HOTSPOT_SET_WARNINGS_AS_ERRORS="WARNINGS_ARE_ERRORS="
1385 1384 else
1386 1385 HOTSPOT_SET_WARNINGS_AS_ERRORS=""
1387 1386 fi
1388 1387
1389 1388 AC_SUBST(WARNINGS_AS_ERRORS)
1390 1389 AC_SUBST(HOTSPOT_SET_WARNINGS_AS_ERRORS)
1391 1390
1392 1391 case "${TOOLCHAIN_TYPE}" in
1393 1392 microsoft)
1394 1393 DISABLE_WARNING_PREFIX="-wd"
1395 1394 CFLAGS_WARNINGS_ARE_ERRORS="-WX"
1396 1395 ;;
1397 1396 solstudio)
1398 1397 DISABLE_WARNING_PREFIX="-erroff="
1399 1398 CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
1400 1399 ;;
1401 1400 gcc)
1402 1401 # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
1403 1402 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
1404 1403 IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
1405 1404 IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
1406 1405 )
1407 1406 if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
1408 1407 DISABLE_WARNING_PREFIX="-Wno-"
1409 1408 else
1410 1409 DISABLE_WARNING_PREFIX=
1411 1410 fi
1412 1411 CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
1413 1412 # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
1414 1413 # CFLAGS since any target specific flags will likely not work with the
1415 1414 # build compiler
1416 1415 CC_OLD="$CC"
1417 1416 CXX_OLD="$CXX"
1418 1417 CC="$BUILD_CC"
1419 1418 CXX="$BUILD_CXX"
1420 1419 CFLAGS_OLD="$CFLAGS"
1421 1420 CFLAGS=""
1422 1421 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
1423 1422 IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
1424 1423 IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
1425 1424 )
1426 1425 if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
1427 1426 BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
1428 1427 else
1429 1428 BUILD_CC_DISABLE_WARNING_PREFIX=
1430 1429 fi
1431 1430 CC="$CC_OLD"
1432 1431 CXX="$CXX_OLD"
1433 1432 CFLAGS="$CFLAGS_OLD"
1434 1433 ;;
1435 1434 clang)
1436 1435 DISABLE_WARNING_PREFIX="-Wno-"
1437 1436 CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
1438 1437 ;;
1439 1438 xlc)
1440 1439 DISABLE_WARNING_PREFIX="-qsuppress="
1441 1440 CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
1442 1441 ;;
1443 1442 esac
1444 1443 AC_SUBST(DISABLE_WARNING_PREFIX)
1445 1444 AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
1446 1445 AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
1447 1446 ])
1448 1447
1449 1448 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
1450 1449 # Arguments:
1451 1450 # $1 - Optional prefix for each variable defined.
1452 1451 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
1453 1452 [
1454 1453 # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
1455 1454 # runs afoul of the more aggressive versions of these optimisations.
1456 1455 # Notably, value range propagation now assumes that the this pointer of C++
1457 1456 # member functions is non-null.
1458 1457 NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
1459 1458 dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
1460 1459 dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
1461 1460 dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
1462 1461 NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
1463 1462 dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
1464 1463 dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
1465 1464 dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
1466 1465 AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
1467 1466 $1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
1468 1467 $1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
1469 1468 ])
↓ open down ↓ |
1367 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX