Fix clip mode detection (tested on Itanium II).

This commit is contained in:
Erik de Castro Lopo 2004-02-25 05:31:46 +00:00
parent 0f1a712ecd
commit 2129cf8e6c
3 changed files with 109 additions and 73 deletions

View File

@ -1,7 +1,11 @@
2004-02-24 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* acinclude.m4
Fix clip mode detection (hopefully).
* acinclude.m4 configure.ac
Fix clip mode detection (tested in one of HP's testdrive Itanium II boxes).
* src/file_io.c
Added check for sizeof (off_t) != sizeof (sf_count_t) to prevent recurrence
of missing large file support on Linux and Solaris.
2004-02-19 Erik de Castro Lopo <erikd AT mega-nerd DOT com>

View File

@ -111,6 +111,12 @@ AC_DEFUN(AC_SYS_EXTRA_LARGEFILE,
esac])
fi
])
dnl @synopsis AC_C_FIND_ENDIAN
dnl
dnl Determine endian-ness of target processor.
@ -269,6 +275,10 @@ else
)# AC_C_FIND_ENDIAN
dnl @synopsis AC_C99_FUNC_LRINT
dnl
dnl Check whether C99's lrint function is available.
@ -304,6 +314,11 @@ if test "$ac_cv_c99_lrint" = yes; then
AC_DEFINE(HAVE_LRINT, 1,
[Define if you have C99's lrint function.])
fi
])# AC_C99_FUNC_LRINT
dnl @synopsis AC_C99_FUNC_LRINTF
dnl
@ -341,6 +356,10 @@ if test "$ac_cv_c99_lrintf" = yes; then
[Define if you have C99's lrintf function.])
fi
])# AC_C99_FUNC_LRINTF
dnl @synopsis AC_C99_FUNC_LLRINT
dnl
dnl Check whether C99's llrint function is available.
@ -378,6 +397,9 @@ if test "$ac_cv_c99_llrint" = yes; then
[Define if you have C99's llrint function.])
fi
])# AC_C99_FUNC_LLRINT
dnl @synopsis AC_C_CLIP_MODE
dnl
dnl Determine the clipping mode when converting float to int.
@ -411,21 +433,26 @@ if test $ac_cv_c_clip_positive = unknown ; then
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <stdio.h>
#include <math.h>
int main (void)
{ double fval = 1.0 * 0x7FFFFFFF ;
int k ;
{ double fval ;
int k, ival ;
for (k = 0 ; k < 60 ; k++)
{ if (lrint (fval) < 0)
return 0 ;
fval = 1.0 * 0x7FFFFFFF ;
for (k = 0 ; k < 100 ; k++)
{ ival = (lrint (fval)) >> 24 ;
if (ival != 127)
return 1 ;
fval *= 1.5 ;
fval *= 1.2499999 ;
} ;
return 1 ;
return 0 ;
}
]], , ac_cv_c_clip_positive=yes,
]],
ac_cv_c_clip_positive=yes,
ac_cv_c_clip_positive=no,
ac_cv_c_clip_positive=unknown
)
@ -435,21 +462,26 @@ if test $ac_cv_c_clip_positive = unknown ; then
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <stdio.h>
#include <math.h>
int main (void)
{ double fval = -8.0 * 0x10000000 ;
int k ;
{ double fval ;
int k, ival ;
for (k = 0 ; k < 60 ; k++)
{ if (lrint (fval) > 0)
return 0 ;
fval = -8.0 * 0x10000000 ;
for (k = 0 ; k < 100 ; k++)
{ ival = (lrint (fval)) >> 24 ;
if (ival != -128)
return 1 ;
fval *= 1.5 ;
fval *= 1.2499999 ;
} ;
return 1 ;
return 0 ;
}
]], , ac_cv_c_clip_negative=yes,
]],
ac_cv_c_clip_negative=yes,
ac_cv_c_clip_negative=no,
ac_cv_c_clip_negative=unknown
)
fi

View File

@ -1,7 +1,7 @@
# Copyright (C) 1999-2004 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
dnl Require autoconf version
AC_PREREQ(2.54)
AC_PREREQ(2.53)
AC_INIT(libsndfile,1.0.7,erikd@mega-nerd.com)
AC_CONFIG_SRCDIR([src/sndfile.c])
@ -208,22 +208,6 @@ AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
[Target processor is little endian.])
#====================================================================================
# Determine if the processor can do clipping on float to int conversions.
if test x$ac_arg_cpu_clip = "xY" ; then
AC_C_CLIP_MODE
else
echo "checking processor clipping capabilities... disabled"
ac_cv_c_clip_positive=0
ac_cv_c_clip_negative=0
fi
AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
[Target processor clips on positive float to int conversion.])
AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
[Target processor clips on negative float to int conversion.])
#====================================================================================
# Check for functions.
@ -252,6 +236,22 @@ case "$target_os" in
;;
esac
#====================================================================================
# Determine if the processor can do clipping on float to int conversions.
if test x$ac_arg_cpu_clip = "xY" ; then
AC_C_CLIP_MODE
else
echo "checking processor clipping capabilities... disabled"
ac_cv_c_clip_positive=0
ac_cv_c_clip_negative=0
fi
AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
[Target processor clips on positive float to int conversion.])
AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
[Target processor clips on negative float to int conversion.])
#====================================================================================
# Target OS specific stuff.