common/autoconf/platform.m4

changeset 971
584dc2e95e04
parent 766
4fb877dfe5c4
child 972
f3697e0783e2
equal deleted inserted replaced
970:e885c762cedd 971:584dc2e95e04
112 *mingw*) 112 *mingw*)
113 VAR_OS=windows 113 VAR_OS=windows
114 VAR_OS_API=winapi 114 VAR_OS_API=winapi
115 VAR_OS_ENV=windows.msys 115 VAR_OS_ENV=windows.msys
116 ;; 116 ;;
117 *aix*)
118 VAR_OS=aix
119 VAR_OS_API=posix
120 VAR_OS_ENV=aix
121 ;;
117 *) 122 *)
118 AC_MSG_ERROR([unsupported operating system $1]) 123 AC_MSG_ERROR([unsupported operating system $1])
119 ;; 124 ;;
120 esac 125 esac
121 ]) 126 ])
410 # Add -mX to various FLAGS variables. 415 # Add -mX to various FLAGS variables.
411 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], 416 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
412 [ 417 [
413 # keep track of c/cxx flags that we added outselves... 418 # keep track of c/cxx flags that we added outselves...
414 # to prevent emitting warning... 419 # to prevent emitting warning...
415 TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" 420 ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
416 AC_SUBST(TARGET_BITS_FLAG) 421 ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
417 422 ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
418 CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}" 423
419 CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}" 424 CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
420 LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}" 425 CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
421 426 LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
422 CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}" 427
423 CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}" 428 CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
424 LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}" 429 CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
430 LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
425 ]) 431 ])
426 432
427 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], 433 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
428 [ 434 [
429 ############################################################################### 435 ###############################################################################
431 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 437 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
432 # (The JVM can use 32 or 64 bit Java pointers but that decision 438 # (The JVM can use 32 or 64 bit Java pointers but that decision
433 # is made at runtime.) 439 # is made at runtime.)
434 # 440 #
435 441
436 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 442 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
437 # Always specify -m flags on Solaris 443 # Always specify -m flag on Solaris
444 # And -q on AIX because otherwise the compiler produces 32-bit objects by default
438 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 445 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
439 elif test "x$COMPILE_TYPE" = xreduced; then 446 elif test "x$COMPILE_TYPE" = xreduced; then
440 if test "x$OPENJDK_TARGET_OS" != xwindows; then 447 if test "x$OPENJDK_TARGET_OS" != xwindows; then
441 # Specify -m if running reduced on other Posix platforms 448 # Specify -m if running reduced on other Posix platforms
442 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 449 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
454 AC_MSG_ERROR([Cannot continue.]) 461 AC_MSG_ERROR([Cannot continue.])
455 ]) 462 ])
456 463
457 AC_CHECK_SIZEOF([int *], [1111]) 464 AC_CHECK_SIZEOF([int *], [1111])
458 465
459 if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then 466 # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
460 # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html 467 if test "x$ac_cv_sizeof_int_p" = x; then
461 SIZEOF_INT_P="$ac_cv_sizeof_int_p"
462 fi
463
464 if test "x$SIZEOF_INT_P" = x; then
465 # The test failed, lets stick to the assumed value. 468 # The test failed, lets stick to the assumed value.
466 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 469 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
467 else 470 else
468 TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` 471 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
469 472
470 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 473 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
471 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)]) 474 # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
475 # Let's try to implicitely set the compilers target architecture and retry the test
476 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).])
477 AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
478 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
479
480 # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
481 unset ac_cv_sizeof_int_p
482 # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
483 cat >>confdefs.h <<_ACEOF
484 #undef SIZEOF_INT_P
485 _ACEOF
486
487 AC_CHECK_SIZEOF([int *], [1111])
488
489 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
490
491 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)])
493 fi
472 fi 494 fi
473 fi 495 fi
474 496
475 AC_MSG_CHECKING([for target address size]) 497 AC_MSG_CHECKING([for target address size])
476 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) 498 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])

mercurial