Permalink
Browse files

use {wordsize, external} in configure script

To properly check to see whether the Erlang emulator is 32-bit or
64-bit in the configure script, call erlang:system_info with the
argument {wordsize, external} instead of just wordsize. The latter
reveals only the internal word size, which happened to work previously
(and is the only option for older versions of Erlang) but doesn't work
for halfword emulators. Fallback to an argument of just wordsize for
older versions of Erlang.
  • Loading branch information...
1 parent d12607c commit 11b272b0c163b2f60ed0df592868cd7aa44fd66a @vinoski vinoski committed May 31, 2011
Showing with 12 additions and 4 deletions.
  1. +12 −4 configure.in
View
@@ -204,8 +204,12 @@ case "$host_os" in
AC_LANG(Erlang)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[dnl
- halt(case erlang:system_info(wordsize) of
- 8 -> 0; 4 -> 1 end)])],
+ halt(try erlang:system_info({wordsize,external}) of
+ 8 -> 0; 4 -> 1
+ catch _:badarg ->
+ case erlang:system_info(wordsize) of
+ 8 -> 0; 4 -> 1
+ end end)])],
[AC_MSG_NOTICE(found 64-bit Erlang)
case "$host_cpu" in
x86_64) CBIT= ;;
@@ -259,8 +263,12 @@ case "$host_os" in
AC_LANG(Erlang)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[dnl
- halt(case erlang:system_info(wordsize) of
- 8 -> 0; 4 -> 1 end)])],
+ halt(try erlang:system_info({wordsize,external}) of
+ 8 -> 0; 4 -> 1
+ catch _:badarg ->
+ case erlang:system_info(wordsize) of
+ 8 -> 0; 4 -> 1
+ end end)])],
[AC_MSG_NOTICE(found 64-bit Erlang)
CBIT=-m64],
[AC_MSG_NOTICE(found 32-bit Erlang)

0 comments on commit 11b272b

Please sign in to comment.