1.1 --- a/common/autoconf/platform.m4 Thu Sep 05 10:58:25 2013 -0700 1.2 +++ b/common/autoconf/platform.m4 Thu Sep 12 12:29:17 2013 -0700 1.3 @@ -114,6 +114,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 @@ -412,16 +417,17 @@ 1.16 [ 1.17 # keep track of c/cxx flags that we added outselves... 1.18 # to prevent emitting warning... 1.19 - TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" 1.20 - AC_SUBST(TARGET_BITS_FLAG) 1.21 + ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 1.22 + ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 1.23 + ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 1.24 1.25 - CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}" 1.26 - CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}" 1.27 - LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}" 1.28 + CFLAGS="${CFLAGS}${ADDED_CFLAGS}" 1.29 + CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" 1.30 + LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" 1.31 1.32 - CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}" 1.33 - CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}" 1.34 - LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}" 1.35 + CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" 1.36 + CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" 1.37 + LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" 1.38 ]) 1.39 1.40 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], 1.41 @@ -433,8 +439,9 @@ 1.42 # is made at runtime.) 1.43 # 1.44 1.45 -if test "x$OPENJDK_TARGET_OS" = xsolaris; then 1.46 - # Always specify -m flags on Solaris 1.47 +if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then 1.48 + # Always specify -m flag on Solaris 1.49 + # And -q on AIX because otherwise the compiler produces 32-bit objects by default 1.50 PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 1.51 elif test "x$COMPILE_TYPE" = xreduced; then 1.52 if test "x$OPENJDK_TARGET_OS" != xwindows; then 1.53 @@ -456,19 +463,34 @@ 1.54 1.55 AC_CHECK_SIZEOF([int *], [1111]) 1.56 1.57 -if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then 1.58 - # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html 1.59 - SIZEOF_INT_P="$ac_cv_sizeof_int_p" 1.60 -fi 1.61 - 1.62 -if test "x$SIZEOF_INT_P" = x; then 1.63 +# AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*' 1.64 +if test "x$ac_cv_sizeof_int_p" = x; then 1.65 # The test failed, lets stick to the assumed value. 1.66 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 1.67 else 1.68 - TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` 1.69 + TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 1.70 1.71 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 1.72 - 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.73 + # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects 1.74 + # Let's try to implicitely set the compilers target architecture and retry the test 1.75 + 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.76 + AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}]) 1.77 + PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 1.78 + 1.79 + # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value! 1.80 + unset ac_cv_sizeof_int_p 1.81 + # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF 1.82 + cat >>confdefs.h <<_ACEOF 1.83 +#undef SIZEOF_INT_P 1.84 +_ACEOF 1.85 + 1.86 + AC_CHECK_SIZEOF([int *], [1111]) 1.87 + 1.88 + TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 1.89 + 1.90 + if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 1.91 + 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.92 + fi 1.93 fi 1.94 fi 1.95