common/autoconf/platform.m4

changeset 458
c8d320b48626
parent 445
efd26e051e50
child 478
2ba6f4da4bf3
equal deleted inserted replaced
455:633f2378c904 458:c8d320b48626
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 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 22 # or visit www.oracle.com if you need additional information or have any
23 # questions. 23 # questions.
24 # 24 #
25 25
26 AC_DEFUN([CHECK_FIND_DELETE], 26 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS],
27 [
28 # Test if find supports -delete
29 AC_MSG_CHECKING([if find supports -delete])
30 FIND_DELETE="-delete"
31
32 DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
33
34 echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
35
36 TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
37 if test -f $DELETEDIR/TestIfFindSupportsDelete; then
38 # No, it does not.
39 rm $DELETEDIR/TestIfFindSupportsDelete
40 FIND_DELETE="-exec rm \{\} \+"
41 AC_MSG_RESULT([no])
42 else
43 AC_MSG_RESULT([yes])
44 fi
45 rmdir $DELETEDIR
46 ])
47
48 AC_DEFUN([CHECK_NONEMPTY],
49 [
50 # Test that variable $1 is not empty.
51 if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
52 ])
53
54 AC_DEFUN([ADD_JVM_ARG_IF_OK],
55 [
56 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
57 # If so, then append $1 to $2
58 FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
59 FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
60 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
61 $2="[$]$2 $1"
62 fi
63 ])
64
65 AC_DEFUN([WHICHCMD],
66 [
67 # Translate "gcc -E" into "`which gcc` -E" ie
68 # extract the full path to the binary and at the
69 # same time maintain any arguments passed to it.
70 # The command MUST exist in the path, or else!
71 tmp="[$]$1"
72 car="${tmp%% *}"
73 tmp="[$]$1 EOL"
74 cdr="${tmp#* }"
75 # On windows we want paths without spaces.
76 if test "x$BUILD_OS" = "xwindows"; then
77 WHICHCMD_SPACESAFE(car)
78 else
79 # "which" is not portable, but is used here
80 # because we know that the command exists!
81 car=`which $car`
82 fi
83 if test "x$cdr" != xEOL; then
84 $1="$car ${cdr% *}"
85 else
86 $1="$car"
87 fi
88 ])
89
90 AC_DEFUN([SPACESAFE],
91 [
92 # Fail with message $2 if var $1 contains a path with no spaces in it.
93 # Unless on Windows, where we can rewrite the path.
94 HAS_SPACE=`echo "[$]$1" | grep " "`
95 if test "x$HAS_SPACE" != x; then
96 if test "x$BUILD_OS" = "xwindows"; then
97 $1=`$CYGPATH -s -m -a "[$]$1"`
98 $1=`$CYGPATH -u "[$]$1"`
99 else
100 AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
101 fi
102 fi
103 ])
104
105 AC_DEFUN([WHICHCMD_SPACESAFE],
106 [
107 # Translate long cygdrive or C:\sdfsf path
108 # into a short mixed mode path that has no
109 # spaces in it.
110 tmp="[$]$1"
111 if test "x$BUILD_OS" = "xwindows"; then
112 tmp=`$CYGPATH -u "[$]$1"`
113 tmp=`which "$tmp"`
114 # If file exists with .exe appended, that's the real filename
115 # and cygpath needs that to convert to short style path.
116 if test -f "${tmp}.exe"; then
117 tmp="${tmp}.exe"
118 elif test -f "${tmp}.cmd"; then
119 tmp="${tmp}.cmd"
120 fi
121 # Convert to C:/ mixed style path without spaces.
122 tmp=`$CYGPATH -s -m "$tmp"`
123 fi
124 $1="$tmp"
125 ])
126
127 AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
128 [
129 if test "x$BUILD_OS" != xwindows; then
130 # Follow a chain of symbolic links. Use readlink
131 # where it exists, else fall back to horribly
132 # complicated shell code.
133 AC_PATH_PROG(READLINK, readlink)
134 if test "x$READLINK_TESTED" != yes; then
135 # On MacOSX there is a readlink tool with a different
136 # purpose than the GNU readlink tool. Check the found readlink.
137 ISGNU=`$READLINK --help 2>&1 | grep GNU`
138 if test "x$ISGNU" = x; then
139 # A readlink that we do not know how to use.
140 # Are there other non-GNU readlinks out there?
141 READLINK_TESTED=yes
142 READLINK=
143 fi
144 fi
145
146 if test "x$READLINK" != x; then
147 $1=`$READLINK -f [$]$1`
148 else
149 STARTDIR=$PWD
150 COUNTER=0
151 DIR=`dirname [$]$1`
152 FIL=`basename [$]$1`
153 while test $COUNTER -lt 20; do
154 ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
155 if test "x$ISLINK" == x; then
156 # This is not a symbolic link! We are done!
157 break
158 fi
159 # The link might be relative! We have to use cd to travel safely.
160 cd $DIR
161 cd `dirname $ISLINK`
162 DIR=`pwd`
163 FIL=`basename $ISLINK`
164 let COUNTER=COUNTER+1
165 done
166 cd $STARTDIR
167 $1=$DIR/$FIL
168 fi
169 fi
170 ])
171
172 AC_DEFUN([TESTFOR_PROG_CCACHE],
173 [
174 AC_ARG_ENABLE([ccache],
175 [AS_HELP_STRING([--disable-ccache],
176 [use ccache to speed up recompilations @<:@enabled@:>@])],
177 [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
178 if test "x$ENABLE_CCACHE" = xyes; then
179 AC_PATH_PROG(CCACHE, ccache)
180 else
181 AC_MSG_CHECKING([for ccache])
182 AC_MSG_RESULT([explicitly disabled])
183 CCACHE=
184 fi
185 AC_SUBST(CCACHE)
186
187 AC_ARG_WITH([ccache-dir],
188 [AS_HELP_STRING([--with-ccache-dir],
189 [where to store ccache files @<:@~/.ccache@:>@])])
190
191 if test "x$with_ccache_dir" != x; then
192 # When using a non home ccache directory, assume the use is to share ccache files
193 # with other users. Thus change the umask.
194 SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
195 fi
196 CCACHE_FOUND=""
197 if test "x$CCACHE" != x; then
198 SETUP_CCACHE_USAGE
199 fi
200 ])
201
202 AC_DEFUN([SETUP_CCACHE_USAGE],
203 [
204 if test "x$CCACHE" != x; then
205 CCACHE_FOUND="true"
206 # Only use ccache if it is 3.1.4 or later, which supports
207 # precompiled headers.
208 AC_MSG_CHECKING([if ccache supports precompiled headers])
209 HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
210 if test "x$HAS_GOOD_CCACHE" = x; then
211 AC_MSG_RESULT([no, disabling ccache])
212 CCACHE=
213 else
214 AC_MSG_RESULT([yes])
215 AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
216 PUSHED_FLAGS="$CXXFLAGS"
217 CXXFLAGS="-fpch-preprocess $CXXFLAGS"
218 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
219 CXXFLAGS="$PUSHED_FLAGS"
220 if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
221 AC_MSG_RESULT([yes])
222 else
223 AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
224 CCACHE=
225 fi
226 fi
227 fi
228
229 if test "x$CCACHE" != x; then
230 CCACHE_SLOPPINESS=time_macros
231 CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
232 CCACHE_FLAGS=-fpch-preprocess
233
234 if test "x$SET_CCACHE_DIR" != x; then
235 mkdir -p $CCACHE_DIR > /dev/null 2>&1
236 chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
237 fi
238 fi
239 ])
240
241 AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
242 [ 27 [
243 # Expects $host_os $host_cpu $build_os and $build_cpu 28 # Expects $host_os $host_cpu $build_os and $build_cpu
244 # and $with_data_model to have been setup! 29 # and $with_target_bits to have been setup!
245 # 30 #
246 # Translate the standard triplet(quadruplet) definition 31 # Translate the standard triplet(quadruplet) definition
247 # of the host/build system into 32 # of the target/build system into
248 # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows 33 # OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
249 # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince 34 # OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
250 # HOST_OS_API=posix,winapi 35 # OPENJDK_TARGET_OS_API=posix,winapi
251 # 36 #
252 # HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64 37 # OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
253 # HOST_CPU_ARCH=x86,sparc,pcc,arm 38 # OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
254 # HOST_CPU_BITS=32,64 39 # OPENJDK_TARGET_CPU_BITS=32,64
255 # HOST_CPU_ENDIAN=big,little 40 # OPENJDK_TARGET_CPU_ENDIAN=big,little
256 # 41 #
257 # The same values are setup for BUILD_... 42 # The same values are setup for BUILD_...
258 # 43 #
259 # And the legacy variables, for controlling the old makefiles. 44 # And the legacy variables, for controlling the old makefiles.
260 # LEGACY_HOST_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64... 45 # LEGACY_OPENJDK_TARGET_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
261 # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64... 46 # LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
262 # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris) 47 # LEGACY_OPENJDK_TARGET_CPU3=sparcv9,amd64 (but only on solaris)
263 # LEGACY_HOST_OS_API=solaris,windows 48 # LEGACY_OPENJDK_TARGET_OS_API=solaris,windows
264 # 49 #
265 # We also copy the autoconf trip/quadruplet 50 # We also copy the autoconf trip/quadruplet
266 # verbatim to HOST and BUILD 51 # verbatim to OPENJDK_TARGET_SYSTEM (from the autoconf "host") and OPENJDK_BUILD_SYSTEM
267 AC_SUBST(HOST, ${host}) 52 OPENJDK_TARGET_SYSTEM="$host"
268 AC_SUBST(BUILD, ${build}) 53 OPENJDK_BUILD_SYSTEM="$build"
54 AC_SUBST(OPENJDK_TARGET_SYSTEM)
55 AC_SUBST(OPENJDK_BUILD_SYSTEM)
269 56
270 EXTRACT_VARS_FROM_OS_TO(HOST,$host_os) 57 PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_TARGET,$host_os)
271 EXTRACT_VARS_FROM_CPU_TO(HOST,$host_cpu) 58 PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_TARGET,$host_cpu)
272 59
273 EXTRACT_VARS_FROM_OS_TO(BUILD,$build_os) 60 PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_BUILD,$build_os)
274 EXTRACT_VARS_FROM_CPU_TO(BUILD,$build_cpu) 61 PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_BUILD,$build_cpu)
275 62
276 if test "x$HOST_OS" != xsolaris; then 63 if test "x$OPENJDK_TARGET_OS" != xsolaris; then
277 LEGACY_HOST_CPU3="" 64 LEGACY_OPENJDK_TARGET_CPU3=""
278 LEGACY_BUILD_CPU3="" 65 LEGACY_OPENJDK_BUILD_CPU3=""
279 fi 66 fi
280 67
281 # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_HOST_CPU1) ... 68 # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_OPENJDK_TARGET_CPU1) ...
282 if test "x$HOST_OS" = xmacosx && test "x$HOST_CPU" = xx64; then 69 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$OPENJDK_TARGET_CPU" = xx64; then
283 LEGACY_HOST_CPU1="x86_64" 70 LEGACY_OPENJDK_TARGET_CPU1="x86_64"
284 fi 71 fi
285 72
286 SET_RELEASE_FILE_OS_VALUES() 73 PLATFORM_SET_RELEASE_FILE_OS_VALUES
287 ]) 74 ])
288 75
289 AC_DEFUN([EXTRACT_VARS_FROM_OS_TO], 76 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS_TO],
290 [ 77 [
291 EXTRACT_VARS_FROM_OS($2) 78 PLATFORM_EXTRACT_VARS_FROM_OS($2)
292 $1_OS="$VAR_OS" 79 $1_OS="$VAR_OS"
293 $1_OS_FAMILY="$VAR_OS_FAMILY" 80 $1_OS_FAMILY="$VAR_OS_FAMILY"
294 $1_OS_API="$VAR_OS_API" 81 $1_OS_API="$VAR_OS_API"
295 82
296 AC_SUBST($1_OS) 83 AC_SUBST($1_OS)
304 LEGACY_$1_OS_API="windows" 91 LEGACY_$1_OS_API="windows"
305 fi 92 fi
306 AC_SUBST(LEGACY_$1_OS_API) 93 AC_SUBST(LEGACY_$1_OS_API)
307 ]) 94 ])
308 95
309 AC_DEFUN([EXTRACT_VARS_FROM_CPU_TO], 96 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU_TO],
310 [ 97 [
311 EXTRACT_VARS_FROM_CPU($2) 98 PLATFORM_EXTRACT_VARS_FROM_CPU($2)
312 $1_CPU="$VAR_CPU" 99 $1_CPU="$VAR_CPU"
313 $1_CPU_ARCH="$VAR_CPU_ARCH" 100 $1_CPU_ARCH="$VAR_CPU_ARCH"
314 $1_CPU_BITS="$VAR_CPU_BITS" 101 $1_CPU_BITS="$VAR_CPU_BITS"
315 $1_CPU_ENDIAN="$VAR_CPU_ENDIAN" 102 $1_CPU_ENDIAN="$VAR_CPU_ENDIAN"
316 103
337 LEGACY_$1_CPU3="" 124 LEGACY_$1_CPU3=""
338 if test "x$$1_CPU" = xx64; then 125 if test "x$$1_CPU" = xx64; then
339 LEGACY_$1_CPU3=amd64 126 LEGACY_$1_CPU3=amd64
340 fi 127 fi
341 if test "x$$1_CPU" = xsparcv9; then 128 if test "x$$1_CPU" = xsparcv9; then
342 LEGACY_$1_CPU3=sparvc9 129 LEGACY_$1_CPU3=sparcv9
343 fi 130 fi
344 AC_SUBST(LEGACY_$1_CPU3) 131 AC_SUBST(LEGACY_$1_CPU3)
345 ]) 132 ])
346 133
347 AC_DEFUN([EXTRACT_VARS_FROM_CPU], 134 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
348 [ 135 [
349 # First argument is the cpu name from the trip/quad 136 # First argument is the cpu name from the trip/quad
350 case "$1" in 137 case "$1" in
351 x86_64) 138 x86_64)
352 VAR_CPU=x64 139 VAR_CPU=x64
370 VAR_LEGACY_CPU=alpha 157 VAR_LEGACY_CPU=alpha
371 ;; 158 ;;
372 arm*) 159 arm*)
373 VAR_CPU=arm 160 VAR_CPU=arm
374 VAR_CPU_ARCH=arm 161 VAR_CPU_ARCH=arm
375 VAR_CPU_BITS=3264 162 VAR_CPU_BITS=32
376 VAR_CPU_ENDIAN=big 163 VAR_CPU_ENDIAN=little
377 VAR_LEGACY_CPU=arm 164 VAR_LEGACY_CPU=arm
378 ;; 165 ;;
379 mips) 166 mips)
380 VAR_CPU=mips 167 VAR_CPU=mips
381 VAR_CPU_ARCH=mips 168 VAR_CPU_ARCH=mips
399 ;; 186 ;;
400 powerpc64) 187 powerpc64)
401 VAR_CPU=ppc64 188 VAR_CPU=ppc64
402 VAR_CPU_ARCH=ppc 189 VAR_CPU_ARCH=ppc
403 VAR_CPU_BITS=64 190 VAR_CPU_BITS=64
404 VAR_CPU_ENDIAN=32 191 VAR_CPU_ENDIAN=big
405 VAR_LEGACY_CPU=ppc64 192 VAR_LEGACY_CPU=ppc64
406 ;; 193 ;;
407 sparc) 194 sparc)
408 VAR_CPU=sparc 195 VAR_CPU=sparc
409 VAR_CPU_ARCH=sparc 196 VAR_CPU_ARCH=sparc
414 sparc64) 201 sparc64)
415 VAR_CPU=sparcv9 202 VAR_CPU=sparcv9
416 VAR_CPU_ARCH=sparc 203 VAR_CPU_ARCH=sparc
417 VAR_CPU_BITS=64 204 VAR_CPU_BITS=64
418 VAR_CPU_ENDIAN=big 205 VAR_CPU_ENDIAN=big
419 VAR_LEGACY_CPU=sparc_sparcv9 206 VAR_LEGACY_CPU=sparcv9
420 ;; 207 ;;
421 s390) 208 s390)
422 VAR_CPU=s390 209 VAR_CPU=s390
423 VAR_CPU_ARCH=s390 210 VAR_CPU_ARCH=s390
424 VAR_CPU_BITS=32 211 VAR_CPU_BITS=32
450 ;; 237 ;;
451 esac 238 esac
452 fi 239 fi
453 fi 240 fi
454 241
242 # on solaris x86...default seems to be 32-bit
243 if test "x$VAR_OS" = "xsolaris" && \
244 test "x$with_target_bits" = "x" && \
245 test "x$VAR_CPU_ARCH" = "xx86"
246 then
247 with_target_bits=32
248 fi
249
455 if test "x$VAR_CPU_ARCH" = "xx86"; then 250 if test "x$VAR_CPU_ARCH" = "xx86"; then
456 if test "x$with_data_model" = "x64"; then 251 if test "x$with_target_bits" = "x64"; then
457 VAR_CPU=x64 252 VAR_CPU=x64
458 VAR_CPU_BITS=64 253 VAR_CPU_BITS=64
459 VAR_LEGACY_CPU=amd64 254 VAR_LEGACY_CPU=amd64
460 fi 255 fi
461 if test "x$with_data_model" = "x32"; then 256 if test "x$with_target_bits" = "x32"; then
462 VAR_CPU=ia32 257 VAR_CPU=ia32
463 VAR_CPU_BITS=32 258 VAR_CPU_BITS=32
464 VAR_LEGACY_CPU=i586 259 VAR_LEGACY_CPU=i586
465 fi 260 fi
466 fi 261 fi
467 ]) 262
468 263 if test "x$VAR_CPU_ARCH" = "xsparc"; then
469 AC_DEFUN([EXTRACT_VARS_FROM_OS], 264 if test "x$with_target_bits" = "x64"; then
265 VAR_CPU=sparcv9
266 VAR_CPU_BITS=64
267 VAR_LEGACY_CPU=sparcv9
268 fi
269 fi
270 ])
271
272 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
470 [ 273 [
471 case "$1" in 274 case "$1" in
472 *linux*) 275 *linux*)
473 VAR_OS=linux 276 VAR_OS=linux
474 VAR_OS_API=posix 277 VAR_OS_API=posix
493 VAR_OS=windows 296 VAR_OS=windows
494 VAR_OS_API=winapi 297 VAR_OS_API=winapi
495 VAR_OS_FAMILY=windows 298 VAR_OS_FAMILY=windows
496 ;; 299 ;;
497 *) 300 *)
498 AC_MSG_ERROR([unsupported host operating system $1]) 301 AC_MSG_ERROR([unsupported operating system $1])
499 ;; 302 ;;
500 esac 303 esac
501 ]) 304 ])
502 305
503 AC_DEFUN([CHECK_COMPILER_VERSION], 306 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
504 [ 307 [
505 # Test the compilers that their versions are new enough. 308 if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
506 # AC_MSG_CHECKING([version of GCC])
507 gcc_ver=`${CC} -dumpversion`
508 gcc_major_ver=`echo ${gcc_ver}|cut -d'.' -f1`
509 gcc_minor_ver=`echo ${gcc_ver}|cut -d'.' -f2`
510 # AM_CONDITIONAL(GCC_OLD, test ! ${gcc_major_ver} -ge 4 -a ${gcc_minor_ver} -ge 3)
511 # AC_MSG_RESULT([${gcc_ver} (major version ${gcc_major_ver}, minor version ${gcc_minor_ver})])
512 ])
513
514 # Fixes paths on windows hosts to be mixed mode short.
515 AC_DEFUN([WIN_FIX_PATH],
516 [
517 if test "x$BUILD_OS" = "xwindows"; then
518 AC_PATH_PROG(CYGPATH, cygpath)
519 tmp="[$]$1"
520 # Convert to C:/ mixed style path without spaces.
521 tmp=`$CYGPATH -s -m "$tmp"`
522 $1="$tmp"
523 fi
524 ])
525
526 AC_DEFUN([SET_RELEASE_FILE_OS_VALUES],
527 [
528 if test "x$HOST_OS" = "xsolaris"; then
529 REQUIRED_OS_NAME=SunOS 309 REQUIRED_OS_NAME=SunOS
530 REQUIRED_OS_VERSION=5.10 310 REQUIRED_OS_VERSION=5.10
531 fi 311 fi
532 if test "x$HOST_OS" = "xlinux"; then 312 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
533 REQUIRED_OS_NAME=Linux 313 REQUIRED_OS_NAME=Linux
534 REQUIRED_OS_VERSION=2.6 314 REQUIRED_OS_VERSION=2.6
535 fi 315 fi
536 if test "x$HOST_OS" = "xwindows"; then 316 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
537 REQUIRED_OS_NAME=Windows 317 REQUIRED_OS_NAME=Windows
538 REQUIRED_OS_VERSION=5.1 318 REQUIRED_OS_VERSION=5.1
539 fi 319 fi
540 if test "x$HOST_OS" = "xmacosx"; then 320 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
541 REQUIRED_OS_NAME=Darwin 321 REQUIRED_OS_NAME=Darwin
542 REQUIRED_OS_VERSION=11.2 322 REQUIRED_OS_VERSION=11.2
543 fi 323 fi
544 324
545 AC_SUBST(REQUIRED_OS_NAME) 325 AC_SUBST(REQUIRED_OS_NAME)
546 AC_SUBST(REQUIRED_OS_VERSION) 326 AC_SUBST(REQUIRED_OS_VERSION)
547 ]) 327 ])
328
329 #%%% Build and target systems %%%
330 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
331 [
332 # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
333 # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the
334 # product you're building. The target of this build is called "host". Since this is confusing to most people, we
335 # have not adopted that system, but use "target" as the platform we are building for. In some places though we need
336 # to use the configure naming style.
337 AC_CANONICAL_BUILD
338 AC_CANONICAL_HOST
339 AC_CANONICAL_TARGET
340
341 AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
342 [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
343
344 if test "x$with_target_bits" != x && \
345 test "x$with_target_bits" != x32 && \
346 test "x$with_target_bits" != x64 ; then
347 AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
348 fi
349 # Translate the standard cpu-vendor-kernel-os quadruplets into
350 # the new TARGET_.... and BUILD_... and the legacy names used by
351 # the openjdk build.
352 # It uses $host_os $host_cpu $build_os $build_cpu and $with_target_bits
353 PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS
354
355 # The LEGACY_OPENJDK_TARGET_CPU3 is the setting for ISA_DIR.
356 if test "x$LEGACY_OPENJDK_TARGET_CPU3" != x; then
357 LEGACY_OPENJDK_TARGET_CPU3="/${LEGACY_OPENJDK_TARGET_CPU3}"
358 fi
359
360 # Now the following vars are defined.
361 # OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
362 # OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
363 # OPENJDK_TARGET_OS_API=posix,winapi
364 #
365 # OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
366 # OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
367 # OPENJDK_TARGET_CPU_BITS=32,64
368 # OPENJDK_TARGET_CPU_ENDIAN=big,little
369 #
370 # There is also a:
371 # LEGACY_OPENJDK_TARGET_CPU1=i586,amd64,.... # used to set the old var ARCH
372 # LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,.... # used to set the old var LIBARCH
373 # LEGACY_OPENJDK_TARGET_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris
374 # There was also a BUILDARCH that had i486,amd64,... but we do not use that
375 # in the new build.
376 # LEGACY_OPENJDK_TARGET_OS_API=solaris,windows # used to select source roots
377 ])
378
379 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
380 [
381 ###############################################################################
382
383 # Note that this is the build platform OS version!
384
385 OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
386 OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
387 OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
388 OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
389 AC_SUBST(OS_VERSION_MAJOR)
390 AC_SUBST(OS_VERSION_MINOR)
391 AC_SUBST(OS_VERSION_MICRO)
392 ])
393
394 AC_DEFUN_ONCE([PLATFORM_TEST_OPENJDK_TARGET_BITS],
395 [
396 ###############################################################################
397 #
398 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
399 # (The JVM can use 32 or 64 bit Java pointers but that decision
400 # is made at runtime.)
401 #
402 AC_LANG_PUSH(C++)
403 OLD_CXXFLAGS="$CXXFLAGS"
404 if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
405 CXXFLAGS="-m${with_target_bits} $CXXFLAGS"
406 fi
407 AC_CHECK_SIZEOF([int *], [1111])
408 CXXFLAGS="$OLD_CXXFLAGS"
409 AC_LANG_POP(C++)
410
411 # keep track of c/cxx flags that we added outselves...
412 # to prevent emitting warning...
413 ADDED_CFLAGS=
414 ADDED_CXXFLAGS=
415 ADDED_LDFLAGS=
416
417 if test "x$ac_cv_sizeof_int_p" = x0; then
418 # The test failed, lets pick the assumed value.
419 ARCH_DATA_MODEL=$OPENJDK_TARGET_CPU_BITS
420 else
421 ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p`
422
423 if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
424 ADDED_CFLAGS=" -m${with_target_bits}"
425 ADDED_CXXFLAGS=" -m${with_target_bits}"
426 ADDED_LDFLAGS=" -m${with_target_bits}"
427
428 CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
429 CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
430 LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
431
432 CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
433 CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
434 LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
435 fi
436 fi
437
438 if test "x$ARCH_DATA_MODEL" = x64; then
439 A_LP64="LP64:="
440 ADD_LP64="-D_LP64=1"
441 fi
442 AC_MSG_CHECKING([for target address size])
443 AC_MSG_RESULT([$ARCH_DATA_MODEL bits])
444 AC_SUBST(LP64,$A_LP64)
445 AC_SUBST(ARCH_DATA_MODEL)
446
447 if test "x$ARCH_DATA_MODEL" != "x$OPENJDK_TARGET_CPU_BITS"; then
448 AC_MSG_ERROR([The tested number of bits in the target ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
449 fi
450
451 #
452 # NOTE: check for -mstackrealign needs to be below potential addition of -m32
453 #
454 if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
455 # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
456 # While waiting for a better solution, the current workaround is to use -mstackrealign.
457 CFLAGS="$CFLAGS -mstackrealign"
458 AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
459 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
460 [
461 AC_MSG_RESULT([yes])
462 ],
463 [
464 AC_MSG_RESULT([no])
465 AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
466 ])
467 fi
468 ])
469
470 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
471 [
472 ###############################################################################
473 #
474 # Is the target little of big endian?
475 #
476 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
477
478 if test "x$ENDIAN" = xuniversal_endianness; then
479 AC_MSG_ERROR([Building with both big and little endianness is not supported])
480 fi
481 if test "x$ENDIAN" = xunknown; then
482 ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
483 fi
484 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
485 AC_MSG_WARN([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
486 ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
487 fi
488 AC_SUBST(ENDIAN)
489 ])
490
491 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ISADIR],
492 [
493 ###############################################################################
494 #
495 # Could someone enlighten this configure script with a comment about libCrun?
496 #
497 #
498 ])

mercurial