Tue, 24 Jul 2018 14:58:25 +0800
#7168 changed OPENJDK_TARGET_CPU_LEGACY_LIB from mips64 to mips64el
Reviewed-by: zhaixiang, fujie
1 #
2 # Copyright (c) 2011, 2015, 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 #
26 #
27 # This file has been modified by Loongson Technology in 2018. These
28 # modifications are Copyright (c) 2018 Loongson Technology, and are made
29 # available on the same license terms set forth above.
30 #
32 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
33 # Converts autoconf style CPU name to OpenJDK style, into
34 # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
35 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
36 [
37 # First argument is the cpu name from the trip/quad
38 case "$1" in
39 x86_64)
40 VAR_CPU=x86_64
41 VAR_CPU_ARCH=x86
42 VAR_CPU_BITS=64
43 VAR_CPU_ENDIAN=little
44 ;;
45 i?86)
46 VAR_CPU=x86
47 VAR_CPU_ARCH=x86
48 VAR_CPU_BITS=32
49 VAR_CPU_ENDIAN=little
50 ;;
51 arm*)
52 VAR_CPU=arm
53 VAR_CPU_ARCH=arm
54 VAR_CPU_BITS=32
55 VAR_CPU_ENDIAN=little
56 ;;
57 aarch64)
58 VAR_CPU=aarch64
59 VAR_CPU_ARCH=aarch64
60 VAR_CPU_BITS=64
61 VAR_CPU_ENDIAN=little
62 ;;
63 powerpc)
64 VAR_CPU=ppc
65 VAR_CPU_ARCH=ppc
66 VAR_CPU_BITS=32
67 VAR_CPU_ENDIAN=big
68 ;;
69 powerpc64)
70 VAR_CPU=ppc64
71 VAR_CPU_ARCH=ppc
72 VAR_CPU_BITS=64
73 VAR_CPU_ENDIAN=big
74 ;;
75 powerpc64le)
76 VAR_CPU=ppc64
77 VAR_CPU_ARCH=ppc
78 VAR_CPU_BITS=64
79 VAR_CPU_ENDIAN=little
80 ;;
81 s390)
82 VAR_CPU=s390
83 VAR_CPU_ARCH=s390
84 VAR_CPU_BITS=32
85 VAR_CPU_ENDIAN=big
86 ;;
87 s390x)
88 VAR_CPU=s390x
89 VAR_CPU_ARCH=s390
90 VAR_CPU_BITS=64
91 VAR_CPU_ENDIAN=big
92 ;;
93 sparc)
94 VAR_CPU=sparc
95 VAR_CPU_ARCH=sparc
96 VAR_CPU_BITS=32
97 VAR_CPU_ENDIAN=big
98 ;;
99 sparcv9|sparc64)
100 VAR_CPU=sparcv9
101 VAR_CPU_ARCH=sparc
102 VAR_CPU_BITS=64
103 VAR_CPU_ENDIAN=big
104 ;;
105 mips64el)
106 VAR_CPU=mips64
107 VAR_CPU_ARCH=mips
108 VAR_CPU_BITS=64
109 VAR_CPU_ENDIAN=little
110 ;;
111 *)
112 AC_MSG_ERROR([unsupported cpu $1])
113 ;;
114 esac
115 ])
117 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
118 # Converts autoconf style OS name to OpenJDK style, into
119 # VAR_OS and VAR_OS_API.
120 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
121 [
122 case "$1" in
123 *linux*)
124 VAR_OS=linux
125 VAR_OS_API=posix
126 VAR_OS_ENV=linux
127 ;;
128 *solaris*)
129 VAR_OS=solaris
130 VAR_OS_API=posix
131 VAR_OS_ENV=solaris
132 ;;
133 *darwin*)
134 VAR_OS=macosx
135 VAR_OS_API=posix
136 VAR_OS_ENV=macosx
137 ;;
138 *bsd*)
139 VAR_OS=bsd
140 VAR_OS_API=posix
141 VAR_OS_ENV=bsd
142 ;;
143 *cygwin*)
144 VAR_OS=windows
145 VAR_OS_API=winapi
146 VAR_OS_ENV=windows.cygwin
147 ;;
148 *mingw*)
149 VAR_OS=windows
150 VAR_OS_API=winapi
151 VAR_OS_ENV=windows.msys
152 ;;
153 *aix*)
154 VAR_OS=aix
155 VAR_OS_API=posix
156 VAR_OS_ENV=aix
157 ;;
158 *)
159 AC_MSG_ERROR([unsupported operating system $1])
160 ;;
161 esac
162 ])
164 # Expects $host_os $host_cpu $build_os and $build_cpu
165 # and $with_target_bits to have been setup!
166 #
167 # Translate the standard triplet(quadruplet) definition
168 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
169 # OPENJDK_BUILD_OS, etc.
170 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
171 [
172 # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
173 # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
174 # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
175 # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
176 OPENJDK_TARGET_AUTOCONF_NAME="$host"
177 OPENJDK_BUILD_AUTOCONF_NAME="$build"
178 AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
179 AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
181 # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
182 PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
183 PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
184 # ..and setup our own variables. (Do this explicitely to facilitate searching)
185 OPENJDK_BUILD_OS="$VAR_OS"
186 OPENJDK_BUILD_OS_API="$VAR_OS_API"
187 OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
188 OPENJDK_BUILD_CPU="$VAR_CPU"
189 OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
190 OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
191 OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
192 AC_SUBST(OPENJDK_BUILD_OS)
193 AC_SUBST(OPENJDK_BUILD_OS_API)
194 AC_SUBST(OPENJDK_BUILD_CPU)
195 AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
196 AC_SUBST(OPENJDK_BUILD_CPU_BITS)
197 AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
199 AC_MSG_CHECKING([openjdk-build os-cpu])
200 AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
202 # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
203 PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
204 PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
205 # ... and setup our own variables. (Do this explicitely to facilitate searching)
206 OPENJDK_TARGET_OS="$VAR_OS"
207 OPENJDK_TARGET_OS_API="$VAR_OS_API"
208 OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
209 OPENJDK_TARGET_CPU="$VAR_CPU"
210 OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
211 OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
212 OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
213 AC_SUBST(OPENJDK_TARGET_OS)
214 AC_SUBST(OPENJDK_TARGET_OS_API)
215 AC_SUBST(OPENJDK_TARGET_CPU)
216 AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
217 AC_SUBST(OPENJDK_TARGET_CPU_BITS)
218 AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
220 AC_MSG_CHECKING([openjdk-target os-cpu])
221 AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
222 ])
224 # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
225 # accordingly. Must be done after setting up build and target system, but before
226 # doing anything else with these values.
227 AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
228 [
229 AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
230 [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
232 # We have three types of compiles:
233 # native == normal compilation, target system == build system
234 # cross == traditional cross compilation, target system != build system; special toolchain needed
235 # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
236 #
237 if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
238 # We're doing a proper cross-compilation
239 COMPILE_TYPE="cross"
240 else
241 COMPILE_TYPE="native"
242 fi
244 if test "x$with_target_bits" != x; then
245 if test "x$COMPILE_TYPE" = "xcross"; then
246 AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
247 fi
249 if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
250 # A reduced build is requested
251 COMPILE_TYPE="reduced"
252 OPENJDK_TARGET_CPU_BITS=32
253 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
254 OPENJDK_TARGET_CPU=x86
255 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
256 OPENJDK_TARGET_CPU=sparc
257 else
258 AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
259 fi
260 elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
261 AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
262 elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
263 AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
264 else
265 AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
266 fi
267 fi
268 AC_SUBST(COMPILE_TYPE)
270 AC_MSG_CHECKING([compilation type])
271 AC_MSG_RESULT([$COMPILE_TYPE])
272 ])
274 # Setup the legacy variables, for controlling the old makefiles.
275 #
276 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
277 [
278 # Also store the legacy naming of the cpu.
279 # Ie i586 and amd64 instead of x86 and x86_64
280 OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU"
281 if test "x$OPENJDK_TARGET_CPU" = xx86; then
282 OPENJDK_TARGET_CPU_LEGACY="i586"
283 elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
284 # On all platforms except MacOSX replace x86_64 with amd64.
285 OPENJDK_TARGET_CPU_LEGACY="amd64"
286 fi
287 AC_SUBST(OPENJDK_TARGET_CPU_LEGACY)
289 # And the second legacy naming of the cpu.
290 # Ie i386 and amd64 instead of x86 and x86_64.
291 OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU"
292 if test "x$OPENJDK_TARGET_CPU" = xx86; then
293 OPENJDK_TARGET_CPU_LEGACY_LIB="i386"
294 elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
295 OPENJDK_TARGET_CPU_LEGACY_LIB="amd64"
296 elif test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
297 OPENJDK_TARGET_CPU_LEGACY_LIB="mips64el"
298 fi
299 AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB)
301 # This is the name of the cpu (but using i386 and amd64 instead of
302 # x86 and x86_64, respectively), preceeded by a /, to be used when
303 # locating libraries. On macosx, it's empty, though.
304 OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB"
305 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
306 OPENJDK_TARGET_CPU_LIBDIR=""
307 fi
308 AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR)
310 # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
311 # /amd64 or /sparcv9. This string is appended to some library paths, like this:
312 # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
313 OPENJDK_TARGET_CPU_ISADIR=""
314 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
315 if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
316 OPENJDK_TARGET_CPU_ISADIR="/amd64"
317 elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
318 OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
319 fi
320 fi
321 AC_SUBST(OPENJDK_TARGET_CPU_ISADIR)
323 # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
324 OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU"
325 if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then
326 # On linux only, we replace x86 with i386.
327 OPENJDK_TARGET_CPU_OSARCH="i386"
328 elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
329 # On all platforms except macosx, we replace x86_64 with amd64.
330 OPENJDK_TARGET_CPU_OSARCH="amd64"
331 elif test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xmips64; then
332 # Jin: to be exactly same with OpenJDK 6(mips64)
333 # System.getProperty("os.arch"): mips64 -> mips64el
334 OPENJDK_TARGET_CPU_OSARCH="mips64el"
335 fi
336 AC_SUBST(OPENJDK_TARGET_CPU_OSARCH)
338 OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU"
339 if test "x$OPENJDK_TARGET_CPU" = xx86; then
340 OPENJDK_TARGET_CPU_JLI="i386"
341 elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
342 # On all platforms except macosx, we replace x86_64 with amd64.
343 OPENJDK_TARGET_CPU_JLI="amd64"
344 elif test "x$OPENJDK_TARGET_CPU" = xmips64 && test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
345 OPENJDK_TARGET_CPU_JLI="mips64el"
346 fi
347 # Now setup the -D flags for building libjli.
348 OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'"
349 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
350 if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then
351 OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
352 elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
353 OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
354 fi
355 fi
356 AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
358 # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
359 if test "x$OPENJDK_TARGET_OS_API" = xposix; then
360 OPENJDK_TARGET_OS_API_DIR="solaris"
361 fi
362 if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
363 OPENJDK_TARGET_OS_API_DIR="windows"
364 fi
365 AC_SUBST(OPENJDK_TARGET_OS_API_DIR)
367 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
368 OPENJDK_TARGET_OS_EXPORT_DIR=macosx
369 else
370 OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR}
371 fi
372 AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR)
374 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
375 A_LP64="LP64:="
376 # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
377 # unpack200.exe
378 if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then
379 ADD_LP64="-D_LP64=1"
380 fi
381 fi
382 AC_SUBST(LP64,$A_LP64)
384 if test "x$COMPILE_TYPE" = "xcross"; then
385 # FIXME: ... or should this include reduced builds..?
386 DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY"
387 else
388 DEFINE_CROSS_COMPILE_ARCH=""
389 fi
390 AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
392 # ZERO_ARCHDEF is used to enable architecture-specific code
393 case "${OPENJDK_TARGET_CPU}" in
394 ppc) ZERO_ARCHDEF=PPC32 ;;
395 ppc64) ZERO_ARCHDEF=PPC64 ;;
396 s390*) ZERO_ARCHDEF=S390 ;;
397 sparc*) ZERO_ARCHDEF=SPARC ;;
398 x86_64*) ZERO_ARCHDEF=AMD64 ;;
399 x86) ZERO_ARCHDEF=IA32 ;;
400 *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z)
401 esac
402 AC_SUBST(ZERO_ARCHDEF)
403 ])
405 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
406 [
407 if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
408 REQUIRED_OS_NAME=SunOS
409 REQUIRED_OS_VERSION=5.10
410 fi
411 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
412 REQUIRED_OS_NAME=Linux
413 REQUIRED_OS_VERSION=2.6
414 fi
415 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
416 REQUIRED_OS_NAME=Windows
417 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
418 REQUIRED_OS_VERSION=5.2
419 else
420 REQUIRED_OS_VERSION=5.1
421 fi
422 fi
423 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
424 REQUIRED_OS_NAME=Darwin
425 REQUIRED_OS_VERSION=11.2
426 fi
428 AC_SUBST(REQUIRED_OS_NAME)
429 AC_SUBST(REQUIRED_OS_VERSION)
430 ])
432 #%%% Build and target systems %%%
433 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
434 [
435 # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
436 # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the
437 # product you're building. The target of this build is called "host". Since this is confusing to most people, we
438 # have not adopted that system, but use "target" as the platform we are building for. In some places though we need
439 # to use the configure naming style.
440 AC_CANONICAL_BUILD
441 AC_CANONICAL_HOST
442 AC_CANONICAL_TARGET
444 PLATFORM_EXTRACT_TARGET_AND_BUILD
445 PLATFORM_SETUP_TARGET_CPU_BITS
446 PLATFORM_SET_RELEASE_FILE_OS_VALUES
447 PLATFORM_SETUP_LEGACY_VARS
448 ])
450 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
451 [
452 ###############################################################################
454 # Note that this is the build platform OS version!
456 OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
457 OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
458 OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
459 OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
460 AC_SUBST(OS_VERSION_MAJOR)
461 AC_SUBST(OS_VERSION_MINOR)
462 AC_SUBST(OS_VERSION_MICRO)
463 ])
465 # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
466 # Add -mX to various FLAGS variables.
467 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
468 [
469 # When we add flags to the "official" CFLAGS etc, we need to
470 # keep track of these additions in ADDED_CFLAGS etc. These
471 # will later be checked to make sure only controlled additions
472 # have been made to CFLAGS etc.
473 ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
474 ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
475 ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
477 CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
478 CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
479 LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
481 CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
482 CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
483 LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
484 ])
486 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
487 [
488 ###############################################################################
489 #
490 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
491 # (The JVM can use 32 or 64 bit Java pointers but that decision
492 # is made at runtime.)
493 #
495 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
496 # Always specify -m flag on Solaris
497 # And -q on AIX because otherwise the compiler produces 32-bit objects by default
498 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
499 elif test "x$COMPILE_TYPE" = xreduced; then
500 if test "x$OPENJDK_TARGET_OS" != xwindows; then
501 # Specify -m if running reduced on other Posix platforms
502 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
503 fi
504 fi
506 # Make compilation sanity check
507 AC_CHECK_HEADERS([stdio.h], , [
508 AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
509 if test "x$COMPILE_TYPE" = xreduced; then
510 AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.])
511 elif test "x$COMPILE_TYPE" = xcross; then
512 AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
513 fi
514 AC_MSG_ERROR([Cannot continue.])
515 ])
517 AC_CHECK_SIZEOF([int *], [1111])
519 # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
520 if test "x$ac_cv_sizeof_int_p" = x; then
521 # The test failed, lets stick to the assumed value.
522 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
523 else
524 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
526 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
527 # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
528 # Let's try to implicitely set the compilers target architecture and retry the test
529 AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS).])
530 AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
531 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
533 # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
534 unset ac_cv_sizeof_int_p
535 # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
536 cat >>confdefs.h <<_ACEOF
537 #undef SIZEOF_INT_P
538 _ACEOF
540 AC_CHECK_SIZEOF([int *], [1111])
542 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
544 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
545 AC_MSG_ERROR([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
546 fi
547 fi
548 fi
550 AC_MSG_CHECKING([for target address size])
551 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
552 ])
554 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
555 [
556 ###############################################################################
557 #
558 # Is the target little of big endian?
559 #
560 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
562 if test "x$ENDIAN" = xuniversal_endianness; then
563 AC_MSG_ERROR([Building with both big and little endianness is not supported])
564 fi
565 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
566 AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
567 fi
568 ])
570 AC_DEFUN([GET_BUILDER_AND_HOST_DATA],
571 [
572 BUILDER_NAME="$build_os"
573 BUILDER_ID="Custom build ($(date))"
574 if test -f /etc/issue; then
575 etc_issue_info=`cat /etc/issue`
576 if test -n "$etc_issue_info"; then
577 BUILDER_NAME=`cat /etc/issue | head -n 1 | cut -d " " -f 1`
578 fi
579 fi
580 if test -f /etc/neokylin-release; then
581 etc_issue_info=`cat /etc/neokylin-release`
582 if test -n "$etc_issue_info"; then
583 BUILDER_NAME=`cat /etc/neokylin-release | head -n 1 | cut -d " " -f 1`
584 fi
585 fi
586 if test -z "$BUILDER_NAME"; then
587 BUILDER_NAME="unknown"
588 fi
589 if test -n "$OPENJDK_TARGET_CPU_OSARCH"; then
590 HOST_NAME="$OPENJDK_TARGET_CPU_OSARCH"
591 else
592 HOST_NAME="unknown"
593 fi
594 if test -f "/usr/bin/cpp"; then
595 # gcc_with_arch_info=`gcc -v 2>&1 | grep '\-\-with-arch=' | sed 's/.*--with-arch=//;s/ .*$//'`
596 gcc_with_arch_info=`cpp -dM /dev/null | grep '\<_MIPS_ARCH\>' | sed 's/^#define _MIPS_ARCH "//;s/"$//'`
597 if test -n "$gcc_with_arch_info"; then
598 HOST_NAME="$gcc_with_arch_info"
599 fi
600 fi
601 AC_SUBST(BUILDER_ID)
602 AC_SUBST(BUILDER_NAME)
603 AC_SUBST(HOST_NAME)
604 ])