- [ --enable-64bit-libs build 64-bit libraries [default=yes]],
- [ENABLE_64BIT_LIBS=${enableval}],
- [ENABLE_64BIT_LIBS=yes]
- )
- dnl These results can't be cached because is sets compiler flags.
- AC_MSG_CHECKING([for 64-bit executable support])
- if test "$ENABLE_64BIT_LIBS" != no; then
- if test "$GCC" = yes; then
- dnl First we check that gcc already compiles as 64-bit
- if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
- ENABLE_64BIT_LIBS=yes
- else
- dnl Now we check a little more forcefully.
- dnl Maybe the compiler builds as 32-bit on a 64-bit machine.
- OLD_CFLAGS="${CFLAGS}"
- OLD_CXXFLAGS="${CXXFLAGS}"
+ [ --enable-64bit-libs (deprecated, use --with-library-bits) build 64-bit libraries [default= platform default]],
+ [echo "note, use --with-library-bits instead of --*-64bit-libs"
+ case "${enableval}" in
+ no|false|32) with_library_bits=32; ;;
+ yes|true|64) with_library_bits=64else32 ;;
+ nochange) with_library_bits=nochange; ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for '--*-64bit-libs') ;;
+ esac] )
+
+
+ AC_ARG_WITH(library-bits,
+ [ --with-library-bits=bits specify how many bits to use for the library (32, 64, 64else32, nochange) [default=nochange]],
+ [case "${withval}" in
+ ""|nochange) BITS_REQ=$withval ;;
+ 32|64|64else32) BITS_REQ=$withval ;;
+ *) AC_MSG_ERROR(bad value ${withval} for --with-library-bits) ;;
+ esac])
+
+ # don't use these for cross compiling
+ if test "$cross_compiling" = "yes" -a "${BITS_REQ}" != "nochange"; then
+ AC_MSG_ERROR([Don't specify bitness when cross compiling. See readme.html for help with cross compilation., and set compiler options manually.])
+ fi
+ AC_CHECK_SIZEOF([void *])
+ AC_MSG_CHECKING([whether runnable 64 bit binaries are built by default])
+ case $ac_cv_sizeof_void_p in
+ 8) DEFAULT_64BIT=yes ;;
+ 4) DEFAULT_64BIT=no ;;
+ *) DEFAULT_64BIT=unknown
+ esac
+ BITS_GOT=unknown
+
+ # 'OK' here means, we can exit any further checking, everything's copa
+ BITS_OK=yes
+
+ # do we need to check for buildable/runnable 32 or 64 bit?
+ BITS_CHECK_32=no
+ BITS_CHECK_64=no
+
+ # later, can we run the 32/64 bit binaries so made?
+ BITS_RUN_32=no
+ BITS_RUN_64=no
+
+ if test "$DEFAULT_64BIT" = "yes"; then
+ # we get 64 bits by default.
+ BITS_GOT=64
+ case "$BITS_REQ" in
+ 32)
+ # need to look for 32 bit support.
+ BITS_CHECK_32=yes
+ # not copa.
+ BITS_OK=no;;
+ # everyone else is happy.
+ nochange) ;;
+ *) ;;
+ esac
+ elif test "$DEFAULT_64BIT" = "no"; then
+ # not 64 bit by default.
+ BITS_GOT=32
+ case "$BITS_REQ" in
+ 64|64else32)
+ BITS_CHECK_64=yes
+ #BITS_CHECK_32=yes
+ BITS_OK=no;;
+ nochange) ;;
+ *) ;;
+ esac
+ elif test "$DEFAULT_64BIT" = "unknown"; then
+ # cross compiling.
+ BITS_GOT=unknown
+ case "$BITS_REQ" in
+ 64|64else32) BITS_OK=no
+ BITS_CHECK_32=yes
+ BITS_CHECK_64=yes ;;
+ 32) BITS_OK=no;;
+ nochange) ;;
+ *) ;;
+ esac
+ fi
+
+ AC_MSG_RESULT($DEFAULT_64BIT);
+
+ if test "$BITS_OK" != "yes"; then
+ # not copa. back these up.
+ CFLAGS_OLD="${CFLAGS}"
+ CXXFLAGS_OLD="${CXXFLAGS}"
+ LDFLAGS_OLD="${LDFLAGS}"
+ ARFLAGS_OLD="${ARFLAGS}"
+
+ CFLAGS_32="${CFLAGS}"
+ CXXFLAGS_32="${CXXFLAGS}"
+ LDFLAGS_32="${LDFLAGS}"
+ ARFLAGS_32="${ARFLAGS}"
+
+ CFLAGS_64="${CFLAGS}"
+ CXXFLAGS_64="${CXXFLAGS}"
+ LDFLAGS_64="${LDFLAGS}"
+ ARFLAGS_64="${ARFLAGS}"
+
+ CAN_BUILD_64=unknown
+ CAN_BUILD_32=unknown
+ # These results can't be cached because is sets compiler flags.
+ if test "$BITS_CHECK_64" = "yes"; then
+ AC_MSG_CHECKING([how to build 64-bit executables])
+ CAN_BUILD_64=no
+ ####
+ # Find out if we think we can *build* for 64 bit. Doesn't check whether we can run it.
+ # Note, we don't have to actually check if the options work- we'll try them before using them.
+ # So, only try actually testing the options, if you are trying to decide between multiple options.
+ # On exit from the following clauses:
+ # if CAN_BUILD_64=yes:
+ # *FLAGS are assumed to contain the right settings for 64bit
+ # else if CAN_BUILD_64=no: (default)
+ # *FLAGS are assumed to be trashed, and will be reset from *FLAGS_OLD
+
+ if test "$GCC" = yes; then