Teach ECL to detect the size of 'int' and 'long'

This commit is contained in:
Juan Jose Garcia Ripoll 2009-07-15 15:18:34 +02:00
parent bfb6e2cef7
commit bae4afc9c3
3 changed files with 42 additions and 4 deletions

21
src/aclocal.m4 vendored
View file

@ -605,6 +605,8 @@ AC_SUBST(CL_FIXNUM_TYPE)
AC_SUBST(CL_FIXNUM_BITS)
AC_SUBST(CL_FIXNUM_MAX)
AC_SUBST(CL_FIXNUM_MIN)
AC_SUBST(CL_INT_BITS)
AC_SUBST(CL_LONG_BITS)
AC_MSG_CHECKING(appropiate type for fixnums)
if test -z "${CL_FIXNUM_TYPE}" ; then
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
@ -641,10 +643,25 @@ int main() {
fprintf(f,"CL_FIXNUM_MIN='%ld';",l);
fprintf(f,"CL_FIXNUM_MAX='%ld';",-l);
#endif
} else
} else {
exit(1);
}
fprintf(f,"CL_FIXNUM_TYPE='%s';",int_type);
fprintf(f,"CL_FIXNUM_BITS='%d'",bits);
fprintf(f,"CL_FIXNUM_BITS='%d';",bits);
{
unsigned int x = 1;
for (bits = 0; x; bits++) {
x <<= 1;
}
fprintf(f,"CL_INT_BITS='%d';",bits);
}
{
unsigned long x = 1;
for (bits = 0; x; bits++) {
x <<= 1;
}
fprintf(f,"CL_LONG_BITS='%d'",bits);
}
exit(0);
}]])],[eval "`cat conftestval`"],[],[])
fi

23
src/configure vendored
View file

@ -648,6 +648,8 @@ ECL_FILE_CNT
ECL_LONGJMP
ECL_SETJMP
ECL_STDINT_HEADER
CL_LONG_BITS
CL_INT_BITS
CL_FIXNUM_MIN
CL_FIXNUM_MAX
CL_FIXNUM_BITS
@ -8023,6 +8025,8 @@ _ACEOF
{ $as_echo "$as_me:$LINENO: checking appropiate type for fixnums" >&5
$as_echo_n "checking appropiate type for fixnums... " >&6; }
if test -z "${CL_FIXNUM_TYPE}" ; then
@ -8075,10 +8079,25 @@ int main() {
fprintf(f,"CL_FIXNUM_MIN='%ld';",l);
fprintf(f,"CL_FIXNUM_MAX='%ld';",-l);
#endif
} else
} else {
exit(1);
}
fprintf(f,"CL_FIXNUM_TYPE='%s';",int_type);
fprintf(f,"CL_FIXNUM_BITS='%d'",bits);
fprintf(f,"CL_FIXNUM_BITS='%d';",bits);
{
unsigned int x = 1;
for (bits = 0; x; bits++) {
x <<= 1;
}
fprintf(f,"CL_INT_BITS='%d';",bits);
}
{
unsigned long x = 1;
for (bits = 0; x; bits++) {
x <<= 1;
}
fprintf(f,"CL_LONG_BITS='%d'",bits);
}
exit(0);
}
_ACEOF

View file

@ -123,6 +123,8 @@
* but the required headers are not present in all systems. Hence we
* use autoconf to guess the following values.
*/
#define ECL_INT_BITS @CL_INT_BITS@
#define ECL_LONG_BITS @CL_LONG_BITS@
#define FIXNUM_BITS @CL_FIXNUM_BITS@
#define MOST_POSITIVE_FIXNUM ((cl_fixnum)@CL_FIXNUM_MAX@)
#define MOST_NEGATIVE_FIXNUM ((cl_fixnum)@CL_FIXNUM_MIN@)