+ case "${host}" in
+ sparc*-*-solaris*)
+ # 1. try -m64
+ CFLAGS="${CFLAGS} -m64"
+ CXXFLAGS="${CXXFLAGS} -m64"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
+ if test "$CAN_BUILD_64" != yes; then
+ # Nope. back out changes.
+ CFLAGS="${CFLAGS_OLD}"
+ CXXFLAGS="${CFLAGS_OLD}"
+ # 2. try xarch=v9 [deprecated]
+ ## TODO: cross compile: the following won't work.
+ SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
+ SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
+ # "Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs"
+ if test -z "$SOL64" && test -n "$SPARCV9"; then
+ CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
+ CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9"
+ LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9"
+ CAN_BUILD_64=yes
+ fi
+ fi
+ ;;
+ i386-*-solaris*)
+ # 1. try -m64
+ CFLAGS="${CFLAGS} -m64"
+ CXXFLAGS="${CXXFLAGS} -m64"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
+ if test "$CAN_BUILD_64" != yes; then
+ # Nope. back out changes.
+ CFLAGS="${CFLAGS_OLD}"
+ CXXFLAGS="${CXXFLAGS_OLD}"
+ # 2. try the older compiler option
+ ## TODO: cross compile problem
+ AMD64=`isainfo -n 2>&1 | grep amd64`
+ SOL64=`$CXX -xtarget=generic64 2>&1 && $CC -xtarget=generic64 2>&1 | grep -v usage:`
+ if test -z "$SOL64" && test -n "$AMD64"; then
+ CFLAGS="${CFLAGS} -xtarget=generic64"
+ CXXFLAGS="${CXXFLAGS} -xtarget=generic64"
+ CAN_BUILD_64=yes
+ fi
+ fi
+ ;;
+ ia64-*-linux*)
+ # check for ecc/ecpc compiler support
+ ## TODO: cross compiler problem
+ if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then
+ if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then
+ CAN_BUILD_64=yes
+ fi
+ fi
+ ;;
+ *-*-cygwin)
+ # vcvarsamd64.bat should have been used to enable 64-bit builds.
+ # We only do this check to display the correct answer.
+ ## TODO: cross compiler problem
+ if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then
+ CAN_BUILD_64=yes
+ fi
+ ;;
+ *-*-aix*|powerpc64-*-linux*)
+ CFLAGS="${CFLAGS} -q64"
+ CXXFLAGS="${CXXFLAGS} -q64"
+ LDFLAGS="${LDFLAGS} -q64"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no)
+ if test "$CAN_BUILD_64" = yes; then
+ # worked- set other options.
+ case "${host}" in
+ *-*-aix*)
+ # tell AIX what executable mode to use.
+ ARFLAGS="${ARFLAGS} -X64"
+ esac
+ fi
+ ;;
+ *-*-hpux*)
+ # First we try the newer +DD64, if that doesn't work,
+ # try other options.
+
+ CFLAGS="${CFLAGS} +DD64"
+ CXXFLAGS="${CXXFLAGS} +DD64"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no)
+ if test "$CAN_BUILD_64" != yes; then
+ # reset
+ CFLAGS="${CFLAGS_OLD}"
+ CXXFLAGS="${CXXFLAGS_OLD}"
+ # append
+ CFLAGS="${CFLAGS} +DA2.0W"
+ CXXFLAGS="${CXXFLAGS} +DA2.0W"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no)
+ fi
+ ;;
+ *-*ibm-openedition*|*-*-os390*)
+ CFLAGS="${CFLAGS} -Wc,lp64"
+ CXXFLAGS="${CXXFLAGS} -Wc,lp64"
+ LDFLAGS="${LDFLAGS} -Wl,lp64"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
+ CAN_BUILD_64=yes, CAN_BUILD_64=no)
+ ;;
+ *)
+ # unknown platform.
+ ;;
+ esac