common/autoconf/platform.m4

Print this page
rev 769 : 8024265: Enable new build on AIX
Reviewed-by: ihse


  97     *darwin*)
  98       VAR_OS=macosx
  99       VAR_OS_API=posix
 100       VAR_OS_ENV=macosx
 101       ;;
 102     *bsd*)
 103       VAR_OS=bsd
 104       VAR_OS_API=posix
 105       VAR_OS_ENV=bsd
 106       ;;
 107     *cygwin*)
 108       VAR_OS=windows
 109       VAR_OS_API=winapi
 110       VAR_OS_ENV=windows.cygwin
 111       ;;
 112     *mingw*)
 113       VAR_OS=windows
 114       VAR_OS_API=winapi
 115       VAR_OS_ENV=windows.msys
 116       ;;





 117     *)
 118       AC_MSG_ERROR([unsupported operating system $1])
 119       ;;
 120   esac
 121 ])
 122 
 123 # Expects $host_os $host_cpu $build_os and $build_cpu
 124 # and $with_target_bits to have been setup!
 125 #
 126 # Translate the standard triplet(quadruplet) definition
 127 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
 128 # OPENJDK_BUILD_OS, etc.
 129 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
 130 [
 131     # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
 132     # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
 133     # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
 134     # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.     
 135     OPENJDK_TARGET_AUTOCONF_NAME="$host"
 136     OPENJDK_BUILD_AUTOCONF_NAME="$build"


 393 
 394 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
 395 [
 396 ###############################################################################
 397 
 398 # Note that this is the build platform OS version!
 399 
 400 OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
 401 OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
 402 OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
 403 OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
 404 AC_SUBST(OS_VERSION_MAJOR)
 405 AC_SUBST(OS_VERSION_MINOR)
 406 AC_SUBST(OS_VERSION_MICRO)
 407 ])
 408 
 409 # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
 410 # Add -mX to various FLAGS variables.
 411 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
 412 [
 413   # keep track of c/cxx flags that we added outselves...
 414   #   to prevent emitting warning...
 415   ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
 416   ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
 417   ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
 418 
 419   CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
 420   CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
 421   LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
 422 
 423   CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
 424   CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
 425   LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
 426 ])
 427 
 428 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
 429 [
 430 ###############################################################################
 431 #
 432 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
 433 # (The JVM can use 32 or 64 bit Java pointers but that decision
 434 # is made at runtime.)
 435 #
 436 
 437 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 438   # Always specify -m flags on Solaris

 439   PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
 440 elif test "x$COMPILE_TYPE" = xreduced; then
 441   if test "x$OPENJDK_TARGET_OS" != xwindows; then
 442     # Specify -m if running reduced on other Posix platforms
 443     PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
 444   fi
 445 fi
 446 
 447 # Make compilation sanity check
 448 AC_CHECK_HEADERS([stdio.h], , [
 449   AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
 450   if test "x$COMPILE_TYPE" = xreduced; then
 451     AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.])
 452   elif test "x$COMPILE_TYPE" = xcross; then
 453     AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
 454   fi
 455   AC_MSG_ERROR([Cannot continue.])
 456 ])
 457 
 458 AC_CHECK_SIZEOF([int *], [1111])
 459 
 460 if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then
 461   # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html
 462   SIZEOF_INT_P="$ac_cv_sizeof_int_p"
 463 fi
 464 
 465 if test "x$SIZEOF_INT_P" = x; then 
 466     # The test failed, lets stick to the assumed value.
 467     AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
 468 else
 469     TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P`


















 470 
 471     if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
 472         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)])

 473     fi
 474 fi
 475 
 476 AC_MSG_CHECKING([for target address size])
 477 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
 478 ])
 479 
 480 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
 481 [
 482 ###############################################################################
 483 #
 484 # Is the target little of big endian?
 485 #
 486 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
 487 
 488 if test "x$ENDIAN" = xuniversal_endianness; then
 489     AC_MSG_ERROR([Building with both big and little endianness is not supported])
 490 fi
 491 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
 492     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)])


  97     *darwin*)
  98       VAR_OS=macosx
  99       VAR_OS_API=posix
 100       VAR_OS_ENV=macosx
 101       ;;
 102     *bsd*)
 103       VAR_OS=bsd
 104       VAR_OS_API=posix
 105       VAR_OS_ENV=bsd
 106       ;;
 107     *cygwin*)
 108       VAR_OS=windows
 109       VAR_OS_API=winapi
 110       VAR_OS_ENV=windows.cygwin
 111       ;;
 112     *mingw*)
 113       VAR_OS=windows
 114       VAR_OS_API=winapi
 115       VAR_OS_ENV=windows.msys
 116       ;;
 117     *aix*)
 118       VAR_OS=aix
 119       VAR_OS_API=posix
 120       VAR_OS_ENV=aix
 121       ;;
 122     *)
 123       AC_MSG_ERROR([unsupported operating system $1])
 124       ;;
 125   esac
 126 ])
 127 
 128 # Expects $host_os $host_cpu $build_os and $build_cpu
 129 # and $with_target_bits to have been setup!
 130 #
 131 # Translate the standard triplet(quadruplet) definition
 132 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
 133 # OPENJDK_BUILD_OS, etc.
 134 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
 135 [
 136     # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
 137     # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
 138     # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
 139     # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.     
 140     OPENJDK_TARGET_AUTOCONF_NAME="$host"
 141     OPENJDK_BUILD_AUTOCONF_NAME="$build"


 398 
 399 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
 400 [
 401 ###############################################################################
 402 
 403 # Note that this is the build platform OS version!
 404 
 405 OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
 406 OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
 407 OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
 408 OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
 409 AC_SUBST(OS_VERSION_MAJOR)
 410 AC_SUBST(OS_VERSION_MINOR)
 411 AC_SUBST(OS_VERSION_MICRO)
 412 ])
 413 
 414 # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
 415 # Add -mX to various FLAGS variables.
 416 AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
 417 [
 418 
 419   ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
 420   ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
 421   ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"

 422 
 423   CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
 424   CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
 425   LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
 426 
 427   CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
 428   CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
 429   LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
 430 ])
 431 
 432 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
 433 [
 434 ###############################################################################
 435 #
 436 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
 437 # (The JVM can use 32 or 64 bit Java pointers but that decision
 438 # is made at runtime.)
 439 #
 440 
 441 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
 442   # Always specify -m flag on Solaris
 443   # And -q on AIX because otherwise the compiler produces 32-bit objects by default
 444   PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
 445 elif test "x$COMPILE_TYPE" = xreduced; then
 446   if test "x$OPENJDK_TARGET_OS" != xwindows; then
 447     # Specify -m if running reduced on other Posix platforms
 448     PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
 449   fi
 450 fi
 451 
 452 # Make compilation sanity check
 453 AC_CHECK_HEADERS([stdio.h], , [
 454   AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
 455   if test "x$COMPILE_TYPE" = xreduced; then
 456     AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.])
 457   elif test "x$COMPILE_TYPE" = xcross; then
 458     AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
 459   fi
 460   AC_MSG_ERROR([Cannot continue.])
 461 ])
 462 
 463 AC_CHECK_SIZEOF([int *], [1111])
 464 
 465 # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
 466 if test "x$ac_cv_sizeof_int_p" = x; then




 467     # The test failed, lets stick to the assumed value.
 468     AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
 469 else
 470     TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
 471 
 472     if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
 473         # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
 474         # Let's try to implicitely set the compilers target architecture and retry the test
 475         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).])
 476         AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
 477         PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
 478 
 479         # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
 480         unset ac_cv_sizeof_int_p
 481         # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
 482         cat >>confdefs.h <<_ACEOF
 483 #undef SIZEOF_INT_P
 484 _ACEOF
 485 
 486         AC_CHECK_SIZEOF([int *], [1111])
 487 
 488         TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
 489 
 490         if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
 491             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)])
 492         fi
 493     fi
 494 fi
 495 
 496 AC_MSG_CHECKING([for target address size])
 497 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
 498 ])
 499 
 500 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
 501 [
 502 ###############################################################################
 503 #
 504 # Is the target little of big endian?
 505 #
 506 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
 507 
 508 if test "x$ENDIAN" = xuniversal_endianness; then
 509     AC_MSG_ERROR([Building with both big and little endianness is not supported])
 510 fi
 511 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
 512     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)])