common/autoconf/platform.m4

changeset 1028
feeb67be5886
parent 972
f3697e0783e2
child 985
d904a8b799d4
equal deleted inserted replaced
1027:065b9ded4bf2 1028:feeb67be5886
123 ;; 123 ;;
124 *mingw*) 124 *mingw*)
125 VAR_OS=windows 125 VAR_OS=windows
126 VAR_OS_API=winapi 126 VAR_OS_API=winapi
127 VAR_OS_ENV=windows.msys 127 VAR_OS_ENV=windows.msys
128 ;;
129 *aix*)
130 VAR_OS=aix
131 VAR_OS_API=posix
132 VAR_OS_ENV=aix
128 ;; 133 ;;
129 *) 134 *)
130 AC_MSG_ERROR([unsupported operating system $1]) 135 AC_MSG_ERROR([unsupported operating system $1])
131 ;; 136 ;;
132 esac 137 esac
430 [ 435 [
431 # When we add flags to the "official" CFLAGS etc, we need to 436 # When we add flags to the "official" CFLAGS etc, we need to
432 # keep track of these additions in ADDED_CFLAGS etc. These 437 # keep track of these additions in ADDED_CFLAGS etc. These
433 # will later be checked to make sure only controlled additions 438 # will later be checked to make sure only controlled additions
434 # have been made to CFLAGS etc. 439 # have been made to CFLAGS etc.
435 ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 440 ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
436 ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 441 ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
437 ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 442 ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
438 443
439 CFLAGS="${CFLAGS}${ADDED_CFLAGS}" 444 CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
440 CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" 445 CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
441 LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" 446 LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
442 447
452 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 457 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
453 # (The JVM can use 32 or 64 bit Java pointers but that decision 458 # (The JVM can use 32 or 64 bit Java pointers but that decision
454 # is made at runtime.) 459 # is made at runtime.)
455 # 460 #
456 461
457 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 462 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
458 # Always specify -m flags on Solaris 463 # Always specify -m flag on Solaris
464 # And -q on AIX because otherwise the compiler produces 32-bit objects by default
459 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 465 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
460 elif test "x$COMPILE_TYPE" = xreduced; then 466 elif test "x$COMPILE_TYPE" = xreduced; then
461 if test "x$OPENJDK_TARGET_OS" != xwindows; then 467 if test "x$OPENJDK_TARGET_OS" != xwindows; then
462 # Specify -m if running reduced on other Posix platforms 468 # Specify -m if running reduced on other Posix platforms
463 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 469 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
475 AC_MSG_ERROR([Cannot continue.]) 481 AC_MSG_ERROR([Cannot continue.])
476 ]) 482 ])
477 483
478 AC_CHECK_SIZEOF([int *], [1111]) 484 AC_CHECK_SIZEOF([int *], [1111])
479 485
480 if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then 486 # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
481 # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html 487 if test "x$ac_cv_sizeof_int_p" = x; then
482 SIZEOF_INT_P="$ac_cv_sizeof_int_p"
483 fi
484
485 if test "x$SIZEOF_INT_P" = x; then
486 # The test failed, lets stick to the assumed value. 488 # The test failed, lets stick to the assumed value.
487 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 489 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
488 else 490 else
489 TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` 491 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
490 492
491 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 493 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
492 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)]) 494 # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
495 # Let's try to implicitely set the compilers target architecture and retry the test
496 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).])
497 AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
498 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
499
500 # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
501 unset ac_cv_sizeof_int_p
502 # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
503 cat >>confdefs.h <<_ACEOF
504 #undef SIZEOF_INT_P
505 _ACEOF
506
507 AC_CHECK_SIZEOF([int *], [1111])
508
509 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
510
511 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
512 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)])
513 fi
493 fi 514 fi
494 fi 515 fi
495 516
496 AC_MSG_CHECKING([for target address size]) 517 AC_MSG_CHECKING([for target address size])
497 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) 518 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])

mercurial