common/autoconf/platform.m4

changeset 1028
feeb67be5886
parent 972
f3697e0783e2
child 985
d904a8b799d4
     1.1 --- a/common/autoconf/platform.m4	Mon Mar 31 14:06:57 2014 -0700
     1.2 +++ b/common/autoconf/platform.m4	Wed Apr 02 10:01:38 2014 -0700
     1.3 @@ -126,6 +126,11 @@
     1.4        VAR_OS_API=winapi
     1.5        VAR_OS_ENV=windows.msys
     1.6        ;;
     1.7 +    *aix*)
     1.8 +      VAR_OS=aix
     1.9 +      VAR_OS_API=posix
    1.10 +      VAR_OS_ENV=aix
    1.11 +      ;;
    1.12      *)
    1.13        AC_MSG_ERROR([unsupported operating system $1])
    1.14        ;;
    1.15 @@ -432,9 +437,9 @@
    1.16    # keep track of these additions in ADDED_CFLAGS etc. These
    1.17    # will later be checked to make sure only controlled additions
    1.18    # have been made to CFLAGS etc.
    1.19 -  ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
    1.20 -  ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
    1.21 -  ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
    1.22 +  ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
    1.23 +  ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
    1.24 +  ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
    1.25  
    1.26    CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
    1.27    CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
    1.28 @@ -454,8 +459,9 @@
    1.29    # is made at runtime.)
    1.30    #
    1.31  
    1.32 -  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    1.33 -    # Always specify -m flags on Solaris
    1.34 +  if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
    1.35 +    # Always specify -m flag on Solaris
    1.36 +    # And -q on AIX because otherwise the compiler produces 32-bit objects by default
    1.37      PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
    1.38    elif test "x$COMPILE_TYPE" = xreduced; then
    1.39      if test "x$OPENJDK_TARGET_OS" != xwindows; then
    1.40 @@ -477,19 +483,34 @@
    1.41  
    1.42    AC_CHECK_SIZEOF([int *], [1111])
    1.43  
    1.44 -  if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then
    1.45 -    # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html
    1.46 -    SIZEOF_INT_P="$ac_cv_sizeof_int_p"
    1.47 -  fi
    1.48 -
    1.49 -  if test "x$SIZEOF_INT_P" = x; then
    1.50 +  # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
    1.51 +  if test "x$ac_cv_sizeof_int_p" = x; then
    1.52      # The test failed, lets stick to the assumed value.
    1.53      AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
    1.54    else
    1.55 -    TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P`
    1.56 +    TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
    1.57  
    1.58      if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
    1.59 -      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)])
    1.60 +      # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
    1.61 +      # Let's try to implicitely set the compilers target architecture and retry the test
    1.62 +      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).])
    1.63 +      AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
    1.64 +      PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
    1.65 +
    1.66 +      # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
    1.67 +      unset ac_cv_sizeof_int_p
    1.68 +      # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
    1.69 +      cat >>confdefs.h <<_ACEOF
    1.70 +#undef SIZEOF_INT_P
    1.71 +_ACEOF
    1.72 +
    1.73 +      AC_CHECK_SIZEOF([int *], [1111])
    1.74 +
    1.75 +      TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
    1.76 +
    1.77 +      if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
    1.78 +        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)])
    1.79 +      fi
    1.80      fi
    1.81    fi
    1.82  

mercurial